我对单元测试相当陌生,并且在网上阅读了很多材料,但我在找出一些东西时遇到了一些小麻烦。
例如:如果我有以下代码:
public class RandomClass
{
int a = 4;
public void foo(Object obj)
{
if(a == 4)
{
AnotherObject anotherObj = new AnotherObject();
anotherObj.setAttribute(obj.getFiled());
//Method call that will be suppressed
我学会了在NUnit中运行组合单元测试,但这导致Visual Studio Test Explorer中的单个结果几乎增加了十倍。它们中的大多数是重复的单元测试调用,只是参数不同。这使得直观地定位测试变得更加困难(尽管,我知道,在顶部有一个搜索栏,以及一些分组选项)。
所以问题是:有没有办法(NUnit配置,Visual Studio配置,Visual Studio扩展)来减少这个输出的冗长?
给定以下代码:
public class Employee
{
public void CalculateEmpSal(int empId,int salary)
{
// local varibles
int Basic;
int HRA;
// Calculate employee salary
Basic = salry * (0.40);
HRA = Basic * (0.50);
}
}
是否可以为可以访问Basic和HRA局部变量的C
我试图在Windows上使用Server。这是我的DataContext
public class FooDataContext : DataContext
{
private static readonly string DB_CONNECTION_STRING = "Data Source=isostore:/foo.sdf";
// Pass the connection string to the base class.
public FooDataContext() : base(DB_CONNECTION_STRING)
{ }