Created
November 29, 2019 16:02
-
-
Save MarcoNicolodi/e7edf607771764e65c8d8af3a6920845 to your computer and use it in GitHub Desktop.
Proposal aggregate pseudo code showing its integrity with comments
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Proposal | |
{ | |
private List<Comments> _comments; | |
public IReadOnlyList<Comments> Comments => _comments.AsReadOnly(); | |
private bool IsOpenForDiscussion => Status != ProposalStatus.Pending; | |
public void Discuss(Guid userId, string content) | |
{ | |
if(!IsOpenForDiscussion) | |
throw new DomainException("Can't discuss about an closed proposal"); | |
_comments.Add(new Comment(userId, Id, content)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment