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);
        }
示例#2
0
        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)));
        }
示例#3
0
        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);
            });
        }
示例#4
0
        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)));
        }
示例#5
0
        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");
            });
        }