Esempio n. 1
0
        public void OrderManager_InvalidOrder_Guest_ShouldPass()
        {
            using var context = new MarketDbContext(inMemoryConnection);

            string storeName = GetStoreName();
            // setup test
            StoreContactDetails details = new StoreContactDetails(storeName, "*****@*****.**", "location", "222", "222", "bank", "cool store");

            Store s = storeHandler.OpenStore(details, Owner, context);

            string itemName = "testItemD";
            Item   item     = s.AddItem(itemName, 2, new HashSet <string>()
            {
                "CategoryA"
            }, 1.22, context);

            Dictionary <Guid, StoreCart> shoppingCart = new Dictionary <Guid, StoreCart>();
            StoreCart cart = new StoreCart(s.Id);

            cart.AddToStoreCart(item.Id, 1);
            shoppingCart.Add(s.Id, cart);

            Order order = null;

            Assert.DoesNotThrow(() => order = orderManager.DiscountAndReserve(GetGuestId(), shoppingCart, context));
            Assert.IsNotNull(order);
            order.Status = OrderStatus.DELIVERED;
            orderManager.LogOrder(order.userKey, order.OrderId, context);
            Assert.AreEqual(orderManager.GetStoreOrdersHistory(s.Id, context).Count, 1);
        }
Esempio n. 2
0
        public void OrderManager_ValidOrder_ShouldPass()
        {
            using var context = new MarketDbContext(inMemoryConnection);

            string storeName = GetStoreName();
            // setup test
            StoreContactDetails details = new StoreContactDetails(storeName, "*****@*****.**", "location", "222", "222", "bank", "cool store");

            storeHandler.OpenStore(details, Owner, context);
            Store s = storeHandler.Stores(context).Where(s => s.ContactDetails.Name.Equals(storeName, StringComparison.InvariantCultureIgnoreCase)).First();

            string itemName = "testItemD";
            Item   item     = s.AddItem(itemName, 2, new HashSet <string>()
            {
                "CategoryA"
            }, 1.22, context);

            Dictionary <Guid, StoreCart> shoppingCart = new Dictionary <Guid, StoreCart>();
            StoreCart cart = new StoreCart(s.Id);

            cart.AddToStoreCart(item.Id, 1);
            shoppingCart.Add(s.Id, cart);

            // test
            Order order = null;

            Assert.DoesNotThrow(() => order = orderManager.DiscountAndReserve(Buyer1, shoppingCart, context));
            Assert.IsNotNull(order);
            order.Status = OrderStatus.DELIVERED;
            Assert.DoesNotThrow(() => orderManager.LogOrder(order.UserId, order.OrderId, context));
        }
Esempio n. 3
0
        public void OrderManager_Delivery_Guest_ShouldPass()
        {
            using var context = new MarketDbContext(inMemoryConnection);

            string storeName = GetStoreName();
            // setup test
            StoreContactDetails details = new StoreContactDetails(storeName, "*****@*****.**", "location", "222", "222", "bank", "cool store");

            storeHandler.OpenStore(details, Owner, context);
            Store s = storeHandler.Stores(context).Where(s => s.ContactDetails.Name.Equals(storeName, StringComparison.InvariantCultureIgnoreCase)).First();

            string itemName = "testItemD";
            Item   item     = s.AddItem(itemName, 2, new HashSet <string>()
            {
                "CategoryA"
            }, 1.22, context);

            Dictionary <Guid, StoreCart> shoppingCart = new Dictionary <Guid, StoreCart>();
            StoreCart cart = new StoreCart(s.Id);

            cart.AddToStoreCart(item.Id, 1);
            shoppingCart.Add(s.Id, cart);

            DeliveryReal realDelivery = new DeliveryReal(new HttpClient());

            orderManager.Delivery.Real = realDelivery;
            Order order = null;

            Assert.DoesNotThrow(() => order = orderManager.DiscountAndReserve(GetGuestId(), shoppingCart, context));
            Assert.IsNotNull(order);
            order.Status = OrderStatus.PAYED_FOR;
            Assert.DoesNotThrow(() => orderManager.ScheduleDelivery(order.userKey, order.OrderId, "address", "city", "country", "22222", "name", context));
        }
