Skip to main content

Practice ยท 3 of 3

Debug: Passes Alone, Fails Together

CHALLENGE
Difficulty: intermediate+25 XP

OrderService behaves correctly when each test runs in its own process โ€” but back-to-back calls across *different service instances* see ghosts of each other. Find the root cause and fix it: the service must depend only on its injected IOrderStore, hold no state outside the instance, and every call must see fresh data from the store it was given. ``csharp public static class Solution { public sealed class OrderService { public OrderService(IOrderStore store); public string PlaceOrder(string sku, int qty); } } // PlaceOrder -> "ok" | "outofstock" ``

Back to lesson: Practice: Testing Practice: Runner, Assertions, Isolation