public void Given_other_enumeration_has_a_KeyCode_with_a_lower_value_When_CompareTo_is_called_Then_result_should_be_1() { // Arrange. Enumeration enumeration = new TestEnumeration("B", "other enumeration"); Enumeration otherEnumeration = new TestEnumeration("A", "enumeration"); // Act. int result = enumeration.CompareTo(otherEnumeration); // Assert. result.Should().Be(1); }
public void Given_other_object_is_null_When_CompareTo_is_called_Then_an_ArgumentNullException_should_be_thrown() { // Arrange. Enumeration enumeration = new TestEnumeration("B", "other enumeration"); object otherObject = null; // Act. Action testCode = () => enumeration.CompareTo(otherObject); // Assert. testCode.Should() .Throw <ArgumentNullException>() .WithMessage("*cannot be null*Parameter name: other*"); }
public void Given_other_object_is_not_of_type_Enumeration_When_CompareTo_is_called_Then_an_ArgumentException_should_be_thrown() { // Arrange. Enumeration enumeration = new TestEnumeration("B", "other enumeration"); object otherObject = new { something = "1" }; // Act. Action testCode = () => enumeration.CompareTo(otherObject); // Assert. testCode.Should() .Throw <ArgumentException>() .WithMessage($"*expected to be of type [{typeof(Enumeration)}]*found [{otherObject.GetType()}]*Parameter name: other*"); }