How to: Create a C# Test Project Add-In -wisdom

C# 进行单元测试实例 C# 进行单元测试实例,图文并茂,详细的讲解了使用VS编译器进行单元测试的方法 立即下载
 

Visual SourceSafe 

How to: Create a C# Test Project Add-In 

The following sections explain how to create and run C# project add-in for trapping events in Visual SourceSafe.

Create a C# Test Project Add-In

To create a test project in C# add-in that demonstrates how to trap the SourceSafe Events, do the following:

1.     Open Visual Studio and, from the Start page, choose New Project.

2.     Select Visual C# Projects from the tree view on the left side of the screen.

3.     Select Class Library as the project template.

4.     Set the name of the app  lication to VSSEvents and click OK to create the project.

5.     Highlight the file called Class1.cs in the Solution Explorer window and rename it to IvssEventSample.cs. Completely delete the code inserted by Visual Studio into this file.

6.     In project properties Build Configuration set Register for COM Interop to true.

7.     To use the Runtime Callable Wrapper (RCW) for the SSAPI.DLL COM component, select References under VSSEvents Project, use right mouse button and then select Add Reference. Make sure that the .NET tab is selected, and use Select button to select IVSS Microsoft.VisualStudio.SourceSafe.Interop.dll PIA. This will add the component to the Selected Components list. Click OK.

8.     To have access to System.Windows.Forms namespace classes, select References under VSSEvents Project, use right mouse button and then select Add Reference. Make sure that the .NET tab is selected, and use Select button to select System.Windows.Forms.dll. This will add the component to the Selected Components list. Click OK.

Add Sample Code

The following example demonstrates how to trap VSS events

  • Paste the code below into IvssEventSample.cs:

Copy Code

using System;

using System.Runtime.InteropServices;

using System.Runtime.InteropServices.ComTypes;

using System.Windows.Forms;

using Microsoft.VisualStudio.SourceSafe.Interop;

 

namespace IvssEventSample

{

      // Use attributes to declare a fixed Prog ID and Guid for the Add-In.

      [ProgId("Microsoft.SourceSafe.EventSample")]

      [Guid("E1916BD8-A8AA-47b7-A862-C1AF995E64EF")]

      [ComVisible(true)]

      public class IvssEventSample : IVSSEventHandler, IVSSEvents

      {

            private VSSApp vssApp;

            IConnectionPoint vssEvents;

            int cookie;

 

            public IvssEventSample()

            {

            }

 

            ~IvssEventSample()

            { }

 

            public void Init(VSSApp app)

            {

                  MessageBox.Show("Init");

 

                  // by saving the VSSApp pointer you can drive the database during events

                  this.vssApp = app;

 

                  // Wire up the COM connection point manually

                  IConnectionPointContainer cpc = (IConnectionPointContainer)app;

                  Guid guid = typeof(IVSSEvents).GUID;

                  cpc.FindConnectionPoint(ref guid, out vssEvents);

                  vssEvents.Advise(this, out cookie);

            }

 

            public void AfterAdd(VSSItem vssItem, string localSpec, string comment)

            {

                  MessageBox.Show("AfterAdd");

            }

 

            public void AfterBranch(VSSItem vssItem, string comment)

            {

                  MessageBox.Show("AfterBranch");

            }

 

            public void AfterCheckin(VSSItem vssItem, string localSpec, string comment)

            {

                  MessageBox.Show("AfterCheckin");

            }

 

            public void AfterCheckout(VSSItem vssItem, string localSpec, string comment)

            {

                  MessageBox.Show("AfterCheckout");

            }

 

            public void AfterEvent(int eventNum, VSSItem vssItem, string str, object var)

            {

                  // Use of this event is deprecated

            }

 

            public void AfterRename(VSSItem vssItem, string oldName)

            {

                  MessageBox.Show("AfterRename");

            }

 

            public void AfterUndoCheckout(VSSItem vssItem, string localSpec)

            {

                  MessageBox.Show("AfterUndoCheckout");

            }

 

