Refactoring and Adding Tests (#58)
* Moving Identity seeding to its own class and method. * Adding tests for AddItem * Added catalog api controller and functional tests Added and cleaned up some comments * Adding integration tests for OrderRepository * Getting integration test for order working with inmemory db
This commit is contained in:
10
src/Web/Controllers/Api/BaseApiController.cs
Normal file
10
src/Web/Controllers/Api/BaseApiController.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
using Microsoft.eShopWeb.Services;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Microsoft.eShopWeb.Controllers.Api
|
||||
{
|
||||
[Route("api/[controller]/[action]")]
|
||||
public class BaseApiController : Controller
|
||||
{ }
|
||||
}
|
||||
21
src/Web/Controllers/Api/CatalogController.cs
Normal file
21
src/Web/Controllers/Api/CatalogController.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using Microsoft.eShopWeb.Services;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Microsoft.eShopWeb.Controllers.Api
|
||||
{
|
||||
public class CatalogController : BaseApiController
|
||||
{
|
||||
private readonly ICatalogService _catalogService;
|
||||
|
||||
public CatalogController(ICatalogService catalogService) => _catalogService = catalogService;
|
||||
|
||||
[HttpGet]
|
||||
public async Task<IActionResult> List(int? brandFilterApplied, int? typesFilterApplied, int? page)
|
||||
{
|
||||
var itemsPage = 10;
|
||||
var catalogModel = await _catalogService.GetCatalogItems(page ?? 0, itemsPage, brandFilterApplied, typesFilterApplied);
|
||||
return Ok(catalogModel);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user