Merge branch 'master' of https://codefirst.iut.uca.fr/git/jade.van_brabandt/3.01-QCM_MuscuMaths
continuous-integration/drone/push Build is passing Details

Multiplayer_Php
Maxence GUITARD 1 year ago
commit d6dd6afe7d

@ -19,10 +19,7 @@ steps:
commands:
- cd Blazor/
- dotnet restore Blazor.sln
- dotnet sonarscanner begin /k:MuscuMaths /d:sonar.host.url=$${PLUGIN_SONAR_HOST} /d:sonar.login=$${PLUGIN_SONAR_TOKEN}
- dotnet test Blazor.sln --logger trx --no-restore /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura --collect "XPlat Code Coverage"
- reportgenerator -reports:"/coverage.cobertura.xml" -reporttypes:SonarQube -targetdir:"coveragereport" -verbosity:Verbose
- dotnet test Blazor.sln --no-restore
depends_on: [build]
- name: code-analysis
@ -30,8 +27,11 @@ steps:
commands:
- cd Blazor/
- dotnet restore Blazor.sln
- dotnet sonarscanner begin /k:MuscuMaths /d:sonar.host.url=$${PLUGIN_SONAR_HOST} /d:sonar.login=$${PLUGIN_SONAR_TOKEN} /d:sonar.coverageReportPaths="coveragereport/SonarQube.xml"
- dotnet sonarscanner begin /k:MuscuMaths /d:sonar.host.url=$${PLUGIN_SONAR_HOST} /d:sonar.login=$${PLUGIN_SONAR_TOKEN}
- dotnet build Blazor.sln -c Release --no-restore
- dotnet test Blazor.sln --logger trx --no-restore /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura --collect "XPlat Code Coverage"
- reportgenerator -reports:"**/coverage.cobertura.xml" -reporttypes:SonarQube -targetdir:"coveragereport" -verbosity:Verbose
- dotnet publish Blazor.sln -c Release --no-restore -o $CI_PROJECT_DIR/build/release
- dotnet sonarscanner end /d:sonar.login=$${PLUGIN_SONAR_TOKEN}
secrets: [ PLUGIN_SONAR_TOKEN ]

@ -1,25 +1,31 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.8.34330.188
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Blazor", "Blazor\Blazor.csproj", "{F9B19564-ED8F-49F7-97D7-2132F92DE3C2}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{F9B19564-ED8F-49F7-97D7-2132F92DE3C2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F9B19564-ED8F-49F7-97D7-2132F92DE3C2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F9B19564-ED8F-49F7-97D7-2132F92DE3C2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F9B19564-ED8F-49F7-97D7-2132F92DE3C2}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {75BB0A32-C002-4B33-88B3-421A9369D9CB}
EndGlobalSection
EndGlobal

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.8.34330.188
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Blazor", "Blazor\Blazor.csproj", "{F9B19564-ED8F-49F7-97D7-2132F92DE3C2}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test", "Test\Test.csproj", "{FC6D090C-6922-4F72-8DD2-AE8FEDD773A5}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{F9B19564-ED8F-49F7-97D7-2132F92DE3C2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F9B19564-ED8F-49F7-97D7-2132F92DE3C2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F9B19564-ED8F-49F7-97D7-2132F92DE3C2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F9B19564-ED8F-49F7-97D7-2132F92DE3C2}.Release|Any CPU.Build.0 = Release|Any CPU
{FC6D090C-6922-4F72-8DD2-AE8FEDD773A5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FC6D090C-6922-4F72-8DD2-AE8FEDD773A5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FC6D090C-6922-4F72-8DD2-AE8FEDD773A5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FC6D090C-6922-4F72-8DD2-AE8FEDD773A5}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {75BB0A32-C002-4B33-88B3-421A9369D9CB}
EndGlobalSection
EndGlobal

@ -0,0 +1 @@
<button type="button" class="btn btn-primary mb-2" @onclick="Back">Retour</button>

@ -0,0 +1,18 @@
using Microsoft.AspNetCore.Components;
namespace Blazor.Components
{
public partial class BackButton
{
[Parameter]
public string RedirectionPage { get; set; }
[Inject]
public required NavigationManager NavigationManager { get; set; }
private void Back()
{
NavigationManager.NavigateTo(RedirectionPage, true);
}
}
}

@ -0,0 +1,6 @@

<div class="card text-center">
@CardHeader
@CardBody
@CardFooter
</div>

@ -0,0 +1,16 @@
using Microsoft.AspNetCore.Components;
namespace Blazor.Components
{
public partial class CardViewQuestion
{
[Parameter]
public RenderFragment CardBody { get; set; }
[Parameter]
public RenderFragment CardFooter { get; set; }
[Parameter]
public RenderFragment CardHeader { get; set; }
}
}

@ -1,32 +0,0 @@
@page "/displayquestions/{QuestionId:int}"
@if (question != null)
{
<div class="text-center pb-2">
<h3>Question n°@question.Id</h3>
</div>
<div class="text-center pb-5 mt-3">
<h5>@question.Content</h5>
</div>
<div class="container-fluid text-center justify-content-center row">
@foreach (var answer in answers)
{
<div class="col-3 text-center">
@if (answer.Id == question.IdAnswerGood)
{
<p class="text-success"><strong>@answer.Content</strong></p>
}
else
{
<p class="text-danger">@answer.Content</p>
}
</div>
}
</div>
}
else
{
<p>Question not found</p>
}

