public void GetTasksIDsTest() { CodeGeneratorWrapper testCodeGeneratorWrapper = new CodeGeneratorWrapper(); string codeSource = "for(int i=0;i<10;i++){Thread.Sleep(1000);}"; testCodeGeneratorWrapper.UseNamespace("System.Threading", "System.Threading.dll"); testCodeGeneratorWrapper.ExecuteCode(codeSource); testCodeGeneratorWrapper.ExecuteCode(codeSource); testCodeGeneratorWrapper.ExecuteCode(codeSource); Assert.AreEqual(3, testCodeGeneratorWrapper.GetTasksIDs().Length); }
public void ExecuteCodeTest() { CodeGeneratorWrapper testCodeGeneratorWrapper = new CodeGeneratorWrapper(); for (int i = 0; i < 25; i++) { string codeSource = "for(int i=0;i<10;i++){Thread.Sleep(100);}"; testCodeGeneratorWrapper.ExecuteCode(codeSource); testCodeGeneratorWrapper.ExecuteCode(codeSource); codeSource = "for(int i=0;i<100000;i++){Thread.Sleep(1000);}"; int id = testCodeGeneratorWrapper.ExecuteCode(codeSource); testCodeGeneratorWrapper.CancelCodeExecutionTask(id); Thread.Sleep(5000); } Thread.Sleep(5000); Assert.AreEqual(0, testCodeGeneratorWrapper.GetTasksIDs().Length); }