public void RegisterPayment_TermsAreNotOverlapping_IsSuccessful()
        {
            var meetingGroupId = new MeetingGroupId(Guid.NewGuid());
            var paymentScheduleForMeetingGroup = MeetingGroupPaymentRegister.CreatePaymentScheduleForMeetingGroup(meetingGroupId);

            var payerId     = new PayerId(Guid.NewGuid());
            var paymentTerm = new PaymentTerm(
                new DateTime(2019, 1, 1),
                new DateTime(2019, 1, 31));

            paymentScheduleForMeetingGroup.RegisterPayment(
                paymentTerm, payerId);

            var nextPaymentTerm = new PaymentTerm(
                new DateTime(2019, 2, 1),
                new DateTime(2019, 2, 28));

            paymentScheduleForMeetingGroup.RegisterPayment(
                nextPaymentTerm, payerId);

            var domainEvents = AssertPublishedDomainEvents <PaymentRegisteredDomainEvent>(paymentScheduleForMeetingGroup);

            Assert.That(domainEvents.Count, Is.EqualTo(2));
            Assert.That(domainEvents[1].DateTo, Is.EqualTo(nextPaymentTerm.EndDate));
        }
        public void CreatePaymentScheduleForMeetingGroup_IsSuccessful()
        {
            var meetingGroupId = new MeetingGroupId(Guid.NewGuid());
            var paymentScheduleForMeetingGroup = MeetingGroupPaymentRegister.CreatePaymentScheduleForMeetingGroup(meetingGroupId);

            var meetingGroupPaymentRegisterCreated =
                AssertPublishedDomainEvent <MeetingGroupPaymentRegisterCreatedDomainEvent>(paymentScheduleForMeetingGroup);

            Assert.That(meetingGroupPaymentRegisterCreated.MeetingGroupPaymentRegisterId.Value, Is.EqualTo(meetingGroupId.Value));
        }
 internal static Meeting CreateNew(MeetingGroupId meetingGroupId,
                                   string title,
                                   MeetingTerm term,
                                   string description,
                                   MeetingLocation location,
                                   MeetingLimits meetingLimits,
                                   Term rsvpTerm,
                                   MoneyValue eventFee,
                                   List <MemberId> hostsMembersIds,
                                   MemberId creatorId)
 {
     return(new Meeting(meetingGroupId, title, term, description,
                        location, meetingLimits, rsvpTerm, eventFee, hostsMembersIds, creatorId));
 }
        internal Meeting(
            MeetingGroupId meetingGroupId,
            string title,
            MeetingTerm term,
            string description,
            MeetingLocation location,
            int?attendeesLimit,
            int guestsLimit,
            Term rsvpTerm,
            MoneyValue eventFee,
            List <MemberId> hostsMembersIds,
            MemberId creatorId)
        {
            Id = new MeetingId(Guid.NewGuid());
            _meetingGroupId = meetingGroupId;
            _title          = title;
            _term           = term;
            _description    = description;
            _location       = location;
            _attendeesLimit = attendeesLimit;
            _guestsLimit    = guestsLimit;

            this.SetRsvpTerm(rsvpTerm, _term);
            _eventFee   = eventFee;
            _creatorId  = creatorId;
            _createDate = SystemClock.Now;

            _attendees       = new List <MeetingAttendee>();
            _notAttendees    = new List <MeetingNotAttendee>();
            _waitlistMembers = new List <MeetingWaitlistMember>();

            this.AddDomainEvent(new MeetingCreatedDomainEvent(this.Id));
            var rsvpDate = SystemClock.Now;

            if (hostsMembersIds.Any())
            {
                foreach (var hostMemberId in hostsMembersIds)
                {
                    _attendees.Add(new MeetingAttendee(this.Id, hostMemberId, rsvpDate, MeetingAttendeeRole.Host, 0, MoneyValue.Zero));
                }
            }
            else
            {
                _attendees.Add(new MeetingAttendee(this.Id, creatorId, rsvpDate, MeetingAttendeeRole.Host, 0, MoneyValue.Zero));
            }
        }
        public void RegisterPayment_OnlyOnePayment_IsSuccessful()
        {
            var meetingGroupId = new MeetingGroupId(Guid.NewGuid());
            var paymentScheduleForMeetingGroup = MeetingGroupPaymentRegister.CreatePaymentScheduleForMeetingGroup(meetingGroupId);

            var payerId     = new PayerId(Guid.NewGuid());
            var paymentTerm = new PaymentTerm(
                new DateTime(2019, 1, 1),
                new DateTime(2019, 1, 31));

            paymentScheduleForMeetingGroup.RegisterPayment(
                paymentTerm, payerId);

            var paymentRegistered = AssertPublishedDomainEvent <PaymentRegisteredDomainEvent>(paymentScheduleForMeetingGroup);

            Assert.That(paymentRegistered.MeetingGroupPaymentRegisterId, Is.EqualTo(paymentScheduleForMeetingGroup.Id));
            Assert.That(paymentRegistered.DateTo, Is.EqualTo(paymentTerm.EndDate));
        }
        public void RegisterPayment_TermsAreOverlapping_BreaksPaymentTermsCannotOverlapRule()
        {
            var meetingGroupId = new MeetingGroupId(Guid.NewGuid());
            var paymentScheduleForMeetingGroup = MeetingGroupPaymentRegister.CreatePaymentScheduleForMeetingGroup(meetingGroupId);

            var payerId     = new PayerId(Guid.NewGuid());
            var paymentTerm = new PaymentTerm(
                new DateTime(2019, 1, 1),
                new DateTime(2019, 1, 31));

            paymentScheduleForMeetingGroup.RegisterPayment(
                paymentTerm, payerId);

            var nextPaymentTerm = new PaymentTerm(
                new DateTime(2019, 1, 31),
                new DateTime(2019, 2, 28));

            AssertBrokenRule <MeetingGroupPaymentsCannotOverlapRule>(() =>
            {
                paymentScheduleForMeetingGroup.RegisterPayment(
                    nextPaymentTerm, payerId);
            });
        }
 public NewMeetingGroupMemberJoinedDomainEvent(MeetingGroupId meetingGroupId, MemberId memberId, MeetingGroupMemberRole role)
 {
     this.MeetingGroupId = meetingGroupId;
     this.MemberId       = memberId;
     this.Role           = role;
 }
Exemple #8
0
 internal MeetingGroupCreatedNotification(MeetingGroupId meetingGroupId, MemberId creatorId, Guid id) : base(null, id)
 {
     this.MeetingGroupId = meetingGroupId;
     this.CreatorId      = creatorId;
 }
 internal SendMeetingGroupCreatedEmailCommand(Guid id, MeetingGroupId meetingGroupId, MemberId creatorId) : base(id)
 {
     MeetingGroupId = meetingGroupId;
     CreatorId      = creatorId;
 }
 public MeetingGroupMemberData(MeetingGroupId meetingGroupId, MeetingGroupMemberRole role)
 {
     MeetingGroupId = meetingGroupId;
     Role           = role;
 }
Exemple #11
0
 public MeetingGroupCreatedDomainEvent(MeetingGroupId meetingGroupId, MemberId creatorId)
 {
     this.MeetingGroupId = meetingGroupId;
     this.CreatorId      = creatorId;
 }
 public async Task <MeetingGroup> GetByIdAsync(MeetingGroupId id)
 {
     return(await _meetingsContext.MeetingGroups.FirstOrDefaultAsync(x => x.Id == id));
 }
Exemple #13
0
 public MeetingGroupMemberLeftGroupDomainEvent(MeetingGroupId meetingGroupId, MemberId memberId)
 {
     MeetingGroupId = meetingGroupId;
     MemberId       = memberId;
 }
Exemple #14
0
 public MeetingGroupMemberData(MeetingGroupId meetingGroupId, MemberId memberId)
 {
     MemberId       = memberId;
     MeetingGroupId = meetingGroupId;
 }
Exemple #15
0
 public MeetingGroupPaymentInfoUpdatedDomainEvent(MeetingGroupId meetingGroupId, DateTime paymentDateTo)
 {
     MeetingGroupId = meetingGroupId;
     PaymentDateTo  = paymentDateTo;
 }