asp.net mvc测试我的service层的方法是不是正确
我用asp.net mvc开发 我新建一个mvc项目 在Models文件夹里新建一个类test.cs 在里面写了一方法
public class test
{
public int A { get; set; }
public int B { get; set; }
public int Add(test c)
{
int d=c.A+c.B;
return d;
}
}
然后在Controllers文件夹中新建了一个UsertController.cs 里面写了一个方法用来接收我的Add()方法
public ActionResult ddd()
{
sd.A = 2;
sd.B = 3;
return View(sd.Add(sd));
}
我在选择Add View... 出来选则我自己的测试类 选择Details........
添加了一个页面在Views自己新建Usert文件夹 选择Add View...添加页面ddd.aspx
我运行页面出现了一个
The model item passed into the dictionary is of type 'System.Int32', but this dictionary requires a model item of type 'MvcApplication3.Models.test'. 错误
我的测试就此完成不了 不知道我的方法是否写的正不正确
高手能不能不能指点一下
有什么方法可以测试我的方法是不是正确的 有没有哪种方法跟好测试 能教我测试我的
能发一个简单的测试到得邮箱吗 h516952364@qq.com