blob: 5fa950a12d05ec4d951c7f11a5d54cb8c1f18079 (
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
50
51
|
using System.Collections.Generic;
using Marina.Presentation.DTO;
using Marina.Presentation.Presenters;
using Marina.Presentation.Views;
using Marina.Task;
using MbUnit.Framework;
using Rhino.Mocks;
namespace Marina.Test.Unit.Presentation {
[TestFixture]
public class AvailableSlipsPresenterTest {
private MockRepository mockery;
private ICatalogTasks mockTask;
private IAvailableSlipsView mockView;
[SetUp]
public void SetUp( ) {
mockery = new MockRepository( );
mockTask = mockery.DynamicMock< ICatalogTasks >( );
mockView = mockery.DynamicMock< IAvailableSlipsView >( );
}
[Test]
public void Should_leverage_task_to_retrieve_all_available_slips_on_initialize( ) {
using ( mockery.Record( ) ) {
Expect.Call( mockTask.GetAllAvailableSlips( ) ).Return( null );
}
using ( mockery.Playback( ) ) {
CreateSUT( ).Initialize( );
}
}
[Test]
public void Should_display_the_available_slips( ) {
IEnumerable< SlipDisplayDTO > availableSlips = new List< SlipDisplayDTO >( );
using ( mockery.Record( ) ) {
SetupResult.For( mockTask.GetAllAvailableSlips( ) ).Return( availableSlips );
mockView.Display( availableSlips );
}
using ( mockery.Playback( ) ) {
CreateSUT( ).Initialize( );
}
}
private IAvailableSlipsPresenter CreateSUT( ) {
return new AvailableSlipsPresenter( mockView, mockTask );
}
}
}
|