Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

With nunit 2.6.7 or higher replaced TestFixtureSetUp and TestFixtureTearDown #35

Open
janwilmans opened this issue Aug 9, 2018 · 0 comments

Comments

@janwilmans
Copy link

janwilmans commented Aug 9, 2018

1>C:\Users\jan\source\repos\Nunittest\Class1.cs(9,10,9,26): warning CS0618: 'TestFixtureSetUpAttribute' is obsolete: 'Use OneTimeSetUpAttribute'
1>C:\Users\jan\source\repos\Nunittest\Class1.cs(15,10,15,29): warning CS0618: 'TestFixtureTearDownAttribute' is obsolete: 'Use OneTimeTearDownAttribute'
// pre nunit 2.6.x TestFixtureSetUp syntax
namespace TestProject
{

    [TestFixture]
    public class Tester
    {
        [TestFixtureSetUp] // pre  2.6.x syntax
        public void TestFixtureSetUp()
        {
            System.Console.WriteLine("C# TestFixtureSetUp"); 
        }

        [TestFixtureTearDown] // pre  2.6.x syntax
        public void TestFixtureTearDown()
        {
            System.Console.WriteLine("C# TestFixtureTearDown");
        }

        [Test]
        public void Mytest()
        {
            System.Console.WriteLine("C# Mytest");
        }

    }
}
// nunit 2.6.x or nunit 3.x.x  replaced TestFixtureSetUp and TestFixtureTearDown
// with OneTimeSetUpAttribute and OneTimeTearDownAttribute

// TestFixtureSetUp and TestFixtureTearDown **are** still allowed, but reported as obsolete

namespace TestProject
{

    [TestFixture]
    public class Tester
    {
        [OneTimeSetUpAttribute ]       //new
        public void TestFixtureSetUp()
        {
            System.Console.WriteLine("C# TestFixtureSetUp"); // not called in v1.1.5
        }

        [OneTimeTearDownAttribute]     //new
        public void TestFixtureTearDown()
        {
            System.Console.WriteLine("C# TestFixtureTearDown");
        }

        [Test]
        public void Mytest()
        {
            System.Console.WriteLine("C# Mytest");
        }

    }
}
@janwilmans janwilmans changed the title With nunit 2.6.7 or higher With nunit 2.6.7 or higher replaced TestFixtureSetUp and TestFixtureTearDown Aug 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant