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 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); }); }
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 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"); }); }