public void CloudFoundryEndpointMiddleware_PathAndVerbMatching_ReturnsExpected()
        {
            var opts   = new CloudFoundryOptions();
            var ep     = new CloudFoundryEndpoint(opts);
            var middle = new CloudFoundryEndpointOwinMiddleware(null, ep);

            Assert.True(middle.RequestVerbAndPathMatch("GET", "/"));
            Assert.False(middle.RequestVerbAndPathMatch("PUT", "/"));
            Assert.False(middle.RequestVerbAndPathMatch("GET", "/badpath"));
        }
        public void CloudFoundryEndpointMiddleware_PathAndVerbMatching_ReturnsExpected()
        {
            var opts        = new CloudFoundryEndpointOptions();
            var mgmtOptions = TestHelpers.GetManagementOptions(opts);
            var ep          = new CloudFoundryEndpoint(opts, mgmtOptions);
            var middle      = new CloudFoundryEndpointOwinMiddleware(null, ep, mgmtOptions);

            Assert.True(middle.RequestVerbAndPathMatch("GET", "/cloudfoundryapplication"));
            Assert.False(middle.RequestVerbAndPathMatch("PUT", "/cloudfoundryapplication"));
            Assert.False(middle.RequestVerbAndPathMatch("GET", "/cloudfoundryapplication/badpath"));
        }
        public async void CloudFoundryInvoke_ReturnsExpected()
        {
            // arrange
            var middle  = new CloudFoundryEndpointOwinMiddleware(null, new TestCloudFoundryEndpoint(new CloudFoundryOptions()));
            var context = OwinTestHelpers.CreateRequest("GET", "/");

            // act
            var json = await middle.InvokeAndReadResponse(context);

            // assert
            Assert.Equal("{\"type\":\"steeltoe\",\"_links\":{}}", json);
        }