summaryrefslogtreecommitdiff
path: root/slips/src/test/Marina.Test/Unit/Web/Handlers/RequestHandlerTest.cs
diff options
context:
space:
mode:
authormokhan <mokhan@da190166-9cfc-4ee1-ae03-434a172be219>2009-02-21 21:44:27 +0000
committermokhan <mokhan@da190166-9cfc-4ee1-ae03-434a172be219>2009-02-21 21:44:27 +0000
commit1dfdccb8118aeaa3cd844ac8de2a672c93312166 (patch)
tree4b19e7f816ab1019f180a46b68572af4b66fe4bc /slips/src/test/Marina.Test/Unit/Web/Handlers/RequestHandlerTest.cs
parent42d66bcab8262c7b8b2452615df535e694a3ec1c (diff)
git-svn-id: http://svn.xp-dev.com/svn/mokhan-sait@2 da190166-9cfc-4ee1-ae03-434a172be219
Diffstat (limited to 'slips/src/test/Marina.Test/Unit/Web/Handlers/RequestHandlerTest.cs')
-rw-r--r--slips/src/test/Marina.Test/Unit/Web/Handlers/RequestHandlerTest.cs49
1 files changed, 49 insertions, 0 deletions
diff --git a/slips/src/test/Marina.Test/Unit/Web/Handlers/RequestHandlerTest.cs b/slips/src/test/Marina.Test/Unit/Web/Handlers/RequestHandlerTest.cs
new file mode 100644
index 0000000..b4a15ef
--- /dev/null
+++ b/slips/src/test/Marina.Test/Unit/Web/Handlers/RequestHandlerTest.cs
@@ -0,0 +1,49 @@
+using Marina.Infrastructure;
+using Marina.Web.Handlers;
+using Marina.Web.Http;
+using MbUnit.Framework;
+using Rhino.Mocks;
+
+namespace Marina.Test.Unit.Web.Handlers {
+ [TestFixture]
+ public class RequestHandlerTest {
+ private MockRepository _mockery;
+ private ISpecification< IHttpGateway > _mockSpecification;
+ private ICommand _mockCommand;
+
+ [SetUp]
+ public void Setup( ) {
+ _mockery = new MockRepository( );
+ _mockSpecification = _mockery.DynamicMock< ISpecification< IHttpGateway > >( );
+ _mockCommand = _mockery.DynamicMock< ICommand >( );
+ }
+
+ [Test]
+ public void Should_delegate_to_specification_to_see_if_criteria_is_satisfied( ) {
+ IHttpGateway request = _mockery.DynamicMock< IHttpGateway >( );
+
+ using ( _mockery.Record( ) ) {
+ Expect.Call( _mockSpecification.IsSatisfiedBy( request ) ).Return( true );
+ }
+
+ using ( _mockery.Playback( ) ) {
+ CreateSUT( ).IsSatisfiedBy( request );
+ }
+ }
+
+ [Test]
+ public void Should_delegate_to_command_when_told_to_execute( ) {
+ using ( _mockery.Record( ) ) {
+ _mockCommand.Execute( );
+ }
+
+ using ( _mockery.Playback( ) ) {
+ CreateSUT( ).Execute( );
+ }
+ }
+
+ private IRequestHandler CreateSUT( ) {
+ return new RequestHandler( _mockSpecification, _mockCommand );
+ }
+ }
+} \ No newline at end of file