Пример #1
0
 public void Pow()
 {
     double numA = 5;
     double numB = 2;
     ScientificCalculator scientific = new ScientificCalculator();
     double actualResult = scientific.Pow(numA, numB);
     ToConsole($"Pow: " +
         $"{numA} ^ {numB} = {actualResult}");
     Assert.AreEqual(numA*numA, actualResult, "Verify operation Pow: False");
 }
Пример #2
0
        public void Mod()
        {
            int a = -5;
            int b = 3;
            ScientificCalculator scientific = new ScientificCalculator();
            double actualResult = scientific.Mod(a, b);

            ToConsole($"Mod: " +
                $"{a} mod {b} = {actualResult}");
            Assert.AreEqual(((Math.Abs(a * b) + a) % b), actualResult, "Verify operation Mod: False");
        }
Пример #3
0
 public void Percents()
 {
     double number = 100;
     double persent = 20;
     ScientificCalculator scientific = new ScientificCalculator();
     double actualResult = scientific.Percents(number, persent);
         
     ToConsole($"Percents: " +
         $"{persent}% from {number} = {actualResult}");
     Assert.AreEqual((number / 100 * persent), actualResult, "Verify operation Percents: False");
 }
Пример #4
0
 public void MinOfArray()
 {
     int[] array = {3, 1, 2, 4, 5 };
     ScientificCalculator scientific = new ScientificCalculator();
     double actualResult = scientific.minOfArray(array);
     ToConsole($"Min of Array = {actualResult}");
     foreach (int element in array)
     {
         ToConsole(array[element - 1].ToString());
     }
     Assert.AreEqual(1, actualResult, "Verify operation MinOfArray: False");
 }