示例#1
0
        public void TestGridPrint_MultiplyUsingList()
        {
            PrimeGrid target            = new PrimeGrid();
            int       numberOfPrimesReq = 5 + 1;//Plus one to allow for pretty printing

            int[] list1    = target.PrimeFinder(numberOfPrimesReq);
            int[] list2    = list1;
            int   expected = 33;
            int   actual   = target.Multiply(list1[2], list2[5]);//Had to update the pointers to allow for 1 inserted for printing

            Assert.AreEqual(expected, actual);
        }
示例#2
0
        public void TestPrimeFinder_ReturnsCorrectNoOfPrimes()
        {
            PrimeGrid target            = new PrimeGrid();
            int       numberOfPrimesReq = 5 + 1; //changed to plus 1 to allow for nice printing

            int[] expected = new int[6] {
                1, 2, 3, 5, 7, 11
            };
            int[] actual = target.PrimeFinder(numberOfPrimesReq);
            Assert.AreEqual(expected[0], actual[0]);
            Assert.AreEqual(expected[1], actual[1]);
            Assert.AreEqual(expected[2], actual[2]);
            Assert.AreEqual(expected[3], actual[3]);
            Assert.AreEqual(expected[4], actual[4]);
            Assert.AreEqual(expected[5], actual[5]); //Extra test case added to allow for extra 1 at start
        }