예제 #1
0
        protected override void OnAppearing()
        {
            _viewModel = new VoucherDetailsViewModel()
            {
                Voucher = _voucherDetails
            };
            this.BindingContext = _viewModel;

            collectionViewRedemptionPoints.HeightRequest = _viewModel.Voucher.RedemptionPoints.Count * 120;
        }
예제 #2
0
        //[Fact]
        //public void VoucherIsOfSameTypeAsDetailAccounts()
        //{
        //    Assert.Equal(VoucherValidator.Validate(data.CurrentVoucher, data.CurrentVoucher.Details.ToArray(), data.Accounts.ToArray()), true);
        //}

        private static VoucherDetailsViewModel GetMockData()
        {
            VoucherDetailsViewModel vdvm = new VoucherDetailsViewModel
            {
                CurrentVoucher = new Voucher
                {
                    Date    = DateTime.Now.AddDays(-3),
                    Amount  = 40,
                    Text    = "Media Markt",
                    Paid    = true,
                    Expense = true
                },
                Accounts = GetAccounts()
            };

            vdvm.CurrentVoucher.Details = GetDetails(vdvm.CurrentVoucher.ID);
            return(vdvm);
        }
        public VoucherDetailsViewModel GetVoucherVM(int id)
        {
            VoucherDetailsViewModel result = new VoucherDetailsViewModel();

            if (id == 0)
            {
                result.CurrentVoucher = new Voucher();
            }
            else
            {
                result.CurrentVoucher = ctx.Vouchers.FirstOrDefault(f => f.ID == id);
                if (result.CurrentVoucher != null)
                {
                    result.Details = ctx.VoucherDetails.Where(f => f.VoucherID == id).ToList();
                    if (result.Details.Any())
                    {
                        result.EditDetail = result.Details[0];
                    }
                }
            }
            result.Accounts = ctx.BalanceAccounts.Where(f => f.Expense == result.CurrentVoucher.Expense).ToList();
            return(result);
        }
예제 #4
0
 public VouchersValidatorTests()
 {
     data = GetMockData();
 }