Esempio n. 1
0
        public IEnumerable <HeroModel> GetHeros()
        {
            var heroes = _heroService.GetHeroes();

            return(heroes);

            //Du ska precis skicka en lista med hjältar till klienten.
            //https://angular.io/docs/ts/latest/tutorial/toh-pt6.html
        }
        public IEnumerable <Hero> Get()
        {
            if (User.Identity.IsAuthenticated)
            {
                return(_heroService.GetHeroes());
            }

            return(_heroService.GetTopFiveHeroes());
        }
Esempio n. 3
0
        public void GetHeroesTest()
        {
            //Arrange
            var heroes = new List <Hero>();

            heroRepositoryMock.Setup(x => x.Get(null))
            .Returns(heroes.AsQueryable())
            .Verifiable("should request from repository");

            //Act
            var heroesList = heroService.GetHeroes();

            //Assert
            Assert.IsNotNull(heroesList);
            Assert.AreEqual(heroesList.Count(), heroes.Count);
            heroRepositoryMock.Verify();
            unitOfWorkMock.Verify();
        }