Unit testing 单声道下的NUnit测试

Unit testing 单声道下的NUnit测试,unit-testing,mono,nunit,Unit Testing,Mono,Nunit,我有一个mut.cs,如下所示 using System; namespace ns { public class Arith { public int Add(int x, int y) { return x + y; } public int Mul(int x, int y) { return x * y; } } } 我为此提出了一个单元测试——mut_tes

我有一个mut.cs,如下所示

using System; namespace ns { public class Arith { public int Add(int x, int y) { return x + y; } public int Mul(int x, int y) { return x * y; } } } 我为此提出了一个单元测试——mut_test.cs

using NUnit.Framework; using System; using ns; namespace Unit.Tests { [TestFixture] public class ArithTests { private Arith m_arith = null; [Setup] public void Setup() { m_arith = new Arith(); } [Test] public void ValidateAdd() { int res = m_arith.Add(10,10); Assert.AreEqual(20, res); } [TearDown] public void TearDown() { m_arith = null; } } } 我运行了以下命令

gmcs -debug -t:library -r:System -r:$NUNITLIB -out:mut.dll mut_test.cs mut.cs 但是我得到了以下错误$NUNITLIB的别名为$NUNITLIB=$NUNITBIN/framework/nunit.framework.dll

mut_test.cs(9,10): error CS0118: `Unit.Tests.ArithTests.Setup()' is a `method' but a `type' was expected mut_test.cs(9,10): error CS0246: The type or namespace name `SetupAttribute' could not be found. Are you missing a using directive or an assembly reference?
可能有什么问题?

您要查找的属性称为设置,而不是设置


请参见此处:

您要查找的属性称为设置,而不是设置

请参见此处:

我讨厌这样拼写,尽管它似乎是因为它是一个动词,但这是你问题的根源。


我讨厌这样拼写,尽管这似乎是因为它是一个动词,但这是问题的根源。

是的,这是问题的原因。谢谢是的,这是问题的原因。谢谢