Esempio n. 1
0
        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);
            }
        }
Esempio n. 2
0
        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"));
            }
        }
Esempio n. 3
0
 public EnvOwinMiddlewareTest()
 {
     ManagementOptions.Clear();
 }
Esempio n. 4
0
 public MetricsEndpointOwinMiddlewareTest()
 {
     ManagementOptions.Clear();
 }
Esempio n. 5
0
 public ThreadDumpEndpointOwinMiddlewareTest()
 {
     ManagementOptions.Clear();
 }
Esempio n. 6
0
 public LoggersEndpointOwinMiddlewareTest()
 {
     ManagementOptions.Clear();
 }
Esempio n. 7
0
 public RefreshEndpointOwinMiddlewareTest()
 {
     ManagementOptions.Clear();
 }
Esempio n. 8
0
 public TraceEndpointOwinMiddlewareTest()
 {
     ManagementOptions.Clear();
 }
 public HealthEndpointOwinMiddlewareTest()
 {
     ManagementOptions.Clear();
 }
 public CloudFoundrySecurityMiddlewareTest()
 {
     Environment.SetEnvironmentVariable("VCAP_APPLICATION", "somestuff");
     ManagementOptions.Clear();
 }