Compare commits
180 Commits
projectIni
...
master
Author | SHA1 | Date |
---|---|---|
|
1338a073fd | 2 weeks ago |
|
3510f8219d | 2 weeks ago |
|
fceef665af | 2 weeks ago |
|
887b43a8a9 | 2 weeks ago |
|
b28632ca27 | 2 weeks ago |
|
092b53fe89 | 2 weeks ago |
![]() |
eb950fe801 | 2 weeks ago |
![]() |
d51225cf23 | 2 weeks ago |
|
326141ebea | 2 weeks ago |
|
5153564054 | 2 weeks ago |
|
1f6dfeefc4 | 2 weeks ago |
|
7660456667 | 2 weeks ago |
|
738880a055 | 2 weeks ago |
|
42b791d630 | 2 weeks ago |
|
b695a0c3a9 | 2 weeks ago |
|
8f60990194 | 2 weeks ago |
|
6d8db552c7 | 2 weeks ago |
|
5634943a6d | 2 weeks ago |
|
552e18702c | 2 weeks ago |
|
0c62d8ed3b | 2 weeks ago |
|
571f2f0967 | 2 weeks ago |
![]() |
f96b0650bd | 2 weeks ago |
![]() |
dd5461e3e4 | 2 weeks ago |
![]() |
f1e5399674 | 2 weeks ago |
![]() |
ff0129aba2 | 2 weeks ago |
![]() |
d6b7d5cc10 | 2 weeks ago |
![]() |
0f02cc0563 | 2 weeks ago |
![]() |
e9db38a673 | 2 weeks ago |
|
344c2b8a61 | 2 weeks ago |
|
da6534249f | 2 weeks ago |
![]() |
ba1429e8d0 | 2 weeks ago |
![]() |
f125ebc9fd | 2 weeks ago |
|
8e24f3bd4d | 2 weeks ago |
|
11e9f528b0 | 2 weeks ago |
|
197251908c | 2 weeks ago |
|
8383532f79 | 2 weeks ago |
|
ddc7bd482a | 2 weeks ago |
|
d0765e9194 | 2 weeks ago |
|
dac0c7a433 | 2 weeks ago |
|
ed87c0a42b | 2 weeks ago |
|
26e2aaa75c | 2 weeks ago |
|
1bffdcd1ca | 2 weeks ago |
|
3c94e8900d | 2 weeks ago |
|
feda8ddd81 | 2 weeks ago |
![]() |
d1f802a002 | 2 weeks ago |
![]() |
f578dffd53 | 2 weeks ago |
![]() |
c6bb4053f6 | 2 weeks ago |
![]() |
5f35563be6 | 2 weeks ago |
![]() |
a1eddae208 | 2 weeks ago |
![]() |
e369fb398b | 2 weeks ago |
|
d452ae3047 | 2 weeks ago |
|
c5d0339496 | 2 weeks ago |
|
725bfe0587 | 2 weeks ago |
![]() |
e3654aa81c | 2 weeks ago |
![]() |
6066064815 | 2 weeks ago |
|
865ad2448d | 3 weeks ago |
|
c93119742b | 3 weeks ago |
|
a474728dae | 3 weeks ago |
|
3ff914a543 | 3 weeks ago |
|
6f6d154542 | 3 weeks ago |
|
0169d251a4 | 3 weeks ago |
|
017e298fe5 | 3 weeks ago |
|
e1de173450 | 3 weeks ago |
|
e20adb2c8f | 3 weeks ago |
|
e9f08492b8 | 3 weeks ago |
|
24be82306c | 3 weeks ago |
|
7b37013f73 | 3 weeks ago |
|
d2fd7db0ab | 3 weeks ago |
|
1b39853556 | 3 weeks ago |
|
8674879e75 | 3 weeks ago |
|
81e18d872e | 3 weeks ago |
![]() |
d952cb6bf0 | 3 weeks ago |
|
3e7ae2af12 | 3 weeks ago |
|
3a30c7972b | 3 weeks ago |
|
75fe8de4d3 | 3 weeks ago |
![]() |
46f60e9fae | 3 weeks ago |
![]() |
4d5b895fd8 | 3 weeks ago |
|
5759828aba | 3 weeks ago |
|
6016183450 | 3 weeks ago |
|
ccb8b0295b | 3 weeks ago |
|
4506406e46 | 3 weeks ago |
|
100c31b5ff | 3 weeks ago |
|
e0fad88de1 | 3 weeks ago |
![]() |
79bec0a5d8 | 3 weeks ago |
![]() |
6947bc017a | 3 weeks ago |
![]() |
30337d1ed7 | 3 weeks ago |
|
dd31aa6a64 | 3 weeks ago |
![]() |
b4b785f20b | 3 weeks ago |
![]() |
8c90ba2721 | 3 weeks ago |
|
24e18ae401 | 3 weeks ago |
|
811ec76c49 | 3 weeks ago |
|
34d6307b4e | 3 weeks ago |
|
2015173411 | 3 weeks ago |
|
4520ecbe0d | 3 weeks ago |
|
9437cc9fdd | 3 weeks ago |
|
1468acc9f9 | 3 weeks ago |
|
510bcecf3c | 3 weeks ago |
|
6565c15294 | 3 weeks ago |
|
dde5e1f09a | 3 weeks ago |
![]() |
c13a864252 | 3 weeks ago |
![]() |
ed678b67eb | 3 weeks ago |
![]() |
eb0af16e6a | 3 weeks ago |
|
cfe199a64d | 3 weeks ago |
![]() |
d872246561 | 3 weeks ago |
![]() |
da9b4a9b83 | 3 weeks ago |
![]() |
3da9d718e7 | 3 weeks ago |
|
18e311da9f | 3 weeks ago |
|
0cacb3a3ed | 3 weeks ago |
![]() |
f52bd3aced | 3 weeks ago |
![]() |
831a65f244 | 3 weeks ago |
![]() |
7e1805126e | 3 weeks ago |
![]() |
6e1825f6ff | 3 weeks ago |
![]() |
ff3a1a0efa | 3 weeks ago |
![]() |
a263050ab6 | 3 weeks ago |
![]() |
0d29cc0626 | 3 weeks ago |
![]() |
e3c668428e | 3 weeks ago |
![]() |
48c12241d8 | 3 weeks ago |
![]() |
f53718694e | 3 weeks ago |
![]() |
019ea01797 | 3 weeks ago |
![]() |
1734512b0b | 3 weeks ago |
|
48a15425c3 | 3 weeks ago |
![]() |
03312f3978 | 3 weeks ago |
![]() |
42face1ba2 | 3 weeks ago |
![]() |
8471e6cfd5 | 3 weeks ago |
![]() |
5b01d086ad | 3 weeks ago |
![]() |
e51db914c2 | 3 weeks ago |
![]() |
b9503cbab4 | 3 weeks ago |
![]() |
5ecf9e768f | 3 weeks ago |
![]() |
3015ac873a | 3 weeks ago |
![]() |
b7a0800b08 | 3 weeks ago |
![]() |
ad8d0023b6 | 3 weeks ago |
![]() |
4b1edf0e16 | 3 weeks ago |
![]() |
69716c4f9b | 3 weeks ago |
![]() |
f7f0be36e5 | 3 weeks ago |
![]() |
fee5b07fac | 3 weeks ago |
![]() |
50fb9d8d68 | 3 weeks ago |
![]() |
63f7da729a | 3 weeks ago |
![]() |
aa8cb64d6f | 3 weeks ago |
![]() |
3029f097bc | 3 weeks ago |
![]() |
4d2985f73f | 3 weeks ago |
![]() |
09372a4b3e | 3 weeks ago |
![]() |
af4f9c8ba0 | 3 weeks ago |
![]() |
0aeb05fa88 | 3 weeks ago |
![]() |
1056339f26 | 3 weeks ago |
![]() |
960a966f06 | 4 weeks ago |
![]() |
0b1c5b0208 | 4 weeks ago |
![]() |
a5b6fac9a6 | 4 weeks ago |
|
1599968013 | 4 weeks ago |
![]() |
d8c91fd73e | 4 weeks ago |
![]() |
48a5f9856e | 4 weeks ago |
![]() |
b6e78e4950 | 4 weeks ago |
|
57e2af4a45 | 4 weeks ago |
|
ddbbf3a361 | 4 weeks ago |
![]() |
6584bf6caf | 1 month ago |
![]() |
b3ef9f3a4a | 1 month ago |
![]() |
ec34797b76 | 1 month ago |
![]() |
96f55a3532 | 1 month ago |
|
9ff0dc316c | 1 month ago |
![]() |
dc010f74cc | 1 month ago |
|
a6fdb3242e | 1 month ago |
![]() |
2738d52fa0 | 1 month ago |
![]() |
d0c0519ca0 | 1 month ago |
|
d3bfd171cd | 1 month ago |
![]() |
2c2e09704d | 1 month ago |
![]() |
2ec1bc76a4 | 1 month ago |
![]() |
925592aa81 | 1 month ago |
![]() |
f726c7c745 | 1 month ago |
![]() |
eb71b3aba1 | 1 month ago |
![]() |
61fa6f89d7 | 1 month ago |
![]() |
4b4b0495fa | 1 month ago |
![]() |
8ccde0b125 | 1 month ago |
![]() |
6eaa80172b | 1 month ago |
![]() |
fdcf26413c | 1 month ago |
![]() |
0a91cae33c | 1 month ago |
![]() |
d8f941f8ec | 1 month ago |
![]() |
502eba2552 | 1 month ago |
![]() |
7694c94feb | 1 month ago |
![]() |
7ff1bacb96 | 1 month ago |
![]() |
4fd8b07cc6 | 1 month ago |
![]() |
6755e63274 | 1 month ago |
@ -0,0 +1,208 @@
|
||||
kind: pipeline
|
||||
type: docker
|
||||
name: CI_ApiPm
|
||||
|
||||
|
||||
trigger:
|
||||
event:
|
||||
- push
|
||||
- pull_request
|
||||
- tag
|
||||
branch:
|
||||
exclude:
|
||||
- master
|
||||
|
||||
volumes:
|
||||
- name: docs
|
||||
temp: {}
|
||||
|
||||
steps:
|
||||
- name: restore & build
|
||||
image: mcr.microsoft.com/dotnet/sdk:8.0
|
||||
commands:
|
||||
- dotnet build WF_EF_Api/WF_EF_Api.sln --configuration Release
|
||||
depends_on: [clone]
|
||||
|
||||
- name: test
|
||||
image: mcr.microsoft.com/dotnet/sdk:8.0
|
||||
commands:
|
||||
- dotnet test WF_EF_Api/XUnitTest/XUnitTest.csproj
|
||||
depends_on: [restore & build]
|
||||
|
||||
- name: publish
|
||||
image: mcr.microsoft.com/dotnet/sdk:8.0
|
||||
commands:
|
||||
- dotnet publish WF_EF_Api/WfApi/WfApi.csproj -c Release -o out
|
||||
depends_on: [restore & build, test]
|
||||
|
||||
---
|
||||
|
||||
kind: pipeline
|
||||
type: docker
|
||||
name: CI_ApiPm_Master
|
||||
|
||||
trigger:
|
||||
event:
|
||||
- push
|
||||
branch:
|
||||
- master
|
||||
|
||||
volumes:
|
||||
- name: doc
|
||||
temp: {}
|
||||
|
||||
steps:
|
||||
- name: restore & build
|
||||
image: mcr.microsoft.com/dotnet/sdk:8.0
|
||||
commands:
|
||||
- dotnet build WF_EF_Api/WF_EF_Api.sln --configuration Release
|
||||
depends_on: [clone]
|
||||
|
||||
- name: test
|
||||
image: mcr.microsoft.com/dotnet/sdk:8.0
|
||||
commands:
|
||||
- dotnet test WF_EF_Api/XUnitTest/XUnitTest.csproj
|
||||
depends_on: [restore & build]
|
||||
|
||||
- name: generate doc
|
||||
image: mcr.microsoft.com/dotnet/sdk:8.0
|
||||
volumes:
|
||||
- name: doc
|
||||
path: /doc
|
||||
commands:
|
||||
- dotnet new tool-manifest
|
||||
- dotnet tool install NSwag.ConsoleCore
|
||||
- dotnet restore WF_EF_Api/WF_EF_Api.sln
|
||||
- dotnet clean WF_EF_Api/WfApi/WfApi.csproj
|
||||
- cd WF_EF_Api/WfApi
|
||||
- dotnet nswag aspnetcore2openapi /output:/doc/swagger.json
|
||||
depends_on: [clone, restore & build , test]
|
||||
|
||||
- name: code-inspection
|
||||
image: hub.codefirst.iut.uca.fr/marc.chevaldonne/codefirst-dronesonarplugin-dotnet8
|
||||
secrets: [ SECRET_SONAR_LOGIN ]
|
||||
environment:
|
||||
sonar_host: https://codefirst.iut.uca.fr/sonar/
|
||||
sonar_token_wtf:
|
||||
from_secret: SECRET_SONAR_LOGIN
|
||||
project_key: wtf-service
|
||||
commands:
|
||||
- dotnet restore WF_EF_Api/WF_EF_Api.sln
|
||||
- dotnet sonarscanner begin /k:$${project_key} /d:sonar.host.url=$${sonar_host} /d:sonar.coverageReportPaths="coveragereport/SonarQube.xml" /d:sonar.login=$${sonar_token_wtf}
|
||||
- dotnet build WF_EF_Api/WF_EF_Api.sln -c Release --no-restore
|
||||
- dotnet test WF_EF_Api/XUnitTest/XUnitTest.csproj --logger trx --no-restore /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura --collect "XPlat Code Coverage"
|
||||
- reportgenerator -reports:"**/coverage.cobertura.xml" -reporttypes:SonarQube -targetdir:"coveragereport"
|
||||
- dotnet sonarscanner end /d:sonar.login=$${sonar_token_wtf}
|
||||
depends_on: [test,generate doc]
|
||||
|
||||
- name: publish
|
||||
image: mcr.microsoft.com/dotnet/sdk:8.0
|
||||
commands:
|
||||
- dotnet publish WF_EF_Api/WfApi/WfApi.csproj -c Release -o out
|
||||
depends_on: [restore & build, test]
|
||||
|
||||
- name: deploy-api-db
|
||||
image: hub.codefirst.iut.uca.fr/thomas.bellembois/codefirst-dockerproxy-clientdrone:latest
|
||||
environment:
|
||||
IMAGENAME: postgres:16.8-alpine3.20
|
||||
CONTAINERNAME: wtf-api
|
||||
COMMAND: create
|
||||
PRIVATE: true
|
||||
CODEFIRST_CLIENTDRONE_ENV_POSTGRES_PASSWORD:
|
||||
from_secret: POSTGRES_PASSWORD_API
|
||||
CODEFIRST_CLIENTDRONE_ENV_POSTGRES_USER:
|
||||
from_secret: POSTGRES_USER_API
|
||||
CODEFIRST_CLIENTDRONE_ENV_POSTGRES_DB:
|
||||
from_secret: POSTGRES_DB_API
|
||||
ADMINS: kentinbrongniart,lenibeaulaton,kevinmondejar,louisguichard-montguers,maximerocher,tommynguyen2
|
||||
|
||||
- name: deploy-auth-db
|
||||
image: hub.codefirst.iut.uca.fr/thomas.bellembois/codefirst-dockerproxy-clientdrone:latest
|
||||
environment:
|
||||
IMAGENAME: postgres:16.8-alpine3.20
|
||||
CONTAINERNAME: wtf-api-auth
|
||||
COMMAND: create
|
||||
PRIVATE: true
|
||||
CODEFIRST_CLIENTDRONE_ENV_POSTGRES_PASSWORD:
|
||||
from_secret: POSTGRES_PASSWORD_AUTH
|
||||
CODEFIRST_CLIENTDRONE_ENV_POSTGRES_USER:
|
||||
from_secret: POSTGRES_USER_AUTH
|
||||
CODEFIRST_CLIENTDRONE_ENV_POSTGRES_DB:
|
||||
from_secret: POSTGRES_DB_AUTH
|
||||
ADMINS: kentinbrongniart,lenibeaulaton,kevinmondejar,louisguichard-montguers,maximerocher,tommynguyen2
|
||||
|
||||
- name: deploy-test-db
|
||||
image: hub.codefirst.iut.uca.fr/thomas.bellembois/codefirst-dockerproxy-clientdrone:latest
|
||||
environment:
|
||||
IMAGENAME: postgres:16.8-alpine3.20
|
||||
CONTAINERNAME: wtf-api-test
|
||||
COMMAND: create
|
||||
PRIVATE: true
|
||||
CODEFIRST_CLIENTDRONE_ENV_POSTGRES_PASSWORD: "test"
|
||||
CODEFIRST_CLIENTDRONE_ENV_POSTGRES_USER: "test"
|
||||
CODEFIRST_CLIENTDRONE_ENV_POSTGRES_DB: "wtf-test"
|
||||
ADMINS: kentinbrongniart,lenibeaulaton,kevinmondejar,louisguichard-montguers,maximerocher,tommynguyen2
|
||||
|
||||
|
||||
- name: update-database
|
||||
image: mcr.microsoft.com/dotnet/sdk:8.0
|
||||
#DB_PATH_AUTH: "WhatTheFantasy-wtf-api-auth"
|
||||
environment:
|
||||
HOST: "WhatTheFantasy-wtf-api-test"
|
||||
PASSWORD: "test"
|
||||
USER: "test"
|
||||
DB: "wtf-test"
|
||||
commands:
|
||||
- cd WF_EF_Api/StubbedContextLib
|
||||
- dotnet tool install --global dotnet-ef
|
||||
- export PATH="$PATH:/root/.dotnet/tools"
|
||||
- dotnet ef database update --connection "Host=$${HOST};Database=$${DB};Username=$${USER};Password=$${PASSWORD};"
|
||||
depends_on: [deploy-api-db,deploy-auth-db,deploy-test-db]
|
||||
|
||||
- name: publish-to-registry
|
||||
image: plugins/docker
|
||||
settings:
|
||||
dockerfile: WF_EF_Api/WfApi/Dockerfile
|
||||
context: WF_EF_Api/
|
||||
registry: hub.codefirst.iut.uca.fr
|
||||
repo: hub.codefirst.iut.uca.fr/whatthefantasy/wf-pmapi
|
||||
username:
|
||||
from_secret: SECRET_REGISTRY_USERNAME
|
||||
password:
|
||||
from_secret: SECRET_REGISTRY_PASSWORD
|
||||
depends_on: [restore & build, test, code-inspection, publish]
|
||||
|
||||
- name: deploy-container
|
||||
image: hub.codefirst.iut.uca.fr/thomas.bellembois/codefirst-dockerproxy-clientdrone:latest
|
||||
environment:
|
||||
IMAGENAME: hub.codefirst.iut.uca.fr/whatthefantasy/wf-pmapi:latest
|
||||
CONTAINERNAME: web-services
|
||||
COMMAND: create
|
||||
OVERWRITE: true
|
||||
CODEFIRST_CLIENTDRONE_ENV_DB_SERVER_API: "WhatTheFantasy-wtf-api"
|
||||
CODEFIRST_CLIENTDRONE_ENV_DB_USER_API:
|
||||
from_secret: POSTGRES_USER_API
|
||||
CODEFIRST_CLIENTDRONE_ENV_DB_PASSWORD_API:
|
||||
from_secret: POSTGRES_PASSWORD_API
|
||||
CODEFIRST_CLIENTDRONE_ENV_DB_DATABASE_API:
|
||||
from_secret: POSTGRES_DB_API
|
||||
|
||||
|
||||
CODEFIRST_CLIENTDRONE_ENV_DB_SERVER_AUTH: "WhatTheFantasy-wtf-api-auth"
|
||||
CODEFIRST_CLIENTDRONE_ENV_DB_USER_AUTH:
|
||||
from_secret: POSTGRES_USER_AUTH
|
||||
CODEFIRST_CLIENTDRONE_ENV_DB_PASSWORD_AUTH:
|
||||
from_secret: POSTGRES_PASSWORD_AUTH
|
||||
CODEFIRST_CLIENTDRONE_ENV_DB_DATABASE_AUTH:
|
||||
from_secret: POSTGRES_DB_AUTH
|
||||
|
||||
|
||||
#CODEFIRST_CLIENTDRONE_ENV_DB_SERVER_API_TEST: "WhatTheFantasy-wtf-api-test"
|
||||
CODEFIRST_CLIENTDRONE_ENV_DB_SERVER_API_TEST: "api-test"
|
||||
CODEFIRST_CLIENTDRONE_ENV_DB_USER_API_TEST: "test"
|
||||
CODEFIRST_CLIENTDRONE_ENV_DB_PASSWORD_API_TEST: "test"
|
||||
CODEFIRST_CLIENTDRONE_ENV_DB_DATABASE_API_TEST: "wtf-db-test"
|
||||
|
||||
|
||||
ADMINS: kentinbrongniart,lenibeaulaton,kevinmondejar,louisguichard-montguers,maximerocher,tommynguyen2
|
||||
depends_on: [restore & build, test, code-inspection, publish, publish-to-registry]
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,33 +0,0 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace WfApi.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("[controller]")]
|
||||
public class WeatherForecastController : ControllerBase
|
||||
{
|
||||
private static readonly string[] Summaries = new[]
|
||||
{
|
||||
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
|
||||
};
|
||||
|
||||
private readonly ILogger<WeatherForecastController> _logger;
|
||||
|
||||
public WeatherForecastController(ILogger<WeatherForecastController> logger)
|
||||
{
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
[HttpGet(Name = "GetWeatherForecast")]
|
||||
public IEnumerable<WeatherForecast> Get()
|
||||
{
|
||||
return Enumerable.Range(1, 5).Select(index => new WeatherForecast
|
||||
{
|
||||
Date = DateOnly.FromDateTime(DateTime.Now.AddDays(index)),
|
||||
TemperatureC = Random.Shared.Next(-20, 55),
|
||||
Summary = Summaries[Random.Shared.Next(Summaries.Length)]
|
||||
})
|
||||
.ToArray();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
namespace WfApi
|
||||
{
|
||||
public class WeatherForecast
|
||||
{
|
||||
public DateOnly Date { get; set; }
|
||||
|
||||
public int TemperatureC { get; set; }
|
||||
|
||||
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
|
||||
|
||||
public string? Summary { get; set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,283 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Moq;
|
||||
|
||||
|
||||
using WfApi.Controllers;
|
||||
using Shared;
|
||||
using DTO;
|
||||
|
||||
namespace XUnitTest
|
||||
{
|
||||
public class UnitTest1
|
||||
{
|
||||
//private readonly Mock<IUserService<UserDTO>> _mockUserService;
|
||||
//private readonly Mock<ILogger<UsersController>> _mockLogger;
|
||||
//private readonly UsersController _userController;
|
||||
|
||||
//public UnitTest1()
|
||||
//{
|
||||
// // Initialisation des mocks
|
||||
// _mockUserService = new Mock<IUserService<UserDTO>>();
|
||||
// _mockLogger = new Mock<ILogger<UsersController>>();
|
||||
// _userController = new UsersController(_mockUserService.Object, _mockLogger.Object);
|
||||
//}
|
||||
|
||||
|
||||
|
||||
//[Fact]
|
||||
//public async Task Get_ReturnsOk_WhenUserExists()
|
||||
//{
|
||||
// // Arrange
|
||||
// var userId = 1;
|
||||
// var userDTO = new UserDTO
|
||||
// {
|
||||
// Id = userId,
|
||||
// Pseudo = "test",
|
||||
// Email = "test@unitaire.fr",
|
||||
// ImageProfil = "http://test",
|
||||
// Password = "1234"
|
||||
// };
|
||||
|
||||
// _mockUserService.Setup(service => service.GetUserById(userId)).ReturnsAsync(userDTO);
|
||||
|
||||
// // Act
|
||||
// var result = await _userController.Get(userId);
|
||||
|
||||
// // Assert
|
||||
// Assert.IsType<OkObjectResult>(result);
|
||||
//}
|
||||
|
||||
|
||||
|
||||
|
||||
//[Fact]
|
||||
//public async Task GetAllUsers_ReturnsOk()
|
||||
//{
|
||||
// // Arrange
|
||||
// var userDTO = new UserDTO
|
||||
// {
|
||||
// Id = 1,
|
||||
// Pseudo = "test",
|
||||
// Email = "test@unitaire.fr",
|
||||
// ImageProfil = "http://test",
|
||||
// Password = "1234"
|
||||
// };
|
||||
// var userDTO2 = new UserDTO
|
||||
// {
|
||||
// Id = 2,
|
||||
// Pseudo = "test",
|
||||
// Email = "test@unitaire.fr",
|
||||
// ImageProfil = "http://test",
|
||||
// Password = "1234"
|
||||
// };
|
||||
|
||||
// _mockUserService.Setup(service => service.GetUserById(1)).ReturnsAsync(userDTO);
|
||||
// _mockUserService.Setup(service => service.GetUserById(2)).ReturnsAsync(userDTO);
|
||||
|
||||
// // Act
|
||||
// var result = await _userController.GetAllUsers();
|
||||
|
||||
// // Assert
|
||||
// Assert.IsType<OkObjectResult>(result);
|
||||
//}
|
||||
|
||||
|
||||
|
||||
//[Fact]
|
||||
//public async Task GetHashPassword_ReturnsOk_WhenPasswordHashIsFound()
|
||||
//{
|
||||
// // Arrange
|
||||
// var username = "testUser";
|
||||
// var expectedHash = "hashedPassword";
|
||||
|
||||
// var taskResult = Task.FromResult(expectedHash);
|
||||
// _mockUserService.Setup(service => service.GetHashPassword(username)).Returns(taskResult);
|
||||
|
||||
// // Act
|
||||
// var result = await _userController.GetHashPassword(username);
|
||||
|
||||
// // Assert
|
||||
// Assert.IsType<OkObjectResult>(result);
|
||||
//}
|
||||
|
||||
//[Fact]
|
||||
//public async Task GetUserByUsername_ReturnsOk_WhenPasswordHashIsFound()
|
||||
//{
|
||||
// // Arrange
|
||||
// var username = "testUser";
|
||||
// var userDTO = new UserDTO
|
||||
// {
|
||||
// Id = 1,
|
||||
// Pseudo = "testUser",
|
||||
// Email = "test@unitaire.fr",
|
||||
// ImageProfil = "http://test",
|
||||
// Password = "1234"
|
||||
// };
|
||||
|
||||
// var taskResult = Task.FromResult(userDTO);
|
||||
// _mockUserService.Setup(service => service.GetUserByUsername(username)).Returns(taskResult);
|
||||
|
||||
// // Act
|
||||
// var result = await _userController.GetUserByUsername(username);
|
||||
|
||||
// // Assert
|
||||
// Assert.IsType<OkObjectResult>(result);
|
||||
//}
|
||||
|
||||
//[Fact]
|
||||
//public async Task GetUserByEmail_ReturnsOk_WhenUserExists()
|
||||
//{
|
||||
// // Arrange
|
||||
// var email = "test@unitaire.fr";
|
||||
// var userDTO = new UserDTO
|
||||
// {
|
||||
// Id = 1,
|
||||
// Pseudo = "testUser",
|
||||
// Email = email,
|
||||
// ImageProfil = "http://test",
|
||||
// Password = "1234"
|
||||
// };
|
||||
|
||||
|
||||
// var taskResult = Task.FromResult(userDTO);
|
||||
// _mockUserService.Setup(service => service.GetUserByEmail(email)).Returns(taskResult);
|
||||
|
||||
// // Act
|
||||
// var result = await _userController.GetUserByEmail(email);
|
||||
|
||||
// // Assert
|
||||
// Assert.IsType<OkObjectResult>(result);
|
||||
//}
|
||||
|
||||
//[Fact]
|
||||
//public async Task GetCountUser_ReturnsOk_WhenCountIsSuccessful()
|
||||
//{
|
||||
// // Arrange
|
||||
// var expectedCount = 5;
|
||||
// var taskResult = Task.FromResult(expectedCount);
|
||||
|
||||
// _mockUserService.Setup(service => service.CountUser()).Returns(taskResult);
|
||||
|
||||
// // Act
|
||||
// var result = await _userController.GetCountUser();
|
||||
|
||||
// // Assert
|
||||
// Assert.IsType<OkObjectResult>(result);
|
||||
//}
|
||||
|
||||
//[Fact]
|
||||
//public async Task GetExistUsername_ReturnsOk_WhenUserExists()
|
||||
//{
|
||||
// // Arrange
|
||||
// var username = "testUser";
|
||||
// var taskResult = Task.FromResult(true);
|
||||
|
||||
|
||||
// _mockUserService.Setup(service => service.ExistUsername(username)).Returns(taskResult);
|
||||
|
||||
// // Act
|
||||
// var result = await _userController.GetExistUsername(username);
|
||||
|
||||
// // Assert
|
||||
// Assert.IsType<OkObjectResult>(result);
|
||||
|
||||
//}
|
||||
|
||||
//[Fact]
|
||||
//public async Task GetExistEmail_ReturnsOk_WhenEmailExists()
|
||||
//{
|
||||
// // Arrange
|
||||
// var email = "test@unitaire.fr";
|
||||
// var taskResult = Task.FromResult(true);
|
||||
|
||||
// _mockUserService.Setup(service => service.ExistEmail(email)).Returns(taskResult);
|
||||
|
||||
// // Act
|
||||
// var result = await _userController.GetExistEmail(email);
|
||||
|
||||
// // Assert
|
||||
// Assert.IsType<OkObjectResult>(result);
|
||||
|
||||
//}
|
||||
//[Fact]
|
||||
//public async Task UpdateUser_ReturnsOk_WhenUserDataIsValid()
|
||||
//{
|
||||
// // Arrange
|
||||
// var id = 1;
|
||||
// var updatedUser = new UserDTO
|
||||
// {
|
||||
// Id = id,
|
||||
// Pseudo = "UpdatedUser",
|
||||
// Email = "updated@unitaire.fr",
|
||||
// ImageProfil = "http://updatedImage.com",
|
||||
// Password = "newPassword123"
|
||||
// };
|
||||
|
||||
// var taskResult = Task.FromResult(updatedUser);
|
||||
|
||||
// _mockUserService.Setup(service => service.UpdateUser(id, updatedUser)).Returns(taskResult);
|
||||
|
||||
// // Act
|
||||
// var result = await _userController.UpdateUser(id, updatedUser);
|
||||
|
||||
// // Assert
|
||||
// var okResult = Assert.IsType<OkObjectResult>(result);
|
||||
|
||||
// Assert.IsType<OkObjectResult>(result);
|
||||
//}
|
||||
//[Fact]
|
||||
//public async Task CreateUser_ReturnsCreatedAtAction_WhenUserIsValid()
|
||||
//{
|
||||
// // Arrange
|
||||
// var newUser = new UserDTO
|
||||
// {
|
||||
// Id = 2,
|
||||
// Pseudo = "NewUser",
|
||||
// Email = "newuser@unitaire.fr",
|
||||
// ImageProfil = "http://newuserimage.com",
|
||||
// Password = "newPassword123"
|
||||
// };
|
||||
|
||||
// _mockUserService.Setup(service => service.GetUserById(newUser.Id)).ReturnsAsync((UserDTO)null);
|
||||
|
||||
// _mockUserService.Setup(service => service.AddUser(newUser)).Verifiable();
|
||||
|
||||
// // Act
|
||||
// var result = await _userController.CreateUser(newUser);
|
||||
|
||||
// // Assert
|
||||
// var createdResult = Assert.IsType<CreatedAtActionResult>(result);
|
||||
// Assert.Equal(newUser.Id, createdResult.RouteValues["id"]);
|
||||
//}
|
||||
|
||||
|
||||
//[Fact]
|
||||
//public async Task DeletePlayer_ReturnsOk_WhenPlayerExists()
|
||||
//{
|
||||
// // Arrange
|
||||
// var id = 1;
|
||||
// var existingPlayer = new UserDTO
|
||||
// {
|
||||
// Id = id,
|
||||
// Pseudo = "ExistingUser",
|
||||
// Email = "existing@unitaire.fr",
|
||||
// ImageProfil = "http://existingimage.com",
|
||||
// Password = "existingPassword123"
|
||||
// };
|
||||
|
||||
// _mockUserService.Setup(service => service.GetUserById(id)).ReturnsAsync(existingPlayer);
|
||||
|
||||
// _mockUserService.Setup(service => service.RemoveUser(existingPlayer.Id)).Verifiable();
|
||||
|
||||
// // Act
|
||||
// var result = await _userController.DeletePlayer(id);
|
||||
|
||||
// // Assert
|
||||
// Assert.IsType<OkObjectResult>(result);
|
||||
|
||||
//}
|
||||
|
||||
|
||||
}
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
namespace XUnitTest
|
||||
{
|
||||
public class UnitTest1
|
||||
{
|
||||
[Fact]
|
||||
public void Test1()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in new issue