コード例 #1
0
        public void TestRouteToTarget()
        {
            HttpMethod [] methods = new HttpMethod [] {
                HttpMethod.HTTP_GET, HttpMethod.HTTP_PUT, HttpMethod.HTTP_POST, HttpMethod.HTTP_HEAD,
                HttpMethod.HTTP_DELETE, HttpMethod.HTTP_TRACE, HttpMethod.HTTP_OPTIONS,
            };

            for (int i = 0; i < methods.Length; i++)
            {
                var m   = new MockManosModule();
                var req = new MockHttpRequest(methods [i], "/Foobar");

                m.Route("/Foobar", new ManosAction(FakeAction));

                Assert.AreEqual(new ManosAction(FakeAction), m.Routes.Find(req).Action);
            }
        }
コード例 #2
0
        public void TestRouteToModule()
        {
            HttpMethod [] methods = new HttpMethod [] {
                HttpMethod.HTTP_GET, HttpMethod.HTTP_PUT, HttpMethod.HTTP_POST, HttpMethod.HTTP_HEAD,
                HttpMethod.HTTP_DELETE, HttpMethod.HTTP_TRACE, HttpMethod.HTTP_OPTIONS,
            };

            for (int i = 0; i < methods.Length; i++)
            {
                var m   = new MockManosModule();
                var req = new MockHttpRequest(methods [i], "/FakeModule/FakeAction");

                m.Route("/FakeModule", new FakeModule());

                //
                // I guess technically this is testing the auto name registering too
                //
                Assert.AreEqual(new ManosAction(FakeModule.FakeAction), m.Routes.Find(req).Action);
            }
        }
コード例 #3
0
        public void TestRouteNull()
        {
            var m = new MockManosModule();

            ManosModule mm = null;

            Should.Throw <ArgumentNullException> (() => m.Route("foo", mm), "a1");
            Should.Throw <ArgumentNullException> (() => m.Route(mm, "foo", "bar", "baz"), "a2");

            ManosAction ma = null;

            Should.Throw <ArgumentNullException> (() => m.Route("foo", ma), "a3");
            Should.Throw <ArgumentNullException> (() => m.Route(ma, "foo", "bar", "baz"), "a4");

            mm = new MockManosModule();
            Should.Throw <ArgumentNullException> (() => m.Route(null, mm), "a4");
            Should.Throw <ArgumentNullException> (() => m.Route(mm, "foo", "bar", "baz", null), "a5");

            ma = FakeAction;
            Should.Throw <ArgumentNullException> (() => m.Route(null, ma), "a6");
            Should.Throw <ArgumentNullException> (() => m.Route(ma, "foo", "bar", "baz", null), "a7");
        }
コード例 #4
0
ファイル: ManosModuleTest.cs プロジェクト: nuxleus/manos
        public void TestRouteToTarget()
        {
            var methods = new[]
                              {
                                  HttpMethod.HTTP_GET, HttpMethod.HTTP_PUT, HttpMethod.HTTP_POST, HttpMethod.HTTP_HEAD,
                                  HttpMethod.HTTP_DELETE, HttpMethod.HTTP_TRACE, HttpMethod.HTTP_OPTIONS,
                              };

            for (int i = 0; i < methods.Length; i++)
            {
                var m = new MockManosModule();
                var req = new MockHttpRequest(methods[i], "/Foobar");

                m.Route("/Foobar", new ManosAction(FakeAction));

                Assert.AreEqual(new ManosAction(FakeAction), m.Routes.Find(req).Action);
            }
        }
コード例 #5
0
ファイル: ManosModuleTest.cs プロジェクト: nuxleus/manos
        public void TestRouteToModule()
        {
            var methods = new[]
                              {
                                  HttpMethod.HTTP_GET, HttpMethod.HTTP_PUT, HttpMethod.HTTP_POST, HttpMethod.HTTP_HEAD,
                                  HttpMethod.HTTP_DELETE, HttpMethod.HTTP_TRACE, HttpMethod.HTTP_OPTIONS,
                              };

            for (int i = 0; i < methods.Length; i++)
            {
                var m = new MockManosModule();
                var req = new MockHttpRequest(methods[i], "/FakeModule/FakeAction");

                m.Route("/FakeModule", new FakeModule());

                //
                // I guess technically this is testing the auto name registering too
                //
                Assert.AreEqual(new ManosAction(FakeModule.FakeAction), m.Routes.Find(req).Action);
            }
        }
コード例 #6
0
ファイル: ManosModuleTest.cs プロジェクト: nuxleus/manos
        public void TestRouteNull()
        {
            var m = new MockManosModule();

            ManosModule mm = null;
            Should.Throw<ArgumentNullException>(() => m.Route("foo", mm), "a1");
            Should.Throw<ArgumentNullException>(() => m.Route(mm, "foo", "bar", "baz"), "a2");

            ManosAction ma = null;
            Should.Throw<ArgumentNullException>(() => m.Route("foo", ma), "a3");
            Should.Throw<ArgumentNullException>(() => m.Route(ma, "foo", "bar", "baz"), "a4");

            mm = new MockManosModule();
            Should.Throw<ArgumentNullException>(() => m.Route(null, mm), "a4");
            Should.Throw<ArgumentNullException>(() => m.Route(mm, "foo", "bar", "baz", null), "a5");

            ma = FakeAction;
            Should.Throw<ArgumentNullException>(() => m.Route(null, ma), "a6");
            Should.Throw<ArgumentNullException>(() => m.Route(ma, "foo", "bar", "baz", null), "a7");
        }
コード例 #7
0
ファイル: ManosModuleTest.cs プロジェクト: KevinT/manos
        public void TestRouteToTarget()
        {
            string [] methods = new string [] {
                "GET", "PUT", "POST", "HEAD", "DELETE", "TRACE", "OPTIONS",
            };

            for (int i = 0; i < methods.Length; i++) {
                var m = new MockManosModule ();
                var req = new MockHttpRequest (methods [i], "/Foobar");

                m.Route ("/Foobar", new ManosAction (FakeAction));

                Assert.AreEqual (new ManosAction (FakeAction), m.Routes.Find (req).Action);
            }
        }
コード例 #8
0
ファイル: ManosModuleTest.cs プロジェクト: KevinT/manos
        public void TestRouteToModule()
        {
            string [] methods = new string [] {
                "GET", "PUT", "POST", "HEAD", "DELETE", "TRACE", "OPTIONS",
            };

            for (int i = 0; i < methods.Length; i++) {
                var m = new MockManosModule ();
                var req = new MockHttpRequest (methods [i], "/FakeModule/FakeAction");

                m.Route ("/FakeModule", new FakeModule ());

                //
                // I guess technically this is testing the auto name registering too
                //
                Assert.AreEqual (new ManosAction (FakeModule.FakeAction), m.Routes.Find (req).Action);
            }
        }