Exemple #1
0
        public void TestMethod3()
        {
            MyMathFunctions myMathFunctions = new MyMathFunctions();
            var             ex = Assert.ThrowsException <Exception>(() => myMathFunctions.sum("r", "7"));

            Assert.AreEqual(ex.Message, "The given value is not a number: r");
        }
Exemple #2
0
        public void TestMethod4()
        {
            MyMathFunctions myMathFunctions = new MyMathFunctions();
            long            result          = myMathFunctions.sum("2147483647", "1");
            long            expectedResult  = 2147483648;

            Assert.AreEqual(result, expectedResult);
        }
Exemple #3
0
        public void TestMethod2()
        {
            MyMathFunctions myMathFunctions = new MyMathFunctions();
            int             result          = myMathFunctions.sum("3", "7");
            int             expectedResult  = 10;

            Assert.AreEqual(result, expectedResult);
        }
Exemple #4
0
        public void TestMethod1()
        {
            MyMathFunctions myMathFunctions = new MyMathFunctions();
            int             result          = myMathFunctions.sum("1", "4");
            int             expectedResult  = 5;

            Assert.AreEqual(expectedResult, result);
        }
    // Use this for initialization
    void Start()
    {
        // Declare variables
        int n = 8;

        // Output the fibonacci-values in the short version.
        Debug.Log("---------- Short version ----------");
        Debug.LogFormat("' {0}. ' ' {1} '", n, MyMathFunctions.Fibonacci(n));

        // Output the fibonacci-values in the long version.
        Debug.Log("---------- Long version ----------");
        Debug.LogFormat("' {0}. ' ' {1} '", n, MyMathFunctions.FibonacciProcedural(n));
    }
 public static void Main(string[] args)
 {
     try
     {
         for (int i = 6; i > -6; i--)
         {
             int factorial = MyMathFunctions.Factorial(i);
             Console.WriteLine("i = {0}, factorial = {1}", i, factorial);
         }
     }
     catch (ArgumentException e)
     {
         Console.WriteLine("Fatal error:");
         Console.WriteLine(e.ToString());
         Console.ReadLine();
     }
 }