Release Notes

Version 3.7

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

Hide C# Code
Hide Visual Basic Code


Windows Vista support

Typemock Isolator now runs on Windows Vista.
Install as Administrator and Enable Register Keys.


Mocking mscorlib interfaces

Enterprise Edition Only (see Typemock Isolator Editions)

You can now mock mscorlib interfaces!


Control mocking of 'hidden' base methods

You can now have better control mocking 'hidden' methods.

It is now possible to mock calls to the base class using mock.CallBase (see Hidden Methods).


Event firing with multiple instances

Professional Edition Only (see Typemock Isolator Editions)
You can now register events on multiple instances of a type and control firing of each instance.


Automatic support for singletons

When using Natural Mocks™, Typemock Isolator will automatically detect singletons and mock them accordingly. There is no need to mock them separately.


More reflective mock expectations

We have added more expectations methods:

  • ExpectUnmockedGet
  • ExpectUnmockedSet

Mocked abstract methods now have a default behavior

Typemock Isolator now creates a default implementation for interfaces and abstract methods. This enables natural property behavior and unstrict method calls.
The feature is turned off by default. Call Strict=false or StrictFlags.ArbitraryMethodsAllowed to activate it (see Arbitrary Calls).

This is the default implementation:

  • All void calls just return
  • Other methods will return a default value (0 or null depending on the return type)
  • Properties will behave like simple properties

Natural Mocks™ strictness

Professional Edition Only (see Typemock Isolator Editions)

Typemock Isolator Natural Mocks™ now support strictness; see Arbitrary Calls.


Abstract class constructors

Abstract type constructors can now be invoked when creating a Dynamic Mock Object from an abstract type.


Natural Mocks™ custom-security attribute

Professional Edition Only (see Typemock Isolator Editions)

Support for custom-security attributes on mocked code.
When in recording:

  • You will not fail on custom security issues
  • You will fail on unprivileged generic security issues

When the mock is called:

  • Security will not be automatically mocked; you will fail if you don't have the privileges
  • To mock security, you must implicitly mock it 

[Test] public void OverrideSecurity()      
{ // setup security to fail calling DoSecure()
UnAuthenticatedIdentity
notAuthenticated =
new UnAuthenticatedIdentity();
Thread.CurrentPrincipal =
new
MyPrincipal(notAuthenticated, new string[]{"GUEST"});
using (RecordExpectations recorder = RecorderManager.StartRecording())
{
  // we will mock the security and pretend to be authenticated recorder.ExpectAndReturn( notAuthenticated.IsAuthenticated, true).
RepeatAlways();
// we will mock the SecuredClass too SecuredClass.DoSecure();
}
}


Expanded constructor mocking

Classes with chained constructors can be mocked. The following example will call all original constructors in the chain.

using (RecordExpectations recorder = RecorderManager.StartRecording())
{
  // CAUTION: ALL calls here are mocked!!!
  ClassWithChainedConstructor d = new ClassWithChainedConstructor(1, 2);
  recorder.CallOriginal().CheckArguments();
}
ClassWithChainedConstructor classTested = new ClassWithChainedConstructor(1, 2);

Behavior changes:

When using natural mocks, recording a new instance will raise a VerifyException if an instance was not created.

New APIs:

  • ExpectUnmockedConstructor(int timesToRun)
  • ExpectConstructor(int timesToRun)
  • ExpectConstructorAlways()

Support for more profilers

Professional Edition Only (see Typemock Isolator Editions)

We now support ReSharper unit tests,  dotTrace profiler and
QA-Systems AQ-Time.


Controlling overridden static and instance methods

Better control mocking 'hidden' static methods. You can now mock static methods that have the same name as instance methods using mock.CallStatic (see Hidden Methods).


Bug fixes

Yes, we also have bugs. This is the list of the ones fixed in this version:

  • Natural Mocks™ disallowed fake return values when the mocked method returned value types you can now fake returned values
  • Typemock Isolator now handles List<Type> and Type[] when checking parameters automatically
  • Natural Mocks™ FailWhenCalled will not fail when verified
  • Events defined in interfaces can now be fired
  • Typemock Isolator now supports mocked methods that return a type contained a Generic Method Parameter
  • Better error messages
  • Documentation fixes
  • System.MethodAccessException when mocking internal abstract classes; the bug was fixed and you can now mock internal abstract types
  • Natural Mocks™ failure when mocking a generic static constructor; the bug was fixed and you can now mock generic static constructors

Breaking changes
  • Constructors that are explicitly expected and not called will now fail the test
  • Natural Mocks™ that returns value types must explicitly set a fake return
  • Events registered to multiple instances cannot use Fire(); use Instance[0] Fire instead
 

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