diff --git a/src/Obsidian.Application/Authentication/PasswordAuthenticateSaga.cs b/src/Obsidian.Application/Authentication/PasswordAuthenticateSaga.cs index 2d89447..ec4a7c7 100644 --- a/src/Obsidian.Application/Authentication/PasswordAuthenticateSaga.cs +++ b/src/Obsidian.Application/Authentication/PasswordAuthenticateSaga.cs @@ -1,4 +1,3 @@ -using Obsidian.Domain; using Obsidian.Domain.Repositories; using Obsidian.Foundation.ProcessManagement; using System.Threading.Tasks; diff --git a/src/Obsidian.Application/ClientManagement/ClientService.cs b/src/Obsidian.Application/ClientManagement/ClientManagementService.cs similarity index 84% rename from src/Obsidian.Application/ClientManagement/ClientService.cs rename to src/Obsidian.Application/ClientManagement/ClientManagementService.cs index a95f218..451309d 100644 --- a/src/Obsidian.Application/ClientManagement/ClientService.cs +++ b/src/Obsidian.Application/ClientManagement/ClientManagementService.cs @@ -1,17 +1,18 @@ -using Obsidian.Domain; +using Microsoft.Extensions.DependencyInjection; +using Obsidian.Domain; using Obsidian.Domain.Repositories; using Obsidian.Foundation; +using Obsidian.Foundation.DependencyInjection; using System; -using System.Collections.Generic; -using System.Text; using System.Threading.Tasks; namespace Obsidian.Application.ClientManagement { - public class ClientService + [Service(ServiceLifetime.Scoped)] + public class ClientManagementService { private readonly IClientRepository _repo; - public ClientService(IClientRepository repo) + public ClientManagementService(IClientRepository repo) { _repo = repo; } diff --git a/src/Obsidian.Application/ScopeManagement/ScopeService.cs b/src/Obsidian.Application/ScopeManagement/ScopeManagementService.cs similarity index 81% rename from src/Obsidian.Application/ScopeManagement/ScopeService.cs rename to src/Obsidian.Application/ScopeManagement/ScopeManagementService.cs index beb5ce3..f9faa9d 100644 --- a/src/Obsidian.Application/ScopeManagement/ScopeService.cs +++ b/src/Obsidian.Application/ScopeManagement/ScopeManagementService.cs @@ -1,16 +1,19 @@ -using Obsidian.Domain; +using Microsoft.Extensions.DependencyInjection; +using Obsidian.Domain; using Obsidian.Domain.Repositories; using Obsidian.Foundation; +using Obsidian.Foundation.DependencyInjection; using System; using System.Collections.Generic; -using System.Text; using System.Threading.Tasks; + namespace Obsidian.Application.ScopeManagement { - public class ScopeService + [Service(ServiceLifetime.Scoped)] + public class ScopeManagementService { private readonly IPermissionScopeRepository _repo; - public ScopeService(IPermissionScopeRepository repo) + public ScopeManagementService(IPermissionScopeRepository repo) { _repo = repo; } diff --git a/src/Obsidian.Application/UserManagement/UserManagementService.cs b/src/Obsidian.Application/UserManagement/UserManagementService.cs index a8a8e33..7bcb19b 100644 --- a/src/Obsidian.Application/UserManagement/UserManagementService.cs +++ b/src/Obsidian.Application/UserManagement/UserManagementService.cs @@ -1,14 +1,18 @@ -using Obsidian.Application.Dto; +using Microsoft.Extensions.DependencyInjection; +using Obsidian.Application.Dto; using Obsidian.Domain; using Obsidian.Domain.Repositories; using Obsidian.Foundation; using Obsidian.Foundation.Collections; +using Obsidian.Foundation.DependencyInjection; using System; using System.Linq; using System.Threading.Tasks; namespace Obsidian.Application.UserManagement { + + [Service(ServiceLifetime.Scoped)] public class UserManagementService { private readonly IUserRepository _repo; diff --git a/src/Obsidian.Application/UserManagementService.cs b/src/Obsidian.Application/UserManagementService.cs deleted file mode 100644 index 27a3b01..0000000 --- a/src/Obsidian.Application/UserManagementService.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace Obsidian.Application.OldCommanding.CommandHandlers -{ - public class UserManagementService - { - } -} \ No newline at end of file diff --git a/src/Obsidian.Domain/Misc/PropertyClaimGetter.cs b/src/Obsidian.Domain/Misc/PropertyClaimGetter.cs index 950d84f..06aa497 100644 --- a/src/Obsidian.Domain/Misc/PropertyClaimGetter.cs +++ b/src/Obsidian.Domain/Misc/PropertyClaimGetter.cs @@ -1,8 +1,5 @@ -using System; -using System.Collections.Generic; -using System.Reflection; +using System.Reflection; using System.Security.Claims; -using System.Text; namespace Obsidian.Domain.Misc { diff --git a/src/Obsidian.Domain/ObsidianClaim.cs b/src/Obsidian.Domain/ObsidianClaim.cs index d443caa..05d289a 100644 --- a/src/Obsidian.Domain/ObsidianClaim.cs +++ b/src/Obsidian.Domain/ObsidianClaim.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace Obsidian.Domain +namespace Obsidian.Domain { public class ObsidianClaim { diff --git a/src/Obsidian.Domain/UserProfile.cs b/src/Obsidian.Domain/UserProfile.cs index e8a94ac..45d199f 100644 --- a/src/Obsidian.Domain/UserProfile.cs +++ b/src/Obsidian.Domain/UserProfile.cs @@ -1,6 +1,4 @@ -using System.Security.Claims; - -namespace Obsidian.Domain +namespace Obsidian.Domain { public class UserProfile { diff --git a/src/Obsidian.Foundation/Collections/EnumerableExtensions.cs b/src/Obsidian.Foundation/Collections/EnumerableExtensions.cs index e535d48..967caf2 100644 --- a/src/Obsidian.Foundation/Collections/EnumerableExtensions.cs +++ b/src/Obsidian.Foundation/Collections/EnumerableExtensions.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Text; namespace Obsidian.Foundation.Collections { diff --git a/src/Obsidian.Foundation/EntityNotFoundException.cs b/src/Obsidian.Foundation/EntityNotFoundException.cs index b303385..dbd9523 100644 --- a/src/Obsidian.Foundation/EntityNotFoundException.cs +++ b/src/Obsidian.Foundation/EntityNotFoundException.cs @@ -1,6 +1,4 @@ using System; -using System.Collections.Generic; -using System.Text; namespace Obsidian.Foundation { diff --git a/src/Obsidian.Foundation/ProcessManagement/SagaBus.cs b/src/Obsidian.Foundation/ProcessManagement/SagaBus.cs index 43c3b63..937e90d 100644 --- a/src/Obsidian.Foundation/ProcessManagement/SagaBus.cs +++ b/src/Obsidian.Foundation/ProcessManagement/SagaBus.cs @@ -1,8 +1,6 @@ -using Obsidian.Foundation.Collections; -using System; +using System; using System.Collections.Generic; using System.Linq; -using System.Reflection; using System.Threading.Tasks; namespace Obsidian.Foundation.ProcessManagement diff --git a/src/Obsidian/Controllers/ApiControllers/ClientsController.cs b/src/Obsidian/Controllers/ApiControllers/ClientsController.cs index 95e2430..f73c185 100644 --- a/src/Obsidian/Controllers/ApiControllers/ClientsController.cs +++ b/src/Obsidian/Controllers/ApiControllers/ClientsController.cs @@ -7,7 +7,6 @@ using Obsidian.Authorization; using Obsidian.Domain.Repositories; using Obsidian.Foundation; -using Obsidian.Foundation.ProcessManagement; using Obsidian.Misc; using Swashbuckle.AspNetCore.SwaggerGen; using System; @@ -20,9 +19,9 @@ namespace Obsidian.Controllers.ApiControllers public class ClientsController : Controller { private readonly IClientRepository _clientRepository; - private readonly ClientService _service; + private readonly ClientManagementService _service; - public ClientsController(IClientRepository repo, ClientService service) + public ClientsController(IClientRepository repo, ClientManagementService service) { _clientRepository = repo; _service = service; diff --git a/src/Obsidian/Controllers/ApiControllers/ScopesController.cs b/src/Obsidian/Controllers/ApiControllers/ScopesController.cs index 89b9e96..bee72d4 100644 --- a/src/Obsidian/Controllers/ApiControllers/ScopesController.cs +++ b/src/Obsidian/Controllers/ApiControllers/ScopesController.cs @@ -7,7 +7,6 @@ using Obsidian.Authorization; using Obsidian.Domain.Repositories; using Obsidian.Foundation; -using Obsidian.Foundation.ProcessManagement; using Obsidian.Misc; using System; using System.Threading.Tasks; @@ -18,9 +17,9 @@ namespace Obsidian.Controllers.ApiControllers public class ScopesController : Controller { private readonly IPermissionScopeRepository _scopeRepository; - private readonly ScopeService _service; + private readonly ScopeManagementService _service; - public ScopesController(IPermissionScopeRepository scopeRepo, ScopeService service) + public ScopesController(IPermissionScopeRepository scopeRepo, ScopeManagementService service) { _scopeRepository = scopeRepo; _service = service; diff --git a/src/Obsidian/IdentityConfig.cs b/src/Obsidian/IdentityConfig.cs index f0f8e1f..809a942 100644 --- a/src/Obsidian/IdentityConfig.cs +++ b/src/Obsidian/IdentityConfig.cs @@ -1,6 +1,5 @@ using Microsoft.AspNetCore.Authentication.Cookies; using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Builder; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Options; using Microsoft.IdentityModel.Tokens; diff --git a/src/Obsidian/Models/InitializationInfo.cs b/src/Obsidian/Models/InitializationInfo.cs index 6f0201b..7f57a2e 100644 --- a/src/Obsidian/Models/InitializationInfo.cs +++ b/src/Obsidian/Models/InitializationInfo.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; -using System.Linq; -using System.Threading.Tasks; +using System.ComponentModel.DataAnnotations; namespace Obsidian.Models { diff --git a/test/Obsidian.Application.Test/ClientManagement/ClientManagementServiceTest.cs b/test/Obsidian.Application.Test/ClientManagement/ClientManagementServiceTest.cs index c9947ee..2895bbc 100644 --- a/test/Obsidian.Application.Test/ClientManagement/ClientManagementServiceTest.cs +++ b/test/Obsidian.Application.Test/ClientManagement/ClientManagementServiceTest.cs @@ -4,8 +4,6 @@ using Obsidian.Domain.Repositories; using Obsidian.Foundation; using System; -using System.Collections.Generic; -using System.Text; using System.Threading.Tasks; using Xunit; @@ -17,7 +15,7 @@ public class ClientManagementServiceTest public async Task CreateTest() { var mockRepo = new Mock(); - var service = new ClientService(mockRepo.Object); + var service = new ClientManagementService(mockRepo.Object); await service.CreateClient("xxx", "http://xxx.com"); mockRepo.Verify(r => r.AddAsync(It.IsAny())); } @@ -27,7 +25,7 @@ public async Task Should_Throw_When_Entity_NotFound() { var mockRepo = new Mock(); mockRepo.Setup(r => r.FindByIdAsync(It.IsAny())).Returns(Task.FromResult(null)); - var service = new ClientService(mockRepo.Object); + var service = new ClientManagementService(mockRepo.Object); await Assert.ThrowsAsync(() => service.UpdateClient(Guid.NewGuid(), "xxx", "xxx")); await Assert.ThrowsAsync(() => service.UpdateClientSecret(Guid.NewGuid())); } @@ -41,7 +39,7 @@ public async Task UpdateSecretTest() var mockRepo = new Mock(); mockRepo.Setup(r => r.FindByIdAsync(It.Is(i => i == id))) .Returns(Task.FromResult(client)); - var service = new ClientService(mockRepo.Object); + var service = new ClientManagementService(mockRepo.Object); var newClient = await service.UpdateClientSecret(id); Assert.NotEqual(secret, newClient.Secret); } @@ -58,7 +56,7 @@ public async Task UpdateClientTest() .Callback(c => client = c) .Returns(Task.CompletedTask); client.RedirectUri = new Uri("http://zzz.com"); - var service = new ClientService(mockRepo.Object); + var service = new ClientManagementService(mockRepo.Object); const string newUri = "http://yyy.com"; await service.UpdateClient(id, "aaa", newUri); Assert.Equal(newUri, client.RedirectUri.OriginalString);