Typemock Isolator Version 5.2.2 is out!

We’re happy to announce the release of the latest and greatest Isolator – version 5.2.2. This version packs some nifty features as well as important bug fixes. Here’s a rundown:

Faking method overloads

This feature was requested by several customers on our support email and forums. Isolator can now fine tune behavior settings for specific overloads. In the following example we are setting a different behavior according to the overload called:

Using our C# API:

[TestMethod]
public void OverloadedMethods_ReturnDifferentValuesFromEachMethod()
{
var shelf = new ProductShelf();

// When a call to GetTotalProductPrice is made with a specific product name return 50
Isolate.WhenCalled(() => shelf.GetTotalProductPrice("a")).WillReturn(50);

// When a call to GetTotalProductPrice is made without any parameters (total price of all product) return 1000
Isolate.WhenCalled(() => shelf.GetTotalProductPrice()).WillReturn(1000);

Assert.AreEqual(50, shelf.GetTotalProductPrice("a"));
Assert.AreEqual(1000, shelf.GetTotalProductPrice());
}

Using the VB friendly API:

<TestMethod()> _
Public Sub OverloadedMethods_ReturnDifferentValuesFromEachMethod()
Dim shelf As New ProductShelf()

' When a call to GetTotalProductPrice is made with a specific product name return 50
Using TheseCalls.WillReturn(50.0F)
shelf.GetTotalProductPrice("a")
End Using

' When a call to GetTotalProductPrice is made without any parameters (total price of all product) return 1000
Using TheseCalls.WillReturn(1000.0F)
shelf.GetTotalProductPrice()
End Using

Assert.AreEqual(50.0F, shelf.GetTotalProductPrice("a"))
Assert.AreEqual(1000.0F, shelf.GetTotalProductPrice())
End Sub

Non-public call faking in VB.NET

Using our VB.NET friendly API you can now fake the behavior of non public methods. This will look familiar to everyone using our C# API:

    <TestMethod()> Public Sub SetBehaviorOnPrivateMethod_ReturnSpecifiedValue()
Dim fake As ProductHandler = FakeInstance(Of ProductHandler)(Members.CallOriginal)

' Set the behavior of private method InternalCalculateWorth() to return return a known value.
' Because this is a private method we use the NonPublic entry point and pass in the fake object
' and method name
NonPublicWillReturn(fake, "InternalCalculateWorth", 100.0)

Dim result As Double = fake.CalculateProductsYearlyNetWorth(Nothing, 0, 0)

Assert.AreEqual(100.0, result)
End Sub

We still do not support assertions on non-public calls – this will be added in an upcoming version.

Bug fixes and improvements

  • A major issue causing tests linking with NCover to fail was fixed
  • RedirectCalls()SwapCallsOn() will now also work on internal and protected methods
  • Several exception messages were simplified and improved. Specifically, when using a MustSpecifiedReturnValue fake object and calling a method without specifying its behavior, a TypeMockException is thrown, instead of the previous confusing behavior.
  • Typemock Isolator can now link with Compuware DevPartner 9 for coverage, performance and memory profiling

So, what are you waiting for? Go get the new version now!

  • Shay

    Do you recommend to uninstall the current version before?

  • Dror Helper

    No, the new version should install over the older one

TOP