public void TestLeapYearAndAdd() { int myAdd = DoSomeMath.Add(1900, 92); bool myLeapYearCheck = LeapYear.IsLeapYear(myAdd); Assert.IsTrue(myLeapYearCheck); }
static void Main(string[] args) { Random rand = new Random(); // just one handler for DoSomeMMath DoSomeMath += Add; // register two handlers for DoSomeMoreMath // both will fire when event occurs DoSomeMoreMath += Subtract; DoSomeMoreMath += RandomAdd; // flip a coin, if even DoSomeMath, otherwise DoSomeMoreMath for (int i = 0; i < 5; i++) { int choice = rand.Next(0, 2); if (choice == 0) { DoSomeMath?.Invoke(choice, 2, 3); } else { DoSomeMoreMath?.Invoke(choice, 10, 7); } } Console.ReadLine(); }
public void TestAdd1() { Assert.AreEqual(DoSomeMath.Add(1, 2), 3); }