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的更多相关文章

  1. [转]Python in Visual Studio Code

    本文转自:https://code.visualstudio.com/docs/languages/python Working with Python in Visual Studio Code, ...

  2. [转] Visual Studio Code behind a proxy

    http://www.tuicool.com/articles/jyyIBf3 http://blog.majcica.com/2016/04/07/visual-studio-code-behind ...

  3. Scala on Visual Studio Code

    Download and install Scala Download a scala installation package from here. Then install it. Linux s ...

  4. 在Visual Studio Code中开发Office Add-in

    作者:陈希章 发表于 2017年7月13日 上一篇 我介绍了如何在Visual Studio中开发Office Add-in,因为有标准的项目模板,一系列配套的工具,尤其是自带的一键调试功能,可以让开 ...

  5. 开发者说 | 使用Visual Studio Code编译、调试Apollo项目

    转载地址:https://mp.weixin.qq.com/s?__biz=MzI1NjkxOTMyNQ==&mid=2247484266&idx=1&sn=d6bcd4842 ...

  6. [转]Using Angular in Visual Studio Code

    本文转自:https://code.visualstudio.com/docs/nodejs/angular-tutorial Using Angular in Visual Studio Code ...

  7. Java on Visual Studio Code的更新 – 2021年7月

    Nick zhu, Senior Program Manager, Developer Division at Microsoft 大家好,欢迎来到 7 月版的 Visual Studio Code ...

  8. Visual Studio Code 代理设置

    Visual Studio Code (简称 VS Code)是由微软研发的一款免费.开源的跨平台文本(代码)编辑器,在十多年的编程经历中,我使用过非常多的的代码编辑器(包括 IDE),例如 Fron ...

  9. 在Visual Studio Code中配置GO开发环境

    一.GO语言安装 详情查看:GO语言下载.安装.配置 二.GoLang插件介绍 对于Visual Studio Code开发工具,有一款优秀的GoLang插件,它的主页为:https://github ...

随机推荐

  1. 2015 提高组 信息传递--tarjan找最小环

    P2661 信息传递 题目描述 有 n 个同学(编号为 1 到 n )正在玩一个信息传递的游戏.在游戏里每人都有一个固定的信息传递对象,其中,编号为 i 的同学的信息传递对象是编号为 Ti​ 的同学. ...

  2. noip2019——动态规划刷题历程

    加粗的是值得总结的 从洛谷的普及题开始刷题: 背包式dp(有些技巧的) 1.p2639[USACO09OCT]Bessie的体重问题 -p1049取模意义下01背包 技巧:重量=价值 2.金明的预算问 ...

  3. POJ-1011(sticks,深搜)

    Description George took sticks of the same length and cut them randomly until all parts became at mo ...

  4. Windows使用Nginx+ffmpeg搭建RTMP服务器

    简介Nginx是一款轻量级的Web 服务器/反向代理服务器及电子邮件(IMAP/POP3)代理服务器.nginx-rmtp-module是Nginx服务器的流媒体插件.nginx通过rtmp模块提供r ...

  5. jQuery 1.9升级指南

    http://www.css88.com/archives/5086 原文地址:http://jquery.com/upgrade-guide/1.9/ 翻译的不对或者不通顺的地方欢迎拍砖留言。 概述 ...

  6. mysql 递归查询父节点 和子节点

    查父集合 --drop FUNCTION `getParentList` )) ) BEGIN ) default ''; ) default rootId; WHILE rootId is not ...

  7. ubuntu使用git提交github时,执行pull或者push命令要重新输入用户名和密码

    ubuntu使用git提交github时,执行pull或者push命令要重新输入用户名和密码: 1:问题现象: hlp@hlp:~/code/github_code/catch_imooc1$ git ...

  8. 关于NSArray的去重

    提到去重,第一反应就是for或while循环来遍历处理. 然后有了几种思路: 1) 两个循环嵌套 对比 然后去重: 但是这种方法会数据丢失, arr为要去重的数组 ; i<arr.count; ...

  9. spring security3.1升级到4.1问题(1)访问/j_spring_security_check 404

    升级完后,发现登录不进去,把post改成get好了,但是系统的提交表单功能都不能用了,也是解决了很长时间,最后找到了根本原因. spring sercurity 4.0 csrf保护是默认开启的,cs ...

  10. spring mvc dispatcherServlet

    1. 在web.xml中配置servlet对相应的url请求进行处理 <servlet> <servlet-name>springDispatcher</servlet- ...