Skip to content

Instantly share code, notes, and snippets.

@dcomartin
Created May 26, 2021 21:48
Show Gist options
  • Save dcomartin/877a6531c764e068935bf8e17ae26398 to your computer and use it in GitHub Desktop.
Save dcomartin/877a6531c764e068935bf8e17ae26398 to your computer and use it in GitHub Desktop.
[Fact]
public async Task Test()
{
var sku = Guid.NewGuid().ToString();
var mockProductService = new Mock<IProductService>();
mockProductService
.Setup(x => x.GetProductBySku(sku))
.Returns(Task.FromResult(new Product()
{
Sku = sku
}));
var sut = new GetProductBySkuHandler(mockProductService.Object);
var result = await sut.Handle(new GetProductBySkuRequest(sku), CancellationToken.None);
result.Sku.ShouldBe(sku);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment