コード例 #1
0
        public void verify_kata_controller_theloop_meets_2000ms_sla()
        {

            KataController controller = new KataController();
            Stopwatch sw = new Stopwatch();
            sw.Start();

            controller.TheLoop();

            sw.Stop();

            Assert.IsTrue(sw.ElapsedMilliseconds < 2500);
        }
コード例 #2
0
        public void verify_kata_controller_thetweets_meets_250ms_sla()
        {

            KataController controller = new KataController();
            Stopwatch sw = new Stopwatch();
            sw.Start();

            controller.TheTweets("nickfloyd");

            sw.Stop();

            Assert.IsTrue(sw.ElapsedMilliseconds < 250);
        }
コード例 #3
0
        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);

        }
コード例 #4
0
        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);
        }