public async Task ByIdAsync_ReturnsExpectedValues()
        {
            const string supplier = "10000";

            var mockResult = new Mock <ISupplierResult>();

            mockResult.Setup(r => r.Id).Returns(supplier);

            // ReSharper disable StringLiteralTypo
            mockResult.Setup(r => r.Name).Returns("Kool Korp");

            // ReSharper restore StringLiteralTypo
            mockResult.Setup(r => r.AddressLine1).Returns("Address line 1");
            mockResult.Setup(r => r.PrimaryContactFirstName).Returns("Bob");
            mockResult.Setup(r => r.HasAddress).Returns(true);
            mockResult.Setup(r => r.HasContact).Returns(true);

            var expectedSupplier = mockResult.Object;

            var mockRepository = new Mock <ISupplierRepository>();

            mockRepository
            .Setup(r => r.GetSupplierById(supplier, It.IsAny <CancellationToken>()))
            .ReturnsAsync(expectedSupplier);

            var reader = new SupplierReader(mockRepository.Object);

            var actualSupplier = await reader.ByIdAsync(supplier, CancellationToken.None);

            actualSupplier.Id.Should().BeEquivalentTo(expectedSupplier.Id);
            actualSupplier.Name.Should().BeEquivalentTo(expectedSupplier.Name);
            actualSupplier.Address.Line1.Should().BeEquivalentTo(expectedSupplier.AddressLine1);
            actualSupplier.PrimaryContact.FirstName.Should().BeEquivalentTo(expectedSupplier.PrimaryContactFirstName);
        }
 public async Task <ISupplier> Handle(GetSupplierByIdQuery request, CancellationToken cancellationToken)
 {
     return(mapper.Map <ISupplier>(await reader.ByIdAsync(request.Id, cancellationToken)));
 }