public void TestGetInventory() { // set timeout to 10 seconds Configuration c1 = new Configuration (timeout: 10000); StoreApi storeApi = new StoreApi (c1); Dictionary<String, int?> response = storeApi.GetInventory (); foreach(KeyValuePair<string, int?> entry in response) { Assert.IsInstanceOf (typeof(int?), entry.Value); } }
public void TestGetInventoryInObject() { // set timeout to 10 seconds Configuration c1 = new Configuration (timeout: 10000); StoreApi storeApi = new StoreApi (c1); Newtonsoft.Json.Linq.JObject response = (Newtonsoft.Json.Linq.JObject)storeApi.GetInventoryInObject (); // should be a Newtonsoft.Json.Linq.JObject since type is object Assert.IsInstanceOf (typeof(Newtonsoft.Json.Linq.JObject), response); foreach(KeyValuePair<string, string> entry in response.ToObject<Dictionary<string, string>>()) { Assert.IsInstanceOf (typeof(int?), Int32.Parse(entry.Value)); } }
public void GetInventoryTest() { // TODO: add unit test for the method 'GetInventory' //var response = instance.GetInventory(); //Assert.IsInstanceOf<Dictionary<string, int?>> (response, "response is Dictionary<string, int?>"); // set timeout to 10 seconds Configuration c1 = new Configuration (timeout: 10000); StoreApi storeApi = new StoreApi (c1); Dictionary<String, int?> response = storeApi.GetInventory (); foreach(KeyValuePair<string, int?> entry in response) { Assert.IsInstanceOf (typeof(int?), entry.Value); } }
public void Init() { instance = new StoreApi(); }