Beispiel #1
0
        public void GivenLuaJobWithJob__WhenCallingAddTask__ContainedJobShouldHaveTask()
        {
            JobStub   jobStub   = new JobStub();
            TaskDummy taskDummy = new TaskDummy();

            LuaJob      sut         = new LuaJob(jobStub);
            LuaTaskStub luaTaskStub = new LuaTaskStub {
                Task = taskDummy
            };

            sut.add_task(luaTaskStub);

            CollectionAssert.Contains(jobStub.Tasks, taskDummy);
        }
Beispiel #2
0
        public void GivenLuaJobWithJob__WhenCallingAddTasks__ContainedJobShouldHaveAllTasks()
        {
            using NLua.Lua luaInterpreter = new NLua.Lua();

            TaskDummy firstTaskDummy  = new TaskDummy();
            TaskDummy secondTaskDummy = new TaskDummy();

            LuaTable taskTable = MakeLuaTable(luaInterpreter, "taskTable");

            taskTable[1] = new LuaTaskStub {
                Task = firstTaskDummy
            };
            taskTable[2] = new LuaTaskStub {
                Task = secondTaskDummy
            };

            JobStub jobStub = new JobStub();
            LuaJob  sut     = new LuaJob(jobStub);

            sut.add_tasks(taskTable);

            ITask[] expectedTasks = { firstTaskDummy, secondTaskDummy };
            CollectionAssert.AreEqual(expectedTasks, jobStub.Tasks);
        }