Created
April 19, 2011 02:55
-
-
Save nissuk/926728 to your computer and use it in GitHub Desktop.
C#: NUnitの単純な例
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Text; | |
// 使用する前に nunit.framework を参照設定に入れて下さい。 | |
using NUnit.Framework; | |
namespace ExampleAppTest | |
{ | |
[TestFixture] | |
public class ExampleTest | |
{ | |
[Test] | |
public void 計算した値が期待した値と同じ() | |
{ | |
int actual = 1 + 1; | |
int expected = 2; | |
Assert.AreEqual(expected, actual); | |
} | |
[Test] | |
[ExpectedException(typeof(Exception))] | |
public void 例外が発生する() | |
{ | |
throw new Exception(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment