diff options
| author | mo khan <mo@mokhan.ca> | 2007-11-02 17:03:42 -0600 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2007-11-02 17:03:42 -0600 |
| commit | 36ffa9f174c831146ca5630a41b75c9d213f3db6 (patch) | |
| tree | 3ba71964656b385995bb9557c87a05b131348ddf /src/app/PlayingWithActiveReports.Core/Domain | |
Diffstat (limited to 'src/app/PlayingWithActiveReports.Core/Domain')
4 files changed, 78 insertions, 0 deletions
diff --git a/src/app/PlayingWithActiveReports.Core/Domain/Answer.cs b/src/app/PlayingWithActiveReports.Core/Domain/Answer.cs new file mode 100644 index 0000000..0807a9a --- /dev/null +++ b/src/app/PlayingWithActiveReports.Core/Domain/Answer.cs @@ -0,0 +1,33 @@ +using System;
+
+namespace PlayingWithActiveReports.Core.Domain {
+ public class Answer : IAnswer, IEquatable< Answer > {
+ public Answer( string answerText ) {
+ _answerText = answerText;
+ }
+
+ public string Text {
+ get { return _answerText; }
+ }
+
+ public bool Equals( Answer answer ) {
+ if( answer == null ) {
+ return false;
+ }
+ return Equals( _answerText, answer._answerText );
+ }
+
+ public override bool Equals( object obj ) {
+ if( ReferenceEquals( this, obj ) ) {
+ return true;
+ }
+ return Equals( obj as Answer );
+ }
+
+ public override int GetHashCode( ) {
+ return _answerText != null ? _answerText.GetHashCode( ) : 0;
+ }
+
+ private readonly string _answerText;
+ }
+}
\ No newline at end of file diff --git a/src/app/PlayingWithActiveReports.Core/Domain/IAnswer.cs b/src/app/PlayingWithActiveReports.Core/Domain/IAnswer.cs new file mode 100644 index 0000000..b587b60 --- /dev/null +++ b/src/app/PlayingWithActiveReports.Core/Domain/IAnswer.cs @@ -0,0 +1,5 @@ +namespace PlayingWithActiveReports.Core.Domain {
+ public interface IAnswer {
+ string Text { get; }
+ }
+}
\ No newline at end of file diff --git a/src/app/PlayingWithActiveReports.Core/Domain/IQuestion.cs b/src/app/PlayingWithActiveReports.Core/Domain/IQuestion.cs new file mode 100644 index 0000000..dd8ad1b --- /dev/null +++ b/src/app/PlayingWithActiveReports.Core/Domain/IQuestion.cs @@ -0,0 +1,8 @@ +namespace PlayingWithActiveReports.Core.Domain {
+ public interface IQuestion {
+ string Text { get; }
+ string Id { get; }
+ IAnswer CurrentAnswer { get; }
+ void ChangeAnswerTo( string answer );
+ }
+}
\ No newline at end of file diff --git a/src/app/PlayingWithActiveReports.Core/Domain/Question.cs b/src/app/PlayingWithActiveReports.Core/Domain/Question.cs new file mode 100644 index 0000000..d025dea --- /dev/null +++ b/src/app/PlayingWithActiveReports.Core/Domain/Question.cs @@ -0,0 +1,32 @@ +using System;
+
+namespace PlayingWithActiveReports.Core.Domain {
+ public class Question : IQuestion {
+ public Question( string id, string text ) {
+ _id = id;
+ _text = text;
+ }
+
+ public Question( string text ) : this( Guid.NewGuid( ).ToString( ), text ) {}
+
+ public string Text {
+ get { return _text; }
+ }
+
+ public string Id {
+ get { return _id; }
+ }
+
+ public IAnswer CurrentAnswer {
+ get { return new Answer( _answer ); }
+ }
+
+ public void ChangeAnswerTo( string answer ) {
+ _answer = answer;
+ }
+
+ private readonly string _id;
+ private readonly string _text;
+ private string _answer;
+ }
+}
\ No newline at end of file |
