This repository has been archived by the owner on Aug 13, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #206 from itmo-is-dev/fix/querying
fix: multiple operations error
- Loading branch information
Showing
47 changed files
with
417 additions
and
503 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
using ITMO.Dev.ASAP.Application.DataAccess; | ||
using ITMO.Dev.ASAP.DataAccess.Contexts; | ||
using ITMO.Dev.ASAP.Seeding.Extensions; | ||
using ITMO.Dev.ASAP.Tests.Core.Fixtures; | ||
using Microsoft.Extensions.DependencyInjection; | ||
using Xunit; | ||
using Xunit.Abstractions; | ||
|
||
namespace ITMO.Dev.ASAP.Tests.Core; | ||
|
||
public class CoreDatabaseTestBase : CoreTestBase, IAsyncLifetime | ||
{ | ||
private AsyncServiceScope _scope; | ||
|
||
protected CoreDatabaseTestBase(CoreDatabaseFixture fixture, ITestOutputHelper? output = null) : base(output) | ||
{ | ||
Fixture = fixture; | ||
} | ||
|
||
protected DatabaseContext Context { get; private set; } = null!; | ||
|
||
protected IPersistenceContext PersistenceContext { get; private set; } = null!; | ||
|
||
protected CoreDatabaseFixture Fixture { get; } | ||
|
||
public async Task InitializeAsync() | ||
{ | ||
_scope = Fixture.CreateAsyncScope(); | ||
|
||
await _scope.UseDatabaseSeeders<TestDatabaseContext>(); | ||
Context = _scope.ServiceProvider.GetRequiredService<TestDatabaseContext>(); | ||
PersistenceContext = _scope.ServiceProvider.GetRequiredService<IPersistenceContext>(); | ||
} | ||
|
||
public async Task DisposeAsync() | ||
{ | ||
await Fixture.ResetAsync(); | ||
await _scope.DisposeAsync(); | ||
} | ||
|
||
protected T GetRequiredService<T>() where T : class | ||
{ | ||
return _scope.ServiceProvider.GetRequiredService<T>(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
tests/ITMO.Dev.ASAP.Tests.Core/Fixtures/TestDatabaseContext.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
using ITMO.Dev.ASAP.DataAccess.Contexts; | ||
using Microsoft.EntityFrameworkCore; | ||
|
||
namespace ITMO.Dev.ASAP.Tests.Core.Fixtures; | ||
|
||
public class TestDatabaseContext : DatabaseContext | ||
{ | ||
public TestDatabaseContext(DbContextOptions<TestDatabaseContext> options) : base(options) { } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.