Skip to content

Commit b212cb6

Browse files
authored
migrate testing (#626)
1 parent a262493 commit b212cb6

235 files changed

Lines changed: 2286 additions & 3441 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/integration-tests.yml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,4 @@ jobs:
4141
4242
- name: NHibernate Integration Tests
4343
run: |
44-
dotnet test --blame src/_SampleSystem/_Tests/SampleSystem.IntegrationTests.NHibernate --no-build --verbosity normal;
45-
46-
- name: NHibernate Integration Tests Xunit
47-
run: |
48-
dotnet test --blame src/_SampleSystem/_Tests/SampleSystem.IntegrationTests.Xunit.NHibernate --no-build --verbosity normal;
49-
44+
dotnet test --blame src/_SampleSystem/_Tests/SampleSystem.IntegrationTests.NHibernate --no-build --verbosity normal;

src/.editorconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ indent_style = space
1010
charset = utf-8-bom
1111
trim_trailing_whitespace = true
1212
insert_final_newline = true
13-
max_line_length = 180
13+
max_line_length = 160
1414

1515
# Microsoft .NET properties
1616
csharp_preserve_single_line_blocks = true

src/Application/Framework.Application.Runtime/Repository/Generic/GenericRepository.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public async Task RemoveAsync(TDomainObject domainObject, CancellationToken canc
3535
await dal.RemoveAsync(domainObject, cancellationToken);
3636
}
3737

38-
private Task CheckAccess(TDomainObject domainObject, CancellationToken cancellationToken) =>
38+
private ValueTask CheckAccess(TDomainObject domainObject, CancellationToken cancellationToken) =>
3939
securityProvider.CheckAccessAsync(domainObject, accessDeniedExceptionService, cancellationToken);
4040

4141
public IQueryable<TDomainObject> GetQueryable() => dal.GetQueryable().Pipe(securityProvider.Inject);

src/Application/Framework.Application.Tests/Framework.Application.Tests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
<ItemGroup>
1212
<PackageReference Include="Microsoft.NET.Test.Sdk" />
13-
<PackageReference Include="xunit" />
13+
<PackageReference Include="xunit.v3" />
1414
<PackageReference Include="xunit.runner.visualstudio">
1515
<PrivateAssets>all</PrivateAssets>
1616
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>

src/Application/Framework.Application.Tests/PeriodTests.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@ public void GetFinancialYear_MonthOutOfRange_ThrowArgumentOutOfRangeException(in
4141
var service = new FinancialYearCalculator(new FinancialYearServiceSettings());
4242

4343
// Act
44-
Action action = () => service.GetFinancialYear(2017, month);
44+
var ex = Record.Exception(() => service.GetFinancialYear(2017, month));
4545

4646
// Assert
47-
Assert.Throws<ArgumentOutOfRangeException>(action);
47+
Assert.IsType<ArgumentOutOfRangeException>(ex);
4848
}
4949

5050
/// <summary>
@@ -61,9 +61,9 @@ public void GetFinancialYear_YearOutOfRange_ThrowArgumentOutOfRangeException(int
6161
var service = new FinancialYearCalculator(new FinancialYearServiceSettings());
6262

6363
// Act
64-
Action action = () => service.GetFinancialYear(year, month);
64+
var ex = Record.Exception(() => service.GetFinancialYear(year, month));
6565

6666
// Assert
67-
Assert.Throws<ArgumentOutOfRangeException>(action);
67+
Assert.IsType<ArgumentOutOfRangeException>(ex);
6868
}
6969
}

src/AutomationCore/Framework.AutomationCore.ServiceEnvironment.LegacyContext/Framework.AutomationCore.ServiceEnvironment.LegacyContext.csproj renamed to src/AutomationCore/Framework.AutomationCore.Legacy/Framework.AutomationCore.Legacy.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<PackageId>Luxoft.Framework.AutomationCore.ServiceEnvironment.LegacyContext</PackageId>
4+
<PackageId>Luxoft.Framework.AutomationCore.Legacy</PackageId>
55
<RootNamespace>Framework.AutomationCore</RootNamespace>
66
</PropertyGroup>
77

@@ -15,7 +15,7 @@
1515

1616
<ProjectReference Include="..\..\_Authorization\Framework.Authorization.WebApi\Framework.Authorization.WebApi.csproj" />
1717

18-
<ProjectReference Include="..\Framework.AutomationCore.ServiceEnvironment\Framework.AutomationCore.ServiceEnvironment.csproj" />
18+
<ProjectReference Include="..\Framework.AutomationCore\Framework.AutomationCore.csproj" />
1919
</ItemGroup>
2020

2121
</Project>

