protected override void DoRun() { PrimeTool tool = new PrimeTool(new SieveOfEratosthenesPrimeStrategy(100)); TestPrimes(tool); tool.Strategy = new BruteForcePrimeStrategy(); TestPrimes(tool); }
private void TestPrimes(PrimeTool tool) { Console.WriteLine($"Checking first 100 primes using {tool.Strategy.GetType()}"); for (int x = 0; x <= 100; x++) { tool.CheckPrime(x); } }