Ejemplo n.º 1
0
        public void CompareUsingEqualsOperatorsAndNullOperandsTest()
        {
            //Arrange

            TestEntity entityLeft = null;
            TestEntity entityRight = new TestEntity();

            entityRight.Id = IdentityGenerator.SequentialGuid(); ;

            //Act
            if (!(entityLeft == (EntityBase)null))//this perform ==(left,right)
                Assert.Fail();

            if (!(entityRight != (EntityBase)null))//this perform !=(left,right)
                Assert.Fail();

            entityRight = null;

            //Act
            if (!(entityLeft == entityRight))//this perform ==(left,right)
                Assert.Fail();

            if (entityLeft != entityRight)//this perform !=(left,right)
                Assert.Fail();

          
        }
Ejemplo n.º 2
0
        public void CompareTheSameReferenceReturnTrueTest()
        {
            //Arrange
            TestEntity entityLeft = new TestEntity();
            TestEntity entityRight = entityLeft;


            //Act
            if (! entityLeft.Equals(entityRight))
                Assert.Fail();

            if (!(entityLeft == entityRight))
                Assert.Fail();

        }
Ejemplo n.º 3
0
        public void DiferentIdProduceEqualsFalseTest()
        {
            //Arrange
            
            TestEntity entityLeft = new TestEntity();
            TestEntity entityRight = new TestEntity();

            entityLeft.Id = IdentityGenerator.SequentialGuid(); ;
            entityRight.Id = IdentityGenerator.SequentialGuid(); ;

            //Act
            bool resultOnEquals = entityLeft.Equals(entityRight);
            bool resultOnOperator = entityLeft == entityRight;

            //Assert
            Assert.IsFalse(resultOnEquals);
            Assert.IsFalse(resultOnOperator);

        }
Ejemplo n.º 4
0
        public void CompareWhenLeftIsNullAndRightIsNullReturnFalseTest()
        {
            //Arrange

            TestEntity entityLeft = null;
            TestEntity entityRight = new TestEntity();

            entityRight.Id = IdentityGenerator.SequentialGuid(); ;

            //Act
            if (!(entityLeft == (EntityBase)null))//this perform ==(left,right)
                Assert.Fail();

            if (!(entityRight != (EntityBase)null))//this perform !=(left,right)
                Assert.Fail();
        }