Skip to content

Instantly share code, notes, and snippets.

@dcomartin

dcomartin/TestInterface.cs Secret

Created May 26, 2021
Embed
What would you like to do?
[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