public async Task <IActionResult> OnPostAsync() { var dto = ObjectMapper.Map <CreateBlogViewModel, CreateBlogDto>(ViewModel); await BlogAdminAppService.CreateAsync(dto); return(NoContent()); }
public async Task CreateAsync_ShouldThrow_WithExistSlug() { await Should.ThrowAsync <BlogSlugAlreadyExistException>( async() => await BlogAdminAppService.CreateAsync(new CreateBlogDto { Name = "News", Slug = CmsKitTestData.BlogSlug })); }
public async Task CreateAsync_ShouldWork() { var blog = await BlogAdminAppService.CreateAsync(new CreateBlogDto { Name = "News", Slug = "latest-news" }); blog.ShouldNotBeNull(); blog.Name.ShouldBe("News"); blog.Slug.ShouldBe("latest-news"); }