summaryrefslogtreecommitdiff
path: root/slips/src/test/Marina.Test/Unit/Presentation/Mappers/LoginCredentialsMapperTest.cs
blob: 4dae259f77d765871da3797c435d5b1612640705 (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
using Marina.Presentation;
using Marina.Presentation.Mappers;
using Marina.Web;
using MbUnit.Framework;
using Rhino.Mocks;

namespace Marina.Test.Unit.Presentation.Mappers {
	[TestFixture]
	public class LoginCredentialsMapperTest {
		private MockRepository mockery;
		private IHttpRequest mockRequest;

		[SetUp]
		public void SetUp( ) {
			mockery = new MockRepository( );
			mockRequest = mockery.DynamicMock< IHttpRequest >( );
		}

		[Test]
		public void Should_map_username_from_request( ) {
			using ( mockery.Record( ) ) {
				Expect.Call( mockRequest.ParsePayloadFor( PayloadKeys.For( "uxUserNameTextBox" ) ) ).Return( null );
				Expect.Call( mockRequest.ParsePayloadFor( PayloadKeys.For( "uxPasswordTextBox" ) ) ).Return( null );
			}

			using ( mockery.Playback( ) ) {
				CreateSUT( ).MapFrom( mockRequest );
			}
		}

		private LoginCredentialsMapper CreateSUT( ) {
			return new LoginCredentialsMapper( );
		}
	}
}