public given_seat_assignments()
 {
     this.sut = new EventSourcingTestHelper<SeatAssignments>();
     this.sut.Setup(new SeatAssignmentsHandler(Mock.Of<IEventSourcedRepository<Order>>(), this.sut.Repository));
     this.sut.Given(new SeatAssignmentsCreated
     {
         SourceId = assigmentsId,
         OrderId = orderId,
         Seats = Enumerable.Range(0, 5).Select(i =>
             new SeatAssignmentsCreated.SeatAssignmentInfo
             {
                 Position = i,
                 SeatType = seatType,
             })
     },
     new SeatAssigned(assigmentsId)
     {
         Position = 0,
         SeatType = seatType,
         Attendee = new PersonalInfo
         {
             Email = "*****@*****.**",
             FirstName = "A",
             LastName = "Z",
         }
     });
 }
 public void SetUp()
 {
     _accountId = Guid.NewGuid();
     _addressId = Guid.NewGuid();
     _sut       = new EventSourcingTestHelper <Account>();
     _sut.Setup(new AccountCommandHandler(_sut.Repository, null, null));
     _sut.Given(new AccountRegistered
     {
         SourceId = _accountId,
         Name     = "Bob",
         Password = null,
         Email    = "*****@*****.**"
     });
     _sut.Given(new FavoriteAddressAdded
     {
         SourceId = _accountId,
         Address  = new Address
         {
             Id           = _addressId,
             FriendlyName = "Chez François",
             Apartment    = "3939",
             FullAddress  = "1234 rue Saint-Hubert",
             RingCode     = "3131",
             Latitude     = 45.515065,
             Longitude    = -73.558064
         }
     });
 }
예제 #3
0
 public given_seat_assignments()
 {
     this.sut = new EventSourcingTestHelper <SeatAssignments>();
     this.sut.Setup(new SeatAssignmentsHandler(Mock.Of <IEventSourcedRepository <Order> >(), this.sut.Repository));
     this.sut.Given(new SeatAssignmentsCreated
     {
         SourceId = assignmentsId,
         OrderId  = orderId,
         Seats    = Enumerable.Range(0, 5).Select(i =>
                                                  new SeatAssignmentsCreated.SeatAssignmentInfo
         {
             Position = i,
             SeatType = seatType,
         })
     },
                    new SeatAssigned(assignmentsId)
     {
         Position = 0,
         SeatType = seatType,
         Attendee = new PersonalInfo
         {
             Email     = "*****@*****.**",
             FirstName = "A",
             LastName  = "Z",
         }
     });
 }
        public void Setup()
        {
            _sut = new EventSourcingTestHelper <Account>();

            _emailSenderMock = new Mock <IEmailSender>();
            _orderDaoMock    = new Mock <IOrderDao>();
            _accountDaoMock  = new Mock <IAccountDao>();
            _serverSettings  = new TestServerSettings();
            _serverSettings.SetSetting("TaxiHail.ApplicationName", ApplicationName);

            var notificationService = new NotificationService(
                () => new BookingDbContext(DbName),
                null,
                new TemplateService(_serverSettings),
                _emailSenderMock.Object,
                _serverSettings,
                new ConfigurationDao(() => new ConfigurationDbContext(DbName)),
                _orderDaoMock.Object,
                _accountDaoMock.Object,
                new StaticMap(),
                null,
                null,
                null,
                new Logger(),
                new CryptographyService(WinRTCrypto.CryptographicEngine, WinRTCrypto.SymmetricKeyAlgorithmProvider, WinRTCrypto.HashAlgorithmProvider, new Logger()));

            notificationService.SetBaseUrl(new Uri("http://www.example.net"));
            _sut.Setup(new EmailCommandHandler(notificationService));
        }
예제 #5
0
 public given_no_order()
 {
     pricingService = new Mock <IPricingService>();
     pricingService.Setup(x => x.CalculateTotal(ConferenceId, It.IsAny <ICollection <SeatQuantity> >())).Returns(OrderTotal);
     sut = new EventSourcingTestHelper <Order>();
     sut.Setup(new OrderCommandHandler(sut.Repository, pricingService.Object));
 }
 public void Setup()
 {
     _sut = new EventSourcingTestHelper <Order>();
     _sut.Setup(new OrderCommandHandler(_sut.Repository, () => new BookingDbContext(DbName)));
     _sut.Given(new AccountRegistered
     {
         SourceId = _accountId,
         Name     = "Bob",
         Password = null,
         Email    = "*****@*****.**"
     });
     _sut.Given(new OrderCreated
     {
         SourceId      = _orderId,
         AccountId     = Guid.NewGuid(),
         PickupDate    = DateTime.Now,
         PickupAddress = new Address
         {
             FullAddress = "1234 rue Saint-Hubert",
             Apartment   = "3939",
             RingCode    = "3131",
             Latitude    = 45.515065,
             Longitude   = -73.558064,
         }
     });
 }
