예제 #1
0
        public void Equals_DifferentComment_False()
        {
            // Arrange
            Comment comment1 = new Comment()
            {
                Text = "Comment 1"
            };
            Comment comment2 = new Comment()
            {
                Text = "Comment 2"
            };

            CommentLike commentLike1 = new CommentLike {
                Id = System.Guid.Empty, IsLiked = true, Comment = comment1
            };
            CommentLike commentLike2 = new CommentLike {
                Id = System.Guid.Empty, IsLiked = true, Comment = comment2
            };

            // Act
            // Assert
            Assert.IsFalse(commentLike1.Equals(commentLike2));
            Assert.AreNotEqual(commentLike1, commentLike2);
            Assert.AreNotSame(commentLike1, commentLike2);
        }
예제 #2
0
        public void Equals_NullValue_Exception()
        {
            // Arrange
            CommentLike commentLike1 = new CommentLike();
            CommentLike commentLike2 = null;

            // Act
            // Assert
            Assert.ThrowsException <System.ArgumentNullException>(() => commentLike1.Equals(commentLike2));
        }
예제 #3
0
        public void Equals_TheSameInstance_True()
        {
            // Arrange
            CommentLike commentLike = new CommentLike();

            // Act
            // Assert
            Assert.IsTrue(commentLike.Equals(commentLike));
            Assert.AreEqual(commentLike, commentLike);
            Assert.AreSame(commentLike, commentLike);
        }
예제 #4
0
        public void Equals_DifferentType_False()
        {
            // Arrange
            CommentLike commentLike = new CommentLike();
            Subject     subject     = new Subject();

            // Act
            // Assert
            Assert.IsFalse(commentLike.Equals(subject));
            Assert.AreNotEqual(commentLike, subject);
            Assert.AreNotSame(commentLike, subject);
        }
예제 #5
0
        public void Equals_TheSameReference_True()
        {
            // Arrange
            CommentLike commentLike1 = new CommentLike();
            CommentLike commentLike2 = commentLike1;

            // Act
            // Assert
            Assert.IsTrue(commentLike1.Equals(commentLike2));
            Assert.AreEqual(commentLike1, commentLike2);
            Assert.AreSame(commentLike1, commentLike2);
        }
예제 #6
0
        public void Equals_DifferentValue_False()
        {
            // Arrange
            CommentLike commentLike1 = new CommentLike {
                Id = System.Guid.Empty, IsLiked = true
            };
            CommentLike commentLike2 = new CommentLike {
                Id = System.Guid.Empty, IsLiked = false
            };

            // Act
            // Assert
            Assert.IsFalse(commentLike1.Equals(commentLike2));
            Assert.AreNotSame(commentLike1, commentLike2);
        }
예제 #7
0
        public void Equals_TheSameValue_True()
        {
            // Arrange
            CommentLike commentLike1 = new CommentLike {
                Id = System.Guid.Empty, IsLiked = true
            };
            CommentLike commentLike2 = new CommentLike {
                Id = System.Guid.Empty, IsLiked = true
            };

            // Act
            // Assert
            Assert.IsTrue(commentLike1.Equals(commentLike2));
            Assert.AreEqual(commentLike1, commentLike2);
            Assert.AreNotSame(commentLike1, commentLike2);
        }
예제 #8
0
        public void Equals_SameUser_True()
        {
            // Arrange
            User user = new User {
                NickName = "User"
            };

            CommentLike commentLike1 = new CommentLike {
                Id = System.Guid.Empty, IsLiked = true, User = user
            };
            CommentLike commentLike2 = new CommentLike {
                Id = System.Guid.Empty, IsLiked = true, User = user
            };

            // Act
            // Assert
            Assert.IsTrue(commentLike1.Equals(commentLike2));
            Assert.AreEqual(commentLike1, commentLike2);
            Assert.AreNotSame(commentLike1, commentLike2);
        }
예제 #9
0
        public void Equals_SecondUserNull_False()
        {
            // Arrange
            User user1 = new User {
                NickName = "User 1"
            };
            User user2 = null;

            CommentLike commentLike1 = new CommentLike {
                Id = System.Guid.Empty, IsLiked = true, User = user1
            };
            CommentLike commentLike2 = new CommentLike {
                Id = System.Guid.Empty, IsLiked = true, User = user2
            };

            // Act
            // Assert
            Assert.IsFalse(commentLike1.Equals(commentLike2));
            Assert.AreNotEqual(commentLike1, commentLike2);
            Assert.AreNotSame(commentLike1, commentLike2);
        }
예제 #10
0
        public void Equals_SameComment_True()
        {
            // Arrange
            Comment comment = new Comment()
            {
                Text = "Comment"
            };

            CommentLike commentLike1 = new CommentLike {
                Id = System.Guid.Empty, IsLiked = true, Comment = comment
            };
            CommentLike commentLike2 = new CommentLike {
                Id = System.Guid.Empty, IsLiked = true, Comment = comment
            };

            // Act
            // Assert
            Assert.IsTrue(commentLike1.Equals(commentLike2));
            Assert.AreEqual(commentLike1, commentLike2);
            Assert.AreNotSame(commentLike1, commentLike2);
        }