consoleTests
Vivien DUFOUR 1 year ago
commit 4a899b32cc

@ -3,6 +3,7 @@ using DbServices;
using FluentAssertions;
using Microsoft.Data.Sqlite;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
using Model;
using StubContext;
@ -21,7 +22,8 @@ public class AdminTeamsControllerTest
);
context.Database.EnsureCreated();
var controller = new TeamsAdminController(
new DbTeamService(context)
new DbTeamService(context),
new LoggerFactory().CreateLogger<TeamsAdminController>()
);
return (controller, context);

@ -4,6 +4,7 @@ using DbServices;
using FluentAssertions;
using Microsoft.Data.Sqlite;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
using Model;
using StubContext;
@ -23,7 +24,7 @@ public class AdminUserControllerTest
);
context.Database.EnsureCreated();
var service = new DbUserService(context);
return new UsersAdminController(service);
return new UsersAdminController(service, new LoggerFactory().CreateLogger<UsersAdminController>());
}

@ -6,15 +6,22 @@ name: "CI/CD"
steps:
- image: mcr.microsoft.com/dotnet/sdk:8.0
name: "Run Tests"
name: "Run Tests and sonar"
commands:
- dotnet test
- apt update && apt install openjdk-17-jre -y
- dotnet tool install --global dotnet-sonarscanner
- dotnet tool install --global dotnet-coverage
- export PATH="$PATH:/root/.dotnet/tools"
- dotnet sonarscanner begin /k:"IQBall-WebAPI" /d:sonar.host.url="https://codefirst.iut.uca.fr/sonar" /d:sonar.login="sqp_b16ad09dcce1b9dde920e313b10c2fe85566624c"
- dotnet build
- dotnet-coverage collect "dotnet test" -f xml -o "coverage.xml"
- dotnet sonarscanner end /d:sonar.login="sqp_b16ad09dcce1b9dde920e313b10c2fe85566624c"
- image: plugins/docker
name: "build and push docker image"
depends_on:
- "Run Tests"
- "Run Tests and sonar"
settings:
dockerfile: ci/API.dockerfile
context: .

Loading…
Cancel
Save