示例#1
0
        public void NegativeEarnBaseComTest()
        {
            BasePlusCommissionEmployee bCS = new BasePlusCommissionEmployee
                                                 ("John", "Doe", "123", 500, 0.5m, 1000m);

            Assert.AreNotEqual(1500, bCS.Earnings());
        }
示例#2
0
        public void Earnings2Test()
        {
            BasePlusCommissionEmployee bCS = new BasePlusCommissionEmployee
                                                 ("John", "Doe", "123", 500, 0.5m, 1000m);

            Assert.AreEqual(1250, bCS.Earnings());
        }
示例#3
0
        public void BaseSalaryTest()
        {
            BasePlusCommissionEmployee bS =
                new BasePlusCommissionEmployee("John", "Doe", "123", 100, 0.5m, 1000m);

            Assert.AreEqual(1000, bS.BaseSalary);
        }
示例#4
0
        public void BaseCommToString()
        {
            BasePlusCommissionEmployee bCTS = new BasePlusCommissionEmployee
                                                  ("John", "Doe", "123", 500, 0.5m, 1000m);
            string stringCompare = "base-salaried commission employee: John Doe\n" +
                                   "social security number: 123\ngross sales: $500.00\n" +
                                   "commission rate: 0.50\nbase salary: $1,000.00";

            Assert.AreEqual(stringCompare, bCTS.ToString());
        }
示例#5
0
        public void BaseSalaryExceptionTest()
        {
            BasePlusCommissionEmployee bS =
                new BasePlusCommissionEmployee("John", "Doe", "123", 100, 0.5m, 1000m);

            Assert.AreEqual(1000, bS.BaseSalary);

            BasePlusCommissionEmployee bS2 =
                new BasePlusCommissionEmployee("John", "Doe", "123", 100, 0.5m, 1000m);

            Assert.AreNotEqual(100, bS2.BaseSalary);

            try
            {
                BasePlusCommissionEmployee bS3 =
                    new BasePlusCommissionEmployee("John", "Doe", "123", 100, 0.5m, -1000m);
            }
            catch (System.ArgumentOutOfRangeException)
            { }
            finally
            {
                Console.WriteLine("out of range");
            }
        }