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()); }
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(); }