summaryrefslogtreecommitdiff
path: root/slips/src/test/Marina.Test/Unit/Web/Views/Pages/AvailableSlipsWebViewTest.cs
blob: 2a40745ddf7ed7ecc20d2404afcea29428a8aa74 (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 System.Collections.Generic;
using Marina.Presentation.DTO;
using Marina.Web.Http;
using Marina.Web.Views;
using Marina.Web.Views.Pages;
using MbUnit.Framework;
using Rhino.Mocks;

namespace Marina.Test.Unit.Web.Views.Pages {
	[TestFixture]
	public class AvailableSlipsWebViewTest {
		private MockRepository _mockery;
		private IViewLuggageTransporter< IEnumerable< SlipDisplayDTO > > _mockViewBag;
		private IHttpGateway _mockGateway;

		[SetUp]
		public void Setup() {
			_mockery = new MockRepository( );
			_mockViewBag = _mockery.DynamicMock< IViewLuggageTransporter< IEnumerable< SlipDisplayDTO > > >( );
			_mockGateway = _mockery.DynamicMock< IHttpGateway >( );
		}

		public IAvailableSlipsWebView CreateSUT() {
			return new AvailableSlipsWebView( _mockViewBag, _mockGateway );
		}

		[Test]
		public void Should_add_item_to_view_bag() {
			IEnumerable< SlipDisplayDTO > slips = new List< SlipDisplayDTO >( );

			using ( _mockery.Record( ) ) {
				_mockViewBag.Add( slips );
			}

			using ( _mockery.Playback( ) ) {
				CreateSUT( ).AddToBag( slips );
			}
		}

		[Test]
		public void Should_return_the_name_of_the_page() {
			using ( _mockery.Record( ) ) {}

			using ( _mockery.Playback( ) ) {
				Assert.AreEqual( "AvailableSlips.aspx", CreateSUT( ).Name( ) );
			}
		}
	}
}