blob: b4a15ef900175d578eb3a16f55ccbef0f2d8b6c8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
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 );
}
}
}
|