Пример #1
0
        public void GetCallbackBookingQuota_ReturnsQuotaMatchingScheduledAt()
        {
            var queryableQuotas = MockCallbackBookingQuotas();

            _mockService.Setup(mock => mock.CreateQuery("dfe_callbackbookingquota", _context))
            .Returns(queryableQuotas);
            var quota   = queryableQuotas.ToArray()[3];
            var startAt = quota.GetAttributeValue <DateTime>("dfe_starttime");

            var result = _crm.GetCallbackBookingQuota(startAt);

            result.StartAt.Should().Be(startAt);
        }
        private void IncrementCallbackBookingQuotaNumberOfBookings(PhoneCall phoneCall)
        {
            if (phoneCall == null)
            {
                return;
            }

            var quota = _crm.GetCallbackBookingQuota(phoneCall.ScheduledAt);

            if (quota == null || !quota.IsAvailable)
            {
                return;
            }

            quota.NumberOfBookings += 1;

            _crm.Save(quota);
        }