blob: 6853b07aecff298d88a89e9cb754ceb7a6a6a9ea (
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
|
using System.Collections.Generic;
using MbUnit.Framework;
using PlayingWithActiveReports.Core.Reports;
namespace PlayingWithActiveReports.Test.Reports {
[TestFixture]
public class ReportSectionTest {
[Test]
public void Should_Contain_0_Parameters( ) {
Assert.AreEqual( 0, CreateSut( ).ParametersCount );
}
[Test]
public void Should_Bind_2_Parameters_To_Section( ) {
IList< IReportParameter > parameters = new List< IReportParameter >( );
parameters.Add( CreateParameter( "QuestionText", "How Old Are You?" ) );
parameters.Add( CreateParameter( "AnswerText", "23" ) );
IReportSection section = CreateSut( );
section.BindTo( parameters );
Assert.AreEqual( 2, section.ParametersCount );
}
[RowTest]
[Row( "Questions" )]
[Row( "Results" )]
[Row( "Table Of Contents" )]
public void Should_Set_Section_Name_To( string name ) {
Assert.AreEqual( name, CreateSut( ).WithName( name ).Name );
}
[Test]
public void Should_Contain_Undefined_Name( ) {
Assert.AreEqual( "Undefined", CreateSut( ).Name );
}
private IReportParameter CreateParameter( string key, string value ) {
return new ReportParameter( key, value );
}
private IReportSection CreateSut( ) {
return new ReportSection( );
}
}
}
|