public void TestPropertiesWhenInvalidHost() { HttpCall call = HttpCall.CreateGet("http://bogus").Execute().Result; Assert.IsTrue(call.Executed); Assert.IsFalse(call.Success); Assert.IsNotNull(call.Error); }
public async Task TestPropertiesWhenInvalidHost() { HttpCall call = await HttpCall.CreateGet("http://bogus").ExecuteAsync(); Assert.IsTrue(call.Executed); Assert.IsFalse(call.Success); Assert.IsNotNull(call.Error); }
public void TestPropertiesWhenNotExecuted() { HttpCall call = HttpCall.CreateGet("http://www.google.com"); Assert.IsFalse(call.Executed); Assert.IsFalse(call.HasResponse); AssertThrows <InvalidOperationException>(() => { bool x = call.Success; }); AssertThrows <InvalidOperationException>(() => { Exception x = call.Error; }); AssertThrows <InvalidOperationException>(() => { string x = call.ResponseBody; }); }
public void TestPropertiesWhenExecuted() { HttpCall call = HttpCall.CreateGet("http://www.google.com").Execute().Result; Assert.IsTrue(call.Executed); Assert.IsTrue(call.HasResponse); Assert.IsTrue(call.Success); Assert.IsNull(call.Error); Assert.IsTrue(call.ResponseBody.Contains("Google Search")); Assert.AreEqual(HttpStatusCode.Ok, call.StatusCode); }