summaryrefslogtreecommitdiff
path: root/src/test/PlayingWithActiveReports.Test/Reports/ResultsSectionBuilderTest.cs
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2007-11-02 17:03:42 -0600
committermo khan <mo@mokhan.ca>2007-11-02 17:03:42 -0600
commit36ffa9f174c831146ca5630a41b75c9d213f3db6 (patch)
tree3ba71964656b385995bb9557c87a05b131348ddf /src/test/PlayingWithActiveReports.Test/Reports/ResultsSectionBuilderTest.cs
import from svntrunkmain
Diffstat (limited to 'src/test/PlayingWithActiveReports.Test/Reports/ResultsSectionBuilderTest.cs')
-rw-r--r--src/test/PlayingWithActiveReports.Test/Reports/ResultsSectionBuilderTest.cs72
1 files changed, 72 insertions, 0 deletions
diff --git a/src/test/PlayingWithActiveReports.Test/Reports/ResultsSectionBuilderTest.cs b/src/test/PlayingWithActiveReports.Test/Reports/ResultsSectionBuilderTest.cs
new file mode 100644
index 0000000..0661368
--- /dev/null
+++ b/src/test/PlayingWithActiveReports.Test/Reports/ResultsSectionBuilderTest.cs
@@ -0,0 +1,72 @@
+using System.Collections.Generic;
+using MbUnit.Framework;
+using PlayingWithActiveReports.Core.Dto;
+using PlayingWithActiveReports.Core.Reports;
+using Rhino.Mocks;
+using Rhino.Mocks.Constraints;
+
+namespace PlayingWithActiveReports.Test.Reports {
+ [TestFixture]
+ public class ResultsSectionBuilderTest {
+ public delegate void CallBackAssertion( );
+
+ // get list of dto items to bind to section
+ // add section to the report
+
+ [SetUp]
+ public void Setup( ) {
+ _mockery = new MockRepository( );
+ _taskStub = _mockery.Stub< IResultSectionTask >( );
+ }
+
+ [Test]
+ public void Should_Add_Section_To_Report( ) {
+ IMainReport mainReportStub = _mockery.Stub< IMainReport >( );
+
+ using( _mockery.Record( ) ) {
+ mainReportStub.AddSection( null );
+ LastCall.Constraints( Is.TypeOf( typeof( IResultsSection ) ) );
+ }
+
+ using( _mockery.Playback( ) ) {
+ CreateSut( ).BuildFrom( mainReportStub );
+ }
+ }
+
+ [Test]
+ public void Should_Get_List_Of_Dtos_Using_Task( ) {
+ IMainReport mainReportStub = _mockery.Stub< IMainReport >( );
+
+ using( _mockery.Record( ) ) {
+ _taskStub.GetResults( );
+ }
+
+ using( _mockery.Playback( ) ) {
+ CreateSut( ).BuildFrom( mainReportStub );
+ }
+ }
+
+ [Test]
+ public void Should_Bind_Dtos_To_Section( ) {
+ IMainReport mainReportStub = _mockery.Stub< IMainReport >( );
+ IResultsSection sectionStub = _mockery.Stub< IResultsSection >( );
+ IEnumerable< DisplayReportQuestionDto > returnValue = _mockery.Stub< IEnumerable< DisplayReportQuestionDto > >( );
+
+ using( _mockery.Record( ) ) {
+ Expect.Call( _taskStub.GetResults( ) ).Return( returnValue );
+ sectionStub.BindTo( returnValue );
+ }
+
+ using( _mockery.Playback( ) ) {
+ CreateSut( ).BuildFrom( mainReportStub, sectionStub );
+ }
+ }
+
+ private ISectionBuilder CreateSut( ) {
+ return new ResultsSectionBuilder( _taskStub );
+ }
+
+ private MockRepository _mockery;
+ private IResultSectionTask _taskStub;
+ }
+} \ No newline at end of file