public async Task <List <Comment> > GetComments(int discussionid) { List <Repository.Models.Comment> repoComments = await _repo.GetMovieComments(discussionid); if (repoComments == null) { Console.WriteLine("ForumLogic.GetComments() was called with a discussionid that doesn't exist."); return(null); } List <Comment> comments = new List <Comment>(); foreach (var repoComment in repoComments) { comments.Add(Mapper.RepoCommentToComment(repoComment)); } return(comments); }
public async Task NoDiscGetMovieCommentsTest() { object result; RelatedDataSet dataSetA = new RelatedDataSet("JimmyJimerson", "ab10101010", "Theory"); using (var context = new Repository.Models.Cinephiliacs_DbContext(dbOptions)) { context.Database.EnsureDeleted(); context.Database.EnsureCreated(); RepoLogic repoLogic = new RepoLogic(context); // Test GetMovieComments() without Discussion dependency result = await repoLogic.GetMovieComments(dataSetA.DiscussionTopic.DiscussionId); } Assert.Null(result); }