private async Task SeedBlogsAsync() { var blog = await _blogRepository.InsertAsync( await _blogManager.CreateAsync(_cmsKitTestData.BlogName, _cmsKitTestData.BlogSlug), autoSave : true); _cmsKitTestData.Blog_Id = blog.Id; var author = await _cmsUserRepository.GetAsync(_cmsKitTestData.User1Id); _cmsKitTestData.BlogPost_1_Id = (await _blogPostRepository.InsertAsync( await _blogPostManager.CreateAsync( author, blog, _cmsKitTestData.BlogPost_1_Title, _cmsKitTestData.BlogPost_1_Slug, "Short desc 1", "Blog Post 1 Content"))).Id; _cmsKitTestData.BlogPost_2_Id = (await _blogPostRepository.InsertAsync( await _blogPostManager.CreateAsync( author, blog, _cmsKitTestData.BlogPost_2_Title, _cmsKitTestData.BlogPost_2_Slug, "Short desc 2", "Blog Post 2 Content"))).Id; }
public async Task BlogCreate_ShouldThrowException_WithExistSlug() { await Should.ThrowAsync <BlogSlugAlreadyExistException>( async() => await BlogManager.CreateAsync("test-name", TestData.BlogSlug) ); }
public async Task BlogCreate_ShouldWorkProperly() { var blog = await BlogManager.CreateAsync("test-name", "test-slug"); blog.ShouldNotBeNull(); blog.Id.ShouldNotBe(Guid.Empty); }
public virtual async Task <BlogDto> CreateAsync(CreateBlogDto input) { var blog = await BlogManager.CreateAsync(input.Name, input.Slug); await BlogRepository.InsertAsync(blog, autoSave : true); await BlogFeatureManager.SetDefaultsAsync(blog.Id); return(ObjectMapper.Map <Blog, BlogDto>(blog)); }