C#TestMethod-异步<;行动结果>;索引()
我不熟悉单元测试,也不太熟悉C。不是很好的组合!我在这个论坛上看到了类似的问题,并尝试了解决方案,但没有成功。 在我的家庭控制器中,我定义了以下方法。如何为C#TestMethod-异步<;行动结果>;索引(),c#,unit-testing,redux-async-actions,C#,Unit Testing,Redux Async Actions,我不熟悉单元测试,也不太熟悉C。不是很好的组合!我在这个论坛上看到了类似的问题,并尝试了解决方案,但没有成功。 在我的家庭控制器中,我定义了以下方法。如何为异步任务编写[MethodTest] 家庭控制器 公共异步任务索引() { var userId=Request.IsAuthenticated?HttpContext.User.Identity.GetUserId():null; var thumbnails=wait new List().GetPropertyThumbnailsAsy
异步任务编写[MethodTest]
家庭控制器
公共异步任务索引()
{
var userId=Request.IsAuthenticated?HttpContext.User.Identity.GetUserId():null;
var thumbnails=wait new List().GetPropertyThumbnailsAsync(userId);
var count=thumbnails.count()/4;
var模型=新列表();
对于(inti=0;i您可以声明您的TestMethod
async
[TestMethod]
public async Task Index()
{
// Arrange
// Validate model state end
// Act
ViewResult result = await HomeController.Index();
//Assert
Assert.IsNotNull(result);
}
您可以声明您的TestMethod
async
[TestMethod]
public async Task Index()
{
// Arrange
// Validate model state end
// Act
ViewResult result = await HomeController.Index();
//Assert
Assert.IsNotNull(result);
}