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(); } }
public void InsureeWithIntAsIdWithValueIsNotTransient() { var insuree = new InsureeWithIntAsId { Id = 4 }; insuree.IsTransient().Should().BeFalse(); }
public void SetIdentitySetANonTransientEntity() { // arrange var entity = new InsureeWithIntAsId { Id = 1 }; // assert entity.IsTransient().Should().BeFalse(); }
public void CompareTheSameReferenceReturnTrueTest() { // arrange var entityLeft = new InsureeWithIntAsId(); var entityRight = entityLeft; // act if (!entityLeft.Equals(entityRight)) { Assert.Fail(); } if (!(entityLeft == entityRight)) { Assert.Fail(); } }
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(); }
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(); }
public void CompareWhenLeftIsNullAndRightIsNullReturnFalseTest() { // arrange InsureeWithIntAsId entityLeft = null; var entityRight = new InsureeWithIntAsId { Id = 1 }; // act if (!(entityLeft == null)) { Assert.Fail(); } if (!(entityRight != null)) { Assert.Fail(); } }
public void NewInsureeWithIntAsIdIsTransient() { var insuree = new InsureeWithIntAsId(); insuree.IsTransient().Should().BeTrue(); }