public void ReviewsCanBeRetrievedByFilmId() { _filmContext.AddFindByIdResult(new Film() { Id = "1234", Title = "The Matrix" }); _reviewContext.AddReview(new Review() { FilmId = "1234", Username = "******", ReviewBody = "Great film" }); _reviewContext.AddReview(new Review() { FilmId = "1234", Username = "******", ReviewBody = "Best film ever!" }); _reviewContext.AddReview(new Review() { FilmId = "1234", Username = "******", ReviewBody = "Legendary film" }); _reviewContext.AddReview(new Review() { FilmId = "1234", Username = "******", ReviewBody = "Awesome film" }); ActionResult <ResponseObject <object> > actualResponse = _reviewsController.GetReviewsByFilmId("1234"); Assert.IsTrue(actualResponse.Value.successful); Assert.IsNotNull(actualResponse.Value.contentList); Assert.AreEqual(5, actualResponse.Value.contentList.Count); }
public void CommentsCanBeSubmitted() { _filmContext.AddFindByIdResult(new Film() { Id = "5d650036280b7e2dc0b0d121" }); _reviewContext.AddReview(new Review() { FilmId = "5d650036280b7e2dc0b0d121", Id = "5544653234567543", Username = "******", ReviewBody = "sdfisdugh", Rating = "erere", JavaClass = "eiorytie" }); ActionResult <ResponseObject <object> > actualResponse = _commentsController.AddComment(new Comment("5544653234567543", "Test user", "Blah")); Assert.AreEqual(true, actualResponse.Value.successful); Assert.AreEqual(1, _commentContext.FindByReviewId("5544653234567543").Count); Assert.AreEqual("Test user", _commentContext.FindByReviewId("5544653234567543")[0].Username); }