Skip to content

Commit fa932c6

Browse files
The github workflow Format was messing up the tests.
1 parent 6a60744 commit fa932c6

27 files changed

Lines changed: 172 additions & 165 deletions

Hyperbee.Expressions.sln

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{
2222
.github\workflows\create_release.yml = .github\workflows\create_release.yml
2323
.github\workflows\create_test_report.yml = .github\workflows\create_test_report.yml
2424
.github\workflows\deploy-gh-pages.yml = .github\workflows\deploy-gh-pages.yml
25-
.github\workflows\format.yml = .github\workflows\format.yml
2625
.github\workflows\issue_branch.yml = .github\workflows\issue_branch.yml
2726
.github\workflows\pack_publish.yml = .github\workflows\pack_publish.yml
2827
.github\workflows\run_tests.yml = .github\workflows\run_tests.yml

test/Hyperbee.Expressions.Benchmark/Hyperbee.Expressions.Benchmark.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
</PropertyGroup>
1010

1111
<ItemGroup>
12-
<PackageReference Include="BenchmarkDotNet" Version="0.14.0" />
13-
<PackageReference Include="DotNext.Metaprogramming" Version="5.21.0" />
12+
<PackageReference Include="BenchmarkDotNet" Version="0.15.2" />
13+
<PackageReference Include="DotNext.Metaprogramming" Version="5.23.0" />
1414
<PackageReference Include="FastExpressionCompiler" Version="5.1.1" />
1515
</ItemGroup>
1616

test/Hyperbee.Expressions.Tests/BlockAsyncBasicTests.cs

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ namespace Hyperbee.Expressions.Tests;
99
[TestClass]
1010
public class BlockAsyncBasicTests
1111
{
12-
[TestMethod]
12+
[DataTestMethod]
1313
[DataRow( CompleterType.Immediate, CompilerType.Fast )]
1414
[DataRow( CompleterType.Immediate, CompilerType.System )]
1515
[DataRow( CompleterType.Immediate, CompilerType.Interpret )]
@@ -36,7 +36,7 @@ public async Task BlockAsync_ShouldAwaitSuccessfully_WithCompletedTask( Complete
3636
Assert.AreEqual( 1, result );
3737
}
3838

39-
[TestMethod]
39+
[DataTestMethod]
4040
[DataRow( CompleterType.Immediate, CompilerType.Fast )]
4141
[DataRow( CompleterType.Immediate, CompilerType.System )]
4242
[DataRow( CompleterType.Immediate, CompilerType.Interpret )]
@@ -67,7 +67,7 @@ public async Task BlockAsync_ShouldAwaitMultipleSuccessfully_WithCompletedTask(
6767
Assert.AreEqual( 2, result );
6868
}
6969

70-
[TestMethod]
70+
[DataTestMethod]
7171
[DataRow( CompilerType.Fast )]
7272
[DataRow( CompilerType.System )]
7373
[DataRow( CompilerType.Interpret )]
@@ -86,7 +86,7 @@ public async Task BlockAsync_ShouldAwaitSuccessfully_WithDelayedTask( CompilerTy
8686
Assert.AreEqual( 5, result );
8787
}
8888

89-
[TestMethod]
89+
[DataTestMethod]
9090
[DataRow( CompleterType.Immediate, CompilerType.Fast )]
9191
[DataRow( CompleterType.Immediate, CompilerType.System )]
9292
[DataRow( CompleterType.Immediate, CompilerType.Interpret )]
@@ -117,10 +117,11 @@ public async Task BlockAsync_ShouldAwaitMultipleTasks_WithDifferentResults( Comp
117117
Assert.AreEqual( 2, result ); // Last awaited result should be returned
118118
}
119119

120-
[TestMethod]
120+
[DataTestMethod]
121121
[DataRow( CompilerType.Fast )]
122122
[DataRow( CompilerType.System )]
123123
[DataRow( CompilerType.Interpret )]
124+
[ExpectedException( typeof( InvalidOperationException ) )]
124125
public async Task BlockAsync_ShouldThrowException_WithFaultedTask( CompilerType compiler )
125126
{
126127
// Arrange
@@ -132,13 +133,14 @@ public async Task BlockAsync_ShouldThrowException_WithFaultedTask( CompilerType
132133
var compiledLambda = lambda.Compile( compiler );
133134

134135
// Act & Assert
135-
await Assert.ThrowsExactlyAsync<InvalidOperationException>( async () => await compiledLambda() );
136+
await compiledLambda();
136137
}
137138

138-
[TestMethod]
139+
[DataTestMethod]
139140
[DataRow( CompilerType.Fast )]
140141
[DataRow( CompilerType.System )]
141142
[DataRow( CompilerType.Interpret )]
143+
[ExpectedException( typeof( TaskCanceledException ) )]
142144
public async Task BlockAsync_ShouldHandleCanceledTask_WithCancellation( CompilerType compiler )
143145
{
144146
// Arrange
@@ -151,10 +153,10 @@ public async Task BlockAsync_ShouldHandleCanceledTask_WithCancellation( Compiler
151153
var compiledLambda = lambda.Compile( compiler );
152154

153155
// Act & Assert
154-
await Assert.ThrowsExactlyAsync<TaskCanceledException>( async () => await compiledLambda() );
156+
await compiledLambda();
155157
}
156158

157-
[TestMethod]
159+
[DataTestMethod]
158160
[DataRow( CompleterType.Immediate, CompilerType.Fast )]
159161
[DataRow( CompleterType.Immediate, CompilerType.System )]
160162
[DataRow( CompleterType.Immediate, CompilerType.Interpret )]
@@ -182,7 +184,7 @@ public async Task BlockAsync_ShouldAwaitNestedBlockAsync_WithNestedTasks( Comple
182184
Assert.AreEqual( 2, result );
183185
}
184186

185-
[TestMethod]
187+
[DataTestMethod]
186188
[DataRow( CompleterType.Immediate, CompilerType.Fast )]
187189
[DataRow( CompleterType.Immediate, CompilerType.System )]
188190
[DataRow( CompleterType.Immediate, CompilerType.Interpret )]
@@ -213,7 +215,7 @@ public async Task BlockAsync_ShouldAwaitNestedBlockAsync_WithNestedLambdas( Comp
213215
Assert.AreEqual( 2, result );
214216
}
215217

216-
[TestMethod]
218+
[DataTestMethod]
217219
[DataRow( CompleterType.Immediate, CompilerType.Fast )]
218220
[DataRow( CompleterType.Immediate, CompilerType.System )]
219221
[DataRow( CompleterType.Immediate, CompilerType.Interpret )]
@@ -259,7 +261,7 @@ public async Task BlockAsync_ShouldShareVariablesBetweenBlocks_WithNestedAwaits(
259261
Assert.AreEqual( 7, result );
260262
}
261263

262-
[TestMethod]
264+
[DataTestMethod]
263265
[DataRow( CompleterType.Immediate, CompilerType.Fast )]
264266
[DataRow( CompleterType.Immediate, CompilerType.System )]
265267
[DataRow( CompleterType.Immediate, CompilerType.Interpret )]
@@ -283,7 +285,7 @@ public async Task BlockAsync_ShouldHandleSyncAndAsync_WithMixedOperations( Compl
283285
Assert.AreEqual( 20, result ); // The last operation is asynchronous and returns 20
284286
}
285287

286-
[TestMethod]
288+
[DataTestMethod]
287289
[DataRow( CompilerType.Fast )]
288290
[DataRow( CompilerType.System )]
289291
[DataRow( CompilerType.Interpret )]
@@ -301,7 +303,7 @@ public async Task BlockAsync_ShouldAwaitSuccessfully_WithTask( CompilerType comp
301303
Assert.IsTrue( true ); // If no exception, the test is successful
302304
}
303305

304-
[TestMethod]
306+
[DataTestMethod]
305307
[DataRow( CompleterType.Immediate, CompilerType.Fast )]
306308
[DataRow( CompleterType.Immediate, CompilerType.System )]
307309
[DataRow( CompleterType.Immediate, CompilerType.Interpret )]
@@ -331,7 +333,7 @@ public async Task BlockAsync_ShouldAwaitSuccessfully_WithReturnLabel( CompleterT
331333
Assert.AreEqual( 10, result ); // The last operation is asynchronous and returns 10
332334
}
333335

334-
[TestMethod]
336+
[DataTestMethod]
335337
[DataRow( CompleterType.Immediate, CompilerType.Fast )]
336338
[DataRow( CompleterType.Immediate, CompilerType.System )]
337339
[DataRow( CompleterType.Immediate, CompilerType.Interpret )]
@@ -363,7 +365,7 @@ public async Task BlockAsync_ShouldPreserveVariableAssignment_BeforeAndAfterAwai
363365
Assert.AreEqual( 15, result );
364366
}
365367

366-
[TestMethod]
368+
[DataTestMethod]
367369
[DataRow( CompleterType.Immediate, CompilerType.Fast )]
368370
[DataRow( CompleterType.Immediate, CompilerType.System )]
369371
[DataRow( CompleterType.Immediate, CompilerType.Interpret )]
@@ -414,7 +416,7 @@ public async Task BlockAsync_ShouldPreserveVariablesInNestedBlock_WithAwaits( Co
414416
Assert.AreEqual( 255, result );
415417
}
416418

417-
[TestMethod]
419+
[DataTestMethod]
418420
[DataRow( CompilerType.Fast )]
419421
[DataRow( CompilerType.System )]
420422
[DataRow( CompilerType.Interpret )]
@@ -452,7 +454,7 @@ public async Task BlockAsync_ShouldPreserveVariables_WithNestedAwaits( CompilerT
452454
Assert.AreEqual( 10, result );
453455
}
454456

455-
[TestMethod]
457+
[DataTestMethod]
456458
[DataRow( CompleterType.Immediate, CompilerType.Fast )]
457459
[DataRow( CompleterType.Immediate, CompilerType.System )]
458460
[DataRow( CompleterType.Immediate, CompilerType.Interpret )]
@@ -498,7 +500,7 @@ public async Task BlockAsync_ShouldAllowLambdaParameters( CompleterType complete
498500
Assert.AreEqual( 15, result );
499501
}
500502

501-
[TestMethod]
503+
[DataTestMethod]
502504
[DataRow( CompleterType.Immediate, CompilerType.Fast )]
503505
[DataRow( CompleterType.Immediate, CompilerType.System )]
504506
[DataRow( CompleterType.Immediate, CompilerType.Interpret )]
@@ -559,7 +561,7 @@ public async Task BlockAsync_ShouldAllowParallelBlocks_WithTaskWhenAll( Complete
559561
}
560562
}
561563

562-
[TestMethod]
564+
[DataTestMethod]
563565
[DataRow( CompleterType.Immediate, CompilerType.Fast )]
564566
[DataRow( CompleterType.Immediate, CompilerType.System )]
565567
[DataRow( CompleterType.Immediate, CompilerType.Interpret )]
@@ -611,7 +613,7 @@ public async Task BlockAsync_ShouldAllowNestedBlocks_WithoutAsync( CompleterType
611613
Assert.AreEqual( 7, result );
612614
}
613615

614-
[TestMethod]
616+
[DataTestMethod]
615617
[DataRow( CompleterType.Immediate, CompilerType.Fast )]
616618
[DataRow( CompleterType.Immediate, CompilerType.System )]
617619
[DataRow( CompleterType.Immediate, CompilerType.Interpret )]
@@ -665,7 +667,7 @@ public void Dispose()
665667
}
666668
}
667669

