Esempio n. 1
0
        public void FindByDate_GivenItemsExist_ShouldReturnMatchingItems()
        {
            //Given
            var tournamentRepository = Substitute.For <ITournamentRepository>();
            var tournamentService    = new TournamentService(tournamentRepository);
            var tournaments          = new List <Tournament>()
            {
                new Tournament(1, "Tournament 1", DateTime.Parse("2018/10/18"), "Location 1"),
                new Tournament(2, "Tournament 2", DateTime.Parse("2019/12/25"), "Location 2"),
                new Tournament(3, "Tournament 3", DateTime.Parse("2016/01/01"), "Location 3")
            };

            tournamentRepository.FindByDate(Arg.Any <DateTime>()).Returns(tournaments);
            //When
            var results = tournamentService.FindByDate(DateTime.Parse("2018/10/18"));

            //Then
            results.Should().BeEquivalentTo(tournaments);
        }