@@ -71,14 +71,6 @@ public IList<TestCaseStarted> FindAllTestCaseStarted() => _testCaseStartedById.V
71
71
72
72
public IList < TestStep > FindAllTestSteps ( ) => _testStepById . Values . OrderBy ( ts => ts . Id ) . ToList ( ) ;
73
73
74
- public IDictionary < Feature ? , List < TestCaseStarted > > FindAllTestCaseStartedGroupedByFeature ( )
75
- {
76
- // Group TestCaseStarted by Feature (null if not found)
77
- return FindAllTestCaseStarted ( )
78
- . GroupBy ( tcs => FindFeatureBy ( tcs ) )
79
- . ToDictionary ( g => g . Key , g => g . ToList ( ) ) ;
80
- }
81
-
82
74
public Meta ? FindMeta ( ) => _meta ;
83
75
public TestRunStarted ? FindTestRunStarted ( ) => _testRunStarted ;
84
76
public TestRunFinished ? FindTestRunFinished ( ) => _testRunFinished ;
@@ -88,14 +80,8 @@ public IList<Attachment> FindAttachmentsBy(TestStepFinished testStepFinished) =>
88
80
? attachments . Where ( a => a . TestStepId == testStepFinished . TestStepId ) . ToList ( )
89
81
: new List < Attachment > ( ) ;
90
82
91
- public Feature ? FindFeatureBy ( TestCaseStarted testCaseStarted )
92
- {
93
- return FindLineageBy ( testCaseStarted ) ? . Feature ;
94
- }
95
-
96
83
public Hook ? FindHookBy ( TestStep testStep )
97
84
{
98
- // Java: testStep.getHookId().map(hookById::get)
99
85
if ( ! string . IsNullOrEmpty ( testStep . HookId ) && _hookById . TryGetValue ( testStep . HookId , out var hook ) )
100
86
{
101
87
return hook ;
@@ -105,7 +91,6 @@ public IList<Attachment> FindAttachmentsBy(TestStepFinished testStepFinished) =>
105
91
106
92
public Pickle ? FindPickleBy ( TestCaseStarted testCaseStarted )
107
93
{
108
- // Java: findTestCaseBy(testCaseStarted).map(TestCase::getPickleId).map(pickleById::get)
109
94
var testCase = FindTestCaseBy ( testCaseStarted ) ;
110
95
if ( testCase != null && _pickleById . TryGetValue ( testCase . PickleId , out var pickle ) )
111
96
{
@@ -116,7 +101,6 @@ public IList<Attachment> FindAttachmentsBy(TestStepFinished testStepFinished) =>
116
101
117
102
public Pickle ? FindPickleBy ( TestStepStarted testStepStarted )
118
103
{
119
- // Java: findTestCaseBy(testStepStarted).map(TestCase::getPickleId).map(pickleById::get)
120
104
var testCaseStarted = FindTestCaseStartedBy ( testStepStarted ) ;
121
105
if ( testCaseStarted != null )
122
106
{
@@ -127,7 +111,6 @@ public IList<Attachment> FindAttachmentsBy(TestStepFinished testStepFinished) =>
127
111
128
112
public TestCase ? FindTestCaseBy ( TestCaseStarted testCaseStarted )
129
113
{
130
- // Java: testCaseById.get(testCaseStarted.getTestCaseId())
131
114
if ( _testCaseById . TryGetValue ( testCaseStarted . TestCaseId , out var testCase ) )
132
115
{
133
116
return testCase ;
@@ -137,32 +120,27 @@ public IList<Attachment> FindAttachmentsBy(TestStepFinished testStepFinished) =>
137
120
138
121
public TestCaseStarted ? FindTestCaseStartedBy ( TestStepStarted testStepStarted )
139
122
{
140
- // Java: testCaseStartedById.get(testStepStarted.getTestCaseStartedId())
141
123
return _testCaseStartedById . TryGetValue ( testStepStarted . TestCaseStartedId , out var tcs ) ? tcs : null ;
142
124
}
143
125
144
126
public TestCase ? FindTestCaseBy ( TestStepStarted testStepStarted )
145
127
{
146
- // Java: findTestCaseStartedBy(testStepStarted).flatMap(this::findTestCaseBy)
147
128
var testCaseStarted = FindTestCaseStartedBy ( testStepStarted ) ;
148
129
return testCaseStarted != null ? FindTestCaseBy ( testCaseStarted ) : null ;
149
130
}
150
131
151
132
public TestStep ? FindTestStepBy ( TestStepStarted testStepStarted )
152
133
{
153
- // Java: testStepById.get(testStepStarted.getTestStepId())
154
134
return _testStepById . TryGetValue ( testStepStarted . TestStepId , out var testStep ) ? testStep : null ;
155
135
}
156
136
157
137
public TestStep ? FindTestStepBy ( TestStepFinished testStepFinished )
158
138
{
159
- // Java: testStepById.get(testStepFinished.getTestStepId())
160
139
return _testStepById . TryGetValue ( testStepFinished . TestStepId , out var testStep ) ? testStep : null ;
161
140
}
162
141
163
142
public PickleStep ? FindPickleStepBy ( TestStep testStep )
164
143
{
165
- // Java: testStep.getPickleStepId().map(pickleStepById::get)
166
144
if ( ! string . IsNullOrEmpty ( testStep . PickleStepId ) )
167
145
{
168
146
if ( _pickleStepById . TryGetValue ( testStep . PickleStepId , out var pickleStep ) )
@@ -175,7 +153,6 @@ public IList<Attachment> FindAttachmentsBy(TestStepFinished testStepFinished) =>
175
153
176
154
public Step ? FindStepBy ( PickleStep pickleStep )
177
155
{
178
- // Java: String stepId = pickleStep.getAstNodeIds().get(0); stepById.get(stepId)
179
156
if ( pickleStep . AstNodeIds != null && pickleStep . AstNodeIds . Count > 0 )
180
157
{
181
158
var stepId = pickleStep . AstNodeIds [ 0 ] ;
@@ -202,13 +179,11 @@ public IList<Attachment> FindAttachmentsBy(TestStepFinished testStepFinished) =>
202
179
203
180
public TestCaseFinished ? FindTestCaseFinishedBy ( TestCaseStarted testCaseStarted )
204
181
{
205
- // Java: testCaseFinishedByTestCaseStartedId.get(testCaseStarted.getId())
206
182
return _testCaseFinishedByTestCaseStartedId . TryGetValue ( testCaseStarted . Id , out var finished ) ? finished : null ;
207
183
}
208
184
209
185
public System . TimeSpan ? FindTestRunDuration ( )
210
186
{
211
- // Java: if (testRunStarted == null || testRunFinished == null) return Optional.empty();
212
187
if ( _testRunStarted == null || _testRunFinished == null )
213
188
return null ;
214
189
var start = Converters . ToDateTime ( _testRunStarted . Timestamp ) ;
@@ -218,18 +193,15 @@ public IList<Attachment> FindAttachmentsBy(TestStepFinished testStepFinished) =>
218
193
219
194
public IList < TestStepStarted > FindTestStepsStartedBy ( TestCaseStarted testCaseStarted )
220
195
{
221
- // Java: testStepsStartedByTestCaseStartedId.getOrDefault(testCaseStarted.getId(), emptyList())
222
196
if ( _testStepsStartedByTestCaseStartedId . TryGetValue ( testCaseStarted . Id , out var steps ) )
223
197
{
224
- // Return a copy for concurrency safety
225
198
return new List < TestStepStarted > ( steps ) ;
226
199
}
227
200
return new List < TestStepStarted > ( ) ;
228
201
}
229
202
230
203
public IList < TestStepFinished > FindTestStepsFinishedBy ( TestCaseStarted testCaseStarted )
231
204
{
232
- // Java: testStepsFinishedByTestCaseStartedId.getOrDefault(testCaseStarted.getId(), emptyList())
233
205
if ( _testStepsFinishedByTestCaseStartedId . TryGetValue ( testCaseStarted . Id , out var steps ) )
234
206
{
235
207
// Return a copy for concurrency safety
@@ -240,11 +212,6 @@ public IList<TestStepFinished> FindTestStepsFinishedBy(TestCaseStarted testCaseS
240
212
241
213
public IList < ( TestStepFinished , TestStep ) > FindTestStepFinishedAndTestStepBy ( TestCaseStarted testCaseStarted )
242
214
{
243
- // Java: findTestStepsFinishedBy(testCaseStarted).stream()
244
- // .map(testStepFinished -> findTestStepBy(testStepFinished).map(testStep -> new SimpleEntry<>(testStepFinished, testStep)))
245
- // .filter(Optional::isPresent)
246
- // .map(Optional::get)
247
- // .collect(toList());
248
215
var finishedSteps = FindTestStepsFinishedBy ( testCaseStarted ) ;
249
216
var result = new List < ( TestStepFinished , TestStep ) > ( ) ;
250
217
foreach ( var testStepFinished in finishedSteps )
@@ -470,62 +437,6 @@ public void Update(Envelope envelope)
470
437
}
471
438
return FindLineageBy ( pickle ) ;
472
439
}
473
-
474
- public string FindNameOf ( GherkinDocument element , NamingStrategy namingStrategy )
475
- {
476
- if ( element == null ) return string . Empty ;
477
- var lineage = FindLineageBy ( element ) ;
478
- return GetNameFromStrategy ( element , lineage , namingStrategy ) ;
479
- }
480
-
481
- public string FindNameOf ( Feature element , NamingStrategy namingStrategy )
482
- {
483
- if ( element == null ) return string . Empty ;
484
- var lineage = FindLineageBy ( element ) ;
485
- return GetNameFromStrategy ( element , lineage , namingStrategy ) ;
486
- }
487
-
488
- public string FindNameOf ( Rule element , NamingStrategy namingStrategy )
489
- {
490
- if ( element == null ) return string . Empty ;
491
- var lineage = FindLineageBy ( element ) ;
492
- return GetNameFromStrategy ( element , lineage , namingStrategy ) ;
493
- }
494
-
495
- public string FindNameOf ( Scenario element , NamingStrategy namingStrategy )
496
- {
497
- if ( element == null ) return string . Empty ;
498
- var lineage = FindLineageBy ( element ) ;
499
- return GetNameFromStrategy ( element , lineage , namingStrategy ) ;
500
- }
501
-
502
- public string FindNameOf ( Examples element , NamingStrategy namingStrategy )
503
- {
504
- if ( element == null ) return string . Empty ;
505
- var lineage = FindLineageBy ( element ) ;
506
- return GetNameFromStrategy ( element , lineage , namingStrategy ) ;
507
- }
508
-
509
- public string FindNameOf ( TableRow element , NamingStrategy namingStrategy )
510
- {
511
- if ( element == null ) return string . Empty ;
512
- var lineage = FindLineageBy ( element ) ;
513
- return GetNameFromStrategy ( element , lineage , namingStrategy ) ;
514
- }
515
-
516
- public string FindNameOf ( Pickle element , NamingStrategy namingStrategy )
517
- {
518
- if ( element == null ) return string . Empty ;
519
- var lineage = FindLineageBy ( element ) ;
520
- var result = namingStrategy . Reduce ( lineage , element ) ;
521
- if ( result == null )
522
- {
523
- throw new ArgumentException ( "Element was not part of this query object" ) ;
524
- }
525
- return result ;
526
-
527
- }
528
-
529
440
public Location ? FindLocationOf ( Pickle pickle )
530
441
{
531
442
var lineage = FindLineageBy ( pickle ) ;
@@ -537,15 +448,4 @@ public string FindNameOf(Pickle element, NamingStrategy namingStrategy)
537
448
return lineage . Scenario . Location ;
538
449
return null ;
539
450
}
540
-
541
- // Placeholder for actual naming strategy logic
542
- private string GetNameFromStrategy ( object element , Lineage ? lineage , NamingStrategy namingStrategy )
543
- {
544
- var result = namingStrategy . Reduce ( lineage ) ;
545
- if ( result == null )
546
- {
547
- throw new ArgumentException ( "Element was not part of this query object" ) ;
548
- }
549
- return result ;
550
- }
551
451
}
0 commit comments