- C# 를 만. (는 브러리)
- 루 를 -> PopUp NUnit nunit.framework
- 는 Method 는 Test를, 는 TestFixture Attribute를 붙.
- NUnit gui console 브 빌 dll exe를 딩 Test를 .
~cpp
using System;
using System.IO;
using NUnit.Framework;
namespace NUnitByCShop
{
[TestFixture]
public class AssertTester
{
[Test] public void 더빼()
{
int actual = 3+2, expected = 5;
Assertion.AssertEquals(expected,actual);
Assertion.Assert(actual == expected);
}
[Test]
public void Null()
{
int[] activeArray = {1,2,3};
Assertion.AssertNotNull(activeArray);
int[] nullArray = null;
Assertion.AssertNull(nullArray);
}
[Test]
public void 는()
{
Assertion.AssertEquals(5,3+4);
}
}
[TestFixture]
public class FileTester
{
String fileName = "_________Test";
[SetUp] public void 만들()
{
FileInfo fileInfo = new FileInfo(fileName);
FileStream fileStream = fileInfo.Create();
fileStream.WriteByte(12);
fileStream.Flush();
fileStream.Close();
}
[TearDown] public void ()
{
FileInfo fileInfo = new FileInfo(fileName);
fileInfo.Delete();
}
[Test] public void ()
{
FileInfo fileInfo = new FileInfo(fileName);
Assertion.Assert(fileInfo.Exists);
}
}
}
|
|
UnitTest ¶
대 는 른 xUnit 면 불. 만 몇 놓면 동 .
NUnit
- 명 만들
- 메뉴 (tool) .
- External Tools 른.
- 른 는 Add를 른.
- 는 Title는 ( :NUnit Test(Console) ) 는.
- Command는 NUnit 램 를 .(:C:\Program Files\NUnit 2.2\bin\nunit-console.exe)
- Argument
$(ProjectDir)\bin\debug\$(TargetName).exe는. ( 보 디 모 므 더 debug. 릴리 는 release 바면 듯)
- 만 Use Output Window를 면 Output .
- 만들
- 메뉴 는 Tool 른.
- Customize를 른.
- Keyboard를 른.
- Show Command Containing 는 방 를 . 명 므 NUnit 는 몇 번 명(External Command) . 를 면 마 External Command8 . (VS2005는 부명1 번 External Tools)
- Press Shotcut Key(s) 부 는 눌러. (: Ctrl + ' )
- 르 만 르면 를 .!!
NUnit












