VB Lite Unitでの記法まとめ

VB Lite Unitの記法がなんとなくわかってきたのでメモ 〆(._.)



Option Explicit
Implements ITestCase

Private Function ITestCase_TestCaseInstance() As ITestCase
  Dim objResult As New TaskTraceTest
  ' Test for cut/paste error - programmer forgot to change type of objResult.
  'Debug.Assert TypeName(objResult) = TypeName(Me)
  Set ITestCase_TestCaseInstance = objResult
End Function

Private Property Get ITestCase_Suite() As Variant
  ' Do nothing here
  ' Only run tests within RunTest.
End Property

Private temp As Integer

Private Sub ITestCase_RunTest( _
  ByVal TestNum As Long, _
  TestName As String, _
  ExpectErrNum As Long, _
  EndOfTests As Boolean _
  Dim objTestNum As New TestNumGenerator

  Select Case TestNum
    Case tstcTestActionSetup

    Case tstcTestActionTeardown
    Case objTestNum.NextNumber
       'AssertEqualがアサ-ト関数 第三引数でテストの名前を書く
       AssertEqual 1, temp, "first"

    Case objTestNum.NextNumber

    Case objTestNum.NextNumber

        'Case 文を追加してどんどんテストを書く

    Case Else
      EndOfTests = True

  End Select

End Sub


Runtests New SampleTest

ショ-トカットキ-の Ctrl + G と F7 を利用してテストを小さく回す。