These are the release notes for Release 5.2.2.
|
||
New Features |
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()); Dim fake as ClassToIsolate = FakeInstance(Of ClassToIsolate)
NonPublicWillReturn(fake, "PrivateMethod", 10) |
|
General fixes |
In 5.2.2:
In 5.2.1:
In 5.2.0:
|
|
|
||
Known Issues |
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); 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 |
|
|
||