From 1dfdccb8118aeaa3cd844ac8de2a672c93312166 Mon Sep 17 00:00:00 2001 From: mokhan Date: Sat, 21 Feb 2009 21:44:27 +0000 Subject: git-svn-id: http://svn.xp-dev.com/svn/mokhan-sait@2 da190166-9cfc-4ee1-ae03-434a172be219 --- .../Handlers/RequestHandlerSpecificationTest.cs | 53 ++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 slips/src/test/Marina.Test/Unit/Web/Handlers/RequestHandlerSpecificationTest.cs (limited to 'slips/src/test/Marina.Test/Unit/Web/Handlers/RequestHandlerSpecificationTest.cs') diff --git a/slips/src/test/Marina.Test/Unit/Web/Handlers/RequestHandlerSpecificationTest.cs b/slips/src/test/Marina.Test/Unit/Web/Handlers/RequestHandlerSpecificationTest.cs new file mode 100644 index 0000000..8b6c4fd --- /dev/null +++ b/slips/src/test/Marina.Test/Unit/Web/Handlers/RequestHandlerSpecificationTest.cs @@ -0,0 +1,53 @@ +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 RequestHandlerSpecificationTest { + private MockRepository _mockery; + + [SetUp] + public void Setup( ) { + _mockery = new MockRepository( ); + } + + [TearDown] + public void TearDown( ) { + _mockery.VerifyAll( ); + } + + [Test] + public void Should_return_true_if_destination_contains_command_name( ) { + IHttpGateway mockRequest = _mockery.DynamicMock< IHttpGateway >( ); + string commandName = "test.marina"; + using ( _mockery.Record( ) ) { + SetupResult.For( mockRequest.Destination( ) ).Return( commandName ); + } + + using ( _mockery.Playback( ) ) { + Assert.IsTrue( CreateSUT( commandName ).IsSatisfiedBy( mockRequest ) ); + } + } + + [Test] + public void Should_return_false_if_destination_does_not_contain_command_name( ) { + IHttpGateway mockRequest = _mockery.DynamicMock< IHttpGateway >( ); + string firstCommandName = "test.marina"; + string secondCommandName = "test2.marina"; + + using ( _mockery.Record( ) ) { + SetupResult.For( mockRequest.Destination( ) ).Return( secondCommandName ); + } + using ( _mockery.Playback( ) ) { + Assert.IsFalse( CreateSUT( firstCommandName ).IsSatisfiedBy( mockRequest ) ); + } + } + + private ISpecification< IHttpGateway > CreateSUT( string commandName ) { + return new RequestHandlerSpecification( commandName ); + } + } +} \ No newline at end of file -- cgit v1.2.3