@ -1,21 +1,31 @@
@page "/editAdministrator/{Id:int}"
<h3>EditAdministrator</h3>
@using Blazor.Components;
<EditForm Model="@administratorModel" OnValidSubmit="@HandleValidSubmit">
<DataAnnotationsValidator />
<ValidationSummary />
<BackButton RedirectionPage="/administrators"></BackButton>
<p>
<label for="username">
Username:
<InputText id="username" @bind-Value="administratorModel.Username" />
</label>
<label for="hashedPassword">
Password:
<InputText id="hashedPassword" @bind-Value="administratorModel.HashedPassword" />
</label>
</p>
<div class="container text-center">
<div class="border border-dark p-4 d-inline-block">
<h3>EditAdministrator</h3>
<button type="submit">Submit</button>
</EditForm>
<EditForm Model="@administratorModel" OnValidSubmit="@HandleValidSubmit">
<DataAnnotationsValidator />
<ValidationSummary />
<div class="row mb-2">
<label for="username">
Username:
<InputText id="username" @bind-Value="administratorModel.Username" />
</label>
</div>
<div class="row mb-2">
<label for="hashedPassword">
Password:
<InputText id="hashedPassword" @bind-Value="administratorModel.HashedPassword" />
</label>
</div>
<button type="submit" class="btn btn-success mb-2">Submit</button>
</EditForm>
</div>
</div>

@ -1,18 +1,27 @@
@page "/editChapter/{Id:int}"
<h3>Edit Chapter</h3>
<EditForm Model="@chapterModel" OnValidSubmit="@HandleValidSubmit">
<DataAnnotationsValidator />
<ValidationSummary />
<p>
<label for="name">
Name:
<InputText id="name" @bind-Value="chapterModel.Name" />
</label>
</p>
<button type="submit">Submit</button>
</EditForm>
@using Blazor.Components;
<BackButton RedirectionPage="/chapters"></BackButton>
<div class="container text-center">
<div class="border border-dark p-4 d-inline-block">
<h3>Edit Chapter</h3>
<EditForm Model="@chapterModel" OnValidSubmit="@HandleValidSubmit">
<DataAnnotationsValidator />
<ValidationSummary />
<p>
<label for="name">
Name:
<InputText id="name" @bind-Value="chapterModel.Name" />
</label>
</p>
<button type="submit" class="btn btn-success mb-2">Submit</button>
</EditForm>
</div>
</div>

@ -1,21 +1,31 @@
@page "/editPlayer/{Id:int}"
<h3>Edit Player</h3>
@using Blazor.Components;
<EditForm Model="@playerModel" OnValidSubmit="@HandleValidSubmit">
<DataAnnotationsValidator />
<ValidationSummary />
<BackButton RedirectionPage="/players"></BackButton>
<p>
<label for="nickname">
Nickname:
<InputText id="nickname" @bind-Value="playerModel.Nickname" />
</label>
<label for="hashedPassword">
Password:
<InputText id="hashedPassword" @bind-Value="playerModel.HashedPassword" />
</label>
</p>
<div class="container text-center">
<div class="border border-dark p-4 d-inline-block">
<h3>Edit Player</h3>
<button type="submit">Submit</button>
</EditForm>
<EditForm Model="@playerModel" OnValidSubmit="@HandleValidSubmit">
<DataAnnotationsValidator />
<ValidationSummary />
<div class="row mb-2">
<label for="nickname">
Nickname:
<InputText id="nickname" @bind-Value="playerModel.Nickname" />
</label>
</div>
<div class="row mb-2"
<label for="hashedPassword">
Password:
<InputText id="hashedPassword" @bind-Value="playerModel.HashedPassword" />
</label>
</div>
<button type="submit" class="btn btn-success">Submit</button>
</EditForm>
</div>
</div>

@ -0,0 +1,37 @@
@page "/displayquestions/{QuestionId:int}"
@using Blazor.Components;
<CardViewQuestion>
<CardHeader>
<div class="text-center pb-2">
<h3>Question n°@question.Id</h3>
</div>
<div class="text-center pb-5 mt-3">
<h5>@question.Content</h5>
</div>
</CardHeader>
<CardBody>
<div class="container-fluid text-center justify-content-center row">
@foreach (var answer in answers)
{
<div class="col-3 text-center">
@if (answer.Id == question.IdAnswerGood)
{
<p class="text-success"><strong>@answer.Content</strong></p>
}
else
{
<p class="text-danger">@answer.Content</p>
}
</div>
}
</div>
</CardBody>
<CardFooter>
<div class="card-footer text-muted">
Chapitre : @question.ChapterName
</div>
<BackButton RedirectionPage="/questions"></BackButton>
</CardFooter>
</CardViewQuestion>

@ -1,11 +1,10 @@
using Blazor.Models;
using Blazor.Pages;
using Blazor.Pages.Questions;
using Blazor.ViewClasses;
using Microsoft.AspNetCore.Components;
using static System.Net.WebRequestMethods;
namespace Blazor.Components
namespace Blazor.Pages.Questions
{
public partial class DisplayQuestions
{
@ -30,7 +29,7 @@ namespace Blazor.Components
IEnumerable<Question> foundQuestions = questions.Where(q => q.Id == QuestionId);
foreach (var q in foundQuestions)
{
answers.Add(new Answer(q.A_id, q.A_content, q.Id));

@ -0,0 +1 @@
global using Microsoft.VisualStudio.TestTools.UnitTesting;

@ -0,0 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.0" />
<PackageReference Include="MSTest.TestAdapter" Version="3.0.4" />
<PackageReference Include="MSTest.TestFramework" Version="3.0.4" />
<PackageReference Include="coverlet.collector" Version="6.0.0" />
</ItemGroup>
</Project>

@ -0,0 +1,11 @@
namespace Test
{
[TestClass]
public class UnitTest1
{
[TestMethod]
public void TestMethod1()
{
}
}
}
Loading…
Cancel
Save