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/Web/Commands/AvailableSlipsCommandTest.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/Web/Commands/AvailableSlipsCommandTest.cs')
| -rw-r--r-- | slips/src/test/Marina.Test/Unit/Web/Commands/AvailableSlipsCommandTest.cs | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/slips/src/test/Marina.Test/Unit/Web/Commands/AvailableSlipsCommandTest.cs b/slips/src/test/Marina.Test/Unit/Web/Commands/AvailableSlipsCommandTest.cs new file mode 100644 index 0000000..c3ca810 --- /dev/null +++ b/slips/src/test/Marina.Test/Unit/Web/Commands/AvailableSlipsCommandTest.cs @@ -0,0 +1,56 @@ +using System.Collections.Generic;
+using Marina.Infrastructure;
+using Marina.Presentation.DTO;
+using Marina.Task;
+using Marina.Web.Commands;
+using Marina.Web.Views.Pages;
+using MbUnit.Framework;
+using Rhino.Mocks;
+
+namespace Marina.Test.Unit.Web.Commands {
+ [TestFixture]
+ public class AvailableSlipsCommandTest {
+ private MockRepository _mockery;
+ private ICatalogTasks _mockTask;
+ private IAvailableSlipsWebView _mockView;
+
+ [SetUp]
+ public void Setup() {
+ _mockery = new MockRepository( );
+ _mockTask = _mockery.DynamicMock< ICatalogTasks >( );
+ _mockView = _mockery.DynamicMock< IAvailableSlipsWebView >( );
+ }
+
+ private ICommand CreateSUT() {
+ return new AvailableSlipsCommand( _mockView, _mockTask );
+ }
+
+ [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( ).Execute( );
+ }
+ }
+
+ [Test]
+ public void Should_add_available_slips_to_bag_and_render_view() {
+ IEnumerable< SlipDisplayDTO > slips = new List< SlipDisplayDTO >( );
+
+ using ( _mockery.Record( ) ) {
+ SetupResult.For( _mockTask.GetAllAvailableSlips( ) ).Return( slips );
+ using ( _mockery.Ordered( ) ) {
+ _mockView.AddToBag( slips );
+ _mockView.Render( );
+ }
+ }
+
+ using ( _mockery.Playback( ) ) {
+ CreateSUT( ).Execute( );
+ }
+ }
+ }
+}
\ No newline at end of file |
