コード例 #1
0
        public void NextTwoWeeksDateProviderShouldReturnOnlyDatesInNextTwoWeeks()
        {
            var expectedResult = new[] { _currentDate, _currentDate.AddDays(1), _currentDate.AddDays(2), _currentDate.AddDays(3), _currentDate.AddDays(4), _currentDate.AddDays(5), _currentDate.AddDays(6), _currentDate.AddDays(7), _currentDate.AddDays(8), _currentDate.AddDays(9), _currentDate.AddDays(10), _currentDate.AddDays(11), _currentDate.AddDays(12), _currentDate.AddDays(13) };

            NextTwoWeeksDateProvider.GenerateTimeSpan(timeProviderMock.Object);
            Assert.AreEqual(NextTwoWeeksDateProvider.DatesInNextTwoWeeks, expectedResult);
        }
コード例 #2
0
        public void Setup()
        {
            var timeProviderMock = new Mock <ITimeProvider>();

            timeProviderMock.Setup(m => m.GetToday()).Returns(currentDate);
            NextTwoWeeksDateProvider.GenerateTimeSpan(timeProviderMock.Object);
            uut = new ExternalProductDeliveryDateFilter(timeProviderMock.Object);
        }
コード例 #3
0
        public void Setup()
        {
            var timeProviderMock = new Mock <ITimeProvider>();

            timeProviderMock.Setup(m => m.GetToday()).Returns(currentDate);
            timeProviderMock.Setup(m => m.GetDaysUntilEndOfWeek()).Returns(6);
            NextTwoWeeksDateProvider.GenerateTimeSpan(timeProviderMock.Object);
            uut = new TemporaryProductDeliveryDateFilter(timeProviderMock.Object);
        }
コード例 #4
0
        public IEnumerable <AvailableDeliveryDate> CalculateAvailableDeliveryDatesForProducts(int postalCode,
                                                                                              IEnumerable <ProductDTO> orderedProducts)
        {
            NextTwoWeeksDateProvider.GenerateTimeSpan(_timeProvider);

            if (!_productValidator.AreValid(orderedProducts))
            {
                return(new List <AvailableDeliveryDate>());
            }

            var daysToPossibleDeliveryOfProducts =
                orderedProducts.Select(product => new ProductDeliveryDates(product, _timeProvider).DaysUntilDelivery);

            if (!daysToPossibleDeliveryOfProducts.Any() || daysToPossibleDeliveryOfProducts.Any(x => !x.Any()))
            {
                return(new List <AvailableDeliveryDate>());
            }

            return(_deliveryDateBuilder.GenerateAvailableDeliveryDates(postalCode,
                                                                       new DeliveryDateDictionary(daysToPossibleDeliveryOfProducts).DaysToDelivery));
        }
コード例 #5
0
 public void Setup()
 {
     _timeMock = new Mock <ITimeProvider>();
     _timeMock.Setup(m => m.GetToday()).Returns(_currentTime);
     NextTwoWeeksDateProvider.GenerateTimeSpan(_timeMock.Object);
 }