Esempio n. 1
0
 public async Task ShouldPostTaxYearlyThrowsTaxesManagerException()
 {
     var service = new TaxCommand(_context);
     await Assert.ThrowsAsync <TaxesManagerException>(() =>
                                                      service.PostTaxYearly(new TaxDto {
         Municipality = "Vilnius", TaxAmount = 8
     }));
 }
Esempio n. 2
0
        public async Task ShouldPostTaxYearly()
        {
            var service = new TaxCommand(_context);
            var result  = await service.PostTaxYearly(new TaxDto { Municipality = "Vilnius", TaxAmount = 0.15 });

            Assert.Equal("Vilnius", result.Municipality);
            Assert.Equal(0.15, result.TaxAmount);
            Assert.Equal(Frequency.Yearly, result.Frequency);
        }
Esempio n. 3
0
        public ResultModel MainCalculate(TaxCommand command)
        {
            decimal annualIncome   = command.AnnaulIncome;
            bool    workThai       = command.WorkThai;
            bool    statusStayThai = command.StatusStayThai; //"true" is Stay in thai less than 180 day in that year

            if (InspectTaxPayer(annualIncome, workThai, statusStayThai))
            {
                return(new ResultModel()
                {
                    Success = false,
                    Message = "No Tex Filing"
                });
            }
            MainValueModel mainValue = new MainValueModel()
            {
                AnnaulIncome = annualIncome
            };

            decimal       providentFund  = command.ProvidentFund;
            decimal       govermentFund  = command.GovermentFund;
            decimal       teacherAidFund = command.TeacherAidFund;
            bool          isDisabled     = command.IsDisabled;
            bool          isElderly      = command.IsElderly;
            decimal       unemployFee    = command.UnemployFee;
            ExceptCommand exceptCommand  = new ExceptCommand()
            {
                AnnaulIncome   = annualIncome,
                ProvidentFund  = providentFund,
                GovermentFund  = govermentFund,
                TeacherAidFund = teacherAidFund,
                IsDisabled     = isDisabled,
                IsElderly      = isElderly,
                UnemployFee    = unemployFee,
            };
            var exceptResult = _exceptIncome.MainCalculate(exceptCommand);

            mainValue.ExceptValue = exceptResult.ExceptValue;

            decimal incomeDifExcept = annualIncome - exceptResult.ExceptValue;

            mainValue.IncomeDifExcept = incomeDifExcept;

            decimal expensesAllo = Expenses(incomeDifExcept);

            mainValue.ExpensesAllo = expensesAllo;

            decimal incomeDifExpenses = incomeDifExcept - expensesAllo;

            mainValue.IncomeDifExpenses = incomeDifExpenses;

            decimal checkFund = exceptResult.CheckFund;

            throw new NotImplementedException();
        }
Esempio n. 4
0
        public async Task ShouldUpdateTax()
        {
            var service = new TaxCommand(_context);
            var tax1    = await service.PostTaxYearly(new TaxDto { Municipality = "Vilnius", TaxAmount = 0.1 });

            var tax2 = await service.PutTax("Vilnius", DateTime.Parse("2020-01-01"), DateTime.Parse("2020-12-31"), 0.2);

            var tax3 = await service.GetTax("Vilnius", DateTime.Parse("2020-01-01"), DateTime.Parse("2020-12-31"));

            Assert.Equal(0.2, tax3.TaxAmount);
        }
Esempio n. 5
0
        public async Task ShouldGetTaxAmountDaily()
        {
            var service = new TaxCommand(_context);
            var tax1    = await service.PostTaxYearly(new TaxDto { Municipality = "Vilnius", TaxAmount = 0.1 });

            var tax2 = await service.PostTaxMonthly(new TaxDto { Municipality = "Vilnius", TaxAmount = 0.3, Month = 9 });

            var tax3 = await service.PostTaxDaily(new TaxDto { Municipality = "Vilnius", TaxAmount = 0.5, Month = 9, Day = 14 });

            var tax = await service.GetTaxAmount("Vilnius", "2020-09-14");

            Assert.Equal(0.5, tax.TaxAmount);
        }