public async Task GetValues_CorrectCurrency(string culture, char expectedCurrencySymbol)
        {
            // Arrange
            var cultureInfo = new CultureInfo(culture);

            Thread.CurrentThread.CurrentCulture   = cultureInfo;
            Thread.CurrentThread.CurrentUICulture = cultureInfo;

            var testCat2 = new Category("Rent");

            var account = new Account("test");

            var paymentList = new List <Payment>
            {
                new Payment(DateTime.Today, 90, PaymentType.Expense, account, category: testCat2)
            };

            var statisticDbAccess = new Mock <IStatisticDbAccess>();

            statisticDbAccess.Setup(x => x.GetPaymentsWithoutTransfer(It.IsAny <DateTime>(), It.IsAny <DateTime>()))
            .Returns(Task.FromResult(paymentList));

            // Act
            var provider = new CategorySpreadingDataProvider(statisticDbAccess.Object);
            var result   = (await provider.GetValues(DateTime.Today.AddDays(-3), DateTime.Today.AddDays(3))).ToList();

            // Assert
            result[0].ValueLabel[0].ShouldEqual(expectedCurrencySymbol);
        }
        public async Task GetValues_CorrectSums()
        {
            // Arrange
            var testCat1 = new Category("Ausgehen");
            var testCat2 = new Category("Rent");
            var testCat3 = new Category("Food");

            var account = new Account("test");

            var paymentList = new List <Payment>
            {
                new Payment(DateTime.Today, 60, PaymentType.Income, account, category: testCat1),
                new Payment(DateTime.Today, 90, PaymentType.Expense, account, category: testCat1),
                new Payment(DateTime.Today, 10, PaymentType.Expense, account, category: testCat3),
                new Payment(DateTime.Today, 90, PaymentType.Expense, account, category: testCat2)
            };

            var statisticDbAccess = new Mock <IStatisticDbAccess>();

            statisticDbAccess.Setup(x => x.GetPaymentsWithoutTransfer(It.IsAny <DateTime>(), It.IsAny <DateTime>()))
            .Returns(Task.FromResult(paymentList));

            // Act
            var provider = new CategorySpreadingDataProvider(statisticDbAccess.Object);
            var result   = (await provider.GetValues(DateTime.Today.AddDays(-3), DateTime.Today.AddDays(3))).ToList();

            // Assert
            Assert.Equal(3, result.Count);
            Assert.Equal(90, result[0].Value);
            Assert.Equal(30, result[1].Value);
            Assert.Equal(10, result[2].Value);
        }
 public StatisticCategorySpreadingViewModel(CategorySpreadingDataProvider spreadingDataProvider,
                                            ISettingsManager settingsManager,
                                            IMvxMessenger messenger) : base(messenger)
 {
     this.spreadingDataProvider = spreadingDataProvider;
     this.settingsManager       = settingsManager;
 }
 public StatisticCategorySpreadingViewModel(CategorySpreadingDataProvider spreadingDataProvider,
                                            IMvxMessenger messenger)
     : base(messenger)
 {
     this.spreadingDataProvider = spreadingDataProvider;
     StatisticItems             = new MvxObservableCollection <StatisticItem>();
 }
        public void GetValues_InitializedData_IgnoreTransfers()
        {
            //Setup
            var paymentRepoSetup = new Mock <IPaymentRepository>();

            paymentRepoSetup.SetupAllProperties();

            var categoryRepoSetup = new Mock <IRepository <Category> >();

            categoryRepoSetup.SetupAllProperties();

            var categoryRepo = categoryRepoSetup.Object;

            categoryRepo.Data = new ObservableCollection <Category>(new List <Category> {
                new Category {
                    Id = 2, Name = "Ausgehen"
                }
            });

            var paymentRepository = paymentRepoSetup.Object;

            paymentRepository.Data = new ObservableCollection <Payment>(new List <Payment> {
                new Payment {
                    Id         = 1,
                    Type       = (int)PaymentType.Income,
                    Date       = DateTime.Today,
                    Amount     = 60,
                    Category   = categoryRepo.Data.First(),
                    CategoryId = 1
                },
                new Payment {
                    Id         = 2,
                    Type       = (int)PaymentType.Expense,
                    Date       = DateTime.Today,
                    Amount     = 90,
                    Category   = categoryRepo.Data.First(),
                    CategoryId = 1
                },
                new Payment {
                    Id         = 3,
                    Type       = (int)PaymentType.Transfer,
                    Date       = DateTime.Today,
                    Amount     = 40,
                    Category   = categoryRepo.Data.First(),
                    CategoryId = 1
                }
            });

            //Excution
            var result =
                new CategorySpreadingDataProvider(paymentRepository, categoryRepo).GetValues(DateTime.Today.AddDays(-3),
                                                                                             DateTime.Today.AddDays(3)).ToList();

            //Assertion
            result.Count.ShouldBe(1);
            result.First().Value.ShouldBe(30);
        }
 /// <summary>
 ///     Contstructor
 /// </summary>
 public StatisticCategorySpreadingViewModel(CategorySpreadingDataProvider spreadingDataProvider,
                                            IMvxMessenger messenger,
                                            ISettingsManager settingsManager,
                                            IMvxLogProvider logProvider,
                                            IMvxNavigationService navigationService)
     : base(messenger, settingsManager, logProvider, navigationService)
 {
     this.spreadingDataProvider = spreadingDataProvider;
 }
