Exemplo n.º 1
0
        public void GivenLuaJobWithJob__WhenCallingAddTasksWithNonTaskValue__ShouldThrowLuaScriptException()
        {
            using NLua.Lua luaInterpreter = new NLua.Lua();
            LuaTable invalidTable = MakeLuaTable(luaInterpreter, "invalidTable");

            invalidTable[1] = "Invalid";

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

            sut.add_tasks(invalidTable);
        }
Exemplo n.º 2
0
        public void GivenLuaProject__WhenAddingJob__ShouldReturnLuaJob()
        {
            JobStub jobStub = new JobStub();
            BuildComponentFactoryStub factoryStub = new BuildComponentFactoryStub
            {
                Project = new ProjectStub(),
                Job     = jobStub
            };

            LuaProject sut    = new LuaProject("TestProject", factoryStub);
            LuaJob     actual = sut.add_job("test-job");

            Assert.IsInstanceOfType(actual, typeof(LuaJob));
        }
Exemplo n.º 3
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);
        }
Exemplo n.º 4
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);
        }