コード例 #1
0
ファイル: Test.cs プロジェクト: Mityaechka/ntsuSharp_7
        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");
            }
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: Mityaechka/ntsuSharp_7
        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);
        }
コード例 #3
0
ファイル: Test.cs プロジェクト: Mityaechka/ntsuSharp_7
        public static void TestWorkerHour()
        {
            WorkerHour Semyon = new WorkerHour("Semyon So", Sex.man, 1500, 2150, 150);

            Semyon.DoWork(140);
            if (Semyon.CalculateSalary() != 210000)
            {
                throw new Exception("WorkerHour.paymentCalculate wrong result with value <= edgeHours\n");
            }

            Semyon.DoWork(190);
            if (Semyon.CalculateSalary() != 311000)
            {
                throw new Exception("WorkerHour.paymentCalculate wrong result with value > edgeHours\n");
            }

            var semyonInfo = Semyon.getWorkerInfo();

            if (semyonInfo["fcs"] != "Semyon So")
            {
                throw new Exception("workerHourInfo[\"key\"] != \"keyvalue\"\n");
            }
        }