Adding tests for users and roles

This commit is contained in:
2025-03-17 23:34:52 +01:00
parent e7b3acb91e
commit db37ebbdce
7 changed files with 501 additions and 24 deletions

View File

@@ -81,6 +81,16 @@ public static class TestUtils
var httpContextAccessor = new Mock<IHttpContextAccessor>();
return new JwtService(httpContextAccessor.Object, configuration, sqlServerContext);
}
public static RoleService CreateRoleService()
{
IConfiguration configuration = CreateConfiguration();
var optionsBuilder = new DbContextOptionsBuilder<SqlServerContext>();
optionsBuilder.UseSqlServer(GetSqlConnectionString(configuration));
SqlServerContext sqlServerContext = new SqlServerContext(optionsBuilder.Options);
var httpContextAccessor = new Mock<IHttpContextAccessor>();
return new RoleService(httpContextAccessor.Object, configuration, sqlServerContext);
}
}