public async Task NetConnector_GetDeserializedXml_WithValidParameters_ShouldWork(string url, int id, string name, string category, decimal price) { var connector = new NetConnector(BaseAddress); var responseObject = await connector.GetXmlObjectAsync <Product>(url); Assert.IsNotNull(responseObject, "Response object should not be null."); Assert.AreEqual(id, responseObject.Id, "Id should match."); Assert.AreEqual(name, responseObject.Name, "Name should match."); Assert.AreEqual(category, responseObject.Category, "Category should match."); Assert.AreEqual(price, responseObject.Price, "Price should match."); }
public async Task NetConnector_GetDeserializedXmlArray_WithValidParameters_ShouldWork(string url, int numberOfItems) { var connector = new NetConnector(BaseAddress); var responseObject = await connector.GetXmlObjectAsync <ArrayOfProduct>(url); Assert.IsNotNull(responseObject, "Response object should not be null."); Assert.AreEqual(numberOfItems, responseObject.Products.Length, "Number of items should match."); for (int i = 0; i < numberOfItems; ++i) { Assert.AreEqual(i + 1, responseObject.Products[i].Id, "Id should be {0}.", i + 1); } }