public void FindAll_GivenNoItemsExist_ShouldReturnEmptyCollection() { //Given var tournamentRepository = Substitute.For <ITournamentRepository>(); var tournamentService = new TournamentService(tournamentRepository); tournamentRepository.FindAll().Returns(new List <Tournament>()); //When var results = tournamentService.FindAll(); //Then results.Should().BeNullOrEmpty(); }
public void FindAll_GivenItemsExist_ShouldReturnAll() { //Given 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"), new Tournament(2, "Tournament 2", DateTime.Now.AddMonths(2), "Location 2"), new Tournament(3, "Tournament 3", DateTime.Now.AddYears(2), "Location 3") }; tournamentRepository.FindAll().Returns(tournaments); //When var results = tournamentService.FindAll(); //Then results.Should().BeEquivalentTo(tournaments); }
public IEnumerable <TournamentModel> Get() { return(Service.FindAll()); }