예제 #1
0
        public void TaxCalculateTaxTest()
        {
            Tax tax = new Tax(0.1M, new RoundingStub());

            decimal taxVal = tax.CalculateTax(10M);

            Assert.AreEqual(1M, taxVal);
        }
        public void TestFloridaTaxCalculation()
        {
            // Whilst this test allows us to test the Tax class, since the tax rates are hardcoded in the class, any changes will cause this test to fail

            Tax t = new Tax();

            decimal tax = t.CalculateTax("FL", 5.63m);

            Assert.AreEqual(0.5067m, tax);
        }
예제 #3
0
        public IActionResult AddRecord(TaxAddViewModel input)
        {
            SQLTaxData sqlData = new SQLTaxData(_context);

            if (ModelState.IsValid)
            {
                Tax tax = new Tax();
                tax.PersonName   = input.PersonName;
                tax.AnnualIncome = input.AnnualIncome;
                tax.PostalCode   = input.PostalCode;
                tax.RecordDate   = DateTime.Now;
                tax.CalculateTax();

                sqlData.Add(tax);
            }
            return(new RedirectResult("/"));
        }