Example #1
0
        public void Equals_ValuesObjectAndDifferentType_ShouldReturnFalse()
        {
            ValueObjectMock mock1 = new ValueObjectMock {
                MockString = "value", MockInt = 26
            };
            int mock2 = 0;
            // ReSharper disable once SuspiciousTypeConversion.Global
            bool actual = mock1.Equals(mock2);

            Assert.False(actual);
        }
Example #2
0
        public void Equals_ValuesObjectAndNullDifferentType_ShouldReturnFalse()
        {
            ValueObjectMock mock1 = new ValueObjectMock {
                MockString = "value", MockInt = 26
            };
            object mock2 = null;
            // ReSharper disable once ExpressionIsAlwaysNull
            bool actual = mock1.Equals(mock2);

            Assert.False(actual);
        }
Example #3
0
        public void Equals_ValuesObjectsOfSameTypeWithSameValues_ShouldReturnTrue()
        {
            ValueObjectMock mock1 = new ValueObjectMock {
                MockString = "value", MockInt = 26
            };
            ValueObjectMock mock2 = new ValueObjectMock {
                MockString = "value", MockInt = 26
            };

            Assert.True(mock1.Equals(mock2));
        }
Example #4
0
        public void Equals_RightObjectIsNull_ShouldReturnFalse()
        {
            ValueObjectMock mock1 = new ValueObjectMock {
                MockString = "value", MockInt = 26
            };
            ValueObjectMock mock2 = null;
            // ReSharper disable once ExpressionIsAlwaysNull
            bool actual = mock1.Equals(mock2);

            Assert.False(actual);
        }
Example #5
0
        public void Equals_ValuesObjectsOfSameTypeWithDifferentValuesButNotIncludedInGetAttributesToIncludeInEqualityCheck_ShouldReturnTrue()
        {
            ValueObjectMock mock1 = new ValueObjectMock {
                MockString = "value", MockInt = 26, MockDate = DateTime.MaxValue
            };
            ValueObjectMock mock2 = new ValueObjectMock {
                MockString = "value", MockInt = 26, MockDate = DateTime.MinValue
            };
            bool actual = mock1.Equals(mock2);

            Assert.True(actual);
        }
Example #6
0
        public void Equals_ValuesObjectsOfSameTypeWithDifferentValues_ShouldReturnFalse()
        {
            ValueObjectMock mock1 = new ValueObjectMock {
                MockString = "value", MockInt = 26
            };
            ValueObjectMock mock2 = new ValueObjectMock {
                MockString = "value", MockInt = 27
            };
            bool actual = mock1.Equals(mock2);

            Assert.False(actual);
        }