Exemplo n.º 1
0
        public async Task <IActionResult> OnPostAsync()
        {
            var dto = ObjectMapper.Map <CreateBlogViewModel, CreateBlogDto>(ViewModel);

            await BlogAdminAppService.CreateAsync(dto);

            return(NoContent());
        }
Exemplo n.º 2
0
 public async Task CreateAsync_ShouldThrow_WithExistSlug()
 {
     await Should.ThrowAsync <BlogSlugAlreadyExistException>(
         async() =>
         await BlogAdminAppService.CreateAsync(new CreateBlogDto
     {
         Name = "News",
         Slug = CmsKitTestData.BlogSlug
     }));
 }
Exemplo n.º 3
0
    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");
    }