chevron-thin-right chevron-thin-left brand cancel-circle search youtube-icon google-plus-icon linkedin-icon facebook-icon twitter-icon toolbox download check linkedin phone twitter-old google-plus facebook profile-male chat calendar profile-male
Welcome to Typemock Answers. Here you can ask and receive answers from other community members. And if you liked or disliked an answer or thread: react with an up- or downvote Enjoy!
+1 vote
Hi Team,
 
We are upgrading Typemock from version 8.4 to version 8.6(TypemockIsolatorSuite-8.6.0.10.921967232).  I got an exception in one of the test, 
 
Please find the following code snippet simplifies and illustrates the issue
 
Sample VB.Net Code
 
Public Enum StateChange
    BySystem = 0
    ByUser
    ToShowDiff
    FromShowDiff
End Enum
 
Public Class Class1
 
    Private Sub Method1(ByRef ShowNormal As Boolean, Optional ByRef StateEditType As StateChange = -1)
        MsgBox(ShowNormal)
    End Sub
 
    Public Sub Test()
        Method1(True)
    End Sub
 
End Class
 
Typemock UnitTest Code
 
Private target As New SampleAppn.Class1
<TestMethod()> _
    Public Sub Test()
        Dim bShowNormal As Boolean = False
        Dim mock As Mock = MockManager.MockAll(GetType(SampleAppn.Class1))
        mock.ExpectCall("Method1", 1).Args(New Assign(bShowNormal), New Assign(-1))
        target.Test()
    End Sub
In the above code, the second parameter I am passing is of enum type, am actually passing integer value causing exception
 
 
The same code is working fine in TypeMock Version 8.4. Please help us to resolve in Typemock 8.6 Version. 
asked by (4.2k points)

1 Answer

0 votes

Hey satanova,

Thanks for contacting us. It looks like you’ve encountered a bug, which we will try to fix as soon as possible. 

In the meantime, try writing your test like this:

<TestMethod()> Public Sub TestMethod1()

        Dim bShowNormal As Boolean = False
        Dim mock As Mock = MockManager.MockAll(GetType(Class1))
        Dim var As StateChange = -1
        mock.ExpectCall("Method1", 1).Args(New Assign(bShowNormal), var)
        target.Test()
    End Sub
 
Let me know if that helps.
Cheers, Sapir. 
answered by (3.1k points)
Request for fix
...