Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/299.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/unit-testing/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# nunit控制台无法移动夹具_C#_Unit Testing_Msbuild_Nunit - Fatal编程技术网

C# nunit控制台无法移动夹具

C# nunit控制台无法移动夹具,c#,unit-testing,msbuild,nunit,C#,Unit Testing,Msbuild,Nunit,我有2.5.8和VS2010 我想对dll运行测试,如果我键入 nunit控制台a.dll 我也有这些套房 public class AllTests { [Suite] public static IEnumerable Suite { get { List<Type> suite = new List<Type>(); foreach (Type testCase

我有2.5.8和VS2010

我想对dll运行测试,如果我键入

nunit控制台a.dll

我也有这些套房

public class AllTests
{
    [Suite]
    public static IEnumerable Suite
    {
        get
        {
            List<Type> suite = new List<Type>();
            foreach (Type testCase in UnitTests.Suite)
            {
                suite.Add(testCase);
            }
            return suite;
        }
    }
}
公共类所有测试
{
[套房]
公共静态IEnumerable套件
{
得到
{
列表套件=新列表();
foreach(UnitTests.Suite中的类型testCase)
{
Add(testCase);
}
返回套房;
}
}
}

公共类单元测试
{
[套房]
公共静态IEnumerable套件
{
得到
{
列表套件=新列表();
增加(许可证管理测试的类型);
suite.Add(类型(CertManagerTests));
返回套房;
}
}
}
如果我想使用Suites运行测试,请键入

nunit控制台a.dll/fixture=AllTests.Suite

但它没有传达出这样的信息

找不到fixture AllTests.Suite

如果你想知道我为什么用套房,我不知道。我们正在项目中使用MSBuild,我想这是MSBuild的一个要求


谢谢你的帮助。问候。

在你的课前加上以下标签 [测试夹具]

我想这就是我们所缺少的

虽然我没有用过套房。但是我的普通单元测试类似于这样

[TestFixture]
public class A
{
//Properties
[Setup]
public void Setup()
{
//Setup code before each test, usually to set any constants, properties defined above
}
[Test]
public void TestA()
{
//test code
Asset.IsTrue(<func()>);
}

} 
[TestFixture]
公共A类
{
//性质
[设置]
公共作废设置()
{
//每次测试前的设置代码,通常用于设置上述定义的任何常量、属性
}
[测试]
公共无效遗嘱()
{
//测试代码
Asset.IsTrue();
}
} 
并以nunit控制台nunit.tests.dll[生成的dll是什么]的形式运行测试

告诉我这是否有帮助

我找到了解决方案

诀窍在于名称空间。 alltests和unittests类的命名空间应为

"Suites".
否则我会一直收到“无法定位”。。
你好。事实上,我没有问这件事。这就是我们调用和运行测试的方式。我的问题是关于使用套件。AFAIK套件用于分组测试。他们现在用得不多了,而是用了类别。啊,对不起!新台币有多少套房
"Suites".