예제 #1
0
        static void Main(string[] args)
        {
            try
            {
                Test.TestWorkerComission();
                Test.TestWorkerHour();
                Test.TestFactory();
            }
            catch (Exception e)
            {
                Console.WriteLine("Some Test was not passed\nTest LOG:\n");
                Console.WriteLine(e.Message);
            }

            Console.WriteLine("All tests was passed successfully\n\n\n");

            WorkerComission Pyotr  = new WorkerComission("Pytor Solo", Sex.woman, 10000, 0.05);
            WorkerHour      Semyon = new WorkerHour("Semyon So", Sex.man, 1500, 2150, 150);

            Factory Jojo = new Factory("Jojo INC.", "Anime");

            Jojo.RecruitMemberStaff(Pyotr);
            Jojo.RecruitMemberStaff(Semyon);

            Jojo.SimulateWork(32);
        }
예제 #2
0
        public static void TestFactory()
        {
            WorkerComission Pyotr  = new WorkerComission("Pytor Solo", Sex.woman, 10000, 0.05);
            WorkerHour      Semyon = new WorkerHour("Semyon So", Sex.man, 1500, 2150, 150);

            Factory Jojo = new Factory("Jojo INC.", "Anime");

            Jojo.RecruitMemberStaff(Pyotr);
            Jojo.RecruitMemberStaff(Semyon);

            if (Jojo.WorkersQuantity() != 2)
            {
                throw new Exception("Jojo.WorkersQuantity wrong value;\n");
            }

            var pytorInfo = Jojo.WorkerInfo("Pytor Solo");

            if (pytorInfo["fcs"] != "Pytor Solo")
            {
                throw new Exception("workerInfo[\"key\"] != \"keyvalue\";\n");
            }

            Jojo.DismissMemberStaff("Pytor Solo");
            pytorInfo = Jojo.WorkerInfo("Pytor Solo");

            if (pytorInfo != null)
            {
                throw new Exception("Factory.DismissMemberStaff(\"workerName\");\n");
            }
        }
예제 #3
0
        public static void TestWorkerComission()
        {
            WorkerComission Pyotr = new WorkerComission("Pytor Solo", Sex.woman, 10000, 0.05);

            Pyotr.DoWork(15000u);

            if (Pyotr.CalculateSalary() != 85000)
            {
                throw new Exception("WorkerComission.CalculatePayment wrong result\n");
            }

            if (Pyotr.getClassType() != "WorkerComission")
            {
                throw new Exception("WorkerComission.GetClassType wrong result;\n");
            }

            var pyotrInfo = Pyotr.getWorkerInfo();

            if (pyotrInfo["fcs"] != "Pytor Solo")
            {
                throw new Exception("WorkerComissionInfo[\"key\"] != \"keyvalue\"\n");
            }
        }