Exemplo n.º 7
0
 /// <summary>
 ///     Contstructor
 /// </summary>
 public StatisticCategorySpreadingViewModel(CategorySpreadingDataProvider spreadingDataProvider,
                                            IMvxMessenger messenger,
                                            ISettingsManager settingsManager,
                                            IDialogService dialogService)
     : base(messenger, settingsManager)
 {
     this.spreadingDataProvider = spreadingDataProvider;
     this.dialogService         = dialogService;
 }
        public void GetValues_InitializedData_IgnoreTransfers()
        {
            //Setup
            var paymentRepoSetup = new Mock<IPaymentRepository>();
            paymentRepoSetup.SetupAllProperties();

            var categoryRepoSetup = new Mock<IRepository<Category>>();
            categoryRepoSetup.SetupAllProperties();

            var categoryRepo = categoryRepoSetup.Object;
            categoryRepo.Data = new ObservableCollection<Category>(new List<Category>
            {
                new Category {Id = 2, Name = "Ausgehen"}
            });

            var paymentRepository = paymentRepoSetup.Object;
            paymentRepository.Data = new ObservableCollection<Payment>(new List<Payment>
            {
                new Payment
                {
                    Id = 1,
                    Type = (int) PaymentType.Income,
                    Date = DateTime.Today,
                    Amount = 60,
                    Category = categoryRepo.Data.First(),
                    CategoryId = 1
                },
                new Payment
                {
                    Id = 2,
                    Type = (int) PaymentType.Expense,
                    Date = DateTime.Today,
                    Amount = 90,
                    Category = categoryRepo.Data.First(),
                    CategoryId = 1
                },
                new Payment
                {
                    Id = 3,
                    Type = (int) PaymentType.Transfer,
                    Date = DateTime.Today,
                    Amount = 40,
                    Category = categoryRepo.Data.First(),
                    CategoryId = 1
                }
            });

            //Excution
            var result =
                new CategorySpreadingDataProvider(paymentRepository, categoryRepo).GetValues(DateTime.Today.AddDays(-3),
                    DateTime.Today.AddDays(3)).ToList();

            //Assertion
            result.Count.ShouldBe(1);
            result.First().Value.ShouldBe(30);
        }
        public void GetValues_InitializedData_IgnoreTransfers()
        {
            //Setup
            var testCat = new CategoryViewModel {
                Id = 2, Name = "Ausgehen"
            };

            var paymentList = new List <PaymentViewModel>
            {
                new PaymentViewModel
                {
                    Id         = 1,
                    Type       = PaymentType.Income,
                    Date       = DateTime.Today,
                    Amount     = 60,
                    Category   = testCat,
                    CategoryId = 1
                },
                new PaymentViewModel
                {
                    Id         = 2,
                    Type       = PaymentType.Expense,
                    Date       = DateTime.Today,
                    Amount     = 90,
                    Category   = testCat,
                    CategoryId = 1
                },
                new PaymentViewModel
                {
                    Id         = 3,
                    Type       = PaymentType.Transfer,
                    Date       = DateTime.Today,
                    Amount     = 40,
                    Category   = testCat,
                    CategoryId = 1
                }
            };

            var paymentRepoSetup = new Mock <IPaymentRepository>();

            paymentRepoSetup.Setup(x => x.GetList(It.IsAny <Expression <Func <PaymentViewModel, bool> > >()))
            .Returns((Expression <Func <PaymentViewModel, bool> > filter) => paymentList.Where(filter.Compile()).ToList());

            //Excution
            var result =
                new CategorySpreadingDataProvider(paymentRepoSetup.Object).GetValues(DateTime.Today.AddDays(-3),
                                                                                     DateTime.Today.AddDays(3)).ToList();

            //Assertion
            result.Count.ShouldBe(1);
            result.First().Value.ShouldBe(30);
        }
        public void GetValues_InitializedData_CalculateIncome()
        {
            //Setup

            var categoryRepoSetup = new Mock <ICategoryRepository>();

            categoryRepoSetup.Setup(x => x.GetList(It.IsAny <Expression <Func <CategoryViewModel, bool> > >())).Returns(new List <CategoryViewModel>
            {
                new CategoryViewModel {
                    Id = 1, Name = "Einkaufen"
                },
                new CategoryViewModel {
                    Id = 2, Name = "Ausgehen"
                },
                new CategoryViewModel {
                    Id = 3, Name = "Foo"
                }
            });

            var categoryRepo = categoryRepoSetup.Object;

            var paymentRepoSetup = new Mock <IPaymentRepository>();

            paymentRepoSetup.Setup(x => x.GetList(It.IsAny <Expression <Func <PaymentViewModel, bool> > >())).Returns(new List <PaymentViewModel>
            {
                new PaymentViewModel
                {
                    Id         = 1,
                    Type       = PaymentType.Income,
                    Date       = DateTime.Today,
                    Amount     = 60,
                    Category   = categoryRepo.GetList().ToList()[0],
                    CategoryId = 1
                },
                new PaymentViewModel
                {
                    Id         = 2,
                    Type       = (int)PaymentType.Expense,
                    Date       = DateTime.Today,
                    Amount     = 90,
                    Category   = categoryRepo.GetList().ToList()[0],
                    CategoryId = 1
                },
                new PaymentViewModel
                {
                    Id         = 3,
                    Type       = (int)PaymentType.Expense,
                    Date       = DateTime.Today,
                    Amount     = 40,
                    Category   = categoryRepo.GetList().ToList()[1],
                    CategoryId = 2
                },
                new PaymentViewModel
                {
                    Id         = 3,
                    Type       = PaymentType.Income,
                    Date       = DateTime.Today,
                    Amount     = 66,
                    Category   = categoryRepo.GetList().ToList()[2],
                    CategoryId = 3
                }
            });

            //Excution
            var result =
                new CategorySpreadingDataProvider(paymentRepoSetup.Object).GetValues(DateTime.Today.AddDays(-3),
                                                                                     DateTime.Today.AddDays(3)).ToList();

            //Assertion
            result.Count.ShouldBe(2);
            result[0].Value.ShouldBe(40);
            result[1].Value.ShouldBe(30);
        }
        public void GetValues_InitializedData_AddOtherItem()
        {
            //Setup
            var categoryRepoSetup = new Mock <ICategoryRepository>();

            categoryRepoSetup.Setup(x => x.GetList(It.IsAny <Expression <Func <CategoryViewModel, bool> > >())).Returns(new List <CategoryViewModel>
            {
                new CategoryViewModel {
                    Id = 1, Name = "Einkaufen"
                },
                new CategoryViewModel {
                    Id = 2, Name = "Ausgehen"
                },
                new CategoryViewModel {
                    Id = 3, Name = "Bier"
                },
                new CategoryViewModel {
                    Id = 4, Name = "Wein"
                },
                new CategoryViewModel {
                    Id = 5, Name = "Wodka"
                },
                new CategoryViewModel {
                    Id = 6, Name = "Limoncella"
                },
                new CategoryViewModel {
                    Id = 7, Name = "Spagetthi"
                },
                new CategoryViewModel {
                    Id = 8, Name = "Tomaten"
                }
            });

            var categoryRepo = categoryRepoSetup.Object;

            var paymentRepoSetup = new Mock <IPaymentRepository>();

            paymentRepoSetup.Setup(x => x.GetList(It.IsAny <Expression <Func <PaymentViewModel, bool> > >())).Returns(new List <PaymentViewModel>
            {
                new PaymentViewModel
                {
                    Id         = 1,
                    Type       = (int)PaymentType.Expense,
                    Date       = DateTime.Today,
                    Amount     = 10,
                    Category   = categoryRepo.GetList().ToList()[0],
                    CategoryId = 1
                },
                new PaymentViewModel
                {
                    Id         = 2,
                    Type       = (int)PaymentType.Expense,
                    Date       = DateTime.Today,
                    Amount     = 20,
                    Category   = categoryRepo.GetList().ToList()[1],
                    CategoryId = 2
                },
                new PaymentViewModel
                {
                    Id         = 3,
                    Type       = (int)PaymentType.Expense,
                    Date       = DateTime.Today,
                    Amount     = 30,
                    Category   = categoryRepo.GetList().ToList()[2],
                    CategoryId = 3
                },
                new PaymentViewModel
                {
                    Id         = 3,
                    Type       = (int)PaymentType.Expense,
                    Date       = DateTime.Today,
                    Amount     = 40,
                    Category   = categoryRepo.GetList().ToList()[3],
                    CategoryId = 4
                },
                new PaymentViewModel
                {
                    Id         = 3,
                    Type       = (int)PaymentType.Expense,
                    Date       = DateTime.Today,
                    Amount     = 50,
                    Category   = categoryRepo.GetList().ToList()[4],
                    CategoryId = 5
                },
                new PaymentViewModel
                {
                    Id         = 3,
                    Type       = (int)PaymentType.Expense,
                    Date       = DateTime.Today,
                    Amount     = 60,
                    Category   = categoryRepo.GetList().ToList()[5],
                    CategoryId = 6
                },
                new PaymentViewModel
                {
                    Id         = 3,
                    Type       = (int)PaymentType.Expense,
                    Date       = DateTime.Today,
                    Amount     = 70,
                    Category   = categoryRepo.GetList().ToList()[6],
                    CategoryId = 7
                },
                new PaymentViewModel
                {
                    Id         = 3,
                    Type       = (int)PaymentType.Expense,
                    Date       = DateTime.Today,
                    Amount     = 80,
                    Category   = categoryRepo.GetList().ToList()[7],
                    CategoryId = 8
                }
            });

            //Excution
            var result =
                new CategorySpreadingDataProvider(paymentRepoSetup.Object).GetValues(DateTime.Today.AddDays(-3),
                                                                                     DateTime.Today.AddDays(3)).ToList();

            //Assertion
            result.Count.ShouldBe(7);
            result[0].Value.ShouldBe(80);
            result[1].Value.ShouldBe(70);
            result[2].Value.ShouldBe(60);
            result[3].Value.ShouldBe(50);
            result[4].Value.ShouldBe(40);
            result[5].Value.ShouldBe(30);
            result[6].Value.ShouldBe(30);
        }
        public void GetValues_InitializedData_HandleDateCorrectly()
        {
            //Setup
            var testList = new List <CategoryViewModel>
            {
                new CategoryViewModel {
                    Id = 1, Name = "Einkaufen"
                },
                new CategoryViewModel {
                    Id = 2, Name = "Ausgehen"
                },
                new CategoryViewModel {
                    Id = 3, Name = "Bier"
                }
            };

            var paymentList = new List <PaymentViewModel>
            {
                new PaymentViewModel
                {
                    Id         = 1,
                    Type       = (int)PaymentType.Expense,
                    Date       = DateTime.Today.AddDays(-5),
                    Amount     = 60,
                    Category   = testList[0],
                    CategoryId = 1
                },
                new PaymentViewModel
                {
                    Id         = 2,
                    Type       = (int)PaymentType.Expense,
                    Date       = DateTime.Today,
                    Amount     = 90,
                    Category   = testList[1],
                    CategoryId = 2
                },
                new PaymentViewModel
                {
                    Id         = 3,
                    Type       = (int)PaymentType.Expense,
                    Date       = DateTime.Today.AddDays(5),
                    Amount     = 40,
                    Category   = testList[2],
                    CategoryId = 3
                }
            };

            var paymentRepoSetup = new Mock <IPaymentRepository>();

            paymentRepoSetup.Setup(x => x.GetList(It.IsAny <Expression <Func <PaymentViewModel, bool> > >()))
            .Returns((Expression <Func <PaymentViewModel, bool> > filter) => paymentList.Where(filter.Compile()).ToList());

            //Excution
            var result =
                new CategorySpreadingDataProvider(paymentRepoSetup.Object).GetValues(DateTime.Today.AddDays(-3),
                                                                                     DateTime.Today.AddDays(3)).ToList();

            //Assertion
            result.Count.ShouldBe(1);
            result.First().Value.ShouldBe(90);
        }
