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"); }
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"); }
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"); }
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"); }