We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MSTest interprets constant double values as decimals, which is a change from previous behaviour
Using the following Code:
using Microsoft.VisualStudio.TestTools.UnitTesting; namespace MStest.DataRowExample { [TestClass] public class Class1 { [DataRow(1,2,3)] [TestMethod] public void DataRowTest_1(double x, double y, double expected) { // arrange // act var actual = x + y; // assert Assert.AreEqual(expected, actual); } [DataRow(1.1, 2.2, 3.3)] [TestMethod] public void DataRowTest_2(double x, double y, double expected) { // arrange // act var actual = x + y; // assert Assert.AreEqual(expected, actual); } [DataRow(1.11111111, 2.22222222, 3.33333333)] [TestMethod] public void DataRowTest_3(double x, double y, double expected) { // arrange // act var actual = x + y; // assert Assert.AreEqual(expected, actual); } } }
All tests should pass (as they do with the previous version of MSTest)
Tests 2 & 3 fail with:
threw exception: System.ArgumentException: Object of type 'System.Decimal' cannot be converted to type 'System.Double'. at System.RuntimeType.TryChangeType(Object value, Binder binder, CultureInfo culture, Boolean needsSpecialCast) at System.Reflection.MethodBase.CheckArguments(Object[] parameters, Binder binder, BindingFlags invokeAttr, CultureInfo culture, Signature sig) at System.Reflection.RuntimeMethodInfo.InvokeArgumentsCheck(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.ThreadOperations.ExecuteWithAbortSafety(Action action)
The text was updated successfully, but these errors were encountered:
Could this be related to #837 ?
Sorry, something went wrong.
Thank you for reporting this, it's a known issue - we're working on it. It's tracked here.
DataRowAttribute
double
decimal
No branches or pull requests
Description
MSTest interprets constant double values as decimals, which is a change from previous behaviour
Steps to reproduce
Using the following Code:
Expected behavior
All tests should pass (as they do with the previous version of MSTest)
Actual behavior
Tests 2 & 3 fail with:
Environment
The text was updated successfully, but these errors were encountered: