Ejemplo n.º 1
0
        private static void UpdateTile()
        {
            var cashFlow =
                new CashFlowDataProvider(ServiceLocator.Current.GetInstance<IPaymentRepository>()).GetValues(
                    DateTime.Today.GetFirstDayOfMonth(),
                    DateTime.Today.GetLastDayOfMonth());

            ServiceLocator.Current.GetInstance<IUserNotification>()
                .UpdateMainTile(cashFlow.Income.Label, cashFlow.Spending.Label, cashFlow.Revenue.Label);
        }
Ejemplo n.º 2
0
        private static void UpdateTile()
        {
            var cashFlow =
                new CashFlowDataProvider(Mvx.Resolve<IPaymentRepository>()).GetValues(
                    DateTime.Today.GetFirstDayOfMonth(),
                    DateTime.Today.GetLastDayOfMonth());

            Mvx.Resolve<ITileUpdateService>()
                .UpdateMainTile(cashFlow.Income.Label, cashFlow.Spending.Label, cashFlow.Revenue.Label);
        }
        public void GetValues_SetupData_ListWithoutTransfer()
        {
            //Setup
            var paymentRepoSetup = new Mock<IPaymentRepository>();
            paymentRepoSetup.SetupAllProperties();

            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
                },
                new Payment
                {
                    Id = 2,
                    Type = (int) PaymentType.Expense,
                    Date = DateTime.Today,
                    Amount = 50
                },
                new Payment
                {
                    Id = 3,
                    Type = (int) PaymentType.Transfer,
                    Date = DateTime.Today,
                    Amount = 40
                }
            });

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

            //Assertion
            result.Income.Value.ShouldBe(60);
            result.Spending.Value.ShouldBe(50);
            result.Revenue.Value.ShouldBe(10);
        }
Ejemplo n.º 4
0
        public void GetValues_SetupData_ListWithoutTransfer()
        {
            //Setup
            var paymentRepoSetup = new Mock <IPaymentRepository>();

            paymentRepoSetup.Setup(x => x.GetList(It.IsAny <Expression <Func <Payment, bool> > >())).Returns(new List <Payment>
            {
                new Payment
                {
                    Id     = 1,
                    Type   = (int)PaymentType.Income,
                    Date   = DateTime.Today,
                    Amount = 60
                },
                new Payment
                {
                    Id     = 2,
                    Type   = (int)PaymentType.Expense,
                    Date   = DateTime.Today,
                    Amount = 50
                },
                new Payment
                {
                    Id     = 3,
                    Type   = (int)PaymentType.Transfer,
                    Date   = DateTime.Today,
                    Amount = 40
                }
            });

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

            //Assertion
            result.Income.Value.ShouldBe(60);
            result.Spending.Value.ShouldBe(50);
            result.Revenue.Value.ShouldBe(10);
        }
 public StatisticCashFlowViewModel(IPaymentRepository paymentRepository, ISettingsManager settingsManager)
 {
     this.settingsManager = settingsManager;
     cashFlowDataProvider = new CashFlowDataProvider(paymentRepository);
     CashFlowModel        = GetCashFlowModel();
 }
Ejemplo n.º 6
0
 public StatisticCashFlowViewModel(IPaymentRepository paymentRepository)
 {
     cashFlowDataProvider = new CashFlowDataProvider(paymentRepository);
     CashFlowModel        = GetCashFlowModel();
 }
        public StatisticCashFlowViewModel(IPaymentRepository paymentRepository)
        {
            cashFlowDataProvider = new CashFlowDataProvider(paymentRepository);

            CashFlowModel = GetCashFlowModel();
        }