668-
[TestMethod]
670+
[DataTestMethod]
669671
[DataRow( CompleterType.Immediate, CompilerType.Fast )]
670672
[DataRow( CompleterType.Immediate, CompilerType.System )]
671673
[DataRow( CompleterType.Deferred, CompilerType.Fast )]

test/Hyperbee.Expressions.Tests/BlockAsyncConditionalTests.cs

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ namespace Hyperbee.Expressions.Tests;
77
[TestClass]
88
public class BlockAsyncConditionalTests
99
{
10-
[TestMethod]
10+
[DataTestMethod]
1111
[DataRow( CompleterType.Immediate, CompilerType.Fast )]
1212
[DataRow( CompleterType.Immediate, CompilerType.System )]
1313
[DataRow( CompleterType.Immediate, CompilerType.Interpret )]
@@ -36,7 +36,7 @@ public async Task AsyncBlock_ShouldAwaitSuccessfully_WithIfThenCondition( Comple
3636
Assert.IsTrue( true ); // No exception means condition and block executed successfully
3737
}
3838

39-
[TestMethod]
39+
[DataTestMethod]
4040
[DataRow( CompleterType.Immediate, CompilerType.Fast )]
4141
[DataRow( CompleterType.Immediate, CompilerType.System )]
4242
[DataRow( CompleterType.Immediate, CompilerType.Interpret )]
@@ -72,7 +72,7 @@ public async Task AsyncBlock_ShouldAwaitSuccessfully_WithConditionalAssignment(
7272
Assert.AreEqual( 1, result );
7373
}
7474

75-
[TestMethod]
75+
[DataTestMethod]
7676
[DataRow( CompleterType.Immediate, CompilerType.Fast )]
7777
[DataRow( CompleterType.Immediate, CompilerType.System )]
7878
[DataRow( CompleterType.Immediate, CompilerType.Interpret )]
@@ -102,7 +102,7 @@ public async Task AsyncBlock_ShouldAwaitSuccessfully_WithIfThenElseTrueBranch( C
102102
Assert.AreEqual( 1, result );
103103
}
104104

105-
[TestMethod]
105+
[DataTestMethod]
106106
[DataRow( CompleterType.Immediate, CompilerType.Fast )]
107107
[DataRow( CompleterType.Immediate, CompilerType.System )]
108108
[DataRow( CompleterType.Immediate, CompilerType.Interpret )]
@@ -132,7 +132,7 @@ public async Task AsyncBlock_ShouldAwaitSuccessfully_WithIfThenElseFalseBranch(
132132
Assert.AreEqual( 2, result );
133133
}
134134

135-
[TestMethod]
135+
[DataTestMethod]
136136
[DataRow( CompleterType.Immediate, CompilerType.Fast )]
137137
[DataRow( CompleterType.Immediate, CompilerType.System )]
138138
[DataRow( CompleterType.Immediate, CompilerType.Interpret )]
@@ -161,7 +161,7 @@ public async Task AsyncBlock_ShouldAwaitSuccessfully_WithConditionalInTest( Comp
161161
Assert.AreEqual( 1, result );
162162
}
163163

164-
[TestMethod]
164+
[DataTestMethod]
165165
[DataRow( CompleterType.Immediate, CompilerType.Fast )]
166166
[DataRow( CompleterType.Immediate, CompilerType.System )]
167167
[DataRow( CompleterType.Immediate, CompilerType.Interpret )]
@@ -194,7 +194,7 @@ public async Task AsyncBlock_ShouldAwaitSuccessfully_WithAwaitInTrueAndFalseBran
194194
Assert.AreEqual( 10, result ); // Condition is true, so the true branch should be awaited
195195
}
196196