Esempio n. 4
0
        public void OrderManager_Payment_Guest_ShouldPass()
        {
            using var context = new MarketDbContext(inMemoryConnection);

            string storeName = GetStoreName();
            // setup test
            StoreContactDetails details = new StoreContactDetails(storeName, "*****@*****.**", "location", "222", "222", "bank", "cool store");

            storeHandler.OpenStore(details, Owner, context);
            Store s = storeHandler.Stores(context).Where(s => s.ContactDetails.Name.Equals(storeName, StringComparison.InvariantCultureIgnoreCase)).First();

            string itemName = "testItemD";
            Item   item     = s.AddItem(itemName, 2, new HashSet <string>()
            {
                "CategoryA"
            }, 1.22, context, keyWords: new HashSet <string>()
            {
                "test"
            });

            Dictionary <Guid, StoreCart> shoppingCart = new Dictionary <Guid, StoreCart>();
            StoreCart cart = new StoreCart(s.Id);

            cart.AddToStoreCart(item.Id, 1);
            shoppingCart.Add(s.Id, cart);

            PaymentReal realPayment = new PaymentReal(new System.Net.Http.HttpClient());

            orderManager.Payment.Real = realPayment;
            Order order = null;

            Assert.DoesNotThrow(() => order = orderManager.DiscountAndReserve(GetGuestId(), shoppingCart, context));
            Assert.IsNotNull(order);
            Assert.DoesNotThrow(() => orderManager.CollectPayment(order.userKey, order.OrderId, "1111222233334444", "12/2021", "111", "name", "222333231", context));
        }
Esempio n. 5
0
        public void EditStoreContactDetails_ShouldPass()
        {
            using var context = new MarketDbContext(inMemoryConnection);
            storeHandler.OpenStore(DataForTests.CreateTestContactDetails(), Owner, context);

            Store store = storeHandler.GetStoreByName("store", context);

            Dictionary <StoresUtils.StoreEditContactDetails, object> newDetails = new Dictionary <StoresUtils.StoreEditContactDetails, object>()
            {
                { StoresUtils.StoreEditContactDetails.name, "newStore" },
                { StoresUtils.StoreEditContactDetails.email, "new email" },
                { StoresUtils.StoreEditContactDetails.address, "newAddress" },
                { StoresUtils.StoreEditContactDetails.bankAccountNumber, "888-222222/20" },
                { StoresUtils.StoreEditContactDetails.bank, "Poalim" },
            };

            Assert.IsTrue(storeHandler.EditStoreContactDetails(store.Id, newDetails, context));
            store = storeHandler.GetStoreById(store.Id, context);

            StoreContactDetails storeContactDetails = store.ContactDetails;

            Assert.AreEqual(storeContactDetails.Name, "newStore");
            Assert.AreEqual(storeContactDetails.Email, "new email");
            Assert.AreEqual(storeContactDetails.Address, "newAddress");
            Assert.AreEqual(storeContactDetails.Phone, "0544444444");
            Assert.AreEqual(storeContactDetails.BankAccountNumber, "888-222222/20");
            Assert.AreEqual(storeContactDetails.Bank, "Poalim");
            Assert.AreEqual(storeContactDetails.Description, "Store description");
        }
Esempio n. 6
0
        public void OrderManager_ValidOrder_TooManyItems_ShouldFail()
        {
            using var context = new MarketDbContext(inMemoryConnection);

            string storeName = GetStoreName();

            // setup test
            StoreContactDetails details = new StoreContactDetails(storeName, "*****@*****.**", "location", "222", "222", "bank", "cool store");

            storeHandler.OpenStore(details, Owner, context);
            Store s = storeHandler.Stores(context).Where(s => s.ContactDetails.Name.Equals(storeName, StringComparison.InvariantCultureIgnoreCase)).First();

            string itemName = "testItemC";
            Item   item     = s.AddItem(itemName, 1, new HashSet <string>()
            {
                "CategoryA"
            }, 1.22, context);

            Dictionary <Guid, StoreCart> shoppingCart = new Dictionary <Guid, StoreCart>();
            StoreCart cart = new StoreCart(s.Id);

            cart.AddToStoreCart(item.Id, 3);
            shoppingCart.Add(s.Id, cart);

            // test
            Assert.Throws <ItemAmountException>(() => orderManager.DiscountAndReserve(Buyer1, shoppingCart, context));
        }
