Skip to content

Commit fa947b3

Browse files
author
Adrian Hall
committed
(#199) Fix for null reference pointer in DisposeAsync when not running live tests.
1 parent 56c1f9f commit fa947b3

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

tests/CommunityToolkit.Datasync.Server.EntityFrameworkCore.Test/CosmosEntityTableRepository_Tests.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,10 @@ public async Task InitializeAsync()
3131

3232
public async Task DisposeAsync()
3333
{
34-
await Context.DisposeAsync();
34+
if (Context is not null)
35+
{
36+
await Context.DisposeAsync();
37+
}
3538
}
3639

3740
private CosmosDbContext Context { get; set; }

tests/CommunityToolkit.Datasync.Server.Test/Live/Cosmos_Controller_Tests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ protected override Task<string> GetRandomEntityIdAsync(bool exists)
6666
/// We test the 400 Bad Request client-side evaluation error here because Cosmos has more restrictions than most,
6767
/// so it's easier to test the code path.
6868
/// </summary>
69-
[Fact]
69+
[SkippableFact]
7070
public async Task ClientSideEvaluation_Produces_400BadRequest()
7171
{
7272
Skip.IfNot(CanRunLiveTests());

0 commit comments

Comments
 (0)