Example #1
0
        public void TestInverseArgs()
        {
            var outputMock = new ConsoleWriteActionStub();

            Assert.DoesNotThrow(() => Program.Execute(outputMock.ActionWithArgs, 2, 1, ""));
            Assert.AreEqual(2, outputMock.Messages.Count, "Action call count did not match expected");
            Assert.IsTrue(outputMock.Messages[0].StartsWith("Results"), "Did not output any results");
            Assert.IsTrue(outputMock.Messages[1].StartsWith("\nResults generated"), "Result timer output missing");
        }
Example #2
0
        public void TestMissingArgsSimple()
        {
            var outputMock = new ConsoleWriteActionStub();

            int    first, second;
            string third;

            Assert.DoesNotThrow(() => Program.ParseArgs(new string[0], outputMock.Action, out first, out second, out third));
            Assert.DoesNotThrow(() => Program.ParseArgs(new[] { "1" }, outputMock.Action, out first, out second, out third));
            Assert.AreEqual(2, outputMock.Messages.Count, "Action call count did not match expected");
            Assert.AreEqual("Must include two positive integers for an inclusive range to check for primes", outputMock.Messages.First());
        }