Rename FeedbackReceiverService.cs to FeedbackReceiversService.cs
This commit is contained in:
parent
b89d2b5f9f
commit
eca110d669
9 changed files with 38 additions and 38 deletions
|
@ -4,7 +4,7 @@ using Retroactiune.Core.Entities;
|
|||
|
||||
namespace Retroactiune.Core.Interfaces
|
||||
{
|
||||
public interface IFeedbackReceiverService
|
||||
public interface IFeedbackReceiversService
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates feedback receivers.
|
|
@ -12,11 +12,11 @@ namespace Retroactiune.Core.Services
|
|||
/// Service that simplifies access to the database for managing FeedbackReceiver items.
|
||||
/// <see cref="FeedbackReceiver"/>
|
||||
/// </summary>
|
||||
public class FeedbackReceiverService : IFeedbackReceiverService
|
||||
public class FeedbackReceiversService : IFeedbackReceiversService
|
||||
{
|
||||
private readonly IMongoCollection<FeedbackReceiver> _collection;
|
||||
|
||||
public FeedbackReceiverService(IMongoClient client, IDatabaseSettings settings)
|
||||
public FeedbackReceiversService(IMongoClient client, IDatabaseSettings settings)
|
||||
{
|
||||
var database = client.GetDatabase(settings.DatabaseName);
|
||||
_collection = database.GetCollection<FeedbackReceiver>(settings.FeedbackReceiverCollectionName);
|
|
@ -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<FeedbackReceiver>()));
|
||||
|
||||
|
||||
|
@ -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);
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ namespace Retroactiune.Tests.Retroactiune.WebAPI.Controllers
|
|||
{
|
||||
// Arrange
|
||||
var mapper = TestUtils.GetMapper();
|
||||
var mockService = new Mock<IFeedbackReceiverService>();
|
||||
var mockService = new Mock<IFeedbackReceiversService>();
|
||||
var tokensService = new Mock<ITokensService>();
|
||||
var logger = new Mock<ILogger<FeedbackReceiversController>>();
|
||||
|
||||
|
@ -40,7 +40,7 @@ namespace Retroactiune.Tests.Retroactiune.WebAPI.Controllers
|
|||
{
|
||||
// Arrange
|
||||
var mapper = TestUtils.GetMapper();
|
||||
var mockService = new Mock<IFeedbackReceiverService>();
|
||||
var mockService = new Mock<IFeedbackReceiversService>();
|
||||
var tokensService = new Mock<ITokensService>();
|
||||
var logger = new Mock<ILogger<FeedbackReceiversController>>();
|
||||
|
||||
|
@ -59,7 +59,7 @@ namespace Retroactiune.Tests.Retroactiune.WebAPI.Controllers
|
|||
{
|
||||
// Arrange
|
||||
var mapper = TestUtils.GetMapper();
|
||||
var mockService = new Mock<IFeedbackReceiverService>();
|
||||
var mockService = new Mock<IFeedbackReceiversService>();
|
||||
var tokensService = new Mock<ITokensService>();
|
||||
var logger = new Mock<ILogger<FeedbackReceiversController>>();
|
||||
|
||||
|
@ -82,7 +82,7 @@ namespace Retroactiune.Tests.Retroactiune.WebAPI.Controllers
|
|||
{
|
||||
// Arrange
|
||||
var mapper = TestUtils.GetMapper();
|
||||
var mockService = new Mock<IFeedbackReceiverService>();
|
||||
var mockService = new Mock<IFeedbackReceiversService>();
|
||||
var tokensService = new Mock<ITokensService>();
|
||||
var logger = new Mock<ILogger<FeedbackReceiversController>>();
|
||||
|
||||
|
@ -104,7 +104,7 @@ namespace Retroactiune.Tests.Retroactiune.WebAPI.Controllers
|
|||
{
|
||||
// Arrange
|
||||
var mapper = TestUtils.GetMapper();
|
||||
var mockService = new Mock<IFeedbackReceiverService>();
|
||||
var mockService = new Mock<IFeedbackReceiversService>();
|
||||
var tokensService = new Mock<ITokensService>();
|
||||
var logger = new Mock<ILogger<FeedbackReceiversController>>();
|
||||
mockService.Setup(i => i.DeleteManyAsync(It.IsAny<IEnumerable<string>>()))
|
||||
|
@ -127,7 +127,7 @@ namespace Retroactiune.Tests.Retroactiune.WebAPI.Controllers
|
|||
{
|
||||
// Arrange
|
||||
var mapper = TestUtils.GetMapper();
|
||||
var mockService = new Mock<IFeedbackReceiverService>();
|
||||
var mockService = new Mock<IFeedbackReceiversService>();
|
||||
var tokensService = new Mock<ITokensService>();
|
||||
var logger = new Mock<ILogger<FeedbackReceiversController>>();
|
||||
mockService.Setup(i => i.FindAsync(It.IsAny<IEnumerable<string>>(), null, null))
|
||||
|
@ -150,7 +150,7 @@ namespace Retroactiune.Tests.Retroactiune.WebAPI.Controllers
|
|||
{
|
||||
// Arrange
|
||||
var mapper = TestUtils.GetMapper();
|
||||
var mockService = new Mock<IFeedbackReceiverService>();
|
||||
var mockService = new Mock<IFeedbackReceiversService>();
|
||||
var tokensService = new Mock<ITokensService>();
|
||||
var logger = new Mock<ILogger<FeedbackReceiversController>>();
|
||||
|
||||
|
@ -171,7 +171,7 @@ namespace Retroactiune.Tests.Retroactiune.WebAPI.Controllers
|
|||
{
|
||||
// Arrange
|
||||
var mapper = TestUtils.GetMapper();
|
||||
var mockService = new Mock<IFeedbackReceiverService>();
|
||||
var mockService = new Mock<IFeedbackReceiversService>();
|
||||
var tokensService = new Mock<ITokensService>();
|
||||
var logger = new Mock<ILogger<FeedbackReceiversController>>();
|
||||
var filterArr = filter as string[] ?? filter.ToArray();
|
||||
|
|
|
@ -19,7 +19,7 @@ namespace Retroactiune.Tests.Retroactiune.WebAPI.Controllers
|
|||
public async Task Test_GenerateTokens_InexistentFeedbackReceiver()
|
||||
{
|
||||
// Arrange
|
||||
var feedbackService = new Mock<IFeedbackReceiverService>();
|
||||
var feedbackService = new Mock<IFeedbackReceiversService>();
|
||||
var mapper = TestUtils.GetMapper();
|
||||
var tokens = new Mock<ITokensService>();
|
||||
var logger = new Mock<ILogger<TokensController>>();
|
||||
|
@ -37,7 +37,7 @@ namespace Retroactiune.Tests.Retroactiune.WebAPI.Controllers
|
|||
{
|
||||
// Arrange
|
||||
var mapper = TestUtils.GetMapper();
|
||||
var feedbackService = new Mock<IFeedbackReceiverService>();
|
||||
var feedbackService = new Mock<IFeedbackReceiversService>();
|
||||
var tokens = new Mock<ITokensService>();
|
||||
var logger = new Mock<ILogger<TokensController>>();
|
||||
|
||||
|
@ -64,7 +64,7 @@ namespace Retroactiune.Tests.Retroactiune.WebAPI.Controllers
|
|||
{
|
||||
// Arrange
|
||||
var mapper = TestUtils.GetMapper();
|
||||
var feedbackService = new Mock<IFeedbackReceiverService>();
|
||||
var feedbackService = new Mock<IFeedbackReceiversService>();
|
||||
var tokens = new Mock<ITokensService>();
|
||||
var logger = new Mock<ILogger<TokensController>>();
|
||||
|
||||
|
@ -82,7 +82,7 @@ namespace Retroactiune.Tests.Retroactiune.WebAPI.Controllers
|
|||
{
|
||||
// Arrange
|
||||
var mapper = TestUtils.GetMapper();
|
||||
var feedbackService = new Mock<IFeedbackReceiverService>();
|
||||
var feedbackService = new Mock<IFeedbackReceiversService>();
|
||||
var tokens = new Mock<ITokensService>();
|
||||
var logger = new Mock<ILogger<TokensController>>();
|
||||
tokens.Setup(i => i.DeleteTokens(It.IsAny<IEnumerable<string>>()))
|
||||
|
@ -102,7 +102,7 @@ namespace Retroactiune.Tests.Retroactiune.WebAPI.Controllers
|
|||
{
|
||||
// Arrange
|
||||
var mapper = TestUtils.GetMapper();
|
||||
var feedbackService = new Mock<IFeedbackReceiverService>();
|
||||
var feedbackService = new Mock<IFeedbackReceiversService>();
|
||||
var tokens = new Mock<ITokensService>();
|
||||
var logger = new Mock<ILogger<TokensController>>();
|
||||
|
||||
|
@ -120,7 +120,7 @@ namespace Retroactiune.Tests.Retroactiune.WebAPI.Controllers
|
|||
{
|
||||
// Arrange
|
||||
var mapper = TestUtils.GetMapper();
|
||||
var feedbackService = new Mock<IFeedbackReceiverService>();
|
||||
var feedbackService = new Mock<IFeedbackReceiversService>();
|
||||
var tokens = new Mock<ITokensService>();
|
||||
var logger = new Mock<ILogger<TokensController>>();
|
||||
tokens.Setup(i => i.DeleteTokens(It.IsAny<IEnumerable<string>>()))
|
||||
|
@ -140,7 +140,7 @@ namespace Retroactiune.Tests.Retroactiune.WebAPI.Controllers
|
|||
{
|
||||
// Arrange
|
||||
var mapper = TestUtils.GetMapper();
|
||||
var feedbackService = new Mock<IFeedbackReceiverService>();
|
||||
var feedbackService = new Mock<IFeedbackReceiversService>();
|
||||
var tokens = new Mock<ITokensService>();
|
||||
var logger = new Mock<ILogger<TokensController>>();
|
||||
|
||||
|
@ -158,7 +158,7 @@ namespace Retroactiune.Tests.Retroactiune.WebAPI.Controllers
|
|||
{
|
||||
// Arrange
|
||||
var mapper = TestUtils.GetMapper();
|
||||
var feedbackService = new Mock<IFeedbackReceiverService>();
|
||||
var feedbackService = new Mock<IFeedbackReceiversService>();
|
||||
var tokens = new Mock<ITokensService>();
|
||||
var logger = new Mock<ILogger<TokensController>>();
|
||||
tokens.Setup(i => i.ListTokens(It.IsAny<TokenListFilters>()))
|
||||
|
|
|
@ -22,16 +22,16 @@ namespace Retroactiune.Controllers
|
|||
private readonly IOptions<ApiBehaviorOptions> _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> apiBehaviorOptions, ILogger<FeedbackReceiversController> 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));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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<TokensController> logger, IMapper mapper)
|
||||
{
|
||||
_feedbackReceiverService = feedbackReceiverService;
|
||||
_feedbackReceiversService = feedbackReceiversService;
|
||||
_tokensService = tokensService;
|
||||
_mapper = mapper;
|
||||
_logger = logger;
|
||||
|
@ -72,7 +72,7 @@ namespace Retroactiune.Controllers
|
|||
public async Task<IActionResult> GenerateTokens([Required] GenerateTokensDto generateTokensDto)
|
||||
{
|
||||
var feedbackReceiverId = generateTokensDto.FeedbackReceiverId;
|
||||
var result = await _feedbackReceiverService.FindAsync(
|
||||
var result = await _feedbackReceiversService.FindAsync(
|
||||
new[] {feedbackReceiverId});
|
||||
if (!result.Any())
|
||||
{
|
||||
|
|
|
@ -38,7 +38,7 @@ namespace Retroactiune
|
|||
|
||||
|
||||
// Services
|
||||
services.AddSingleton<IFeedbackReceiverService, FeedbackReceiverService>();
|
||||
services.AddSingleton<IFeedbackReceiversService, FeedbackReceiversService>();
|
||||
services.AddSingleton<ITokensService, TokensService>();
|
||||
services.AddSingleton<IMongoClient, MongoClient>(i =>
|
||||
{
|
||||
|
|
|
@ -34,7 +34,7 @@ namespace Retroactiune
|
|||
services.AddAutoMapper(AppDomain.CurrentDomain.GetAssemblies());
|
||||
|
||||
// Services
|
||||
services.AddSingleton<IFeedbackReceiverService, FeedbackReceiverService>();
|
||||
services.AddSingleton<IFeedbackReceiversService, FeedbackReceiversService>();
|
||||
services.AddSingleton<ITokensService, TokensService>();
|
||||
services.AddSingleton<IMongoClient, MongoClient>(i =>
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue