Пример #1
0
        public void Setup()
        {
            this._pricingService = new Mock <IPricingService>();
            this._pricingService.Setup(x => x.CalculateTotal(ConferenceId, It.IsAny <ICollection <SeatQuantity> >()))
            .Returns(OrderTotal);

            this._sut = new EventSourcingTestHelper <Order>();
            this._sut.Setup(new OrderCommandHandler(this._sut.Repository, this._pricingService.Object));
        }
        public void Setup()
        {
            this._pricingService = new Mock <IPricingService>();
            this._pricingService.Setup(x => x.CalculateTotal(ConferenceId, It.IsAny <ICollection <SeatQuantity> >()))
            .Returns(OrderTotal);

            this._sut = new EventSourcingTestHelper <Order>();
            this._sut.Setup(new OrderCommandHandler(this._sut.Repository, this._pricingService.Object));

            this._sut.Given(new OrderPlaced {
                SourceId     = OrderId,
                ConferenceId = ConferenceId,
                Seats        = new[] { new SeatQuantity(SeatTypeId, 5) },
                ReservationAutoExpiration = DateTime.UtcNow
            });
        }
Пример #3
0
        public void Setup()
        {
            this._seatHelper  = new EventSourcingTestHelper <SeatAssignments>();
            this._orderHelper = new EventSourcingTestHelper <Order>();

            this._orderHelper.Setup(new OrderCommandHandler(this._orderHelper.Repository, Mock.Of <IPricingService>()));
            this._orderHelper.Given(new OrderPlaced()
            {
                SourceId     = _orderId,
                ConferenceId = Guid.NewGuid(),
                Seats        = new[] {
                    new SeatQuantity(Guid.NewGuid(), 5),
                    new SeatQuantity(Guid.NewGuid(), 10)
                },
                ReservationAutoExpiration = DateTime.UtcNow.AddDays(1),
                AccessCode = HandleGenerator.Generate(6)
            }, new OrderPaymentConfirmed()
            {
                SourceId = _orderId
            });

            this._seatHelper.Setup(new SeatAssignmentsHandler(this._orderHelper.Repository, this._seatHelper.Repository));
        }
Пример #4
0
 public void Setup()
 {
     this._sut = new EventSourcingTestHelper <SeatAssignments>();
     this._sut.Setup(new SeatAssignmentsHandler(Mock.Of <IEventSourcedRepository <Order> >(), this._sut.Repository));
     this._sut.Given(new SeatAssignmentsCreated {
         SourceId = this._assignmentsId,
         OrderId  = this._orderId,
         Seats    = Enumerable.Range(0, 5).Select(i =>
                                                  new SeatAssignmentsCreated.SeatAssignmentInfo {
             Position = i,
             SeatType = this._seatType,
         })
     },
                     new SeatAssigned(this._assignmentsId)
     {
         Position = 0,
         SeatType = this._seatType,
         Attendee = new PersonalInfo {
             Email     = "*****@*****.**",
             FirstName = "A",
             LastName  = "Z",
         }
     });
 }