public void GetCommentByID(int commentId) { ScopeAsync(async (c, t) => { var commentRepo = new ImageCommentRepository(c); var result = await commentRepo.GetSingleByID(commentId); Assert.True(result.HasValue); }); }
public void GetComment(int imageId) { ScopeAsync(async (c, t) => { var commentRepo = new ImageCommentRepository(c); var result = await commentRepo.Get(imageId); Assert.True(result.Any()); }); }
public void GetPageOfComments(int imageId, int skip, int take) { ScopeAsync(async (c, t) => { var commentRepo = new ImageCommentRepository(c); var result = await commentRepo.GetPage(skip, take, imageId); Assert.True(result.CurrentItems.Any()); }); }
public void UpdateComment(int commentId, string updatedRemark) { ScopeAsync(async (c, t) => { // Arrange var commentRepo = new ImageCommentRepository(c); var updated = new ImageComment { PostedOn = DateTime.Now, Text = updatedRemark }; // Act var result = await commentRepo.UpdateSingle(commentId, updated); // Assert Assert.True(result); }); }
public void DeleteComment(int commentId) { ScopeAsync(async (c, t) => { // Arrange var commentRepo = new ImageCommentRepository(c); // Act Func<int, Task> onDelete = (id) => Task.FromResult(0); var result = await commentRepo.DeleteSingle(commentId, onDelete); // Assert Assert.True(result); }); }
public void CreateComment(string remark, int userId, int imageId) { ScopeAsync(async (c, t) => { // Arrange var commentRepo = new ImageCommentRepository(c); var comment = new ImageComment { Author = new User { ID = userId }, PostedOn = DateTime.Now, Text = remark, }; // Act Func<ImageComment, Task> onCreate = com => Task.FromResult(0); var result = await commentRepo.CreateSingle(comment, onCreate); // Assert Assert.True(result.HasValue); }); }