Exemplo n.º 13
0
        public void GetValues_CorrectSums()
        {
            // Arrange
            var testCat1 = new CategoryEntity {
                Id = 2, Name = "Ausgehen"
            };
            var testCat2 = new CategoryEntity {
                Id = 3, Name = "Rent"
            };
            var testCat3 = new CategoryEntity {
                Id = 4, Name = "Food"
            };

            var paymentList = new List <Payment>
            {
                new Payment
                {
                    Data =
                    {
                        Id         =                  1,
                        Type       = PaymentType.Income,
                        Date       = DateTime.Today,
                        Amount     =                 60,
                        Category   = testCat1,
                        CategoryId = testCat1.Id
                    }
                },
                new Payment
                {
                    Data =
                    {
                        Id         =                   2,
                        Type       = PaymentType.Expense,
                        Date       = DateTime.Today,
                        Amount     =                  90,
                        Category   = testCat1,
                        CategoryId = testCat1.Id
                    }
                },
                new Payment
                {
                    Data =
                    {
                        Id         =                   3,
                        Type       = PaymentType.Expense,
                        Date       = DateTime.Today,
                        Amount     =                  10,
                        Category   = testCat3,
                        CategoryId = testCat3.Id
                    }
                },
                new Payment
                {
                    Data =
                    {
                        Id         =                   4,
                        Type       = PaymentType.Expense,
                        Date       = DateTime.Today,
                        Amount     =                  90,
                        Category   = testCat2,
                        CategoryId = testCat2.Id
                    }
                }
            };

            var paymentService = new Mock <IPaymentService>();

            paymentService.Setup(x => x.GetPaymentsWithoutTransfer(It.IsAny <DateTime>(), It.IsAny <DateTime>()))
            .Returns(Task.FromResult <IEnumerable <Payment> >(paymentList));

            // Act
            var provider = new CategorySpreadingDataProvider(paymentService.Object);
            var result   = provider.GetValues(DateTime.Today.AddDays(-3), DateTime.Today.AddDays(3)).Result.ToList();

            // Assert
            Assert.Equal(3, result.Count);
            Assert.Equal(90, result[0].Value);
            Assert.Equal(30, result[1].Value);
            Assert.Equal(10, result[2].Value);
        }
 public StatisticCategorySpreadingViewModel(IPaymentRepository paymentRepository,
                                            IRepository <Category> categoryRepository)
 {
     speadingDataProvider = new CategorySpreadingDataProvider(paymentRepository, categoryRepository);
 }
        public void GetValues_InitializedData_AddOtherItem()
        {
            //Setup
            var paymentRepoSetup = new Mock <IPaymentRepository>();

            paymentRepoSetup.SetupAllProperties();

            var categoryRepoSetup = new Mock <IRepository <Category> >();

            categoryRepoSetup.SetupAllProperties();

            var categoryRepo = categoryRepoSetup.Object;

            categoryRepo.Data = new ObservableCollection <Category>(new List <Category>
            {
                new Category {
                    Id = 1, Name = "Einkaufen"
                },
                new Category {
                    Id = 2, Name = "Ausgehen"
                },
                new Category {
                    Id = 3, Name = "Bier"
                },
                new Category {
                    Id = 4, Name = "Wein"
                },
                new Category {
                    Id = 5, Name = "Wodka"
                },
                new Category {
                    Id = 6, Name = "Limoncella"
                },
                new Category {
                    Id = 7, Name = "Spagetthi"
                },
                new Category {
                    Id = 8, Name = "Tomaten"
                }
            });

            var paymentRepository = paymentRepoSetup.Object;

            paymentRepository.Data = new ObservableCollection <Payment>(new List <Payment>
            {
                new Payment
                {
                    Id         = 1,
                    Type       = (int)PaymentType.Expense,
                    Date       = DateTime.Today,
                    Amount     = 10,
                    Category   = categoryRepo.Data[0],
                    CategoryId = 1
                },
                new Payment
                {
                    Id         = 2,
                    Type       = (int)PaymentType.Expense,
                    Date       = DateTime.Today,
                    Amount     = 20,
                    Category   = categoryRepo.Data[1],
                    CategoryId = 2
                },
                new Payment
                {
                    Id         = 3,
                    Type       = (int)PaymentType.Expense,
                    Date       = DateTime.Today,
                    Amount     = 30,
                    Category   = categoryRepo.Data[2],
                    CategoryId = 3
                },
                new Payment
                {
                    Id         = 3,
                    Type       = (int)PaymentType.Expense,
                    Date       = DateTime.Today,
                    Amount     = 40,
                    Category   = categoryRepo.Data[3],
                    CategoryId = 4
                },
                new Payment
                {
                    Id         = 3,
                    Type       = (int)PaymentType.Expense,
                    Date       = DateTime.Today,
                    Amount     = 50,
                    Category   = categoryRepo.Data[4],
                    CategoryId = 5
                },
                new Payment
                {
                    Id         = 3,
                    Type       = (int)PaymentType.Expense,
                    Date       = DateTime.Today,
                    Amount     = 60,
                    Category   = categoryRepo.Data[5],
                    CategoryId = 6
                },
                new Payment
                {
                    Id         = 3,
                    Type       = (int)PaymentType.Expense,
                    Date       = DateTime.Today,
                    Amount     = 70,
                    Category   = categoryRepo.Data[6],
                    CategoryId = 7
                },
                new Payment
                {
                    Id         = 3,
                    Type       = (int)PaymentType.Expense,
                    Date       = DateTime.Today,
                    Amount     = 80,
                    Category   = categoryRepo.Data[7],
                    CategoryId = 8
                }
            });

            //Excution
            var result =
                new CategorySpreadingDataProvider(paymentRepository, categoryRepo).GetValues(DateTime.Today.AddDays(-3),
                                                                                             DateTime.Today.AddDays(3)).ToList();

            //Assertion
            result.Count.ShouldBe(7);
            result[0].Value.ShouldBe(80);
            result[1].Value.ShouldBe(70);
            result[2].Value.ShouldBe(60);
            result[3].Value.ShouldBe(50);
            result[4].Value.ShouldBe(40);
            result[5].Value.ShouldBe(30);
            result[6].Value.ShouldBe(30);
        }
        public void GetValues_InitializedData_AddOtherItem()
        {
            //Setup
            var paymentRepoSetup = new Mock<IPaymentRepository>();
            paymentRepoSetup.SetupAllProperties();

            var categoryRepoSetup = new Mock<IRepository<Category>>();
            categoryRepoSetup.SetupAllProperties();

            var categoryRepo = categoryRepoSetup.Object;
            categoryRepo.Data = new ObservableCollection<Category>(new List<Category>
            {
                new Category {Id = 1, Name = "Einkaufen"},
                new Category {Id = 2, Name = "Ausgehen"},
                new Category {Id = 3, Name = "Bier"},
                new Category {Id = 4, Name = "Wein"},
                new Category {Id = 5, Name = "Wodka"},
                new Category {Id = 6, Name = "Limoncella"},
                new Category {Id = 7, Name = "Spagetthi"},
                new Category {Id = 8, Name = "Tomaten"}
            });

            var paymentRepository = paymentRepoSetup.Object;
            paymentRepository.Data = new ObservableCollection<Payment>(new List<Payment>
            {
                new Payment
                {
                    Id = 1,
                    Type = (int) PaymentType.Expense,
                    Date = DateTime.Today,
                    Amount = 10,
                    Category = categoryRepo.Data[0],
                    CategoryId = 1
                },
                new Payment
                {
                    Id = 2,
                    Type = (int) PaymentType.Expense,
                    Date = DateTime.Today,
                    Amount = 20,
                    Category = categoryRepo.Data[1],
                    CategoryId = 2
                },
                new Payment
                {
                    Id = 3,
                    Type = (int) PaymentType.Expense,
                    Date = DateTime.Today,
                    Amount = 30,
                    Category = categoryRepo.Data[2],
                    CategoryId = 3
                },
                new Payment
                {
                    Id = 3,
                    Type = (int) PaymentType.Expense,
                    Date = DateTime.Today,
                    Amount = 40,
                    Category = categoryRepo.Data[3],
                    CategoryId = 4
                },
                new Payment
                {
                    Id = 3,
                    Type = (int) PaymentType.Expense,
                    Date = DateTime.Today,
                    Amount = 50,
                    Category = categoryRepo.Data[4],
                    CategoryId = 5
                },
                new Payment
                {
                    Id = 3,
                    Type = (int) PaymentType.Expense,
                    Date = DateTime.Today,
                    Amount = 60,
                    Category = categoryRepo.Data[5],
                    CategoryId = 6
                },
                new Payment
                {
                    Id = 3,
                    Type = (int) PaymentType.Expense,
                    Date = DateTime.Today,
                    Amount = 70,
                    Category = categoryRepo.Data[6],
                    CategoryId = 7
                },
                new Payment
                {
                    Id = 3,
                    Type = (int) PaymentType.Expense,
                    Date = DateTime.Today,
                    Amount = 80,
                    Category = categoryRepo.Data[7],
                    CategoryId = 8
                }
            });

            //Excution
            var result =
                new CategorySpreadingDataProvider(paymentRepository, categoryRepo).GetValues(DateTime.Today.AddDays(-3),
                    DateTime.Today.AddDays(3)).ToList();

            //Assertion
            result.Count.ShouldBe(7);
            result[0].Value.ShouldBe(80);
            result[1].Value.ShouldBe(70);
            result[2].Value.ShouldBe(60);
            result[3].Value.ShouldBe(50);
            result[4].Value.ShouldBe(40);
            result[5].Value.ShouldBe(30);
            result[6].Value.ShouldBe(30);
        }
 public StatisticCategorySpreadingViewModel(IPaymentRepository paymentRepository,
     IRepository<Category> categoryRepository)
 {
     speadingDataProvider = new CategorySpreadingDataProvider(paymentRepository, categoryRepository);
 }
 public StatisticCategorySpreadingViewModel(CategorySpreadingDataProvider spreadingDataProvider)
 {
     this.spreadingDataProvider = spreadingDataProvider;
 }