Make testing name scheme consistent (#395)
* Updating CahceHelperTests names * Updating OrdersTests names * Removing tests for "Include" functionality as it lives in a NuGet Package now * Updating Integration Test anems
This commit is contained in:
39
tests/UnitTests/MediatorHandlers/OrdersTests/GetMyOrders.cs
Normal file
39
tests/UnitTests/MediatorHandlers/OrdersTests/GetMyOrders.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
using Ardalis.Specification;
|
||||
using Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate;
|
||||
using Microsoft.eShopWeb.ApplicationCore.Interfaces;
|
||||
using Microsoft.eShopWeb.Web.Features.MyOrders;
|
||||
using Moq;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Xunit;
|
||||
|
||||
namespace Microsoft.eShopWeb.UnitTests.MediatorHandlers.OrdersTests
|
||||
{
|
||||
public class GetMyOrders
|
||||
{
|
||||
private readonly Mock<IOrderRepository> _mockOrderRepository;
|
||||
|
||||
public GetMyOrders()
|
||||
{
|
||||
var item = new OrderItem(new CatalogItemOrdered(1, "ProductName", "URI"), 10.00m, 10);
|
||||
var address = new Address(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>());
|
||||
Order order = new Order("buyerId", address, new List<OrderItem> { item });
|
||||
|
||||
_mockOrderRepository = new Mock<IOrderRepository>();
|
||||
_mockOrderRepository.Setup(x => x.ListAsync(It.IsAny<ISpecification<Order>>())).ReturnsAsync(new List<Order> { order });
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task NotReturnNullIfOrdersArePresent()
|
||||
{
|
||||
var request = new eShopWeb.Web.Features.MyOrders.GetMyOrders("SomeUserName");
|
||||
|
||||
var handler = new GetMyOrdersHandler(_mockOrderRepository.Object);
|
||||
|
||||
var result = await handler.Handle(request, CancellationToken.None);
|
||||
|
||||
Assert.NotNull(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user