aboutsummaryrefslogtreecommitdiff
path: root/src/Services/DevHive.Services.Tests
diff options
context:
space:
mode:
authortranstrike <transtrike@gmail.com>2021-02-15 19:06:14 +0200
committertranstrike <transtrike@gmail.com>2021-02-15 19:06:14 +0200
commit4c03712af14c37718b7be5b23fcadeb86f2a2191 (patch)
tree0c6b5a592244e5b2574afa9e4919d4a3111eea34 /src/Services/DevHive.Services.Tests
parent09fc4603e82f69c926f9457085aa3fa48bb3939c (diff)
downloadDevHive-4c03712af14c37718b7be5b23fcadeb86f2a2191.tar
DevHive-4c03712af14c37718b7be5b23fcadeb86f2a2191.tar.gz
DevHive-4c03712af14c37718b7be5b23fcadeb86f2a2191.zip
Code Analyzer added to all csproj; Removed unnessessary code; Fixed formatting
Diffstat (limited to 'src/Services/DevHive.Services.Tests')
-rw-r--r--src/Services/DevHive.Services.Tests/DevHive.Services.Tests.csproj13
-rw-r--r--src/Services/DevHive.Services.Tests/UserService.Tests.cs8
2 files changed, 11 insertions, 10 deletions
diff --git a/src/Services/DevHive.Services.Tests/DevHive.Services.Tests.csproj b/src/Services/DevHive.Services.Tests/DevHive.Services.Tests.csproj
index eb33d07..bdfb2bb 100644
--- a/src/Services/DevHive.Services.Tests/DevHive.Services.Tests.csproj
+++ b/src/Services/DevHive.Services.Tests/DevHive.Services.Tests.csproj
@@ -4,14 +4,15 @@
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
- <PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="5.0.3" />
- <PackageReference Include="Moq" Version="4.16.0" />
- <PackageReference Include="NUnit" Version="3.13.1" />
- <PackageReference Include="NUnit3TestAdapter" Version="3.17.0" />
- <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.8.3" />
+ <PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="5.0.3"/>
+ <PackageReference Include="Moq" Version="4.16.0"/>
+ <PackageReference Include="NUnit" Version="3.13.1"/>
+ <PackageReference Include="NUnit3TestAdapter" Version="3.17.0"/>
+ <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.8.3"/>
+ <PackageReference Include="SonarAnalyzer.CSharp" Version="8.18.0.27296"/>
</ItemGroup>
<ItemGroup>
- <ProjectReference Include="..\DevHive.Services\DevHive.Services.csproj" />
+ <ProjectReference Include="..\DevHive.Services\DevHive.Services.csproj"/>
</ItemGroup>
<PropertyGroup>
<EnableNETAnalyzers>true</EnableNETAnalyzers>
diff --git a/src/Services/DevHive.Services.Tests/UserService.Tests.cs b/src/Services/DevHive.Services.Tests/UserService.Tests.cs
index 8fddce7..ce997c1 100644
--- a/src/Services/DevHive.Services.Tests/UserService.Tests.cs
+++ b/src/Services/DevHive.Services.Tests/UserService.Tests.cs
@@ -29,7 +29,7 @@ namespace DevHive.Services.Tests
private Mock<ILanguageRepository> LanguageRepositoryMock { get; set; }
private Mock<ITechnologyRepository> TechnologyRepositoryMock { get; set; }
private Mock<IMapper> MapperMock { get; set; }
- private JWTOptions JWTOptions { get; set; }
+ private JwtOptions JwtOptions { get; set; }
private UserService UserService { get; set; }
#region SetUps
@@ -41,10 +41,10 @@ namespace DevHive.Services.Tests
this.CloudServiceMock = new Mock<ICloudService>();
this.LanguageRepositoryMock = new Mock<ILanguageRepository>();
this.TechnologyRepositoryMock = new Mock<ITechnologyRepository>();
- this.JWTOptions = new JWTOptions("gXfQlU6qpDleFWyimscjYcT3tgFsQg3yoFjcvSLxG56n1Vu2yptdIUq254wlJWjm");
+ this.JwtOptions = new JwtOptions("gXfQlU6qpDleFWyimscjYcT3tgFsQg3yoFjcvSLxG56n1Vu2yptdIUq254wlJWjm");
this.MapperMock = new Mock<IMapper>();
// TODO: give actual UserManager and RoleManager to UserService
- this.UserService = new UserService(this.UserRepositoryMock.Object, this.LanguageRepositoryMock.Object, this.RoleRepositoryMock.Object, this.TechnologyRepositoryMock.Object, null, null, this.MapperMock.Object, this.JWTOptions, this.CloudServiceMock.Object);
+ this.UserService = new UserService(this.UserRepositoryMock.Object, this.LanguageRepositoryMock.Object, this.RoleRepositoryMock.Object, this.TechnologyRepositoryMock.Object, null, null, this.MapperMock.Object, this.JwtOptions, this.CloudServiceMock.Object);
}
#endregion
@@ -364,7 +364,7 @@ namespace DevHive.Services.Tests
#region HelperMethods
private string WriteJWTSecurityToken(Guid userId, string username, HashSet<Role> roles)
{
- byte[] signingKey = Encoding.ASCII.GetBytes(this.JWTOptions.Secret);
+ byte[] signingKey = Encoding.ASCII.GetBytes(this.JwtOptions.Secret);
HashSet<Claim> claims = new()
{
new Claim("ID", $"{userId}"),