本文整理汇总了C#中TestTask.Run方法的典型用法代码示例。如果您正苦于以下问题:C# TestTask.Run方法的具体用法?C# TestTask.Run怎么用?C# TestTask.Run使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TestTask
的用法示例。
在下文中一共展示了TestTask.Run方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RunMinute
public void RunMinute()
{
var now = DateTime.UtcNow;
var tt = new TestTask((byte)now.Hour, (sbyte)now.Minute);
tt.Run();
Assert.IsTrue(tt.Called);
}
示例2: RunWithFalseResultMarksStatusAsFailed
public void RunWithFalseResultMarksStatusAsFailed()
{
var task = new TestTask
{
Result = () => false
};
var result = mocks.DynamicMock<IIntegrationResult>();
mocks.ReplayAll();
task.Run(result);
mocks.VerifyAll();
Assert.IsTrue(task.Executed);
Assert.AreEqual(ItemBuildStatus.CompletedFailed, task.CurrentStatus.Status);
}
示例3: Execute_should_call_wait_for_exit_before_ExitCode
public void Execute_should_call_wait_for_exit_before_ExitCode()
{
//Since mono is broken and won't give us the ExitCode otherwise.
var process = new ProcessStub();
var waitForExitCalled = false;
process.WaitForExitHandler = () => waitForExitCalled = true;
process.GetExitCodeHandler = () =>
{
Assert.IsTrue(waitForExitCalled);
return 0;
};
var platform = new ExecutionEnvironmentStub();
var fileSystem = new InMemoryFileSystem();
platform.RunHandler = (program, args, handler) => handler(process);
var task = new TestTask(fileSystem, platform);
task.Run();
}
示例4: RunWrongMinute
public void RunWrongMinute()
{
var now = DateTime.UtcNow;
var minute = now.Minute > 1 ? now.Minute - 1 : 2;
var tt = new TestTask((byte)now.Hour, (sbyte)minute);
tt.Run();
Assert.IsFalse(tt.Called);
}
示例5: RunWrongHour
public void RunWrongHour()
{
var now = DateTime.UtcNow;
var hour = now.Hour > 1 ? now.Hour - 1 : 2;
var tt = new TestTask((byte)hour);
tt.Run();
Assert.IsFalse(tt.Called);
}
示例6: ApplyParametersStoresTheArguments
public void ApplyParametersStoresTheArguments()
{
var parameters = new Dictionary<string, string>();
var definitions = new List<ParameterBase>();
var subTask = new MockTask();
var task = new TestTask
{
Tasks = new ITask[]
{
subTask
}
};
var result = mocks.DynamicMock<IIntegrationResult>();
mocks.ReplayAll();
task.ApplyParameters(parameters, definitions);
task.Run(result);
mocks.VerifyAll();
Assert.AreSame(parameters, subTask.Parameters);
Assert.AreSame(definitions, subTask.Definitions);
Assert.IsTrue(subTask.Executed);
}
示例7: RunWithExceptionMarksStatusAsFailed
public void RunWithExceptionMarksStatusAsFailed()
{
var task = new TestTask
{
Result = () =>
{
throw new CruiseControlException();
}
};
var result = mocks.DynamicMock<IIntegrationResult>();
mocks.ReplayAll();
// This may look like a weird test, but we don't care that Run() has an exception
try
{
task.Run(result);
}
catch (Exception) { }
mocks.VerifyAll();
Assert.IsTrue(task.Executed);
Assert.AreEqual(ItemBuildStatus.CompletedFailed, task.CurrentStatus.Status);
}