Skip to main content

Checkpoint: Suite That Catches

Challenge on lesson: Checkpoint โ€” The Self-Verifying Suite

CHALLENGE
Difficulty: intermediate+25 XP

Implement the pieces described in the checkpoint: ``csharp public interface IInventory { int GetStock(string sku); void Reserve(string sku, int qty); } public static class Solution { public sealed class FakeInventory : IInventory { public System.Collections.Generic.Dictionary<string, int> Stock = new(); public System.Collections.Generic.List<string> Reservations = new(); public bool LyingStock; // GetStock returns true value + 1000 public bool BrokenReserve; // Reserve records nothing } public sealed class OrderService { public OrderService(IInventory inv); public string PlaceOrder(string sku, int qty); } public static System.Collections.Generic.List<string> CheckAll(FakeInventory inv); } ``

Back to lesson: Checkpoint โ€” The Self-Verifying Suite