First unit test

pull/2/head
nathan boileau 2 years ago
parent 840bc3a883
commit fa0512941c

@ -29,6 +29,11 @@ EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EFLol", "EFLol\EFLol.csproj", "{7AEE66D2-490B-4049-B9D3-C629D7F78DA7}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EFLol", "EFLol\EFLol.csproj", "{7AEE66D2-490B-4049-B9D3-C629D7F78DA7}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestUnitaireAPiLol", "TestUnitaireAPiLol\TestUnitaireAPiLol.csproj", "{AD7F3A69-AC84-42CA-BD7E-FB037DAB1581}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestUnitaireAPiLol", "TestUnitaireAPiLol\TestUnitaireAPiLol.csproj", "{AD7F3A69-AC84-42CA-BD7E-FB037DAB1581}"
ProjectSection(ProjectDependencies) = postProject
{2960F9BA-49DE-494D-92E3-CE5A794BA1A9} = {2960F9BA-49DE-494D-92E3-CE5A794BA1A9}
{65B824B5-FADB-4C89-8B4B-D541B62B7DCA} = {65B824B5-FADB-4C89-8B4B-D541B62B7DCA}
{B01D7EF2-2D64-409A-A29A-61FB7BB7A9DB} = {B01D7EF2-2D64-409A-A29A-61FB7BB7A9DB}
EndProjectSection
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution

@ -21,4 +21,8 @@
</PackageReference> </PackageReference>
</ItemGroup> </ItemGroup>
<ItemGroup>
<ProjectReference Include="..\apiLOL\apiLOL.csproj" />
</ItemGroup>
</Project> </Project>

@ -1,3 +1,8 @@
using apiLOL;
using apiLOL.Controllers;
using Microsoft.AspNetCore.Mvc;
using StubLib;
namespace TestUnitaireAPiLol namespace TestUnitaireAPiLol
{ {
public class UnitTest1 public class UnitTest1
@ -7,5 +12,20 @@ namespace TestUnitaireAPiLol
{ {
} }
[Fact]
public void TestPostChampion()
{
// Arrange
var controller = new ControllerChampions(new StubData());
var champDTO = new ChampionDTO("Charle", "Charle est un champion de League of Legends");
// Act
var result = controller.Post(champDTO);
// Assert
Assert.IsType<OkResult>(result);
}
} }
} }

@ -12,6 +12,8 @@ namespace apiLOL.Controllers
public class ControllerChampions : Controller public class ControllerChampions : Controller
{ {
private readonly IDataManager data; private readonly IDataManager data;
public ControllerChampions(IDataManager manager) public ControllerChampions(IDataManager manager)
{ {

Loading…
Cancel
Save