Esempio n. 7
0
        public void OrderManager_StoreHistory_TwoStores_ShouldPass()
        {
            using var context = new MarketDbContext(inMemoryConnection);

            string storeName1 = GetStoreName();
            string storeName2 = GetStoreName();

            // setup test
            StoreContactDetails details1 = new StoreContactDetails(storeName1, "*****@*****.**", "location", "222", "222", "bank", "cool store");
            StoreContactDetails details2 = new StoreContactDetails(storeName2, "*****@*****.**", "location", "222", "222", "bank", "very cool store");

            storeHandler.OpenStore(details1, Owner, context);
            storeHandler.OpenStore(details2, Owner, context);

            Store store1 = storeHandler.Stores(context).Where(s => s.ContactDetails.Name.Equals(storeName1, StringComparison.InvariantCultureIgnoreCase)).First();
            Store store2 = storeHandler.Stores(context).Where(s => s.ContactDetails.Name.Equals(storeName2, StringComparison.InvariantCultureIgnoreCase)).First();

            string itemName1 = "testItemD";
            string itemName2 = "testItemE";

            Item item1 = store1.AddItem(itemName1, 2, new HashSet <string>()
            {
                "CategoryA"
            }, 1.22, context);
            Item item2 = store2.AddItem(itemName2, 2, new HashSet <string>()
            {
                "CategoryA"
            }, 1.22, context);

            Dictionary <Guid, StoreCart> shoppingCart = new Dictionary <Guid, StoreCart>();
            StoreCart cart1 = new StoreCart(store1.Id);

            cart1.AddToStoreCart(item1.Id, 1);
            shoppingCart.Add(store1.Id, cart1);

            StoreCart cart2 = new StoreCart(store2.Id);

            cart2.AddToStoreCart(item2.Id, 1);
            shoppingCart.Add(store2.Id, cart2);
            // test
            Order order = null;

            Assert.DoesNotThrow(() => order = orderManager.DiscountAndReserve(Buyer1, shoppingCart, context));
            Assert.IsNotNull(order);
            order.Status = OrderStatus.DELIVERED;
            Assert.DoesNotThrow(() => orderManager.LogOrder(order.UserId, order.OrderId, context));

            List <StoreOrder> storeHistory1 = orderManager.GetStoreOrdersHistory(store1.Id, context);

            Assert.AreEqual(1, storeHistory1.Count());
            Assert.AreEqual(storeHistory1[0].OrderItemsDict[item1.Id].Name, itemName1);
            Assert.AreEqual(storeHistory1[0].StoreId, store1.Id);

            List <StoreOrder> storeHistory2 = orderManager.GetStoreOrdersHistory(store2.Id, context);

            Assert.AreEqual(1, storeHistory2.Count());
            Assert.AreEqual(storeHistory2[0].OrderItemsDict[item2.Id].Name, itemName2);
            Assert.AreEqual(storeHistory2[0].StoreId, store2.Id);
        }
Esempio n. 8
0
 public bool openStore(StoreContactDetails contactDetails)
 {
     if (realBridge != null)
     {
         return(realBridge.openStore(contactDetails));
     }
     return(false);
 }
Esempio n. 9
0
        private ResponseClass DeserializeOpenStore(Guid sessionID, string storeName)
        {
            StoreContactDetails details = DataForTests.CreateTestContactDetails();
            string json = marketFacade.OpenStore(sessionID, storeName, details.Email, details.Address, details.Phone, details.BankAccountNumber,
                                                 details.Bank, details.Description, null, null);

            return(JsonConvert.DeserializeObject <ResponseClass>(json));
        }
