Пример #1
0
        public async Task Initialize()
        {
            ProxyMarketContext.Instance.IsDebug = false;
            String guestName = marketUsers.AddGuest();
            await userManagement.SignUp("founder", "123", null);

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

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

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

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

            await marketUsers.AddMember("owner", "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", "founder", card, address);

            await market.makeManager("manager", store.Id, "founder");

            await market.makeOwner("owner", store.Id, "founder");
        }
Пример #2
0
        public async Task MarketRulesTestsInit()
        {
            ProxyMarketContext.Instance.IsDebug = false;
            String guestName = marketUsers.AddGuest();
            await userManagement.SignUp("founder", "123", null);

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

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

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

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

            store = await marketStores.CreateStore("testStore", "founder", card, address);

            await marketStores.makeManager("manager", store.Id, "founder");

            product1 = new ProductData(new Guid(), "ProductName", 100, 100, 100, "CategoryName");
            User         u    = marketUsers.GetUserByUserName("founder");
            ShoppingCart cart = u.ShoppingCart;

            shoppingBasket = await cart.GetShoppingBasket(store);

            Result <Product> result = await MarketStores.Instance.AddProduct(product1, store.Id, "founder");

            product = result.Ret;
            await marketUsers.AddProductToCart("founder", result.Ret.Id, 10);
        }
        public async Task Initialize()
        {
            String guestName = marketUsers.AddGuest();
            await userManagement.SignUp("founder", "123", null);

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

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

            await marketUsers.AddMember("manager", "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", "founder", card, address);

            await market.makeManager("manager", store.Id, "founder");

            product1 = new ProductData(new Guid(), "1", 10, 10, 10, "c");
        }
Пример #4
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 async Task <string> loginAsync(string usrname, string password, string guestusername)
 {
     return(await marketUsers.AddMember(usrname, password, guestusername));
 }