Skip to content

Instantly share code, notes, and snippets.

@nissuk
Created April 19, 2011 02:55
Show Gist options
  • Save nissuk/926728 to your computer and use it in GitHub Desktop.
Save nissuk/926728 to your computer and use it in GitHub Desktop.
C#: NUnitの単純な例
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