public async Task Net_HttpRequestPut_SendAsync() { object dataOut = null; var configuration = ConfigurationManagerSafeTests.ConfigurationManagerSafeConstruct(); var request = new HttpRequestPut <object>(configuration.AppSettingValue("MyWebService") + "/HomeApi"); try { dataOut = await request.SendAsync(); Assert.IsTrue(request.Response.IsSuccessStatusCode); throw new WebException(); } catch (WebException) { Assert.IsTrue(dataOut != null); } finally { request.Dispose(); } }
public async Task Core_Net_HttpRequestPut_SendAsync() { object dataOut = null; var configuration = new ConfigurationManagerCore(ApplicationTypes.Native); var request = new HttpRequestPut <object>(new Uri(configuration.AppSettingValue("MyWebService") + "/HomeApi"), "This is a test"); try { dataOut = await request.SendAsync(); Assert.IsTrue(request.Response.IsSuccessStatusCode); throw new HttpRequestException(); } catch (HttpRequestException ex) { Assert.IsTrue(dataOut != null || ex.Message.Contains("No such host") || ex.Message.Contains("no data")); } finally { request.Dispose(); } }