@@ -19,8 +19,8 @@ public class TestTestDiscoverer
1919 // Tests that all the tests in the reference project are found.
2020 [ TestMethod ]
2121 [ DeploymentItem ( Common . ReferenceExePath ) ]
22- public void DiscoversAllTests ( )
23- {
22+ public void DiscoversAllTests ( )
23+ {
2424 // Initialize a mock sink to keep track of the discovered tests.
2525 MockTestCaseDiscoverySink testSink = new MockTestCaseDiscoverySink ( ) ;
2626
@@ -145,5 +145,26 @@ public void FiltersTestExecutables()
145145 // There should be no tests, as nothing matches the filter.
146146 Assert . AreEqual ( testSink . Tests . Count , 0 ) ;
147147 }
148+
149+ // Tests that a non Catch exe returns no test cases.
150+ [ TestMethod ]
151+ public void DiscoversNoTests ( )
152+ {
153+ // Initialize a mock sink to keep track of the discovered tests.
154+ MockTestCaseDiscoverySink testSink = new MockTestCaseDiscoverySink ( ) ;
155+
156+ TestDiscoverer discoverer = new TestDiscoverer ( ) ;
157+ var cd = System . IO . Directory . GetCurrentDirectory ( ) ;
158+ // Unfortunately it doesn't get copied with the DeployItemAttribute, no idea why.
159+ System . IO . File . WriteAllText ( @"nonecatchexe.cmd" , @"@echo Non Catch Output line" ) ;
160+ // Returns an unexpected first line.
161+ discoverer . DiscoverTests ( new List < String > ( ) { @"nonecatchexe.cmd" } ,
162+ new MockDiscoveryContext ( ) ,
163+ new MockMessageLogger ( ) ,
164+ testSink ) ;
165+
166+ // Zero test cases should be registered.
167+ Assert . AreEqual ( 0 , testSink . Tests . Count ) ;
168+ }
148169 }
149170}
0 commit comments