1- // This file has been modified by Microsoft on 8 /2017.
1+ // This file has been modified by Microsoft on 9 /2017.
22
33using System ;
44using System . Collections . Generic ;
@@ -25,27 +25,6 @@ namespace GoogleTestAdapter
2525 public class GoogleTestDiscovererTests : TestsBase
2626 {
2727
28- [ TestMethod ]
29- [ TestCategory ( Unit ) ]
30- public void IsGoogleTestExecutable_MatchingExamples_AreMatched ( )
31- {
32- AssertIsGoogleTestExecutable ( "MyGoogleTests.exe" , true ) ;
33- AssertIsGoogleTestExecutable ( "MyGoogleTests.exe" , true ) ;
34- AssertIsGoogleTestExecutable ( "MyGoogleTest.exe" , true ) ;
35- AssertIsGoogleTestExecutable ( "mygoogletests.exe" , true ) ;
36- AssertIsGoogleTestExecutable ( "mygoogletest.exe" , true ) ;
37- }
38-
39- [ TestMethod ]
40- [ TestCategory ( Unit ) ]
41- public void IsGoogleTestExecutable_NotMatchingExamples_AreNotMatched ( )
42- {
43- AssertIsGoogleTestExecutable ( "MyGoogleTes.exe" , false ) ;
44- AssertIsGoogleTestExecutable ( "TotallyWrong.exe" , false ) ;
45- AssertIsGoogleTestExecutable ( "TestStuff.exe" , false ) ;
46- AssertIsGoogleTestExecutable ( "TestLibrary.exe" , false ) ;
47- }
48-
4928 [ TestMethod ]
5029 [ TestCategory ( Unit ) ]
5130 public void IsGoogleTestExecutable_WithRegexFromOptions_MatchesCorrectly ( )
@@ -59,7 +38,7 @@ public void IsGoogleTestExecutable_WithRegexFromOptions_MatchesCorrectly()
5938 [ TestCategory ( Unit ) ]
6039 public void IsGoogleTestExecutable_WithUnparsableRegexFromOptions_ProducesErrorMessage ( )
6140 {
62- bool result = new GoogleTestDiscoverer ( TestEnvironment . Logger , TestEnvironment . Options ) . IsGoogleTestExecutable ( "my.exe" , "d[ddd[" ) ;
41+ bool result = GoogleTestDiscoverer . IsGoogleTestExecutable ( "my.exe" , "d[ddd[" , TestEnvironment . Logger ) ;
6342
6443 result . Should ( ) . BeFalse ( ) ;
6544 MockLogger . Verify ( l => l . LogError ( It . Is < string > ( s => s . Contains ( "'d[ddd['" ) ) ) , Times . Exactly ( 1 ) ) ;
@@ -72,8 +51,8 @@ public void IsGoogleTestExecutable_WithIndicatorFile_IsRecognizedAsTestExecutabl
7251 string testExecutable = SetupIndicatorFileTest ( true ) ;
7352 try
7453 {
75- bool result = new GoogleTestDiscoverer ( TestEnvironment . Logger , TestEnvironment . Options )
76- . IsGoogleTestExecutable ( testExecutable ) ;
54+ bool result = GoogleTestDiscoverer
55+ . IsGoogleTestExecutable ( testExecutable , "" , TestEnvironment . Logger ) ;
7756
7857 result . Should ( ) . BeTrue ( ) ;
7958 }
@@ -86,15 +65,15 @@ public void IsGoogleTestExecutable_WithIndicatorFile_IsRecognizedAsTestExecutabl
8665
8766 [ TestMethod ]
8867 [ TestCategory ( Unit ) ]
89- public void IsGoogleTestExecutable_WithoutIndicatorFile_IsNotRecognizedAsTestExecutable ( )
68+ public void IsGoogleTestExecutable_WithoutIndicatorFile_IsRecognizedAsTestExecutable ( )
9069 {
9170 string testExecutable = SetupIndicatorFileTest ( false ) ;
9271 try
9372 {
94- bool result = new GoogleTestDiscoverer ( TestEnvironment . Logger , TestEnvironment . Options )
95- . IsGoogleTestExecutable ( testExecutable ) ;
73+ bool result = GoogleTestDiscoverer
74+ . IsGoogleTestExecutable ( testExecutable , "" , TestEnvironment . Logger ) ;
9675
97- result . Should ( ) . BeFalse ( ) ;
76+ result . Should ( ) . BeTrue ( ) ;
9877 }
9978 finally
10079 {
@@ -103,6 +82,26 @@ public void IsGoogleTestExecutable_WithoutIndicatorFile_IsNotRecognizedAsTestExe
10382 }
10483 }
10584
85+ [ TestMethod ]
86+ [ TestCategory ( Unit ) ]
87+ public void IsGoogleTestExecutable_DependingOnGtestDll_IsRecognizedAsTestExecutable ( )
88+ {
89+ bool result = GoogleTestDiscoverer
90+ . IsGoogleTestExecutable ( TestResources . FakeGtestDllExe , "" , TestEnvironment . Logger ) ;
91+
92+ result . Should ( ) . BeTrue ( ) ;
93+ }
94+
95+ [ TestMethod ]
96+ [ TestCategory ( Unit ) ]
97+ public void IsGoogleTestExecutable_DependingOnGtestDllX64_IsRecognizedAsTestExecutable ( )
98+ {
99+ bool result = GoogleTestDiscoverer
100+ . IsGoogleTestExecutable ( TestResources . FakeGtestDllExeX64 , "" , TestEnvironment . Logger ) ;
101+
102+ result . Should ( ) . BeTrue ( ) ;
103+ }
104+
106105 [ TestMethod ]
107106 [ TestCategory ( Integration ) ]
108107 public void GetTestsFromExecutable_SampleTestsDebug_FindsTestsWithLocation ( )
@@ -320,7 +319,7 @@ public void GetTestsFromExecutable_LoadTests_AreFoundInReasonableTime()
320319
321320 private void AssertIsGoogleTestExecutable ( string executable , bool isGoogleTestExecutable , string regex = "" )
322321 {
323- new GoogleTestDiscoverer ( TestEnvironment . Logger , TestEnvironment . Options ) . IsGoogleTestExecutable ( executable , regex )
322+ GoogleTestDiscoverer . IsGoogleTestExecutable ( executable , regex , TestEnvironment . Logger )
324323 . Should ( )
325324 . Be ( isGoogleTestExecutable ) ;
326325 }
0 commit comments