public void GivenAParkinglotService_WhenGetAllParkinglots_ThenRepositoryReceivedGetAllParkinglots() { //Given Parkinglot newParkinglot = new Parkinglot(); List <Parkinglot> testParkinglots = new List <Parkinglot>() { newParkinglot }; IParkinglotRepository parkinglotRepository = Substitute.For <IParkinglotRepository>(); var parkinglotService = new ParkinglotService(parkinglotRepository); //When var returnParkinglot = parkinglotService.GetAll(); //Then parkinglotRepository.Received().GetAllParkinglots(); }
public void GivenAParkinglotService_WhenGetAllParkinglots_ThenListOfParkinglotsIsReturned() { //Given Parkinglot newParkinglot = new Parkinglot(); List <Parkinglot> testParkinglots = new List <Parkinglot>() { newParkinglot }; IParkinglotRepository parkinglotRepository = Substitute.For <IParkinglotRepository>(); parkinglotRepository.GetAllParkinglots().Returns(testParkinglots); var parkinglotService = new ParkinglotService(parkinglotRepository); //When var returnParkinglot = parkinglotService.GetAll(); //Then Assert.IsType <List <Parkinglot> >(returnParkinglot); }