- 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