public void when_assigning_previously_assigned_seat_to_new_email_then_reassigns_seat_with_two_events()
        {
            var command = new AssignSeat
            {
                SeatAssignmentsId = assignmentsId,
                Position          = 0,
                Attendee          = new PersonalInfo
                {
                    Email     = "*****@*****.**",
                    FirstName = "B",
                    LastName  = "Z",
                }
            };

            sut.When(command);

            var unassign = sut.ThenHasOne <SeatUnassigned>();

            Assert.Equal(0, unassign.Position);
            Assert.Equal(assignmentsId, unassign.SourceId);

            var assign = sut.ThenHasOne <SeatAssigned>();

            Assert.Equal(0, assign.Position);
            Assert.Equal(seatType, assign.SeatType);
            Assert.Equal(assignmentsId, assign.SourceId);
            Assert.Equal(command.Attendee, assign.Attendee);
        }
        public void when_complete_order_successfully()
        {
            var completeOrder = new ChangeOrderStatus
            {
                Status = new OrderStatusDetail {
                    OrderId = _orderId, Status = OrderStatus.Completed
                },
                Fare      = 23,
                Toll      = 2,
                Tip       = 5,
                Tax       = 3,
                Surcharge = 1
            };

            _sut.When(completeOrder);

            var @event = _sut.ThenHasOne <OrderStatusChanged>();

            Assert.AreEqual(_orderId, @event.SourceId);
            Assert.AreEqual(completeOrder.Fare, @event.Fare);
            Assert.AreEqual(completeOrder.Toll, @event.Toll);
            Assert.AreEqual(completeOrder.Tip, @event.Tip);
            Assert.AreEqual(completeOrder.Tax, @event.Tax);
            Assert.AreEqual(completeOrder.Surcharge, @event.Surcharge);
            Assert.AreEqual(true, @event.IsCompleted);
        }
        public void when_add_first_credit_card()
        {
            const string creditCardCompany = "visa";
            const string nameOnCard        = "Bob";
            var          creditCardId      = Guid.NewGuid();
            const string last4Digits       = "4025";
            const string expirationMonth   = "5";
            const string expirationYear    = "2020";
            const string token             = "jjwcnSLWm85";

            _sut.When(new AddOrUpdateCreditCard
            {
                AccountId         = _accountId,
                CreditCardCompany = creditCardCompany,
                NameOnCard        = nameOnCard,
                CreditCardId      = creditCardId,
                Last4Digits       = last4Digits,
                ExpirationMonth   = expirationMonth,
                ExpirationYear    = expirationYear,
                Token             = token,
                Id = Guid.NewGuid()
            });

            var @event = _sut.ThenHasOne <CreditCardAddedOrUpdated>();

            Assert.AreEqual(_accountId, @event.SourceId);
            Assert.AreEqual(creditCardCompany, @event.CreditCardCompany);
            Assert.AreEqual(nameOnCard, @event.NameOnCard);
            Assert.AreEqual(creditCardId, @event.CreditCardId);
            Assert.AreEqual(last4Digits, @event.Last4Digits);
            Assert.AreEqual(expirationMonth, @event.ExpirationMonth);
            Assert.AreEqual(expirationYear, @event.ExpirationYear);
            Assert.AreEqual(token, @event.Token);
        }
Esempio n. 4
0
        public void when_creating_order_then_is_placed_with_specified_id()
        {
            sut.When(new RegisterToConference {
                ConferenceId = ConferenceId, OrderId = OrderId, Seats = new[] { new SeatQuantity(SeatTypeId, 5) }
            });

            Assert.Equal(OrderId, sut.ThenHasOne <OrderPlaced>().SourceId);
        }
Esempio n. 5
0
        public void when_updating_an_order_then_updates_seats()
        {
            sut.When(new RegisterToConference {
                OrderId = OrderId, Seats = new[] { new SeatQuantity(SeatTypeId, 4) }
            });

            var updated = sut.ThenHasOne <OrderUpdated>();

            Assert.Equal(OrderId, updated.SourceId);
            Assert.Equal(SeatTypeId, updated.Seats.First().SeatType);
            Assert.Equal(4, updated.Seats.First().Quantity);
        }
Esempio n. 6
0
        public void when_updating_seats_then_updates_order_with_new_seats()
        {
            sut.When(new RegisterToConference {
                ConferenceId = ConferenceId, OrderId = OrderId, Seats = new[] { new SeatQuantity(SeatTypeId, 20) }
            });

            var @event = sut.ThenHasOne <OrderUpdated>();

            Assert.Equal(OrderId, @event.SourceId);
            Assert.Equal(1, @event.Seats.Count());
            Assert.Equal(20, @event.Seats.ElementAt(0).Quantity);
        }
Esempio n. 7
0
        public void ENTONCES_puedo_agregar_animales_una_vez()
        {
            var command = new AgregarAnimales(this.guid.NewGuid(), this.guid.NewGuid(), this.guid.NewGuid(), this.guid.NewGuid(), 7, 1870);

            this.sut.When(command);

            var e = sut.ThenHasOne <SeAgregaronAnimalesAlInventario>();

            Assert.Equal(command.IdEmpresa, e.IdEmpresa);
            Assert.Equal(command.Animal, e.Animal);
            Assert.Equal(command.Sucursal, e.Sucursal);
            Assert.Equal(command.Cantidad, e.Cantidad);
            Assert.Equal(command.Periodo, e.Periodo);
        }
Esempio n. 8
0
        public void when_updating_successfully()
        {
            int?defaultTipPercent = 15;

            _sut.When(new UpdateBookingSettings
            {
                AccountId         = _accountId,
                Email             = "*****@*****.**",
                Name              = "Robert2 Smither2",
                ChargeTypeId      = 12,
                NumberOfTaxi      = 3,
                Phone             = "123",
                Passengers        = 3,
                ProviderId        = 85,
                VehicleTypeId     = 69,
                DefaultTipPercent = defaultTipPercent,
                AccountNumber     = "1234",
                CustomerNumber    = "0"
            });

            var @event = _sut.ThenHasOne <BookingSettingsUpdated>();

            Assert.AreEqual(_accountId, @event.SourceId);
            Assert.AreEqual("*****@*****.**", @event.Email);
            Assert.AreEqual("Robert2 Smither2", @event.Name);
            Assert.AreEqual(12, @event.ChargeTypeId);
            Assert.AreEqual(3, @event.NumberOfTaxi);
            Assert.AreEqual("123", @event.Phone);
            Assert.AreEqual(3, @event.Passengers);
            Assert.AreEqual(85, @event.ProviderId);
            Assert.AreEqual(69, @event.VehicleTypeId);
            Assert.AreEqual("1234", @event.AccountNumber);
            Assert.AreEqual("0", @event.CustomerNumber);
            Assert.AreEqual(defaultTipPercent, @event.DefaultTipPercent);
        }
        public void CUANDO_se_aggregan_animales_al_inventario_ENTONCES_se_actualiza_el_resumen_del_periodo()
        {
            var idEmpresa = this.guid.NewGuid();
            var animal    = this.guid.NewGuid();
            var sucursal  = this.guid.NewGuid();

            var hydratingEvent =
                new SeActualizoResumenDeAnimalesPorPeriodo
            {
                SourceId           = idEmpresa,
                CantidadDeAnimales = 4,
                Periodo            = 2015
            };

            var newEvent =
                new SeAgregaronAnimalesAlInventario
            {
                SourceId  = idEmpresa,
                IdEmpresa = idEmpresa,
                Animal    = animal,
                Sucursal  = sucursal,
                Cantidad  = 6,
                Periodo   = 2015
            };

            this.sut.Given(hydratingEvent);

            this.sut.When(newEvent);

            var olapEvent = sut.ThenHasOne <SeActualizoResumenDeAnimalesPorPeriodo>();

            Assert.Equal(2015, olapEvent.Periodo);
            Assert.Equal(10, olapEvent.CantidadDeAnimales);
        }
Esempio n. 10
0
        public void when_paymentmode_changed()
        {
            var newSettings = new ServerPaymentSettings
            {
                PaymentMode = PaymentMethod.Braintree
            };

            _sut.When(new UpdatePaymentSettings
            {
                ServerPaymentSettings = newSettings
            });


            Assert.AreEqual(2, _sut.Events.Count);
            var evt  = _sut.ThenHasOne <PaymentSettingUpdated>();
            var evt2 = _sut.ThenHasOne <PaymentModeChanged>();

            Assert.AreEqual(_companyId, evt2.SourceId);
        }
        public void when_ridelinq_update_trip_info()
        {
            _sut.When(new UpdateTripInfoInOrderForManualRideLinq
            {
                OrderId   = _orderId,
                Distance  = 25d,
                Fare      = 15f,
                Tax       = 3f,
                TollTotal = 1f,
                Extra     = .5f,
                Tip       = 1.5f,
            });

            var @event = _sut.ThenHasOne <ManualRideLinqTripInfoUpdated>();

            Assert.AreEqual(15f, @event.Fare);
            Assert.AreEqual(3f, @event.Tax);
            Assert.AreEqual(1.5f, @event.Tip);
            Assert.AreEqual(25d, @event.Distance);
            Assert.AreEqual(1f, @event.Toll);
            Assert.AreEqual(.5f, @event.Extra);
            Assert.IsNull(@event.EndTime);
        }