Esempio n. 10
0
        public void GetStoreCertificationManager_ShouldPass()
        {
            using var context = new MarketDbContext(inMemoryConnection);
            StoreContactDetails storeContactDetails = DataForTests.CreateTestContactDetails();

            storeHandler.OpenStore(storeContactDetails, Owner, context);

            Store store = storeHandler.GetStoreByName("store", context);
            IStoreCertificationManager scm = storeHandler.GetStoreCertificationManager(store.Id, context);

            Assert.AreEqual(store, scm);
        }
Esempio n. 11
0
        public void OrderManager_ReviewPending_Timeout_ShouldPass()
        {
            using var context = new MarketDbContext(inMemoryConnection);

            string storeName1 = GetStoreName();
            string storeName2 = GetStoreName();

            // setup test
            StoreContactDetails details1 = new StoreContactDetails(storeName1, "*****@*****.**", "location", "222", "222", "bank", "cool store");
            StoreContactDetails details2 = new StoreContactDetails(storeName2, "*****@*****.**", "location", "222", "222", "bank", "very cool store");

            storeHandler.OpenStore(details1, Owner, context);
            storeHandler.OpenStore(details2, Owner, context);

            Store store1 = storeHandler.Stores(context).Where(s => s.ContactDetails.Name.Equals(storeName1, StringComparison.InvariantCultureIgnoreCase)).First();
            Store store2 = storeHandler.Stores(context).Where(s => s.ContactDetails.Name.Equals(storeName2, StringComparison.InvariantCultureIgnoreCase)).First();

            string itemName1 = "testItemD";
            string itemName2 = "testItemE";

            Item item1 = store1.AddItem(itemName1, 2, new HashSet <string>()
            {
                "CategoryA"
            }, 1.22, context);
            Item item2 = store2.AddItem(itemName2, 2, new HashSet <string>()
            {
                "CategoryA"
            }, 1.22, context);

            Dictionary <Guid, StoreCart> shoppingCart = new Dictionary <Guid, StoreCart>();
            StoreCart cart1 = new StoreCart(store1.Id);

            cart1.AddToStoreCart(item1.Id, 2);
            shoppingCart.Add(store1.Id, cart1);

            StoreCart cart2 = new StoreCart(store2.Id);

            cart2.AddToStoreCart(item2.Id, 2);
            shoppingCart.Add(store2.Id, cart2);
            // test
            Order order = null;

            Assert.DoesNotThrow(() => order = orderManager.DiscountAndReserve(Buyer1, shoppingCart, context));
            Assert.IsNotNull(order);
            Assert.Throws <ItemAmountException>(() => orderManager.DiscountAndReserve(Buyer1, shoppingCart, context));
            context.SaveChanges();
            context.Dispose();

            Thread.Sleep(1000 * 60 * 4);// sleep max time for delete

            using var context2 = new MarketDbContext(inMemoryConnection);
            Assert.DoesNotThrow(() => order = orderManager.DiscountAndReserve(Buyer1, shoppingCart, context2));
        }
Esempio n. 12
0
        public void GetStoreById_ShouldPass()
        {
            using var context = new MarketDbContext(inMemoryConnection);
            storeHandler.OpenStore(DataForTests.CreateTestContactDetails(), Owner, context);

            StoreContactDetails storeContactDetails2 = DataForTests.CreateTestContactDetails();

            storeContactDetails2.Name = "store2";
            storeHandler.OpenStore(storeContactDetails2, Owner, context);

            Store store = storeHandler.GetStoreByName("store", context);

            Assert.AreEqual(store, storeHandler.GetStoreById(store.Id, context));
        }
