Beispiel #1
0
        public void Given2TeamNames_WhenGetMatchesBetweenTeams_ThenReturnsListOfMatcheasBetweenThem()
        {
            //arrange
            var footballDetails = new List <FootballDetail>()
            {
                new FootballDetail()
                {
                    no      = "1",
                    home    = "Man U",
                    visitor = "Chelsea"
                },
                new FootballDetail()
                {
                    no      = "2",
                    home    = "Man U",
                    visitor = "Chelsea"
                },
                new FootballDetail()
                {
                    no      = "3",
                    home    = "Man City",
                    visitor = "Everton"
                }
            };

            string home    = "Man U";
            string visitor = "Chelsea";

            //act
            var result = _footballService.GetMatchesBetweenTeams(home, visitor, footballDetails);

            //assert
            Assert.IsType <List <FootballDetail> >(result);
            Assert.Equal(2, result.Count);
        }
Beispiel #2
0
        public IActionResult GetMatchesBetween(string home, string visitor)
        {
            var result = _footballService.GetMatchesBetweenTeams(home, visitor, _footballDetails);

            return(Content(JsonConvert.SerializeObject(result)));
        }