public void ShouldPassTicketsIntoEnforcementRules() { //Arrange ParkingTicketDto sampleTicket = new ParkingTicketDto { DateOfOffense = DateTime.MinValue, Fine = 3, Offense = "bad hair", State = "In", TicketID = Guid.NewGuid() }; _MY.Setup(x => x.GetTicketsFromTag(_tag)).Returns(new List <ParkingTicketDto>()); _IL.Setup(x => x.GetTicketsFromTag(_tag)).Returns(new List <ParkingTicketDto>()); _IN.Setup(x => x.GetTicketsFromTag(_tag)).Returns(new List <ParkingTicketDto> { sampleTicket }); _PA.Setup(x => x.GetTicketsFromTag(_tag)).Returns(new List <ParkingTicketDto>()); _EnforcementRules .Setup(x => x.ShouldTowCar(new List <ParkingTicketDto>(), ParkingOffense.BlockingSidewalk, It.IsAny <int>())) .Returns(true); _sut = new TowDeterminerService(_logger.Object, _MY.Object, _IL.Object, _IN.Object, _PA.Object, _EnforcementRules.Object); //Act bool result = _sut.ShouldTowCar(ParkingOffense.BlockingSidewalk, _tag, It.IsAny <int>()); //Assert _EnforcementRules.Verify(x => x.ShouldTowCar(new List <ParkingTicketDto> { sampleTicket }, ParkingOffense.BlockingSidewalk, It.IsAny <int>()), Times.Once); }
public void ShouldReturnFalseForSameViolationOnSameDay() { //Arrange SystemTime.SetDateTime(new DateTime(2019, 05, 22)); _holidayService.Setup(x => x.GetHolidays()) .Returns(new List <HolidayDTO>()); ParkingTicketDto exisitingTicket = new ParkingTicketDto { DateOfOffense = SystemTime.Now(), Fine = 43, Offense = ParkingOffense.ExpiredParkingMeter.ToString(), State = String.Empty }; _myStateParkingAuthority.Setup(x => x.GetTicketsFromTag(_tag)).Returns(new List <ParkingTicketDto> { exisitingTicket }); _sut = new TicketIssuer(_holidayService.Object, _myStateParkingAuthority.Object); //Act bool result = _sut.DetermineTicket(ParkingOffense.ExpiredParkingMeter, _tag); //Assert Assert.IsFalse(result); }