Esempio n. 13
0
        public void OrderManager_ValidOrder_TwoStores_TwoShoppingCarts_OneDoesntHaveEnoughItems_ShuoldFail()
        {
            using var context = new MarketDbContext(inMemoryConnection);

            string storeName1 = GetStoreName();
            string storeName2 = GetStoreName();

            // setup test
            StoreContactDetails details1 = new StoreContactDetails(storeName1, "*****@*****.**", "location", "222", "222", "bank", "cool store");
            StoreContactDetails details2 = new StoreContactDetails(storeName2, "*****@*****.**", "location", "222", "222", "bank", "very cool store");

            storeHandler.OpenStore(details1, Owner, context);
            storeHandler.OpenStore(details2, Owner, context);

            Store store1 = storeHandler.Stores(context).Where(s => s.ContactDetails.Name.Equals(storeName1, StringComparison.InvariantCultureIgnoreCase)).First();
            Store store2 = storeHandler.Stores(context).Where(s => s.ContactDetails.Name.Equals(storeName2, StringComparison.InvariantCultureIgnoreCase)).First();

            string itemName1 = "testItemD";
            string itemName2 = "testItemE";

            Item item1 = store1.AddItem(itemName1, 2, new HashSet <string>()
            {
                "CategoryA"
            }, 1.22, context);
            Item item2 = store2.AddItem(itemName2, 0, new HashSet <string>()
            {
                "CategoryA"
            }, 1.22, context);

            Dictionary <Guid, StoreCart> shoppingCart1 = new Dictionary <Guid, StoreCart>();
            StoreCart cart1 = new StoreCart(store1.Id);

            cart1.AddToStoreCart(item1.Id, 1);
            shoppingCart1.Add(store1.Id, cart1);

            Dictionary <Guid, StoreCart> shoppingCart2 = new Dictionary <Guid, StoreCart>();
            StoreCart cart2 = new StoreCart(store2.Id);

            cart2.AddToStoreCart(item2.Id, 1);
            shoppingCart2.Add(store2.Id, cart2);

            // test
            Order order = null;

            Assert.DoesNotThrow(() => order = orderManager.DiscountAndReserve(Buyer1, shoppingCart1, context));
            Assert.IsNotNull(order);
            order.Status = OrderStatus.DELIVERED;
            Assert.DoesNotThrow(() => orderManager.LogOrder(order.UserId, order.OrderId, context));
            Assert.Throws <ItemAmountException>(() => orderManager.DiscountAndReserve(Buyer1, shoppingCart2, context));
        }
Esempio n. 14
0
        public void GetStores_ShouldPass()
        {
            using var context = new MarketDbContext(inMemoryConnection);
            StoreContactDetails storeContactDetails = DataForTests.CreateTestContactDetails();

            storeHandler.OpenStore(storeContactDetails, Owner, context);
            Store store = storeHandler.GetStoreByName(storeContactDetails.Name, context);

            Assert.IsTrue(storeHandler.Stores(context).Contains(store));
            Assert.AreEqual(1, storeHandler.Stores(context).Count);

            StoreContactDetails storeContactDetails2 = DataForTests.CreateTestContactDetails();

            storeContactDetails2.Name = "store2";
            storeHandler.OpenStore(storeContactDetails2, Owner, context);
            Store store2 = storeHandler.GetStoreByName(storeContactDetails.Name, context);

            Assert.IsTrue(storeHandler.Stores(context).Contains(store));
            Assert.IsTrue(storeHandler.Stores(context).Contains(store2));
            Assert.AreEqual(2, storeHandler.Stores(context).Count);
        }
Esempio n. 15
0
        public void EditStoreContactDetails_EditNameToExistingStoreName_ShouldFail()
        {
            using var context = new MarketDbContext(inMemoryConnection);
            StoreContactDetails storeContactDetails1 = DataForTests.CreateTestContactDetails();

            storeHandler.OpenStore(storeContactDetails1, Owner, context);

            StoreContactDetails storeContactDetails2 = DataForTests.CreateTestContactDetails();

            storeContactDetails2.Name = "store2";
            storeHandler.OpenStore(storeContactDetails2, Owner, context);

            Store store = storeHandler.GetStoreByName("store", context);

            Dictionary <StoresUtils.StoreEditContactDetails, object> newDetails = new Dictionary <StoresUtils.StoreEditContactDetails, object>()
            {
                { StoresUtils.StoreEditContactDetails.name, "store2" },
            };

            Assert.Throws(Is.TypeOf <StoreAlreadyExistException>()
                          .And.Message.EqualTo(string.Format("Store with name {0} already exists", "store2")),
                          () => storeHandler.EditStoreContactDetails(store.Id, newDetails, context));
        }
