我正在运行Twilio提供的测试用例:
https://www.twilio.com/docs/voice/tutorials/ivr-phone-tree-csharp-mvc
所有测试失败,因为代码引发异常:
System.MissingMethodException HResult = 0x80131513 消息=未找到方法。 .Nullable,System.String,System.Nullable,System.Uri,Twilio.Http.HttpMethod,LanguageEnum,System.String,System.Nullable,System.Nullable)
这是测试用例失败的一个例子
public void GivenAWelcomeAction_ThenTheResponseContainsGatherPlay()
{
var controllerPropertiesMock = new ControllerPropertiesMock();
var controller = new IVRController
{
ControllerContext = controllerPropertiesMock.ControllerContext,
Url = controllerPropertiesMock.Url(RouteConfig.RegisterRoutes)
};
controller.WithCallTo(c => c.Welcome())
.ShouldReturnTwiMLResult(data =>
{
Assert.That(data.XPathSelectElement("Response/Gather/Say"), Is.Not.Null);
Assert.That(data.XPathSelectElement("Response/Gather").Attribute("action").Value,
Is.EqualTo("/Menu/Show"));
});
}
关于如何避免异常的任何建议?