Rename TokensService.cs to TokenService.cs

This commit is contained in:
Denis-Cosmin Nutiu 2021-06-27 16:51:45 +03:00
parent 910343207c
commit 32054fea3c
4 changed files with 7 additions and 7 deletions

View file

@ -8,11 +8,11 @@ using Retroactiune.Core.Interfaces;
namespace Retroactiune.Core.Services namespace Retroactiune.Core.Services
{ {
public class TokensService : ITokensService public class TokenService : ITokensService
{ {
private readonly IMongoCollection<Token> _collection; private readonly IMongoCollection<Token> _collection;
public TokensService(IMongoClient client, IDatabaseSettings settings) public TokenService(IMongoClient client, IDatabaseSettings settings)
{ {
var database = client.GetDatabase(settings.DatabaseName); var database = client.GetDatabase(settings.DatabaseName);
_collection = database.GetCollection<Token>(settings.TokensCollectionName); _collection = database.GetCollection<Token>(settings.TokensCollectionName);

View file

@ -35,7 +35,7 @@ namespace Retroactiune.Tests.Retroactiune.Core.Services
.Returns(mongoCollectionMock.Object); .Returns(mongoCollectionMock.Object);
// Test & Assert // Test & Assert
var service = new TokensService(mongoClientMock.Object, mongoSettingsMock.Object); var service = new TokenService(mongoClientMock.Object, mongoSettingsMock.Object);
await Assert.ThrowsAsync<ArgumentException>(async () => { await service.GenerateTokensAsync(-1, ""); }); await Assert.ThrowsAsync<ArgumentException>(async () => { await service.GenerateTokensAsync(-1, ""); });
} }
@ -63,7 +63,7 @@ namespace Retroactiune.Tests.Retroactiune.Core.Services
// Test // Test
var expiryTime = DateTime.UtcNow; var expiryTime = DateTime.UtcNow;
var service = new TokensService(mongoClientMock.Object, mongoSettingsMock.Object); var service = new TokenService(mongoClientMock.Object, mongoSettingsMock.Object);
await service.GenerateTokensAsync(3, "Hello", expiryTime); await service.GenerateTokensAsync(3, "Hello", expiryTime);
// Assert // Assert
@ -104,7 +104,7 @@ namespace Retroactiune.Tests.Retroactiune.Core.Services
.Returns(mongoCollectionMock.Object); .Returns(mongoCollectionMock.Object);
// Test // Test
var service = new TokensService(mongoClientMock.Object, mongoSettingsMock.Object); var service = new TokenService(mongoClientMock.Object, mongoSettingsMock.Object);
await service.DeleteTokens(new[] {"test_id"}); await service.DeleteTokens(new[] {"test_id"});
// Assert // Assert

View file

@ -39,7 +39,7 @@ namespace Retroactiune
// Services // Services
services.AddSingleton<IFeedbackReceiverService, FeedbackReceiverService>(); services.AddSingleton<IFeedbackReceiverService, FeedbackReceiverService>();
services.AddSingleton<ITokensService, TokensService>(); services.AddSingleton<ITokensService, TokenService>();
services.AddSingleton<IMongoClient, MongoClient>(i => services.AddSingleton<IMongoClient, MongoClient>(i =>
{ {
var settings = i.GetService<IOptions<DatabaseSettings>>(); var settings = i.GetService<IOptions<DatabaseSettings>>();

View file

@ -35,7 +35,7 @@ namespace Retroactiune
// Services // Services
services.AddSingleton<IFeedbackReceiverService, FeedbackReceiverService>(); services.AddSingleton<IFeedbackReceiverService, FeedbackReceiverService>();
services.AddSingleton<ITokensService, TokensService>(); services.AddSingleton<ITokensService, TokenService>();
services.AddSingleton<IMongoClient, MongoClient>(i => services.AddSingleton<IMongoClient, MongoClient>(i =>
{ {
var settings = i.GetService<IOptions<DatabaseSettings>>(); var settings = i.GetService<IOptions<DatabaseSettings>>();