Пример #1
0
        public IEnumerable <MatchModel> Get(int tournamentId)
        {
            var tournament = Service.FindById(tournamentId);

            if (tournament != null)
            {
                return(tournament.Matches);
            }

            return(null);
        }
Пример #2
0
        public void FindById_GivenExistingTournamentAndId_ShouldReturnTournament()
        {
            //Given
            var tournamentId         = 1;
            var tournamentRepository = Substitute.For <ITournamentRepository>();
            var tournamentService    = new TournamentService(tournamentRepository);
            var tournaments          = new List <Tournament>()
            {
                new Tournament(1, "Tournament 1", DateTime.Now.AddMonths(-2), "Location 1")
            };

            tournamentRepository.FindById(tournamentId).Returns(tournaments);
            //When
            var results = tournamentService.FindById(tournamentId);

            //Then
            results.Should().BeEquivalentTo(tournaments);
        }
 public TournamentModel Get(Int32 id)
 {
     return(Service.FindById(id));
 }