You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

58 lines
1.3 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

using API.Controllers;
using API.Dto;
using Microsoft.AspNetCore.Mvc;
using System.Collections.Generic;
namespace TestProject1
{
public class Tests
{
[SetUp]
public void Setup()
{
}
[Test]
public void TestGET()
{
//Arrange
//Act
var championResult = ChampionController.get();
//Assert
var objectResult = championResult as OkObjectResult;
//vérifie que cest un ok 200 et un objet
Assert.IsNotNull(objectResult);
var champions = objectResult?.value as IEnumerable<ChampionDto>;
Assert.IsNotNull(champions);
Assert.AreEqual(champions.count(), (await stubData.championsMgr.getItems(0, 5)).Count());
}
[Test]
public void TestPOST()
{
//Arrange
var championDto = new ChampionDto()
{
Name = "Darius"
};
//Act
var championResult = await ChampionController.post(championDto);
//Assert
var objectResult = championResult as CreatedAtActionResult;
Assert.IsNotNull(objectResult);
var champions = objectResult?.value as ChampionDto;
Assert.IsNotNull(champions);
}
}
}