public void An_enum_that_is_one_of_the_expected_values_should_not_throw() { // Arrange BindingFlags flags = BindingFlags.Public; // Act / Assert flags.Should().BeOneOf(BindingFlags.Public, BindingFlags.ExactBinding); }
public void An_enum_matching_the_predicate_should_not_throw() { // Arrange BindingFlags flags = BindingFlags.Public; // Act / Assert flags.Should().Match(x => x == BindingFlags.Public); }
public void An_enum_not_matching_the_predicate_should_throw_with_the_predicate_in_the_message() { // Arrange BindingFlags flags = BindingFlags.Public; // Act Action act = () => flags.Should().Match(x => x == BindingFlags.Static, "that's what we need"); // Assert act.Should().Throw <XunitException>().WithMessage("Expected*Static*because that's what we need*found*Public*"); }
public void An_enum_cannot_be_part_of_a_null_list() { // Arrange BindingFlags flags = BindingFlags.DeclaredOnly; // Act / Assert Action act = () => flags.Should().BeOneOf(null); act.Should() .Throw <ArgumentException>() .WithMessage("Cannot*null list of enums*"); }
public void Throws_when_the_enums_is_not_one_of_the_expected_enums() { // Arrange BindingFlags flags = BindingFlags.DeclaredOnly; // Act / Assert Action act = () => flags.Should().BeOneOf(new[] { BindingFlags.Public, BindingFlags.ExactBinding }, "that's what we need"); act.Should() .Throw <XunitException>() .WithMessage("Expected*Public*ExactBinding*because that's what we need*found*DeclaredOnly*"); }