public void When_asserting_members_from_different_enum_types_are_equivalent_it_should_compare_by_value_by_default() { // Arrange var subject = new ClassWithEnumOne(); var expectation = new ClassWithEnumTwo(); // Act Action act = () => subject.Should().BeEquivalentTo(expectation); // Assert act.Should().NotThrow(); }
public void When_asserting_members_from_different_enum_types_are_equivalent_by_value_it_should_succeed() { // Arrange var subject = new ClassWithEnumOne { Enum = EnumOne.One }; var expectation = new ClassWithEnumThree { Enum = EnumThree.ValueZero }; // Act Action act = () => subject.Should().BeEquivalentTo(expectation, config => config.ComparingEnumsByValue()); // Assert act.Should().NotThrow(); }
When_asserting_members_from_different_enum_types_are_equivalent_by_value_but_comparing_by_name_it_should_throw() { // Arrange var subject = new ClassWithEnumOne { Enum = EnumOne.Two }; var expectation = new ClassWithEnumFour { Enum = EnumFour.Three }; // Act Action act = () => subject.Should().BeEquivalentTo(expectation, config => config.ComparingEnumsByName()); // Assert act.Should().Throw <XunitException>() .WithMessage("Expected*to equal EnumFour.Three {value: 3} by name, but found EnumOne.Two {value: 3}*"); }