public void GivenYearRange_WhenGetMatchesBetweenTheYears_ThenReturnsListOfMatcheasBetweenTheYears() { //arrange var footballDetails = new List <FootballDetail>() { new FootballDetail() { no = "1", home = "Man U", visitor = "Chelsea", Date = new DateTime(2000, 2, 3).ToString("yyyy-MM-dd") }, new FootballDetail() { no = "2", home = "Man U", visitor = "Chelsea", Date = new DateTime(2001, 5, 3).ToString("yyyy-MM-dd") }, new FootballDetail() { no = "3", home = "Man City", visitor = "Everton", Date = new DateTime(2010, 1, 1).ToString("yyyy-MM-dd") } }; string startYear = "2000"; string endYear = "2005"; //act var result = _footballService.GetMatchesBetweenYears(startYear, endYear, footballDetails); //assert Assert.IsType <List <FootballDetail> >(result); Assert.Equal(2, result.Count); }
public IActionResult GetMatchesBetweenYears(string startyear, string endyear) { var result = _footballService.GetMatchesBetweenYears(startyear, startyear, _footballDetails); return(Content(JsonConvert.SerializeObject(result))); }