You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Data driven data type gets converted from double to decimal or long.
This for types that are object.
MSTest.TestFramework version 3.0.2.
Look at the test below, it is easier than trying to explain in free form.
Steps To Reproduce
private static IEnumerable<object?[]> ADoubleType
{
get
{
yield return new object[] { "double becomes decimal", new object[] { (double)1.1 } };
yield return new object[] { "double becomes int", new object[] { (double)1.0 } };
}
}
[DataTestMethod]
[DynamicData(nameof(ADoubleType))]
public void WichTypeIsThat(string message, object[] data)
{
Assert.IsInstanceOfType<double>(data[0], message);
}
Expected behavior
The data type should be double and the test should be green.
Actual behavior
Assert.IsInstanceOfType failed. double becomes decimal Expected type:<System.Double>. Actual type:<System.Decimal>. Assert.IsInstanceOfType failed. double becomes int Expected type:<System.Double>. Actual type:<System.Int32>.
Additional context
Not-easy-to-spot; the second parameter data is an array of object.
I cannot say whether this is a bug or working-as-intended. One can argue for both.
One can also argue that it is a bug but too special case to bother about.
But as I see ncrunch succeed it feels more like a bug.
It might work in v.2.0.0, because I noticed this when updating to 3.0.2. But on the other hand, I am not sure v.2.0.0. picked up the data driven test at all. When I reverted back to 2.0.0, my environment refused to run the test so I gave up on exploring full regression. Anyhow - the test code should be easy to run.
I am running the tests in Visual studio 17.4.2 (2022) if that matters.
MSTest.TestAdapter is v.3.0.2.
When running the test through dotnet test the test fails.
When running the test through ncrunch, it works as expected. I do not know how ncrunch runs test. Obviously not through dotnet test.
The text was updated successfully, but these errors were encountered:
I confirm that there is an issue and that it's not a regression from 2.2.10. As far as I can see, this is one more example of problem caused by using the DataContractSerializer + algorithm put in place in MSTest.
I will keep this one open and link it to this ticket: #1462.
Describe the bug
Data driven data type gets converted from
double
todecimal
orlong
.This for types that are
object
.MSTest.TestFramework version 3.0.2.
Look at the test below, it is easier than trying to explain in free form.
Steps To Reproduce
Expected behavior
The data type should be
double
and the test should be green.Actual behavior
Assert.IsInstanceOfType failed. double becomes decimal Expected type:<System.Double>. Actual type:<System.Decimal>.
Assert.IsInstanceOfType failed. double becomes int Expected type:<System.Double>. Actual type:<System.Int32>.
Additional context
Not-easy-to-spot; the second parameter
data
is an array of object.I cannot say whether this is a bug or working-as-intended. One can argue for both.
One can also argue that it is a bug but too special case to bother about.
But as I see ncrunch succeed it feels more like a bug.
It might work in v.2.0.0, because I noticed this when updating to 3.0.2. But on the other hand, I am not sure v.2.0.0. picked up the data driven test at all. When I reverted back to 2.0.0, my environment refused to run the test so I gave up on exploring full regression. Anyhow - the test code should be easy to run.
I am running the tests in Visual studio 17.4.2 (2022) if that matters.
MSTest.TestAdapter is v.3.0.2.
When running the test through
dotnet test
the test fails.When running the test through ncrunch, it works as expected. I do not know how ncrunch runs test. Obviously not through
dotnet test
.The text was updated successfully, but these errors were encountered: