问题描述
嗨
我在运行此nunit时安装了Nunit,它给了我一些错误,而我得到的错误是此程序集不是使用任何已知的测试框架构建的" ,在c#中,我正在添加.net框架,因为我没有获取.dll文件,我什至没有浏览器尝试从程序文件中放入文件,但它没有在参考文件夹中显示我,请让我知道在这种情况下我该怎么做?
当我编写此代码时:
Hi
I have install Nunit when i am running this nunit it gives me some error and the error i am getting is "This assembly was not built with any known testing framework" and in c# in reference i am adding the .net framework and in that i am not getting .dll file i have even browser an try to put from program files but it is not showing me in reference folder please let me know what i do in this case?
When i am writing this code:
using System;
using System.Collections.Generic;
using System.Text;
using NUnit.Framework;
namespace ConsoleApplication3
{
class Program
{
static void Main(string[] args)
{
}
public float balance;
public void Deposite(float amount)
{
balance += amount;
}
public void withdraw(float amount)
{
balance -= amount;
}
public void TransferFunds(Program destination, float amount)
{
}
public float Balance
{
get { return balance; }
}
public static void testmethod()
{
Program a1 = new Program();
a1.Deposite(200.00f);
Program a2 = new Program();
a2.Deposite(15.00f);
a1.TransferFunds(a2, 100.00f);
Program.Equals(250.00f, a2.balance);
Program.Equals(100.00f, a1.balance);
}
}
[TestFixture()]
public class Calculator_UnitTest
{
Program a1 = new Program();
[SetUp()]
public void Init()
{
// some code here, that need to be run
// at the start of every test case.
}
[TearDown()]
public void Clean()
{
// code that will be called after each Test case
}
[Test]
public void Test()
{
Program a1 = new Program();
a1.Deposite(200.00f);
Program a2 = new Program();
a2.Deposite(15.00f);
a1.TransferFunds(a2, 100.00f);
Program.Equals(250.00f, a2.balance);
Program.Equals(100.00f, a1.balance);
}
}
}
它不支持NUnit.Framework
或[TestFixture()]
和,请提供帮助.
It''s not supporting NUnit.Framework
nor [TestFixture()]
and please help.
推荐答案
这篇关于NUnit测试问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!