开发者

Where to put Automapper maps in Nunit test assembly

I am using Automapper in my application and I am testing the maps with fake objects, so I have slightly different maps in my tests than in my production code, what is the best way to c开发者_Go百科reate/call the maps, I have the maps sitting right now at each fixture's

[TestFixtureSetUp]

As the Mapper class is static is it possible to read the maps once per "all test" run, because I found it slows down the tests very much

Thank you.


With NUnit you could use [SetUpFixture]:

This is the attribute that marks a class that contains the one-time setup or teardown methods for all the test fixtures under a given namespace. The class may contain at most one method marked with the SetUpAttribute and one method marked with the TearDownAttribute.

With MbUnit you could use [AssemblyFixture] which is executed once per unit test assembly.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