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); }
public TicketEmission CreateEmission(double price, DateTime begDate, DateTime endDate) { TicketIssuer = new TicketIssuer(); TicketEmission tE = TicketIssuer.createEmission(price, begDate, endDate); _db.TicketEmissions.Add(tE); _db.SaveChanges(); return(tE); }
public void ShouldNotCareAboutHolidaysWhenParkingInAHandicappedSpot() { //Scenario: Users report slowness when issuing tickets. // One optimization we can make is only call the // holiday lookups when it is a holiday. //Arrange _myStateParkingAuthority.Setup(x => x.GetTicketsFromTag(_tag)).Returns(new List <ParkingTicketDto>()); _sut = new TicketIssuer(_holidayService.Object, _myStateParkingAuthority.Object); //Act bool result = _sut.DetermineTicket(ParkingOffense.HandicappedParkingSpot, _tag); //Assert _holidayService.Verify(x => x.GetHolidays(), Times.Never); }
public void ShouldIssueTicketForExpiredMeterOnNonHoliday() { //Arrange SystemTime.SetDateTime(new DateTime(2019, 05, 24)); _holidayService.Setup(x => x.GetHolidays()) .Returns( new List <HolidayDTO> { new HolidayDTO { Date = new DateTime(2019, 05, 22), TitleOfDay = "Mayor's Birthday" }, }); _myStateParkingAuthority.Setup(x => x.GetTicketsFromTag(_tag)).Returns(new List <ParkingTicketDto>()); _sut = new TicketIssuer(_holidayService.Object, _myStateParkingAuthority.Object); //Act bool result = _sut.DetermineTicket(ParkingOffense.ExpiredParkingMeter, _tag); //Assert _myStateParkingAuthority.Verify(x => x.IssueParkingTicketDto(ParkingOffense.ExpiredParkingMeter.ToString(), 30), Times.Once); }
public void ShouldReturnTrueHydrantOnNonHoliday() { //Arrange SystemTime.SetDateTime(new DateTime(2019, 05, 22)); _holidayService.Setup(x => x.GetHolidays()) .Returns( new List <HolidayDTO> { new HolidayDTO { Date = new DateTime(2019, 05, 22), TitleOfDay = "Mayor's Birthday" }, }); _myStateParkingAuthority.Setup(x => x.GetTicketsFromTag(_tag)).Returns(new List <ParkingTicketDto>()); _sut = new TicketIssuer(_holidayService.Object, _myStateParkingAuthority.Object); //Act bool result = _sut.DetermineTicket(ParkingOffense.BlockingFireHydrant, _tag); //Assert Assert.IsTrue(result); }