From eca110d669c3dccbc902a74c64f6030d939b27f0 Mon Sep 17 00:00:00 2001 From: Denis Nutiu Date: Sun, 4 Jul 2021 17:39:07 +0300 Subject: [PATCH] Rename FeedbackReceiverService.cs to FeedbackReceiversService.cs --- ...erService.cs => IFeedbackReceiversService.cs} | 2 +- ...verService.cs => FeedbackReceiversService.cs} | 4 ++-- .../Services/TestFeedbackReceiverService.cs | 10 +++++----- .../TestFeedbackReceiverController.cs | 16 ++++++++-------- .../Controllers/TestTokensController.cs | 16 ++++++++-------- .../Controllers/FeedbackReceiversController.cs | 16 ++++++++-------- .../Controllers/TokensController.cs | 8 ++++---- Retroactiune.WebAPI/Startup.cs | 2 +- Retroactiune.WebAPI/TestingStartup.cs | 2 +- 9 files changed, 38 insertions(+), 38 deletions(-) rename Retroactiune.Core/Interfaces/{IFeedbackReceiverService.cs => IFeedbackReceiversService.cs} (96%) rename Retroactiune.Core/Services/{FeedbackReceiverService.cs => FeedbackReceiversService.cs} (95%) diff --git a/Retroactiune.Core/Interfaces/IFeedbackReceiverService.cs b/Retroactiune.Core/Interfaces/IFeedbackReceiversService.cs similarity index 96% rename from Retroactiune.Core/Interfaces/IFeedbackReceiverService.cs rename to Retroactiune.Core/Interfaces/IFeedbackReceiversService.cs index aca7785..1a3abe1 100644 --- a/Retroactiune.Core/Interfaces/IFeedbackReceiverService.cs +++ b/Retroactiune.Core/Interfaces/IFeedbackReceiversService.cs @@ -4,7 +4,7 @@ using Retroactiune.Core.Entities; namespace Retroactiune.Core.Interfaces { - public interface IFeedbackReceiverService + public interface IFeedbackReceiversService { /// /// Creates feedback receivers. diff --git a/Retroactiune.Core/Services/FeedbackReceiverService.cs b/Retroactiune.Core/Services/FeedbackReceiversService.cs similarity index 95% rename from Retroactiune.Core/Services/FeedbackReceiverService.cs rename to Retroactiune.Core/Services/FeedbackReceiversService.cs index decf370..915f42e 100644 --- a/Retroactiune.Core/Services/FeedbackReceiverService.cs +++ b/Retroactiune.Core/Services/FeedbackReceiversService.cs @@ -12,11 +12,11 @@ namespace Retroactiune.Core.Services /// Service that simplifies access to the database for managing FeedbackReceiver items. /// /// - public class FeedbackReceiverService : IFeedbackReceiverService + public class FeedbackReceiversService : IFeedbackReceiversService { private readonly IMongoCollection _collection; - public FeedbackReceiverService(IMongoClient client, IDatabaseSettings settings) + public FeedbackReceiversService(IMongoClient client, IDatabaseSettings settings) { var database = client.GetDatabase(settings.DatabaseName); _collection = database.GetCollection(settings.FeedbackReceiverCollectionName); diff --git a/Retroactiune.UnitTests/Retroactiune.Core/Services/TestFeedbackReceiverService.cs b/Retroactiune.UnitTests/Retroactiune.Core/Services/TestFeedbackReceiverService.cs index 9da304f..9c855ff 100644 --- a/Retroactiune.UnitTests/Retroactiune.Core/Services/TestFeedbackReceiverService.cs +++ b/Retroactiune.UnitTests/Retroactiune.Core/Services/TestFeedbackReceiverService.cs @@ -35,7 +35,7 @@ namespace Retroactiune.Tests.Retroactiune.Core.Services .Returns(mongoCollectionMock.Object); // Test - var service = new FeedbackReceiverService(mongoClientMock.Object, mongoSettingsMock.Object); + var service = new FeedbackReceiversService(mongoClientMock.Object, mongoSettingsMock.Object); var feedbackReceivers = items as FeedbackReceiver[] ?? items.ToArray(); await service.CreateManyAsync(feedbackReceivers); @@ -70,7 +70,7 @@ namespace Retroactiune.Tests.Retroactiune.Core.Services .Returns(mongoCollectionMock.Object); // Test - var service = new FeedbackReceiverService(mongoClientMock.Object, mongoSettingsMock.Object); + var service = new FeedbackReceiversService(mongoClientMock.Object, mongoSettingsMock.Object); var ex = Record.ExceptionAsync(async () => await service.CreateManyAsync(null)); @@ -111,7 +111,7 @@ namespace Retroactiune.Tests.Retroactiune.Core.Services .Returns(mongoCollectionMock.Object); // Test - var service = new FeedbackReceiverService(mongoClientMock.Object, mongoSettingsMock.Object); + var service = new FeedbackReceiversService(mongoClientMock.Object, mongoSettingsMock.Object); var ex = Record.ExceptionAsync(async () => await service.CreateManyAsync(new List())); @@ -152,7 +152,7 @@ namespace Retroactiune.Tests.Retroactiune.Core.Services .Returns(mongoCollectionMock.Object); // Test - var service = new FeedbackReceiverService(mongoClientMock.Object, mongoSettingsMock.Object); + var service = new FeedbackReceiversService(mongoClientMock.Object, mongoSettingsMock.Object); await service.DeleteManyAsync(new []{"insert_guid_here"}); // Assert @@ -193,7 +193,7 @@ namespace Retroactiune.Tests.Retroactiune.Core.Services .ReturnsAsync(mongoCursorMock.Object); // Test - var service = new FeedbackReceiverService(mongoClientMock.Object, mongoSettingsMock.Object); + var service = new FeedbackReceiversService(mongoClientMock.Object, mongoSettingsMock.Object); var guids = new[] {"insert_guid_here"}; await service.FindAsync(guids, 0, 15); diff --git a/Retroactiune.UnitTests/Retroactiune.WebAPI/Controllers/TestFeedbackReceiverController.cs b/Retroactiune.UnitTests/Retroactiune.WebAPI/Controllers/TestFeedbackReceiverController.cs index 560d502..d159e05 100644 --- a/Retroactiune.UnitTests/Retroactiune.WebAPI/Controllers/TestFeedbackReceiverController.cs +++ b/Retroactiune.UnitTests/Retroactiune.WebAPI/Controllers/TestFeedbackReceiverController.cs @@ -21,7 +21,7 @@ namespace Retroactiune.Tests.Retroactiune.WebAPI.Controllers { // Arrange var mapper = TestUtils.GetMapper(); - var mockService = new Mock(); + var mockService = new Mock(); var tokensService = new Mock(); var logger = new Mock>(); @@ -40,7 +40,7 @@ namespace Retroactiune.Tests.Retroactiune.WebAPI.Controllers { // Arrange var mapper = TestUtils.GetMapper(); - var mockService = new Mock(); + var mockService = new Mock(); var tokensService = new Mock(); var logger = new Mock>(); @@ -59,7 +59,7 @@ namespace Retroactiune.Tests.Retroactiune.WebAPI.Controllers { // Arrange var mapper = TestUtils.GetMapper(); - var mockService = new Mock(); + var mockService = new Mock(); var tokensService = new Mock(); var logger = new Mock>(); @@ -82,7 +82,7 @@ namespace Retroactiune.Tests.Retroactiune.WebAPI.Controllers { // Arrange var mapper = TestUtils.GetMapper(); - var mockService = new Mock(); + var mockService = new Mock(); var tokensService = new Mock(); var logger = new Mock>(); @@ -104,7 +104,7 @@ namespace Retroactiune.Tests.Retroactiune.WebAPI.Controllers { // Arrange var mapper = TestUtils.GetMapper(); - var mockService = new Mock(); + var mockService = new Mock(); var tokensService = new Mock(); var logger = new Mock>(); mockService.Setup(i => i.DeleteManyAsync(It.IsAny>())) @@ -127,7 +127,7 @@ namespace Retroactiune.Tests.Retroactiune.WebAPI.Controllers { // Arrange var mapper = TestUtils.GetMapper(); - var mockService = new Mock(); + var mockService = new Mock(); var tokensService = new Mock(); var logger = new Mock>(); mockService.Setup(i => i.FindAsync(It.IsAny>(), null, null)) @@ -150,7 +150,7 @@ namespace Retroactiune.Tests.Retroactiune.WebAPI.Controllers { // Arrange var mapper = TestUtils.GetMapper(); - var mockService = new Mock(); + var mockService = new Mock(); var tokensService = new Mock(); var logger = new Mock>(); @@ -171,7 +171,7 @@ namespace Retroactiune.Tests.Retroactiune.WebAPI.Controllers { // Arrange var mapper = TestUtils.GetMapper(); - var mockService = new Mock(); + var mockService = new Mock(); var tokensService = new Mock(); var logger = new Mock>(); var filterArr = filter as string[] ?? filter.ToArray(); diff --git a/Retroactiune.UnitTests/Retroactiune.WebAPI/Controllers/TestTokensController.cs b/Retroactiune.UnitTests/Retroactiune.WebAPI/Controllers/TestTokensController.cs index 38fdec2..5d29719 100644 --- a/Retroactiune.UnitTests/Retroactiune.WebAPI/Controllers/TestTokensController.cs +++ b/Retroactiune.UnitTests/Retroactiune.WebAPI/Controllers/TestTokensController.cs @@ -19,7 +19,7 @@ namespace Retroactiune.Tests.Retroactiune.WebAPI.Controllers public async Task Test_GenerateTokens_InexistentFeedbackReceiver() { // Arrange - var feedbackService = new Mock(); + var feedbackService = new Mock(); var mapper = TestUtils.GetMapper(); var tokens = new Mock(); var logger = new Mock>(); @@ -37,7 +37,7 @@ namespace Retroactiune.Tests.Retroactiune.WebAPI.Controllers { // Arrange var mapper = TestUtils.GetMapper(); - var feedbackService = new Mock(); + var feedbackService = new Mock(); var tokens = new Mock(); var logger = new Mock>(); @@ -64,7 +64,7 @@ namespace Retroactiune.Tests.Retroactiune.WebAPI.Controllers { // Arrange var mapper = TestUtils.GetMapper(); - var feedbackService = new Mock(); + var feedbackService = new Mock(); var tokens = new Mock(); var logger = new Mock>(); @@ -82,7 +82,7 @@ namespace Retroactiune.Tests.Retroactiune.WebAPI.Controllers { // Arrange var mapper = TestUtils.GetMapper(); - var feedbackService = new Mock(); + var feedbackService = new Mock(); var tokens = new Mock(); var logger = new Mock>(); tokens.Setup(i => i.DeleteTokens(It.IsAny>())) @@ -102,7 +102,7 @@ namespace Retroactiune.Tests.Retroactiune.WebAPI.Controllers { // Arrange var mapper = TestUtils.GetMapper(); - var feedbackService = new Mock(); + var feedbackService = new Mock(); var tokens = new Mock(); var logger = new Mock>(); @@ -120,7 +120,7 @@ namespace Retroactiune.Tests.Retroactiune.WebAPI.Controllers { // Arrange var mapper = TestUtils.GetMapper(); - var feedbackService = new Mock(); + var feedbackService = new Mock(); var tokens = new Mock(); var logger = new Mock>(); tokens.Setup(i => i.DeleteTokens(It.IsAny>())) @@ -140,7 +140,7 @@ namespace Retroactiune.Tests.Retroactiune.WebAPI.Controllers { // Arrange var mapper = TestUtils.GetMapper(); - var feedbackService = new Mock(); + var feedbackService = new Mock(); var tokens = new Mock(); var logger = new Mock>(); @@ -158,7 +158,7 @@ namespace Retroactiune.Tests.Retroactiune.WebAPI.Controllers { // Arrange var mapper = TestUtils.GetMapper(); - var feedbackService = new Mock(); + var feedbackService = new Mock(); var tokens = new Mock(); var logger = new Mock>(); tokens.Setup(i => i.ListTokens(It.IsAny())) diff --git a/Retroactiune.WebAPI/Controllers/FeedbackReceiversController.cs b/Retroactiune.WebAPI/Controllers/FeedbackReceiversController.cs index 59cddff..340c3d4 100644 --- a/Retroactiune.WebAPI/Controllers/FeedbackReceiversController.cs +++ b/Retroactiune.WebAPI/Controllers/FeedbackReceiversController.cs @@ -22,16 +22,16 @@ namespace Retroactiune.Controllers private readonly IOptions _apiBehaviorOptions; // Note: Probably refactor this to use an Aggregate object, need to learn more about aggregates.. - private readonly IFeedbackReceiverService _feedbackReceiverService; + private readonly IFeedbackReceiversService _feedbackReceiversService; private readonly ITokensService _tokensService; private readonly IMapper _mapper; private readonly ILogger _logger; - public FeedbackReceiversController(IFeedbackReceiverService feedbackReceiverService, + public FeedbackReceiversController(IFeedbackReceiversService feedbackReceiversService, ITokensService tokensService, IMapper mapper, IOptions apiBehaviorOptions, ILogger logger) { - _feedbackReceiverService = feedbackReceiverService; + _feedbackReceiversService = feedbackReceiversService; _tokensService = tokensService; _mapper = mapper; _apiBehaviorOptions = apiBehaviorOptions; @@ -66,7 +66,7 @@ namespace Retroactiune.Controllers return result; }); - await _feedbackReceiverService.CreateManyAsync(mappedItems); + await _feedbackReceiversService.CreateManyAsync(mappedItems); return Ok(new BasicResponse() { @@ -88,7 +88,7 @@ namespace Retroactiune.Controllers [StringLength(24, ErrorMessage = "invalid guid, must be 24 characters", MinimumLength = 24)] string guid) { - await Task.WhenAll(_feedbackReceiverService.DeleteManyAsync(new[] {guid}), + await Task.WhenAll(_feedbackReceiversService.DeleteManyAsync(new[] {guid}), _tokensService.DeleteManyByFeedbackReceiverIdAsync(new[] {guid})); return NoContent(); } @@ -109,7 +109,7 @@ namespace Retroactiune.Controllers [StringLength(24, ErrorMessage = "invalid guid, must be 24 characters", MinimumLength = 24)] string guid) { - var result = await _feedbackReceiverService.FindAsync(new[] {guid}); + var result = await _feedbackReceiversService.FindAsync(new[] {guid}); var feedbackReceivers = result as FeedbackReceiver[] ?? result.ToArray(); if (!feedbackReceivers.Any()) { @@ -140,7 +140,7 @@ namespace Retroactiune.Controllers [RangeAttribute(1, 1000, ErrorMessage = "limit is out of range, allowed ranges [1-1000]"), FromQuery] int limit) { - return Ok(await _feedbackReceiverService.FindAsync(filter, offset, limit)); + return Ok(await _feedbackReceiversService.FindAsync(filter, offset, limit)); } /// @@ -158,7 +158,7 @@ namespace Retroactiune.Controllers try { var feedbackReceiverIds = ids as string[] ?? ids.ToArray(); - await Task.WhenAll(_feedbackReceiverService.DeleteManyAsync(feedbackReceiverIds), + await Task.WhenAll(_feedbackReceiversService.DeleteManyAsync(feedbackReceiverIds), _tokensService.DeleteManyByFeedbackReceiverIdAsync(feedbackReceiverIds)); return NoContent(); } diff --git a/Retroactiune.WebAPI/Controllers/TokensController.cs b/Retroactiune.WebAPI/Controllers/TokensController.cs index 3d2823e..d12a116 100644 --- a/Retroactiune.WebAPI/Controllers/TokensController.cs +++ b/Retroactiune.WebAPI/Controllers/TokensController.cs @@ -17,15 +17,15 @@ namespace Retroactiune.Controllers [Route("api/v1/[controller]")] public class TokensController : ControllerBase { - private readonly IFeedbackReceiverService _feedbackReceiverService; + private readonly IFeedbackReceiversService _feedbackReceiversService; private readonly ITokensService _tokensService; private readonly IMapper _mapper; private readonly ILogger _logger; - public TokensController(IFeedbackReceiverService feedbackReceiverService, ITokensService tokensService, + public TokensController(IFeedbackReceiversService feedbackReceiversService, ITokensService tokensService, ILogger logger, IMapper mapper) { - _feedbackReceiverService = feedbackReceiverService; + _feedbackReceiversService = feedbackReceiversService; _tokensService = tokensService; _mapper = mapper; _logger = logger; @@ -72,7 +72,7 @@ namespace Retroactiune.Controllers public async Task GenerateTokens([Required] GenerateTokensDto generateTokensDto) { var feedbackReceiverId = generateTokensDto.FeedbackReceiverId; - var result = await _feedbackReceiverService.FindAsync( + var result = await _feedbackReceiversService.FindAsync( new[] {feedbackReceiverId}); if (!result.Any()) { diff --git a/Retroactiune.WebAPI/Startup.cs b/Retroactiune.WebAPI/Startup.cs index e5b341b..61a5e6a 100644 --- a/Retroactiune.WebAPI/Startup.cs +++ b/Retroactiune.WebAPI/Startup.cs @@ -38,7 +38,7 @@ namespace Retroactiune // Services - services.AddSingleton(); + services.AddSingleton(); services.AddSingleton(); services.AddSingleton(i => { diff --git a/Retroactiune.WebAPI/TestingStartup.cs b/Retroactiune.WebAPI/TestingStartup.cs index fe53dd3..0a3b32d 100644 --- a/Retroactiune.WebAPI/TestingStartup.cs +++ b/Retroactiune.WebAPI/TestingStartup.cs @@ -34,7 +34,7 @@ namespace Retroactiune services.AddAutoMapper(AppDomain.CurrentDomain.GetAssemblies()); // Services - services.AddSingleton(); + services.AddSingleton(); services.AddSingleton(); services.AddSingleton(i => {