@@ -18,7 +18,7 @@ public class TestProgressStateTests
1818 public void ReportSkippedTest_MultipleCalls_DifferentInstanceId ( )
1919 {
2020 var stopwatchMock = new Mock < IStopwatch > ( ) ;
21- var state = new TestProgressState ( 1 , "assembly.dll" , null , null , stopwatchMock . Object ) ;
21+ var state = new TestProgressState ( 1 , "assembly.dll" , null , null , stopwatchMock . Object , isDiscovery : false ) ;
2222 string testUid = "test1" ;
2323 string instanceA = "instanceA" ;
2424 string instanceB = "instanceB" ;
@@ -48,7 +48,7 @@ public void ReportSkippedTest_MultipleCalls_DifferentInstanceId()
4848 public void ReportSkippedTest_RepeatedInstanceAfterRetry_ThrowsInvalidOperationException ( )
4949 {
5050 var stopwatchMock = new Mock < IStopwatch > ( ) ;
51- var state = new TestProgressState ( 1 , "assembly.dll" , null , null , stopwatchMock . Object ) ;
51+ var state = new TestProgressState ( 1 , "assembly.dll" , null , null , stopwatchMock . Object , isDiscovery : false ) ;
5252 string testUid = "test1" ;
5353 string instanceA = "instanceA" ;
5454 string instanceB = "instanceB" ;
@@ -75,7 +75,7 @@ public void ReportSkippedTest_RepeatedInstanceAfterRetry_ThrowsInvalidOperationE
7575 public void ReportFailedTest_RepeatedCalls_IncrementsFailedTests ( int callCount )
7676 {
7777 var stopwatchMock = new Mock < IStopwatch > ( ) ;
78- var state = new TestProgressState ( 1 , "assembly.dll" , null , null , stopwatchMock . Object ) ;
78+ var state = new TestProgressState ( 1 , "assembly.dll" , null , null , stopwatchMock . Object , isDiscovery : false ) ;
7979 state . NotifyHandshake ( "instance1" ) ;
8080 for ( int i = 0 ; i < callCount ; i ++ )
8181 {
@@ -95,7 +95,7 @@ public void ReportFailedTest_RepeatedCalls_IncrementsFailedTests(int callCount)
9595 public void ReportFailedTest_DifferentInstanceId_RetriesFailureAndResetsCount ( )
9696 {
9797 var stopwatchMock = new Mock < IStopwatch > ( ) ;
98- var state = new TestProgressState ( 1 , "assembly.dll" , null , null , stopwatchMock . Object ) ;
98+ var state = new TestProgressState ( 1 , "assembly.dll" , null , null , stopwatchMock . Object , isDiscovery : false ) ;
9999 state . NotifyHandshake ( "id1" ) ;
100100 state . ReportFailedTest ( "testUid" , "id1" ) ;
101101 state . ReportFailedTest ( "testUid" , "id1" ) ;
@@ -114,7 +114,7 @@ public void ReportFailedTest_DifferentInstanceId_RetriesFailureAndResetsCount()
114114 public void ReportFailedTest_ReusingOldInstanceId_ThrowsInvalidOperationException ( )
115115 {
116116 var stopwatchMock = new Mock < IStopwatch > ( ) ;
117- var state = new TestProgressState ( 1 , "assembly.dll" , null , null , stopwatchMock . Object ) ;
117+ var state = new TestProgressState ( 1 , "assembly.dll" , null , null , stopwatchMock . Object , isDiscovery : false ) ;
118118 state . NotifyHandshake ( "id1" ) ;
119119 state . ReportFailedTest ( "testUid" , "id1" ) ;
120120 state . NotifyHandshake ( "id2" ) ;
@@ -134,7 +134,7 @@ public void ReportFailedTest_ReusingOldInstanceId_ThrowsInvalidOperationExceptio
134134 public void ReportTest_WithNewInstanceId_ClearsOldReports ( )
135135 {
136136 var stopwatchMock = new Mock < IStopwatch > ( ) ;
137- var state = new TestProgressState ( 1 , "assembly.dll" , null , null , stopwatchMock . Object ) ;
137+ var state = new TestProgressState ( 1 , "assembly.dll" , null , null , stopwatchMock . Object , isDiscovery : false ) ;
138138 state . NotifyHandshake ( "id1" ) ;
139139 state . ReportFailedTest ( "testUid" , "id1" ) ;
140140 state . ReportFailedTest ( "testUid" , "id1" ) ;
@@ -154,6 +154,7 @@ public void ReportTest_WithNewInstanceId_ClearsOldReports()
154154 state . SkippedTests . Should ( ) . Be ( 1 ) ;
155155 state . RetriedFailedTests . Should ( ) . Be ( 3 ) ;
156156 }
157+
157158 /// <summary>
158159 /// Tests that DiscoverTest increments PassedTests and adds the displayName and uid to DiscoveredTests.
159160 /// </summary>
@@ -173,22 +174,23 @@ public void DiscoverTest_DisplayNameAndUid_AddsEntryAndIncrementsPassedTests(str
173174 assembly : "assembly.dll" ,
174175 targetFramework : null ,
175176 architecture : null ,
176- stopwatch : stopwatchMock . Object ) ;
177+ stopwatch : stopwatchMock . Object ,
178+ isDiscovery : true ) ;
177179
178180 state . DiscoverTest ( displayName , uid ) ;
179181
180- state . PassedTests . Should ( ) . Be ( 1 ) ;
181- state . DiscoveredTests . Count . Should ( ) . Be ( 1 ) ;
182- state . DiscoveredTests [ 0 ] . DisplayName . Should ( ) . Be ( displayName ) ;
183- state . DiscoveredTests [ 0 ] . UID . Should ( ) . Be ( uid ) ;
182+ state . DiscoveredTests . Should ( ) . Be ( 1 ) ;
183+ state . DiscoveredTestNames . Count . Should ( ) . Be ( 1 ) ;
184+ state . DiscoveredTestNames [ 0 ] . DisplayName . Should ( ) . Be ( displayName ) ;
185+ state . DiscoveredTestNames [ 0 ] . UID . Should ( ) . Be ( uid ) ;
184186 }
185187
186188 [ Fact ]
187189 public void FailedTestRetryShouldShouldShowTheSameTotalCountsInEachRetry ( )
188190 {
189191 // Tests are retried, total test count stays 3 to give use comparable counts, no matter how many times we retry.
190192 var stopwatchMock = new Mock < IStopwatch > ( ) ;
191- var state = new TestProgressState ( 1 , "assembly.dll" , null , null , stopwatchMock . Object ) ;
193+ var state = new TestProgressState ( 1 , "assembly.dll" , null , null , stopwatchMock . Object , isDiscovery : false ) ;
192194
193195 // First run
194196 state . NotifyHandshake ( "run1" ) ;
@@ -227,7 +229,7 @@ public void FailedTestRetryShouldNotFailTheRunWhenSecondRunProducesLessDynamicTe
227229 {
228230 // This is special test for dynamic tests where we don't know how many tests will be produced in the second run.
229231 var stopwatchMock = new Mock < IStopwatch > ( ) ;
230- var state = new TestProgressState ( 1 , "assembly.dll" , null , null , stopwatchMock . Object ) ;
232+ var state = new TestProgressState ( 1 , "assembly.dll" , null , null , stopwatchMock . Object , isDiscovery : false ) ;
231233
232234 // First run
233235 state . NotifyHandshake ( "run1" ) ;
@@ -259,7 +261,7 @@ public void FailedTestRetryShouldAccountPassedTestsInRetry()
259261 {
260262 // This is special test for dynamic tests where we cannot avoid re-running even non-failing tests from dynamic tests.
261263 var stopwatchMock = new Mock < IStopwatch > ( ) ;
262- var state = new TestProgressState ( 1 , "assembly.dll" , null , null , stopwatchMock . Object ) ;
264+ var state = new TestProgressState ( 1 , "assembly.dll" , null , null , stopwatchMock . Object , isDiscovery : false ) ;
263265
264266 // First run
265267 state . NotifyHandshake ( "run1" ) ;
0 commit comments