Beispiel #1
0
        public void Equals_TwoNullInstances_ReturnsTrue()
        {
            // Arrange
            var comparer = new EntityIdentityComparer <string>();

            // Act
            var result = comparer.Equals(null, null);

            // Assert
            Assert.True(result);
        }
Beispiel #2
0
        public void Equals_SecondInstanceNull_ReturnsFalse()
        {
            // Arrange
            var entity1  = new SimpleEntityRepresentation1("test-id");
            var comparer = new EntityIdentityComparer <string>();

            // Act
            var result = comparer.Equals(entity1, null);

            // Assert
            Assert.False(result);
        }
Beispiel #3
0
        public void Equals_DifferentInstanceTypeWithSameIdValue_ReturnsTrue()
        {
            // Arrange
            var entity1  = new SimpleEntityRepresentation1("test-id");
            var entity2  = new SimpleEntityRepresentation2("test-id");
            var comparer = new EntityIdentityComparer <string>();

            // Act
            var result = comparer.Equals(entity1, entity2);

            // Assert
            Assert.True(result);
        }
Beispiel #4
0
        public void Equals_CustomIdentityComparerAndDistinctIdentityValue_ReturnsFalse()
        {
            // Arrange
            var entity1  = new ComplexEntityRepresentation1(new ComplexIdentity("test-id"));
            var entity2  = new ComplexEntityRepresentation1(new ComplexIdentity("test-id2"));
            var comparer = new EntityIdentityComparer <ComplexIdentity>(new ComplexIdentityComparer());

            // Act
            var result = comparer.Equals(entity1, entity2);

            // Assert
            Assert.False(result);
        }