예제 #1
0
    public async Task WhenRetrievingEntities_ThenAllEntitiesShouldBeReturned()
    {
        _repositoryMock.Setup(x => x.GetAsync())
        .ReturnsAsync(new List <Order>
        {
            _mapper.Map <Order>(Orders.Order1),
            _mapper.Map <Order>(Orders.Order2)
        });

        var handler = new GetOrdersHandler(_repositoryMock.Object);

        var result = await handler.Handle(new GetOrders(), default);

        Assert.Collection(result,
                          c => Assert.Equal(OrderViews.Order1.Id, c.Id),
                          c => Assert.Equal(OrderViews.Order2.Id, c.Id));
    }