Esempio n. 1
0
        public void TestGetPokemonWithIds()
        {
            //arrange
            IHomeContext    hc = new HomeTestContext();
            IPokemonContext pc = new PokemonTestContext();
            IAanvalContext  ac = new AanvalTestContext();
            HomeRepo        hr = new HomeRepo(hc, pc, ac);

            List <Pokemon> p    = new List <Pokemon>();
            List <int>     ints = new List <int>();

            ints.Add(50);
            ints.Add(75);
            ints.Add(69);

            //act
            p = hr.GetPokemonWithIds(ints);

            //assert
            foreach (var pokemon in p)
            {
                Assert.IsNotNull(pokemon.Id);
                Assert.AreNotEqual(0, pokemon.Aanvallen.Count);
            }
        }
        public IActionResult NewGame()
        {
            if (HttpContext.Session.GetInt32("AccountID") == null)
            {
                return(RedirectToAction("Login", "Account"));
            }

            NewGameConvert   pngc       = new NewGameConvert();
            List <int>       allIds     = homeRepo.GetAllId();
            List <int>       randomInts = homeRepo.XRandNum(allIds, 3);
            List <Pokemon>   randomPok  = homeRepo.GetPokemonWithIds(randomInts);
            NewGameViewModel ngvm       = pngc.PokemonToNewGame(randomPok);

            return(View(ngvm));
        }