[英]C# unit test with mocking for VBScript
I have made changes to a VBScript (.vbs) that needs testing. 我对需要测试的VBScript(.vbs)进行了更改。
These are some VB6 classes defined in .cls
files. 这些是.cls
文件中定义的一些VB6类。 The VBScript requires the objects of these classes. VBScript需要这些类的对象。
My changes are limited to only one function in the VBScript that requires an object for just one of the classes. 我所做的更改仅限于VBScript中仅一个函数,该函数只需要一个类的对象。
I want to avoid having to run the entire script and initiate all the objects. 我想避免必须运行整个脚本并启动所有对象。
Is there any way, I can write unit tests to test my part of the script and mock the object that I need to pass? 有什么办法可以编写单元测试来测试脚本的一部分并模拟需要传递的对象?
This is how I am using C# unit tests to mock VB6 COM classes using RhinoMocks: 这就是我使用C#单元测试使用RhinoMocks模拟VB6 COM类的方式:
Note: I am new to COM :) So if you are an experienced COM user, please feel free to edit my answer for corrections or providing more details, links, etc. 注意:我是COM的新手:)因此,如果您是经验丰富的COM用户,请随时编辑我的答案以进行更正或提供更多详细信息,链接等。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.