public async Task GetAverageShouldReturnAverageBetweenModels()
        {
            // Arrange
            const int timeSlot = 1;
            var       start    = new DateTime(2018, 1, 1, 0, 0, 0, 0);

            _converterMock.Setup(x => x.GetTimeSlotStartDate(timeSlot))
            .Returns(start);

            _converterMock.Setup(x => x.GetTimeSlotStartDate(timeSlot + 1))
            .Returns(start.AddDays(1));

            // Act
            var average = await _service.GetAverage(timeSlot, "owner1", "instrument1",
                                                    "portfolio1");

            // Assert
            average.Price.ShouldBe(2.0m);
            average.Start.ShouldBe(start);
        }
        public async Task <ApiPriceModel> Handle(AveragePriceRequest request, CancellationToken cancellationToken)
        {
            var date = request.Date.Parse();

            var timeSlot = _converter.DateTimeToTimeSlot(date);

            var isInstrumentOwnerEmpty = string.IsNullOrEmpty(request.InstrumentOwner);
            var isInstrumentEmpty      = string.IsNullOrEmpty(request.Instrument);
            var isPortfolioEmpty       = string.IsNullOrEmpty(request.Portfolio);

            if (isInstrumentOwnerEmpty && isInstrumentEmpty && isPortfolioEmpty)
            {
                throw new ArgumentNullException(nameof(request),
                                                "Provide at least one filter");
            }

            var average = await _priceModelService.GetAverage(timeSlot,
                                                              request.InstrumentOwner, request.Instrument, request.Portfolio);

            return(new ApiPriceModel(average.Start, average.Price));
        }