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.")); }
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(); }
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))); }
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(); }