@@ -7,9 +7,6 @@ namespace NSubstitute.Core;
77
88public class WhenCalled < T > ( ISubstitutionContext context , T substitute , Action < T > call , MatchArgs matchArgs )
99{
10- private const string RecommendedThrowMethodToUseMessage =
11- "The recommended method to use is Throw()." ;
12-
1310 private readonly ICallRouter _callRouter = context . GetCallRouterFor ( substitute ! ) ;
1411 private readonly IThreadLocalContext _threadContext = context . ThreadContext ;
1512 private readonly IRouteFactory _routeFactory = context . RouteFactory ;
@@ -77,21 +74,21 @@ public void Throw(Func<CallInfo, Exception> createException) =>
7774 /// <summary>
7875 /// Throws the specified exception when called.
7976 /// </summary>
80- [ Obsolete ( RecommendedThrowMethodToUseMessage ) ]
77+ /// Prefer <see cref="Throw(System.Exception)" /> for readability.
8178 public void Throws ( Exception exception ) =>
8279 Throw ( exception ) ;
8380
8481 /// <summary>
8582 /// Throws an exception of the given type when called.
8683 /// </summary>
87- [ Obsolete ( RecommendedThrowMethodToUseMessage ) ]
84+ /// Prefer <see cref="Throw{TException}" /> for readability.
8885 public TException Throws < TException > ( ) where TException : Exception , new ( )
8986 => Throw < TException > ( ) ;
9087
9188 /// <summary>
9289 /// Throws an exception generated by the specified function when called.
9390 /// </summary>
94- [ Obsolete ( RecommendedThrowMethodToUseMessage ) ]
91+ /// Prefer <see cref="Throw(System.Func{CallInfo, System.Exception})" /> for readability.
9592 public void Throws ( Func < CallInfo , Exception > createException ) =>
9693 Throw ( createException ) ;
9794}
0 commit comments