- 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