diff --git a/AdminUi/src/AdminUi.Infrastructure.Database.Postgres/AdminUi.Infrastructure.Database.Postgres.csproj b/AdminUi/src/AdminUi.Infrastructure.Database.Postgres/AdminUi.Infrastructure.Database.Postgres.csproj index 2edf5a0a17..bc19a9b981 100644 --- a/AdminUi/src/AdminUi.Infrastructure.Database.Postgres/AdminUi.Infrastructure.Database.Postgres.csproj +++ b/AdminUi/src/AdminUi.Infrastructure.Database.Postgres/AdminUi.Infrastructure.Database.Postgres.csproj @@ -1,9 +1,5 @@ - - enable - - diff --git a/AdminUi/src/AdminUi.Infrastructure.Database.SqlServer/AdminUi.Infrastructure.Database.SqlServer.csproj b/AdminUi/src/AdminUi.Infrastructure.Database.SqlServer/AdminUi.Infrastructure.Database.SqlServer.csproj index 2edf5a0a17..bc19a9b981 100644 --- a/AdminUi/src/AdminUi.Infrastructure.Database.SqlServer/AdminUi.Infrastructure.Database.SqlServer.csproj +++ b/AdminUi/src/AdminUi.Infrastructure.Database.SqlServer/AdminUi.Infrastructure.Database.SqlServer.csproj @@ -1,9 +1,5 @@ - - enable - - diff --git a/AdminUi/src/AdminUi.Infrastructure/AdminUi.Infrastructure.csproj b/AdminUi/src/AdminUi.Infrastructure/AdminUi.Infrastructure.csproj index 0e09d4df82..f697b708cd 100644 --- a/AdminUi/src/AdminUi.Infrastructure/AdminUi.Infrastructure.csproj +++ b/AdminUi/src/AdminUi.Infrastructure/AdminUi.Infrastructure.csproj @@ -1,9 +1,5 @@ - - enable - - diff --git a/AdminUi/src/AdminUi.Infrastructure/DTOs/ClientOverview.cs b/AdminUi/src/AdminUi.Infrastructure/DTOs/ClientOverview.cs index b371836681..f7df92ee55 100644 --- a/AdminUi/src/AdminUi.Infrastructure/DTOs/ClientOverview.cs +++ b/AdminUi/src/AdminUi.Infrastructure/DTOs/ClientOverview.cs @@ -1,10 +1,10 @@ namespace Backbone.AdminUi.Infrastructure.DTOs; public class ClientOverview { - public string ClientId { get; set; } - public string DisplayName { get; set; } - public TierDTO DefaultTier { get; set; } - public DateTime CreatedAt { get; set; } + public required string ClientId { get; set; } + public required string DisplayName { get; set; } + public required TierDTO DefaultTier { get; set; } + public required DateTime CreatedAt { get; set; } public int? MaxIdentities { get; set; } - public int NumberOfIdentities { get; set; } + public required int NumberOfIdentities { get; set; } } diff --git a/AdminUi/src/AdminUi.Infrastructure/DTOs/IdentityOverview.cs b/AdminUi/src/AdminUi.Infrastructure/DTOs/IdentityOverview.cs index dc1b69590c..df5c0967b9 100644 --- a/AdminUi/src/AdminUi.Infrastructure/DTOs/IdentityOverview.cs +++ b/AdminUi/src/AdminUi.Infrastructure/DTOs/IdentityOverview.cs @@ -2,12 +2,12 @@ public class IdentityOverview { - public string Address { get; set; } - public DateTime CreatedAt { get; set; } + public required string Address { get; set; } + public required DateTime CreatedAt { get; set; } public DateTime? LastLoginAt { get; set; } public string? CreatedWithClient { get; set; } public int? DatawalletVersion { get; set; } - public byte IdentityVersion { get; set; } - public TierDTO Tier { get; set; } + public required byte IdentityVersion { get; set; } + public required TierDTO Tier { get; set; } public int? NumberOfDevices { get; set; } } diff --git a/AdminUi/src/AdminUi.Infrastructure/DTOs/RelationshipOverview.cs b/AdminUi/src/AdminUi.Infrastructure/DTOs/RelationshipOverview.cs index fdb81ee349..134f26b98c 100644 --- a/AdminUi/src/AdminUi.Infrastructure/DTOs/RelationshipOverview.cs +++ b/AdminUi/src/AdminUi.Infrastructure/DTOs/RelationshipOverview.cs @@ -1,14 +1,14 @@ namespace Backbone.AdminUi.Infrastructure.DTOs; public class RelationshipOverview { - public string From { get; set; } - public string To { get; set; } - public string RelationshipTemplateId { get; set; } - public RelationshipStatus Status { get; set; } - public DateTime CreatedAt { get; set; } + public required string From { get; set; } + public required string To { get; set; } + public required string RelationshipTemplateId { get; set; } + public required RelationshipStatus Status { get; set; } + public required DateTime CreatedAt { get; set; } public DateTime? AnsweredAt { get; set; } - public string CreatedByDevice { get; set; } - public string? AnsweredByDevice { get; set; } + public required string CreatedByDevice { get; set; } + public required string? AnsweredByDevice { get; set; } } public enum RelationshipStatus diff --git a/AdminUi/src/AdminUi.Infrastructure/DTOs/TierOverview.cs b/AdminUi/src/AdminUi.Infrastructure/DTOs/TierOverview.cs index e495385bfe..e56555facf 100644 --- a/AdminUi/src/AdminUi.Infrastructure/DTOs/TierOverview.cs +++ b/AdminUi/src/AdminUi.Infrastructure/DTOs/TierOverview.cs @@ -1,7 +1,7 @@ namespace Backbone.AdminUi.Infrastructure.DTOs; public class TierOverview { - public string Id { get; set; } - public string Name { get; set; } - public int NumberOfIdentities { get; set; } + public required string Id { get; set; } + public required string Name { get; set; } + public required int NumberOfIdentities { get; set; } } diff --git a/AdminUi/src/AdminUi.Infrastructure/Persistence/Database/AdminUiDbContext.cs b/AdminUi/src/AdminUi.Infrastructure/Persistence/Database/AdminUiDbContext.cs index 7dd12cdc43..2f0017895c 100644 --- a/AdminUi/src/AdminUi.Infrastructure/Persistence/Database/AdminUiDbContext.cs +++ b/AdminUi/src/AdminUi.Infrastructure/Persistence/Database/AdminUiDbContext.cs @@ -18,13 +18,13 @@ public AdminUiDbContext(DbContextOptions options, IServiceProv { } - public DbSet IdentityOverviews { get; set; } + public DbSet IdentityOverviews { get; set; } = null!; - public DbSet TierOverviews { get; set; } + public DbSet TierOverviews { get; set; } = null!; - public DbSet ClientOverviews { get; set; } + public DbSet ClientOverviews { get; set; } = null!; - public DbSet RelationshipOverviews { get; set; } + public DbSet RelationshipOverviews { get; set; } = null!; protected override void OnModelCreating(ModelBuilder builder) { diff --git a/AdminUi/src/AdminUi.Infrastructure/Persistence/IServiceCollectionExtension.cs b/AdminUi/src/AdminUi.Infrastructure/Persistence/IServiceCollectionExtension.cs index 059a52b872..8d8cf22d45 100644 --- a/AdminUi/src/AdminUi.Infrastructure/Persistence/IServiceCollectionExtension.cs +++ b/AdminUi/src/AdminUi.Infrastructure/Persistence/IServiceCollectionExtension.cs @@ -26,7 +26,7 @@ public static IServiceCollection AddDatabase(this IServiceCollection services, S public static IServiceCollection AddDatabase(this IServiceCollection services, Action setupOptions) { var options = new DbOptions(); - setupOptions?.Invoke(options); + setupOptions.Invoke(options); services .AddDbContext(dbContextOptions => @@ -61,8 +61,8 @@ public static IServiceCollection AddDatabase(this IServiceCollection services, A public class DbOptions { - public string Provider { get; set; } - public string ConnectionString { get; set; } + public string Provider { get; set; } = null!; + public string ConnectionString { get; set; } = null!; public RetryOptions RetryOptions { get; set; } = new(); } diff --git a/AdminUi/src/AdminUi/AdminUi.csproj b/AdminUi/src/AdminUi/AdminUi.csproj index 7ce9b3343f..fa2fdf2145 100644 --- a/AdminUi/src/AdminUi/AdminUi.csproj +++ b/AdminUi/src/AdminUi/AdminUi.csproj @@ -1,7 +1,6 @@  - enable false ClientApp\ http://localhost:4200 @@ -12,9 +11,9 @@ - + - + all runtime; build; native; contentfiles; analyzers; buildtransitive @@ -23,7 +22,7 @@ - + diff --git a/AdminUi/src/AdminUi/Authentication/ApiKeyAuthenticationSchemeHandler.cs b/AdminUi/src/AdminUi/Authentication/ApiKeyAuthenticationSchemeHandler.cs index 5716b764e4..757ba43b5e 100644 --- a/AdminUi/src/AdminUi/Authentication/ApiKeyAuthenticationSchemeHandler.cs +++ b/AdminUi/src/AdminUi/Authentication/ApiKeyAuthenticationSchemeHandler.cs @@ -15,7 +15,7 @@ public class ApiKeyAuthenticationSchemeHandler : AuthenticationHandler options, ILoggerFactory logger, UrlEncoder encoder, ISystemClock clock, ApiKeyValidator apiKeyValidator) : base(options, logger, encoder, clock) + public ApiKeyAuthenticationSchemeHandler(IOptionsMonitor options, ILoggerFactory logger, UrlEncoder encoder, ApiKeyValidator apiKeyValidator) : base(options, logger, encoder) { _apiKeyValidator = apiKeyValidator; } diff --git a/AdminUi/src/AdminUi/ClientApp/src/app/components/client/change-secret-dialog/change-secret-dialog.component.html b/AdminUi/src/AdminUi/ClientApp/src/app/components/client/change-secret-dialog/change-secret-dialog.component.html index 81ba941aee..d75081ffbc 100644 --- a/AdminUi/src/AdminUi/ClientApp/src/app/components/client/change-secret-dialog/change-secret-dialog.component.html +++ b/AdminUi/src/AdminUi/ClientApp/src/app/components/client/change-secret-dialog/change-secret-dialog.component.html @@ -16,7 +16,7 @@

{{ header }}

A Client Secret will be generated if this field is left blank.
- Please save the Client Secret since it will be unaccessible after exiting. + Please save the Client Secret since it will be inaccessible after exiting.
diff --git a/AdminUi/src/AdminUi/ClientApp/src/app/components/client/create-client-dialog/create-client-dialog.component.html b/AdminUi/src/AdminUi/ClientApp/src/app/components/client/create-client-dialog/create-client-dialog.component.html index 419dd0f173..b0432b98a0 100644 --- a/AdminUi/src/AdminUi/ClientApp/src/app/components/client/create-client-dialog/create-client-dialog.component.html +++ b/AdminUi/src/AdminUi/ClientApp/src/app/components/client/create-client-dialog/create-client-dialog.component.html @@ -42,7 +42,7 @@

{{ headerCreate }}

- Please save the Client Secret since it will be unaccessible after exiting. + Please save the Client Secret since it will be inaccessible after exiting.
diff --git a/AdminUi/src/AdminUi/Controllers/ClientsController.cs b/AdminUi/src/AdminUi/Controllers/ClientsController.cs index ef19ea204b..2204f03bb4 100644 --- a/AdminUi/src/AdminUi/Controllers/ClientsController.cs +++ b/AdminUi/src/AdminUi/Controllers/ClientsController.cs @@ -85,11 +85,11 @@ public async Task DeleteClient([FromRoute] string clientId, Cance public class ChangeClientSecretRequest { - public string NewSecret { get; set; } + public required string NewSecret { get; set; } } public class UpdateClientRequest { - public string DefaultTier { get; set; } + public required string DefaultTier { get; set; } public int? MaxIdentities { get; set; } } diff --git a/AdminUi/src/AdminUi/Controllers/IdentitiesController.cs b/AdminUi/src/AdminUi/Controllers/IdentitiesController.cs index 667a7c218e..56834bde48 100644 --- a/AdminUi/src/AdminUi/Controllers/IdentitiesController.cs +++ b/AdminUi/src/AdminUi/Controllers/IdentitiesController.cs @@ -14,8 +14,6 @@ using Microsoft.AspNetCore.Mvc; using GetIdentityQueryDevices = Backbone.Modules.Devices.Application.Identities.Queries.GetIdentity.GetIdentityQuery; using GetIdentityQueryQuotas = Backbone.Modules.Quotas.Application.Identities.Queries.GetIdentity.GetIdentityQuery; -using GetIdentityResponseDevices = Backbone.Modules.Devices.Application.Identities.Queries.GetIdentity.GetIdentityResponse; -using GetIdentityResponseQuotas = Backbone.Modules.Quotas.Application.Identities.Queries.GetIdentity.GetIdentityResponse; namespace Backbone.AdminUi.Controllers; @@ -52,8 +50,8 @@ public async Task DeleteIndividualQuota([FromRoute] string identi [ProducesError(StatusCodes.Status404NotFound)] public async Task GetIdentityByAddress([FromRoute] string address, CancellationToken cancellationToken) { - var identity = await _mediator.Send(new GetIdentityQueryDevices(address), cancellationToken); - var quotas = await _mediator.Send(new GetIdentityQueryQuotas(address), cancellationToken); + var identity = await _mediator.Send(new GetIdentityQueryDevices(address), cancellationToken); + var quotas = await _mediator.Send(new GetIdentityQueryQuotas(address), cancellationToken); var response = new GetIdentityResponse { @@ -118,27 +116,27 @@ public async Task StartDeletionProcessAsSupport([FromRoute] strin public class CreateQuotaForIdentityRequest { - public string MetricKey { get; set; } - public int Max { get; set; } - public QuotaPeriod Period { get; set; } + public required string MetricKey { get; set; } + public required int Max { get; set; } + public required QuotaPeriod Period { get; set; } } public class UpdateIdentityTierRequest { - public string TierId { get; set; } + public required string TierId { get; set; } } public class GetIdentityResponse { - public string Address { get; set; } - public string ClientId { get; set; } - public byte[] PublicKey { get; set; } - public string TierId { get; set; } - public DateTime CreatedAt { get; set; } - public byte IdentityVersion { get; set; } - public int NumberOfDevices { get; set; } - public IEnumerable Devices { get; set; } - public IEnumerable Quotas { get; set; } + public required string Address { get; set; } + public required string? ClientId { get; set; } + public required byte[] PublicKey { get; set; } + public required string TierId { get; set; } + public required DateTime CreatedAt { get; set; } + public required byte IdentityVersion { get; set; } + public required int NumberOfDevices { get; set; } + public required IEnumerable Devices { get; set; } + public required IEnumerable Quotas { get; set; } } public class CreateIdentityRequest diff --git a/AdminUi/src/AdminUi/Controllers/LogsController.cs b/AdminUi/src/AdminUi/Controllers/LogsController.cs index 15f3b2d2f4..b3191cb3cc 100644 --- a/AdminUi/src/AdminUi/Controllers/LogsController.cs +++ b/AdminUi/src/AdminUi/Controllers/LogsController.cs @@ -1,11 +1,9 @@ using Backbone.BuildingBlocks.API.Mvc; using Backbone.BuildingBlocks.API.Mvc.ControllerAttributes; using Backbone.BuildingBlocks.Application.Abstractions.Exceptions; -using Backbone.Modules.Devices.Application; using MediatR; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; -using Microsoft.Extensions.Options; using ApplicationException = Backbone.BuildingBlocks.Application.Abstractions.Exceptions.ApplicationException; namespace Backbone.AdminUi.Controllers; @@ -14,13 +12,11 @@ namespace Backbone.AdminUi.Controllers; [Authorize("ApiKey")] public class LogsController : ApiControllerBase { - private readonly ApplicationOptions _options; private readonly ILoggerFactory _loggerFactory; public LogsController( - IMediator mediator, IOptions options, ILoggerFactory logger) : base(mediator) + IMediator mediator, ILoggerFactory logger) : base(mediator) { - _options = options.Value; _loggerFactory = logger; } @@ -54,7 +50,6 @@ public IActionResult CreateLog(LogRequest request) break; default: throw new ApplicationException(GenericApplicationErrors.Validation.InvalidPropertyValue(nameof(request.LogLevel))); - break; } return NoContent(); @@ -63,10 +58,10 @@ public IActionResult CreateLog(LogRequest request) public class LogRequest { - public LogLevel LogLevel { get; set; } - public string Category { get; set; } - public string MessageTemplate { get; set; } - public object[] Arguments { get; set; } + public required LogLevel LogLevel { get; set; } + public required string Category { get; set; } + public required string MessageTemplate { get; set; } + public object[] Arguments { get; set; } = []; } public enum LogLevel diff --git a/AdminUi/src/AdminUi/Controllers/TiersController.cs b/AdminUi/src/AdminUi/Controllers/TiersController.cs index dba727aa6e..613d848262 100644 --- a/AdminUi/src/AdminUi/Controllers/TiersController.cs +++ b/AdminUi/src/AdminUi/Controllers/TiersController.cs @@ -3,7 +3,6 @@ using Backbone.BuildingBlocks.API; using Backbone.BuildingBlocks.API.Mvc; using Backbone.BuildingBlocks.API.Mvc.ControllerAttributes; -using Backbone.Modules.Devices.Application; using Backbone.Modules.Devices.Application.Tiers.Commands.CreateTier; using Backbone.Modules.Devices.Application.Tiers.Commands.DeleteTier; using Backbone.Modules.Quotas.Application.DTOs; @@ -15,7 +14,6 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; -using Microsoft.Extensions.Options; namespace Backbone.AdminUi.Controllers; @@ -24,12 +22,10 @@ namespace Backbone.AdminUi.Controllers; public class TiersController : ApiControllerBase { private readonly AdminUiDbContext _adminUiDbContext; - private readonly ApplicationOptions _options; - public TiersController(IMediator mediator, IOptions options, AdminUiDbContext adminUiDbContext) : base(mediator) + public TiersController(IMediator mediator, AdminUiDbContext adminUiDbContext) : base(mediator) { _adminUiDbContext = adminUiDbContext; - _options = options.Value; } [HttpGet] @@ -91,7 +87,7 @@ public async Task DeleteTierQuota([FromRoute] string tierId, [Fro public class CreateQuotaForTierRequest { - public string MetricKey { get; set; } - public int Max { get; set; } - public QuotaPeriod Period { get; set; } + public required string MetricKey { get; set; } + public required int Max { get; set; } + public required QuotaPeriod Period { get; set; } } diff --git a/AdminUi/src/AdminUi/Extensions/IServiceCollectionExtensions.cs b/AdminUi/src/AdminUi/Extensions/IServiceCollectionExtensions.cs index bd2353456c..8de04b98c5 100644 --- a/AdminUi/src/AdminUi/Extensions/IServiceCollectionExtensions.cs +++ b/AdminUi/src/AdminUi/Extensions/IServiceCollectionExtensions.cs @@ -48,7 +48,7 @@ public static IServiceCollection AddCustomAspNetCore(this IServiceCollection ser options.InvalidModelStateResponseFactory = context => { var firstPropertyWithError = - context.ModelState.First(p => p.Value != null && p.Value.Errors.Count > 0); + context.ModelState.First(p => p.Value is { Errors.Count: > 0 }); var nameOfPropertyWithError = firstPropertyWithError.Key; var firstError = firstPropertyWithError.Value!.Errors.First(); var firstErrorMessage = !string.IsNullOrWhiteSpace(firstError.ErrorMessage) @@ -125,12 +125,10 @@ public static IServiceCollection AddCustomAspNetCore(this IServiceCollection ser var modules = configuration.Modules.GetType().GetProperties(); foreach (var moduleProperty in modules) { - if (moduleProperty is null) continue; - var moduleName = moduleProperty.Name; - var module = configuration.Modules.GetType().GetProperty(moduleName).GetValue(configuration.Modules, null); + var module = configuration.Modules.GetType().GetProperty(moduleName)!.GetValue(configuration.Modules, null)!; var provider = GetPropertyValue(module, "Infrastructure.SqlDatabase.Provider") as string; - var connectionString = GetPropertyValue(module, "Infrastructure.SqlDatabase.ConnectionString") as string; + var connectionString = (string)GetPropertyValue(module, "Infrastructure.SqlDatabase.ConnectionString"); switch (provider) { @@ -158,7 +156,7 @@ public static IServiceCollection AddCustomAspNetCore(this IServiceCollection ser private static object GetPropertyValue(object source, string propertyPath) { foreach (var property in propertyPath.Split('.').Select(s => source.GetType().GetProperty(s))) - source = property.GetValue(source, null); + source = property!.GetValue(source, null)!; return source; } diff --git a/AdminUi/test/AdminUi.Tests.Integration/API/BaseApi.cs b/AdminUi/test/AdminUi.Tests.Integration/API/BaseApi.cs index 1db0bd8b34..003dfe3a62 100644 --- a/AdminUi/test/AdminUi.Tests.Integration/API/BaseApi.cs +++ b/AdminUi/test/AdminUi.Tests.Integration/API/BaseApi.cs @@ -58,9 +58,9 @@ private async Task LoadXsrfTokensAsync() } } - protected async Task> GetOData(string endpoint, RequestConfiguration requestConfiguration) + protected async Task> GetOData(string endpoint) { - return await ExecuteODataRequest(HttpMethod.Get, endpoint, requestConfiguration); + return await ExecuteODataRequest(HttpMethod.Get, endpoint); } protected async Task> Get(string endpoint, RequestConfiguration requestConfiguration) @@ -97,6 +97,9 @@ private async Task ExecuteRequest(HttpMethod method, string endpoi { var request = new HttpRequestMessage(method, ROUTE_PREFIX + endpoint); + if (string.IsNullOrEmpty(requestConfiguration.ContentType)) + throw new ArgumentNullException(nameof(requestConfiguration.ContentType)); + if (!string.IsNullOrEmpty(requestConfiguration.Content)) request.Content = new StringContent(requestConfiguration.Content, MediaTypeHeaderValue.Parse(requestConfiguration.ContentType)); @@ -116,7 +119,7 @@ private async Task ExecuteRequest(HttpMethod method, string endpoi return response; } - private async Task> ExecuteODataRequest(HttpMethod method, string endpoint, RequestConfiguration requestConfiguration) + private async Task> ExecuteODataRequest(HttpMethod method, string endpoint) { var request = new HttpRequestMessage(method, ODATA_ROUTE_PREFIX + endpoint); @@ -141,6 +144,9 @@ private async Task> ExecuteRequest(HttpMethod method, string { var request = new HttpRequestMessage(method, ROUTE_PREFIX + endpoint); + if (string.IsNullOrEmpty(requestConfiguration.ContentType)) + throw new ArgumentNullException(nameof(requestConfiguration.ContentType)); + if (!string.IsNullOrEmpty(requestConfiguration.Content)) request.Content = new StringContent(requestConfiguration.Content, MediaTypeHeaderValue.Parse(requestConfiguration.ContentType)); diff --git a/AdminUi/test/AdminUi.Tests.Integration/API/ClientsApi.cs b/AdminUi/test/AdminUi.Tests.Integration/API/ClientsApi.cs index e36f4a1cf1..f9afc06635 100644 --- a/AdminUi/test/AdminUi.Tests.Integration/API/ClientsApi.cs +++ b/AdminUi/test/AdminUi.Tests.Integration/API/ClientsApi.cs @@ -24,7 +24,7 @@ internal async Task DeleteClient(string clientId, RequestConfigura internal async Task> CreateClient(RequestConfiguration requestConfiguration) { - return await Post($"/Clients", requestConfiguration); + return await Post("/Clients", requestConfiguration); } internal async Task> ChangeClientSecret(string clientId, RequestConfiguration requestConfiguration) diff --git a/AdminUi/test/AdminUi.Tests.Integration/API/IdentitiesApi.cs b/AdminUi/test/AdminUi.Tests.Integration/API/IdentitiesApi.cs index 6748017071..485cc90ea9 100644 --- a/AdminUi/test/AdminUi.Tests.Integration/API/IdentitiesApi.cs +++ b/AdminUi/test/AdminUi.Tests.Integration/API/IdentitiesApi.cs @@ -23,9 +23,9 @@ internal async Task DeleteIndividualQuota(string identityAddress, return await Delete($"/Identities/{identityAddress}/Quotas/{individualQuotaId}", requestConfiguration); } - internal async Task>?> GetIdentityOverviews(RequestConfiguration requestConfiguration) + internal async Task>?> GetIdentityOverviews() { - return await GetOData>("/Identities?$expand=Tier", requestConfiguration); + return await GetOData>("/Identities?$expand=Tier"); } internal async Task> StartDeletionProcess(string identityAddress, RequestConfiguration requestConfiguration) diff --git a/AdminUi/test/AdminUi.Tests.Integration/API/LogsApi.cs b/AdminUi/test/AdminUi.Tests.Integration/API/LogsApi.cs index 7369727bb6..8ebad87e99 100644 --- a/AdminUi/test/AdminUi.Tests.Integration/API/LogsApi.cs +++ b/AdminUi/test/AdminUi.Tests.Integration/API/LogsApi.cs @@ -9,6 +9,6 @@ public LogsApi(IOptions httpConfiguration, HttpClientFactory internal async Task CreateLog(RequestConfiguration requestConfiguration) { - return await Post($"/Logs", requestConfiguration); + return await Post("/Logs", requestConfiguration); } } diff --git a/AdminUi/test/AdminUi.Tests.Integration/AdminUi.Tests.Integration.csproj b/AdminUi/test/AdminUi.Tests.Integration/AdminUi.Tests.Integration.csproj index b0d852a9b9..2275ec68fa 100644 --- a/AdminUi/test/AdminUi.Tests.Integration/AdminUi.Tests.Integration.csproj +++ b/AdminUi/test/AdminUi.Tests.Integration/AdminUi.Tests.Integration.csproj @@ -1,19 +1,18 @@  - enable false - + - + diff --git a/AdminUi/test/AdminUi.Tests.Integration/Models/ChangeClientSecretRequest.cs b/AdminUi/test/AdminUi.Tests.Integration/Models/ChangeClientSecretRequest.cs index 5f9b9c3bcd..53b2a07e38 100644 --- a/AdminUi/test/AdminUi.Tests.Integration/Models/ChangeClientSecretRequest.cs +++ b/AdminUi/test/AdminUi.Tests.Integration/Models/ChangeClientSecretRequest.cs @@ -1,5 +1,5 @@ namespace Backbone.AdminUi.Tests.Integration.Models; public class ChangeClientSecretRequest { - public string NewSecret { get; set; } + public required string NewSecret { get; set; } } diff --git a/AdminUi/test/AdminUi.Tests.Integration/Models/ChangeClientSecretResponse.cs b/AdminUi/test/AdminUi.Tests.Integration/Models/ChangeClientSecretResponse.cs index 71a2f54382..267fb72cde 100644 --- a/AdminUi/test/AdminUi.Tests.Integration/Models/ChangeClientSecretResponse.cs +++ b/AdminUi/test/AdminUi.Tests.Integration/Models/ChangeClientSecretResponse.cs @@ -1,9 +1,9 @@ namespace Backbone.AdminUi.Tests.Integration.Models; public class ChangeClientSecretResponse { - public string ClientId { get; set; } - public string DisplayName { get; set; } - public string ClientSecret { get; set; } - public DateTime CreatedAt { get; set; } + public required string ClientId { get; set; } + public required string DisplayName { get; set; } + public required string ClientSecret { get; set; } + public required DateTime CreatedAt { get; set; } public int? MaxIdentities { get; set; } } diff --git a/AdminUi/test/AdminUi.Tests.Integration/Models/ClientDTO.cs b/AdminUi/test/AdminUi.Tests.Integration/Models/ClientDTO.cs index 5b3c1f868f..7a1a012808 100644 --- a/AdminUi/test/AdminUi.Tests.Integration/Models/ClientDTO.cs +++ b/AdminUi/test/AdminUi.Tests.Integration/Models/ClientDTO.cs @@ -2,9 +2,9 @@ public class ClientDTO { - public string ClientId { get; set; } - public string DisplayName { get; set; } - public string DefaultTier { get; set; } - public DateTime CreatedAt { get; set; } + public required string ClientId { get; set; } + public required string DisplayName { get; set; } + public required string DefaultTier { get; set; } + public required DateTime CreatedAt { get; set; } public int? MaxIdentities { get; set; } } diff --git a/AdminUi/test/AdminUi.Tests.Integration/Models/ClientOverviewDTO.cs b/AdminUi/test/AdminUi.Tests.Integration/Models/ClientOverviewDTO.cs index 5586eec3fc..3202c82be3 100644 --- a/AdminUi/test/AdminUi.Tests.Integration/Models/ClientOverviewDTO.cs +++ b/AdminUi/test/AdminUi.Tests.Integration/Models/ClientOverviewDTO.cs @@ -1,10 +1,10 @@ namespace Backbone.AdminUi.Tests.Integration.Models; public class ClientOverviewDTO { - public string ClientId { get; set; } - public string DisplayName { get; set; } - public TierDTO DefaultTier { get; set; } - public DateTime CreatedAt { get; set; } + public required string ClientId { get; set; } + public required string DisplayName { get; set; } + public required TierDTO DefaultTier { get; set; } + public required DateTime CreatedAt { get; set; } public int? MaxIdentities { get; set; } - public int NumberOfIdentities { get; set; } + public required int NumberOfIdentities { get; set; } } diff --git a/AdminUi/test/AdminUi.Tests.Integration/Models/CreateClientRequest.cs b/AdminUi/test/AdminUi.Tests.Integration/Models/CreateClientRequest.cs index be9be0e2a0..ef915d3309 100644 --- a/AdminUi/test/AdminUi.Tests.Integration/Models/CreateClientRequest.cs +++ b/AdminUi/test/AdminUi.Tests.Integration/Models/CreateClientRequest.cs @@ -2,9 +2,9 @@ public class CreateClientRequest { - public string ClientId { get; set; } - public string DisplayName { get; set; } - public string ClientSecret { get; set; } - public string DefaultTier { get; set; } + public required string ClientId { get; set; } + public required string DisplayName { get; set; } + public required string ClientSecret { get; set; } + public required string DefaultTier { get; set; } public int? MaxIdentities { get; set; } } diff --git a/AdminUi/test/AdminUi.Tests.Integration/Models/CreateClientResponse.cs b/AdminUi/test/AdminUi.Tests.Integration/Models/CreateClientResponse.cs index 69a3dc988f..3e55c7526d 100644 --- a/AdminUi/test/AdminUi.Tests.Integration/Models/CreateClientResponse.cs +++ b/AdminUi/test/AdminUi.Tests.Integration/Models/CreateClientResponse.cs @@ -1,9 +1,9 @@ namespace Backbone.AdminUi.Tests.Integration.Models; public class CreateClientResponse { - public string ClientId { get; set; } - public string DisplayName { get; set; } - public string ClientSecret { get; set; } - public DateTime CreatedAt { get; set; } + public required string ClientId { get; set; } + public required string DisplayName { get; set; } + public required string ClientSecret { get; set; } + public required DateTime CreatedAt { get; set; } public int? MaxIdentities { get; set; } } diff --git a/AdminUi/test/AdminUi.Tests.Integration/Models/CreateIdentityRequest.cs b/AdminUi/test/AdminUi.Tests.Integration/Models/CreateIdentityRequest.cs index 618180cfd8..a6e66ec339 100644 --- a/AdminUi/test/AdminUi.Tests.Integration/Models/CreateIdentityRequest.cs +++ b/AdminUi/test/AdminUi.Tests.Integration/Models/CreateIdentityRequest.cs @@ -2,16 +2,16 @@ public class CreateIdentityRequest { - public string ClientId { get; set; } - public string ClientSecret { get; set; } - public string IdentityPublicKey { get; set; } - public string DevicePassword { get; set; } - public byte IdentityVersion { get; set; } - public CreateIdentityRequestSignedChallenge SignedChallenge { get; set; } + public required string ClientId { get; set; } + public required string ClientSecret { get; set; } + public required string IdentityPublicKey { get; set; } + public required string DevicePassword { get; set; } + public required byte IdentityVersion { get; set; } + public required CreateIdentityRequestSignedChallenge SignedChallenge { get; set; } } public class CreateIdentityRequestSignedChallenge { - public string Challenge { get; set; } - public string Signature { get; set; } + public required string Challenge { get; set; } + public required string Signature { get; set; } } diff --git a/AdminUi/test/AdminUi.Tests.Integration/Models/CreateIdentityResponse.cs b/AdminUi/test/AdminUi.Tests.Integration/Models/CreateIdentityResponse.cs index 53d7f18b20..f7d2cf702d 100644 --- a/AdminUi/test/AdminUi.Tests.Integration/Models/CreateIdentityResponse.cs +++ b/AdminUi/test/AdminUi.Tests.Integration/Models/CreateIdentityResponse.cs @@ -2,15 +2,15 @@ public class CreateIdentityResponse { - public string Address { get; set; } - public DateTime CreatedAt { get; set; } + public required string Address { get; set; } + public required DateTime CreatedAt { get; set; } - public CreateIdentityResponseDevice Device { get; set; } + public required CreateIdentityResponseDevice Device { get; set; } } public class CreateIdentityResponseDevice { - public string Id { get; set; } - public string Username { get; set; } - public DateTime CreatedAt { get; set; } + public required string Id { get; set; } + public required string Username { get; set; } + public required DateTime CreatedAt { get; set; } } diff --git a/AdminUi/test/AdminUi.Tests.Integration/Models/CreateIndividualQuotaRequest.cs b/AdminUi/test/AdminUi.Tests.Integration/Models/CreateIndividualQuotaRequest.cs index 4356b1cc22..30be956c68 100644 --- a/AdminUi/test/AdminUi.Tests.Integration/Models/CreateIndividualQuotaRequest.cs +++ b/AdminUi/test/AdminUi.Tests.Integration/Models/CreateIndividualQuotaRequest.cs @@ -2,7 +2,7 @@ public class CreateIndividualQuotaRequest { - public string MetricKey { get; set; } - public int Max { get; set; } - public string Period { get; set; } + public required string MetricKey { get; set; } + public required int Max { get; set; } + public required string Period { get; set; } } diff --git a/AdminUi/test/AdminUi.Tests.Integration/Models/CreateTierQuotaRequest.cs b/AdminUi/test/AdminUi.Tests.Integration/Models/CreateTierQuotaRequest.cs index 20ece775a1..a40e2b1e4d 100644 --- a/AdminUi/test/AdminUi.Tests.Integration/Models/CreateTierQuotaRequest.cs +++ b/AdminUi/test/AdminUi.Tests.Integration/Models/CreateTierQuotaRequest.cs @@ -2,7 +2,7 @@ public class CreateTierQuotaRequest { - public string MetricKey { get; set; } - public int Max { get; set; } - public string Period { get; set; } + public required string MetricKey { get; set; } + public required int Max { get; set; } + public required string Period { get; set; } } diff --git a/AdminUi/test/AdminUi.Tests.Integration/Models/CreateTierRequest.cs b/AdminUi/test/AdminUi.Tests.Integration/Models/CreateTierRequest.cs index 2e8c489ed0..ee6a1a2a97 100644 --- a/AdminUi/test/AdminUi.Tests.Integration/Models/CreateTierRequest.cs +++ b/AdminUi/test/AdminUi.Tests.Integration/Models/CreateTierRequest.cs @@ -2,5 +2,5 @@ public class CreateTierRequest { - public string Name { get; set; } + public required string Name { get; set; } } diff --git a/AdminUi/test/AdminUi.Tests.Integration/Models/Error.cs b/AdminUi/test/AdminUi.Tests.Integration/Models/Error.cs index 1f402ef38a..cbfe66ea10 100644 --- a/AdminUi/test/AdminUi.Tests.Integration/Models/Error.cs +++ b/AdminUi/test/AdminUi.Tests.Integration/Models/Error.cs @@ -2,9 +2,9 @@ public class Error { - public string Id { get; set; } - public string Code { get; set; } - public string Message { get; set; } - public string Docs { get; set; } - public DateTime Time { get; set; } + public required string Id { get; set; } + public required string Code { get; set; } + public required string Message { get; set; } + public required string Docs { get; set; } + public required DateTime Time { get; set; } } diff --git a/AdminUi/test/AdminUi.Tests.Integration/Models/HttpResponse.cs b/AdminUi/test/AdminUi.Tests.Integration/Models/HttpResponse.cs index 242dc70031..be77ed7fd4 100644 --- a/AdminUi/test/AdminUi.Tests.Integration/Models/HttpResponse.cs +++ b/AdminUi/test/AdminUi.Tests.Integration/Models/HttpResponse.cs @@ -4,23 +4,23 @@ namespace Backbone.AdminUi.Tests.Integration.Models; public class HttpResponse { - public ResponseContent Content { get; set; } - public HttpStatusCode StatusCode { get; set; } - public bool IsSuccessStatusCode { get; set; } + public required ResponseContent Content { get; set; } + public required HttpStatusCode StatusCode { get; set; } + public required bool IsSuccessStatusCode { get; set; } public string? ContentType { get; set; } public string? RawContent { get; set; } } public class HttpResponse { - public HttpStatusCode StatusCode { get; set; } - public bool IsSuccessStatusCode { get; set; } + public required HttpStatusCode StatusCode { get; set; } + public required bool IsSuccessStatusCode { get; set; } public string? ContentType { get; set; } - public ErrorResponseContent? Content { get; set; } + public required ErrorResponseContent? Content { get; set; } } public class Cookie { - public string Name { get; init; } - public string Value { get; init; } + public required string Name { get; init; } + public required string Value { get; init; } } diff --git a/AdminUi/test/AdminUi.Tests.Integration/Models/IdentityOverviewDTO.cs b/AdminUi/test/AdminUi.Tests.Integration/Models/IdentityOverviewDTO.cs index c739c86a66..193844678d 100644 --- a/AdminUi/test/AdminUi.Tests.Integration/Models/IdentityOverviewDTO.cs +++ b/AdminUi/test/AdminUi.Tests.Integration/Models/IdentityOverviewDTO.cs @@ -1,12 +1,12 @@ namespace Backbone.AdminUi.Tests.Integration.Models; public class IdentityOverviewDTO { - public string Address { get; set; } - public DateTime CreatedAt { get; set; } + public required string Address { get; set; } + public required DateTime CreatedAt { get; set; } public DateTime? LastLoginAt { get; set; } public string? CreatedWithClient { get; set; } public int? DatawalletVersion { get; set; } - public byte IdentityVersion { get; set; } - public TierDTO Tier { get; set; } + public required byte IdentityVersion { get; set; } + public required TierDTO Tier { get; set; } public int? NumberOfDevices { get; set; } } diff --git a/AdminUi/test/AdminUi.Tests.Integration/Models/IdentitySummaryDTO.cs b/AdminUi/test/AdminUi.Tests.Integration/Models/IdentitySummaryDTO.cs index f561927074..a1a9c4938d 100644 --- a/AdminUi/test/AdminUi.Tests.Integration/Models/IdentitySummaryDTO.cs +++ b/AdminUi/test/AdminUi.Tests.Integration/Models/IdentitySummaryDTO.cs @@ -2,10 +2,10 @@ public class IdentitySummaryDTO { - public string Address { get; set; } - public string ClientId { get; set; } - public string PublicKey { get; set; } - public DateTime CreatedAt { get; set; } - public byte IdentityVersion { get; set; } - public int NumberOfDevices { get; set; } + public required string Address { get; set; } + public required string ClientId { get; set; } + public required string PublicKey { get; set; } + public required DateTime CreatedAt { get; set; } + public required byte IdentityVersion { get; set; } + public required int NumberOfDevices { get; set; } } diff --git a/AdminUi/test/AdminUi.Tests.Integration/Models/IndividualQuotaDTO.cs b/AdminUi/test/AdminUi.Tests.Integration/Models/IndividualQuotaDTO.cs index ff26eff982..3d64f81639 100644 --- a/AdminUi/test/AdminUi.Tests.Integration/Models/IndividualQuotaDTO.cs +++ b/AdminUi/test/AdminUi.Tests.Integration/Models/IndividualQuotaDTO.cs @@ -1,9 +1,9 @@ namespace Backbone.AdminUi.Tests.Integration.Models; public class IndividualQuotaDTO { - public string Id { get; set; } - public MetricDTO Metric { get; set; } - public int Max { get; set; } - public string Period { get; set; } + public required string Id { get; set; } + public required MetricDTO Metric { get; set; } + public required int Max { get; set; } + public required string Period { get; set; } } diff --git a/AdminUi/test/AdminUi.Tests.Integration/Models/LogRequest.cs b/AdminUi/test/AdminUi.Tests.Integration/Models/LogRequest.cs index d32ff9b3b2..4a0cf8d174 100644 --- a/AdminUi/test/AdminUi.Tests.Integration/Models/LogRequest.cs +++ b/AdminUi/test/AdminUi.Tests.Integration/Models/LogRequest.cs @@ -1,10 +1,10 @@ namespace Backbone.AdminUi.Tests.Integration.Models; public class LogRequest { - public LogLevel LogLevel { get; set; } - public string Category { get; set; } - public string MessageTemplate { get; set; } - public object[] Arguments { get; set; } + public required LogLevel LogLevel { get; set; } + public required string Category { get; set; } + public required string MessageTemplate { get; set; } + public object[]? Arguments { get; set; } } public enum LogLevel diff --git a/AdminUi/test/AdminUi.Tests.Integration/Models/MetricDTO.cs b/AdminUi/test/AdminUi.Tests.Integration/Models/MetricDTO.cs index be38e66eaa..b26befcd4d 100644 --- a/AdminUi/test/AdminUi.Tests.Integration/Models/MetricDTO.cs +++ b/AdminUi/test/AdminUi.Tests.Integration/Models/MetricDTO.cs @@ -2,6 +2,6 @@ public class MetricDTO { - public string Key { get; set; } - public string DisplayName { get; set; } + public required string Key { get; set; } + public required string DisplayName { get; set; } } diff --git a/AdminUi/test/AdminUi.Tests.Integration/Models/ODataResponse.cs b/AdminUi/test/AdminUi.Tests.Integration/Models/ODataResponse.cs index dabcc40ef7..2a6f3c4212 100644 --- a/AdminUi/test/AdminUi.Tests.Integration/Models/ODataResponse.cs +++ b/AdminUi/test/AdminUi.Tests.Integration/Models/ODataResponse.cs @@ -4,9 +4,9 @@ namespace Backbone.AdminUi.Tests.Integration.Models; public class ODataResponse { - public ODataResponseContent Content { get; set; } - public HttpStatusCode StatusCode { get; set; } - public bool IsSuccessStatusCode { get; set; } + public required ODataResponseContent Content { get; set; } + public required HttpStatusCode StatusCode { get; set; } + public required bool IsSuccessStatusCode { get; set; } public string? ContentType { get; set; } public string? RawContent { get; set; } } diff --git a/AdminUi/test/AdminUi.Tests.Integration/Models/ResponseContent.cs b/AdminUi/test/AdminUi.Tests.Integration/Models/ResponseContent.cs index fc0c3f66d5..8511f5943b 100644 --- a/AdminUi/test/AdminUi.Tests.Integration/Models/ResponseContent.cs +++ b/AdminUi/test/AdminUi.Tests.Integration/Models/ResponseContent.cs @@ -14,5 +14,5 @@ public class ErrorResponseContent { [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] - public Error Error { get; set; } + public required Error Error { get; set; } } diff --git a/AdminUi/test/AdminUi.Tests.Integration/Models/StartDeletionProcessAsSupportResponse.cs b/AdminUi/test/AdminUi.Tests.Integration/Models/StartDeletionProcessAsSupportResponse.cs index 781867ea04..508931bb97 100644 --- a/AdminUi/test/AdminUi.Tests.Integration/Models/StartDeletionProcessAsSupportResponse.cs +++ b/AdminUi/test/AdminUi.Tests.Integration/Models/StartDeletionProcessAsSupportResponse.cs @@ -2,7 +2,7 @@ public class StartDeletionProcessAsSupportResponse { - public string Id { get; set; } - public string Status { get; set; } - public DateTime CreatedAt { get; set; } + public required string Id { get; set; } + public required string Status { get; set; } + public required DateTime CreatedAt { get; set; } } diff --git a/AdminUi/test/AdminUi.Tests.Integration/Models/TierDTO.cs b/AdminUi/test/AdminUi.Tests.Integration/Models/TierDTO.cs index 09a5399e98..0eeb394545 100644 --- a/AdminUi/test/AdminUi.Tests.Integration/Models/TierDTO.cs +++ b/AdminUi/test/AdminUi.Tests.Integration/Models/TierDTO.cs @@ -2,6 +2,6 @@ public class TierDTO { - public string Id { get; set; } - public string Name { get; set; } + public required string Id { get; set; } + public required string Name { get; set; } } diff --git a/AdminUi/test/AdminUi.Tests.Integration/Models/TierDetailsDTO.cs b/AdminUi/test/AdminUi.Tests.Integration/Models/TierDetailsDTO.cs index 225bd3d8db..7bf4eb5ea2 100644 --- a/AdminUi/test/AdminUi.Tests.Integration/Models/TierDetailsDTO.cs +++ b/AdminUi/test/AdminUi.Tests.Integration/Models/TierDetailsDTO.cs @@ -1,7 +1,7 @@ namespace Backbone.AdminUi.Tests.Integration.Models; public class TierDetailsDTO { - public string Id { get; set; } - public string Name { get; set; } - public IEnumerable Quotas { get; set; } + public required string Id { get; set; } + public required string Name { get; set; } + public required IEnumerable Quotas { get; set; } } diff --git a/AdminUi/test/AdminUi.Tests.Integration/Models/TierOverviewDTO.cs b/AdminUi/test/AdminUi.Tests.Integration/Models/TierOverviewDTO.cs index 169bf2396e..d938de2bf9 100644 --- a/AdminUi/test/AdminUi.Tests.Integration/Models/TierOverviewDTO.cs +++ b/AdminUi/test/AdminUi.Tests.Integration/Models/TierOverviewDTO.cs @@ -1,7 +1,7 @@ namespace Backbone.AdminUi.Tests.Integration.Models; public class TierOverviewDTO { - public string Id { get; set; } - public string Name { get; set; } - public int NumberOfIdentities { get; set; } + public required string Id { get; set; } + public required string Name { get; set; } + public required int NumberOfIdentities { get; set; } } diff --git a/AdminUi/test/AdminUi.Tests.Integration/Models/TierQuotaDTO.cs b/AdminUi/test/AdminUi.Tests.Integration/Models/TierQuotaDTO.cs index bf2aa8e4d7..31bb890f64 100644 --- a/AdminUi/test/AdminUi.Tests.Integration/Models/TierQuotaDTO.cs +++ b/AdminUi/test/AdminUi.Tests.Integration/Models/TierQuotaDTO.cs @@ -2,8 +2,8 @@ public class TierQuotaDTO { - public string Id { get; set; } - public MetricDTO Metric { get; set; } - public int Max { get; set; } - public string Period { get; set; } + public required string Id { get; set; } + public required MetricDTO Metric { get; set; } + public required int Max { get; set; } + public required string Period { get; set; } } diff --git a/AdminUi/test/AdminUi.Tests.Integration/Models/UpdateClientRequest.cs b/AdminUi/test/AdminUi.Tests.Integration/Models/UpdateClientRequest.cs index 613de551fe..3c0e445336 100644 --- a/AdminUi/test/AdminUi.Tests.Integration/Models/UpdateClientRequest.cs +++ b/AdminUi/test/AdminUi.Tests.Integration/Models/UpdateClientRequest.cs @@ -1,6 +1,6 @@ namespace Backbone.AdminUi.Tests.Integration.Models; public class UpdateClientRequest { - public string DefaultTier { get; set; } + public required string DefaultTier { get; set; } public int? MaxIdentities { get; set; } } diff --git a/AdminUi/test/AdminUi.Tests.Integration/Models/UpdateClientResponse.cs b/AdminUi/test/AdminUi.Tests.Integration/Models/UpdateClientResponse.cs index 40bf23201e..64f79e61cd 100644 --- a/AdminUi/test/AdminUi.Tests.Integration/Models/UpdateClientResponse.cs +++ b/AdminUi/test/AdminUi.Tests.Integration/Models/UpdateClientResponse.cs @@ -1,9 +1,9 @@ namespace Backbone.AdminUi.Tests.Integration.Models; public class UpdateClientResponse { - public string ClientId { get; set; } - public string DisplayName { get; set; } - public string DefaultTier { get; set; } - public DateTime CreatedAt { get; set; } + public required string ClientId { get; set; } + public required string DisplayName { get; set; } + public required string DefaultTier { get; set; } + public required DateTime CreatedAt { get; set; } public int? MaxIdentities { get; set; } } diff --git a/AdminUi/test/AdminUi.Tests.Integration/StepDefinitions/BaseStepDefinitions.cs b/AdminUi/test/AdminUi.Tests.Integration/StepDefinitions/BaseStepDefinitions.cs index 989523b180..bda0b588b2 100644 --- a/AdminUi/test/AdminUi.Tests.Integration/StepDefinitions/BaseStepDefinitions.cs +++ b/AdminUi/test/AdminUi.Tests.Integration/StepDefinitions/BaseStepDefinitions.cs @@ -9,22 +9,22 @@ public class BaseStepDefinitions public BaseStepDefinitions() { - _requestConfiguration = new RequestConfiguration(); + _requestConfiguration = new RequestConfiguration { ContentType = "application/json" }; } - [Given(@"the user is authenticated")] + [Given("the user is authenticated")] public void GivenTheUserIsAuthenticated() { _requestConfiguration.Authenticate = true; } - [Given(@"the user is unauthenticated")] + [Given("the user is unauthenticated")] public void GivenTheUserIsUnauthenticated() { _requestConfiguration.Authenticate = false; } - [Given(@"the Accept header is '([^']*)'")] + [Given("the Accept header is '([^']*)'")] public void GivenTheAcceptHeaderIs(string acceptHeader) { _requestConfiguration.AcceptHeader = acceptHeader; diff --git a/AdminUi/test/AdminUi.Tests.Integration/StepDefinitions/ClientDetailsStepDefinitions.cs b/AdminUi/test/AdminUi.Tests.Integration/StepDefinitions/ClientDetailsStepDefinitions.cs index 37c43daccc..1b73122f9f 100644 --- a/AdminUi/test/AdminUi.Tests.Integration/StepDefinitions/ClientDetailsStepDefinitions.cs +++ b/AdminUi/test/AdminUi.Tests.Integration/StepDefinitions/ClientDetailsStepDefinitions.cs @@ -22,7 +22,7 @@ public ClientDetailsStepDefinitions(ClientsApi clientsApi, TiersApi tiersApi) _maxIdentities = 1; } - [Given(@"a Tier t")] + [Given("a Tier t")] public async Task GivenATierT() { var createTierRequest = new CreateTierRequest @@ -44,7 +44,7 @@ public async Task GivenATierT() Thread.Sleep(2000); } - [Given(@"a Client c with Tier t")] + [Given("a Client c with Tier t")] public async Task GivenAClientWithTierT() { var createClientRequest = new CreateClientRequest @@ -67,7 +67,7 @@ public async Task GivenAClientWithTierT() _clientId = response.Content.Result!.ClientId; } - [When(@"a GET request is sent to the /Clients/{c.clientId} endpoint")] + [When("a GET request is sent to the /Clients/{c.clientId} endpoint")] public async Task WhenAGETRequestIsSentToTheClientsIdEndpoint() { _response = await _clientsApi.GetClient(_clientId, _requestConfiguration); @@ -75,7 +75,7 @@ public async Task WhenAGETRequestIsSentToTheClientsIdEndpoint() _response.Content.Should().NotBeNull(); } - [Then(@"the response contains Client c")] + [Then("the response contains Client c")] public void ThenTheResponseContainsAClient() { _response!.Content.Result.Should().NotBeNull(); diff --git a/AdminUi/test/AdminUi.Tests.Integration/StepDefinitions/ClientsStepDefinitions.cs b/AdminUi/test/AdminUi.Tests.Integration/StepDefinitions/ClientsStepDefinitions.cs index 6095b1c81a..650d8f38c9 100644 --- a/AdminUi/test/AdminUi.Tests.Integration/StepDefinitions/ClientsStepDefinitions.cs +++ b/AdminUi/test/AdminUi.Tests.Integration/StepDefinitions/ClientsStepDefinitions.cs @@ -74,7 +74,7 @@ public async Task CreateTier() return response.Content.Result!.Id; } - [Given(@"a Client c")] + [Given("a Client c")] public async Task GivenAClientC() { _tierId = await GetTier(); @@ -100,20 +100,20 @@ public async Task GivenAClientC() _clientId = response.Content.Result!.ClientId; } - [Given(@"a non-existent Client c")] + [Given("a non-existent Client c")] public void GivenANonExistentClientC() { _clientId = "some-non-existent-client-id"; } - [When(@"a DELETE request is sent to the /Clients endpoint")] + [When("a DELETE request is sent to the /Clients endpoint")] public async Task WhenADeleteRequestIsSentToTheClientsEndpoint() { _deleteResponse = await _clientsApi.DeleteClient(_clientId, _requestConfiguration); _deleteResponse.Should().NotBeNull(); } - [When(@"a GET request is sent to the /Clients endpoint")] + [When("a GET request is sent to the /Clients endpoint")] public async Task WhenAGetRequestIsSentToTheClientsEndpoint() { _getClientsResponse = await _clientsApi.GetAllClients(_requestConfiguration); @@ -121,7 +121,7 @@ public async Task WhenAGetRequestIsSentToTheClientsEndpoint() _getClientsResponse.Content.Should().NotBeNull(); } - [When(@"a PATCH request is sent to the /Clients/{c.ClientId}/ChangeSecret endpoint with a new secret")] + [When("a PATCH request is sent to the /Clients/{c.ClientId}/ChangeSecret endpoint with a new secret")] public async Task WhenAPatchRequestIsSentToTheClientsChangeSecretEndpointWithASecret() { _clientSecret = "new-client-secret"; @@ -141,7 +141,7 @@ public async Task WhenAPatchRequestIsSentToTheClientsChangeSecretEndpointWithASe _changeClientSecretResponse.Content.Should().NotBeNull(); } - [When(@"a PATCH request is sent to the /Clients/{c.ClientId}/ChangeSecret endpoint without passing a secret")] + [When("a PATCH request is sent to the /Clients/{c.ClientId}/ChangeSecret endpoint without passing a secret")] public async Task WhenAPatchRequestIsSentToTheClientsChangeSecretEndpointWithoutASecret() { var changeClientSecretRequest = new ChangeClientSecretRequest @@ -159,7 +159,7 @@ public async Task WhenAPatchRequestIsSentToTheClientsChangeSecretEndpointWithout _changeClientSecretResponse.Content.Should().NotBeNull(); } - [When(@"a PATCH request is sent to the /Clients/{clientId}/ChangeSecret endpoint")] + [When("a PATCH request is sent to the /Clients/{clientId}/ChangeSecret endpoint")] public async Task WhenAPatchRequestIsSentToTheClientsChangeSecretEndpointForAnInexistentClient() { var changeClientSecretRequest = new ChangeClientSecretRequest @@ -177,7 +177,7 @@ public async Task WhenAPatchRequestIsSentToTheClientsChangeSecretEndpointForAnIn _changeClientSecretResponse.Content.Should().NotBeNull(); } - [When(@"a PUT request is sent to the /Clients/{c.ClientId} endpoint")] + [When("a PUT request is sent to the /Clients/{c.ClientId} endpoint")] public async Task WhenAPatchRequestIsSentToTheClientsEndpoint() { _updatedTierId = await CreateTier(); @@ -199,7 +199,7 @@ public async Task WhenAPatchRequestIsSentToTheClientsEndpoint() _updateClientResponse.Content.Should().NotBeNull(); } - [When(@"a PUT request is sent to the /Clients/{c.ClientId} endpoint with a null value for maxIdentities")] + [When("a PUT request is sent to the /Clients/{c.ClientId} endpoint with a null value for maxIdentities")] public async Task WhenAPatchRequestIsSentToTheClientsEndpointWithANullMaxIdentities() { var updateClientRequest = new UpdateClientRequest() @@ -218,7 +218,7 @@ public async Task WhenAPatchRequestIsSentToTheClientsEndpointWithANullMaxIdentit _updateClientResponse.Content.Should().NotBeNull(); } - [When(@"a PUT request is sent to the /Clients/{c.ClientId} endpoint with a non-existent tier id")] + [When("a PUT request is sent to the /Clients/{c.ClientId} endpoint with a non-existent tier id")] public async Task WhenAPatchRequestIsSentToTheClientsEndpointWithAnInexistentDefaultTier() { var updateClientRequest = new UpdateClientRequest() @@ -237,7 +237,7 @@ public async Task WhenAPatchRequestIsSentToTheClientsEndpointWithAnInexistentDef _updateClientResponse.Content.Should().NotBeNull(); } - [When(@"a PUT request is sent to the /Clients/{c.clientId} endpoint with a non-existing clientId")] + [When("a PUT request is sent to the /Clients/{c.clientId} endpoint with a non-existing clientId")] public async Task WhenAPatchRequestIsSentToTheClientsEndpointForAnInexistentClient() { var updateClientRequest = new UpdateClientRequest() @@ -256,14 +256,14 @@ public async Task WhenAPatchRequestIsSentToTheClientsEndpointForAnInexistentClie _updateClientResponse.Content.Should().NotBeNull(); } - [Then(@"the response contains a paginated list of Clients")] + [Then("the response contains a paginated list of Clients")] public void ThenTheResponseContainsAListOfClients() { _getClientsResponse!.Content.Result.Should().NotBeNullOrEmpty(); _getClientsResponse.AssertContentCompliesWithSchema(); } - [Then(@"the response contains Client c with the new client secret")] + [Then("the response contains Client c with the new client secret")] public void ThenTheResponseContainsAClientWithNewSecret() { _changeClientSecretResponse!.AssertHasValue(); @@ -273,7 +273,7 @@ public void ThenTheResponseContainsAClientWithNewSecret() _changeClientSecretResponse!.Content.Result!.ClientSecret.Should().Be(_clientSecret); } - [Then(@"the response contains Client c with a random secret generated by the backend")] + [Then("the response contains Client c with a random secret generated by the backend")] public void ThenTheResponseContainsAClientWithRandomGeneratedSecret() { _changeClientSecretResponse!.AssertHasValue(); @@ -283,7 +283,7 @@ public void ThenTheResponseContainsAClientWithRandomGeneratedSecret() _changeClientSecretResponse!.Content.Result!.ClientSecret.Should().NotBeNullOrEmpty(); } - [Then(@"the response contains Client c")] + [Then("the response contains Client c")] public void ThenTheResponseContainsAClient() { _updateClientResponse!.AssertHasValue(); @@ -292,7 +292,7 @@ public void ThenTheResponseContainsAClient() _updateClientResponse!.AssertContentCompliesWithSchema(); } - [Then(@"the Client in the Backend was successfully updated")] + [Then("the Client in the Backend was successfully updated")] public async Task ThenTheClientInTheBackendWasUpdatedAsync() { var requestConfiguration = _requestConfiguration.Clone(); @@ -308,7 +308,7 @@ public async Task ThenTheClientInTheBackendWasUpdatedAsync() response.Content.Result!.MaxIdentities.Should().Be(_updatedMaxIdentities); } - [Then(@"the Client in the Backend has a null value for maxIdentities")] + [Then("the Client in the Backend has a null value for maxIdentities")] public async Task ThenTheClientInTheBackendHasNullIdentitiesLimit() { var requestConfiguration = _requestConfiguration.Clone(); diff --git a/AdminUi/test/AdminUi.Tests.Integration/StepDefinitions/IdentitiesApiStepDefinitions.cs b/AdminUi/test/AdminUi.Tests.Integration/StepDefinitions/IdentitiesApiStepDefinitions.cs index 54309bf638..d04833c9e4 100644 --- a/AdminUi/test/AdminUi.Tests.Integration/StepDefinitions/IdentitiesApiStepDefinitions.cs +++ b/AdminUi/test/AdminUi.Tests.Integration/StepDefinitions/IdentitiesApiStepDefinitions.cs @@ -34,7 +34,7 @@ public async Task GivenAnActiveDeletionProcessForIdentityAExists() await _identitiesApi.StartDeletionProcess(_createIdentityResponse!.Content.Result!.Address, _requestConfiguration); } - [Given(@"an Identity i")] + [Given("an Identity i")] public async Task GivenAnIdentityI() { var keyPair = _signatureHelper.CreateKeyPair(); @@ -74,15 +74,15 @@ public async Task WhenAPOSTRequestIsSentToTheIdentitiesIdDeletionProcessesEndpoi _identityDeletionProcessResponse = await _identitiesApi.StartDeletionProcess(_createIdentityResponse!.Content.Result!.Address, _requestConfiguration); } - [When(@"a GET request is sent to the /Identities endpoint")] + [When("a GET request is sent to the /Identities endpoint")] public async Task WhenAGETRequestIsSentToTheIdentitiesOverviewEndpoint() { - _identityOverviewsResponse = await _identitiesApi.GetIdentityOverviews(_requestConfiguration); + _identityOverviewsResponse = await _identitiesApi.GetIdentityOverviews(); _identityOverviewsResponse.Should().NotBeNull(); _identityOverviewsResponse!.Content.Should().NotBeNull(); } - [When(@"a GET request is sent to the /Identities/{i.address} endpoint")] + [When("a GET request is sent to the /Identities/{i.address} endpoint")] public async Task WhenAGETRequestIsSentToTheIdentitiesAddressEndpoint() { _identityResponse = await _identitiesApi.GetIdentityByAddress(_requestConfiguration, _existingIdentity); @@ -90,7 +90,7 @@ public async Task WhenAGETRequestIsSentToTheIdentitiesAddressEndpoint() _identityResponse.Content.Should().NotBeNull(); } - [When(@"a GET request is sent to the /Identities/{address} endpoint with an inexistent address")] + [When("a GET request is sent to the /Identities/{address} endpoint with an inexistent address")] public async Task WhenAGETRequestIsSentToTheIdentitiesAddressEndpointForAnInexistentIdentity() { _identityResponse = await _identitiesApi.GetIdentityByAddress(_requestConfiguration, "inexistentIdentityAddress"); @@ -98,7 +98,7 @@ public async Task WhenAGETRequestIsSentToTheIdentitiesAddressEndpointForAnInexis _identityResponse.Content.Should().NotBeNull(); } - [Then(@"the response contains a list of Identities")] + [Then("the response contains a list of Identities")] public void ThenTheResponseContainsAListOfIdentities() { _identityOverviewsResponse!.Content.Value.Should().NotBeNull(); @@ -107,7 +107,7 @@ public void ThenTheResponseContainsAListOfIdentities() _identityOverviewsResponse!.AssertContentCompliesWithSchema(); } - [Then(@"the response contains a Deletion Process")] + [Then("the response contains a Deletion Process")] public void ThenTheResponseContainsADeletionProcess() { _identityDeletionProcessResponse!.Content.Result.Should().NotBeNull(); @@ -115,7 +115,7 @@ public void ThenTheResponseContainsADeletionProcess() _identityDeletionProcessResponse!.AssertContentCompliesWithSchema(); } - [Then(@"the response contains Identity i")] + [Then("the response contains Identity i")] public void ThenTheResponseContainsAnIdentity() { _identityResponse!.AssertHasValue(); diff --git a/AdminUi/test/AdminUi.Tests.Integration/StepDefinitions/IndividualQuotaStepDefinitions.cs b/AdminUi/test/AdminUi.Tests.Integration/StepDefinitions/IndividualQuotaStepDefinitions.cs index c40f0f61c6..b81867149c 100644 --- a/AdminUi/test/AdminUi.Tests.Integration/StepDefinitions/IndividualQuotaStepDefinitions.cs +++ b/AdminUi/test/AdminUi.Tests.Integration/StepDefinitions/IndividualQuotaStepDefinitions.cs @@ -27,13 +27,13 @@ public IndividualQuotaStepDefinitions(IdentitiesApi identitiesApi, ISignatureHel _quotaId = string.Empty; } - [Given(@"an Identity i")] + [Given("an Identity i")] public async Task GivenAnIdentityI() { await CreateIdentity(); } - [Given(@"an Identity i with an IndividualQuota q")] + [Given("an Identity i with an IndividualQuota q")] public async Task GivenAnIdentityIWithAnIndividualQuotaQ() { await CreateIdentity(); @@ -53,21 +53,21 @@ public async Task GivenAnIdentityIWithAnIndividualQuotaQ() _quotaId = response.Content.Result!.Id; } - [When(@"a DELETE request is sent to the /Identities/{i.address}/Quotas/{q.id} endpoint")] + [When("a DELETE request is sent to the /Identities/{i.address}/Quotas/{q.id} endpoint")] public async Task WhenADeleteRequestIsSentToTheDeleteIndividualQuotaEndpoint() { _deleteResponse = await _identitiesApi.DeleteIndividualQuota(_identityAddress, _quotaId, _requestConfiguration); _deleteResponse.Should().NotBeNull(); } - [When(@"a DELETE request is sent to the /Identities/{i.address}/Quotas/inexistentQuotaId endpoint")] + [When("a DELETE request is sent to the /Identities/{i.address}/Quotas/inexistentQuotaId endpoint")] public async Task WhenADeleteRequestIsSentToTheDeleteIndividualQuotaEndpointWithAnInexistentQuotaId() { _deleteResponse = await _identitiesApi.DeleteIndividualQuota(_identityAddress, "QUOInexistentIdxxxxx", _requestConfiguration); _deleteResponse.Should().NotBeNull(); } - [When(@"a POST request is sent to the /Identity/{i.id}/Quotas endpoint")] + [When("a POST request is sent to the /Identity/{i.id}/Quotas endpoint")] public async Task WhenAPOSTRequestIsSentToTheCreateIndividualQuotaEndpoint() { var createIndividualQuotaRequest = new CreateIndividualQuotaRequest() @@ -84,7 +84,7 @@ public async Task WhenAPOSTRequestIsSentToTheCreateIndividualQuotaEndpoint() _response = await _identitiesApi.CreateIndividualQuota(requestConfiguration, _identityAddress); } - [When(@"a POST request is sent to the /Identity/{address}/Quotas endpoint with an inexistent identity address")] + [When("a POST request is sent to the /Identity/{address}/Quotas endpoint with an inexistent identity address")] public async Task WhenAPOSTRequestIsSentToTheCreateIndividualQuotaEndpointWithAnInexistentIdentityAddress() { var createIndividualQuotaRequest = new CreateIndividualQuotaRequest() @@ -117,7 +117,7 @@ public void ThenTheResponseStatusCodeIs(int expectedStatusCode) } } - [Then(@"the response contains an IndividualQuota")] + [Then("the response contains an IndividualQuota")] public void ThenTheResponseContainsAnIndividualQuota() { _response!.AssertHasValue(); diff --git a/AdminUi/test/AdminUi.Tests.Integration/StepDefinitions/LogsStepDefinitions.cs b/AdminUi/test/AdminUi.Tests.Integration/StepDefinitions/LogsStepDefinitions.cs index 862d2daf33..35a2da789c 100644 --- a/AdminUi/test/AdminUi.Tests.Integration/StepDefinitions/LogsStepDefinitions.cs +++ b/AdminUi/test/AdminUi.Tests.Integration/StepDefinitions/LogsStepDefinitions.cs @@ -15,7 +15,7 @@ public LogsStepDefinitions(LogsApi logsApi) _logsApi = logsApi; } - [When(@"a POST request is sent to the /Logs endpoint")] + [When("a POST request is sent to the /Logs endpoint")] public async Task WhenAPOSTRequestIsSentToTheLogsEndpoint() { var createTierRequest = new LogRequest @@ -23,7 +23,7 @@ public async Task WhenAPOSTRequestIsSentToTheLogsEndpoint() LogLevel = LogLevel.Trace, Category = "Test Category", MessageTemplate = "The log request {0} has the following description: {1}", - Arguments = new object[] { "Request Name", "Request Description" } + Arguments = ["Request Name", "Request Description"] }; var requestConfiguration = _requestConfiguration.Clone(); @@ -33,7 +33,7 @@ public async Task WhenAPOSTRequestIsSentToTheLogsEndpoint() _postResponse = await _logsApi.CreateLog(requestConfiguration); } - [When(@"a POST request is sent to the /Logs endpoint with an invalid Log Level")] + [When("a POST request is sent to the /Logs endpoint with an invalid Log Level")] public async Task WhenAPOSTRequestIsSentToTheLogsEndpointWithAnInvalidLogLevel() { var createTierRequest = new LogRequest @@ -41,7 +41,7 @@ public async Task WhenAPOSTRequestIsSentToTheLogsEndpointWithAnInvalidLogLevel() LogLevel = (LogLevel)16, Category = "Test Category", MessageTemplate = "The log request {0} has the following description: {1}", - Arguments = new object[] { "Request Name", "Request Description" } + Arguments = ["Request Name", "Request Description"] }; var requestConfiguration = _requestConfiguration.Clone(); @@ -64,7 +64,8 @@ public void ThenTheResponseStatusCodeIs(int expectedStatusCode) [Then(@"the response content includes an error with the error code ""([^""]+)""")] public void ThenTheResponseContentIncludesAnErrorWithTheErrorCode(string errorCode) { - _postResponse!.Content.Error.Should().NotBeNull(); - _postResponse.Content.Error!.Code.Should().Be(errorCode); + _postResponse!.Content.Should().NotBeNull(); + _postResponse!.Content!.Error.Should().NotBeNull(); + _postResponse.Content.Error.Code.Should().Be(errorCode); } } diff --git a/AdminUi/test/AdminUi.Tests.Integration/StepDefinitions/MetricsStepDefinitions.cs b/AdminUi/test/AdminUi.Tests.Integration/StepDefinitions/MetricsStepDefinitions.cs index d989658ea2..d6cf123a0a 100644 --- a/AdminUi/test/AdminUi.Tests.Integration/StepDefinitions/MetricsStepDefinitions.cs +++ b/AdminUi/test/AdminUi.Tests.Integration/StepDefinitions/MetricsStepDefinitions.cs @@ -16,7 +16,7 @@ public MetricsStepDefinitions(MetricsApi metricsApi) _metricsApi = metricsApi; } - [When(@"a GET request is sent to the /Metrics endpoint")] + [When("a GET request is sent to the /Metrics endpoint")] public async Task WhenAGETRequestIsSentToTheMetricsEndpoint() { _response = await _metricsApi.GetAllMetrics(_requestConfiguration); @@ -24,7 +24,7 @@ public async Task WhenAGETRequestIsSentToTheMetricsEndpoint() _response.Content.Should().NotBeNull(); } - [Then(@"the response contains a list of Metrics")] + [Then("the response contains a list of Metrics")] public void ThenTheResponseContainsAListOfMetrics() { _response!.Content.Result.Should().NotBeNullOrEmpty(); diff --git a/AdminUi/test/AdminUi.Tests.Integration/StepDefinitions/TierDetailsStepDefinitions.cs b/AdminUi/test/AdminUi.Tests.Integration/StepDefinitions/TierDetailsStepDefinitions.cs index 1dfd8ac0e0..f868f633fa 100644 --- a/AdminUi/test/AdminUi.Tests.Integration/StepDefinitions/TierDetailsStepDefinitions.cs +++ b/AdminUi/test/AdminUi.Tests.Integration/StepDefinitions/TierDetailsStepDefinitions.cs @@ -19,7 +19,7 @@ public TierDetailsStepDefinitions(TiersApi tiersApi) _tierId = string.Empty; } - [Given(@"a Tier t")] + [Given("a Tier t")] public async Task GivenATier() { var createTierRequest = new CreateTierRequest @@ -41,7 +41,7 @@ public async Task GivenATier() Thread.Sleep(2000); } - [When(@"a GET request is sent to the /Tiers/{t.id} endpoint")] + [When("a GET request is sent to the /Tiers/{t.id} endpoint")] public async Task WhenAGETRequestIsSentToTheTiersIdEndpoint() { _response = await _tiersApi.GetTierById(_requestConfiguration, _tierId); @@ -49,7 +49,7 @@ public async Task WhenAGETRequestIsSentToTheTiersIdEndpoint() _response.Content.Should().NotBeNull(); } - [Then(@"the response contains Tier t")] + [Then("the response contains Tier t")] public void ThenTheResponseContainsATier() { _response!.Content.Result.Should().NotBeNull(); diff --git a/AdminUi/test/AdminUi.Tests.Integration/StepDefinitions/TierQuotaStepDefinitions.cs b/AdminUi/test/AdminUi.Tests.Integration/StepDefinitions/TierQuotaStepDefinitions.cs index 3ba9f9d8c4..afcec454d7 100644 --- a/AdminUi/test/AdminUi.Tests.Integration/StepDefinitions/TierQuotaStepDefinitions.cs +++ b/AdminUi/test/AdminUi.Tests.Integration/StepDefinitions/TierQuotaStepDefinitions.cs @@ -22,7 +22,7 @@ public TierQuotaStepDefinitions(TiersApi tiersApi) _tierQuotaDefinitionId = string.Empty; } - [Given(@"a Tier t")] + [Given("a Tier t")] public async Task GivenAValidTier() { var createTierRequest = new CreateTierRequest @@ -44,7 +44,7 @@ public async Task GivenAValidTier() Thread.Sleep(2000); } - [Given(@"a Tier t with a Quota q")] + [Given("a Tier t with a Quota q")] public async Task GivenAValidTierWithAQuota() { await GivenAValidTier(); @@ -70,7 +70,7 @@ public async Task GivenAValidTierWithAQuota() Thread.Sleep(2000); } - [When(@"a POST request is sent to the /Tiers/{t.id}/Quotas endpoint")] + [When("a POST request is sent to the /Tiers/{t.id}/Quotas endpoint")] public async Task WhenAPOSTRequestIsSentToTheCreateTierQuotaEndpoint() { var createTierQuotaRequest = new CreateTierQuotaRequest @@ -87,7 +87,7 @@ public async Task WhenAPOSTRequestIsSentToTheCreateTierQuotaEndpoint() _response = await _tiersApi.CreateTierQuota(requestConfiguration, _tierId); } - [When(@"a POST request is sent to the /Tiers/{tierId}/Quotas endpoint with an inexistent tier id")] + [When("a POST request is sent to the /Tiers/{tierId}/Quotas endpoint with an inexistent tier id")] public async Task WhenAPOSTRequestIsSentToTheCreateTierQuotaEndpointForAnInexistentTier() { var createTierQuotaRequest = new CreateTierQuotaRequest @@ -104,14 +104,14 @@ public async Task WhenAPOSTRequestIsSentToTheCreateTierQuotaEndpointForAnInexist _response = await _tiersApi.CreateTierQuota(requestConfiguration, "inexistentTierId"); } - [When(@"a DELETE request is sent to the /Tiers/{t.id}/Quotas/{q.id} endpoint")] + [When("a DELETE request is sent to the /Tiers/{t.id}/Quotas/{q.id} endpoint")] public async Task WhenADELETERequestIsSentToTheDeleteTierQuotaEndpoint() { _deleteResponse = await _tiersApi.DeleteTierQuota(_tierId, _tierQuotaDefinitionId, _requestConfiguration); _deleteResponse.Should().NotBeNull(); } - [When(@"a DELETE request is sent to the /Tiers/{t.id}/Quotas/{quotaId} endpoint with an inexistent quota id")] + [When("a DELETE request is sent to the /Tiers/{t.id}/Quotas/{quotaId} endpoint with an inexistent quota id")] public async Task WhenADELETERequestIsSentToTheDeleteTierQuotaEndpointForAnInexistentQuota() { _deleteResponse = await _tiersApi.DeleteTierQuota(_tierId, "inexistentQuotaId", _requestConfiguration); @@ -134,7 +134,7 @@ public void ThenTheResponseStatusCodeIs(int expectedStatusCode) } } - [Then(@"the response contains a TierQuota")] + [Then("the response contains a TierQuota")] public void ThenTheResponseContainsATierQuotaDefinition() { _response!.AssertHasValue(); diff --git a/AdminUi/test/AdminUi.Tests.Integration/StepDefinitions/TiersStepDefinitions.cs b/AdminUi/test/AdminUi.Tests.Integration/StepDefinitions/TiersStepDefinitions.cs index 0720e2b1e5..0ecfaa4179 100644 --- a/AdminUi/test/AdminUi.Tests.Integration/StepDefinitions/TiersStepDefinitions.cs +++ b/AdminUi/test/AdminUi.Tests.Integration/StepDefinitions/TiersStepDefinitions.cs @@ -26,7 +26,7 @@ public TiersStepDefinitions(TiersApi tiersApi) _existingTierId = string.Empty; } - [Given(@"a Tier t")] + [Given("a Tier t")] public async Task GivenATier() { var createTierRequest = new CreateTierRequest @@ -45,13 +45,13 @@ public async Task GivenATier() _existingTierId = response.Content.Result!.Id; } - [Given(@"the Tier T has one associated identity")] + [Given("the Tier T has one associated identity")] public void GivenTheTierTHasOneAssociatedIdentity() { throw new PendingStepException(); } - [Given(@"the Basic Tier as t")] + [Given("the Basic Tier as t")] public async Task GivenTheBasicTierAsT() { var requestConfiguration = _requestConfiguration.Clone(); @@ -65,7 +65,7 @@ public async Task GivenTheBasicTierAsT() _existingTierId = basicTier.Id; } - [When(@"a GET request is sent to the /Tiers endpoint")] + [When("a GET request is sent to the /Tiers endpoint")] public async Task WhenAGETRequestIsSentToTheTiersEndpoint() { _tiersResponse = await _tiersApi.GetTiers(_requestConfiguration); @@ -73,7 +73,7 @@ public async Task WhenAGETRequestIsSentToTheTiersEndpoint() _tiersResponse.Content.Should().NotBeNull(); } - [When(@"a POST request is sent to the /Tiers endpoint")] + [When("a POST request is sent to the /Tiers endpoint")] public async Task WhenAPOSTRequestIsSentToTheTiersEndpoint() { var createTierRequest = new CreateTierRequest @@ -88,7 +88,7 @@ public async Task WhenAPOSTRequestIsSentToTheTiersEndpoint() _tierResponse = await _tiersApi.CreateTier(requestConfiguration); } - [When(@"a POST request is sent to the /Tiers endpoint with the name t.Name")] + [When("a POST request is sent to the /Tiers endpoint with the name t.Name")] public async Task WhenAPOSTRequestIsSentToTheTiersEndpointWithAnAlreadyExistingName() { var createTierRequest = new CreateTierRequest @@ -115,14 +115,14 @@ public async Task WhenADELETERequestIsSentToTheTiersT_IdEndpointWithAnInexistent _deleteResponse = await _tiersApi.DeleteTier(_requestConfiguration, "TIR00000000000000000"); } - [Then(@"the response contains a paginated list of Tiers")] + [Then("the response contains a paginated list of Tiers")] public void ThenTheResponseContainsAList() { _tiersResponse!.Content.Result.Should().NotBeNull(); _tiersResponse!.Content.Result.Should().NotBeEmpty(); } - [Then(@"the response contains a Tier")] + [Then("the response contains a Tier")] public void ThenTheResponseContainsATier() { _tierResponse!.AssertHasValue(); diff --git a/Backbone.Tests.ArchUnit/Backbone.Tests.ArchUnit.csproj b/Backbone.Tests.ArchUnit/Backbone.Tests.ArchUnit.csproj index 4bf9803bba..5db60f8be3 100644 --- a/Backbone.Tests.ArchUnit/Backbone.Tests.ArchUnit.csproj +++ b/Backbone.Tests.ArchUnit/Backbone.Tests.ArchUnit.csproj @@ -1,7 +1,6 @@ - enable false @@ -9,8 +8,8 @@ - - + + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/Backbone.Tests.ArchUnit/BackboneArchitecture.cs b/Backbone.Tests.ArchUnit/BackboneArchitecture.cs index b2033af158..7c4ce7e495 100644 --- a/Backbone.Tests.ArchUnit/BackboneArchitecture.cs +++ b/Backbone.Tests.ArchUnit/BackboneArchitecture.cs @@ -16,7 +16,7 @@ private static Assembly[] GetSolutionAssemblies() var assemblies = Directory .GetFiles(AppDomain.CurrentDomain.BaseDirectory, "*.dll") .Select(x => Assembly.Load(AssemblyName.GetAssemblyName(x))) - .Where(x => x.FullName.StartsWith("Backbone")); + .Where(x => x.FullName!.StartsWith("Backbone")); return assemblies.ToArray(); } } diff --git a/BuildingBlocks/src/BuildingBlocks.API/BuildingBlocks.API.csproj b/BuildingBlocks/src/BuildingBlocks.API/BuildingBlocks.API.csproj index 5473711a7b..3daaa6ea00 100644 --- a/BuildingBlocks/src/BuildingBlocks.API/BuildingBlocks.API.csproj +++ b/BuildingBlocks/src/BuildingBlocks.API/BuildingBlocks.API.csproj @@ -1,14 +1,10 @@  - - enable - - - - + + diff --git a/BuildingBlocks/src/BuildingBlocks.API/HttpError.cs b/BuildingBlocks/src/BuildingBlocks.API/HttpError.cs index 9cfbbcd3bf..3dae12802e 100644 --- a/BuildingBlocks/src/BuildingBlocks.API/HttpError.cs +++ b/BuildingBlocks/src/BuildingBlocks.API/HttpError.cs @@ -88,10 +88,41 @@ public struct HttpErrorId private const string PREFIX = "ERR"; private static readonly char[] VALID_CHARS = - { - 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K', 'L', 'M', 'N', 'P', 'Q', 'R', 'S', 'T', 'U', - 'V', 'W', 'X', 'Y', 'Z', '1', '2', '3', '4', '5', '6', '7', '8', '9' - }; + [ + 'A', + 'B', + 'C', + 'D', + 'E', + 'F', + 'G', + 'H', + 'J', + 'K', + 'L', + 'M', + 'N', + 'P', + 'Q', + 'R', + 'S', + 'T', + 'U', + 'V', + 'W', + 'X', + 'Y', + 'Z', + '1', + '2', + '3', + '4', + '5', + '6', + '7', + '8', + '9' + ]; private HttpErrorId(string stringValue) { diff --git a/BuildingBlocks/src/BuildingBlocks.API/Mvc/ExceptionFilters/CustomExceptionFilter.cs b/BuildingBlocks/src/BuildingBlocks.API/Mvc/ExceptionFilters/CustomExceptionFilter.cs index ec2a7901e7..356270bea5 100644 --- a/BuildingBlocks/src/BuildingBlocks.API/Mvc/ExceptionFilters/CustomExceptionFilter.cs +++ b/BuildingBlocks/src/BuildingBlocks.API/Mvc/ExceptionFilters/CustomExceptionFilter.cs @@ -67,7 +67,7 @@ public override void OnException(ExceptionContext context) context.HttpContext.Response.StatusCode = (int)GetStatusCodeForDomainException(domainException); break; - case BadHttpRequestException _: + case BadHttpRequestException: _logger.RequestBodyTooLarge(ERROR_CODE_REQUEST_BODY_TOO_LARGE); httpError = HttpError.ForProduction( @@ -132,9 +132,9 @@ private HttpError CreateHttpErrorForDomainException(DomainException domainExcept private dynamic? GetCustomData(ApplicationException applicationException) { - if (applicationException is QuotaExhaustedException quotaExhautedException) + if (applicationException is QuotaExhaustedException quotaExhaustedException) { - return quotaExhautedException.ExhaustedMetricStatuses.Select(m => new + return quotaExhaustedException.ExhaustedMetricStatuses.Select(m => new { #pragma warning disable IDE0037 MetricKey = m.MetricKey.Value, @@ -146,7 +146,7 @@ private HttpError CreateHttpErrorForDomainException(DomainException domainExcept return null; } - private static HttpStatusCode GetStatusCodeForInfrastructureException(InfrastructureException exception) + private static HttpStatusCode GetStatusCodeForInfrastructureException(InfrastructureException _) { return HttpStatusCode.BadRequest; } @@ -155,9 +155,9 @@ private static HttpStatusCode GetStatusCodeForApplicationException(ApplicationEx { return exception switch { - NotFoundException _ => HttpStatusCode.NotFound, - ActionForbiddenException _ => HttpStatusCode.Forbidden, - QuotaExhaustedException _ => HttpStatusCode.TooManyRequests, + NotFoundException => HttpStatusCode.NotFound, + ActionForbiddenException => HttpStatusCode.Forbidden, + QuotaExhaustedException => HttpStatusCode.TooManyRequests, _ => HttpStatusCode.BadRequest }; } diff --git a/BuildingBlocks/src/BuildingBlocks.Application.Abstractions/BuildingBlocks.Application.Abstractions.csproj b/BuildingBlocks/src/BuildingBlocks.Application.Abstractions/BuildingBlocks.Application.Abstractions.csproj index 4f9c8387bd..479b64260c 100644 --- a/BuildingBlocks/src/BuildingBlocks.Application.Abstractions/BuildingBlocks.Application.Abstractions.csproj +++ b/BuildingBlocks/src/BuildingBlocks.Application.Abstractions/BuildingBlocks.Application.Abstractions.csproj @@ -1,9 +1,5 @@ - - enable - - Enmeshed.BuildingBlocks.Application.Abstractions https://enmeshed.eu @@ -15,7 +11,7 @@ - + diff --git a/BuildingBlocks/src/BuildingBlocks.Application.Abstractions/Infrastructure/EventBus/IIntegrationEventHandler.cs b/BuildingBlocks/src/BuildingBlocks.Application.Abstractions/Infrastructure/EventBus/IIntegrationEventHandler.cs index 06c9f63e8b..0d87a0a96f 100644 --- a/BuildingBlocks/src/BuildingBlocks.Application.Abstractions/Infrastructure/EventBus/IIntegrationEventHandler.cs +++ b/BuildingBlocks/src/BuildingBlocks.Application.Abstractions/Infrastructure/EventBus/IIntegrationEventHandler.cs @@ -8,6 +8,4 @@ public interface IIntegrationEventHandler : IIntegrationEv Task Handle(TIntegrationEvent @event); } -public interface IIntegrationEventHandler -{ -} +public interface IIntegrationEventHandler; diff --git a/BuildingBlocks/src/BuildingBlocks.Application.Abstractions/Infrastructure/Mapping/IMapTo.cs b/BuildingBlocks/src/BuildingBlocks.Application.Abstractions/Infrastructure/Mapping/IMapTo.cs index 753711d817..4840530bfa 100644 --- a/BuildingBlocks/src/BuildingBlocks.Application.Abstractions/Infrastructure/Mapping/IMapTo.cs +++ b/BuildingBlocks/src/BuildingBlocks.Application.Abstractions/Infrastructure/Mapping/IMapTo.cs @@ -1,6 +1,4 @@ namespace Backbone.BuildingBlocks.Application.Abstractions.Infrastructure.Mapping; // ReSharper disable once UnusedTypeParameter -public interface IMapTo -{ -} +public interface IMapTo; diff --git a/BuildingBlocks/src/BuildingBlocks.Application/AutoMapper/MapperProfileHelper.cs b/BuildingBlocks/src/BuildingBlocks.Application/AutoMapper/MapperProfileHelper.cs index c5b05a0204..da852e456f 100644 --- a/BuildingBlocks/src/BuildingBlocks.Application/AutoMapper/MapperProfileHelper.cs +++ b/BuildingBlocks/src/BuildingBlocks.Application/AutoMapper/MapperProfileHelper.cs @@ -11,12 +11,12 @@ public static IEnumerable LoadStandardMappings(Assembly rootAssembly) var mapsFrom = ( from type in types - from interf in type.GetInterfaces() + from @interface in type.GetInterfaces() where - interf.IsGenericType && interf.GetGenericTypeDefinition() == typeof(IMapTo<>) && + @interface.IsGenericType && @interface.GetGenericTypeDefinition() == typeof(IMapTo<>) && !type.IsAbstract && !type.IsInterface - select new Map(interf.GetGenericArguments().First(), type)).ToList(); + select new Map(@interface.GetGenericArguments().First(), type)).ToList(); return mapsFrom; } @@ -27,9 +27,9 @@ public static IEnumerable LoadCustomMappings(Assembly rootAs var mapsFrom = ( from type in types - from interf in type.GetInterfaces() + from @interface in type.GetInterfaces() where - typeof(IHaveCustomMapping).IsAssignableFrom(interf) && + typeof(IHaveCustomMapping).IsAssignableFrom(@interface) && !type.IsAbstract && !type.IsInterface select (IHaveCustomMapping)Activator.CreateInstance(type)!).ToList(); diff --git a/BuildingBlocks/src/BuildingBlocks.Application/BuildingBlocks.Application.csproj b/BuildingBlocks/src/BuildingBlocks.Application/BuildingBlocks.Application.csproj index 50759137c3..d0b3f320c7 100644 --- a/BuildingBlocks/src/BuildingBlocks.Application/BuildingBlocks.Application.csproj +++ b/BuildingBlocks/src/BuildingBlocks.Application/BuildingBlocks.Application.csproj @@ -1,13 +1,9 @@ - - enable - - - + diff --git a/BuildingBlocks/src/BuildingBlocks.Application/FluentValidation/IRuleBuilderExtensions.cs b/BuildingBlocks/src/BuildingBlocks.Application/FluentValidation/IRuleBuilderExtensions.cs index 8f0fea2691..efdd7fcc5f 100644 --- a/BuildingBlocks/src/BuildingBlocks.Application/FluentValidation/IRuleBuilderExtensions.cs +++ b/BuildingBlocks/src/BuildingBlocks.Application/FluentValidation/IRuleBuilderExtensions.cs @@ -13,7 +13,7 @@ public static void Valid(this IRuleBuilder ruleBuilder, { var domainError = validator(v); if (domainError != null) - context.AddFailure(new ValidationFailure(context.PropertyName, domainError.Message, v) { ErrorCode = domainError.Code }); + context.AddFailure(new ValidationFailure(context.PropertyPath, domainError.Message, v) { ErrorCode = domainError.Code }); }); } } diff --git a/BuildingBlocks/src/BuildingBlocks.Domain/BuildingBlocks.Domain.csproj b/BuildingBlocks/src/BuildingBlocks.Domain/BuildingBlocks.Domain.csproj index 43e529c14d..660dd8c99c 100644 --- a/BuildingBlocks/src/BuildingBlocks.Domain/BuildingBlocks.Domain.csproj +++ b/BuildingBlocks/src/BuildingBlocks.Domain/BuildingBlocks.Domain.csproj @@ -1,9 +1,5 @@  - - enable - - diff --git a/BuildingBlocks/src/BuildingBlocks.Domain/StronglyTypedIds/Classes/StronglyTypedId.cs b/BuildingBlocks/src/BuildingBlocks.Domain/StronglyTypedIds/Classes/StronglyTypedId.cs index 1f6be5ef17..40a68ade37 100644 --- a/BuildingBlocks/src/BuildingBlocks.Domain/StronglyTypedIds/Classes/StronglyTypedId.cs +++ b/BuildingBlocks/src/BuildingBlocks.Domain/StronglyTypedIds/Classes/StronglyTypedId.cs @@ -37,13 +37,70 @@ public abstract class StronglyTypedId : IFormattable, IEquatable - - enable - - - + - - - - + + + + - + - + diff --git a/BuildingBlocks/src/BuildingBlocks.Infrastructure/EventBus/AzureServiceBus/EventBusAzureServiceBus.cs b/BuildingBlocks/src/BuildingBlocks.Infrastructure/EventBus/AzureServiceBus/EventBusAzureServiceBus.cs index 7cf50defa8..b438542ccc 100644 --- a/BuildingBlocks/src/BuildingBlocks.Infrastructure/EventBus/AzureServiceBus/EventBusAzureServiceBus.cs +++ b/BuildingBlocks/src/BuildingBlocks.Infrastructure/EventBus/AzureServiceBus/EventBusAzureServiceBus.cs @@ -170,7 +170,7 @@ await policy.ExecuteAsync(async () => throw new Exception( "Integration event handler could not be resolved from dependency container or it does not implement IIntegrationEventHandler."); - await (Task)concreteType.GetMethod("Handle")!.Invoke(handler, new[] { integrationEvent })!; + await (Task)concreteType.GetMethod("Handle")!.Invoke(handler, [integrationEvent])!; }); } catch (Exception ex) diff --git a/BuildingBlocks/src/BuildingBlocks.Infrastructure/EventBus/EventBusRetryPolicyFactory.cs b/BuildingBlocks/src/BuildingBlocks.Infrastructure/EventBus/EventBusRetryPolicyFactory.cs index 38f8dc0342..74852cd122 100644 --- a/BuildingBlocks/src/BuildingBlocks.Infrastructure/EventBus/EventBusRetryPolicyFactory.cs +++ b/BuildingBlocks/src/BuildingBlocks.Infrastructure/EventBus/EventBusRetryPolicyFactory.cs @@ -4,7 +4,7 @@ namespace Backbone.BuildingBlocks.Infrastructure.EventBus; internal class EventBusRetryPolicyFactory { - static internal AsyncRetryPolicy Create(HandlerRetryBehavior handlerRetryBehavior, Action onRetry) + internal static AsyncRetryPolicy Create(HandlerRetryBehavior handlerRetryBehavior, Action onRetry) { return Policy.Handle() .WaitAndRetryAsync( diff --git a/BuildingBlocks/src/BuildingBlocks.Infrastructure/EventBus/GoogleCloudPubSub/EventBusGoogleCloudPubSub.cs b/BuildingBlocks/src/BuildingBlocks.Infrastructure/EventBus/GoogleCloudPubSub/EventBusGoogleCloudPubSub.cs index 6c62ad9159..f97057a646 100644 --- a/BuildingBlocks/src/BuildingBlocks.Infrastructure/EventBus/GoogleCloudPubSub/EventBusGoogleCloudPubSub.cs +++ b/BuildingBlocks/src/BuildingBlocks.Infrastructure/EventBus/GoogleCloudPubSub/EventBusGoogleCloudPubSub.cs @@ -139,7 +139,7 @@ await policy.ExecuteAsync(async () => var handleMethod = handler.GetType().GetMethod("Handle"); - await (Task)handleMethod!.Invoke(handler, new object[] { integrationEvent })!; + await (Task)handleMethod!.Invoke(handler, [integrationEvent])!; return Task.CompletedTask; }); diff --git a/BuildingBlocks/src/BuildingBlocks.Infrastructure/EventBus/InMemoryEventBusSubscriptionsManager.cs b/BuildingBlocks/src/BuildingBlocks.Infrastructure/EventBus/InMemoryEventBusSubscriptionsManager.cs index dc88d55ef9..30ed2ae432 100644 --- a/BuildingBlocks/src/BuildingBlocks.Infrastructure/EventBus/InMemoryEventBusSubscriptionsManager.cs +++ b/BuildingBlocks/src/BuildingBlocks.Infrastructure/EventBus/InMemoryEventBusSubscriptionsManager.cs @@ -60,7 +60,7 @@ private void DoAddSubscription(Type handlerType, Type eventType) { var eventName = GetEventKey(eventType); - if (!HasSubscriptionsForEvent(eventName)) _handlers.Add(eventName, new List()); + if (!HasSubscriptionsForEvent(eventName)) _handlers.Add(eventName, []); if (_handlers[eventName].Any(s => s.HandlerType == handlerType)) throw new ArgumentException( diff --git a/BuildingBlocks/src/BuildingBlocks.Infrastructure/EventBus/RabbitMQ/DefaultRabbitMQPersisterConnection.cs b/BuildingBlocks/src/BuildingBlocks.Infrastructure/EventBus/RabbitMQ/DefaultRabbitMQPersisterConnection.cs index 4ca1e111ac..686b5b9840 100644 --- a/BuildingBlocks/src/BuildingBlocks.Infrastructure/EventBus/RabbitMQ/DefaultRabbitMQPersisterConnection.cs +++ b/BuildingBlocks/src/BuildingBlocks.Infrastructure/EventBus/RabbitMQ/DefaultRabbitMQPersisterConnection.cs @@ -26,7 +26,7 @@ public DefaultRabbitMqPersistentConnection(IConnectionFactory connectionFactory, _retryCount = retryCount; } - public bool IsConnected => _connection != null && _connection.IsOpen && !_disposed; + public bool IsConnected => _connection is { IsOpen: true } && !_disposed; public IModel CreateModel() { diff --git a/BuildingBlocks/src/BuildingBlocks.Infrastructure/EventBus/RabbitMQ/EventBusRabbitMQ.cs b/BuildingBlocks/src/BuildingBlocks.Infrastructure/EventBus/RabbitMQ/EventBusRabbitMQ.cs index e504c94226..97f6bb8e71 100644 --- a/BuildingBlocks/src/BuildingBlocks.Infrastructure/EventBus/RabbitMQ/EventBusRabbitMQ.cs +++ b/BuildingBlocks/src/BuildingBlocks.Infrastructure/EventBus/RabbitMQ/EventBusRabbitMQ.cs @@ -55,7 +55,7 @@ public void StartConsuming() { if (_consumer is null) { - throw new Exception("Cannnot start consuming without a consumer set."); + throw new Exception("Cannot start consuming without a consumer set."); } _consumerChannel.BasicConsume(_queueName, false, _consumer); @@ -112,7 +112,7 @@ public void Subscribe() var eventName = _subsManager.GetEventKey(); DoInternalSubscription(eventName); - _logger.LogInformation("Subscribing to event '{EventName}' with {EventHandler}", eventName, typeof(TH).GetType().Name); + _logger.LogInformation("Subscribing to event '{EventName}' with {EventHandler}", eventName, typeof(TH).Name); _subsManager.AddSubscription(); } @@ -216,7 +216,7 @@ await policy.ExecuteAsync(async () => var concreteType = typeof(IIntegrationEventHandler<>).MakeGenericType(eventType); - await (Task)concreteType.GetMethod("Handle")!.Invoke(handler, new[] { integrationEvent })!; + await (Task)concreteType.GetMethod("Handle")!.Invoke(handler, [integrationEvent])!; }); } } diff --git a/BuildingBlocks/src/BuildingBlocks.Infrastructure/Exceptions/GenericInfrastructureErrors.cs b/BuildingBlocks/src/BuildingBlocks.Infrastructure/Exceptions/GenericInfrastructureErrors.cs index f8d3ae117e..8f54644261 100644 --- a/BuildingBlocks/src/BuildingBlocks.Infrastructure/Exceptions/GenericInfrastructureErrors.cs +++ b/BuildingBlocks/src/BuildingBlocks.Infrastructure/Exceptions/GenericInfrastructureErrors.cs @@ -1,5 +1,3 @@ namespace Backbone.BuildingBlocks.Infrastructure.Exceptions; -public static class GenericInfrastructureErrors -{ -} +public static class GenericInfrastructureErrors; diff --git a/BuildingBlocks/src/BuildingBlocks.Infrastructure/Persistence/BlobStorage/GoogleCloudStorage/GoogleCloudStorage.cs b/BuildingBlocks/src/BuildingBlocks.Infrastructure/Persistence/BlobStorage/GoogleCloudStorage/GoogleCloudStorage.cs index ccf0594878..99f73f9292 100644 --- a/BuildingBlocks/src/BuildingBlocks.Infrastructure/Persistence/BlobStorage/GoogleCloudStorage/GoogleCloudStorage.cs +++ b/BuildingBlocks/src/BuildingBlocks.Infrastructure/Persistence/BlobStorage/GoogleCloudStorage/GoogleCloudStorage.cs @@ -17,7 +17,7 @@ public class GoogleCloudStorage : IBlobStorage, IDisposable public GoogleCloudStorage(StorageClient storageClient, ILogger logger) { _storageClient = storageClient; - _changedBlobs = new List(); + _changedBlobs = []; _removedBlobs = new List(); _logger = logger; } diff --git a/BuildingBlocks/src/Crypto/Crypto.csproj b/BuildingBlocks/src/Crypto/Crypto.csproj index c9d87fc2db..c1bb7576c0 100644 --- a/BuildingBlocks/src/Crypto/Crypto.csproj +++ b/BuildingBlocks/src/Crypto/Crypto.csproj @@ -1,9 +1,5 @@ - - enable - - Enmeshed.Crypto https://enmeshed.eu diff --git a/BuildingBlocks/src/Crypto/Implementations/KeyGenerator.cs b/BuildingBlocks/src/Crypto/Implementations/KeyGenerator.cs index 5e86a439a1..3398f416fe 100644 --- a/BuildingBlocks/src/Crypto/Implementations/KeyGenerator.cs +++ b/BuildingBlocks/src/Crypto/Implementations/KeyGenerator.cs @@ -1,17 +1,9 @@ using Backbone.Crypto.Abstractions; -using NSec.Cryptography; namespace Backbone.Crypto.Implementations; public class KeyGenerator : IKeyGenerator { - private readonly KeyBlobFormat _keyFormat; - - public KeyGenerator(KeyBlobFormat keyFormat) - { - _keyFormat = keyFormat; - } - public ConvertibleString DeriveSymmetricKeyWithEcdh(ConvertibleString privateKey, ConvertibleString publicKey, int keyLengthInBits) { diff --git a/BuildingBlocks/src/Crypto/Implementations/SignatureHelper.cs b/BuildingBlocks/src/Crypto/Implementations/SignatureHelper.cs index 7ea62a93ad..a223c6d4e7 100644 --- a/BuildingBlocks/src/Crypto/Implementations/SignatureHelper.cs +++ b/BuildingBlocks/src/Crypto/Implementations/SignatureHelper.cs @@ -81,7 +81,6 @@ public bool IsValidPrivateKey(ConvertibleString privateKey) public static SignatureHelper CreateEd25519WithRawKeyFormat() { - new X25519(); return new SignatureHelper(SignatureAlgorithm.Ed25519, KeyBlobFormat.RawPrivateKey, KeyBlobFormat.RawPublicKey); } diff --git a/BuildingBlocks/src/DevelopmentKit.Identity/DevelopmentKit.Identity.csproj b/BuildingBlocks/src/DevelopmentKit.Identity/DevelopmentKit.Identity.csproj index 4ba0f8e165..6fef68aa62 100644 --- a/BuildingBlocks/src/DevelopmentKit.Identity/DevelopmentKit.Identity.csproj +++ b/BuildingBlocks/src/DevelopmentKit.Identity/DevelopmentKit.Identity.csproj @@ -1,9 +1,5 @@  - - enable - - diff --git a/BuildingBlocks/src/SpecFlowCucumberResultsExporter/Extensions/Exporter.cs b/BuildingBlocks/src/SpecFlowCucumberResultsExporter/Extensions/Exporter.cs index 9323cd7626..ed6cf50024 100644 --- a/BuildingBlocks/src/SpecFlowCucumberResultsExporter/Extensions/Exporter.cs +++ b/BuildingBlocks/src/SpecFlowCucumberResultsExporter/Extensions/Exporter.cs @@ -10,7 +10,7 @@ public static void ExportToCucumber(string path = default, string fileName = def Reporters.Add(new JsonReporter()); - Reporters.FinishedReport += (sender, args) => + Reporters.FinishedReport += (_, args) => { var file = new FileInfo(Path.Combine(path, fileName)); file.Directory?.Create(); diff --git a/BuildingBlocks/src/SpecFlowCucumberResultsExporter/Extensions/ExtensionMethods.cs b/BuildingBlocks/src/SpecFlowCucumberResultsExporter/Extensions/ExtensionMethods.cs index 72dc7eaf55..85b36aac35 100644 --- a/BuildingBlocks/src/SpecFlowCucumberResultsExporter/Extensions/ExtensionMethods.cs +++ b/BuildingBlocks/src/SpecFlowCucumberResultsExporter/Extensions/ExtensionMethods.cs @@ -51,12 +51,12 @@ internal static TestResult ToTestResult(this ScenarioExecutionStatus executionSt } } - internal static IEnumerable GetPendingSteps(this ScenarioContext scenarioContenxt) + internal static IEnumerable GetPendingSteps(this ScenarioContext scenarioContext) { return typeof(ScenarioContext) - .GetProperty("PendingSteps", BindingFlags.NonPublic | BindingFlags.Instance) - .GetValue(scenarioContenxt, null) as IEnumerable - ?? new string[0]; + .GetProperty("PendingSteps", BindingFlags.NonPublic | BindingFlags.Instance)! + .GetValue(scenarioContext, null) as IEnumerable + ?? []; } internal static string ReplaceFirst(this string s, string find, string replace) diff --git a/BuildingBlocks/src/SpecFlowCucumberResultsExporter/Extensions/JsonReporter.cs b/BuildingBlocks/src/SpecFlowCucumberResultsExporter/Extensions/JsonReporter.cs index 019bcdeb0b..9d1576f8ee 100644 --- a/BuildingBlocks/src/SpecFlowCucumberResultsExporter/Extensions/JsonReporter.cs +++ b/BuildingBlocks/src/SpecFlowCucumberResultsExporter/Extensions/JsonReporter.cs @@ -11,21 +11,20 @@ public class JsonReporter : Reporter public JsonReporter() { + var list = new JsonConverter[] { new StringEnumConverter() }.ToList(); + JsonSerializerSettings = new JsonSerializerSettings { Formatting = Formatting.Indented, ContractResolver = new ReportContractResolver(), NullValueHandling = NullValueHandling.Ignore, - Converters = Enumerable.ToList(new JsonConverter[1] - { - new StringEnumConverter() - }) + Converters = list }; } public override void WriteToStream(Stream stream) { - var s = JsonConvert.SerializeObject(base.Report.Features, JsonSerializerSettings); + var s = JsonConvert.SerializeObject(Report.Features, JsonSerializerSettings); var bytes = Encoding.UTF8.GetBytes(s); using var memoryStream = new MemoryStream(bytes); memoryStream.CopyTo(stream); diff --git a/BuildingBlocks/src/SpecFlowCucumberResultsExporter/Extensions/ReportContractResolver.cs b/BuildingBlocks/src/SpecFlowCucumberResultsExporter/Extensions/ReportContractResolver.cs index ce8f3651c1..907ac61736 100644 --- a/BuildingBlocks/src/SpecFlowCucumberResultsExporter/Extensions/ReportContractResolver.cs +++ b/BuildingBlocks/src/SpecFlowCucumberResultsExporter/Extensions/ReportContractResolver.cs @@ -15,7 +15,6 @@ protected override IList CreateProperties(Type type, MemberSeriali property.PropertyName = ConvertPropertyName(property.PropertyName); } - // only seria return properties; } diff --git a/BuildingBlocks/src/SpecFlowCucumberResultsExporter/Model/Feature.cs b/BuildingBlocks/src/SpecFlowCucumberResultsExporter/Model/Feature.cs index 4145eeadce..0ae49f355c 100644 --- a/BuildingBlocks/src/SpecFlowCucumberResultsExporter/Model/Feature.cs +++ b/BuildingBlocks/src/SpecFlowCucumberResultsExporter/Model/Feature.cs @@ -8,8 +8,8 @@ public class Feature : TaggedReportItem public new string Description { - get { return _description; } - set { _description = string.IsNullOrEmpty(value) ? value : value.Replace("\r", ""); } + get => _description; + set => _description = string.IsNullOrEmpty(value) ? value : value.Replace("\r", ""); } public string Uri { get; set; } = DEFAULT_URI; diff --git a/BuildingBlocks/src/SpecFlowCucumberResultsExporter/Model/Step.cs b/BuildingBlocks/src/SpecFlowCucumberResultsExporter/Model/Step.cs index 45b5dea554..fd84f72c6d 100644 --- a/BuildingBlocks/src/SpecFlowCucumberResultsExporter/Model/Step.cs +++ b/BuildingBlocks/src/SpecFlowCucumberResultsExporter/Model/Step.cs @@ -10,7 +10,7 @@ public class Step : ReportItem public List Rows { get; set; } [JsonProperty("embeddings")] - public List Embeddings { get; set; } = new(); + public List Embeddings { get; set; } = []; public void AddEmbedding(string mimeType, string base64data) { diff --git a/BuildingBlocks/src/SpecFlowCucumberResultsExporter/Reporting/Reporter.cs b/BuildingBlocks/src/SpecFlowCucumberResultsExporter/Reporting/Reporter.cs index 5625cd2807..eff5f10a91 100644 --- a/BuildingBlocks/src/SpecFlowCucumberResultsExporter/Reporting/Reporter.cs +++ b/BuildingBlocks/src/SpecFlowCucumberResultsExporter/Reporting/Reporter.cs @@ -10,7 +10,7 @@ public abstract class Reporter public Step CurrentStep { get; internal set; } - public virtual string Name => GetType().FullName; + public virtual string Name => GetType().FullName!; public Report Report { get; set; } diff --git a/BuildingBlocks/src/SpecFlowCucumberResultsExporter/Reporting/Reporters.SpecFlowHooks.cs b/BuildingBlocks/src/SpecFlowCucumberResultsExporter/Reporting/Reporters.SpecFlowHooks.cs index 5a7a67d896..8ef383a49b 100644 --- a/BuildingBlocks/src/SpecFlowCucumberResultsExporter/Reporting/Reporters.SpecFlowHooks.cs +++ b/BuildingBlocks/src/SpecFlowCucumberResultsExporter/Reporting/Reporters.SpecFlowHooks.cs @@ -5,7 +5,7 @@ namespace Backbone.SpecFlowCucumberResultsExporter.Reporting; public partial class Reporters { - private static bool _testrunIsFirstFeature; + private static bool _testRunIsFirstFeature; [AfterFeature] internal static void AfterFeature() @@ -14,15 +14,15 @@ internal static void AfterFeature() { var feature = reporter.CurrentFeature; - var scenarioOutlineGroups = feature.Elements.GroupBy(scenario => scenario.Name) - .Where((scenarioGrp, key) => scenarioGrp.Count() > 1) - .Select((scenarioGrp, key) => scenarioGrp.ToList()); + var scenarioOutlineGroups = feature!.Elements.GroupBy(scenario => scenario.Name) + .Where((scenarioGrp, _) => scenarioGrp.Count() > 1) + .Select((scenarioGrp, _) => scenarioGrp.ToList()); foreach (var scenarioOutlineGroup in scenarioOutlineGroups) { - for (var i = 0; i < scenarioOutlineGroup.Count(); i++) + for (var i = 0; i < scenarioOutlineGroup.Count; i++) { - scenarioOutlineGroup[i].Name = string.Format("{0} (example {1})", scenarioOutlineGroup[i].Name, i + 1); + scenarioOutlineGroup[i].Name = $"{scenarioOutlineGroup[i].Name} (example {i + 1})"; } } @@ -42,7 +42,7 @@ internal static void AfterScenario() foreach (var reporter in REPORTERS.ToArray()) { var scenario = reporter.CurrentScenario; - scenario.EndTime = CurrentRunTime; + scenario!.EndTime = CurrentRunTime; scenario.Result = scenario.Steps.Exists(o => o.Result.Status == TestResult.Failed) ? TestResult.Failed : TestResult.Passed; @@ -64,7 +64,7 @@ internal static void AfterTestRun() [AfterStep] internal static void AfterStep(ScenarioContext scenarioContext) { - var endtime = CurrentRunTime; + var endTime = CurrentRunTime; var result = scenarioContext.ScenarioExecutionStatus.ToTestResult(); var error = scenarioContext.TestError?.ToExceptionInfo().Message; error = error == null && result == TestResult.Pending ? new PendingStepException().ToExceptionInfo().Message : string.Empty; @@ -72,10 +72,10 @@ internal static void AfterStep(ScenarioContext scenarioContext) foreach (var reporter in REPORTERS.ToArray()) { var step = reporter.CurrentStep; - step.EndTime = CurrentRunTime; + step!.EndTime = CurrentRunTime; step.Result = new StepResult { - Duration = (long)((endtime - reporter.CurrentStep.StartTime).TotalMilliseconds * 1000000), + Duration = (long)((endTime - reporter.CurrentStep!.StartTime).TotalMilliseconds * 1000000), Status = result, Error = error }; @@ -88,25 +88,25 @@ internal static void AfterStep(ScenarioContext scenarioContext) [BeforeFeature] internal static void BeforeFeature(FeatureContext featureContext) { - var starttime = CurrentRunTime; + var startTime = CurrentRunTime; // Init reports when the first feature runs. This is intentionally not done in // BeforeTestRun(), to make sure other [BeforeTestRun] annotated methods can perform // initialization before the reports are created. - if (_testrunIsFirstFeature) + if (_testRunIsFirstFeature) { foreach (var reporter in REPORTERS) { reporter.Report = new Report { - Features = new List(), - StartTime = starttime + Features = [], + StartTime = startTime }; OnStartedReport(reporter); } - _testrunIsFirstFeature = false; + _testRunIsFirstFeature = false; } foreach (var reporter in REPORTERS) @@ -115,8 +115,8 @@ internal static void BeforeFeature(FeatureContext featureContext) var feature = new Feature { Tags = featureContext.FeatureInfo.Tags.Select(tag => new Tag() { Name = "@" + tag }).ToList(), - Elements = new List(), - StartTime = starttime, + Elements = [], + StartTime = startTime, Name = featureContext.FeatureInfo.Title, Description = featureContext.FeatureInfo.Description, Id = featureId, @@ -133,20 +133,20 @@ internal static void BeforeFeature(FeatureContext featureContext) [BeforeScenario] internal static void BeforeScenario(ScenarioContext scenarioContext) { - var starttime = CurrentRunTime; + var startTime = CurrentRunTime; foreach (var reporter in REPORTERS) { var scenario = new Scenario { Tags = scenarioContext.ScenarioInfo.Tags.Select(tag => new Tag() { Name = "@" + tag }).ToList(), - StartTime = starttime, + StartTime = startTime, Name = scenarioContext.ScenarioInfo.Title, - Steps = new List(), + Steps = [], Description = scenarioContext.ScenarioInfo.Title }; - reporter.CurrentFeature.Elements.Add(scenario); + reporter.CurrentFeature!.Elements.Add(scenario); reporter.CurrentScenario = scenario; OnStartedScenario(reporter); @@ -156,7 +156,7 @@ internal static void BeforeScenario(ScenarioContext scenarioContext) [BeforeTestRun] internal static void BeforeTestRun() { - _testrunIsFirstFeature = true; + _testRunIsFirstFeature = true; } [BeforeStep] @@ -168,7 +168,7 @@ internal static void BeforeStep(ScenarioContext scenarioContext) { var step = CreateStep(scenarioContext, startTime); - reporter.CurrentScenario.Steps.Add(step); + reporter.CurrentScenario!.Steps.Add(step); reporter.CurrentStep = step; OnStartedStep(reporter); diff --git a/BuildingBlocks/src/SpecFlowCucumberResultsExporter/Reporting/Reporters.cs b/BuildingBlocks/src/SpecFlowCucumberResultsExporter/Reporting/Reporters.cs index d2a89a8d4a..b5ceb609e4 100644 --- a/BuildingBlocks/src/SpecFlowCucumberResultsExporter/Reporting/Reporters.cs +++ b/BuildingBlocks/src/SpecFlowCucumberResultsExporter/Reporting/Reporters.cs @@ -10,7 +10,7 @@ public partial class Reporters { #region Private/Internal - private static readonly List REPORTERS = new(); + private static readonly List REPORTERS = []; /// /// Returns the current date/time which is used during the test run. It can set to a fixed @@ -30,21 +30,21 @@ internal static DateTime CurrentRunTime private static void AddStepRows(ref Step step, Table table) { - step.Rows = new List { new() { Cells = table.Header.ToList() } }; + step.Rows = [new() { Cells = table.Header.ToList() }]; foreach (var tableRow in table.Rows) { step.Rows.Add(new Row() { Cells = tableRow.Select(x => x.Value).ToList() }); } } - internal static Step CreateStep(ScenarioContext scenarioContext, DateTime starttime, MethodBase method = null, params object[] args) + internal static Step CreateStep(ScenarioContext scenarioContext, DateTime startTime, MethodBase method = null, params object[] args) { var stepInfo = ScenarioStepContext.Current.StepInfo; var step = new Step { Name = stepInfo.Text, - StartTime = starttime, + StartTime = startTime, Keyword = scenarioContext.CurrentScenarioBlock + " ", Id = stepInfo.Text.Replace(" ", "-").ToLower() }; @@ -57,9 +57,8 @@ internal static Step CreateStep(ScenarioContext scenarioContext, DateTime startt { step.Name = attr.Regex; - for (var i = 0; i < args.Length; i++) + foreach (var arg in args) { - var arg = args[i]; if (arg is Table table) { AddStepRows(ref step, table); @@ -70,11 +69,11 @@ internal static Step CreateStep(ScenarioContext scenarioContext, DateTime startt var match = titleRegex.Match(step.Name); if (match.Groups.Count > 1) { - step.Name = step.Name.ReplaceFirst(match.Groups[1].Value, args[i].ToString()); + step.Name = step.Name.ReplaceFirst(match.Groups[1].Value, arg.ToString()); } else { - step.MultiLineParameter = args[i].ToString(); + step.MultiLineParameter = arg.ToString(); } } } @@ -138,19 +137,19 @@ internal static async Task ExecuteStep(ScenarioContext scenarioContext, Func stepFunc, MethodBase methodBase, params object[] args) { - methodBase = methodBase ?? stepFunc.Method; + methodBase ??= stepFunc.Method; var currentSteps = new Dictionary(); - var starttime = CurrentRunTime; + var startTime = CurrentRunTime; foreach (var reporter in GetAll()) { currentSteps.Add(reporter, reporter.CurrentStep); - var step = CreateStep(scenarioContext, starttime, methodBase, args); + var step = CreateStep(scenarioContext, startTime, methodBase, args); var stepContainer = reporter.CurrentScenario; - stepContainer.Steps.Add(step); + stepContainer!.Steps.Add(step); reporter.CurrentStep = step; OnStartedStep(reporter); } @@ -184,7 +183,7 @@ internal static async Task ExecuteStep(ScenarioContext scenarioContext, Func - /// Set fixed start and end times. Usefull for automated tests. + /// Set fixed start and end times. Useful for automated tests. /// public static DateTime? FixedRunTime { get; set; } diff --git a/BuildingBlocks/src/SpecFlowCucumberResultsExporter/SpecFlowCucumberResultsExporter.csproj b/BuildingBlocks/src/SpecFlowCucumberResultsExporter/SpecFlowCucumberResultsExporter.csproj index 9b379dc558..346c2dc9b6 100644 --- a/BuildingBlocks/src/SpecFlowCucumberResultsExporter/SpecFlowCucumberResultsExporter.csproj +++ b/BuildingBlocks/src/SpecFlowCucumberResultsExporter/SpecFlowCucumberResultsExporter.csproj @@ -1,20 +1,21 @@ - - Library - + + Library + disable + - - - - - - - + + + + + + + - - - - + + + + diff --git a/BuildingBlocks/src/StronglyTypedIds/StronglyTypedIds.csproj b/BuildingBlocks/src/StronglyTypedIds/StronglyTypedIds.csproj index a9f0f27e2b..c632161032 100644 --- a/BuildingBlocks/src/StronglyTypedIds/StronglyTypedIds.csproj +++ b/BuildingBlocks/src/StronglyTypedIds/StronglyTypedIds.csproj @@ -1,7 +1,3 @@  - - enable - - diff --git a/BuildingBlocks/src/Tooling/SystemTime.cs b/BuildingBlocks/src/Tooling/SystemTime.cs index 07102a2ef4..e70235305f 100644 --- a/BuildingBlocks/src/Tooling/SystemTime.cs +++ b/BuildingBlocks/src/Tooling/SystemTime.cs @@ -30,7 +30,7 @@ public static void Set(DateTime time) var stackTrace = new StackTrace(); var callerType = stackTrace.GetFrame(1)!.GetMethod()!.DeclaringType; - if (callerType != null && callerType.Namespace != null && !callerType.Namespace.Contains("Test")) + if (callerType is { Namespace: not null } && !callerType.Namespace.Contains("Test")) { throw new NotSupportedException("You can't call this method from a Non-Test-class"); } diff --git a/BuildingBlocks/src/Tooling/Tooling.csproj b/BuildingBlocks/src/Tooling/Tooling.csproj index 1e0db01b46..2ff7a5b632 100644 --- a/BuildingBlocks/src/Tooling/Tooling.csproj +++ b/BuildingBlocks/src/Tooling/Tooling.csproj @@ -1,9 +1,5 @@ - - enable - - diff --git a/BuildingBlocks/src/UnitTestTools/Data/TestDataGenerator.cs b/BuildingBlocks/src/UnitTestTools/Data/TestDataGenerator.cs index 338abb145d..9fc0573493 100644 --- a/BuildingBlocks/src/UnitTestTools/Data/TestDataGenerator.cs +++ b/BuildingBlocks/src/UnitTestTools/Data/TestDataGenerator.cs @@ -6,7 +6,7 @@ public static class TestDataGenerator { public static string GenerateString(int resultLength, char[]? chars = null) { - chars ??= new char[] { 'A', 'B', 'C' }; + chars ??= ['A', 'B', 'C']; Random random = new(); return new string(Enumerable.Repeat(chars, resultLength).Select(s => s[random.Next(s.Length)]).ToArray()); diff --git a/BuildingBlocks/src/UnitTestTools/FluentAssertions/Extensions/StringAssertionsExtensions.cs b/BuildingBlocks/src/UnitTestTools/FluentAssertions/Extensions/StringAssertionsExtensions.cs index 2b21745c93..c865d6484d 100644 --- a/BuildingBlocks/src/UnitTestTools/FluentAssertions/Extensions/StringAssertionsExtensions.cs +++ b/BuildingBlocks/src/UnitTestTools/FluentAssertions/Extensions/StringAssertionsExtensions.cs @@ -18,7 +18,7 @@ public static AndConstraint BeValidJson(this StringAssertions JsonDocument.Parse(it.Subject); Execute.Assertion.Given(() => it); } - catch (Exception _) + catch (Exception) { Execute.Assertion.FailWith("Invalid Json"); } diff --git a/BuildingBlocks/src/UnitTestTools/TestDoubles/Fakes/FakeDbContextFactory.cs b/BuildingBlocks/src/UnitTestTools/TestDoubles/Fakes/FakeDbContextFactory.cs index 8b4df6ffb6..18858c749b 100644 --- a/BuildingBlocks/src/UnitTestTools/TestDoubles/Fakes/FakeDbContextFactory.cs +++ b/BuildingBlocks/src/UnitTestTools/TestDoubles/Fakes/FakeDbContextFactory.cs @@ -15,7 +15,7 @@ public static (TContext arrangeContext, TContext assertionContext, TContext actC .UseSqlite(connection) .Options; - object[] args = { options }; + object[] args = [options]; var context = (TContext)Activator.CreateInstance(typeof(TContext), args)!; context.Database.EnsureCreated(); diff --git a/BuildingBlocks/src/UnitTestTools/UnitTestTools.csproj b/BuildingBlocks/src/UnitTestTools/UnitTestTools.csproj index c40efc2b95..4005467675 100644 --- a/BuildingBlocks/src/UnitTestTools/UnitTestTools.csproj +++ b/BuildingBlocks/src/UnitTestTools/UnitTestTools.csproj @@ -1,15 +1,11 @@ - - enable - - - - + + diff --git a/BuildingBlocks/test/BuildingBlocks.API.Tests/BuildingBlocks.API.Tests.csproj b/BuildingBlocks/test/BuildingBlocks.API.Tests/BuildingBlocks.API.Tests.csproj index 0dc85828e3..024dbc3b0a 100644 --- a/BuildingBlocks/test/BuildingBlocks.API.Tests/BuildingBlocks.API.Tests.csproj +++ b/BuildingBlocks/test/BuildingBlocks.API.Tests/BuildingBlocks.API.Tests.csproj @@ -1,7 +1,6 @@ - enable false diff --git a/BuildingBlocks/test/BuildingBlocks.Application.Tests/BuildingBlocks.Application.Tests.csproj b/BuildingBlocks/test/BuildingBlocks.Application.Tests/BuildingBlocks.Application.Tests.csproj index 4cf7cea8ef..4ae11cf3b3 100644 --- a/BuildingBlocks/test/BuildingBlocks.Application.Tests/BuildingBlocks.Application.Tests.csproj +++ b/BuildingBlocks/test/BuildingBlocks.Application.Tests/BuildingBlocks.Application.Tests.csproj @@ -6,9 +6,9 @@ - + - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/BuildingBlocks/test/BuildingBlocks.Application.Tests/FluentValidation/ValueInValidatorTests.cs b/BuildingBlocks/test/BuildingBlocks.Application.Tests/FluentValidation/ValueInValidatorTests.cs index 86f5374d5d..8a0fba3608 100644 --- a/BuildingBlocks/test/BuildingBlocks.Application.Tests/FluentValidation/ValueInValidatorTests.cs +++ b/BuildingBlocks/test/BuildingBlocks.Application.Tests/FluentValidation/ValueInValidatorTests.cs @@ -47,7 +47,7 @@ public void ValidationErrorHasCorrectProperties() private class AClass { - public string AStringProperty { get; set; } + public required string AStringProperty { get; init; } } private class AClassValidator : AbstractValidator diff --git a/BuildingBlocks/test/BuildingBlocks.Application.Tests/Mediatr/MetricStatusesStubRepository.cs b/BuildingBlocks/test/BuildingBlocks.Application.Tests/Mediatr/MetricStatusesStubRepository.cs index e6e1fbd7aa..318c6a27a7 100644 --- a/BuildingBlocks/test/BuildingBlocks.Application.Tests/Mediatr/MetricStatusesStubRepository.cs +++ b/BuildingBlocks/test/BuildingBlocks.Application.Tests/Mediatr/MetricStatusesStubRepository.cs @@ -15,21 +15,10 @@ public MetricStatusesStubRepository(List? metricStatuses) MetricStatuses = metricStatuses; } } - public List MetricStatuses { get; } = new(); + public List MetricStatuses { get; } = []; public Task> GetMetricStatuses(IdentityAddress identity, IEnumerable keys) { return Task.FromResult(MetricStatuses.AsEnumerable()); } } - -public class MetricStatusesNoMatchStubRepository : IMetricStatusesRepository -{ - public MetricStatusesNoMatchStubRepository() - { } - - public Task> GetMetricStatuses(IdentityAddress identity, IEnumerable keys) - { - return Task.FromResult(Enumerable.Empty()); - } -} diff --git a/BuildingBlocks/test/BuildingBlocks.Application.Tests/Mediatr/QuotaEnforcerBehaviorTests.cs b/BuildingBlocks/test/BuildingBlocks.Application.Tests/Mediatr/QuotaEnforcerBehaviorTests.cs index 0e47418482..4b73038e64 100644 --- a/BuildingBlocks/test/BuildingBlocks.Application.Tests/Mediatr/QuotaEnforcerBehaviorTests.cs +++ b/BuildingBlocks/test/BuildingBlocks.Application.Tests/Mediatr/QuotaEnforcerBehaviorTests.cs @@ -21,7 +21,7 @@ public async void Calls_next_when_no_metric_is_exhausted() var nextMock = new NextMock(); // Act - Func acting = async () => await behavior.Handle( + var acting = async () => await behavior.Handle( new TestCommand(), nextMock.Value, CancellationToken.None); @@ -64,8 +64,7 @@ public void Thrown_QuotaExhaustedException_contains_information_about_each_exhau var exhaustionDate2 = DateTime.UtcNow.AddDays(10); var exhaustedMetricStatus1 = new MetricStatus(new MetricKey("exhausted1"), exhaustionDate1); var exhaustedMetricStatus2 = new MetricStatus(new MetricKey("exhausted2"), exhaustionDate2); - var behavior = CreateQuotaEnforcerBehavior(exhaustedMetricStatuses: new[] - { exhaustedMetricStatus1, exhaustedMetricStatus2 } + var behavior = CreateQuotaEnforcerBehavior(exhaustedMetricStatuses: [exhaustedMetricStatus1, exhaustedMetricStatus2] ); // Act @@ -113,6 +112,4 @@ public Task CheckQuotaExhaustion(IEnumerable metric /// all the metrics available in the repository unless where specified. /// [ApplyQuotasForMetrics("DoesNotApplyToTests")] -internal class TestCommand : IRequest -{ -} +internal class TestCommand : IRequest; diff --git a/BuildingBlocks/test/BuildingBlocks.Infrastructure.Tests/BuildingBlocks.Infrastructure.Tests.csproj b/BuildingBlocks/test/BuildingBlocks.Infrastructure.Tests/BuildingBlocks.Infrastructure.Tests.csproj index 94317c10e8..77cc310614 100644 --- a/BuildingBlocks/test/BuildingBlocks.Infrastructure.Tests/BuildingBlocks.Infrastructure.Tests.csproj +++ b/BuildingBlocks/test/BuildingBlocks.Infrastructure.Tests/BuildingBlocks.Infrastructure.Tests.csproj @@ -11,8 +11,8 @@ - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/BuildingBlocks/test/BuildingBlocks.Infrastructure.Tests/EventBus/GoogleCloudPubSub/GoogleCloudPubSubTests.cs b/BuildingBlocks/test/BuildingBlocks.Infrastructure.Tests/EventBus/GoogleCloudPubSub/GoogleCloudPubSubTests.cs index 9e99edc7e2..126a6612a3 100644 --- a/BuildingBlocks/test/BuildingBlocks.Infrastructure.Tests/EventBus/GoogleCloudPubSub/GoogleCloudPubSubTests.cs +++ b/BuildingBlocks/test/BuildingBlocks.Infrastructure.Tests/EventBus/GoogleCloudPubSub/GoogleCloudPubSubTests.cs @@ -144,7 +144,7 @@ public record Instance(AutofacServiceProvider AutofacServiceProviders, EventBusG public const string CONNECTION_INFO = ""; - private readonly List _instances = new(); + private readonly List _instances = []; public EventBusFactory(ITestOutputHelper output) { diff --git a/BuildingBlocks/test/BuildingBlocks.Infrastructure.Tests/EventBus/GoogleCloudPubSub/TestIntegrationEventHandlers/TestEvent1IntegrationEventHandler1.cs b/BuildingBlocks/test/BuildingBlocks.Infrastructure.Tests/EventBus/GoogleCloudPubSub/TestIntegrationEventHandlers/TestEvent1IntegrationEventHandler1.cs index be4f9b2ad1..f612769322 100644 --- a/BuildingBlocks/test/BuildingBlocks.Infrastructure.Tests/EventBus/GoogleCloudPubSub/TestIntegrationEventHandlers/TestEvent1IntegrationEventHandler1.cs +++ b/BuildingBlocks/test/BuildingBlocks.Infrastructure.Tests/EventBus/GoogleCloudPubSub/TestIntegrationEventHandlers/TestEvent1IntegrationEventHandler1.cs @@ -8,7 +8,7 @@ namespace Backbone.BuildingBlocks.Infrastructure.Tests.EventBus.GoogleCloudPubSu public class TestEvent1IntegrationEventHandler1 : IIntegrationEventHandler { - public static List Instances { get; } = new(); + public static List Instances { get; } = []; public TestEvent1IntegrationEventHandler1() { diff --git a/BuildingBlocks/test/BuildingBlocks.Infrastructure.Tests/EventBus/GoogleCloudPubSub/TestIntegrationEventHandlers/TestEvent1IntegrationEventHandler2.cs b/BuildingBlocks/test/BuildingBlocks.Infrastructure.Tests/EventBus/GoogleCloudPubSub/TestIntegrationEventHandlers/TestEvent1IntegrationEventHandler2.cs index 04cfb22925..976cdbb2f7 100644 --- a/BuildingBlocks/test/BuildingBlocks.Infrastructure.Tests/EventBus/GoogleCloudPubSub/TestIntegrationEventHandlers/TestEvent1IntegrationEventHandler2.cs +++ b/BuildingBlocks/test/BuildingBlocks.Infrastructure.Tests/EventBus/GoogleCloudPubSub/TestIntegrationEventHandlers/TestEvent1IntegrationEventHandler2.cs @@ -9,7 +9,7 @@ namespace Backbone.BuildingBlocks.Infrastructure.Tests.EventBus.GoogleCloudPubSu public class TestEvent1IntegrationEventHandler2 : IIntegrationEventHandler { - public static List Instances { get; } = new(); + public static List Instances { get; } = []; public TestEvent1IntegrationEventHandler2() { diff --git a/BuildingBlocks/test/BuildingBlocks.Infrastructure.Tests/EventBus/GoogleCloudPubSub/TestIntegrationEventHandlers/TestEvent2IntegrationEventHandler.cs b/BuildingBlocks/test/BuildingBlocks.Infrastructure.Tests/EventBus/GoogleCloudPubSub/TestIntegrationEventHandlers/TestEvent2IntegrationEventHandler.cs index cb557ca6a5..6741710f3e 100644 --- a/BuildingBlocks/test/BuildingBlocks.Infrastructure.Tests/EventBus/GoogleCloudPubSub/TestIntegrationEventHandlers/TestEvent2IntegrationEventHandler.cs +++ b/BuildingBlocks/test/BuildingBlocks.Infrastructure.Tests/EventBus/GoogleCloudPubSub/TestIntegrationEventHandlers/TestEvent2IntegrationEventHandler.cs @@ -8,7 +8,7 @@ namespace Backbone.BuildingBlocks.Infrastructure.Tests.EventBus.GoogleCloudPubSu public class TestEvent2IntegrationEventHandler : IIntegrationEventHandler { - public static List Instances { get; } = new(); + public static List Instances { get; } = []; public TestEvent2IntegrationEventHandler() { diff --git a/BuildingBlocks/test/BuildingBlocks.Infrastructure.Tests/EventBus/GoogleCloudPubSub/TestIntegrationEvents/TestEvent1IntegrationEvent.cs b/BuildingBlocks/test/BuildingBlocks.Infrastructure.Tests/EventBus/GoogleCloudPubSub/TestIntegrationEvents/TestEvent1IntegrationEvent.cs index 1543cf5700..ccbb440e60 100644 --- a/BuildingBlocks/test/BuildingBlocks.Infrastructure.Tests/EventBus/GoogleCloudPubSub/TestIntegrationEvents/TestEvent1IntegrationEvent.cs +++ b/BuildingBlocks/test/BuildingBlocks.Infrastructure.Tests/EventBus/GoogleCloudPubSub/TestIntegrationEvents/TestEvent1IntegrationEvent.cs @@ -2,6 +2,4 @@ namespace Backbone.BuildingBlocks.Infrastructure.Tests.EventBus.GoogleCloudPubSub.TestIntegrationEvents; -public class TestEvent1IntegrationEvent : IntegrationEvent -{ -} +public class TestEvent1IntegrationEvent : IntegrationEvent; diff --git a/BuildingBlocks/test/BuildingBlocks.Infrastructure.Tests/EventBus/GoogleCloudPubSub/TestIntegrationEvents/TestEvent2IntegrationEvent.cs b/BuildingBlocks/test/BuildingBlocks.Infrastructure.Tests/EventBus/GoogleCloudPubSub/TestIntegrationEvents/TestEvent2IntegrationEvent.cs index 7a2e283269..c743d991f3 100644 --- a/BuildingBlocks/test/BuildingBlocks.Infrastructure.Tests/EventBus/GoogleCloudPubSub/TestIntegrationEvents/TestEvent2IntegrationEvent.cs +++ b/BuildingBlocks/test/BuildingBlocks.Infrastructure.Tests/EventBus/GoogleCloudPubSub/TestIntegrationEvents/TestEvent2IntegrationEvent.cs @@ -2,6 +2,4 @@ namespace Backbone.BuildingBlocks.Infrastructure.Tests.EventBus.GoogleCloudPubSub.TestIntegrationEvents; -public class TestEvent2IntegrationEvent : IntegrationEvent -{ -} +public class TestEvent2IntegrationEvent : IntegrationEvent; diff --git a/BuildingBlocks/test/BuildingBlocks.Infrastructure.Tests/Tests/AzureStorageAccountTests.cs b/BuildingBlocks/test/BuildingBlocks.Infrastructure.Tests/Tests/AzureStorageAccountTests.cs index ba99ab2776..dba069a090 100644 --- a/BuildingBlocks/test/BuildingBlocks.Infrastructure.Tests/Tests/AzureStorageAccountTests.cs +++ b/BuildingBlocks/test/BuildingBlocks.Infrastructure.Tests/Tests/AzureStorageAccountTests.cs @@ -38,7 +38,7 @@ private static void StartAzuriteContainer() private static void CloseAzuriteContainer() { - var processInfo = new ProcessStartInfo("docker", $"stop azurite-test-container") + var processInfo = new ProcessStartInfo("docker", "stop azurite-test-container") { CreateNoWindow = true, UseShellExecute = false, @@ -71,7 +71,7 @@ private static IBlobStorage ProvisionAzureStorageTests() }); var serviceProvider = services.BuildServiceProvider(); - return serviceProvider.GetService(); + return serviceProvider.GetRequiredService(); } [Fact(Skip = "Fails because emulator container can't be started")] diff --git a/BuildingBlocks/test/Crypto.Tests/Crypto.Tests.csproj b/BuildingBlocks/test/Crypto.Tests/Crypto.Tests.csproj index 50ab6d17f1..69675eafdd 100644 --- a/BuildingBlocks/test/Crypto.Tests/Crypto.Tests.csproj +++ b/BuildingBlocks/test/Crypto.Tests/Crypto.Tests.csproj @@ -11,8 +11,8 @@ - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/BuildingBlocks/test/Crypto.Tests/KeyGeneratorTests.cs b/BuildingBlocks/test/Crypto.Tests/KeyGeneratorTests.cs index d99c6637d7..db0d986579 100644 --- a/BuildingBlocks/test/Crypto.Tests/KeyGeneratorTests.cs +++ b/BuildingBlocks/test/Crypto.Tests/KeyGeneratorTests.cs @@ -4,9 +4,9 @@ namespace Backbone.Crypto.Tests; -public class KeyGeneratorTests : IDisposable +public class KeyGeneratorTests { - private KeyGenerator _keyGeneratorUnderTest; + private readonly KeyGenerator _keyGeneratorUnderTest; #region GenerateSymmetricKey @@ -35,11 +35,6 @@ public KeyGeneratorTests() _keyGeneratorUnderTest = new KeyGenerator(); } - public void Dispose() - { - _keyGeneratorUnderTest = null; - } - #endregion #region DeriveSymmetricKeyWithEcdh diff --git a/BuildingBlocks/test/Crypto.Tests/Tests/Implementations/Deprecated/BouncyCastle/AesEncryptionHelperTests.cs b/BuildingBlocks/test/Crypto.Tests/Tests/Implementations/Deprecated/BouncyCastle/AesEncryptionHelperTests.cs index 4c566c2ae7..c3a8e54308 100644 --- a/BuildingBlocks/test/Crypto.Tests/Tests/Implementations/Deprecated/BouncyCastle/AesEncryptionHelperTests.cs +++ b/BuildingBlocks/test/Crypto.Tests/Tests/Implementations/Deprecated/BouncyCastle/AesEncryptionHelperTests.cs @@ -4,9 +4,9 @@ namespace Backbone.Crypto.Tests.Tests.Implementations.Deprecated.BouncyCastle; -public class AesEncryptionHelperTests : IDisposable +public class AesEncryptionHelperTests { - private ISymmetricEncrypter _symmetricEncrypterUnderTest; + private readonly ISymmetricEncrypter _symmetricEncrypterUnderTest; #region Setup/Teardown @@ -15,11 +15,6 @@ public AesEncryptionHelperTests() _symmetricEncrypterUnderTest = AesSymmetricEncrypter.CreateWith96BitIv128BitMac(); } - public void Dispose() - { - _symmetricEncrypterUnderTest = null; - } - #endregion #region Decrypt diff --git a/BuildingBlocks/test/Crypto.Tests/Tests/Implementations/Deprecated/BouncyCastle/EllipticCurveSignatureHelperTests.cs b/BuildingBlocks/test/Crypto.Tests/Tests/Implementations/Deprecated/BouncyCastle/EllipticCurveSignatureHelperTests.cs index bb1f525f73..e9cba089b8 100644 --- a/BuildingBlocks/test/Crypto.Tests/Tests/Implementations/Deprecated/BouncyCastle/EllipticCurveSignatureHelperTests.cs +++ b/BuildingBlocks/test/Crypto.Tests/Tests/Implementations/Deprecated/BouncyCastle/EllipticCurveSignatureHelperTests.cs @@ -3,9 +3,9 @@ namespace Backbone.Crypto.Tests.Tests.Implementations.Deprecated.BouncyCastle; -public class EllipticCurveSignatureHelperTests : IDisposable +public class EllipticCurveSignatureHelperTests { - private EllipticCurveSignatureHelper _signatureHelper; + private readonly EllipticCurveSignatureHelper _signatureHelper; #region Test Data @@ -27,11 +27,6 @@ public EllipticCurveSignatureHelperTests() _signatureHelper = EllipticCurveSignatureHelper.CreateSha512WithEcdsa(); } - public void Dispose() - { - _signatureHelper = null; - } - #endregion #region Tests diff --git a/BuildingBlocks/test/Crypto.Tests/Tests/Implementations/KeyAgreementHelperTests.cs b/BuildingBlocks/test/Crypto.Tests/Tests/Implementations/KeyAgreementHelperTests.cs index a59b7c32d5..ed85846a61 100644 --- a/BuildingBlocks/test/Crypto.Tests/Tests/Implementations/KeyAgreementHelperTests.cs +++ b/BuildingBlocks/test/Crypto.Tests/Tests/Implementations/KeyAgreementHelperTests.cs @@ -4,9 +4,9 @@ namespace Backbone.Crypto.Tests.Tests.Implementations; -public class KeyAgreementHelperTests : IDisposable +public class KeyAgreementHelperTests { - private KeyAgreementHelper _keyAgreementHelper; + private readonly KeyAgreementHelper _keyAgreementHelper; [Fact] public void IsValidPublicKey_ShouldReturnTrue_WhenPublicKeyIsValid() @@ -55,10 +55,5 @@ public KeyAgreementHelperTests() _keyAgreementHelper = KeyAgreementHelper.CreateX25519WithRawKeyFormat(); } - public void Dispose() - { - _keyAgreementHelper = null; - } - #endregion } diff --git a/BuildingBlocks/test/Crypto.Tests/Tests/Implementations/SignatureAlgorithmTests.cs b/BuildingBlocks/test/Crypto.Tests/Tests/Implementations/SignatureAlgorithmTests.cs index a3b2a84445..68162fca20 100644 --- a/BuildingBlocks/test/Crypto.Tests/Tests/Implementations/SignatureAlgorithmTests.cs +++ b/BuildingBlocks/test/Crypto.Tests/Tests/Implementations/SignatureAlgorithmTests.cs @@ -4,9 +4,9 @@ namespace Backbone.Crypto.Tests.Tests.Implementations; -public class SignatureHelperTests : IDisposable +public class SignatureHelperTests { - private SignatureHelper _signatureHelper; + private readonly SignatureHelper _signatureHelper; #region Test Data @@ -29,11 +29,6 @@ public SignatureHelperTests() _signatureHelper = SignatureHelper.CreateEd25519WithRawKeyFormat(); } - public void Dispose() - { - _signatureHelper = null; - } - #endregion #region Tests @@ -136,7 +131,7 @@ public void GetSignature_ThrowsException_IfPrivateKeyIsInvalid() [Fact] public void IsValidPublicKey_ReturnsTrue_WhenPublicKeyIsValid() { - var _ = _signatureHelper.VerifySignature(ConvertibleString.FromUtf8("Test"), + _ = _signatureHelper.VerifySignature(ConvertibleString.FromUtf8("Test"), ConvertibleString.FromBase64(""), ConvertibleString.FromBase64("Y8ZG4ikthK/Tvql7MwM9blvifnneN0nw5qQTVI7gvEw=")); @@ -169,7 +164,7 @@ public void TestImport() { var key = Key.Create(new Ed25519(), new KeyCreationParameters { ExportPolicy = KeyExportPolicies.AllowPlaintextExport }); - var _ = ConvertibleString.FromByteArray(key.PublicKey.Export(KeyBlobFormat.RawPublicKey)); + _ = ConvertibleString.FromByteArray(key.PublicKey.Export(KeyBlobFormat.RawPublicKey)); var privateKey = ConvertibleString.FromByteArray(key.Export(KeyBlobFormat.RawPrivateKey)); _signatureHelper.CreateSignature(privateKey, ConvertibleString.FromUtf8("Test")); diff --git a/BuildingBlocks/test/DevelopmentKit.Identity.Tests/DevelopmentKit.Identity.Tests.csproj b/BuildingBlocks/test/DevelopmentKit.Identity.Tests/DevelopmentKit.Identity.Tests.csproj index 7fec670d97..2b972fea96 100644 --- a/BuildingBlocks/test/DevelopmentKit.Identity.Tests/DevelopmentKit.Identity.Tests.csproj +++ b/BuildingBlocks/test/DevelopmentKit.Identity.Tests/DevelopmentKit.Identity.Tests.csproj @@ -7,8 +7,8 @@ - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/BuildingBlocks/test/DevelopmentKit.Identity.Tests/IdentityAddressTests.cs b/BuildingBlocks/test/DevelopmentKit.Identity.Tests/IdentityAddressTests.cs index c59344978d..6a2f664fb7 100644 --- a/BuildingBlocks/test/DevelopmentKit.Identity.Tests/IdentityAddressTests.cs +++ b/BuildingBlocks/test/DevelopmentKit.Identity.Tests/IdentityAddressTests.cs @@ -82,13 +82,13 @@ public void AddressesWithInvalidMainPartAreDeclined() internal class TestData { - public string Realm { get; private set; } - public byte[] PublicKey { get; private set; } + public required string Realm { get; set; } + public required byte[] PublicKey { get; set; } - public string Address { get; private set; } + public required string Address { get; set; } - public string Checksum { get; private set; } - public string MainPart { get; private set; } + public required string Checksum { get; set; } + public required string MainPart { get; set; } public static TestData Valid() { diff --git a/BuildingBlocks/test/StronglyTypedIds.Tests/StronglyTypedIds.Tests.csproj b/BuildingBlocks/test/StronglyTypedIds.Tests/StronglyTypedIds.Tests.csproj index bf84d1a5be..d673f3fa50 100644 --- a/BuildingBlocks/test/StronglyTypedIds.Tests/StronglyTypedIds.Tests.csproj +++ b/BuildingBlocks/test/StronglyTypedIds.Tests/StronglyTypedIds.Tests.csproj @@ -6,8 +6,8 @@ - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/BuildingBlocks/test/Tooling.Tests/Tests/DateTimeExtensionsTests.cs b/BuildingBlocks/test/Tooling.Tests/Tests/DateTimeExtensionsTests.cs index 3634410882..4db94b7e74 100644 --- a/BuildingBlocks/test/Tooling.Tests/Tests/DateTimeExtensionsTests.cs +++ b/BuildingBlocks/test/Tooling.Tests/Tests/DateTimeExtensionsTests.cs @@ -25,21 +25,21 @@ public class DateTimeExtensionsTestData : IEnumerable { public IEnumerator GetEnumerator() { - yield return new object[] { "2023-02-23T00:00:30.000", DateTimeExtensions.StartOfDay, "2023-02-23T00:00:00.000" }; - yield return new object[] { "2023-02-23T23:58:30.000", DateTimeExtensions.StartOfDay, "2023-02-23T00:00:00.000" }; - yield return new object[] { "2023-06-20T00:00:30.000", DateTimeExtensions.StartOfWeek, "2023-06-19T00:00:00.000" }; - yield return new object[] { "2023-01-01T23:58:30.000", DateTimeExtensions.StartOfWeek, "2022-12-26T00:00:00.000" }; - yield return new object[] { "2023-01-01T00:00:30.000", DateTimeExtensions.StartOfMonth, "2023-01-01T00:00:00.000" }; - yield return new object[] { "2023-02-23T00:00:30.000", DateTimeExtensions.StartOfMonth, "2023-02-01T00:00:00.000" }; - yield return new object[] { "2023-02-23T00:00:30.000", DateTimeExtensions.StartOfYear, "2023-01-01T00:00:00.000" }; - yield return new object[] { "2023-02-23T00:00:30.000", DateTimeExtensions.EndOfDay, "2023-02-23T23:59:59.999" }; - yield return new object[] { "2023-02-23T23:58:30.000", DateTimeExtensions.EndOfDay, "2023-02-23T23:59:59.999" }; - yield return new object[] { "2023-06-20T00:00:30.000", DateTimeExtensions.EndOfWeek, "2023-06-25T23:59:59.999" }; - yield return new object[] { "2023-01-01T23:58:30.000", DateTimeExtensions.EndOfWeek, "2023-01-01T23:59:59.999" }; - yield return new object[] { "2023-01-01T00:00:30.000", DateTimeExtensions.EndOfMonth, "2023-01-31T23:59:59.999" }; - yield return new object[] { "2023-02-23T00:00:30.000", DateTimeExtensions.EndOfMonth, "2023-02-28T23:59:59.999" }; - yield return new object[] { "2024-02-23T00:00:30.000", DateTimeExtensions.EndOfMonth, "2024-02-29T23:59:59.999" }; - yield return new object[] { "2023-02-23T00:00:30.000", DateTimeExtensions.EndOfYear, "2023-12-31T23:59:59.999" }; + yield return ["2023-02-23T00:00:30.000", DateTimeExtensions.StartOfDay, "2023-02-23T00:00:00.000"]; + yield return ["2023-02-23T23:58:30.000", DateTimeExtensions.StartOfDay, "2023-02-23T00:00:00.000"]; + yield return ["2023-06-20T00:00:30.000", DateTimeExtensions.StartOfWeek, "2023-06-19T00:00:00.000"]; + yield return ["2023-01-01T23:58:30.000", DateTimeExtensions.StartOfWeek, "2022-12-26T00:00:00.000"]; + yield return ["2023-01-01T00:00:30.000", DateTimeExtensions.StartOfMonth, "2023-01-01T00:00:00.000"]; + yield return ["2023-02-23T00:00:30.000", DateTimeExtensions.StartOfMonth, "2023-02-01T00:00:00.000"]; + yield return ["2023-02-23T00:00:30.000", DateTimeExtensions.StartOfYear, "2023-01-01T00:00:00.000"]; + yield return ["2023-02-23T00:00:30.000", DateTimeExtensions.EndOfDay, "2023-02-23T23:59:59.999"]; + yield return ["2023-02-23T23:58:30.000", DateTimeExtensions.EndOfDay, "2023-02-23T23:59:59.999"]; + yield return ["2023-06-20T00:00:30.000", DateTimeExtensions.EndOfWeek, "2023-06-25T23:59:59.999"]; + yield return ["2023-01-01T23:58:30.000", DateTimeExtensions.EndOfWeek, "2023-01-01T23:59:59.999"]; + yield return ["2023-01-01T00:00:30.000", DateTimeExtensions.EndOfMonth, "2023-01-31T23:59:59.999"]; + yield return ["2023-02-23T00:00:30.000", DateTimeExtensions.EndOfMonth, "2023-02-28T23:59:59.999"]; + yield return ["2024-02-23T00:00:30.000", DateTimeExtensions.EndOfMonth, "2024-02-29T23:59:59.999"]; + yield return ["2023-02-23T00:00:30.000", DateTimeExtensions.EndOfYear, "2023-12-31T23:59:59.999"]; } IEnumerator IEnumerable.GetEnumerator() => GetEnumerator(); diff --git a/BuildingBlocks/test/Tooling.Tests/Tests/UrlSafeBase64ToByteArrayJsonConverterTests.cs b/BuildingBlocks/test/Tooling.Tests/Tests/UrlSafeBase64ToByteArrayJsonConverterTests.cs index 1966f8fde1..6dd64847e1 100644 --- a/BuildingBlocks/test/Tooling.Tests/Tests/UrlSafeBase64ToByteArrayJsonConverterTests.cs +++ b/BuildingBlocks/test/Tooling.Tests/Tests/UrlSafeBase64ToByteArrayJsonConverterTests.cs @@ -14,7 +14,7 @@ public void ShouldDeserializeJsonCorrectly() const string jsonString = "{\"Bytes\":\"LS0tKysjIyM8PDw-Pi0oKS8iKSQlJiY_IQ\"}"; var result = JsonSerializer.Deserialize(jsonString, - new JsonSerializerOptions { Converters = { new UrlSafeBase64ToByteArrayJsonConverter() } }); + new JsonSerializerOptions { Converters = { new UrlSafeBase64ToByteArrayJsonConverter() } })!; var utf8 = Encoding.UTF8.GetString(result.Bytes); @@ -40,5 +40,5 @@ public void ShouldSerializeJsonCorrectly() public class Test { - public byte[] Bytes { get; set; } + public required byte[] Bytes { get; set; } } diff --git a/BuildingBlocks/test/Tooling.Tests/Tooling.Tests.csproj b/BuildingBlocks/test/Tooling.Tests/Tooling.Tests.csproj index ec2fe9ab74..ef86dd407d 100644 --- a/BuildingBlocks/test/Tooling.Tests/Tooling.Tests.csproj +++ b/BuildingBlocks/test/Tooling.Tests/Tooling.Tests.csproj @@ -7,8 +7,8 @@ - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/Common/src/Common.Infrastructure/Common.Infrastructure.csproj b/Common/src/Common.Infrastructure/Common.Infrastructure.csproj index 7dae36996e..12cb4890aa 100644 --- a/Common/src/Common.Infrastructure/Common.Infrastructure.csproj +++ b/Common/src/Common.Infrastructure/Common.Infrastructure.csproj @@ -1,12 +1,8 @@ - - enable - - - + diff --git a/Common/src/Common.Infrastructure/Persistence/Context/MetricKeyTypeHandler.cs b/Common/src/Common.Infrastructure/Persistence/Context/MetricKeyTypeHandler.cs index dd28b63178..168a56dc7b 100644 --- a/Common/src/Common.Infrastructure/Persistence/Context/MetricKeyTypeHandler.cs +++ b/Common/src/Common.Infrastructure/Persistence/Context/MetricKeyTypeHandler.cs @@ -10,8 +10,8 @@ public override MetricKey Parse(object value) return new MetricKey((string)value); } - public override void SetValue(IDbDataParameter parameter, MetricKey value) + public override void SetValue(IDbDataParameter parameter, MetricKey? value) { - parameter.Value = value.ToString(); + parameter.Value = value?.ToString(); } } diff --git a/ConsumerApi.Tests.Integration/API/BaseApi.cs b/ConsumerApi.Tests.Integration/API/BaseApi.cs index f99ab868bf..7a8745de44 100644 --- a/ConsumerApi.Tests.Integration/API/BaseApi.cs +++ b/ConsumerApi.Tests.Integration/API/BaseApi.cs @@ -19,7 +19,7 @@ protected BaseApi(HttpClientFactory factory) _httpClient = factory.CreateClient(); ServicePointManager.ServerCertificateValidationCallback += - (sender, cert, chain, sslPolicyErrors) => true; + (_, _, _, _) => true; } protected async Task> Get(string endpoint, RequestConfiguration requestConfiguration) @@ -51,6 +51,9 @@ private async Task ExecuteRequest(HttpMethod method, string endpoi { var request = new HttpRequestMessage(method, ROUTE_PREFIX + endpoint); + if (string.IsNullOrEmpty(requestConfiguration.ContentType)) + throw new ArgumentNullException(nameof(requestConfiguration.ContentType)); + if (!string.IsNullOrEmpty(requestConfiguration.Content)) request.Content = new StringContent(requestConfiguration.Content, MediaTypeHeaderValue.Parse(requestConfiguration.ContentType)); @@ -83,6 +86,9 @@ private async Task> ExecuteRequest(HttpMethod method, string { var request = new HttpRequestMessage(method, ROUTE_PREFIX + endpoint); + if (string.IsNullOrEmpty(requestConfiguration.ContentType)) + throw new ArgumentNullException(nameof(requestConfiguration.ContentType)); + if (!string.IsNullOrEmpty(requestConfiguration.Content)) request.Content = new StringContent(requestConfiguration.Content, MediaTypeHeaderValue.Parse(requestConfiguration.ContentType)); diff --git a/ConsumerApi.Tests.Integration/ConsumerApi.Tests.Integration.csproj b/ConsumerApi.Tests.Integration/ConsumerApi.Tests.Integration.csproj index 43a52e15fd..ef9cfd5229 100644 --- a/ConsumerApi.Tests.Integration/ConsumerApi.Tests.Integration.csproj +++ b/ConsumerApi.Tests.Integration/ConsumerApi.Tests.Integration.csproj @@ -1,12 +1,11 @@  - enable false - + @@ -14,7 +13,7 @@ - + diff --git a/ConsumerApi.Tests.Integration/CustomWebApplicationFactory.cs b/ConsumerApi.Tests.Integration/CustomWebApplicationFactory.cs index 53014f6014..80822cd67a 100644 --- a/ConsumerApi.Tests.Integration/CustomWebApplicationFactory.cs +++ b/ConsumerApi.Tests.Integration/CustomWebApplicationFactory.cs @@ -1,13 +1,6 @@ -using Backbone.Crypto; -using Backbone.Crypto.Abstractions; -using Backbone.Crypto.Implementations; -using Backbone.Tooling.Extensions; -using Google; +using Backbone.Tooling.Extensions; using Microsoft.AspNetCore.Mvc.Testing; -using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.DependencyInjection.Extensions; using Microsoft.Extensions.Hosting; namespace Backbone.ConsumerApi.Tests.Integration; diff --git a/ConsumerApi.Tests.Integration/ImplicitUsings.cs b/ConsumerApi.Tests.Integration/ImplicitUsings.cs index 2ce83da016..7a5742ea96 100644 --- a/ConsumerApi.Tests.Integration/ImplicitUsings.cs +++ b/ConsumerApi.Tests.Integration/ImplicitUsings.cs @@ -1,3 +1,2 @@ global using FluentAssertions; -global using NUnit; global using TechTalk.SpecFlow; diff --git a/ConsumerApi.Tests.Integration/Models/AuthenticationParameters.cs b/ConsumerApi.Tests.Integration/Models/AuthenticationParameters.cs index ae3dcb6aac..5ab3100a2e 100644 --- a/ConsumerApi.Tests.Integration/Models/AuthenticationParameters.cs +++ b/ConsumerApi.Tests.Integration/Models/AuthenticationParameters.cs @@ -2,9 +2,9 @@ public class AuthenticationParameters { - public string GrantType { get; set; } - public string ClientId { get; set; } - public string ClientSecret { get; set; } - public string Username { get; set; } - public string Password { get; set; } + public string GrantType { get; set; } = null!; + public string ClientId { get; set; } = null!; + public string ClientSecret { get; set; } = null!; + public string Username { get; set; } = null!; + public string Password { get; set; } = null!; } diff --git a/ConsumerApi.Tests.Integration/Models/Challenge.cs b/ConsumerApi.Tests.Integration/Models/Challenge.cs index 1f4d90eb1a..7df9b01047 100644 --- a/ConsumerApi.Tests.Integration/Models/Challenge.cs +++ b/ConsumerApi.Tests.Integration/Models/Challenge.cs @@ -5,9 +5,9 @@ namespace Backbone.ConsumerApi.Tests.Integration.Models; public class Challenge { [Required] - public string Id { get; set; } + public required string Id { get; set; } [Required] - public DateTime ExpiresAt { get; set; } + public required DateTime ExpiresAt { get; set; } public string? CreatedBy { get; set; } public string? CreatedByDevice { get; set; } } diff --git a/ConsumerApi.Tests.Integration/Models/CreateTokenResponse.cs b/ConsumerApi.Tests.Integration/Models/CreateTokenResponse.cs index 62d5b417ca..46c087ec8c 100644 --- a/ConsumerApi.Tests.Integration/Models/CreateTokenResponse.cs +++ b/ConsumerApi.Tests.Integration/Models/CreateTokenResponse.cs @@ -2,6 +2,6 @@ public class CreateTokenResponse { - public string Id { get; set; } - public string CreatedAt { get; set; } + public required string Id { get; set; } + public required string CreatedAt { get; set; } } diff --git a/ConsumerApi.Tests.Integration/Models/Device.cs b/ConsumerApi.Tests.Integration/Models/Device.cs index 1895c709b2..63e3bd3efb 100644 --- a/ConsumerApi.Tests.Integration/Models/Device.cs +++ b/ConsumerApi.Tests.Integration/Models/Device.cs @@ -1,6 +1,4 @@ -using Backbone.DevelopmentKit.Identity.ValueObjects; - -namespace Backbone.ConsumerApi.Tests.Integration.Models; +namespace Backbone.ConsumerApi.Tests.Integration.Models; public class Device { diff --git a/ConsumerApi.Tests.Integration/Models/Error.cs b/ConsumerApi.Tests.Integration/Models/Error.cs index 2116507662..c9a3237b60 100644 --- a/ConsumerApi.Tests.Integration/Models/Error.cs +++ b/ConsumerApi.Tests.Integration/Models/Error.cs @@ -2,9 +2,9 @@ public class Error { - public string Id { get; set; } - public string Code { get; set; } - public string Message { get; set; } - public string Docs { get; set; } - public DateTime Time { get; set; } + public required string Id { get; set; } + public required string Code { get; set; } + public required string Message { get; set; } + public required string Docs { get; set; } + public required DateTime Time { get; set; } } diff --git a/ConsumerApi.Tests.Integration/Models/HttpResponse.cs b/ConsumerApi.Tests.Integration/Models/HttpResponse.cs index 4f8b342010..fcdc9d49f3 100644 --- a/ConsumerApi.Tests.Integration/Models/HttpResponse.cs +++ b/ConsumerApi.Tests.Integration/Models/HttpResponse.cs @@ -4,20 +4,20 @@ namespace Backbone.ConsumerApi.Tests.Integration.Models; public class HttpResponse { - public ResponseContent Content { get; set; } + public required ResponseContent Content { get; set; } public string? HttpMethod { get; set; } - public HttpStatusCode StatusCode { get; set; } - public bool IsSuccessStatusCode { get; set; } + public required HttpStatusCode StatusCode { get; set; } + public required bool IsSuccessStatusCode { get; set; } public string? ContentType { get; set; } public string? RawContent { get; set; } } public class HttpResponse { - public ErrorResponseContent? Content { get; set; } + public required ErrorResponseContent? Content { get; set; } public string? HttpMethod { get; set; } - public HttpStatusCode StatusCode { get; set; } - public bool IsSuccessStatusCode { get; set; } + public required HttpStatusCode StatusCode { get; set; } + public required bool IsSuccessStatusCode { get; set; } public string? ContentType { get; set; } public string? RawContent { get; set; } } diff --git a/ConsumerApi.Tests.Integration/Models/ListDevicesResponse.cs b/ConsumerApi.Tests.Integration/Models/ListDevicesResponse.cs index 9be282cb8c..843084e8a1 100644 --- a/ConsumerApi.Tests.Integration/Models/ListDevicesResponse.cs +++ b/ConsumerApi.Tests.Integration/Models/ListDevicesResponse.cs @@ -1,3 +1,3 @@ namespace Backbone.ConsumerApi.Tests.Integration.Models; -public class ListDevicesResponse : PagedResponse { } +public class ListDevicesResponse : PagedResponse; diff --git a/ConsumerApi.Tests.Integration/Models/PnsRegistrationRequest.cs b/ConsumerApi.Tests.Integration/Models/PnsRegistrationRequest.cs index 29ef6c2b06..121e95c243 100644 --- a/ConsumerApi.Tests.Integration/Models/PnsRegistrationRequest.cs +++ b/ConsumerApi.Tests.Integration/Models/PnsRegistrationRequest.cs @@ -1,7 +1,8 @@ namespace Backbone.ConsumerApi.Tests.Integration.Models; internal class PnsRegistrationRequest { - public string Platform { get; set; } - public string Handle { get; set; } - public string AppId { get; set; } + public required string Platform { get; set; } + public required string Handle { get; set; } + public required string AppId { get; set; } + public string? Environment { get; set; } } diff --git a/ConsumerApi.Tests.Integration/Models/RequestConfiguration.cs b/ConsumerApi.Tests.Integration/Models/RequestConfiguration.cs index d9edd25a85..97d7ac6bee 100644 --- a/ConsumerApi.Tests.Integration/Models/RequestConfiguration.cs +++ b/ConsumerApi.Tests.Integration/Models/RequestConfiguration.cs @@ -5,7 +5,7 @@ namespace Backbone.ConsumerApi.Tests.Integration.Models; public class RequestConfiguration { public AuthenticationParameters AuthenticationParameters { get; set; } = new(); - public bool Authenticate { get; set; } = false; + public bool Authenticate { get; set; } public string? ContentType { get; set; } public string? AcceptHeader { get; set; } public string? Content { get; set; } diff --git a/ConsumerApi.Tests.Integration/Models/StartDeletionProcessAsSupportResponse.cs b/ConsumerApi.Tests.Integration/Models/StartDeletionProcessAsSupportResponse.cs index acb239ca1a..6dbe63abf7 100644 --- a/ConsumerApi.Tests.Integration/Models/StartDeletionProcessAsSupportResponse.cs +++ b/ConsumerApi.Tests.Integration/Models/StartDeletionProcessAsSupportResponse.cs @@ -4,7 +4,7 @@ namespace Backbone.ConsumerApi.Tests.Integration.Models; public class StartDeletionProcessAsSupportResponse { - public string Id { get; set; } - public DeletionProcessStatus Status { get; set; } - public DateTime CreatedAt { get; set; } + public required string Id { get; set; } + public required DeletionProcessStatus Status { get; set; } + public required DateTime CreatedAt { get; set; } } diff --git a/ConsumerApi.Tests.Integration/Models/StartDeletionProcessResponse.cs b/ConsumerApi.Tests.Integration/Models/StartDeletionProcessResponse.cs index 3abde3cb51..2531f5a930 100644 --- a/ConsumerApi.Tests.Integration/Models/StartDeletionProcessResponse.cs +++ b/ConsumerApi.Tests.Integration/Models/StartDeletionProcessResponse.cs @@ -2,12 +2,12 @@ public class StartDeletionProcessResponse { - public string Id { get; set; } - public string Status { get; set; } - public DateTime CreatedAt { get; set; } + public required string Id { get; set; } + public required string Status { get; set; } + public required DateTime CreatedAt { get; set; } - public DateTime ApprovedAt { get; set; } - public string ApprovedByDevice { get; set; } + public required DateTime ApprovedAt { get; set; } + public required string ApprovedByDevice { get; set; } - public DateTime GracePeriodEndsAt { get; set; } + public required DateTime GracePeriodEndsAt { get; set; } } diff --git a/ConsumerApi.Tests.Integration/Models/Token.cs b/ConsumerApi.Tests.Integration/Models/Token.cs index c0b5a4f0e3..92d91b8458 100644 --- a/ConsumerApi.Tests.Integration/Models/Token.cs +++ b/ConsumerApi.Tests.Integration/Models/Token.cs @@ -5,10 +5,10 @@ namespace Backbone.ConsumerApi.Tests.Integration.Models; public class Token { [Required] - public string Id { get; set; } + public required string Id { get; set; } public DateTime? ExpiresAt { get; set; } [Required] - public DateTime CreatedAt { get; set; } + public required DateTime CreatedAt { get; set; } public string? CreatedBy { get; set; } public string? CreatedByDevice { get; set; } public string? Content { get; set; } diff --git a/ConsumerApi.Tests.Integration/StepDefinitions/BaseStepDefinitions.cs b/ConsumerApi.Tests.Integration/StepDefinitions/BaseStepDefinitions.cs index d3075a834e..b643912995 100644 --- a/ConsumerApi.Tests.Integration/StepDefinitions/BaseStepDefinitions.cs +++ b/ConsumerApi.Tests.Integration/StepDefinitions/BaseStepDefinitions.cs @@ -28,7 +28,8 @@ public BaseStepDefinitions(IOptions httpConfiguration, ISigna ClientSecret = httpConfiguration.Value.ClientCredentials.ClientSecret, Username = "USRa", Password = "a" - } + }, + ContentType = "application/json" }; _signatureHelper = signatureHelper; @@ -39,19 +40,19 @@ public BaseStepDefinitions(IOptions httpConfiguration, ISigna #region StepDefinitions - [Given(@"the user is authenticated")] + [Given("the user is authenticated")] public void GivenTheUserIsAuthenticated() { _requestConfiguration.Authenticate = true; } - [Given(@"the user is unauthenticated")] + [Given("the user is unauthenticated")] public void GivenTheUserIsUnauthenticated() { _requestConfiguration.Authenticate = false; } - [Given(@"the Accept header is '([^']*)'")] + [Given("the Accept header is '([^']*)'")] public void GivenTheAcceptHeaderIs(string acceptHeader) { _requestConfiguration.AcceptHeader = acceptHeader; diff --git a/ConsumerApi.Tests.Integration/StepDefinitions/ChallengesApiStepDefinitions.cs b/ConsumerApi.Tests.Integration/StepDefinitions/ChallengesApiStepDefinitions.cs index 9608b6bfb5..0a0fa76ed5 100644 --- a/ConsumerApi.Tests.Integration/StepDefinitions/ChallengesApiStepDefinitions.cs +++ b/ConsumerApi.Tests.Integration/StepDefinitions/ChallengesApiStepDefinitions.cs @@ -12,18 +12,16 @@ namespace Backbone.ConsumerApi.Tests.Integration.StepDefinitions; [Scope(Feature = "GET Challenge")] internal class ChallengesApiStepDefinitions : BaseStepDefinitions { - private readonly ChallengesApi _challengesApi; private string _challengeId; private HttpResponse? _response; public ChallengesApiStepDefinitions(IOptions httpConfiguration, ISignatureHelper signatureHelper, ChallengesApi challengesApi, IdentitiesApi identitiesApi, DevicesApi devicesApi) : base(httpConfiguration, signatureHelper, challengesApi, identitiesApi, devicesApi) { - _challengesApi = challengesApi; _challengeId = string.Empty; } - [Given(@"a Challenge c")] + [Given("a Challenge c")] public async Task GivenAChallengeC() { var challengeResponse = await _challengesApi.CreateChallenge(_requestConfiguration); @@ -33,7 +31,7 @@ public async Task GivenAChallengeC() _challengeId.Should().NotBeNullOrEmpty(); } - [When(@"a POST request is sent to the Challenges endpoint with")] + [When("a POST request is sent to the Challenges endpoint with")] public async Task WhenAPOSTRequestIsSentToTheChallengesEndpointWith(Table table) { var requestConfiguration = table.CreateInstance(); @@ -42,7 +40,7 @@ public async Task WhenAPOSTRequestIsSentToTheChallengesEndpointWith(Table table) _response = await _challengesApi.CreateChallenge(requestConfiguration); } - [When(@"a POST request is sent to the Challenges endpoint")] + [When("a POST request is sent to the Challenges endpoint")] public async Task WhenAPOSTRequestIsSentToTheChallengesEndpoint() { _response = await _challengesApi.CreateChallenge(_requestConfiguration); @@ -63,7 +61,7 @@ public async Task WhenAGETRequestIsSentToTheChallengesIdEndpointWith(string id) _response = await _challengesApi.GetChallengeById(_requestConfiguration, id); } - [Then(@"the response contains a Challenge")] + [Then("the response contains a Challenge")] public void ThenTheResponseContainsAChallenge() { _response!.Should().NotBeNull(); @@ -72,14 +70,14 @@ public void ThenTheResponseContainsAChallenge() AssertExpirationDateIsInFuture(); } - [Then(@"the Challenge does not contain information about the creator")] + [Then("the Challenge does not contain information about the creator")] public void ThenTheChallengeDoesNotContainInformationAboutTheCreator() { _response!.Content.Result!.CreatedBy.Should().BeNull(); _response.Content.Result!.CreatedByDevice.Should().BeNull(); } - [Then(@"the Challenge contains information about the creator")] + [Then("the Challenge contains information about the creator")] public void ThenTheChallengeContainsInformationAboutTheCreator() { _response!.Content.Result!.CreatedBy.Should().NotBeNull(); diff --git a/ConsumerApi.Tests.Integration/StepDefinitions/IdentitiesApiStepDefinitions.cs b/ConsumerApi.Tests.Integration/StepDefinitions/IdentitiesApiStepDefinitions.cs index 705cb5152b..dfd9a56d00 100644 --- a/ConsumerApi.Tests.Integration/StepDefinitions/IdentitiesApiStepDefinitions.cs +++ b/ConsumerApi.Tests.Integration/StepDefinitions/IdentitiesApiStepDefinitions.cs @@ -4,6 +4,7 @@ using Backbone.ConsumerApi.Tests.Integration.Models; using Backbone.Crypto.Abstractions; using Microsoft.Extensions.Options; +using static Backbone.ConsumerApi.Tests.Integration.Helpers.ThrowHelpers; namespace Backbone.ConsumerApi.Tests.Integration.StepDefinitions; @@ -52,8 +53,8 @@ public async Task WhenAPOSTRequestIsSentToTheIdentitiesSelfDeletionProcessEndpoi [Then(@"the response content includes an error with the error code ""([^""]*)""")] public void ThenTheResponseContentIncludesAnErrorWithTheErrorCode(string errorCode) { - _response!.Content.Should().NotBeNull(); - _response.Content!.Error.Should().NotBeNull(); + ThrowIfNull(_response); + _response.Content.Error.Should().NotBeNull(); _response.Content.Error!.Code.Should().Be(errorCode); } @@ -65,26 +66,26 @@ public void ThenTheResponseContainsADeletionProcess() _response!.AssertContentCompliesWithSchema(); } - [Given(@"a Challenge c")] + [Given("a Challenge c")] public async Task GivenAChallengeC() { _challengeResponse = await CreateChallenge(); } - [When(@"a POST request is sent to the /Identities endpoint with a valid signature on c")] + [When("a POST request is sent to the /Identities endpoint with a valid signature on c")] public async Task WhenAPOSTRequestIsSentToTheIdentitiesEndpoint() { _identityResponse = await CreateIdentity(_challengeResponse!.Content.Result); } - [Given(@"an Identity i")] + [Given("an Identity i")] public async Task GivenAnIdentityI() { _challengeResponse = await CreateChallenge(); _identityResponse = await CreateIdentity(_challengeResponse.Content.Result); } - [Then(@"the response contains a CreateIdentityResponse")] + [Then("the response contains a CreateIdentityResponse")] public void ThenTheResponseContainsACreateIdentityResponse() { _identityResponse!.Should().NotBeNull(); diff --git a/ConsumerApi.Tests.Integration/StepDefinitions/PnsRegistrationStepDefinitions.cs b/ConsumerApi.Tests.Integration/StepDefinitions/PnsRegistrationStepDefinitions.cs index 52b770af02..932781746b 100644 --- a/ConsumerApi.Tests.Integration/StepDefinitions/PnsRegistrationStepDefinitions.cs +++ b/ConsumerApi.Tests.Integration/StepDefinitions/PnsRegistrationStepDefinitions.cs @@ -27,7 +27,7 @@ public PnsRegistrationStepDefinitions( _pnsRegistrationsApi = pnsRegistrationsApi; } - [When(@"a PUT request is sent to the /Devices/Self/PushNotifications endpoint")] + [When("a PUT request is sent to the /Devices/Self/PushNotifications endpoint")] public async Task WhenAPUTRequestIsSentToTheDevicesSelfPushNotificationsEndpoint() { var requestConfiguration = new RequestConfiguration(); @@ -54,7 +54,7 @@ public void ThenTheResponseStatusCodeIs(int statusCode) _response.StatusCode.Should().Be((HttpStatusCode)statusCode); } - [Then(@"the response contains the push identifier for the device")] + [Then("the response contains the push identifier for the device")] public void ThenTheResponseContainsThePushIdentifierForTheDevice() { _response!.Content.Result!.DevicePushIdentifier.Should().NotBeNullOrEmpty(); diff --git a/ConsumerApi.Tests.Integration/StepDefinitions/TokensApiStepDefinitions.cs b/ConsumerApi.Tests.Integration/StepDefinitions/TokensApiStepDefinitions.cs index b8a6ae0aa9..c328d44922 100644 --- a/ConsumerApi.Tests.Integration/StepDefinitions/TokensApiStepDefinitions.cs +++ b/ConsumerApi.Tests.Integration/StepDefinitions/TokensApiStepDefinitions.cs @@ -33,11 +33,11 @@ public TokensApiStepDefinitions(IOptions httpConfiguration, T _tokensApi = tokensApi; _tokenId = string.Empty; _peerTokenId = string.Empty; - _givenOwnTokens = new List(); - _responseTokens = new List(); + _givenOwnTokens = []; + _responseTokens = []; } - [Given(@"an own Token t")] + [Given("an own Token t")] public async Task GivenAnOwnTokenT() { var createTokenRequest = new CreateTokenRequest @@ -60,7 +60,7 @@ public async Task GivenAnOwnTokenT() _tokenId.Should().NotBeNullOrEmpty(); } - [Given(@"a peer Token p")] + [Given("a peer Token p")] public async Task GivenAPeerTokenP() { var createTokenRequest = new CreateTokenRequest @@ -85,7 +85,7 @@ public async Task GivenAPeerTokenP() _peerTokenId.Should().NotBeNullOrEmpty(); } - [Given(@"the user created multiple Tokens")] + [Given("the user created multiple Tokens")] public async Task GivenTheUserCreatedMultipleTokens() { for (var i = 0; i < 2; i++) @@ -111,7 +111,7 @@ public async Task GivenTheUserCreatedMultipleTokens() } } - [When(@"a GET request is sent to the Tokens endpoint with a list of ids of own Tokens")] + [When("a GET request is sent to the Tokens endpoint with a list of ids of own Tokens")] public async Task WhenAGETRequestIsSentToTheTokensEndpointWithAListOfIdsOfOwnTokens() { var tokenIds = _givenOwnTokens.Select(t => t.Id); @@ -125,7 +125,7 @@ public async Task WhenAGETRequestIsSentToTheTokensEndpointWithAListOfIdsOfOwnTok _responseTokens.AddRange(tokens); } - [When(@"a POST request is sent to the Tokens endpoint with")] + [When("a POST request is sent to the Tokens endpoint with")] public async Task WhenAPOSTRequestIsSentToTheTokensEndpointWith(Table table) { var requestConfiguration = table.CreateInstance(); @@ -147,7 +147,7 @@ public async Task WhenAPOSTRequestIsSentToTheTokensEndpointWith(Table table) _createTokenResponse = await _tokensApi.CreateToken(requestConfiguration); } - [When(@"a POST request is sent to the Tokens endpoint with no request content")] + [When("a POST request is sent to the Tokens endpoint with no request content")] public async Task WhenAPOSTRequestIsSentToTheTokensEndpointWithNoRequestContent() { _requestConfiguration.Content = null; @@ -173,7 +173,7 @@ public async Task WhenAGETRequestIsSentToTheTokensIdEndpointWith(string id) _tokenResponse = await _tokensApi.GetTokenById(_requestConfiguration, id); } - [When(@"a POST request is sent to the Tokens endpoint with '([^']*)', '([^']*)'")] + [When("a POST request is sent to the Tokens endpoint with '([^']*)', '([^']*)'")] public async Task WhenAPOSTRequestIsSentToTheTokensEndpointWith(string content, string expiresAt) { var createTokenRequest = new CreateTokenRequest @@ -203,7 +203,7 @@ public async Task WhenAGETRequestIsSentToTheTokensEndpointWithAListContainingT_I _responseTokens.AddRange(tokens); } - [Then(@"the response contains both Tokens")] + [Then("the response contains both Tokens")] public void ThenTheResponseOnlyContainsTheOwnToken() { _responseTokens.Should().HaveCount(2) @@ -212,7 +212,7 @@ public void ThenTheResponseOnlyContainsTheOwnToken() } - [Then(@"the response contains all Tokens with the given ids")] + [Then("the response contains all Tokens with the given ids")] public void ThenTheResponseContainsAllTokensWithTheGivenIds() { _responseTokens.Select(t => t.Id) @@ -221,7 +221,7 @@ public void ThenTheResponseContainsAllTokensWithTheGivenIds() .And.BeEquivalentTo(_givenOwnTokens.Select(t => t.Id), options => options.WithoutStrictOrdering()); } - [Then(@"the response contains a CreateTokenResponse")] + [Then("the response contains a CreateTokenResponse")] public void ThenTheResponseContainsACreateTokenResponse() { _createTokenResponse!.Should().NotBeNull(); @@ -230,7 +230,7 @@ public void ThenTheResponseContainsACreateTokenResponse() _createTokenResponse!.AssertContentCompliesWithSchema(); } - [Then(@"the response contains a Token")] + [Then("the response contains a Token")] public void ThenTheResponseContainsAToken() { _tokenResponse!.Should().NotBeNull(); diff --git a/ConsumerApi/ConsumerApi.csproj b/ConsumerApi/ConsumerApi.csproj index 9c913fcb08..992c698cd3 100644 --- a/ConsumerApi/ConsumerApi.csproj +++ b/ConsumerApi/ConsumerApi.csproj @@ -1,7 +1,6 @@ - enable f114fba8-95dd-4fee-8385-af8e8a343c68 Linux ..\docker-compose.dcproj @@ -10,15 +9,15 @@ - + - + - + - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive true diff --git a/ConsumerApi/Controllers/AuthorizationController.cs b/ConsumerApi/Controllers/AuthorizationController.cs index fdec765ee9..e6373a8f52 100644 --- a/ConsumerApi/Controllers/AuthorizationController.cs +++ b/ConsumerApi/Controllers/AuthorizationController.cs @@ -22,17 +22,15 @@ namespace Backbone.ConsumerApi.Controllers; public class AuthorizationController : ApiControllerBase { private readonly UserManager _userManager; - private readonly ILogger _logger; private readonly SignInManager _signInManager; public AuthorizationController( IMediator mediator, SignInManager signInManager, - UserManager userManager, ILogger logger) : base(mediator) + UserManager userManager) : base(mediator) { _signInManager = signInManager; _userManager = userManager; - _logger = logger; } [HttpPost("~/connect/token"), IgnoreAntiforgeryToken, Produces("application/json"), diff --git a/ConsumerApi/Extensions/IServiceCollectionExtensions.cs b/ConsumerApi/Extensions/IServiceCollectionExtensions.cs index 8b1acea3ba..fe4a1b592e 100644 --- a/ConsumerApi/Extensions/IServiceCollectionExtensions.cs +++ b/ConsumerApi/Extensions/IServiceCollectionExtensions.cs @@ -34,7 +34,7 @@ public static IServiceCollection AddCustomAspNetCore(this IServiceCollection ser options.InvalidModelStateResponseFactory = context => { var firstPropertyWithError = - context.ModelState.First(p => p.Value != null && p.Value.Errors.Count > 0); + context.ModelState.First(p => p.Value is { Errors.Count: > 0 }); var nameOfPropertyWithError = firstPropertyWithError.Key; var firstError = firstPropertyWithError.Value!.Errors.First(); var firstErrorMessage = !string.IsNullOrWhiteSpace(firstError.ErrorMessage) diff --git a/ConsumerApi/MessagesDbContextSeeder.cs b/ConsumerApi/MessagesDbContextSeeder.cs index 963f3f89f9..571f1617c7 100644 --- a/ConsumerApi/MessagesDbContextSeeder.cs +++ b/ConsumerApi/MessagesDbContextSeeder.cs @@ -37,7 +37,7 @@ private async Task FillBodyColumnsFromBlobStorage(MessagesDbContext context) { try { - var blobMessageBody = await _blobStorage.FindAsync(_blobRootFolder, message.Id); + var blobMessageBody = await _blobStorage!.FindAsync(_blobRootFolder, message.Id); message.LoadBody(blobMessageBody); context.Messages.Update(message); } diff --git a/ConsumerApi/Mvc/ApiControllerBase.cs b/ConsumerApi/Mvc/ApiControllerBase.cs index 4119c269c0..3bdde2c858 100644 --- a/ConsumerApi/Mvc/ApiControllerBase.cs +++ b/ConsumerApi/Mvc/ApiControllerBase.cs @@ -25,13 +25,13 @@ protected ApiControllerBase(IMediator mediator) } [NonAction] - public override OkObjectResult Ok(object result) + public override OkObjectResult Ok(object? result) { return base.Ok(HttpResponseEnvelope.CreateSuccess(result)); } [NonAction] - public override CreatedResult Created(string uri, object result) + public override CreatedResult Created(string? uri, object? result) { return base.Created(uri, HttpResponseEnvelope.CreateSuccess(result)); } @@ -43,13 +43,13 @@ public CreatedResult Created(object result) } [NonAction] - public override CreatedAtActionResult CreatedAtAction(string actionName, object result) + public override CreatedAtActionResult CreatedAtAction(string? actionName, object? result) { return base.CreatedAtAction(actionName, HttpResponseEnvelope.CreateSuccess(result)); } [NonAction] - public override CreatedAtActionResult CreatedAtAction(string actionName, object routeValues, object result) + public override CreatedAtActionResult CreatedAtAction(string? actionName, object? routeValues, object? result) { return base.CreatedAtAction(actionName, routeValues, HttpResponseEnvelope.CreateSuccess(result)); } diff --git a/ConsumerApi/Mvc/JsonConverters/Challenges/ChallengeIdJsonConverter.cs b/ConsumerApi/Mvc/JsonConverters/Challenges/ChallengeIdJsonConverter.cs index 3ffc6e6ed5..fd06771935 100644 --- a/ConsumerApi/Mvc/JsonConverters/Challenges/ChallengeIdJsonConverter.cs +++ b/ConsumerApi/Mvc/JsonConverters/Challenges/ChallengeIdJsonConverter.cs @@ -14,8 +14,7 @@ public override bool CanConvert(Type objectType) public override ChallengeId Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { - var id = reader.GetString(); - + var id = reader.GetString() ?? throw new JsonException("The id cannot be null."); try { return ChallengeId.Parse(id); diff --git a/ConsumerApi/Mvc/JsonConverters/Files/FileIdJsonConverter.cs b/ConsumerApi/Mvc/JsonConverters/Files/FileIdJsonConverter.cs index 3cf5fb3358..c54f065b3c 100644 --- a/ConsumerApi/Mvc/JsonConverters/Files/FileIdJsonConverter.cs +++ b/ConsumerApi/Mvc/JsonConverters/Files/FileIdJsonConverter.cs @@ -14,8 +14,7 @@ public override bool CanConvert(Type objectType) public override FileId Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { - var id = reader.GetString(); - + var id = reader.GetString() ?? throw new JsonException("The id cannot be null."); try { return FileId.Parse(id); diff --git a/ConsumerApi/Mvc/JsonConverters/Messages/FileIdJsonConverter.cs b/ConsumerApi/Mvc/JsonConverters/Messages/FileIdJsonConverter.cs index 85e4441961..07eef25016 100644 --- a/ConsumerApi/Mvc/JsonConverters/Messages/FileIdJsonConverter.cs +++ b/ConsumerApi/Mvc/JsonConverters/Messages/FileIdJsonConverter.cs @@ -14,8 +14,7 @@ public override bool CanConvert(Type objectType) public override FileId Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { - var id = reader.GetString(); - + var id = reader.GetString() ?? throw new JsonException("The id cannot be null."); try { return FileId.Parse(id); diff --git a/ConsumerApi/Mvc/JsonConverters/Messages/MessageIdJsonConverter.cs b/ConsumerApi/Mvc/JsonConverters/Messages/MessageIdJsonConverter.cs index 6539855f5f..1f4bb6ed87 100644 --- a/ConsumerApi/Mvc/JsonConverters/Messages/MessageIdJsonConverter.cs +++ b/ConsumerApi/Mvc/JsonConverters/Messages/MessageIdJsonConverter.cs @@ -14,8 +14,7 @@ public override bool CanConvert(Type objectType) public override MessageId Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { - var id = reader.GetString(); - + var id = reader.GetString() ?? throw new JsonException("The id cannot be null."); try { return MessageId.Parse(id); diff --git a/ConsumerApi/Mvc/JsonConverters/Messages/RelationshipIdJsonConverter.cs b/ConsumerApi/Mvc/JsonConverters/Messages/RelationshipIdJsonConverter.cs index 34429f5426..38381af6c7 100644 --- a/ConsumerApi/Mvc/JsonConverters/Messages/RelationshipIdJsonConverter.cs +++ b/ConsumerApi/Mvc/JsonConverters/Messages/RelationshipIdJsonConverter.cs @@ -14,8 +14,7 @@ public override bool CanConvert(Type objectType) public override RelationshipId Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { - var id = reader.GetString(); - + var id = reader.GetString() ?? throw new JsonException("The id cannot be null."); try { return RelationshipId.Parse(id); diff --git a/ConsumerApi/Mvc/JsonConverters/Relationships/RelationshipChangeIdJsonConverter.cs b/ConsumerApi/Mvc/JsonConverters/Relationships/RelationshipChangeIdJsonConverter.cs index 6946d43881..5aea0e5000 100644 --- a/ConsumerApi/Mvc/JsonConverters/Relationships/RelationshipChangeIdJsonConverter.cs +++ b/ConsumerApi/Mvc/JsonConverters/Relationships/RelationshipChangeIdJsonConverter.cs @@ -15,8 +15,7 @@ public override bool CanConvert(Type objectType) public override RelationshipChangeId Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { - var id = reader.GetString(); - + var id = reader.GetString() ?? throw new JsonException("The id cannot be null."); try { return RelationshipChangeId.Parse(id); diff --git a/ConsumerApi/Mvc/JsonConverters/Relationships/RelationshipIdJsonConverter.cs b/ConsumerApi/Mvc/JsonConverters/Relationships/RelationshipIdJsonConverter.cs index 9006a6553d..d37a40be7f 100644 --- a/ConsumerApi/Mvc/JsonConverters/Relationships/RelationshipIdJsonConverter.cs +++ b/ConsumerApi/Mvc/JsonConverters/Relationships/RelationshipIdJsonConverter.cs @@ -14,8 +14,7 @@ public override bool CanConvert(Type objectType) public override RelationshipId Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { - var id = reader.GetString(); - + var id = reader.GetString() ?? throw new JsonException("The id cannot be null."); try { return RelationshipId.Parse(id); diff --git a/ConsumerApi/Mvc/JsonConverters/Relationships/RelationshipTemplateIdJsonConverter.cs b/ConsumerApi/Mvc/JsonConverters/Relationships/RelationshipTemplateIdJsonConverter.cs index 8c27d484f1..d0f847863d 100644 --- a/ConsumerApi/Mvc/JsonConverters/Relationships/RelationshipTemplateIdJsonConverter.cs +++ b/ConsumerApi/Mvc/JsonConverters/Relationships/RelationshipTemplateIdJsonConverter.cs @@ -15,8 +15,7 @@ public override bool CanConvert(Type objectType) public override RelationshipTemplateId Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { - var id = reader.GetString(); - + var id = reader.GetString() ?? throw new JsonException("The id cannot be null."); try { return RelationshipTemplateId.Parse(id); diff --git a/ConsumerApi/Mvc/JsonConverters/Synchronization/DatawalletIdJsonConverter.cs b/ConsumerApi/Mvc/JsonConverters/Synchronization/DatawalletIdJsonConverter.cs index 28a01f936b..47dfd2d2fe 100644 --- a/ConsumerApi/Mvc/JsonConverters/Synchronization/DatawalletIdJsonConverter.cs +++ b/ConsumerApi/Mvc/JsonConverters/Synchronization/DatawalletIdJsonConverter.cs @@ -14,8 +14,7 @@ public override bool CanConvert(Type objectType) public override DatawalletId Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { - var id = reader.GetString(); - + var id = reader.GetString() ?? throw new JsonException("The id cannot be null."); try { return DatawalletId.Parse(id); diff --git a/ConsumerApi/Mvc/JsonConverters/Synchronization/DatawalletModificationIdJsonConverter.cs b/ConsumerApi/Mvc/JsonConverters/Synchronization/DatawalletModificationIdJsonConverter.cs index f46c74a08a..4270c36d3a 100644 --- a/ConsumerApi/Mvc/JsonConverters/Synchronization/DatawalletModificationIdJsonConverter.cs +++ b/ConsumerApi/Mvc/JsonConverters/Synchronization/DatawalletModificationIdJsonConverter.cs @@ -14,8 +14,7 @@ public override bool CanConvert(Type objectType) public override DatawalletModificationId Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { - var id = reader.GetString(); - + var id = reader.GetString() ?? throw new JsonException("The id cannot be null."); try { return DatawalletModificationId.Parse(id); diff --git a/ConsumerApi/Mvc/JsonConverters/Synchronization/ExternalEventIdJsonConverter.cs b/ConsumerApi/Mvc/JsonConverters/Synchronization/ExternalEventIdJsonConverter.cs index eddb27d86f..7049f82d60 100644 --- a/ConsumerApi/Mvc/JsonConverters/Synchronization/ExternalEventIdJsonConverter.cs +++ b/ConsumerApi/Mvc/JsonConverters/Synchronization/ExternalEventIdJsonConverter.cs @@ -14,8 +14,7 @@ public override bool CanConvert(Type objectType) public override ExternalEventId Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { - var id = reader.GetString(); - + var id = reader.GetString() ?? throw new JsonException("The id cannot be null."); try { return ExternalEventId.Parse(id); diff --git a/ConsumerApi/Mvc/JsonConverters/Synchronization/SyncErrorIdJsonConverter.cs b/ConsumerApi/Mvc/JsonConverters/Synchronization/SyncErrorIdJsonConverter.cs index e6963bdb70..a7438d6f6f 100644 --- a/ConsumerApi/Mvc/JsonConverters/Synchronization/SyncErrorIdJsonConverter.cs +++ b/ConsumerApi/Mvc/JsonConverters/Synchronization/SyncErrorIdJsonConverter.cs @@ -14,8 +14,7 @@ public override bool CanConvert(Type objectType) public override SyncErrorId Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { - var id = reader.GetString(); - + var id = reader.GetString() ?? throw new JsonException("The id cannot be null."); try { return SyncErrorId.Parse(id); diff --git a/ConsumerApi/Mvc/JsonConverters/Synchronization/SyncRunIdJsonConverter.cs b/ConsumerApi/Mvc/JsonConverters/Synchronization/SyncRunIdJsonConverter.cs index f92a906d50..ec72d66adf 100644 --- a/ConsumerApi/Mvc/JsonConverters/Synchronization/SyncRunIdJsonConverter.cs +++ b/ConsumerApi/Mvc/JsonConverters/Synchronization/SyncRunIdJsonConverter.cs @@ -14,8 +14,7 @@ public override bool CanConvert(Type objectType) public override SyncRunId Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { - var id = reader.GetString(); - + var id = reader.GetString() ?? throw new JsonException("The id cannot be null."); try { return SyncRunId.Parse(id); diff --git a/ConsumerApi/Mvc/JsonConverters/Tokens/TokenIdJsonConverter.cs b/ConsumerApi/Mvc/JsonConverters/Tokens/TokenIdJsonConverter.cs index 7a6c4169e4..060397b310 100644 --- a/ConsumerApi/Mvc/JsonConverters/Tokens/TokenIdJsonConverter.cs +++ b/ConsumerApi/Mvc/JsonConverters/Tokens/TokenIdJsonConverter.cs @@ -14,8 +14,7 @@ public override bool CanConvert(Type objectType) public override TokenId Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { - var id = reader.GetString(); - + var id = reader.GetString() ?? throw new JsonException("The id cannot be null."); try { return TokenId.Parse(id); diff --git a/ConsumerApi/Mvc/Middleware/UserDataLoggingMiddleware.cs b/ConsumerApi/Mvc/Middleware/UserDataLoggingMiddleware.cs index 31fbd2b750..ef834baa43 100644 --- a/ConsumerApi/Mvc/Middleware/UserDataLoggingMiddleware.cs +++ b/ConsumerApi/Mvc/Middleware/UserDataLoggingMiddleware.cs @@ -24,11 +24,11 @@ public async Task Invoke(HttpContext context) var username = _userContext.GetUsernameOrNull() ?? context.GetOpenIddictServerRequest()?.Username; ILogEventEnricher[] enrichers = - { + [ new PropertyEnricher("deviceId", deviceId ?? ""), new PropertyEnricher("identityAddress", identityAddress ?? ""), new PropertyEnricher("username", username ?? "") - }; + ]; using (LogContext.Push(enrichers)) { diff --git a/ConsumerApi/RelationshipsDbContextSeeder.cs b/ConsumerApi/RelationshipsDbContextSeeder.cs index edcd2f6094..9fd7e4de81 100644 --- a/ConsumerApi/RelationshipsDbContextSeeder.cs +++ b/ConsumerApi/RelationshipsDbContextSeeder.cs @@ -2,7 +2,6 @@ using Backbone.BuildingBlocks.Application.Abstractions.Exceptions; using Backbone.BuildingBlocks.Application.Abstractions.Infrastructure.Persistence.BlobStorage; using Backbone.Modules.Relationships.Application.Infrastructure; -using Backbone.Modules.Relationships.Domain.Entities; using Backbone.Modules.Relationships.Infrastructure.Persistence.Database; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Options; diff --git a/ConsumerApi/SynchronizationDbContextSeeder.cs b/ConsumerApi/SynchronizationDbContextSeeder.cs index ab299c4ed1..d1159cf9c7 100644 --- a/ConsumerApi/SynchronizationDbContextSeeder.cs +++ b/ConsumerApi/SynchronizationDbContextSeeder.cs @@ -5,7 +5,6 @@ using Backbone.Modules.Synchronization.Application.Infrastructure; using Backbone.Modules.Synchronization.Domain.Entities; using Backbone.Modules.Synchronization.Infrastructure.Persistence.Database; -using Backbone.Tooling.Extensions; using Microsoft.Extensions.Options; namespace Backbone.ConsumerApi; diff --git a/Directory.Build.props b/Directory.Build.props index ade022dd10..80298b7fee 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -4,5 +4,6 @@ enable Backbone.$(MSBuildProjectName) $(AssemblyName.Replace(" ", "_")) + enable diff --git a/HealthCheck/HealthCheck.csproj b/HealthCheck/HealthCheck.csproj index 206b89a9a8..892b88e841 100644 --- a/HealthCheck/HealthCheck.csproj +++ b/HealthCheck/HealthCheck.csproj @@ -4,7 +4,6 @@ Exe net8.0 enable - enable diff --git a/Infrastructure/EventBus/EventBusConfiguration.cs b/Infrastructure/EventBus/EventBusConfiguration.cs index 05d8ea0e26..961e3a6b02 100644 --- a/Infrastructure/EventBus/EventBusConfiguration.cs +++ b/Infrastructure/EventBus/EventBusConfiguration.cs @@ -7,19 +7,19 @@ public class EventBusConfiguration { [Required] [RegularExpression("Azure|GoogleCloud|RabbitMQ")] - public string Vendor { get; set; } + public string Vendor { get; set; } = null!; - public string ConnectionInfo { get; set; } + public string ConnectionInfo { get; set; } = null!; [Required] - public string SubscriptionClientName { get; set; } + public string SubscriptionClientName { get; set; } = null!; - public string RabbitMqUsername { get; set; } - public string RabbitMqPassword { get; set; } + public string RabbitMqUsername { get; set; } = null!; + public string RabbitMqPassword { get; set; } = null!; public int ConnectionRetryCount { get; set; } - public string GcpPubSubProjectId { get; set; } - public string GcpPubSubTopicName { get; set; } + public string GcpPubSubProjectId { get; set; } = null!; + public string GcpPubSubTopicName { get; set; } = null!; - public HandlerRetryBehavior HandlerRetryBehavior { get; set; } + public HandlerRetryBehavior HandlerRetryBehavior { get; set; } = null!; } diff --git a/Infrastructure/EventBus/EventBusInMemory.cs b/Infrastructure/EventBus/EventBusInMemory.cs deleted file mode 100644 index 6d516b30e4..0000000000 --- a/Infrastructure/EventBus/EventBusInMemory.cs +++ /dev/null @@ -1,87 +0,0 @@ -using System.Reflection; -using Autofac; -using Backbone.BuildingBlocks.Application.Abstractions.Infrastructure.EventBus; -using Backbone.BuildingBlocks.Application.Abstractions.Infrastructure.EventBus.Events; -using Newtonsoft.Json; -using Newtonsoft.Json.Serialization; - -namespace Backbone.Infrastructure.EventBus; - -public class EventBusInMemory : IEventBus -{ - private const string AUTOFAC_SCOPE_NAME = "event_bus"; - - private record Subscription(Type Event, Type EventHandler); - - private readonly List _subscriptions = new(); - private readonly ILifetimeScope _autofac; - - public EventBusInMemory(ILifetimeScope autofac) - { - _autofac = autofac; - } - - public void Publish(IntegrationEvent @event) - { - // var subscriptions = _subscriptions.Where(h => h.Event == @event.GetType()); - // - // using var scope = _autofac.BeginLifetimeScope(AUTOFAC_SCOPE_NAME); - // - // foreach (var subscription in subscriptions) - // { - // var handler = scope.ResolveOptional(subscription.EventHandler); - // - // - // if (handler == null) - // throw new Exception( - // $"The handler type {subscription.HandlerType.FullName} is not registered in the dependency container."); - // - // var concreteType = typeof(IIntegrationEventHandler<>).MakeGenericType(@event.GetType()); - // (Task)concreteType.GetMethod("Handle")!.Invoke(handler, new[] { @event })!; - // - // try - // { - // await handler.Handle(@event); - // } - // catch (Exception ex) - // { - // _logger.LogError(ex, - // "An error occurred while processing the integration event with id '{eventId}'.", - // @event.IntegrationEventId); - // return false; - // } - // } - } - - public void Subscribe() where T : IntegrationEvent where TH : IIntegrationEventHandler - { - _subscriptions.Add(new Subscription(typeof(T), typeof(TH))); - } - - public void StartConsuming() - { - // publish pending - } -} - -public class ContractResolverWithPrivates : CamelCasePropertyNamesContractResolver -{ - protected override JsonProperty CreateProperty(MemberInfo member, - MemberSerialization memberSerialization) - { - var prop = base.CreateProperty(member, memberSerialization); - - prop.Writable = true; - - if (prop.Writable) return prop; - - var property = member as PropertyInfo; - if (property != null) - { - var hasPrivateSetter = property.GetSetMethod(true) != null; - prop.Writable = hasPrivateSetter; - } - - return prop; - } -} diff --git a/Infrastructure/Infrastructure.csproj b/Infrastructure/Infrastructure.csproj index f3c17fc045..34fe9140cb 100644 --- a/Infrastructure/Infrastructure.csproj +++ b/Infrastructure/Infrastructure.csproj @@ -1,9 +1,5 @@ - - enable - - diff --git a/Infrastructure/UserContext/AspNetCoreUserContext.cs b/Infrastructure/UserContext/AspNetCoreUserContext.cs index 4f8ad69824..e91e73424a 100644 --- a/Infrastructure/UserContext/AspNetCoreUserContext.cs +++ b/Infrastructure/UserContext/AspNetCoreUserContext.cs @@ -22,39 +22,39 @@ public AspNetCoreUserContext(IHttpContextAccessor context) public IdentityAddress GetAddress() { - var address = _context.HttpContext.User.FindFirstValue(ADDRESS_CLAIM) ?? throw new NotFoundException(); + var address = GetHttpContext().User.FindFirstValue(ADDRESS_CLAIM) ?? throw new NotFoundException(); return IdentityAddress.Parse(address); } public IdentityAddress? GetAddressOrNull() { - var address = _context.HttpContext.User.FindFirstValue(ADDRESS_CLAIM); + var address = GetHttpContext().User.FindFirstValue(ADDRESS_CLAIM); return address == null ? null : IdentityAddress.Parse(address); } public DeviceId GetDeviceId() { - var deviceId = _context.HttpContext.User.FindFirstValue(DEVICE_ID_CLAIM) ?? throw new NotFoundException(); + var deviceId = GetHttpContext().User.FindFirstValue(DEVICE_ID_CLAIM) ?? throw new NotFoundException(); return DeviceId.Parse(deviceId); } public DeviceId? GetDeviceIdOrNull() { - var deviceId = _context.HttpContext.User.FindFirstValue(DEVICE_ID_CLAIM); + var deviceId = GetHttpContext().User.FindFirstValue(DEVICE_ID_CLAIM); return deviceId == null ? null : DeviceId.Parse(deviceId); } public string GetUserId() { - var userId = _context.HttpContext.User.FindFirstValue(USER_ID_CLAIM) ?? throw new NotFoundException(); + var userId = GetHttpContext().User.FindFirstValue(USER_ID_CLAIM) ?? throw new NotFoundException(); return userId; } - public string GetUserIdOrNull() + public string? GetUserIdOrNull() { - var userId = _context.HttpContext.User.FindFirstValue(USER_ID_CLAIM); + var userId = GetHttpContext().User.FindFirstValue(USER_ID_CLAIM); return userId; } @@ -64,15 +64,15 @@ public string GetUsername() return GetUsernameOrNull() ?? throw new NotFoundException(); } - public string GetUsernameOrNull() + public string? GetUsernameOrNull() { - var username = _context.HttpContext.User.Identities.FirstOrDefault()?.Name; + var username = GetHttpContext().User.Identities.FirstOrDefault()?.Name; return username; } public IEnumerable GetRoles() { - var rolesClaim = _context.HttpContext.User.FindFirstValue(ClaimTypes.Role); + var rolesClaim = GetHttpContext().User.FindFirstValue(ClaimTypes.Role); if (rolesClaim == null) return new List(); @@ -81,7 +81,7 @@ public IEnumerable GetRoles() public SubscriptionPlan GetSubscriptionPlan() { - var subscriptionPlanClaim = _context.HttpContext.User.FindFirstValue(SUBSCRIPTION_PLAN_CLAIM); + var subscriptionPlanClaim = GetHttpContext().User.FindFirstValue(SUBSCRIPTION_PLAN_CLAIM); if (string.IsNullOrEmpty(subscriptionPlanClaim)) return SubscriptionPlan.Undefined; @@ -94,4 +94,9 @@ public SubscriptionPlan GetSubscriptionPlan() $"The value '{subscriptionPlanClaim}' is not a supported subscription plan."); } } + + private HttpContext GetHttpContext() + { + return _context.HttpContext ?? throw new Exception("HttpContext is null"); + } } diff --git a/Modules/Challenges/src/Challenges.Application/ApplicationOptions.cs b/Modules/Challenges/src/Challenges.Application/ApplicationOptions.cs index 52c072df57..2818f1462c 100644 --- a/Modules/Challenges/src/Challenges.Application/ApplicationOptions.cs +++ b/Modules/Challenges/src/Challenges.Application/ApplicationOptions.cs @@ -1,5 +1,3 @@ namespace Backbone.Modules.Challenges.Application; -public class ApplicationOptions -{ -} +public class ApplicationOptions; diff --git a/Modules/Challenges/src/Challenges.Application/Challenges.Application.csproj b/Modules/Challenges/src/Challenges.Application/Challenges.Application.csproj index f2b78162ff..763ce58563 100644 --- a/Modules/Challenges/src/Challenges.Application/Challenges.Application.csproj +++ b/Modules/Challenges/src/Challenges.Application/Challenges.Application.csproj @@ -1,9 +1,5 @@ - - enable - - diff --git a/Modules/Challenges/src/Challenges.Application/Challenges/ApplicationErrors.cs b/Modules/Challenges/src/Challenges.Application/Challenges/ApplicationErrors.cs index 3be74b2040..ca5e50bcaa 100644 --- a/Modules/Challenges/src/Challenges.Application/Challenges/ApplicationErrors.cs +++ b/Modules/Challenges/src/Challenges.Application/Challenges/ApplicationErrors.cs @@ -1,5 +1,3 @@ namespace Backbone.Modules.Challenges.Application.Challenges; -public static class ApplicationErrors -{ -} +public static class ApplicationErrors; diff --git a/Modules/Challenges/src/Challenges.Application/Challenges/Commands/CreateChallenge/CreateChallengeCommand.cs b/Modules/Challenges/src/Challenges.Application/Challenges/Commands/CreateChallenge/CreateChallengeCommand.cs index c26f203c4c..480e233924 100644 --- a/Modules/Challenges/src/Challenges.Application/Challenges/Commands/CreateChallenge/CreateChallengeCommand.cs +++ b/Modules/Challenges/src/Challenges.Application/Challenges/Commands/CreateChallenge/CreateChallengeCommand.cs @@ -3,4 +3,4 @@ namespace Backbone.Modules.Challenges.Application.Challenges.Commands.CreateChallenge; -public class CreateChallengeCommand : IRequest { } +public class CreateChallengeCommand : IRequest; diff --git a/Modules/Challenges/src/Challenges.Application/Challenges/Commands/CreateChallenge/Validators.cs b/Modules/Challenges/src/Challenges.Application/Challenges/Commands/CreateChallenge/Validators.cs index d5122b597d..115424d87e 100644 --- a/Modules/Challenges/src/Challenges.Application/Challenges/Commands/CreateChallenge/Validators.cs +++ b/Modules/Challenges/src/Challenges.Application/Challenges/Commands/CreateChallenge/Validators.cs @@ -2,4 +2,4 @@ namespace Backbone.Modules.Challenges.Application.Challenges.Commands.CreateChallenge; -public class CreateChallengeCommandValidator : AbstractValidator { } +public class CreateChallengeCommandValidator : AbstractValidator; diff --git a/Modules/Challenges/src/Challenges.Application/Challenges/Commands/DeleteExpiredChallenges/DeleteExpiredChallengesCommand.cs b/Modules/Challenges/src/Challenges.Application/Challenges/Commands/DeleteExpiredChallenges/DeleteExpiredChallengesCommand.cs index 59d32d169f..a26ef3bf60 100644 --- a/Modules/Challenges/src/Challenges.Application/Challenges/Commands/DeleteExpiredChallenges/DeleteExpiredChallengesCommand.cs +++ b/Modules/Challenges/src/Challenges.Application/Challenges/Commands/DeleteExpiredChallenges/DeleteExpiredChallengesCommand.cs @@ -2,4 +2,4 @@ namespace Backbone.Modules.Challenges.Application.Challenges.Commands.DeleteExpiredChallenges; -public class DeleteExpiredChallengesCommand : IRequest { } +public class DeleteExpiredChallengesCommand : IRequest; diff --git a/Modules/Challenges/src/Challenges.ConsumerApi/Challenges.ConsumerApi.csproj b/Modules/Challenges/src/Challenges.ConsumerApi/Challenges.ConsumerApi.csproj index 6e568e80f7..21f69e8a0a 100644 --- a/Modules/Challenges/src/Challenges.ConsumerApi/Challenges.ConsumerApi.csproj +++ b/Modules/Challenges/src/Challenges.ConsumerApi/Challenges.ConsumerApi.csproj @@ -1,9 +1,5 @@ - - enable - - @@ -14,6 +10,6 @@ - + diff --git a/Modules/Challenges/src/Challenges.Domain/Challenges.Domain.csproj b/Modules/Challenges/src/Challenges.Domain/Challenges.Domain.csproj index 757c63fd6c..5c47748418 100644 --- a/Modules/Challenges/src/Challenges.Domain/Challenges.Domain.csproj +++ b/Modules/Challenges/src/Challenges.Domain/Challenges.Domain.csproj @@ -1,9 +1,5 @@  - - enable - - diff --git a/Modules/Challenges/src/Challenges.Infrastructure.Database.Postgres/Challenges.Infrastructure.Database.Postgres.csproj b/Modules/Challenges/src/Challenges.Infrastructure.Database.Postgres/Challenges.Infrastructure.Database.Postgres.csproj index f66f2ea676..e1301dee1f 100644 --- a/Modules/Challenges/src/Challenges.Infrastructure.Database.Postgres/Challenges.Infrastructure.Database.Postgres.csproj +++ b/Modules/Challenges/src/Challenges.Infrastructure.Database.Postgres/Challenges.Infrastructure.Database.Postgres.csproj @@ -1,9 +1,5 @@ - - enable - - diff --git a/Modules/Challenges/src/Challenges.Infrastructure.Database.SqlServer/Challenges.Infrastructure.Database.SqlServer.csproj b/Modules/Challenges/src/Challenges.Infrastructure.Database.SqlServer/Challenges.Infrastructure.Database.SqlServer.csproj index f66f2ea676..e1301dee1f 100644 --- a/Modules/Challenges/src/Challenges.Infrastructure.Database.SqlServer/Challenges.Infrastructure.Database.SqlServer.csproj +++ b/Modules/Challenges/src/Challenges.Infrastructure.Database.SqlServer/Challenges.Infrastructure.Database.SqlServer.csproj @@ -1,9 +1,5 @@ - - enable - - diff --git a/Modules/Challenges/src/Challenges.Infrastructure/Challenges.Infrastructure.csproj b/Modules/Challenges/src/Challenges.Infrastructure/Challenges.Infrastructure.csproj index cd2bee6485..fe1f4856e8 100644 --- a/Modules/Challenges/src/Challenges.Infrastructure/Challenges.Infrastructure.csproj +++ b/Modules/Challenges/src/Challenges.Infrastructure/Challenges.Infrastructure.csproj @@ -1,13 +1,9 @@ - - enable - - - - - + + + diff --git a/Modules/Challenges/src/Challenges.Jobs.Cleanup/Challenges.Jobs.Cleanup.csproj b/Modules/Challenges/src/Challenges.Jobs.Cleanup/Challenges.Jobs.Cleanup.csproj index ac3cb96d38..926fb11122 100644 --- a/Modules/Challenges/src/Challenges.Jobs.Cleanup/Challenges.Jobs.Cleanup.csproj +++ b/Modules/Challenges/src/Challenges.Jobs.Cleanup/Challenges.Jobs.Cleanup.csproj @@ -2,7 +2,6 @@ Linux - enable diff --git a/Modules/Devices/src/Devices.AdminCli/Devices.AdminCli.csproj b/Modules/Devices/src/Devices.AdminCli/Devices.AdminCli.csproj index fbccd98009..b3f9cb201e 100644 --- a/Modules/Devices/src/Devices.AdminCli/Devices.AdminCli.csproj +++ b/Modules/Devices/src/Devices.AdminCli/Devices.AdminCli.csproj @@ -2,7 +2,6 @@ 1.5.0 - enable Exe True diff --git a/Modules/Devices/src/Devices.Application/Clients/Queries/ListClients/ListClientsQuery.cs b/Modules/Devices/src/Devices.Application/Clients/Queries/ListClients/ListClientsQuery.cs index 6bdf175fb7..f37eebfc3f 100644 --- a/Modules/Devices/src/Devices.Application/Clients/Queries/ListClients/ListClientsQuery.cs +++ b/Modules/Devices/src/Devices.Application/Clients/Queries/ListClients/ListClientsQuery.cs @@ -1,4 +1,4 @@ using MediatR; namespace Backbone.Modules.Devices.Application.Clients.Queries.ListClients; -public class ListClientsQuery : IRequest { } +public class ListClientsQuery : IRequest; diff --git a/Modules/Devices/src/Devices.Application/Devices.Application.csproj b/Modules/Devices/src/Devices.Application/Devices.Application.csproj index 2698d045a1..609ecf18ae 100644 --- a/Modules/Devices/src/Devices.Application/Devices.Application.csproj +++ b/Modules/Devices/src/Devices.Application/Devices.Application.csproj @@ -1,9 +1,5 @@  - - enable - - diff --git a/Modules/Devices/src/Devices.Application/Devices/Queries/GetActiveDevice/GetActiveDeviceQuery.cs b/Modules/Devices/src/Devices.Application/Devices/Queries/GetActiveDevice/GetActiveDeviceQuery.cs index 3960770ab3..50f1bf5800 100644 --- a/Modules/Devices/src/Devices.Application/Devices/Queries/GetActiveDevice/GetActiveDeviceQuery.cs +++ b/Modules/Devices/src/Devices.Application/Devices/Queries/GetActiveDevice/GetActiveDeviceQuery.cs @@ -3,4 +3,4 @@ namespace Backbone.Modules.Devices.Application.Devices.Queries.GetActiveDevice; -public class GetActiveDeviceQuery : IRequest { } +public class GetActiveDeviceQuery : IRequest; diff --git a/Modules/Devices/src/Devices.Application/Identities/Commands/SendDeletionProcessGracePeriodReminders/SendDeletionProcessGracePeriodRemindersCommand.cs b/Modules/Devices/src/Devices.Application/Identities/Commands/SendDeletionProcessGracePeriodReminders/SendDeletionProcessGracePeriodRemindersCommand.cs index cc664399d5..7089a779b3 100644 --- a/Modules/Devices/src/Devices.Application/Identities/Commands/SendDeletionProcessGracePeriodReminders/SendDeletionProcessGracePeriodRemindersCommand.cs +++ b/Modules/Devices/src/Devices.Application/Identities/Commands/SendDeletionProcessGracePeriodReminders/SendDeletionProcessGracePeriodRemindersCommand.cs @@ -1,6 +1,4 @@ using MediatR; namespace Backbone.Modules.Devices.Application.Identities.Commands.SendDeletionProcessGracePeriodReminders; -public class SendDeletionProcessGracePeriodRemindersCommand : IRequest -{ -} +public class SendDeletionProcessGracePeriodRemindersCommand : IRequest; diff --git a/Modules/Devices/src/Devices.Application/Identities/Commands/StartDeletionProcessAsOwner/StartDeletionProcessAsOwnerCommand.cs b/Modules/Devices/src/Devices.Application/Identities/Commands/StartDeletionProcessAsOwner/StartDeletionProcessAsOwnerCommand.cs index d38fff3de1..0b12d47e3f 100644 --- a/Modules/Devices/src/Devices.Application/Identities/Commands/StartDeletionProcessAsOwner/StartDeletionProcessAsOwnerCommand.cs +++ b/Modules/Devices/src/Devices.Application/Identities/Commands/StartDeletionProcessAsOwner/StartDeletionProcessAsOwnerCommand.cs @@ -2,6 +2,4 @@ namespace Backbone.Modules.Devices.Application.Identities.Commands.StartDeletionProcessAsOwner; -public class StartDeletionProcessAsOwnerCommand : IRequest -{ -} +public class StartDeletionProcessAsOwnerCommand : IRequest; diff --git a/Modules/Devices/src/Devices.Application/Infrastructure/Persistence/Database/IDevicesDbContext.cs b/Modules/Devices/src/Devices.Application/Infrastructure/Persistence/Database/IDevicesDbContext.cs index 51c298573b..98d3097038 100644 --- a/Modules/Devices/src/Devices.Application/Infrastructure/Persistence/Database/IDevicesDbContext.cs +++ b/Modules/Devices/src/Devices.Application/Infrastructure/Persistence/Database/IDevicesDbContext.cs @@ -2,6 +2,4 @@ namespace Backbone.Modules.Devices.Application.Infrastructure.Persistence.Database; -public interface IDevicesDbContext : IDbContext -{ -} +public interface IDevicesDbContext : IDbContext; diff --git a/Modules/Devices/src/Devices.Application/Infrastructure/PushNotifications/DeletionProcess/DeletionProcessStartedPushNotification.cs b/Modules/Devices/src/Devices.Application/Infrastructure/PushNotifications/DeletionProcess/DeletionProcessStartedPushNotification.cs index 07721dadb8..bdf6928307 100644 --- a/Modules/Devices/src/Devices.Application/Infrastructure/PushNotifications/DeletionProcess/DeletionProcessStartedPushNotification.cs +++ b/Modules/Devices/src/Devices.Application/Infrastructure/PushNotifications/DeletionProcess/DeletionProcessStartedPushNotification.cs @@ -1,6 +1,4 @@ namespace Backbone.Modules.Devices.Application.Infrastructure.PushNotifications.DeletionProcess; [NotificationText(Title = "Deletion process started", Body = "A Deletion Process was started for your Identity.")] -public record DeletionProcessStartedPushNotification -{ -} +public record DeletionProcessStartedPushNotification; diff --git a/Modules/Devices/src/Devices.Application/PasswordGenerator.cs b/Modules/Devices/src/Devices.Application/PasswordGenerator.cs index e82fc20be6..df06e30220 100644 --- a/Modules/Devices/src/Devices.Application/PasswordGenerator.cs +++ b/Modules/Devices/src/Devices.Application/PasswordGenerator.cs @@ -1,5 +1,4 @@ -using System.Diagnostics.CodeAnalysis; -using System.Security.Cryptography; +using System.Security.Cryptography; using System.Text; namespace Backbone.Modules.Devices.Application; diff --git a/Modules/Devices/src/Devices.Application/PushNotifications/Commands/DeleteDeviceRegistration/DeleteDeviceRegistrationCommand.cs b/Modules/Devices/src/Devices.Application/PushNotifications/Commands/DeleteDeviceRegistration/DeleteDeviceRegistrationCommand.cs index 90593129e7..82209d94dc 100644 --- a/Modules/Devices/src/Devices.Application/PushNotifications/Commands/DeleteDeviceRegistration/DeleteDeviceRegistrationCommand.cs +++ b/Modules/Devices/src/Devices.Application/PushNotifications/Commands/DeleteDeviceRegistration/DeleteDeviceRegistrationCommand.cs @@ -2,4 +2,4 @@ namespace Backbone.Modules.Devices.Application.PushNotifications.Commands.DeleteDeviceRegistration; -public class DeleteDeviceRegistrationCommand : IRequest { } +public class DeleteDeviceRegistrationCommand : IRequest; diff --git a/Modules/Devices/src/Devices.Application/Tiers/Commands/CreateQueuedForDeletionTier/CreateQueuedForDeletionTierCommand.cs b/Modules/Devices/src/Devices.Application/Tiers/Commands/CreateQueuedForDeletionTier/CreateQueuedForDeletionTierCommand.cs index c7385ff60d..1b9212a424 100644 --- a/Modules/Devices/src/Devices.Application/Tiers/Commands/CreateQueuedForDeletionTier/CreateQueuedForDeletionTierCommand.cs +++ b/Modules/Devices/src/Devices.Application/Tiers/Commands/CreateQueuedForDeletionTier/CreateQueuedForDeletionTierCommand.cs @@ -2,6 +2,4 @@ namespace Backbone.Modules.Devices.Application.Tiers.Commands.CreateQueuedForDeletionTier; -public class CreateQueuedForDeletionTierCommand : IRequest -{ -} +public class CreateQueuedForDeletionTierCommand : IRequest; diff --git a/Modules/Devices/src/Devices.Application/Users/Commands/SeedTestUsers/SeedTestUsersCommand.cs b/Modules/Devices/src/Devices.Application/Users/Commands/SeedTestUsers/SeedTestUsersCommand.cs index b9a52adf2b..82d57eb1b2 100644 --- a/Modules/Devices/src/Devices.Application/Users/Commands/SeedTestUsers/SeedTestUsersCommand.cs +++ b/Modules/Devices/src/Devices.Application/Users/Commands/SeedTestUsers/SeedTestUsersCommand.cs @@ -1,6 +1,4 @@ using MediatR; namespace Backbone.Modules.Devices.Application.Users.Commands.SeedTestUsers; -public class SeedTestUsersCommand : IRequest -{ -} +public class SeedTestUsersCommand : IRequest; diff --git a/Modules/Devices/src/Devices.ConsumerApi/Devices.ConsumerApi.csproj b/Modules/Devices/src/Devices.ConsumerApi/Devices.ConsumerApi.csproj index 77145c9ecb..da19448e0e 100644 --- a/Modules/Devices/src/Devices.ConsumerApi/Devices.ConsumerApi.csproj +++ b/Modules/Devices/src/Devices.ConsumerApi/Devices.ConsumerApi.csproj @@ -1,9 +1,5 @@  - - enable - - @@ -14,6 +10,6 @@ - + diff --git a/Modules/Devices/src/Devices.Domain/Devices.Domain.csproj b/Modules/Devices/src/Devices.Domain/Devices.Domain.csproj index a4146be25e..dc49b9ca4e 100644 --- a/Modules/Devices/src/Devices.Domain/Devices.Domain.csproj +++ b/Modules/Devices/src/Devices.Domain/Devices.Domain.csproj @@ -1,11 +1,7 @@ - - enable - - - + diff --git a/Modules/Devices/src/Devices.Domain/Entities/Identities/IdentityDeletionProcess.cs b/Modules/Devices/src/Devices.Domain/Entities/Identities/IdentityDeletionProcess.cs index f0062f2b42..9e0f4411ff 100644 --- a/Modules/Devices/src/Devices.Domain/Entities/Identities/IdentityDeletionProcess.cs +++ b/Modules/Devices/src/Devices.Domain/Entities/Identities/IdentityDeletionProcess.cs @@ -32,10 +32,7 @@ private IdentityDeletionProcess(IdentityAddress createdBy, DeletionProcessStatus CreatedAt = SystemTime.UtcNow; Status = status; - _auditLog = new List - { - IdentityDeletionProcessAuditLogEntry.ProcessStartedBySupport(Id, createdBy) - }; + _auditLog = [IdentityDeletionProcessAuditLogEntry.ProcessStartedBySupport(Id, createdBy)]; } private IdentityDeletionProcess(IdentityAddress createdBy, DeviceId createdByDevice) @@ -45,10 +42,7 @@ private IdentityDeletionProcess(IdentityAddress createdBy, DeviceId createdByDev Approve(createdByDevice); - _auditLog = new List - { - IdentityDeletionProcessAuditLogEntry.ProcessStartedByOwner(Id, createdBy, createdByDevice) - }; + _auditLog = [IdentityDeletionProcessAuditLogEntry.ProcessStartedByOwner(Id, createdBy, createdByDevice)]; } private void Approve(DeviceId createdByDevice) diff --git a/Modules/Devices/src/Devices.Infrastructure.Database.Postgres/Devices.Infrastructure.Database.Postgres.csproj b/Modules/Devices/src/Devices.Infrastructure.Database.Postgres/Devices.Infrastructure.Database.Postgres.csproj index e49fe9d142..04d456f1e6 100644 --- a/Modules/Devices/src/Devices.Infrastructure.Database.Postgres/Devices.Infrastructure.Database.Postgres.csproj +++ b/Modules/Devices/src/Devices.Infrastructure.Database.Postgres/Devices.Infrastructure.Database.Postgres.csproj @@ -1,9 +1,5 @@ - - enable - - diff --git a/Modules/Devices/src/Devices.Infrastructure.Database.SqlServer/Devices.Infrastructure.Database.SqlServer.csproj b/Modules/Devices/src/Devices.Infrastructure.Database.SqlServer/Devices.Infrastructure.Database.SqlServer.csproj index 8ba9755fdc..17a2f9db88 100644 --- a/Modules/Devices/src/Devices.Infrastructure.Database.SqlServer/Devices.Infrastructure.Database.SqlServer.csproj +++ b/Modules/Devices/src/Devices.Infrastructure.Database.SqlServer/Devices.Infrastructure.Database.SqlServer.csproj @@ -1,9 +1,5 @@ - - enable - - diff --git a/Modules/Devices/src/Devices.Infrastructure/Devices.Infrastructure.csproj b/Modules/Devices/src/Devices.Infrastructure/Devices.Infrastructure.csproj index b9b8b83be4..2f0cb889dc 100644 --- a/Modules/Devices/src/Devices.Infrastructure/Devices.Infrastructure.csproj +++ b/Modules/Devices/src/Devices.Infrastructure/Devices.Infrastructure.csproj @@ -1,25 +1,21 @@  - - enable - - - - - + + + - - + + - + - + diff --git a/Modules/Devices/src/Devices.Infrastructure/OpenIddict/CustomOpenIddictEntityFrameworkCoreAuthorization.cs b/Modules/Devices/src/Devices.Infrastructure/OpenIddict/CustomOpenIddictEntityFrameworkCoreAuthorization.cs index 0fd54b4b8a..242f658cb0 100644 --- a/Modules/Devices/src/Devices.Infrastructure/OpenIddict/CustomOpenIddictEntityFrameworkCoreAuthorization.cs +++ b/Modules/Devices/src/Devices.Infrastructure/OpenIddict/CustomOpenIddictEntityFrameworkCoreAuthorization.cs @@ -1,6 +1,4 @@ using OpenIddict.EntityFrameworkCore.Models; namespace Backbone.Modules.Devices.Infrastructure.OpenIddict; -public class CustomOpenIddictEntityFrameworkCoreAuthorization : OpenIddictEntityFrameworkCoreAuthorization -{ -} +public class CustomOpenIddictEntityFrameworkCoreAuthorization : OpenIddictEntityFrameworkCoreAuthorization; diff --git a/Modules/Devices/src/Devices.Infrastructure/OpenIddict/CustomOpenIddictEntityFrameworkCoreScope.cs b/Modules/Devices/src/Devices.Infrastructure/OpenIddict/CustomOpenIddictEntityFrameworkCoreScope.cs index eab13dff3d..73175c5780 100644 --- a/Modules/Devices/src/Devices.Infrastructure/OpenIddict/CustomOpenIddictEntityFrameworkCoreScope.cs +++ b/Modules/Devices/src/Devices.Infrastructure/OpenIddict/CustomOpenIddictEntityFrameworkCoreScope.cs @@ -1,7 +1,5 @@ using OpenIddict.EntityFrameworkCore.Models; namespace Backbone.Modules.Devices.Infrastructure.OpenIddict; -public class CustomOpenIddictEntityFrameworkCoreScope : OpenIddictEntityFrameworkCoreScope -{ -} +public class CustomOpenIddictEntityFrameworkCoreScope : OpenIddictEntityFrameworkCoreScope; diff --git a/Modules/Devices/src/Devices.Infrastructure/OpenIddict/CustomOpenIddictEntityFrameworkCoreToken.cs b/Modules/Devices/src/Devices.Infrastructure/OpenIddict/CustomOpenIddictEntityFrameworkCoreToken.cs index 7a28da5832..4e0a988b1c 100644 --- a/Modules/Devices/src/Devices.Infrastructure/OpenIddict/CustomOpenIddictEntityFrameworkCoreToken.cs +++ b/Modules/Devices/src/Devices.Infrastructure/OpenIddict/CustomOpenIddictEntityFrameworkCoreToken.cs @@ -1,7 +1,5 @@ using OpenIddict.EntityFrameworkCore.Models; namespace Backbone.Modules.Devices.Infrastructure.OpenIddict; -public class CustomOpenIddictEntityFrameworkCoreToken : OpenIddictEntityFrameworkCoreToken -{ -} +public class CustomOpenIddictEntityFrameworkCoreToken : OpenIddictEntityFrameworkCoreToken; diff --git a/Modules/Devices/test/Devices.Application.Tests/Devices.Application.Tests.csproj b/Modules/Devices/test/Devices.Application.Tests/Devices.Application.Tests.csproj index ff106e06d2..58f049c9a3 100644 --- a/Modules/Devices/test/Devices.Application.Tests/Devices.Application.Tests.csproj +++ b/Modules/Devices/test/Devices.Application.Tests/Devices.Application.Tests.csproj @@ -2,7 +2,6 @@ false - enable @@ -11,8 +10,8 @@ - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/Modules/Devices/test/Devices.Domain.Tests/Devices.Domain.Tests.csproj b/Modules/Devices/test/Devices.Domain.Tests/Devices.Domain.Tests.csproj index f69891ec48..c262da43cc 100644 --- a/Modules/Devices/test/Devices.Domain.Tests/Devices.Domain.Tests.csproj +++ b/Modules/Devices/test/Devices.Domain.Tests/Devices.Domain.Tests.csproj @@ -1,20 +1,19 @@ - enable false - + - - + + runtime; build; native; contentfiles; analyzers; buildtransitive all - + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/Modules/Devices/test/Devices.Infrastructure.Tests/Devices.Infrastructure.Tests.csproj b/Modules/Devices/test/Devices.Infrastructure.Tests/Devices.Infrastructure.Tests.csproj index 80f0b0f885..42d7178d5a 100644 --- a/Modules/Devices/test/Devices.Infrastructure.Tests/Devices.Infrastructure.Tests.csproj +++ b/Modules/Devices/test/Devices.Infrastructure.Tests/Devices.Infrastructure.Tests.csproj @@ -1,7 +1,6 @@ - enable false @@ -11,8 +10,8 @@ - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/Modules/Directory.Build.props b/Modules/Directory.Build.props index ad833c4a35..de3e097997 100644 --- a/Modules/Directory.Build.props +++ b/Modules/Directory.Build.props @@ -4,5 +4,6 @@ enable Backbone.Modules.$(MSBuildProjectName) $(AssemblyName.Replace(" ", "_")) + enable diff --git a/Modules/Files/src/Files.Application/ApplicationErrors.cs b/Modules/Files/src/Files.Application/ApplicationErrors.cs index 0e8487e25c..59fd095573 100644 --- a/Modules/Files/src/Files.Application/ApplicationErrors.cs +++ b/Modules/Files/src/Files.Application/ApplicationErrors.cs @@ -2,7 +2,5 @@ public static class ApplicationErrors { - public static class Files - { - } + public static class Files; } diff --git a/Modules/Files/src/Files.Application/Files.Application.csproj b/Modules/Files/src/Files.Application/Files.Application.csproj index 86e182f562..d3e5311bad 100644 --- a/Modules/Files/src/Files.Application/Files.Application.csproj +++ b/Modules/Files/src/Files.Application/Files.Application.csproj @@ -1,9 +1,5 @@  - - enable - - diff --git a/Modules/Files/src/Files.Application/Infrastructure/Persistence/IFilesDbContext.cs b/Modules/Files/src/Files.Application/Infrastructure/Persistence/IFilesDbContext.cs index c3d6e91759..9b4017f76b 100644 --- a/Modules/Files/src/Files.Application/Infrastructure/Persistence/IFilesDbContext.cs +++ b/Modules/Files/src/Files.Application/Infrastructure/Persistence/IFilesDbContext.cs @@ -2,6 +2,4 @@ namespace Backbone.Modules.Files.Application.Infrastructure.Persistence; -public interface IFilesDbContext : IDbContext -{ -} +public interface IFilesDbContext : IDbContext; diff --git a/Modules/Files/src/Files.ConsumerApi/Files.ConsumerApi.csproj b/Modules/Files/src/Files.ConsumerApi/Files.ConsumerApi.csproj index 5f67ac0995..f7a8b52108 100644 --- a/Modules/Files/src/Files.ConsumerApi/Files.ConsumerApi.csproj +++ b/Modules/Files/src/Files.ConsumerApi/Files.ConsumerApi.csproj @@ -1,9 +1,5 @@ - - enable - - @@ -15,6 +11,6 @@ - + diff --git a/Modules/Files/src/Files.Domain/Files.Domain.csproj b/Modules/Files/src/Files.Domain/Files.Domain.csproj index 757c63fd6c..5c47748418 100644 --- a/Modules/Files/src/Files.Domain/Files.Domain.csproj +++ b/Modules/Files/src/Files.Domain/Files.Domain.csproj @@ -1,9 +1,5 @@  - - enable - - diff --git a/Modules/Files/src/Files.Infrastructure.Database.Postgres/Files.Infrastructure.Database.Postgres.csproj b/Modules/Files/src/Files.Infrastructure.Database.Postgres/Files.Infrastructure.Database.Postgres.csproj index 13a28dcbaf..43ab6a6d16 100644 --- a/Modules/Files/src/Files.Infrastructure.Database.Postgres/Files.Infrastructure.Database.Postgres.csproj +++ b/Modules/Files/src/Files.Infrastructure.Database.Postgres/Files.Infrastructure.Database.Postgres.csproj @@ -1,9 +1,5 @@ - - enable - - diff --git a/Modules/Files/src/Files.Infrastructure.Database.SqlServer/Files.Infrastructure.Database.SqlServer.csproj b/Modules/Files/src/Files.Infrastructure.Database.SqlServer/Files.Infrastructure.Database.SqlServer.csproj index 13a28dcbaf..43ab6a6d16 100644 --- a/Modules/Files/src/Files.Infrastructure.Database.SqlServer/Files.Infrastructure.Database.SqlServer.csproj +++ b/Modules/Files/src/Files.Infrastructure.Database.SqlServer/Files.Infrastructure.Database.SqlServer.csproj @@ -1,9 +1,5 @@ - - enable - - diff --git a/Modules/Files/src/Files.Infrastructure/Files.Infrastructure.csproj b/Modules/Files/src/Files.Infrastructure/Files.Infrastructure.csproj index 4bf8f0b577..f5dae92bdb 100644 --- a/Modules/Files/src/Files.Infrastructure/Files.Infrastructure.csproj +++ b/Modules/Files/src/Files.Infrastructure/Files.Infrastructure.csproj @@ -1,13 +1,9 @@  - - enable - - - - - + + + diff --git a/Modules/Files/src/Files.Jobs.SanityCheck/Files.Jobs.SanityCheck.csproj b/Modules/Files/src/Files.Jobs.SanityCheck/Files.Jobs.SanityCheck.csproj index 3a01151590..b31cd05824 100644 --- a/Modules/Files/src/Files.Jobs.SanityCheck/Files.Jobs.SanityCheck.csproj +++ b/Modules/Files/src/Files.Jobs.SanityCheck/Files.Jobs.SanityCheck.csproj @@ -3,7 +3,6 @@ Linux ..\..\..\.. - enable diff --git a/Modules/Files/src/Files.Jobs.SanityCheck/Infrastructure/Reporter/LogReporter.cs b/Modules/Files/src/Files.Jobs.SanityCheck/Infrastructure/Reporter/LogReporter.cs index eca8d569e9..2d371479a9 100644 --- a/Modules/Files/src/Files.Jobs.SanityCheck/Infrastructure/Reporter/LogReporter.cs +++ b/Modules/Files/src/Files.Jobs.SanityCheck/Infrastructure/Reporter/LogReporter.cs @@ -12,8 +12,8 @@ public LogReporter(ILogger logger) { _logger = logger; - _databaseIds = new List(); - _blobIds = new List(); + _databaseIds = []; + _blobIds = []; } public void Complete() diff --git a/Modules/Files/test/Files.Application.Tests/Files.Application.Tests.csproj b/Modules/Files/test/Files.Application.Tests/Files.Application.Tests.csproj index 7d644b359b..14d9f4181c 100644 --- a/Modules/Files/test/Files.Application.Tests/Files.Application.Tests.csproj +++ b/Modules/Files/test/Files.Application.Tests/Files.Application.Tests.csproj @@ -6,8 +6,8 @@ - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/Modules/Files/test/Files.Jobs.SanityCheck.Tests/Files.Jobs.SanityCheck.Tests.csproj b/Modules/Files/test/Files.Jobs.SanityCheck.Tests/Files.Jobs.SanityCheck.Tests.csproj index 8e71fe2af3..c4971f0ef4 100644 --- a/Modules/Files/test/Files.Jobs.SanityCheck.Tests/Files.Jobs.SanityCheck.Tests.csproj +++ b/Modules/Files/test/Files.Jobs.SanityCheck.Tests/Files.Jobs.SanityCheck.Tests.csproj @@ -1,19 +1,18 @@ - enable false - - + + runtime; build; native; contentfiles; analyzers; buildtransitive all - + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/Modules/Files/test/Files.Jobs.SanityCheck.Tests/Infrastructure/Reporter/TestReporter.cs b/Modules/Files/test/Files.Jobs.SanityCheck.Tests/Infrastructure/Reporter/TestReporter.cs index 54c3205914..4cb18425dd 100644 --- a/Modules/Files/test/Files.Jobs.SanityCheck.Tests/Infrastructure/Reporter/TestReporter.cs +++ b/Modules/Files/test/Files.Jobs.SanityCheck.Tests/Infrastructure/Reporter/TestReporter.cs @@ -5,8 +5,8 @@ namespace Backbone.Modules.Files.Jobs.SanityCheck.Tests.Infrastructure.Reporter; public class TestReporter : IReporter { - public List ReportedDatabaseIds { get; } = new(); - public List ReportedBlobIds { get; } = new(); + public List ReportedDatabaseIds { get; } = []; + public List ReportedBlobIds { get; } = []; public void Complete() { diff --git a/Modules/Messages/src/Messages.Application/Messages.Application.csproj b/Modules/Messages/src/Messages.Application/Messages.Application.csproj index b890508a7b..261530b820 100644 --- a/Modules/Messages/src/Messages.Application/Messages.Application.csproj +++ b/Modules/Messages/src/Messages.Application/Messages.Application.csproj @@ -1,9 +1,5 @@  - - enable - - diff --git a/Modules/Messages/src/Messages.Common/Messages.Common.csproj b/Modules/Messages/src/Messages.Common/Messages.Common.csproj index f768fa15dc..d618a07e59 100644 --- a/Modules/Messages/src/Messages.Common/Messages.Common.csproj +++ b/Modules/Messages/src/Messages.Common/Messages.Common.csproj @@ -1,9 +1,5 @@  - - enable - - diff --git a/Modules/Messages/src/Messages.ConsumerApi/Messages.ConsumerApi.csproj b/Modules/Messages/src/Messages.ConsumerApi/Messages.ConsumerApi.csproj index 359f9834e9..54bbfb08f9 100644 --- a/Modules/Messages/src/Messages.ConsumerApi/Messages.ConsumerApi.csproj +++ b/Modules/Messages/src/Messages.ConsumerApi/Messages.ConsumerApi.csproj @@ -1,9 +1,5 @@  - - enable - - @@ -14,7 +10,7 @@ - + diff --git a/Modules/Messages/src/Messages.Domain/Messages.Domain.csproj b/Modules/Messages/src/Messages.Domain/Messages.Domain.csproj index 820a3403c7..6bb5ab10c2 100644 --- a/Modules/Messages/src/Messages.Domain/Messages.Domain.csproj +++ b/Modules/Messages/src/Messages.Domain/Messages.Domain.csproj @@ -1,9 +1,5 @@  - - enable - - diff --git a/Modules/Messages/src/Messages.Infrastructure.Database.Postgres/Messages.Infrastructure.Database.Postgres.csproj b/Modules/Messages/src/Messages.Infrastructure.Database.Postgres/Messages.Infrastructure.Database.Postgres.csproj index 11c91c5c98..407698c3e3 100644 --- a/Modules/Messages/src/Messages.Infrastructure.Database.Postgres/Messages.Infrastructure.Database.Postgres.csproj +++ b/Modules/Messages/src/Messages.Infrastructure.Database.Postgres/Messages.Infrastructure.Database.Postgres.csproj @@ -1,9 +1,5 @@  - - enable - - diff --git a/Modules/Messages/src/Messages.Infrastructure.Database.SqlServer/Messages.Infrastructure.Database.SqlServer.csproj b/Modules/Messages/src/Messages.Infrastructure.Database.SqlServer/Messages.Infrastructure.Database.SqlServer.csproj index e1754c7ac4..e245c41c36 100644 --- a/Modules/Messages/src/Messages.Infrastructure.Database.SqlServer/Messages.Infrastructure.Database.SqlServer.csproj +++ b/Modules/Messages/src/Messages.Infrastructure.Database.SqlServer/Messages.Infrastructure.Database.SqlServer.csproj @@ -1,9 +1,5 @@ - - enable - - diff --git a/Modules/Messages/src/Messages.Infrastructure/Messages.Infrastructure.csproj b/Modules/Messages/src/Messages.Infrastructure/Messages.Infrastructure.csproj index faace5562d..b9f685809c 100644 --- a/Modules/Messages/src/Messages.Infrastructure/Messages.Infrastructure.csproj +++ b/Modules/Messages/src/Messages.Infrastructure/Messages.Infrastructure.csproj @@ -1,13 +1,9 @@  - - enable - - - - - + + + diff --git a/Modules/Messages/test/Messages.Application.Tests/Messages.Application.Tests.csproj b/Modules/Messages/test/Messages.Application.Tests/Messages.Application.Tests.csproj index 1dae1ff6ca..9f72c3a8e0 100644 --- a/Modules/Messages/test/Messages.Application.Tests/Messages.Application.Tests.csproj +++ b/Modules/Messages/test/Messages.Application.Tests/Messages.Application.Tests.csproj @@ -2,15 +2,14 @@ false - enable - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/Modules/Quotas/src/Quotas.Application/DTOs/MetricStatusDTO.cs b/Modules/Quotas/src/Quotas.Application/DTOs/MetricStatusDTO.cs index aa0d963839..a58c77aac0 100644 --- a/Modules/Quotas/src/Quotas.Application/DTOs/MetricStatusDTO.cs +++ b/Modules/Quotas/src/Quotas.Application/DTOs/MetricStatusDTO.cs @@ -1,4 +1,2 @@ namespace Backbone.Modules.Quotas.Application.DTOs; -public class MetricStatusDTO -{ -} +public class MetricStatusDTO; diff --git a/Modules/Quotas/src/Quotas.Application/Identities/Queries/ListQuotasForIdentity/ListQuotasForIdentityQuery.cs b/Modules/Quotas/src/Quotas.Application/Identities/Queries/ListQuotasForIdentity/ListQuotasForIdentityQuery.cs index dbabd8e6e3..4657f55be2 100644 --- a/Modules/Quotas/src/Quotas.Application/Identities/Queries/ListQuotasForIdentity/ListQuotasForIdentityQuery.cs +++ b/Modules/Quotas/src/Quotas.Application/Identities/Queries/ListQuotasForIdentity/ListQuotasForIdentityQuery.cs @@ -2,4 +2,4 @@ namespace Backbone.Modules.Quotas.Application.Identities.Queries.ListQuotasForIdentity; -public class ListQuotasForIdentityQuery : IRequest { } +public class ListQuotasForIdentityQuery : IRequest; diff --git a/Modules/Quotas/src/Quotas.Application/Metrics/Queries/ListMetrics/ListMetricsQuery.cs b/Modules/Quotas/src/Quotas.Application/Metrics/Queries/ListMetrics/ListMetricsQuery.cs index 2212bfe356..3d9afc99b6 100644 --- a/Modules/Quotas/src/Quotas.Application/Metrics/Queries/ListMetrics/ListMetricsQuery.cs +++ b/Modules/Quotas/src/Quotas.Application/Metrics/Queries/ListMetrics/ListMetricsQuery.cs @@ -1,6 +1,4 @@ using MediatR; namespace Backbone.Modules.Quotas.Application.Metrics.Queries.ListMetrics; -public class ListMetricsQuery : IRequest -{ -} +public class ListMetricsQuery : IRequest; diff --git a/Modules/Quotas/src/Quotas.Application/Quotas.Application.csproj b/Modules/Quotas/src/Quotas.Application/Quotas.Application.csproj index 1972052cdd..e5f899f160 100644 --- a/Modules/Quotas/src/Quotas.Application/Quotas.Application.csproj +++ b/Modules/Quotas/src/Quotas.Application/Quotas.Application.csproj @@ -1,9 +1,5 @@  - - enable - - diff --git a/Modules/Quotas/src/Quotas.Application/Tiers/Commands/SeedQueuedForDeletionTier/SeedQueuedForDeletionTierCommand.cs b/Modules/Quotas/src/Quotas.Application/Tiers/Commands/SeedQueuedForDeletionTier/SeedQueuedForDeletionTierCommand.cs index 342ea80b23..dac326a923 100644 --- a/Modules/Quotas/src/Quotas.Application/Tiers/Commands/SeedQueuedForDeletionTier/SeedQueuedForDeletionTierCommand.cs +++ b/Modules/Quotas/src/Quotas.Application/Tiers/Commands/SeedQueuedForDeletionTier/SeedQueuedForDeletionTierCommand.cs @@ -2,6 +2,4 @@ namespace Backbone.Modules.Quotas.Application.Tiers.Commands.SeedQueuedForDeletionTier; -public class SeedQueuedForDeletionTierCommand : IRequest -{ -} +public class SeedQueuedForDeletionTierCommand : IRequest; diff --git a/Modules/Quotas/src/Quotas.ConsumerApi/Quotas.ConsumerApi.csproj b/Modules/Quotas/src/Quotas.ConsumerApi/Quotas.ConsumerApi.csproj index ad4c9d6e52..4660247fc5 100644 --- a/Modules/Quotas/src/Quotas.ConsumerApi/Quotas.ConsumerApi.csproj +++ b/Modules/Quotas/src/Quotas.ConsumerApi/Quotas.ConsumerApi.csproj @@ -1,9 +1,5 @@  - - enable - - @@ -13,7 +9,7 @@ - + diff --git a/Modules/Quotas/src/Quotas.Domain/Aggregates/Identities/Identity.cs b/Modules/Quotas/src/Quotas.Domain/Aggregates/Identities/Identity.cs index d9a56da4f9..a044343def 100644 --- a/Modules/Quotas/src/Quotas.Domain/Aggregates/Identities/Identity.cs +++ b/Modules/Quotas/src/Quotas.Domain/Aggregates/Identities/Identity.cs @@ -28,9 +28,9 @@ public Identity(string address, TierId tierId) { Address = address; TierId = tierId; - _tierQuotas = new List(); - _individualQuotas = new List(); - _metricStatuses = new List(); + _tierQuotas = []; + _individualQuotas = []; + _metricStatuses = []; } public string Address { get; } diff --git a/Modules/Quotas/src/Quotas.Domain/Aggregates/Metrics/MetricKey.cs b/Modules/Quotas/src/Quotas.Domain/Aggregates/Metrics/MetricKey.cs index df4f2baf06..81b42304cf 100644 --- a/Modules/Quotas/src/Quotas.Domain/Aggregates/Metrics/MetricKey.cs +++ b/Modules/Quotas/src/Quotas.Domain/Aggregates/Metrics/MetricKey.cs @@ -13,14 +13,15 @@ public record MetricKey public static MetricKey UsedFileStorageSpace = new("UsedFileStorageSpace"); - private static readonly MetricKey[] SUPPORTED_METRIC_KEYS = { + private static readonly MetricKey[] SUPPORTED_METRIC_KEYS = + [ NumberOfSentMessages, NumberOfRelationships, NumberOfFiles, NumberOfTokens, UsedFileStorageSpace, NumberOfRelationshipTemplates - }; + ]; private static readonly string[] SUPPORTED_METRIC_KEY_VALUES = SUPPORTED_METRIC_KEYS.Select(m => m.Value).ToArray(); private MetricKey(string value) diff --git a/Modules/Quotas/src/Quotas.Domain/Aggregates/Tiers/Tier.cs b/Modules/Quotas/src/Quotas.Domain/Aggregates/Tiers/Tier.cs index 1a56ab2201..2b2e9c37b1 100644 --- a/Modules/Quotas/src/Quotas.Domain/Aggregates/Tiers/Tier.cs +++ b/Modules/Quotas/src/Quotas.Domain/Aggregates/Tiers/Tier.cs @@ -13,7 +13,7 @@ public Tier(TierId id, string name) { Id = id; Name = name; - Quotas = new List(); + Quotas = []; } public TierId Id { get; } diff --git a/Modules/Quotas/src/Quotas.Domain/Quotas.Domain.csproj b/Modules/Quotas/src/Quotas.Domain/Quotas.Domain.csproj index 1829f89c25..fd3b21e6eb 100644 --- a/Modules/Quotas/src/Quotas.Domain/Quotas.Domain.csproj +++ b/Modules/Quotas/src/Quotas.Domain/Quotas.Domain.csproj @@ -1,9 +1,5 @@ - - enable - - diff --git a/Modules/Quotas/src/Quotas.Infrastructure.Database.Postgres/Quotas.Infrastructure.Database.Postgres.csproj b/Modules/Quotas/src/Quotas.Infrastructure.Database.Postgres/Quotas.Infrastructure.Database.Postgres.csproj index 8970c35c86..80f0075b34 100644 --- a/Modules/Quotas/src/Quotas.Infrastructure.Database.Postgres/Quotas.Infrastructure.Database.Postgres.csproj +++ b/Modules/Quotas/src/Quotas.Infrastructure.Database.Postgres/Quotas.Infrastructure.Database.Postgres.csproj @@ -1,9 +1,5 @@ - - enable - - diff --git a/Modules/Quotas/src/Quotas.Infrastructure.Database.SqlServer/Quotas.Infrastructure.Database.SqlServer.csproj b/Modules/Quotas/src/Quotas.Infrastructure.Database.SqlServer/Quotas.Infrastructure.Database.SqlServer.csproj index 8970c35c86..80f0075b34 100644 --- a/Modules/Quotas/src/Quotas.Infrastructure.Database.SqlServer/Quotas.Infrastructure.Database.SqlServer.csproj +++ b/Modules/Quotas/src/Quotas.Infrastructure.Database.SqlServer/Quotas.Infrastructure.Database.SqlServer.csproj @@ -1,9 +1,5 @@ - - enable - - diff --git a/Modules/Quotas/src/Quotas.Infrastructure/Persistence/Database/QuotasDbContext.cs b/Modules/Quotas/src/Quotas.Infrastructure/Persistence/Database/QuotasDbContext.cs index 6595854fd6..f0ec89e1df 100644 --- a/Modules/Quotas/src/Quotas.Infrastructure/Persistence/Database/QuotasDbContext.cs +++ b/Modules/Quotas/src/Quotas.Infrastructure/Persistence/Database/QuotasDbContext.cs @@ -14,7 +14,7 @@ namespace Backbone.Modules.Quotas.Infrastructure.Persistence.Database; public class QuotasDbContext : AbstractDbContextBase { - public QuotasDbContext() : base() { } + public QuotasDbContext() { } public QuotasDbContext(DbContextOptions options) : base(options) { } diff --git a/Modules/Quotas/src/Quotas.Infrastructure/Persistence/Repository/MetricsRepository.cs b/Modules/Quotas/src/Quotas.Infrastructure/Persistence/Repository/MetricsRepository.cs index 54689d8fe2..c29335febe 100644 --- a/Modules/Quotas/src/Quotas.Infrastructure/Persistence/Repository/MetricsRepository.cs +++ b/Modules/Quotas/src/Quotas.Infrastructure/Persistence/Repository/MetricsRepository.cs @@ -10,15 +10,15 @@ public class MetricsRepository : IMetricsRepository public MetricsRepository() { - _metrics = new List - { + _metrics = + [ new(MetricKey.NumberOfSentMessages, "Number of Sent Messages"), new(MetricKey.NumberOfRelationships, "Number of Relationships"), new(MetricKey.NumberOfRelationshipTemplates, "Number of Relationship Templates"), new(MetricKey.NumberOfFiles, "Number of Files"), new(MetricKey.NumberOfTokens, "Number of Tokens"), new(MetricKey.UsedFileStorageSpace, "File Storage Capacity (in Megabytes)") - }; + ]; } public Task Find(MetricKey key, CancellationToken cancellationToken, bool track = false) diff --git a/Modules/Quotas/src/Quotas.Infrastructure/Quotas.Infrastructure.csproj b/Modules/Quotas/src/Quotas.Infrastructure/Quotas.Infrastructure.csproj index 3d16122f33..94291fe04a 100644 --- a/Modules/Quotas/src/Quotas.Infrastructure/Quotas.Infrastructure.csproj +++ b/Modules/Quotas/src/Quotas.Infrastructure/Quotas.Infrastructure.csproj @@ -1,14 +1,10 @@ - - enable - - - - - - + + + + diff --git a/Modules/Quotas/test/Quotas.Application.Tests/Quotas.Application.Tests.csproj b/Modules/Quotas/test/Quotas.Application.Tests/Quotas.Application.Tests.csproj index aa74d487b2..5bceadc4df 100644 --- a/Modules/Quotas/test/Quotas.Application.Tests/Quotas.Application.Tests.csproj +++ b/Modules/Quotas/test/Quotas.Application.Tests/Quotas.Application.Tests.csproj @@ -2,15 +2,14 @@ false - enable - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/Modules/Quotas/test/Quotas.Application.Tests/TestDoubles/UserContextStub.cs b/Modules/Quotas/test/Quotas.Application.Tests/TestDoubles/UserContextStub.cs index 7bf11cacb6..5a2925aa55 100644 --- a/Modules/Quotas/test/Quotas.Application.Tests/TestDoubles/UserContextStub.cs +++ b/Modules/Quotas/test/Quotas.Application.Tests/TestDoubles/UserContextStub.cs @@ -7,7 +7,7 @@ internal class UserContextStub : IUserContext { public IdentityAddress GetAddress() { - return IdentityAddress.Create(new byte[] { 0 }, "id1"); + return IdentityAddress.Create([0], "id1"); } public IdentityAddress GetAddressOrNull() diff --git a/Modules/Quotas/test/Quotas.Domain.Tests/Quotas.Domain.Tests.csproj b/Modules/Quotas/test/Quotas.Domain.Tests/Quotas.Domain.Tests.csproj index 00b045f2d8..64c2e6ef9e 100644 --- a/Modules/Quotas/test/Quotas.Domain.Tests/Quotas.Domain.Tests.csproj +++ b/Modules/Quotas/test/Quotas.Domain.Tests/Quotas.Domain.Tests.csproj @@ -2,14 +2,13 @@ false - enable - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/Modules/Relationships/src/Relationships.Application/RelationshipTemplates/Queries/ListRelationshipTemplates/ListRelationshipTemplatesQuery.cs b/Modules/Relationships/src/Relationships.Application/RelationshipTemplates/Queries/ListRelationshipTemplates/ListRelationshipTemplatesQuery.cs index 57f4349cd7..b775206717 100644 --- a/Modules/Relationships/src/Relationships.Application/RelationshipTemplates/Queries/ListRelationshipTemplates/ListRelationshipTemplatesQuery.cs +++ b/Modules/Relationships/src/Relationships.Application/RelationshipTemplates/Queries/ListRelationshipTemplates/ListRelationshipTemplatesQuery.cs @@ -9,7 +9,7 @@ public class ListRelationshipTemplatesQuery : IRequest? ids) { PaginationFilter = paginationFilter; - Ids = ids == null ? [] : new List(ids); + Ids = ids == null ? [] : ids.ToList(); } public PaginationFilter PaginationFilter { get; set; } diff --git a/Modules/Relationships/src/Relationships.Application/Relationships.Application.csproj b/Modules/Relationships/src/Relationships.Application/Relationships.Application.csproj index dd8421092d..75991db824 100644 --- a/Modules/Relationships/src/Relationships.Application/Relationships.Application.csproj +++ b/Modules/Relationships/src/Relationships.Application/Relationships.Application.csproj @@ -1,7 +1,4 @@ - - enable - diff --git a/Modules/Relationships/src/Relationships.Application/Relationships/Commands/AcceptRelationshipChangeRequest/AcceptRelationshipChangeRequestResponse.cs b/Modules/Relationships/src/Relationships.Application/Relationships/Commands/AcceptRelationshipChangeRequest/AcceptRelationshipChangeRequestResponse.cs index 586a71acb2..1f060823eb 100644 --- a/Modules/Relationships/src/Relationships.Application/Relationships/Commands/AcceptRelationshipChangeRequest/AcceptRelationshipChangeRequestResponse.cs +++ b/Modules/Relationships/src/Relationships.Application/Relationships/Commands/AcceptRelationshipChangeRequest/AcceptRelationshipChangeRequestResponse.cs @@ -2,4 +2,4 @@ namespace Backbone.Modules.Relationships.Application.Relationships.Commands.AcceptRelationshipChangeRequest; -public class AcceptRelationshipChangeRequestResponse : RelationshipMetadataDTO { } +public class AcceptRelationshipChangeRequestResponse : RelationshipMetadataDTO; diff --git a/Modules/Relationships/src/Relationships.Application/Relationships/Commands/CreateRelationship/CreateRelationshipResponse.cs b/Modules/Relationships/src/Relationships.Application/Relationships/Commands/CreateRelationship/CreateRelationshipResponse.cs index da58a0e9ad..f4b8f5c926 100644 --- a/Modules/Relationships/src/Relationships.Application/Relationships/Commands/CreateRelationship/CreateRelationshipResponse.cs +++ b/Modules/Relationships/src/Relationships.Application/Relationships/Commands/CreateRelationship/CreateRelationshipResponse.cs @@ -2,4 +2,4 @@ namespace Backbone.Modules.Relationships.Application.Relationships.Commands.CreateRelationship; -public class CreateRelationshipResponse : RelationshipMetadataDTO { } +public class CreateRelationshipResponse : RelationshipMetadataDTO; diff --git a/Modules/Relationships/src/Relationships.Application/Relationships/Commands/RejectRelationshipChangeRequest/RejectRelationshipChangeRequestResponse.cs b/Modules/Relationships/src/Relationships.Application/Relationships/Commands/RejectRelationshipChangeRequest/RejectRelationshipChangeRequestResponse.cs index acde5fd2fe..408ec04739 100644 --- a/Modules/Relationships/src/Relationships.Application/Relationships/Commands/RejectRelationshipChangeRequest/RejectRelationshipChangeRequestResponse.cs +++ b/Modules/Relationships/src/Relationships.Application/Relationships/Commands/RejectRelationshipChangeRequest/RejectRelationshipChangeRequestResponse.cs @@ -2,4 +2,4 @@ namespace Backbone.Modules.Relationships.Application.Relationships.Commands.RejectRelationshipChangeRequest; -public class RejectRelationshipChangeRequestResponse : RelationshipMetadataDTO { } +public class RejectRelationshipChangeRequestResponse : RelationshipMetadataDTO; diff --git a/Modules/Relationships/src/Relationships.Application/Relationships/Commands/RevokeRelationshipChangeRequest/RevokeRelationshipChangeRequestResponse.cs b/Modules/Relationships/src/Relationships.Application/Relationships/Commands/RevokeRelationshipChangeRequest/RevokeRelationshipChangeRequestResponse.cs index 46fd0dc8fc..9adf95ea3a 100644 --- a/Modules/Relationships/src/Relationships.Application/Relationships/Commands/RevokeRelationshipChangeRequest/RevokeRelationshipChangeRequestResponse.cs +++ b/Modules/Relationships/src/Relationships.Application/Relationships/Commands/RevokeRelationshipChangeRequest/RevokeRelationshipChangeRequestResponse.cs @@ -2,4 +2,4 @@ namespace Backbone.Modules.Relationships.Application.Relationships.Commands.RevokeRelationshipChangeRequest; -public class RevokeRelationshipChangeRequestResponse : RelationshipMetadataDTO { } +public class RevokeRelationshipChangeRequestResponse : RelationshipMetadataDTO; diff --git a/Modules/Relationships/src/Relationships.Application/Relationships/Queries/ListRelationships/ListRelationshipsQuery.cs b/Modules/Relationships/src/Relationships.Application/Relationships/Queries/ListRelationships/ListRelationshipsQuery.cs index 47243c6b50..9bbc92fed5 100644 --- a/Modules/Relationships/src/Relationships.Application/Relationships/Queries/ListRelationships/ListRelationshipsQuery.cs +++ b/Modules/Relationships/src/Relationships.Application/Relationships/Queries/ListRelationships/ListRelationshipsQuery.cs @@ -9,7 +9,7 @@ public class ListRelationshipsQuery : IRequest public ListRelationshipsQuery(PaginationFilter paginationFilter, IEnumerable? ids) { PaginationFilter = paginationFilter; - Ids = ids == null ? [] : new List(ids); + Ids = ids == null ? [] : ids.ToList(); } public PaginationFilter PaginationFilter { get; set; } diff --git a/Modules/Relationships/src/Relationships.Common/Relationships.Common.csproj b/Modules/Relationships/src/Relationships.Common/Relationships.Common.csproj index 2e10c0ff24..afdbddeed4 100644 --- a/Modules/Relationships/src/Relationships.Common/Relationships.Common.csproj +++ b/Modules/Relationships/src/Relationships.Common/Relationships.Common.csproj @@ -1,9 +1,5 @@ - - enable - - diff --git a/Modules/Relationships/src/Relationships.ConsumerApi/Relationships.ConsumerApi.csproj b/Modules/Relationships/src/Relationships.ConsumerApi/Relationships.ConsumerApi.csproj index 054b859bca..0a506b0039 100644 --- a/Modules/Relationships/src/Relationships.ConsumerApi/Relationships.ConsumerApi.csproj +++ b/Modules/Relationships/src/Relationships.ConsumerApi/Relationships.ConsumerApi.csproj @@ -1,9 +1,5 @@  - - enable - - @@ -15,6 +11,6 @@ - + diff --git a/Modules/Relationships/src/Relationships.Domain/Relationships.Domain.csproj b/Modules/Relationships/src/Relationships.Domain/Relationships.Domain.csproj index 757c63fd6c..5c47748418 100644 --- a/Modules/Relationships/src/Relationships.Domain/Relationships.Domain.csproj +++ b/Modules/Relationships/src/Relationships.Domain/Relationships.Domain.csproj @@ -1,9 +1,5 @@  - - enable - - diff --git a/Modules/Relationships/src/Relationships.Infrastructure.Database.Postgres/Relationships.Infrastructure.Database.Postgres.csproj b/Modules/Relationships/src/Relationships.Infrastructure.Database.Postgres/Relationships.Infrastructure.Database.Postgres.csproj index 91b073a048..d95fafeeb0 100644 --- a/Modules/Relationships/src/Relationships.Infrastructure.Database.Postgres/Relationships.Infrastructure.Database.Postgres.csproj +++ b/Modules/Relationships/src/Relationships.Infrastructure.Database.Postgres/Relationships.Infrastructure.Database.Postgres.csproj @@ -1,9 +1,5 @@ - - enable - - diff --git a/Modules/Relationships/src/Relationships.Infrastructure.Database.SqlServer/Relationships.Infrastructure.Database.SqlServer.csproj b/Modules/Relationships/src/Relationships.Infrastructure.Database.SqlServer/Relationships.Infrastructure.Database.SqlServer.csproj index 892516c490..e963e9939a 100644 --- a/Modules/Relationships/src/Relationships.Infrastructure.Database.SqlServer/Relationships.Infrastructure.Database.SqlServer.csproj +++ b/Modules/Relationships/src/Relationships.Infrastructure.Database.SqlServer/Relationships.Infrastructure.Database.SqlServer.csproj @@ -1,9 +1,5 @@  - - enable - - diff --git a/Modules/Relationships/src/Relationships.Infrastructure/Relationships.Infrastructure.csproj b/Modules/Relationships/src/Relationships.Infrastructure/Relationships.Infrastructure.csproj index 2ea5663bb4..07ec409344 100644 --- a/Modules/Relationships/src/Relationships.Infrastructure/Relationships.Infrastructure.csproj +++ b/Modules/Relationships/src/Relationships.Infrastructure/Relationships.Infrastructure.csproj @@ -1,13 +1,9 @@ - - enable - - - - - + + + diff --git a/Modules/Relationships/test/Relationships.Application.Tests/Relationships.Application.Tests.csproj b/Modules/Relationships/test/Relationships.Application.Tests/Relationships.Application.Tests.csproj index ea549a4966..b493b045df 100644 --- a/Modules/Relationships/test/Relationships.Application.Tests/Relationships.Application.Tests.csproj +++ b/Modules/Relationships/test/Relationships.Application.Tests/Relationships.Application.Tests.csproj @@ -2,15 +2,14 @@ false - enable - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/Modules/Relationships/test/Relationships.Application.Tests/Tests/RelationshipTemplates/Queries/ListRelationshipTemplates/ListRelationshipTemplatesValidatorTests.cs b/Modules/Relationships/test/Relationships.Application.Tests/Tests/RelationshipTemplates/Queries/ListRelationshipTemplates/ListRelationshipTemplatesValidatorTests.cs index ecb2593f61..7281efaa90 100644 --- a/Modules/Relationships/test/Relationships.Application.Tests/Tests/RelationshipTemplates/Queries/ListRelationshipTemplates/ListRelationshipTemplatesValidatorTests.cs +++ b/Modules/Relationships/test/Relationships.Application.Tests/Tests/RelationshipTemplates/Queries/ListRelationshipTemplates/ListRelationshipTemplatesValidatorTests.cs @@ -14,7 +14,7 @@ public void Happy_path() { var validator = new ListRelationshipTemplatesValidator(); - var validationResult = validator.TestValidate(new ListRelationshipTemplatesQuery(new PaginationFilter(), new[] { RelationshipTemplateId.New() })); + var validationResult = validator.TestValidate(new ListRelationshipTemplatesQuery(new PaginationFilter(), [RelationshipTemplateId.New()])); validationResult.ShouldNotHaveAnyValidationErrors(); } diff --git a/Modules/Relationships/test/Relationships.Domain.Tests/Relationships.Domain.Tests.csproj b/Modules/Relationships/test/Relationships.Domain.Tests/Relationships.Domain.Tests.csproj index bf2be2ffb5..4565128836 100644 --- a/Modules/Relationships/test/Relationships.Domain.Tests/Relationships.Domain.Tests.csproj +++ b/Modules/Relationships/test/Relationships.Domain.Tests/Relationships.Domain.Tests.csproj @@ -2,14 +2,13 @@ false - enable - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/Modules/Relationships/test/Relationships.Domain.Tests/Tests/RelationshipTests.cs b/Modules/Relationships/test/Relationships.Domain.Tests/Tests/RelationshipTests.cs index 88d263df65..9fec189096 100644 --- a/Modules/Relationships/test/Relationships.Domain.Tests/Tests/RelationshipTests.cs +++ b/Modules/Relationships/test/Relationships.Domain.Tests/Tests/RelationshipTests.cs @@ -411,7 +411,7 @@ private static Relationship CreateActiveRelationship() { var relationship = new Relationship(TEMPLATE, FROM_IDENTITY, FROM_DEVICE, REQUEST_CONTENT); var change = relationship.Changes.GetOpenCreation(); - relationship.AcceptChange(change.Id, TO_IDENTITY, TO_DEVICE, RESPONSE_CONTENT); + relationship.AcceptChange(change!.Id, TO_IDENTITY, TO_DEVICE, RESPONSE_CONTENT); return relationship; } @@ -419,7 +419,7 @@ private static Relationship CreateRelationshipWithOpenTermination() { var relationship = new Relationship(TEMPLATE, FROM_IDENTITY, FROM_DEVICE, REQUEST_CONTENT); var change = relationship.Changes.GetOpenCreation(); - relationship.AcceptChange(change.Id, TO_IDENTITY, TO_DEVICE, RESPONSE_CONTENT); + relationship.AcceptChange(change!.Id, TO_IDENTITY, TO_DEVICE, RESPONSE_CONTENT); relationship.RequestTermination(FROM_IDENTITY, FROM_DEVICE); return relationship; diff --git a/Modules/Synchronization/src/Synchronization.Application/Synchronization.Application.csproj b/Modules/Synchronization/src/Synchronization.Application/Synchronization.Application.csproj index 1960db5628..f55084d5f5 100644 --- a/Modules/Synchronization/src/Synchronization.Application/Synchronization.Application.csproj +++ b/Modules/Synchronization/src/Synchronization.Application/Synchronization.Application.csproj @@ -2,7 +2,6 @@ - enable diff --git a/Modules/Synchronization/src/Synchronization.ConsumerApi/Synchronization.ConsumerApi.csproj b/Modules/Synchronization/src/Synchronization.ConsumerApi/Synchronization.ConsumerApi.csproj index 175f7ef6c8..700a67250a 100644 --- a/Modules/Synchronization/src/Synchronization.ConsumerApi/Synchronization.ConsumerApi.csproj +++ b/Modules/Synchronization/src/Synchronization.ConsumerApi/Synchronization.ConsumerApi.csproj @@ -1,9 +1,5 @@  - - enable - - @@ -14,6 +10,6 @@ - + diff --git a/Modules/Synchronization/src/Synchronization.Domain/Synchronization.Domain.csproj b/Modules/Synchronization/src/Synchronization.Domain/Synchronization.Domain.csproj index 757c63fd6c..5c47748418 100644 --- a/Modules/Synchronization/src/Synchronization.Domain/Synchronization.Domain.csproj +++ b/Modules/Synchronization/src/Synchronization.Domain/Synchronization.Domain.csproj @@ -1,9 +1,5 @@  - - enable - - diff --git a/Modules/Synchronization/src/Synchronization.Infrastructure.Database.Postgres/Synchronization.Infrastructure.Database.Postgres.csproj b/Modules/Synchronization/src/Synchronization.Infrastructure.Database.Postgres/Synchronization.Infrastructure.Database.Postgres.csproj index a8c6670267..7941d658de 100644 --- a/Modules/Synchronization/src/Synchronization.Infrastructure.Database.Postgres/Synchronization.Infrastructure.Database.Postgres.csproj +++ b/Modules/Synchronization/src/Synchronization.Infrastructure.Database.Postgres/Synchronization.Infrastructure.Database.Postgres.csproj @@ -1,9 +1,5 @@ - - enable - - diff --git a/Modules/Synchronization/src/Synchronization.Infrastructure.Database.SqlServer/Synchronization.Infrastructure.Database.SqlServer.csproj b/Modules/Synchronization/src/Synchronization.Infrastructure.Database.SqlServer/Synchronization.Infrastructure.Database.SqlServer.csproj index a8c6670267..7941d658de 100644 --- a/Modules/Synchronization/src/Synchronization.Infrastructure.Database.SqlServer/Synchronization.Infrastructure.Database.SqlServer.csproj +++ b/Modules/Synchronization/src/Synchronization.Infrastructure.Database.SqlServer/Synchronization.Infrastructure.Database.SqlServer.csproj @@ -1,9 +1,5 @@ - - enable - - diff --git a/Modules/Synchronization/src/Synchronization.Infrastructure/Synchronization.Infrastructure.csproj b/Modules/Synchronization/src/Synchronization.Infrastructure/Synchronization.Infrastructure.csproj index aae9fd1282..0d3912b231 100644 --- a/Modules/Synchronization/src/Synchronization.Infrastructure/Synchronization.Infrastructure.csproj +++ b/Modules/Synchronization/src/Synchronization.Infrastructure/Synchronization.Infrastructure.csproj @@ -1,9 +1,5 @@ - - enable - - @@ -11,10 +7,10 @@ - - - - + + + + diff --git a/Modules/Synchronization/test/Synchronization.Application.Tests/Synchronization.Application.Tests.csproj b/Modules/Synchronization/test/Synchronization.Application.Tests/Synchronization.Application.Tests.csproj index 9d46236d49..e187fedd29 100644 --- a/Modules/Synchronization/test/Synchronization.Application.Tests/Synchronization.Application.Tests.csproj +++ b/Modules/Synchronization/test/Synchronization.Application.Tests/Synchronization.Application.Tests.csproj @@ -2,7 +2,6 @@ false - enable @@ -11,8 +10,8 @@ - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/Modules/Synchronization/test/Synchronization.Domain.Tests/Synchronization.Domain.Tests.csproj b/Modules/Synchronization/test/Synchronization.Domain.Tests/Synchronization.Domain.Tests.csproj index 4e6e3355f3..9e2be5bc4d 100644 --- a/Modules/Synchronization/test/Synchronization.Domain.Tests/Synchronization.Domain.Tests.csproj +++ b/Modules/Synchronization/test/Synchronization.Domain.Tests/Synchronization.Domain.Tests.csproj @@ -2,14 +2,13 @@ false - enable - - + + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/Modules/Tokens/src/Tokens.Application/ApplicationErrors.cs b/Modules/Tokens/src/Tokens.Application/ApplicationErrors.cs index f9fd92a792..edd0d6e3f8 100644 --- a/Modules/Tokens/src/Tokens.Application/ApplicationErrors.cs +++ b/Modules/Tokens/src/Tokens.Application/ApplicationErrors.cs @@ -1,3 +1,3 @@ namespace Backbone.Modules.Tokens.Application; -public static class ApplicationErrors { } +public static class ApplicationErrors; diff --git a/Modules/Tokens/src/Tokens.Application/Tokens.Application.csproj b/Modules/Tokens/src/Tokens.Application/Tokens.Application.csproj index c0987cbe38..1cf4eea348 100644 --- a/Modules/Tokens/src/Tokens.Application/Tokens.Application.csproj +++ b/Modules/Tokens/src/Tokens.Application/Tokens.Application.csproj @@ -1,7 +1,4 @@ - - enable - diff --git a/Modules/Tokens/src/Tokens.ConsumerApi/Tokens.ConsumerApi.csproj b/Modules/Tokens/src/Tokens.ConsumerApi/Tokens.ConsumerApi.csproj index c658ee6a2d..856d30603f 100644 --- a/Modules/Tokens/src/Tokens.ConsumerApi/Tokens.ConsumerApi.csproj +++ b/Modules/Tokens/src/Tokens.ConsumerApi/Tokens.ConsumerApi.csproj @@ -1,9 +1,5 @@ - - enable - - @@ -14,6 +10,6 @@ - + diff --git a/Modules/Tokens/src/Tokens.Domain/Tokens.Domain.csproj b/Modules/Tokens/src/Tokens.Domain/Tokens.Domain.csproj index 4158fd3752..bc3dd29d28 100644 --- a/Modules/Tokens/src/Tokens.Domain/Tokens.Domain.csproj +++ b/Modules/Tokens/src/Tokens.Domain/Tokens.Domain.csproj @@ -1,9 +1,5 @@ - - enable - - diff --git a/Modules/Tokens/src/Tokens.Infrastructure.Database.Postgres/Tokens.Infrastructure.Database.Postgres.csproj b/Modules/Tokens/src/Tokens.Infrastructure.Database.Postgres/Tokens.Infrastructure.Database.Postgres.csproj index d9209881a2..dabb612ceb 100644 --- a/Modules/Tokens/src/Tokens.Infrastructure.Database.Postgres/Tokens.Infrastructure.Database.Postgres.csproj +++ b/Modules/Tokens/src/Tokens.Infrastructure.Database.Postgres/Tokens.Infrastructure.Database.Postgres.csproj @@ -1,9 +1,5 @@ - - enable - - diff --git a/Modules/Tokens/src/Tokens.Infrastructure.Database.SqlServer/Tokens.Infrastructure.Database.SqlServer.csproj b/Modules/Tokens/src/Tokens.Infrastructure.Database.SqlServer/Tokens.Infrastructure.Database.SqlServer.csproj index d9209881a2..dabb612ceb 100644 --- a/Modules/Tokens/src/Tokens.Infrastructure.Database.SqlServer/Tokens.Infrastructure.Database.SqlServer.csproj +++ b/Modules/Tokens/src/Tokens.Infrastructure.Database.SqlServer/Tokens.Infrastructure.Database.SqlServer.csproj @@ -1,9 +1,5 @@ - - enable - - diff --git a/Modules/Tokens/src/Tokens.Infrastructure/Persistence/Repository/IServiceCollectionExtensions.cs b/Modules/Tokens/src/Tokens.Infrastructure/Persistence/Repository/IServiceCollectionExtensions.cs index 93ca604b35..718b099218 100644 --- a/Modules/Tokens/src/Tokens.Infrastructure/Persistence/Repository/IServiceCollectionExtensions.cs +++ b/Modules/Tokens/src/Tokens.Infrastructure/Persistence/Repository/IServiceCollectionExtensions.cs @@ -1,5 +1,4 @@ -using Backbone.BuildingBlocks.Infrastructure.Persistence.BlobStorage; -using Backbone.Modules.Tokens.Application.Infrastructure.Persistence.Repository; +using Backbone.Modules.Tokens.Application.Infrastructure.Persistence.Repository; using Microsoft.Extensions.DependencyInjection; namespace Backbone.Modules.Tokens.Infrastructure.Persistence.Repository; diff --git a/Modules/Tokens/src/Tokens.Infrastructure/Tokens.Infrastructure.csproj b/Modules/Tokens/src/Tokens.Infrastructure/Tokens.Infrastructure.csproj index 9f4b5022ad..0ef6a34253 100644 --- a/Modules/Tokens/src/Tokens.Infrastructure/Tokens.Infrastructure.csproj +++ b/Modules/Tokens/src/Tokens.Infrastructure/Tokens.Infrastructure.csproj @@ -1,12 +1,9 @@ - - enable - - - - + + + diff --git a/Modules/Tokens/test/Tokens.Application.Tests/Tests/Tokens/CreateToken/HandlerTests.cs b/Modules/Tokens/test/Tokens.Application.Tests/Tests/Tokens/CreateToken/HandlerTests.cs index 01c9cf0d78..5c5bee30cf 100644 --- a/Modules/Tokens/test/Tokens.Application.Tests/Tests/Tokens/CreateToken/HandlerTests.cs +++ b/Modules/Tokens/test/Tokens.Application.Tests/Tests/Tokens/CreateToken/HandlerTests.cs @@ -33,7 +33,7 @@ public async void Triggers_TokenCreatedIntegrationEvent() var command = new CreateTokenCommand { ExpiresAt = DateTime.UtcNow, - Content = new byte[] { 1, 1, 1, 1, 1, 1, 1, 1 } + Content = [1, 1, 1, 1, 1, 1, 1, 1] }; var tokenRepository = A.Fake(); diff --git a/Modules/Tokens/test/Tokens.Application.Tests/Tokens.Application.Tests.csproj b/Modules/Tokens/test/Tokens.Application.Tests/Tokens.Application.Tests.csproj index a8f86cc2b4..3589f64088 100644 --- a/Modules/Tokens/test/Tokens.Application.Tests/Tokens.Application.Tests.csproj +++ b/Modules/Tokens/test/Tokens.Application.Tests/Tokens.Application.Tests.csproj @@ -2,15 +2,14 @@ false - enable - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive