예제 #1
0
        public void Should_be_equal_to_another_instance_with_the_same_id()
        {
            //Arrange
            var sut     = new TestEnumeration(3, "aaa");
            var another = new TestEnumeration(3, "bbb");

            //Act
            var areEqual = sut.Equals(another) && sut == another;

            //Assert
            areEqual.Should().BeTrue();
        }
예제 #2
0
        public void Given_an_object_which_has_the_same_KeyCode_value_and_has_the_same_Type_When_Equals_is_called_Then_true_should_be_returned()
        {
            // Arrange.
            Enumeration enumeration      = new TestEnumeration("SALAD", "Yummy yummy");
            Enumeration otherEnumeration = new TestEnumeration("SALAD", "In my tummy");

            // Act.
            bool result = enumeration.Equals(otherEnumeration);

            // Assert.
            // Ensure that we are asserting that Equals does equivalency by value of `KeyCode` rather than by reference equality.
            enumeration.Should().NotBeSameAs(otherEnumeration);
            result.Should().BeTrue();
        }