コード例 #1
0
        public void CountWorkersExpenseTest()
        {
            //Przygotowanie
            GameParams g  = new GameParams();
            Functions  f  = new Functions();
            Round      r1 = new Round()
            {
                DwarfWorkers = 1, DwarfWorkersDismissed = 1, DwarfWorkersEmployed = 1
            };
            Round r2 = new Round()
            {
                ElfWorkers = 1, ElfWorkersDismissed = 1, ElfWorkersEmployed = 1
            };
            Round r3 = new Round()
            {
                HumanWorkers = 1, HumanWorkersDismissed = 1, HumanWorkersEmployed = 1
            };
            double d1 = 0, d2 = 0, d3 = 0;

            //Działanie
            d1 = f.CountWorkersExpense(r1);
            d2 = f.CountWorkersExpense(r2);
            d3 = f.CountWorkersExpense(r3);
            //Sprawdzenie
            Assert.AreEqual(d1, g.WorkerDwarfPrice * g.HoursPerPeriod + g.DismissalPrice + g.EmploymentPrice);
            Assert.AreEqual(d2, g.WorkerElfPrice * g.HoursPerPeriod + g.DismissalPrice + g.EmploymentPrice);
            Assert.AreEqual(d3, g.WorkerHumanPrice * g.HoursPerPeriod + g.DismissalPrice + g.EmploymentPrice);
        }