예제 #7
0
        public void Setup()
        {
            _sut = new EventSourcingTestHelper <Promotion>();

            _sut.Setup(new PromotionCommandHandler(_sut.Repository));
            _sut.Given(new PromotionCreated
            {
                SourceId                = _promoId,
                Name                    = "promo1",
                Description             = "promodesc1",
                Code                    = _code,
                AppliesToCurrentBooking = true,
                AppliesToFutureBooking  = false,
                DiscountType            = _type,
                DiscountValue           = _value,
                DaysOfWeek              = new[] { DayOfWeek.Monday, DayOfWeek.Tuesday },
                MaxUsage                = 2,
                MaxUsagePerUser         = 1,
                StartDate               = new DateTime(2014, 11, 10),
                EndDate                 = new DateTime(2015, 11, 10),
                StartTime               = new DateTime(SqlDateTime.MinValue.Value.Year, SqlDateTime.MinValue.Value.Month, SqlDateTime.MinValue.Value.Day, 10, 0, 0),
                EndTime                 = new DateTime(SqlDateTime.MinValue.Value.Year, SqlDateTime.MinValue.Value.Month, SqlDateTime.MinValue.Value.Day, 14, 0, 0),
                PublishedStartDate      = new DateTime(2014, 11, 9),
                PublishedEndDate        = new DateTime(2015, 11, 10),
                TriggerSettings         = new PromotionTriggerSettings()
            });
            _sut.Given(new PromotionActivated {
                SourceId = _promoId
            });
        }
        public void Setup()
        {
            sut = new EventSourcingTestHelper <Order>();

            _emailSenderMock = new Mock <IEmailSender>();
            _orderDaoMock    = new Mock <IOrderDao>();
            _accountDaoMock  = new Mock <IAccountDao>();
            _serverSettings  = new TestServerSettings();
            _geocodingMock   = new Mock <IGeocoding>();
            var taxihailNetworkServiceClientMock = new Mock <ITaxiHailNetworkServiceClient>();

            taxihailNetworkServiceClientMock
            .Setup(x => x.GetCompanyMarketSettings(It.IsAny <double>(), It.IsAny <double>()))
            .Returns(new CompanyMarketSettingsResponse());
            _serverSettings.SetSetting("TaxiHail.ApplicationName", ApplicationName);

            var notificationService = new NotificationService(() => new BookingDbContext(DbName),
                                                              null,
                                                              new TemplateService(_serverSettings),
                                                              _emailSenderMock.Object,
                                                              _serverSettings,
                                                              new ConfigurationDao(() => new ConfigurationDbContext(DbName)),
                                                              _orderDaoMock.Object,
                                                              _accountDaoMock.Object,
                                                              new StaticMap(),
                                                              null,
                                                              _geocodingMock.Object,
                                                              taxihailNetworkServiceClientMock.Object,
                                                              new Logger(),
                                                              new CryptographyService(WinRTCrypto.CryptographicEngine, WinRTCrypto.SymmetricKeyAlgorithmProvider, WinRTCrypto.HashAlgorithmProvider, new Logger()));

            notificationService.SetBaseUrl(new Uri("http://www.example.net"));

            sut.Setup(new EmailCommandHandler(notificationService));
        }
예제 #9
0
 public given_no_order()
 {
     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, pricingService.Object));
 }
        public void Setup()
        {
            _sut = new EventSourcingTestHelper <Account>();

            _smsSenderMock = new Mock <ISmsService>();

            _orderDaoMock   = new Mock <IOrderDao>();
            _serverSettings = new TestServerSettings();
            _serverSettings.SetSetting("TaxiHail.ApplicationName", ApplicationName);
            _serverSettings.SetSetting("SMSConfirmationEnabled", "true");
            _serverSettings.SetSetting("SMSAccountSid", "AC081ad5bacfad6c50e0598052fc062693");
            _serverSettings.SetSetting("SMSAuthToken", "9b142e2d163a5688ada040d8c71e3fb1");
            _serverSettings.SetSetting("SMSFromNumber", "15147002781");

            _sut.Setup(new SmsCommandHandler(new NotificationService(null,
                                                                     null,
                                                                     null,
                                                                     null,
                                                                     _serverSettings,
                                                                     null,
                                                                     _orderDaoMock.Object,
                                                                     null,
                                                                     new StaticMap(),
                                                                     _smsSenderMock.Object,
                                                                     null,
                                                                     null,
                                                                     null,
                                                                     new CryptographyService(WinRTCrypto.CryptographicEngine, WinRTCrypto.SymmetricKeyAlgorithmProvider, WinRTCrypto.HashAlgorithmProvider, new Logger()))));
        }
