//public bool NegTest1() //{ // bool retVal = true; // TestLibrary.TestFramework.BeginScenario("NegTest1: "); // try // { // // // // Add your test logic here // // // } // catch (Exception e) // { // TestLibrary.TestFramework.LogError("101", "Unexpected exception: " + e); // TestLibrary.TestFramework.LogInformation(e.StackTrace); // retVal = false; // } // return retVal; //} #endregion #endregion public static int Main() { MathPow test = new MathPow(); TestLibrary.TestFramework.BeginTestCase("MathPow"); if (test.RunTests()) { TestLibrary.TestFramework.EndTestCase(); TestLibrary.TestFramework.LogInformation("PASS"); return(100); } else { TestLibrary.TestFramework.EndTestCase(); TestLibrary.TestFramework.LogInformation("FAIL"); return(0); } }
static void Main(string[] args) { MathPow pow2 = Pow2; MathPow pow3 = Pow3; Console.WriteLine(pow2(2)); Console.WriteLine(pow3(2)); pow2 += Pow3; Console.WriteLine(pow2(2)); MathPow anonimMethod1 = new MathPow(delegate(int x) { return((int)Math.Pow(x, 4)); }); // Anonimus MathPow anonim2 = delegate(int x) { if (x > 0) { return(x * x); } else { return(0); } }; MathPow anonim3 = (int x) => { return(x * 2); }; Console.WriteLine(anonimMethod1(4)); Console.WriteLine(anonim2(10)); Console.WriteLine(anonim2(-10)); Console.WriteLine(anonim3(3)); Console.WriteLine(); Console.ReadKey(); }
//public bool NegTest1() //{ // bool retVal = true; // TestLibrary.TestFramework.BeginScenario("NegTest1: "); // try // { // // // // Add your test logic here // // // } // catch (Exception e) // { // TestLibrary.TestFramework.LogError("101", "Unexpected exception: " + e); // TestLibrary.TestFramework.LogInformation(e.StackTrace); // retVal = false; // } // return retVal; //} #endregion #endregion public static int Main() { MathPow test = new MathPow(); TestLibrary.TestFramework.BeginTestCase("MathPow"); if (test.RunTests()) { TestLibrary.TestFramework.EndTestCase(); TestLibrary.TestFramework.LogInformation("PASS"); return 100; } else { TestLibrary.TestFramework.EndTestCase(); TestLibrary.TestFramework.LogInformation("FAIL"); return 0; } }
public void Given_2_When_pow_0_Then_1() { Assert.AreEqual(1, MathPow.MyPow(2, 0)); }
public void Given_888023_When_pow_3_Then_70028148() { Assert.AreEqual(700.28148d, MathPow.MyPow(8.88023d, 3)); }
public void Given_2_When_pow_2_Then_4() { Assert.AreEqual(4, MathPow.MyPow(2, 2)); }