Exemple #1
0
        public void CompareUsingEqualsOperatorsAndNullOperandsTest()
        {
            // arrange
            InsureeWithIntAsId entityLeft = null;
            var entityRight = new InsureeWithIntAsId {
                Id = 2
            };

            // act
            if (!(entityLeft == null))
            {
                Assert.Fail();
            }

            if (!(entityRight != null))
            {
                Assert.Fail();
            }

            entityRight = null;

            // act
            if (!(entityLeft == entityRight))
            {
                Assert.Fail();
            }

            if (entityLeft != entityRight)
            {
                Assert.Fail();
            }
        }
Exemple #2
0
        public void InsureeWithIntAsIdWithValueIsNotTransient()
        {
            var insuree = new InsureeWithIntAsId {
                Id = 4
            };

            insuree.IsTransient().Should().BeFalse();
        }
Exemple #3
0
        public void SetIdentitySetANonTransientEntity()
        {
            // arrange
            var entity = new InsureeWithIntAsId {
                Id = 1
            };

            // assert
            entity.IsTransient().Should().BeFalse();
        }
Exemple #4
0
        public void CompareTheSameReferenceReturnTrueTest()
        {
            // arrange
            var entityLeft  = new InsureeWithIntAsId();
            var entityRight = entityLeft;

            // act
            if (!entityLeft.Equals(entityRight))
            {
                Assert.Fail();
            }

            if (!(entityLeft == entityRight))
            {
                Assert.Fail();
            }
        }
Exemple #5
0
        public void SameIdentityProduceEqualsTrueTest()
        {
            // arrange
            var entityLeft = new InsureeWithIntAsId {
                Id = 1
            };
            var entityRight = new InsureeWithIntAsId {
                Id = 1
            };

            // act
            var resultOnEquals   = entityLeft.Equals(entityRight);
            var resultOnOperator = entityLeft == entityRight;

            // assert
            resultOnEquals.Should().BeTrue();
            resultOnOperator.Should().BeTrue();
        }
Exemple #6
0
        public void DifferentIdProduceEqualsFalseTest()
        {
            // arrange
            var entityLeft = new InsureeWithIntAsId {
                Id = 1
            };
            var entityRight = new InsureeWithIntAsId {
                Id = 2
            };

            // act
            var resultOnEquals   = entityLeft.Equals(entityRight);
            var resultOnOperator = entityLeft == entityRight;

            // assert
            resultOnEquals.Should().BeFalse();
            resultOnOperator.Should().BeFalse();
        }
Exemple #7
0
        public void CompareWhenLeftIsNullAndRightIsNullReturnFalseTest()
        {
            // arrange
            InsureeWithIntAsId entityLeft = null;
            var entityRight = new InsureeWithIntAsId {
                Id = 1
            };

            // act
            if (!(entityLeft == null))
            {
                Assert.Fail();
            }

            if (!(entityRight != null))
            {
                Assert.Fail();
            }
        }
Exemple #8
0
        public void NewInsureeWithIntAsIdIsTransient()
        {
            var insuree = new InsureeWithIntAsId();

            insuree.IsTransient().Should().BeTrue();
        }