public void Executes_the_task_when_run_inside_a_TeamCity_build(TeamCityTask task) { task.ForceTaskExecution = false; using (Mocks.Record()) { SetupResult.For(task.BuildEnvironment.IsTeamCityBuild).Return(true); task.Log(Level.Verbose, null); LastCall.Constraints(Is.Equal(Level.Verbose), Text.Contains("Skipping task execution")).Repeat.Never(); task.Log(Level.Verbose, null); LastCall.Constraints(Is.Anything(), Is.Anything()).Repeat.Any(); } using (Mocks.Playback()) { Reflector.InvokeMethod(task, "ExecuteTask"); } }
public void Skips_task_execution_when_run_outside_of_TeamCity(TeamCityTask task) { task.ForceTaskExecution = false; using (Mocks.Record()) { SetupResult.For(task.BuildEnvironment.IsTeamCityBuild).Return(false); task.Log(Level.Verbose, null); LastCall.Constraints(Is.Equal(Level.Verbose), Text.Contains("Skipping task execution")); } using (Mocks.Playback()) { Reflector.InvokeMethod(task, "ExecuteTask"); } }