vs 2005 中的单元测试的生命周期

// The following code was generated by Microsoft Visual Studio 2005.
// The test owner should check each test for validity.
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Text;
using System.Collections.Generic;

namespace TestProject3
{
    /// <summary>
    ///This is a test class for BankAccountDemo.Business.Tests.BankAccountTest and is intended
    ///to contain all BankAccountDemo.Business.Tests.BankAccountTest Unit Tests
    ///</summary>
    [TestClass()]
    public class LifeLoop
    {
        [TestMethod()]
        public void TestTestMothodBytodd()
        {
            //Assert.Inconclusive("todd.");  4         
            Assert.IsFalse(false);
            //Assert.Fail("dddd");
            Assert.Inconclusive("ddddd");
        }
        [TestMethod()]
        public void TestTestMothodBytodd1()
        {
            //Assert.Inconclusive("todd.");  4         
            Assert.IsFalse(true);
        }
        [ClassInitialize()]
        public static void TestClassInitialize(TestContext testContext)
        {
            //Assert.Inconclusive("ClassInitialize");2
            Assert.IsFalse(false);
           
        }
        [ClassCleanup()]
        public static void TestClassCleanup()
        {
            //Assert.Inconclusive("ClassCleanup");6
            Assert.IsFalse(false);
        }
        [TestInitialize()]
        public void TestTestInitialize()
        {
            //Assert.Inconclusive("TestInitialize");3
            Assert.IsFalse(false);
        }
        [TestCleanup()]
        public  void TestTestCleanup()
        {
            //Assert.Inconclusive("TestCleanup");5
            Assert.IsFalse(false);
        }
        //AssemblyInitialize1
        [AssemblyInitialize()]
        public static void TestAssemblyInitialize(TestContext testContext)
        {
            //Assert.Inconclusive("TestAssemblyInitialize");
            Assert.IsFalse(false);
        }
        //AssemblyCleanup
        [AssemblyCleanup()]
        public static void TestAssemblyCleanup()
        {
            //Assert.Inconclusive("AssemblyCleanup");7
            Assert.IsFalse(false);
        }
        //[Description]
        //public void TestDescription()
        //{
        //    Assert.Inconclusive("Description");
        //}
        [Ignore()]
        public void TestIgnore()
        {
            //Assert.Inconclusive("Ignore");
            Assert.IsFalse(false);
        }
        //1--AssemblyInitialize在执行为执行选择的第一个 TestClass() 中的第一个 TestMethod() 之前
        //2--ClassInitialize带有该属性的方法在执行第一个测试之前调用
        //3--TestInitialize带有该属性的方法在执行每个 TestMethod() 之前调用
        //4--TestMethod该属性表示一个测试用例
        //5--TestCleanup带有该属性的方法在执行每个 TestMethod() 之后调用
        //6--ClassCleanup带有该属性的方法在执行 ALL 测试之后调用
        //7--AssemblyCleanup
    }
}

原文地址:https://www.cnblogs.com/snowball/p/386721.html