Exemplo n.º 1
0
        public void CreateList_CreatesListOfNums_List()
        {
            Primes     testPrimes = new Primes();
            List <int> newList    = new List <int> {
                2, 3, 4
            };
            List <int> result = testPrimes.CreateList(5);

            CollectionAssert.AreEqual(newList, result);
        }
Exemplo n.º 2
0
        public void ReturnPrimes_ReturnsPrimeList_List()
        {
            Primes     testPrimes = new Primes();
            List <int> newList    = new List <int> {
                2, 3
            };
            List <int> result = testPrimes.CreateList(5);

            CollectionAssert.AreEqual(newList, testPrimes.ReturnPrimes(result));
        }
Exemplo n.º 3
0
    public static void Main()
    {
        Console.WriteLine("Enter a number to get all primes below that number: ");
        int        number    = int.Parse(Console.ReadLine());
        Primes     primeList = new Primes();
        List <int> numList   = primeList.CreateList(number);

        numList = primeList.ReturnPrimes(numList);
        foreach (int num in numList)
        {
            Console.WriteLine(num);
        }
    }