Skip to content

Commit 0e09973

Browse files
committed
Fix generated test code
1 parent af9d4c4 commit 0e09973

File tree

1 file changed

+11
-11
lines changed
  • src/Http/Http.Results/tools/ResultsOfTGenerator

1 file changed

+11
-11
lines changed

src/Http/Http.Results/tools/ResultsOfTGenerator/Program.cs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ public class Program
1212

1313
public static void Main(string[] args)
1414
{
15-
// By default we assume we're being run in the context of the <repo>/src/Http/Http.Results/src
15+
// By default we assume we're being run in the context of the <repo>/src/Http/Http.Results/tools/ResultsOfTGenerator directory
1616
var pwd = Directory.GetCurrentDirectory();
17-
var classTargetFilePath = Path.Combine(pwd, "ResultsOfT.Generated.cs");
18-
var testsTargetFilePath = Path.Combine(pwd, "..", "test", "ResultsOfTTests.Generated.cs");
17+
var classTargetFilePath = Path.Combine(pwd, "..", "..", "src", "ResultsOfT.Generated.cs");
18+
var testsTargetFilePath = Path.Combine(pwd, "..", "..", "test", "ResultsOfTTests.Generated.cs");
1919

2020
if (args.Length > 0)
2121
{
@@ -482,7 +482,7 @@ static void GenerateTest_ExecuteResult_ExecutesAssignedResult(StreamWriter write
482482
static void GenerateTest_Throws_ArgumentNullException_WhenHttpContextIsNull(StreamWriter writer, int typeArgNumber)
483483
{
484484
//[Fact]
485-
//public void ResultsOfTResult1TResult2_Throws_ArgumentNullException_WhenHttpContextIsNull()
485+
//public async Task ResultsOfTResult1TResult2_Throws_ArgumentNullException_WhenHttpContextIsNull()
486486
//{
487487
// // Arrange
488488
// Results<ChecksumResult1, NoContent> MyApi()
@@ -494,7 +494,7 @@ static void GenerateTest_Throws_ArgumentNullException_WhenHttpContextIsNull(Stre
494494
// // Act & Assert
495495
// var result = MyApi();
496496

497-
// Assert.ThrowsAsync<ArgumentNullException>(async () =>
497+
// await Assert.ThrowsAsync<ArgumentNullException>(async () =>
498498
// {
499499
// await result.ExecuteAsync(httpContext);
500500
// });
@@ -504,7 +504,7 @@ static void GenerateTest_Throws_ArgumentNullException_WhenHttpContextIsNull(Stre
504504
writer.WriteIndentedLine("[Fact]");
505505

506506
// Start method
507-
writer.WriteIndent(1, "public void ResultsOf");
507+
writer.WriteIndent(1, "public async Task ResultsOf");
508508
for (int j = 1; j <= typeArgNumber; j++)
509509
{
510510
writer.Write($"TResult{j}");
@@ -526,7 +526,7 @@ static void GenerateTest_Throws_ArgumentNullException_WhenHttpContextIsNull(Stre
526526
writer.WriteIndentedLine(2, "var result = MyApi();");
527527
writer.WriteLine();
528528

529-
writer.WriteIndentedLine(2, "Assert.ThrowsAsync<ArgumentNullException>(async () =>");
529+
writer.WriteIndentedLine(2, "await Assert.ThrowsAsync<ArgumentNullException>(async () =>");
530530
writer.WriteIndentedLine(2, "{");
531531
writer.WriteIndentedLine(3, "await result.ExecuteAsync(httpContext);");
532532
writer.WriteIndentedLine(2, "});");
@@ -539,7 +539,7 @@ static void GenerateTest_Throws_ArgumentNullException_WhenHttpContextIsNull(Stre
539539
static void GenerateTest_Throws_InvalidOperationException_WhenResultIsNull(StreamWriter writer, int typeArgNumber)
540540
{
541541
//[Fact]
542-
//public void ResultsOfTResult1TResult2_Throws_InvalidOperationException_WhenResultIsNull()
542+
//public async Task ResultsOfTResult1TResult2_Throws_InvalidOperationException_WhenResultIsNull()
543543
//{
544544
// // Arrange
545545
// Results<ChecksumResult1, NoContent> MyApi()
@@ -551,7 +551,7 @@ static void GenerateTest_Throws_InvalidOperationException_WhenResultIsNull(Strea
551551
// // Act & Assert
552552
// var result = MyApi();
553553

554-
// Assert.ThrowsAsync<InvalidOperationException>(async () =>
554+
// await Assert.ThrowsAsync<InvalidOperationException>(async () =>
555555
// {
556556
// await result.ExecuteAsync(httpContext);
557557
// });
@@ -561,7 +561,7 @@ static void GenerateTest_Throws_InvalidOperationException_WhenResultIsNull(Strea
561561
writer.WriteIndentedLine("[Fact]");
562562

563563
// Start method
564-
writer.WriteIndent(1, "public void ResultsOf");
564+
writer.WriteIndent(1, "public async Task ResultsOf");
565565
for (int j = 1; j <= typeArgNumber; j++)
566566
{
567567
writer.Write($"TResult{j}");
@@ -583,7 +583,7 @@ static void GenerateTest_Throws_InvalidOperationException_WhenResultIsNull(Strea
583583
writer.WriteIndentedLine(2, "var result = MyApi();");
584584
writer.WriteLine();
585585

586-
writer.WriteIndentedLine(2, "Assert.ThrowsAsync<InvalidOperationException>(async () =>");
586+
writer.WriteIndentedLine(2, "await Assert.ThrowsAsync<InvalidOperationException>(async () =>");
587587
writer.WriteIndentedLine(2, "{");
588588
writer.WriteIndentedLine(3, "await result.ExecuteAsync(httpContext);");
589589
writer.WriteIndentedLine(2, "});");

0 commit comments

Comments
 (0)