예제 #1
0
        public void Equality_NotNullAndSameTypeButGuidEmptyId_ReturnsFalse()
        {
            // Arrange
            var entity1 = new DummyEntity();

            entity1.ChangeId(Guid.Empty);
            var entity2 = new DummyEntity();

            // Act - Assert
            Assert.IsFalse(entity1 == entity2);
            Assert.IsFalse(entity1.Equals(entity2));
            Assert.IsFalse(entity2.Equals(entity1));
        }
예제 #2
0
        public void Equality_NotNullAndSameTypeAndSameId_ReturnsTrue()
        {
            // Arrange
            var entityId = Guid.NewGuid();
            var entity1  = new DummyEntity();

            entity1.ChangeId(entityId);
            var entity2 = new DummyEntity();

            entity2.ChangeId(entityId);

            // Act - Assert
            Assert.IsTrue(entity1 == entity2);
            Assert.IsTrue(entity1.Equals(entity2));
            Assert.IsTrue(entity2.Equals(entity1));
        }