Skip to content

Decimal separator inconsistency (MarkupMatches) causes test failure when pushed to Azure #1011

Closed

Description

@BenjoWatcher

The bug is related to a difference in decimal separators between the local environment and Azure. When running a test that expects a comma as a decimal separator, the test fails when pushed to Azure, which requires a point as the decimal separator. This causes the test to produce an error message indicating a difference near ".4" in the expected value "5,4". To reproduce this issue, follow these steps:

  1. Run the test locally and ensure that it passes.
  2. Push the test to Azure and run it.
  3. Observe that the test fails with an error message indicating a difference near ".4" in the expected value "5,4".

Example:

    [Test]
    public void ComponentShouldGetDropSequence()
    {
        // Act
       var component = RenderComponent<FwdBlazorApp.Pages.DataViewer.DataViewer> 
       (parameters=>parameters.AddCascadingValue(RenderComponent<MainLayout>().Instance));
        
        // Assert
        component.FindAll("td")[0].TextContent.MarkupMatches("5,4");
        component.FindAll("td")[1].TextContent.MarkupMatches("43,3");
        component.FindAll("td")[2].TextContent.MarkupMatches("50,4");
        component.FindAll("td")[3].TextContent.MarkupMatches("32,08");
    }

Component under test

    <RowTemplate>
        <MudTd DataLabel="Station">5,4</MudTd>
        <MudTd DataLabel="Drop ID">43,3</MudTd>
        <MudTd DataLabel="Force">50,4</MudTd>
        <MudTd DataLabel="Stress">32,08</MudTd>
    </RowTemplate>

Results in this output (Locally):
image

Results in this output (Azure):
image

Version info:

  • bUnit version: 1.18.4

Workaround:
Although there is a workaround available, it is not an optimal solution. As such, it would be prudent to address the underlying issue with MarkupMatches() to fully resolve the bug.

        var td3 = component.FindAll("td")[0].TextContent;
        Assert.That(Convert.ToDouble(td3),Is.EqualTo(5.4));
        
        var td4 = component.FindAll("td")[1].TextContent;
        Assert.That(Convert.ToDouble(td4),Is.EqualTo(43.3));
        
        var td5 = component.FindAll("td")[2].TextContent;
        Assert.That(Convert.ToDouble(td5),Is.EqualTo(50.4));
        
        var td6 = component.FindAll("td")[3].TextContent;
        Assert.That(Convert.ToDouble(td6),Is.EqualTo(32.08));

Activity

  1. locked and limited conversation to collaborators on Mar 2, 2023
  2. converted this issue into a discussion #1012 on Mar 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions