public ShoppingBasketTestsFixture(ITestOutputHelper outputHelper) { // Setup DI. var serviceCollection = new ServiceCollection(); serviceCollection.AddLogging((builder) => builder.AddXUnit(outputHelper)); serviceCollection.AddShoppingBasketDependencies(); ServiceProvider = serviceCollection.BuildServiceProvider(); // Create basket items. var bread = new BasketItem(Guid.NewGuid(), "Bread", 1); var butter = new BasketItem(Guid.NewGuid(), "Butter", 0.8M); var milk = new BasketItem(Guid.NewGuid(), "Milk", 1.15M); // Create discounts. var breadDiscount = new ProductDiscount("Buy two butters, get one bread at 50% off", 50); breadDiscount.AddCondition(butter.ProductId, 2); bread.AddDiscount(breadDiscount); var milkDiscount = new ProductDiscount("Buy three milks, get fourth for free", 100); milkDiscount.AddCondition(milk.ProductId, 3); milk.AddDiscount(milkDiscount); Products = new List <BasketItem> { bread, butter, milk }; }