public void Equals_WhenObjectsAreTheSameClass_ReturnsTrue()
        {
            //Arrange
            var sut = new FirstDescendantValueObject();

            //Act
            bool matches = sut.Equals(sut);

            //Assert
            Assert.IsTrue(matches);
        }
        public void Equals_WhenCompareObjectIsDifferentType_ReturnsFalse()
        {
            //Arrange
            var sut = new FirstDescendantValueObject();

            //Act
            bool matches = sut.Equals(new object());

            //Assert
            Assert.IsFalse(matches);
        }
        public void Equals_WhenCompareObjectNull_ReturnsFalse()
        {
            //Arrange
            var sut = new FirstDescendantValueObject();

            //Act
            bool matches = sut.Equals(null);

            //Assert
            Assert.IsFalse(matches);
        }
        public void GetHasCode_ObjectsHaveSameValues_HashMatches()
        {
            //Arrange
            var sut        = new FirstDescendantValueObject();
            var sameValues = new FirstDescendantValueObject();

            //Act
            int value1 = sut.GetHashCode();
            int value2 = sameValues.GetHashCode();

            //Assert
            Assert.AreEqual(value1, value2);
        }
        public void GetHasCode_ObjectsAreTheSameReference_HashMatches()
        {
            //Arrange
            var sut        = new FirstDescendantValueObject();
            var sameObject = sut;

            //Act
            int value1 = sut.GetHashCode();
            int value2 = sameObject.GetHashCode();

            //Assert
            Assert.AreEqual(value1, value2);
        }
        public void Equals_WhenFirstDescendantsHaveSameValues_ReturnsTrue()
        {
            //Arrange
            var sut = new FirstDescendantValueObject();

            var match = new FirstDescendantValueObject();


            //Act
            bool matches = sut.Equals(match);

            //Assert
            Assert.IsTrue(matches);
        }
        public void GetHasCode_FirstDescendantPrivateClassIsDifferent_HashAreNotEqual()
        {
            //Arrange
            var sut      = new FirstDescendantValueObject();
            var nonMatch = new FirstDescendantValueObject();

            nonMatch.SetPrivateClassFieldToNull();

            //Act
            int value1 = sut.GetHashCode();
            int value2 = nonMatch.GetHashCode();

            //Assert
            Assert.AreNotEqual(value1, value2);
        }
        public void Equals_WhenFirstDescendantsPrivateClassIsDifferent_ReturnsFalse()
        {
            //Arrange
            var sut = new FirstDescendantValueObject();

            var match = new FirstDescendantValueObject();

            match.SetPrivateClassFieldToNotMatch();

            //Act
            bool matches = sut.Equals(match);

            //Assert
            Assert.IsFalse(matches);
        }
        public void Equals_WhenFirstDescendantsPrivateClassSutIsNull_ReturnsFalse()
        {
            //Arrange
            var sut = new FirstDescendantValueObject();

            sut.SetPrivateClassFieldToNull();

            var match = new FirstDescendantValueObject();

            //Act
            bool matches = sut.Equals(match);

            //Assert
            Assert.IsFalse(matches);
        }
Ejemplo n.º 10
0
        public void Equals_WhenFirstDescendantsPublicStructSutIsNull_ReturnsFalse()
        {
            //Arrange
            var sut = new FirstDescendantValueObject
            {
                StructField = null
            };

            var match = new FirstDescendantValueObject();

            //Act
            bool matches = sut.Equals(match);

            //Assert
            Assert.IsFalse(matches);
        }
Ejemplo n.º 11
0
        public void GetHasCode_FirstDescendantPublicClassIsDifferent_HashAreNotEqual()
        {
            //Arrange
            var sut      = new FirstDescendantValueObject();
            var nonMatch = new FirstDescendantValueObject
            {
                ClassField = new Tuple <int>(2)
            };

            //Act
            int value1 = sut.GetHashCode();
            int value2 = nonMatch.GetHashCode();

            //Assert
            Assert.AreNotEqual(value1, value2);
        }
Ejemplo n.º 12
0
        public void GetHasCode_FirstDescendantPublicStructIsDifferent_HashAreNotEqual()
        {
            //Arrange
            var sut      = new FirstDescendantValueObject();
            var nonMatch = new FirstDescendantValueObject
            {
                StructField = "other string"
            };

            //Act
            int value1 = sut.GetHashCode();
            int value2 = nonMatch.GetHashCode();

            //Assert
            Assert.AreNotEqual(value1, value2);
        }
Ejemplo n.º 13
0
        public void Equals_WhenFirstDescendantsPublicClassIsDifferent_ReturnsFalse()
        {
            //Arrange
            var sut = new FirstDescendantValueObject();

            var match = new FirstDescendantValueObject
            {
                ClassField = new Tuple <int>(2)
            };

            //Act
            bool matches = sut.Equals(match);

            //Assert
            Assert.IsFalse(matches);
        }
Ejemplo n.º 14
0
        public void Equals_WhenFirstDescendantsPublicStructIsDifferent_ReturnsFalse()
        {
            //Arrange
            var sut = new FirstDescendantValueObject();

            var match = new FirstDescendantValueObject
            {
                StructField = "other string"
            };

            //Act
            bool matches = sut.Equals(match);

            //Assert
            Assert.IsFalse(matches);
        }