diff --git a/WebApiService/Win_in.Sfs.Scp.WebApi.sln b/WebApiService/Win_in.Sfs.Scp.WebApi.sln index 30146b0..b269719 100644 --- a/WebApiService/Win_in.Sfs.Scp.WebApi.sln +++ b/WebApiService/Win_in.Sfs.Scp.WebApi.sln @@ -11,10 +11,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Win_in.Sfs.Scp.WebApi.Entit EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{CA9AC87F-097E-4F15-8393-4BC07735A5B0}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{04DBDB01-70F4-4E06-B468-8F87850B22BE}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Win_in.Sfs.Scp.WebApi.Application.Tests", "test\Win_in.Sfs.Scp.WebApi.Application.Tests\Win_in.Sfs.Scp.WebApi.Application.Tests.csproj", "{50B2631D-129C-47B3-A587-029CCD6099BC}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Win_in.Sfs.Scp.WebApi.Domain.Shared", "src\Win_in.Sfs.Scp.WebApi.Domain.Shared\Win_in.Sfs.Scp.WebApi.Domain.Shared.csproj", "{42F719ED-8413-4895-B5B4-5AB56079BC66}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Win_in.Sfs.Scp.WebApi.Application.Contracts", "src\Win_in.Sfs.Scp.WebApi.Application.Contracts\Win_in.Sfs.Scp.WebApi.Application.Contracts.csproj", "{520659C8-C734-4298-A3DA-B539DB9DFC0B}" @@ -23,14 +19,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Win_in.Sfs.Scp.WebApi.HttpA EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Win_in.Sfs.Scp.WebApi.HttpApi.Client", "src\Win_in.Sfs.Scp.WebApi.HttpApi.Client\Win_in.Sfs.Scp.WebApi.HttpApi.Client.csproj", "{3B5A0094-670D-4BB1-BFDD-61B88A8773DC}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Win_in.Sfs.Scp.WebApi.EntityFrameworkCore.Tests", "test\Win_in.Sfs.Scp.WebApi.EntityFrameworkCore.Tests\Win_in.Sfs.Scp.WebApi.EntityFrameworkCore.Tests.csproj", "{1FE30EB9-74A9-47F5-A9F6-7B1FAB672D81}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Win_in.Sfs.Scp.WebApi.TestBase", "test\Win_in.Sfs.Scp.WebApi.TestBase\Win_in.Sfs.Scp.WebApi.TestBase.csproj", "{91853F21-9CD9-4132-BC29-A7D5D84FFFE7}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Win_in.Sfs.Scp.WebApi.Domain.Tests", "test\Win_in.Sfs.Scp.WebApi.Domain.Tests\Win_in.Sfs.Scp.WebApi.Domain.Tests.csproj", "{E512F4D9-9375-480F-A2F6-A46509F9D824}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Win_in.Sfs.Scp.WebApi.HttpApi.Client.ConsoleTestApp", "test\Win_in.Sfs.Scp.WebApi.HttpApi.Client.ConsoleTestApp\Win_in.Sfs.Scp.WebApi.HttpApi.Client.ConsoleTestApp.csproj", "{EF480016-9127-4916-8735-D2466BDBC582}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Win_in.Sfs.Scp.WebApi.DbMigrator", "src\Win_in.Sfs.Scp.WebApi.DbMigrator\Win_in.Sfs.Scp.WebApi.DbMigrator.csproj", "{AA94D832-1CCC-4715-95A9-A483F23A1A5D}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Win_in.Sfs.Scp.WebApi.HttpApi.Host", "src\Win_in.Sfs.Scp.WebApi.HttpApi.Host\Win_in.Sfs.Scp.WebApi.HttpApi.Host.csproj", "{748584B1-BA69-4F6A-81AA-F4BDE6BCE29D}" @@ -73,10 +61,6 @@ Global {C956DD76-69C8-4A9C-83EA-D17DF83340FD}.Debug|Any CPU.Build.0 = Debug|Any CPU {C956DD76-69C8-4A9C-83EA-D17DF83340FD}.Release|Any CPU.ActiveCfg = Release|Any CPU {C956DD76-69C8-4A9C-83EA-D17DF83340FD}.Release|Any CPU.Build.0 = Release|Any CPU - {50B2631D-129C-47B3-A587-029CCD6099BC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {50B2631D-129C-47B3-A587-029CCD6099BC}.Debug|Any CPU.Build.0 = Debug|Any CPU - {50B2631D-129C-47B3-A587-029CCD6099BC}.Release|Any CPU.ActiveCfg = Release|Any CPU - {50B2631D-129C-47B3-A587-029CCD6099BC}.Release|Any CPU.Build.0 = Release|Any CPU {42F719ED-8413-4895-B5B4-5AB56079BC66}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {42F719ED-8413-4895-B5B4-5AB56079BC66}.Debug|Any CPU.Build.0 = Debug|Any CPU {42F719ED-8413-4895-B5B4-5AB56079BC66}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -93,22 +77,6 @@ Global {3B5A0094-670D-4BB1-BFDD-61B88A8773DC}.Debug|Any CPU.Build.0 = Debug|Any CPU {3B5A0094-670D-4BB1-BFDD-61B88A8773DC}.Release|Any CPU.ActiveCfg = Release|Any CPU {3B5A0094-670D-4BB1-BFDD-61B88A8773DC}.Release|Any CPU.Build.0 = Release|Any CPU - {1FE30EB9-74A9-47F5-A9F6-7B1FAB672D81}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {1FE30EB9-74A9-47F5-A9F6-7B1FAB672D81}.Debug|Any CPU.Build.0 = Debug|Any CPU - {1FE30EB9-74A9-47F5-A9F6-7B1FAB672D81}.Release|Any CPU.ActiveCfg = Release|Any CPU - {1FE30EB9-74A9-47F5-A9F6-7B1FAB672D81}.Release|Any CPU.Build.0 = Release|Any CPU - {91853F21-9CD9-4132-BC29-A7D5D84FFFE7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {91853F21-9CD9-4132-BC29-A7D5D84FFFE7}.Debug|Any CPU.Build.0 = Debug|Any CPU - {91853F21-9CD9-4132-BC29-A7D5D84FFFE7}.Release|Any CPU.ActiveCfg = Release|Any CPU - {91853F21-9CD9-4132-BC29-A7D5D84FFFE7}.Release|Any CPU.Build.0 = Release|Any CPU - {E512F4D9-9375-480F-A2F6-A46509F9D824}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {E512F4D9-9375-480F-A2F6-A46509F9D824}.Debug|Any CPU.Build.0 = Debug|Any CPU - {E512F4D9-9375-480F-A2F6-A46509F9D824}.Release|Any CPU.ActiveCfg = Release|Any CPU - {E512F4D9-9375-480F-A2F6-A46509F9D824}.Release|Any CPU.Build.0 = Release|Any CPU - {EF480016-9127-4916-8735-D2466BDBC582}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {EF480016-9127-4916-8735-D2466BDBC582}.Debug|Any CPU.Build.0 = Debug|Any CPU - {EF480016-9127-4916-8735-D2466BDBC582}.Release|Any CPU.ActiveCfg = Release|Any CPU - {EF480016-9127-4916-8735-D2466BDBC582}.Release|Any CPU.Build.0 = Release|Any CPU {AA94D832-1CCC-4715-95A9-A483F23A1A5D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {AA94D832-1CCC-4715-95A9-A483F23A1A5D}.Debug|Any CPU.Build.0 = Debug|Any CPU {AA94D832-1CCC-4715-95A9-A483F23A1A5D}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -149,15 +117,10 @@ Global {554AD327-6DBA-4F8F-96F8-81CE7A0C863F} = {A79A01B2-9532-4C6B-880F-193251F3B9F3} {1A94A50E-06DC-43C1-80B5-B662820EC3EB} = {A79A01B2-9532-4C6B-880F-193251F3B9F3} {C956DD76-69C8-4A9C-83EA-D17DF83340FD} = {A79A01B2-9532-4C6B-880F-193251F3B9F3} - {50B2631D-129C-47B3-A587-029CCD6099BC} = {04DBDB01-70F4-4E06-B468-8F87850B22BE} {42F719ED-8413-4895-B5B4-5AB56079BC66} = {A79A01B2-9532-4C6B-880F-193251F3B9F3} {520659C8-C734-4298-A3DA-B539DB9DFC0B} = {A79A01B2-9532-4C6B-880F-193251F3B9F3} {4164BDF7-F527-4E85-9CE6-E3C2D7426A27} = {A79A01B2-9532-4C6B-880F-193251F3B9F3} {3B5A0094-670D-4BB1-BFDD-61B88A8773DC} = {A79A01B2-9532-4C6B-880F-193251F3B9F3} - {1FE30EB9-74A9-47F5-A9F6-7B1FAB672D81} = {04DBDB01-70F4-4E06-B468-8F87850B22BE} - {91853F21-9CD9-4132-BC29-A7D5D84FFFE7} = {04DBDB01-70F4-4E06-B468-8F87850B22BE} - {E512F4D9-9375-480F-A2F6-A46509F9D824} = {04DBDB01-70F4-4E06-B468-8F87850B22BE} - {EF480016-9127-4916-8735-D2466BDBC582} = {04DBDB01-70F4-4E06-B468-8F87850B22BE} {AA94D832-1CCC-4715-95A9-A483F23A1A5D} = {A79A01B2-9532-4C6B-880F-193251F3B9F3} {748584B1-BA69-4F6A-81AA-F4BDE6BCE29D} = {44A92E7C-E2FC-4F37-AF3D-6B7213EF54FE} {3EE98133-3E7A-4B14-A515-12CB039A9EED} = {925EA68F-25D1-444F-A79B-EB9BF754EC3C} diff --git a/WebApiService/test/Win_in.Sfs.Scp.WebApi.Application.Tests/Samples/SampleAppServiceTests.cs b/WebApiService/test/Win_in.Sfs.Scp.WebApi.Application.Tests/Samples/SampleAppServiceTests.cs deleted file mode 100644 index cc6f97b..0000000 --- a/WebApiService/test/Win_in.Sfs.Scp.WebApi.Application.Tests/Samples/SampleAppServiceTests.cs +++ /dev/null @@ -1,33 +0,0 @@ -using Shouldly; -using System.Threading.Tasks; -using Volo.Abp.Identity; -using Xunit; - -namespace Win_in.Sfs.Scp.WebApi.Samples -{ - /* This is just an example test class. - * Normally, you don't test code of the modules you are using - * (like IIdentityUserAppService here). - * Only test your own application services. - */ - public class SampleAppServiceTests : WebApiApplicationTestBase - { - private readonly IIdentityUserAppService _userAppService; - - public SampleAppServiceTests() - { - _userAppService = GetRequiredService(); - } - - [Fact] - public async Task Initial_Data_Should_Contain_Admin_User() - { - //Act - var result = await _userAppService.GetListAsync(new GetIdentityUsersInput()); - - //Assert - result.TotalCount.ShouldBeGreaterThan(0); - result.Items.ShouldContain(u => u.UserName == "admin"); - } - } -} diff --git a/WebApiService/test/Win_in.Sfs.Scp.WebApi.Application.Tests/WebApiApplicationTestBase.cs b/WebApiService/test/Win_in.Sfs.Scp.WebApi.Application.Tests/WebApiApplicationTestBase.cs deleted file mode 100644 index 67bd6b4..0000000 --- a/WebApiService/test/Win_in.Sfs.Scp.WebApi.Application.Tests/WebApiApplicationTestBase.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace Win_in.Sfs.Scp.WebApi -{ - public abstract class WebApiApplicationTestBase : WebApiTestBase - { - - } -} diff --git a/WebApiService/test/Win_in.Sfs.Scp.WebApi.Application.Tests/WebApiApplicationTestModule.cs b/WebApiService/test/Win_in.Sfs.Scp.WebApi.Application.Tests/WebApiApplicationTestModule.cs deleted file mode 100644 index 6b1b9cd..0000000 --- a/WebApiService/test/Win_in.Sfs.Scp.WebApi.Application.Tests/WebApiApplicationTestModule.cs +++ /dev/null @@ -1,13 +0,0 @@ -using Volo.Abp.Modularity; - -namespace Win_in.Sfs.Scp.WebApi -{ - [DependsOn( - typeof(WebApiApplicationModule), - typeof(WebApiDomainTestModule) - )] - public class WebApiApplicationTestModule : AbpModule - { - - } -} \ No newline at end of file diff --git a/WebApiService/test/Win_in.Sfs.Scp.WebApi.Application.Tests/Win_in.Sfs.Scp.WebApi.Application.Tests.csproj b/WebApiService/test/Win_in.Sfs.Scp.WebApi.Application.Tests/Win_in.Sfs.Scp.WebApi.Application.Tests.csproj deleted file mode 100644 index 8e3a026..0000000 --- a/WebApiService/test/Win_in.Sfs.Scp.WebApi.Application.Tests/Win_in.Sfs.Scp.WebApi.Application.Tests.csproj +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - net5.0 - Win_in.Sfs.Scp.WebApi - - - - - - - - - - - - diff --git a/WebApiService/test/Win_in.Sfs.Scp.WebApi.Domain.Tests/Samples/SampleDomainTests.cs b/WebApiService/test/Win_in.Sfs.Scp.WebApi.Domain.Tests/Samples/SampleDomainTests.cs deleted file mode 100644 index dc00daa..0000000 --- a/WebApiService/test/Win_in.Sfs.Scp.WebApi.Domain.Tests/Samples/SampleDomainTests.cs +++ /dev/null @@ -1,45 +0,0 @@ -using System.Threading.Tasks; -using Shouldly; -using Volo.Abp.Identity; -using Xunit; - -namespace Win_in.Sfs.Scp.WebApi.Samples -{ - /* This is just an example test class. - * Normally, you don't test code of the modules you are using - * (like IdentityUserManager here). - * Only test your own domain services. - */ - public class SampleDomainTests : WebApiDomainTestBase - { - private readonly IIdentityUserRepository _identityUserRepository; - private readonly IdentityUserManager _identityUserManager; - - public SampleDomainTests() - { - _identityUserRepository = GetRequiredService(); - _identityUserManager = GetRequiredService(); - } - - [Fact] - public async Task Should_Set_Email_Of_A_User() - { - IdentityUser adminUser; - - /* Need to manually start Unit Of Work because - * FirstOrDefaultAsync should be executed while db connection / context is available. - */ - await WithUnitOfWorkAsync(async () => - { - adminUser = await _identityUserRepository - .FindByNormalizedUserNameAsync("ADMIN"); - - await _identityUserManager.SetEmailAsync(adminUser, "newemail@abp.io"); - await _identityUserRepository.UpdateAsync(adminUser); - }); - - adminUser = await _identityUserRepository.FindByNormalizedUserNameAsync("ADMIN"); - adminUser.Email.ShouldBe("newemail@abp.io"); - } - } -} diff --git a/WebApiService/test/Win_in.Sfs.Scp.WebApi.Domain.Tests/WebApiDomainTestBase.cs b/WebApiService/test/Win_in.Sfs.Scp.WebApi.Domain.Tests/WebApiDomainTestBase.cs deleted file mode 100644 index 9959115..0000000 --- a/WebApiService/test/Win_in.Sfs.Scp.WebApi.Domain.Tests/WebApiDomainTestBase.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace Win_in.Sfs.Scp.WebApi -{ - public abstract class WebApiDomainTestBase : WebApiTestBase - { - - } -} diff --git a/WebApiService/test/Win_in.Sfs.Scp.WebApi.Domain.Tests/WebApiDomainTestModule.cs b/WebApiService/test/Win_in.Sfs.Scp.WebApi.Domain.Tests/WebApiDomainTestModule.cs deleted file mode 100644 index 1bc421a..0000000 --- a/WebApiService/test/Win_in.Sfs.Scp.WebApi.Domain.Tests/WebApiDomainTestModule.cs +++ /dev/null @@ -1,13 +0,0 @@ -using Win_in.Sfs.Scp.WebApi.EntityFrameworkCore; -using Volo.Abp.Modularity; - -namespace Win_in.Sfs.Scp.WebApi -{ - [DependsOn( - typeof(WebApiEntityFrameworkCoreTestModule) - )] - public class WebApiDomainTestModule : AbpModule - { - - } -} \ No newline at end of file diff --git a/WebApiService/test/Win_in.Sfs.Scp.WebApi.Domain.Tests/Win_in.Sfs.Scp.WebApi.Domain.Tests.csproj b/WebApiService/test/Win_in.Sfs.Scp.WebApi.Domain.Tests/Win_in.Sfs.Scp.WebApi.Domain.Tests.csproj deleted file mode 100644 index 116c1ac..0000000 --- a/WebApiService/test/Win_in.Sfs.Scp.WebApi.Domain.Tests/Win_in.Sfs.Scp.WebApi.Domain.Tests.csproj +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - net5.0 - Win_in.Sfs.Scp.WebApi - - - - - - - - - - - diff --git a/WebApiService/test/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore.Tests/EntityFrameworkCore/Samples/SampleRepositoryTests.cs b/WebApiService/test/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore.Tests/EntityFrameworkCore/Samples/SampleRepositoryTests.cs deleted file mode 100644 index e8c9094..0000000 --- a/WebApiService/test/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore.Tests/EntityFrameworkCore/Samples/SampleRepositoryTests.cs +++ /dev/null @@ -1,44 +0,0 @@ -using Microsoft.EntityFrameworkCore; -using Shouldly; -using System; -using System.Linq; -using System.Threading.Tasks; -using Volo.Abp.Domain.Repositories; -using Volo.Abp.Identity; -using Xunit; - -namespace Win_in.Sfs.Scp.WebApi.EntityFrameworkCore.Samples -{ - /* This is just an example test class. - * Normally, you don't test ABP framework code - * (like default AppUser repository IRepository here). - * Only test your custom repository methods. - */ - public class SampleRepositoryTests : WebApiEntityFrameworkCoreTestBase - { - private readonly IRepository _appUserRepository; - - public SampleRepositoryTests() - { - _appUserRepository = GetRequiredService>(); - } - - [Fact] - public async Task Should_Query_AppUser() - { - /* Need to manually start Unit Of Work because - * FirstOrDefaultAsync should be executed while db connection / context is available. - */ - await WithUnitOfWorkAsync(async () => - { - //Act - var adminUser = await (await _appUserRepository.GetQueryableAsync()) - .Where(u => u.UserName == "admin") - .FirstOrDefaultAsync(); - - //Assert - adminUser.ShouldNotBeNull(); - }); - } - } -} diff --git a/WebApiService/test/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore.Tests/EntityFrameworkCore/WebApiEntityFrameworkCoreTestBase.cs b/WebApiService/test/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore.Tests/EntityFrameworkCore/WebApiEntityFrameworkCoreTestBase.cs deleted file mode 100644 index e0b0d9a..0000000 --- a/WebApiService/test/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore.Tests/EntityFrameworkCore/WebApiEntityFrameworkCoreTestBase.cs +++ /dev/null @@ -1,9 +0,0 @@ -using Volo.Abp; - -namespace Win_in.Sfs.Scp.WebApi.EntityFrameworkCore -{ - public abstract class WebApiEntityFrameworkCoreTestBase : WebApiTestBase - { - - } -} diff --git a/WebApiService/test/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore.Tests/EntityFrameworkCore/WebApiEntityFrameworkCoreTestModule.cs b/WebApiService/test/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore.Tests/EntityFrameworkCore/WebApiEntityFrameworkCoreTestModule.cs deleted file mode 100644 index ed7849d..0000000 --- a/WebApiService/test/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore.Tests/EntityFrameworkCore/WebApiEntityFrameworkCoreTestModule.cs +++ /dev/null @@ -1,62 +0,0 @@ -using Microsoft.Data.Sqlite; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Storage; -using Microsoft.Extensions.DependencyInjection; -using Volo.Abp; -using Volo.Abp.EntityFrameworkCore; -using Volo.Abp.EntityFrameworkCore.Sqlite; -using Volo.Abp.Modularity; - -namespace Win_in.Sfs.Scp.WebApi.EntityFrameworkCore -{ - [DependsOn( - typeof(WebApiEntityFrameworkCoreModule), - typeof(WebApiTestBaseModule), - typeof(AbpEntityFrameworkCoreSqliteModule) - )] - public class WebApiEntityFrameworkCoreTestModule : AbpModule - { - private SqliteConnection _sqliteConnection; - - public override void ConfigureServices(ServiceConfigurationContext context) - { - ConfigureInMemorySqlite(context.Services); - } - - private void ConfigureInMemorySqlite(IServiceCollection services) - { - _sqliteConnection = CreateDatabaseAndGetConnection(); - - services.Configure(options => - { - options.Configure(context => - { - context.DbContextOptions.UseSqlite(_sqliteConnection); - }); - }); - } - - public override void OnApplicationShutdown(ApplicationShutdownContext context) - { - _sqliteConnection.Dispose(); - } - - private static SqliteConnection CreateDatabaseAndGetConnection() - { - var connection = new SqliteConnection("Data Source=:memory:"); - connection.Open(); - - var options = new DbContextOptionsBuilder() - .UseSqlite(connection) - .Options; - - using (var context = new WebApiDbContext(options)) - { - context.GetService().CreateTables(); - } - - return connection; - } - } -} diff --git a/WebApiService/test/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore.Tests/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore.Tests.csproj b/WebApiService/test/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore.Tests/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore.Tests.csproj deleted file mode 100644 index b6c7a7d..0000000 --- a/WebApiService/test/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore.Tests/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore.Tests.csproj +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - net5.0 - Win_in.Sfs.Scp.WebApi - - - - - - - - - - - - - diff --git a/WebApiService/test/Win_in.Sfs.Scp.WebApi.HttpApi.Client.ConsoleTestApp/ClientDemoService.cs b/WebApiService/test/Win_in.Sfs.Scp.WebApi.HttpApi.Client.ConsoleTestApp/ClientDemoService.cs deleted file mode 100644 index 04796fe..0000000 --- a/WebApiService/test/Win_in.Sfs.Scp.WebApi.HttpApi.Client.ConsoleTestApp/ClientDemoService.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System; -using System.Threading.Tasks; -using Volo.Abp.DependencyInjection; -using Volo.Abp.Identity; - -namespace Win_in.Sfs.Scp.WebApi.HttpApi.Client.ConsoleTestApp -{ - public class ClientDemoService : ITransientDependency - { - private readonly IProfileAppService _profileAppService; - - public ClientDemoService(IProfileAppService profileAppService) - { - _profileAppService = profileAppService; - } - - public async Task RunAsync() - { - var output = await _profileAppService.GetAsync(); - Console.WriteLine($"UserName : {output.UserName}"); - Console.WriteLine($"Email : {output.Email}"); - Console.WriteLine($"Name : {output.Name}"); - Console.WriteLine($"Surname : {output.Surname}"); - } - } -} \ No newline at end of file diff --git a/WebApiService/test/Win_in.Sfs.Scp.WebApi.HttpApi.Client.ConsoleTestApp/ConsoleTestAppHostedService.cs b/WebApiService/test/Win_in.Sfs.Scp.WebApi.HttpApi.Client.ConsoleTestApp/ConsoleTestAppHostedService.cs deleted file mode 100644 index 6c2e58a..0000000 --- a/WebApiService/test/Win_in.Sfs.Scp.WebApi.HttpApi.Client.ConsoleTestApp/ConsoleTestAppHostedService.cs +++ /dev/null @@ -1,37 +0,0 @@ -using Microsoft.Extensions.Hosting; -using System.Threading; -using System.Threading.Tasks; -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.DependencyInjection; -using Volo.Abp; - -namespace Win_in.Sfs.Scp.WebApi.HttpApi.Client.ConsoleTestApp -{ - public class ConsoleTestAppHostedService : IHostedService - { - private readonly IConfiguration _configuration; - - public ConsoleTestAppHostedService(IConfiguration configuration) - { - _configuration = configuration; - } - - public async Task StartAsync(CancellationToken cancellationToken) - { - using (var application = AbpApplicationFactory.Create(options => - { - options.Services.ReplaceConfiguration(_configuration); - })) - { - application.Initialize(); - - var demo = application.ServiceProvider.GetRequiredService(); - await demo.RunAsync(); - - application.Shutdown(); - } - } - - public Task StopAsync(CancellationToken cancellationToken) => Task.CompletedTask; - } -} diff --git a/WebApiService/test/Win_in.Sfs.Scp.WebApi.HttpApi.Client.ConsoleTestApp/Program.cs b/WebApiService/test/Win_in.Sfs.Scp.WebApi.HttpApi.Client.ConsoleTestApp/Program.cs deleted file mode 100644 index 90a5b43..0000000 --- a/WebApiService/test/Win_in.Sfs.Scp.WebApi.HttpApi.Client.ConsoleTestApp/Program.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System.Threading.Tasks; -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Hosting; - -namespace Win_in.Sfs.Scp.WebApi.HttpApi.Client.ConsoleTestApp -{ - class Program - { - static async Task Main(string[] args) - { - await CreateHostBuilder(args).RunConsoleAsync(); - } - - public static IHostBuilder CreateHostBuilder(string[] args) => - Host.CreateDefaultBuilder(args) - .ConfigureAppConfiguration(build => - { - build.AddJsonFile("appsettings.secrets.json", optional: true); - }) - .ConfigureServices((hostContext, services) => - { - services.AddHostedService(); - }); - } -} diff --git a/WebApiService/test/Win_in.Sfs.Scp.WebApi.HttpApi.Client.ConsoleTestApp/WebApiConsoleApiClientModule.cs b/WebApiService/test/Win_in.Sfs.Scp.WebApi.HttpApi.Client.ConsoleTestApp/WebApiConsoleApiClientModule.cs deleted file mode 100644 index eb27a21..0000000 --- a/WebApiService/test/Win_in.Sfs.Scp.WebApi.HttpApi.Client.ConsoleTestApp/WebApiConsoleApiClientModule.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System; -using Microsoft.Extensions.DependencyInjection; -using Polly; -using Volo.Abp.Http.Client; -using Volo.Abp.Http.Client.IdentityModel; -using Volo.Abp.Modularity; - -namespace Win_in.Sfs.Scp.WebApi.HttpApi.Client.ConsoleTestApp -{ - [DependsOn( - typeof(WebApiHttpApiClientModule), - typeof(AbpHttpClientIdentityModelModule), - typeof(WebApiApplicationContractsModule) - )] - public class WebApiConsoleApiClientModule : AbpModule - { - public override void PreConfigureServices(ServiceConfigurationContext context) - { - PreConfigure(options => - { - options.ProxyClientBuildActions.Add((remoteServiceName, clientBuilder) => - { - clientBuilder.AddTransientHttpErrorPolicy( - policyBuilder => policyBuilder.WaitAndRetryAsync(3, i => TimeSpan.FromSeconds(Math.Pow(2, i))) - ); - }); - }); - } - } -} diff --git a/WebApiService/test/Win_in.Sfs.Scp.WebApi.HttpApi.Client.ConsoleTestApp/Win_in.Sfs.Scp.WebApi.HttpApi.Client.ConsoleTestApp.csproj b/WebApiService/test/Win_in.Sfs.Scp.WebApi.HttpApi.Client.ConsoleTestApp/Win_in.Sfs.Scp.WebApi.HttpApi.Client.ConsoleTestApp.csproj deleted file mode 100644 index 9e018ef..0000000 --- a/WebApiService/test/Win_in.Sfs.Scp.WebApi.HttpApi.Client.ConsoleTestApp/Win_in.Sfs.Scp.WebApi.HttpApi.Client.ConsoleTestApp.csproj +++ /dev/null @@ -1,31 +0,0 @@ - - - - Exe - net5.0 - - - - - - PreserveNewest - Always - - - - PreserveNewest - Always - - - - - - - - - - - - - - diff --git a/WebApiService/test/Win_in.Sfs.Scp.WebApi.HttpApi.Client.ConsoleTestApp/appsettings.json b/WebApiService/test/Win_in.Sfs.Scp.WebApi.HttpApi.Client.ConsoleTestApp/appsettings.json deleted file mode 100644 index 78b3c56..0000000 --- a/WebApiService/test/Win_in.Sfs.Scp.WebApi.HttpApi.Client.ConsoleTestApp/appsettings.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "RemoteServices": { - "Default": { - "BaseUrl": "https://localhost:44359" - } - }, - "IdentityClients": { - "Default": { - "GrantType": "password", - "ClientId": "WebApi_App", - "ClientSecret": "1q2w3e*", - "UserName": "admin", - "UserPassword": "1q2w3E*", - "Authority": "https://localhost:44359", - "Scope": "WebApi" - } - } -} \ No newline at end of file diff --git a/WebApiService/test/Win_in.Sfs.Scp.WebApi.HttpApi.Client.ConsoleTestApp/appsettings.secrets.json b/WebApiService/test/Win_in.Sfs.Scp.WebApi.HttpApi.Client.ConsoleTestApp/appsettings.secrets.json deleted file mode 100644 index 7a73a41..0000000 --- a/WebApiService/test/Win_in.Sfs.Scp.WebApi.HttpApi.Client.ConsoleTestApp/appsettings.secrets.json +++ /dev/null @@ -1,2 +0,0 @@ -{ -} \ No newline at end of file diff --git a/WebApiService/test/Win_in.Sfs.Scp.WebApi.TestBase/Security/FakeCurrentPrincipalAccessor.cs b/WebApiService/test/Win_in.Sfs.Scp.WebApi.TestBase/Security/FakeCurrentPrincipalAccessor.cs deleted file mode 100644 index a86d983..0000000 --- a/WebApiService/test/Win_in.Sfs.Scp.WebApi.TestBase/Security/FakeCurrentPrincipalAccessor.cs +++ /dev/null @@ -1,43 +0,0 @@ -using System.Collections.Generic; -using System.Security.Claims; -using Volo.Abp.DependencyInjection; -using Volo.Abp.Security.Claims; - -namespace Win_in.Sfs.Scp.WebApi.Security -{ - [Dependency(ReplaceServices = true)] - public class FakeCurrentPrincipalAccessor : ThreadCurrentPrincipalAccessor - { - protected override ClaimsPrincipal GetClaimsPrincipal() - { - return GetPrincipal(); - } - - private ClaimsPrincipal _principal; - - private ClaimsPrincipal GetPrincipal() - { - if (_principal == null) - { - lock (this) - { - if (_principal == null) - { - _principal = new ClaimsPrincipal( - new ClaimsIdentity( - new List - { - new Claim(AbpClaimTypes.UserId,"2e701e62-0953-4dd3-910b-dc6cc93ccb0d"), - new Claim(AbpClaimTypes.UserName,"admin"), - new Claim(AbpClaimTypes.Email,"admin@abp.io") - } - ) - ); - } - } - } - - return _principal; - } - } -} diff --git a/WebApiService/test/Win_in.Sfs.Scp.WebApi.TestBase/WebApiTestBase.cs b/WebApiService/test/Win_in.Sfs.Scp.WebApi.TestBase/WebApiTestBase.cs deleted file mode 100644 index 4187d72..0000000 --- a/WebApiService/test/Win_in.Sfs.Scp.WebApi.TestBase/WebApiTestBase.cs +++ /dev/null @@ -1,61 +0,0 @@ -using System; -using System.Threading.Tasks; -using Microsoft.Extensions.DependencyInjection; -using Volo.Abp; -using Volo.Abp.Modularity; -using Volo.Abp.Uow; -using Volo.Abp.Testing; - -namespace Win_in.Sfs.Scp.WebApi -{ - /* All test classes are derived from this class, directly or indirectly. - */ - public abstract class WebApiTestBase : AbpIntegratedTest - where TStartupModule : IAbpModule - { - protected override void SetAbpApplicationCreationOptions(AbpApplicationCreationOptions options) - { - options.UseAutofac(); - } - - protected virtual Task WithUnitOfWorkAsync(Func func) - { - return WithUnitOfWorkAsync(new AbpUnitOfWorkOptions(), func); - } - - protected virtual async Task WithUnitOfWorkAsync(AbpUnitOfWorkOptions options, Func action) - { - using (var scope = ServiceProvider.CreateScope()) - { - var uowManager = scope.ServiceProvider.GetRequiredService(); - - using (var uow = uowManager.Begin(options)) - { - await action(); - - await uow.CompleteAsync(); - } - } - } - - protected virtual Task WithUnitOfWorkAsync(Func> func) - { - return WithUnitOfWorkAsync(new AbpUnitOfWorkOptions(), func); - } - - protected virtual async Task WithUnitOfWorkAsync(AbpUnitOfWorkOptions options, Func> func) - { - using (var scope = ServiceProvider.CreateScope()) - { - var uowManager = scope.ServiceProvider.GetRequiredService(); - - using (var uow = uowManager.Begin(options)) - { - var result = await func(); - await uow.CompleteAsync(); - return result; - } - } - } - } -} diff --git a/WebApiService/test/Win_in.Sfs.Scp.WebApi.TestBase/WebApiTestBaseModule.cs b/WebApiService/test/Win_in.Sfs.Scp.WebApi.TestBase/WebApiTestBaseModule.cs deleted file mode 100644 index 555aaed..0000000 --- a/WebApiService/test/Win_in.Sfs.Scp.WebApi.TestBase/WebApiTestBaseModule.cs +++ /dev/null @@ -1,62 +0,0 @@ -using Microsoft.Extensions.DependencyInjection; -using Volo.Abp; -using Volo.Abp.Authorization; -using Volo.Abp.Autofac; -using Volo.Abp.BackgroundJobs; -using Volo.Abp.Data; -using Volo.Abp.IdentityServer; -using Volo.Abp.Modularity; -using Volo.Abp.Threading; - -namespace Win_in.Sfs.Scp.WebApi -{ - [DependsOn( - typeof(AbpAutofacModule), - typeof(AbpTestBaseModule), - typeof(AbpAuthorizationModule), - typeof(WebApiDomainModule) - )] - public class WebApiTestBaseModule : AbpModule - { - public override void PreConfigureServices(ServiceConfigurationContext context) - { - PreConfigure(options => - { - options.AddDeveloperSigningCredential = false; - }); - - PreConfigure(identityServerBuilder => - { - identityServerBuilder.AddDeveloperSigningCredential(false, System.Guid.NewGuid().ToString()); - }); - } - - public override void ConfigureServices(ServiceConfigurationContext context) - { - Configure(options => - { - options.IsJobExecutionEnabled = false; - }); - - context.Services.AddAlwaysAllowAuthorization(); - } - - public override void OnApplicationInitialization(ApplicationInitializationContext context) - { - SeedTestData(context); - } - - private static void SeedTestData(ApplicationInitializationContext context) - { - AsyncHelper.RunSync(async () => - { - using (var scope = context.ServiceProvider.CreateScope()) - { - await scope.ServiceProvider - .GetRequiredService() - .SeedAsync(); - } - }); - } - } -} diff --git a/WebApiService/test/Win_in.Sfs.Scp.WebApi.TestBase/WebApiTestDataSeedContributor.cs b/WebApiService/test/Win_in.Sfs.Scp.WebApi.TestBase/WebApiTestDataSeedContributor.cs deleted file mode 100644 index b371249..0000000 --- a/WebApiService/test/Win_in.Sfs.Scp.WebApi.TestBase/WebApiTestDataSeedContributor.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System.Threading.Tasks; -using Volo.Abp.Data; -using Volo.Abp.DependencyInjection; - -namespace Win_in.Sfs.Scp.WebApi -{ - public class WebApiTestDataSeedContributor : IDataSeedContributor, ITransientDependency - { - public Task SeedAsync(DataSeedContext context) - { - /* Seed additional test data... */ - - return Task.CompletedTask; - } - } -} \ No newline at end of file diff --git a/WebApiService/test/Win_in.Sfs.Scp.WebApi.TestBase/Win_in.Sfs.Scp.WebApi.TestBase.csproj b/WebApiService/test/Win_in.Sfs.Scp.WebApi.TestBase/Win_in.Sfs.Scp.WebApi.TestBase.csproj deleted file mode 100644 index efb05db..0000000 --- a/WebApiService/test/Win_in.Sfs.Scp.WebApi.TestBase/Win_in.Sfs.Scp.WebApi.TestBase.csproj +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - net5.0 - Win_in.Sfs.Scp.WebApi - - - - - - - - - - - - - - - - - - -