Esempio n. 16
0
 public override void UC_3_2_openingAStore_SuccessAndFailureScenarios(StoreContactDetails contactDetails, bool success)
 {
     Assert.AreEqual(success, storeOperations.openStore(contactDetails));
 }
Esempio n. 17
0
        public void OrderManager_UserHistory_2UsersSameStore_ShouldPass()
        {
            using var context = new MarketDbContext(inMemoryConnection);

            string storeName = GetStoreName();
            // setup test
            StoreContactDetails details = new StoreContactDetails(storeName, "*****@*****.**", "location", "222", "222", "bank", "cool store");

            storeHandler.OpenStore(details, Owner, context);
            Store s = storeHandler.Stores(context).Where(s => s.ContactDetails.Name.Equals(storeName, StringComparison.InvariantCultureIgnoreCase)).First();

            string itemName = "testItemD";
            Item   item     = s.AddItem(itemName, 4, new HashSet <string>()
            {
                "CategoryA"
            }, 1.22, context);

            Dictionary <Guid, StoreCart> shoppingCart = new Dictionary <Guid, StoreCart>();
            StoreCart cart = new StoreCart(s.Id);

            cart.AddToStoreCart(item.Id, 1);
            shoppingCart.Add(s.Id, cart);

            // test
            Order order = null;

            Assert.DoesNotThrow(() => order = orderManager.DiscountAndReserve(Buyer1, shoppingCart, context));
            Assert.IsNotNull(order);
            order.Status = OrderStatus.DELIVERED;
            Assert.DoesNotThrow(() => orderManager.LogOrder(order.UserId, order.OrderId, context));

            order = null;
            Assert.DoesNotThrow(() => order = orderManager.DiscountAndReserve(Buyer2, shoppingCart, context));
            Assert.IsNotNull(order);
            order.Status = OrderStatus.DELIVERED;
            Assert.DoesNotThrow(() => orderManager.LogOrder(order.UserId, order.OrderId, context));

            List <Order> userHistory1 = orderManager.GetUserOrdersHistory(Buyer1, context);

            Assert.AreEqual(1, userHistory1.Count());
            Order orderHistory1 = userHistory1.First();

            Assert.AreEqual(orderHistory1.StoreOrdersDict.Count, 1);
            KeyValuePair <Guid, StoreOrder> orderedItemFromStore1 = orderHistory1.StoreOrdersDict.First();

            Assert.AreEqual(orderedItemFromStore1.Value.StoreOrderItems.Count, 1);
            OrderItem orderedItem1 = orderedItemFromStore1.Value.OrderItemsDict[item.Id];

            Assert.AreEqual(orderedItem1.ItemId, item.Id);

            List <Order> userHistory2 = orderManager.GetUserOrdersHistory(Buyer1, context);

            Assert.AreEqual(1, userHistory2.Count());
            Order orderHistory2 = userHistory2.First();

            Assert.AreEqual(orderHistory2.StoreOrdersDict.Count, 1);
            KeyValuePair <Guid, StoreOrder> orderedItemFromStore2 = orderHistory2.StoreOrdersDict.First();

            Assert.AreEqual(orderedItemFromStore2.Value.StoreOrderItems.Count, 1);
            OrderItem orderedItem2 = orderedItemFromStore2.Value.OrderItemsDict[item.Id];

            Assert.AreEqual(orderedItem2.ItemId, item.Id);
        }
