IT:AD:NUnit:HowTo:Create a Unit Test

Note: There are no NUnit equivalents to MSTest's AssemblyInitializeAttribute and AssemblyCleanupAttribute

using NUnit.Framework;
using XAct.Tests;

namespace XAct.Diagnostics.Tests
{
    /// <summary>
    ///   NUNit Test Fixture.
    /// </summary>
    [TestFixture(Description = "Some Fixture")]
    public class UnitTests1
    {
        /// <summary>
        ///   Sets up to do before any tests 
        ///   within this test fixture are run.
        /// </summary>
        [TestFixtureSetUp]
        public void TestFixtureSetUp()
        {
            //run once before any tests in this testfixture have been run...
            //...setup vars common to all the upcoming tests...

            IoCBootStrapper.Initialize();

        }

        /// <summary>
        ///   Tear down after all tests in this fixture.
        /// </summary>
        [TestFixtureTearDown]
        public void TestFixtureTearDown()
        {
            //IoCBootStrapper.Instance =null;
        }

        /// <summary>
        ///   An Example Test.
        /// </summary>
        [Test(Description = "")]
        public void UnitTest01()
        {
            SOMECLASSNAME ctrl = new SOMECLASSNAME();
            Assert.IsTrue(true);
        }
    }


}


  • /home/skysigal/public_html/data/pages/it/ad/nunit/howto/create_a_unit_test.txt
  • Last modified: 2023/11/04 01:51
  • by 127.0.0.1