@@ -7,9 +7,6 @@ namespace NSubstitute.Core;
7
7
8
8
public class WhenCalled < T > ( ISubstitutionContext context , T substitute , Action < T > call , MatchArgs matchArgs )
9
9
{
10
- private const string RecommendedThrowMethodToUseMessage =
11
- "The recommended method to use is Throw()." ;
12
-
13
10
private readonly ICallRouter _callRouter = context . GetCallRouterFor ( substitute ! ) ;
14
11
private readonly IThreadLocalContext _threadContext = context . ThreadContext ;
15
12
private readonly IRouteFactory _routeFactory = context . RouteFactory ;
@@ -77,21 +74,21 @@ public void Throw(Func<CallInfo, Exception> createException) =>
77
74
/// <summary>
78
75
/// Throws the specified exception when called.
79
76
/// </summary>
80
- [ Obsolete ( RecommendedThrowMethodToUseMessage ) ]
77
+ /// Prefer <see cref="Throw(System.Exception)" /> for readability.
81
78
public void Throws ( Exception exception ) =>
82
79
Throw ( exception ) ;
83
80
84
81
/// <summary>
85
82
/// Throws an exception of the given type when called.
86
83
/// </summary>
87
- [ Obsolete ( RecommendedThrowMethodToUseMessage ) ]
84
+ /// Prefer <see cref="Throw{TException}" /> for readability.
88
85
public TException Throws < TException > ( ) where TException : Exception , new ( )
89
86
=> Throw < TException > ( ) ;
90
87
91
88
/// <summary>
92
89
/// Throws an exception generated by the specified function when called.
93
90
/// </summary>
94
- [ Obsolete ( RecommendedThrowMethodToUseMessage ) ]
91
+ /// Prefer <see cref="Throw(System.Func{CallInfo, System.Exception})" /> for readability.
95
92
public void Throws ( Func < CallInfo , Exception > createException ) =>
96
93
Throw ( createException ) ;
97
94
}
0 commit comments