parent
2681d13de7
commit
1f0ee639ac
Binary file not shown.
@ -0,0 +1,62 @@
|
|||||||
|
using API_LoL_Project.Controllers;
|
||||||
|
using DTO;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Model;
|
||||||
|
using StubLib;
|
||||||
|
|
||||||
|
namespace TestProject1
|
||||||
|
{
|
||||||
|
[TestClass]
|
||||||
|
public class ChampionControllerTest
|
||||||
|
{
|
||||||
|
public readonly ChampionsController championCtrl;
|
||||||
|
|
||||||
|
public readonly IChampionsManager stubMgr;
|
||||||
|
public ChampionControllerTest()
|
||||||
|
{
|
||||||
|
stubMgr = new StubData().ChampionsMgr;
|
||||||
|
|
||||||
|
championCtrl = new ChampionsController(stubMgr);
|
||||||
|
}
|
||||||
|
|
||||||
|
[TestMethod]
|
||||||
|
public async Task TestGetChampions()
|
||||||
|
{
|
||||||
|
var getResult = await championCtrl.Get();
|
||||||
|
|
||||||
|
var objectRes = getResult as OkObjectResult;
|
||||||
|
|
||||||
|
Assert.IsNotNull(objectRes);
|
||||||
|
|
||||||
|
var champions = objectRes?.Value as IEnumerable<ChampionDTO>;
|
||||||
|
Assert.IsNotNull(champions);
|
||||||
|
|
||||||
|
Assert.AreEqual(champions.Count(), await stubMgr.GetNbItems());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
[TestMethod]
|
||||||
|
public async void TestPostChampions()
|
||||||
|
{
|
||||||
|
var chamionGetResul = championCtrl.Get();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
[TestMethod]
|
||||||
|
public async void TestUpdateChampions()
|
||||||
|
{
|
||||||
|
var chamionGetResul = championCtrl.Get();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
[TestMethod]
|
||||||
|
public async void TestDeleteChampions()
|
||||||
|
{
|
||||||
|
var chamionGetResul = championCtrl.Get();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,22 @@
|
|||||||
|
<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.1.0" />
|
||||||
|
<PackageReference Include="MSTest.TestAdapter" Version="2.2.8" />
|
||||||
|
<PackageReference Include="MSTest.TestFramework" Version="2.2.8" />
|
||||||
|
<PackageReference Include="coverlet.collector" Version="3.1.2" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\API_LoL_Project\API_LoL_Project.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
@ -0,0 +1,11 @@
|
|||||||
|
namespace TestProject1
|
||||||
|
{
|
||||||
|
[TestClass]
|
||||||
|
public class UnitTest1
|
||||||
|
{
|
||||||
|
[TestMethod]
|
||||||
|
public void TestMethod1()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1 @@
|
|||||||
|
global using Microsoft.VisualStudio.TestTools.UnitTesting;
|
@ -0,0 +1,46 @@
|
|||||||
|
using API_LoL_Project.Controllers;
|
||||||
|
using DTO;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Model;
|
||||||
|
using StubLib;
|
||||||
|
using System.Net;
|
||||||
|
|
||||||
|
namespace Test_Api
|
||||||
|
{
|
||||||
|
[TestClass]
|
||||||
|
public class ChampionControllerTest
|
||||||
|
{
|
||||||
|
public readonly ChampionsController championCtrl;
|
||||||
|
|
||||||
|
public readonly IDataManager stubMgr;
|
||||||
|
public ChampionControllerTest()
|
||||||
|
{
|
||||||
|
var stubMgr = new StubData();
|
||||||
|
|
||||||
|
championCtrl = new ChampionsController(stubMgr);
|
||||||
|
}
|
||||||
|
|
||||||
|
[TestMethod]
|
||||||
|
public async Task TestGetChampions()
|
||||||
|
{
|
||||||
|
var getResult = await championCtrl.Get();
|
||||||
|
Console.WriteLine(getResult);
|
||||||
|
var objectRes = getResult as OkObjectResult;
|
||||||
|
|
||||||
|
Assert.AreEqual(200, objectRes.StatusCode);
|
||||||
|
|
||||||
|
Assert.IsNotNull(objectRes);
|
||||||
|
|
||||||
|
var champions = objectRes?.Value as IEnumerable<ChampionDTO>;
|
||||||
|
|
||||||
|
Assert.IsNotNull(champions);
|
||||||
|
|
||||||
|
/*
|
||||||
|
Assert.AreEqual(champions.Count(), await stubMgr.ChampionsMgr.GetNbItems());*/
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,25 @@
|
|||||||
|
<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.1.0" />
|
||||||
|
<PackageReference Include="MSTest.TestAdapter" Version="2.2.8" />
|
||||||
|
<PackageReference Include="MSTest.TestFramework" Version="2.2.8" />
|
||||||
|
<PackageReference Include="coverlet.collector" Version="3.1.2" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\API_LoL_Project\API_LoL_Project.csproj" />
|
||||||
|
<ProjectReference Include="..\DTO\DTO.csproj" />
|
||||||
|
<ProjectReference Include="..\Model\Model.csproj" />
|
||||||
|
<ProjectReference Include="..\StubLib\StubLib.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
@ -0,0 +1 @@
|
|||||||
|
global using Microsoft.VisualStudio.TestTools.UnitTesting;
|
Loading…
Reference in new issue