summaryrefslogtreecommitdiff
path: root/slips/src/test/Marina.Test/Unit/Presentation/CurrentLeasesPresenterTest.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/Presentation/CurrentLeasesPresenterTest.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/Presentation/CurrentLeasesPresenterTest.cs')
-rw-r--r--slips/src/test/Marina.Test/Unit/Presentation/CurrentLeasesPresenterTest.cs63
1 files changed, 63 insertions, 0 deletions
diff --git a/slips/src/test/Marina.Test/Unit/Presentation/CurrentLeasesPresenterTest.cs b/slips/src/test/Marina.Test/Unit/Presentation/CurrentLeasesPresenterTest.cs
new file mode 100644
index 0000000..a9f2cb1
--- /dev/null
+++ b/slips/src/test/Marina.Test/Unit/Presentation/CurrentLeasesPresenterTest.cs
@@ -0,0 +1,63 @@
+using System.Collections.Generic;
+using Marina.Presentation;
+using Marina.Presentation.DTO;
+using Marina.Presentation.Presenters;
+using Marina.Presentation.Views;
+using Marina.Task;
+using Marina.Web;
+using MbUnit.Framework;
+using Rhino.Mocks;
+
+namespace Marina.Test.Unit.Presentation {
+ [TestFixture]
+ public class CurrentLeasesPresenterTest {
+ private MockRepository _mockery;
+ private ILeaseTasks task;
+ private IHttpRequest mockRequest;
+ private ICurrentLeasesView mockView;
+
+ [SetUp]
+ public void Setup() {
+ _mockery = new MockRepository( );
+ task = _mockery.DynamicMock< ILeaseTasks >( );
+ mockRequest = _mockery.DynamicMock< IHttpRequest >( );
+ mockView = _mockery.DynamicMock< ICurrentLeasesView >( );
+ }
+
+ public ICurrentLeasesPresenter CreateSUT() {
+ return new CurrentLeasesPresenter( mockView, mockRequest, task );
+ }
+
+ [Test]
+ public void Should_leverage_task_to_retrieve_all_leases_for_customer_id() {
+ long customerId = 32;
+ IList< DisplayLeaseDTO > dtos = new List< DisplayLeaseDTO >( );
+
+ using ( _mockery.Record( ) ) {
+ SetupResult.For( mockRequest.ParsePayloadFor( PayloadKeys.CustomerId ) ).Return( customerId );
+ Expect.Call( task.FindAllLeasesFor( customerId ) ).Return( dtos );
+ }
+
+ using ( _mockery.Playback( ) ) {
+ CreateSUT( ).Initialize( );
+ }
+ }
+
+ [Test]
+ public void Should_display_the_found_leases_on_the_view() {
+ IList< DisplayLeaseDTO > dtos = new List< DisplayLeaseDTO >( );
+ using ( _mockery.Record( ) ) {
+ SetupResult
+ .For( task.FindAllLeasesFor( 0 ) )
+ .IgnoreArguments( )
+ .Return( dtos );
+
+ mockView.Display( dtos );
+ }
+
+ using ( _mockery.Playback( ) ) {
+ CreateSUT( ).Initialize( );
+ }
+ }
+ }
+} \ No newline at end of file