Exemplo n.º 1
0
        public async Task GetWikiTestAsync(string wikiURL)
        {
            string dbString = Guid.NewGuid().ToString();

            //ARRANGE
            using var context = InMemoryDbContextFactory.GetViewzDbContext(dbString);
            IMdToHtmlAndContentsFactory factory = new MdToHtmlAndContentsFactory();
            var wrepo           = new WikiRepositoryStoring(context, factory);
            var prepo           = new PageRepositoryStoring(context, factory);
            var wiki_controller = new WikiController(wrepo, prepo, w_logger);

            var wiki = await context.Wiki.Where(w => w.Url == wikiURL).SingleOrDefaultAsync();

            //ACT
            var status = await wiki_controller.GetAsync(wikiURL);

            if (wiki != null)
            {
                //ASSERT - status 200 (OK)
                Assert.IsType <OkObjectResult>(status);
            }
            else
            {
                //ASSERT - status 404 (OK)
                Assert.IsType <NotFoundResult>(status);
            }
        }
Exemplo n.º 2
0
        public async Task GetPopWiki200TestAsync()
        {
            //ARRANGE
            string dbString = Guid.NewGuid().ToString();

            //ARRANGE
            using var context = InMemoryDbContextFactory.GetViewzDbContext(dbString);
            IMdToHtmlAndContentsFactory factory = new MdToHtmlAndContentsFactory();
            var prepo           = new PageRepositoryStoring(context, factory);
            var wrepo           = new WikiRepositoryStoring(context, factory);
            var wiki_controller = new WikiController(wrepo, prepo, w_logger);

            var status = await wiki_controller.GetAsync(5);

            //ACT
            //ASSERT
            Assert.IsType <OkObjectResult>(status);
        }