Visual Studio Code Unit Testing
1、NUnit
project.json
{
"version": "1.0.0-*",
"testRunner": "nunit",
"buildOptions": {
"debugType": "portable"
},
"dependencies": {
"NUnit": "3.5.0",
"dotnet-test-nunit": "3.4.0-beta-3"
},
"frameworks": {
"netcoreapp1.0": {
"imports": "portable-net45+win8",
"dependencies": {
"Microsoft.NETCore.App": {
"type": "platform",
"version": "1.0.0"
}
}
}
}
}
测试类
using System;
using NUnit.Framework; namespace ClassLibrary
{
[TestFixture]
public class Class1
{
[Test]
public void Method1()
{
Assert.AreEqual(1101, 1100 + 1);
}
}
}
然后在集成终端里面输入dotnet test,就可以运行Console Runner

2、xunit
project.json
{
"version": "1.0.0-*",
"testRunner": "xunit",
"buildOptions": {
"debugType": "portable"
},
"dependencies": {
"xunit": "2.2.0-beta2-build3300",
"dotnet-test-xunit": "2.2.0-preview2-build1029"
},
"frameworks": {
"netcoreapp1.0": {
"dependencies": {
"Microsoft.NETCore.App": {
"type": "platform",
"version": "1.0.0"
}
}
}
}
}
测试类
using System;
using Xunit; namespace ClassLibrary
{
public class Class1
{
public void Method1()
{ } [Fact]
public void PassingTest()
{
int a = 5;
int b = a;
Assert.Equal(b, Add(2, 2));
} [Fact]
public void FailingTest()
{
Assert.Equal(5, Add(2, 2));
} int Add(int x, int y)
{
return x + y;
}
}
}
和NUnit一样,输入dotnet test,就可以运行测试

Visual Studio Code现在也可以直接嗅探到测试方法,只需要在上面轻轻点击run test或者debug test就可以轻松的运行个别测试

Visual Studio Code Unit Testing的更多相关文章
- [转]Python in Visual Studio Code
本文转自:https://code.visualstudio.com/docs/languages/python Working with Python in Visual Studio Code, ...
- [转] Visual Studio Code behind a proxy
http://www.tuicool.com/articles/jyyIBf3 http://blog.majcica.com/2016/04/07/visual-studio-code-behind ...
- Scala on Visual Studio Code
Download and install Scala Download a scala installation package from here. Then install it. Linux s ...
- 在Visual Studio Code中开发Office Add-in
作者:陈希章 发表于 2017年7月13日 上一篇 我介绍了如何在Visual Studio中开发Office Add-in,因为有标准的项目模板,一系列配套的工具,尤其是自带的一键调试功能,可以让开 ...
- 开发者说 | 使用Visual Studio Code编译、调试Apollo项目
转载地址:https://mp.weixin.qq.com/s?__biz=MzI1NjkxOTMyNQ==&mid=2247484266&idx=1&sn=d6bcd4842 ...
- [转]Using Angular in Visual Studio Code
本文转自:https://code.visualstudio.com/docs/nodejs/angular-tutorial Using Angular in Visual Studio Code ...
- Java on Visual Studio Code的更新 – 2021年7月
Nick zhu, Senior Program Manager, Developer Division at Microsoft 大家好,欢迎来到 7 月版的 Visual Studio Code ...
- Visual Studio Code 代理设置
Visual Studio Code (简称 VS Code)是由微软研发的一款免费.开源的跨平台文本(代码)编辑器,在十多年的编程经历中,我使用过非常多的的代码编辑器(包括 IDE),例如 Fron ...
- 在Visual Studio Code中配置GO开发环境
一.GO语言安装 详情查看:GO语言下载.安装.配置 二.GoLang插件介绍 对于Visual Studio Code开发工具,有一款优秀的GoLang插件,它的主页为:https://github ...
随机推荐
- HDU-4791-Alice‘s Print Service
分析: 1.由于价格是递减的,所以可能出现si*pi>sj*pj(j>i).所以要有一个数组来储存当前端点的最小值. 2.然后二分查找当前的si,比较q*p[i]和M[i+1].不过在这之 ...
- ajax 实现订单商品数量的增减及订单的删除进行异步更新界面
[转载]https://blog.csdn.net/luliuying_01/article/details/78177617?locationNum=8&fps=1 由于在做答辩项目,做到购 ...
- SecureCRT 64位 破解版v8.1.4
http://www.xue51.com/soft/1510.html#xzdz securecrt 破解版是一款支持SSH1和SSH2的终端仿真程序,这个程序能够在windows系统中登陆UNIX或 ...
- 第一次:从今开始玩Linux,Ubuntu16.04
首先声明,我的文章不配图,就靠文字描述,然后自己体会,摸着石头体验吧! 从今天开始玩Linux,Ubuntu16.04据说是比较稳定的,界面友好,类似与Windows界面,也有Linux的命令终端,用 ...
- 美团技术分享:大众点评App的短视频耗电量优化实战
美团技术专栏: 关注MAYOU18 前言 美团测试团队负责App的质量保证工作,日常除了App的功能测试以外,还会重点关注App的性能测试.现在大家对手机越来越依赖,而上面各App的耗电量,直接影响了 ...
- Python之阻塞IO模型与非阻塞IO模型
Python之阻塞IO模型与非阻塞IO模型 IO模型 1 阻塞IO: 全程阻塞 2 非阻塞IO: 发送多次系统调用: 优点:wait for data时无阻塞 缺点:1 系统调用太多 2 数据不是实时 ...
- php基础语句 变量 符号
中心主题 标记与注释 // /* */ 输出语句 echo输出 echo可以输出多个字符串,逗号隔开 print输出 print只能输出一个字符串,返回true或false print_r() 可以把 ...
- Python基础教程笔记——第2章:列表和元组
python shell 里重复上一次的命令:Alt+p 2.3 列表:Python的苦力 (1)list函数 (2)列表赋值,不蹦蹦为一个元素不存在的位置赋值 (3)删除元素,del name[1] ...
- java 字节码 指令集
有时候为了能理解JVM对程序所做的优化等,需要查看程序的字节码,因此知道了解一些常见的指令集很重要! 指令码 助记符 说明 0x00 nop 什么都不做 0x01 aconst_null 将null推 ...
- 洛谷——P3353 在你窗外闪耀的星星
P3353 在你窗外闪耀的星星 题目描述 飞逝的的时光不会模糊我对你的记忆.难以相信从我第一次见到你以来已经过去了3年.我仍然还生动地记得,3年前,在美丽的集美中学,从我看到你微笑着走出教室,你将头向 ...