1
- using Microsoft . Office . Core ;
1
+ using System . Diagnostics ;
2
+ using System . Drawing ;
3
+ using System . Runtime . InteropServices ;
4
+ using System . Windows . Forms ;
5
+ using Microsoft . Office . Core ;
2
6
using Microsoft . Vbe . Interop ;
7
+ using Rubberduck . Properties ;
8
+ using Rubberduck . UnitTesting ;
3
9
using CommandBarButtonClickEvent = Microsoft . Office . Core . _CommandBarButtonEvents_ClickEventHandler ;
4
10
5
11
namespace Rubberduck . UI . UnitTesting
@@ -19,22 +25,33 @@ public TestMenu(VBE vbe, AddIn addIn, TestExplorerWindow view, TestExplorerDocka
19
25
_presenter = presenter ;
20
26
}
21
27
28
+ private CommandBarButton _runAllTestsButton ;
29
+ private CommandBarButton _windowsTestExplorerButton ;
30
+
22
31
public void Initialize ( CommandBarControls menuControls )
23
32
{
24
- var menu = menuControls . Add ( MsoControlType . msoControlButton , Temporary : true ) as CommandBarButton ;
25
- menu . Caption = "&Test Explorer" ;
26
- menu . Click += OnTestExplorerButtonClick ;
33
+ var menu = menuControls . Add ( MsoControlType . msoControlPopup , Temporary : true ) as CommandBarPopup ;
34
+ menu . Caption = "Te&st" ;
35
+
36
+ _windowsTestExplorerButton = AddButton ( menu , "&Test Explorer" , false , new CommandBarButtonClickEvent ( OnTestExplorerButtonClick ) , Resources . TestManager_8590_32 ) ;
37
+ _runAllTestsButton = AddButton ( menu , "&Run All Tests" , true , new CommandBarButtonClickEvent ( OnRunAllTestsButtonClick ) , Resources . AllLoadedTests_8644_24 ) ;
38
+ }
39
+
40
+ void OnRunAllTestsButtonClick ( CommandBarButton Ctrl , ref bool CancelDefault )
41
+ {
42
+ _presenter . Show ( ) ;
43
+ _presenter . RunTests ( ) ;
27
44
}
28
45
29
- private void OnTestExplorerButtonClick ( CommandBarButton Ctrl , ref bool CancelDefault )
46
+ void OnTestExplorerButtonClick ( CommandBarButton Ctrl , ref bool CancelDefault )
30
47
{
31
48
_presenter . Show ( ) ;
32
49
}
33
50
34
- private bool _disposed ;
51
+ bool disposed = false ;
35
52
protected override void Dispose ( bool disposing )
36
53
{
37
- if ( _disposed )
54
+ if ( disposed )
38
55
{
39
56
return ;
40
57
}
@@ -52,7 +69,7 @@ protected override void Dispose(bool disposing)
52
69
}
53
70
}
54
71
55
- _disposed = true ;
72
+ disposed = true ;
56
73
base . Dispose ( disposing ) ;
57
74
}
58
75
}
0 commit comments