diff options
Diffstat (limited to 'external/rx/Rx/NET/Source/Microsoft.Reactive.Testing/ReactiveTest.cs')
-rw-r--r-- | external/rx/Rx/NET/Source/Microsoft.Reactive.Testing/ReactiveTest.cs | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/external/rx/Rx/NET/Source/Microsoft.Reactive.Testing/ReactiveTest.cs b/external/rx/Rx/NET/Source/Microsoft.Reactive.Testing/ReactiveTest.cs index 37ff279696..45d8424647 100644 --- a/external/rx/Rx/NET/Source/Microsoft.Reactive.Testing/ReactiveTest.cs +++ b/external/rx/Rx/NET/Source/Microsoft.Reactive.Testing/ReactiveTest.cs @@ -65,15 +65,13 @@ namespace Microsoft.Reactive.Testing } /// <summary> - /// Factory method for an OnCompleted notification record at a given time. + /// Factory method for an OnCompleted notification record at a given time, using inference to determine the type of <typeparamref name="T"/>. /// </summary> /// <typeparam name="T">The element type for the resulting notification object.</typeparam> - /// <param name="dummy">An unused instance of type T, to force the compiler to infer that T as part of the method's return value.</param> /// <param name="ticks">Recorded virtual time the OnCompleted notification occurs.</param> + /// <param name="witness">Object solely used to infer the type of the <typeparamref name="T"/> type parameter. This parameter is typically used when creating a sequence of anonymously typed elements.</param> /// <returns>Recorded OnCompleted notification.</returns> - /// <remarks>This overload is used for anonymous types - by passing in an instance of the type, the compiler can infer the - /// anonymous type without you having to try naming the type.</remarks> - public static Recorded<Notification<T>> OnCompleted<T>(T dummy, long ticks) + public static Recorded<Notification<T>> OnCompleted<T>(long ticks, T witness) { return new Recorded<Notification<T>>(ticks, Notification.CreateOnCompleted<T>()); } @@ -109,19 +107,17 @@ namespace Microsoft.Reactive.Testing return new Recorded<Notification<T>>(ticks, new OnErrorPredicate<T>(predicate)); } - + /// <summary> - /// Factory method for an OnError notification record at a given time with a given error. + /// Factory method for an OnError notification record at a given time with a given error, using inference to determine the type of <typeparamref name="T"/>. /// </summary> /// <typeparam name="T">The element type for the resulting notification object.</typeparam> - /// <param name="dummy">An unused instance of type T, to force the compiler to infer that T as part of the method's return value.</param> /// <param name="ticks">Recorded virtual time the OnError notification occurs.</param> /// <param name="exception">Recorded exception stored in the OnError notification.</param> + /// <param name="witness">Object solely used to infer the type of the <typeparamref name="T"/> type parameter. This parameter is typically used when creating a sequence of anonymously typed elements.</param> /// <returns>Recorded OnError notification.</returns> /// <exception cref="ArgumentNullException"><paramref name="exception"/> is null.</exception> - /// <remarks>This overload is used for anonymous types - by passing in an instance of the type, the compiler can infer the - /// anonymous type without you having to try naming the type.</remarks> - public static Recorded<Notification<T>> OnError<T>(T dummy, long ticks, Exception exception) + public static Recorded<Notification<T>> OnError<T>(long ticks, Exception exception, T witness) { if (exception == null) throw new ArgumentNullException("exception"); @@ -130,17 +126,15 @@ namespace Microsoft.Reactive.Testing } /// <summary> - /// Factory method for writing an assert that checks for an OnError notification record at a given time, using the specified predicate to check the exception. + /// Factory method for writing an assert that checks for an OnError notification record at a given time, using the specified predicate to check the exception and inference to determine the type of <typeparamref name="T"/>. /// </summary> /// <typeparam name="T">The element type for the resulting notification object.</typeparam> - /// <param name="dummy">An unused instance of type T, to force the compiler to infer that T as part of the method's return value.</param> /// <param name="ticks">Recorded virtual time the OnError notification occurs.</param> /// <param name="predicate">Predicate function to check the OnError notification value against an expected exception.</param> + /// <param name="witness">Object solely used to infer the type of the <typeparamref name="T"/> type parameter. This parameter is typically used when creating a sequence of anonymously typed elements.</param> /// <returns>Recorded OnError notification with a predicate to assert a given exception.</returns> /// <exception cref="ArgumentNullException"><paramref name="predicate"/> is null.</exception> - /// <remarks>This overload is used for anonymous types - by passing in an instance of the type, the compiler can infer the - /// anonymous type without you having to try naming the type.</remarks> - public static Recorded<Notification<T>> OnError<T>(T dummy, long ticks, Func<Exception, bool> predicate) + public static Recorded<Notification<T>> OnError<T>(long ticks, Func<Exception, bool> predicate, T witness) { if (predicate == null) throw new ArgumentNullException("predicate"); |