@@ -18,7 +18,7 @@ public class TestProgressStateTests
18
18
public void ReportSkippedTest_MultipleCalls_DifferentInstanceId ( )
19
19
{
20
20
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 ) ;
22
22
string testUid = "test1" ;
23
23
string instanceA = "instanceA" ;
24
24
string instanceB = "instanceB" ;
@@ -48,7 +48,7 @@ public void ReportSkippedTest_MultipleCalls_DifferentInstanceId()
48
48
public void ReportSkippedTest_RepeatedInstanceAfterRetry_ThrowsInvalidOperationException ( )
49
49
{
50
50
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 ) ;
52
52
string testUid = "test1" ;
53
53
string instanceA = "instanceA" ;
54
54
string instanceB = "instanceB" ;
@@ -75,7 +75,7 @@ public void ReportSkippedTest_RepeatedInstanceAfterRetry_ThrowsInvalidOperationE
75
75
public void ReportFailedTest_RepeatedCalls_IncrementsFailedTests ( int callCount )
76
76
{
77
77
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 ) ;
79
79
state . NotifyHandshake ( "instance1" ) ;
80
80
for ( int i = 0 ; i < callCount ; i ++ )
81
81
{
@@ -95,7 +95,7 @@ public void ReportFailedTest_RepeatedCalls_IncrementsFailedTests(int callCount)
95
95
public void ReportFailedTest_DifferentInstanceId_RetriesFailureAndResetsCount ( )
96
96
{
97
97
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 ) ;
99
99
state . NotifyHandshake ( "id1" ) ;
100
100
state . ReportFailedTest ( "testUid" , "id1" ) ;
101
101
state . ReportFailedTest ( "testUid" , "id1" ) ;
@@ -114,7 +114,7 @@ public void ReportFailedTest_DifferentInstanceId_RetriesFailureAndResetsCount()
114
114
public void ReportFailedTest_ReusingOldInstanceId_ThrowsInvalidOperationException ( )
115
115
{
116
116
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 ) ;
118
118
state . NotifyHandshake ( "id1" ) ;
119
119
state . ReportFailedTest ( "testUid" , "id1" ) ;
120
120
state . NotifyHandshake ( "id2" ) ;
@@ -134,7 +134,7 @@ public void ReportFailedTest_ReusingOldInstanceId_ThrowsInvalidOperationExceptio
134
134
public void ReportTest_WithNewInstanceId_ClearsOldReports ( )
135
135
{
136
136
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 ) ;
138
138
state . NotifyHandshake ( "id1" ) ;
139
139
state . ReportFailedTest ( "testUid" , "id1" ) ;
140
140
state . ReportFailedTest ( "testUid" , "id1" ) ;
@@ -154,6 +154,7 @@ public void ReportTest_WithNewInstanceId_ClearsOldReports()
154
154
state . SkippedTests . Should ( ) . Be ( 1 ) ;
155
155
state . RetriedFailedTests . Should ( ) . Be ( 3 ) ;
156
156
}
157
+
157
158
/// <summary>
158
159
/// Tests that DiscoverTest increments PassedTests and adds the displayName and uid to DiscoveredTests.
159
160
/// </summary>
@@ -173,22 +174,23 @@ public void DiscoverTest_DisplayNameAndUid_AddsEntryAndIncrementsPassedTests(str
173
174
assembly : "assembly.dll" ,
174
175
targetFramework : null ,
175
176
architecture : null ,
176
- stopwatch : stopwatchMock . Object ) ;
177
+ stopwatch : stopwatchMock . Object ,
178
+ isDiscovery : true ) ;
177
179
178
180
state . DiscoverTest ( displayName , uid ) ;
179
181
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 ) ;
184
186
}
185
187
186
188
[ Fact ]
187
189
public void FailedTestRetryShouldShouldShowTheSameTotalCountsInEachRetry ( )
188
190
{
189
191
// Tests are retried, total test count stays 3 to give use comparable counts, no matter how many times we retry.
190
192
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 ) ;
192
194
193
195
// First run
194
196
state . NotifyHandshake ( "run1" ) ;
@@ -227,7 +229,7 @@ public void FailedTestRetryShouldNotFailTheRunWhenSecondRunProducesLessDynamicTe
227
229
{
228
230
// This is special test for dynamic tests where we don't know how many tests will be produced in the second run.
229
231
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 ) ;
231
233
232
234
// First run
233
235
state . NotifyHandshake ( "run1" ) ;
@@ -259,7 +261,7 @@ public void FailedTestRetryShouldAccountPassedTestsInRetry()
259
261
{
260
262
// This is special test for dynamic tests where we cannot avoid re-running even non-failing tests from dynamic tests.
261
263
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 ) ;
263
265
264
266
// First run
265
267
state . NotifyHandshake ( "run1" ) ;
0 commit comments