单元测试Bot框架 [英] Unit Testing Bot Framework

查看:134
本文介绍了单元测试Bot框架的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试弄清如何对基本的MS Bot Framework对话框进行单元测试,并且无法使其按Internet上的所有功能正常工作.

I'm trying to figure out how to unit test a basic MS Bot Framework dialog and cannot get it to work the way everything on the internet says it should work.

我发现的所有内容基本上都遵循以下条件: https://github.com. com/Microsoft/BotBuilder/blob/master/CSharp/Tests/Microsoft.Bot.Sample.Tests/EchoBotTests.cs

Everything I find basically says follow this: https://github.com/Microsoft/BotBuilder/blob/master/CSharp/Tests/Microsoft.Bot.Sample.Tests/EchoBotTests.cs

好吧,这是问题所在:

等待对话.SendAsync(scope,toBot);

await Conversation.SendAsync(scope, toBot);

它被定义为内部的,因此在bot.builder代码之外无法访问.因此,除非您正在对内部bot.builder东西进行编程测试,否则这完全没有用.

That is defined as internal so it is not accessible outside of the bot.builder code. So it is totally useless unless you are programming tests for internal bot.builder stuff.

有没有新的方法来解决这个问题?

Is there a new way to get around this?

推荐答案

Bot Framework是一个开源项目,您可以下载代码并根据需要对其进行修改.在您的情况下,请删除internal关键字.另一种选择是创建一个新类,该类继承自您尝试使用的类,并对需要覆盖的方法设置自己的访问级别. 此博客文章描述了如何使用代码本地.

Bot Framework is an open source project, you can download the code and modify it as you need. In your case removing the internal keyword. Another option would be to create a new class that inherits from the class you are trying to use and making your own access levels on the methods you need to override. This blog post describes how to use the code locally.

这篇关于单元测试Bot框架的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