            public bool BeforeAdd(VSSItem vssItem, string localSpec, string comment)

            {

                  MessageBox.Show("BeforeAdd");

                  return true;

            }

 

            public bool BeforeBranch(VSSItem vssItem, string comment)

            {

                  MessageBox.Show("BeforeBranch");

                  return true;

            }

 

            public bool BeforeCheckin(VSSItem vssItem, string localSpec, string comment)

            {

                  MessageBox.Show("BeforeCheckin");

                  System.Threading.Thread.Sleep(10000);

                  return true;

            }

 

            public bool BeforeCheckout(VSSItem vssItem, string localSpec, string comment)

            {

                  MessageBox.Show("BeforeCheckout");

                  return true;

            }

 

            public bool BeforeEvent(int eventNum, VSSItem vssItem, string str, object var)

            {

                  // Use of this event is deprecated

                  return true;

            }

 

            public bool BeforeRename(VSSItem vssItem, string oldName)

            {

                  MessageBox.Show("BeforeRename");

                  return true;

            }

 

            public bool BeforeUndoCheckout(VSSItem vssItem, string localSpec)

            {

                  MessageBox.Show("BeforeUndoCheckout");

                  return true;

            }

 

            public bool BeginCommand(int unused)

            {

                  // use of this event is deprecated

                  return true;

            }

 

            public void EndCommand(int unused)

            {

                  // Use of this event is deprecated

            }

      }

}

Configure Visual SourceSafe

To configure Visual SourceSafe do the following:

1.     Create a file named ssaddin.ini that contains the following statement:

Copy Code

Microsoft.SourceSafe.EventSample = 1

Double check that the ProgID in IvssEventSample.cs is the same as this statement in your ssaddin.ini file.

2.     Place this file into the same folder as ssapi.dll (usually /Microsoft Visual Studio/VSS/win32).

Test the Application

To test the application do the following:

1.     Build the VSSEvents DLL.

2.     Start Visual SourceSafe Explorer. While performing the operations that have corresponding event handlers in IvssEventSample.cs you should be able to observe message boxes pop up. For example, while checking out a file you will observe two dialogs. The first dialog will contain “BeforeCheckout” message, the second dialog – “AfterCheckout”.

Note: this add-in can be effective even when using it in Visual studio 2005.

【OpenClaw企业级智能体实战】第13篇:1+N架构实战!OpenClaw多Agent数字员工军团搭建指南(含完整配置+路由策略+代码落地) 单Agent因“记忆负担重、Token消耗高、响应不精准”已难以满足复杂场景需求,而多Agent团队通过“1个编排者+N个执行者”的分工协作模式,能让效率提升300%以上。本文基于OpenClaw 2026稳定版,结合阿里云开发者社区实战案例,从核心认知、准备工作、实操流程、协作机制、安全配置五大维度,完整拆解多Agent团队搭建全流程。文中包含可直接复制执行的代码、详细配置模板、路由策略设置及常见问题排查,新手可在1-2小时内落地属于自己的“数字员工”军团,覆盖内容创作、技术支持、多平台运营等多场景。 阅读详情

相关推荐

基于ESP32-C3的物联网硬件设计:从免费工具链到PCB打样全流程实战

在物联网和嵌入式开发领域,硬件设计是连接软件逻辑与物理世界的关键环节。其核心原理在于通过电路设计将微控制器、传感器、通信模块等电子元件有机整合,实现特定功能。掌握硬件设计能力的技术价值在于能够自主实现产品原型,优化成本与性能,并深入理解系统底层运作。常见的应用场景包括智能家居节点、环境监测设备、工业传感终端等。本文以热门的ESP32-C3 RISC-V物联网芯片和广泛使用的KiCad免费EDA工具为例,详细解析了从核心器件选型、射频电路布局、PCB设计规则到Gerber文件生产的完整流程,并分享了在嘉立创平

weixin_30918633的博客 333

图文详解C#单元测试

