我的 NUnit 有一些问题。我有这个 TestFixture 测试模型
模型是这样的:
public class Model
{
public int Id {get;set;}
public string Name {get; set;}
public void myAction(MyDatabase db, string r, string i) {
db.DataEmp.Add(new DataEmp{
Id = this.Id,
DateOfAction = DateTime.UtcNow,
R = r,
I = i
});
db.SaveChanges();
}
}
我在 NUnit 中的测试用例
[Test]
public void Method_Test_Pass_myAction()
{
newModel.myAction(db,"R","I");
Assert.That(db.DataEmp.FirstOrDefault(de => de.Id == newModel.Id), Is.Null);
}
它给了我一个
System.NotImplementedException :方法或操作未实现。
所以我不确定出了什么问题,因为我在 Setup 方法中实例化了 newModel 。如果运行应用程序,该方法运行良好。想法受到赞赏。
谢谢!!