Release Notes

Version 5.2.2

These are the release notes for Release 5.2.2.


New Features
  • Support for faking method overloads:
In previous versions of Isolator, when a behavior has been set on a method, it applied to all of its overloads. With overload support in place, when you define behavior separately for two overloads of the same method (separated by the method's arguments), behaviors will apply to each overload separately. In the following example we set ProductShelf.GetTotalProductPrice() to return 50 for one overload, and 1000 for another:
    // Using the c# API
    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
    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")
    Enb 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()
    Enb Using

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

  • Added support for faking non-public behavior in the VB-Friendly API:
  • Dim fake as ClassToIsolate = FakeInstance(Of ClassToIsolate) 
    NonPublicWillReturn(fake, "PrivateMethod", 10)

  • Typemock Isolator now supports linking with Compuware DevPartner 9. The DevPartner performance, coverage and memory profilers are supported.


General fixes

In 5.2.2:

  • Fixed a bug which caused NCover linking to fail
  • Duck Type Swapping (Isolate.Swap.CallsOn() in c#, RedirectCalls() in VB) now also works on internal methods
  • A confusing verification exception that was thrown when calling a method faked with the MustSpecifyReturnValue behavior is changed to throw a different exception type
  • Fixed a test runner crash during finalize when faking an abstract class which is disposable
  • The error message when attempting to fake a field has been improved

In 5.2.1:

  • Visual Basic API: Fixed issue - Exception thrown WhenCalled is used with Nothing.

In 5.2.0:

  • Recursive fakes now return string.Empty (instead of null) for methods returning strings
  • Simplified the Isolator example projects structure
    • You can now find separate example solutions for c# and VB.NET, as well as a solution dedicated to our older APIs - Natural and Reflective.
  • Fixed a crash when creating fakes for classes containing anonymous delegates or lambda expressions
  • Fake.StaticConstructor() will not throw an exception when called twice
  • Faking the same struct twice is unsupported. A proper exception is thrown now for this scenario. 
    • A common solution for problems where you try to fake several copies of the same struct is to create a real copy of the struct and return it with WillReturn.
  • Improved displayed method signature in verification exception message
  • Resharper test runner is now reset when disabling and enabling Typemock Isolator in Visual Studio
  • Fixed a bug where a type's  static constructor is called even though Fake.StaticConstructor() was called for the type.


Known Issues
  • Isolator now installs into Program Files->Typemock->Isolator->5.2. When removing former versions, some artifcats on the file system and menus may remain, which can be deleted manually. 
  • When faking behavior for a chained call beginning with a static method for than once, the last behavior may override previous expectations:
  • Isolate.WhenCalled(() => ProductFactory.GetProduct().Name).WillReturn("ProductA");
    Isolate.WhenCalled(() => ProductFactory.GetProduct().Price).WillReturn(100);

    // may fail: the second behavior setting declaration overrid the first.
    Assert.AreEqual("ProductA", ProductFactory.GetProduct.Name);
  • Isolator AAA does not support nested chains in WhenCalled() and Verify methods:
  • Isolate.WhenCalled(() => fake.Call(fake.Do())).WillReturn(0); // not supported

    // instead extract the inner chain to a variable:
    var innerChain = fake.Do();
    Isolate.WhenCalled(() => fake.Call(innerChain)).WillReturn(0); // supported


Breaking changes
  • Because of the added support for overloaded method handling, if your test contained a behavior being set on different method overloads, the overload handling mechanism will now work where it didn't before. This may cause your test to act differently than it previously did.


 

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