-
Notifications
You must be signed in to change notification settings - Fork 291
Closed as not planned
Description
We are using DynamicData to specify our test cases. We are creating an InvalidUpdateException object by passing custom exception message. However, the exception message being actually passed to the unit test method is “Exception of type ‘CCO.Contracts.InvalidUpdateException' was thrown.”
Steps to reproduce
private static IEnumerable<object[]> TestData()
{
return new List<object[]>()
{
new object[] { new InvalidUpdateException("Test exception message") }
};
}
[DynamicData(nameof(TestData), DynamicDataSourceType.Method)]
[TestMethod]
public void ValidateExMessage(Exception ex)
{
Assert.AreEqual(ex?.Message, "Test exception message");
}
Expected behavior
ex?.Message = "Test exception message"
Actual behavior
ex?.Message = "Exception of type ‘CCO.Contracts.InvalidUpdateException' was thrown"
Environment
Windows OS
Using Visual Studio 2022
Nuget package versions -
<PackageReference Update="Microsoft.NET.Test.Sdk" Version="17.0.0" />
<PackageReference Update="MSTest.TestAdapter" Version="2.2.8" />
<PackageReference Update="MSTest.TestFramework" Version="2.2.8" />
vinilnarangms
Metadata
Metadata
Assignees
Labels
No labels