public async void CloudFoundryHttpCall_ReturnsExpected() { ManagementOptions.Clear(); using (var server = TestServer.Create <Startup>()) { var client = server.HttpClient; var result = await client.GetAsync("http://localhost/cloudfoundryapplication"); Assert.Equal(HttpStatusCode.OK, result.StatusCode); var json = await result.Content.ReadAsStringAsync(); Assert.NotNull(json); #pragma warning disable CS0612 // Type or member is obsolete var links = JsonConvert.DeserializeObject <Links>(json); #pragma warning restore CS0612 // Type or member is obsolete Assert.NotNull(links); Assert.True(links._links.ContainsKey("self"), "Self is one of the available links"); Assert.Equal("http://localhost/cloudfoundryapplication", links._links["self"].href); Assert.True(links._links.ContainsKey("info"), "Info is one of the available links"); Assert.Equal("http://localhost/cloudfoundryapplication/info", links._links["info"].href); // this test is here to prevent breaking changes in response serialization Assert.Equal("{\"type\":\"steeltoe\",\"_links\":{\"self\":{\"href\":\"http://localhost/cloudfoundryapplication\",\"templated\":false},\"info\":{\"href\":\"http://localhost/cloudfoundryapplication/info\",\"templated\":false}}}", json); } }
public async void InfoHttpCall_ReturnsExpected() { // Note: This test pulls in from git.properties and appsettings created // in the Startup class ManagementOptions.Clear(); using (var server = TestServer.Create <Startup>()) { var client = server.HttpClient; var result = await client.GetAsync("http://localhost/cloudfoundryapplication/infomanagement"); Assert.Equal(HttpStatusCode.OK, result.StatusCode); var json = await result.Content.ReadAsStringAsync(); Assert.NotNull(json); var dict = JsonConvert.DeserializeObject <Dictionary <string, Dictionary <string, object> > >(json); Assert.NotNull(dict); Assert.Equal(3, dict.Count); Assert.True(dict.ContainsKey("application")); Assert.True(dict.ContainsKey("NET")); Assert.True(dict.ContainsKey("git")); var appNode = dict["application"] as Dictionary <string, object>; Assert.NotNull(appNode); Assert.Equal("foobar", appNode["name"]); var netNode = dict["NET"] as Dictionary <string, object>; Assert.NotNull(netNode); Assert.Equal("Core", netNode["type"]); var gitNode = dict["git"] as Dictionary <string, object>; Assert.NotNull(gitNode); Assert.True(gitNode.ContainsKey("build")); Assert.True(gitNode.ContainsKey("branch")); Assert.True(gitNode.ContainsKey("commit")); Assert.True(gitNode.ContainsKey("closest")); Assert.True(gitNode.ContainsKey("dirty")); Assert.True(gitNode.ContainsKey("remote")); Assert.True(gitNode.ContainsKey("tags")); } }
public EnvOwinMiddlewareTest() { ManagementOptions.Clear(); }
public MetricsEndpointOwinMiddlewareTest() { ManagementOptions.Clear(); }
public ThreadDumpEndpointOwinMiddlewareTest() { ManagementOptions.Clear(); }
public LoggersEndpointOwinMiddlewareTest() { ManagementOptions.Clear(); }
public RefreshEndpointOwinMiddlewareTest() { ManagementOptions.Clear(); }
public TraceEndpointOwinMiddlewareTest() { ManagementOptions.Clear(); }
public HealthEndpointOwinMiddlewareTest() { ManagementOptions.Clear(); }
public CloudFoundrySecurityMiddlewareTest() { Environment.SetEnvironmentVariable("VCAP_APPLICATION", "somestuff"); ManagementOptions.Clear(); }