示例#1
0
        public async Task GetBlogContentNullTest()
        {
            var blogElement    = new BlogElementBuilder().Build();
            var contentService = new BlogContentServiceBuilder()
                                 .WithBlogElement(blogElement)
                                 .Build();
            var controller = new DataControllerBuilder()
                             .WithBlogContentService(null)
                             .Build();

            var result = await controller.GetBlogContent(0);

            result.Should().NotBeNull();
        }
示例#2
0
        public async Task PostBlogElementTest(bool saveStatus, bool expected)
        {
            var blogElement    = new BlogElementBuilder().Build();
            var contentService = new BlogContentServiceBuilder()
                                 .WithSaveStatus(saveStatus)
                                 .Build();
            var controller = new DataControllerBuilder()
                             .WithBlogContentService(contentService)
                             .Build();

            var result = await controller.PostBlog(new BlogElementRequest()
            {
                BlogElement = blogElement
            });

            result.Should().Be(expected);
        }
示例#3
0
        public async Task GetBlogPageTest()
        {
            var blogElement    = new BlogElementBuilder().Build();
            var contentService = new BlogContentServiceBuilder()
                                 .WithBlogElements(new List <BlogElement>()
            {
                blogElement
            })
                                 .Build();
            var controller = new DataControllerBuilder()
                             .WithBlogContentService(contentService)
                             .Build();

            var blogElements = await controller.GetBlogPage("201901", 0);

            blogElements.Should().NotBeEmpty();
            blogElements.First().Should().Be(blogElement);
        }