1.       新建test Project 2.       在solution中添加要进行单元测试的project 3.       在test Project上点击右键,选择添加“Unit Test”  4.       选择需要进行单元测试的project,可以一直选择到需要进行的方法上。 5.   VS 2008

cychai的专栏 2万+

谷歌DreamFusion使用方法及实例详解

DreamFusion 是谷歌提出的基于文本生成3D模型的突破性技术,无需3D训练数据,通过2D扩散模型(如Imagen)与NeRF(神经辐射场)结合实现。以下为使用社区开源实现(如。)的详细步骤及实例。

主攻大数据 人工智能 物联网 安全 低空经济等方向。mtsc 、gtest特邀分享嘉宾 1042

C# 使用MSTest测试你的程序

准备工作 在程序进行测试之前,你需要一组正确的输入数据和输出数据,以供测试程序进行比对 测试 首先随便写一个简单的方法 public class Test { public int AddNumber(int i, int j) { return i + j; } } 右键方法,点击创建单元测试 一...

LanQ的博客 1万+

lisflood-fp(一)从源码到可执行文件:Windows下的Cmake实战编译指南

本文详细介绍了在Windows环境下使用Cmake工具编译lisflood-fp水文模型源码生成可执行文件的全过程。从开发环境配置、源码获取到实战编译,逐步指导如何解决常见错误并处理运行时依赖,最终生成可用的exe文件。特别适合水文专业研究者和工程师学习参考。

weixin_30555125的博客 481

山景BP10_128DBG开发板ADC_Key驱动

最近在学习山景BP10_128DBG开发板,想使用开发板上的按键。看了看原理图和之前用过的按键好像有点不一样。常见的按键都是判断IO口是否被拉低或拉高来判断按键是否被按下。山景BP10_128DBG开发板上的按键是ADC按键,每个按键按下之后ADC的采样值是不同的,通过ADC采样回来的值进而判断哪个按键按下。这种方式核心思想就是用一个ADC通道来节约IO口,对于IO紧张的芯片是一个不错的解决思路。

weixin_56646002的博客 1310

visualstudio开始调试不执行_VisualStudio创建程序(Create a program)

打开 Visual Studio。“启动”窗口中会显示有关克隆存储库、打开最近的项目或创建全新项目的各种选项。2.选择“创建新项目”。随即打开“创建新项目”窗口,并显示几个项目模板。 模板包含给定项目类型所需的基本文件和设置。3.若要查找所需的模板,请在搜索框中键入或输入“.Net Core 控制台”。 系统会自动根据输入的关键字筛选可用模板列表。 可以通过从“语言”下拉列表选择“C#”进一步筛选...

weixin_39845347的博客 868

YOLOv11 改进 - 注意力机制 | EMA (Efficient Multi-Scale Attention) 高效多尺度注意力:跨空间学习与多分支协同增强特征表征,优化多尺度目标检测

本文介绍了高效多尺度注意力(EMA)模块及其在YOLOv11中的结合应用。现有注意力机制在通道维度缩减时可能影响深度视觉表示,EMA模块通过结合通道和空间信息、采用多尺度并行子网络结构等创新点,实现了高效的多尺度注意力机制。其基本原理包括通道和空间注意力结合、多尺度并行子网络设计等。在多个流行基准数据集上的实验表明,该模块能有效提高特征表示能力。我们将EMA集成进YOLOv11,实验证明改进后的模型在目标检测任务中性能优越,具有广泛应用前景

魔改工程师的博客 1292

