Beispiel #1
0
        public void GetCallbackBookingQuotas_ReturnsFutureQuotasUpTo14DaysInAdvanceExcludingFullyBooked()
        {
            var queryableQuotas = MockCallbackBookingQuotas();

            _mockService.Setup(mock => mock.CreateQuery("dfe_callbackbookingquota", _context))
            .Returns(queryableQuotas);

            var result = _crm.GetCallbackBookingQuotas().ToList();

            result.Select(quota => quota.NumberOfBookings).Should().BeEquivalentTo(
                new object[] { 4, 3, 2 },
                options => options.WithStrictOrdering());
        }
Beispiel #2
0
        public IEnumerable <CallbackBookingQuota> GetCallbackBookingQuotas()
        {
            IEnumerable <CallbackBookingQuota> quotas = null;

            try
            {
                quotas = _crm.GetCallbackBookingQuotas();
            }
            catch
            {
                _logger.LogError("GetCallbackBookingQuotas: failed to reach CRM");
            }

            if (quotas == null || !quotas.Any())
            {
                _logger.LogWarning("GetCallbackBookingQuotas: returning fallback quotas");

                quotas = FallbackBookingQuotas();
            }

            return(quotas);
        }