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); } }
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); } }
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"); }
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); } }
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); } }
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"); }
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); } }
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); } }