예제 #1
0
        private static void DeleteDb(Bootstrapper.PretendApplication app)
        {
            app.DeleteDatabase();

            var cartModel = app.Read <BasketRequest, BasketsReadModel>(new BasketRequest());

            if (!cartModel.HasCart(ClientId))
            {
                app.Send(new CreateNewCart {
                    ClientId = ClientId
                });
            }
        }
예제 #2
0
        private static void PrintProducts(Bootstrapper.PretendApplication app)
        {
            var model = app.Read <ProductsRequest, ProductsReadModel>(new ProductsRequest());

            System.Console.WriteLine("-----");
            if (model.GetAll().Count > 0)
            {
                System.Console.WriteLine("Products:");
                model.GetAll().ToList().ForEach(PrintProducts);
                System.Console.WriteLine("-----");
            }
            else
            {
                System.Console.WriteLine("No products");
            }
        }
예제 #3
0
        private static void PrintCart(Bootstrapper.PretendApplication app)
        {
            var carts = app.Read <BasketRequest, BasketsReadModel>(new BasketRequest());
            var cart  = carts.GetCart(ClientId);

            System.Console.WriteLine("-----");
            if (cart.Items.Count > 0)
            {
                System.Console.WriteLine("Your basket:");
                cart.Items.ForEach(PrintShoppingCartItemReadModel);
                System.Console.WriteLine("-----");
            }
            else
            {
                System.Console.WriteLine("Your basket is empty");
            }
        }