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 Community! Here you can ask and receive answers from other community members. If you liked or disliked an answer or thread: react with an up- or downvote.
0 votes
Hello

I'm using VB 2003. I read about the Block feature ("Building a Mock Infrastructure" in the help file) and I'd like to use it in combination with Natural TypeMocks, something like this:

    Dim recorder As New RecordExpectations
    Try
        Dim s as new Socket
        Dim m as Mock = GetLastRecordedMock()
        m.StarBlock("BasicConnection")
        s.Connect()
        s.Access()
        s.Close()
        m.EndBlock()
    Finally
        recorder.Dispose()
    End Try


Is there any way to do it?

Thanks in advance,
Julián
asked by Julian (1.8k points)

1 Answer

0 votes
Julián hi,

Using "Blocks" with Natural Typemock is supported.
Actually it is done more or less as you have specified.
If you havn't done so already I suggest that youll give it a go and and let me know how it goes.

Furthermore, there is explicit support for VerifyMode blocks by using: recorder.VerifyMode.
We are thinking of implementing a multiple mock blocks (which will give a more natural feeling to it) in the future.

In any case I think we should add an explicit example for this in the guide,
thank you for pointing this out.

Lior
TypeMock Support Group
answered by lior (13.2k points)
...