Nuint-テスト実行ロジック

4616 ワード

Nuint-
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using NUnit.Framework;
namespace NC_Test._002Nc_Alac
{
    [TestFixture]
    public class Alac_Test01
    {
        String sIP = "192.168.1.1";

        [TestMethod]
        public void TestMethod1()
        {
            Console.WriteLine(111);
        }
        [TestFixtureSetUp]
        public void Teststat()
        {
            Console.WriteLine("( ) TestFixtureSetUp");
        }
        [SetUp]
        public void TestSetup()
        {
            Console.WriteLine(" SetUp");
        }
    
        [Test]
        public void Channe()
        {

            Console.WriteLine("ip={0}", sIP);

            NUnit.Framework.Assert.AreEqual(2, 2);
            NUnit.Framework.Assert.AreEqual(1, 2);
        }
        [Test]
        public void Channe2()
        {

            Console.WriteLine("ip={0}", sIP);

            NUnit.Framework.Assert.AreEqual(2, 2);
            NUnit.Framework.Assert.AreEqual(1, 2);
        }
       [TearDown]
        public void jsRepat()
        {
            Console.WriteLine(" TearDown");

        }
        [TestFixtureTearDown]
        public void js()
        {
            Console.WriteLine(" TestFixtureTearDown");

        }
    }
}

実行結果
( ) TestFixtureSetUp
***** NC_Test._002Nc_Alac.Alac_Test01.Channe
 SetUp
ip=192.168.1.1
 TearDown
***** NC_Test._002Nc_Alac.Alac_Test01.Channe2
 SetUp
ip=192.168.1.1
 TearDown
 TestFixtureTearDown

 
転載先:https://www.cnblogs.com/hs22/p/7208616.html