diff options
| author | mokhan <mokhan@da190166-9cfc-4ee1-ae03-434a172be219> | 2009-02-21 21:44:27 +0000 |
|---|---|---|
| committer | mokhan <mokhan@da190166-9cfc-4ee1-ae03-434a172be219> | 2009-02-21 21:44:27 +0000 |
| commit | 1dfdccb8118aeaa3cd844ac8de2a672c93312166 (patch) | |
| tree | 4b19e7f816ab1019f180a46b68572af4b66fe4bc /slips/src/test/Marina.Test/Unit/Presentation/DockPresenterTest.cs | |
| parent | 42d66bcab8262c7b8b2452615df535e694a3ec1c (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/Presentation/DockPresenterTest.cs')
| -rw-r--r-- | slips/src/test/Marina.Test/Unit/Presentation/DockPresenterTest.cs | 90 |
1 files changed, 90 insertions, 0 deletions
diff --git a/slips/src/test/Marina.Test/Unit/Presentation/DockPresenterTest.cs b/slips/src/test/Marina.Test/Unit/Presentation/DockPresenterTest.cs new file mode 100644 index 0000000..1fc2a26 --- /dev/null +++ b/slips/src/test/Marina.Test/Unit/Presentation/DockPresenterTest.cs @@ -0,0 +1,90 @@ +using System.Collections.Generic;
+using Marina.Presentation;
+using Marina.Presentation.DTO;
+using Marina.Presentation.Presenters;
+using Marina.Presentation.Views;
+using Marina.Task;
+using Marina.Test.Utility;
+using Marina.Web;
+using MbUnit.Framework;
+using Rhino.Mocks;
+
+namespace Marina.Test.Unit.Presentation {
+ [TestFixture]
+ public class DockPresenterTest {
+ private MockRepository mockery;
+ private IDockView mockView;
+ private ICatalogTasks mockTask;
+ private IHttpRequest mockRequest;
+
+ private IDockPresenter CreateSUT( ) {
+ return new DockPresenter( mockView, mockRequest, mockTask );
+ }
+
+ [SetUp]
+ public void SetUp( ) {
+ mockery = new MockRepository( );
+ mockView = mockery.DynamicMock< IDockView >( );
+ mockTask = mockery.DynamicMock< ICatalogTasks >( );
+ mockRequest = mockery.DynamicMock< IHttpRequest >( );
+ }
+
+ [Test]
+ public void Should_leverage_its_task_to_retrieve_the_dock_information( ) {
+ long dockId = 1;
+ using ( mockery.Record( ) ) {
+ SetupResult.For( mockRequest.ParsePayloadFor( PayloadKeys.DockId ) ).Return( dockId );
+ Expect.Call( mockTask.GetDockInformationBy( dockId ) ).Return( null );
+ }
+ using ( mockery.Playback( ) ) {
+ CreateSUT( ).Initialize( );
+ }
+ }
+
+ [Test]
+ public void Should_display_dock_information( ) {
+ DockDisplayDTO dto = ObjectMother.DockDisplayDTO( );
+ int dockId = 2;
+
+ using ( mockery.Record( ) ) {
+ SetupResult.For( mockRequest.ParsePayloadFor( PayloadKeys.DockId ) ).Return( dockId );
+ SetupResult.For( mockTask.GetDockInformationBy( dockId ) ).Return( dto );
+ mockView.Display( dto );
+ }
+
+ using ( mockery.Playback( ) ) {
+ CreateSUT( ).Initialize( );
+ }
+ }
+
+ [Test]
+ public void Should_leverage_task_to__load_list_of_locations_on_initialize( ) {
+ long dockId = 1;
+
+ using ( mockery.Record( ) ) {
+ SetupResult.For( mockRequest.ParsePayloadFor( PayloadKeys.DockId ) ).Return( dockId );
+ Expect.Call( mockTask.GetAvailableSlipsForDockBy( dockId ) ).Return( null );
+ }
+
+ using ( mockery.Playback( ) ) {
+ CreateSUT( ).Initialize( );
+ }
+ }
+
+ [Test]
+ public void Should_display_the_available_slips( ) {
+ IEnumerable< SlipDisplayDTO > availableSlips = new List< SlipDisplayDTO >( );
+ long dockId = 2;
+
+ using ( mockery.Record( ) ) {
+ SetupResult.For( mockRequest.ParsePayloadFor( PayloadKeys.DockId ) ).Return( dockId );
+ SetupResult.For( mockTask.GetAvailableSlipsForDockBy( dockId ) ).Return( availableSlips );
+ mockView.Display( availableSlips );
+ }
+
+ using ( mockery.Playback( ) ) {
+ CreateSUT( ).Initialize( );
+ }
+ }
+ }
+}
\ No newline at end of file |
