public void After_Failed_Transaction_Returns_Failed_Result() { var command = new LoadDataForListViewQuery(); var handler = new LoadDataForListViewQueryHandler(_unitOfWorkMock.Object); _unitOfWorkMock .Setup(m => m.Workers.GetAllWorkersWithEmployers()) .Returns(() => throw new InvalidOperationException()); var result = handler.Handle(command); Assert.True(result.IsFailure); }
public void After_Successful_Transaction_Return_Success_Result_With_Data() { var command = new LoadDataForListViewQuery(); var handler = new LoadDataForListViewQueryHandler(_unitOfWorkMock.Object); _unitOfWorkMock .Setup(m => m.Workers.GetAllWorkersWithEmployers()) .Returns(new List <Worker>()); var result = handler.Handle(command); Assert.True(result.IsSuccess); Assert.NotNull(result.Value); }