예제 #11
0
 public void given_a_company_setup()
 {
     _sut = new EventSourcingTestHelper <Company>();
     _sut.Setup(new CompanyCommandHandler(_sut.Repository, null));
     _sut.Given(new CompanyCreated {
         SourceId = _companyId
     });
 }
예제 #12
0
        public void Setup()
        {
            Sut = new EventSourcingTestHelper <Order>();

            EmailSenderMock      = new Mock <IEmailSender>();
            ConfigurationManager = new TestServerSettings();
            TemplateServiceMock  = new Mock <ITemplateService>();

            TemplateServiceMock.Setup(x => x.Render(It.IsAny <string>(), It.IsAny <object>())).Returns("");
            TemplateServiceMock.Setup(x => x.Find(It.IsAny <string>(), It.IsAny <string>())).Returns("");
        }
예제 #13
0
 public void SetUp()
 {
     _sut = new EventSourcingTestHelper <Company>();
     _sut.Setup(new CompanyCommandHandler(_sut.Repository, null));
     _sut.Given(new CompanyCreated {
         SourceId = _companyId
     });
     _sut.Given(new TariffCreated {
         SourceId = _companyId, TariffId = _tariffRateId, Type = TariffType.Default
     });
 }
예제 #14
0
 public void Setup()
 {
     _sut = new EventSourcingTestHelper <Order>();
     _sut.Setup(new OrderCommandHandler(_sut.Repository, () => new BookingDbContext(DbName)));
     _sut.Given(new AccountRegistered
     {
         SourceId = _accountId,
         Name     = "Bob",
         Password = null,
         Email    = "*****@*****.**"
     });
 }
예제 #15
0
 public void Setup()
 {
     _sut = new EventSourcingTestHelper <Account>();
     _sut.Setup(new AccountCommandHandler(_sut.Repository, new PasswordService(), null));
     _sut.Given(new AccountRegistered
     {
         SourceId = _accountId,
         Name     = "Bob Smith",
         Password = null,
         Email    = "*****@*****.**"
     });
 }
 public void setup()
 {
     _sut      = new EventSourcingTestHelper <Company>();
     _otherSut = new EventSourcingTestHelper <Account>();
     _sut.Setup(new CompanyCommandHandler(_sut.Repository, _otherSut.Repository));
     _sut.Given(new CompanyCreated {
         SourceId = _companyId
     });
     _otherSut.Given(new AccountRegistered {
         SourceId = _accountId
     });
 }
예제 #17
0
        public given_placed_order()
        {
            pricingService = new Mock <IPricingService>();
            pricingService.Setup(x => x.CalculateTotal(ConferenceId, It.IsAny <ICollection <SeatQuantity> >())).Returns(OrderTotal);
            sut = new EventSourcingTestHelper <Order>();
            sut.Setup(new OrderCommandHandler(sut.Repository, pricingService.Object));

            sut.Given(
                new OrderPlaced {
                SourceId     = OrderId,
                ConferenceId = ConferenceId,
                Seats        = new[] { new SeatQuantity(SeatTypeId, 5) },
                ReservationAutoExpiration = DateTime.UtcNow
            });
        }
예제 #18
0
        public void Setup()
        {
            _orderId   = Guid.NewGuid();
            _paymentId = Guid.NewGuid();

            _sut = new EventSourcingTestHelper <CreditCardPayment>();
            _sut.Setup(new CreditCardPaymentCommandHandler(_sut.Repository));
            _sut.Given(new CreditCardPaymentInitiated
            {
                SourceId      = _paymentId,
                OrderId       = _orderId,
                TransactionId = "the transaction",
                Amount        = _preAuthAmount
            });
        }
