public async Task <bool> Seed()
        {
            var bulb  = ProductFactory.CreateBulbProduct();
            var table = ProductFactory.CreateTableProduct();

            return(await Repository.Create(bulb)
                   .MapAsync(
                       x => x
                    ? Repository.Create(table)
                    : Task.FromResult(false))
                   .ConfigureAwait(false));
        }
Ejemplo n.º 2
0
        public void SetProductState_Should_ApplyEventsBasedOnStateDate(
            int month,
            int day,
            double expectedPrice,
            int expectedInStock,
            int expectedAvailable)
        {
            var productStock = ProductFactory.CreateBulbProduct();
            var product      = EventBroker.SetProduct(productStock);
            var stateDate    = new DateTime(2018, month, day, 0, 0, 0).ToLocalTime();

            EventBroker.SetProductState(product, stateDate);

            Assert.Equal(expectedPrice, product.Price);
            Assert.Equal(expectedInStock, product.InStock);
            Assert.Equal(expectedAvailable, product.Available);
        }