Beispiel #1
0
        public Comment AddComment(Comment comment)
        {
            //Add the authenticated user's name
            comment.Author = userService.GetUserName();

            //Add current date
            comment.Date = dateService.Now();

            movieRepo.AddComment(comment);
            return(comment);
        }
Beispiel #2
0
        public void AddComment_AddsCommentCorrectly(
            int movieId, bool expectedResult)
        {
            //Arrange
            context.Movies.Add(Helpers.GetTestDomainMovie(1, "title"));
            context.SaveChanges();
            movieRepositoryEF = new MovieRepositoryEF(context);

            //Act
            movieRepositoryEF.AddComment(new View.Comment {
                Id = 1, MovieId = movieId
            });

            //Assert
            Assert.Equal(expectedResult, MovieHasComment(movieId, 1));
        }