Feature/migrate to minimal api (#662)
* migrate from classic controller to minimal api * fix all PublicApi integration test * update all nuget package add forget project * fix pay now * Adapt readme use in memory database * undo AuthenticateEndpoint to use EndpointBaseAsync * Update README.md Co-authored-by: Steve Smith <steve@kentsmiths.com> Co-authored-by: Steve Smith <steve@kentsmiths.com>
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
using Microsoft.eShopWeb;
|
||||
using Microsoft.eShopWeb.PublicApi.CatalogItemEndpoints;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using System.Net;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace PublicApiIntegrationTests.CatalogItemEndpoints
|
||||
{
|
||||
[TestClass]
|
||||
public class CatalogItemGetByIdEndpointTest
|
||||
{
|
||||
[TestMethod]
|
||||
public async Task ReturnsItemGivenValidId()
|
||||
{
|
||||
var response = await ProgramTest.NewClient.GetAsync("api/catalog-items/5");
|
||||
response.EnsureSuccessStatusCode();
|
||||
var stringResponse = await response.Content.ReadAsStringAsync();
|
||||
var model = stringResponse.FromJson<GetByIdCatalogItemResponse>();
|
||||
|
||||
Assert.AreEqual(5, model.CatalogItem.Id);
|
||||
Assert.AreEqual("Roslyn Red Sheet", model.CatalogItem.Name);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public async Task ReturnsNotFoundGivenInvalidId()
|
||||
{
|
||||
var response = await ProgramTest.NewClient.GetAsync("api/catalog-items/0");
|
||||
|
||||
Assert.AreEqual(HttpStatusCode.NotFound, response.StatusCode);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user