Nunit Test Project(C#) + selenium环境搭建

一、准备:安装Visual Studio 二、开始安装 1. 创建Nunit Test Project(C#)项目 2. 添加Selenium的支持 使用NuGet添加包Selenium.Support和Selenium.WebDriver.MSEdgeDriver。 ->Selenium.Support: 提供Selenium的接口,已经还包含了Selenium.WebDriver中的所有库; ->Selenium.WebDriver.MSEdgeDriver: 用于下载和Edg.

zhx_zhang的博客 5184

在Windows10上安装WSL2

WSL2是微软提供的Windows子系统,允许在Windows 10和11上运行Linux环境,提供更好的性能和兼容性。安装WSL2需要启用WSL功能、更新系统、安装WSL2内核,并设置为默认版本。之后,可以通过Microsoft Store安装Linux发行版,并使用WSL命令启动和管理它们。

howard2005的专栏 5940

YOLOv8模型压缩终极方案:LAMP剪枝实战,速度提升不掉点

一个庞大的模型虽然强大,但在实际部署,尤其是资源受限的边缘设备(如无人机、移动电话、嵌入式系统)上,却面临着严峻的挑战:高昂的内存占用、巨大的计算量以及随之而来的高延迟和高能耗。本教程从LAMP剪枝的深刻理论出发,详细解释了它如何通过最小化最坏情况下的L2失真,并借助巧妙的数学简化,最终推导出一种高效、无超参数、层自适应的剪枝策略。它如同为臃肿的模型进行一次精准的“瘦身手术”,通过移除网络中冗余或不重要的权重、神经元甚至整个结构,来显著降低模型的参数量和计算量(FLOPs),从而实现推理加速和资源节约。

LXY_LOVE36的博客 174

c#语言的单元测试,单元测试(C#版)

所谓单元测试(unit testing),就是对软件中的最小单元进行检查和验证,其一般验证对象是一个函数或者一个类。值得一提的是,虽然单元测试是开发者为了验证一段代码功能正确性而写的一段代码,但是我们写一个单元测试的出发点并不是针对一段代码或者一个方法,而是针对一个应用场景(scenario),即在某些条件下某个特定的函数的行为。0. 单元测试的必要性单元测试不但会使你的工作完成得更轻松,而且会令...

weixin_42137723的博客 2778

第五章 TTM 后备管理:5.6系统内存域

系统内存域由 TTM 内置资源管理器管理,通过 ttm_tt 承载页信息,依赖 ttm_pool 提供物理页。ttm_tt 管理页数组、缓存属性与状态标志,支持外部页与换出机制。初始化分 ttm_tt_init 与 ttm_sg_tt_init,生命周期包括创建、填充、释放与销毁。页池针对 write-combined、uncached 及一致性 DMA 分配的页进行缓存,提升性能并减少 TLB 刷新。分配时高阶优先、批量设置缓存属性,回收时清零后归还池中,确保高效复用。

图形/计算GPU的驱动与虚拟化技术分享园地 2563

C# Project 问题及解决

Bug1: Unhandled Exception:System.IO.FileNotFoundException: Could not load file or assembly 'MLGMisc,Version=7.4.0.0, Culture=neutral, PublicKeyToken=9d6a406f61a3f983' or one ofits dependencies. T

gls_liujia的专栏 2802

假人有限元模型

假人模型,车辆碰撞假人有限元模型,适合做乘员安全的研究者利用

Probability and Statistics - 4th edition

Probability and Statistics - 4th edition

关于xml load 文件时:The data at the root level is invalid. Line 1, position 1.

今天在读取XML时,突然遇到这问题了,总是提示: The data at the root level is invalid. Line 1, position 1.-XmlDocument doc = new XmlDocument();-doc.LoadXml(FilePath);就是有错误,XML也是对的。--------------------最后终于找到错误所在了

wisdom的专栏 2万+

温度PID控制PLC程序

温度PID稳定控制程序,适用于欧姆龙PLC,对其他PLC也具有很大参考价值

Scrum & ScrumWorks Learning

Scrum Learning Wisdom Guo Scrum Methodology 1.     There are three main roles in Scrum: Product owner, scrum master and team members.2.     The first step in Scrum is for the Product Owner t

wisdom的专栏 5743

STM32F407中文手册

STM32f407中文手册 本参考手册面向应用开发人员,提供有关使用 STM32F405xx/07xx、STM32F415xx/17xx、 STM32F42xxx 和 STM32F43xxx 微控制器存储器与外设的完整信息。STM32F405xx/07xx、STM32F415xx/17xx、STM32F42xxx 和 STM32F43xxx 构成一个微 控制器系列,各产品具有不同的存储器大小、封装和外设。有关订购信息以及器件的机械与电气特性,请参见数据手册。有关 ARM Cortex™-M4F 内核的信息,请参见《Cortex™-M4F 技术参考手册》。

如何使用内嵌资源(embedded resource)

 内嵌资源,就是把一个资源文件bind到DLL里面来,可以在内部使用,而不需要file 在disk 上。如何embedded resource? very easy:选择要绑定的文件的属性:然后可以根据需要选择,是否把这个内嵌的资源拷贝出来:“Copy if newer”: 指如果磁盘的相同文件已经过期的话,会把内嵌的资源拷贝出来覆盖磁盘上的。具体选择那个选项,要看

wisdom的专栏 4311

SQL Server CLR: 去除字符串中的指定字符串 以及 取得当中字母

 private static string Cleanse(string InputString)        {//过滤掉 And AND aNd 等包含And的字符            MatchCollection ms = Regex.Matches(InputString, " (a|A)+(n|N)+(d|D)+ ");            foreach(Match m in

wisdom的专栏 1949

SqlDataReader & Dataset ExecuteNonQuery & ExecuteScalar

SqlDataReader & Dataset1.  Sqldatareader优点:读取数据非常快,但保持数据库连接,forward进行查询如果对返回的数据不需做大量处理的情况下,建议使用SqlDataReader,其性能要比datset好很多。缺点:保持连接使用 SQL Server 的本机网络数据传输格式从数据库连接直接读取数据。 2.  Dataset是把数据一次性读出,缓存在内存

wisdom的专栏 831

序列化(serialization) & 反序列化(de-serialization)- 序列化到内存xml

 序列化:提供了可以把内存中的对象的snapshot保存到xml,二进制文件,内存的机制;   在需要的时候,可以用反序列化就可以得到当时的 snapshot   ---------------------------------------------------------- 最近在做项目的时候,需要把一个List 序列化到内存中,但是以XML格式。   经过一定的research and t

wisdom的专栏 792

遍历xml节点 要注意 comment节点

在对xml文件中的节点进行遍历的时候,应该注意以下一点: 假设nodes对象里面包含很多xml节点:-----------------------------------------------------XmlNode[] nodes;   foreach(XmlNode xn in nodes)   {    //exclude the comment node in the

wisdom的专栏 785

C# 动态编译

C#也已通过调用类库中方法进行动态的创建类:使用CSharpCodeProvider cp = new CSharpCodeProvider();如:CSharpCodeProvider cp = new CSharpCodeProvider();            CompilerParameters paras = new CompilerParameters();      paras.

wisdom的专栏 762

使用lxml操作 Word 的 OpenXML 底层

本文综合介绍了使用lxml操作Word底层OpenXML文档的基础知识,并给出了一个效率远超VBA的提取Word文档中的表格的HTML表结构的实例,演示了用lxml获取及修改部分Word文档组成部件的文本、属性的方法。

yivifu的专栏 406

C#使用opencv和Yolo模型识别车牌号

本文基于OpenCVSharp与OnnxRuntime,结合YoloV8n-pose_plate模型(检测车牌位置)和OCR模型(识别车牌文字),实现高效车牌识别。通过预处理、目标检测、NMS筛选及文字识别流程,最终输出车牌框位置与识别文本。代码封装良好,支持自定义路径与置信度阈值,具备实际应用价值。

lweiyue的专栏 170

C# NAFNet 图片去模糊

基于NAFNet与ONNX Runtime的C# WinForms图片去模糊工具,支持DirectML GPU加速与CPU回退,实现一键去模糊、大图分块处理、并排对比及拖拽打开。具备高DPI适配、自绘圆角界面、命令行批量处理等功能,适用于Windows 10/11系统,可灵活配置模型路径与分块大小,解决显存不足与边缘接缝问题。

hixiong123的博客 259
上一篇: XML Learning - XSLT - Wisdom Guo
下一篇: 最后期限-阅读总结
wisdom521
博客等级 码龄20年 25粉丝 36原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值