我的单元测试给了我
“配置的设置:x => x.GetCount(It.IsAny(), It.IsAny()) 未执行任何调用。”
这是下面的方法:
private IService Client = null;
public void CountChecks()
{
Client = new ServiceClient();
var _amount = Client.GetCount(value01, value01);
}
Run Code Online (Sandbox Code Playgroud)
这是我的测试课:
public class CountChecksClassTests
{
private Mock<IService > service { get; set; }
private CountChecksClass { get; set; }
[TestInitialize]
public void Setup()
{
service = new Mock<IService>();
service.Setup(x => x.GetCount(It.IsAny<DateTime>(), It.IsAny<DateTime>()));
checker = new CountChecksClass ();
}
[TestMethod()]
public void GetCountTest()
{
checker.CountChecks();
service.Verify(x => x.GetCount(It.IsAny<DateTime>(), It.IsAny<DateTime>()));
}
}
Run Code Online (Sandbox Code Playgroud)
当我调试测试时,该方法被调用。那么,为什么我会收到“未执行调用”错误?错误发生在service.Verify(x => x.GetCount(It.IsAny<DateTime>(), …
我正在运行 sonarqube 8.9.1.44547 并且它已连接到 SQL Server 数据库。我的问题是,当我尝试在网络界面上添加新用户时,它什么也不做。当我单击“创建”按钮时,没有弹出窗口或任何内容告诉我缺少什么。我还可以在数据库中看到尚未创建用户。请帮忙。