fix merge conflicts
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
commit
e7ced7634d
@ -0,0 +1,71 @@
|
|||||||
|
kind: pipeline
|
||||||
|
type: docker
|
||||||
|
name: default
|
||||||
|
|
||||||
|
trigger:
|
||||||
|
event:
|
||||||
|
- push
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: build
|
||||||
|
image: mcr.microsoft.com/dotnet/sdk:7.0
|
||||||
|
volumes:
|
||||||
|
- name: docs
|
||||||
|
path: /docs
|
||||||
|
commands:
|
||||||
|
- cd MCTG/
|
||||||
|
- dotnet restore ./ConsoleApp/ConsoleApp.csproj
|
||||||
|
- dotnet restore ./Model/Model.csproj
|
||||||
|
- dotnet restore ./Tests/Model_UnitTests/Model_UnitTests.csproj
|
||||||
|
- dotnet build SAE-2.01.sln -c CI --no-restore
|
||||||
|
- dotnet publish SAE-2.01.sln -c CI --no-restore -o CI_PROJECT_DIR/build/release
|
||||||
|
|
||||||
|
- name: tests
|
||||||
|
image: mcr.microsoft.com/dotnet/sdk:7.0
|
||||||
|
commands:
|
||||||
|
- cd MCTG/
|
||||||
|
- dotnet restore ./ConsoleApp/ConsoleApp.csproj
|
||||||
|
- dotnet restore ./Model/Model.csproj
|
||||||
|
- dotnet restore ./Tests/Model_UnitTests/Model_UnitTests.csproj
|
||||||
|
- dotnet test SAE-2.01.sln -c CI --no-restore
|
||||||
|
depends_on: [ build ]
|
||||||
|
|
||||||
|
- name: code-analysis
|
||||||
|
image: hub.codefirst.iut.uca.fr/marc.chevaldonne/codefirst-dronesonarplugin-dotnet7
|
||||||
|
commands:
|
||||||
|
- cd MCTG/
|
||||||
|
- dotnet restore ./ConsoleApp/ConsoleApp.csproj
|
||||||
|
- dotnet restore ./Model/Model.csproj
|
||||||
|
- dotnet restore ./Tests/Model_UnitTests/Model_UnitTests.csproj
|
||||||
|
- dotnet sonarscanner begin /k:SAE-2.01 /d:sonar.host.url=$${PLUGIN_SONAR_HOST} /d:sonar.coverageReportPaths="coveragereport/SonarQube.xml" /d:sonar.coverage.exclusions="Tests/**" /d:sonar.login=$${PLUGIN_SONAR_TOKEN}
|
||||||
|
- dotnet build SAE-2.01.sln -c CI --no-restore
|
||||||
|
- dotnet test SAE-2.01.sln -c CI --logger trx --no-restore /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura --collect "XPlat Code Coverage"
|
||||||
|
- reportgenerator -reports:"**/coverage.cobertura.xml" -reporttypes:SonarQube -targetdir:"coveragereport"
|
||||||
|
- dotnet publish SAE-2.01.sln -c CI --no-restore -o CI_PROJECT_DIR/build/release
|
||||||
|
- dotnet sonarscanner end /d:sonar.login=$${PLUGIN_SONAR_TOKEN}
|
||||||
|
secrets: [ SECRET_SONAR_LOGIN ]
|
||||||
|
settings:
|
||||||
|
# accessible en ligne de commande par ${PLUGIN_SONAR_HOST}
|
||||||
|
sonar_host: https://codefirst.iut.uca.fr/sonar/
|
||||||
|
# accessible en ligne de commande par ${PLUGIN_SONAR_TOKEN}
|
||||||
|
sonar_token:
|
||||||
|
from_secret: SECRET_SONAR_LOGIN
|
||||||
|
depends_on: [ tests ]
|
||||||
|
|
||||||
|
- name: generate-and-deploy-docs
|
||||||
|
image: hub.codefirst.iut.uca.fr/thomas.bellembois/codefirst-docdeployer
|
||||||
|
failure: ignore
|
||||||
|
volumes:
|
||||||
|
- name: docs
|
||||||
|
path: /docs
|
||||||
|
commands:
|
||||||
|
- cd Doc/doxygen
|
||||||
|
- doxygen Doxyfile
|
||||||
|
when:
|
||||||
|
branch:
|
||||||
|
- master
|
||||||
|
depends_on: [ build ]
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
- name: docs
|
||||||
|
temp: {}
|
@ -0,0 +1,25 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net7.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
<IsPackable>false</IsPackable>
|
||||||
|
<IsTestProject>true</IsTestProject>
|
||||||
|
<Configurations>Debug;Release;CI</Configurations>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.2" />
|
||||||
|
<PackageReference Include="xunit" Version="2.4.2" />
|
||||||
|
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
|
||||||
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
</PackageReference>
|
||||||
|
<PackageReference Include="coverlet.collector" Version="3.1.2">
|
||||||
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
</PackageReference>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\..\Model\Model.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
@ -0,0 +1,26 @@
|
|||||||
|
using Model;
|
||||||
|
|
||||||
|
namespace Model_UnitTests
|
||||||
|
{
|
||||||
|
public class Recipe_UT
|
||||||
|
{
|
||||||
|
[Fact]
|
||||||
|
public void TestVoidConstructor()
|
||||||
|
{
|
||||||
|
Recipe r = new Recipe(id: 999); // id is given to avoid tests errors with the static atrribute 'idCreator'.
|
||||||
|
Assert.NotNull(r.Title);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Theory]
|
||||||
|
[InlineData("Cookies", 23, "Cookies", 23)]
|
||||||
|
[InlineData("Cookies", 1, "Cookies", 1)]
|
||||||
|
[InlineData("No title.", 1, "", 1)]
|
||||||
|
public void TestConstructor(string expectedTitle, int expectedId, string title, int? id)
|
||||||
|
{
|
||||||
|
Recipe r = new Recipe(title, id);
|
||||||
|
Assert.NotNull(r.Title);
|
||||||
|
Assert.Equal(expectedId, r.Id);
|
||||||
|
Assert.Equal(expectedTitle, r.Title);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1 @@
|
|||||||
|
global using Xunit;
|
Loading…
Reference in new issue