From 80a05c58094ee0e69721f22c886cb1e10d6fdf4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zolt=C3=A1n=20Leh=C3=B3czky?= Date: Mon, 12 Dec 2022 22:56:12 +0100 Subject: [PATCH 1/2] Removing sync over async --- .../Services/ManualConnectingIndexServiceFixture.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Lombiq.HelpfulLibraries.Tests/UnitTests/Services/ManualConnectingIndexServiceFixture.cs b/Lombiq.HelpfulLibraries.Tests/UnitTests/Services/ManualConnectingIndexServiceFixture.cs index 5e62da1b..fee826c2 100644 --- a/Lombiq.HelpfulLibraries.Tests/UnitTests/Services/ManualConnectingIndexServiceFixture.cs +++ b/Lombiq.HelpfulLibraries.Tests/UnitTests/Services/ManualConnectingIndexServiceFixture.cs @@ -37,9 +37,6 @@ public ManualConnectingIndexServiceFixture() .Range(0, 10) .Select(n => new TestDocument { Name = NamePrefix + n.ToTechnicalString() }) .ToArray(); - - if (File.Exists(FileName)) File.Delete(FileName); - CreateDatabaseAsync().Wait(); } public async Task SessionAsync(Func action) @@ -59,6 +56,8 @@ public async Task SessionAsync(Func action) private async Task CreateDatabaseAsync() { + if (File.Exists(FileName)) File.Delete(FileName); + Store = (Store)await StoreFactory.CreateAndInitializeAsync(_configuration); var dbAccessorMock = new Mock(); dbAccessorMock.Setup(x => x.CreateConnection()) From e4ff56c8685581b7a1383783744378e824125498 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zolt=C3=A1n=20Leh=C3=B3czky?= Date: Mon, 12 Dec 2022 22:56:22 +0100 Subject: [PATCH 2/2] No single-letter variable names --- .../UnitTests/Services/ManualConnectingIndexServiceTests.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Lombiq.HelpfulLibraries.Tests/UnitTests/Services/ManualConnectingIndexServiceTests.cs b/Lombiq.HelpfulLibraries.Tests/UnitTests/Services/ManualConnectingIndexServiceTests.cs index ba3a88e9..62144271 100644 --- a/Lombiq.HelpfulLibraries.Tests/UnitTests/Services/ManualConnectingIndexServiceTests.cs +++ b/Lombiq.HelpfulLibraries.Tests/UnitTests/Services/ManualConnectingIndexServiceTests.cs @@ -36,15 +36,15 @@ public Task AllIndexShouldRetrieveItsDocument() => _fixture.SessionAsync(async s var query = session.Query(index => index.Number.IsIn(numbers)); var list = await query.ListAsync(); var documents = list.ToList(); - documents.Select(x => x.Name) - .ShouldBe(_fixture.Documents.Where((_, index) => index is not 3 and not 6).Select(x => x.Name)); + documents.Select(document => document.Name) + .ShouldBe(_fixture.Documents.Where((_, index) => index is not 3 and not 6).Select(document => document.Name)); }); [Fact] public Task MissingOrDeletedIndexShouldNotRetrieveAnyDocument() => _fixture.SessionAsync(async session => { var numbers = new[] { 3, 6 }; - var documents = (await session.Query(x => x.Number.IsIn(numbers)).ListAsync()).ToList(); + var documents = (await session.Query(index => index.Number.IsIn(numbers)).ListAsync()).ToList(); documents.ShouldBeEmpty(); }); }