Example #1
0
        private MonthlyReturnDto[] GetMonthlyReturnSeries(int entityNumber)
        {
            var returnSeries   = _returnsSeriesDataRepository.GetReturnSeries(new[] { entityNumber }).First();
            var monthlyReturns = _monthlyReturnsDataRepository.GetMonthlyReturns(returnSeries.ReturnSeriesId);

            return(monthlyReturns);
        }
Example #2
0
        private MonthlyReturnDto[] GetMonthlyReturns(
            ReturnSeriesDto[] returnSeries)
        {
            var distinctReturnSeriesIds = returnSeries
                                          .Select(d => d.ReturnSeriesId)
                                          .Distinct()
                                          .ToArray();

            var monthlyReturnDtos = _monthlyReturnsDataRepository
                                    .GetMonthlyReturns(distinctReturnSeriesIds);

            return(monthlyReturnDtos);
        }
Example #3
0
        public void ShouldReadAndWriteMonthlyReturns()
        {
            var newReturnsSeries = InsertTestReturnSeries();

            var testMonthlyReturns = CreateTestMonthlyReturns(newReturnsSeries);

            _monthlyReturnsDataRepository.InsertMonthlyReturns(testMonthlyReturns);

            var savedMonthlyReturns = _monthlyReturnsDataRepository.GetMonthlyReturns(newReturnsSeries.ReturnSeriesId);

            AssertMonthlyReturnsAreValid(savedMonthlyReturns, newReturnsSeries.ReturnSeriesId);

            _monthlyReturnsDataRepository.DeleteMonthlyReturns(newReturnsSeries.ReturnSeriesId);
            _returnsSeriesDataRepository.DeleteReturnSeries(newReturnsSeries.ReturnSeriesId);
        }