diff options
Diffstat (limited to 'src/app/PlayingWithActiveReports.Core/Task')
3 files changed, 43 insertions, 0 deletions
diff --git a/src/app/PlayingWithActiveReports.Core/Task/IResultSectionTask.cs b/src/app/PlayingWithActiveReports.Core/Task/IResultSectionTask.cs new file mode 100644 index 0000000..7b18c53 --- /dev/null +++ b/src/app/PlayingWithActiveReports.Core/Task/IResultSectionTask.cs @@ -0,0 +1,8 @@ +using System.Collections.Generic;
+using PlayingWithActiveReports.Core.Dto;
+
+namespace PlayingWithActiveReports.Test.Reports {
+ public interface IResultSectionTask {
+ IEnumerable< DisplayReportQuestionDto > GetResults( );
+ }
+}
\ No newline at end of file diff --git a/src/app/PlayingWithActiveReports.Core/Task/IResultsReportTask.cs b/src/app/PlayingWithActiveReports.Core/Task/IResultsReportTask.cs new file mode 100644 index 0000000..3367e6f --- /dev/null +++ b/src/app/PlayingWithActiveReports.Core/Task/IResultsReportTask.cs @@ -0,0 +1,7 @@ +using PlayingWithActiveReports.Core.Reports;
+
+namespace PlayingWithActiveReports.Core.Task {
+ public interface IResultsReportTask {
+ IResultsReport CreateReport( );
+ }
+}
\ No newline at end of file diff --git a/src/app/PlayingWithActiveReports.Core/Task/StubResultsReportTask.cs b/src/app/PlayingWithActiveReports.Core/Task/StubResultsReportTask.cs new file mode 100644 index 0000000..d6ba5cf --- /dev/null +++ b/src/app/PlayingWithActiveReports.Core/Task/StubResultsReportTask.cs @@ -0,0 +1,28 @@ +using System.Collections.Generic;
+using PlayingWithActiveReports.Core.Domain;
+using PlayingWithActiveReports.Core.Reports;
+using PlayingWithActiveReports.Core.Repositories;
+
+namespace PlayingWithActiveReports.Core.Task {
+ public class StubResultsReportTask : IResultsReportTask {
+ public StubResultsReportTask( ) : this( new QuestionBank( ) ) {}
+
+ public StubResultsReportTask( IQuestionBank bank ) {
+ _bank = bank;
+ }
+
+ public IResultsReport CreateReport( ) {
+ _bank.CreateQuestion( "What is your name?" ).ChangeAnswerTo( "mO" );
+ _bank.CreateQuestion( "How old are you?" ).ChangeAnswerTo( "23" );
+ return new ResultsReport( ).BindTo( CreateParameters( ) ).Execute( );
+ }
+
+ private IEnumerable< IReportParameter > CreateParameters( ) {
+ return new List< IQuestion >( _bank.FindAll( ) ).ConvertAll< IReportParameter >(
+ delegate( IQuestion input ) { return new ReportParameter( input.Text, input.CurrentAnswer.Text ); }
+ );
+ }
+
+ private IQuestionBank _bank;
+ }
+}
\ No newline at end of file |
