Describe the bug
If the DataRowAttribute has a null parameters in it, Snapshooter will error trying to generate the snapshot name.
To Reproduce
Create a MS Test like so:
[DataTestMethod]
[DataRow("str", null)]
public void TestWithNull(string str, string? nullableStr) {
var data = new { str, nullableStr };
Snapshoot.Match(data);
}
This results in the following error:
Message:
Test method Cli.Tests.InitTests.EnsureCorrectConfigGenerationWithDifferentAuthenticationProviders threw exception:
System.NullReferenceException: Object reference not set to an instance of an object.
Stack Trace:
<>c.<GetMethodSnapshotName>b__6_0(Object d)
SelectArrayIterator`2.MoveNext()
String.Join(String separator, IEnumerable`1 values)
MSTestSnapshotFullNameReader.GetMethodSnapshotName(MethodBase method)
MSTestSnapshotFullNameReader.ReadSnapshotFullName()
SnapshotFullNameResolver.ResolveSnapshotFullName(String snapshotName, String snapshotNameExtension)
Snapshooter.ResolveSnapshotFullName(String snapshotName, SnapshotNameExtension snapshotNameExtension)
Snapshot.FullName()
Snapshot.Match(Object currentResult, Func`2 matchOptions)
Snapshot.Match[T](T currentResult, Func`2 matchOptions)
Expected behavior
Test to pass.
Desktop (please complete the following information):
Describe the bug If the
DataRowAttribute
has anull
parameters in it, Snapshooter will error trying to generate the snapshot name.To Reproduce Create a MS Test like so:
This results in the following error:
Expected behavior Test to pass.
Desktop (please complete the following information):