コード例 #1
0
        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;
        }
コード例 #2
0
ファイル: BlogManager_Test.cs プロジェクト: younes21/abp
 public async Task BlogCreate_ShouldThrowException_WithExistSlug()
 {
     await Should.ThrowAsync <BlogSlugAlreadyExistException>(
         async() =>
         await BlogManager.CreateAsync("test-name", TestData.BlogSlug)
         );
 }
コード例 #3
0
ファイル: BlogManager_Test.cs プロジェクト: younes21/abp
    public async Task BlogCreate_ShouldWorkProperly()
    {
        var blog = await BlogManager.CreateAsync("test-name", "test-slug");

        blog.ShouldNotBeNull();
        blog.Id.ShouldNotBe(Guid.Empty);
    }
コード例 #4
0
        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));
        }