Skip to content

Instantly share code, notes, and snippets.

@explorer14

explorer14/UseCaseTest.cs

Last active Nov 17, 2018
Embed
What would you like to do?
public class WhenRunningProductReorderLevelUseCase
{
[Fact]
public async Task Given_Products_With_Values_When_UseCase_Is_Executed_Then_The_Calculated_ReorderLevel_Is_As_Expected()
{
var testProducts = TestData.SampleProductsWithExpectedReorderLevels();
var publisherStub = new StubPublisher();
var activeProductsStub = new StubRetrieveActiveProducts(
testProducts.Select(x => x.OriginalProduct).ToList());
var useCase = new UseCase(publisherStub, activeProductsStub);
await useCase.Run();
foreach (var product in testProducts)
{
var publishedProduct = publisherStub.PublishedProducts[product.OriginalProduct.ProductId];
publishedProduct.Should().NotBeNull();
publishedProduct.ReorderLevel.Should().Be(product.ExpectedReorderLevel);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.