예제 #19
0
 public void Setup()
 {
     _sut = new EventSourcingTestHelper <Company>();
     _sut.Setup(new CompanyCommandHandler(_sut.Repository, null));
     _sut.Given(new CompanyCreated {
         SourceId = _companyId
     });
     _sut.Given(new PaymentSettingUpdated
     {
         SourceId = _companyId,
         ServerPaymentSettings = new ServerPaymentSettings
         {
             PaymentMode = PaymentMethod.Cmt
         }
     });
 }
        public void Setup()
        {
            _orderId   = Guid.NewGuid();
            _paymentId = Guid.NewGuid();
            _authCode  = "123456";

            _sut = new EventSourcingTestHelper <CreditCardPayment>();
            _sut.Setup(new CreditCardPaymentCommandHandler(_sut.Repository));
            _sut.Given(new CreditCardPaymentInitiated
            {
                SourceId      = _paymentId,
                OrderId       = _orderId,
                TransactionId = "the transaction",
                Amount        = 12.34m
            });
            _sut.Given(new CreditCardPaymentCaptured_V2 {
                SourceId = _paymentId
            });
        }
        public given_a_paid_order()
        {
            this.sut = 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.sut.Setup(new SeatAssignmentsHandler(this.orderHelper.Repository, this.sut.Repository));
        }
        public given_a_paid_order()
        {
            sut         = new EventSourcingTestHelper <SeatAssignments>();
            orderHelper = new EventSourcingTestHelper <Order>();
            orderHelper.Setup(new OrderCommandHandler(orderHelper.Repository, Mock.Of <IPricingService>()));
            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
            });

            sut.Setup(new SeatAssignmentsHandler(orderHelper.Repository, sut.Repository));
        }
 public void SetUp()
 {
     _sut = new EventSourcingTestHelper <Company>();
     _sut.Setup(new CompanyCommandHandler(_sut.Repository, null));
     _sut.Given(new CompanyCreated {
         SourceId = _companyId
     });
     _sut.Given(new PopularAddressAdded
     {
         SourceId = _companyId,
         Address  =
             new Address
         {
             Id           = _addressId,
             FriendlyName = "Chez François popular",
             Apartment    = "3939",
             FullAddress  = "1234 rue Saint-Hubert",
             RingCode     = "3131",
             Latitude     = 45.515065,
             Longitude    = -73.558064
         }
     });
 }
 public DADO_reporte_nuevo()
 {
     this.guid = new SequentialGuid();
     this.sut  = new EventSourcingTestHelper <AnimalesDeTodosLosPeriodos>();
     this.sut.Setup(new AnimalesDeTodosLosPeriodosHandler(this.sut.Store));
 }
        public given_placed_order()
        {
            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(sut.Repository, pricingService.Object));

            this.sut.Given(
                    new OrderPlaced 
                    { 
                        SourceId = OrderId,
                        ConferenceId = ConferenceId,
                        Seats = new[] { new SeatQuantity(SeatTypeId, 5) },
                        ReservationAutoExpiration = DateTime.UtcNow
                    });
        }
 public given_no_order()
 {
     this.sut = new EventSourcingTestHelper<Order>();
     this.sut.Setup(new OrderCommandHandler(this.sut.Repository, Mock.Of<IPricingService>()));
 }
        public given_fully_reserved_order()
        {
            this.sut = new EventSourcingTestHelper<Order>();
            this.sut.Setup(new OrderCommandHandler(this.sut.Repository, Mock.Of<IPricingService>()));

            this.sut.Given(
                new OrderPlaced
                    {
                        SourceId = OrderId,
                        ConferenceId = ConferenceId,
                        Seats = new[] { new SeatQuantity(SeatTypeId, 5) },
                        ReservationAutoExpiration = DateTime.UtcNow
                    },
                new OrderReservationCompleted
                    {
                        SourceId = OrderId,
                        ReservationExpiration = DateTime.UtcNow.AddMinutes(5),
                        Seats = new[] { new SeatQuantity(SeatTypeId, 5) }
                    });
        }
 public void given_no_company_setup()
 {
     _sut = new EventSourcingTestHelper <Company>();
     _sut.Setup(new CompanyCommandHandler(_sut.Repository, null));
 }
예제 #29
0
 public DADO_inventario_vacio()
 {
     this.guid = new SequentialGuid();
     this.sut  = new EventSourcingTestHelper <Inventario>();
     this.sut.Setup(new InventarioHandler(this.sut.Store));
 }
 public void given_no_account_setup()
 {
     _sut = new EventSourcingTestHelper <Account>();
     _sut.Setup(new AccountCommandHandler(_sut.Repository, new PasswordService(), null));
 }
예제 #31
0
 public void Setup()
 {
     _sut = new EventSourcingTestHelper <CreditCardPayment>();
     _sut.Setup(new CreditCardPaymentCommandHandler(_sut.Repository));
 }
예제 #32
0
 public void given_no_promotion_setup()
 {
     _sut = new EventSourcingTestHelper <Domain.Promotion>();
     _sut.Setup(new PromotionCommandHandler(_sut.Repository));
 }