Skip to content

Commit

Permalink
Add fix for older dotnet versions which are failing in the tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
marabooy committed Sep 9, 2024
1 parent 20cf1e1 commit ebdb79c
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public async Task VerifyConcurrentResultsAreConsistentAsync()
services.AddDefaultODataServices();
ServiceProvider serviceProvider = services.BuildServiceProvider();

await Task.CompletedTask; // Added due to dotnet < 5 as async await cannot be used only in a loop
var content1 = string.Concat(Enumerable.Repeat('A', 1000_000));
var content2 = string.Concat(Enumerable.Repeat('B', 1000_000));
for (int i = 0; i < 1000; i++)
Expand All @@ -54,13 +55,16 @@ private async Task<string> WritePayload(string content, IServiceProvider service

var message = new ODataMessage(outputStream, serviceProvider);
await using ODataMessageWriter writer = new ODataMessageWriter(message);

await Task.Yield();

await writer.WriteValueAsync(content);

outputStream.Position = 0;
using var reader = new StreamReader(outputStream);

await Task.Yield();

string writen = await reader.ReadToEndAsync();
await writer.DisposeAsync();
return writen;
Expand Down

0 comments on commit ebdb79c

Please sign in to comment.