// // // // // $Revision$ // using System; using System.Collections.Generic; using ICSharpCode.SharpDevelop.Gui; using ICSharpCode.SharpDevelop.Project; using ICSharpCode.UnitTesting; namespace UnitTesting.Tests.Utils { public class DerivedRunTestCommand : AbstractRunTestCommand { bool onBeforeBuildMethodCalled; bool onAfterRunTestsMethodCalled; AbstractRunTestCommand runningTestCommandWhenOnBeforeBuildCalled; bool runningTestWhenOnBeforeBuildCalled; bool onStopMethodCalled; List helpers = new List(); List testRunnersCreated = new List(); public DerivedRunTestCommand(IRunTestCommandContext context) : base(context) { } public bool IsOnBeforeBuildMethodCalled { get { return onBeforeBuildMethodCalled; } } public void CallOnBeforeBuildMethod() { OnBeforeBuild(); } protected override void OnBeforeBuild() { onBeforeBuildMethodCalled = true; runningTestCommandWhenOnBeforeBuildCalled = AbstractRunTestCommand.RunningTestCommand; runningTestWhenOnBeforeBuildCalled = AbstractRunTestCommand.IsRunningTest; } protected override ITestRunner CreateTestRunner(IProject project) { MockTestRunner testRunner = new MockTestRunner(); testRunnersCreated.Add(testRunner); return testRunner; } public List TestRunnersCreated { get { return testRunnersCreated; } } protected override void RunTests(NUnitConsoleApplication helper) { helpers.Add(helper); } public List Helpers { get { return helpers; } } public AbstractRunTestCommand RunningTestCommandPropertyWhenOnBeforeBuildCalled { get { return runningTestCommandWhenOnBeforeBuildCalled; } } public bool IsRunningTestPropertyWhenOnBeforeBuildCalled { get { return runningTestWhenOnBeforeBuildCalled; } } public bool IsOnStopMethodCalled { get { return onStopMethodCalled; } } protected override void OnStop() { onStopMethodCalled = true; } public Action ShowResultAction { get { return ShowResult; } } public void CallTestsCompleted() { base.TestRunCompleted(); } public bool IsOnAfterRunTestsMethodCalled { get { return onAfterRunTestsMethodCalled; } } public void CallOnAfterRunTestsMethod() { OnAfterRunTests(); } protected override void OnAfterRunTests() { onAfterRunTestsMethodCalled = true; } public ITestRunner CallCreateTestRunner(IProject project) { return CreateTestRunner(project); } } }