diff --git a/.editorconfig b/.editorconfig
index 5f1f4fb..31931b5 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -42,6 +42,9 @@ tab_width = 4
dotnet_separate_import_directive_groups = false
dotnet_sort_system_directives_first = false
+# Namespace matching folder structure preferences
+dotnet_style_namespace_match_folder = true:warning
+
# this. and Me. preferences
dotnet_style_qualification_for_event = false:warning
dotnet_style_qualification_for_field = false:warning
@@ -202,6 +205,16 @@ dotnet_naming_rule.non_field_members_should_be_pascal_case.severity = warning
dotnet_naming_rule.non_field_members_should_be_pascal_case.symbols = non_field_members
dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case
+dotnet_naming_rule.async_methods_end_in_async.symbols = async_methods
+dotnet_naming_rule.async_methods_end_in_async.style = end_in_async
+dotnet_naming_rule.async_methods_end_in_async.severity = warning
+
+dotnet_naming_symbols.async_methods.applicable_kinds = method
+dotnet_naming_symbols.async_methods.required_modifiers = async
+
+dotnet_naming_style.end_in_async.required_suffix = Async
+dotnet_naming_style.end_in_async.capitalization = pascal_case
+
# Symbol specifications
dotnet_naming_symbols.interface.applicable_kinds = interface
diff --git a/Directory.Packages.props b/Directory.Packages.props
index 758bf42..e708603 100644
--- a/Directory.Packages.props
+++ b/Directory.Packages.props
@@ -5,30 +5,30 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
@@ -40,26 +40,26 @@
-
-
-
-
+
+
+
+
-
+
-
+
-
+
-
-
-
+
+
+
diff --git a/InvoiceReminder.API/Endpoints/SendMessageEndpoints.cs b/InvoiceReminder.API/Endpoints/SendMessageEndpoints.cs
index 2f84fdd..9a64c7b 100644
--- a/InvoiceReminder.API/Endpoints/SendMessageEndpoints.cs
+++ b/InvoiceReminder.API/Endpoints/SendMessageEndpoints.cs
@@ -17,7 +17,7 @@ private static void MapSendMessage(RouteGroupBuilder endpoint)
{
_ = endpoint.MapGet("/{id}", async (ISendMessageService messageService, Guid id, CancellationToken ct) =>
{
- var result = await messageService.SendMessage(id, ct);
+ var result = await messageService.SendMessageAsync(id, ct);
return !string.IsNullOrEmpty(result)
? Results.Ok(result)
diff --git a/InvoiceReminder.CrossCutting.IoC/DependencyInjectionConfig.cs b/InvoiceReminder.CrossCutting.IoC/DependencyInjectionConfig.cs
index 56276ee..c3fbfab 100644
--- a/InvoiceReminder.CrossCutting.IoC/DependencyInjectionConfig.cs
+++ b/InvoiceReminder.CrossCutting.IoC/DependencyInjectionConfig.cs
@@ -67,7 +67,10 @@ private static IServiceCollection AddDbContext(this IServiceCollection services)
var config = sp.GetRequiredService();
_ = options.UseNpgsql(config.GetConnectionString("DatabaseConnection"),
- b => b.MigrationsHistoryTable("__EFMigrationsHistory", "invoice_reminder")
+ b => b.MigrationsHistoryTable(
+ tableName: "__EFMigrationsHistory",
+ schema: "invoice_reminder"
+ )
);
});
diff --git a/InvoiceReminder.Data/Repository/UnitOfWork.cs b/InvoiceReminder.Data/Repository/UnitOfWork.cs
index 56f1c50..b11f9ca 100644
--- a/InvoiceReminder.Data/Repository/UnitOfWork.cs
+++ b/InvoiceReminder.Data/Repository/UnitOfWork.cs
@@ -30,7 +30,7 @@ public async Task SaveChangesAsync(CancellationToken cancellationToken = default
try
{
- await OpenConnection(cancellationToken);
+ await OpenConnectionAsync(cancellationToken);
transaction = await _context.Database.BeginTransactionAsync(cancellationToken);
@@ -67,11 +67,11 @@ public async Task SaveChangesAsync(CancellationToken cancellationToken = default
finally
{
transaction?.Dispose();
- await CloseConnection();
+ await CloseConnectionAsync();
}
}
- private async Task OpenConnection(CancellationToken cancellationToken = default)
+ private async Task OpenConnectionAsync(CancellationToken cancellationToken = default)
{
if (_connection.State == ConnectionState.Closed)
{
@@ -79,7 +79,7 @@ private async Task OpenConnection(CancellationToken cancellationToken = default)
}
}
- private async Task CloseConnection()
+ private async Task CloseConnectionAsync()
{
if (_connection.State == ConnectionState.Open)
{
diff --git a/InvoiceReminder.ExternalServices/SendMessage/ISendMessageService.cs b/InvoiceReminder.ExternalServices/SendMessage/ISendMessageService.cs
index e9de2cc..9876f18 100644
--- a/InvoiceReminder.ExternalServices/SendMessage/ISendMessageService.cs
+++ b/InvoiceReminder.ExternalServices/SendMessage/ISendMessageService.cs
@@ -2,5 +2,5 @@ namespace InvoiceReminder.ExternalServices.SendMessage;
public interface ISendMessageService
{
- Task SendMessage(Guid userId, CancellationToken cancellationToken = default);
+ Task SendMessageAsync(Guid userId, CancellationToken cancellationToken = default);
}
diff --git a/InvoiceReminder.ExternalServices/SendMessage/SendMessageService.cs b/InvoiceReminder.ExternalServices/SendMessage/SendMessageService.cs
index 9bd8a8a..67a0193 100644
--- a/InvoiceReminder.ExternalServices/SendMessage/SendMessageService.cs
+++ b/InvoiceReminder.ExternalServices/SendMessage/SendMessageService.cs
@@ -33,7 +33,7 @@ public SendMessageService(
_logger = logger;
}
- public async Task SendMessage(Guid userId, CancellationToken cancellationToken = default)
+ public async Task SendMessageAsync(Guid userId, CancellationToken cancellationToken = default)
{
IDictionary attachments;
@@ -77,7 +77,7 @@ public async Task SendMessage(Guid userId, CancellationToken cancellatio
}
catch (OperationCanceledException ex) when (cancellationToken.IsCancellationRequested)
{
- var method = $"{nameof(SendMessageService)}.{nameof(SendMessage)}";
+ var method = $"{nameof(SendMessageService)}.{nameof(SendMessageAsync)}";
var contextualInfo = $"Method {method} execution was interrupted by a CancellationToken Request...";
if (_logger.IsEnabled(LogLevel.Warning))
diff --git a/InvoiceReminder.JobScheduler/JobSettings/CronJob.cs b/InvoiceReminder.JobScheduler/JobSettings/CronJob.cs
index 0291503..afddc52 100644
--- a/InvoiceReminder.JobScheduler/JobSettings/CronJob.cs
+++ b/InvoiceReminder.JobScheduler/JobSettings/CronJob.cs
@@ -30,7 +30,6 @@ public async Task Execute(IJobExecutionContext context)
_logger.LogInformation("{Message}", message);
}
- // possÃvel uso de um agendamento de envio de mensagem para lembrete no dia do vencimento?...
- _ = await service.SendMessage(id);
+ _ = await service.SendMessageAsync(id, context.CancellationToken);
}
}
diff --git a/InvoiceReminder.UnitTests.API/Endpoints/SendMessageEndpointsTests.cs b/InvoiceReminder.UnitTests.API/Endpoints/SendMessageEndpointsTests.cs
index 62fee02..131da7a 100644
--- a/InvoiceReminder.UnitTests.API/Endpoints/SendMessageEndpointsTests.cs
+++ b/InvoiceReminder.UnitTests.API/Endpoints/SendMessageEndpointsTests.cs
@@ -44,7 +44,7 @@ public async Task SendMessage_WhenUserIsAuthenticated_ShouldReturnOk()
var expectedResult = "Total messages sent: 1";
- _ = _sendMessageService.SendMessage(Arg.Any(), Arg.Any())
+ _ = _sendMessageService.SendMessageAsync(Arg.Any(), Arg.Any())
.Returns(Task.FromResult(expectedResult));
_ = _authorizationService.AuthorizeAsync(Arg.Any(), Arg.Any