예제 #1
0
        public void ShouldGetAllCommentsOfPhoto()
        {
            //arrange
            var user = GenerateUser();

            //act
            var dataLayer = new DataLayer.Sql.DataLayer(ConnectionSql);

            dataLayer.AddUser(user);

            var photo = GeneratePhoto(user.Id);

            dataLayer.AddPhoto(photo);

            var comment = GenerateComment(user.Id, photo.Id);

            dataLayer.AddComment(comment);
            var anotherComment = GenerateComment(user.Id, photo.Id);

            dataLayer.AddComment(anotherComment);

            photo.AllComments = dataLayer.GetAllComments(photo.Id);
            foreach (var currentComment in photo.AllComments)
            {
                Assert.AreEqual(currentComment.PhotoId, photo.Id);
            }
            //assert
        }