snapshooter
snapshooter copied to clipboard
Multiple asserts in one assert context do not work
results.MatchSnapshot(matchOptions =>
{
return matchOptions.Assert(fieldOption =>
{
Assert.Equal(sessionId, fieldOption.Field<string>("[0].Data.onPublishSchema.sessionId"));
Assert.Equal(sessionId, fieldOption.Field<string>("[1].Data.onPublishSchema.sessionId"));
/*
Assert.Collection(
fieldOption.Fields<string>("[*].Data.onPublishSchema.sessionId"),
t => Assert.Equal(sessionId, t),
t => Assert.Equal(sessionId, t));*/
});
});
@michaelstaib is this already completed - I took the latest master pull and tried to reproduce the error but test case is passing.
I've tried the following in MatchSnapshot_PlainExtension_CorrectSnapshot
method inside SnapshotExtensionTests.cs
testPerson.MatchSnapshot(matchOption => matchOption.Assert(fieldOption =>
{
Assert.Equal("Hanna", fieldOption.Field<string>("Children[2].Name"));
Assert.Collection(fieldOption.Fields<string>("Children[*].Name"),
a1 => { },
a2 => { },
a3 => "Hanna".Should().BeEquivalentTo(a3);
);
}));
Should be fixed with the last version.