Fixed ordering unit test

This commit is contained in:
Ramón Tomás 2018-11-12 11:52:37 +01:00
parent 9b21ac109f
commit 9f5e7aee6c

View File

@ -10,6 +10,7 @@ using System.Threading.Tasks;
namespace UnitTest.Ordering.Application
{
using global::Ordering.API.Application.IntegrationEvents;
using global::Ordering.API.Application.Models;
using MediatR;
using System.Collections;
@ -22,12 +23,14 @@ namespace UnitTest.Ordering.Application
private readonly Mock<IOrderRepository> _orderRepositoryMock;
private readonly Mock<IIdentityService> _identityServiceMock;
private readonly Mock<IMediator> _mediator;
private readonly Mock<IOrderingIntegrationEventService> _orderingIntegrationEventService;
public NewOrderRequestHandlerTest()
{
_orderRepositoryMock = new Mock<IOrderRepository>();
_identityServiceMock = new Mock<IIdentityService>();
_orderingIntegrationEventService = new Mock<IOrderingIntegrationEventService>();
_mediator = new Mock<IMediator>();
}
@ -48,7 +51,7 @@ namespace UnitTest.Ordering.Application
_identityServiceMock.Setup(svc => svc.GetUserIdentity()).Returns(buyerId);
//Act
var handler = new CreateOrderCommandHandler(_mediator.Object, _orderRepositoryMock.Object, _identityServiceMock.Object);
var handler = new CreateOrderCommandHandler(_mediator.Object, _orderingIntegrationEventService.Object, _orderRepositoryMock.Object, _identityServiceMock.Object);
var cltToken = new System.Threading.CancellationToken();
var result = await handler.Handle(fakeOrderCmd, cltToken);