|
vs2008编译下面的nunit测试代码出错
已加入对nunit.framework.dll的引用
出错后再重新引用也不行,,,我第一次用vs2008,,,所以不太熟
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace nunitquickstart
{
using nunit.framework;
[TestFixture]
public class testIicket
{
[test]
public void testAdd()
{
Ticket ticket;
ticket.Add(100);
ticket.Sell();
ticket.Sell();
ticket.Sell();
Assert.AreEqual(ticket.Amount (),97);
}
[Test]
[ExpectedException(typeof(Exception))]
public void ExcpetionTesting()
{
Ticket ticket = new Ticket();
ticket.Add(3);
ticket.Sell();
ticket.Sell();
ticket.Sell();
ticket.Sell();
}
}
public class Ticket
{
private int amount;
public int Amount
{
get
{
return amount;
}
}
public void Add(int num)
{
amount +=num;
}
public void Sell()
{
amount -= 1;
}
}
}
错误信息:
------ 已启动全部重新生成: 项目: nunitquickstart, 配置: Debug Any CPU ------
C:\WINDOWS\Microsoft.NET\Framework\v3.5\Csc.exe /noconfig /nowarn:1701,1702 /errorreport:prompt /warn:4 /defineEBUG;TRACE /reference:"..\..\..\..\Program Files\NUnit 2.5\net-1.1\lib\nunit.framework.dll" /reference:"C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.5\System.Core.dll" /reference:"C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.5\System.Data.DataSetExtensions.dll" /reference:C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Data.dll /reference:C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.dll /reference:C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Xml.dll /reference:"C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.5\System.Xml.Linq.dll" /debug+ /debug:full /filealign:512 /optimize- /outbj\Debug\nunitquickstart.dll /target:library Class1.cs Properties\AssemblyInfo.cs
D:\sprict\operation\nunitquickstart\nunitquickstart\Class1.cs(10,11): 错误 CS0246: 找不到类型或命名空间名称“nunit”(是否缺少 using 指令或程序集引用?)
D:\sprict\operation\nunitquickstart\nunitquickstart\Class1.cs(16,8): 错误 CS0246: 找不到类型或命名空间名称“test”(是否缺少 using 指令或程序集引用?)
D:\sprict\operation\nunitquickstart\nunitquickstart\Class1.cs(16,8): 错误 CS0246: 找不到类型或命名空间名称“testAttribute”(是否缺少 using 指令或程序集引用?)
D:\sprict\operation\nunitquickstart\nunitquickstart\Class1.cs(28,8): 错误 CS0246: 找不到类型或命名空间名称“Test”(是否缺少 using 指令或程序集引用?)
D:\sprict\operation\nunitquickstart\nunitquickstart\Class1.cs(28,8): 错误 CS0246: 找不到类型或命名空间名称“TestAttribute”(是否缺少 using 指令或程序集引用?)
D:\sprict\operation\nunitquickstart\nunitquickstart\Class1.cs(30,8): 错误 CS0246: 找不到类型或命名空间名称“ExpectedException”(是否缺少 using 指令或程序集引用?)
D:\sprict\operation\nunitquickstart\nunitquickstart\Class1.cs(30,8): 错误 CS0246: 找不到类型或命名空间名称“ExpectedExceptionAttribute”(是否缺少 using 指令或程序集引用?)
D:\sprict\operation\nunitquickstart\nunitquickstart\Class1.cs(11,4): 错误 CS0246: 找不到类型或命名空间名称“TestFixture”(是否缺少 using 指令或程序集引用?)
D:\sprict\operation\nunitquickstart\nunitquickstart\Class1.cs(11,4): 错误 CS0246: 找不到类型或命名空间名称“TestFixtureAttribute”(是否缺少 using 指令或程序集引用?)
编译完成 -- 9 个错误,0 个警告
========== 全部重新生成: 成功 0 个,失败 1 个,跳过 0 个 ========== |
|