public static MeetingGroupProposal ProposeNew(string name, string description, MeetingGroupLocation location, MemberId proposalUserId) { return(new MeetingGroupProposal(name, description, location, proposalUserId)); }
protected MeetingTestData CreateMeetingTestData(MeetingTestDataOptions options) { var proposalMemberId = options.CreatorId ?? new MemberId(Guid.NewGuid()); var meetingProposal = MeetingGroupProposal.ProposeNew( "name", "description", MeetingGroupLocation.CreateNew("Warsaw", "PL"), proposalMemberId); meetingProposal.Accept(); var meetingGroup = meetingProposal.CreateMeetingGroup(); meetingGroup.UpdatePaymentInfo(DateTime.Now.AddDays(1)); var meetingTerm = options.MeetingTerm ?? MeetingTerm.CreateNewBetweenDates(DateTime.UtcNow.AddDays(1), DateTime.UtcNow.AddDays(2)); var rsvpTerm = options.RvspTerm ?? Term.NoTerm; var meeting = meetingGroup.CreateMeeting("title", meetingTerm, "description", MeetingLocation.CreateNew("Name", "Address", "PostalCode", "City"), options.AttendeesLimit, options.GuestsLimit, rsvpTerm, MoneyValue.Undefined, new List <MemberId>(), proposalMemberId); DomainEventsTestHelper.ClearAllDomainEvents(meetingGroup); return(new MeetingTestData(meetingGroup, meeting)); }
public async Task <Unit> Handle(EditMeetingGroupGeneralAttributesCommand request, CancellationToken cancellationToken) { MeetingGroup meetingGroup = await _meetingGroupRepository.GetByIdAsync(new MeetingGroupId(request.MeetingGroupId)); meetingGroup.EditGeneralAttributes(request.Name, request.Description, MeetingGroupLocation.CreateNew(request.LocationCity, request.LocationCountry)); await _meetingGroupRepository.Commit(); return(Unit.Value); }
public async Task <Unit> Handle(ProposeMeetingGroupCommand request, CancellationToken cancellationToken) { var meetingGroupProposal = MeetingGroupProposal.ProposeNew( request.Name, request.Description, MeetingGroupLocation.CreateNew(request.LocationCity, request.LocationCountryCode), _memberContext.MemberId); await _meetingGroupProposalRepository.AddAsync(meetingGroupProposal); return(new Unit()); }
public void ProposeNewMeetingGroup_IsSuccessful() { var proposalMemberId = new MemberId(Guid.NewGuid()); var meetingProposal = MeetingGroupProposal.ProposeNew( "name", "description", MeetingGroupLocation.CreateNew("Warsaw", "PL"), proposalMemberId); var meetingGroupProposed = AssertPublishedDomainEvent <MeetingGroupProposedDomainEvent>(meetingProposal); Assert.That(meetingGroupProposed.MeetingGroupProposalId, Is.EqualTo(meetingProposal.Id)); }
protected MeetingTestData CreateMeetingTestData(MeetingTestDataOptions options) { var proposalMemberId = options.CreatorId ?? new MemberId(Guid.NewGuid()); var meetingProposal = MeetingGroupProposal.ProposeNew( "name", "description", MeetingGroupLocation.CreateNew("Warsaw", "PL"), proposalMemberId); meetingProposal.Accept(); var meetingGroup = meetingProposal.CreateMeetingGroup(); meetingGroup.SetExpirationDate(DateTime.Now.AddDays(1)); var meetingTerm = options.MeetingTerm ?? MeetingTerm.CreateNewBetweenDates(DateTime.UtcNow.AddDays(1), DateTime.UtcNow.AddDays(2)); var rsvpTerm = options.RvspTerm ?? Term.NoTerm; var meeting = meetingGroup.CreateMeeting( "title", meetingTerm, "description", MeetingLocation.CreateNew("Name", "Address", "PostalCode", "City"), options.AttendeesLimit, options.GuestsLimit, rsvpTerm, MoneyValue.Undefined, new List <MemberId>(), proposalMemberId); foreach (var attendee in options.Attendees) { meetingGroup.JoinToGroupMember(attendee); meeting.AddAttendee(meetingGroup, attendee, 0); } var meetingCommentingConfiguration = meeting.CreateCommentingConfiguration(); if (options.IsMeetingCommentingEnabled) { meetingCommentingConfiguration.EnableCommenting(proposalMemberId, meetingGroup); } else { meetingCommentingConfiguration.DisableCommenting(proposalMemberId, meetingGroup); } DomainEventsTestHelper.ClearAllDomainEvents(meetingGroup); return(new MeetingTestData(meetingGroup, meeting, meetingCommentingConfiguration)); }
public async Task <Guid> Handle(RequestMeetingGroupProposalVerificationCommand request, CancellationToken cancellationToken) { var meetingGroupProposal = MeetingGroupProposal.CreateToVerify( request.MeetingGroupProposalId, request.Name, request.Description, MeetingGroupLocation.Create(request.LocationCity, request.LocationCountryCode), new UserId(request.ProposalUserId), request.ProposalDate); await _meetingGroupProposalRepository.AddAsync(meetingGroupProposal); return(meetingGroupProposal.Id.Value); }
public void CreateProposalToVerify_IsSuccessful() { var meetingGroupProposalId = Guid.NewGuid(); var location = MeetingGroupLocation.Create("Warsaw", "Poland"); var proposalUserId = new UserId(Guid.NewGuid()); var proposalDate = DateTime.Now; var meetingGroupProposal = MeetingGroupProposal.CreateToVerify(meetingGroupProposalId, "meetingName", "meetingDescription", location, proposalUserId, proposalDate); var meetingGroupProposalVerificationRequested = AssertPublishedDomainEvent <MeetingGroupProposalVerificationRequestedDomainEvent>(meetingGroupProposal); Assert.That(meetingGroupProposalVerificationRequested.Id, Is.EqualTo(new MeetingGroupProposalId(meetingGroupProposalId))); }
public void AcceptProposal_WhenIsAlreadyAccepted_BreaksProposalCannotBeAcceptedMoreThanOnceRule() { var proposalMemberId = new MemberId(Guid.NewGuid()); var meetingProposal = MeetingGroupProposal.ProposeNew( "name", "description", MeetingGroupLocation.CreateNew("Warsaw", "PL"), proposalMemberId); meetingProposal.Accept(); AssertBrokenRule <MeetingGroupProposalCannotBeAcceptedMoreThanOnceRule>(() => { meetingProposal.Accept(); }); }
public void AcceptProposal_WhenDecisionIsNotMade_IsSuccessful() { var meetingGroupProposalId = Guid.NewGuid(); var location = MeetingGroupLocation.Create("Warsaw", "Poland"); var proposalUserId = new UserId(Guid.NewGuid()); var proposalDate = DateTime.Now; var meetingGroupProposal = MeetingGroupProposal.CreateToVerify(meetingGroupProposalId, "meetingName", "meetingDescription", location, proposalUserId, proposalDate); meetingGroupProposal.Accept(new UserId(Guid.NewGuid())); var meetingGroupProposalAccepted = AssertPublishedDomainEvent <MeetingGroupProposalAcceptedDomainEvent>(meetingGroupProposal); Assert.That(meetingGroupProposalAccepted.MeetingGroupProposalId, Is.EqualTo(new MeetingGroupProposalId(meetingGroupProposalId))); }
public void EditGeneralAttributes_IsSuccessful() { var meetingGroup = CreateMeetingGroup(); var meetingGroupLocation = new MeetingGroupLocation("London", "GB"); meetingGroup.EditGeneralAttributes("newName", "newDescription", meetingGroupLocation); var meetingGroupGeneralAttributesEdited = AssertPublishedDomainEvent <MeetingGroupGeneralAttributesEditedDomainEvent>(meetingGroup); Assert.That(meetingGroupGeneralAttributesEdited.NewName, Is.EqualTo("newName")); Assert.That(meetingGroupGeneralAttributesEdited.NewDescription, Is.EqualTo("newDescription")); Assert.That(meetingGroupGeneralAttributesEdited.NewLocation, Is.EqualTo(meetingGroupLocation)); }
private static MeetingGroup CreateMeetingGroup(MemberId definedProposalMemberId = null) { var proposalMemberId = definedProposalMemberId ?? new MemberId(Guid.NewGuid()); var meetingProposal = MeetingGroupProposal.ProposeNew( "name", "description", MeetingGroupLocation.CreateNew("Warsaw", "PL"), proposalMemberId); meetingProposal.Accept(); var meetingGroup = meetingProposal.CreateMeetingGroup(); DomainEventsTestHelper.ClearAllDomainEvents(meetingGroup); return(meetingGroup); }
public void RejectProposal_WithoutProvidedReason_CannotBeRejected() { var meetingGroupProposalId = Guid.NewGuid(); var location = MeetingGroupLocation.Create("Warsaw", "Poland"); var userId = new UserId(Guid.NewGuid()); var proposalUserId = userId; var proposalDate = DateTime.Now; var meetingGroupProposal = MeetingGroupProposal.CreateToVerify(meetingGroupProposalId, "meetingName", "meetingDescription", location, proposalUserId, proposalDate); AssertBrokenRule <MeetingGroupProposalRejectionMustHaveAReasonRule>(() => { meetingGroupProposal.Reject(userId, string.Empty); }); }
private MeetingGroupProposal( string name, string description, MeetingGroupLocation location, MemberId proposalUserId) { Id = new MeetingGroupProposalId(Guid.NewGuid()); _name = name; _description = description; _location = location; _proposalUserId = proposalUserId; _proposalDate = SystemClock.Now; _status = MeetingGroupProposalStatus.InVerification; this.AddDomainEvent(new MeetingGroupProposedDomainEvent(this.Id, _name, _description, proposalUserId, _proposalDate, _location.City, _location.CountryCode)); }
public void RejectProposal_WhenDecisionIsMade_CanBeVerifiedOnlyOnce() { var meetingGroupProposalId = Guid.NewGuid(); var location = MeetingGroupLocation.Create("Warsaw", "Poland"); var userId = new UserId(Guid.NewGuid()); var proposalUserId = userId; var proposalDate = DateTime.Now; var meetingGroupProposal = MeetingGroupProposal.CreateToVerify(meetingGroupProposalId, "meetingName", "meetingDescription", location, proposalUserId, proposalDate); meetingGroupProposal.Accept(userId); AssertBrokenRule <MeetingGroupProposalCanBeVerifiedOnceRule>(() => { meetingGroupProposal.Reject(userId, "rejectReason"); }); }
public void CreateMeetingGroup_IsSuccessful_And_CreatorIsAHost() { var proposalMemberId = new MemberId(Guid.NewGuid()); var name = "name"; var description = "description"; var meetingGroupLocation = MeetingGroupLocation.CreateNew("Warsaw", "PL"); var meetingProposal = MeetingGroupProposal.ProposeNew( name, description, meetingGroupLocation, proposalMemberId); var meetingGroup = meetingProposal.CreateMeetingGroup(); var meetingGroupCreated = AssertPublishedDomainEvent <MeetingGroupCreatedDomainEvent>(meetingGroup); var newMeetingGroupMemberJoined = AssertPublishedDomainEvent <NewMeetingGroupMemberJoinedDomainEvent>(meetingGroup); Assert.That(meetingGroupCreated.MeetingGroupId, Is.EqualTo(meetingProposal.Id)); Assert.That(newMeetingGroupMemberJoined.MemberId, Is.EqualTo(proposalMemberId)); Assert.That(newMeetingGroupMemberJoined.Role, Is.EqualTo(MeetingGroupMemberRole.Organizer)); }
public MeetingGroupGeneralAttributesEditedDomainEvent(string newName, string newDescription, MeetingGroupLocation newLocation) { this.NewName = newName; this.NewDescription = newDescription; this.NewLocation = newLocation; }