[英]Do xunit tests run in total isolation?
If I have a static class: 如果我有一个静态课程:
public static class Foo
{
public static string Bar = "baz";
}
And inside a xunit test I do something like this (contrived): 在xunit测试中,我做这样的事情(做作):
public class FooTests
{
[Fact]
public void Bar_can_be_set_to_buz()
{
Foo.Bar = "buz";
}
[Fact]
public void Some_other_test()
{
//Is Foo.Bar "buz", or is there isolation ?
}
}
Is the external static class shared by both tests, or is there complete isolation between tests? 外部静态类是两个测试共享的,还是两个测试之间完全隔离?
Each test gets a new instance of the test class. 每个测试都会获得测试类的新实例。 Any static state will shared amongst all tests.
任何静态都将在所有测试之间共享。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.