Example #1
0
        // GET: Links

        public async Task <IActionResult> Index()
        {
            if (User.Identity.Name != "*****@*****.**")
            {
                return(View("Blank"));
            }
            if (Request.IsAjaxRequest())
            {
                return(PartialView(await _linkRepository.AllLinksToListAsync()));
            }
            else
            {
                return(View(await _linkRepository.AllLinksToListAsync()));
            }
        }
Example #2
0
        public async Task AllLinksRepositoryTest()
        {
            providerClass        provider   = new providerClass();
            ILinkRepository      repository = provider.giveRepository();
            ApplicationDbContext context    = provider.giveContext();

            List <Link> repositoryList = await repository.AllLinksToListAsync();

            List <Link> contextList = await context.Links.Include <Link, Category>(l => l.category).ToListAsync();

            Assert.That(repositoryList, Is.EqualTo(contextList));

            /*
             * foreach (Link link in repositoryList)
             * {
             *  Link contextLink = contextList.Single(l => l.LinkId == link.LinkId);
             *  contextLink.category = new Category();
             *  contextLink.category.UrlSlug = "notthis";
             *  Assert.AreEqual(link, contextLink);
             *  Assert.AreEqual(link.category.UrlSlug, contextLink.category.UrlSlug);
             * } */
        }