Skip to content

Commit 578670b

Browse files
author
Adrian Hall
committed
(#199) Switch to sync-over-async in the Cosmos driver for initialization.
1 parent 6cc46bd commit 578670b

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

tests/CommunityToolkit.Datasync.TestCommon/Databases/CosmosDb/CosmosDbContext.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@
22
// The .NET Foundation licenses this file to you under the MIT license.
33
// See the LICENSE file in the project root for more information.
44

5-
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
65
using Microsoft.EntityFrameworkCore;
6+
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
77
using Xunit.Abstractions;
8-
using Microsoft.EntityFrameworkCore.Diagnostics;
98

109
namespace CommunityToolkit.Datasync.TestCommon.Databases;
1110

@@ -33,7 +32,10 @@ internal void InitializeDatabase(bool clearEntities)
3332
{
3433
if (clearEntities)
3534
{
36-
RemoveRange(Movies.ToList());
35+
// NOTE: sync-over-async is used here. This is bad, but it is only used in the test suite.
36+
// The test suite is not performance sensitive, so this is acceptable.
37+
List<CosmosEntityMovie> movies = Movies.ToListAsync().Result;
38+
RemoveRange(movies);
3739
SaveChanges();
3840
}
3941
}

0 commit comments

Comments
 (0)