0
0
mirror of https://github.com/alex289/CleanArchitecture.git synced 2025-06-30 10:33:43 +00:00

Code cleanup and dependency updates

This commit is contained in:
Alexander Konietzko 2023-07-01 13:26:10 +02:00
parent e39c94ea99
commit 745b3930f0
No known key found for this signature in database
GPG Key ID: BA6905F37AEC2B5B
16 changed files with 38 additions and 33 deletions

View File

@ -10,14 +10,14 @@
<PackageReference Include="AspNetCore.HealthChecks.ApplicationStatus" Version="6.0.0" />
<PackageReference Include="AspNetCore.HealthChecks.SqlServer" Version="6.0.2" />
<PackageReference Include="AspNetCore.HealthChecks.UI.Client" Version="6.0.5" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="7.0.7" />
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="7.0.7" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.7">
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="7.0.8" />
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="7.0.8" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.8">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.Proxies" Version="7.0.7" />
<PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks.EntityFrameworkCore" Version="7.0.7" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Proxies" Version="7.0.8" />
<PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks.EntityFrameworkCore" Version="7.0.8" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
<PackageReference Include="Swashbuckle.AspNetCore.Annotations" Version="6.5.0" />
</ItemGroup>

View File

@ -1,4 +1,3 @@
using System;
using CleanArchitecture.Api.Extensions;
using CleanArchitecture.Application.Extensions;
using CleanArchitecture.Application.gRPC;

View File

@ -9,7 +9,7 @@
<ItemGroup>
<PackageReference Include="FluentAssertions" Version="6.11.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.2" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.3" />
<PackageReference Include="MockQueryable.Moq" Version="7.0.0" />
<PackageReference Include="Moq" Version="4.18.4" />
<PackageReference Include="xunit" Version="2.4.2" />

View File

@ -6,7 +6,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.7" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.8" />
</ItemGroup>
<ItemGroup>

View File

@ -10,7 +10,7 @@
<ItemGroup>
<PackageReference Include="BCrypt.Net-Next" Version="4.0.3" />
<PackageReference Include="FluentAssertions" Version="6.11.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.2" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.3" />
<PackageReference Include="Moq" Version="4.18.4" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">

View File

@ -20,7 +20,7 @@ namespace CleanArchitecture.Domain.Commands.Users.LoginUser;
public sealed class LoginUserCommandHandler : CommandHandlerBase,
IRequestHandler<LoginUserCommand, string>
{
private const double ExpiryDurationMinutes = 30;
private const double _expiryDurationMinutes = 30;
private readonly TokenSettings _tokenSettings;
private readonly IUserRepository _userRepository;
@ -96,7 +96,7 @@ public sealed class LoginUserCommandHandler : CommandHandlerBase,
tokenSettings.Issuer,
tokenSettings.Audience,
claims,
expires: DateTime.Now.AddMinutes(ExpiryDurationMinutes),
expires: DateTime.Now.AddMinutes(_expiryDurationMinutes),
signingCredentials: credentials);
return new JwtSecurityTokenHandler().WriteToken(tokenDescriptor);

View File

@ -9,7 +9,7 @@
<ItemGroup>
<PackageReference Include="FluentAssertions" Version="6.11.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.2" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.3" />
<PackageReference Include="Moq" Version="4.18.4" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">

View File

@ -11,10 +11,10 @@
<ItemGroup>
<PackageReference Include="MediatR" Version="12.0.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.7" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="7.0.7" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.7" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.7">
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.8" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="7.0.8" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.8" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.8">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>

View File

@ -0,0 +1,8 @@
// This file is used by Code Analysis to maintain SuppressMessage
// attributes that are applied to this project.
// Project-level suppressions either have no target or are given
// a specific target and scoped to a namespace, type, member, etc.
using System.Diagnostics.CodeAnalysis;
[assembly: SuppressMessage("Style", "IDE0161:Convert to file-scoped namespace", Justification = "<Pending>", Scope = "namespace", Target = "~N:CleanArchitecture.Infrastructure.Migrations")]

View File

@ -9,11 +9,11 @@
<ItemGroup>
<PackageReference Include="FluentAssertions" Version="6.11.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="7.0.7" />
<PackageReference Include="Microsoft.Data.Sqlite.Core" Version="7.0.7" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Proxies" Version="7.0.7" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="7.0.7" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.2" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="7.0.8" />
<PackageReference Include="Microsoft.Data.Sqlite.Core" Version="7.0.8" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Proxies" Version="7.0.8" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="7.0.8" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.3" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="Xunit.Priority" Version="1.1.6" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">

View File

@ -8,7 +8,7 @@ namespace CleanArchitecture.IntegrationTests.Extensions;
public static class HttpExtensions
{
private static readonly JsonSerializerOptions JsonSerializerOptions = new()
private static readonly JsonSerializerOptions s_jsonSerializerOptions = new()
{
PropertyNameCaseInsensitive = true
};
@ -20,12 +20,12 @@ public static class HttpExtensions
return default;
}
return JsonSerializer.Deserialize<T>(json, JsonSerializerOptions);
return JsonSerializer.Deserialize<T>(json, s_jsonSerializerOptions);
}
private static string Serialize<T>(T data)
{
return JsonSerializer.Serialize(data, JsonSerializerOptions);
return JsonSerializer.Serialize(data, s_jsonSerializerOptions);
}
public static async Task<ResponseMessage<T>?> ReadAsJsonAsync<T>(this HttpContent httpContent)

View File

@ -2,7 +2,6 @@ using System;
using CleanArchitecture.Domain.Entities;
using CleanArchitecture.Domain.Enums;
using CleanArchitecture.Infrastructure.Database;
using CleanArchitecture.IntegrationTests.Infrastructure;
using Grpc.Net.Client;
namespace CleanArchitecture.IntegrationTests.Fixtures.gRPC;

View File

@ -19,14 +19,14 @@ public sealed class HealthChecksTests : IClassFixture<TestFixtureBase>
{
_fixture = fixture;
}
[Fact]
[Priority(0)]
public async Task Should_Return_Healthy()
{
var response = await _fixture.ServerClient.GetAsync("/healthz");
response.StatusCode.Should().Be(HttpStatusCode.OK);
var content = await response.Content.ReadAsStringAsync();
var json = JObject.Parse(content);

View File

@ -15,15 +15,15 @@ public sealed class GetUsersByIdsTests : IClassFixture<GetUsersByIdsTestFixture>
{
_fixture = fixture;
}
[Fact]
public async Task Should_Get_Users_By_Ids()
{
var client = new UsersApi.UsersApiClient(_fixture.GrpcChannel);
var request = new GetByIdsRequest();
request.Ids.Add(_fixture.CreatedUserId.ToString());
var response = await client.GetByIdsAsync(request);
response.Users.Count.Should().Be(1);

View File

@ -9,7 +9,7 @@
<ItemGroup>
<PackageReference Include="FluentAssertions" Version="6.11.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.2" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.3" />
<PackageReference Include="MockQueryable.Moq" Version="7.0.0" />
<PackageReference Include="Moq" Version="4.18.4" />
<PackageReference Include="xunit" Version="2.4.2" />

View File

@ -1,5 +1,4 @@
using System;
using CleanArchitecture.gRPC.Interfaces;
using CleanArchitecture.gRPC.Interfaces;
namespace CleanArchitecture.gRPC;