~halega/+junk/sharpdevelop

« back to all changes in this revision

Viewing changes to src/AddIns/Analysis/UnitTesting/Test/Utils/DerivedRunTestCommand.cs

  • Committer: sk
  • Date: 2011-09-10 05:17:57 UTC
  • Revision ID: halega@halega.com-20110910051757-qfouz1llya9m6boy
4.1.0.7915 Release Candidate 1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
 
2
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
 
3
 
 
4
using System;
 
5
using System.Collections.Generic;
 
6
using ICSharpCode.SharpDevelop.Gui;
 
7
using ICSharpCode.SharpDevelop.Project;
 
8
using ICSharpCode.UnitTesting;
 
9
 
 
10
namespace UnitTesting.Tests.Utils
 
11
{
 
12
        public class DerivedRunTestCommand : AbstractRunTestCommand
 
13
        {
 
14
                public bool IsOnBeforeBuildMethodCalled;
 
15
                public bool IsOnAfterRunTestsMethodCalled;
 
16
                public AbstractRunTestCommand RunningTestCommandPropertyWhenOnBeforeBuildCalled;
 
17
                public bool IsRunningTestWhenOnBeforeBuildCalled;
 
18
                public bool IsOnStopMethodCalled;
 
19
                public List<MockTestRunner> TestRunnersCreated = new List<MockTestRunner>();
 
20
                public int OnBeforeRunTestsMethodCallCount;
 
21
                
 
22
                public DerivedRunTestCommand(IRunTestCommandContext context)
 
23
                        : base(context)
 
24
                {
 
25
                }
 
26
 
 
27
                public void CallOnBeforeBuildMethod()
 
28
                {
 
29
                        OnBeforeBuild();
 
30
                }
 
31
                
 
32
                protected override void OnBeforeBuild()
 
33
                {
 
34
                        IsOnBeforeBuildMethodCalled = true;
 
35
                        RunningTestCommandPropertyWhenOnBeforeBuildCalled = AbstractRunTestCommand.RunningTestCommand;
 
36
                        IsRunningTestWhenOnBeforeBuildCalled = AbstractRunTestCommand.IsRunningTest;
 
37
                }
 
38
                
 
39
                protected override ITestRunner CreateTestRunner(IProject project)
 
40
                {
 
41
                        MockTestRunner testRunner = new MockTestRunner();
 
42
                        TestRunnersCreated.Add(testRunner);
 
43
                        return testRunner;
 
44
                }
 
45
                
 
46
                protected override void OnStop()
 
47
                {
 
48
                        IsOnStopMethodCalled = true;
 
49
                }
 
50
                
 
51
                public Action<TestResult> ShowResultAction {
 
52
                        get { return ShowResult; }
 
53
                }
 
54
                
 
55
                public void CallTestsCompleted()
 
56
                {
 
57
                        base.TestRunCompleted();
 
58
                }
 
59
 
 
60
                public void CallOnAfterRunTestsMethod()
 
61
                {
 
62
                        OnAfterRunTests();
 
63
                }
 
64
                
 
65
                protected override void OnAfterRunTests()
 
66
                {
 
67
                        IsOnAfterRunTestsMethodCalled = true;
 
68
                }
 
69
                
 
70
                public ITestRunner CallCreateTestRunner(IProject project)
 
71
                {
 
72
                        return CreateTestRunner(project);
 
73
                }
 
74
                
 
75
                protected override void OnBeforeRunTests()
 
76
                {
 
77
                        OnBeforeRunTestsMethodCallCount++;
 
78
                }
 
79
        }
 
80
}