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));
        }
Ejemplo n.º 2
0
        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 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();
            });
        }
Ejemplo n.º 7
0
        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);
        }
Ejemplo n.º 8
0
        public void EditGeneralAttributes_IsSuccessful()
        {
            var meetingGroup = CreateMeetingGroup();

            var meetingGroupLocation = MeetingGroupLocation.CreateNew("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));
        }
        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));
        }