[ACCEPTED]-xUnit framework: Equivalent of [TestFixtureSetUp] of NUnit in XUnit?-xunit

Accepted answer
Score: 41

There is no direct equivalent of [TestFixtureSetUp] in XUnit, but 11 you can achieve similar functionality. This page lays 10 out the translation between NUnit and XUnit 9 (as well as a couple other C#/.NET test 8 frameworks). However, XUnit largely got 7 rid of setups/teardowns (this article explains why that 6 decision was made). Instead, you need the 5 test suite to implement an interface called 4 IUseFixture<T> which can initialize some data for the 3 fixture.

You might also want to read this overview of XUnit, written 2 from the perspective somebody coming from 1 an NUnit/MbUnit background.

More Related questions