Rename TokensService.cs to TokenService.cs
This commit is contained in:
parent
910343207c
commit
32054fea3c
4 changed files with 7 additions and 7 deletions
|
@ -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);
|
|
@ -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
|
||||||
|
|
|
@ -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>>();
|
||||||
|
|
|
@ -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>>();
|
||||||
|
|
Loading…
Reference in a new issue