xUnitで使用できるAssertion
C#のテストツール「xUnit」について調べ中。xUnitを使用したC#のテストプログラム作成法
xUnitを使用したC#のテストでSetUpやTearDown、Theory
使用できるAssertionについて調べてみます。
http://xunit.codeplex.com/wikipage?title=Comparisons&referringTitle=HowToUse
こちらの「Assertions」を参考にしました。
※思いのほか長くなったので、ページ内リンクを作っておきます。
等しいか(Equal)
等しくないか(NotEqual)
同じインスタンスでないか(NotSame)
同じインスタンスであるか(Same)
コレクションに含まれるか(Contains)
コレクションに含まれないか(DoesNotContain)
エラーが発生しないか(DoesNotThrow)
指定範囲に含まれるか(InRange)
指定クラスのインスタンスであるか(IsAssignableFrom)
空であるか(Empty)
Falseであるか(False)
指定のインスタンスであるか(IsType)
空でないか(NotEmpty)
指定のインスタンスではないか(IsNotType)
Nullでないか(NotNull)
nullであるか(Null)
trueであるか(True)
範囲に含まれないか(NotInRange)
指定のエラーが発生するか(Throws)
等しいか(Equal)
第一引数と第二引数が等しければ検証通過。
等しくなければエラーを報告します。
- using Xunit;
- public class MyTests {
- [Fact]
- public void MyTest1() {
- //成功
- Assert.Equal(true, true);
- }
- [Fact]
- public void MyTest2() {
- //エラー
- Assert.Equal(true, false);
- }
- }
テストの実行結果
xUnit.net console test runner (64-bit .NET 2.0.50727.5420)
Copyright (C) 2007-11 Microsoft Corporation.
xunit.dll: Version 1.9.1.1600
Test assembly: c:¥share¥csharp¥MyTests.dll
MyTests.MyTest2 [FAIL]
Assert.Equal() Failure
Expected: True
Actual: False
Stack Trace:
場所 Xunit.Assert.Equal[T](T expected, T actual, IEqualityComparer`1 comparer)
場所 MyTests.MyTest2()
2 total, 1 failed, 0 skipped, took 0.315 seconds
等しくないか(NotEqual)
第一引数と第二引数が等しくなければ検証通過。
等しければエラーを報告します。
- using Xunit;
- public class MyTests {
- [Fact]
- public void MyTest1() {
- //成功
- Assert.NotEqual(true, false);
- }
- [Fact]
- public void MyTest2() {
- //エラー
- Assert.NotEqual(true, true);
- }
- }
テストの実行結果
xUnit.net console test runner (64-bit .NET 2.0.50727.5420)
Copyright (C) 2007-11 Microsoft Corporation.
xunit.dll: Version 1.9.1.1600
Test assembly: c:¥share¥csharp¥MyTests.dll
MyTests.MyTest2 [FAIL]
Assert.NotEqual() Failure
Stack Trace:
場所 Xunit.Assert.NotEqual[T](T expected, T actual)
場所 MyTests.MyTest2()
2 total, 1 failed, 0 skipped, took 0.335 seconds
同じインスタンスでないか(NotSame)
第一引数と第二引数のインスタンスが等しくなければ検証通過。
等しければエラーを報告します。
- using Xunit;
- public class MyTests {
- private TestData test_value = new TestData();
- [Fact]
- public void MyTest1() {
- //成功
- Assert.NotSame(test_value, new TestData());
- }
- [Fact]
- public void MyTest2() {
- //エラー
- Assert.NotSame(test_value, test_value);
- }
- }
- public class TestData {
- }
テストの実行結果
xUnit.net console test runner (64-bit .NET 2.0.50727.5420)
Copyright (C) 2007-11 Microsoft Corporation.
xunit.dll: Version 1.9.1.1600
Test assembly: c:¥share¥csharp¥MyTests.dll
MyTests.MyTest2 [FAIL]
Assert.NotSame() Failure
Stack Trace:
場所 Xunit.Assert.NotSame(Object expected, Object actual)
場所 MyTests.MyTest2()
2 total, 1 failed, 0 skipped, took 0.318 seconds
同じインスタンスであるか(Same)
第一引数と第二引数のインスタンスが等しければ検証通過。
等しくなければエラーを報告します。
- using Xunit;
- public class MyTests {
- private TestData test_value = new TestData();
- [Fact]
- public void MyTest1() {
- //成功
- Assert.Same(test_value, test_value);
- }
- [Fact]
- public void MyTest2() {
- //エラー
- Assert.Same(test_value, new TestData());
- }
- }
- public class TestData {
- }
テストの実行結果
xUnit.net console test runner (64-bit .NET 2.0.50727.5420)
Copyright (C) 2007-11 Microsoft Corporation.
xunit.dll: Version 1.9.1.1600
Test assembly: c:¥share¥csharp¥MyTests.dll
MyTests.MyTest2 [FAIL]
Assert.Same() Failure
Expected: TestData
Actual: TestData
Stack Trace:
場所 Xunit.Assert.Same(Object expected, Object actual)
場所 MyTests.MyTest2()
2 total, 1 failed, 0 skipped, took 0.312 seconds
コレクションに含まれるか(Contains)
第一引数のコレクションに第二引数の値が含まれていれば検証通過。
含まれていなければエラーを報告します。
- using System.Collections.Generic;
- using Xunit;
- public class MyTests {
- private List<int> test_value;
- public MyTests() {
- test_value = new List<int>();
- test_value.Add(10);
- test_value.Add(20);
- test_value.Add(30);
- }
- [Fact]
- public void MyTest1() {
- //成功
- Assert.Contains(20, test_value);
- }
- [Fact]
- public void MyTest2() {
- //エラー
- Assert.Contains(40, test_value);
- }
- }
テストの実行結果
xUnit.net console test runner (64-bit .NET 2.0.50727.5420)
Copyright (C) 2007-11 Microsoft Corporation.
xunit.dll: Version 1.9.1.1600
Test assembly: c:¥share¥csharp¥MyTests.dll
MyTests.MyTest2 [FAIL]
Assert.Contains() failure: Not found: 40
Stack Trace:
場所 Xunit.Assert.Contains[T](T expected, IEnumerable`1 collection, IEqualityComparer`1 comparer)
場所 MyTests.MyTest2()
2 total, 1 failed, 0 skipped, took 0.309 seconds
コレクションに含まれないか(DoesNotContain)
第一引数のコレクションに第二引数の値が含まれていなけれは検証通過。
含まれていればエラーを報告します。
- using System.Collections.Generic;
- using Xunit;
- public class MyTests {
- private List<int> test_value;
- public MyTests() {
- test_value = new List<int>();
- test_value.Add(10);
- test_value.Add(20);
- test_value.Add(30);
- }
- [Fact]
- public void MyTest1() {
- //成功
- Assert.DoesNotContain(40, test_value);
- }
- [Fact]
- public void MyTest2() {
- //エラー
- Assert.DoesNotContain(20, test_value);
- }
- }
テストの実行結果
xUnit.net console test runner (64-bit .NET 2.0.50727.5420)
Copyright (C) 2007-11 Microsoft Corporation.
xunit.dll: Version 1.9.1.1600
Test assembly: c:¥share¥csharp¥MyTests.dll
MyTests.MyTest2 [FAIL]
Assert.DoesNotContain() failure: Found: 20
Stack Trace:
場所 Xunit.Assert.DoesNotContain[T](T expected, IEnumerable`1 collection, IEqualityComparer`1 comparer)
場所 MyTests.MyTest2()
2 total, 1 failed, 0 skipped, took 0.307 seconds
エラーが発生しないか(DoesNotThrow)
エラーが発生しなければ検証通過。
エラーが発生したらテストを通過しません。
- using Xunit;
- public class MyTests {
- [Fact]
- public void MyTest1() {
- //成功
- Assert.DoesNotThrow(() => calc(10, 5) );
- }
- [Fact]
- public void MyTest2() {
- //エラー
- Assert.DoesNotThrow(() => calc(10, 0));
- }
- private int calc(int a, int b) {
- return a / b;
- }
- }
テストの実行結果
xUnit.net console test runner (64-bit .NET 2.0.50727.5420)
Copyright (C) 2007-11 Microsoft Corporation.
xunit.dll: Version 1.9.1.1600
Test assembly: c:¥share¥csharp¥MyTests.dll
MyTests.MyTest2 [FAIL]
Assert.DoesNotThrow() failure
Expected: (No exception)
Actual: System.DivideByZeroException: 0 で除算しようとしました。
Stack Trace:
場所 MyTests.<MyTest2>b__1()
場所 Xunit.Record.Exception(ThrowsDelegate code)
2 total, 1 failed, 0 skipped, took 0.316 seconds
指定範囲に含まれるか(InRange)
第一引数が、第二引数と第三引数の範囲に含まれていれば検証通過。
含まれていなければエラーとなります。
- using Xunit;
- public class MyTests {
- [Fact]
- public void MyTest1() {
- //成功
- Assert.InRange(5, 1, 10);
- }
- [Fact]
- public void MyTest2() {
- //エラー
- Assert.InRange(15, 1, 10);
- }
- }
テストの実行結果
xUnit.net console test runner (64-bit .NET 2.0.50727.5420)
Copyright (C) 2007-11 Microsoft Corporation.
xunit.dll: Version 1.9.1.1600
Test assembly: c:¥share¥csharp¥MyTests.dll
MyTests.MyTest2 [FAIL]
Assert.InRange() Failure
Range: (1 - 10)
Actual: 15
Stack Trace:
場所 Xunit.Assert.InRange[T](T actual, T low, T high, IComparer`1 comparer)
場所 MyTests.MyTest2()
2 total, 1 failed, 0 skipped, took 0.318 seconds
指定クラスのインスタンスであるか(IsAssignableFrom)
よくわかっていないのですが、指定のクラスであるかのチェックだと思います。
書き方が2通りあって、
Assert.IsAssignableFrom(typeof(string), "日本語");
という記載方法と、
Assert.IsAssignableFrom<string>("日本語");
という記載方法があります。
- using Xunit;
- public class MyTests {
- [Fact]
- public void MyTest1_1() {
- //成功
- Assert.IsAssignableFrom(typeof(string), "日本語");
- }
- [Fact]
- public void MyTest1_2() {
- //成功
- Assert.IsAssignableFrom<string>("日本語");
- }
- [Fact]
- public void MyTest2_1() {
- //エラー
- Assert.IsAssignableFrom(typeof(string), 10);
- }
- [Fact]
- public void MyTest2_2() {
- //エラー
- Assert.IsAssignableFrom<string>(10);
- }
- }
テストの実行結果
xUnit.net console test runner (64-bit .NET 2.0.50727.5420)
Copyright (C) 2007-11 Microsoft Corporation.
xunit.dll: Version 1.9.1.1600
Test assembly: c:¥share¥csharp¥MyTests.dll
MyTests.MyTest2_2 [FAIL]
Assert.IsAssignableFrom() Failure
Expected: System.String
Actual: System.Int32
Stack Trace:
場所 Xunit.Assert.IsAssignableFrom(Type expectedType, Object object)
場所 Xunit.Assert.IsAssignableFrom[T](Object object)
場所 MyTests.MyTest2_2()
MyTests.MyTest2_1 [FAIL]
Assert.IsAssignableFrom() Failure
Expected: System.String
Actual: System.Int32
Stack Trace:
場所 Xunit.Assert.IsAssignableFrom(Type expectedType, Object object)
場所 MyTests.MyTest2_1()
4 total, 2 failed, 0 skipped, took 0.311 seconds
空であるか(Empty)
文字列やリストが空白であるかを検証します。
nullのチェックではありません。
- using System.Collections.Generic;
- using Xunit;
- public class MyTests {
- [Fact]
- public void MyTest1_1() {
- //成功
- Assert.Empty("");
- }
- [Fact]
- public void MyTest1_2() {
- //成功
- Assert.Empty(new List<string>());
- }
- [Fact]
- public void MyTest2_1() {
- //エラー
- Assert.Empty("日本語");
- }
- [Fact]
- public void MyTest2_2() {
- //エラー
- Assert.Empty(null);
- }
- }
テストの実行結果
xUnit.net console test runner (64-bit .NET 2.0.50727.5420)
Copyright (C) 2007-11 Microsoft Corporation.
xunit.dll: Version 1.9.1.1600
Test assembly: c:¥share¥csharp¥MyTests.dll
MyTests.MyTest2_2 [FAIL]
System.ArgumentNullException : 値を Null にすることはできません。
パラメータ名: collection
Stack Trace:
場所 Xunit.Assert.Empty(IEnumerable collection)
場所 MyTests.MyTest2_2()
MyTests.MyTest2_1 [FAIL]
Assert.Empty() failure
Stack Trace:
場所 Xunit.Assert.Empty(IEnumerable collection)
場所 MyTests.MyTest2_1()
4 total, 2 failed, 0 skipped, took 0.316 seconds
Falseであるか(False)
これはそのまま、Falseだったら検証通過。
Trueだったらエラーとなります。
- using Xunit;
- public class MyTests {
- [Fact]
- public void MyTest1() {
- //成功
- Assert.False(1 == 2);
- }
- [Fact]
- public void MyTest2() {
- //エラー
- Assert.False(1 == 1);
- }
- }
テストの実行結果
xUnit.net console test runner (64-bit .NET 2.0.50727.5420)
Copyright (C) 2007-11 Microsoft Corporation.
xunit.dll: Version 1.9.1.1600
Test assembly: c:¥share¥csharp¥MyTests.dll
MyTests.MyTest2 [FAIL]
Assert.False() Failure
Stack Trace:
場所 Xunit.Assert.False(Boolean condition)
場所 MyTests.MyTest2()
2 total, 1 failed, 0 skipped, took 0.291 seconds
指定のインスタンスであるか(IsType)
これも2通り記載方法があります。
Assert.IsType(typeof(string), "文字列")
という記載方法と
Assert.IsType<string>("文字列")
という記載です。
- using Xunit;
- public class MyTests {
- private TestB test = new TestB();
- [Fact]
- public void MyTest1_1() {
- //成功
- Assert.IsType(typeof(TestB), test);
- }
- [Fact]
- public void MyTest1_2() {
- //成功
- Assert.IsType<TestB>(test);
- }
- [Fact]
- public void MyTest2_1() {
- //エラー
- Assert.IsType(typeof(TestA), test);
- }
- [Fact]
- public void MyTest2_2() {
- //エラー
- Assert.IsType<TestA>(test);
- }
- }
- public class TestA {
- }
- public class TestB : TestA {
- }
テストの実行結果
xUnit.net console test runner (64-bit .NET 2.0.50727.5420)
Copyright (C) 2007-11 Microsoft Corporation.
xunit.dll: Version 1.9.1.1600
Test assembly: c:¥share¥csharp¥MyTests.dll
MyTests.MyTest2_2 [FAIL]
Assert.IsType() Failure
Expected: TestA
Actual: TestB
Stack Trace:
場所 Xunit.Assert.IsType(Type expectedType, Object object)
場所 Xunit.Assert.IsType[T](Object object)
場所 MyTests.MyTest2_2()
MyTests.MyTest2_1 [FAIL]
Assert.IsType() Failure
Expected: TestA
Actual: TestB
Stack Trace:
場所 Xunit.Assert.IsType(Type expectedType, Object object)
場所 MyTests.MyTest2_1()
4 total, 2 failed, 0 skipped, took 0.327 seconds
ちなみに、上記のテストをIsTypeからIsAssignableFromに変更して実行してみます。
- using Xunit;
- public class MyTests {
- private TestB test = new TestB();
- [Fact]
- public void MyTest1_1() {
- //成功
- Assert.IsAssignableFrom(typeof(TestB), test);
- }
- [Fact]
- public void MyTest1_2() {
- //成功
- Assert.IsAssignableFrom<TestB>(test);
- }
- [Fact]
- public void MyTest2_1() {
- //エラー
- Assert.IsAssignableFrom(typeof(TestA), test);
- }
- [Fact]
- public void MyTest2_2() {
- //エラー
- Assert.IsAssignableFrom<TestA>(test);
- }
- }
- public class TestA {
- }
- public class TestB : TestA {
- }
テストは全て通過します。
xUnit.net console test runner (64-bit .NET 2.0.50727.5420)
Copyright (C) 2007-11 Microsoft Corporation.
xunit.dll: Version 1.9.1.1600
Test assembly: c:¥share¥csharp¥MyTests.dll
4 total, 0 failed, 0 skipped, took 0.306 seconds
空でないか(NotEmpty)
Emptyの逆です。
空でなければ検証通過。
要素が空ならエラーになります。
- using System.Collections.Generic;
- using Xunit;
- public class MyTests {
- [Fact]
- public void MyTest1_1() {
- //成功
- Assert.NotEmpty("日本語");
- }
- [Fact]
- public void MyTest1_2() {
- //成功
- List<int> list = new List<int>();
- list.Add(1);
- Assert.NotEmpty(list);
- }
- [Fact]
- public void MyTest2_1() {
- //エラー
- Assert.NotEmpty("");
- }
- [Fact]
- public void MyTest2_2() {
- //エラー
- Assert.NotEmpty(new List<int>());
- }
- }
テストの実行結果
xUnit.net console test runner (64-bit .NET 2.0.50727.5420)
Copyright (C) 2007-11 Microsoft Corporation.
xunit.dll: Version 1.9.1.1600
Test assembly: c:¥share¥csharp¥MyTests.dll
MyTests.MyTest2_2 [FAIL]
Assert.NotEmpty() failure
Stack Trace:
場所 Xunit.Assert.NotEmpty(IEnumerable collection)
場所 MyTests.MyTest2_2()
MyTests.MyTest2_1 [FAIL]
Assert.NotEmpty() failure
Stack Trace:
場所 Xunit.Assert.NotEmpty(IEnumerable collection)
場所 MyTests.MyTest2_1()
4 total, 2 failed, 0 skipped, took 0.303 seconds
指定のインスタンスではないか(IsNotType)
IsTypeの逆です。
指定のインスタンスでなければ検証通過。
指定のインスタンスだったらエラーになります。
- using System.Collections.Generic;
- using Xunit;
- public class MyTests {
- private ClassB test = new ClassB();
- [Fact]
- public void MyTest1_1() {
- //成功
- Assert.IsNotType(typeof(ClassA), test);
- }
- [Fact]
- public void MyTest1_2() {
- //成功
- Assert.IsNotType<ClassA>(test);
- }
- [Fact]
- public void MyTest2_1() {
- //エラー
- Assert.IsNotType(typeof(ClassB), test);
- }
- [Fact]
- public void MyTest2_2() {
- //エラー
- Assert.IsNotType<ClassB>(test);
- }
- }
- public class ClassA {
- }
- public class ClassB : ClassA {
- }
テストの実行結果
xUnit.net console test runner (64-bit .NET 2.0.50727.5420)
Copyright (C) 2007-11 Microsoft Corporation.
xunit.dll: Version 1.9.1.1600
Test assembly: c:¥share¥csharp¥MyTests.dll
MyTests.MyTest2_1 [FAIL]
Assert.IsNotType() Failure
Expected: ClassB
Actual: ClassB
Stack Trace:
場所 Xunit.Assert.IsNotType(Type expectedType, Object object)
場所 MyTests.MyTest2_1()
MyTests.MyTest2_2 [FAIL]
Assert.IsNotType() Failure
Expected: ClassB
Actual: ClassB
Stack Trace:
場所 Xunit.Assert.IsNotType(Type expectedType, Object object)
場所 Xunit.Assert.IsNotType[T](Object object)
場所 MyTests.MyTest2_2()
4 total, 2 failed, 0 skipped, took 0.314 seconds
Nullでないか(NotNull)
nullでなければ検証通過。
nullならエラーになります。
- using Xunit;
- public class MyTests {
- [Fact]
- public void MyTest1_1() {
- //成功
- Assert.NotNull("日本語");
- }
- [Fact]
- public void MyTest2_1() {
- //エラー
- Assert.NotNull(null);
- }
- }
テストの実行結果
xUnit.net console test runner (64-bit .NET 2.0.50727.5420)
Copyright (C) 2007-11 Microsoft Corporation.
xunit.dll: Version 1.9.1.1600
Test assembly: c:¥share¥csharp¥MyTests.dll
MyTests.MyTest2_1 [FAIL]
Assert.NotNull() Failure
Stack Trace:
場所 Xunit.Assert.NotNull(Object object)
場所 MyTests.MyTest2_1()
2 total, 1 failed, 0 skipped, took 0.310 seconds
nullであるか(Null)
NotNullの逆です。
nullなら検証通過。
nullでなければエラーとなります。
- using Xunit;
- public class MyTests {
- [Fact]
- public void MyTest1() {
- //成功
- Assert.Null(null);
- }
- [Fact]
- public void MyTest2() {
- //エラー
- Assert.Null("日本語");
- }
- }
テストの実行結果
xUnit.net console test runner (64-bit .NET 2.0.50727.5420)
Copyright (C) 2007-11 Microsoft Corporation.
xunit.dll: Version 1.9.1.1600
Test assembly: c:¥share¥csharp¥MyTests.dll
MyTests.MyTest2 [FAIL]
Assert.Null() Failure
Expected: (null)
Actual: 日本語
Stack Trace:
場所 Xunit.Assert.Null(Object object)
場所 MyTests.MyTest2()
2 total, 1 failed, 0 skipped, took 0.311 seconds
trueであるか(True)
Falseの逆。
trueなら検証通過。
falseならエラーを報告します。
- using Xunit;
- public class MyTests {
- [Fact]
- public void MyTest1() {
- //成功
- Assert.True(1 == 1);
- }
- [Fact]
- public void MyTest2() {
- //エラー
- Assert.True(1 == 2);
- }
- }
テストの実行結果
xUnit.net console test runner (64-bit .NET 2.0.50727.5420)
Copyright (C) 2007-11 Microsoft Corporation.
xunit.dll: Version 1.9.1.1600
Test assembly: c:¥share¥csharp¥MyTests.dll
MyTests.MyTest2 [FAIL]
Assert.True() Failure
Stack Trace:
場所 Xunit.Assert.True(Boolean condition)
場所 MyTests.MyTest2()
2 total, 1 failed, 0 skipped, took 0.305 seconds
範囲に含まれないか(NotInRange)
InRangeの逆。
第一引数が、第二引数と第三引数の範囲に含まれなければ検証通過。
含まれていたらエラーになります。
こんな感じで、文字の範囲も指定可能です。
- using Xunit;
- public class MyTests {
- [Fact]
- public void MyTest1() {
- //成功
- Assert.NotInRange("a", "x", "z");
- }
- [Fact]
- public void MyTest2() {
- //エラー
- Assert.NotInRange("y", "x", "z");
- }
- }
テストの実行結果
xUnit.net console test runner (64-bit .NET 2.0.50727.5420)
Copyright (C) 2007-11 Microsoft Corporation.
xunit.dll: Version 1.9.1.1600
Test assembly: c:¥share¥csharp¥MyTests.dll
MyTests.MyTest2 [FAIL]
Assert.NotInRange() Failure
Range: (x - z)
Actual: y
Stack Trace:
場所 Xunit.Assert.NotInRange[T](T actual, T low, T high, IComparer`1 comparer)
場所 Xunit.Assert.NotInRange[T](T actual, T low, T high)
場所 MyTests.MyTest2()
2 total, 1 failed, 0 skipped, took 0.311 seconds
指定のエラーが発生するか(Throws)
指定したエラーが発生したら検証通過。
発生しなければエラーになります。
これも書き方が2通りあります。
Assert.Throws(typeof(Exception), hoge)
Assert.Throws<Exception>(hoge)
また、エラーの種類は厳密に書く必要があるみたいです。
- using System;
- using Xunit;
- public class MyTests {
- [Fact]
- public void MyTest1_1() {
- //成功
- Assert.Throws(typeof(DivideByZeroException), () => calc(0));
- }
- [Fact]
- public void MyTest1_2() {
- //成功
- Assert.Throws<DivideByZeroException>(() => calc(0));
- }
- [Fact]
- public void MyTest2_1() {
- //エラー
- Assert.Throws(typeof(DivideByZeroException), () => calc(10));
- }
- [Fact]
- public void MyTest2_2() {
- //エラー
- Assert.Throws<DivideByZeroException>(() => calc(10));
- }
- private int calc(int val) {
- return 10 / val;
- }
- }
テストの実行結果
xUnit.net console test runner (64-bit .NET 2.0.50727.5420)
Copyright (C) 2007-11 Microsoft Corporation.
xunit.dll: Version 1.9.1.1600
Test assembly: c:¥share¥csharp¥MyTests.dll
MyTests.MyTest2_2 [FAIL]
Assert.Throws() Failure
Expected: System.DivideByZeroException
Actual: (No exception was thrown)
Stack Trace:
場所 Xunit.Assert.Throws(Type exceptionType, ThrowsDelegateWithReturn testCode)
場所 Xunit.Assert.Throws[T](ThrowsDelegateWithReturn testCode)
場所 MyTests.MyTest2_2()
MyTests.MyTest2_1 [FAIL]
Assert.Throws() Failure
Expected: System.DivideByZeroException
Actual: (No exception was thrown)
Stack Trace:
場所 Xunit.Assert.Throws(Type exceptionType, ThrowsDelegateWithReturn testCode)
場所 MyTests.MyTest2_1()
4 total, 2 failed, 0 skipped, took 0.322 seconds
【参考URL】
http://xunit.codeplex.com/wikipage?title=Comparisons&referringTitle=HowToUse
http://xunit.codeplex.com/SourceControl/BrowseLatest
コメント