summaryrefslogtreecommitdiff
path: root/src/test/PlayingWithActiveReports.Test/Reports/ResultsSectionTest.cs
blob: bb185d40d23a8d94017b528d68e1e5a5ca05dba3 (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
using System.Collections.Generic;
using MbUnit.Framework;
using PlayingWithActiveReports.Core.Dto;
using PlayingWithActiveReports.Core.Reports;

namespace PlayingWithActiveReports.Test.Reports {
	[TestFixture]
	public class ResultsSectionTest {
		[Test]
		public void Should_Be_Able_To_Bind_Dtos_To_Report( ) {
			IResultsSection section = CreateSut( );
			IList< DisplayReportQuestionDto > results = new List< DisplayReportQuestionDto >( );
			results.Add( CreateDto( "How are you?", "good" ) );
			results.Add( CreateDto( "How are you?", "bad" ) );
			results.Add( CreateDto( "How are you?", "hungry" ) );

			section.BindTo( results );
			Assert.AreEqual( 3, section.ResultsCount );
		}

		[Test]
		public void Should_Have_No_Results( ) {
			Assert.AreEqual( 0, CreateSut( ).ResultsCount );
		}

		private DisplayReportQuestionDto CreateDto( string question, string answer ) {
			return new DisplayReportQuestionDto( question, answer );
		}

		private IResultsSection CreateSut( ) {
			return new ResultsSection( );
		}
	}
}