197-
[TestMethod]
197+
[DataTestMethod]
198198
[DataRow( CompleterType.Immediate, CompilerType.Fast )]
199199
[DataRow( CompleterType.Immediate, CompilerType.System )]
200200
[DataRow( CompleterType.Immediate, CompilerType.Interpret )]
@@ -225,7 +225,7 @@ public async Task AsyncBlock_ShouldAwaitSuccessfully_WithAwaitBeforeAndAfterCond
225225
Assert.AreEqual( 15, result ); // Last awaited value should be 15
226226
}
227227

228-
[TestMethod]
228+
[DataTestMethod]
229229
[DataRow( CompleterType.Immediate, CompilerType.Fast )]
230230
[DataRow( CompleterType.Immediate, CompilerType.System )]
231231
[DataRow( CompleterType.Immediate, CompilerType.Interpret )]
@@ -255,7 +255,7 @@ public async Task AsyncBlock_ShouldAwaitSuccessfully_WithFalseCondition( Complet
255255
Assert.AreEqual( 20, result ); // False branch should be awaited and return 20
256256
}
257257

258-
[TestMethod]
258+
[DataTestMethod]
259259
[DataRow( CompleterType.Immediate, CompilerType.Fast )]
260260
[DataRow( CompleterType.Immediate, CompilerType.System )]
261261
[DataRow( CompleterType.Deferred, CompilerType.Fast )]
@@ -295,7 +295,7 @@ public async Task AsyncBlock_ShouldAwaitSuccessfully_WithComplexConditionalLogic
295295
Assert.AreEqual( 2, result ); // Second condition is false, so the false branch returns 2
296296
}
297297

