示例#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);
        }
        public async Task Initialize()
        {
            ProxyMarketContext.Instance.IsDebug = true;

            PublisherManagement.Instance.DeleteAll();
            marketUsers.CleanMarketUsers();
            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);
            product  = new Product(new Guid(), 100, 100, 100);
            var shoppingCart = new ShoppingCart(customer);
            await customer.UpdateProductInShoppingBasket(store, product, QUANTITY);

            store.UpdateProduct(product);
        }
 public PublisherController()
 {
     _publisherManagement = new PublisherManagement();
 }