src/AutomationCore/Framework.AutomationCore.ServiceEnvironment.LegacyContext/IntegrationTestBase.cs renamed to src/AutomationCore/Framework.AutomationCore.Legacy/IntegrationTestBase.cs

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
using Framework.Application;
44
using Framework.Application.Repository;
55
using Framework.AutomationCore.RootServiceProviderContainer;
6-
using Framework.AutomationCore.ServiceProviderPool;
76
using Framework.BLL.DTOMapping.Domain;
87
using Framework.Configuration.BLL;
98
using Framework.Configuration.Domain;
@@ -18,23 +17,22 @@
1817

1918
namespace Framework.AutomationCore;
2019

21-
public abstract class IntegrationTestBase<TBLLContext>(IServiceProviderPool rootServiceProviderPool)
22-
: IntegrationTestBase(rootServiceProviderPool), IRootServiceProviderContainer<TBLLContext>
20+
public abstract class IntegrationTestBase<TBLLContext>(IServiceProvider rootServiceProvider) : RootServiceProviderContainer<TBLLContext>(rootServiceProvider)
2321
where TBLLContext : IServiceProviderContainer
2422
{
2523
public Task<TResult> EvaluateAsync<TResult>(
2624
DBSessionMode sessionMode,
2725
UserCredential? customUserCredential,
2826
Func<TBLLContext, Task<TResult>> getResult) =>
29-
this.RootServiceProvider.GetRequiredService<IServiceEvaluator<TBLLContext>>().EvaluateAsync(sessionMode, customUserCredential, getResult);
27+
rootServiceProvider.GetRequiredService<IServiceEvaluator<TBLLContext>>().EvaluateAsync(sessionMode, customUserCredential, getResult);
3028

3129

3230
protected IConfigurationBLLContext GetConfigurationBLLContext(TBLLContext context) => context.ServiceProvider.GetRequiredService<IConfigurationBLLContext>();
3331

3432
/// <summary>
3533
/// Отчистка списка нотифицаций
3634
/// </summary>
37-
public override void ClearNotifications() =>
35+
public virtual void ClearNotifications() =>
3836
this.EvaluateWrite(context => this.GetConfigurationBLLContext(context).Logics.DomainObjectNotification.Pipe(bll => bll.GetFullList().ForEach(bll.Remove)));
3937

4038
/// <summary>
@@ -46,12 +44,12 @@ protected virtual List<ObjectModificationInfoDTO<Guid>> GetModifications() =>
4644

4745
this.GetConfigurationBLLContext(context).Logics.DomainObjectModification.GetFullList()
4846
.ToList(mod => new ObjectModificationInfoDTO<Guid>
49-
{
50-
Identity = mod.DomainObjectId,
51-
ModificationType = mod.Type,
52-
Revision = mod.Revision,
53-
TypeInfoDescription = new TypeInfoDescriptionDTO { Name = mod.DomainType.Name, Namespace = mod.DomainType.Namespace }
54-
}));
47+
{
48+
Identity = mod.DomainObjectId,
49+
ModificationType = mod.Type,
50+
Revision = mod.Revision,
51+
TypeInfoDescription = new TypeInfoDescriptionDTO { Name = mod.DomainType.Name, Namespace = mod.DomainType.Namespace }
52+
}));
5553

5654
/// <summary>
5755
/// Отчистка списка модификаций
@@ -62,7 +60,7 @@ protected virtual void ClearModifications() =>
6260
/// <summary>
6361
/// Отчистка интеграционных евентов
6462
/// </summary>
65-
public override void ClearIntegrationEvents()
63+
public virtual void ClearIntegrationEvents()
6664
{
6765
this.ClearModifications();
6866

src/AutomationCore/Framework.AutomationCore.ServiceEnvironment.LegacyContext/RootServiceProviderContainer/ContextEvaluatorExtensions.cs renamed to src/AutomationCore/Framework.AutomationCore.Legacy/RootServiceProviderContainer/ContextEvaluatorExtensions.cs

File renamed without changes.

src/AutomationCore/Framework.AutomationCore.ServiceEnvironment.LegacyContext/RootServiceProviderContainer/ContextEvaluatorWithMappingExtensions.cs renamed to src/AutomationCore/Framework.AutomationCore.Legacy/RootServiceProviderContainer/ContextEvaluatorWithMappingExtensions.cs

File renamed without changes.

src/AutomationCore/Framework.AutomationCore.ServiceEnvironment.LegacyContext/RootServiceProviderContainer/IRootServiceProviderContainer.cs renamed to src/AutomationCore/Framework.AutomationCore.Legacy/RootServiceProviderContainer/IRootServiceProviderContainer.cs

File renamed without changes.

0 commit comments

Comments
 (0)