public async void CancelAsync_Throws_IfAppNameNotNullAndIDNull() { var config = new EurekaClientConfig(); var client = new EurekaHttpClient(config); var ex = await Assert.ThrowsAsync <ArgumentException>(() => client.CancelAsync("appName", null)); Assert.Contains("id", ex.Message); }
public async System.Threading.Tasks.Task CancelAsync_Throws_IfAppNameNull() { var config = new EurekaClientConfig(); var client = new EurekaHttpClient(config); var ex = await Assert.ThrowsAsync <ArgumentException>(() => client.CancelAsync(null, "id")); Assert.Contains("appName", ex.Message); }
public async void CancelAsync_InvokesServer_ReturnsStatusCodeAndHeaders() { var startup = new TestConfigServerStartup("", 200); var server = TestServer.Create(startup.Configure); var uri = "http://localhost:8888/"; server.BaseAddress = new Uri(uri); var cconfig = new EurekaClientConfig() { EurekaServerServiceUrls = uri }; var client = new EurekaHttpClient(cconfig, server.CreateClient()); EurekaHttpResponse resp = await client.CancelAsync("foo", "bar"); Assert.NotNull(resp); Assert.Equal(HttpStatusCode.OK, resp.StatusCode); Assert.NotNull(resp.Headers); Assert.Equal("DELETE", startup.LastRequest.Method); Assert.Equal("localhost:8888", startup.LastRequest.Host.Value); Assert.Equal("/apps/foo/bar", startup.LastRequest.Path.Value); }