public void NewPersonWithIntAsIdIsTransient() { var person = new PersonWithIntAsId(); Assert.True(person.IsTransient()); //person.IsTransient().Should().BeTrue(); }
public void CompareUsingEqualsOperatorsAndNullOperandsTest() { //Arrange PersonWithIntAsId entityLeft = null; PersonWithIntAsId entityRight = new PersonWithIntAsId { Id = 2 }; //Act if (!(entityLeft == null)) { Assert.True(false, "entityLeft is not null"); } if (!(entityRight != null)) { Assert.True(false, "entityRight is null"); } entityRight = null; //Act if (!(entityLeft == entityRight)) { Assert.True(false, "entityLeft is not equal to entityRight"); } if (entityLeft != entityRight) { Assert.True(false, "entityLeft is not equal to entityRight"); } }
public void TwoTransientsAreNotEqual() { var personLeft = new PersonWithIntAsId(); var personRight = new PersonWithIntAsId(); personLeft.Equals(personRight).Should().BeFalse(); }
public void CompareUsingEqualsOperatorsAndNullOperandsTest() { //Arrange PersonWithIntAsId entityLeft = null; PersonWithIntAsId entityRight = new PersonWithIntAsId { Id = 2 }; //Act if (!(entityLeft == (PersonWithIntAsId)null)) { Assert.Fail(); } if (!(entityRight != (PersonWithIntAsId)null)) { Assert.Fail(); } entityRight = null; //Act if (!(entityLeft == entityRight)) { Assert.Fail(); } if (entityLeft != entityRight) { Assert.Fail(); } }
public void PersonWithIntAsIdWithValueIsNotTransient() { var person = new PersonWithIntAsId { Id = 4 }; person.IsTransient().Should().BeFalse(); }
public void TransientLeftIsNotEqual() { var personLeft = new PersonWithIntAsId(); var personRight = new PersonWithIntAsId { Id = 1 }; personLeft.Equals(personRight).Should().BeFalse(); }
public void SetIdentitySetANonTransientEntity() { //Arrange var entity = new PersonWithIntAsId { Id = 1 }; //Assert Assert.False(entity.IsTransient()); }
public void CompareTheSameReferenceReturnTrueTest() { //Arrange var entityLeft = new PersonWithIntAsId(); PersonWithIntAsId entityRight = entityLeft; //Act if (!entityLeft.Equals(entityRight)) { Assert.True(false, "entityLeft is not equal to entityRight"); } if (!(entityLeft == entityRight)) { Assert.True(false, "entityLeft is not equal to entityRight"); } }
public void SameIdentityProduceEqualsTrueTest() { var entityLeft = new PersonWithIntAsId { Id = 1 }; var entityRight = new PersonWithIntAsId { Id = 1 }; //Act bool resultOnEquals = entityLeft.Equals(entityRight); bool resultOnOperator = entityLeft == entityRight; //Assert resultOnEquals.Should().BeTrue(); resultOnOperator.Should().BeTrue(); }
public void DifferentIdProduceEqualsFalseTest() { //Arrange var entityLeft = new PersonWithIntAsId { Id = 1 }; var entityRight = new PersonWithIntAsId { Id = 2 }; //Act bool resultOnEquals = entityLeft.Equals(entityRight); bool resultOnOperator = entityLeft == entityRight; //Assert resultOnEquals.Should().BeFalse(); resultOnOperator.Should().BeFalse(); }
public void CompareWhenLeftIsNullAndRightIsNullReturnFalseTest() { //Arrange PersonWithIntAsId entityLeft = null; var entityRight = new PersonWithIntAsId { Id = 1 }; //Act if (!(entityLeft == null)) //this perform ==(left,right) { Assert.True(false, "entityLeft is not null"); } if (!(entityRight != null)) //this perform !=(left,right) { Assert.True(false, "entityRight is null"); } }
public void NewPersonWithIntAsIdIsTransient() { var person = new PersonWithIntAsId(); person.IsTransient().Should().BeTrue(); }