Update Project

pull/10/head
Louwar 2 years ago
parent 37a380fed9
commit 6fd96637f5

Binary file not shown.

After

Width:  |  Height:  |  Size: 83 KiB

@ -29,6 +29,14 @@ namespace API.Controllers
this.dataManager = datamanager;
}
/* public championHttpManager(HttpClient client)
{
_client = client;
client.BaseAddress = new Uri("à chopper dans lauchSettings.json propriété du projet");
}
*/
/**** Méthodes GET ****/
[HttpGet]
public async Task<ActionResult<ChampionDto>> Get()
{
@ -58,10 +66,6 @@ namespace API.Controllers
.ToArray());
}
static async Task GetJsonData()
{
using var client = new HttpClient();
@ -92,35 +96,32 @@ namespace API.Controllers
}
}
/* public async Task<IEnumerable<ChampionDto>> getJson()
{
var champions = await _client.GetFromJsonAsync<IEnumerable<ChampionDto>>();
var reponse = await _cleint.GetAscyn("api/champion");
return champions;
}*/
/**** Méthodes POST ****/
/*[HttpPost]
/* [HttpPost]
public async Task<IActionResult> post([FromBody] ChampionDto champion)
{
return CreatedAtAction(nameof(GetById), new { id = 1 },
await dataManager.ChampionsMgr.AddItem(champion.ToModel));
}
public championHttpManager(HttpClient client)
public async void addchampion(ChampionDto champion)
{
_client = client;
client.BaseAddress = new Uri("à chopper dans lauchSettings.json propriété du projet");
}
_clientLpostAsJsonAscync<Champion>(ApiChampion, champion);
}*/
/**** Méthodes DELETE ****/
public async Task<IEnumerable<ChampionDto>> getChampion()
{
var champions = await _client.GetFromJsonAsync<IEnumerable<ChampionDto>>();
var reponse = await _cleint.GetAscyn("api/champion") ;
return champions;
}
public async void addchampion(ChampionDto champion)
{
_clientLpostAsJsonAscync<Champion>(ApiChampion, champion);
}
*/
/**** Méthodes PUT ****/
}
}

@ -1,6 +1,7 @@
using API.Controllers;
using API.Dto;
using Microsoft.AspNetCore.Mvc;
using StubLib;
using System.Collections.Generic;
namespace TestProject1
@ -13,7 +14,7 @@ namespace TestProject1
}
[Test]
/*[Test]
public void TestGET()
{
//Arrange
@ -26,10 +27,10 @@ namespace TestProject1
//vérifie que cest un ok 200 et un objet
Assert.IsNotNull(objectResult);
var champions = objectResult?.value as IEnumerable<ChampionDto>;
var champions = objectResult?.Value as IEnumerable<ChampionDto>;
Assert.IsNotNull(champions);
Assert.AreEqual(champions.count(), (await stubData.championsMgr.getItems(0, 5)).Count());
Assert.AreEqual(champions.Count(), (await StubData.championsMgr.getItems(0, 5)).Count());
}
[Test]
@ -48,10 +49,10 @@ namespace TestProject1
var objectResult = championResult as CreatedAtActionResult;
Assert.IsNotNull(objectResult);
var champions = objectResult?.value as ChampionDto;
var champions = objectResult?.Value as ChampionDto;
Assert.IsNotNull(champions);
}
}*/
}

Loading…
Cancel
Save