Code: Select all
'bool' does not contain a definition for 'ShouldBe' and the best extension method overload 'ShouldBeTestExtensions.ShouldBe(bool?, bool?, string?)' requires a receiver of type 'bool?'CS1929
< /code>
Wie soll ich die Werte nicht-nullbarer und nullierbarer Typen vergleiche? Xunit.net hat keine Probleme damit mit Assert.equal ()
Ich bevorzuge den Empfänger der Erweiterungsmethode für jeden Vergleich nicht auf einen nullbaren Typ. Is.Equal(v, expected, new ObjectEqualityComparer()), actual, expected, customMessage);
else
actual.AssertAwesomely(v => Is.Equal(v, expected), actual, expected, customMessage);
}
[/code]
Wenn t bool? ist, dann würde es Argumente vom Typ bool akzeptieren? < /p>
Code: < /p>
Code: Select all
owners.ShouldSatisfyAllConditions(
o => o.Count.ShouldBe(graphUsers.Count),
o => o[0].Id.ShouldBe(Guid.Parse(graphUsers[0].Id!)),
o => o[0].DisplayName.ShouldBe(graphUsers[0].DisplayName),
o => o[0].GivenName.ShouldBe(graphUsers[0].GivenName),
o => o[0].Surname.ShouldBe(graphUsers[0].Surname),
o => o[0].UserPrincipalName.ShouldBe(graphUsers[0].UserPrincipalName),
o => o[0].Email.ShouldBe(graphUsers[0].Mail),
o => ((bool?)o[0].AccountEnabled).ShouldBe(graphUsers[0].AccountEnabled)
);