随笔分类 -  Xunit Warm-up

introduce how to use xunit to write test code.
xUnit Extension之DataTheories
摘要:通过为测试添加[Theory]属性,我们可以进行数据驱动的测试。测试数据分为以下几种: 1. InlineData, 由InlineDataAttribute提供 //Provides a data source for a data theory, with the data coming from inline values.[Theory][InlineData("a",... 阅读全文

posted @ 2011-11-27 00:49 蚂蚁蚂蚁 阅读(413) 评论(0) 推荐(0)

xUnit 之 Equal(1)
摘要:Equal恐怕是写xUnit测试使用最多的方法。那么Equal方法到底能进行哪些类型参数的比较呢? 我们首先看一下Equal方法的几种重载形式: 1. 最常用到的一种形式: /// <summary>/// Verifies that two objects are equal, using a default comparer./// </summary>/// <typeparam name="T">The type of the objects to be compared</typeparam>/// <para 阅读全文

posted @ 2011-11-26 14:31 蚂蚁蚂蚁 阅读(553) 评论(0) 推荐(1)

xUnit Assert之其他
摘要:1. Contains test [Fact]public void CanFindNullInContainer(){ var list = new List<object> { 16, null, "Hi there" }; Assert.Contains(null, list);} [Fact]public void ListInContainer(){ var list = new List<object> {1, 2, 3}; var list2 = new List<object> {4, 5, list}; Assert.C 阅读全文

posted @ 2011-11-26 14:13 蚂蚁蚂蚁 阅读(832) 评论(0) 推荐(0)

xUnit之Equal(2)
摘要:继续上节,列举一下Equal测试的类型: 1. ArrayTest [Fact]public void Array(){ string[] expected = { "@", "a", "ab", "b" }; string[] actual = { "@", "a", "ab", "b" }; Assert.Equal(expected, actual); Assert.Throws<NotEqualException>( 阅读全文

posted @ 2011-11-26 13:36 蚂蚁蚂蚁 阅读(309) 评论(0) 推荐(0)

What is xUnit.net? Xunit 是什么 ?
摘要:xUnit.net is a unit testing tool for the .NET Framework.Written by the original inventor of NUnit, xUnit.net is the latest technology for unit testing C#, F#, VB.NET and other .NET languages. Works with ReSharper, CodeRush, and TestDriven.NET.xUnit.net 是一个用于.NET框架的单元测试工具。xUnit出自Nunit创始人之手。可用于C#,... 阅读全文

posted @ 2011-11-24 00:36 蚂蚁蚂蚁 阅读(635) 评论(0) 推荐(0)

导航