public IActionResult Stat() { Stat s = new Stat(); StatLogic sl = new StatLogic(); s.BiggesAvgWeight = sl.BiggestAvg(categorylogic.List().ToList(), competitorlogic.List().ToList()); s.HighestCompsCategory = sl.HighestCompCategory(categorylogic.List().ToList(), competitorlogic.List().ToList()); s.OnlyUSACategory = sl.OnlyUSA(categorylogic.List().ToList(), competitorlogic.List().ToList()); return(View(nameof(Stat), s)); }
public void HighestCompetitorCategory() { CategoryLogic c = new CategoryLogic(this.categrepo.Object, this.comprepo.Object, this.sponsorrepo.Object); CompetitorLogic com = new CompetitorLogic(this.comprepo.Object); StatLogic s = new StatLogic(this.categrepo.Object, this.comprepo.Object); List <Category> categlist = new List <Category>() { new Category() { CategoryId = Guid.NewGuid().ToString(), Name = CategoryType.MrOlympia, StartingWeight = 90, MaximumWeight = 135 }, new Category() { CategoryId = Guid.NewGuid().ToString(), Name = CategoryType.ClassicPhysique, StartingWeight = 80, MaximumWeight = 110 }, new Category() { CategoryId = Guid.NewGuid().ToString(), Name = CategoryType.MensPhisyque, StartingWeight = 70, MaximumWeight = 100 }, new Category() { CategoryId = Guid.NewGuid().ToString(), Name = CategoryType.WomensBikini, StartingWeight = 45, MaximumWeight = 70 }, }; List <Competitor> complist = new List <Competitor>() { new Competitor { CompetitorId = Guid.NewGuid().ToString(), Number = 1, Name = "Kökény Béla", Nationality = "Hungary", Gender = GenderType.Male, Height = 181, Weight = 103, AchivedPlace = 12, CategoryId = categlist.ElementAt(0).CategoryId }, new Competitor { CompetitorId = Guid.NewGuid().ToString(), Number = 2, Name = "Kökény Béci", Nationality = "Hungary", Gender = GenderType.Male, Height = 174, Weight = 93, AchivedPlace = 11, CategoryId = categlist.ElementAt(1).CategoryId }, new Competitor { CompetitorId = Guid.NewGuid().ToString(), Number = 3, Name = "Kökény Béna", Nationality = "Hungary", Gender = GenderType.Male, Height = 173, Weight = 95, AchivedPlace = 8, CategoryId = categlist.ElementAt(2).CategoryId }, new Competitor { CompetitorId = Guid.NewGuid().ToString(), Number = 4, Name = "Kökény Béláné", Nationality = "Hungary", Gender = GenderType.Female, Height = 164, Weight = 53, AchivedPlace = 15, CategoryId = categlist.ElementAt(3).CategoryId }, new Competitor { CompetitorId = Guid.NewGuid().ToString(), Number = 5, Name = "Kökény Másik Béláné", Nationality = "Hungary", Gender = GenderType.Female, Height = 163, Weight = 57, AchivedPlace = 19, CategoryId = categlist.ElementAt(3).CategoryId }, }; var expected = categlist[0].Name; categrepo.Setup(x => x.ListAll()).Returns(categlist.AsQueryable); comprepo.Setup(x => x.ListAll()).Returns(complist.AsQueryable); var result = s.HighestCompCategory(categlist, complist); Assert.That(result, Is.EqualTo(expected)); }