private static void CommandDependenciesCommon(Logger logger, Command command1, Command command2, ResultStatus expectedStatus1, ResultStatus expectedStatus2, bool cancelled = false) { var builder = Utils.CreateBuilder(false); var step2 = builder.Root.Add(command2); var step1 = builder.Root.Add(command1); BuildStep.LinkBuildSteps(step1, step2); if (cancelled) { var cancelThread = new Thread(() => { Thread.Sleep(1000); logger.Warning("Cancelling build!"); builder.CancelBuild(); }); cancelThread.Start(); } builder.Run(Builder.Mode.Build); Assert.That(step1.Status, Is.EqualTo(expectedStatus1)); Assert.That(step2.Status, Is.EqualTo(expectedStatus2)); }