forked from nsubstitute/NSubstitute
-
Notifications
You must be signed in to change notification settings - Fork 0
/
BreakingChanges.txt
73 lines (52 loc) · 3.15 KB
/
BreakingChanges.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
================================================================================================
1.4.0 Release
================================================================================================
Auto-substitute from substitutes of `Func` delegates (following the same rules as auto-subbing
for methods and properties). So the delegate returned from `Substitute.For<Func<IFoo>>()` will
return a substitute of `IFoo`. This means some substitutes for delegates that used to return
null will now return a new substitute.
Reason:
Reduced setup when substituting for `Func` delegates, and consistency with behaviour for
properties and methods.
Fix:
Explicitly return null from substitute delegates when required for a test.
e.g. subFunc().Returns(x => null);
================================================================================================
1.2.0 Release
================================================================================================
Auto-substitute for pure virtual classes (in addition to interfaces and delegate types), which
means some methods and properties on substitutes that used to return null by default will now
return a new substitute of that type.
Reason:
Cut down the code required to configure substitute members that return interface-like types
(e.g. ASP.NET web abstractions like HttpContextBase) which are safe to create and proxy.
Safe classes are those with all their public methods and properties defined as virtual or
abstract, and containing a default, parameterless constructor defined as public or protected.
Fix:
Explicitly return null from methods and property getters when required for a test.
e.g. sub.Method().Returns(x => null);
================================================================================================
0.9.5 Release
================================================================================================
Raise.Event<TEventArgs>(...) methods renamed to Raise.EventWith<TEventArgs()
Reason:
The Raise.Event<TEventArgs>() signature would often conflict with the
Raise.Event<THandler>() method which is used to raise all types of events.
Raise.Event<THandler>() will now always work for any event type, while
Raise.EventWith<TEventArgs>() can be used as a shortcut to raise
EventHandler-style events with a particular argument.
Fix:
Replace Raise.Event<TEventArgs>() calls with equivalent Raise.EventWith<TEventArgs>() call.
------------------------------------------------------------------------------------------------
Raise.Action() methods removed
Reason:
The Raise.Event<THandler>() method can be used to raise all delegate events, including Actions.
Raise.Action() was removed so there is a consistent way of raising all delegate events.
Fix:
- Replace Raise.Action() calls with Raise.Event<Action>().
- Replace Raise.Action<T>(T arg) calls with Raise.Event<Action<T>>(arg).
- Replace Raise.Action<T1,T2>(T1 x, T2 y) calls with Raise.Event<Action<T1,T2>>(x, y).
================================================================================================
0.9.0 Release
================================================================================================
No breaking changes.