NUnit测试用例 - 来自Datatable的字符串数组 [英] NUnit Test Case - String Array from Datatable

查看:124
本文介绍了NUnit测试用例 - 来自Datatable的字符串数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

需要针对以下功能的NUnit测试用例。对于saem函数如果我在函数测试用例内构建了数据表成功。如果它来自DB测试用例失败。



公共ActionResult GetCustomerInfo()

{

DataTable dtCustomerInfo = BL.rptCustomerInfo();

Session [dtCustomerInfo] = dtCustomerInfo;

List< system.collections.arraylist> CustomerInfo = new List< system.collections.arraylist>();

foreach(dtCustomerInfo.Rows中的DataRow dataRow)

{

系统。 Collections.ArrayList values = new System.Collections.ArrayList();

foreach(dataRow.ItemArray中的对象值)

values.Add(value);

CustomerInfo.Add(值);

}

var model = CustomerInfo;

返回模型;

}





问候,

Kalaiselvan

解决方案

Need NUnit Test Case for the below Function. For the saem function If I Built the Datatable Inside the Function Test Case succeeds. If its comes from DB Test case fails.

public ActionResult GetCustomerInfo()
{
DataTable dtCustomerInfo = BL.rptCustomerInfo();
Session["dtCustomerInfo"] = dtCustomerInfo;
List<system.collections.arraylist> CustomerInfo = new List<system.collections.arraylist>();
foreach (DataRow dataRow in dtCustomerInfo.Rows)
{
System.Collections.ArrayList values = new System.Collections.ArrayList();
foreach (object value in dataRow.ItemArray)
values.Add(value);
CustomerInfo.Add(values);
}
var model = CustomerInfo;
return model;
}


Regards,
Kalaiselvan

解决方案

这篇关于NUnit测试用例 - 来自Datatable的字符串数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