Exemplo n.º 1
0
        public async Task Initialize()
        {
            ProxyMarketContext.Instance.IsDebug = false;

            PublisherManagement.Instance.DeleteAll();
            publisherManagement = PublisherManagement.Instance;
            publisherManagement.SetTestMode(true);
            String guestName = marketUsers.AddGuest();
            await userManagement.SignUp("FounderTest1", "123", null);

            await marketUsers.AddMember("FounderTest1", "123", guestName);

            guestName = marketUsers.AddGuest();
            await userManagement.SignUp("ManagerTest1", "123", null);

            await marketUsers.AddMember("ManagerTest1", "123", guestName);

            guestName = marketUsers.AddGuest();
            await userManagement.SignUp("OwnerTest1", "123", null);

            await marketUsers.AddMember("OwnerTest1", "123", guestName);

            Address    address = new Address("1", "1", "1", "1", "1");
            CreditCard card    = new CreditCard("1", "1", "1", "1", "1", "1");

            store = await market.CreateStore("testStore", "FounderTest1", card, address);

            await market.makeOwner("OwnerTest1", store.Id, "FounderTest1");

            owner    = marketUsers.ActiveUsers.GetOrAdd("OwnerTest1", owner);
            customer = marketUsers.ActiveUsers.GetOrAdd("ManagerTest1", customer);

            dataproduct = new ProductData(new Guid(), "lala", 100, 100, 100, "cat");
            var shoppingCart     = new ShoppingCart(customer);
            Result <Product> res = await market.AddProduct(dataproduct, store.Id, "FounderTest1");

            product = res.Ret;
            await marketUsers.AddProductToCart(customer.Username, product.id, QUANTITY);
        }
Exemplo n.º 2
0
        public async Task CheckValidAddProduct()
        {
            Result <Product> result = await market.AddProduct(product1, store.Id, "founder");

            Assert.IsFalse(result.IsErr);
        }
 //"Product added"
 public async Task <Result <Product> > AddProduct(ProductData product, Guid storeID, string username)
 {
     return(await marketStores.AddProduct(product, storeID, username));
 }