Beispiel #1
0
        public void ShouldGetCommentsToImage()
        {
            // arrange
            var comment = new Comment
            {
                Text   = Guid.NewGuid().ToString(),
                UserId = Guid.Parse("F94A87D3-BBB1-46C9-A487-57FDE39FB38B")
            };
            var dataLayer = new DataLayer.SQL.DataLayer(_connectionString);

            // act
            dataLayer.AddCommentToImage(Guid.Parse("176DCFA9-FDB7-4FAF-91CB-7E38D0C5F77C"), comment);
            List <Comment> comments = dataLayer.GetImageComments(Guid.Parse("176DCFA9-FDB7-4FAF-91CB-7E38D0C5F77C"));

            // asserts
            Assert.IsTrue(comments.Exists(x => x.Text == comment.Text));
        }
Beispiel #2
0
        public void ShouldAddComment()
        {
            // arrange
            var comment = new Comment
            {
                Text   = "AddTest",
                UserId = Guid.Parse("F94A87D3-BBB1-46C9-A487-57FDE39FB38B")
            };

            var dataLayer = new DataLayer.SQL.DataLayer(_connectionString);
            // act
            var image = dataLayer.GetImage(Guid.Parse("176DCFA9-FDB7-4FAF-91CB-7E38D0C5F77C"));

            comment = dataLayer.AddCommentToImage(image.Id, comment);
            // asserts
            var resultComment = dataLayer.GetComment(comment.Id);

            Assert.AreEqual(comment.Text, resultComment.Text);
        }
Beispiel #3
0
        public void ShouldDeleteComment()
        {
            // arrange
            var comment = new Comment
            {
                Text   = Guid.NewGuid().ToString(),
                UserId = Guid.Parse("F94A87D3-BBB1-46C9-A487-57FDE39FB38B")
            };

            var dataLayer = new DataLayer.SQL.DataLayer(_connectionString);
            // act
            var image = dataLayer.GetImage(Guid.Parse("176DCFA9-FDB7-4FAF-91CB-7E38D0C5F77C"));

            comment = dataLayer.AddCommentToImage(image.Id, comment);
            dataLayer.DeleteComment(comment.Id);
            // asserts
            List <Comment> resultComments = dataLayer.GetImageComments(image.Id);

            Assert.IsFalse(resultComments.Exists(x => x.Text == comment.Text));
        }