298-
[TestMethod]
298+
[DataTestMethod]
299299
[DataRow( CompleterType.Immediate, CompilerType.Fast )]
300300
[DataRow( CompleterType.Immediate, CompilerType.System )]
301301
[DataRow( CompleterType.Immediate, CompilerType.Interpret )]
@@ -332,7 +332,7 @@ public async Task AsyncBlock_ShouldAwaitSuccessfully_WithNestedConditionals( Com
332332
Assert.AreEqual( 10, result ); // The true branch contains another conditional, false branch executed
333333
}
334334

335-
[TestMethod]
335+
[DataTestMethod]
336336
[DataRow( CompleterType.Immediate, CompilerType.Fast )]
337337
[DataRow( CompleterType.Immediate, CompilerType.System )]
338338
[DataRow( CompleterType.Immediate, CompilerType.Interpret )]
@@ -370,6 +370,7 @@ public async Task AsyncBlock_ShouldAwaitSuccessfully_WithConditionalReturningTas
370370
}
371371

372372
[TestMethod]
373+
[ExpectedException( typeof( NullReferenceException ) )]
373374
public async Task AsyncBlock_ShouldThrowException_WithNullTaskInConditional()
374375
{
375376
// Arrange: One of the branches returns a null task, leading to exception
@@ -384,6 +385,6 @@ public async Task AsyncBlock_ShouldThrowException_WithNullTaskInConditional()
384385
var compiledLambda = lambda.Compile();
385386

386387
// Act & Assert
387-
await Assert.ThrowsExactlyAsync<NullReferenceException>( async () => await compiledLambda() );
388+
await compiledLambda();
388389
}
389390
}

