parent
62e23ce924
commit
3c642ff5e3
Binary file not shown.
@ -0,0 +1,37 @@
|
|||||||
|
using apiLOL;
|
||||||
|
using apiLOL.Controllers;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using StubLib;
|
||||||
|
|
||||||
|
namespace TestUnitaire
|
||||||
|
{
|
||||||
|
public class TestAPILol
|
||||||
|
{
|
||||||
|
[Fact]
|
||||||
|
public void Test1()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void TestPostChampion()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
var data = new StubData();
|
||||||
|
var controller = new ControllerChampions(new StubData());
|
||||||
|
var champDTO = new ChampionDTO("Charles", "Charles est un champion de League of Legends");
|
||||||
|
|
||||||
|
// Act
|
||||||
|
var result = controller.Post(champDTO);
|
||||||
|
data.ChampionsMgr.AddItem(champDTO.ToModel());
|
||||||
|
var nbItem = data.ChampionsMgr.GetNbItems();
|
||||||
|
Task<int> nbItemTask = nbItem;
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
Assert.IsType<OkResult>(result);
|
||||||
|
// Verify that the champions is added to the stub
|
||||||
|
Assert.Equal(7, nbItemTask.Result);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,30 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
|
||||||
|
<IsPackable>false</IsPackable>
|
||||||
|
</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="..\apiLOL\apiLOL.csproj" />
|
||||||
|
<ProjectReference Include="..\EFLol\EFLol.csproj" />
|
||||||
|
<ProjectReference Include="..\StubLib\StubLib.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
@ -0,0 +1 @@
|
|||||||
|
global using Xunit;
|
Loading…
Reference in new issue