Пример #1
0
        public void grossSaleOutOfRangeTest()
        {
            CommissionEmployee gS =
                new CommissionEmployee("John", "Doe", "123", 1, 0.5m);

            Assert.AreEqual(1, gS.GrossSales);

            CommissionEmployee gS2 =
                new CommissionEmployee("John", "Doe", "123", 0, 0.5m);

            Assert.AreNotEqual(1, gS2.GrossSales);

            try
            {
                CommissionEmployee gS3 =
                    new CommissionEmployee("John", "Doe", "123", -1, 0.5m);
            }
            catch (System.ArgumentOutOfRangeException)
            { }
            finally {
                Console.WriteLine("out of range");
            }
        }
Пример #2
0
        public void ExceptionCommissionRateTest()
        {
            CommissionEmployee cR =
                new CommissionEmployee("John", "Doe", "123", 100, 0.5m);

            Assert.AreEqual(0.5, cR.CommissionRate);

            CommissionEmployee cR2 =
                new CommissionEmployee("John", "Doe", "123", 100, 0.5m);

            Assert.AreNotEqual(0.6, cR2.CommissionRate);

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