예제 #1
0
파일: API.cs 프로젝트: zohaibbb/GDSD1
        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
파일: API.cs 프로젝트: zohaibbb/GDSD1
        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
파일: API.cs 프로젝트: zohaibbb/GDSD1
        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);
            }
        }