コード例 #1
0
        public void Given_an_object_which_has_the_same_KeyCode_value_but_does_not_extend_Enumeration_When_Equals_is_called_Then_false_should_be_returned()
        {
            // Arrange.
            Enumeration enumeration             = EmployeeType.Permanent;
            object      objWithSameKeyCodeValue = new ObjectWithKeyCode(enumeration.KeyCode);

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

            // Assert.
            result.Should().BeFalse();
        }
コード例 #2
0
        public void Given_an_object_which_is_null_When_Equals_is_called_Then_false_should_be_returned()
        {
            // Arrange.
            object      nullObject  = null;
            Enumeration enumeration = EmployeeType.Permanent;

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

            // Assert.
            result.Should().BeFalse();
        }
コード例 #3
0
        public void Given_an_object_which_has_the_same_KeyCode_value_and_extends_Enumeration_but_is_not_of_the_same_Type_When_Equals_is_called_Then_false_should_be_returned()
        {
            // Arrange.
            Enumeration enumeration = EmployeeType.Permanent;
            Enumeration enumerationWithSameKeyCodeValue = new TestEnumeration(enumeration.KeyCode, "display name");

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

            // Assert.
            enumeration.KeyCode.Should().BeEquivalentTo(enumerationWithSameKeyCodeValue.KeyCode);
            result.Should().BeFalse();
        }