Skip to content

Using units in dynamic data in MSTest doesn't seem to work #976

@dschuermans

Description

@dschuermans

Describe the bug
When using UnitsNet units as values in a dynamic data set for a MSTest unit test, the value is lost when the test method is executed

To Reproduce

private static IEnumerable<object> TestArgs => new[] {
    new object[]{ Length.FromMillimeters(2)}

};

[DataTestMethod]
[DynamicData(nameof(TestArgs))]
public void MyTestMethod(Length value)
{
    Assert.AreEqual(Length.FromMillimeters(2), value);

}

Assert.AreEqual will fail, reporting that expected is 2mm and actual is 0m

Expected behavior
Assert.AreEqual should pass

Additional context
Not entirely sure if this is an issue with UnitsNet objects or an issue with the MSTest framework

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions