Beispiel #1
0
        internal void ChangeStatus(BookedRecordStatus newStatus)
        {
            CheckRule(new BookedRecordToBeChangedMustBeUnfinishedRule(this));

            status     = newStatus;
            changeDate = DateTime.Now;
        }
 public SetBookedRecordStatusCommand(Guid bookingId, Guid facilityId, Guid bookedRecordId, BookedRecordStatus status)
 {
     BookingId      = bookingId;
     FacilityId     = facilityId;
     BookedRecordId = bookedRecordId;
     Status         = status;
 }
Beispiel #3
0
        public void ChangeRecordStatus_FinishedAllBookedRecords_IsFinished(BookedRecordStatus serviceStatus)
        {
            var booking   = BookingFactory.CreateBooked(DateTime.Now.AddDays(1), 60);
            var serviceId = booking.DomainEvents.OfType <BookedEvent>().Single().BookedRecordId;

            booking.ChangeRecordStatus(serviceId, serviceStatus);

            Assert.True(booking.IsFinished);
            AssertDomainEventPublished <BookingFinishedEvent>(booking);
        }
Beispiel #4
0
        public void ChangeRecordStatus(BookedRecordId serviceId, BookedRecordStatus recordStatus)
        {
            bookedRecords
            .First(s => s.Id == serviceId)
            .ChangeStatus(recordStatus);

            if (IsFinished)
            {
                status = BookingStatus.Finished;
                AddDomainEvent(new BookingFinishedEvent(Id));
            }
        }
Beispiel #5
0
        public void ChangeRecordStatus_NotAllBookedRecordsFinished_IsNotFinished(BookedRecordStatus serviceStatus)
        {
            var booking = BookingFactory.CreateBooked(new List <(DateTime, short)> {
                (DateTime.Now.AddDays(1), 60),
                (DateTime.Now.AddDays(2), 60)
            });
            var serviceId = booking.DomainEvents.OfType <BookedEvent>().First().BookedRecordId;

            booking.ChangeRecordStatus(serviceId, serviceStatus);

            Assert.False(booking.IsFinished);
        }