Пример #1
0
        public ObservableCollection <Product> getWishList()
        {
            ObservableCollection <Product> pro = new ObservableCollection <Product>();

            using (var webClient = new WebClient())
            {
                try
                {
                    String json = webClient.DownloadString("https://fulda-buyandsell.herokuapp.com/api/wishlist/5c3fa39047eca600301357a5");



                    MyWishList data = JsonConvert.DeserializeObject <MyWishList>(json);

                    List <wishListItems> wl = data.Wishlist;



                    for (int i = 0; i < wl.Count; i++)
                    {
                        pro.Add(
                            wl[i].Product_details);
                    }
                    return(pro);
                }
                catch (Exception e)
                {
                    Console.Write(e);
                }
                return(pro);
            }
        }
Пример #2
0
        public void ThenUserCanAddNewWishlist()
        {
            //svaki Then ima Assert, objekat se pravi i veze se na kojoj je stranici

            MyWishList NWl = new MyWishList(Driver);

            Assert.True(ut.ElementDispayed(NWl.NewWL), "New wishlist can not add");
        }
Пример #3
0
        public void TestingWishList()
        {
            Authentication authenticationPage = mainPage.ClickSignInButton();

            authenticationPage.EnterAccountData(email, password);

            MyAccountPage accountPage = authenticationPage.SingInYourAccount();

            MyWishList myWishList = accountPage.ClickOnMyWishListsButton();

            myWishList.EnterNewListName(newListName)
            .ClickSaveNewList();
        }
Пример #4
0
        public async Task checkOut(float price)
        {
            API api = new API();

            using (var webClient = new WebClient())
            {
                try
                {
                    MyWishList mwishlist = api.mList();


                    List <wishListItems> wi = mwishlist.Wishlist;

                    String[] pids = new String[10];
                    String[] wids = new String[10];

                    for (int i = 0; i < wi.Count; i++)
                    {
                        pids[i] = wi[i].Product_id;
                        wids[i] = wi[i]._Id;
                    }



                    var a = JsonConvert.SerializeObject(pids);
                    var b = JsonConvert.SerializeObject(wids);


                    string  url         = "https://fulda-buyandsell.herokuapp.com/api/wishlist/checkout";
                    string  contentType = "application/json";
                    JObject oJsonObject = new JObject();


                    oJsonObject.Add("buyer_id", "5c3fa39047eca600301357a5");
                    oJsonObject.Add("total", price);
                    oJsonObject.Add("wishlist", a);
                    oJsonObject.Add("products", b);



                    HttpClient oHttpClient    = new HttpClient();
                    var        oTaskPostAsync = oHttpClient.PostAsync(url, new StringContent(oJsonObject.ToString(), Encoding.UTF8, contentType)).Result;
                }
                catch (Exception e)
                {
                    Console.Write(e);
                }
            }
        }
Пример #5
0
        public MyWishList mList()
        {
            MyWishList data = null;

            using (var webClient = new WebClient())
            {
                try
                {
                    String json = webClient.DownloadString("https://fulda-buyandsell.herokuapp.com/api/wishlist/5c3fa39047eca600301357a5");



                    data = JsonConvert.DeserializeObject <MyWishList>(json);
                }

                catch (Exception e)
                {
                    Console.Write(e);
                }
                return(data);
            }
        }