コード例 #1
0
        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");
        }
コード例 #2
0
        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");
        }
コード例 #3
0
ファイル: Models.cs プロジェクト: adamdthomas/APITestExample
        //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);
        }
コード例 #4
0
        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");
        }
コード例 #5
0
 public void Setup()
 {
     products = Models.getProducts(new System.Uri("http://pltestautomationsample.azurewebsites.net/api/product"));
 }