コード例 #1
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);
        }
コード例 #2
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));
        }
コード例 #3
0
        public void ShouldAddImage()
        {
            // arrange
            var image = new Image
            {
                Picture = new byte[1],
                UserId  = Guid.Parse("F94A87D3-BBB1-46C9-A487-57FDE39FB38B"),
                Time    = DateTime.Now
            };

            image.Time = new DateTime(image.Time.Year, image.Time.Month, image.Time.Day, image.Time.Hour, image.Time.Minute, image.Time.Second, image.Time.Kind);

            var dataLayer = new DataLayer.SQL.DataLayer(_connectionString);

            // act
            image = dataLayer.AddImage(image);
            // asserts
            var resultImage = dataLayer.GetImage(image.Id);

            Assert.AreEqual(image.Time, resultImage.Time);
        }