public void GetResponseAndDeserializeXml() { HttpResponseMessage message = this.WebServiceDriver.GetWithResponse("/api/XML_JSON/GetAllProducts", "application/xml"); ArrayOfProduct result = WebServiceUtils.DeserializeXmlDocument <ArrayOfProduct>(message); Assert.AreEqual(3, result.Product.Length, "Expected 3 products to be returned"); }
public void GetXmlDeserialized() { WebServiceDriver client = new WebServiceDriver(new Uri(url)); ArrayOfProduct result = client.Get <ArrayOfProduct>("/api/XML_JSON/GetAllProducts", "application/xml", false); Assert.AreEqual(3, result.Product.Length, "Expected 3 products to be returned"); }
//Returns dictionary representing a product with a given ID public static Dictionary <string, string> getItemByID(ArrayOfProduct products, string id) { Dictionary <string, string> itemDic = new Dictionary <string, string>(); foreach (var product in products.Items) { if (product.Id == id) { itemDic.Add("name", product.Name); itemDic.Add("id", product.Id); itemDic.Add("desc", product.Description); } } return(itemDic); }
public void GetXmlDeserialized() { ArrayOfProduct result = this.WebServiceDriver.Get <ArrayOfProduct>("/api/XML_JSON/GetAllProducts", "application/xml"); Assert.AreEqual(3, result.Product.Length, "Expected 3 products to be returned"); }
public void Setup() { products = Models.getProducts(new System.Uri("http://pltestautomationsample.azurewebsites.net/api/product")); }