using System; using System.Collections; using NUnit.Framework; #region entry point public class EntryClass { public static void Main() { NewClass t = new NewClass(); } } #endregion entry point // To test, select Build|Build To File... then point nunit's guii at the resultant dll // Class we will build up for testing public class NewClass { // Sample Method which is tested public int MyMethod(int firstNumber, int secondNumber) { return firstNumber + secondNumber; } } // Class that does the nunit testing ([TestFixture] tells nunit it's the test class) [TestFixture] public class MyNewClassTestClass { // Method for testing the method in the class above ([Test] tells nunit this is a test method) [Test] public void MyMethodTest() { // create an instance of the class NewClass obj_newClass = new NewClass(); // Verify assertion Assertion.Assert(obj_newClass.MyMethod(10, 20) == 30); } }
You need to create an account or log in to post comments to this site.