Esempio n. 18
0
        public static Store[] CreateStoresForSearchTests(StoreHandler storeHandler, MarketDbContext context)
        {
            RegisteredUser owner = new RegisteredUser("TEMP", new byte[] { });

            context.Users.Add(owner);
            context.SaveChanges();
            Guid Owner = owner.ID;

            Store[] stores = new Store[4];

            StoreContactDetails contactDetails = CreateTestContactDetails();

            contactDetails.Name = "store";
            storeHandler.OpenStore(contactDetails, Owner, context);
            Store store = storeHandler.GetStoreByName(contactDetails.Name, context);

            stores[0] = store;

            StoreContactDetails contactDetails1 = CreateTestContactDetails();

            contactDetails1.Name = "store1";
            storeHandler.OpenStore(contactDetails1, Owner, context);
            Store store1 = storeHandler.GetStoreByName(contactDetails1.Name, context);

            stores[1] = store1;

            StoreContactDetails contactDetails2 = CreateTestContactDetails();

            contactDetails2.Name = "store2";
            storeHandler.OpenStore(contactDetails2, Owner, context);
            Store store2 = storeHandler.GetStoreByName(contactDetails2.Name, context);

            stores[2] = store2;

            StoreContactDetails contactDetails3 = CreateTestContactDetails();

            contactDetails3.Name = "store3";
            storeHandler.OpenStore(contactDetails3, Owner, context);
            Store store3 = storeHandler.GetStoreByName(contactDetails3.Name, context);

            stores[3] = store3;

            //store items:
            IStoreInventoryManager inventoryManager = storeHandler.GetStoreInventoryManager(store.Id, context);

            inventoryManager.AddItem("item one", 20, new HashSet <string>()
            {
                "cat1"
            }, 20.4, context, new HashSet <string>()
            {
                "word1"
            });
            inventoryManager.AddItem("item two", 30, new HashSet <string>()
            {
                "cat2"
            }, 20.4, context, new HashSet <string>()
            {
                "word2"
            });
            inventoryManager.AddItem("item three", 200, new HashSet <string>()
            {
                "cat1", "cat2"
            }, 20.4, context, new HashSet <string>()
            {
                "word3"
            });


            //store1 items:
            IStoreInventoryManager inventoryManager1 = storeHandler.GetStoreInventoryManager(store1.Id, context);

            inventoryManager1.AddItem("item one", 20, new HashSet <string>()
            {
                "cat1"
            }, 20.4, context, new HashSet <string>()
            {
                "word1"
            });
            inventoryManager1.AddItem("item two", 30, new HashSet <string>()
            {
                "cat2"
            }, 10, context, new HashSet <string>()
            {
                "word2"
            });
            inventoryManager1.AddItem("item four", 500, new HashSet <string>()
            {
                "cat1", "cat2"
            }, 20.4, context, new HashSet <string>()
            {
                "word3", "word4"
            });
            inventoryManager1.AddItem("item five", 700, new HashSet <string>()
            {
                "cat1", "cat2", "cat3"
            }, 50, context, new HashSet <string>()
            {
                "word4", "word50"
            });


            //store2 items:
            IStoreInventoryManager inventoryManager2 = storeHandler.GetStoreInventoryManager(store2.Id, context);

            inventoryManager2.AddItem("item one", 30, new HashSet <string>()
            {
                "cat1"
            }, 20.5, context, new HashSet <string>()
            {
                "word1"
            });
            inventoryManager2.AddItem("item two", 300, new HashSet <string>()
            {
                "cat2"
            }, 10, context, new HashSet <string>()
            {
                "word2"
            });
            inventoryManager2.AddItem("item three", 200, new HashSet <string>()
            {
                "cat1", "cat2"
            }, 20.4, context, new HashSet <string>()
            {
                "word3"
            });
            inventoryManager2.AddItem("item four", 3000, new HashSet <string>()
            {
                "cat1", "cat2"
            }, 20.4, context, new HashSet <string>()
            {
                "word3", "word4"
            });
            inventoryManager2.AddItem("item five", 30000, new HashSet <string>()
            {
                "cat1", "cat2", "cat5"
            }, 50, context, new HashSet <string>()
            {
            });

            //store3 items
            IStoreInventoryManager inventoryManager3 = storeHandler.GetStoreInventoryManager(store3.Id, context);

            inventoryManager3.AddItem("item twenty", 20, new HashSet <string>()
            {
                "cat20"
            }, 200, context, new HashSet <string>()
            {
                "word50"
            });
            return(stores);
        }
Esempio n. 19
0
 public Store OpenStore(StoreContactDetails contactDetails, Guid sessionUser, MarketDbContext context)
 => Stores.OpenStore(contactDetails, sessionUser, context);