探索Visual Studio 2017测试项目配置与Azure云开发
1. 配置测试项目起步
首先,打开Visual Studio 2017 IDE,按照以下步骤创建项目:
1. 选择“文件”|“新建”|“项目”|“控制台应用程序(.NET Framework)”作为项目模板。
2. 给项目命名(例如,ConsoleApp)并创建项目。
接着,创建一个名为Person的类,并让它继承自ICloneable接口:
public class Person : ICloneable { public string ID { get; set; } public string Name { get; set; } public string Address { get; set; } public object Clone() { throw new NotImplementedException(); } }之后,为测试和代码覆盖创建单元测试项目:
1. 在解决方案资源管理器中右键单击解决方案文件,从Visual Studio上下文菜单中选择“添加”|“新建项目…”。
2. 在“添加新项目”对话框中,从“测试”类别中选择“单元测试项目(.NET Framework)”,命名(例如,TestConsoleApp)并点击“确定”。
创建好单元测试项目后,添加主项目的程序集引用: <