public void verify_kata_controller_theprime_returns_primes_of_1000_in_less_than_1000ms() { KataController controller = new KataController(); Stopwatch sw = new Stopwatch(); sw.Start(); controller.ThePrime(1000); sw.Stop(); Assert.IsTrue(sw.ElapsedMilliseconds < 1000); }
public void verify_kata_controller_theprime_returns_primes_of_500() { var num = 500; KataController controller = new KataController(); controller.ThePrime(num); List<int> expected = Enumerable.Range(2, num).Aggregate( Enumerable.Range(2, num).ToList(), (result, index) => { result.RemoveAll(i => i > index && i % index == 0); return result; } ); Assert.AreEqual(expected,controller.ViewBag.Primes); }