Exemple #1
0
        public void FactoriseReturnsTwoAndOtherFactorWhenNumberIsEven(int evenNumber)
        {
            Factoriser factoriser = new Factoriser();

            (int, int)factors = factoriser.factorise(evenNumber);
            Assert.Equal(factors, (2, evenNumber / 2));
        }
Exemple #2
0
        public static void Main(string[] args)
        {
            int numberToFactorise = 15;

            (int, int)result = new Factoriser().factorise(numberToFactorise);
            Console.WriteLine($"The factors of {numberToFactorise} are {result.Item1} and {result.Item2}");
        }
Exemple #3
0
        public void FactoriseReturnsErrorWhenLessThanTwo(int numberLessThanTwo)
        {
            Factoriser factoriser = new Factoriser();
            Action     act        = () => factoriser.factorise(numberLessThanTwo);

            Assert.Throws <ArgumentException>(act);
        }