示例#1
0
 public void TicketSaleGetAvailabilityThrowsWhenSaleHasEnded()
 {
     new QueryScenarioFor <TicketSale>(TicketSale.Factory).
     Given(
         TicketSaleEvents.Started(TicketSaleId, ConcertId, DateTimeOffset.UtcNow.Date, 100),
         TicketSaleEvents.Ended(TicketSaleId, DateTimeOffset.UtcNow.Date)).
     When(sut => sut.GetAvailability()).
     AssertThrows(new InvalidOperationException("The ticket sale has ended."));
 }
示例#2
0
 public void TicketSaleGetAvailabilityReturnsExpectedSeatCount()
 {
     new QueryScenarioFor <TicketSale>(TicketSale.Factory).
     Given(
         TicketSaleEvents.Started(TicketSaleId, ConcertId, DateTimeOffset.UtcNow.Date, 100)).
     When(sut => sut.GetAvailability()).
     Then(new SeatCount(100)).
     Assert();
 }
示例#3
0
 public TicketSale StartTicketSale(TicketSaleId ticketSaleId, DateTimeOffset date)
 {
     if (_cancelled)
     {
         throw new InvalidOperationException(
                   "Starting a ticket sale for a cancelled concert is impossible.");
     }
     return(new TicketSale(TicketSaleEvents.Started(ticketSaleId, _id, date, 100)));
 }
示例#4
0
 public void PlannedConcertCanHaveTicketSaleStarted()
 {
     new FactoryScenarioFor <Concert>(Concert.Factory).
     Given(
         ConcertEvents.Planned(ConcertId)).
     When(sut => sut.StartTicketSale(TicketSaleId, DateTimeOffset.UtcNow.Date)).
     Then(
         TicketSaleEvents.Started(TicketSaleId, ConcertId, DateTimeOffset.UtcNow.Date, 100)).
     Assert();
 }