test/Hyperbee.Expressions.Tests/BlockAsyncLoopTests.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ namespace Hyperbee.Expressions.Tests;
77
[TestClass]
88
public class BlockAsyncLoopTests
99
{
10-
[TestMethod]
10+
[DataTestMethod]
1111
[DataRow( CompleterType.Immediate, CompilerType.Fast )]
1212
[DataRow( CompleterType.Immediate, CompilerType.System )]
1313
[DataRow( CompleterType.Immediate, CompilerType.Interpret )]
@@ -49,7 +49,7 @@ public async Task AsyncBlock_ShouldAwaitSuccessfully_WithAwaitBeforeBreak( Compl
4949
Assert.AreEqual( 1, result ); // Loop should break after 1 iteration
5050
}
5151

52-
[TestMethod]
52+
[DataTestMethod]
5353
[DataRow( CompleterType.Immediate, CompilerType.Fast )]
5454
[DataRow( CompleterType.Immediate, CompilerType.System )]
5555
[DataRow( CompleterType.Immediate, CompilerType.Interpret )]
@@ -92,7 +92,7 @@ public async Task AsyncBlock_ShouldAwaitSuccessfully_WithAwaitAfterLoop( Complet
9292
Assert.AreEqual( 2, result ); // Loop breaks after 2 iterations
9393
}
9494

95-
[TestMethod]
95+
[DataTestMethod]
9696
[DataRow( CompleterType.Immediate, CompilerType.Fast )]
9797
[DataRow( CompleterType.Immediate, CompilerType.System )]
9898
[DataRow( CompleterType.Immediate, CompilerType.Interpret )]
@@ -136,7 +136,7 @@ public async Task AsyncBlock_ShouldAwaitSuccessfully_WithAwaitBeforeContinue( Co
136136
Assert.AreEqual( 2, result ); // Loop continues past the first iteration
137137
}
138138

139-
[TestMethod]
139+
[DataTestMethod]
140140
[DataRow( CompleterType.Immediate, CompilerType.Fast )]
141141
[DataRow( CompleterType.Immediate, CompilerType.System )]
142142
[DataRow( CompleterType.Immediate, CompilerType.Interpret )]
@@ -180,7 +180,7 @@ public async Task AsyncBlock_ShouldAwaitSuccessfully_WithAwaitAfterContinue( Com
180180
Assert.AreEqual( 2, result ); // Loop processes all iterations
181181
}
182182

183-
[TestMethod]
183+
[DataTestMethod]
184184
[DataRow( CompleterType.Immediate, CompilerType.Fast )]
185185
[DataRow( CompleterType.Immediate, CompilerType.System )]
186186
[DataRow( CompleterType.Immediate, CompilerType.Interpret )]
@@ -223,7 +223,7 @@ public async Task AsyncBlock_ShouldAwaitSuccessfully_WithMultipleAwaitsInLoop( C
223223
Assert.AreEqual( 1, result ); // Loop processes all iterations
224224
}
225225

226-
[TestMethod]
226+
[DataTestMethod]
227227
[DataRow( CompleterType.Immediate, CompilerType.Fast )]
228228
[DataRow( CompleterType.Immediate, CompilerType.System )]
229229
[DataRow( CompleterType.Immediate, CompilerType.Interpret )]

0 commit comments

Comments
 (0)