public void CallsFooImplementation() { var target = new HandlerRunnerBuilder(typeof (Foo), "GET").BuildRunner(); var context = new Mocks.MockContext(); context.Request = new MockRequest {AcceptTypes = new[] {"text/html"}}; var foo = new Foo(); target(foo, context); Assert.True(foo.Called); }
public void CallsFooImplementation() { var target = new HandlerRunnerBuilder(typeof (Foo), "GET").BuildRunner(); var context = new Mocks.MockContext(); context.Request = new MockRequest { Headers = new Dictionary<string, string[]> { { HeaderKeys.Accept, new[] { "text/html" } } } }; var foo = new Foo(); target(foo, context); Assert.True(foo.Called); }
public void BarStopsFoo() { var target = new HandlerRunnerBuilder(typeof (Bar), "GET").BuildRunner(); var context = new Mocks.MockContext(); context.Request = new MockRequest { Headers = new Dictionary<string, string[]> { { HeaderKeys.Accept, new[] { "text/html" } } } }; var bar = new Bar(); target(bar, context); Assert.True(((IBar)bar).Called); Assert.False(((IFoo)bar).Called); }
public void BarStopsFoo() { var target = new HandlerRunnerBuilder(typeof (Bar), "GET").BuildRunner(); var context = new Mocks.MockContext(); context.Request = new MockRequest {AcceptTypes = new[] {"text/html"}}; var bar = new Bar(); target(bar, context); Assert.True(((IBar)bar).Called); Assert.False(((IFoo)bar).Called); }
public void CallsFooImplementation() { var target = new HandlerRunnerBuilder(typeof(StringFoo), "GET").BuildRunner(); var context = new Mocks.MockContext { Request = new MockRequest { Headers = new Dictionary <string, string[]> { { HeaderKeys.Accept, new[] { "text/html" } } } } }; var foo = new StringFoo(); target(foo, context); Assert.True(foo.Called); }
public void RedirectFooRedirects() { var target = new HandlerRunnerBuilder(typeof(RedirectFoo), "GET").BuildRunner(); var context = new Mocks.MockContext(); context.Request = new MockRequest { Headers = new Dictionary <string, string[]> { { HeaderKeys.Accept, new[] { "text/html" } } } }; context.Response = new MockResponse(); var foo = new RedirectFoo(); target(foo, context); Assert.True(context.Response.Headers.ContainsKey("Location")); }
public void BarStopsFoo() { var target = new HandlerRunnerBuilder(typeof(Bar), "GET").BuildRunner(); var context = new Mocks.MockContext(); context.Request = new MockRequest { Headers = new Dictionary <string, string[]> { { HeaderKeys.Accept, new[] { "text/html" } } } }; var bar = new Bar(); target(bar, context); Assert.True(((IBar)bar).Called); Assert.False(((IFoo)bar).Called); }
public void CallsPutWithParameter() { var target = new HandlerRunnerBuilder(typeof(PutFoo), "PUT").BuildRunner(); var context = new Mocks.MockContext(); context.Request = new MockRequest { Headers = new Dictionary <string, string[]> { { HeaderKeys.Accept, new[] { "text/html" } }, { HeaderKeys.ContentType, new[] { "application/json" } } }, InputStream = new MemoryStream(TestJson) }; var postFoo = new PutFoo(); target(postFoo, context); Assert.True(postFoo.Called); Assert.Equal("Pass", postFoo.Test); }