<i id='bODfO'><tr id='bODfO'><dt id='bODfO'><q id='bODfO'><span id='bODfO'><b id='bODfO'><form id='bODfO'><ins id='bODfO'></ins><ul id='bODfO'></ul><sub id='bODfO'></sub></form><legend id='bODfO'></legend><bdo id='bODfO'><pre id='bODfO'><center id='bODfO'></center></pre></bdo></b><th id='bODfO'></th></span></q></dt></tr></i><div id='bODfO'><tfoot id='bODfO'></tfoot><dl id='bODfO'><fieldset id='bODfO'></fieldset></dl></div>

    <small id='bODfO'></small><noframes id='bODfO'>

      <bdo id='bODfO'></bdo><ul id='bODfO'></ul>
    <tfoot id='bODfO'></tfoot>

    <legend id='bODfO'><style id='bODfO'><dir id='bODfO'><q id='bODfO'></q></dir></style></legend>

      1. 如何对与 VS DOM 交互的 Visual Studio 插件进行单元测试

        时间:2023-09-17

        <legend id='uDMSR'><style id='uDMSR'><dir id='uDMSR'><q id='uDMSR'></q></dir></style></legend>
      2. <tfoot id='uDMSR'></tfoot>

          • <small id='uDMSR'></small><noframes id='uDMSR'>

                <bdo id='uDMSR'></bdo><ul id='uDMSR'></ul>
                    <tbody id='uDMSR'></tbody>

                  <i id='uDMSR'><tr id='uDMSR'><dt id='uDMSR'><q id='uDMSR'><span id='uDMSR'><b id='uDMSR'><form id='uDMSR'><ins id='uDMSR'></ins><ul id='uDMSR'></ul><sub id='uDMSR'></sub></form><legend id='uDMSR'></legend><bdo id='uDMSR'><pre id='uDMSR'><center id='uDMSR'></center></pre></bdo></b><th id='uDMSR'></th></span></q></dt></tr></i><div id='uDMSR'><tfoot id='uDMSR'></tfoot><dl id='uDMSR'><fieldset id='uDMSR'></fieldset></dl></div>

                  本文介绍了如何对与 VS DOM 交互的 Visual Studio 插件进行单元测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我开发了一个 Visual Studio 插件,它与 Visual Studio DOM 交互并修改加载的解决方案.
                  虽然我已经努力分离与 DOM 交互的代码并可以通过单元测试对其他业务逻辑进行单元测试,但有没有办法对 VS DOM 交互功能和添加自定义菜单项的加载项初始化代码进行单元测试视觉工作室?

                  I have developed a Visual Studio Add-In which interacts with the Visual Studio DOM and amends the loaded solution.
                  While I have endevoured to seperate the code which interacts with the DOM and can unit test the other business logic via unit tests, is there a way to unit test the VS DOM interaction functionality and the Add-In initialisation code which adds custom menu items to Visaual Studio?

                  推荐答案

                  这可能有助于回答这个问题...我有一个代码示例来创建一个 DTE VS 实例,我希望我可以使用它在我的单元测试中注入我的类,它与 VS 交互,然后希望分析 DTE 对象以确认测试成功标准.我还没来得及在测试中尝试它,但它看起来很有希望.

                  This may go some way to answer this... I've got a code sample to create a DTE VS instance which i'm hoping I can then use in my unit test to inject into my class, which interacts with VS, and then hopefully analyse the DTE object to confirm the tests success criteria. I havent got round to trying it within a test but it looks promising.

                          DTE2 dte = null;
                          try
                          {
                              Type type = System.Type.GetTypeFromProgID("VisualStudio.DTE.10.0");
                              object inst = System.Activator.CreateInstance(type, true);
                              dte = (EnvDTE80.DTE2)inst;
                  
                              dte.Solution.Open(@"C:Demo.sln");
                  
                              // Inject into class under test
                  
                              // Perform the test
                  
                              // Analyse the DTE to test for success.
                  
                          }
                          finally
                          {
                              if (dte != null)
                              {
                                  dte.Quit();
                              }
                  

                  这篇关于如何对与 VS DOM 交互的 Visual Studio 插件进行单元测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:命令行自动化——期望等效 下一篇:如何在 C# 中验证消息框弹出窗口?

                  相关文章

                      <legend id='8frkg'><style id='8frkg'><dir id='8frkg'><q id='8frkg'></q></dir></style></legend>
                    1. <i id='8frkg'><tr id='8frkg'><dt id='8frkg'><q id='8frkg'><span id='8frkg'><b id='8frkg'><form id='8frkg'><ins id='8frkg'></ins><ul id='8frkg'></ul><sub id='8frkg'></sub></form><legend id='8frkg'></legend><bdo id='8frkg'><pre id='8frkg'><center id='8frkg'></center></pre></bdo></b><th id='8frkg'></th></span></q></dt></tr></i><div id='8frkg'><tfoot id='8frkg'></tfoot><dl id='8frkg'><fieldset id='8frkg'></fieldset></dl></div>

                    2. <tfoot id='8frkg'></tfoot>

                      • <bdo id='8frkg'></bdo><ul id='8frkg'></ul>

                      <small id='8frkg'></small><noframes id='8frkg'>