Release Notes

Version 3.6

Following are the release notes for version 3.6. For breaking changes, see below.

Hide C# Code
Hide Visual Basic Code


Event firing

Professional Edition Only (see Typemock Isolator Editions)
Typemock Isolator now supports Event Firing. It is now easy to test events by firing them and verifying that the handlers were called

using (RecordExpectations recorder = RecorderManager.StartRecording())
{
  // CAUTION: ALL calls here are mocked!!!
  // Mock Click Event of next Button
  Button buttonMock = new Button();
  buttonMock.Click += null;
}

// fire the event.
RecorderManager.LastMockedEvent.Fire(this, EventArgs.Empty);

 


Natural Mocks™ conditional expectations

Enterprise Edition Only (see Typemock Isolator Editions)
Natural Mocks™ supports conditional expectations when the mock depends on the arguments passed. This allows controlling different behavior according to the passed parameters, and makes testing code cleaner.

using (RecordExpectations recorder = RecorderManager.StartRecording())
{
   // always return "TypeMock" when mockedClass.Lookup is called with 1.
   recorder.ExpectAndReturn(mockedClass.Lookup(1),"TypeMock").RepeatAlways().WhenArgumentsMatch();
}
// Thats it folks


Natural Mocks™ default behavior

Professional Edition Only (see Typemock Isolator Editions)
It is now possible to set the default behavior for all mocks. This includes:

  • Time to repeat
  • Validate arguments
  • Conditional expectations

using (RecordExpectations recorder = RecorderManager.StartRecording())
{
   // for all runs always check arguments
   recorder.DefaultBehavior.RepeatAlways().CheckArguments();
   DataBases.GetDatabase("typemock").Perform("select");
}
// Thats it folks s


Automatic concrete mock object

Typemock Isolator now supports automatic creation of default arguments for any concrete mock object.
When no constructor arguments are passed to MockManager.MockObject(), Typemock Isolator will create the required arguments to enable objects creation.


Natural Mocks™ private methods

Professional Edition Only (see Typemock Isolator Editions)
It is now possible to use Natural Mocks™ with private methods using Visual Studio Test - Private Accessors.


Bug fixes

Yes, we also have bugs. And here are the ones we fixed:

  • VerifyWithTimeout not working for MockAll mocks
  • Managed C++ failing in unknown module
  • ComException and InvalidProgramException in multithread applications

More examples

Examples added to the distributed examples

  • Examples testing events
  • Examples using conditional expectations

Breaking changes

CheckArguments now checks only the LAST statement arguments. To revert to old way, use: recorder.DefaultBehavior.CheckArguments()

 

Copyright © Typemock Ltd. 2004-2020. All Rights Reserved.