Skip to content

Commit

Permalink
fix unit test to inject JwtCreator
Browse files Browse the repository at this point in the history
  • Loading branch information
Eddie4k-code committed Dec 7, 2024
1 parent a85953b commit 6a97ea2
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 1 deletion.
3 changes: 2 additions & 1 deletion UserService/UserService.UnitTests/UserServiceTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using UserService.Application.Services;
using UserService.Domain.Entities;
using UserService.Domain.ValueObjects;
using UserService.Infrastructure.Authentication;
namespace UserService.UnitTests
{
public class UserServiceTests
Expand All @@ -17,7 +18,7 @@ public class UserServiceTests
private readonly Mock<IUserRepository> _userRepositoryMock = new Mock<IUserRepository>();

public UserServiceTests() {
this._userService = new AuthenticationService(_userRepositoryMock.Object);
this._userService = new AuthenticationService(_userRepositoryMock.Object, new JwtCreator());

Check failure on line 21 in UserService/UserService.UnitTests/UserServiceTests.cs

View workflow job for this annotation

GitHub Actions / run-service-unit-tests (UserService)

There is no argument given that corresponds to the required parameter 'jwtSettings' of 'JwtCreator.JwtCreator(IOptions<JwtSettings>)'

Check failure on line 21 in UserService/UserService.UnitTests/UserServiceTests.cs

View workflow job for this annotation

GitHub Actions / run-service-unit-tests (UserService)

There is no argument given that corresponds to the required parameter 'jwtSettings' of 'JwtCreator.JwtCreator(IOptions<JwtSettings>)'
}

[Fact]
Expand Down
1 change: 1 addition & 0 deletions shared/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
7 changes: 7 additions & 0 deletions shared/shared.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,11 @@
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Diagnostics" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Abstractions" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Core" Version="2.2.5" />
</ItemGroup>

</Project>
25 changes: 25 additions & 0 deletions shared/shared.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.5.002.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "shared", "shared.csproj", "{5DF65EDA-E226-4531-9FE4-D5B615C95718}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{5DF65EDA-E226-4531-9FE4-D5B615C95718}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5DF65EDA-E226-4531-9FE4-D5B615C95718}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5DF65EDA-E226-4531-9FE4-D5B615C95718}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5DF65EDA-E226-4531-9FE4-D5B615C95718}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {AF81B790-E65C-4B47-8442-E819AFB3B74C}
EndGlobalSection
EndGlobal

0 comments on commit 6a97ea2

Please sign in to comment.