public void Collection_of_Output_Lines_is_Returned()
        {
            var outputFormatter = new OutputFormatter();

            IList<string> formattedOutput = outputFormatter.Format(_generatedPrimes);

            Assert.IsAssignableFrom(typeof (List<string>), formattedOutput);
        }
示例#2
0
        private static void Main(string[] args)
        {
            var primeGenerator = new PrimeGenerator(new PrimeEvaluationEngine());

            var results = new OutputFormatter().Format(primeGenerator.GeneratePrimesUpTo(10000));
            results.ForEach(Console.WriteLine);

            Console.WriteLine("--- hit enter to exit --");
            Console.ReadLine();
        }
        public void Every_Tenth_Line_Contains_Count()
        {
            var generatedPrimes = new PrimeGenerator(new PrimeEvaluationEngine()).GeneratePrimesUpTo(2000);

            var outputFormatter = new OutputFormatter();

            IList<string> formattedOutput = outputFormatter.Format(generatedPrimes);

            for (int i = 10; i < formattedOutput.Count; i += 11)
            {
                Assert.IsTrue(formattedOutput[i].Contains("Count:"));
            }
        }
        public void Each_Output_Line_Contains_No_More_Than_Five_Items()
        {
            var outputFormatter = new OutputFormatter();

            IList<string> formattedOutput = outputFormatter.Format(_generatedPrimes);

            string[] splitPrimes;

            foreach (string item in formattedOutput)
            {
                splitPrimes = item.Split(",".ToCharArray());

                Assert.LessOrEqual(splitPrimes.Length, 5);
            }
        }
        public void Can_Create_Instance()
        {
            var outputFormatter = new OutputFormatter();

            Assert.IsNotNull(outputFormatter);
        }