Exemple #1
0
        public void Publish(DomainEvent @event, IPublishEndpoint publisher)
        {
            ConcertTicketsBoughtDomainEvent ticketsBoughtEvent = (ConcertTicketsBoughtDomainEvent)@event;

            ConcertTicketsBoughtEvent concertTicketsBought = new ConcertTicketsBoughtEvent(ticketsBoughtEvent.NumberOfTicketsToBuy, ticketsBoughtEvent.UserId, ticketsBoughtEvent.ConcertId);

            publisher.Publish(concertTicketsBought);
        }
        public void Concert_Applying_ConcertTicketsBoughtDomainEvent()
        {
            ConcertTicketsBoughtDomainEvent ticketsBought = new ConcertTicketsBoughtDomainEvent(10, 5, Guid.NewGuid());
            Concert concert = new Concert("SPENS", 50, DateTime.Now, "Koncert godine", Guid.NewGuid());

            concert.Apply(ticketsBought);
            Assert.True(concert.BoughtTickets.Quantity == 10);
        }
 private void When(ConcertTicketsBoughtDomainEvent concertTicketsBoughtEvent)
 {
     BoughtTickets = BoughtTickets.AddNumberOf(new Tickets(concertTicketsBoughtEvent.NumberOfTicketsToBuy));
 }