Пример #1
0
        public void TestCalculateTodayIsThursday()
        {
            DateTime nextThursday = DateTime.Now;

            for (var i = 1; i < 8; i++)
            {
                if (nextThursday.DayOfWeek == DayOfWeek.Thursday)
                {
                    return;
                }

                nextThursday = nextThursday.AddDays(i);
            }

            Tax tax = new Tax(new ErehwonCitizen
            {
                BirthDate = DateTime.Parse("1999-04-30"),
                FirstName = "Test",
                LastName  = "Person"
            }, nextThursday);

            //Act
            decimal taxAmount = tax.Calculate(100);

            //Assert
            Assert.AreEqual(16m, taxAmount);
        }
Пример #2
0
        public void SingleTaxesTest(decimal amount, decimal expectedTaxes)
        {
            Tax tax = new Tax(new SingleTax(), TaxSituation.Single);

            decimal t = tax.Calculate(amount);

            Assert.True(decimal.Compare(t, expectedTaxes) == 0);
        }
Пример #3
0
        public void HHTaxesTest(decimal amount, decimal expectedTaxes)
        {
            Tax tax = new Tax(new HHTax(), TaxSituation.HeadofHousehold);

            decimal t = tax.Calculate(amount);

            Assert.True(decimal.Compare(t, expectedTaxes) == 0);
        }
Пример #4
0
        public void MFJOrQWTaxTest(decimal amount, decimal expectedTaxes)
        {
            Tax tax = new Tax(new MFJOrQWTax(), TaxSituation.MarriedfilingJointlyorQualifyingWidow);

            decimal t = tax.Calculate(amount);

            Assert.True(decimal.Compare(t, expectedTaxes) == 0);
        }
Пример #5
0
        public void MFSTaxTest(decimal amount, decimal expectedTaxes)
        {
            Tax tax = new Tax(new MFSTax(), TaxSituation.MarriedFilingSeparately);

            decimal t = tax.Calculate(amount);

            Assert.True(decimal.Compare(t, expectedTaxes) == 0);
        }
        public decimal CheckOut()
        {
            decimal totalWithoutTax = cart.TotalPrice();
            Tax     tax             = new Tax();
            decimal taxAmt          = tax.Calculate(totalWithoutTax, this);

            return(taxAmt + totalWithoutTax);
        }
Пример #7
0
 public void TestIfThursday()
 {
     //arrange
     Person peep = PersonMaker("Wayne", "Bradey", 33);
     Tax tax = new Tax();
     decimal amountToTax = 10.00m;
     //act
     decimal result = tax.Calculate(peep, amountToTax);
     //assert
     Assert.AreEqual(0.80m, result);
 }
Пример #8
0
 public void FirstNameTest()
 {
     //arrange
     Person peep = PersonMaker("james", "Rick", 33);
     Tax tax = new Tax();
     decimal amountToTax = 10.00m;
     //act
     decimal result = tax.Calculate(peep, amountToTax);
     //assert
     Assert.AreEqual(1.60m, result);
 }
Пример #9
0
        public void TestIfThursday()
        {
            //arrange
            Person  peep        = PersonMaker("Wayne", "Bradey", 33);
            Tax     tax         = new Tax();
            decimal amountToTax = 10.00m;
            //act
            decimal result = tax.Calculate(peep, amountToTax);

            //assert
            Assert.AreEqual(0.80m, result);
        }
Пример #10
0
        public void FirstNameTest()
        {
            //arrange
            Person  peep        = PersonMaker("james", "Rick", 33);
            Tax     tax         = new Tax();
            decimal amountToTax = 10.00m;
            //act
            decimal result = tax.Calculate(peep, amountToTax);

            //assert
            Assert.AreEqual(1.60m, result);
        }
Пример #11
0
        public void TestCalculate2()
        {
            //Arrange
            Citizen jimmy        = new Citizen("James", "Walters", Convert.ToDateTime("01/05/2014"));
            Tax     ErehwonTaxes = new Tax();
            decimal price        = 1.00m;

            //Act
            decimal total = ErehwonTaxes.Calculate(jimmy, price);

            //Assert
            Assert.AreEqual(1m, total);
        }
Пример #12
0
        public void TestCalculate1()
        {
            //Arrange
            Citizen billy        = new Citizen("Bill", "McMurray", Convert.ToDateTime("01/05/1990"));
            Tax     ErehwonTaxes = new Tax();
            decimal price        = 100.00m;

            //Act
            decimal total = ErehwonTaxes.Calculate(billy, price);

            //Assert
            Assert.AreEqual(108.00m, total);
        }
