villaniom.blogg.se

Vb6 code
Vb6 code













vb6 code

The only thing that I can see at first glance to show what the business rule is, is to do something like this m_GlobalCode = "ABC"

vb6 code

Is there a way to write the test so as to make the business rules even more obvious? The thing is, without this test method, the mere fact that you give "ABC2014" to the function and it returns "ABC2013" can (will) be a major WTF for anyone maintaining this code in 2 years' time (including myself) the way I see it, these tests document what the business rules are. Is this the best way to write automated tests in VB6?Ĭolleagues call me a "purist" - I take it as a compliment. Running this method from the immediate pane prints GetEquivalentCodeTest: Passed., and if I tweak it to make it fail, it breaks at the assertion that evaluates to False. The implications of this function are massive, so before I deployed it I wrote a small test to ensure it returns the correct/expected value in all cases: Public Sub GetEquivalentCodeTest()ĭebug.Print "GetEquivalentCodeTest: Passed."

vb6 code

If IsMissing(code) Or code = vbNullString Then code = m_GlobalCode I have a small little function in a VB6 codebase: Public Function GetEquivalentCode(Optional ByVal code As String) As String















Vb6 code