public void Build_returns_new_store_instance()
        {
            var builder = new StoreBuilder <AppState>(new AppReducer());
            var store   = builder.Build();

            Assert.NotNull(store);
        }
Exemplo n.º 2
0
        public void GivenStore_WhenDeriving_ThenRequiredRelationsMustExist()
        {
            var builder = new StoreBuilder(this.Session);

            builder.Build();

            Assert.True(this.Session.Derive(false).HasErrors);

            this.Session.Rollback();

            builder.WithName("Organisation store");
            builder.Build();

            Assert.True(this.Session.Derive(false).HasErrors);

            this.Session.Rollback();

            builder.WithDefaultCarrier(new Carriers(this.Session).Fedex);
            builder.Build();

            Assert.True(this.Session.Derive(false).HasErrors);

            this.Session.Rollback();

            builder.WithDefaultShipmentMethod(new ShipmentMethods(this.Session).Ground);
            builder.Build();

            Assert.False(this.Session.Derive(false).HasErrors);

            builder.WithSalesInvoiceNumberCounter(new CounterBuilder(this.Session).Build()).Build();
            builder.Build();

            Assert.False(this.Session.Derive(false).HasErrors);

            builder.WithFiscalYearsStoreSequenceNumber(new FiscalYearStoreSequenceNumbersBuilder(this.Session).WithFiscalYear(DateTime.Today.Year).Build());
            builder.Build();

            Assert.True(this.Session.Derive(false).HasErrors);
        }
Exemplo n.º 3
0
        public void GivenStore_WhenDeriving_ThenRequiredRelationsMustExist()
        {
            var builder = new StoreBuilder(this.DatabaseSession);
            builder.Build();

            Assert.IsTrue(this.DatabaseSession.Derive().HasErrors);

            this.DatabaseSession.Rollback();

            builder.WithName("Organisation store");
            builder.Build();

            Assert.IsTrue(this.DatabaseSession.Derive().HasErrors);

            this.DatabaseSession.Rollback();

            builder.WithDefaultCarrier(new Carriers(this.DatabaseSession).Fedex);
            builder.Build();

            Assert.IsTrue(this.DatabaseSession.Derive().HasErrors);

            this.DatabaseSession.Rollback();

            builder.WithDefaultShipmentMethod(new ShipmentMethods(this.DatabaseSession).Ground);
            builder.Build();

            Assert.IsFalse(this.DatabaseSession.Derive().HasErrors);

            builder.WithSalesInvoiceCounter( new CounterBuilder(this.DatabaseSession).Build() ).Build();
            builder.Build();

            Assert.IsFalse(this.DatabaseSession.Derive().HasErrors);

            builder.WithFiscalYearInvoiceNumber(new FiscalYearInvoiceNumberBuilder(this.DatabaseSession).WithFiscalYear(DateTime.Today.Year).Build());
            builder.Build();

            Assert.IsTrue(this.DatabaseSession.Derive().HasErrors);
        }
 public IStateStore Build() => storeBuilder.Build() as IStateStore;