Пример #13
0
        public void AgeLessThanFive()
        {
            //arrange
            Person peep = PersonMaker("billy", "bob", 6);
            Tax tax = new Tax();
            decimal amountToTax = 100.00m;

            //act
            decimal result = tax.Calculate(peep, amountToTax);

            //assert
            Assert.AreEqual(0, result);
        }
Пример #14
0
        public void AgeLessThanFive()
        {
            //arrange
            Person  peep        = PersonMaker("billy", "bob", 6);
            Tax     tax         = new Tax();
            decimal amountToTax = 100.00m;


            //act
            decimal result = tax.Calculate(peep, amountToTax);


            //assert
            Assert.AreEqual(0, result);
        }
Пример #15
0
        public void TestCalculateAgeLessFive()
        {
            //Arrange
            Tax tax = new Tax(new ErehwonCitizen
            {
                BirthDate = DateTime.Parse("2010-06-01"),
                FirstName = "Test",
                LastName = "Person"
            });
            //Act
            decimal taxAmount = tax.Calculate(100);

            //Assert
            Assert.AreEqual(0, taxAmount);
        }
Пример #16
0
        public void TestCalculateAgeLessFive()
        {
            //Arrange
            Tax tax = new Tax(new ErehwonCitizen
            {
                BirthDate = DateTime.Parse("2010-06-01"),
                FirstName = "Test",
                LastName  = "Person"
            });
            //Act
            decimal taxAmount = tax.Calculate(100);

            //Assert
            Assert.AreEqual(0, taxAmount);
        }
Пример #17
0
        public void TestCalculateTodayIsThursday()
        {
            DateTime thursday = DateTime.Now;
            for (int i = 1; i < 8; i++)
            {
                if (thursday.DayOfWeek == DayOfWeek.Tuesday)
                    return;

                thursday = thursday.AddDays(1);
            }

            Tax tax = new Tax(thursday);

            decimal result = tax.Calculate(100, DateTime.Parse("1998-05-18"), "John", "doe");

            Assert.AreEqual(32, result);
        }
Пример #18
0
        public void TestCalculateTodayIsThursday()
        {
            DateTime thursday = DateTime.Now;

            for (int i = 1; i < 8; i++)
            {
                if (thursday.DayOfWeek == DayOfWeek.Tuesday)
                {
                    return;
                }

                thursday = thursday.AddDays(1);
            }

            Tax tax = new Tax(thursday);

            decimal result = tax.Calculate(100, DateTime.Parse("1998-05-18"), "John", "doe");

            Assert.AreEqual(32, result);
        }
Пример #19
0
        public void TestCalculateTodayIsThursday()
        {
            DateTime nextThursday = DateTime.Now;
            for (var i = 1; i < 8; i++)
            {
                if (nextThursday.DayOfWeek == DayOfWeek.Thursday)
                    return;

                nextThursday = nextThursday.AddDays(i);
            }

            Tax tax = new Tax(new ErehwonCitizen
            {
                BirthDate = DateTime.Parse("1999-04-30"),
                FirstName = "Test",
                LastName = "Person"
            }, nextThursday);

            //Act
            decimal taxAmount = tax.Calculate(100);

            //Assert
            Assert.AreEqual(16m, taxAmount);
        }
Пример #20
0
        public void TestCalculate2()
        {
            //Arrange
            Citizen jimmy = new Citizen("James", "Walters", Convert.ToDateTime("01/05/2014"));
            Tax ErehwonTaxes = new Tax();
            decimal price = 1.00m;

            //Act
            decimal total = ErehwonTaxes.Calculate(jimmy, price);

            //Assert
            Assert.AreEqual(1m, total);
        }
Пример #21
0
 public decimal IncomeTax()
 {
     return(Tax.Calculate(GrossIncome(), Brackets.Table()[workState]));
 }
Пример #22
0
        public void TestCalculate1()
        {
            //Arrange
            Citizen billy = new Citizen("Bill", "McMurray", Convert.ToDateTime("01/05/1990"));
            Tax ErehwonTaxes = new Tax();
            decimal price = 100.00m;

            //Act
            decimal total = ErehwonTaxes.Calculate(billy, price);

            //Assert
            Assert.AreEqual(108.00m, total);
        }