public void TestDollarEquals()
        {
            var dollar1 = Dollars.Parse("5.00");
            var dollar2 = Dollars.Parse("5.00");

            Assert.IsTrue(dollar1.Equals(dollar2));
        }
        public void TestMultiplicationInt()
        {
            var tenDollars = Dollars.Parse("10.00");
            var twoFifty   = Dollars.Parse("2.50");

            Assert.AreEqual(tenDollars, twoFifty * 4);
        }
        public void TestMultiplicationDecimal()
        {
            var tenDollars = Dollars.Parse("10.00");
            var twoFifty   = Dollars.Parse("2.50");

            Assert.AreEqual(twoFifty, tenDollars * 0.25m);
        }
Exemple #4
0
        public bool add()
        {
            var dollarRate  = Dollars.Parse(rate);
            var newEmployee = new Employee(id, name, payType, dollarRate);

            payroll.AddEmployee(newEmployee);
            return(true);
        }
        public void TestDollarGreaterThan()
        {
            var dollar1 = Dollars.Parse("1.00");
            var dollar2 = Dollars.Parse("2.00");

            Assert.IsTrue(dollar2 > dollar1);
            Assert.IsFalse(dollar1 > dollar2);
        }
        public void PlusEqualsTest()
        {
            var dollar1 = Dollars.Parse("1.00");
            var dollar2 = Dollars.Parse("2.00");


            dollar2 += dollar1;
            Assert.AreEqual("3.00", dollar2.ToCleanString());
        }
        public void TestAddition()
        {
            var fiveDollars  = Dollars.Parse("5.00");
            var twoDollars   = Dollars.Parse("2.00");
            var threeDollars = Dollars.Parse("3.00");
            var result       = threeDollars + twoDollars;

            Assert.AreEqual("5.00", result.ToCleanString());
            Assert.AreEqual(fiveDollars, result);
        }
        public void SalaryTest()
        {
            Payroll  payroll = new Payroll();
            Dollars  payrate = Dollars.Parse("4000.00");
            Employee carl    = new Employee("1", "Carl", "Salary", payrate);

            payroll.AddEmployee(carl);

            var payDate = "01/31/2017";

            payroll.Pay(payDate);
            var payment = carl.GetPayment(payDate);

            Assert.AreEqual("1", carl.GetId());
            Assert.AreEqual("3,000.00", payment.GetNetPay().ToCleanString());
            Assert.AreEqual(1, payroll.PayCount());
            Assert.AreEqual("Carl", payroll.GetEmployee("1").GetName());
        }
        public void TestDollarParse()
        {
            var dollars = Dollars.Parse("5.00");

            Assert.AreEqual("5.00", dollars.ToCleanString());
        }