public async Task DeleteBlog_deletes_blog() { IBlogLogic logic = new BlogLogic(_context); var existingBlogs = await logic.GetAsync(); var existingBlog = existingBlogs.FirstOrDefault(b => b.Title == "Title2"); var result = await logic.DeleteAsync(existingBlog.Id); result.Should().BeTrue(); (await logic.GetAsync()).Any(b => b.Id == existingBlog.Id).Should().BeFalse(); }
public async Task UpdateBlog_updates_blog() { IBlogLogic logic = new BlogLogic(_context); var existingBlogs = await logic.GetAsync(); var existingBlog = existingBlogs.FirstOrDefault(b => b.Title == "Title1"); existingBlog.Title = "UpdatedTitle1"; var result = await logic.UpdateAsync(existingBlog.Id, existingBlog); result.Should().BeTrue(); (await logic.GetAsync()).FirstOrDefault(b => b.Id == existingBlog.Id).Title.Should().Be("UpdatedTitle1"); }