Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/rx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAtsushi Eno <atsushieno@veritas-vos-liberabit.com>2013-01-22 13:20:44 +0400
committerAtsushi Eno <atsushieno@veritas-vos-liberabit.com>2013-01-22 13:20:44 +0400
commit4378a5b6415dfbc774d96b168a28b019337fad2d (patch)
tree6d084e01643a36471a7bdd408b2b3b448daf0cf0
parent23f5ba8fab5fbbaca72e44c8afd975dc83af1324 (diff)
delete old Rx.NET.
-rw-r--r--Rx.NET/Build.bat1
-rw-r--r--Rx.NET/BuildAll.proj107
-rw-r--r--Rx.NET/BuildSetup.bat1
-rw-r--r--Rx.NET/Clean.bat1
-rw-r--r--Rx.NET/Common.targets348
-rw-r--r--Rx.NET/Import.targets29
-rw-r--r--Rx.NET/Local.testsettings39
-rw-r--r--Rx.NET/Microsoft.Reactive.Testing/ColdObservable.cs60
-rw-r--r--Rx.NET/Microsoft.Reactive.Testing/GlobalSuppressions.cs18
-rw-r--r--Rx.NET/Microsoft.Reactive.Testing/HotObservable.cs68
-rw-r--r--Rx.NET/Microsoft.Reactive.Testing/ITestObservable.cs25
-rw-r--r--Rx.NET/Microsoft.Reactive.Testing/ITestObserver.cs20
-rw-r--r--Rx.NET/Microsoft.Reactive.Testing/Microsoft.Reactive.Testing.csproj69
-rw-r--r--Rx.NET/Microsoft.Reactive.Testing/MockObserver.cs43
-rw-r--r--Rx.NET/Microsoft.Reactive.Testing/NamespaceDoc.cs12
-rw-r--r--Rx.NET/Microsoft.Reactive.Testing/Properties/AssemblyInfo.cs23
-rw-r--r--Rx.NET/Microsoft.Reactive.Testing/ReactiveAssert.cs284
-rw-r--r--Rx.NET/Microsoft.Reactive.Testing/ReactiveTest.cs215
-rw-r--r--Rx.NET/Microsoft.Reactive.Testing/Recorded.cs108
-rw-r--r--Rx.NET/Microsoft.Reactive.Testing/Subscription.cs124
-rw-r--r--Rx.NET/Microsoft.Reactive.Testing/TestScheduler.cs163
-rw-r--r--Rx.NET/README.mono8
-rw-r--r--Rx.NET/Rx.ruleset222
-rw-r--r--Rx.NET/Rx.sln1782
-rw-r--r--Rx.NET/Rx.userprefs8
-rw-r--r--Rx.NET/Rx.vsmdi6
-rw-r--r--Rx.NET/Rx.vssscc10
-rw-r--r--Rx.NET/System.Reactive.Core/GlobalSuppressions.cs16
-rw-r--r--Rx.NET/System.Reactive.Core/InternalsVisibleTo.cs26
-rw-r--r--Rx.NET/System.Reactive.Core/NamespaceDocs.cs13
-rw-r--r--Rx.NET/System.Reactive.Core/Observable.Extensions.cs195
-rw-r--r--Rx.NET/System.Reactive.Core/Observer.Extensions.cs344
-rw-r--r--Rx.NET/System.Reactive.Core/Properties/AssemblyInfo.cs37
-rw-r--r--Rx.NET/System.Reactive.Core/Reactive/AnonymousObservable.cs38
-rw-r--r--Rx.NET/System.Reactive.Core/Reactive/AnonymousObserver.cs99
-rw-r--r--Rx.NET/System.Reactive.Core/Reactive/AnonymousSafeObserver.cs85
-rw-r--r--Rx.NET/System.Reactive.Core/Reactive/Concurrency/AsyncLock.cs84
-rw-r--r--Rx.NET/System.Reactive.Core/Reactive/Concurrency/CatchScheduler.cs151
-rw-r--r--Rx.NET/System.Reactive.Core/Reactive/Concurrency/ConcurrencyAbstractionLayer.Default.cs283
-rw-r--r--Rx.NET/System.Reactive.Core/Reactive/Concurrency/ConcurrencyAbstractionLayer.cs94
-rw-r--r--Rx.NET/System.Reactive.Core/Reactive/Concurrency/CurrentThreadScheduler.cs191
-rw-r--r--Rx.NET/System.Reactive.Core/Reactive/Concurrency/DefaultScheduler.cs176
-rw-r--r--Rx.NET/System.Reactive.Core/Reactive/Concurrency/DisableOptimizationsScheduler.cs52
-rw-r--r--Rx.NET/System.Reactive.Core/Reactive/Concurrency/ImmediateScheduler.cs123
-rw-r--r--Rx.NET/System.Reactive.Core/Reactive/Concurrency/LocalScheduler.TimerQueue.cs487
-rw-r--r--Rx.NET/System.Reactive.Core/Reactive/Concurrency/LocalScheduler.cs102
-rw-r--r--Rx.NET/System.Reactive.Core/Reactive/Concurrency/ScheduledItem.cs244
-rw-r--r--Rx.NET/System.Reactive.Core/Reactive/Concurrency/Scheduler.Async.cs432
-rw-r--r--Rx.NET/System.Reactive.Core/Reactive/Concurrency/Scheduler.Recursive.cs254
-rw-r--r--Rx.NET/System.Reactive.Core/Reactive/Concurrency/Scheduler.Services.Emulation.cs623
-rw-r--r--Rx.NET/System.Reactive.Core/Reactive/Concurrency/Scheduler.Services.cs89
-rw-r--r--Rx.NET/System.Reactive.Core/Reactive/Concurrency/Scheduler.Simple.cs86
-rw-r--r--Rx.NET/System.Reactive.Core/Reactive/Concurrency/Scheduler.Wrappers.cs59
-rw-r--r--Rx.NET/System.Reactive.Core/Reactive/Concurrency/Scheduler.cs142
-rw-r--r--Rx.NET/System.Reactive.Core/Reactive/Concurrency/SchedulerDefaults.cs15
-rw-r--r--Rx.NET/System.Reactive.Core/Reactive/Concurrency/SchedulerOperation.cs156
-rw-r--r--Rx.NET/System.Reactive.Core/Reactive/Concurrency/SchedulerQueue.cs87
-rw-r--r--Rx.NET/System.Reactive.Core/Reactive/Concurrency/SchedulerWrapper.cs124
-rw-r--r--Rx.NET/System.Reactive.Core/Reactive/Concurrency/Stopwatch.Default.cs48
-rw-r--r--Rx.NET/System.Reactive.Core/Reactive/Concurrency/Synchronization.ObserveOn.cs117
-rw-r--r--Rx.NET/System.Reactive.Core/Reactive/Concurrency/Synchronization.Synchronize.cs72
-rw-r--r--Rx.NET/System.Reactive.Core/Reactive/Concurrency/Synchronization.cs210
-rw-r--r--Rx.NET/System.Reactive.Core/Reactive/Concurrency/SynchronizationContextScheduler.cs99
-rw-r--r--Rx.NET/System.Reactive.Core/Reactive/Disposables/AnonymousDisposable.cs47
-rw-r--r--Rx.NET/System.Reactive.Core/Reactive/Disposables/BooleanDisposable.cs45
-rw-r--r--Rx.NET/System.Reactive.Core/Reactive/Disposables/CancellationDisposable.cs61
-rw-r--r--Rx.NET/System.Reactive.Core/Reactive/Disposables/CompositeDisposable.cs276
-rw-r--r--Rx.NET/System.Reactive.Core/Reactive/Disposables/ContextDisposable.cs66
-rw-r--r--Rx.NET/System.Reactive.Core/Reactive/Disposables/DefaultDisposable.cs27
-rw-r--r--Rx.NET/System.Reactive.Core/Reactive/Disposables/Disposable.cs32
-rw-r--r--Rx.NET/System.Reactive.Core/Reactive/Disposables/MultipleAssignmentDisposable.cs92
-rw-r--r--Rx.NET/System.Reactive.Core/Reactive/Disposables/RefCountDisposable.cs131
-rw-r--r--Rx.NET/System.Reactive.Core/Reactive/Disposables/ScheduledDisposable.cs85
-rw-r--r--Rx.NET/System.Reactive.Core/Reactive/Disposables/SerialDisposable.cs87
-rw-r--r--Rx.NET/System.Reactive.Core/Reactive/Disposables/SingleAssignmentDisposable.cs80
-rw-r--r--Rx.NET/System.Reactive.Core/Reactive/Internal/AsyncLockObserver.cs40
-rw-r--r--Rx.NET/System.Reactive.Core/Reactive/Internal/AutoDetachObserver.cs98
-rw-r--r--Rx.NET/System.Reactive.Core/Reactive/Internal/CheckedObserver.cs73
-rw-r--r--Rx.NET/System.Reactive.Core/Reactive/Internal/ConcurrentDictionary.cs576
-rw-r--r--Rx.NET/System.Reactive.Core/Reactive/Internal/ConcurrentQueue.cs316
-rw-r--r--Rx.NET/System.Reactive.Core/Reactive/Internal/Constants.cs17
-rw-r--r--Rx.NET/System.Reactive.Core/Reactive/Internal/ExceptionServices.Default.cs30
-rw-r--r--Rx.NET/System.Reactive.Core/Reactive/Internal/ExceptionServices.cs48
-rw-r--r--Rx.NET/System.Reactive.Core/Reactive/Internal/HostLifecycleService.cs113
-rw-r--r--Rx.NET/System.Reactive.Core/Reactive/Internal/ImmutableList.cs51
-rw-r--r--Rx.NET/System.Reactive.Core/Reactive/Internal/Lazy.cs126
-rw-r--r--Rx.NET/System.Reactive.Core/Reactive/Internal/Observers.cs109
-rw-r--r--Rx.NET/System.Reactive.Core/Reactive/Internal/PlatformEnlightenmentProvider.cs102
-rw-r--r--Rx.NET/System.Reactive.Core/Reactive/Internal/PriorityQueue.cs154
-rw-r--r--Rx.NET/System.Reactive.Core/Reactive/Internal/Producer.cs87
-rw-r--r--Rx.NET/System.Reactive.Core/Reactive/Internal/SafeObserver.cs71
-rw-r--r--Rx.NET/System.Reactive.Core/Reactive/Internal/ScheduledObserver.cs441
-rw-r--r--Rx.NET/System.Reactive.Core/Reactive/Internal/Semaphore.Silverlight.cs116
-rw-r--r--Rx.NET/System.Reactive.Core/Reactive/Internal/Semaphore.Xna.cs143
-rw-r--r--Rx.NET/System.Reactive.Core/Reactive/Internal/Sink.cs68
-rw-r--r--Rx.NET/System.Reactive.Core/Reactive/Internal/Stubs.cs16
-rw-r--r--Rx.NET/System.Reactive.Core/Reactive/Internal/SynchronizationContextExtensions.cs55
-rw-r--r--Rx.NET/System.Reactive.Core/Reactive/Internal/SynchronizedObserver.cs40
-rw-r--r--Rx.NET/System.Reactive.Core/Reactive/Internal/SystemClock.Default.cs113
-rw-r--r--Rx.NET/System.Reactive.Core/Reactive/Internal/SystemClock.cs149
-rw-r--r--Rx.NET/System.Reactive.Core/Reactive/Notification.cs649
-rw-r--r--Rx.NET/System.Reactive.Core/Reactive/ObservableBase.cs107
-rw-r--r--Rx.NET/System.Reactive.Core/Reactive/ObserverBase.cs114
-rw-r--r--Rx.NET/System.Reactive.Core/Reactive/Unit.cs82
-rw-r--r--Rx.NET/System.Reactive.Core/Strings_Core.Generated.cs172
-rw-r--r--Rx.NET/System.Reactive.Core/Strings_Core.resx145
-rw-r--r--Rx.NET/System.Reactive.Core/System.Reactive.Core.csproj127
-rw-r--r--Rx.NET/System.Reactive.Debugger/Properties/AssemblyInfo.cs37
-rw-r--r--Rx.NET/System.Reactive.Debugger/Reactive/Linq/QueryDebugger.cs29
-rw-r--r--Rx.NET/System.Reactive.Debugger/System.Reactive.Debugger.csproj62
-rw-r--r--Rx.NET/System.Reactive.Experimental/ExperimentalAttribute.cs12
-rw-r--r--Rx.NET/System.Reactive.Experimental/InternalsVisibleTo.cs17
-rw-r--r--Rx.NET/System.Reactive.Experimental/Properties/AssemblyInfo.cs38
-rw-r--r--Rx.NET/System.Reactive.Experimental/Reactive/Internal/BinaryObserver.cs34
-rw-r--r--Rx.NET/System.Reactive.Experimental/Reactive/Linq/IQueryLanguageEx.cs30
-rw-r--r--Rx.NET/System.Reactive.Experimental/Reactive/Linq/ObservableEx.cs234
-rw-r--r--Rx.NET/System.Reactive.Experimental/Reactive/Linq/QbservableEx.Generated.cs368
-rw-r--r--Rx.NET/System.Reactive.Experimental/Reactive/Linq/QbservableEx.cs57
-rw-r--r--Rx.NET/System.Reactive.Experimental/Reactive/Linq/QueryLanguageEx.cs445
-rw-r--r--Rx.NET/System.Reactive.Experimental/Reactive/ListObservable.cs205
-rw-r--r--Rx.NET/System.Reactive.Experimental/System.Reactive.Experimental.csproj62
-rw-r--r--Rx.NET/System.Reactive.Interfaces/AssemblyFileVersionAttribute.cs22
-rw-r--r--Rx.NET/System.Reactive.Interfaces/DateTimeOffset.cs805
-rw-r--r--Rx.NET/System.Reactive.Interfaces/GlobalSuppressions.cs17
-rw-r--r--Rx.NET/System.Reactive.Interfaces/IObservable.cs21
-rw-r--r--Rx.NET/System.Reactive.Interfaces/IObserver.cs33
-rw-r--r--Rx.NET/System.Reactive.Interfaces/NamespaceDocs.cs63
-rw-r--r--Rx.NET/System.Reactive.Interfaces/Properties/AssemblyInfo.cs39
-rw-r--r--Rx.NET/System.Reactive.Interfaces/Reactive/Concurrency/IScheduledItem.cs21
-rw-r--r--Rx.NET/System.Reactive.Interfaces/Reactive/Concurrency/IScheduler.cs44
-rw-r--r--Rx.NET/System.Reactive.Interfaces/Reactive/Concurrency/ISchedulerLongRunning.cs26
-rw-r--r--Rx.NET/System.Reactive.Interfaces/Reactive/Concurrency/ISchedulerPeriodic.cs23
-rw-r--r--Rx.NET/System.Reactive.Interfaces/Reactive/Concurrency/IStopwatch.cs17
-rw-r--r--Rx.NET/System.Reactive.Interfaces/Reactive/Concurrency/IStopwatchProvider.cs25
-rw-r--r--Rx.NET/System.Reactive.Interfaces/Reactive/Disposables/ICancelable.cs15
-rw-r--r--Rx.NET/System.Reactive.Interfaces/Reactive/IEventPattern.cs37
-rw-r--r--Rx.NET/System.Reactive.Interfaces/Reactive/IEventPatternSource.cs19
-rw-r--r--Rx.NET/System.Reactive.Interfaces/Reactive/IEventSource.cs25
-rw-r--r--Rx.NET/System.Reactive.Interfaces/Reactive/IObserver.Result.cs42
-rw-r--r--Rx.NET/System.Reactive.Interfaces/Reactive/Linq/IGroupedObservable.cs27
-rw-r--r--Rx.NET/System.Reactive.Interfaces/Reactive/Linq/IQbservable.cs46
-rw-r--r--Rx.NET/System.Reactive.Interfaces/Reactive/Linq/IQbservableProvider.cs23
-rw-r--r--Rx.NET/System.Reactive.Interfaces/Reactive/Subjects/IConnectableObservable.cs24
-rw-r--r--Rx.NET/System.Reactive.Interfaces/Reactive/Subjects/ISubject.Multi.cs23
-rw-r--r--Rx.NET/System.Reactive.Interfaces/Reactive/Subjects/ISubject.cs12
-rw-r--r--Rx.NET/System.Reactive.Interfaces/System.Reactive.Interfaces.csproj63
-rw-r--r--Rx.NET/System.Reactive.Linq/GlobalSuppressions.cs183
-rw-r--r--Rx.NET/System.Reactive.Linq/InternalsVisibleTo.cs23
-rw-r--r--Rx.NET/System.Reactive.Linq/NamespaceDocs.cs12
-rw-r--r--Rx.NET/System.Reactive.Linq/Properties/AssemblyInfo.cs37
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Concurrency/HistoricalScheduler.cs152
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Concurrency/VirtualTimeScheduler.Extensions.cs60
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Concurrency/VirtualTimeScheduler.cs415
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/EventPattern.cs116
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/EventPatternSource.cs28
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/EventPatternSourceBase.cs127
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/EventSource.cs95
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Internal/AnonymousEnumerable.cs26
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Internal/BinaryObserver.cs36
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Internal/ConcatSink.cs29
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Internal/Constants.cs18
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Internal/Either.Generic.cs115
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Internal/HashSet.cs28
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Internal/Helpers.cs45
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Internal/IConcatenatable.cs12
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Internal/IEvaluatableObservable.cs9
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Internal/ImmutableList.cs49
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Internal/Lookup.cs83
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Internal/Observers.cs107
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Internal/Producer.cs49
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Internal/PushPullAdapter.cs79
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Internal/QueryServices.cs35
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Internal/ReflectionUtils.cs152
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Internal/Sink.cs66
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Internal/TailRecursiveSink.cs187
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Joins/ActivePlan.cs1435
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Joins/JoinObserver.cs97
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Joins/Pattern.cs1075
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Joins/Plan.cs1169
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/GroupedObservable.cs52
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/IQueryLanguage.cs797
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/LocalQueryMethodImplementationTypeAttribute.cs36
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/Observable.Aggregates.cs2554
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/Observable.Async.cs2802
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/Observable.Awaiter.cs79
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/Observable.Binding.cs610
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/Observable.Blocking.cs503
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/Observable.Concurrency.cs155
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/Observable.Conversions.cs164
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/Observable.Creation.cs624
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/Observable.Events.cs1403
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/Observable.Imperative.cs299
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/Observable.Joins.cs91
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/Observable.Multiple.cs2386
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/Observable.Single.cs657
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/Observable.StandardSequenceOperators.cs923
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/Observable.Time.cs1985
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/Observable_.cs12
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/AddRef.cs55
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Aggregate.cs158
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/All.cs73
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Amb.cs173
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Any.cs115
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/AsObservable.cs60
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Average.cs703
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Buffer.cs709
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Case.cs85
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Cast.cs62
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Catch.cs183
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Collect.cs139
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/CombineLatest.cs1863
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Concat.cs52
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Contains.cs76
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Count.cs124
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/DefaultIfEmpty.cs60
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Defer.cs76
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Delay.cs768
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/DelaySubscription.cs76
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Dematerialize.cs63
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Distinct.cs75
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/DistinctUntilChanged.cs94
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Do.cs92
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/DoWhile.cs54
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/ElementAt.cs75
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Empty.cs48
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Finally.cs73
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/FirstAsync.cs132
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/For.cs53
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/ForEach.cs122
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/FromEvent.cs368
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/FromEventPattern.cs143
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Generate.cs292
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/GetEnumerator.cs102
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/GroupBy.cs129
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/GroupByUntil.cs289
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/GroupJoin.cs302
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/If.cs81
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/IgnoreElements.cs54
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/IsEmpty.cs53
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Join.cs336
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/LastAsync.cs140
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Latest.cs145
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/LongCount.cs124
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Materialize.cs57
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Max.cs792
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/MaxBy.cs108
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Merge.cs288
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Min.cs792
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/MinBy.cs108
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/MostRecent.cs85
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Multicast.cs82
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Never.cs20
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Next.cs156
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/ObserveOn.cs87
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/OfType.cs53
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/OnErrorResumeNext.cs60
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/PushToPullAdapter.cs93
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Range.cs83
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/RefCount.cs88
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Repeat.cs127
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Return.cs51
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Sample.cs243
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Scan.cs146
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Select.cs138
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/SelectMany.cs593
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/SequenceEqual.cs322
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/SingleAsync.cs154
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Skip.cs151
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/SkipLast.cs125
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/SkipUntil.cs210
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/SkipWhile.cs139
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Sum.cs517
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Switch.cs152
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Synchronize.cs69
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Take.cs176
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/TakeLast.cs230
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/TakeLastBuffer.cs141
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/TakeUntil.cs258
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/TakeWhile.cs149
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Throttle.cs280
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Throw.cs50
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/TimeInterval.cs73
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Timeout.cs432
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Timer.cs264
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Timestamp.cs56
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/ToArray.cs55
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/ToDictionary.cs71
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/ToList.cs55
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/ToLookup.cs72
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/ToObservable.cs174
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Using.cs76
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Where.cs135
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/While.cs53
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Window.cs758
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Zip.cs2326
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/_.cs9
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/QueryLanguage.Aggregates.cs1662
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/QueryLanguage.Async.cs1796
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/QueryLanguage.Awaiter.cs64
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/QueryLanguage.Binding.cs158
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/QueryLanguage.Blocking.cs464
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/QueryLanguage.Concurrency.cs61
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/QueryLanguage.Conversions.cs159
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/QueryLanguage.Creation.cs462
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/QueryLanguage.Events.cs653
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/QueryLanguage.Imperative.cs232
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/QueryLanguage.Joins.cs84
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/QueryLanguage.Multiple.cs1723
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/QueryLanguage.Single.cs661
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/QueryLanguage.StandardSequenceOperators.cs1265
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/QueryLanguage.Time.cs1907
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Linq/QueryLanguage_.cs8
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Observer.Extensions.cs239
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Subjects/AsyncSubject.cs334
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Subjects/BehaviorSubject.cs193
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Subjects/ConnectableObservable.cs90
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Subjects/ReplaySubject.cs341
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Subjects/Subject.Extensions.cs108
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Subjects/Subject.cs385
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Threading/Tasks/NamespaceDoc.cs12
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Threading/Tasks/TaskObservableExtensions.cs236
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/TimeInterval.cs114
-rw-r--r--Rx.NET/System.Reactive.Linq/Reactive/Timestamped.cs115
-rw-r--r--Rx.NET/System.Reactive.Linq/Strings_Linq.Generated.cs260
-rw-r--r--Rx.NET/System.Reactive.Linq/Strings_Linq.resx169
-rw-r--r--Rx.NET/System.Reactive.Linq/System.Reactive.Linq.csproj223
-rw-r--r--Rx.NET/System.Reactive.Linq/internals-visibleto-workaround.patch91
-rw-r--r--Rx.NET/System.Reactive.PlatformServices/GlobalSuppressions.cs16
-rw-r--r--Rx.NET/System.Reactive.PlatformServices/Properties/AssemblyInfo.cs37
-rw-r--r--Rx.NET/System.Reactive.PlatformServices/Reactive/Concurrency/ConcurrencyAbstractionLayerImpl.Windows.cs101
-rw-r--r--Rx.NET/System.Reactive.PlatformServices/Reactive/Concurrency/ConcurrencyAbstractionLayerImpl.cs215
-rw-r--r--Rx.NET/System.Reactive.PlatformServices/Reactive/Concurrency/EventLoopScheduler.cs375
-rw-r--r--Rx.NET/System.Reactive.PlatformServices/Reactive/Concurrency/NewThreadScheduler.cs194
-rw-r--r--Rx.NET/System.Reactive.PlatformServices/Reactive/Concurrency/TaskPoolScheduler.cs230
-rw-r--r--Rx.NET/System.Reactive.PlatformServices/Reactive/Concurrency/Thread.Stub.cs34
-rw-r--r--Rx.NET/System.Reactive.PlatformServices/Reactive/Concurrency/ThreadPoolScheduler.Windows.cs185
-rw-r--r--Rx.NET/System.Reactive.PlatformServices/Reactive/Concurrency/ThreadPoolScheduler.cs303
-rw-r--r--Rx.NET/System.Reactive.PlatformServices/Reactive/EnlightenmentProvider.cs29
-rw-r--r--Rx.NET/System.Reactive.PlatformServices/Reactive/Internal/ExceptionServicesImpl.cs19
-rw-r--r--Rx.NET/System.Reactive.PlatformServices/Reactive/Internal/HostLifecycleNotifications.Windows.cs43
-rw-r--r--Rx.NET/System.Reactive.PlatformServices/Reactive/Internal/HostLifecycleNotifications.WindowsPhone.cs63
-rw-r--r--Rx.NET/System.Reactive.PlatformServices/Reactive/Internal/PhoneShellThunks.cs214
-rw-r--r--Rx.NET/System.Reactive.PlatformServices/Reactive/Internal/PlatformEnlightenmentProvider.cs109
-rw-r--r--Rx.NET/System.Reactive.PlatformServices/Reactive/Internal/StopwatchImpl.cs28
-rw-r--r--Rx.NET/System.Reactive.PlatformServices/Strings_PlatformServices.Designer.cs72
-rw-r--r--Rx.NET/System.Reactive.PlatformServices/Strings_PlatformServices.Generated.cs95
-rw-r--r--Rx.NET/System.Reactive.PlatformServices/Strings_PlatformServices.resx123
-rw-r--r--Rx.NET/System.Reactive.PlatformServices/System.Reactive.PlatformServices.csproj74
-rw-r--r--Rx.NET/System.Reactive.Providers/GlobalSuppressions.cs29
-rw-r--r--Rx.NET/System.Reactive.Providers/Properties/AssemblyInfo.cs33
-rw-r--r--Rx.NET/System.Reactive.Providers/Reactive/Internal/Constants.cs18
-rw-r--r--Rx.NET/System.Reactive.Providers/Reactive/Joins/QueryablePattern.cs1053
-rw-r--r--Rx.NET/System.Reactive.Providers/Reactive/Joins/QueryablePlan.cs27
-rw-r--r--Rx.NET/System.Reactive.Providers/Reactive/Linq/ExpressionVisitor.cs373
-rw-r--r--Rx.NET/System.Reactive.Providers/Reactive/Linq/Observable.Queryable.cs42
-rw-r--r--Rx.NET/System.Reactive.Providers/Reactive/Linq/Qbservable.Generated.cs22610
-rw-r--r--Rx.NET/System.Reactive.Providers/Reactive/Linq/Qbservable.Joins.cs140
-rw-r--r--Rx.NET/System.Reactive.Providers/Reactive/Linq/Qbservable.cs135
-rw-r--r--Rx.NET/System.Reactive.Providers/Reactive/ObservableQuery.cs509
-rw-r--r--Rx.NET/System.Reactive.Providers/Strings_Providers.Generated.cs117
-rw-r--r--Rx.NET/System.Reactive.Providers/Strings_Providers.resx129
-rw-r--r--Rx.NET/System.Reactive.Providers/System.Reactive.Providers.csproj80
-rw-r--r--Rx.NET/System.Reactive.Runtime.Remoting/GlobalSuppressions.cs14
-rw-r--r--Rx.NET/System.Reactive.Runtime.Remoting/Properties/AssemblyInfo.cs33
-rw-r--r--Rx.NET/System.Reactive.Runtime.Remoting/Reactive/Linq/Observable.Remoting.cs114
-rw-r--r--Rx.NET/System.Reactive.Runtime.Remoting/Reactive/Linq/QueryLanguage.Remoting.cs255
-rw-r--r--Rx.NET/System.Reactive.Runtime.Remoting/System.Reactive.Runtime.Remoting.csproj46
-rw-r--r--Rx.NET/System.Reactive.Windows.Forms/GlobalSuppressions.cs14
-rw-r--r--Rx.NET/System.Reactive.Windows.Forms/Properties/AssemblyInfo.cs33
-rw-r--r--Rx.NET/System.Reactive.Windows.Forms/Reactive/Concurrency/ControlScheduler.cs184
-rw-r--r--Rx.NET/System.Reactive.Windows.Forms/Reactive/Linq/ControlObservable.cs53
-rw-r--r--Rx.NET/System.Reactive.Windows.Forms/System.Reactive.Windows.Forms.csproj51
-rw-r--r--Rx.NET/System.Reactive.Windows.Threading/GlobalSuppressions.cs14
-rw-r--r--Rx.NET/System.Reactive.Windows.Threading/Properties/AssemblyInfo.cs44
-rw-r--r--Rx.NET/System.Reactive.Windows.Threading/Reactive/Concurrency/CoreDispatcherScheduler.cs239
-rw-r--r--Rx.NET/System.Reactive.Windows.Threading/Reactive/Concurrency/DispatcherScheduler.cs248
-rw-r--r--Rx.NET/System.Reactive.Windows.Threading/Reactive/Internal/Constants.cs13
-rw-r--r--Rx.NET/System.Reactive.Windows.Threading/Reactive/Linq/CoreDispatcherObservable.cs258
-rw-r--r--Rx.NET/System.Reactive.Windows.Threading/Reactive/Linq/DispatcherObservable.cs390
-rw-r--r--Rx.NET/System.Reactive.Windows.Threading/Strings_WindowsThreading.Generated.cs106
-rw-r--r--Rx.NET/System.Reactive.Windows.Threading/Strings_WindowsThreading.resx128
-rw-r--r--Rx.NET/System.Reactive.Windows.Threading/System.Reactive.Windows.Threading.csproj60
-rw-r--r--Rx.NET/System.Reactive.WindowsRuntime/EventPatternSource.cs29
-rw-r--r--Rx.NET/System.Reactive.WindowsRuntime/Foundation/AsyncInfoExtensions.cs249
-rw-r--r--Rx.NET/System.Reactive.WindowsRuntime/Foundation/AsyncInfoToObservableBridge.cs101
-rw-r--r--Rx.NET/System.Reactive.WindowsRuntime/IEventPatternSource.cs21
-rw-r--r--Rx.NET/System.Reactive.WindowsRuntime/Linq/AsyncInfoObservable.cs204
-rw-r--r--Rx.NET/System.Reactive.WindowsRuntime/Linq/WindowsObservable.Events.cs101
-rw-r--r--Rx.NET/System.Reactive.WindowsRuntime/Linq/WindowsObservable.StandardSequenceOperators.cs103
-rw-r--r--Rx.NET/System.Reactive.WindowsRuntime/Properties/AssemblyInfo.cs31
-rw-r--r--Rx.NET/System.Reactive.WindowsRuntime/System.Reactive.WindowsRuntime.csproj57
-rw-r--r--Rx.NET/Test.ruleset6
-rw-r--r--Rx.NET/Tests.System.Reactive/App.cs48
-rw-r--r--Rx.NET/Tests.System.Reactive/DispatcherHelpers.cs68
-rw-r--r--Rx.NET/Tests.System.Reactive/Dummies/DummyDisposable.cs16
-rw-r--r--Rx.NET/Tests.System.Reactive/Dummies/DummyEnumerable.cs45
-rw-r--r--Rx.NET/Tests.System.Reactive/Dummies/DummyFunc.cs36
-rw-r--r--Rx.NET/Tests.System.Reactive/Dummies/DummyObservable.cs20
-rw-r--r--Rx.NET/Tests.System.Reactive/Dummies/DummyObserver.cs30
-rw-r--r--Rx.NET/Tests.System.Reactive/Dummies/DummyScheduler.cs36
-rw-r--r--Rx.NET/Tests.System.Reactive/Extensions.cs39
-rw-r--r--Rx.NET/Tests.System.Reactive/MockDisposable.cs29
-rw-r--r--Rx.NET/Tests.System.Reactive/MockEnumerable.cs97
-rw-r--r--Rx.NET/Tests.System.Reactive/NullErrorObservable.cs25
-rw-r--r--Rx.NET/Tests.System.Reactive/Properties/AppManifest.xml7
-rw-r--r--Rx.NET/Tests.System.Reactive/Properties/AssemblyInfo.cs23
-rw-r--r--Rx.NET/Tests.System.Reactive/Semaphore.cs116
-rw-r--r--Rx.NET/Tests.System.Reactive/Stress/Core/Disposables/Composite.cs159
-rw-r--r--Rx.NET/Tests.System.Reactive/Stress/Core/Disposables/RefCount.cs160
-rw-r--r--Rx.NET/Tests.System.Reactive/Stress/Core/Disposables/Serial.cs147
-rw-r--r--Rx.NET/Tests.System.Reactive/Stress/Core/Disposables/SingleAssignment.cs75
-rw-r--r--Rx.NET/Tests.System.Reactive/Stress/Helpers.cs216
-rw-r--r--Rx.NET/Tests.System.Reactive/Stress/Linq/Delay.cs64
-rw-r--r--Rx.NET/Tests.System.Reactive/Stress/Linq/FromEvent.cs412
-rw-r--r--Rx.NET/Tests.System.Reactive/Stress/Linq/Replay.cs57
-rw-r--r--Rx.NET/Tests.System.Reactive/TestBase.cs79
-rw-r--r--Rx.NET/Tests.System.Reactive/TestLongRunningScheduler.cs89
-rw-r--r--Rx.NET/Tests.System.Reactive/TestTaskScheduler.cs27
-rw-r--r--Rx.NET/Tests.System.Reactive/Tests.System.Reactive.csproj192
-rw-r--r--Rx.NET/Tests.System.Reactive/Tests/AnonymousTest.cs42
-rw-r--r--Rx.NET/Tests.System.Reactive/Tests/AsyncLockTest.cs133
-rw-r--r--Rx.NET/Tests.System.Reactive/Tests/AsyncSubjectTest.cs434
-rw-r--r--Rx.NET/Tests.System.Reactive/Tests/BehaviorSubjectTest.cs336
-rw-r--r--Rx.NET/Tests.System.Reactive/Tests/ConcurrencyTest.cs91
-rw-r--r--Rx.NET/Tests.System.Reactive/Tests/ConnectableObservable.cs28
-rw-r--r--Rx.NET/Tests.System.Reactive/Tests/ConnectableObservableTest.cs196
-rw-r--r--Rx.NET/Tests.System.Reactive/Tests/ControlSchedulerTest.cs329
-rw-r--r--Rx.NET/Tests.System.Reactive/Tests/CurrentThreadSchedulerTest.cs178
-rw-r--r--Rx.NET/Tests.System.Reactive/Tests/DefaultConcurrencyAbstractionLayerTest.cs291
-rw-r--r--Rx.NET/Tests.System.Reactive/Tests/DefaultSchedulerTest.cs95
-rw-r--r--Rx.NET/Tests.System.Reactive/Tests/DispatcherSchedulerTest.cs260
-rw-r--r--Rx.NET/Tests.System.Reactive/Tests/DisposableTests.cs626
-rw-r--r--Rx.NET/Tests.System.Reactive/Tests/EventLoopSchedulerTest.cs374
-rw-r--r--Rx.NET/Tests.System.Reactive/Tests/EventPatternSourceBaseTest.cs57
-rw-r--r--Rx.NET/Tests.System.Reactive/Tests/HistoricalSchedulerTest.cs417
-rw-r--r--Rx.NET/Tests.System.Reactive/Tests/ImmediateSchedulerTest.cs159
-rw-r--r--Rx.NET/Tests.System.Reactive/Tests/ListObservableTest.cs434
-rw-r--r--Rx.NET/Tests.System.Reactive/Tests/MySubject.cs53
-rw-r--r--Rx.NET/Tests.System.Reactive/Tests/NewThreadSchedulerTest.cs118
-rw-r--r--Rx.NET/Tests.System.Reactive/Tests/NotificationTest.cs592
-rw-r--r--Rx.NET/Tests.System.Reactive/Tests/ObservableAggregateTest.cs14465
-rw-r--r--Rx.NET/Tests.System.Reactive/Tests/ObservableAsyncTest.cs2460
-rw-r--r--Rx.NET/Tests.System.Reactive/Tests/ObservableAwaiterTest.cs145
-rw-r--r--Rx.NET/Tests.System.Reactive/Tests/ObservableBindingTest.cs2817
-rw-r--r--Rx.NET/Tests.System.Reactive/Tests/ObservableBlockingTest.cs1652
-rw-r--r--Rx.NET/Tests.System.Reactive/Tests/ObservableConcurrencyTest.cs1124
-rw-r--r--Rx.NET/Tests.System.Reactive/Tests/ObservableConversionTests.cs855
-rw-r--r--Rx.NET/Tests.System.Reactive/Tests/ObservableCreationTest.cs2553
-rw-r--r--Rx.NET/Tests.System.Reactive/Tests/ObservableEventsTest.cs1360
-rw-r--r--Rx.NET/Tests.System.Reactive/Tests/ObservableExTest.cs1692
-rw-r--r--Rx.NET/Tests.System.Reactive/Tests/ObservableExtensionsTest.cs116
-rw-r--r--Rx.NET/Tests.System.Reactive/Tests/ObservableImperativeTest.cs1747
-rw-r--r--Rx.NET/Tests.System.Reactive/Tests/ObservableJoinsTest.cs1709
-rw-r--r--Rx.NET/Tests.System.Reactive/Tests/ObservableMultipleTest.cs15208
-rw-r--r--Rx.NET/Tests.System.Reactive/Tests/ObservableRemotingTest.cs220
-rw-r--r--Rx.NET/Tests.System.Reactive/Tests/ObservableSafetyTest.cs284
-rw-r--r--Rx.NET/Tests.System.Reactive/Tests/ObservableSingleTest.cs4565
-rw-r--r--Rx.NET/Tests.System.Reactive/Tests/ObservableStandardQueryOperatorTest.cs12995
-rw-r--r--Rx.NET/Tests.System.Reactive/Tests/ObservableTimeTest.cs8936
-rw-r--r--Rx.NET/Tests.System.Reactive/Tests/ObserverTest.cs818
-rw-r--r--Rx.NET/Tests.System.Reactive/Tests/PrivateTypesTest.cs239
-rw-r--r--Rx.NET/Tests.System.Reactive/Tests/QbservableExTest.cs73
-rw-r--r--Rx.NET/Tests.System.Reactive/Tests/QbservableTest.cs2114
-rw-r--r--Rx.NET/Tests.System.Reactive/Tests/RegressionTest.cs429
-rw-r--r--Rx.NET/Tests.System.Reactive/Tests/ReplaySubjectTest.cs502
-rw-r--r--Rx.NET/Tests.System.Reactive/Tests/RogueEnumerable.cs27
-rw-r--r--Rx.NET/Tests.System.Reactive/Tests/ScheduledItemTest.cs137
-rw-r--r--Rx.NET/Tests.System.Reactive/Tests/SchedulerTest.cs1080
-rw-r--r--Rx.NET/Tests.System.Reactive/Tests/StopwatchTest.cs41
-rw-r--r--Rx.NET/Tests.System.Reactive/Tests/SubjectTest.cs433
-rw-r--r--Rx.NET/Tests.System.Reactive/Tests/SynchronizationContextSchedulerTest.cs234
-rw-r--r--Rx.NET/Tests.System.Reactive/Tests/SynchronizationTest.cs51
-rw-r--r--Rx.NET/Tests.System.Reactive/Tests/SystemClockTest.cs1095
-rw-r--r--Rx.NET/Tests.System.Reactive/Tests/TaskObservableExtensionsTest.cs818
-rw-r--r--Rx.NET/Tests.System.Reactive/Tests/TaskPoolSchedulerTest.cs165
-rw-r--r--Rx.NET/Tests.System.Reactive/Tests/ThreadPoolSchedulerTest.cs237
-rw-r--r--Rx.NET/Tests.System.Reactive/Tests/TimeTests.cs160
-rw-r--r--Rx.NET/Tests.System.Reactive/Tests/UnitTest.cs25
-rw-r--r--Rx.NET/Tests.System.Reactive/Tests/VirtualSchedulerTest.cs127
-rw-r--r--Rx.NET/Tests.System.Reactive/Utils.cs22
-rw-r--r--Rx.NET/Tests.System.Reactive/replacer.sh24
-rw-r--r--Rx.NET/TraceAndTestImpact.testsettings21
-rw-r--r--Rx.NET/license.txt15
-rw-r--r--Rx.NET/mono.patch15
484 files changed, 0 insertions, 197960 deletions
diff --git a/Rx.NET/Build.bat b/Rx.NET/Build.bat
deleted file mode 100644
index c0eb6be..0000000
--- a/Rx.NET/Build.bat
+++ /dev/null
@@ -1 +0,0 @@
-msbuild BuildAll.proj \ No newline at end of file
diff --git a/Rx.NET/BuildAll.proj b/Rx.NET/BuildAll.proj
deleted file mode 100644
index acfdce6..0000000
--- a/Rx.NET/BuildAll.proj
+++ /dev/null
@@ -1,107 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <LayoutOutputFolder>$(MSBuildProjectDirectory)\..\..\Layout\Rx\</LayoutOutputFolder>
- <SetupOutputFolder>$(MSBuildProjectDirectory)\..\..\Setup\Rx\</SetupOutputFolder>
- </PropertyGroup>
-
- <!-- Current platforms -->
-
- <ItemGroup>
- <!-- Important: The HomoIcon build task requires the 4.0 builds to appear first! (currently disabled) -->
- <Flavor Include="Rx.sln">
- <Configuration>Debug40</Configuration>
- </Flavor>
- <Flavor Include="Rx.sln">
- <Configuration>Release40</Configuration>
- </Flavor>
- <Flavor Include="Rx.sln">
- <Configuration>Debug45</Configuration>
- </Flavor>
- <Flavor Include="Rx.sln">
- <Configuration>Release45</Configuration>
- </Flavor>
- <Flavor Include="Rx.sln">
- <Configuration>Debug8</Configuration>
- </Flavor>
- <Flavor Include="Rx.sln">
- <Configuration>Release8</Configuration>
- </Flavor>
- <Flavor Include="Rx.sln">
- <Configuration>DebugPL</Configuration>
- </Flavor>
- <Flavor Include="Rx.sln">
- <Configuration>ReleasePL</Configuration>
- </Flavor>
- <Flavor Include="Rx.sln">
- <Configuration>DebugWP7</Configuration>
- </Flavor>
- <Flavor Include="Rx.sln">
- <Configuration>ReleaseWP7</Configuration>
- </Flavor>
- <Flavor Include="Rx.sln">
- <Configuration>DebugSL5</Configuration>
- </Flavor>
- <Flavor Include="Rx.sln">
- <Configuration>ReleaseSL5</Configuration>
- </Flavor>
- </ItemGroup>
-
-
- <!-- Legacy platforms -->
-
- <ItemGroup>
- <Flavor Include="Rx.sln">
- <Configuration>DebugSL4</Configuration>
- </Flavor>
- <Flavor Include="Rx.sln">
- <Configuration>ReleaseSL4</Configuration>
- </Flavor>
- <Flavor Include="Rx.sln">
- <Configuration>Debug35</Configuration>
- </Flavor>
- <Flavor Include="Rx.sln">
- <Configuration>Release35</Configuration>
- </Flavor>
- <Flavor Include="Rx.sln">
- <Configuration>DebugXNA4</Configuration>
- </Flavor>
- <Flavor Include="Rx.sln">
- <Configuration>ReleaseXNA4</Configuration>
- </Flavor>
- </ItemGroup>
-
-
- <!-- Future platforms -->
-
- <ItemGroup>
- <Flavor Include="Rx.sln">
- <Configuration>DebugWP8</Configuration>
- </Flavor>
- <Flavor Include="Rx.sln">
- <Configuration>ReleaseWP8</Configuration>
- </Flavor>
- </ItemGroup>
-
-
- <Target Name="ExpandFlavors">
- <CreateItem Include="@(Flavor)" AdditionalMetadata="Properties=Configuration=%(Flavor.Configuration)%3BPlatform=Any CPU%3BOutDir=$(LayoutOutputFolder)\%(Flavor.Configuration)\">
- <Output TaskParameter="Include" ItemName="ProjectToBuild" />
- </CreateItem>
- <CreateItem Include="Setup\BuildAll.proj" AdditionalMetadata="Properties=BinariesLayoutFolder=$(LayoutOutputFolder)%3BOutDir=$(SetupOutputFolder)" Condition=" '$(BuildSetup)' == '1' ">
- <Output TaskParameter="Include" ItemName="SetupToBuild" />
- </CreateItem>
- </Target>
- <Target Name="Build" DependsOnTargets="ExpandFlavors">
- <MSBuild Projects="@(ProjectToBuild)" Targets="Build" />
- <MSBuild Projects="@(SetupToBuild)" Targets="Build" />
- </Target>
- <Target Name="Clean" DependsOnTargets="ExpandFlavors">
- <MSBuild Projects="@(ProjectToBuild)" Targets="Clean" />
- <MSBuild Projects="@(SetupToBuild)" Targets="Clean" />
- </Target>
- <Target Name="Rebuild" DependsOnTargets="ExpandFlavors">
- <MSBuild Projects="@(ProjectToBuild)" Targets="Rebuild" />
- <MSBuild Projects="@(SetupToBuild)" Targets="Rebuild" />
- </Target>
-</Project> \ No newline at end of file
diff --git a/Rx.NET/BuildSetup.bat b/Rx.NET/BuildSetup.bat
deleted file mode 100644
index 49dc22f..0000000
--- a/Rx.NET/BuildSetup.bat
+++ /dev/null
@@ -1 +0,0 @@
-msbuild BuildAll.proj /p:BuildSetup=1 /p:BuildNumber=0.9.0.0 /p:RxRelease=EXPERIMENTAL \ No newline at end of file
diff --git a/Rx.NET/Clean.bat b/Rx.NET/Clean.bat
deleted file mode 100644
index af937c2..0000000
--- a/Rx.NET/Clean.bat
+++ /dev/null
@@ -1 +0,0 @@
-msbuild BuildAll.proj /t:Clean /p:BuildSetup=1 \ No newline at end of file
diff --git a/Rx.NET/Common.targets b/Rx.NET/Common.targets
deleted file mode 100644
index 7e69043..0000000
--- a/Rx.NET/Common.targets
+++ /dev/null
@@ -1,348 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <ProductVersion>8.0.30703</ProductVersion>
- <SchemaVersion>2.0</SchemaVersion>
- <TargetFrameworkProfile />
- </PropertyGroup>
-
-
- <!--
- ***********************
- * SUPPORTED PLATFORMS *
- ***********************
- -->
-
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'DebugPL|AnyCPU' ">
- <BuildConfig>Debug</BuildConfig>
- <BuildTarget>PL</BuildTarget>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'ReleasePL|AnyCPU' ">
- <BuildConfig>Release</BuildConfig>
- <BuildTarget>PL</BuildTarget>
- </PropertyGroup>
-
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug45|AnyCPU' ">
- <BuildConfig>Debug</BuildConfig>
- <BuildTarget>45</BuildTarget>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release45|AnyCPU' ">
- <BuildConfig>Release</BuildConfig>
- <BuildTarget>45</BuildTarget>
- </PropertyGroup>
-
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug8|AnyCPU' ">
- <BuildConfig>Debug</BuildConfig>
- <BuildTarget>8</BuildTarget>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release8|AnyCPU' ">
- <BuildConfig>Release</BuildConfig>
- <BuildTarget>8</BuildTarget>
- </PropertyGroup>
-
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug40|AnyCPU' ">
- <BuildConfig>Debug</BuildConfig>
- <BuildTarget>40</BuildTarget>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release40|AnyCPU' ">
- <BuildConfig>Release</BuildConfig>
- <BuildTarget>40</BuildTarget>
- </PropertyGroup>
-
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'DebugSL5|AnyCPU' ">
- <BuildConfig>Debug</BuildConfig>
- <BuildTarget>SL5</BuildTarget>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'ReleaseSL5|AnyCPU' ">
- <BuildConfig>Release</BuildConfig>
- <BuildTarget>SL5</BuildTarget>
- </PropertyGroup>
-
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'DebugWP7|AnyCPU' ">
- <BuildConfig>Debug</BuildConfig>
- <BuildTarget>WP7</BuildTarget>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'ReleaseWP7|AnyCPU' ">
- <BuildConfig>Release</BuildConfig>
- <BuildTarget>WP7</BuildTarget>
- </PropertyGroup>
-
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'DebugWP8|AnyCPU' ">
- <BuildConfig>Debug</BuildConfig>
- <BuildTarget>WP8</BuildTarget>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'ReleaseWP8|AnyCPU' ">
- <BuildConfig>Release</BuildConfig>
- <BuildTarget>WP8</BuildTarget>
- </PropertyGroup>
-
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'DebugXBLV|AnyCPU' ">
- <BuildConfig>Debug</BuildConfig>
- <BuildTarget>XBLV</BuildTarget>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'ReleaseXBLV|AnyCPU' ">
- <BuildConfig>Release</BuildConfig>
- <BuildTarget>XBLV</BuildTarget>
- </PropertyGroup>
-
-
- <PropertyGroup Condition=" '$(BuildTarget)' == 'PL' ">
- <DefineConstants>$(DefineConstants);NO_EVENTARGS_CONSTRAINT;HAS_EDI;HAS_WINRT;HAS_PROGRESS;PREFER_ASYNC;HAS_AWAIT;HAS_APTCA;NO_REMOTING;NO_SERIALIZABLE;NO_THREAD;CRIPPLED_REFLECTION;PLIB</DefineConstants>
- <TargetFrameworkIdentifier>.NETPortable</TargetFrameworkIdentifier>
- <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
- <TargetFrameworkProfile>Profile7</TargetFrameworkProfile>
- <NoStdLib>true</NoStdLib>
- <SignKeyEnhanced>true</SignKeyEnhanced>
- </PropertyGroup>
-
- <PropertyGroup Condition=" '$(BuildTarget)' == '45' ">
- <DefineConstants>$(DefineConstants);NO_EVENTARGS_CONSTRAINT;HAS_EDI;HAS_WINRT;HAS_PROGRESS;PREFER_ASYNC;HAS_AWAIT;HAS_APTCA; HAS_DISPATCHER_PRIORITY;HAS_WINFORMS</DefineConstants>
- <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
- <NoStdLib>true</NoStdLib>
- <BuildPlatform>DESKTOPCLR</BuildPlatform>
- <BuildFlavor>DESKTOPCLR45</BuildFlavor>
- <SignKeyEnhanced>true</SignKeyEnhanced>
- </PropertyGroup>
-
- <PropertyGroup Condition=" '$(BuildTarget)' == '8' ">
- <DefineConstants>$(DefineConstants);NO_EVENTARGS_CONSTRAINT;HAS_EDI;HAS_WINRT;HAS_PROGRESS;PREFER_ASYNC;HAS_AWAIT; NO_REMOTING;NO_SERIALIZABLE;NO_THREAD;CRIPPLED_REFLECTION</DefineConstants>
- <TargetFrameworkIdentifier>.NETCore</TargetFrameworkIdentifier>
- <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
- <NoStdLib>true</NoStdLib>
- <BuildPlatform>WINDOWS</BuildPlatform>
- <BuildFlavor>WINDOWS8</BuildFlavor>
- <DefaultLanguage>en-US</DefaultLanguage>
- <SignKeyEnhanced>true</SignKeyEnhanced>
- </PropertyGroup>
-
- <PropertyGroup Condition=" '$(BuildTarget)' == '40' ">
- <DefineConstants>$(DefineConstants);NO_TASK_DELAY;HAS_APTCA;HAS_WINFORMS</DefineConstants>
- <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
- <BuildPlatform>DESKTOPCLR</BuildPlatform>
- <BuildFlavor>DESKTOPCLR40</BuildFlavor>
- </PropertyGroup>
-
- <PropertyGroup Condition=" '$(BuildTarget)' == 'SL5' ">
- <DefineConstants>$(DefineConstants);NO_RXINTERFACES;USE_SL_DISPATCHER;NO_SERIALIZABLE;NO_REMOTING;NO_SEMAPHORE;NO_STOPWATCH;NO_CDS;NO_TASK_DELAY</DefineConstants>
- <TargetFrameworkIdentifier>Silverlight</TargetFrameworkIdentifier>
- <TargetFrameworkVersion>v5.0</TargetFrameworkVersion>
- <SilverlightVersion>$(TargetFrameworkVersion)</SilverlightVersion>
- <SilverlightApplication>false</SilverlightApplication>
- <BuildPlatform>SILVERLIGHT</BuildPlatform>
- <BuildFlavor>SILVERLIGHT5</BuildFlavor>
- </PropertyGroup>
-
- <PropertyGroup Condition=" '$(BuildTarget)' == 'WP7' ">
- <DefineConstants>$(DefineConstants);USE_SL_DISPATCHER;NO_SERIALIZABLE;NO_REMOTING;NO_CDS;NO_TLS;NO_VARIANCE;NO_TPL;NO_HASHSET;NO_SEMAPHORE;NO_LARGEARITY;NO_EXPRESSIONVISITOR;NO_LAZY;NO_WEAKTABLE;NO_INTERLOCKED_64;WINDOWSPHONE7</DefineConstants>
- <TargetFrameworkProfile>WindowsPhone71</TargetFrameworkProfile>
- <TargetFrameworkIdentifier>Silverlight</TargetFrameworkIdentifier>
- <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
- <SilverlightVersion>$(TargetFrameworkVersion)</SilverlightVersion>
- <SilverlightApplication>false</SilverlightApplication>
- <BuildPlatform>SILVERLIGHT</BuildPlatform>
- <BuildFlavor>SILVERLIGHTM7</BuildFlavor>
- </PropertyGroup>
-
- <PropertyGroup Condition=" '$(BuildTarget)' == 'WP8' ">
- <DefineConstants>$(DefineConstants);USE_SL_DISPATCHER;NO_SERIALIZABLE;NO_REMOTING;NO_CDS_COLLECTIONS</DefineConstants>
- <TargetFrameworkIdentifier>WindowsPhone</TargetFrameworkIdentifier>
- <TargetFrameworkVersion>v8.0</TargetFrameworkVersion>
- <SilverlightVersion>$(TargetFrameworkVersion)</SilverlightVersion>
- <SilverlightApplication>false</SilverlightApplication>
- <BuildPlatform>WINDOWS_PHONE</BuildPlatform>
- <BuildFlavor>WINDOWS_PHONE8</BuildFlavor>
- <NoStdLib>true</NoStdLib>
- <SignKeyEnhanced>true</SignKeyEnhanced>
- </PropertyGroup>
-
- <PropertyGroup Condition=" '$(BuildTarget)' == 'XBLV' ">
- <DefineConstants>$(DefineConstants);NO_RXINTERFACES;USE_SL_DISPATCHER;NO_SERIALIZABLE;NO_REMOTING;NO_SEMAPHORE;NO_STOPWATCH;NO_CDS;NO_TPL;NO_LAZY;NO_WEAKTABLE;NO_VARIANCE;NO_HASHSET;NO_LARGEARITY;NO_EXPRESSIONVISITOR;NO_EXPRESSIONS</DefineConstants>
- <TargetFrameworkIdentifier>Silverlight</TargetFrameworkIdentifier>
- <TargetFrameworkVersion>v3.0</TargetFrameworkVersion>
- <SilverlightVersion>$(TargetFrameworkVersion)</SilverlightVersion>
- <SilverlightApplication>false</SilverlightApplication>
- <BuildPlatform>SILVERLIGHT</BuildPlatform>
- <BuildFlavor>XBOX_LAKEVIEW</BuildFlavor>
- </PropertyGroup>
-
-
- <!--
- ********************
- * LEGACY PLATFORMS *
- ********************
- -->
-
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug35|AnyCPU' ">
- <BuildConfig>Debug</BuildConfig>
- <BuildTarget>35</BuildTarget>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release35|AnyCPU' ">
- <BuildConfig>Release</BuildConfig>
- <BuildTarget>35</BuildTarget>
- </PropertyGroup>
-
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'DebugSL3|AnyCPU' ">
- <BuildConfig>Debug</BuildConfig>
- <BuildTarget>SL3</BuildTarget>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'ReleaseSL3|AnyCPU' ">
- <BuildConfig>Release</BuildConfig>
- <BuildTarget>SL3</BuildTarget>
- </PropertyGroup>
-
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'DebugSL4|AnyCPU' ">
- <BuildConfig>Debug</BuildConfig>
- <BuildTarget>SL4</BuildTarget>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'ReleaseSL4|AnyCPU' ">
- <BuildConfig>Release</BuildConfig>
- <BuildTarget>SL4</BuildTarget>
- </PropertyGroup>
-
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'DebugXNA4|AnyCPU' ">
- <BuildConfig>Debug</BuildConfig>
- <BuildTarget>XNA4</BuildTarget>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'ReleaseXNA4|AnyCPU' ">
- <BuildConfig>Release</BuildConfig>
- <BuildTarget>XNA4</BuildTarget>
- </PropertyGroup>
-
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'DebugCF35|AnyCPU' ">
- <BuildConfig>Debug</BuildConfig>
- <BuildTarget>CF35</BuildTarget>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'ReleaseCF35|AnyCPU' ">
- <BuildConfig>Release</BuildConfig>
- <BuildTarget>CF35</BuildTarget>
- </PropertyGroup>
-
-
- <PropertyGroup Condition=" '$(BuildTarget)' == '35' ">
- <DefineConstants>$(DefineConstants);NO_RXINTERFACES;NO_VARIANCE;NO_TPL;NO_LARGEARITY;NO_EXPRESSIONVISITOR;NO_CDS;NO_LAZY;NO_WEAKTABLE;HAS_APTCA</DefineConstants>
- <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
- <BuildPlatform>DESKTOPCLR</BuildPlatform>
- <BuildFlavor>DESKTOPCLR20</BuildFlavor>
- </PropertyGroup>
-
- <PropertyGroup Condition=" '$(BuildTarget)' == 'SL3' ">
- <DefineConstants>$(DefineConstants);NO_RXINTERFACES;USE_SL_DISPATCHER;NO_SERIALIZABLE;NO_REMOTING;NO_SEMAPHORE;NO_STOPWATCH;NO_CDS;NO_TPL;NO_LAZY;NO_WEAKTABLE;NO_VARIANCE;NO_HASHSET;NO_LARGEARITY;NO_EXPRESSIONVISITOR</DefineConstants>
- <TargetFrameworkIdentifier>Silverlight</TargetFrameworkIdentifier>
- <TargetFrameworkVersion>v3.0</TargetFrameworkVersion>
- <SilverlightVersion>$(TargetFrameworkVersion)</SilverlightVersion>
- <SilverlightApplication>false</SilverlightApplication>
- <BuildPlatform>SILVERLIGHT</BuildPlatform>
- <BuildFlavor>SILVERLIGHT3</BuildFlavor>
- </PropertyGroup>
-
- <PropertyGroup Condition=" '$(BuildTarget)' == 'SL4' ">
- <DefineConstants>$(DefineConstants);NO_RXINTERFACES;USE_SL_DISPATCHER;NO_SERIALIZABLE;NO_REMOTING;NO_SEMAPHORE;NO_STOPWATCH;NO_CDS;NO_TPL</DefineConstants>
- <TargetFrameworkIdentifier>Silverlight</TargetFrameworkIdentifier>
- <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
- <SilverlightVersion>$(TargetFrameworkVersion)</SilverlightVersion>
- <SilverlightApplication>false</SilverlightApplication>
- <BuildPlatform>SILVERLIGHT</BuildPlatform>
- <BuildFlavor>SILVERLIGHT4</BuildFlavor>
- </PropertyGroup>
-
- <PropertyGroup Condition=" '$(BuildTarget)' == 'XNA4' ">
- <DefineConstants>$(DefineConstants);NO_VARIANCE;NO_LARGEARITY;NO_SERIALIZABLE;NO_TPL;NO_SEMAPHORE;NO_HASHSET;NO_RXINTERFACES;NO_REMOTING;NO_EXPRESSIONVISITOR;NO_CDS;NO_LAZY;NO_EXPRESSIONS;NO_WEAKTABLE;NO_DEBUGGER_ATTRIBUTES;USE_SLEEP_MS;NO_INTERLOCKED_64</DefineConstants>
- <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
- <XnaFrameworkVersion>v4.0</XnaFrameworkVersion>
- <XnaPlatform>Xbox 360</XnaPlatform>
- <NoStdLib>true</NoStdLib>
- <BuildPlatform>XNA</BuildPlatform>
- <BuildFlavor>XNA4</BuildFlavor>
- </PropertyGroup>
-
- <PropertyGroup Condition=" '$(BuildTarget)' == 'CF35' ">
- <DefineConstants>$(DefineConstants);NO_VARIANCE;NO_TPL;NO_LARGEARITY;NO_RXINTERFACES;NO_EXPRESSIONVISITOR;NO_CDS;NO_EXPRESSIONS;NO_HASHSET;NO_SEMAPHORE;NO_DATETIMEOFFSET;NO_ASSEMBLYFILEVERSIONATTRIBUTE;NO_SYNCCTX;NO_TLS;NO_LAZY;NO_REMOTING;NO_WEAKTABLE;NO_DEBUGGER_ATTRIBUTES;USE_SLEEP_MS;NO_INTERLOCKED_64</DefineConstants>
- <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
- <BuildPlatform>NETCF</BuildPlatform>
- <BuildFlavor>NETCF35</BuildFlavor>
- <NoStdLib>true</NoStdLib>
- </PropertyGroup>
-
- <PropertyGroup Condition=" '$(BuildPlatform)' == 'NETCF' ">
- <!-- The following seems to be required for Microsoft.CompactFramework.targets to be happy. It doesn't seem to impact generated metadata. -->
- <PlatformFamilyName>PocketPC</PlatformFamilyName>
- <PlatformID>4118C335-430C-497f-BE48-11C3316B135E</PlatformID>
- <OSVersion>5.1</OSVersion>
- <NativePlatformName>Windows Mobile 5.0 Pocket PC SDK</NativePlatformName>
- </PropertyGroup>
-
-
- <!--
- ********************
- * GENERAL SETTINGS *
- ********************
- -->
-
- <PropertyGroup>
- <DefineConstants>$(DefineConstants);$(BuildPlatform);$(BuildFlavor);TRACE</DefineConstants>
- <OutputPath>bin\$(BuildConfig)$(BuildTarget)</OutputPath>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- </PropertyGroup>
-
- <PropertyGroup Condition=" '$(BuildConfig)' == 'Debug' ">
- <DebugSymbols>true</DebugSymbols>
- <DebugType>full</DebugType>
- <Optimize>false</Optimize>
- <DefineConstants>$(DefineConstants);DEBUG</DefineConstants>
- </PropertyGroup>
-
- <PropertyGroup Condition=" '$(BuildConfig)' == 'Release' ">
- <DebugType>pdbonly</DebugType>
- <Optimize>true</Optimize>
- </PropertyGroup>
-
- <PropertyGroup Condition=" '$(NoOpt)' == '1' ">
- <DefineConstants>$(DefineConstants);NO_PERF</DefineConstants>
- </PropertyGroup>
-
- <ItemGroup Condition=" '$(NoStdLib)' == 'true' ">
- <Reference Include="mscorlib" />
- </ItemGroup>
-
- <ItemGroup Condition=" '$(BuildPlatform)' == 'NETCF' ">
- <Reference Include="System.Core" />
- </ItemGroup>
-
- <!-- Temporary flag to enable stress test builds. Should be refactored into a separate project and be written in a more platform-neutral manner. (TFS 484720) -->
- <PropertyGroup Condition=" '$(BuildFlavor)' == 'DESKTOPCLR40' OR '$(BuildFlavor)' == 'DESKTOPCLR45' ">
- <DefineConstants>$(DefineConstants);STRESS</DefineConstants>
- </PropertyGroup>
-
- <PropertyGroup Condition=" '$(ProductSignAssembly)' == 'true' AND '$(SignedBuild)' == '1' ">
- <DefineConstants>$(DefineConstants);SIGNED</DefineConstants>
- <SignAssembly>true</SignAssembly>
- <DelaySign>true</DelaySign>
- </PropertyGroup>
-
- <PropertyGroup Condition=" '$(SignAssembly)' == 'true' AND '$(SignKeyEnhanced)' != 'true' ">
- <AssemblyOriginatorKeyFile>..\35MSSharedLib1024.snk</AssemblyOriginatorKeyFile>
- <SignKeyId>72</SignKeyId>
- </PropertyGroup>
-
- <PropertyGroup Condition=" '$(SignAssembly)' == 'true' AND '$(SignKeyEnhanced)' == 'true' ">
- <AssemblyOriginatorKeyFile>..\272MSSharedLibSN2048.snk</AssemblyOriginatorKeyFile>
- <DefineConstants>$(DefineConstants);SIGNENHANCED</DefineConstants>
- <SignKeyId>272</SignKeyId>
- </PropertyGroup>
-
- <PropertyGroup Condition=" '$(BuildLab)' == '1' ">
- <DefineConstants>$(DefineConstants);NO_CODECOVERAGE</DefineConstants>
- </PropertyGroup>
-
- <PropertyGroup>
- <GetReferenceAssemblyPathsDependsOn>CP_SetBuildReferencePath</GetReferenceAssemblyPathsDependsOn>
- </PropertyGroup>
- <Target Name="CP_SetBuildReferencePath">
- <PropertyGroup>
- <TargetFrameworkDirectory>$(ProjectDir)..\..\References\$(BuildFlavor)</TargetFrameworkDirectory>
- </PropertyGroup>
- </Target>
-
-</Project>
diff --git a/Rx.NET/Import.targets b/Rx.NET/Import.targets
deleted file mode 100644
index b5f5c1e..0000000
--- a/Rx.NET/Import.targets
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <!-- Non-Portable Library build -->
- <Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v11.0\Microsoft.Windows.UI.Xaml.CSharp.targets" Condition=" '$(TargetFrameworkIdentifier)' == '.NETCore' " />
- <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" Condition=" '$(TargetFrameworkIdentifier)' != '.NETPortable' And ('$(BuildPlatform)' == 'DESKTOPCLR' Or '$(BuildPlatform)' == 'XNA') " />
- <Import Project="$(MSBuildExtensionsPath32)\Microsoft\Silverlight\$(SilverlightVersion)\Microsoft.Silverlight.CSharp.targets" Condition=" '$(TargetFrameworkIdentifier)' != '.NETPortable' And '$(BuildPlatform)' == 'SILVERLIGHT' AND !('$(BuildFlavor)' == 'SILVERLIGHTM7') " />
- <Import Project="$(MSBuildExtensionsPath)\Microsoft\Silverlight for Phone\$(TargetFrameworkVersion)\Microsoft.Silverlight.$(TargetFrameworkProfile).Overrides.targets" Condition=" '$(TargetFrameworkIdentifier)' != '.NETPortable' And '$(BuildFlavor)' == 'SILVERLIGHTM7' " />
- <Import Project="$(MSBuildExtensionsPath)\Microsoft\Silverlight for Phone\$(TargetFrameworkVersion)\Microsoft.Silverlight.CSharp.targets" Condition=" '$(TargetFrameworkIdentifier)' != '.NETPortable' And '$(BuildFlavor)' == 'SILVERLIGHTM7' " />
- <Import Project="$(MSBuildExtensionsPath)\Microsoft\$(TargetFrameworkIdentifier)\$(TargetFrameworkVersion)\Microsoft.$(TargetFrameworkIdentifier).$(TargetFrameworkVersion).Overrides.targets" Condition=" '$(TargetFrameworkIdentifier)' != '.NETPortable' And '$(BuildFlavor)' == 'WINDOWS_PHONE8' "/>
- <Import Project="$(MSBuildExtensionsPath)\Microsoft\$(TargetFrameworkIdentifier)\$(TargetFrameworkVersion)\Microsoft.$(TargetFrameworkIdentifier).CSharp.targets" Condition=" '$(TargetFrameworkIdentifier)' != '.NETPortable' And '$(BuildFlavor)' == 'WINDOWS_PHONE8' "/>
- <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\Microsoft.Xna.GameStudio.targets" Condition=" '$(TargetFrameworkIdentifier)' != '.NETPortable' And '$(BuildPlatform)' == 'XNA' "/>
- <Import Project="$(MSBuildExtensionsPath32)\Microsoft\Compact\Microsoft.CompactFramework.CSharp.targets" Condition=" '$(BuildPlatform)' == 'NETCF' " />
- <Import Project="$(MSBuildExtensionsPath)\Microsoft\Xbox 360 ADK\Microsoft.Xbox360.Adk.App.targets" Condition=" '$(BuildPlatform)' == 'XBOX' " />
-
- <!-- Portable Library Build -->
- <Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" Condition=" '$(TargetFrameworkIdentifier)' == '.NETPortable' " />
-
- <Target Name="AfterBuild">
- <WriteLinesToFile Condition=" '$(ProductSignAssembly)' == 'true' AND '$(SignedBuild)' == '1' "
- File="$(OutDir)\$(TargetFileName).sign" Overwrite="true"
- Lines="[$(SignKeyId)] Auto-generated file. Indicates the corresponding binary file needs to be signed." />
-
- <!-- Hack for Metro; for some reason the XAML build creates intermediary folders, so we flatten the hierarchy for consumption by the setup build at a later stage -->
- <CreateItem Include="$(OutDir)\*.*" Condition=" '$(TargetFrameworkIdentifier)' == '.NETCore' ">
- <Output TaskParameter="Include" ItemName="BuiltFilesInOutDir" />
- </CreateItem>
- <Copy SourceFiles="@(BuiltFilesInOutDir)" DestinationFolder="$(OutDir)\.." Condition=" '$(TargetFrameworkIdentifier)' == '.NETCore' " />
- </Target>
-</Project>
diff --git a/Rx.NET/Local.testsettings b/Rx.NET/Local.testsettings
deleted file mode 100644
index 95d94d8..0000000
--- a/Rx.NET/Local.testsettings
+++ /dev/null
@@ -1,39 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<TestSettings name="Local" id="a2f63e98-7f97-4ca7-9d25-6313d3452023" xmlns="http://microsoft.com/schemas/VisualStudio/TeamTest/2010">
- <Description>These are default test settings for a local test run.</Description>
- <Execution>
- <TestTypeSpecific>
- <UnitTestRunConfig testTypeId="13cdc9d9-ddb5-4fa4-a97d-d965ccfc6d4b">
- <AssemblyResolution>
- <TestDirectory useLoadContext="true" />
- </AssemblyResolution>
- </UnitTestRunConfig>
- <WebTestRunConfiguration testTypeId="4e7599fa-5ecb-43e9-a887-cd63cf72d207">
- <Browser name="Internet Explorer 7.0">
- <Headers>
- <Header name="User-Agent" value="Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)" />
- <Header name="Accept" value="*/*" />
- <Header name="Accept-Language" value="{{$IEAcceptLanguage}}" />
- <Header name="Accept-Encoding" value="GZIP" />
- </Headers>
- </Browser>
- </WebTestRunConfiguration>
- </TestTypeSpecific>
- <AgentRule name="LocalMachineDefaultRole">
- <DataCollectors>
- <DataCollector uri="datacollector://microsoft/CodeCoverage/1.0" assemblyQualifiedName="Microsoft.VisualStudio.TestTools.CodeCoverage.CoveragePlugIn, Microsoft.VisualStudio.QualityTools.Plugins.CodeCoverage, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" friendlyName="Code Coverage">
- <Configuration>
- <CodeCoverage xmlns="">
- <Regular>
- <CodeCoverageItem binaryFile="System.Reactive.Core\bin\Debug40\System.Reactive.Core.dll" pdbFile="System.Reactive.Core\bin\Debug40\System.Reactive.Core.pdb" instrumentInPlace="true" />
- <CodeCoverageItem binaryFile="System.Reactive.Interfaces\bin\Debug40\System.Reactive.Interfaces.dll" pdbFile="System.Reactive.Interfaces\bin\Debug40\System.Reactive.Interfaces.pdb" instrumentInPlace="true" />
- <CodeCoverageItem binaryFile="System.Reactive.Linq\bin\Debug40\System.Reactive.Linq.dll" pdbFile="System.Reactive.Linq\bin\Debug40\System.Reactive.Linq.pdb" instrumentInPlace="true" />
- <CodeCoverageItem binaryFile="System.Reactive.PlatformServices\bin\Debug40\System.Reactive.PlatformServices.dll" pdbFile="System.Reactive.PlatformServices\bin\Debug40\System.Reactive.PlatformServices.pdb" instrumentInPlace="true" />
- </Regular>
- </CodeCoverage>
- </Configuration>
- </DataCollector>
- </DataCollectors>
- </AgentRule>
- </Execution>
-</TestSettings> \ No newline at end of file
diff --git a/Rx.NET/Microsoft.Reactive.Testing/ColdObservable.cs b/Rx.NET/Microsoft.Reactive.Testing/ColdObservable.cs
deleted file mode 100644
index ce18051..0000000
--- a/Rx.NET/Microsoft.Reactive.Testing/ColdObservable.cs
+++ /dev/null
@@ -1,60 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System.Collections.Generic;
-using System.Reactive;
-using System;
-using System.Reactive.Disposables;
-
-namespace Microsoft.Reactive.Testing
-{
- class ColdObservable<T> : ITestableObservable<T>
- {
- readonly TestScheduler scheduler;
- readonly Recorded<Notification<T>>[] messages;
- readonly List<Subscription> subscriptions = new List<Subscription>();
-
- public ColdObservable(TestScheduler scheduler, params Recorded<Notification<T>>[] messages)
- {
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
- if (messages == null)
- throw new ArgumentNullException("messages");
-
- this.scheduler = scheduler;
- this.messages = messages;
- }
-
- public virtual IDisposable Subscribe(IObserver<T> observer)
- {
- if (observer == null)
- throw new ArgumentNullException("observer");
-
- subscriptions.Add(new Subscription(scheduler.Clock));
- var index = subscriptions.Count - 1;
-
- var d = new CompositeDisposable();
-
- for (var i = 0; i < messages.Length; ++i)
- {
- var notification = messages[i].Value;
- d.Add(scheduler.ScheduleRelative(default(object), messages[i].Time, (scheduler1, state1) => { notification.Accept(observer); return Disposable.Empty; }));
- }
-
- return Disposable.Create(() =>
- {
- subscriptions[index] = new Subscription(subscriptions[index].Subscribe, scheduler.Clock);
- d.Dispose();
- });
- }
-
- public IList<Subscription> Subscriptions
- {
- get { return subscriptions; }
- }
-
- public IList<Recorded<Notification<T>>> Messages
- {
- get { return messages; }
- }
- }
-}
diff --git a/Rx.NET/Microsoft.Reactive.Testing/GlobalSuppressions.cs b/Rx.NET/Microsoft.Reactive.Testing/GlobalSuppressions.cs
deleted file mode 100644
index 7a6b005..0000000
--- a/Rx.NET/Microsoft.Reactive.Testing/GlobalSuppressions.cs
+++ /dev/null
@@ -1,18 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-// This file is used by Code Analysis to maintain SuppressMessage
-// attributes that are applied to this project.
-// Project-level suppressions either have no target or are given
-// a specific target and scoped to a namespace, type, member, etc.
-//
-// To add a suppression to this file, right-click the message in the
-// Error List, point to "Suppress Message(s)", and click
-// "In Project Suppression File".
-// You do not need to add suppressions to this file manually.
-
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA2210:AssembliesShouldHaveValidStrongNames")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1053:StaticHolderTypesShouldNotHaveConstructors", Scope = "type", Target = "Microsoft.Reactive.Testing.ReactiveTest")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1014:MarkAssembliesWithClsCompliant")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1004:GenericMethodsShouldProvideTypeParameter", Scope = "member", Target = "Microsoft.Reactive.Testing.ReactiveAssert.#Throws`1(System.Action,System.String)")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1004:GenericMethodsShouldProvideTypeParameter", Scope = "member", Target = "Microsoft.Reactive.Testing.ReactiveAssert.#Throws`1(System.Action)")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1016:MarkAssembliesWithAssemblyVersion")]
diff --git a/Rx.NET/Microsoft.Reactive.Testing/HotObservable.cs b/Rx.NET/Microsoft.Reactive.Testing/HotObservable.cs
deleted file mode 100644
index d883f33..0000000
--- a/Rx.NET/Microsoft.Reactive.Testing/HotObservable.cs
+++ /dev/null
@@ -1,68 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System.Collections.Generic;
-using System.Reactive;
-using System;
-using System.Reactive.Disposables;
-
-namespace Microsoft.Reactive.Testing
-{
- class HotObservable<T> : ITestableObservable<T>
- {
- readonly TestScheduler scheduler;
- readonly List<IObserver<T>> observers = new List<IObserver<T>>();
- readonly List<Subscription> subscriptions = new List<Subscription>();
- readonly Recorded<Notification<T>>[] messages;
-
- public HotObservable(TestScheduler scheduler, params Recorded<Notification<T>>[] messages)
- {
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
- if (messages == null)
- throw new ArgumentNullException("messages");
-
- this.scheduler = scheduler;
- this.messages = messages;
-
- for (var i = 0; i < messages.Length; ++i)
- {
- var notification = messages[i].Value;
- scheduler.ScheduleAbsolute(default(object), messages[i].Time, (scheduler1, state1) =>
- {
- var _observers = observers.ToArray();
- for (var j = 0; j < _observers.Length; ++j)
- {
- notification.Accept(_observers[j]);
- }
- return Disposable.Empty;
- });
- }
- }
-
- public virtual IDisposable Subscribe(IObserver<T> observer)
- {
- if (observer == null)
- throw new ArgumentNullException("observer");
-
- observers.Add(observer);
- subscriptions.Add(new Subscription(scheduler.Clock));
- var index = subscriptions.Count - 1;
-
- return Disposable.Create(() =>
- {
- observers.Remove(observer);
- subscriptions[index] = new Subscription(subscriptions[index].Subscribe, scheduler.Clock);
- });
- }
-
- public IList<Subscription> Subscriptions
- {
- get { return subscriptions; }
- }
-
- public IList<Recorded<Notification<T>>> Messages
- {
- get { return messages; }
- }
- }
-}
diff --git a/Rx.NET/Microsoft.Reactive.Testing/ITestObservable.cs b/Rx.NET/Microsoft.Reactive.Testing/ITestObservable.cs
deleted file mode 100644
index 0b6cdba..0000000
--- a/Rx.NET/Microsoft.Reactive.Testing/ITestObservable.cs
+++ /dev/null
@@ -1,25 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System;
-using System.Collections.Generic;
-using System.Reactive;
-
-namespace Microsoft.Reactive.Testing
-{
- /// <summary>
- /// Observable sequence that records subscription lifetimes and timestamped notification messages sent to observers.
- /// </summary>
- /// <typeparam name="T">The type of the elements in the sequence.</typeparam>
- public interface ITestableObservable<T> : IObservable<T>
- {
- /// <summary>
- /// Gets a list of all the subscriptions to the observable sequence, including their lifetimes.
- /// </summary>
- IList<Subscription> Subscriptions { get; }
-
- /// <summary>
- /// Gets the recorded timestamped notification messages that were sent by the observable sequence to its observers.
- /// </summary>
- IList<Recorded<Notification<T>>> Messages { get; }
- }
-}
diff --git a/Rx.NET/Microsoft.Reactive.Testing/ITestObserver.cs b/Rx.NET/Microsoft.Reactive.Testing/ITestObserver.cs
deleted file mode 100644
index 1b485cb..0000000
--- a/Rx.NET/Microsoft.Reactive.Testing/ITestObserver.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System;
-using System.Collections.Generic;
-using System.Reactive;
-
-namespace Microsoft.Reactive.Testing
-{
- /// <summary>
- /// Observer that records received notification messages and timestamps those.
- /// </summary>
- /// <typeparam name="T">The type of the elements in the sequence.</typeparam>
- public interface ITestableObserver<T> : IObserver<T>
- {
- /// <summary>
- /// Gets recorded timestamped notification messages received by the observer.
- /// </summary>
- IList<Recorded<Notification<T>>> Messages { get; }
- }
-}
diff --git a/Rx.NET/Microsoft.Reactive.Testing/Microsoft.Reactive.Testing.csproj b/Rx.NET/Microsoft.Reactive.Testing/Microsoft.Reactive.Testing.csproj
deleted file mode 100644
index f1e4a30..0000000
--- a/Rx.NET/Microsoft.Reactive.Testing/Microsoft.Reactive.Testing.csproj
+++ /dev/null
@@ -1,69 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <ProductVersion>8.0.30703</ProductVersion>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{E7B7408B-B039-4F30-B6CF-CC06218CE4CA}</ProjectGuid>
- <OutputType>Library</OutputType>
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <RootNamespace>Microsoft.Reactive.Testing</RootNamespace>
- <AssemblyName>Microsoft.Reactive.Testing</AssemblyName>
- <FileAlignment>512</FileAlignment>
- <ProductSignAssembly>true</ProductSignAssembly>
- <CodeAnalysisRuleSet>..\Rx.ruleset</CodeAnalysisRuleSet>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'ReleaseXBLV|AnyCPU'">
- <OutputPath>bin\ReleaseXBLV\</OutputPath>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'DebugXBLV|AnyCPU'">
- <OutputPath>bin\DebugXBLV\</OutputPath>
- </PropertyGroup>
- <Import Project="..\Common.targets" />
- <PropertyGroup>
- <DocumentationFile>$(OutputPath)\$(AssemblyName).XML</DocumentationFile>
- </PropertyGroup>
- <ItemGroup>
- <Reference Include="mscorlib" Condition=" '$(BuildPlatform)' == 'SILVERLIGHT' " />
- <Reference Include="Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight" Condition=" '$(BuildPlatform)' == 'SILVERLIGHT' " />
- <Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework" Condition=" '$(BuildPlatform)' == 'DESKTOPCLR' " />
- <Reference Include="System" />
- <Reference Include="System.Core" />
- <Reference Include="System.Observable" Condition=" '$(BuildFlavor)' == 'SILVERLIGHTM7' " />
- </ItemGroup>
- <ItemGroup Condition=" '$(BuildFlavor)' == 'WINDOWS8' ">
- <SDKReference Include="MSTestFramework, Version=11.0" />
- <SDKReference Include="TestPlatform, Version=11.0" />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="ColdObservable.cs" />
- <Compile Include="GlobalSuppressions.cs" />
- <Compile Include="HotObservable.cs" />
- <Compile Include="ITestObservable.cs" />
- <Compile Include="ITestObserver.cs" />
- <Compile Include="MockObserver.cs" />
- <Compile Include="NamespaceDoc.cs" />
- <Compile Include="Properties\AssemblyInfo.cs" />
- <Compile Include="ReactiveAssert.cs" />
- <Compile Include="ReactiveTest.cs" />
- <Compile Include="Recorded.cs" />
- <Compile Include="Subscription.cs" />
- <Compile Include="TestScheduler.cs" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\System.Reactive.Core\System.Reactive.Core.csproj">
- <Project>{4E516F10-DA7A-4D43-963E-A93865ABEA5B}</Project>
- <Name>System.Reactive.Core</Name>
- </ProjectReference>
- <ProjectReference Include="..\System.Reactive.Interfaces\System.Reactive.Interfaces.csproj">
- <Project>{9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}</Project>
- <Name>System.Reactive.Interfaces</Name>
- </ProjectReference>
- <ProjectReference Include="..\System.Reactive.Linq\System.Reactive.Linq.csproj">
- <Project>{63252AE9-5186-45CA-BFCD-FA51C6B66A43}</Project>
- <Name>System.Reactive.Linq</Name>
- </ProjectReference>
- </ItemGroup>
- <Import Project="..\Import.targets" />
-</Project> \ No newline at end of file
diff --git a/Rx.NET/Microsoft.Reactive.Testing/MockObserver.cs b/Rx.NET/Microsoft.Reactive.Testing/MockObserver.cs
deleted file mode 100644
index 917a9f6..0000000
--- a/Rx.NET/Microsoft.Reactive.Testing/MockObserver.cs
+++ /dev/null
@@ -1,43 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System.Collections.Generic;
-using System.Reactive;
-using System;
-
-namespace Microsoft.Reactive.Testing
-{
- class MockObserver<T> : ITestableObserver<T>
- {
- TestScheduler scheduler;
- List<Recorded<Notification<T>>> messages;
-
- public MockObserver(TestScheduler scheduler)
- {
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- this.scheduler = scheduler;
- this.messages = new List<Recorded<Notification<T>>>();
- }
-
- public void OnNext(T value)
- {
- messages.Add(new Recorded<Notification<T>>(scheduler.Clock, Notification.CreateOnNext<T>(value)));
- }
-
- public void OnError(Exception exception)
- {
- messages.Add(new Recorded<Notification<T>>(scheduler.Clock, Notification.CreateOnError<T>(exception)));
- }
-
- public void OnCompleted()
- {
- messages.Add(new Recorded<Notification<T>>(scheduler.Clock, Notification.CreateOnCompleted<T>()));
- }
-
- public IList<Recorded<Notification<T>>> Messages
- {
- get { return messages; }
- }
- }
-}
diff --git a/Rx.NET/Microsoft.Reactive.Testing/NamespaceDoc.cs b/Rx.NET/Microsoft.Reactive.Testing/NamespaceDoc.cs
deleted file mode 100644
index 3dea288..0000000
--- a/Rx.NET/Microsoft.Reactive.Testing/NamespaceDoc.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-namespace Microsoft.Reactive.Testing
-{
- /// <summary>
- /// The <b>Microsoft.Reactive.Testing</b> namespace contains interfaces and classes providing functionality to test applications and libraries built using Reactive Extensions.
- /// </summary>
- [System.Runtime.CompilerServices.CompilerGeneratedAttribute]
- class NamespaceDoc
- {
- }
-}
diff --git a/Rx.NET/Microsoft.Reactive.Testing/Properties/AssemblyInfo.cs b/Rx.NET/Microsoft.Reactive.Testing/Properties/AssemblyInfo.cs
deleted file mode 100644
index 9947ca1..0000000
--- a/Rx.NET/Microsoft.Reactive.Testing/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,23 +0,0 @@
-using System;
-using System.Reflection;
-using System.Resources;
-using System.Runtime.InteropServices;
-
-[assembly: AssemblyTitle("Microsoft.Reactive.Testing")]
-[assembly: AssemblyDescription("Reactive Extensions Testing Library used to write unit tests for queries and custom operators over observable sequences.")]
-#if DEBUG
-[assembly: AssemblyConfiguration("Debug")]
-#else
-[assembly: AssemblyConfiguration("Retail")]
-#endif
-[assembly: AssemblyCompany("Microsoft Corporation")]
-[assembly: AssemblyProduct("Reactive Extensions")]
-[assembly: AssemblyCopyright("\x00a9 Microsoft Corporation. All rights reserved.")]
-[assembly: NeutralResourcesLanguage("en-US")]
-
-[assembly: ComVisible(false)]
-
-//
-// Note: Assembly (file) version numbers get inserted by the build system on the fly. Inspect the Team Build workflows
-// and the custom activity in Source/Build/Activities/AppendVersionInfo.cs for more information.
-//
diff --git a/Rx.NET/Microsoft.Reactive.Testing/ReactiveAssert.cs b/Rx.NET/Microsoft.Reactive.Testing/ReactiveAssert.cs
deleted file mode 100644
index e9715a4..0000000
--- a/Rx.NET/Microsoft.Reactive.Testing/ReactiveAssert.cs
+++ /dev/null
@@ -1,284 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System;
-using System.Collections.Generic;
-using System.Globalization;
-using System.Linq;
-using System.Text;
-using System.Reactive.Disposables;
-using System.Reactive.Linq;
-
-#if WINDOWS8
-using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
-#else
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-#endif
-
-namespace Microsoft.Reactive.Testing
-{
- /// <summary>
- /// Helper class to write asserts in unit tests for applications and libraries built using Reactive Extensions.
- /// </summary>
- public static class ReactiveAssert
- {
- static string Message<T>(IEnumerable<T> actual, IEnumerable<T> expected)
- {
- var sb = new StringBuilder();
- sb.AppendLine();
- sb.Append("Expected: [");
- sb.Append(string.Join(", ", expected.Select(x => x.ToString()).ToArray()));
- sb.Append("]");
- sb.AppendLine();
- sb.Append("Actual..: [");
- sb.Append(string.Join(", ", actual.Select(x => x.ToString()).ToArray()));
- sb.Append("]");
- sb.AppendLine();
- return sb.ToString();
- }
-
- /// <summary>
- /// Asserts that both enumerable sequences have equal length and equal elements.
- /// </summary>
- /// <typeparam name="T">The type of the elements in the sequence.</typeparam>
- /// <param name="expected">Expected sequence.</param>
- /// <param name="actual">Actual sequence to compare against the expected one.</param>
- /// <exception cref="ArgumentNullException"><paramref name="expected"/> or <paramref name="actual"/> is null.</exception>
- public static void AreElementsEqual<T>(IEnumerable<T> expected, IEnumerable<T> actual)
- {
- if (expected == null)
- throw new ArgumentNullException("expected");
- if (actual == null)
- throw new ArgumentNullException("actual");
-
- if (!expected.SequenceEqual(actual))
- Assert.Fail(Message(actual, expected));
- }
-
- /// <summary>
- /// Asserts that both enumerable sequences have equal length and equal elements.
- /// </summary>
- /// <typeparam name="T">The type of the elements in the sequence.</typeparam>
- /// <param name="expected">Expected sequence.</param>
- /// <param name="actual">Actual sequence to compare against the expected one.</param>
- /// <param name="message">Error message for assert failure.</param>
- /// <exception cref="ArgumentNullException"><paramref name="expected"/> or <paramref name="actual"/> is null.</exception>
- public static void AreElementsEqual<T>(IEnumerable<T> expected, IEnumerable<T> actual, string message)
- {
- if (expected == null)
- throw new ArgumentNullException("expected");
- if (actual == null)
- throw new ArgumentNullException("actual");
-
- if (!expected.SequenceEqual(actual))
- Assert.Fail(message);
- }
-
- /// <summary>
- /// Asserts that both observable sequences have equal length and equal notifications.
- /// </summary>
- /// <typeparam name="T">The type of the elements in the sequence.</typeparam>
- /// <param name="expected">Expected sequence.</param>
- /// <param name="actual">Actual sequence to compare against the expected one.</param>
- /// <exception cref="ArgumentNullException"><paramref name="expected"/> or <paramref name="actual"/> is null.</exception>
- public static void AreElementsEqual<T>(IObservable<T> expected, IObservable<T> actual)
- {
- if (expected == null)
- throw new ArgumentNullException("expected");
- if (actual == null)
- throw new ArgumentNullException("actual");
-
- AreElementsEqual(expected.Materialize().ToEnumerable(), actual.Materialize().ToEnumerable());
- }
-
- /// <summary>
- /// Asserts that both observable sequences have equal length and equal elements.
- /// </summary>
- /// <typeparam name="T">The type of the elements in the sequence.</typeparam>
- /// <param name="expected">Expected sequence.</param>
- /// <param name="actual">Actual sequence to compare against the expected one.</param>
- /// <param name="message">Error message for assert failure.</param>
- /// <exception cref="ArgumentNullException"><paramref name="expected"/> or <paramref name="actual"/> is null.</exception>
- public static void AreElementsEqual<T>(IObservable<T> expected, IObservable<T> actual, string message)
- {
- if (expected == null)
- throw new ArgumentNullException("expected");
- if (actual == null)
- throw new ArgumentNullException("actual");
-
- AreElementsEqual(expected.Materialize().ToEnumerable(), actual.Materialize().ToEnumerable(), message);
- }
-
- /// <summary>
- /// Asserts that the given action throws an exception of the type specified in the generic parameter, or a subtype thereof.
- /// </summary>
- /// <typeparam name="TException">Type of the exception to check for.</typeparam>
- /// <param name="action">Action to run.</param>
- /// <exception cref="ArgumentNullException"><paramref name="action"/> is null.</exception>
- public static void Throws<TException>(Action action) where TException : Exception
- {
- if (action == null)
- throw new ArgumentNullException("action");
-
- var failed = false;
- try
- {
- action();
- failed = true;
- }
- catch (TException)
- {
- }
- catch (Exception ex)
- {
- Assert.Fail(string.Format(CultureInfo.CurrentCulture, "Expected {0} threw {1}.\r\n\r\nStack trace:\r\n{2}", typeof(TException).Name, ex.GetType().Name, ex.StackTrace));
- }
-
- if (failed)
- Assert.Fail(string.Format(CultureInfo.CurrentCulture, "Expected {0}.", typeof(TException).Name));
- }
-
- /// <summary>
- /// Asserts that the given action throws an exception of the type specified in the generic parameter, or a subtype thereof.
- /// </summary>
- /// <typeparam name="TException">Type of the exception to check for.</typeparam>
- /// <param name="action">Action to run.</param>
- /// <param name="message">Error message for assert failure.</param>
- /// <exception cref="ArgumentNullException"><paramref name="action"/> is null.</exception>
- public static void Throws<TException>(Action action, string message) where TException : Exception
- {
- if (action == null)
- throw new ArgumentNullException("action");
-
- var failed = false;
- try
- {
- action();
- failed = true;
- }
- catch (TException)
- {
- }
- catch
- {
- Assert.Fail(message);
- }
-
- if (failed)
- Assert.Fail(message);
- }
-
- /// <summary>
- /// Asserts that the given action throws the specified exception.
- /// </summary>
- /// <typeparam name="TException">Type of the exception to check for.</typeparam>
- /// <param name="exception">Exception to assert being thrown.</param>
- /// <param name="action">Action to run.</param>
- /// <exception cref="ArgumentNullException"><paramref name="action"/> is null.</exception>
- public static void Throws<TException>(TException exception, Action action) where TException : Exception
- {
- if (action == null)
- throw new ArgumentNullException("action");
-
- var failed = false;
- try
- {
- action();
- failed = true;
- }
- catch (TException ex)
- {
- Assert.AreSame(exception, ex);
- }
- catch (Exception ex)
- {
- Assert.Fail(string.Format(CultureInfo.CurrentCulture, "Expected {0} threw {1}.\r\n\r\nStack trace:\r\n{2}", typeof(TException).Name, ex.GetType().Name, ex.StackTrace));
- }
-
- if (failed)
- Assert.Fail(string.Format(CultureInfo.CurrentCulture, "Expected {0}.", typeof(TException).Name));
- }
-
- /// <summary>
- /// Asserts that the given action throws the specified exception.
- /// </summary>
- /// <typeparam name="TException">Type of the exception to check for.</typeparam>
- /// <param name="exception">Exception to assert being thrown.</param>
- /// <param name="action">Action to run.</param>
- /// <param name="message">Error message for assert failure.</param>
- /// <exception cref="ArgumentNullException"><paramref name="action"/> is null.</exception>
- public static void Throws<TException>(TException exception, Action action, string message) where TException : Exception
- {
- if (action == null)
- throw new ArgumentNullException("action");
-
- var failed = false;
- try
- {
- action();
- failed = true;
- }
- catch (TException ex)
- {
- Assert.AreSame(exception, ex);
- }
- catch
- {
- Assert.Fail(message);
- }
-
- if (failed)
- Assert.Fail(message);
- }
-
- /// <summary>
- /// Asserts that both enumerable sequences have equal length and equal elements.
- /// </summary>
- /// <typeparam name="T">The type of the elements in the sequence.</typeparam>
- /// <param name="actual">Actual sequence to compare against the expected one.</param>
- /// <param name="expected">Expected sequence.</param>
- /// <exception cref="ArgumentNullException"><paramref name="expected"/> or <paramref name="actual"/> is null.</exception>
- public static void AssertEqual<T>(this IEnumerable<T> actual, IEnumerable<T> expected)
- {
- if (actual == null)
- throw new ArgumentNullException("actual");
- if (expected == null)
- throw new ArgumentNullException("expected");
-
- ReactiveAssert.AreElementsEqual(expected, actual);
- }
-
- /// <summary>
- /// Asserts the enumerable sequence has the expected elements.
- /// </summary>
- /// <typeparam name="T">The type of the elements in the sequence.</typeparam>
- /// <param name="actual">Actual sequence to compare against the expected elements.</param>
- /// <param name="expected">Expected elements.</param>
- /// <exception cref="ArgumentNullException"><paramref name="expected"/> or <paramref name="actual"/> is null.</exception>
- public static void AssertEqual<T>(this IEnumerable<T> actual, params T[] expected)
- {
- if (actual == null)
- throw new ArgumentNullException("actual");
- if (expected == null)
- throw new ArgumentNullException("expected");
-
- ReactiveAssert.AreElementsEqual(expected, actual);
- }
-
- /// <summary>
- /// Asserts that both observable sequences have equal length and equal notifications.
- /// </summary>
- /// <typeparam name="T">The type of the elements in the sequence.</typeparam>
- /// <param name="actual">Actual sequence to compare against the expected one.</param>
- /// <param name="expected">Expected sequence.</param>
- /// <exception cref="ArgumentNullException"><paramref name="expected"/> or <paramref name="actual"/> is null.</exception>
- public static void AssertEqual<T>(this IObservable<T> actual, IObservable<T> expected)
- {
- if (actual == null)
- throw new ArgumentNullException("actual");
- if (expected == null)
- throw new ArgumentNullException("expected");
-
- ReactiveAssert.AreElementsEqual(expected, actual);
- }
- }
-}
diff --git a/Rx.NET/Microsoft.Reactive.Testing/ReactiveTest.cs b/Rx.NET/Microsoft.Reactive.Testing/ReactiveTest.cs
deleted file mode 100644
index 067cc72..0000000
--- a/Rx.NET/Microsoft.Reactive.Testing/ReactiveTest.cs
+++ /dev/null
@@ -1,215 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System;
-using System.Reactive;
-
-namespace Microsoft.Reactive.Testing
-{
- /// <summary>
- /// Base class to write unit tests for applications and libraries built using Reactive Extensions.
- /// </summary>
- public class ReactiveTest
- {
- /// <summary>
- /// Default virtual time used for creation of observable sequences in <see cref="ReactiveTest"/>-based unit tests.
- /// </summary>
- public const long Created = 100;
-
- /// <summary>
- /// Default virtual time used to subscribe to observable sequences in <see cref="ReactiveTest"/>-based unit tests.
- /// </summary>
- public const long Subscribed = 200;
-
- /// <summary>
- /// Default virtual time used to dispose subscriptions in <see cref="ReactiveTest"/>-based unit tests.
- /// </summary>
- public const long Disposed = 1000;
-
- /// <summary>
- /// Factory method for an OnNext notification record at a given time with a given value.
- /// </summary>
- /// <typeparam name="T">The element type for the resulting notification object.</typeparam>
- /// <param name="ticks">Recorded virtual time the OnNext notification occurs.</param>
- /// <param name="value">Recorded value stored in the OnNext notification.</param>
- /// <returns>Recorded OnNext notification.</returns>
- public static Recorded<Notification<T>> OnNext<T>(long ticks, T value)
- {
- return new Recorded<Notification<T>>(ticks, Notification.CreateOnNext<T>(value));
- }
-
- /// <summary>
- /// Factory method for writing an assert that checks for an OnNext notification record at a given time, using the specified predicate to check the value.
- /// </summary>
- /// <typeparam name="T">The element type for the resulting notification object.</typeparam>
- /// <param name="ticks">Recorded virtual time the OnNext notification occurs.</param>
- /// <param name="predicate">Predicate function to check the OnNext notification value against an expected value.</param>
- /// <returns>Recorded OnNext notification with a predicate to assert a given value.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="predicate"/> is null.</exception>
- public static Recorded<Notification<T>> OnNext<T>(long ticks, Func<T, bool> predicate)
- {
- if (predicate == null)
- throw new ArgumentNullException("predicate");
-
- return new Recorded<Notification<T>>(ticks, new OnNextPredicate<T>(predicate));
- }
-
- /// <summary>
- /// Factory method for an OnCompleted notification record at a given time.
- /// </summary>
- /// <typeparam name="T">The element type for the resulting notification object.</typeparam>
- /// <param name="ticks">Recorded virtual time the OnCompleted notification occurs.</param>
- /// <returns>Recorded OnCompleted notification.</returns>
- public static Recorded<Notification<T>> OnCompleted<T>(long ticks)
- {
- return new Recorded<Notification<T>>(ticks, Notification.CreateOnCompleted<T>());
- }
-
- /// <summary>
- /// Factory method for an OnError notification record at a given time with a given error.
- /// </summary>
- /// <typeparam name="T">The element type for the resulting notification object.</typeparam>
- /// <param name="ticks">Recorded virtual time the OnError notification occurs.</param>
- /// <param name="exception">Recorded exception stored in the OnError notification.</param>
- /// <returns>Recorded OnError notification.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="exception"/> is null.</exception>
- public static Recorded<Notification<T>> OnError<T>(long ticks, Exception exception)
- {
- if (exception == null)
- throw new ArgumentNullException("exception");
-
- return new Recorded<Notification<T>>(ticks, Notification.CreateOnError<T>(exception));
- }
-
- /// <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.
- /// </summary>
- /// <typeparam name="T">The element type for the resulting notification object.</typeparam>
- /// <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>
- /// <returns>Recorded OnError notification with a predicate to assert a given exception.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="predicate"/> is null.</exception>
- public static Recorded<Notification<T>> OnError<T>(long ticks, Func<Exception, bool> predicate)
- {
- if (predicate == null)
- throw new ArgumentNullException("predicate");
-
- return new Recorded<Notification<T>>(ticks, new OnErrorPredicate<T>(predicate));
- }
-
- /// <summary>
- /// Factory method for a subscription record based on a given subscription and disposal time.
- /// </summary>
- /// <param name="start">Virtual time indicating when the subscription was created.</param>
- /// <param name="end">Virtual time indicating when the subscription was disposed.</param>
- /// <returns>Subscription object.</returns>
- public static Subscription Subscribe(long start, long end)
- {
- return new Subscription(start, end);
- }
-
- /// <summary>
- /// Factory method for a subscription record based on a given subscription time.
- /// </summary>
- /// <param name="start">Virtual time indicating when the subscription was created.</param>
- /// <returns>Subscription object.</returns>
- public static Subscription Subscribe(long start)
- {
- return new Subscription(start);
- }
-
- #region Predicate-based notification assert helper classes
-
- class OnNextPredicate<T> : PredicateNotification<T>
- {
- private readonly Func<T, bool> _predicate;
-
- public OnNextPredicate(Func<T, bool> predicate)
- {
- _predicate = predicate;
- }
-
- public override bool Equals(Notification<T> other)
- {
- if (Object.ReferenceEquals(this, other))
- return true;
- if (Object.ReferenceEquals(other, null))
- return false;
- if (other.Kind != NotificationKind.OnNext)
- return false;
-
- return _predicate(other.Value);
- }
- }
-
- class OnErrorPredicate<T> : PredicateNotification<T>
- {
- private readonly Func<Exception, bool> _predicate;
-
- public OnErrorPredicate(Func<Exception, bool> predicate)
- {
- _predicate = predicate;
- }
-
- public override bool Equals(Notification<T> other)
- {
- if (Object.ReferenceEquals(this, other))
- return true;
- if (Object.ReferenceEquals(other, null))
- return false;
- if (other.Kind != NotificationKind.OnError)
- return false;
-
- return _predicate(other.Exception);
- }
- }
-
- abstract class PredicateNotification<T> : Notification<T>
- {
- #region Non-implemented members (by design)
-
- public override T Value
- {
- get { throw new NotSupportedException(); }
- }
-
- public override bool HasValue
- {
- get { throw new NotSupportedException(); }
- }
-
- public override Exception Exception
- {
- get { throw new NotSupportedException(); }
- }
-
- public override NotificationKind Kind
- {
- get { throw new NotSupportedException(); }
- }
-
- public override void Accept(IObserver<T> observer)
- {
- throw new NotSupportedException();
- }
-
- public override TResult Accept<TResult>(IObserver<T, TResult> observer)
- {
- throw new NotSupportedException();
- }
-
- public override void Accept(Action<T> onNext, Action<Exception> onError, Action onCompleted)
- {
- throw new NotSupportedException();
- }
-
- public override TResult Accept<TResult>(Func<T, TResult> onNext, Func<Exception, TResult> onError, Func<TResult> onCompleted)
- {
- throw new NotSupportedException();
- }
-
- #endregion
- }
-
- #endregion
- }
-}
diff --git a/Rx.NET/Microsoft.Reactive.Testing/Recorded.cs b/Rx.NET/Microsoft.Reactive.Testing/Recorded.cs
deleted file mode 100644
index d587299..0000000
--- a/Rx.NET/Microsoft.Reactive.Testing/Recorded.cs
+++ /dev/null
@@ -1,108 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Globalization;
-
-namespace Microsoft.Reactive.Testing
-{
- /// <summary>
- /// Record of a value including the virtual time it was produced on.
- /// </summary>
- /// <typeparam name="T">Type of the value.</typeparam>
-#if !NO_DEBUGGER_ATTRIBUTES
- [DebuggerDisplay("{Value}@{Time}")]
-#endif
-#if !NO_SERIALIZABLE
- [Serializable]
-#endif
- public struct Recorded<T> : IEquatable<Recorded<T>>
- {
- private readonly long _time;
- private readonly T _value;
-
- /// <summary>
- /// Gets the virtual time the value was produced on.
- /// </summary>
- public long Time { get { return _time; } }
-
- /// <summary>
- /// Gets the recorded value.
- /// </summary>
- public T Value { get { return _value; } }
-
- /// <summary>
- /// Creates a new object recording the production of the specified value at the given virtual time.
- /// </summary>
- /// <param name="time">Virtual time the value was produced on.</param>
- /// <param name="value">Value that was produced.</param>
- public Recorded(long time, T value)
- {
- _time = time;
- _value = value;
- }
-
- /// <summary>
- /// Checks whether the given recorded object is equal to the current instance.
- /// </summary>
- /// <param name="other">Recorded object to check for equality.</param>
- /// <returns>true if both objects are equal; false otherwise.</returns>
- public bool Equals(Recorded<T> other)
- {
- return Time == other.Time && EqualityComparer<T>.Default.Equals(Value, other.Value);
- }
-
- /// <summary>
- /// Determines whether the two specified Recorded&lt;T&gt; values have the same Time and Value.
- /// </summary>
- /// <param name="left">The first Recorded&lt;T&gt; value to compare.</param>
- /// <param name="right">The second Recorded&lt;T&gt; value to compare.</param>
- /// <returns>true if the first Recorded&lt;T&gt; value has the same Time and Value as the second Recorded&lt;T&gt; value; otherwise, false.</returns>
- public static bool operator ==(Recorded<T> left, Recorded<T> right)
- {
- return left.Equals(right);
- }
-
- /// <summary>
- /// Determines whether the two specified Recorded&lt;T&gt; values don't have the same Time and Value.
- /// </summary>
- /// <param name="left">The first Recorded&lt;T&gt; value to compare.</param>
- /// <param name="right">The second Recorded&lt;T&gt; value to compare.</param>
- /// <returns>true if the first Recorded&lt;T&gt; value has a different Time or Value as the second Recorded&lt;T&gt; value; otherwise, false.</returns>
- public static bool operator !=(Recorded<T> left, Recorded<T> right)
- {
- return !left.Equals(right);
- }
-
- /// <summary>
- /// Determines whether the specified System.Object is equal to the current Recorded&lt;T&gt; value.
- /// </summary>
- /// <param name="obj">The System.Object to compare with the current Recorded&lt;T&gt; value.</param>
- /// <returns>true if the specified System.Object is equal to the current Recorded&lt;T&gt; value; otherwise, false.</returns>
- public override bool Equals(object obj)
- {
- if (obj is Recorded<T>)
- return Equals((Recorded<T>)obj);
- return false;
- }
-
- /// <summary>
- /// Returns the hash code for the current Recorded&lt;T&gt; value.
- /// </summary>
- /// <returns>A hash code for the current Recorded&lt;T&gt; value.</returns>
- public override int GetHashCode()
- {
- return Time.GetHashCode() + EqualityComparer<T>.Default.GetHashCode(Value);
- }
-
- /// <summary>
- /// Returns a string representation of the current Recorded&lt;T&gt; value.
- /// </summary>
- /// <returns>String representation of the current Recorded&lt;T&gt; value.</returns>
- public override string ToString()
- {
- return Value.ToString() + "@" + Time.ToString(CultureInfo.CurrentCulture);
- }
- }
-}
diff --git a/Rx.NET/Microsoft.Reactive.Testing/Subscription.cs b/Rx.NET/Microsoft.Reactive.Testing/Subscription.cs
deleted file mode 100644
index 2f9b7a5..0000000
--- a/Rx.NET/Microsoft.Reactive.Testing/Subscription.cs
+++ /dev/null
@@ -1,124 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System;
-using System.Diagnostics;
-using System.Globalization;
-
-namespace Microsoft.Reactive.Testing
-{
- /// <summary>
- /// Records information about subscriptions to and unsubscriptions from observable sequences.
- /// </summary>
-#if !NO_DEBUGGER_ATTRIBUTES
- [DebuggerDisplay("({Subscribe}, {Unsubscribe})")]
-#endif
-#if !NO_SERIALIZABLE
- [Serializable]
-#endif
- public struct Subscription : IEquatable<Subscription>
- {
- /// <summary>
- /// Infinite virtual time value, used to indicate an unsubscription never took place.
- /// </summary>
- public const long Infinite = long.MaxValue;
-
- private long _subscribe;
- private long _unsubscribe;
-
- /// <summary>
- /// Gets the subscription virtual time.
- /// </summary>
- public long Subscribe { get { return _subscribe; } }
-
- /// <summary>
- /// Gets the unsubscription virtual time.
- /// </summary>
- public long Unsubscribe { get { return _unsubscribe; } }
-
- /// <summary>
- /// Creates a new subscription object with the given virtual subscription time.
- /// </summary>
- /// <param name="subscribe">Virtual time at which the subscription occurred.</param>-
- public Subscription(long subscribe)
- {
- _subscribe = subscribe;
- _unsubscribe = Infinite;
- }
-
- /// <summary>
- /// Creates a new subscription object with the given virtual subscription and unsubscription time.
- /// </summary>
- /// <param name="subscribe">Virtual time at which the subscription occurred.</param>
- /// <param name="unsubscribe">Virtual time at which the unsubscription occurred.</param>
- public Subscription(long subscribe, long unsubscribe)
- {
- _subscribe = subscribe;
- _unsubscribe = unsubscribe;
- }
-
- /// <summary>
- /// Checks whether the given subscription is equal to the current instance.
- /// </summary>
- /// <param name="other">Subscription object to check for equality.</param>
- /// <returns>true if both objects are equal; false otherwise.</returns>
- public bool Equals(Subscription other)
- {
- return Subscribe == other.Subscribe && Unsubscribe == other.Unsubscribe;
- }
-
- /// <summary>
- /// Determines whether the two specified Subscription values have the same Subscribe and Unsubscribe.
- /// </summary>
- /// <param name="left">The first Subscription value to compare.</param>
- /// <param name="right">The second Subscription value to compare.</param>
- /// <returns>true if the first Subscription value has the same Subscribe and Unsubscribe as the second Subscription value; otherwise, false.</returns>
- public static bool operator==(Subscription left, Subscription right)
- {
- return left.Equals(right);
- }
-
- /// <summary>
- /// Determines whether the two specified Subscription values don't have the same Subscribe and Unsubscribe.
- /// </summary>
- /// <param name="left">The first Subscription value to compare.</param>
- /// <param name="right">The second Subscription value to compare.</param>
- /// <returns>true if the first Subscription value has a different Subscribe or Unsubscribe as the second Subscription value; otherwise, false.</returns>
- public static bool operator !=(Subscription left, Subscription right)
- {
- return !left.Equals(right);
- }
-
- /// <summary>
- /// Determines whether the specified System.Object is equal to the current Subscription value.
- /// </summary>
- /// <param name="obj">The System.Object to compare with the current Subscription value.</param>
- /// <returns>true if the specified System.Object is equal to the current Subscription value; otherwise, false.</returns>
- public override bool Equals(object obj)
- {
- if (obj is Subscription)
- return Equals((Subscription)obj);
- return false;
- }
-
- /// <summary>
- /// Returns the hash code for the current Subscription value.
- /// </summary>
- /// <returns>A hash code for the current Subscription value.</returns>
- public override int GetHashCode()
- {
- return Subscribe.GetHashCode() ^ Unsubscribe.GetHashCode();
- }
-
- /// <summary>
- /// Returns a string representation of the current Subscription value.
- /// </summary>
- /// <returns>String representation of the current Subscription value.</returns>
- public override string ToString()
- {
- if (Unsubscribe == Infinite)
- return string.Format(CultureInfo.CurrentCulture, "({0}, Infinite)", Subscribe);
- else
- return string.Format(CultureInfo.CurrentCulture, "({0}, {1})", Subscribe, Unsubscribe);
- }
- }
-}
diff --git a/Rx.NET/Microsoft.Reactive.Testing/TestScheduler.cs b/Rx.NET/Microsoft.Reactive.Testing/TestScheduler.cs
deleted file mode 100644
index cb20111..0000000
--- a/Rx.NET/Microsoft.Reactive.Testing/TestScheduler.cs
+++ /dev/null
@@ -1,163 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System;
-using System.Reactive;
-using System.Reactive.Concurrency;
-using System.Reactive.Disposables;
-
-namespace Microsoft.Reactive.Testing
-{
- /// <summary>
- /// Virtual time scheduler used for testing applications and libraries built using Reactive Extensions.
- /// </summary>
- public class TestScheduler : VirtualTimeScheduler<long, long>
- {
- /// <summary>
- /// Schedules an action to be executed at the specified virtual time.
- /// </summary>
- /// <typeparam name="TState">The type of the state passed to the scheduled action.</typeparam>
- /// <param name="state">State passed to the action to be executed.</param>
- /// <param name="action">Action to be executed.</param>
- /// <param name="dueTime">Absolute virtual time at which to execute the action.</param>
- /// <returns>Disposable object used to cancel the scheduled action (best effort).</returns>
- /// <exception cref="ArgumentNullException"><paramref name="action"/> is null.</exception>
- public override IDisposable ScheduleAbsolute<TState>(TState state, long dueTime, Func<IScheduler, TState, IDisposable> action)
- {
- if (dueTime <= Clock)
- dueTime = Clock + 1;
-
- return base.ScheduleAbsolute<TState>(state, dueTime, action);
- }
-
- /// <summary>
- /// Adds a relative virtual time to an absolute virtual time value.
- /// </summary>
- /// <param name="absolute">Absolute virtual time value.</param>
- /// <param name="relative">Relative virtual time value to add.</param>
- /// <returns>Resulting absolute virtual time sum value.</returns>
- protected override long Add(long absolute, long relative)
- {
- return absolute + relative;
- }
-
- /// <summary>
- /// Converts the absolute virtual time value to a DateTimeOffset value.
- /// </summary>
- /// <param name="absolute">Absolute virtual time value to convert.</param>
- /// <returns>Corresponding DateTimeOffset value.</returns>
- protected override DateTimeOffset ToDateTimeOffset(long absolute)
- {
- return new DateTimeOffset(absolute, TimeSpan.Zero);
- }
-
- /// <summary>
- /// Converts the TimeSpan value to a relative virtual time value.
- /// </summary>
- /// <param name="timeSpan">TimeSpan value to convert.</param>
- /// <returns>Corresponding relative virtual time value.</returns>
- protected override long ToRelative(TimeSpan timeSpan)
- {
- return timeSpan.Ticks;
- }
-
- /// <summary>
- /// Starts the test scheduler and uses the specified virtual times to invoke the factory function, subscribe to the resulting sequence, and dispose the subscription.
- /// </summary>
- /// <typeparam name="T">The element type of the observable sequence being tested.</typeparam>
- /// <param name="create">Factory method to create an observable sequence.</param>
- /// <param name="created">Virtual time at which to invoke the factory to create an observable sequence.</param>
- /// <param name="subscribed">Virtual time at which to subscribe to the created observable sequence.</param>
- /// <param name="disposed">Virtual time at which to dispose the subscription.</param>
- /// <returns>Observer with timestamped recordings of notification messages that were received during the virtual time window when the subscription to the source sequence was active.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="create"/> is null.</exception>
- public ITestableObserver<T> Start<T>(Func<IObservable<T>> create, long created, long subscribed, long disposed)
- {
- if (create == null)
- throw new ArgumentNullException("create");
-
- var source = default(IObservable<T>);
- var subscription = default(IDisposable);
- var observer = CreateObserver<T>();
-
- ScheduleAbsolute(default(object), created, (scheduler, state) => { source = create(); return Disposable.Empty; });
- ScheduleAbsolute(default(object), subscribed, (scheduler, state) => { subscription = source.Subscribe(observer); return Disposable.Empty; });
- ScheduleAbsolute(default(object), disposed, (scheduler, state) => { subscription.Dispose(); return Disposable.Empty; });
-
- Start();
-
- return observer;
- }
-
- /// <summary>
- /// Starts the test scheduler and uses the specified virtual time to dispose the subscription to the sequence obtained through the factory function.
- /// Default virtual times are used for <see cref="ReactiveTest.Created">factory invocation</see> and <see cref="ReactiveTest.Subscribed">sequence subscription</see>.
- /// </summary>
- /// <typeparam name="T">The element type of the observable sequence being tested.</typeparam>
- /// <param name="create">Factory method to create an observable sequence.</param>
- /// <param name="disposed">Virtual time at which to dispose the subscription.</param>
- /// <returns>Observer with timestamped recordings of notification messages that were received during the virtual time window when the subscription to the source sequence was active.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="create"/> is null.</exception>
- public ITestableObserver<T> Start<T>(Func<IObservable<T>> create, long disposed)
- {
- if (create == null)
- throw new ArgumentNullException("create");
-
- return Start(create, ReactiveTest.Created, ReactiveTest.Subscribed, disposed);
- }
-
- /// <summary>
- /// Starts the test scheduler and uses default virtual times to <see cref="ReactiveTest.Created">invoke the factory function</see>, to <see cref="ReactiveTest.Subscribed">subscribe to the resulting sequence</see>, and to <see cref="ReactiveTest.Disposed">dispose the subscription</see>.
- /// </summary>
- /// <typeparam name="T">The element type of the observable sequence being tested.</typeparam>
- /// <param name="create">Factory method to create an observable sequence.</param>
- /// <returns>Observer with timestamped recordings of notification messages that were received during the virtual time window when the subscription to the source sequence was active.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="create"/> is null.</exception>
- public ITestableObserver<T> Start<T>(Func<IObservable<T>> create)
- {
- if (create == null)
- throw new ArgumentNullException("create");
-
- return Start(create, ReactiveTest.Created, ReactiveTest.Subscribed, ReactiveTest.Disposed);
- }
-
- /// <summary>
- /// Creates a hot observable using the specified timestamped notification messages.
- /// </summary>
- /// <typeparam name="T">The element type of the observable sequence being created.</typeparam>
- /// <param name="messages">Notifications to surface through the created sequence at their specified absolute virtual times.</param>
- /// <returns>Hot observable sequence that can be used to assert the timing of subscriptions and notifications.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="messages"/> is null.</exception>
- public ITestableObservable<T> CreateHotObservable<T>(params Recorded<Notification<T>>[] messages)
- {
- if (messages == null)
- throw new ArgumentNullException("messages");
-
- return new HotObservable<T>(this, messages);
- }
-
- /// <summary>
- /// Creates a cold observable using the specified timestamped notification messages.
- /// </summary>
- /// <typeparam name="T">The element type of the observable sequence being created.</typeparam>
- /// <param name="messages">Notifications to surface through the created sequence at their specified virtual time offsets from the sequence subscription time.</param>
- /// <returns>Cold observable sequence that can be used to assert the timing of subscriptions and notifications.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="messages"/> is null.</exception>
- public ITestableObservable<T> CreateColdObservable<T>(params Recorded<Notification<T>>[] messages)
- {
- if (messages == null)
- throw new ArgumentNullException("messages");
-
- return new ColdObservable<T>(this, messages);
- }
-
- /// <summary>
- /// Creates an observer that records received notification messages and timestamps those.
- /// </summary>
- /// <typeparam name="T">The element type of the observer being created.</typeparam>
- /// <returns>Observer that can be used to assert the timing of received notifications.</returns>
- public ITestableObserver<T> CreateObserver<T>()
- {
- return new MockObserver<T>(this);
- }
- }
-}
diff --git a/Rx.NET/README.mono b/Rx.NET/README.mono
deleted file mode 100644
index 7da4dea..0000000
--- a/Rx.NET/README.mono
+++ /dev/null
@@ -1,8 +0,0 @@
-As of OSS release 1.0, there are only two steps are required to make it possible to build with mono in the source repo:
-
-- apply ReactiveAssert.cs change.
-- run replacer.sh
-
-Actually ObservableExTest.cs cannot be compiled due to insufficient
-type inference for lambdas, so I skipped it in Mono.Reactive.Testing_test.dll.
-
diff --git a/Rx.NET/Rx.ruleset b/Rx.NET/Rx.ruleset
deleted file mode 100644
index 591de30..0000000
--- a/Rx.NET/Rx.ruleset
+++ /dev/null
@@ -1,222 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<RuleSet Name="New Rule Set" Description=" " ToolsVersion="10.0">
- <Rules AnalyzerId="Microsoft.Analyzers.ManagedCodeAnalysis" RuleNamespace="Microsoft.Rules.Managed">
- <Rule Id="CA1000" Action="Warning" />
- <Rule Id="CA1002" Action="Warning" />
- <Rule Id="CA1003" Action="Warning" />
- <Rule Id="CA1004" Action="Warning" />
- <Rule Id="CA1007" Action="Warning" />
- <Rule Id="CA1008" Action="Warning" />
- <Rule Id="CA1009" Action="Warning" />
- <Rule Id="CA1010" Action="Warning" />
- <Rule Id="CA1012" Action="Warning" />
- <Rule Id="CA1013" Action="Warning" />
- <Rule Id="CA1014" Action="Warning" />
- <Rule Id="CA1016" Action="Warning" />
- <Rule Id="CA1017" Action="Warning" />
- <Rule Id="CA1018" Action="Warning" />
- <Rule Id="CA1019" Action="Warning" />
- <Rule Id="CA1020" Action="Warning" />
- <Rule Id="CA1021" Action="Warning" />
- <Rule Id="CA1023" Action="Warning" />
- <Rule Id="CA1024" Action="Warning" />
- <Rule Id="CA1025" Action="Warning" />
- <Rule Id="CA1026" Action="Warning" />
- <Rule Id="CA1027" Action="Warning" />
- <Rule Id="CA1028" Action="Warning" />
- <Rule Id="CA1030" Action="Warning" />
- <Rule Id="CA1032" Action="Warning" />
- <Rule Id="CA1033" Action="Warning" />
- <Rule Id="CA1034" Action="Warning" />
- <Rule Id="CA1035" Action="Warning" />
- <Rule Id="CA1036" Action="Warning" />
- <Rule Id="CA1038" Action="Warning" />
- <Rule Id="CA1039" Action="Warning" />
- <Rule Id="CA1040" Action="Warning" />
- <Rule Id="CA1041" Action="Warning" />
- <Rule Id="CA1043" Action="Warning" />
- <Rule Id="CA1044" Action="Warning" />
- <Rule Id="CA1045" Action="Warning" />
- <Rule Id="CA1046" Action="Warning" />
- <Rule Id="CA1047" Action="Warning" />
- <Rule Id="CA1048" Action="Warning" />
- <Rule Id="CA1049" Action="Warning" />
- <Rule Id="CA1050" Action="Warning" />
- <Rule Id="CA1051" Action="Warning" />
- <Rule Id="CA1052" Action="Warning" />
- <Rule Id="CA1053" Action="Warning" />
- <Rule Id="CA1054" Action="Warning" />
- <Rule Id="CA1055" Action="Warning" />
- <Rule Id="CA1056" Action="Warning" />
- <Rule Id="CA1057" Action="Warning" />
- <Rule Id="CA1058" Action="Warning" />
- <Rule Id="CA1059" Action="Warning" />
- <Rule Id="CA1060" Action="Warning" />
- <Rule Id="CA1061" Action="Warning" />
- <Rule Id="CA1062" Action="Warning" />
- <Rule Id="CA1063" Action="Warning" />
- <Rule Id="CA1064" Action="Warning" />
- <Rule Id="CA1065" Action="Warning" />
- <Rule Id="CA1300" Action="Warning" />
- <Rule Id="CA1301" Action="Warning" />
- <Rule Id="CA1302" Action="Warning" />
- <Rule Id="CA1303" Action="Warning" />
- <Rule Id="CA1304" Action="Warning" />
- <Rule Id="CA1305" Action="Warning" />
- <Rule Id="CA1306" Action="Warning" />
- <Rule Id="CA1307" Action="Warning" />
- <Rule Id="CA1308" Action="Warning" />
- <Rule Id="CA1309" Action="Warning" />
- <Rule Id="CA1400" Action="Warning" />
- <Rule Id="CA1401" Action="Warning" />
- <Rule Id="CA1402" Action="Warning" />
- <Rule Id="CA1403" Action="Warning" />
- <Rule Id="CA1404" Action="Warning" />
- <Rule Id="CA1405" Action="Warning" />
- <Rule Id="CA1406" Action="Warning" />
- <Rule Id="CA1407" Action="Warning" />
- <Rule Id="CA1408" Action="Warning" />
- <Rule Id="CA1409" Action="Warning" />
- <Rule Id="CA1410" Action="Warning" />
- <Rule Id="CA1411" Action="Warning" />
- <Rule Id="CA1412" Action="Warning" />
- <Rule Id="CA1413" Action="Warning" />
- <Rule Id="CA1414" Action="Warning" />
- <Rule Id="CA1415" Action="Warning" />
- <Rule Id="CA1600" Action="Warning" />
- <Rule Id="CA1601" Action="Warning" />
- <Rule Id="CA1700" Action="Warning" />
- <Rule Id="CA1701" Action="Warning" />
- <Rule Id="CA1702" Action="Warning" />
- <Rule Id="CA1703" Action="Warning" />
- <Rule Id="CA1704" Action="Warning" />
- <Rule Id="CA1707" Action="Warning" />
- <Rule Id="CA1708" Action="Warning" />
- <Rule Id="CA1709" Action="Warning" />
- <Rule Id="CA1710" Action="Warning" />
- <Rule Id="CA1711" Action="Warning" />
- <Rule Id="CA1712" Action="Warning" />
- <Rule Id="CA1713" Action="Warning" />
- <Rule Id="CA1714" Action="Warning" />
- <Rule Id="CA1715" Action="Warning" />
- <Rule Id="CA1716" Action="Warning" />
- <Rule Id="CA1717" Action="Warning" />
- <Rule Id="CA1719" Action="Warning" />
- <Rule Id="CA1720" Action="Warning" />
- <Rule Id="CA1721" Action="Warning" />
- <Rule Id="CA1722" Action="Warning" />
- <Rule Id="CA1724" Action="Warning" />
- <Rule Id="CA1725" Action="Warning" />
- <Rule Id="CA1726" Action="Warning" />
- <Rule Id="CA1800" Action="Warning" />
- <Rule Id="CA1801" Action="Warning" />
- <Rule Id="CA1802" Action="Warning" />
- <Rule Id="CA1804" Action="Warning" />
- <Rule Id="CA1806" Action="Warning" />
- <Rule Id="CA1809" Action="Warning" />
- <Rule Id="CA1810" Action="Warning" />
- <Rule Id="CA1811" Action="Warning" />
- <Rule Id="CA1812" Action="Warning" />
- <Rule Id="CA1813" Action="Warning" />
- <Rule Id="CA1814" Action="Warning" />
- <Rule Id="CA1815" Action="Warning" />
- <Rule Id="CA1816" Action="Warning" />
- <Rule Id="CA1819" Action="Warning" />
- <Rule Id="CA1820" Action="Warning" />
- <Rule Id="CA1821" Action="Warning" />
- <Rule Id="CA1822" Action="Warning" />
- <Rule Id="CA1823" Action="Warning" />
- <Rule Id="CA1824" Action="Warning" />
- <Rule Id="CA1900" Action="Warning" />
- <Rule Id="CA1901" Action="Warning" />
- <Rule Id="CA1903" Action="Warning" />
- <Rule Id="CA2001" Action="Warning" />
- <Rule Id="CA2002" Action="Warning" />
- <Rule Id="CA2003" Action="Warning" />
- <Rule Id="CA2004" Action="Warning" />
- <Rule Id="CA2006" Action="Warning" />
- <Rule Id="CA2100" Action="Warning" />
- <Rule Id="CA2101" Action="Warning" />
- <Rule Id="CA2102" Action="Warning" />
- <Rule Id="CA2103" Action="Warning" />
- <Rule Id="CA2104" Action="Warning" />
- <Rule Id="CA2105" Action="Warning" />
- <Rule Id="CA2106" Action="Warning" />
- <Rule Id="CA2107" Action="Warning" />
- <Rule Id="CA2108" Action="Warning" />
- <Rule Id="CA2109" Action="Warning" />
- <Rule Id="CA2111" Action="Warning" />
- <Rule Id="CA2112" Action="Warning" />
- <Rule Id="CA2114" Action="Warning" />
- <Rule Id="CA2115" Action="Warning" />
- <Rule Id="CA2116" Action="Warning" />
- <Rule Id="CA2117" Action="Warning" />
- <Rule Id="CA2118" Action="Warning" />
- <Rule Id="CA2119" Action="Warning" />
- <Rule Id="CA2120" Action="Warning" />
- <Rule Id="CA2121" Action="Warning" />
- <Rule Id="CA2122" Action="Warning" />
- <Rule Id="CA2123" Action="Warning" />
- <Rule Id="CA2124" Action="Warning" />
- <Rule Id="CA2126" Action="Warning" />
- <Rule Id="CA2130" Action="Warning" />
- <Rule Id="CA2131" Action="Warning" />
- <Rule Id="CA2132" Action="Warning" />
- <Rule Id="CA2133" Action="Warning" />
- <Rule Id="CA2134" Action="Warning" />
- <Rule Id="CA2135" Action="Warning" />
- <Rule Id="CA2136" Action="Warning" />
- <Rule Id="CA2137" Action="Warning" />
- <Rule Id="CA2138" Action="Warning" />
- <Rule Id="CA2139" Action="Warning" />
- <Rule Id="CA2140" Action="Warning" />
- <Rule Id="CA2141" Action="Warning" />
- <Rule Id="CA2142" Action="Warning" />
- <Rule Id="CA2143" Action="Warning" />
- <Rule Id="CA2144" Action="Warning" />
- <Rule Id="CA2145" Action="Warning" />
- <Rule Id="CA2146" Action="Warning" />
- <Rule Id="CA2147" Action="Warning" />
- <Rule Id="CA2149" Action="Warning" />
- <Rule Id="CA2201" Action="Warning" />
- <Rule Id="CA2202" Action="Warning" />
- <Rule Id="CA2204" Action="Warning" />
- <Rule Id="CA2205" Action="Warning" />
- <Rule Id="CA2207" Action="Warning" />
- <Rule Id="CA2208" Action="Warning" />
- <Rule Id="CA2210" Action="Warning" />
- <Rule Id="CA2211" Action="Warning" />
- <Rule Id="CA2212" Action="Warning" />
- <Rule Id="CA2213" Action="Warning" />
- <Rule Id="CA2214" Action="Warning" />
- <Rule Id="CA2215" Action="Warning" />
- <Rule Id="CA2216" Action="Warning" />
- <Rule Id="CA2217" Action="Warning" />
- <Rule Id="CA2218" Action="Warning" />
- <Rule Id="CA2219" Action="Warning" />
- <Rule Id="CA2220" Action="Warning" />
- <Rule Id="CA2221" Action="Warning" />
- <Rule Id="CA2222" Action="Warning" />
- <Rule Id="CA2223" Action="Warning" />
- <Rule Id="CA2224" Action="Warning" />
- <Rule Id="CA2225" Action="Warning" />
- <Rule Id="CA2226" Action="Warning" />
- <Rule Id="CA2227" Action="Warning" />
- <Rule Id="CA2228" Action="Warning" />
- <Rule Id="CA2229" Action="Warning" />
- <Rule Id="CA2230" Action="Warning" />
- <Rule Id="CA2231" Action="Warning" />
- <Rule Id="CA2232" Action="Warning" />
- <Rule Id="CA2233" Action="Warning" />
- <Rule Id="CA2234" Action="Warning" />
- <Rule Id="CA2235" Action="Warning" />
- <Rule Id="CA2236" Action="Warning" />
- <Rule Id="CA2237" Action="Warning" />
- <Rule Id="CA2238" Action="Warning" />
- <Rule Id="CA2239" Action="Warning" />
- <Rule Id="CA2240" Action="Warning" />
- <Rule Id="CA2241" Action="Warning" />
- <Rule Id="CA2242" Action="Warning" />
- <Rule Id="CA2243" Action="Warning" />
- </Rules>
-</RuleSet> \ No newline at end of file
diff --git a/Rx.NET/Rx.sln b/Rx.NET/Rx.sln
deleted file mode 100644
index 95c908e..0000000
--- a/Rx.NET/Rx.sln
+++ /dev/null
@@ -1,1782 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 2012
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Reactive.Linq", "System.Reactive.Linq\System.Reactive.Linq.csproj", "{63252AE9-5186-45CA-BFCD-FA51C6B66A43}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Reactive.Testing", "Microsoft.Reactive.Testing\Microsoft.Reactive.Testing.csproj", "{E7B7408B-B039-4F30-B6CF-CC06218CE4CA}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tests.System.Reactive", "Tests.System.Reactive\Tests.System.Reactive.csproj", "{2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{9492F965-20BF-4F80-A09F-54344F3862AE}"
- ProjectSection(SolutionItems) = preProject
- 35MSSharedLib1024.snk = 35MSSharedLib1024.snk
- Import.targets = Import.targets
- license.txt = license.txt
- Local.testsettings = Local.testsettings
- Rx.ruleset = Rx.ruleset
- Rx.vsmdi = Rx.vsmdi
- Test.ruleset = Test.ruleset
- TraceAndTestImpact.testsettings = TraceAndTestImpact.testsettings
- EndProjectSection
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Reactive.Windows.Forms", "System.Reactive.Windows.Forms\System.Reactive.Windows.Forms.csproj", "{E32328A1-1F5B-45F9-B005-02EF5CC2CF0D}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Reactive.Windows.Threading", "System.Reactive.Windows.Threading\System.Reactive.Windows.Threading.csproj", "{2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Reactive.Providers", "System.Reactive.Providers\System.Reactive.Providers.csproj", "{C7B9D7BE-F47F-466B-A6B0-E46F1069B171}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Reactive.WindowsRuntime", "System.Reactive.WindowsRuntime\System.Reactive.WindowsRuntime.csproj", "{EE655A70-A899-4B38-84D3-FB9F63A8C661}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Reactive.Interfaces", "System.Reactive.Interfaces\System.Reactive.Interfaces.csproj", "{9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Reactive.Core", "System.Reactive.Core\System.Reactive.Core.csproj", "{4E516F10-DA7A-4D43-963E-A93865ABEA5B}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Reactive.PlatformServices", "System.Reactive.PlatformServices\System.Reactive.PlatformServices.csproj", "{0CCCF009-763F-40D2-8655-7A94828023BF}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Reactive.Runtime.Remoting", "System.Reactive.Runtime.Remoting\System.Reactive.Runtime.Remoting.csproj", "{7A6EF49E-7946-4101-9C89-407B9C53A173}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Reactive.Experimental", "System.Reactive.Experimental\System.Reactive.Experimental.csproj", "{41E65B96-733B-41C4-A1BB-7476359B89EB}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Reactive.Debugger", "System.Reactive.Debugger\System.Reactive.Debugger.csproj", "{FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}"
-EndProject
-Global
- GlobalSection(TestCaseManagementSettings) = postSolution
- CategoryFile = Rx.vsmdi
- EndGlobalSection
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Any CPU = Debug|Any CPU
- Debug|Mixed Platforms = Debug|Mixed Platforms
- Debug|x86 = Debug|x86
- Debug35|Any CPU = Debug35|Any CPU
- Debug35|Mixed Platforms = Debug35|Mixed Platforms
- Debug35|x86 = Debug35|x86
- Debug40|Any CPU = Debug40|Any CPU
- Debug40|Mixed Platforms = Debug40|Mixed Platforms
- Debug40|x86 = Debug40|x86
- Debug45|Any CPU = Debug45|Any CPU
- Debug45|Mixed Platforms = Debug45|Mixed Platforms
- Debug45|x86 = Debug45|x86
- Debug8|Any CPU = Debug8|Any CPU
- Debug8|Mixed Platforms = Debug8|Mixed Platforms
- Debug8|x86 = Debug8|x86
- DebugCF35|Any CPU = DebugCF35|Any CPU
- DebugCF35|Mixed Platforms = DebugCF35|Mixed Platforms
- DebugCF35|x86 = DebugCF35|x86
- DebugPL|Any CPU = DebugPL|Any CPU
- DebugPL|Mixed Platforms = DebugPL|Mixed Platforms
- DebugPL|x86 = DebugPL|x86
- DebugSL3|Any CPU = DebugSL3|Any CPU
- DebugSL3|Mixed Platforms = DebugSL3|Mixed Platforms
- DebugSL3|x86 = DebugSL3|x86
- DebugSL4|Any CPU = DebugSL4|Any CPU
- DebugSL4|Mixed Platforms = DebugSL4|Mixed Platforms
- DebugSL4|x86 = DebugSL4|x86
- DebugSL5|Any CPU = DebugSL5|Any CPU
- DebugSL5|Mixed Platforms = DebugSL5|Mixed Platforms
- DebugSL5|x86 = DebugSL5|x86
- DebugWP7|Any CPU = DebugWP7|Any CPU
- DebugWP7|Mixed Platforms = DebugWP7|Mixed Platforms
- DebugWP7|x86 = DebugWP7|x86
- DebugWP8|Any CPU = DebugWP8|Any CPU
- DebugWP8|Mixed Platforms = DebugWP8|Mixed Platforms
- DebugWP8|x86 = DebugWP8|x86
- DebugXBLV|Any CPU = DebugXBLV|Any CPU
- DebugXBLV|Mixed Platforms = DebugXBLV|Mixed Platforms
- DebugXBLV|x86 = DebugXBLV|x86
- DebugXNA4|Any CPU = DebugXNA4|Any CPU
- DebugXNA4|Mixed Platforms = DebugXNA4|Mixed Platforms
- DebugXNA4|x86 = DebugXNA4|x86
- Release|Any CPU = Release|Any CPU
- Release|Mixed Platforms = Release|Mixed Platforms
- Release|x86 = Release|x86
- Release35|Any CPU = Release35|Any CPU
- Release35|Mixed Platforms = Release35|Mixed Platforms
- Release35|x86 = Release35|x86
- Release40|Any CPU = Release40|Any CPU
- Release40|Mixed Platforms = Release40|Mixed Platforms
- Release40|x86 = Release40|x86
- Release45|Any CPU = Release45|Any CPU
- Release45|Mixed Platforms = Release45|Mixed Platforms
- Release45|x86 = Release45|x86
- Release8|Any CPU = Release8|Any CPU
- Release8|Mixed Platforms = Release8|Mixed Platforms
- Release8|x86 = Release8|x86
- ReleaseCF35|Any CPU = ReleaseCF35|Any CPU
- ReleaseCF35|Mixed Platforms = ReleaseCF35|Mixed Platforms
- ReleaseCF35|x86 = ReleaseCF35|x86
- ReleasePL|Any CPU = ReleasePL|Any CPU
- ReleasePL|Mixed Platforms = ReleasePL|Mixed Platforms
- ReleasePL|x86 = ReleasePL|x86
- ReleaseSL3|Any CPU = ReleaseSL3|Any CPU
- ReleaseSL3|Mixed Platforms = ReleaseSL3|Mixed Platforms
- ReleaseSL3|x86 = ReleaseSL3|x86
- ReleaseSL4|Any CPU = ReleaseSL4|Any CPU
- ReleaseSL4|Mixed Platforms = ReleaseSL4|Mixed Platforms
- ReleaseSL4|x86 = ReleaseSL4|x86
- ReleaseSL5|Any CPU = ReleaseSL5|Any CPU
- ReleaseSL5|Mixed Platforms = ReleaseSL5|Mixed Platforms
- ReleaseSL5|x86 = ReleaseSL5|x86
- ReleaseWP7|Any CPU = ReleaseWP7|Any CPU
- ReleaseWP7|Mixed Platforms = ReleaseWP7|Mixed Platforms
- ReleaseWP7|x86 = ReleaseWP7|x86
- ReleaseWP8|Any CPU = ReleaseWP8|Any CPU
- ReleaseWP8|Mixed Platforms = ReleaseWP8|Mixed Platforms
- ReleaseWP8|x86 = ReleaseWP8|x86
- ReleaseXBLV|Any CPU = ReleaseXBLV|Any CPU
- ReleaseXBLV|Mixed Platforms = ReleaseXBLV|Mixed Platforms
- ReleaseXBLV|x86 = ReleaseXBLV|x86
- ReleaseXNA4|Any CPU = ReleaseXNA4|Any CPU
- ReleaseXNA4|Mixed Platforms = ReleaseXNA4|Mixed Platforms
- ReleaseXNA4|x86 = ReleaseXNA4|x86
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.Debug|Any CPU.ActiveCfg = DebugPL|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.Debug|Any CPU.Build.0 = DebugPL|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.Debug|Mixed Platforms.ActiveCfg = DebugPL|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.Debug|Mixed Platforms.Build.0 = DebugPL|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.Debug|x86.ActiveCfg = DebugPL|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.Debug35|Any CPU.ActiveCfg = Debug35|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.Debug35|Any CPU.Build.0 = Debug35|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.Debug35|Mixed Platforms.ActiveCfg = Debug35|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.Debug35|Mixed Platforms.Build.0 = Debug35|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.Debug35|x86.ActiveCfg = Debug35|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.Debug40|Any CPU.ActiveCfg = Debug40|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.Debug40|Any CPU.Build.0 = Debug40|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.Debug40|Mixed Platforms.ActiveCfg = Debug40|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.Debug40|Mixed Platforms.Build.0 = Debug40|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.Debug40|x86.ActiveCfg = Debug40|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.Debug45|Any CPU.ActiveCfg = DebugPL|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.Debug45|Any CPU.Build.0 = DebugPL|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.Debug45|Mixed Platforms.ActiveCfg = Debug45|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.Debug45|Mixed Platforms.Build.0 = Debug45|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.Debug45|x86.ActiveCfg = Debug45|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.Debug8|Any CPU.ActiveCfg = DebugPL|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.Debug8|Any CPU.Build.0 = DebugPL|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.Debug8|Mixed Platforms.ActiveCfg = Debug8|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.Debug8|Mixed Platforms.Build.0 = Debug8|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.Debug8|x86.ActiveCfg = Debug45|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.DebugCF35|Any CPU.ActiveCfg = DebugCF35|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.DebugCF35|Any CPU.Build.0 = DebugCF35|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.DebugCF35|Mixed Platforms.ActiveCfg = DebugCF35|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.DebugCF35|Mixed Platforms.Build.0 = DebugCF35|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.DebugCF35|x86.ActiveCfg = DebugSL3|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.DebugPL|Any CPU.ActiveCfg = DebugPL|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.DebugPL|Any CPU.Build.0 = DebugPL|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.DebugPL|Mixed Platforms.ActiveCfg = DebugPL|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.DebugPL|Mixed Platforms.Build.0 = DebugPL|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.DebugPL|x86.ActiveCfg = DebugPL|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.DebugSL3|Any CPU.ActiveCfg = DebugSL3|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.DebugSL3|Any CPU.Build.0 = DebugSL3|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.DebugSL3|Mixed Platforms.ActiveCfg = DebugSL3|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.DebugSL3|Mixed Platforms.Build.0 = DebugSL3|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.DebugSL3|x86.ActiveCfg = DebugSL3|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.DebugSL4|Any CPU.ActiveCfg = DebugSL4|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.DebugSL4|Any CPU.Build.0 = DebugSL4|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.DebugSL4|Mixed Platforms.ActiveCfg = DebugSL4|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.DebugSL4|Mixed Platforms.Build.0 = DebugSL4|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.DebugSL4|x86.ActiveCfg = DebugSL4|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.DebugSL5|Any CPU.ActiveCfg = DebugSL5|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.DebugSL5|Any CPU.Build.0 = DebugSL5|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.DebugSL5|Mixed Platforms.ActiveCfg = DebugSL5|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.DebugSL5|Mixed Platforms.Build.0 = DebugSL5|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.DebugSL5|x86.ActiveCfg = DebugSL5|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.DebugWP7|Any CPU.ActiveCfg = DebugWP7|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.DebugWP7|Any CPU.Build.0 = DebugWP7|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.DebugWP7|Mixed Platforms.ActiveCfg = DebugWP7|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.DebugWP7|Mixed Platforms.Build.0 = DebugWP7|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.DebugWP7|x86.ActiveCfg = DebugWP7|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.DebugWP8|Any CPU.ActiveCfg = DebugPL|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.DebugWP8|Any CPU.Build.0 = DebugPL|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.DebugWP8|Mixed Platforms.ActiveCfg = DebugWP8|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.DebugWP8|Mixed Platforms.Build.0 = DebugWP8|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.DebugWP8|x86.ActiveCfg = DebugWP8|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.DebugXBLV|Any CPU.ActiveCfg = DebugXBLV|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.DebugXBLV|Any CPU.Build.0 = DebugXBLV|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.DebugXBLV|Mixed Platforms.ActiveCfg = DebugXBLV|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.DebugXBLV|Mixed Platforms.Build.0 = DebugXBLV|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.DebugXBLV|x86.ActiveCfg = DebugXBLV|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.DebugXNA4|Any CPU.ActiveCfg = DebugXNA4|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.DebugXNA4|Any CPU.Build.0 = DebugXNA4|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.DebugXNA4|Mixed Platforms.ActiveCfg = DebugXNA4|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.DebugXNA4|Mixed Platforms.Build.0 = DebugXNA4|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.DebugXNA4|x86.ActiveCfg = DebugXNA4|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.Release|Any CPU.ActiveCfg = ReleasePL|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.Release|Any CPU.Build.0 = ReleasePL|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.Release|Mixed Platforms.ActiveCfg = ReleasePL|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.Release|Mixed Platforms.Build.0 = ReleasePL|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.Release|x86.ActiveCfg = ReleasePL|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.Release35|Any CPU.ActiveCfg = Release35|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.Release35|Any CPU.Build.0 = Release35|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.Release35|Mixed Platforms.ActiveCfg = Release35|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.Release35|Mixed Platforms.Build.0 = Release35|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.Release35|x86.ActiveCfg = Release35|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.Release40|Any CPU.ActiveCfg = Release40|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.Release40|Any CPU.Build.0 = Release40|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.Release40|Mixed Platforms.ActiveCfg = Release40|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.Release40|Mixed Platforms.Build.0 = Release40|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.Release40|x86.ActiveCfg = Release40|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.Release45|Any CPU.ActiveCfg = ReleasePL|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.Release45|Any CPU.Build.0 = ReleasePL|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.Release45|Mixed Platforms.ActiveCfg = Release45|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.Release45|Mixed Platforms.Build.0 = Release45|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.Release45|x86.ActiveCfg = Release45|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.Release8|Any CPU.ActiveCfg = ReleasePL|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.Release8|Any CPU.Build.0 = ReleasePL|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.Release8|Mixed Platforms.ActiveCfg = Release8|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.Release8|Mixed Platforms.Build.0 = Release8|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.Release8|x86.ActiveCfg = Release45|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.ReleaseCF35|Any CPU.ActiveCfg = ReleaseCF35|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.ReleaseCF35|Any CPU.Build.0 = ReleaseCF35|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.ReleaseCF35|Mixed Platforms.ActiveCfg = ReleaseCF35|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.ReleaseCF35|Mixed Platforms.Build.0 = ReleaseCF35|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.ReleaseCF35|x86.ActiveCfg = ReleaseSL3|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.ReleasePL|Any CPU.ActiveCfg = ReleasePL|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.ReleasePL|Any CPU.Build.0 = ReleasePL|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.ReleasePL|Mixed Platforms.ActiveCfg = ReleasePL|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.ReleasePL|Mixed Platforms.Build.0 = ReleasePL|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.ReleasePL|x86.ActiveCfg = ReleasePL|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.ReleaseSL3|Any CPU.ActiveCfg = ReleaseSL3|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.ReleaseSL3|Any CPU.Build.0 = ReleaseSL3|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.ReleaseSL3|Mixed Platforms.ActiveCfg = ReleaseSL3|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.ReleaseSL3|Mixed Platforms.Build.0 = ReleaseSL3|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.ReleaseSL3|x86.ActiveCfg = ReleaseSL3|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.ReleaseSL4|Any CPU.ActiveCfg = ReleaseSL4|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.ReleaseSL4|Any CPU.Build.0 = ReleaseSL4|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.ReleaseSL4|Mixed Platforms.ActiveCfg = ReleaseSL4|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.ReleaseSL4|Mixed Platforms.Build.0 = ReleaseSL4|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.ReleaseSL4|x86.ActiveCfg = ReleaseSL4|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.ReleaseSL5|Any CPU.ActiveCfg = ReleaseSL5|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.ReleaseSL5|Any CPU.Build.0 = ReleaseSL5|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.ReleaseSL5|Mixed Platforms.ActiveCfg = ReleaseSL5|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.ReleaseSL5|Mixed Platforms.Build.0 = ReleaseSL5|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.ReleaseSL5|x86.ActiveCfg = ReleaseSL5|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.ReleaseWP7|Any CPU.ActiveCfg = ReleaseWP7|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.ReleaseWP7|Any CPU.Build.0 = ReleaseWP7|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.ReleaseWP7|Mixed Platforms.ActiveCfg = ReleaseWP7|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.ReleaseWP7|Mixed Platforms.Build.0 = ReleaseWP7|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.ReleaseWP7|x86.ActiveCfg = ReleaseWP7|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.ReleaseWP8|Any CPU.ActiveCfg = ReleasePL|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.ReleaseWP8|Any CPU.Build.0 = ReleasePL|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.ReleaseWP8|Mixed Platforms.ActiveCfg = ReleaseWP8|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.ReleaseWP8|Mixed Platforms.Build.0 = ReleaseWP8|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.ReleaseWP8|x86.ActiveCfg = ReleaseWP8|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.ReleaseXBLV|Any CPU.ActiveCfg = ReleaseXBLV|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.ReleaseXBLV|Any CPU.Build.0 = ReleaseXBLV|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.ReleaseXBLV|Mixed Platforms.ActiveCfg = ReleaseXBLV|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.ReleaseXBLV|Mixed Platforms.Build.0 = ReleaseXBLV|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.ReleaseXBLV|x86.ActiveCfg = ReleaseXBLV|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.ReleaseXNA4|Any CPU.ActiveCfg = ReleaseXNA4|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.ReleaseXNA4|Any CPU.Build.0 = ReleaseXNA4|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.ReleaseXNA4|Mixed Platforms.ActiveCfg = ReleaseXNA4|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.ReleaseXNA4|Mixed Platforms.Build.0 = ReleaseXNA4|Any CPU
- {63252AE9-5186-45CA-BFCD-FA51C6B66A43}.ReleaseXNA4|x86.ActiveCfg = ReleaseXNA4|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.Debug|Any CPU.ActiveCfg = DebugPL|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.Debug|Any CPU.Build.0 = DebugPL|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.Debug|Mixed Platforms.ActiveCfg = DebugPL|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.Debug|Mixed Platforms.Build.0 = DebugPL|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.Debug|x86.ActiveCfg = DebugPL|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.Debug35|Any CPU.ActiveCfg = Debug35|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.Debug35|Any CPU.Build.0 = Debug35|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.Debug35|Mixed Platforms.ActiveCfg = Debug35|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.Debug35|Mixed Platforms.Build.0 = Debug35|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.Debug35|x86.ActiveCfg = Debug35|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.Debug40|Any CPU.ActiveCfg = Debug40|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.Debug40|Any CPU.Build.0 = Debug40|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.Debug40|Mixed Platforms.ActiveCfg = Debug40|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.Debug40|Mixed Platforms.Build.0 = Debug40|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.Debug40|x86.ActiveCfg = Debug40|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.Debug45|Any CPU.ActiveCfg = Debug45|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.Debug45|Any CPU.Build.0 = Debug45|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.Debug45|Mixed Platforms.ActiveCfg = Debug45|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.Debug45|Mixed Platforms.Build.0 = Debug45|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.Debug45|x86.ActiveCfg = Debug45|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.Debug8|Any CPU.ActiveCfg = Debug8|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.Debug8|Any CPU.Build.0 = Debug8|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.Debug8|Mixed Platforms.ActiveCfg = Debug8|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.Debug8|Mixed Platforms.Build.0 = Debug8|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.Debug8|x86.ActiveCfg = Debug45|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.DebugCF35|Any CPU.ActiveCfg = DebugCF35|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.DebugCF35|Mixed Platforms.ActiveCfg = DebugCF35|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.DebugCF35|x86.ActiveCfg = DebugSL3|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.DebugPL|Any CPU.ActiveCfg = DebugPL|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.DebugPL|Mixed Platforms.ActiveCfg = DebugPL|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.DebugPL|x86.ActiveCfg = DebugPL|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.DebugSL3|Any CPU.ActiveCfg = DebugSL3|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.DebugSL3|Any CPU.Build.0 = DebugSL3|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.DebugSL3|Mixed Platforms.ActiveCfg = DebugSL3|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.DebugSL3|Mixed Platforms.Build.0 = DebugSL3|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.DebugSL3|x86.ActiveCfg = DebugSL3|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.DebugSL4|Any CPU.ActiveCfg = DebugSL4|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.DebugSL4|Any CPU.Build.0 = DebugSL4|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.DebugSL4|Mixed Platforms.ActiveCfg = DebugSL4|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.DebugSL4|Mixed Platforms.Build.0 = DebugSL4|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.DebugSL4|x86.ActiveCfg = DebugSL4|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.DebugSL5|Any CPU.ActiveCfg = DebugSL5|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.DebugSL5|Any CPU.Build.0 = DebugSL5|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.DebugSL5|Mixed Platforms.ActiveCfg = DebugSL5|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.DebugSL5|Mixed Platforms.Build.0 = DebugSL5|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.DebugSL5|x86.ActiveCfg = DebugSL5|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.DebugWP7|Any CPU.ActiveCfg = DebugWP7|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.DebugWP7|Any CPU.Build.0 = DebugWP7|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.DebugWP7|Mixed Platforms.ActiveCfg = DebugWP7|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.DebugWP7|Mixed Platforms.Build.0 = DebugWP7|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.DebugWP7|x86.ActiveCfg = DebugWP7|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.DebugWP8|Any CPU.ActiveCfg = DebugWP8|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.DebugWP8|Any CPU.Build.0 = DebugWP8|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.DebugWP8|Mixed Platforms.ActiveCfg = DebugWP8|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.DebugWP8|Mixed Platforms.Build.0 = DebugWP8|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.DebugWP8|x86.ActiveCfg = DebugWP8|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.DebugXBLV|Any CPU.ActiveCfg = DebugXBLV|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.DebugXBLV|Mixed Platforms.ActiveCfg = DebugXBLV|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.DebugXBLV|Mixed Platforms.Build.0 = DebugXBLV|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.DebugXBLV|x86.ActiveCfg = DebugXBLV|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.DebugXNA4|Any CPU.ActiveCfg = DebugXNA4|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.DebugXNA4|Mixed Platforms.ActiveCfg = DebugXNA4|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.DebugXNA4|Mixed Platforms.Build.0 = DebugXNA4|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.DebugXNA4|x86.ActiveCfg = DebugXNA4|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.Release|Any CPU.ActiveCfg = ReleasePL|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.Release|Any CPU.Build.0 = ReleasePL|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.Release|Mixed Platforms.ActiveCfg = ReleasePL|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.Release|Mixed Platforms.Build.0 = ReleasePL|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.Release|x86.ActiveCfg = ReleasePL|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.Release35|Any CPU.ActiveCfg = Release35|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.Release35|Any CPU.Build.0 = Release35|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.Release35|Mixed Platforms.ActiveCfg = Release35|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.Release35|Mixed Platforms.Build.0 = Release35|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.Release35|x86.ActiveCfg = Release35|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.Release40|Any CPU.ActiveCfg = Release40|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.Release40|Any CPU.Build.0 = Release40|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.Release40|Mixed Platforms.ActiveCfg = Release40|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.Release40|Mixed Platforms.Build.0 = Release40|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.Release40|x86.ActiveCfg = Release40|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.Release45|Any CPU.ActiveCfg = Release45|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.Release45|Any CPU.Build.0 = Release45|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.Release45|Mixed Platforms.ActiveCfg = Release45|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.Release45|Mixed Platforms.Build.0 = Release45|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.Release45|x86.ActiveCfg = Release45|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.Release8|Any CPU.ActiveCfg = Release8|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.Release8|Any CPU.Build.0 = Release8|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.Release8|Mixed Platforms.ActiveCfg = Release8|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.Release8|Mixed Platforms.Build.0 = Release8|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.Release8|x86.ActiveCfg = Release45|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.ReleaseCF35|Any CPU.ActiveCfg = ReleaseCF35|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.ReleaseCF35|Mixed Platforms.ActiveCfg = ReleaseCF35|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.ReleaseCF35|x86.ActiveCfg = ReleaseSL3|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.ReleasePL|Any CPU.ActiveCfg = ReleasePL|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.ReleasePL|Mixed Platforms.ActiveCfg = ReleasePL|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.ReleasePL|x86.ActiveCfg = ReleasePL|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.ReleaseSL3|Any CPU.ActiveCfg = ReleaseSL3|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.ReleaseSL3|Any CPU.Build.0 = ReleaseSL3|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.ReleaseSL3|Mixed Platforms.ActiveCfg = ReleaseSL3|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.ReleaseSL3|Mixed Platforms.Build.0 = ReleaseSL3|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.ReleaseSL3|x86.ActiveCfg = ReleaseSL3|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.ReleaseSL4|Any CPU.ActiveCfg = ReleaseSL4|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.ReleaseSL4|Any CPU.Build.0 = ReleaseSL4|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.ReleaseSL4|Mixed Platforms.ActiveCfg = ReleaseSL4|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.ReleaseSL4|Mixed Platforms.Build.0 = ReleaseSL4|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.ReleaseSL4|x86.ActiveCfg = ReleaseSL4|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.ReleaseSL5|Any CPU.ActiveCfg = ReleaseSL5|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.ReleaseSL5|Any CPU.Build.0 = ReleaseSL5|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.ReleaseSL5|Mixed Platforms.ActiveCfg = ReleaseSL5|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.ReleaseSL5|Mixed Platforms.Build.0 = ReleaseSL5|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.ReleaseSL5|x86.ActiveCfg = ReleaseSL5|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.ReleaseWP7|Any CPU.ActiveCfg = ReleaseWP7|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.ReleaseWP7|Any CPU.Build.0 = ReleaseWP7|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.ReleaseWP7|Mixed Platforms.ActiveCfg = ReleaseWP7|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.ReleaseWP7|Mixed Platforms.Build.0 = ReleaseWP7|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.ReleaseWP7|x86.ActiveCfg = ReleaseWP7|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.ReleaseWP8|Any CPU.ActiveCfg = ReleaseWP8|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.ReleaseWP8|Any CPU.Build.0 = ReleaseWP8|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.ReleaseWP8|Mixed Platforms.ActiveCfg = ReleaseWP8|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.ReleaseWP8|Mixed Platforms.Build.0 = ReleaseWP8|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.ReleaseWP8|x86.ActiveCfg = ReleaseWP8|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.ReleaseXBLV|Any CPU.ActiveCfg = ReleaseXBLV|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.ReleaseXBLV|Mixed Platforms.ActiveCfg = ReleaseXBLV|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.ReleaseXBLV|Mixed Platforms.Build.0 = ReleaseXBLV|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.ReleaseXBLV|x86.ActiveCfg = ReleaseXBLV|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.ReleaseXNA4|Any CPU.ActiveCfg = ReleaseXNA4|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.ReleaseXNA4|Mixed Platforms.ActiveCfg = ReleaseXNA4|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.ReleaseXNA4|Mixed Platforms.Build.0 = ReleaseXNA4|Any CPU
- {E7B7408B-B039-4F30-B6CF-CC06218CE4CA}.ReleaseXNA4|x86.ActiveCfg = ReleaseXNA4|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.Debug|Any CPU.ActiveCfg = DebugPL|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.Debug|Any CPU.Build.0 = DebugPL|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.Debug|Mixed Platforms.ActiveCfg = DebugPL|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.Debug|Mixed Platforms.Build.0 = DebugPL|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.Debug|x86.ActiveCfg = DebugPL|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.Debug35|Any CPU.ActiveCfg = Debug35|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.Debug35|Any CPU.Build.0 = Debug35|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.Debug35|Mixed Platforms.ActiveCfg = Debug35|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.Debug35|Mixed Platforms.Build.0 = Debug35|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.Debug35|x86.ActiveCfg = Debug35|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.Debug40|Any CPU.ActiveCfg = Debug40|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.Debug40|Any CPU.Build.0 = Debug40|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.Debug40|Mixed Platforms.ActiveCfg = Debug40|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.Debug40|Mixed Platforms.Build.0 = Debug40|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.Debug40|x86.ActiveCfg = Debug40|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.Debug45|Any CPU.ActiveCfg = Debug45|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.Debug45|Any CPU.Build.0 = Debug45|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.Debug45|Mixed Platforms.ActiveCfg = Debug45|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.Debug45|Mixed Platforms.Build.0 = Debug45|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.Debug45|x86.ActiveCfg = Debug45|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.Debug8|Any CPU.ActiveCfg = Debug8|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.Debug8|Mixed Platforms.ActiveCfg = Debug8|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.Debug8|x86.ActiveCfg = Debug45|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.DebugCF35|Any CPU.ActiveCfg = DebugCF35|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.DebugCF35|Mixed Platforms.ActiveCfg = DebugCF35|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.DebugCF35|x86.ActiveCfg = DebugSL3|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.DebugPL|Any CPU.ActiveCfg = DebugPL|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.DebugPL|Mixed Platforms.ActiveCfg = DebugPL|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.DebugPL|x86.ActiveCfg = DebugPL|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.DebugSL3|Any CPU.ActiveCfg = DebugSL3|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.DebugSL3|Mixed Platforms.ActiveCfg = DebugSL3|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.DebugSL3|Mixed Platforms.Build.0 = DebugSL3|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.DebugSL3|x86.ActiveCfg = DebugSL3|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.DebugSL4|Any CPU.ActiveCfg = DebugSL4|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.DebugSL4|Any CPU.Build.0 = DebugSL4|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.DebugSL4|Mixed Platforms.ActiveCfg = DebugSL4|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.DebugSL4|Mixed Platforms.Build.0 = DebugSL4|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.DebugSL4|x86.ActiveCfg = DebugSL4|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.DebugSL5|Any CPU.ActiveCfg = DebugSL5|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.DebugSL5|Any CPU.Build.0 = DebugSL5|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.DebugSL5|Mixed Platforms.ActiveCfg = DebugSL5|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.DebugSL5|Mixed Platforms.Build.0 = DebugSL5|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.DebugSL5|x86.ActiveCfg = DebugSL5|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.DebugWP7|Any CPU.ActiveCfg = DebugWP7|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.DebugWP7|Any CPU.Build.0 = DebugWP7|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.DebugWP7|Mixed Platforms.ActiveCfg = DebugWP7|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.DebugWP7|Mixed Platforms.Build.0 = DebugWP7|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.DebugWP7|x86.ActiveCfg = DebugWP7|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.DebugWP8|Any CPU.ActiveCfg = DebugWP8|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.DebugWP8|Any CPU.Build.0 = DebugWP8|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.DebugWP8|Mixed Platforms.ActiveCfg = DebugWP8|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.DebugWP8|Mixed Platforms.Build.0 = DebugWP8|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.DebugWP8|x86.ActiveCfg = DebugWP8|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.DebugXBLV|Any CPU.ActiveCfg = DebugXBLV|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.DebugXBLV|Mixed Platforms.ActiveCfg = DebugXBLV|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.DebugXBLV|Mixed Platforms.Build.0 = DebugXBLV|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.DebugXBLV|x86.ActiveCfg = DebugXBLV|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.DebugXNA4|Any CPU.ActiveCfg = DebugXNA4|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.DebugXNA4|Mixed Platforms.ActiveCfg = DebugXNA4|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.DebugXNA4|Mixed Platforms.Build.0 = DebugXNA4|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.DebugXNA4|x86.ActiveCfg = DebugXNA4|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.Release|Any CPU.ActiveCfg = ReleasePL|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.Release|Any CPU.Build.0 = ReleasePL|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.Release|Mixed Platforms.ActiveCfg = ReleasePL|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.Release|Mixed Platforms.Build.0 = ReleasePL|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.Release|x86.ActiveCfg = ReleasePL|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.Release35|Any CPU.ActiveCfg = Release35|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.Release35|Any CPU.Build.0 = Release35|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.Release35|Mixed Platforms.ActiveCfg = Release35|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.Release35|Mixed Platforms.Build.0 = Release35|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.Release35|x86.ActiveCfg = Release35|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.Release40|Any CPU.ActiveCfg = Release40|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.Release40|Any CPU.Build.0 = Release40|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.Release40|Mixed Platforms.ActiveCfg = Release40|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.Release40|Mixed Platforms.Build.0 = Release40|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.Release40|x86.ActiveCfg = Release40|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.Release45|Any CPU.ActiveCfg = Release45|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.Release45|Any CPU.Build.0 = Release45|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.Release45|Mixed Platforms.ActiveCfg = Release45|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.Release45|Mixed Platforms.Build.0 = Release45|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.Release45|x86.ActiveCfg = Release45|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.Release8|Any CPU.ActiveCfg = Release8|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.Release8|Mixed Platforms.ActiveCfg = Release8|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.Release8|x86.ActiveCfg = Release45|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.ReleaseCF35|Any CPU.ActiveCfg = ReleaseCF35|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.ReleaseCF35|Mixed Platforms.ActiveCfg = ReleaseCF35|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.ReleaseCF35|x86.ActiveCfg = ReleaseSL3|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.ReleasePL|Any CPU.ActiveCfg = ReleasePL|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.ReleasePL|Mixed Platforms.ActiveCfg = ReleasePL|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.ReleasePL|x86.ActiveCfg = ReleasePL|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.ReleaseSL3|Any CPU.ActiveCfg = ReleaseSL3|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.ReleaseSL3|Mixed Platforms.ActiveCfg = ReleaseSL3|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.ReleaseSL3|Mixed Platforms.Build.0 = ReleaseSL3|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.ReleaseSL3|x86.ActiveCfg = ReleaseSL3|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.ReleaseSL4|Any CPU.ActiveCfg = ReleaseSL4|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.ReleaseSL4|Any CPU.Build.0 = ReleaseSL4|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.ReleaseSL4|Mixed Platforms.ActiveCfg = ReleaseSL4|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.ReleaseSL4|Mixed Platforms.Build.0 = ReleaseSL4|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.ReleaseSL4|x86.ActiveCfg = ReleaseSL4|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.ReleaseSL5|Any CPU.ActiveCfg = ReleaseSL5|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.ReleaseSL5|Any CPU.Build.0 = ReleaseSL5|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.ReleaseSL5|Mixed Platforms.ActiveCfg = ReleaseSL5|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.ReleaseSL5|Mixed Platforms.Build.0 = ReleaseSL5|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.ReleaseSL5|x86.ActiveCfg = ReleaseSL5|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.ReleaseWP7|Any CPU.ActiveCfg = ReleaseWP7|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.ReleaseWP7|Any CPU.Build.0 = ReleaseWP7|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.ReleaseWP7|Mixed Platforms.ActiveCfg = ReleaseWP7|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.ReleaseWP7|Mixed Platforms.Build.0 = ReleaseWP7|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.ReleaseWP7|x86.ActiveCfg = ReleaseWP7|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.ReleaseWP8|Any CPU.ActiveCfg = ReleaseWP8|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.ReleaseWP8|Any CPU.Build.0 = ReleaseWP8|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.ReleaseWP8|Mixed Platforms.ActiveCfg = ReleaseWP8|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.ReleaseWP8|Mixed Platforms.Build.0 = ReleaseWP8|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.ReleaseWP8|x86.ActiveCfg = ReleaseWP8|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.ReleaseXBLV|Any CPU.ActiveCfg = ReleaseXBLV|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.ReleaseXBLV|Mixed Platforms.ActiveCfg = ReleaseXBLV|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.ReleaseXBLV|Mixed Platforms.Build.0 = ReleaseXBLV|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.ReleaseXBLV|x86.ActiveCfg = ReleaseXBLV|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.ReleaseXNA4|Any CPU.ActiveCfg = ReleaseXNA4|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.ReleaseXNA4|Mixed Platforms.ActiveCfg = ReleaseXNA4|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.ReleaseXNA4|Mixed Platforms.Build.0 = ReleaseXNA4|Any CPU
- {2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}.ReleaseXNA4|x86.ActiveCfg = ReleaseXNA4|Any CPU
- {E32328A1-1F5B-45F9-B005-02EF5CC2CF0D}.Debug|Any CPU.ActiveCfg = DebugPL|Any CPU
- {E32328A1-1F5B-45F9-B005-02EF5CC2CF0D}.Debug|Any CPU.Build.0 = DebugPL|Any CPU
- {E32328A1-1F5B-45F9-B005-02EF5CC2CF0D}.Debug|Mixed Platforms.ActiveCfg = DebugPL|Any CPU
- {E32328A1-1F5B-45F9-B005-02EF5CC2CF0D}.Debug|Mixed Platforms.Build.0 = DebugPL|Any CPU
- {E32328A1-1F5B-45F9-B005-02EF5CC2CF0D}.Debug|x86.ActiveCfg = DebugPL|Any CPU
- {E32328A1-1F5B-45F9-B005-02EF5CC2CF0D}.Debug35|Any CPU.ActiveCfg = Debug35|Any CPU
- {E32328A1-1F5B-45F9-B005-02EF5CC2CF0D}.Debug35|Any CPU.Build.0 = Debug35|Any CPU
- {E32328A1-1F5B-45F9-B005-02EF5CC2CF0D}.Debug35|Mixed Platforms.ActiveCfg = Debug35|Any CPU
- {E32328A1-1F5B-45F9-B005-02EF5CC2CF0D}.Debug35|Mixed Platforms.Build.0 = Debug35|Any CPU
- {E32328A1-1F5B-45F9-B005-02EF5CC2CF0D}.Debug35|x86.ActiveCfg = Debug35|Any CPU
- {E32328A1-1F5B-45F9-B005-02EF5CC2CF0D}.Debug40|Any CPU.ActiveCfg = Debug40|Any CPU
- {E32328A1-1F5B-45F9-B005-02EF5CC2CF0D}.Debug40|Any CPU.Build.0 = Debug40|Any CPU
- {E32328A1-1F5B-45F9-B005-02EF5CC2CF0D}.Debug40|Mixed Platforms.ActiveCfg = Debug40|Any CPU
- {E32328A1-1F5B-45F9-B005-02EF5CC2CF0D}.Debug40|Mixed Platforms.Build.0 = Debug40|Any CPU
- {E32328A1-1F5B-45F9-B005-02EF5CC2CF0D}.Debug40|x86.ActiveCfg = Debug40|Any CPU
- {E32328A1-1F5B-45F9-B005-02EF5CC2CF0D}.Debug45|Any CPU.ActiveCfg = Debug45|Any CPU
- {E32328A1-1F5B-45F9-B005-02EF5CC2CF0D}.Debug45|Any CPU.Build.0 = Debug45|Any CPU
- {E32328A1-1F5B-45F9-B005-02EF5CC2CF0D}.Debug45|Mixed Platforms.ActiveCfg = Debug45|Any CPU
- {E32328A1-1F5B-45F9-B005-02EF5CC2CF0D}.Debug45|Mixed Platforms.Build.0 = Debug45|Any CPU
- {E32328A1-1F5B-45F9-B005-02EF5CC2CF0D}.Debug45|x86.ActiveCfg = Debug45|Any CPU
- {E32328A1-1F5B-45F9-B005-02EF5CC2CF0D}.Debug8|Any CPU.ActiveCfg = Debug8|Any CPU
- {E32328A1-1F5B-45F9-B005-02EF5CC2CF0D}.Debug8|Mixed Platforms.ActiveCfg = Debug8|Any CPU
- {E32328A1-1F5B-45F9-B005-02EF5CC2CF0D}.Debug8|x86.ActiveCfg = Debug45|Any CPU
- {E32328A1-1F5B-45F9-B005-02EF5CC2CF0D}.DebugCF35|Any CPU.ActiveCfg = DebugCF35|Any CPU
- {E32328A1-1F5B-45F9-B005-02EF5CC2CF0D}.DebugCF35|Any CPU.Build.0 = DebugCF35|Any CPU
- {E32328A1-1F5B-45F9-B005-02EF5CC2CF0D}.DebugCF35|Mixed Platforms.ActiveCfg = DebugCF35|Any CPU
- {E32328A1-1F5B-45F9-B005-02EF5CC2CF0D}.DebugCF35|Mixed Platforms.Build.0 = DebugCF35|Any CPU
- {E32328A1-1F5B-45F9-B005-02EF5CC2CF0D}.DebugCF35|x86.ActiveCfg = DebugSL3|Any CPU
- {E32328A1-1F5B-45F9-B005-02EF5CC2CF0D}.DebugPL|Any CPU.ActiveCfg = DebugPL|Any CPU
- {E32328A1-1F5B-45F9-B005-02EF5CC2CF0D}.DebugPL|Mixed Platforms.ActiveCfg = DebugPL|Any CPU
- {E32328A1-1F5B-45F9-B005-02EF5CC2CF0D}.DebugPL|x86.ActiveCfg = DebugPL|Any CPU
- {E32328A1-1F5B-45F9-B005-02EF5CC2CF0D}.DebugSL3|Any CPU.ActiveCfg = DebugSL3|Any CPU
- {E32328A1-1F5B-45F9-B005-02EF5CC2CF0D}.DebugSL3|Mixed Platforms.ActiveCfg = DebugSL3|Any CPU
- {E32328A1-1F5B-45F9-B005-02EF5CC2CF0D}.DebugSL3|x86.ActiveCfg = DebugSL3|Any CPU
- {E32328A1-1F5B-45F9-B005-02EF5CC2CF0D}.DebugSL4|Any CPU.ActiveCfg = DebugSL4|Any CPU
- {E32328A1-1F5B-45F9-B005-02EF5CC2CF0D}.DebugSL4|Mixed Platforms.ActiveCfg = DebugSL4|Any CPU
- {E32328A1-1F5B-45F9-B005-02EF5CC2CF0D}.DebugSL4|x86.ActiveCfg = DebugSL4|Any CPU
- {E32328A1-1F5B-45F9-B005-02EF5CC2CF0D}.DebugSL5|Any CPU.ActiveCfg = DebugSL5|Any CPU
- {E32328A1-1F5B-45F9-B005-02EF5CC2CF0D}.DebugSL5|Mixed Platforms.ActiveCfg = DebugSL5|Any CPU
- {E32328A1-1F5B-45F9-B005-02EF5CC2CF0D}.DebugSL5|x86.ActiveCfg = DebugSL5|Any CPU
- {E32328A1-1F5B-45F9-B005-02EF5CC2CF0D}.DebugWP7|Any CPU.ActiveCfg = DebugWP7|Any CPU
- {E32328A1-1F5B-45F9-B005-02EF5CC2CF0D}.DebugWP7|Mixed Platforms.ActiveCfg = DebugWP7|Any CPU
- {E32328A1-1F5B-45F9-B005-02EF5CC2CF0D}.DebugWP7|x86.ActiveCfg = DebugWP7|Any CPU
- {E32328A1-1F5B-45F9-B005-02EF5CC2CF0D}.DebugWP8|Any CPU.ActiveCfg = DebugWP8|Any CPU
- {E32328A1-1F5B-45F9-B005-02EF5CC2CF0D}.DebugWP8|Mixed Platforms.ActiveCfg = DebugWP8|Any CPU
- {E32328A1-1F5B-45F9-B005-02EF5CC2CF0D}.DebugWP8|x86.ActiveCfg = DebugWP8|Any CPU
- {E32328A1-1F5B-45F9-B005-02EF5CC2CF0D}.DebugXBLV|Any CPU.ActiveCfg = DebugXBLV|Any CPU
- {E32328A1-1F5B-45F9-B005-02EF5CC2CF0D}.DebugXBLV|Mixed Platforms.ActiveCfg = DebugXBLV|Any CPU
- {E32328A1-1F5B-45F9-B005-02EF5CC2CF0D}.DebugXBLV|Mixed Platforms.Build.0 = DebugXBLV|Any CPU
- {E32328A1-1F5B-45F9-B005-02EF5CC2CF0D}.DebugXBLV|x86.ActiveCfg = DebugXBLV|Any CPU
- {E32328A1-1F5B-45F9-B005-02EF5CC2CF0D}.DebugXNA4|Any CPU.ActiveCfg = DebugXNA4|Any CPU
- {E32328A1-1F5B-45F9-B005-02EF5CC2CF0D}.DebugXNA4|Mixed Platforms.ActiveCfg = DebugXNA4|Any CPU
- {E32328A1-1F5B-45F9-B005-02EF5CC2CF0D}.DebugXNA4|x86.ActiveCfg = DebugXNA4|Any CPU
- {E32328A1-1F5B-45F9-B005-02EF5CC2CF0D}.Release|Any CPU.ActiveCfg = ReleasePL|Any CPU
- {E32328A1-1F5B-45F9-B005-02EF5CC2CF0D}.Release|Any CPU.Build.0 = ReleasePL|Any CPU
- {E32328A1-1F5B-45F9-B005-02EF5CC2CF0D}.Release|Mixed Platforms.ActiveCfg = ReleasePL|Any CPU
- {E32328A1-1F5B-45F9-B005-02EF5CC2CF0D}.Release|Mixed Platforms.Build.0 = ReleasePL|Any CPU
- {E32328A1-1F5B-45F9-B005-02EF5CC2CF0D}.Release|x86.ActiveCfg = ReleasePL|Any CPU
- {E32328A1-1F5B-45F9-B005-02EF5CC2CF0D}.Release35|Any CPU.ActiveCfg = Release35|Any CPU
- {E32328A1-1F5B-45F9-B005-02EF5CC2CF0D}.Release35|Any CPU.Build.0 = Release35|Any CPU
- {E32328A1-1F5B-45F9-B005-02EF5CC2CF0D}.Release35|Mixed Platforms.ActiveCfg = Release35|Any CPU
- {E32328A1-1F5B-45F9-B005-02EF5CC2CF0D}.Release35|Mixed Platforms.Build.0 = Release35|Any CPU
- {E32328A1-1F5B-45F9-B005-02EF5CC2CF0D}.Release35|x86.ActiveCfg = Release35|Any CPU
- {E32328A1-1F5B-45F9-B005-02EF5CC2CF0D}.Release40|Any CPU.ActiveCfg = Release40|Any CPU
- {E32328A1-1F5B-45F9-B005-02EF5CC2CF0D}.Release40|Any CPU.Build.0 = Release40|Any CPU
- {E32328A1-1F5B-45F9-B005-02EF5CC2CF0D}.Release40|Mixed Platforms.ActiveCfg = Release40|Any CPU
- {E32328A1-1F5B-45F9-B005-02EF5CC2CF0D}.Release40|Mixed Platforms.Build.0 = Release40|Any CPU
- {E32328A1-1F5B-45F9-B005-02EF5CC2CF0D}.Release40|x86.ActiveCfg = Release40|Any CPU
- {E32328A1-1F5B-45F9-B005-02EF5CC2CF0D}.Release45|Any CPU.ActiveCfg = Release45|Any CPU
- {E32328A1-1F5B-45F9-B005-02EF5CC2CF0D}.Release45|Any CPU.Build.0 = Release45|Any CPU
- {E32328A1-1F5B-45F9-B005-02EF5CC2CF0D}.Release45|Mixed Platforms.ActiveCfg = Release45|Any CPU
- {E32328A1-1F5B-45F9-B005-02EF5CC2CF0D}.Release45|Mixed Platforms.Build.0 = Release45|Any CPU
- {E32328A1-1F5B-45F9-B005-02EF5CC2CF0D}.Release45|x86.ActiveCfg = Release45|Any CPU
- {E32328A1-1F5B-45F9-B005-02EF5CC2CF0D}.Release8|Any CPU.ActiveCfg = Release8|Any CPU
- {E32328A1-1F5B-45F9-B005-02EF5CC2CF0D}.Release8|Mixed Platforms.ActiveCfg = Release8|Any CPU
- {E32328A1-1F5B-45F9-B005-02EF5CC2CF0D}.Release8|x86.ActiveCfg = Release45|Any CPU
- {E32328A1-1F5B-45F9-B005-02EF5CC2CF0D}.ReleaseCF35|Any CPU.ActiveCfg = ReleaseCF35|Any CPU
- {E32328A1-1F5B-45F9-B005-02EF5CC2CF0D}.ReleaseCF35|Any CPU.Build.0 = ReleaseCF35|Any CPU
- {E32328A1-1F5B-45F9-B005-02EF5CC2CF0D}.ReleaseCF35|Mixed Platforms.ActiveCfg = ReleaseCF35|Any CPU
- {E32328A1-1F5B-45F9-B005-02EF5CC2CF0D}.ReleaseCF35|Mixed Platforms.Build.0 = ReleaseCF35|Any CPU
- {E32328A1-1F5B-45F9-B005-02EF5CC2CF0D}.ReleaseCF35|x86.ActiveCfg = ReleaseSL3|Any CPU
- {E32328A1-1F5B-45F9-B005-02EF5CC2CF0D}.ReleasePL|Any CPU.ActiveCfg = ReleasePL|Any CPU
- {E32328A1-1F5B-45F9-B005-02EF5CC2CF0D}.ReleasePL|Mixed Platforms.ActiveCfg = ReleasePL|Any CPU
- {E32328A1-1F5B-45F9-B005-02EF5CC2CF0D}.ReleasePL|x86.ActiveCfg = ReleasePL|Any CPU
- {E32328A1-1F5B-45F9-B005-02EF5CC2CF0D}.ReleaseSL3|Any CPU.ActiveCfg = ReleaseSL3|Any CPU
- {E32328A1-1F5B-45F9-B005-02EF5CC2CF0D}.ReleaseSL3|Mixed Platforms.ActiveCfg = ReleaseSL3|Any CPU
- {E32328A1-1F5B-45F9-B005-02EF5CC2CF0D}.ReleaseSL3|x86.ActiveCfg = ReleaseSL3|Any CPU
- {E32328A1-1F5B-45F9-B005-02EF5CC2CF0D}.ReleaseSL4|Any CPU.ActiveCfg = ReleaseSL4|Any CPU
- {E32328A1-1F5B-45F9-B005-02EF5CC2CF0D}.ReleaseSL4|Mixed Platforms.ActiveCfg = ReleaseSL4|Any CPU
- {E32328A1-1F5B-45F9-B005-02EF5CC2CF0D}.ReleaseSL4|x86.ActiveCfg = ReleaseSL4|Any CPU
- {E32328A1-1F5B-45F9-B005-02EF5CC2CF0D}.ReleaseSL5|Any CPU.ActiveCfg = ReleaseSL5|Any CPU
- {E32328A1-1F5B-45F9-B005-02EF5CC2CF0D}.ReleaseSL5|Mixed Platforms.ActiveCfg = ReleaseSL5|Any CPU
- {E32328A1-1F5B-45F9-B005-02EF5CC2CF0D}.ReleaseSL5|x86.ActiveCfg = ReleaseSL5|Any CPU
- {E32328A1-1F5B-45F9-B005-02EF5CC2CF0D}.ReleaseWP7|Any CPU.ActiveCfg = ReleaseWP7|Any CPU
- {E32328A1-1F5B-45F9-B005-02EF5CC2CF0D}.ReleaseWP7|Mixed Platforms.ActiveCfg = ReleaseWP7|Any CPU
- {E32328A1-1F5B-45F9-B005-02EF5CC2CF0D}.ReleaseWP7|x86.ActiveCfg = ReleaseWP7|Any CPU
- {E32328A1-1F5B-45F9-B005-02EF5CC2CF0D}.ReleaseWP8|Any CPU.ActiveCfg = ReleaseWP8|Any CPU
- {E32328A1-1F5B-45F9-B005-02EF5CC2CF0D}.ReleaseWP8|Mixed Platforms.ActiveCfg = ReleaseWP8|Any CPU
- {E32328A1-1F5B-45F9-B005-02EF5CC2CF0D}.ReleaseWP8|x86.ActiveCfg = ReleaseWP8|Any CPU
- {E32328A1-1F5B-45F9-B005-02EF5CC2CF0D}.ReleaseXBLV|Any CPU.ActiveCfg = ReleaseXBLV|Any CPU
- {E32328A1-1F5B-45F9-B005-02EF5CC2CF0D}.ReleaseXBLV|Mixed Platforms.ActiveCfg = ReleaseXBLV|Any CPU
- {E32328A1-1F5B-45F9-B005-02EF5CC2CF0D}.ReleaseXBLV|Mixed Platforms.Build.0 = ReleaseXBLV|Any CPU
- {E32328A1-1F5B-45F9-B005-02EF5CC2CF0D}.ReleaseXBLV|x86.ActiveCfg = ReleaseXBLV|Any CPU
- {E32328A1-1F5B-45F9-B005-02EF5CC2CF0D}.ReleaseXNA4|Any CPU.ActiveCfg = ReleaseXNA4|Any CPU
- {E32328A1-1F5B-45F9-B005-02EF5CC2CF0D}.ReleaseXNA4|Mixed Platforms.ActiveCfg = ReleaseXNA4|Any CPU
- {E32328A1-1F5B-45F9-B005-02EF5CC2CF0D}.ReleaseXNA4|x86.ActiveCfg = ReleaseXNA4|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.Debug|Any CPU.ActiveCfg = DebugPL|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.Debug|Any CPU.Build.0 = DebugPL|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.Debug|Mixed Platforms.ActiveCfg = DebugPL|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.Debug|Mixed Platforms.Build.0 = DebugPL|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.Debug|x86.ActiveCfg = DebugPL|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.Debug35|Any CPU.ActiveCfg = Debug35|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.Debug35|Any CPU.Build.0 = Debug35|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.Debug35|Mixed Platforms.ActiveCfg = Debug35|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.Debug35|Mixed Platforms.Build.0 = Debug35|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.Debug35|x86.ActiveCfg = Debug35|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.Debug40|Any CPU.ActiveCfg = Debug40|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.Debug40|Any CPU.Build.0 = Debug40|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.Debug40|Mixed Platforms.ActiveCfg = Debug40|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.Debug40|Mixed Platforms.Build.0 = Debug40|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.Debug40|x86.ActiveCfg = Debug40|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.Debug45|Any CPU.ActiveCfg = Debug45|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.Debug45|Any CPU.Build.0 = Debug45|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.Debug45|Mixed Platforms.ActiveCfg = Debug45|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.Debug45|Mixed Platforms.Build.0 = Debug45|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.Debug45|x86.ActiveCfg = Debug45|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.Debug8|Any CPU.ActiveCfg = Debug8|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.Debug8|Any CPU.Build.0 = Debug8|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.Debug8|Mixed Platforms.ActiveCfg = Debug8|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.Debug8|Mixed Platforms.Build.0 = Debug8|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.Debug8|x86.ActiveCfg = Debug45|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.DebugCF35|Any CPU.ActiveCfg = DebugCF35|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.DebugCF35|Mixed Platforms.ActiveCfg = DebugCF35|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.DebugCF35|x86.ActiveCfg = DebugSL3|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.DebugPL|Any CPU.ActiveCfg = DebugPL|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.DebugPL|Mixed Platforms.ActiveCfg = DebugPL|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.DebugPL|x86.ActiveCfg = DebugPL|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.DebugSL3|Any CPU.ActiveCfg = DebugSL3|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.DebugSL3|Any CPU.Build.0 = DebugSL3|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.DebugSL3|Mixed Platforms.ActiveCfg = DebugSL3|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.DebugSL3|Mixed Platforms.Build.0 = DebugSL3|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.DebugSL3|x86.ActiveCfg = DebugSL3|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.DebugSL4|Any CPU.ActiveCfg = DebugSL4|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.DebugSL4|Any CPU.Build.0 = DebugSL4|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.DebugSL4|Mixed Platforms.ActiveCfg = DebugSL4|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.DebugSL4|Mixed Platforms.Build.0 = DebugSL4|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.DebugSL4|x86.ActiveCfg = DebugSL4|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.DebugSL5|Any CPU.ActiveCfg = DebugSL5|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.DebugSL5|Any CPU.Build.0 = DebugSL5|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.DebugSL5|Mixed Platforms.ActiveCfg = DebugSL5|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.DebugSL5|Mixed Platforms.Build.0 = DebugSL5|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.DebugSL5|x86.ActiveCfg = DebugSL5|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.DebugWP7|Any CPU.ActiveCfg = DebugWP7|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.DebugWP7|Any CPU.Build.0 = DebugWP7|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.DebugWP7|Mixed Platforms.ActiveCfg = DebugWP7|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.DebugWP7|Mixed Platforms.Build.0 = DebugWP7|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.DebugWP7|x86.ActiveCfg = DebugWP7|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.DebugWP8|Any CPU.ActiveCfg = DebugWP8|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.DebugWP8|Any CPU.Build.0 = DebugWP8|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.DebugWP8|Mixed Platforms.ActiveCfg = DebugWP8|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.DebugWP8|Mixed Platforms.Build.0 = DebugWP8|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.DebugWP8|x86.ActiveCfg = DebugWP8|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.DebugXBLV|Any CPU.ActiveCfg = DebugXBLV|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.DebugXBLV|Any CPU.Build.0 = DebugXBLV|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.DebugXBLV|Mixed Platforms.ActiveCfg = DebugXBLV|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.DebugXBLV|Mixed Platforms.Build.0 = DebugXBLV|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.DebugXBLV|x86.ActiveCfg = DebugXBLV|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.DebugXNA4|Any CPU.ActiveCfg = DebugXNA4|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.DebugXNA4|Mixed Platforms.ActiveCfg = DebugXNA4|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.DebugXNA4|Mixed Platforms.Build.0 = DebugXNA4|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.DebugXNA4|x86.ActiveCfg = DebugXNA4|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.Release|Any CPU.ActiveCfg = ReleasePL|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.Release|Any CPU.Build.0 = ReleasePL|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.Release|Mixed Platforms.ActiveCfg = ReleasePL|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.Release|Mixed Platforms.Build.0 = ReleasePL|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.Release|x86.ActiveCfg = ReleasePL|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.Release35|Any CPU.ActiveCfg = Release35|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.Release35|Any CPU.Build.0 = Release35|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.Release35|Mixed Platforms.ActiveCfg = Release35|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.Release35|Mixed Platforms.Build.0 = Release35|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.Release35|x86.ActiveCfg = Release35|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.Release40|Any CPU.ActiveCfg = Release40|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.Release40|Any CPU.Build.0 = Release40|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.Release40|Mixed Platforms.ActiveCfg = Release40|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.Release40|Mixed Platforms.Build.0 = Release40|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.Release40|x86.ActiveCfg = Release40|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.Release45|Any CPU.ActiveCfg = Release45|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.Release45|Any CPU.Build.0 = Release45|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.Release45|Mixed Platforms.ActiveCfg = Release45|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.Release45|Mixed Platforms.Build.0 = Release45|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.Release45|x86.ActiveCfg = Release45|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.Release8|Any CPU.ActiveCfg = Release8|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.Release8|Any CPU.Build.0 = Release8|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.Release8|Mixed Platforms.ActiveCfg = Release8|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.Release8|Mixed Platforms.Build.0 = Release8|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.Release8|x86.ActiveCfg = Release45|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.ReleaseCF35|Any CPU.ActiveCfg = ReleaseCF35|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.ReleaseCF35|Mixed Platforms.ActiveCfg = ReleaseCF35|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.ReleaseCF35|x86.ActiveCfg = ReleaseSL3|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.ReleasePL|Any CPU.ActiveCfg = ReleasePL|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.ReleasePL|Mixed Platforms.ActiveCfg = ReleasePL|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.ReleasePL|x86.ActiveCfg = ReleasePL|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.ReleaseSL3|Any CPU.ActiveCfg = ReleaseSL3|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.ReleaseSL3|Any CPU.Build.0 = ReleaseSL3|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.ReleaseSL3|Mixed Platforms.ActiveCfg = ReleaseSL3|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.ReleaseSL3|Mixed Platforms.Build.0 = ReleaseSL3|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.ReleaseSL3|x86.ActiveCfg = ReleaseSL3|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.ReleaseSL4|Any CPU.ActiveCfg = ReleaseSL4|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.ReleaseSL4|Any CPU.Build.0 = ReleaseSL4|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.ReleaseSL4|Mixed Platforms.ActiveCfg = ReleaseSL4|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.ReleaseSL4|Mixed Platforms.Build.0 = ReleaseSL4|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.ReleaseSL4|x86.ActiveCfg = ReleaseSL4|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.ReleaseSL5|Any CPU.ActiveCfg = ReleaseSL5|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.ReleaseSL5|Any CPU.Build.0 = ReleaseSL5|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.ReleaseSL5|Mixed Platforms.ActiveCfg = ReleaseSL5|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.ReleaseSL5|Mixed Platforms.Build.0 = ReleaseSL5|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.ReleaseSL5|x86.ActiveCfg = ReleaseSL5|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.ReleaseWP7|Any CPU.ActiveCfg = ReleaseWP7|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.ReleaseWP7|Any CPU.Build.0 = ReleaseWP7|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.ReleaseWP7|Mixed Platforms.ActiveCfg = ReleaseWP7|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.ReleaseWP7|Mixed Platforms.Build.0 = ReleaseWP7|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.ReleaseWP7|x86.ActiveCfg = ReleaseWP7|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.ReleaseWP8|Any CPU.ActiveCfg = ReleaseWP8|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.ReleaseWP8|Any CPU.Build.0 = ReleaseWP8|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.ReleaseWP8|Mixed Platforms.ActiveCfg = ReleaseWP8|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.ReleaseWP8|Mixed Platforms.Build.0 = ReleaseWP8|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.ReleaseWP8|x86.ActiveCfg = ReleaseWP8|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.ReleaseXBLV|Any CPU.ActiveCfg = ReleaseXBLV|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.ReleaseXBLV|Any CPU.Build.0 = ReleaseXBLV|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.ReleaseXBLV|Mixed Platforms.ActiveCfg = ReleaseXBLV|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.ReleaseXBLV|Mixed Platforms.Build.0 = ReleaseXBLV|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.ReleaseXBLV|x86.ActiveCfg = ReleaseXBLV|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.ReleaseXNA4|Any CPU.ActiveCfg = ReleaseXNA4|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.ReleaseXNA4|Mixed Platforms.ActiveCfg = ReleaseXNA4|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.ReleaseXNA4|Mixed Platforms.Build.0 = ReleaseXNA4|Any CPU
- {2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}.ReleaseXNA4|x86.ActiveCfg = ReleaseXNA4|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.Debug|Any CPU.ActiveCfg = DebugPL|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.Debug|Any CPU.Build.0 = DebugPL|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.Debug|Mixed Platforms.ActiveCfg = DebugPL|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.Debug|Mixed Platforms.Build.0 = DebugPL|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.Debug|x86.ActiveCfg = DebugPL|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.Debug35|Any CPU.ActiveCfg = Debug35|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.Debug35|Any CPU.Build.0 = Debug35|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.Debug35|Mixed Platforms.ActiveCfg = Debug35|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.Debug35|Mixed Platforms.Build.0 = Debug35|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.Debug35|x86.ActiveCfg = Debug35|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.Debug40|Any CPU.ActiveCfg = Debug40|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.Debug40|Any CPU.Build.0 = Debug40|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.Debug40|Mixed Platforms.ActiveCfg = Debug40|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.Debug40|Mixed Platforms.Build.0 = Debug40|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.Debug40|x86.ActiveCfg = Debug40|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.Debug45|Any CPU.ActiveCfg = DebugPL|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.Debug45|Any CPU.Build.0 = DebugPL|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.Debug45|Mixed Platforms.ActiveCfg = Debug45|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.Debug45|Mixed Platforms.Build.0 = Debug45|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.Debug45|x86.ActiveCfg = Debug45|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.Debug8|Any CPU.ActiveCfg = DebugPL|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.Debug8|Any CPU.Build.0 = DebugPL|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.Debug8|Mixed Platforms.ActiveCfg = Debug8|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.Debug8|Mixed Platforms.Build.0 = Debug8|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.Debug8|x86.ActiveCfg = Debug45|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.DebugCF35|Any CPU.ActiveCfg = DebugCF35|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.DebugCF35|Mixed Platforms.ActiveCfg = DebugCF35|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.DebugCF35|x86.ActiveCfg = DebugSL3|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.DebugPL|Any CPU.ActiveCfg = DebugPL|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.DebugPL|Any CPU.Build.0 = DebugPL|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.DebugPL|Mixed Platforms.ActiveCfg = DebugPL|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.DebugPL|Mixed Platforms.Build.0 = DebugPL|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.DebugPL|x86.ActiveCfg = DebugPL|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.DebugSL3|Any CPU.ActiveCfg = DebugSL3|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.DebugSL3|Any CPU.Build.0 = DebugSL3|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.DebugSL3|Mixed Platforms.ActiveCfg = DebugSL3|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.DebugSL3|Mixed Platforms.Build.0 = DebugSL3|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.DebugSL3|x86.ActiveCfg = DebugSL3|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.DebugSL4|Any CPU.ActiveCfg = DebugSL4|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.DebugSL4|Any CPU.Build.0 = DebugSL4|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.DebugSL4|Mixed Platforms.ActiveCfg = DebugSL4|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.DebugSL4|Mixed Platforms.Build.0 = DebugSL4|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.DebugSL4|x86.ActiveCfg = DebugSL4|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.DebugSL5|Any CPU.ActiveCfg = DebugSL5|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.DebugSL5|Any CPU.Build.0 = DebugSL5|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.DebugSL5|Mixed Platforms.ActiveCfg = DebugSL5|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.DebugSL5|Mixed Platforms.Build.0 = DebugSL5|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.DebugSL5|x86.ActiveCfg = DebugSL5|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.DebugWP7|Any CPU.ActiveCfg = DebugWP7|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.DebugWP7|Any CPU.Build.0 = DebugWP7|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.DebugWP7|Mixed Platforms.ActiveCfg = DebugWP7|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.DebugWP7|Mixed Platforms.Build.0 = DebugWP7|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.DebugWP7|x86.ActiveCfg = DebugWP7|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.DebugWP8|Any CPU.ActiveCfg = DebugPL|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.DebugWP8|Any CPU.Build.0 = DebugPL|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.DebugWP8|Mixed Platforms.ActiveCfg = DebugWP8|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.DebugWP8|Mixed Platforms.Build.0 = DebugWP8|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.DebugWP8|x86.ActiveCfg = DebugWP8|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.DebugXBLV|Any CPU.ActiveCfg = DebugXBLV|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.DebugXBLV|Mixed Platforms.ActiveCfg = DebugXBLV|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.DebugXBLV|Mixed Platforms.Build.0 = DebugXBLV|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.DebugXBLV|x86.ActiveCfg = DebugXBLV|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.DebugXNA4|Any CPU.ActiveCfg = DebugXNA4|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.DebugXNA4|Mixed Platforms.ActiveCfg = DebugXNA4|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.DebugXNA4|Mixed Platforms.Build.0 = DebugXNA4|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.DebugXNA4|x86.ActiveCfg = DebugXNA4|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.Release|Any CPU.ActiveCfg = ReleasePL|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.Release|Any CPU.Build.0 = ReleasePL|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.Release|Mixed Platforms.ActiveCfg = ReleasePL|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.Release|Mixed Platforms.Build.0 = ReleasePL|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.Release|x86.ActiveCfg = ReleasePL|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.Release35|Any CPU.ActiveCfg = Release35|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.Release35|Any CPU.Build.0 = Release35|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.Release35|Mixed Platforms.ActiveCfg = Release35|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.Release35|Mixed Platforms.Build.0 = Release35|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.Release35|x86.ActiveCfg = Release35|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.Release40|Any CPU.ActiveCfg = Release40|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.Release40|Any CPU.Build.0 = Release40|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.Release40|Mixed Platforms.ActiveCfg = Release40|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.Release40|Mixed Platforms.Build.0 = Release40|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.Release40|x86.ActiveCfg = Release40|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.Release45|Any CPU.ActiveCfg = ReleasePL|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.Release45|Any CPU.Build.0 = ReleasePL|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.Release45|Mixed Platforms.ActiveCfg = Release45|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.Release45|Mixed Platforms.Build.0 = Release45|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.Release45|x86.ActiveCfg = Release45|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.Release8|Any CPU.ActiveCfg = ReleasePL|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.Release8|Any CPU.Build.0 = ReleasePL|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.Release8|Mixed Platforms.ActiveCfg = Release8|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.Release8|Mixed Platforms.Build.0 = Release8|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.Release8|x86.ActiveCfg = Release45|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.ReleaseCF35|Any CPU.ActiveCfg = ReleaseCF35|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.ReleaseCF35|Mixed Platforms.ActiveCfg = ReleaseCF35|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.ReleaseCF35|x86.ActiveCfg = ReleaseSL3|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.ReleasePL|Any CPU.ActiveCfg = ReleasePL|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.ReleasePL|Any CPU.Build.0 = ReleasePL|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.ReleasePL|Mixed Platforms.ActiveCfg = ReleasePL|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.ReleasePL|Mixed Platforms.Build.0 = ReleasePL|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.ReleasePL|x86.ActiveCfg = ReleasePL|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.ReleaseSL3|Any CPU.ActiveCfg = ReleaseSL3|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.ReleaseSL3|Any CPU.Build.0 = ReleaseSL3|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.ReleaseSL3|Mixed Platforms.ActiveCfg = ReleaseSL3|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.ReleaseSL3|Mixed Platforms.Build.0 = ReleaseSL3|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.ReleaseSL3|x86.ActiveCfg = ReleaseSL3|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.ReleaseSL4|Any CPU.ActiveCfg = ReleaseSL4|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.ReleaseSL4|Any CPU.Build.0 = ReleaseSL4|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.ReleaseSL4|Mixed Platforms.ActiveCfg = ReleaseSL4|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.ReleaseSL4|Mixed Platforms.Build.0 = ReleaseSL4|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.ReleaseSL4|x86.ActiveCfg = ReleaseSL4|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.ReleaseSL5|Any CPU.ActiveCfg = ReleaseSL5|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.ReleaseSL5|Any CPU.Build.0 = ReleaseSL5|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.ReleaseSL5|Mixed Platforms.ActiveCfg = ReleaseSL5|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.ReleaseSL5|Mixed Platforms.Build.0 = ReleaseSL5|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.ReleaseSL5|x86.ActiveCfg = ReleaseSL5|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.ReleaseWP7|Any CPU.ActiveCfg = ReleaseWP7|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.ReleaseWP7|Any CPU.Build.0 = ReleaseWP7|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.ReleaseWP7|Mixed Platforms.ActiveCfg = ReleaseWP7|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.ReleaseWP7|Mixed Platforms.Build.0 = ReleaseWP7|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.ReleaseWP7|x86.ActiveCfg = ReleaseWP7|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.ReleaseWP8|Any CPU.ActiveCfg = ReleasePL|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.ReleaseWP8|Any CPU.Build.0 = ReleasePL|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.ReleaseWP8|Mixed Platforms.ActiveCfg = ReleaseWP8|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.ReleaseWP8|Mixed Platforms.Build.0 = ReleaseWP8|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.ReleaseWP8|x86.ActiveCfg = ReleaseWP8|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.ReleaseXBLV|Any CPU.ActiveCfg = ReleaseXBLV|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.ReleaseXBLV|Mixed Platforms.ActiveCfg = ReleaseXBLV|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.ReleaseXBLV|Mixed Platforms.Build.0 = ReleaseXBLV|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.ReleaseXBLV|x86.ActiveCfg = ReleaseXBLV|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.ReleaseXNA4|Any CPU.ActiveCfg = ReleaseXNA4|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.ReleaseXNA4|Mixed Platforms.ActiveCfg = ReleaseXNA4|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.ReleaseXNA4|Mixed Platforms.Build.0 = ReleaseXNA4|Any CPU
- {C7B9D7BE-F47F-466B-A6B0-E46F1069B171}.ReleaseXNA4|x86.ActiveCfg = ReleaseXNA4|Any CPU
- {EE655A70-A899-4B38-84D3-FB9F63A8C661}.Debug|Any CPU.ActiveCfg = DebugPL|Any CPU
- {EE655A70-A899-4B38-84D3-FB9F63A8C661}.Debug|Any CPU.Build.0 = DebugPL|Any CPU
- {EE655A70-A899-4B38-84D3-FB9F63A8C661}.Debug|Mixed Platforms.ActiveCfg = DebugPL|Any CPU
- {EE655A70-A899-4B38-84D3-FB9F63A8C661}.Debug|Mixed Platforms.Build.0 = DebugPL|Any CPU
- {EE655A70-A899-4B38-84D3-FB9F63A8C661}.Debug|x86.ActiveCfg = DebugPL|Any CPU
- {EE655A70-A899-4B38-84D3-FB9F63A8C661}.Debug35|Any CPU.ActiveCfg = Debug35|Any CPU
- {EE655A70-A899-4B38-84D3-FB9F63A8C661}.Debug35|Mixed Platforms.ActiveCfg = Debug35|Any CPU
- {EE655A70-A899-4B38-84D3-FB9F63A8C661}.Debug35|x86.ActiveCfg = Debug35|Any CPU
- {EE655A70-A899-4B38-84D3-FB9F63A8C661}.Debug40|Any CPU.ActiveCfg = Debug40|Any CPU
- {EE655A70-A899-4B38-84D3-FB9F63A8C661}.Debug40|Mixed Platforms.ActiveCfg = Debug40|Any CPU
- {EE655A70-A899-4B38-84D3-FB9F63A8C661}.Debug40|x86.ActiveCfg = Debug40|Any CPU
- {EE655A70-A899-4B38-84D3-FB9F63A8C661}.Debug45|Any CPU.ActiveCfg = Debug45|Any CPU
- {EE655A70-A899-4B38-84D3-FB9F63A8C661}.Debug45|Mixed Platforms.ActiveCfg = Debug45|Any CPU
- {EE655A70-A899-4B38-84D3-FB9F63A8C661}.Debug45|x86.ActiveCfg = Debug45|Any CPU
- {EE655A70-A899-4B38-84D3-FB9F63A8C661}.Debug8|Any CPU.ActiveCfg = Debug8|Any CPU
- {EE655A70-A899-4B38-84D3-FB9F63A8C661}.Debug8|Any CPU.Build.0 = Debug8|Any CPU
- {EE655A70-A899-4B38-84D3-FB9F63A8C661}.Debug8|Mixed Platforms.ActiveCfg = Debug8|Any CPU
- {EE655A70-A899-4B38-84D3-FB9F63A8C661}.Debug8|Mixed Platforms.Build.0 = Debug8|Any CPU
- {EE655A70-A899-4B38-84D3-FB9F63A8C661}.Debug8|x86.ActiveCfg = Debug8|Any CPU
- {EE655A70-A899-4B38-84D3-FB9F63A8C661}.DebugCF35|Any CPU.ActiveCfg = DebugCF35|Any CPU
- {EE655A70-A899-4B38-84D3-FB9F63A8C661}.DebugCF35|Mixed Platforms.ActiveCfg = DebugCF35|Any CPU
- {EE655A70-A899-4B38-84D3-FB9F63A8C661}.DebugCF35|x86.ActiveCfg = DebugSL3|Any CPU
- {EE655A70-A899-4B38-84D3-FB9F63A8C661}.DebugPL|Any CPU.ActiveCfg = DebugPL|Any CPU
- {EE655A70-A899-4B38-84D3-FB9F63A8C661}.DebugPL|Mixed Platforms.ActiveCfg = DebugPL|Any CPU
- {EE655A70-A899-4B38-84D3-FB9F63A8C661}.DebugPL|x86.ActiveCfg = DebugPL|Any CPU
- {EE655A70-A899-4B38-84D3-FB9F63A8C661}.DebugSL3|Any CPU.ActiveCfg = DebugSL3|Any CPU
- {EE655A70-A899-4B38-84D3-FB9F63A8C661}.DebugSL3|Mixed Platforms.ActiveCfg = DebugSL3|Any CPU
- {EE655A70-A899-4B38-84D3-FB9F63A8C661}.DebugSL3|x86.ActiveCfg = DebugSL3|Any CPU
- {EE655A70-A899-4B38-84D3-FB9F63A8C661}.DebugSL4|Any CPU.ActiveCfg = DebugSL4|Any CPU
- {EE655A70-A899-4B38-84D3-FB9F63A8C661}.DebugSL4|Mixed Platforms.ActiveCfg = DebugSL4|Any CPU
- {EE655A70-A899-4B38-84D3-FB9F63A8C661}.DebugSL4|x86.ActiveCfg = DebugSL4|Any CPU
- {EE655A70-A899-4B38-84D3-FB9F63A8C661}.DebugSL5|Any CPU.ActiveCfg = DebugSL5|Any CPU
- {EE655A70-A899-4B38-84D3-FB9F63A8C661}.DebugSL5|Mixed Platforms.ActiveCfg = DebugSL5|Any CPU
- {EE655A70-A899-4B38-84D3-FB9F63A8C661}.DebugSL5|x86.ActiveCfg = DebugSL5|Any CPU
- {EE655A70-A899-4B38-84D3-FB9F63A8C661}.DebugWP7|Any CPU.ActiveCfg = DebugWP7|Any CPU
- {EE655A70-A899-4B38-84D3-FB9F63A8C661}.DebugWP7|Mixed Platforms.ActiveCfg = DebugWP7|Any CPU
- {EE655A70-A899-4B38-84D3-FB9F63A8C661}.DebugWP7|x86.ActiveCfg = DebugWP7|Any CPU
- {EE655A70-A899-4B38-84D3-FB9F63A8C661}.DebugWP8|Any CPU.ActiveCfg = DebugWP8|Any CPU
- {EE655A70-A899-4B38-84D3-FB9F63A8C661}.DebugWP8|Mixed Platforms.ActiveCfg = DebugWP8|Any CPU
- {EE655A70-A899-4B38-84D3-FB9F63A8C661}.DebugWP8|x86.ActiveCfg = DebugWP8|Any CPU
- {EE655A70-A899-4B38-84D3-FB9F63A8C661}.DebugXBLV|Any CPU.ActiveCfg = DebugXBLV|Any CPU
- {EE655A70-A899-4B38-84D3-FB9F63A8C661}.DebugXBLV|Mixed Platforms.ActiveCfg = DebugXBLV|Any CPU
- {EE655A70-A899-4B38-84D3-FB9F63A8C661}.DebugXBLV|Mixed Platforms.Build.0 = DebugXBLV|Any CPU
- {EE655A70-A899-4B38-84D3-FB9F63A8C661}.DebugXBLV|x86.ActiveCfg = DebugXBLV|Any CPU
- {EE655A70-A899-4B38-84D3-FB9F63A8C661}.DebugXNA4|Any CPU.ActiveCfg = DebugXNA4|Any CPU
- {EE655A70-A899-4B38-84D3-FB9F63A8C661}.DebugXNA4|Mixed Platforms.ActiveCfg = DebugXNA4|Any CPU
- {EE655A70-A899-4B38-84D3-FB9F63A8C661}.DebugXNA4|Mixed Platforms.Build.0 = DebugXNA4|Any CPU
- {EE655A70-A899-4B38-84D3-FB9F63A8C661}.DebugXNA4|x86.ActiveCfg = DebugXNA4|Any CPU
- {EE655A70-A899-4B38-84D3-FB9F63A8C661}.Release|Any CPU.ActiveCfg = ReleasePL|Any CPU
- {EE655A70-A899-4B38-84D3-FB9F63A8C661}.Release|Any CPU.Build.0 = ReleasePL|Any CPU
- {EE655A70-A899-4B38-84D3-FB9F63A8C661}.Release|Mixed Platforms.ActiveCfg = ReleasePL|Any CPU
- {EE655A70-A899-4B38-84D3-FB9F63A8C661}.Release|Mixed Platforms.Build.0 = ReleasePL|Any CPU
- {EE655A70-A899-4B38-84D3-FB9F63A8C661}.Release|x86.ActiveCfg = ReleasePL|Any CPU
- {EE655A70-A899-4B38-84D3-FB9F63A8C661}.Release35|Any CPU.ActiveCfg = Release35|Any CPU
- {EE655A70-A899-4B38-84D3-FB9F63A8C661}.Release35|Mixed Platforms.ActiveCfg = Release35|Any CPU
- {EE655A70-A899-4B38-84D3-FB9F63A8C661}.Release35|x86.ActiveCfg = Release35|Any CPU
- {EE655A70-A899-4B38-84D3-FB9F63A8C661}.Release40|Any CPU.ActiveCfg = Release40|Any CPU
- {EE655A70-A899-4B38-84D3-FB9F63A8C661}.Release40|Mixed Platforms.ActiveCfg = Release40|Any CPU
- {EE655A70-A899-4B38-84D3-FB9F63A8C661}.Release40|x86.ActiveCfg = Release40|Any CPU
- {EE655A70-A899-4B38-84D3-FB9F63A8C661}.Release45|Any CPU.ActiveCfg = Release45|Any CPU
- {EE655A70-A899-4B38-84D3-FB9F63A8C661}.Release45|Mixed Platforms.ActiveCfg = Release45|Any CPU
- {EE655A70-A899-4B38-84D3-FB9F63A8C661}.Release45|x86.ActiveCfg = Release45|Any CPU
- {EE655A70-A899-4B38-84D3-FB9F63A8C661}.Release8|Any CPU.ActiveCfg = Release8|Any CPU
- {EE655A70-A899-4B38-84D3-FB9F63A8C661}.Release8|Any CPU.Build.0 = Release8|Any CPU
- {EE655A70-A899-4B38-84D3-FB9F63A8C661}.Release8|Mixed Platforms.ActiveCfg = Release8|Any CPU
- {EE655A70-A899-4B38-84D3-FB9F63A8C661}.Release8|Mixed Platforms.Build.0 = Release8|Any CPU
- {EE655A70-A899-4B38-84D3-FB9F63A8C661}.Release8|x86.ActiveCfg = Release8|Any CPU
- {EE655A70-A899-4B38-84D3-FB9F63A8C661}.ReleaseCF35|Any CPU.ActiveCfg = ReleaseCF35|Any CPU
- {EE655A70-A899-4B38-84D3-FB9F63A8C661}.ReleaseCF35|Mixed Platforms.ActiveCfg = ReleaseCF35|Any CPU
- {EE655A70-A899-4B38-84D3-FB9F63A8C661}.ReleaseCF35|x86.ActiveCfg = ReleaseSL3|Any CPU
- {EE655A70-A899-4B38-84D3-FB9F63A8C661}.ReleasePL|Any CPU.ActiveCfg = ReleasePL|Any CPU
- {EE655A70-A899-4B38-84D3-FB9F63A8C661}.ReleasePL|Mixed Platforms.ActiveCfg = ReleasePL|Any CPU
- {EE655A70-A899-4B38-84D3-FB9F63A8C661}.ReleasePL|x86.ActiveCfg = ReleasePL|Any CPU
- {EE655A70-A899-4B38-84D3-FB9F63A8C661}.ReleaseSL3|Any CPU.ActiveCfg = ReleaseSL3|Any CPU
- {EE655A70-A899-4B38-84D3-FB9F63A8C661}.ReleaseSL3|Mixed Platforms.ActiveCfg = ReleaseSL3|Any CPU
- {EE655A70-A899-4B38-84D3-FB9F63A8C661}.ReleaseSL3|x86.ActiveCfg = ReleaseSL3|Any CPU
- {EE655A70-A899-4B38-84D3-FB9F63A8C661}.ReleaseSL4|Any CPU.ActiveCfg = ReleaseSL4|Any CPU
- {EE655A70-A899-4B38-84D3-FB9F63A8C661}.ReleaseSL4|Mixed Platforms.ActiveCfg = ReleaseSL4|Any CPU
- {EE655A70-A899-4B38-84D3-FB9F63A8C661}.ReleaseSL4|x86.ActiveCfg = ReleaseSL4|Any CPU
- {EE655A70-A899-4B38-84D3-FB9F63A8C661}.ReleaseSL5|Any CPU.ActiveCfg = ReleaseSL5|Any CPU
- {EE655A70-A899-4B38-84D3-FB9F63A8C661}.ReleaseSL5|Mixed Platforms.ActiveCfg = ReleaseSL5|Any CPU
- {EE655A70-A899-4B38-84D3-FB9F63A8C661}.ReleaseSL5|x86.ActiveCfg = ReleaseSL5|Any CPU
- {EE655A70-A899-4B38-84D3-FB9F63A8C661}.ReleaseWP7|Any CPU.ActiveCfg = ReleaseWP7|Any CPU
- {EE655A70-A899-4B38-84D3-FB9F63A8C661}.ReleaseWP7|Mixed Platforms.ActiveCfg = ReleaseWP7|Any CPU
- {EE655A70-A899-4B38-84D3-FB9F63A8C661}.ReleaseWP7|x86.ActiveCfg = ReleaseWP7|Any CPU
- {EE655A70-A899-4B38-84D3-FB9F63A8C661}.ReleaseWP8|Any CPU.ActiveCfg = ReleaseWP8|Any CPU
- {EE655A70-A899-4B38-84D3-FB9F63A8C661}.ReleaseWP8|Mixed Platforms.ActiveCfg = ReleaseWP8|Any CPU
- {EE655A70-A899-4B38-84D3-FB9F63A8C661}.ReleaseWP8|x86.ActiveCfg = ReleaseWP8|Any CPU
- {EE655A70-A899-4B38-84D3-FB9F63A8C661}.ReleaseXBLV|Any CPU.ActiveCfg = ReleaseXBLV|Any CPU
- {EE655A70-A899-4B38-84D3-FB9F63A8C661}.ReleaseXBLV|Mixed Platforms.ActiveCfg = ReleaseXBLV|Any CPU
- {EE655A70-A899-4B38-84D3-FB9F63A8C661}.ReleaseXBLV|Mixed Platforms.Build.0 = ReleaseXBLV|Any CPU
- {EE655A70-A899-4B38-84D3-FB9F63A8C661}.ReleaseXBLV|x86.ActiveCfg = ReleaseXBLV|Any CPU
- {EE655A70-A899-4B38-84D3-FB9F63A8C661}.ReleaseXNA4|Any CPU.ActiveCfg = ReleaseXNA4|Any CPU
- {EE655A70-A899-4B38-84D3-FB9F63A8C661}.ReleaseXNA4|Mixed Platforms.ActiveCfg = ReleaseXNA4|Any CPU
- {EE655A70-A899-4B38-84D3-FB9F63A8C661}.ReleaseXNA4|x86.ActiveCfg = ReleaseXNA4|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.Debug|Any CPU.ActiveCfg = DebugPL|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.Debug|Any CPU.Build.0 = DebugPL|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.Debug|Mixed Platforms.ActiveCfg = DebugPL|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.Debug|Mixed Platforms.Build.0 = DebugPL|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.Debug|x86.ActiveCfg = DebugPL|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.Debug35|Any CPU.ActiveCfg = Debug35|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.Debug35|Any CPU.Build.0 = Debug35|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.Debug35|Mixed Platforms.ActiveCfg = Debug35|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.Debug35|Mixed Platforms.Build.0 = Debug35|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.Debug35|x86.ActiveCfg = Debug35|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.Debug40|Any CPU.ActiveCfg = Debug40|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.Debug40|Any CPU.Build.0 = Debug40|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.Debug40|Mixed Platforms.ActiveCfg = Debug40|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.Debug40|Mixed Platforms.Build.0 = Debug40|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.Debug40|x86.ActiveCfg = Debug40|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.Debug45|Any CPU.ActiveCfg = DebugPL|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.Debug45|Any CPU.Build.0 = DebugPL|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.Debug45|Mixed Platforms.ActiveCfg = Debug45|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.Debug45|Mixed Platforms.Build.0 = Debug45|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.Debug45|x86.ActiveCfg = Debug45|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.Debug8|Any CPU.ActiveCfg = DebugPL|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.Debug8|Any CPU.Build.0 = DebugPL|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.Debug8|Mixed Platforms.ActiveCfg = Debug8|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.Debug8|Mixed Platforms.Build.0 = Debug8|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.Debug8|x86.ActiveCfg = Debug8|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.DebugCF35|Any CPU.ActiveCfg = DebugCF35|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.DebugCF35|Any CPU.Build.0 = DebugCF35|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.DebugCF35|Mixed Platforms.ActiveCfg = DebugCF35|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.DebugCF35|Mixed Platforms.Build.0 = DebugCF35|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.DebugCF35|x86.ActiveCfg = DebugSL3|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.DebugPL|Any CPU.ActiveCfg = DebugPL|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.DebugPL|Any CPU.Build.0 = DebugPL|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.DebugPL|Mixed Platforms.ActiveCfg = DebugPL|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.DebugPL|Mixed Platforms.Build.0 = DebugPL|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.DebugPL|x86.ActiveCfg = DebugPL|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.DebugSL3|Any CPU.ActiveCfg = DebugSL3|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.DebugSL3|Any CPU.Build.0 = DebugSL3|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.DebugSL3|Mixed Platforms.ActiveCfg = DebugSL3|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.DebugSL3|Mixed Platforms.Build.0 = DebugSL3|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.DebugSL3|x86.ActiveCfg = DebugSL3|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.DebugSL4|Any CPU.ActiveCfg = DebugSL4|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.DebugSL4|Any CPU.Build.0 = DebugSL4|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.DebugSL4|Mixed Platforms.ActiveCfg = DebugSL4|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.DebugSL4|Mixed Platforms.Build.0 = DebugSL4|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.DebugSL4|x86.ActiveCfg = DebugSL4|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.DebugSL5|Any CPU.ActiveCfg = DebugSL5|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.DebugSL5|Any CPU.Build.0 = DebugSL5|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.DebugSL5|Mixed Platforms.ActiveCfg = DebugSL5|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.DebugSL5|Mixed Platforms.Build.0 = DebugSL5|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.DebugSL5|x86.ActiveCfg = DebugSL5|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.DebugWP7|Any CPU.ActiveCfg = DebugWP7|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.DebugWP7|Any CPU.Build.0 = DebugWP7|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.DebugWP7|Mixed Platforms.ActiveCfg = DebugWP7|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.DebugWP7|Mixed Platforms.Build.0 = DebugWP7|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.DebugWP7|x86.ActiveCfg = DebugWP7|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.DebugWP8|Any CPU.ActiveCfg = DebugPL|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.DebugWP8|Any CPU.Build.0 = DebugPL|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.DebugWP8|Mixed Platforms.ActiveCfg = DebugWP8|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.DebugWP8|Mixed Platforms.Build.0 = DebugWP8|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.DebugWP8|x86.ActiveCfg = DebugWP8|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.DebugXBLV|Any CPU.ActiveCfg = DebugXBLV|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.DebugXBLV|Any CPU.Build.0 = DebugXBLV|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.DebugXBLV|Mixed Platforms.ActiveCfg = DebugXBLV|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.DebugXBLV|Mixed Platforms.Build.0 = DebugXBLV|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.DebugXBLV|x86.ActiveCfg = DebugXBLV|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.DebugXNA4|Any CPU.ActiveCfg = DebugXNA4|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.DebugXNA4|Any CPU.Build.0 = DebugXNA4|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.DebugXNA4|Mixed Platforms.ActiveCfg = DebugXNA4|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.DebugXNA4|Mixed Platforms.Build.0 = DebugXNA4|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.DebugXNA4|x86.ActiveCfg = DebugXNA4|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.Release|Any CPU.ActiveCfg = ReleasePL|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.Release|Any CPU.Build.0 = ReleasePL|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.Release|Mixed Platforms.ActiveCfg = ReleasePL|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.Release|Mixed Platforms.Build.0 = ReleasePL|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.Release|x86.ActiveCfg = ReleasePL|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.Release35|Any CPU.ActiveCfg = Release35|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.Release35|Any CPU.Build.0 = Release35|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.Release35|Mixed Platforms.ActiveCfg = Release35|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.Release35|Mixed Platforms.Build.0 = Release35|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.Release35|x86.ActiveCfg = Release35|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.Release40|Any CPU.ActiveCfg = Release40|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.Release40|Any CPU.Build.0 = Release40|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.Release40|Mixed Platforms.ActiveCfg = Release40|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.Release40|Mixed Platforms.Build.0 = Release40|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.Release40|x86.ActiveCfg = Release40|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.Release45|Any CPU.ActiveCfg = ReleasePL|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.Release45|Any CPU.Build.0 = ReleasePL|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.Release45|Mixed Platforms.ActiveCfg = Release45|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.Release45|Mixed Platforms.Build.0 = Release45|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.Release45|x86.ActiveCfg = Release45|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.Release8|Any CPU.ActiveCfg = ReleasePL|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.Release8|Any CPU.Build.0 = ReleasePL|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.Release8|Mixed Platforms.ActiveCfg = Release8|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.Release8|Mixed Platforms.Build.0 = Release8|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.Release8|x86.ActiveCfg = Release8|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.ReleaseCF35|Any CPU.ActiveCfg = ReleaseCF35|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.ReleaseCF35|Any CPU.Build.0 = ReleaseCF35|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.ReleaseCF35|Mixed Platforms.ActiveCfg = ReleaseCF35|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.ReleaseCF35|Mixed Platforms.Build.0 = ReleaseCF35|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.ReleaseCF35|x86.ActiveCfg = ReleaseSL3|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.ReleasePL|Any CPU.ActiveCfg = ReleasePL|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.ReleasePL|Any CPU.Build.0 = ReleasePL|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.ReleasePL|Mixed Platforms.ActiveCfg = ReleasePL|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.ReleasePL|Mixed Platforms.Build.0 = ReleasePL|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.ReleasePL|x86.ActiveCfg = ReleasePL|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.ReleaseSL3|Any CPU.ActiveCfg = ReleaseSL3|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.ReleaseSL3|Any CPU.Build.0 = ReleaseSL3|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.ReleaseSL3|Mixed Platforms.ActiveCfg = ReleaseSL3|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.ReleaseSL3|Mixed Platforms.Build.0 = ReleaseSL3|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.ReleaseSL3|x86.ActiveCfg = ReleaseSL3|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.ReleaseSL4|Any CPU.ActiveCfg = ReleaseSL4|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.ReleaseSL4|Any CPU.Build.0 = ReleaseSL4|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.ReleaseSL4|Mixed Platforms.ActiveCfg = ReleaseSL4|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.ReleaseSL4|Mixed Platforms.Build.0 = ReleaseSL4|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.ReleaseSL4|x86.ActiveCfg = ReleaseSL4|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.ReleaseSL5|Any CPU.ActiveCfg = ReleaseSL5|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.ReleaseSL5|Any CPU.Build.0 = ReleaseSL5|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.ReleaseSL5|Mixed Platforms.ActiveCfg = ReleaseSL5|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.ReleaseSL5|Mixed Platforms.Build.0 = ReleaseSL5|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.ReleaseSL5|x86.ActiveCfg = ReleaseSL5|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.ReleaseWP7|Any CPU.ActiveCfg = ReleaseWP7|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.ReleaseWP7|Any CPU.Build.0 = ReleaseWP7|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.ReleaseWP7|Mixed Platforms.ActiveCfg = ReleaseWP7|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.ReleaseWP7|Mixed Platforms.Build.0 = ReleaseWP7|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.ReleaseWP7|x86.ActiveCfg = ReleaseWP7|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.ReleaseWP8|Any CPU.ActiveCfg = ReleasePL|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.ReleaseWP8|Any CPU.Build.0 = ReleasePL|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.ReleaseWP8|Mixed Platforms.ActiveCfg = ReleaseWP8|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.ReleaseWP8|Mixed Platforms.Build.0 = ReleaseWP8|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.ReleaseWP8|x86.ActiveCfg = ReleaseWP8|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.ReleaseXBLV|Any CPU.ActiveCfg = ReleaseXBLV|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.ReleaseXBLV|Any CPU.Build.0 = ReleaseXBLV|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.ReleaseXBLV|Mixed Platforms.ActiveCfg = ReleaseXBLV|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.ReleaseXBLV|Mixed Platforms.Build.0 = ReleaseXBLV|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.ReleaseXBLV|x86.ActiveCfg = ReleaseXBLV|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.ReleaseXNA4|Any CPU.ActiveCfg = ReleaseXNA4|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.ReleaseXNA4|Any CPU.Build.0 = ReleaseXNA4|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.ReleaseXNA4|Mixed Platforms.ActiveCfg = ReleaseXNA4|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.ReleaseXNA4|Mixed Platforms.Build.0 = ReleaseXNA4|Any CPU
- {9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}.ReleaseXNA4|x86.ActiveCfg = ReleaseXNA4|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.Debug|Any CPU.ActiveCfg = DebugPL|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.Debug|Any CPU.Build.0 = DebugPL|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.Debug|Mixed Platforms.ActiveCfg = DebugPL|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.Debug|Mixed Platforms.Build.0 = DebugPL|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.Debug|x86.ActiveCfg = DebugPL|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.Debug35|Any CPU.ActiveCfg = Debug35|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.Debug35|Any CPU.Build.0 = Debug35|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.Debug35|Mixed Platforms.ActiveCfg = Debug35|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.Debug35|Mixed Platforms.Build.0 = Debug35|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.Debug35|x86.ActiveCfg = Debug35|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.Debug40|Any CPU.ActiveCfg = Debug40|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.Debug40|Any CPU.Build.0 = Debug40|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.Debug40|Mixed Platforms.ActiveCfg = Debug40|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.Debug40|Mixed Platforms.Build.0 = Debug40|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.Debug40|x86.ActiveCfg = Debug40|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.Debug45|Any CPU.ActiveCfg = DebugPL|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.Debug45|Any CPU.Build.0 = DebugPL|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.Debug45|Mixed Platforms.ActiveCfg = Debug45|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.Debug45|Mixed Platforms.Build.0 = Debug45|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.Debug45|x86.ActiveCfg = Debug45|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.Debug8|Any CPU.ActiveCfg = DebugPL|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.Debug8|Any CPU.Build.0 = DebugPL|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.Debug8|Mixed Platforms.ActiveCfg = Debug8|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.Debug8|Mixed Platforms.Build.0 = Debug8|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.Debug8|x86.ActiveCfg = Debug8|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.DebugCF35|Any CPU.ActiveCfg = DebugCF35|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.DebugCF35|Any CPU.Build.0 = DebugCF35|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.DebugCF35|Mixed Platforms.ActiveCfg = DebugCF35|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.DebugCF35|Mixed Platforms.Build.0 = DebugCF35|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.DebugCF35|x86.ActiveCfg = DebugSL3|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.DebugPL|Any CPU.ActiveCfg = DebugPL|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.DebugPL|Any CPU.Build.0 = DebugPL|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.DebugPL|Mixed Platforms.ActiveCfg = DebugPL|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.DebugPL|Mixed Platforms.Build.0 = DebugPL|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.DebugPL|x86.ActiveCfg = DebugPL|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.DebugSL3|Any CPU.ActiveCfg = DebugSL3|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.DebugSL3|Any CPU.Build.0 = DebugSL3|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.DebugSL3|Mixed Platforms.ActiveCfg = DebugSL3|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.DebugSL3|Mixed Platforms.Build.0 = DebugSL3|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.DebugSL3|x86.ActiveCfg = DebugSL3|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.DebugSL4|Any CPU.ActiveCfg = DebugSL4|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.DebugSL4|Any CPU.Build.0 = DebugSL4|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.DebugSL4|Mixed Platforms.ActiveCfg = DebugSL4|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.DebugSL4|Mixed Platforms.Build.0 = DebugSL4|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.DebugSL4|x86.ActiveCfg = DebugSL4|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.DebugSL5|Any CPU.ActiveCfg = DebugSL5|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.DebugSL5|Any CPU.Build.0 = DebugSL5|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.DebugSL5|Mixed Platforms.ActiveCfg = DebugSL5|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.DebugSL5|Mixed Platforms.Build.0 = DebugSL5|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.DebugSL5|x86.ActiveCfg = DebugSL5|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.DebugWP7|Any CPU.ActiveCfg = DebugWP7|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.DebugWP7|Any CPU.Build.0 = DebugWP7|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.DebugWP7|Mixed Platforms.ActiveCfg = DebugWP7|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.DebugWP7|Mixed Platforms.Build.0 = DebugWP7|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.DebugWP7|x86.ActiveCfg = DebugWP7|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.DebugWP8|Any CPU.ActiveCfg = DebugPL|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.DebugWP8|Any CPU.Build.0 = DebugPL|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.DebugWP8|Mixed Platforms.ActiveCfg = DebugWP8|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.DebugWP8|Mixed Platforms.Build.0 = DebugWP8|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.DebugWP8|x86.ActiveCfg = DebugWP8|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.DebugXBLV|Any CPU.ActiveCfg = DebugXBLV|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.DebugXBLV|Any CPU.Build.0 = DebugXBLV|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.DebugXBLV|Mixed Platforms.ActiveCfg = DebugXBLV|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.DebugXBLV|Mixed Platforms.Build.0 = DebugXBLV|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.DebugXBLV|x86.ActiveCfg = DebugXBLV|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.DebugXNA4|Any CPU.ActiveCfg = DebugXNA4|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.DebugXNA4|Any CPU.Build.0 = DebugXNA4|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.DebugXNA4|Mixed Platforms.ActiveCfg = DebugXNA4|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.DebugXNA4|Mixed Platforms.Build.0 = DebugXNA4|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.DebugXNA4|x86.ActiveCfg = DebugXNA4|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.Release|Any CPU.ActiveCfg = ReleasePL|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.Release|Any CPU.Build.0 = ReleasePL|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.Release|Mixed Platforms.ActiveCfg = ReleasePL|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.Release|Mixed Platforms.Build.0 = ReleasePL|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.Release|x86.ActiveCfg = ReleasePL|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.Release35|Any CPU.ActiveCfg = Release35|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.Release35|Any CPU.Build.0 = Release35|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.Release35|Mixed Platforms.ActiveCfg = Release35|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.Release35|Mixed Platforms.Build.0 = Release35|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.Release35|x86.ActiveCfg = Release35|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.Release40|Any CPU.ActiveCfg = Release40|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.Release40|Any CPU.Build.0 = Release40|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.Release40|Mixed Platforms.ActiveCfg = Release40|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.Release40|Mixed Platforms.Build.0 = Release40|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.Release40|x86.ActiveCfg = Release40|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.Release45|Any CPU.ActiveCfg = ReleasePL|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.Release45|Any CPU.Build.0 = ReleasePL|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.Release45|Mixed Platforms.ActiveCfg = Release45|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.Release45|Mixed Platforms.Build.0 = Release45|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.Release45|x86.ActiveCfg = Release45|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.Release8|Any CPU.ActiveCfg = ReleasePL|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.Release8|Any CPU.Build.0 = ReleasePL|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.Release8|Mixed Platforms.ActiveCfg = Release8|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.Release8|Mixed Platforms.Build.0 = Release8|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.Release8|x86.ActiveCfg = Release8|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.ReleaseCF35|Any CPU.ActiveCfg = ReleaseCF35|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.ReleaseCF35|Any CPU.Build.0 = ReleaseCF35|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.ReleaseCF35|Mixed Platforms.ActiveCfg = ReleaseCF35|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.ReleaseCF35|Mixed Platforms.Build.0 = ReleaseCF35|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.ReleaseCF35|x86.ActiveCfg = ReleaseSL3|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.ReleasePL|Any CPU.ActiveCfg = ReleasePL|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.ReleasePL|Any CPU.Build.0 = ReleasePL|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.ReleasePL|Mixed Platforms.ActiveCfg = ReleasePL|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.ReleasePL|Mixed Platforms.Build.0 = ReleasePL|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.ReleasePL|x86.ActiveCfg = ReleasePL|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.ReleaseSL3|Any CPU.ActiveCfg = ReleaseSL3|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.ReleaseSL3|Any CPU.Build.0 = ReleaseSL3|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.ReleaseSL3|Mixed Platforms.ActiveCfg = ReleaseSL3|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.ReleaseSL3|Mixed Platforms.Build.0 = ReleaseSL3|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.ReleaseSL3|x86.ActiveCfg = ReleaseSL3|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.ReleaseSL4|Any CPU.ActiveCfg = ReleaseSL4|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.ReleaseSL4|Any CPU.Build.0 = ReleaseSL4|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.ReleaseSL4|Mixed Platforms.ActiveCfg = ReleaseSL4|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.ReleaseSL4|Mixed Platforms.Build.0 = ReleaseSL4|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.ReleaseSL4|x86.ActiveCfg = ReleaseSL4|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.ReleaseSL5|Any CPU.ActiveCfg = ReleaseSL5|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.ReleaseSL5|Any CPU.Build.0 = ReleaseSL5|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.ReleaseSL5|Mixed Platforms.ActiveCfg = ReleaseSL5|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.ReleaseSL5|Mixed Platforms.Build.0 = ReleaseSL5|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.ReleaseSL5|x86.ActiveCfg = ReleaseSL5|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.ReleaseWP7|Any CPU.ActiveCfg = ReleaseWP7|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.ReleaseWP7|Any CPU.Build.0 = ReleaseWP7|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.ReleaseWP7|Mixed Platforms.ActiveCfg = ReleaseWP7|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.ReleaseWP7|Mixed Platforms.Build.0 = ReleaseWP7|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.ReleaseWP7|x86.ActiveCfg = ReleaseWP7|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.ReleaseWP8|Any CPU.ActiveCfg = ReleasePL|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.ReleaseWP8|Any CPU.Build.0 = ReleasePL|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.ReleaseWP8|Mixed Platforms.ActiveCfg = ReleaseWP8|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.ReleaseWP8|Mixed Platforms.Build.0 = ReleaseWP8|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.ReleaseWP8|x86.ActiveCfg = ReleaseWP8|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.ReleaseXBLV|Any CPU.ActiveCfg = ReleaseXBLV|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.ReleaseXBLV|Any CPU.Build.0 = ReleaseXBLV|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.ReleaseXBLV|Mixed Platforms.ActiveCfg = ReleaseXBLV|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.ReleaseXBLV|Mixed Platforms.Build.0 = ReleaseXBLV|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.ReleaseXBLV|x86.ActiveCfg = ReleaseXBLV|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.ReleaseXNA4|Any CPU.ActiveCfg = ReleaseXNA4|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.ReleaseXNA4|Any CPU.Build.0 = ReleaseXNA4|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.ReleaseXNA4|Mixed Platforms.ActiveCfg = ReleaseXNA4|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.ReleaseXNA4|Mixed Platforms.Build.0 = ReleaseXNA4|Any CPU
- {4E516F10-DA7A-4D43-963E-A93865ABEA5B}.ReleaseXNA4|x86.ActiveCfg = ReleaseXNA4|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.Debug|Any CPU.ActiveCfg = DebugPL|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.Debug|Mixed Platforms.ActiveCfg = DebugPL|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.Debug|x86.ActiveCfg = DebugPL|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.Debug35|Any CPU.ActiveCfg = Debug35|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.Debug35|Any CPU.Build.0 = Debug35|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.Debug35|Mixed Platforms.ActiveCfg = Debug35|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.Debug35|Mixed Platforms.Build.0 = Debug35|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.Debug35|x86.ActiveCfg = Debug35|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.Debug40|Any CPU.ActiveCfg = Debug40|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.Debug40|Any CPU.Build.0 = Debug40|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.Debug40|Mixed Platforms.ActiveCfg = Debug40|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.Debug40|Mixed Platforms.Build.0 = Debug40|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.Debug40|x86.ActiveCfg = Debug40|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.Debug45|Any CPU.ActiveCfg = Debug45|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.Debug45|Any CPU.Build.0 = Debug45|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.Debug45|Mixed Platforms.ActiveCfg = Debug45|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.Debug45|Mixed Platforms.Build.0 = Debug45|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.Debug45|x86.ActiveCfg = Debug45|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.Debug8|Any CPU.ActiveCfg = Debug8|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.Debug8|Any CPU.Build.0 = Debug8|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.Debug8|Mixed Platforms.ActiveCfg = Debug8|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.Debug8|Mixed Platforms.Build.0 = Debug8|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.Debug8|x86.ActiveCfg = Debug8|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.DebugCF35|Any CPU.ActiveCfg = DebugCF35|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.DebugCF35|Any CPU.Build.0 = DebugCF35|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.DebugCF35|Mixed Platforms.ActiveCfg = DebugCF35|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.DebugCF35|Mixed Platforms.Build.0 = DebugCF35|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.DebugCF35|x86.ActiveCfg = DebugSL3|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.DebugPL|Any CPU.ActiveCfg = DebugPL|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.DebugPL|Mixed Platforms.ActiveCfg = DebugPL|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.DebugPL|x86.ActiveCfg = DebugPL|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.DebugSL3|Any CPU.ActiveCfg = DebugSL3|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.DebugSL3|Any CPU.Build.0 = DebugSL3|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.DebugSL3|Mixed Platforms.ActiveCfg = DebugSL3|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.DebugSL3|x86.ActiveCfg = DebugSL3|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.DebugSL4|Any CPU.ActiveCfg = DebugSL4|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.DebugSL4|Any CPU.Build.0 = DebugSL4|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.DebugSL4|Mixed Platforms.ActiveCfg = DebugSL4|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.DebugSL4|Mixed Platforms.Build.0 = DebugSL4|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.DebugSL4|x86.ActiveCfg = DebugSL4|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.DebugSL5|Any CPU.ActiveCfg = DebugSL5|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.DebugSL5|Any CPU.Build.0 = DebugSL5|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.DebugSL5|Mixed Platforms.ActiveCfg = DebugSL5|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.DebugSL5|Mixed Platforms.Build.0 = DebugSL5|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.DebugSL5|x86.ActiveCfg = DebugSL5|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.DebugWP7|Any CPU.ActiveCfg = DebugWP7|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.DebugWP7|Any CPU.Build.0 = DebugWP7|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.DebugWP7|Mixed Platforms.ActiveCfg = DebugWP7|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.DebugWP7|Mixed Platforms.Build.0 = DebugWP7|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.DebugWP7|x86.ActiveCfg = DebugWP7|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.DebugWP8|Any CPU.ActiveCfg = DebugWP8|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.DebugWP8|Any CPU.Build.0 = DebugWP8|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.DebugWP8|Mixed Platforms.ActiveCfg = DebugWP8|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.DebugWP8|Mixed Platforms.Build.0 = DebugWP8|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.DebugWP8|x86.ActiveCfg = DebugWP8|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.DebugXBLV|Any CPU.ActiveCfg = DebugXBLV|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.DebugXBLV|Any CPU.Build.0 = DebugXBLV|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.DebugXBLV|Mixed Platforms.ActiveCfg = DebugXBLV|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.DebugXBLV|Mixed Platforms.Build.0 = DebugXBLV|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.DebugXBLV|x86.ActiveCfg = DebugXBLV|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.DebugXNA4|Any CPU.ActiveCfg = DebugXNA4|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.DebugXNA4|Any CPU.Build.0 = DebugXNA4|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.DebugXNA4|Mixed Platforms.ActiveCfg = DebugXNA4|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.DebugXNA4|Mixed Platforms.Build.0 = DebugXNA4|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.DebugXNA4|x86.ActiveCfg = DebugXNA4|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.Release|Any CPU.ActiveCfg = ReleasePL|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.Release|Mixed Platforms.ActiveCfg = ReleasePL|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.Release|x86.ActiveCfg = ReleasePL|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.Release35|Any CPU.ActiveCfg = Release35|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.Release35|Any CPU.Build.0 = Release35|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.Release35|Mixed Platforms.ActiveCfg = Release35|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.Release35|Mixed Platforms.Build.0 = Release35|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.Release35|x86.ActiveCfg = Release35|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.Release40|Any CPU.ActiveCfg = Release40|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.Release40|Any CPU.Build.0 = Release40|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.Release40|Mixed Platforms.ActiveCfg = Release40|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.Release40|Mixed Platforms.Build.0 = Release40|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.Release40|x86.ActiveCfg = Release40|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.Release45|Any CPU.ActiveCfg = Release45|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.Release45|Any CPU.Build.0 = Release45|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.Release45|Mixed Platforms.ActiveCfg = Release45|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.Release45|Mixed Platforms.Build.0 = Release45|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.Release45|x86.ActiveCfg = Release45|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.Release8|Any CPU.ActiveCfg = Release8|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.Release8|Any CPU.Build.0 = Release8|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.Release8|Mixed Platforms.ActiveCfg = Release8|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.Release8|Mixed Platforms.Build.0 = Release8|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.Release8|x86.ActiveCfg = Release8|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.ReleaseCF35|Any CPU.ActiveCfg = ReleaseCF35|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.ReleaseCF35|Any CPU.Build.0 = ReleaseCF35|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.ReleaseCF35|Mixed Platforms.ActiveCfg = ReleaseCF35|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.ReleaseCF35|Mixed Platforms.Build.0 = ReleaseCF35|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.ReleaseCF35|x86.ActiveCfg = ReleaseSL3|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.ReleasePL|Any CPU.ActiveCfg = ReleasePL|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.ReleasePL|Mixed Platforms.ActiveCfg = ReleasePL|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.ReleasePL|x86.ActiveCfg = ReleasePL|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.ReleaseSL3|Any CPU.ActiveCfg = ReleaseSL3|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.ReleaseSL3|Any CPU.Build.0 = ReleaseSL3|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.ReleaseSL3|Mixed Platforms.ActiveCfg = ReleaseSL3|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.ReleaseSL3|x86.ActiveCfg = ReleaseSL3|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.ReleaseSL4|Any CPU.ActiveCfg = ReleaseSL4|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.ReleaseSL4|Any CPU.Build.0 = ReleaseSL4|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.ReleaseSL4|Mixed Platforms.ActiveCfg = ReleaseSL4|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.ReleaseSL4|Mixed Platforms.Build.0 = ReleaseSL4|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.ReleaseSL4|x86.ActiveCfg = ReleaseSL4|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.ReleaseSL5|Any CPU.ActiveCfg = ReleaseSL5|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.ReleaseSL5|Any CPU.Build.0 = ReleaseSL5|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.ReleaseSL5|Mixed Platforms.ActiveCfg = ReleaseSL5|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.ReleaseSL5|Mixed Platforms.Build.0 = ReleaseSL5|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.ReleaseSL5|x86.ActiveCfg = ReleaseSL5|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.ReleaseWP7|Any CPU.ActiveCfg = ReleaseWP7|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.ReleaseWP7|Any CPU.Build.0 = ReleaseWP7|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.ReleaseWP7|Mixed Platforms.ActiveCfg = ReleaseWP7|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.ReleaseWP7|Mixed Platforms.Build.0 = ReleaseWP7|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.ReleaseWP7|x86.ActiveCfg = ReleaseWP7|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.ReleaseWP8|Any CPU.ActiveCfg = ReleaseWP8|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.ReleaseWP8|Any CPU.Build.0 = ReleaseWP8|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.ReleaseWP8|Mixed Platforms.ActiveCfg = ReleaseWP8|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.ReleaseWP8|Mixed Platforms.Build.0 = ReleaseWP8|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.ReleaseWP8|x86.ActiveCfg = ReleaseWP8|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.ReleaseXBLV|Any CPU.ActiveCfg = ReleaseXBLV|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.ReleaseXBLV|Any CPU.Build.0 = ReleaseXBLV|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.ReleaseXBLV|Mixed Platforms.ActiveCfg = ReleaseXBLV|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.ReleaseXBLV|Mixed Platforms.Build.0 = ReleaseXBLV|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.ReleaseXBLV|x86.ActiveCfg = ReleaseXBLV|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.ReleaseXNA4|Any CPU.ActiveCfg = ReleaseXNA4|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.ReleaseXNA4|Any CPU.Build.0 = ReleaseXNA4|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.ReleaseXNA4|Mixed Platforms.ActiveCfg = ReleaseXNA4|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.ReleaseXNA4|Mixed Platforms.Build.0 = ReleaseXNA4|Any CPU
- {0CCCF009-763F-40D2-8655-7A94828023BF}.ReleaseXNA4|x86.ActiveCfg = ReleaseXNA4|Any CPU
- {7A6EF49E-7946-4101-9C89-407B9C53A173}.Debug|Any CPU.ActiveCfg = DebugCF35|Any CPU
- {7A6EF49E-7946-4101-9C89-407B9C53A173}.Debug|Any CPU.Build.0 = DebugCF35|Any CPU
- {7A6EF49E-7946-4101-9C89-407B9C53A173}.Debug|Mixed Platforms.ActiveCfg = DebugCF35|Any CPU
- {7A6EF49E-7946-4101-9C89-407B9C53A173}.Debug|Mixed Platforms.Build.0 = DebugCF35|Any CPU
- {7A6EF49E-7946-4101-9C89-407B9C53A173}.Debug|x86.ActiveCfg = DebugCF35|Any CPU
- {7A6EF49E-7946-4101-9C89-407B9C53A173}.Debug35|Any CPU.ActiveCfg = Debug35|Any CPU
- {7A6EF49E-7946-4101-9C89-407B9C53A173}.Debug35|Any CPU.Build.0 = Debug35|Any CPU
- {7A6EF49E-7946-4101-9C89-407B9C53A173}.Debug35|Mixed Platforms.ActiveCfg = Debug35|Any CPU
- {7A6EF49E-7946-4101-9C89-407B9C53A173}.Debug35|Mixed Platforms.Build.0 = Debug35|Any CPU
- {7A6EF49E-7946-4101-9C89-407B9C53A173}.Debug35|x86.ActiveCfg = Debug35|Any CPU
- {7A6EF49E-7946-4101-9C89-407B9C53A173}.Debug40|Any CPU.ActiveCfg = Debug40|Any CPU
- {7A6EF49E-7946-4101-9C89-407B9C53A173}.Debug40|Any CPU.Build.0 = Debug40|Any CPU
- {7A6EF49E-7946-4101-9C89-407B9C53A173}.Debug40|Mixed Platforms.ActiveCfg = Debug40|Any CPU
- {7A6EF49E-7946-4101-9C89-407B9C53A173}.Debug40|Mixed Platforms.Build.0 = Debug40|Any CPU
- {7A6EF49E-7946-4101-9C89-407B9C53A173}.Debug40|x86.ActiveCfg = Debug40|Any CPU
- {7A6EF49E-7946-4101-9C89-407B9C53A173}.Debug45|Any CPU.ActiveCfg = Debug45|Any CPU
- {7A6EF49E-7946-4101-9C89-407B9C53A173}.Debug45|Any CPU.Build.0 = Debug45|Any CPU
- {7A6EF49E-7946-4101-9C89-407B9C53A173}.Debug45|Mixed Platforms.ActiveCfg = Debug45|Any CPU
- {7A6EF49E-7946-4101-9C89-407B9C53A173}.Debug45|Mixed Platforms.Build.0 = Debug45|Any CPU
- {7A6EF49E-7946-4101-9C89-407B9C53A173}.Debug45|x86.ActiveCfg = Debug45|Any CPU
- {7A6EF49E-7946-4101-9C89-407B9C53A173}.Debug8|Any CPU.ActiveCfg = Debug8|Any CPU
- {7A6EF49E-7946-4101-9C89-407B9C53A173}.Debug8|Mixed Platforms.ActiveCfg = Debug8|Any CPU
- {7A6EF49E-7946-4101-9C89-407B9C53A173}.Debug8|x86.ActiveCfg = Debug8|Any CPU
- {7A6EF49E-7946-4101-9C89-407B9C53A173}.DebugCF35|Any CPU.ActiveCfg = DebugCF35|Any CPU
- {7A6EF49E-7946-4101-9C89-407B9C53A173}.DebugCF35|Mixed Platforms.ActiveCfg = DebugCF35|Any CPU
- {7A6EF49E-7946-4101-9C89-407B9C53A173}.DebugCF35|x86.ActiveCfg = DebugCF35|Any CPU
- {7A6EF49E-7946-4101-9C89-407B9C53A173}.DebugPL|Any CPU.ActiveCfg = DebugPL|Any CPU
- {7A6EF49E-7946-4101-9C89-407B9C53A173}.DebugPL|Mixed Platforms.ActiveCfg = DebugPL|Any CPU
- {7A6EF49E-7946-4101-9C89-407B9C53A173}.DebugPL|x86.ActiveCfg = DebugPL|Any CPU
- {7A6EF49E-7946-4101-9C89-407B9C53A173}.DebugSL3|Any CPU.ActiveCfg = DebugSL3|Any CPU
- {7A6EF49E-7946-4101-9C89-407B9C53A173}.DebugSL3|Mixed Platforms.ActiveCfg = DebugSL3|Any CPU
- {7A6EF49E-7946-4101-9C89-407B9C53A173}.DebugSL3|x86.ActiveCfg = DebugSL3|Any CPU
- {7A6EF49E-7946-4101-9C89-407B9C53A173}.DebugSL4|Any CPU.ActiveCfg = DebugSL4|Any CPU
- {7A6EF49E-7946-4101-9C89-407B9C53A173}.DebugSL4|Mixed Platforms.ActiveCfg = DebugSL4|Any CPU
- {7A6EF49E-7946-4101-9C89-407B9C53A173}.DebugSL4|x86.ActiveCfg = DebugSL4|Any CPU
- {7A6EF49E-7946-4101-9C89-407B9C53A173}.DebugSL5|Any CPU.ActiveCfg = DebugSL5|Any CPU
- {7A6EF49E-7946-4101-9C89-407B9C53A173}.DebugSL5|Mixed Platforms.ActiveCfg = DebugSL5|Any CPU
- {7A6EF49E-7946-4101-9C89-407B9C53A173}.DebugSL5|x86.ActiveCfg = DebugSL5|Any CPU
- {7A6EF49E-7946-4101-9C89-407B9C53A173}.DebugWP7|Any CPU.ActiveCfg = DebugWP7|Any CPU
- {7A6EF49E-7946-4101-9C89-407B9C53A173}.DebugWP7|Mixed Platforms.ActiveCfg = DebugWP7|Any CPU
- {7A6EF49E-7946-4101-9C89-407B9C53A173}.DebugWP7|x86.ActiveCfg = DebugWP7|Any CPU
- {7A6EF49E-7946-4101-9C89-407B9C53A173}.DebugWP8|Any CPU.ActiveCfg = DebugWP8|Any CPU
- {7A6EF49E-7946-4101-9C89-407B9C53A173}.DebugWP8|Mixed Platforms.ActiveCfg = DebugWP8|Any CPU
- {7A6EF49E-7946-4101-9C89-407B9C53A173}.DebugWP8|x86.ActiveCfg = DebugWP8|Any CPU
- {7A6EF49E-7946-4101-9C89-407B9C53A173}.DebugXBLV|Any CPU.ActiveCfg = DebugXBLV|Any CPU
- {7A6EF49E-7946-4101-9C89-407B9C53A173}.DebugXBLV|Mixed Platforms.ActiveCfg = DebugXBLV|Any CPU
- {7A6EF49E-7946-4101-9C89-407B9C53A173}.DebugXBLV|Mixed Platforms.Build.0 = DebugXBLV|Any CPU
- {7A6EF49E-7946-4101-9C89-407B9C53A173}.DebugXBLV|x86.ActiveCfg = DebugXBLV|Any CPU
- {7A6EF49E-7946-4101-9C89-407B9C53A173}.DebugXNA4|Any CPU.ActiveCfg = DebugXNA4|Any CPU
- {7A6EF49E-7946-4101-9C89-407B9C53A173}.DebugXNA4|Mixed Platforms.ActiveCfg = DebugXNA4|Any CPU
- {7A6EF49E-7946-4101-9C89-407B9C53A173}.DebugXNA4|x86.ActiveCfg = DebugXNA4|Any CPU
- {7A6EF49E-7946-4101-9C89-407B9C53A173}.Release|Any CPU.ActiveCfg = ReleaseCF35|Any CPU
- {7A6EF49E-7946-4101-9C89-407B9C53A173}.Release|Any CPU.Build.0 = ReleaseCF35|Any CPU
- {7A6EF49E-7946-4101-9C89-407B9C53A173}.Release|Mixed Platforms.ActiveCfg = ReleaseCF35|Any CPU
- {7A6EF49E-7946-4101-9C89-407B9C53A173}.Release|Mixed Platforms.Build.0 = ReleaseCF35|Any CPU
- {7A6EF49E-7946-4101-9C89-407B9C53A173}.Release|x86.ActiveCfg = ReleaseCF35|Any CPU
- {7A6EF49E-7946-4101-9C89-407B9C53A173}.Release35|Any CPU.ActiveCfg = Release35|Any CPU
- {7A6EF49E-7946-4101-9C89-407B9C53A173}.Release35|Any CPU.Build.0 = Release35|Any CPU
- {7A6EF49E-7946-4101-9C89-407B9C53A173}.Release35|Mixed Platforms.ActiveCfg = Release35|Any CPU
- {7A6EF49E-7946-4101-9C89-407B9C53A173}.Release35|Mixed Platforms.Build.0 = Release35|Any CPU
- {7A6EF49E-7946-4101-9C89-407B9C53A173}.Release35|x86.ActiveCfg = Release35|Any CPU
- {7A6EF49E-7946-4101-9C89-407B9C53A173}.Release40|Any CPU.ActiveCfg = Release40|Any CPU
- {7A6EF49E-7946-4101-9C89-407B9C53A173}.Release40|Any CPU.Build.0 = Release40|Any CPU
- {7A6EF49E-7946-4101-9C89-407B9C53A173}.Release40|Mixed Platforms.ActiveCfg = Release40|Any CPU
- {7A6EF49E-7946-4101-9C89-407B9C53A173}.Release40|Mixed Platforms.Build.0 = Release40|Any CPU
- {7A6EF49E-7946-4101-9C89-407B9C53A173}.Release40|x86.ActiveCfg = Release40|Any CPU
- {7A6EF49E-7946-4101-9C89-407B9C53A173}.Release45|Any CPU.ActiveCfg = Release45|Any CPU
- {7A6EF49E-7946-4101-9C89-407B9C53A173}.Release45|Any CPU.Build.0 = Release45|Any CPU
- {7A6EF49E-7946-4101-9C89-407B9C53A173}.Release45|Mixed Platforms.ActiveCfg = Release45|Any CPU
- {7A6EF49E-7946-4101-9C89-407B9C53A173}.Release45|Mixed Platforms.Build.0 = Release45|Any CPU
- {7A6EF49E-7946-4101-9C89-407B9C53A173}.Release45|x86.ActiveCfg = Release45|Any CPU
- {7A6EF49E-7946-4101-9C89-407B9C53A173}.Release8|Any CPU.ActiveCfg = Release8|Any CPU
- {7A6EF49E-7946-4101-9C89-407B9C53A173}.Release8|Mixed Platforms.ActiveCfg = Release8|Any CPU
- {7A6EF49E-7946-4101-9C89-407B9C53A173}.Release8|x86.ActiveCfg = Release8|Any CPU
- {7A6EF49E-7946-4101-9C89-407B9C53A173}.ReleaseCF35|Any CPU.ActiveCfg = ReleaseCF35|Any CPU
- {7A6EF49E-7946-4101-9C89-407B9C53A173}.ReleaseCF35|Mixed Platforms.ActiveCfg = ReleaseCF35|Any CPU
- {7A6EF49E-7946-4101-9C89-407B9C53A173}.ReleaseCF35|x86.ActiveCfg = ReleaseCF35|Any CPU
- {7A6EF49E-7946-4101-9C89-407B9C53A173}.ReleasePL|Any CPU.ActiveCfg = ReleasePL|Any CPU
- {7A6EF49E-7946-4101-9C89-407B9C53A173}.ReleasePL|Mixed Platforms.ActiveCfg = ReleasePL|Any CPU
- {7A6EF49E-7946-4101-9C89-407B9C53A173}.ReleasePL|x86.ActiveCfg = ReleasePL|Any CPU
- {7A6EF49E-7946-4101-9C89-407B9C53A173}.ReleaseSL3|Any CPU.ActiveCfg = ReleaseSL3|Any CPU
- {7A6EF49E-7946-4101-9C89-407B9C53A173}.ReleaseSL3|Mixed Platforms.ActiveCfg = ReleaseSL3|Any CPU
- {7A6EF49E-7946-4101-9C89-407B9C53A173}.ReleaseSL3|x86.ActiveCfg = ReleaseSL3|Any CPU
- {7A6EF49E-7946-4101-9C89-407B9C53A173}.ReleaseSL4|Any CPU.ActiveCfg = ReleaseSL4|Any CPU
- {7A6EF49E-7946-4101-9C89-407B9C53A173}.ReleaseSL4|Mixed Platforms.ActiveCfg = ReleaseSL4|Any CPU
- {7A6EF49E-7946-4101-9C89-407B9C53A173}.ReleaseSL4|x86.ActiveCfg = ReleaseSL4|Any CPU
- {7A6EF49E-7946-4101-9C89-407B9C53A173}.ReleaseSL5|Any CPU.ActiveCfg = ReleaseSL5|Any CPU
- {7A6EF49E-7946-4101-9C89-407B9C53A173}.ReleaseSL5|Mixed Platforms.ActiveCfg = ReleaseSL5|Any CPU
- {7A6EF49E-7946-4101-9C89-407B9C53A173}.ReleaseSL5|x86.ActiveCfg = ReleaseSL5|Any CPU
- {7A6EF49E-7946-4101-9C89-407B9C53A173}.ReleaseWP7|Any CPU.ActiveCfg = ReleaseWP7|Any CPU
- {7A6EF49E-7946-4101-9C89-407B9C53A173}.ReleaseWP7|Mixed Platforms.ActiveCfg = ReleaseWP7|Any CPU
- {7A6EF49E-7946-4101-9C89-407B9C53A173}.ReleaseWP7|x86.ActiveCfg = ReleaseWP7|Any CPU
- {7A6EF49E-7946-4101-9C89-407B9C53A173}.ReleaseWP8|Any CPU.ActiveCfg = ReleaseWP8|Any CPU
- {7A6EF49E-7946-4101-9C89-407B9C53A173}.ReleaseWP8|Mixed Platforms.ActiveCfg = ReleaseWP8|Any CPU
- {7A6EF49E-7946-4101-9C89-407B9C53A173}.ReleaseWP8|x86.ActiveCfg = ReleaseWP8|Any CPU
- {7A6EF49E-7946-4101-9C89-407B9C53A173}.ReleaseXBLV|Any CPU.ActiveCfg = ReleaseXBLV|Any CPU
- {7A6EF49E-7946-4101-9C89-407B9C53A173}.ReleaseXBLV|Mixed Platforms.ActiveCfg = ReleaseXBLV|Any CPU
- {7A6EF49E-7946-4101-9C89-407B9C53A173}.ReleaseXBLV|Mixed Platforms.Build.0 = ReleaseXBLV|Any CPU
- {7A6EF49E-7946-4101-9C89-407B9C53A173}.ReleaseXBLV|x86.ActiveCfg = ReleaseXBLV|Any CPU
- {7A6EF49E-7946-4101-9C89-407B9C53A173}.ReleaseXNA4|Any CPU.ActiveCfg = ReleaseXNA4|Any CPU
- {7A6EF49E-7946-4101-9C89-407B9C53A173}.ReleaseXNA4|Mixed Platforms.ActiveCfg = ReleaseXNA4|Any CPU
- {7A6EF49E-7946-4101-9C89-407B9C53A173}.ReleaseXNA4|x86.ActiveCfg = ReleaseXNA4|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.Debug|Any CPU.ActiveCfg = DebugCF35|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.Debug|Any CPU.Build.0 = DebugCF35|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.Debug|Mixed Platforms.ActiveCfg = DebugCF35|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.Debug|Mixed Platforms.Build.0 = DebugCF35|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.Debug|x86.ActiveCfg = DebugCF35|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.Debug35|Any CPU.ActiveCfg = Debug35|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.Debug35|Any CPU.Build.0 = Debug35|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.Debug35|Mixed Platforms.ActiveCfg = Debug35|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.Debug35|Mixed Platforms.Build.0 = Debug35|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.Debug35|x86.ActiveCfg = Debug35|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.Debug40|Any CPU.ActiveCfg = Debug40|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.Debug40|Any CPU.Build.0 = Debug40|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.Debug40|Mixed Platforms.ActiveCfg = Debug40|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.Debug40|Mixed Platforms.Build.0 = Debug40|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.Debug40|x86.ActiveCfg = Debug40|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.Debug45|Any CPU.ActiveCfg = DebugPL|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.Debug45|Any CPU.Build.0 = DebugPL|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.Debug45|Mixed Platforms.ActiveCfg = Debug45|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.Debug45|Mixed Platforms.Build.0 = Debug45|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.Debug45|x86.ActiveCfg = Debug45|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.Debug8|Any CPU.ActiveCfg = DebugPL|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.Debug8|Any CPU.Build.0 = DebugPL|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.Debug8|Mixed Platforms.ActiveCfg = Debug8|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.Debug8|Mixed Platforms.Build.0 = Debug8|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.Debug8|x86.ActiveCfg = Debug8|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.DebugCF35|Any CPU.ActiveCfg = DebugCF35|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.DebugCF35|Any CPU.Build.0 = DebugCF35|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.DebugCF35|Mixed Platforms.ActiveCfg = DebugCF35|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.DebugCF35|Mixed Platforms.Build.0 = DebugCF35|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.DebugCF35|x86.ActiveCfg = DebugCF35|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.DebugPL|Any CPU.ActiveCfg = DebugPL|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.DebugPL|Any CPU.Build.0 = DebugPL|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.DebugPL|Mixed Platforms.ActiveCfg = DebugPL|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.DebugPL|Mixed Platforms.Build.0 = DebugPL|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.DebugPL|x86.ActiveCfg = DebugPL|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.DebugSL3|Any CPU.ActiveCfg = DebugSL3|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.DebugSL3|Any CPU.Build.0 = DebugSL3|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.DebugSL3|Mixed Platforms.ActiveCfg = DebugSL3|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.DebugSL3|Mixed Platforms.Build.0 = DebugSL3|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.DebugSL3|x86.ActiveCfg = DebugSL3|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.DebugSL4|Any CPU.ActiveCfg = DebugSL4|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.DebugSL4|Any CPU.Build.0 = DebugSL4|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.DebugSL4|Mixed Platforms.ActiveCfg = DebugSL4|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.DebugSL4|Mixed Platforms.Build.0 = DebugSL4|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.DebugSL4|x86.ActiveCfg = DebugSL4|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.DebugSL5|Any CPU.ActiveCfg = DebugSL5|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.DebugSL5|Any CPU.Build.0 = DebugSL5|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.DebugSL5|Mixed Platforms.ActiveCfg = DebugSL5|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.DebugSL5|Mixed Platforms.Build.0 = DebugSL5|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.DebugSL5|x86.ActiveCfg = DebugSL5|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.DebugWP7|Any CPU.ActiveCfg = DebugWP7|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.DebugWP7|Any CPU.Build.0 = DebugWP7|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.DebugWP7|Mixed Platforms.ActiveCfg = DebugWP7|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.DebugWP7|Mixed Platforms.Build.0 = DebugWP7|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.DebugWP7|x86.ActiveCfg = DebugWP7|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.DebugWP8|Any CPU.ActiveCfg = DebugPL|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.DebugWP8|Any CPU.Build.0 = DebugPL|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.DebugWP8|Mixed Platforms.ActiveCfg = DebugWP8|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.DebugWP8|Mixed Platforms.Build.0 = DebugWP8|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.DebugWP8|x86.ActiveCfg = DebugWP8|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.DebugXBLV|Any CPU.ActiveCfg = DebugXBLV|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.DebugXBLV|Any CPU.Build.0 = DebugXBLV|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.DebugXBLV|Mixed Platforms.ActiveCfg = DebugXBLV|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.DebugXBLV|Mixed Platforms.Build.0 = DebugXBLV|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.DebugXBLV|x86.ActiveCfg = DebugXBLV|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.DebugXNA4|Any CPU.ActiveCfg = DebugXNA4|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.DebugXNA4|Any CPU.Build.0 = DebugXNA4|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.DebugXNA4|Mixed Platforms.ActiveCfg = DebugXNA4|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.DebugXNA4|Mixed Platforms.Build.0 = DebugXNA4|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.DebugXNA4|x86.ActiveCfg = DebugXNA4|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.Release|Any CPU.ActiveCfg = ReleaseCF35|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.Release|Any CPU.Build.0 = ReleaseCF35|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.Release|Mixed Platforms.ActiveCfg = ReleaseCF35|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.Release|Mixed Platforms.Build.0 = ReleaseCF35|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.Release|x86.ActiveCfg = ReleaseCF35|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.Release35|Any CPU.ActiveCfg = Release35|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.Release35|Any CPU.Build.0 = Release35|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.Release35|Mixed Platforms.ActiveCfg = Release35|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.Release35|Mixed Platforms.Build.0 = Release35|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.Release35|x86.ActiveCfg = Release35|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.Release40|Any CPU.ActiveCfg = Release40|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.Release40|Any CPU.Build.0 = Release40|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.Release40|Mixed Platforms.ActiveCfg = Release40|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.Release40|Mixed Platforms.Build.0 = Release40|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.Release40|x86.ActiveCfg = Release40|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.Release45|Any CPU.ActiveCfg = ReleasePL|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.Release45|Any CPU.Build.0 = ReleasePL|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.Release45|Mixed Platforms.ActiveCfg = Release45|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.Release45|Mixed Platforms.Build.0 = Release45|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.Release45|x86.ActiveCfg = Release45|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.Release8|Any CPU.ActiveCfg = ReleasePL|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.Release8|Any CPU.Build.0 = ReleasePL|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.Release8|Mixed Platforms.ActiveCfg = Release8|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.Release8|Mixed Platforms.Build.0 = Release8|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.Release8|x86.ActiveCfg = Release8|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.ReleaseCF35|Any CPU.ActiveCfg = ReleaseCF35|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.ReleaseCF35|Any CPU.Build.0 = ReleaseCF35|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.ReleaseCF35|Mixed Platforms.ActiveCfg = ReleaseCF35|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.ReleaseCF35|Mixed Platforms.Build.0 = ReleaseCF35|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.ReleaseCF35|x86.ActiveCfg = ReleaseCF35|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.ReleasePL|Any CPU.ActiveCfg = ReleasePL|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.ReleasePL|Any CPU.Build.0 = ReleasePL|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.ReleasePL|Mixed Platforms.ActiveCfg = ReleasePL|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.ReleasePL|Mixed Platforms.Build.0 = ReleasePL|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.ReleasePL|x86.ActiveCfg = ReleasePL|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.ReleaseSL3|Any CPU.ActiveCfg = ReleaseSL3|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.ReleaseSL3|Any CPU.Build.0 = ReleaseSL3|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.ReleaseSL3|Mixed Platforms.ActiveCfg = ReleaseSL3|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.ReleaseSL3|Mixed Platforms.Build.0 = ReleaseSL3|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.ReleaseSL3|x86.ActiveCfg = ReleaseSL3|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.ReleaseSL4|Any CPU.ActiveCfg = ReleaseSL4|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.ReleaseSL4|Any CPU.Build.0 = ReleaseSL4|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.ReleaseSL4|Mixed Platforms.ActiveCfg = ReleaseSL4|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.ReleaseSL4|Mixed Platforms.Build.0 = ReleaseSL4|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.ReleaseSL4|x86.ActiveCfg = ReleaseSL4|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.ReleaseSL5|Any CPU.ActiveCfg = ReleaseSL5|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.ReleaseSL5|Any CPU.Build.0 = ReleaseSL5|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.ReleaseSL5|Mixed Platforms.ActiveCfg = ReleaseSL5|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.ReleaseSL5|Mixed Platforms.Build.0 = ReleaseSL5|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.ReleaseSL5|x86.ActiveCfg = ReleaseSL5|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.ReleaseWP7|Any CPU.ActiveCfg = ReleaseWP7|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.ReleaseWP7|Any CPU.Build.0 = ReleaseWP7|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.ReleaseWP7|Mixed Platforms.ActiveCfg = ReleaseWP7|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.ReleaseWP7|Mixed Platforms.Build.0 = ReleaseWP7|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.ReleaseWP7|x86.ActiveCfg = ReleaseWP7|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.ReleaseWP8|Any CPU.ActiveCfg = ReleasePL|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.ReleaseWP8|Any CPU.Build.0 = ReleasePL|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.ReleaseWP8|Mixed Platforms.ActiveCfg = ReleaseWP8|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.ReleaseWP8|Mixed Platforms.Build.0 = ReleaseWP8|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.ReleaseWP8|x86.ActiveCfg = ReleaseWP8|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.ReleaseXBLV|Any CPU.ActiveCfg = ReleaseXBLV|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.ReleaseXBLV|Any CPU.Build.0 = ReleaseXBLV|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.ReleaseXBLV|Mixed Platforms.ActiveCfg = ReleaseXBLV|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.ReleaseXBLV|Mixed Platforms.Build.0 = ReleaseXBLV|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.ReleaseXBLV|x86.ActiveCfg = ReleaseXBLV|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.ReleaseXNA4|Any CPU.ActiveCfg = ReleaseXNA4|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.ReleaseXNA4|Any CPU.Build.0 = ReleaseXNA4|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.ReleaseXNA4|Mixed Platforms.ActiveCfg = ReleaseXNA4|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.ReleaseXNA4|Mixed Platforms.Build.0 = ReleaseXNA4|Any CPU
- {41E65B96-733B-41C4-A1BB-7476359B89EB}.ReleaseXNA4|x86.ActiveCfg = ReleaseXNA4|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.Debug|Any CPU.ActiveCfg = DebugCF35|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.Debug|Any CPU.Build.0 = DebugCF35|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.Debug|Mixed Platforms.ActiveCfg = DebugCF35|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.Debug|Mixed Platforms.Build.0 = DebugCF35|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.Debug|x86.ActiveCfg = DebugCF35|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.Debug35|Any CPU.ActiveCfg = Debug35|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.Debug35|Any CPU.Build.0 = Debug35|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.Debug35|Mixed Platforms.ActiveCfg = Debug35|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.Debug35|Mixed Platforms.Build.0 = Debug35|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.Debug35|x86.ActiveCfg = Debug35|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.Debug40|Any CPU.ActiveCfg = Debug40|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.Debug40|Any CPU.Build.0 = Debug40|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.Debug40|Mixed Platforms.ActiveCfg = Debug40|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.Debug40|Mixed Platforms.Build.0 = Debug40|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.Debug40|x86.ActiveCfg = Debug40|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.Debug45|Any CPU.ActiveCfg = Debug45|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.Debug45|Any CPU.Build.0 = Debug45|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.Debug45|Mixed Platforms.ActiveCfg = Debug45|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.Debug45|Mixed Platforms.Build.0 = Debug45|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.Debug45|x86.ActiveCfg = Debug45|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.Debug8|Any CPU.ActiveCfg = Debug8|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.Debug8|Any CPU.Build.0 = Debug8|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.Debug8|Mixed Platforms.ActiveCfg = Debug8|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.Debug8|Mixed Platforms.Build.0 = Debug8|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.Debug8|x86.ActiveCfg = Debug8|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.DebugCF35|Any CPU.ActiveCfg = DebugCF35|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.DebugCF35|Any CPU.Build.0 = DebugCF35|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.DebugCF35|Mixed Platforms.ActiveCfg = DebugCF35|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.DebugCF35|Mixed Platforms.Build.0 = DebugCF35|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.DebugCF35|x86.ActiveCfg = DebugCF35|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.DebugPL|Any CPU.ActiveCfg = DebugPL|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.DebugPL|Any CPU.Build.0 = DebugPL|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.DebugPL|Mixed Platforms.ActiveCfg = DebugPL|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.DebugPL|Mixed Platforms.Build.0 = DebugPL|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.DebugPL|x86.ActiveCfg = DebugPL|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.DebugSL3|Any CPU.ActiveCfg = DebugSL3|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.DebugSL3|Any CPU.Build.0 = DebugSL3|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.DebugSL3|Mixed Platforms.ActiveCfg = DebugSL3|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.DebugSL3|Mixed Platforms.Build.0 = DebugSL3|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.DebugSL3|x86.ActiveCfg = DebugSL3|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.DebugSL4|Any CPU.ActiveCfg = DebugSL4|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.DebugSL4|Any CPU.Build.0 = DebugSL4|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.DebugSL4|Mixed Platforms.ActiveCfg = DebugSL4|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.DebugSL4|Mixed Platforms.Build.0 = DebugSL4|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.DebugSL4|x86.ActiveCfg = DebugSL4|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.DebugSL5|Any CPU.ActiveCfg = DebugSL5|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.DebugSL5|Any CPU.Build.0 = DebugSL5|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.DebugSL5|Mixed Platforms.ActiveCfg = DebugSL5|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.DebugSL5|Mixed Platforms.Build.0 = DebugSL5|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.DebugSL5|x86.ActiveCfg = DebugSL5|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.DebugWP7|Any CPU.ActiveCfg = DebugWP7|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.DebugWP7|Any CPU.Build.0 = DebugWP7|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.DebugWP7|Mixed Platforms.ActiveCfg = DebugWP7|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.DebugWP7|Mixed Platforms.Build.0 = DebugWP7|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.DebugWP7|x86.ActiveCfg = DebugWP7|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.DebugWP8|Any CPU.ActiveCfg = DebugWP8|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.DebugWP8|Any CPU.Build.0 = DebugWP8|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.DebugWP8|Mixed Platforms.ActiveCfg = DebugWP8|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.DebugWP8|Mixed Platforms.Build.0 = DebugWP8|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.DebugWP8|x86.ActiveCfg = DebugWP8|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.DebugXBLV|Any CPU.ActiveCfg = DebugXBLV|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.DebugXBLV|Any CPU.Build.0 = DebugXBLV|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.DebugXBLV|Mixed Platforms.ActiveCfg = DebugXBLV|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.DebugXBLV|Mixed Platforms.Build.0 = DebugXBLV|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.DebugXBLV|x86.ActiveCfg = DebugXBLV|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.DebugXNA4|Any CPU.ActiveCfg = DebugXNA4|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.DebugXNA4|Any CPU.Build.0 = DebugXNA4|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.DebugXNA4|Mixed Platforms.ActiveCfg = DebugXNA4|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.DebugXNA4|Mixed Platforms.Build.0 = DebugXNA4|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.DebugXNA4|x86.ActiveCfg = DebugXNA4|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.Release|Any CPU.ActiveCfg = ReleaseCF35|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.Release|Any CPU.Build.0 = ReleaseCF35|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.Release|Mixed Platforms.ActiveCfg = ReleaseCF35|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.Release|Mixed Platforms.Build.0 = ReleaseCF35|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.Release|x86.ActiveCfg = ReleaseCF35|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.Release35|Any CPU.ActiveCfg = Release35|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.Release35|Any CPU.Build.0 = Release35|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.Release35|Mixed Platforms.ActiveCfg = Release35|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.Release35|Mixed Platforms.Build.0 = Release35|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.Release35|x86.ActiveCfg = Release35|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.Release40|Any CPU.ActiveCfg = Release40|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.Release40|Any CPU.Build.0 = Release40|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.Release40|Mixed Platforms.ActiveCfg = Release40|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.Release40|Mixed Platforms.Build.0 = Release40|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.Release40|x86.ActiveCfg = Release40|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.Release45|Any CPU.ActiveCfg = Release45|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.Release45|Any CPU.Build.0 = Release45|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.Release45|Mixed Platforms.ActiveCfg = Release45|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.Release45|Mixed Platforms.Build.0 = Release45|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.Release45|x86.ActiveCfg = Release45|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.Release8|Any CPU.ActiveCfg = Release8|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.Release8|Any CPU.Build.0 = Release8|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.Release8|Mixed Platforms.ActiveCfg = Release8|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.Release8|Mixed Platforms.Build.0 = Release8|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.Release8|x86.ActiveCfg = Release8|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.ReleaseCF35|Any CPU.ActiveCfg = ReleaseCF35|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.ReleaseCF35|Any CPU.Build.0 = ReleaseCF35|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.ReleaseCF35|Mixed Platforms.ActiveCfg = ReleaseCF35|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.ReleaseCF35|Mixed Platforms.Build.0 = ReleaseCF35|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.ReleaseCF35|x86.ActiveCfg = ReleaseCF35|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.ReleasePL|Any CPU.ActiveCfg = ReleasePL|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.ReleasePL|Any CPU.Build.0 = ReleasePL|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.ReleasePL|Mixed Platforms.ActiveCfg = ReleasePL|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.ReleasePL|Mixed Platforms.Build.0 = ReleasePL|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.ReleasePL|x86.ActiveCfg = ReleasePL|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.ReleaseSL3|Any CPU.ActiveCfg = ReleaseSL3|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.ReleaseSL3|Any CPU.Build.0 = ReleaseSL3|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.ReleaseSL3|Mixed Platforms.ActiveCfg = ReleaseSL3|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.ReleaseSL3|Mixed Platforms.Build.0 = ReleaseSL3|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.ReleaseSL3|x86.ActiveCfg = ReleaseSL3|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.ReleaseSL4|Any CPU.ActiveCfg = ReleaseSL4|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.ReleaseSL4|Any CPU.Build.0 = ReleaseSL4|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.ReleaseSL4|Mixed Platforms.ActiveCfg = ReleaseSL4|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.ReleaseSL4|Mixed Platforms.Build.0 = ReleaseSL4|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.ReleaseSL4|x86.ActiveCfg = ReleaseSL4|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.ReleaseSL5|Any CPU.ActiveCfg = ReleaseSL5|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.ReleaseSL5|Any CPU.Build.0 = ReleaseSL5|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.ReleaseSL5|Mixed Platforms.ActiveCfg = ReleaseSL5|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.ReleaseSL5|Mixed Platforms.Build.0 = ReleaseSL5|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.ReleaseSL5|x86.ActiveCfg = ReleaseSL5|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.ReleaseWP7|Any CPU.ActiveCfg = ReleaseWP7|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.ReleaseWP7|Any CPU.Build.0 = ReleaseWP7|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.ReleaseWP7|Mixed Platforms.ActiveCfg = ReleaseWP7|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.ReleaseWP7|Mixed Platforms.Build.0 = ReleaseWP7|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.ReleaseWP7|x86.ActiveCfg = ReleaseWP7|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.ReleaseWP8|Any CPU.ActiveCfg = ReleaseWP8|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.ReleaseWP8|Any CPU.Build.0 = ReleaseWP8|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.ReleaseWP8|Mixed Platforms.ActiveCfg = ReleaseWP8|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.ReleaseWP8|Mixed Platforms.Build.0 = ReleaseWP8|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.ReleaseWP8|x86.ActiveCfg = ReleaseWP8|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.ReleaseXBLV|Any CPU.ActiveCfg = ReleaseXBLV|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.ReleaseXBLV|Any CPU.Build.0 = ReleaseXBLV|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.ReleaseXBLV|Mixed Platforms.ActiveCfg = ReleaseXBLV|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.ReleaseXBLV|Mixed Platforms.Build.0 = ReleaseXBLV|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.ReleaseXBLV|x86.ActiveCfg = ReleaseXBLV|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.ReleaseXNA4|Any CPU.ActiveCfg = ReleaseXNA4|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.ReleaseXNA4|Any CPU.Build.0 = ReleaseXNA4|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.ReleaseXNA4|Mixed Platforms.ActiveCfg = ReleaseXNA4|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.ReleaseXNA4|Mixed Platforms.Build.0 = ReleaseXNA4|Any CPU
- {FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}.ReleaseXNA4|x86.ActiveCfg = ReleaseXNA4|Any CPU
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
-EndGlobal
diff --git a/Rx.NET/Rx.userprefs b/Rx.NET/Rx.userprefs
deleted file mode 100644
index 8a063db..0000000
--- a/Rx.NET/Rx.userprefs
+++ /dev/null
@@ -1,8 +0,0 @@
-<Properties>
- <MonoDevelop.Ide.Workspace ActiveConfiguration="Debug" />
- <MonoDevelop.Ide.Workbench />
- <MonoDevelop.Ide.DebuggingService.Breakpoints>
- <BreakpointStore />
- </MonoDevelop.Ide.DebuggingService.Breakpoints>
- <MonoDevelop.Ide.DebuggingService.PinnedWatches />
-</Properties> \ No newline at end of file
diff --git a/Rx.NET/Rx.vsmdi b/Rx.NET/Rx.vsmdi
deleted file mode 100644
index 5c9cd67..0000000
--- a/Rx.NET/Rx.vsmdi
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<TestLists xmlns="http://microsoft.com/schemas/VisualStudio/TeamTest/2010">
- <TestList name="Lists of Tests" id="8c43106b-9dc1-4907-a29f-aa66a61bf5b6">
- <RunConfiguration id="a2f63e98-7f97-4ca7-9d25-6313d3452023" name="Local" storage="local.testsettings" type="Microsoft.VisualStudio.TestTools.Common.TestRunConfiguration, Microsoft.VisualStudio.QualityTools.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
- </TestList>
-</TestLists> \ No newline at end of file
diff --git a/Rx.NET/Rx.vssscc b/Rx.NET/Rx.vssscc
deleted file mode 100644
index 6cb031b..0000000
--- a/Rx.NET/Rx.vssscc
+++ /dev/null
@@ -1,10 +0,0 @@
-""
-{
-"FILE_VERSION" = "9237"
-"ENLISTMENT_CHOICE" = "NEVER"
-"PROJECT_FILE_RELATIVE_PATH" = ""
-"NUMBER_OF_EXCLUDED_FILES" = "0"
-"ORIGINAL_PROJECT_FILE_PATH" = ""
-"NUMBER_OF_NESTED_PROJECTS" = "0"
-"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROJECT"
-}
diff --git a/Rx.NET/System.Reactive.Core/GlobalSuppressions.cs b/Rx.NET/System.Reactive.Core/GlobalSuppressions.cs
deleted file mode 100644
index e638f8d..0000000
--- a/Rx.NET/System.Reactive.Core/GlobalSuppressions.cs
+++ /dev/null
@@ -1,16 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-// This file is used by Code Analysis to maintain SuppressMessage
-// attributes that are applied to this project.
-// Project-level suppressions either have no target or are given
-// a specific target and scoped to a namespace, type, member, etc.
-//
-// To add a suppression to this file, right-click the message in the
-// Error List, point to "Suppress Message(s)", and click
-// "In Project Suppression File".
-// You do not need to add suppressions to this file manually.
-
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes", Scope = "namespace", Target = "System", Justification = "By design.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA2210:AssembliesShouldHaveValidStrongNames", Justification = "Taken care of by lab build.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1016:MarkAssembliesWithAssemblyVersion", Justification = "Taken care of by lab build.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0", Scope = "member", Target = "System.Reactive.Concurrency.LocalScheduler+WorkItem.#CompareTo(System.Reactive.Concurrency.LocalScheduler+WorkItem)", Justification = "Checked all enqueue operations against null reference insertions.")]
diff --git a/Rx.NET/System.Reactive.Core/InternalsVisibleTo.cs b/Rx.NET/System.Reactive.Core/InternalsVisibleTo.cs
deleted file mode 100644
index 52759ec..0000000
--- a/Rx.NET/System.Reactive.Core/InternalsVisibleTo.cs
+++ /dev/null
@@ -1,26 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System;
-
-#if SIGNED
-
-#if SIGNENHANCED // Key 272 for .NET 4.5 and beyond
-[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("System.Reactive.Debugger, PublicKey=002400000c80000014010000060200000024000052534131000800000100010085aad0bef0688d1b994a0d78e1fd29fc24ac34ed3d3ac3fb9b3d0c48386ba834aa880035060a8848b2d8adf58e670ed20914be3681a891c9c8c01eef2ab22872547c39be00af0e6c72485d7cfd1a51df8947d36ceba9989106b58abe79e6a3e71a01ed6bdc867012883e0b1a4d35b1b5eeed6df21e401bb0c22f2246ccb69979dc9e61eef262832ed0f2064853725a75485fa8a3efb7e027319c86dec03dc3b1bca2b5081bab52a627b9917450dfad534799e1c7af58683bdfa135f1518ff1ea60e90d7b993a6c87fd3dd93408e35d1296f9a7f9a97c5db56c0f3cc25ad11e9777f94d138b3cea53b9a8331c2e6dcb8d2ea94e18bf1163ff112a22dbd92d429a")]
-[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("System.Reactive.Experimental, PublicKey=002400000c80000014010000060200000024000052534131000800000100010085aad0bef0688d1b994a0d78e1fd29fc24ac34ed3d3ac3fb9b3d0c48386ba834aa880035060a8848b2d8adf58e670ed20914be3681a891c9c8c01eef2ab22872547c39be00af0e6c72485d7cfd1a51df8947d36ceba9989106b58abe79e6a3e71a01ed6bdc867012883e0b1a4d35b1b5eeed6df21e401bb0c22f2246ccb69979dc9e61eef262832ed0f2064853725a75485fa8a3efb7e027319c86dec03dc3b1bca2b5081bab52a627b9917450dfad534799e1c7af58683bdfa135f1518ff1ea60e90d7b993a6c87fd3dd93408e35d1296f9a7f9a97c5db56c0f3cc25ad11e9777f94d138b3cea53b9a8331c2e6dcb8d2ea94e18bf1163ff112a22dbd92d429a")]
-[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("System.Reactive.Linq, PublicKey=002400000c80000014010000060200000024000052534131000800000100010085aad0bef0688d1b994a0d78e1fd29fc24ac34ed3d3ac3fb9b3d0c48386ba834aa880035060a8848b2d8adf58e670ed20914be3681a891c9c8c01eef2ab22872547c39be00af0e6c72485d7cfd1a51df8947d36ceba9989106b58abe79e6a3e71a01ed6bdc867012883e0b1a4d35b1b5eeed6df21e401bb0c22f2246ccb69979dc9e61eef262832ed0f2064853725a75485fa8a3efb7e027319c86dec03dc3b1bca2b5081bab52a627b9917450dfad534799e1c7af58683bdfa135f1518ff1ea60e90d7b993a6c87fd3dd93408e35d1296f9a7f9a97c5db56c0f3cc25ad11e9777f94d138b3cea53b9a8331c2e6dcb8d2ea94e18bf1163ff112a22dbd92d429a")]
-[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("System.Reactive.PlatformServices, PublicKey=002400000c80000014010000060200000024000052534131000800000100010085aad0bef0688d1b994a0d78e1fd29fc24ac34ed3d3ac3fb9b3d0c48386ba834aa880035060a8848b2d8adf58e670ed20914be3681a891c9c8c01eef2ab22872547c39be00af0e6c72485d7cfd1a51df8947d36ceba9989106b58abe79e6a3e71a01ed6bdc867012883e0b1a4d35b1b5eeed6df21e401bb0c22f2246ccb69979dc9e61eef262832ed0f2064853725a75485fa8a3efb7e027319c86dec03dc3b1bca2b5081bab52a627b9917450dfad534799e1c7af58683bdfa135f1518ff1ea60e90d7b993a6c87fd3dd93408e35d1296f9a7f9a97c5db56c0f3cc25ad11e9777f94d138b3cea53b9a8331c2e6dcb8d2ea94e18bf1163ff112a22dbd92d429a")]
-#else // Key 35 for older platforms
-[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("System.Reactive.Debugger, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")]
-[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("System.Reactive.Experimental, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")]
-[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("System.Reactive.Linq, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")]
-[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("System.Reactive.PlatformServices, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")]
-#endif
-
-#else
-
-[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("System.Reactive.Debugger")]
-[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("System.Reactive.Experimental")]
-[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("System.Reactive.Linq")]
-[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("System.Reactive.PlatformServices")]
-
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Core/NamespaceDocs.cs b/Rx.NET/System.Reactive.Core/NamespaceDocs.cs
deleted file mode 100644
index b16ba10..0000000
--- a/Rx.NET/System.Reactive.Core/NamespaceDocs.cs
+++ /dev/null
@@ -1,13 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-namespace System.Reactive.PlatformServices
-{
- /// <summary>
- /// The <b>System.Reactive.PlatformServices</b> namespace contains interfaces and classes used by the runtime infrastructure of Reactive Extensions.
- /// Those are not intended to be used directly from user code and are subject to change in future releases of the product.
- /// </summary>
- [System.Runtime.CompilerServices.CompilerGeneratedAttribute]
- class NamespaceDoc
- {
- }
-} \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Core/Observable.Extensions.cs b/Rx.NET/System.Reactive.Core/Observable.Extensions.cs
deleted file mode 100644
index 975e156..0000000
--- a/Rx.NET/System.Reactive.Core/Observable.Extensions.cs
+++ /dev/null
@@ -1,195 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System.ComponentModel;
-using System.Reactive;
-using System.Reactive.Disposables;
-
-namespace System
-{
- /// <summary>
- /// Provides a set of static methods for subscribing delegates to observables.
- /// </summary>
- public static class ObservableExtensions
- {
- /// <summary>
- /// Subscribes to the observable sequence without specifying any handlers.
- /// This method can be used to evaluate the observable sequence for its side-effects only.
- /// </summary>
- /// <typeparam name="T">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Observable sequence to subscribe to.</param>
- /// <returns>IDisposable object used to unsubscribe from the observable sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- public static IDisposable Subscribe<T>(this IObservable<T> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- //
- // [OK] Use of unsafe Subscribe: non-pretentious constructor for an observer; this overload is not to be used internally.
- //
- return source.Subscribe/*Unsafe*/(new AnonymousObserver<T>(Stubs<T>.Ignore, Stubs.Throw, Stubs.Nop));
- }
-
- /// <summary>
- /// Subscribes an element handler to an observable sequence.
- /// </summary>
- /// <typeparam name="T">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Observable sequence to subscribe to.</param>
- /// <param name="onNext">Action to invoke for each element in the observable sequence.</param>
- /// <returns>IDisposable object used to unsubscribe from the observable sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="onNext"/> is null.</exception>
- public static IDisposable Subscribe<T>(this IObservable<T> source, Action<T> onNext)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (onNext == null)
- throw new ArgumentNullException("onNext");
-
- //
- // [OK] Use of unsafe Subscribe: non-pretentious constructor for an observer; this overload is not to be used internally.
- //
- return source.Subscribe/*Unsafe*/(new AnonymousObserver<T>(onNext, Stubs.Throw, Stubs.Nop));
- }
-
- /// <summary>
- /// Subscribes an element handler and an exception handler to an observable sequence.
- /// </summary>
- /// <typeparam name="T">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Observable sequence to subscribe to.</param>
- /// <param name="onNext">Action to invoke for each element in the observable sequence.</param>
- /// <param name="onError">Action to invoke upon exceptional termination of the observable sequence.</param>
- /// <returns>IDisposable object used to unsubscribe from the observable sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="onNext"/> or <paramref name="onError"/> is null.</exception>
- public static IDisposable Subscribe<T>(this IObservable<T> source, Action<T> onNext, Action<Exception> onError)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (onNext == null)
- throw new ArgumentNullException("onNext");
- if (onError == null)
- throw new ArgumentNullException("onError");
-
- //
- // [OK] Use of unsafe Subscribe: non-pretentious constructor for an observer; this overload is not to be used internally.
- //
- return source.Subscribe/*Unsafe*/(new AnonymousObserver<T>(onNext, onError, Stubs.Nop));
- }
-
- /// <summary>
- /// Subscribes an element handler and a completion handler to an observable sequence.
- /// </summary>
- /// <typeparam name="T">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Observable sequence to subscribe to.</param>
- /// <param name="onNext">Action to invoke for each element in the observable sequence.</param>
- /// <param name="onCompleted">Action to invoke upon graceful termination of the observable sequence.</param>
- /// <returns>IDisposable object used to unsubscribe from the observable sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="onNext"/> or <paramref name="onCompleted"/> is null.</exception>
- public static IDisposable Subscribe<T>(this IObservable<T> source, Action<T> onNext, Action onCompleted)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (onNext == null)
- throw new ArgumentNullException("onNext");
- if (onCompleted == null)
- throw new ArgumentNullException("onCompleted");
-
- //
- // [OK] Use of unsafe Subscribe: non-pretentious constructor for an observer; this overload is not to be used internally.
- //
- return source.Subscribe/*Unsafe*/(new AnonymousObserver<T>(onNext, Stubs.Throw, onCompleted));
- }
-
- /// <summary>
- /// Subscribes an element handler, an exception handler, and a completion handler to an observable sequence.
- /// </summary>
- /// <typeparam name="T">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Observable sequence to subscribe to.</param>
- /// <param name="onNext">Action to invoke for each element in the observable sequence.</param>
- /// <param name="onError">Action to invoke upon exceptional termination of the observable sequence.</param>
- /// <param name="onCompleted">Action to invoke upon graceful termination of the observable sequence.</param>
- /// <returns>IDisposable object used to unsubscribe from the observable sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="onNext"/> or <paramref name="onError"/> or <paramref name="onCompleted"/> is null.</exception>
- public static IDisposable Subscribe<T>(this IObservable<T> source, Action<T> onNext, Action<Exception> onError, Action onCompleted)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (onNext == null)
- throw new ArgumentNullException("onNext");
- if (onError == null)
- throw new ArgumentNullException("onError");
- if (onCompleted == null)
- throw new ArgumentNullException("onCompleted");
-
- //
- // [OK] Use of unsafe Subscribe: non-pretentious constructor for an observer; this overload is not to be used internally.
- //
- return source.Subscribe/*Unsafe*/(new AnonymousObserver<T>(onNext, onError, onCompleted));
- }
-
- /// <summary>
- /// Subscribes to the specified source, re-routing synchronous exceptions during invocation of the Subscribe method to the observer's OnError channel.
- /// This method is typically used when writing query operators.
- /// </summary>
- /// <typeparam name="T">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Observable sequence to subscribe to.</param>
- /// <param name="observer">Observer that will be passed to the observable sequence, and that will be used for exception propagation.</param>
- /// <returns>IDisposable object used to unsubscribe from the observable sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="observer"/> is null.</exception>
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- public static IDisposable SubscribeSafe<T>(this IObservable<T> source, IObserver<T> observer)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (observer == null)
- throw new ArgumentNullException("observer");
-
- //
- // The following types are white-listed and should not exhibit exceptional behavior
- // for regular operation circumstances.
- //
- if (source is ObservableBase<T>)
- return source.Subscribe(observer);
-
-#if !NO_PERF
- var producer = source as Producer<T>;
- if (producer != null)
- return producer.SubscribeRaw(observer, false);
-#endif
-
- var d = Disposable.Empty;
-
- try
- {
- d = source.Subscribe(observer);
- }
- catch (Exception exception)
- {
- //
- // The effect of redirecting the exception to the OnError channel is automatic
- // clean-up of query operator state for a large number of cases. For example,
- // consider a binary and temporal query operator with the following Subscribe
- // behavior (implemented using the Producer pattern with a Run method):
- //
- // public IDisposable Run(...)
- // {
- // var tm = _scheduler.Schedule(_due, Tick);
- //
- // var df = _fst.SubscribeSafe(new FstObserver(this, ...));
- // var ds = _snd.SubscribeSafe(new SndObserver(this, ...)); // <-- fails
- //
- // return new CompositeDisposable(tm, df, ds);
- // }
- //
- // If the second subscription fails, we're not leaving the first subscription
- // or the scheduled job hanging around. Instead, the OnError propagation to
- // the SndObserver should take care of a Dispose call to the observer's parent
- // object. The handshake between Producer and Sink objects will ultimately
- // cause disposal of the CompositeDisposable that's returned from the method.
- //
- observer.OnError(exception);
- }
-
- return d;
- }
- }
-}
diff --git a/Rx.NET/System.Reactive.Core/Observer.Extensions.cs b/Rx.NET/System.Reactive.Core/Observer.Extensions.cs
deleted file mode 100644
index f9abacc..0000000
--- a/Rx.NET/System.Reactive.Core/Observer.Extensions.cs
+++ /dev/null
@@ -1,344 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System.Reactive.Concurrency;
-using System.Threading;
-
-namespace System.Reactive
-{
- /// <summary>
- /// Provides a set of static methods for creating observers.
- /// </summary>
- public static class Observer
- {
- /// <summary>
- /// Creates an observer from a notification callback.
- /// </summary>
- /// <typeparam name="T">The type of the elements received by the observer.</typeparam>
- /// <param name="handler">Action that handles a notification.</param>
- /// <returns>The observer object that invokes the specified handler using a notification corresponding to each message it receives.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="handler"/> is null.</exception>
- public static IObserver<T> ToObserver<T>(this Action<Notification<T>> handler)
- {
- if (handler == null)
- throw new ArgumentNullException("handler");
-
- return new AnonymousObserver<T>(
- x => handler(Notification.CreateOnNext<T>(x)),
- exception => handler(Notification.CreateOnError<T>(exception)),
- () => handler(Notification.CreateOnCompleted<T>())
- );
- }
-
- /// <summary>
- /// Creates a notification callback from an observer.
- /// </summary>
- /// <typeparam name="T">The type of the elements received by the observer.</typeparam>
- /// <param name="observer">Observer object.</param>
- /// <returns>The action that forwards its input notification to the underlying observer.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="observer"/> is null.</exception>
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Notifier", Justification = "Backward compat.")]
- public static Action<Notification<T>> ToNotifier<T>(this IObserver<T> observer)
- {
- if (observer == null)
- throw new ArgumentNullException("observer");
-
- return n => n.Accept(observer);
- }
-
- /// <summary>
- /// Creates an observer from the specified OnNext action.
- /// </summary>
- /// <typeparam name="T">The type of the elements received by the observer.</typeparam>
- /// <param name="onNext">Observer's OnNext action implementation.</param>
- /// <returns>The observer object implemented using the given actions.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="onNext"/> is null.</exception>
- public static IObserver<T> Create<T>(Action<T> onNext)
- {
- if (onNext == null)
- throw new ArgumentNullException("onNext");
-
- return new AnonymousObserver<T>(onNext);
- }
-
- /// <summary>
- /// Creates an observer from the specified OnNext and OnError actions.
- /// </summary>
- /// <typeparam name="T">The type of the elements received by the observer.</typeparam>
- /// <param name="onNext">Observer's OnNext action implementation.</param>
- /// <param name="onError">Observer's OnError action implementation.</param>
- /// <returns>The observer object implemented using the given actions.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="onNext"/> or <paramref name="onError"/> is null.</exception>
- public static IObserver<T> Create<T>(Action<T> onNext, Action<Exception> onError)
- {
- if (onNext == null)
- throw new ArgumentNullException("onNext");
- if (onError == null)
- throw new ArgumentNullException("onError");
-
- return new AnonymousObserver<T>(onNext, onError);
- }
-
- /// <summary>
- /// Creates an observer from the specified OnNext and OnCompleted actions.
- /// </summary>
- /// <typeparam name="T">The type of the elements received by the observer.</typeparam>
- /// <param name="onNext">Observer's OnNext action implementation.</param>
- /// <param name="onCompleted">Observer's OnCompleted action implementation.</param>
- /// <returns>The observer object implemented using the given actions.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="onNext"/> or <paramref name="onCompleted"/> is null.</exception>
- public static IObserver<T> Create<T>(Action<T> onNext, Action onCompleted)
- {
- if (onNext == null)
- throw new ArgumentNullException("onNext");
- if (onCompleted == null)
- throw new ArgumentNullException("onCompleted");
-
- return new AnonymousObserver<T>(onNext, onCompleted);
- }
-
- /// <summary>
- /// Creates an observer from the specified OnNext, OnError, and OnCompleted actions.
- /// </summary>
- /// <typeparam name="T">The type of the elements received by the observer.</typeparam>
- /// <param name="onNext">Observer's OnNext action implementation.</param>
- /// <param name="onError">Observer's OnError action implementation.</param>
- /// <param name="onCompleted">Observer's OnCompleted action implementation.</param>
- /// <returns>The observer object implemented using the given actions.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="onNext"/> or <paramref name="onError"/> or <paramref name="onCompleted"/> is null.</exception>
- public static IObserver<T> Create<T>(Action<T> onNext, Action<Exception> onError, Action onCompleted)
- {
- if (onNext == null)
- throw new ArgumentNullException("onNext");
- if (onError == null)
- throw new ArgumentNullException("onError");
- if (onCompleted == null)
- throw new ArgumentNullException("onCompleted");
-
- return new AnonymousObserver<T>(onNext, onError, onCompleted);
- }
-
- /// <summary>
- /// Hides the identity of an observer.
- /// </summary>
- /// <typeparam name="T">The type of the elements received by the source observer.</typeparam>
- /// <param name="observer">An observer whose identity to hide.</param>
- /// <returns>An observer that hides the identity of the specified observer.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="observer"/> is null.</exception>
- public static IObserver<T> AsObserver<T>(this IObserver<T> observer)
- {
- if (observer == null)
- throw new ArgumentNullException("observer");
-
- return new AnonymousObserver<T>(observer.OnNext, observer.OnError, observer.OnCompleted);
- }
-
- /// <summary>
- /// Checks access to the observer for grammar violations. This includes checking for multiple OnError or OnCompleted calls, as well as reentrancy in any of the observer methods.
- /// If a violation is detected, an InvalidOperationException is thrown from the offending observer method call.
- /// </summary>
- /// <typeparam name="T">The type of the elements received by the source observer.</typeparam>
- /// <param name="observer">The observer whose callback invocations should be checked for grammar violations.</param>
- /// <returns>An observer that checks callbacks invocations against the observer grammar and, if the checks pass, forwards those to the specified observer.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="observer"/> is null.</exception>
- public static IObserver<T> Checked<T>(this IObserver<T> observer)
- {
- if (observer == null)
- throw new ArgumentNullException("observer");
-
- return new CheckedObserver<T>(observer);
- }
-
- /// <summary>
- /// Synchronizes access to the observer such that its callback methods cannot be called concurrently from multiple threads. This overload is useful when coordinating access to an observer.
- /// Notice reentrant observer callbacks on the same thread are still possible.
- /// </summary>
- /// <typeparam name="T">The type of the elements received by the source observer.</typeparam>
- /// <param name="observer">The observer whose callbacks should be synchronized.</param>
- /// <returns>An observer that delivers callbacks to the specified observer in a synchronized manner.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="observer"/> is null.</exception>
- /// <remarks>
- /// Because a <see cref="System.Threading.Monitor">Monitor</see> is used to perform the synchronization, there's no protection against reentrancy from the same thread.
- /// Hence, overlapped observer callbacks are still possible, which is invalid behavior according to the observer grammar. In order to protect against this behavior as
- /// well, use the <see cref="Synchronize{T}(IObserver{T}, bool)"/> overload, passing true for the second parameter.
- /// </remarks>
- public static IObserver<T> Synchronize<T>(IObserver<T> observer)
- {
- if (observer == null)
- throw new ArgumentNullException("observer");
-
- return new SynchronizedObserver<T>(observer, new object());
- }
-
- /// <summary>
- /// Synchronizes access to the observer such that its callback methods cannot be called concurrently. This overload is useful when coordinating access to an observer.
- /// The <paramref name="preventReentrancy"/> parameter configures the type of lock used for synchronization.
- /// </summary>
- /// <typeparam name="T">The type of the elements received by the source observer.</typeparam>
- /// <param name="observer">The observer whose callbacks should be synchronized.</param>
- /// <param name="preventReentrancy">If set to true, reentrant observer callbacks will be queued up and get delivered to the observer in a sequential manner.</param>
- /// <returns>An observer that delivers callbacks to the specified observer in a synchronized manner.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="observer"/> is null.</exception>
- /// <remarks>
- /// When the <paramref name="preventReentrancy"/> parameter is set to false, behavior is identical to the <see cref="Synchronize{T}(IObserver{T})"/> overload which uses
- /// a <see cref="System.Threading.Monitor">Monitor</see> for synchronization. When the <paramref name="preventReentrancy"/> parameter is set to true, an <see cref="AsyncLock"/>
- /// is used to queue up callbacks to the specified observer if a reentrant call is made.
- /// </remarks>
- public static IObserver<T> Synchronize<T>(IObserver<T> observer, bool preventReentrancy)
- {
- if (observer == null)
- throw new ArgumentNullException("observer");
-
- if (preventReentrancy)
- return new AsyncLockObserver<T>(observer, new AsyncLock());
- else
- return new SynchronizedObserver<T>(observer, new object());
- }
-
- /// <summary>
- /// Synchronizes access to the observer such that its callback methods cannot be called concurrently by multiple threads, using the specified gate object for use by a <see cref="System.Threading.Monitor">Monitor</see>-based lock.
- /// This overload is useful when coordinating multiple observers that access shared state by synchronizing on a common gate object.
- /// Notice reentrant observer callbacks on the same thread are still possible.
- /// </summary>
- /// <typeparam name="T">The type of the elements received by the source observer.</typeparam>
- /// <param name="observer">The observer whose callbacks should be synchronized.</param>
- /// <param name="gate">Gate object to synchronize each observer call on.</param>
- /// <returns>An observer that delivers callbacks to the specified observer in a synchronized manner.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="observer"/> or <paramref name="gate"/> is null.</exception>
- /// <remarks>
- /// Because a <see cref="System.Threading.Monitor">Monitor</see> is used to perform the synchronization, there's no protection against reentrancy from the same thread.
- /// Hence, overlapped observer callbacks are still possible, which is invalid behavior according to the observer grammar. In order to protect against this behavior as
- /// well, use the <see cref="Synchronize{T}(IObserver{T}, AsyncLock)"/> overload.
- /// </remarks>
- public static IObserver<T> Synchronize<T>(IObserver<T> observer, object gate)
- {
- if (observer == null)
- throw new ArgumentNullException("observer");
- if (gate == null)
- throw new ArgumentNullException("gate");
-
- return new SynchronizedObserver<T>(observer, gate);
- }
-
- /// <summary>
- /// Synchronizes access to the observer such that its callback methods cannot be called concurrently, using the specified asynchronous lock to protect against concurrent and reentrant access.
- /// This overload is useful when coordinating multiple observers that access shared state by synchronizing on a common asynchronous lock.
- /// </summary>
- /// <typeparam name="T">The type of the elements received by the source observer.</typeparam>
- /// <param name="observer">The observer whose callbacks should be synchronized.</param>
- /// <param name="asyncLock">Gate object to synchronize each observer call on.</param>
- /// <returns>An observer that delivers callbacks to the specified observer in a synchronized manner.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="observer"/> or <paramref name="asyncLock"/> is null.</exception>
- public static IObserver<T> Synchronize<T>(IObserver<T> observer, AsyncLock asyncLock)
- {
- if (observer == null)
- throw new ArgumentNullException("observer");
- if (asyncLock == null)
- throw new ArgumentNullException("asyncLock");
-
- return new AsyncLockObserver<T>(observer, asyncLock);
- }
-
- /// <summary>
- /// Schedules the invocation of observer methods on the given scheduler.
- /// </summary>
- /// <typeparam name="T">The type of the elements received by the source observer.</typeparam>
- /// <param name="observer">The observer to schedule messages for.</param>
- /// <param name="scheduler">Scheduler to schedule observer messages on.</param>
- /// <returns>Observer whose messages are scheduled on the given scheduler.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="observer"/> or <paramref name="scheduler"/> is null.</exception>
- public static IObserver<T> NotifyOn<T>(this IObserver<T> observer, IScheduler scheduler)
- {
- if (observer == null)
- throw new ArgumentNullException("observer");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return new ObserveOnObserver<T>(scheduler, observer, null);
- }
-
-#if !NO_SYNCCTX
- /// <summary>
- /// Schedules the invocation of observer methods on the given synchonization context.
- /// </summary>
- /// <typeparam name="T">The type of the elements received by the source observer.</typeparam>
- /// <param name="observer">The observer to schedule messages for.</param>
- /// <param name="context">Synchonization context to schedule observer messages on.</param>
- /// <returns>Observer whose messages are scheduled on the given synchonization context.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="observer"/> or <paramref name="context"/> is null.</exception>
- public static IObserver<T> NotifyOn<T>(this IObserver<T> observer, SynchronizationContext context)
- {
- if (observer == null)
- throw new ArgumentNullException("observer");
- if (context == null)
- throw new ArgumentNullException("context");
-
- return new ObserveOnObserver<T>(new SynchronizationContextScheduler(context), observer, null);
- }
-#endif
-
-#if HAS_PROGRESS
- /// <summary>
- /// Converts an observer to a progress object.
- /// </summary>
- /// <typeparam name="T">The type of the progress objects received by the source observer.</typeparam>
- /// <param name="observer">The observer to convert.</param>
- /// <returns>Progress object whose Report messages correspond to the observer's OnNext messages.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="observer"/> is null.</exception>
- public static IProgress<T> ToProgress<T>(this IObserver<T> observer)
- {
- if (observer == null)
- throw new ArgumentNullException("observer");
-
- return new AnonymousProgress<T>(observer.OnNext);
- }
-
- /// <summary>
- /// Converts an observer to a progress object, using the specified scheduler to invoke the progress reporting method.
- /// </summary>
- /// <typeparam name="T">The type of the progress objects received by the source observer.</typeparam>
- /// <param name="observer">The observer to convert.</param>
- /// <param name="scheduler">Scheduler to report progress on.</param>
- /// <returns>Progress object whose Report messages correspond to the observer's OnNext messages.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="observer"/> or <paramref name="scheduler"/> is null.</exception>
- public static IProgress<T> ToProgress<T>(this IObserver<T> observer, IScheduler scheduler)
- {
- if (observer == null)
- throw new ArgumentNullException("observer");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return new AnonymousProgress<T>(new ObserveOnObserver<T>(scheduler, observer, null).OnNext);
- }
-
- class AnonymousProgress<T> : IProgress<T>
- {
- private readonly Action<T> _progress;
-
- public AnonymousProgress(Action<T> progress)
- {
- _progress = progress;
- }
-
- public void Report(T value)
- {
- _progress(value);
- }
- }
-
- /// <summary>
- /// Converts a progress object to an observer.
- /// </summary>
- /// <typeparam name="T">The type of the progress objects received by the progress reporter.</typeparam>
- /// <param name="progress">The progress object to convert.</param>
- /// <returns>Observer whose OnNext messages correspond to the progress object's Report messages.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="progress"/> is null.</exception>
- public static IObserver<T> ToObserver<T>(this IProgress<T> progress)
- {
- if (progress == null)
- throw new ArgumentNullException("progress");
-
- return new AnonymousObserver<T>(progress.Report);
- }
-#endif
- }
-}
diff --git a/Rx.NET/System.Reactive.Core/Properties/AssemblyInfo.cs b/Rx.NET/System.Reactive.Core/Properties/AssemblyInfo.cs
deleted file mode 100644
index f8d9063..0000000
--- a/Rx.NET/System.Reactive.Core/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,37 +0,0 @@
-using System;
-using System.Reflection;
-using System.Resources;
-using System.Runtime.InteropServices;
-using System.Security;
-
-[assembly: AssemblyTitle("System.Reactive.Core")]
-// Notice: same description as in the .nuspec files; see Source/Rx/Setup/NuGet
-[assembly: AssemblyDescription("Reactive Extensions Core Library containing base classes and scheduler infrastructure.")]
-#if DEBUG
-[assembly: AssemblyConfiguration("Debug")]
-#else
-[assembly: AssemblyConfiguration("Retail")]
-#endif
-[assembly: AssemblyCompany("Microsoft Corporation")]
-[assembly: AssemblyProduct("Reactive Extensions")]
-[assembly: AssemblyCopyright("\x00a9 Microsoft Corporation. All rights reserved.")]
-[assembly: NeutralResourcesLanguage("en-US")]
-
-#if !PLIB
-[assembly: ComVisible(false)]
-#endif
-
-[assembly: CLSCompliant(true)]
-
-#if HAS_APTCA && NO_CODECOVERAGE
-[assembly: AllowPartiallyTrustedCallers]
-#endif
-
-#if XBOX_LAKEVIEW
-[assembly: SecurityTransparent]
-#endif
-
-//
-// Note: Assembly (file) version numbers get inserted by the build system on the fly. Inspect the Team Build workflows
-// and the custom activity in Build/Source/Activities/AppendVersionInfo.cs for more information.
-//
diff --git a/Rx.NET/System.Reactive.Core/Reactive/AnonymousObservable.cs b/Rx.NET/System.Reactive.Core/Reactive/AnonymousObservable.cs
deleted file mode 100644
index 81ffa53..0000000
--- a/Rx.NET/System.Reactive.Core/Reactive/AnonymousObservable.cs
+++ /dev/null
@@ -1,38 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System.Reactive.Disposables;
-
-namespace System.Reactive
-{
- /// <summary>
- /// Class to create an IObservable&lt;T&gt; instance from a delegate-based implementation of the Subscribe method.
- /// </summary>
- /// <typeparam name="T">The type of the elements in the sequence.</typeparam>
- public sealed class AnonymousObservable<T> : ObservableBase<T>
- {
- private readonly Func<IObserver<T>, IDisposable> _subscribe;
-
- /// <summary>
- /// Creates an observable sequence object from the specified subscription function.
- /// </summary>
- /// <param name="subscribe">Subscribe method implementation.</param>
- /// <exception cref="ArgumentNullException"><paramref name="subscribe"/> is null.</exception>
- public AnonymousObservable(Func<IObserver<T>, IDisposable> subscribe)
- {
- if (subscribe == null)
- throw new ArgumentNullException("subscribe");
-
- _subscribe = subscribe;
- }
-
- /// <summary>
- /// Calls the subscription function that was supplied to the constructor.
- /// </summary>
- /// <param name="observer">Observer to send notifications to.</param>
- /// <returns>Disposable object representing an observer's subscription to the observable sequence.</returns>
- protected override IDisposable SubscribeCore(IObserver<T> observer)
- {
- return _subscribe(observer) ?? Disposable.Empty;
- }
- }
-}
diff --git a/Rx.NET/System.Reactive.Core/Reactive/AnonymousObserver.cs b/Rx.NET/System.Reactive.Core/Reactive/AnonymousObserver.cs
deleted file mode 100644
index ea0f9ec..0000000
--- a/Rx.NET/System.Reactive.Core/Reactive/AnonymousObserver.cs
+++ /dev/null
@@ -1,99 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-namespace System.Reactive
-{
- /// <summary>
- /// Class to create an IObserver&lt;T&gt; instance from delegate-based implementations of the On* methods.
- /// </summary>
- /// <typeparam name="T">The type of the elements in the sequence.</typeparam>
- public sealed class AnonymousObserver<T> : ObserverBase<T>
- {
- private readonly Action<T> _onNext;
- private readonly Action<Exception> _onError;
- private readonly Action _onCompleted;
-
- /// <summary>
- /// Creates an observer from the specified OnNext, OnError, and OnCompleted actions.
- /// </summary>
- /// <param name="onNext">Observer's OnNext action implementation.</param>
- /// <param name="onError">Observer's OnError action implementation.</param>
- /// <param name="onCompleted">Observer's OnCompleted action implementation.</param>
- /// <exception cref="ArgumentNullException"><paramref name="onNext"/> or <paramref name="onError"/> or <paramref name="onCompleted"/> is null.</exception>
- public AnonymousObserver(Action<T> onNext, Action<Exception> onError, Action onCompleted)
- {
- if (onNext == null)
- throw new ArgumentNullException("onNext");
- if (onError == null)
- throw new ArgumentNullException("onError");
- if (onCompleted == null)
- throw new ArgumentNullException("onCompleted");
-
- _onNext = onNext;
- _onError = onError;
- _onCompleted = onCompleted;
- }
-
- /// <summary>
- /// Creates an observer from the specified OnNext action.
- /// </summary>
- /// <param name="onNext">Observer's OnNext action implementation.</param>
- /// <exception cref="ArgumentNullException"><paramref name="onNext"/> is null.</exception>
- public AnonymousObserver(Action<T> onNext)
- : this(onNext, Stubs.Throw, Stubs.Nop)
- {
- }
-
- /// <summary>
- /// Creates an observer from the specified OnNext and OnError actions.
- /// </summary>
- /// <param name="onNext">Observer's OnNext action implementation.</param>
- /// <param name="onError">Observer's OnError action implementation.</param>
- /// <exception cref="ArgumentNullException"><paramref name="onNext"/> or <paramref name="onError"/> is null.</exception>
- public AnonymousObserver(Action<T> onNext, Action<Exception> onError)
- : this(onNext, onError, Stubs.Nop)
- {
- }
-
- /// <summary>
- /// Creates an observer from the specified OnNext and OnCompleted actions.
- /// </summary>
- /// <param name="onNext">Observer's OnNext action implementation.</param>
- /// <param name="onCompleted">Observer's OnCompleted action implementation.</param>
- /// <exception cref="ArgumentNullException"><paramref name="onNext"/> or <paramref name="onCompleted"/> is null.</exception>
- public AnonymousObserver(Action<T> onNext, Action onCompleted)
- : this(onNext, Stubs.Throw, onCompleted)
- {
- }
-
- /// <summary>
- /// Calls the onNext action.
- /// </summary>
- /// <param name="value">Next element in the sequence.</param>
- protected override void OnNextCore(T value)
- {
- _onNext(value);
- }
-
- /// <summary>
- /// Calls the onError action.
- /// </summary>
- /// <param name="error">The error that has occurred.</param>
- protected override void OnErrorCore(Exception error)
- {
- _onError(error);
- }
-
- /// <summary>
- /// Calls the onCompleted action.
- /// </summary>
- protected override void OnCompletedCore()
- {
- _onCompleted();
- }
-
- internal IObserver<T> MakeSafe(IDisposable disposable)
- {
- return new AnonymousSafeObserver<T>(_onNext, _onError, _onCompleted, disposable);
- }
- }
-}
diff --git a/Rx.NET/System.Reactive.Core/Reactive/AnonymousSafeObserver.cs b/Rx.NET/System.Reactive.Core/Reactive/AnonymousSafeObserver.cs
deleted file mode 100644
index ae7cccc..0000000
--- a/Rx.NET/System.Reactive.Core/Reactive/AnonymousSafeObserver.cs
+++ /dev/null
@@ -1,85 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System;
-using System.Threading;
-
-namespace System.Reactive
-{
- //
- // See AutoDetachObserver.cs for more information on the safeguarding requirement and
- // its implementation aspects.
- //
-
- /// <summary>
- /// This class fuses logic from ObserverBase, AnonymousObserver, and SafeObserver into one class. When an observer
- /// needs to be safeguarded, an instance of this type can be created by SafeObserver.Create when it detects its
- /// input is an AnonymousObserver, which is commonly used by end users when using the Subscribe extension methods
- /// that accept delegates for the On* handlers. By doing the fusion, we make the call stack depth shorter which
- /// helps debugging and some performance.
- /// </summary>
- class AnonymousSafeObserver<T> : IObserver<T>
- {
- private readonly Action<T> _onNext;
- private readonly Action<Exception> _onError;
- private readonly Action _onCompleted;
- private readonly IDisposable _disposable;
-
- private int isStopped;
-
- public AnonymousSafeObserver(Action<T> onNext, Action<Exception> onError, Action onCompleted, IDisposable disposable)
- {
- _onNext = onNext;
- _onError = onError;
- _onCompleted = onCompleted;
- _disposable = disposable;
- }
-
- public void OnNext(T value)
- {
- if (isStopped == 0)
- {
- var __noError = false;
- try
- {
- _onNext(value);
- __noError = true;
- }
- finally
- {
- if (!__noError)
- _disposable.Dispose();
- }
- }
- }
-
- public void OnError(Exception error)
- {
- if (Interlocked.Exchange(ref isStopped, 1) == 0)
- {
- try
- {
- _onError(error);
- }
- finally
- {
- _disposable.Dispose();
- }
- }
- }
-
- public void OnCompleted()
- {
- if (Interlocked.Exchange(ref isStopped, 1) == 0)
- {
- try
- {
- _onCompleted();
- }
- finally
- {
- _disposable.Dispose();
- }
- }
- }
- }
-}
diff --git a/Rx.NET/System.Reactive.Core/Reactive/Concurrency/AsyncLock.cs b/Rx.NET/System.Reactive.Core/Reactive/Concurrency/AsyncLock.cs
deleted file mode 100644
index 73def1a..0000000
--- a/Rx.NET/System.Reactive.Core/Reactive/Concurrency/AsyncLock.cs
+++ /dev/null
@@ -1,84 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System.Collections.Generic;
-
-namespace System.Reactive.Concurrency
-{
- /// <summary>
- /// Asynchronous lock.
- /// </summary>
- public sealed class AsyncLock : IDisposable
- {
- private readonly Queue<Action> queue = new Queue<Action>();
- private bool isAcquired = false;
- private bool hasFaulted = false;
-
- /// <summary>
- /// Queues the action for execution. If the caller acquires the lock and becomes the owner,
- /// the queue is processed. If the lock is already owned, the action is queued and will get
- /// processed by the owner.
- /// </summary>
- /// <param name="action">Action to queue for execution.</param>
- /// <exception cref="ArgumentNullException"><paramref name="action"/> is null.</exception>
- public void Wait(Action action)
- {
- if (action == null)
- throw new ArgumentNullException("action");
-
- var isOwner = false;
- lock (queue)
- {
- if (!hasFaulted)
- {
- queue.Enqueue(action);
- isOwner = !isAcquired;
- isAcquired = true;
- }
- }
-
- if (isOwner)
- {
- while (true)
- {
- var work = default(Action);
- lock (queue)
- {
- if (queue.Count > 0)
- work = queue.Dequeue();
- else
- {
- isAcquired = false;
- break;
- }
- }
-
- try
- {
- work();
- }
- catch
- {
- lock (queue)
- {
- queue.Clear();
- hasFaulted = true;
- }
- throw;
- }
- }
- }
- }
-
- /// <summary>
- /// Clears the work items in the queue and drops further work being queued.
- /// </summary>
- public void Dispose()
- {
- lock (queue)
- {
- queue.Clear();
- hasFaulted = true;
- }
- }
- }
-}
diff --git a/Rx.NET/System.Reactive.Core/Reactive/Concurrency/CatchScheduler.cs b/Rx.NET/System.Reactive.Core/Reactive/Concurrency/CatchScheduler.cs
deleted file mode 100644
index b4e9fa3..0000000
--- a/Rx.NET/System.Reactive.Core/Reactive/Concurrency/CatchScheduler.cs
+++ /dev/null
@@ -1,151 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System;
-using System.Reactive.Disposables;
-
-#if !NO_WEAKTABLE
-using System.Runtime.CompilerServices;
-#endif
-
-namespace System.Reactive.Concurrency
-{
- class CatchScheduler<TException> : SchedulerWrapper
- where TException : Exception
- {
- private readonly Func<TException, bool> _handler;
-
- public CatchScheduler(IScheduler scheduler, Func<TException, bool> handler)
- : base(scheduler)
- {
- _handler = handler;
- }
-
- protected override Func<IScheduler, TState, IDisposable> Wrap<TState>(Func<IScheduler, TState, IDisposable> action)
- {
- return (self, state) =>
- {
- try
- {
- return action(GetRecursiveWrapper(self), state);
- }
- catch (TException exception)
- {
- if (!_handler(exception))
- throw;
-
- return Disposable.Empty;
- }
- };
- }
-
-#if !NO_WEAKTABLE
- public CatchScheduler(IScheduler scheduler, Func<TException, bool> handler, ConditionalWeakTable<IScheduler, IScheduler> cache)
- : base(scheduler, cache)
- {
- _handler = handler;
- }
-
- protected override SchedulerWrapper Clone(IScheduler scheduler, ConditionalWeakTable<IScheduler, IScheduler> cache)
- {
- return new CatchScheduler<TException>(scheduler, _handler, cache);
- }
-#else
- protected override SchedulerWrapper Clone(IScheduler scheduler)
- {
- return new CatchScheduler<TException>(scheduler, _handler);
- }
-#endif
-
- protected override bool TryGetService(IServiceProvider provider, Type serviceType, out object service)
- {
- service = provider.GetService(serviceType);
-
- if (service != null)
- {
- if (serviceType == typeof(ISchedulerLongRunning))
- service = new CatchSchedulerLongRunning((ISchedulerLongRunning)service, _handler);
- else if (serviceType == typeof(ISchedulerPeriodic))
- service = new CatchSchedulerPeriodic((ISchedulerPeriodic)service, _handler);
- }
-
- return true;
- }
-
- class CatchSchedulerLongRunning : ISchedulerLongRunning
- {
- private readonly ISchedulerLongRunning _scheduler;
- private readonly Func<TException, bool> _handler;
-
- public CatchSchedulerLongRunning(ISchedulerLongRunning scheduler, Func<TException, bool> handler)
- {
- _scheduler = scheduler;
- _handler = handler;
- }
-
- public IDisposable ScheduleLongRunning<TState>(TState state, Action<TState, ICancelable> action)
- {
- return _scheduler.ScheduleLongRunning(state, (state_, cancel) =>
- {
- try
- {
- action(state_, cancel);
- }
- catch (TException exception)
- {
- if (!_handler(exception))
- throw;
- }
- });
- }
- }
-
- class CatchSchedulerPeriodic : ISchedulerPeriodic
- {
- private readonly ISchedulerPeriodic _scheduler;
- private readonly Func<TException, bool> _handler;
-
- public CatchSchedulerPeriodic(ISchedulerPeriodic scheduler, Func<TException, bool> handler)
- {
- _scheduler = scheduler;
- _handler = handler;
- }
-
- public IDisposable SchedulePeriodic<TState>(TState state, TimeSpan period, Func<TState, TState> action)
- {
- var failed = false;
-
- var d = new SingleAssignmentDisposable();
-
- d.Disposable = _scheduler.SchedulePeriodic(state, period, state_ =>
- {
- //
- // Cancellation may not be granted immediately; prevent from running user
- // code in that case. Periodic schedulers are assumed to introduce some
- // degree of concurrency, so we should return from the SchedulePeriodic
- // call eventually, allowing the d.Dispose() call in the catch block to
- // take effect.
- //
- if (failed)
- return default(TState);
-
- try
- {
- return action(state_);
- }
- catch (TException exception)
- {
- failed = true;
-
- if (!_handler(exception))
- throw;
-
- d.Dispose();
- return default(TState);
- }
- });
-
- return d;
- }
- }
- }
-}
diff --git a/Rx.NET/System.Reactive.Core/Reactive/Concurrency/ConcurrencyAbstractionLayer.Default.cs b/Rx.NET/System.Reactive.Core/Reactive/Concurrency/ConcurrencyAbstractionLayer.Default.cs
deleted file mode 100644
index 7ab5cfe..0000000
--- a/Rx.NET/System.Reactive.Core/Reactive/Concurrency/ConcurrencyAbstractionLayer.Default.cs
+++ /dev/null
@@ -1,283 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_THREAD
-using System;
-using System.Collections.Generic;
-using System.Reactive.Disposables;
-using System.Threading;
-
-namespace System.Reactive.Concurrency
-{
- //
- // WARNING: This code is kept *identically* in two places. One copy is kept in System.Reactive.Core for non-PLIB platforms.
- // Another copy is kept in System.Reactive.PlatformServices to enlighten the default lowest common denominator
- // behavior of Rx for PLIB when used on a more capable platform.
- //
- internal class DefaultConcurrencyAbstractionLayer/*Impl*/ : IConcurrencyAbstractionLayer
- {
- public IDisposable StartTimer(Action<object> action, object state, TimeSpan dueTime)
- {
- return new Timer(action, state, Normalize(dueTime));
- }
-
- public IDisposable StartPeriodicTimer(Action action, TimeSpan period)
- {
- //
- // MSDN documentation states the following:
- //
- // "If period is zero (0) or negative one (-1) milliseconds and dueTime is positive, callback is invoked once;
- // the periodic behavior of the timer is disabled, but can be re-enabled using the Change method."
- //
- if (period <= TimeSpan.Zero)
- throw new ArgumentOutOfRangeException("period");
-
- return new PeriodicTimer(action, period);
- }
-
- public IDisposable QueueUserWorkItem(Action<object> action, object state)
- {
- System.Threading.ThreadPool.QueueUserWorkItem(_ => action(_), state);
- return Disposable.Empty;
- }
-
-#if USE_SLEEP_MS
- public void Sleep(TimeSpan timeout)
- {
- System.Threading.Thread.Sleep((int)Normalize(timeout).TotalMilliseconds);
- }
-#else
- public void Sleep(TimeSpan timeout)
- {
- System.Threading.Thread.Sleep(Normalize(timeout));
- }
-#endif
-
- public IStopwatch StartStopwatch()
- {
- return new DefaultStopwatch();
- }
-
- public bool SupportsLongRunning
- {
- get { return true; }
- }
-
- public void StartThread(Action<object> action, object state)
- {
- new Thread(() =>
- {
- action(state);
- }).Start();
- }
-
- private static TimeSpan Normalize(TimeSpan dueTime)
- {
- if (dueTime < TimeSpan.Zero)
- return TimeSpan.Zero;
-
- return dueTime;
- }
-
- class Timer : IDisposable
- {
- //
- // Note: the dictionary exists to "root" the timers so that they are not garbage collected and finalized while they are running.
- //
-#if !NO_HASHSET
- private static readonly HashSet<System.Threading.Timer> s_timers = new HashSet<System.Threading.Timer>();
-#else
- private static readonly Dictionary<System.Threading.Timer, object> s_timers = new Dictionary<System.Threading.Timer, object>();
-#endif
-
- private Action<object> _action;
- private System.Threading.Timer _timer;
-
- private bool _hasAdded;
- private bool _hasRemoved;
-
- public Timer(Action<object> action, object state, TimeSpan dueTime)
- {
- _action = action;
- _timer = new System.Threading.Timer(Tick, state, dueTime, TimeSpan.FromMilliseconds(System.Threading.Timeout.Infinite));
-
- lock (s_timers)
- {
- if (!_hasRemoved)
- {
-#if !NO_HASHSET
- s_timers.Add(_timer);
-#else
- s_timers.Add(_timer, null);
-#endif
-
- _hasAdded = true;
- }
- }
- }
-
- private void Tick(object state)
- {
- try
- {
- _action(state);
- }
- finally
- {
- Dispose();
- }
- }
-
- public void Dispose()
- {
- _action = Stubs<object>.Ignore;
-
- var timer = default(System.Threading.Timer);
-
- lock (s_timers)
- {
- if (!_hasRemoved)
- {
- timer = _timer;
- _timer = null;
-
- if (_hasAdded && timer != null)
- s_timers.Remove(timer);
-
- _hasRemoved = true;
- }
- }
-
- if (timer != null)
- timer.Dispose();
- }
- }
-
- class PeriodicTimer : IDisposable
- {
- //
- // Note: the dictionary exists to "root" the timers so that they are not garbage collected and finalized while they are running.
- //
-#if !NO_HASHSET
- private static readonly HashSet<System.Threading.Timer> s_timers = new HashSet<System.Threading.Timer>();
-#else
- private static readonly Dictionary<System.Threading.Timer, object> s_timers = new Dictionary<System.Threading.Timer, object>();
-#endif
-
- private Action _action;
- private System.Threading.Timer _timer;
-
- public PeriodicTimer(Action action, TimeSpan period)
- {
- _action = action;
- _timer = new System.Threading.Timer(Tick, null, period, period);
-
- lock (s_timers)
- {
-#if !NO_HASHSET
- s_timers.Add(_timer);
-#else
- s_timers.Add(_timer, null);
-#endif
- }
- }
-
- private void Tick(object state)
- {
- _action();
- }
-
- public void Dispose()
- {
- var timer = default(System.Threading.Timer);
-
- lock (s_timers)
- {
- timer = _timer;
- _timer = null;
-
- if (timer != null)
- s_timers.Remove(timer);
- }
-
- if (timer != null)
- {
- timer.Dispose();
- _action = Stubs.Nop;
- }
- }
- }
- }
-}
-#else
-using System;
-using System.Reactive.Disposables;
-using System.Threading.Tasks;
-
-namespace System.Reactive.Concurrency
-{
- internal class DefaultConcurrencyAbstractionLayer : IConcurrencyAbstractionLayer
- {
- public IDisposable StartTimer(Action<object> action, object state, TimeSpan dueTime)
- {
- var cancel = new CancellationDisposable();
- Task.Delay(dueTime, cancel.Token).ContinueWith(
- _ => action(state),
- TaskContinuationOptions.ExecuteSynchronously | TaskContinuationOptions.OnlyOnRanToCompletion
- );
- return cancel;
- }
-
- public IDisposable StartPeriodicTimer(Action action, TimeSpan period)
- {
- var cancel = new CancellationDisposable();
-
- var moveNext = default(Action);
- moveNext = () =>
- {
- Task.Delay(period, cancel.Token).ContinueWith(
- _ =>
- {
- moveNext();
- action();
- },
- TaskContinuationOptions.ExecuteSynchronously | TaskContinuationOptions.OnlyOnRanToCompletion
- );
- };
-
- moveNext();
-
- return cancel;
- }
-
- public IDisposable QueueUserWorkItem(Action<object> action, object state)
- {
- var cancel = new CancellationDisposable();
- Task.Factory.StartNew(action, state, cancel.Token);
- return cancel;
- }
-
- public void Sleep(TimeSpan timeout)
- {
- Task.Delay(timeout).Wait();
- }
-
- public IStopwatch StartStopwatch()
- {
- return new DefaultStopwatch();
- }
-
- public bool SupportsLongRunning
- {
- get { return true; }
- }
-
- public void StartThread(Action<object> action, object state)
- {
- Task.Factory.StartNew(() =>
- {
- action(state);
- }, TaskCreationOptions.LongRunning);
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Core/Reactive/Concurrency/ConcurrencyAbstractionLayer.cs b/Rx.NET/System.Reactive.Core/Reactive/Concurrency/ConcurrencyAbstractionLayer.cs
deleted file mode 100644
index d09058f..0000000
--- a/Rx.NET/System.Reactive.Core/Reactive/Concurrency/ConcurrencyAbstractionLayer.cs
+++ /dev/null
@@ -1,94 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System.ComponentModel;
-using System.Reactive.PlatformServices;
-
-namespace System.Reactive.Concurrency
-{
- /// <summary>
- /// (Infrastructure) Concurrency abstraction layer.
- /// </summary>
- internal static class ConcurrencyAbstractionLayer
- {
- private static Lazy<IConcurrencyAbstractionLayer> s_current = new Lazy<IConcurrencyAbstractionLayer>(Initialize);
-
- /// <summary>
- /// Gets the current CAL. If no CAL has been set yet, it will be initialized to the default.
- /// </summary>
- public static IConcurrencyAbstractionLayer Current
- {
- get
- {
- return s_current.Value;
- }
- }
-
- private static IConcurrencyAbstractionLayer Initialize()
- {
- return PlatformEnlightenmentProvider.Current.GetService<IConcurrencyAbstractionLayer>() ?? new DefaultConcurrencyAbstractionLayer();
- }
- }
-
- /// <summary>
- /// (Infrastructure) Concurrency abstraction layer interface.
- /// </summary>
- /// <remarks>
- /// This type is used by the Rx infrastructure and not meant for public consumption or implementation.
- /// No guarantees are made about forward compatibility of the type's functionality and its usage.
- /// </remarks>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public interface IConcurrencyAbstractionLayer
- {
- /// <summary>
- /// Queues a method for execution at the specified relative time.
- /// </summary>
- /// <param name="action">Method to execute.</param>
- /// <param name="state">State to pass to the method.</param>
- /// <param name="dueTime">Time to execute the method on.</param>
- /// <returns>Disposable object that can be used to stop the timer.</returns>
- IDisposable StartTimer(Action<object> action, object state, TimeSpan dueTime);
-
- /// <summary>
- /// Queues a method for periodic execution based on the specified period.
- /// </summary>
- /// <param name="action">Method to execute; should be safe for reentrancy.</param>
- /// <param name="period">Period for running the method periodically.</param>
- /// <returns>Disposable object that can be used to stop the timer.</returns>
- IDisposable StartPeriodicTimer(Action action, TimeSpan period);
-
- /// <summary>
- /// Queues a method for execution.
- /// </summary>
- /// <param name="action">Method to execute.</param>
- /// <param name="state">State to pass to the method.</param>
- /// <returns>Disposable object that can be used to cancel the queued method.</returns>
- IDisposable QueueUserWorkItem(Action<object> action, object state);
-
- /// <summary>
- /// Blocking sleep operation.
- /// </summary>
- /// <param name="timeout">Time to sleep.</param>
- void Sleep(TimeSpan timeout);
-
- /// <summary>
- /// Starts a new stopwatch object.
- /// </summary>
- /// <returns>New stopwatch object; started at the time of the request.</returns>
- IStopwatch StartStopwatch();
-
- /// <summary>
- /// Gets whether long-running scheduling is supported.
- /// </summary>
- bool SupportsLongRunning
- {
- get;
- }
-
- /// <summary>
- /// Starts a new long-running thread.
- /// </summary>
- /// <param name="action">Method to execute.</param>
- /// <param name="state">State to pass to the method.</param>
- void StartThread(Action<object> action, object state);
- }
-}
diff --git a/Rx.NET/System.Reactive.Core/Reactive/Concurrency/CurrentThreadScheduler.cs b/Rx.NET/System.Reactive.Core/Reactive/Concurrency/CurrentThreadScheduler.cs
deleted file mode 100644
index 1a051c6..0000000
--- a/Rx.NET/System.Reactive.Core/Reactive/Concurrency/CurrentThreadScheduler.cs
+++ /dev/null
@@ -1,191 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System.ComponentModel;
-using System.Threading;
-using System.Reactive.Disposables;
-
-namespace System.Reactive.Concurrency
-{
- /// <summary>
- /// Represents an object that schedules units of work on the current thread.
- /// </summary>
- /// <seealso cref="Scheduler.CurrentThread">Singleton instance of this type exposed through this static property.</seealso>
- public sealed class CurrentThreadScheduler : LocalScheduler
- {
- private static readonly CurrentThreadScheduler s_instance = new CurrentThreadScheduler();
-
- CurrentThreadScheduler()
- {
- }
-
- /// <summary>
- /// Gets the singleton instance of the current thread scheduler.
- /// </summary>
- public static CurrentThreadScheduler Instance
- {
- get { return s_instance; }
- }
-
-#if !NO_TLS
- [ThreadStatic]
- static SchedulerQueue<TimeSpan> s_threadLocalQueue;
-
- [ThreadStatic]
- static IStopwatch s_clock;
-
- private static SchedulerQueue<TimeSpan> GetQueue()
- {
- return s_threadLocalQueue;
- }
-
- private static void SetQueue(SchedulerQueue<TimeSpan> newQueue)
- {
- s_threadLocalQueue = newQueue;
- }
-
- private static TimeSpan Time
- {
- get
- {
- if (s_clock == null)
- s_clock = ConcurrencyAbstractionLayer.Current.StartStopwatch();
-
- return s_clock.Elapsed;
- }
- }
-#else
- private static readonly System.Collections.Generic.Dictionary<int, SchedulerQueue<TimeSpan>> s_queues = new System.Collections.Generic.Dictionary<int, SchedulerQueue<TimeSpan>>();
-
- private static readonly System.Collections.Generic.Dictionary<int, IStopwatch> s_clocks = new System.Collections.Generic.Dictionary<int, IStopwatch>();
-
- private static SchedulerQueue<TimeSpan> GetQueue()
- {
- lock (s_queues)
- {
- var item = default(SchedulerQueue<TimeSpan>);
- if (s_queues.TryGetValue(Thread.CurrentThread.ManagedThreadId, out item))
- return item;
-
- return null;
- }
- }
-
- private static void SetQueue(SchedulerQueue<TimeSpan> newQueue)
- {
- lock (s_queues)
- {
- if (newQueue == null)
- s_queues.Remove(Thread.CurrentThread.ManagedThreadId);
- else
- s_queues[Thread.CurrentThread.ManagedThreadId] = newQueue;
- }
- }
-
- private static TimeSpan Time
- {
- get
- {
- lock (s_clocks)
- {
- var clock = default(IStopwatch);
- if (!s_clocks.TryGetValue(Thread.CurrentThread.ManagedThreadId, out clock))
- s_clocks[Thread.CurrentThread.ManagedThreadId] = clock = ConcurrencyAbstractionLayer.Current.StartStopwatch();
-
- return clock.Elapsed;
- }
- }
- }
-#endif
-
- /// <summary>
- /// Gets a value that indicates whether the caller must call a Schedule method.
- /// </summary>
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic", Justification = "Now marked as obsolete.")]
- [EditorBrowsable(EditorBrowsableState.Never)]
- [Obsolete(Constants_Core.OBSOLETE_SCHEDULEREQUIRED)] // Preferring static method call over instance method call.
- public bool ScheduleRequired
- {
- get
- {
- return IsScheduleRequired;
- }
- }
-
- /// <summary>
- /// Gets a value that indicates whether the caller must call a Schedule method.
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- public static bool IsScheduleRequired
- {
- get
- {
- return GetQueue() == null;
- }
- }
-
- /// <summary>
- /// Schedules an action to be executed after dueTime.
- /// </summary>
- /// <typeparam name="TState">The type of the state passed to the scheduled action.</typeparam>
- /// <param name="state">State passed to the action to be executed.</param>
- /// <param name="action">Action to be executed.</param>
- /// <param name="dueTime">Relative time after which to execute the action.</param>
- /// <returns>The disposable object used to cancel the scheduled action (best effort).</returns>
- /// <exception cref="ArgumentNullException"><paramref name="action"/> is null.</exception>
- public override IDisposable Schedule<TState>(TState state, TimeSpan dueTime, Func<IScheduler, TState, IDisposable> action)
- {
- if (action == null)
- throw new ArgumentNullException("action");
-
- var dt = Time + Scheduler.Normalize(dueTime);
-
- var si = new ScheduledItem<TimeSpan, TState>(this, state, action, dt);
-
- var queue = GetQueue();
-
- if (queue == null)
- {
- queue = new SchedulerQueue<TimeSpan>(4);
- queue.Enqueue(si);
-
- CurrentThreadScheduler.SetQueue(queue);
- try
- {
- Trampoline.Run(queue);
- }
- finally
- {
- CurrentThreadScheduler.SetQueue(null);
- }
- }
- else
- {
- queue.Enqueue(si);
- }
-
- return Disposable.Create(si.Cancel);
- }
-
- static class Trampoline
- {
- public static void Run(SchedulerQueue<TimeSpan> queue)
- {
- while (queue.Count > 0)
- {
- var item = queue.Dequeue();
- if (!item.IsCanceled)
- {
- var wait = item.DueTime - CurrentThreadScheduler.Time;
- if (wait.Ticks > 0)
- {
- ConcurrencyAbstractionLayer.Current.Sleep(wait);
- }
-
- if (!item.IsCanceled)
- item.Invoke();
- }
- }
- }
- }
- }
-}
diff --git a/Rx.NET/System.Reactive.Core/Reactive/Concurrency/DefaultScheduler.cs b/Rx.NET/System.Reactive.Core/Reactive/Concurrency/DefaultScheduler.cs
deleted file mode 100644
index 1e5ae79..0000000
--- a/Rx.NET/System.Reactive.Core/Reactive/Concurrency/DefaultScheduler.cs
+++ /dev/null
@@ -1,176 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System.Collections.Generic;
-using System.Reactive.Disposables;
-using System.Threading;
-
-namespace System.Reactive.Concurrency
-{
- /// <summary>
- /// Represents an object that schedules units of work on the platform's default scheduler.
- /// </summary>
- /// <seealso cref="Scheduler.Default">Singleton instance of this type exposed through this static property.</seealso>
- public sealed class DefaultScheduler : LocalScheduler, ISchedulerPeriodic
- {
- private static readonly DefaultScheduler s_instance = new DefaultScheduler();
- private static IConcurrencyAbstractionLayer s_cal = ConcurrencyAbstractionLayer.Current;
-
- /// <summary>
- /// Gets the singleton instance of the default scheduler.
- /// </summary>
- public static DefaultScheduler Instance
- {
- get
- {
- return s_instance;
- }
- }
-
- private DefaultScheduler()
- {
- }
-
- /// <summary>
- /// Schedules an action to be executed.
- /// </summary>
- /// <typeparam name="TState">The type of the state passed to the scheduled action.</typeparam>
- /// <param name="state">State passed to the action to be executed.</param>
- /// <param name="action">Action to be executed.</param>
- /// <returns>The disposable object used to cancel the scheduled action (best effort).</returns>
- /// <exception cref="ArgumentNullException"><paramref name="action"/> is null.</exception>
- public override IDisposable Schedule<TState>(TState state, Func<IScheduler, TState, IDisposable> action)
- {
- if (action == null)
- throw new ArgumentNullException("action");
-
- var d = new SingleAssignmentDisposable();
-
- var cancel = s_cal.QueueUserWorkItem(_ =>
- {
- if (!d.IsDisposed)
- d.Disposable = action(this, state);
- }, null);
-
- return new CompositeDisposable(
- d,
- cancel
- );
- }
-
- /// <summary>
- /// Schedules an action to be executed after dueTime, using a System.Threading.Timer object.
- /// </summary>
- /// <typeparam name="TState">The type of the state passed to the scheduled action.</typeparam>
- /// <param name="state">State passed to the action to be executed.</param>
- /// <param name="action">Action to be executed.</param>
- /// <param name="dueTime">Relative time after which to execute the action.</param>
- /// <returns>The disposable object used to cancel the scheduled action (best effort).</returns>
- /// <exception cref="ArgumentNullException"><paramref name="action"/> is null.</exception>
- public override IDisposable Schedule<TState>(TState state, TimeSpan dueTime, Func<IScheduler, TState, IDisposable> action)
- {
- if (action == null)
- throw new ArgumentNullException("action");
-
- var dt = Scheduler.Normalize(dueTime);
- if (dt.Ticks == 0)
- return Schedule(state, action);
-
- var d = new SingleAssignmentDisposable();
-
- var cancel = s_cal.StartTimer(_ =>
- {
- if (!d.IsDisposed)
- d.Disposable = action(this, state);
- }, null, dt);
-
- return new CompositeDisposable(
- d,
- cancel
- );
- }
-
- /// <summary>
- /// Schedules a periodic piece of work, using a System.Threading.Timer object.
- /// </summary>
- /// <typeparam name="TState">The type of the state passed to the scheduled action.</typeparam>
- /// <param name="state">Initial state passed to the action upon the first iteration.</param>
- /// <param name="period">Period for running the work periodically.</param>
- /// <param name="action">Action to be executed, potentially updating the state.</param>
- /// <returns>The disposable object used to cancel the scheduled recurring action (best effort).</returns>
- /// <exception cref="ArgumentOutOfRangeException"><paramref name="period"/> is less than TimeSpan.Zero.</exception>
- /// <exception cref="ArgumentNullException"><paramref name="action"/> is null.</exception>
- public IDisposable SchedulePeriodic<TState>(TState state, TimeSpan period, Func<TState, TState> action)
- {
- if (period < TimeSpan.Zero)
- throw new ArgumentOutOfRangeException("period");
- if (action == null)
- throw new ArgumentNullException("action");
-
- var state1 = state;
- var gate = new AsyncLock();
-
- var cancel = s_cal.StartPeriodicTimer(() =>
- {
- gate.Wait(() =>
- {
- state1 = action(state1);
- });
- }, period);
-
- return Disposable.Create(() =>
- {
- cancel.Dispose();
- gate.Dispose();
- action = Stubs<TState>.I;
- });
- }
-
- /// <summary>
- /// Discovers scheduler services by interface type.
- /// </summary>
- /// <param name="serviceType">Scheduler service interface type to discover.</param>
- /// <returns>Object implementing the requested service, if available; null otherwise.</returns>
- protected override object GetService(Type serviceType)
- {
- if (serviceType == typeof(ISchedulerLongRunning))
- {
- if (s_cal.SupportsLongRunning)
- {
- return LongRunning.Instance;
- }
- }
-
- return base.GetService(serviceType);
- }
-
- class LongRunning : ISchedulerLongRunning
- {
- public static ISchedulerLongRunning Instance = new LongRunning();
-
- public IDisposable ScheduleLongRunning<TState>(TState state, Action<TState, ICancelable> action)
- {
- if (action == null)
- throw new ArgumentNullException("action");
-
- var cancel = new BooleanDisposable();
-
- DefaultScheduler.s_cal.StartThread(
- arg =>
- {
- var d = (ICancelable)arg;
-
- //
- // Notice we don't check d.IsDisposed. The contract for ISchedulerLongRunning
- // requires us to ensure the scheduled work gets an opportunity to observe
- // the cancellation request.
- //
- action(state, d);
- },
- cancel
- );
-
- return cancel;
- }
- }
- }
-}
diff --git a/Rx.NET/System.Reactive.Core/Reactive/Concurrency/DisableOptimizationsScheduler.cs b/Rx.NET/System.Reactive.Core/Reactive/Concurrency/DisableOptimizationsScheduler.cs
deleted file mode 100644
index dec54b9..0000000
--- a/Rx.NET/System.Reactive.Core/Reactive/Concurrency/DisableOptimizationsScheduler.cs
+++ /dev/null
@@ -1,52 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System;
-using System.Linq;
-
-#if !NO_WEAKTABLE
-using System.Runtime.CompilerServices;
-#endif
-
-namespace System.Reactive.Concurrency
-{
- class DisableOptimizationsScheduler : SchedulerWrapper
- {
- private readonly Type[] _optimizationInterfaces;
-
- public DisableOptimizationsScheduler(IScheduler scheduler)
- : base(scheduler)
- {
- _optimizationInterfaces = Scheduler.OPTIMIZATIONS;
- }
-
- public DisableOptimizationsScheduler(IScheduler scheduler, Type[] optimizationInterfaces)
- : base(scheduler)
- {
- _optimizationInterfaces = optimizationInterfaces;
- }
-
-#if !NO_WEAKTABLE
- public DisableOptimizationsScheduler(IScheduler scheduler, Type[] optimizationInterfaces, ConditionalWeakTable<IScheduler, IScheduler> cache)
- : base(scheduler, cache)
- {
- _optimizationInterfaces = optimizationInterfaces;
- }
-
- protected override SchedulerWrapper Clone(IScheduler scheduler, ConditionalWeakTable<IScheduler, IScheduler> cache)
- {
- return new DisableOptimizationsScheduler(scheduler, _optimizationInterfaces, cache);
- }
-#else
- protected override SchedulerWrapper Clone(IScheduler scheduler)
- {
- return new DisableOptimizationsScheduler(scheduler, _optimizationInterfaces);
- }
-#endif
-
- protected override bool TryGetService(IServiceProvider provider, Type serviceType, out object service)
- {
- service = null;
- return _optimizationInterfaces.Contains(serviceType);
- }
- }
-}
diff --git a/Rx.NET/System.Reactive.Core/Reactive/Concurrency/ImmediateScheduler.cs b/Rx.NET/System.Reactive.Core/Reactive/Concurrency/ImmediateScheduler.cs
deleted file mode 100644
index 017fce5..0000000
--- a/Rx.NET/System.Reactive.Core/Reactive/Concurrency/ImmediateScheduler.cs
+++ /dev/null
@@ -1,123 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System.Threading;
-using System.Reactive.Disposables;
-
-namespace System.Reactive.Concurrency
-{
- /// <summary>
- /// Represents an object that schedules units of work to run immediately on the current thread.
- /// </summary>
- /// <seealso cref="Scheduler.Immediate">Singleton instance of this type exposed through this static property.</seealso>
- public sealed class ImmediateScheduler : LocalScheduler
- {
- private static readonly ImmediateScheduler s_instance = new ImmediateScheduler();
-
- ImmediateScheduler()
- {
- }
-
- /// <summary>
- /// Gets the singleton instance of the immediate scheduler.
- /// </summary>
- public static ImmediateScheduler Instance
- {
- get { return s_instance; }
- }
-
- /// <summary>
- /// Schedules an action to be executed.
- /// </summary>
- /// <typeparam name="TState">The type of the state passed to the scheduled action.</typeparam>
- /// <param name="state">State passed to the action to be executed.</param>
- /// <param name="action">Action to be executed.</param>
- /// <returns>The disposable object used to cancel the scheduled action (best effort).</returns>
- /// <exception cref="ArgumentNullException"><paramref name="action"/> is null.</exception>
- public override IDisposable Schedule<TState>(TState state, Func<IScheduler, TState, IDisposable> action)
- {
- if (action == null)
- throw new ArgumentNullException("action");
-
- return action(new AsyncLockScheduler(), state);
- }
-
- /// <summary>
- /// Schedules an action to be executed after dueTime.
- /// </summary>
- /// <typeparam name="TState">The type of the state passed to the scheduled action.</typeparam>
- /// <param name="state">State passed to the action to be executed.</param>
- /// <param name="action">Action to be executed.</param>
- /// <param name="dueTime">Relative time after which to execute the action.</param>
- /// <returns>The disposable object used to cancel the scheduled action (best effort).</returns>
- /// <exception cref="ArgumentNullException"><paramref name="action"/> is null.</exception>
- public override IDisposable Schedule<TState>(TState state, TimeSpan dueTime, Func<IScheduler, TState, IDisposable> action)
- {
- if (action == null)
- throw new ArgumentNullException("action");
-
- var dt = Scheduler.Normalize(dueTime);
- if (dt.Ticks > 0)
- {
- ConcurrencyAbstractionLayer.Current.Sleep(dt);
- }
-
- return action(new AsyncLockScheduler(), state);
- }
-
- class AsyncLockScheduler : LocalScheduler
- {
- AsyncLock asyncLock;
-
- public override IDisposable Schedule<TState>(TState state, Func<IScheduler, TState, IDisposable> action)
- {
- if (action == null)
- throw new ArgumentNullException("action");
-
- var m = new SingleAssignmentDisposable();
-
- if (asyncLock == null)
- asyncLock = new AsyncLock();
-
- asyncLock.Wait(() =>
- {
- if (!m.IsDisposed)
- m.Disposable = action(this, state);
- });
-
- return m;
- }
-
- public override IDisposable Schedule<TState>(TState state, TimeSpan dueTime, Func<IScheduler, TState, IDisposable> action)
- {
- if (action == null)
- throw new ArgumentNullException("action");
-
- if (dueTime.Ticks <= 0)
- return Schedule<TState>(state, action);
-
- var timer = ConcurrencyAbstractionLayer.Current.StartStopwatch();
-
- var m = new SingleAssignmentDisposable();
-
- if (asyncLock == null)
- asyncLock = new AsyncLock();
-
- asyncLock.Wait(() =>
- {
- if (!m.IsDisposed)
- {
- var sleep = dueTime - timer.Elapsed;
- if (sleep.Ticks > 0)
- {
- ConcurrencyAbstractionLayer.Current.Sleep(sleep);
- }
- if (!m.IsDisposed)
- m.Disposable = action(this, state);
- }
- });
-
- return m;
- }
- }
- }
-}
diff --git a/Rx.NET/System.Reactive.Core/Reactive/Concurrency/LocalScheduler.TimerQueue.cs b/Rx.NET/System.Reactive.Core/Reactive/Concurrency/LocalScheduler.TimerQueue.cs
deleted file mode 100644
index ded2b28..0000000
--- a/Rx.NET/System.Reactive.Core/Reactive/Concurrency/LocalScheduler.TimerQueue.cs
+++ /dev/null
@@ -1,487 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System.Collections.Generic;
-using System.Reactive.Disposables;
-using System.Reactive.PlatformServices;
-using System.Threading;
-
-namespace System.Reactive.Concurrency
-{
- public partial class LocalScheduler
- {
- /// <summary>
- /// Gate to protect queues and to synchronize scheduling decisions and system clock
- /// change management.
- /// </summary>
- private static readonly object s_gate = new object();
-
- /// <summary>
- /// Long term work queue. Contains work that's due beyond SHORTTERM, computed at the
- /// time of enqueueing.
- /// </summary>
- private static readonly PriorityQueue<WorkItem/*!*/> s_longTerm = new PriorityQueue<WorkItem/*!*/>();
-
- /// <summary>
- /// Disposable resource for the long term timer that will reevaluate and dispatch the
- /// first item in the long term queue. A serial disposable is used to make "dispose
- /// current and assign new" logic easier. The disposable itself is never disposed.
- /// </summary>
- private static readonly SerialDisposable s_nextLongTermTimer = new SerialDisposable();
-
- /// <summary>
- /// Item at the head of the long term queue for which the current long term timer is
- /// running. Used to detect changes in the queue and decide whether we should replace
- /// or can continue using the current timer (because no earlier long term work was
- /// added to the queue).
- /// </summary>
- private static WorkItem s_nextLongTermWorkItem = null;
-
- /// <summary>
- /// Short term work queue. Contains work that's due soon, computed at the time of
- /// enqueueing or upon reevaluation of the long term queue causing migration of work
- /// items. This queue is kept in order to be able to relocate short term items back
- /// to the long term queue in case a system clock change occurs.
- /// </summary>
- private static readonly PriorityQueue<WorkItem/*!*/> s_shortTerm = new PriorityQueue<WorkItem/*!*/>();
-
- /// <summary>
- /// Set of disposable handles to all of the current short term work Schedule calls,
- /// allowing those to be cancelled upon a system clock change.
- /// </summary>
-#if !NO_HASHSET
- private static readonly HashSet<IDisposable> s_shortTermWork = new HashSet<IDisposable>();
-#else
- private static readonly Dictionary<IDisposable, object> s_shortTermWork = new Dictionary<IDisposable, object>();
-#endif
-
- /// <summary>
- /// Threshold where an item is considered to be short term work or gets moved from
- /// long term to short term.
- /// </summary>
- private static readonly TimeSpan SHORTTERM = TimeSpan.FromSeconds(10);
-
- /// <summary>
- /// Maximum error ratio for timer drift. We've seen machines with 10s drift on a
- /// daily basis, which is in the order 10E-4, so we allow for extra margin here.
- /// This value is used to calculate early arrival for the long term queue timer
- /// that will reevaluate work for the short term queue.
- ///
- /// Example: -------------------------------...---------------------*-----$
- /// ^ ^
- /// | |
- /// early due
- /// 0.999 1.0
- ///
- /// We also make the gap between early and due at least LONGTOSHORT so we have
- /// enough time to transition work to short term and as a courtesy to the
- /// destination scheduler to manage its queues etc.
- /// </summary>
- private const int MAXERRORRATIO = 1000;
-
- /// <summary>
- /// Minimum threshold for the long term timer to fire before the queue is reevaluated
- /// for short term work. This value is chosen to be less than SHORTTERM in order to
- /// ensure the timer fires and has work to transition to the short term queue.
- /// </summary>
- private static readonly TimeSpan LONGTOSHORT = TimeSpan.FromSeconds(5);
-
- /// <summary>
- /// Threshold used to determine when a short term timer has fired too early compared
- /// to the absolute due time. This provides a last chance protection against early
- /// completion of scheduled work, which can happen in case of time adjustment in the
- /// operating system (cf. GetSystemTimeAdjustment).
- /// </summary>
- private static readonly TimeSpan RETRYSHORT = TimeSpan.FromMilliseconds(50);
-
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1810:InitializeReferenceTypeStaticFieldsInline", Justification = "We can't really lift this into a field initializer, and would end up checking for an initialization flag in every static method anyway (which is roughly what the JIT does in a thread-safe manner).")]
- static LocalScheduler()
- {
- //
- // Hook up for system clock change notifications. This doesn't do anything until the
- // AddRef method is called (which can throw).
- //
- SystemClock.SystemClockChanged += SystemClockChanged;
- }
-
- /// <summary>
- /// Enqueues absolute time scheduled work in the timer queue or the short term work list.
- /// </summary>
- /// <param name="scheduler">Scheduler to run the work on. Typically "this" from the caller's perspective (LocalScheduler.Schedule), but parameter kept because we have a single (static) timer queue across all of Rx local schedulers.</param>
- /// <param name="state">State to pass to the action.</param>
- /// <param name="dueTime">Absolute time to run the work on. The timer queue is responsible to execute the work close to the specified time, also accounting for system clock changes.</param>
- /// <param name="action">Action to run, potentially recursing into the scheduler.</param>
- /// <returns>Disposable object to prevent the work from running.</returns>
- private static IDisposable Enqueue<TState>(IScheduler scheduler, TState state, DateTimeOffset dueTime, Func<IScheduler, TState, IDisposable> action)
- {
- //
- // Work that's due in the past is sent to the underlying scheduler through the Schedule
- // overload for execution at TimeSpan.Zero. We don't go to the overload for immediate
- // scheduling in order to:
- //
- // - Preserve the time-based nature of the call as surfaced to the underlying scheduler,
- // as it may use different queuing strategies.
- //
- // - Optimize for the default behavior of LocalScheduler where a virtual call to Schedule
- // for immediate execution calls into the abstract Schedule method with TimeSpan.Zero.
- //
- var due = Scheduler.Normalize(dueTime - scheduler.Now);
- if (due == TimeSpan.Zero)
- {
- return scheduler.Schedule<TState>(state, TimeSpan.Zero, action);
- }
-
- //
- // We're going down the path of queueing up work or scheduling it, so we need to make
- // sure we can get system clock change notifications. If not, the call below is expected
- // to throw NotSupportedException. WorkItem.Invoke decreases the ref count again to allow
- // the system clock monitor to stop if there's no work left. Notice work items always
- // reach an execution stage since we don't dequeue items but merely mark them as cancelled
- // through WorkItem.Dispose. Double execution is also prevented, so the ref count should
- // correctly balance out.
- //
- SystemClock.AddRef();
-
- var workItem = new WorkItem<TState>(scheduler, state, dueTime, action);
-
- if (due <= SHORTTERM)
- {
- ScheduleShortTermWork(workItem);
- }
- else
- {
- ScheduleLongTermWork(workItem);
- }
-
- return workItem;
- }
-
- /// <summary>
- /// Schedule work that's due in the short term. This leads to relative scheduling calls to the
- /// underlying scheduler for short TimeSpan values. If the system clock changes in the meantime,
- /// the short term work is attempted to be cancelled and reevaluated.
- /// </summary>
- /// <param name="item">Work item to schedule in the short term. The caller is responsible to determine the work is indeed short term.</param>
- private static void ScheduleShortTermWork(WorkItem/*!*/ item)
- {
- lock (s_gate)
- {
- s_shortTerm.Enqueue(item);
-
- //
- // We don't bother trying to dequeue the item or stop the timer upon cancellation,
- // but always let the timer fire to do the queue maintenance. When the item is
- // cancelled, it won't run (see WorkItem.Invoke). In the event of a system clock
- // change, all outstanding work in s_shortTermWork is cancelled and the short
- // term queue is reevaluated, potentially prompting rescheduling of short term
- // work. Notice work is protected against double execution by the implementation
- // of WorkItem.Invoke.
- //
- var d = new SingleAssignmentDisposable();
-#if !NO_HASHSET
- s_shortTermWork.Add(d);
-#else
- s_shortTermWork.Add(d, null);
-#endif
-
- //
- // We normalize the time delta again (possibly redundant), because we can't assume
- // the underlying scheduler implementations is valid and deals with negative values
- // (though it should).
- //
- var dueTime = Scheduler.Normalize(item.DueTime - item.Scheduler.Now);
- d.Disposable = item.Scheduler.Schedule(d, dueTime, ExecuteNextShortTermWorkItem);
- }
- }
-
- /// <summary>
- /// Callback to process the next short term work item.
- /// </summary>
- /// <param name="scheduler">Recursive scheduler supplied by the underlying scheduler.</param>
- /// <param name="cancel">Disposable used to identify the work the timer was triggered for (see code for usage).</param>
- /// <returns>Empty disposable. Recursive work cancellation is wired through the original WorkItem.</returns>
- private static IDisposable ExecuteNextShortTermWorkItem(IScheduler scheduler, IDisposable cancel)
- {
- var next = default(WorkItem);
-
- lock (s_gate)
- {
- //
- // Notice that even though we try to cancel all work in the short term queue upon a
- // system clock change, cancellation may not be honored immediately and there's a
- // small chance this code runs for work that has been cancelled. Because the handler
- // doesn't execute the work that triggered the time-based Schedule call, but always
- // runs the work from the short term queue in order, we need to make sure we're not
- // stealing items in the queue. We can do so by remembering the object identity of
- // the disposable and check whether it still exists in the short term work list. If
- // not, a system clock change handler has gotten rid of it as part of reevaluating
- // the short term queue, but we still ended up here because the inherent race in the
- // call to Dispose versus the underlying timer. It's also possible the underlying
- // scheduler does a bad job at cancellation, so this measure helps for that too.
- //
- if (s_shortTermWork.Remove(cancel) && s_shortTerm.Count > 0)
- {
- next = s_shortTerm.Dequeue();
- }
- }
-
- if (next != null)
- {
- //
- // If things don't make sense and we're way too early to run the work, this is our
- // final chance to prevent us from running before the due time. This situation can
- // arise when Windows applies system clock adjustment (see SetSystemTimeAdjustment)
- // and as a result the clock is ticking slower. If the clock is ticking faster due
- // to such an adjustment, too bad :-). We try to minimize the window for the final
- // relative time based scheduling such that 10%+ adjustments to the clock rate
- // have only "little" impact (range of 100s of ms). On an absolute time scale, we
- // don't provide stronger guarantees.
- //
- if (next.DueTime - next.Scheduler.Now >= RETRYSHORT)
- {
- ScheduleShortTermWork(next);
- }
- else
- {
- //
- // Invocation happens on the recursive scheduler supplied to the function. We
- // are already running on the target scheduler, so we should stay on board.
- // Not doing so would have unexpected behavior for e.g. NewThreadScheduler,
- // causing a whole new thread to be allocated because of a top-level call to
- // the Schedule method rather than a recursive one.
- //
- // Notice if work got cancelled, the call to Invoke will not propagate to user
- // code because of the IsDisposed check inside.
- //
- next.Invoke(scheduler);
- }
- }
-
- //
- // No need to return anything better here. We already handed out the original WorkItem
- // object upon the call to Enqueue (called itself by Schedule). The disposable inside
- // the work item allows a cancellation request to chase the underlying computation.
- //
- return Disposable.Empty;
- }
-
- /// <summary>
- /// Schedule work that's due on the long term. This leads to the work being queued up for
- /// eventual transitioning to the short term work list.
- /// </summary>
- /// <param name="item">Work item to schedule on the long term. The caller is responsible to determine the work is indeed long term.</param>
- private static void ScheduleLongTermWork(WorkItem/*!*/ item)
- {
- lock (s_gate)
- {
- s_longTerm.Enqueue(item);
-
- //
- // In case we're the first long-term item in the queue now, the timer will have
- // to be updated.
- //
- UpdateLongTermProcessingTimer();
- }
- }
-
- /// <summary>
- /// Updates the long term timer which is responsible to transition work from the head of the
- /// long term queue to the short term work list.
- /// </summary>
- /// <remarks>Should be called under the scheduler lock.</remarks>
- private static void UpdateLongTermProcessingTimer()
- {
- /*
- * CALLERS - Ensure this is called under the lock!
- *
- lock (s_gate) */
- {
- if (s_longTerm.Count == 0)
- return;
-
- //
- // To avoid setting the timer all over again for the first work item if it hasn't changed,
- // we keep track of the next long term work item that will be processed by the timer.
- //
- var next = s_longTerm.Peek();
- if (next == s_nextLongTermWorkItem)
- return;
-
- //
- // We need to arrive early in order to accommodate for potential drift. The relative amount
- // of drift correction is kept in MAXERRORRATIO. At the very least, we want to be LONGTOSHORT
- // early to make the final jump from long term to short term, giving the target scheduler
- // enough time to process the item through its queue. LONGTOSHORT is chosen such that the
- // error due to drift is negligible.
- //
- var due = Scheduler.Normalize(next.DueTime - next.Scheduler.Now);
- var remainder = TimeSpan.FromTicks(Math.Max(due.Ticks / MAXERRORRATIO, LONGTOSHORT.Ticks));
- var dueEarly = due - remainder;
-
- s_nextLongTermWorkItem = next;
- s_nextLongTermTimer.Disposable = ConcurrencyAbstractionLayer.Current.StartTimer(EvaluateLongTermQueue, null, dueEarly);
- }
- }
-
- /// <summary>
- /// Evaluates the long term queue, transitioning short term work to the short term list,
- /// and adjusting the new long term processing timer accordingly.
- /// </summary>
- /// <param name="state">Ignored.</param>
- private static void EvaluateLongTermQueue(object state)
- {
- lock (s_gate)
- {
- var next = default(WorkItem);
-
- while (s_longTerm.Count > 0)
- {
- next = s_longTerm.Peek();
-
- var due = Scheduler.Normalize(next.DueTime - next.Scheduler.Now);
- if (due >= SHORTTERM)
- break;
-
- var item = s_longTerm.Dequeue();
- ScheduleShortTermWork(item);
- }
-
- s_nextLongTermWorkItem = null;
- UpdateLongTermProcessingTimer();
- }
- }
-
- /// <summary>
- /// Callback invoked when a system clock change is observed in order to adjust and reevaluate
- /// the internal scheduling queues.
- /// </summary>
- /// <param name="args">Currently not used.</param>
- /// <param name="sender">Currently not used.</param>
- private static void SystemClockChanged(object sender, SystemClockChangedEventArgs args)
- {
- lock (s_gate)
- {
- //
- // Best-effort cancellation of short term work. A check for presence in the hash set
- // is used to notice race conditions between cancellation and the timer firing (also
- // guarded by the same gate object). See checks in ExecuteNextShortTermWorkItem.
- //
-#if !NO_HASHSET
- foreach (var d in s_shortTermWork)
-#else
- foreach (var d in s_shortTermWork.Keys)
-#endif
- d.Dispose();
-
- s_shortTermWork.Clear();
-
- //
- // Transition short term work to the long term queue for reevaluation by calling the
- // EvaluateLongTermQueue method. We don't know which direction the clock was changed
- // in, so we don't optimize for special cases, but always transition the whole queue.
- // Notice the short term queue is bounded to SHORTTERM length.
- //
- while (s_shortTerm.Count > 0)
- {
- var next = s_shortTerm.Dequeue();
- s_longTerm.Enqueue(next);
- }
-
- //
- // Reevaluate the queue and don't forget to null out the current timer to force the
- // method to create a new timer for the new first long term item.
- //
- s_nextLongTermWorkItem = null;
- EvaluateLongTermQueue(null);
- }
- }
-
- /// <summary>
- /// Represents a work item in the absolute time scheduler.
- /// </summary>
- /// <remarks>
- /// This type is very similar to ScheduledItem, but we need a different Invoke signature to allow customization
- /// of the target scheduler (e.g. when called in a recursive scheduling context, see ExecuteNextShortTermWorkItem).
- /// </remarks>
- abstract class WorkItem : IComparable<WorkItem>, IDisposable
- {
- private readonly IScheduler _scheduler;
- private readonly DateTimeOffset _dueTime;
- private readonly SingleAssignmentDisposable _disposable;
- private int _hasRun;
-
- public WorkItem(IScheduler scheduler, DateTimeOffset dueTime)
- {
- _scheduler = scheduler;
- _dueTime = dueTime;
- _disposable = new SingleAssignmentDisposable();
- _hasRun = 0;
- }
-
- public IScheduler Scheduler
- {
- get { return _scheduler; }
- }
-
- public DateTimeOffset DueTime
- {
- get { return _dueTime; }
- }
-
- public void Invoke(IScheduler scheduler)
- {
- //
- // Protect against possible maltreatment of the scheduler queues or races in
- // execution of a work item that got relocated across system clock changes.
- // Under no circumstance whatsoever we should run work twice. The monitor's
- // ref count should also be subject to this policy.
- //
- if (Interlocked.Exchange(ref _hasRun, 1) == 0)
- {
- try
- {
- if (!_disposable.IsDisposed)
- _disposable.Disposable = InvokeCore(scheduler);
- }
- finally
- {
- SystemClock.Release();
- }
- }
- }
-
- protected abstract IDisposable InvokeCore(IScheduler scheduler);
-
- public int CompareTo(WorkItem/*!*/ other)
- {
- return Comparer<DateTimeOffset>.Default.Compare(this._dueTime, other._dueTime);
- }
-
- public void Dispose()
- {
- _disposable.Dispose();
- }
- }
-
- /// <summary>
- /// Represents a work item that closes over scheduler invocation state. Subtyping is
- /// used to have a common type for the scheduler queues.
- /// </summary>
- sealed class WorkItem<TState> : WorkItem
- {
- private readonly TState _state;
- private readonly Func<IScheduler, TState, IDisposable> _action;
-
- public WorkItem(IScheduler scheduler, TState state, DateTimeOffset dueTime, Func<IScheduler, TState, IDisposable> action)
- : base(scheduler, dueTime)
- {
- _state = state;
- _action = action;
- }
-
- protected override IDisposable InvokeCore(IScheduler scheduler)
- {
- return _action(scheduler, _state);
- }
- }
- }
-} \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Core/Reactive/Concurrency/LocalScheduler.cs b/Rx.NET/System.Reactive.Core/Reactive/Concurrency/LocalScheduler.cs
deleted file mode 100644
index b71367a..0000000
--- a/Rx.NET/System.Reactive.Core/Reactive/Concurrency/LocalScheduler.cs
+++ /dev/null
@@ -1,102 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System;
-
-namespace System.Reactive.Concurrency
-{
- /// <summary>
- /// Abstract base class for machine-local schedulers, using the local system clock for time-based operations.
- /// </summary>
- public abstract partial class LocalScheduler : IScheduler, IStopwatchProvider, IServiceProvider
- {
- /// <summary>
- /// Gets the scheduler's notion of current time.
- /// </summary>
- public virtual DateTimeOffset Now
- {
- get { return Scheduler.Now; }
- }
-
- /// <summary>
- /// Schedules an action to be executed.
- /// </summary>
- /// <typeparam name="TState">The type of the state passed to the scheduled action.</typeparam>
- /// <param name="state">State passed to the action to be executed.</param>
- /// <param name="action">Action to be executed.</param>
- /// <returns>The disposable object used to cancel the scheduled action (best effort).</returns>
- /// <exception cref="ArgumentNullException"><paramref name="action"/> is null.</exception>
- public virtual IDisposable Schedule<TState>(TState state, Func<IScheduler, TState, IDisposable> action)
- {
- if (action == null)
- throw new ArgumentNullException("action");
-
- return Schedule(state, TimeSpan.Zero, action);
- }
-
- /// <summary>
- /// Schedules an action to be executed after dueTime.
- /// </summary>
- /// <typeparam name="TState">The type of the state passed to the scheduled action.</typeparam>
- /// <param name="state">State passed to the action to be executed.</param>
- /// <param name="action">Action to be executed.</param>
- /// <param name="dueTime">Relative time after which to execute the action.</param>
- /// <returns>The disposable object used to cancel the scheduled action (best effort).</returns>
- public abstract IDisposable Schedule<TState>(TState state, TimeSpan dueTime, Func<IScheduler, TState, IDisposable> action);
-
- /// <summary>
- /// Schedules an action to be executed at dueTime.
- /// </summary>
- /// <typeparam name="TState">The type of the state passed to the scheduled action.</typeparam>
- /// <param name="state">State passed to the action to be executed.</param>
- /// <param name="action">Action to be executed.</param>
- /// <param name="dueTime">Absolute time at which to execute the action.</param>
- /// <returns>The disposable object used to cancel the scheduled action (best effort).</returns>
- /// <exception cref="ArgumentNullException"><paramref name="action"/> is null.</exception>
- public virtual IDisposable Schedule<TState>(TState state, DateTimeOffset dueTime, Func<IScheduler, TState, IDisposable> action)
- {
- if (action == null)
- throw new ArgumentNullException("action");
-
- return Enqueue(this, state, dueTime, action);
- }
-
- /// <summary>
- /// Starts a new stopwatch object.
- /// </summary>
- /// <returns>New stopwatch object; started at the time of the request.</returns>
- /// <remarks>
- /// Platform-specific scheduler implementations should reimplement IStopwatchProvider to provide a more
- /// efficient IStopwatch implementation (if available).
- /// </remarks>
- public virtual IStopwatch StartStopwatch()
- {
- return ConcurrencyAbstractionLayer.Current.StartStopwatch();
- }
-
- object IServiceProvider.GetService(Type serviceType)
- {
- return GetService(serviceType);
- }
-
- /// <summary>
- /// Discovers scheduler services by interface type. The base class implementation returns
- /// requested services for each scheduler interface implemented by the derived class. For
- /// more control over service discovery, derived types can override this method.
- /// </summary>
- /// <param name="serviceType">Scheduler service interface type to discover.</param>
- /// <returns>Object implementing the requested service, if available; null otherwise.</returns>
- protected virtual object GetService(Type serviceType)
- {
-#if !NO_PERF
- if (serviceType == typeof(IStopwatchProvider))
- return this as IStopwatchProvider;
- else if (serviceType == typeof(ISchedulerLongRunning))
- return this as ISchedulerLongRunning;
- else if (serviceType == typeof(ISchedulerPeriodic))
- return this as ISchedulerPeriodic;
-#endif
-
- return null;
- }
- }
-}
diff --git a/Rx.NET/System.Reactive.Core/Reactive/Concurrency/ScheduledItem.cs b/Rx.NET/System.Reactive.Core/Reactive/Concurrency/ScheduledItem.cs
deleted file mode 100644
index d3ea2f1..0000000
--- a/Rx.NET/System.Reactive.Core/Reactive/Concurrency/ScheduledItem.cs
+++ /dev/null
@@ -1,244 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System.Collections.Generic;
-using System.Reactive.Disposables;
-
-namespace System.Reactive.Concurrency
-{
- /// <summary>
- /// Abstract base class for scheduled work items.
- /// </summary>
- /// <typeparam name="TAbsolute">Absolute time representation type.</typeparam>
- public abstract class ScheduledItem<TAbsolute> : IScheduledItem<TAbsolute>, IComparable<ScheduledItem<TAbsolute>>
- where TAbsolute : IComparable<TAbsolute>
- {
- private readonly SingleAssignmentDisposable _disposable = new SingleAssignmentDisposable();
- private readonly TAbsolute _dueTime;
- private readonly IComparer<TAbsolute> _comparer;
-
- /// <summary>
- /// Creates a new scheduled work item to run at the specified time.
- /// </summary>
- /// <param name="dueTime">Absolute time at which the work item has to be executed.</param>
- /// <param name="comparer">Comparer used to compare work items based on their scheduled time.</param>
- /// <exception cref="ArgumentNullException"><paramref name="comparer"/> is null.</exception>
- protected ScheduledItem(TAbsolute dueTime, IComparer<TAbsolute> comparer)
- {
- if (comparer == null)
- throw new ArgumentNullException("comparer");
-
- _dueTime = dueTime;
- _comparer = comparer;
- }
-
- /// <summary>
- /// Gets the absolute time at which the item is due for invocation.
- /// </summary>
- public TAbsolute DueTime
- {
- get { return _dueTime; }
- }
-
- /// <summary>
- /// Invokes the work item.
- /// </summary>
- public void Invoke()
- {
- if (!_disposable.IsDisposed)
- _disposable.Disposable = InvokeCore();
- }
-
- /// <summary>
- /// Implement this method to perform the work item invocation, returning a disposable object for deep cancellation.
- /// </summary>
- /// <returns>Disposable object used to cancel the work item and/or derived work items.</returns>
- protected abstract IDisposable InvokeCore();
-
- #region Inequality
-
- /// <summary>
- /// Compares the work item with another work item based on absolute time values.
- /// </summary>
- /// <param name="other">Work item to compare the current work item to.</param>
- /// <returns>Relative ordering between this and the specified work item.</returns>
- /// <remarks>The inequality operators are overloaded to provide results consistent with the IComparable implementation. Equality operators implement traditional reference equality semantics.</remarks>
- public int CompareTo(ScheduledItem<TAbsolute> other)
- {
- // MSDN: By definition, any object compares greater than null, and two null references compare equal to each other.
- if (object.ReferenceEquals(other, null))
- return 1;
-
- return _comparer.Compare(DueTime, other.DueTime);
- }
-
- /// <summary>
- /// Determines whether one specified ScheduledItem&lt;TAbsolute&gt; object is due before a second specified ScheduledItem&lt;TAbsolute&gt; object.
- /// </summary>
- /// <param name="left">The first object to compare.</param>
- /// <param name="right">The second object to compare.</param>
- /// <returns>true if the DueTime value of left is earlier than the DueTime value of right; otherwise, false.</returns>
- /// <remarks>This operator provides results consistent with the IComparable implementation.</remarks>
- public static bool operator <(ScheduledItem<TAbsolute> left, ScheduledItem<TAbsolute> right)
- {
- return Comparer<ScheduledItem<TAbsolute>>.Default.Compare(left, right) < 0;
- }
-
- /// <summary>
- /// Determines whether one specified ScheduledItem&lt;TAbsolute&gt; object is due before or at the same of a second specified ScheduledItem&lt;TAbsolute&gt; object.
- /// </summary>
- /// <param name="left">The first object to compare.</param>
- /// <param name="right">The second object to compare.</param>
- /// <returns>true if the DueTime value of left is earlier than or simultaneous with the DueTime value of right; otherwise, false.</returns>
- /// <remarks>This operator provides results consistent with the IComparable implementation.</remarks>
- public static bool operator <=(ScheduledItem<TAbsolute> left, ScheduledItem<TAbsolute> right)
- {
- return Comparer<ScheduledItem<TAbsolute>>.Default.Compare(left, right) <= 0;
- }
-
- /// <summary>
- /// Determines whether one specified ScheduledItem&lt;TAbsolute&gt; object is due after a second specified ScheduledItem&lt;TAbsolute&gt; object.
- /// </summary>
- /// <param name="left">The first object to compare.</param>
- /// <param name="right">The second object to compare.</param>
- /// <returns>true if the DueTime value of left is later than the DueTime value of right; otherwise, false.</returns>
- /// <remarks>This operator provides results consistent with the IComparable implementation.</remarks>
- public static bool operator >(ScheduledItem<TAbsolute> left, ScheduledItem<TAbsolute> right)
- {
- return Comparer<ScheduledItem<TAbsolute>>.Default.Compare(left, right) > 0;
- }
-
- /// <summary>
- /// Determines whether one specified ScheduledItem&lt;TAbsolute&gt; object is due after or at the same time of a second specified ScheduledItem&lt;TAbsolute&gt; object.
- /// </summary>
- /// <param name="left">The first object to compare.</param>
- /// <param name="right">The second object to compare.</param>
- /// <returns>true if the DueTime value of left is later than or simultaneous with the DueTime value of right; otherwise, false.</returns>
- /// <remarks>This operator provides results consistent with the IComparable implementation.</remarks>
- public static bool operator >=(ScheduledItem<TAbsolute> left, ScheduledItem<TAbsolute> right)
- {
- return Comparer<ScheduledItem<TAbsolute>>.Default.Compare(left, right) >= 0;
- }
-
- #endregion
-
- #region Equality
-
- /// <summary>
- /// Determines whether two specified ScheduledItem&lt;TAbsolute, TValue&gt; objects are equal.
- /// </summary>
- /// <param name="left">The first object to compare.</param>
- /// <param name="right">The second object to compare.</param>
- /// <returns>true if both ScheduledItem&lt;TAbsolute, TValue&gt; are equal; otherwise, false.</returns>
- /// <remarks>This operator does not provide results consistent with the IComparable implementation. Instead, it implements reference equality.</remarks>
- public static bool operator ==(ScheduledItem<TAbsolute> left, ScheduledItem<TAbsolute> right)
- {
- return object.ReferenceEquals(left, right);
- }
-
- /// <summary>
- /// Determines whether two specified ScheduledItem&lt;TAbsolute, TValue&gt; objects are inequal.
- /// </summary>
- /// <param name="left">The first object to compare.</param>
- /// <param name="right">The second object to compare.</param>
- /// <returns>true if both ScheduledItem&lt;TAbsolute, TValue&gt; are inequal; otherwise, false.</returns>
- /// <remarks>This operator does not provide results consistent with the IComparable implementation. Instead, it implements reference equality.</remarks>
- public static bool operator !=(ScheduledItem<TAbsolute> left, ScheduledItem<TAbsolute> right)
- {
- return !(left == right);
- }
-
- /// <summary>
- /// Determines whether a ScheduledItem&lt;TAbsolute&gt; object is equal to the specified object.
- /// </summary>
- /// <param name="obj">The object to compare to the current ScheduledItem&lt;TAbsolute&gt; object.</param>
- /// <returns>true if the obj parameter is a ScheduledItem&lt;TAbsolute&gt; object and is equal to the current ScheduledItem&lt;TAbsolute&gt; object; otherwise, false.</returns>
- public override bool Equals(object obj)
- {
- return object.ReferenceEquals(this, obj);
- }
-
- /// <summary>
- /// Returns the hash code for the current ScheduledItem&lt;TAbsolute&gt; object.
- /// </summary>
- /// <returns>A 32-bit signed integer hash code.</returns>
- public override int GetHashCode()
- {
- return base.GetHashCode();
- }
-
- #endregion
-
- /// <summary>
- /// Cancels the work item by disposing the resource returned by InvokeCore as soon as possible.
- /// </summary>
- public void Cancel()
- {
- _disposable.Dispose();
- }
-
- /// <summary>
- /// Gets whether the work item has received a cancellation request.
- /// </summary>
- public bool IsCanceled
- {
- get { return _disposable.IsDisposed; }
- }
- }
-
- /// <summary>
- /// Represents a scheduled work item based on the materialization of an IScheduler.Schedule method call.
- /// </summary>
- /// <typeparam name="TAbsolute">Absolute time representation type.</typeparam>
- /// <typeparam name="TValue">Type of the state passed to the scheduled action.</typeparam>
- public sealed class ScheduledItem<TAbsolute, TValue> : ScheduledItem<TAbsolute>
- where TAbsolute : IComparable<TAbsolute>
- {
- private readonly IScheduler _scheduler;
- private readonly TValue _state;
- private readonly Func<IScheduler, TValue, IDisposable> _action;
-
- /// <summary>
- /// Creates a materialized work item.
- /// </summary>
- /// <param name="scheduler">Recursive scheduler to invoke the scheduled action with.</param>
- /// <param name="state">State to pass to the scheduled action.</param>
- /// <param name="action">Scheduled action.</param>
- /// <param name="dueTime">Time at which to run the scheduled action.</param>
- /// <param name="comparer">Comparer used to compare work items based on their scheduled time.</param>
- /// <exception cref="ArgumentNullException"><paramref name="scheduler"/> or <paramref name="action"/> or <paramref name="comparer"/> is null.</exception>
- public ScheduledItem(IScheduler scheduler, TValue state, Func<IScheduler, TValue, IDisposable> action, TAbsolute dueTime, IComparer<TAbsolute> comparer)
- : base(dueTime, comparer)
- {
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
- if (action == null)
- throw new ArgumentNullException("action");
-
- _scheduler = scheduler;
- _state = state;
- _action = action;
- }
-
- /// <summary>
- /// Creates a materialized work item.
- /// </summary>
- /// <param name="scheduler">Recursive scheduler to invoke the scheduled action with.</param>
- /// <param name="state">State to pass to the scheduled action.</param>
- /// <param name="action">Scheduled action.</param>
- /// <param name="dueTime">Time at which to run the scheduled action.</param>
- /// <exception cref="ArgumentNullException"><paramref name="scheduler"/> or <paramref name="action"/> is null.</exception>
- public ScheduledItem(IScheduler scheduler, TValue state, Func<IScheduler, TValue, IDisposable> action, TAbsolute dueTime)
- : this(scheduler, state, action, dueTime, Comparer<TAbsolute>.Default)
- {
- }
-
- /// <summary>
- /// Invokes the scheduled action with the supplied recursive scheduler and state.
- /// </summary>
- /// <returns>Cancellation resource returned by the scheduled action.</returns>
- protected override IDisposable InvokeCore()
- {
- return _action(_scheduler, _state);
- }
- }
-}
diff --git a/Rx.NET/System.Reactive.Core/Reactive/Concurrency/Scheduler.Async.cs b/Rx.NET/System.Reactive.Core/Reactive/Concurrency/Scheduler.Async.cs
deleted file mode 100644
index ac881a8..0000000
--- a/Rx.NET/System.Reactive.Core/Reactive/Concurrency/Scheduler.Async.cs
+++ /dev/null
@@ -1,432 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if HAS_AWAIT
-using System.Reactive.Disposables;
-using System.Threading;
-using System.Threading.Tasks;
-
-namespace System.Reactive.Concurrency
-{
- public static partial class Scheduler
- {
- /// <summary>
- /// Yields execution of the current work item on the scheduler to another work item on the scheduler.
- /// The caller should await the result of calling Yield to schedule the remainder of the current work item (known as the continuation).
- /// </summary>
- /// <param name="scheduler">Scheduler to yield work on.</param>
- /// <returns>Scheduler operation object to await in order to schedule the continuation.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="scheduler"/> is null.</exception>
- public static SchedulerOperation Yield(this IScheduler scheduler)
- {
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return new SchedulerOperation(a => scheduler.Schedule(a), scheduler.GetCancellationToken());
- }
-
- /// <summary>
- /// Yields execution of the current work item on the scheduler to another work item on the scheduler.
- /// The caller should await the result of calling Yield to schedule the remainder of the current work item (known as the continuation).
- /// </summary>
- /// <param name="scheduler">Scheduler to yield work on.</param>
- /// <param name="cancellationToken">Cancellation token to cancel the continuation to run.</param>
- /// <returns>Scheduler operation object to await in order to schedule the continuation.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="scheduler"/> is null.</exception>
- public static SchedulerOperation Yield(this IScheduler scheduler, CancellationToken cancellationToken)
- {
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return new SchedulerOperation(a => scheduler.Schedule(a), cancellationToken);
- }
-
- /// <summary>
- /// Suspends execution of the current work item on the scheduler for the specified duration.
- /// The caller should await the result of calling Sleep to schedule the remainder of the current work item (known as the continuation) after the specified duration.
- /// </summary>
- /// <param name="scheduler">Scheduler to yield work on.</param>
- /// <param name="dueTime">Time when the continuation should run.</param>
- /// <returns>Scheduler operation object to await in order to schedule the continuation.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="scheduler"/> is null.</exception>
- public static SchedulerOperation Sleep(this IScheduler scheduler, TimeSpan dueTime)
- {
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return new SchedulerOperation(a => scheduler.Schedule(dueTime, a), scheduler.GetCancellationToken());
- }
-
- /// <summary>
- /// Suspends execution of the current work item on the scheduler for the specified duration.
- /// The caller should await the result of calling Sleep to schedule the remainder of the current work item (known as the continuation) after the specified duration.
- /// </summary>
- /// <param name="scheduler">Scheduler to yield work on.</param>
- /// <param name="dueTime">Time when the continuation should run.</param>
- /// <param name="cancellationToken">Cancellation token to cancel the continuation to run.</param>
- /// <returns>Scheduler operation object to await in order to schedule the continuation.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="scheduler"/> is null.</exception>
- public static SchedulerOperation Sleep(this IScheduler scheduler, TimeSpan dueTime, CancellationToken cancellationToken)
- {
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return new SchedulerOperation(a => scheduler.Schedule(dueTime, a), cancellationToken);
- }
-
- /// <summary>
- /// Suspends execution of the current work item on the scheduler until the specified due time.
- /// The caller should await the result of calling Sleep to schedule the remainder of the current work item (known as the continuation) at the specified due time.
- /// </summary>
- /// <param name="scheduler">Scheduler to yield work on.</param>
- /// <param name="dueTime">Time when the continuation should run.</param>
- /// <returns>Scheduler operation object to await in order to schedule the continuation.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="scheduler"/> is null.</exception>
- public static SchedulerOperation Sleep(this IScheduler scheduler, DateTimeOffset dueTime)
- {
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return new SchedulerOperation(a => scheduler.Schedule(dueTime, a), scheduler.GetCancellationToken());
- }
-
- /// <summary>
- /// Suspends execution of the current work item on the scheduler until the specified due time.
- /// The caller should await the result of calling Sleep to schedule the remainder of the current work item (known as the continuation) at the specified due time.
- /// </summary>
- /// <param name="scheduler">Scheduler to yield work on.</param>
- /// <param name="dueTime">Time when the continuation should run.</param>
- /// <param name="cancellationToken">Cancellation token to cancel the continuation to run.</param>
- /// <returns>Scheduler operation object to await in order to schedule the continuation.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="scheduler"/> is null.</exception>
- public static SchedulerOperation Sleep(this IScheduler scheduler, DateTimeOffset dueTime, CancellationToken cancellationToken)
- {
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return new SchedulerOperation(a => scheduler.Schedule(dueTime, a), cancellationToken);
- }
-
- /// <summary>
- /// Schedules work using an asynchronous method, allowing for cooperative scheduling in an imperative coding style.
- /// </summary>
- /// <typeparam name="TState">The type of the state passed to the scheduled action.</typeparam>
- /// <param name="scheduler">Scheduler to schedule work on.</param>
- /// <param name="state">State to pass to the asynchronous method.</param>
- /// <param name="action">Asynchronous method to run the work, using Yield and Sleep operations for cooperative scheduling and injection of cancellation points.</param>
- /// <returns>Disposable object that allows to cancel outstanding work on cooperative cancellation points or through the cancellation token passed to the asynchronous method.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="scheduler"/> or <paramref name="action"/> is null.</exception>
- public static IDisposable ScheduleAsync<TState>(this IScheduler scheduler, TState state, Func<IScheduler, TState, CancellationToken, Task> action)
- {
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
- if (action == null)
- throw new ArgumentNullException("action");
-
- return ScheduleAsync_<TState>(scheduler, state, action);
- }
-
- /// <summary>
- /// Schedules work using an asynchronous method, allowing for cooperative scheduling in an imperative coding style.
- /// </summary>
- /// <typeparam name="TState">The type of the state passed to the scheduled action.</typeparam>
- /// <param name="scheduler">Scheduler to schedule work on.</param>
- /// <param name="state">State to pass to the asynchronous method.</param>
- /// <param name="action">Asynchronous method to run the work, using Yield and Sleep operations for cooperative scheduling and injection of cancellation points.</param>
- /// <returns>Disposable object that allows to cancel outstanding work on cooperative cancellation points or through the cancellation token passed to the asynchronous method.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="scheduler"/> or <paramref name="action"/> is null.</exception>
- public static IDisposable ScheduleAsync<TState>(this IScheduler scheduler, TState state, Func<IScheduler, TState, CancellationToken, Task<IDisposable>> action)
- {
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
- if (action == null)
- throw new ArgumentNullException("action");
-
- return ScheduleAsync_<TState>(scheduler, state, action);
- }
-
- /// <summary>
- /// Schedules work using an asynchronous method, allowing for cooperative scheduling in an imperative coding style.
- /// </summary>
- /// <param name="scheduler">Scheduler to schedule work on.</param>
- /// <param name="action">Asynchronous method to run the work, using Yield and Sleep operations for cooperative scheduling and injection of cancellation points.</param>
- /// <returns>Disposable object that allows to cancel outstanding work on cooperative cancellation points or through the cancellation token passed to the asynchronous method.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="scheduler"/> or <paramref name="action"/> is null.</exception>
- public static IDisposable ScheduleAsync(this IScheduler scheduler, Func<IScheduler, CancellationToken, Task> action)
- {
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
- if (action == null)
- throw new ArgumentNullException("action");
-
- return ScheduleAsync_(scheduler, default(object), (self, o, ct) => action(self, ct));
- }
-
- /// <summary>
- /// Schedules work using an asynchronous method, allowing for cooperative scheduling in an imperative coding style.
- /// </summary>
- /// <param name="scheduler">Scheduler to schedule work on.</param>
- /// <param name="action">Asynchronous method to run the work, using Yield and Sleep operations for cooperative scheduling and injection of cancellation points.</param>
- /// <returns>Disposable object that allows to cancel outstanding work on cooperative cancellation points or through the cancellation token passed to the asynchronous method.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="scheduler"/> or <paramref name="action"/> is null.</exception>
- public static IDisposable ScheduleAsync(this IScheduler scheduler, Func<IScheduler, CancellationToken, Task<IDisposable>> action)
- {
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
- if (action == null)
- throw new ArgumentNullException("action");
-
- return ScheduleAsync_(scheduler, default(object), (self, o, ct) => action(self, ct));
- }
-
- /// <summary>
- /// Schedules work using an asynchronous method, allowing for cooperative scheduling in an imperative coding style.
- /// </summary>
- /// <typeparam name="TState">The type of the state passed to the scheduled action.</typeparam>
- /// <param name="scheduler">Scheduler to schedule work on.</param>
- /// <param name="state">State to pass to the asynchronous method.</param>
- /// <param name="dueTime">Relative time after which to execute the action.</param>
- /// <param name="action">Asynchronous method to run the work, using Yield and Sleep operations for cooperative scheduling and injection of cancellation points.</param>
- /// <returns>Disposable object that allows to cancel outstanding work on cooperative cancellation points or through the cancellation token passed to the asynchronous method.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="scheduler"/> or <paramref name="action"/> is null.</exception>
- public static IDisposable ScheduleAsync<TState>(this IScheduler scheduler, TState state, TimeSpan dueTime, Func<IScheduler, TState, CancellationToken, Task> action)
- {
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
- if (action == null)
- throw new ArgumentNullException("action");
-
- return ScheduleAsync_(scheduler, state, dueTime, action);
- }
-
- /// <summary>
- /// Schedules work using an asynchronous method, allowing for cooperative scheduling in an imperative coding style.
- /// </summary>
- /// <typeparam name="TState">The type of the state passed to the scheduled action.</typeparam>
- /// <param name="scheduler">Scheduler to schedule work on.</param>
- /// <param name="state">State to pass to the asynchronous method.</param>
- /// <param name="dueTime">Relative time after which to execute the action.</param>
- /// <param name="action">Asynchronous method to run the work, using Yield and Sleep operations for cooperative scheduling and injection of cancellation points.</param>
- /// <returns>Disposable object that allows to cancel outstanding work on cooperative cancellation points or through the cancellation token passed to the asynchronous method.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="scheduler"/> or <paramref name="action"/> is null.</exception>
- public static IDisposable ScheduleAsync<TState>(this IScheduler scheduler, TState state, TimeSpan dueTime, Func<IScheduler, TState, CancellationToken, Task<IDisposable>> action)
- {
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
- if (action == null)
- throw new ArgumentNullException("action");
-
- return ScheduleAsync_(scheduler, state, dueTime, action);
- }
-
- /// <summary>
- /// Schedules work using an asynchronous method, allowing for cooperative scheduling in an imperative coding style.
- /// </summary>
- /// <param name="scheduler">Scheduler to schedule work on.</param>
- /// <param name="dueTime">Relative time after which to execute the action.</param>
- /// <param name="action">Asynchronous method to run the work, using Yield and Sleep operations for cooperative scheduling and injection of cancellation points.</param>
- /// <returns>Disposable object that allows to cancel outstanding work on cooperative cancellation points or through the cancellation token passed to the asynchronous method.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="scheduler"/> or <paramref name="action"/> is null.</exception>
- public static IDisposable ScheduleAsync(this IScheduler scheduler, TimeSpan dueTime, Func<IScheduler, CancellationToken, Task> action)
- {
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
- if (action == null)
- throw new ArgumentNullException("action");
-
- return ScheduleAsync_(scheduler, default(object), dueTime, (self, o, ct) => action(self, ct));
- }
-
- /// <summary>
- /// Schedules work using an asynchronous method, allowing for cooperative scheduling in an imperative coding style.
- /// </summary>
- /// <param name="scheduler">Scheduler to schedule work on.</param>
- /// <param name="dueTime">Relative time after which to execute the action.</param>
- /// <param name="action">Asynchronous method to run the work, using Yield and Sleep operations for cooperative scheduling and injection of cancellation points.</param>
- /// <returns>Disposable object that allows to cancel outstanding work on cooperative cancellation points or through the cancellation token passed to the asynchronous method.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="scheduler"/> or <paramref name="action"/> is null.</exception>
- public static IDisposable ScheduleAsync(this IScheduler scheduler, TimeSpan dueTime, Func<IScheduler, CancellationToken, Task<IDisposable>> action)
- {
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
- if (action == null)
- throw new ArgumentNullException("action");
-
- return ScheduleAsync_(scheduler, default(object), dueTime, (self, o, ct) => action(self, ct));
- }
-
- /// <summary>
- /// Schedules work using an asynchronous method, allowing for cooperative scheduling in an imperative coding style.
- /// </summary>
- /// <typeparam name="TState">The type of the state passed to the scheduled action.</typeparam>
- /// <param name="scheduler">Scheduler to schedule work on.</param>
- /// <param name="state">State to pass to the asynchronous method.</param>
- /// <param name="dueTime">Absolute time at which to execute the action.</param>
- /// <param name="action">Asynchronous method to run the work, using Yield and Sleep operations for cooperative scheduling and injection of cancellation points.</param>
- /// <returns>Disposable object that allows to cancel outstanding work on cooperative cancellation points or through the cancellation token passed to the asynchronous method.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="scheduler"/> or <paramref name="action"/> is null.</exception>
- public static IDisposable ScheduleAsync<TState>(this IScheduler scheduler, TState state, DateTimeOffset dueTime, Func<IScheduler, TState, CancellationToken, Task> action)
- {
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
- if (action == null)
- throw new ArgumentNullException("action");
-
- return ScheduleAsync_(scheduler, state, dueTime, action);
- }
-
- /// <summary>
- /// Schedules work using an asynchronous method, allowing for cooperative scheduling in an imperative coding style.
- /// </summary>
- /// <typeparam name="TState">The type of the state passed to the scheduled action.</typeparam>
- /// <param name="scheduler">Scheduler to schedule work on.</param>
- /// <param name="state">State to pass to the asynchronous method.</param>
- /// <param name="dueTime">Absolute time at which to execute the action.</param>
- /// <param name="action">Asynchronous method to run the work, using Yield and Sleep operations for cooperative scheduling and injection of cancellation points.</param>
- /// <returns>Disposable object that allows to cancel outstanding work on cooperative cancellation points or through the cancellation token passed to the asynchronous method.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="scheduler"/> or <paramref name="action"/> is null.</exception>
- public static IDisposable ScheduleAsync<TState>(this IScheduler scheduler, TState state, DateTimeOffset dueTime, Func<IScheduler, TState, CancellationToken, Task<IDisposable>> action)
- {
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
- if (action == null)
- throw new ArgumentNullException("action");
-
- return ScheduleAsync_(scheduler, state, dueTime, action);
- }
-
- /// <summary>
- /// Schedules work using an asynchronous method, allowing for cooperative scheduling in an imperative coding style.
- /// </summary>
- /// <param name="scheduler">Scheduler to schedule work on.</param>
- /// <param name="dueTime">Absolute time at which to execute the action.</param>
- /// <param name="action">Asynchronous method to run the work, using Yield and Sleep operations for cooperative scheduling and injection of cancellation points.</param>
- /// <returns>Disposable object that allows to cancel outstanding work on cooperative cancellation points or through the cancellation token passed to the asynchronous method.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="scheduler"/> or <paramref name="action"/> is null.</exception>
- public static IDisposable ScheduleAsync(this IScheduler scheduler, DateTimeOffset dueTime, Func<IScheduler, CancellationToken, Task> action)
- {
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
- if (action == null)
- throw new ArgumentNullException("action");
-
- return ScheduleAsync_(scheduler, default(object), dueTime, (self, o, ct) => action(self, ct));
- }
-
- /// <summary>
- /// Schedules work using an asynchronous method, allowing for cooperative scheduling in an imperative coding style.
- /// </summary>
- /// <param name="scheduler">Scheduler to schedule work on.</param>
- /// <param name="dueTime">Absolute time at which to execute the action.</param>
- /// <param name="action">Asynchronous method to run the work, using Yield and Sleep operations for cooperative scheduling and injection of cancellation points.</param>
- /// <returns>Disposable object that allows to cancel outstanding work on cooperative cancellation points or through the cancellation token passed to the asynchronous method.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="scheduler"/> or <paramref name="action"/> is null.</exception>
- public static IDisposable ScheduleAsync(this IScheduler scheduler, DateTimeOffset dueTime, Func<IScheduler, CancellationToken, Task<IDisposable>> action)
- {
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
- if (action == null)
- throw new ArgumentNullException("action");
-
- return ScheduleAsync_(scheduler, default(object), dueTime, (self, o, ct) => action(self, ct));
- }
-
- private static IDisposable ScheduleAsync_<TState>(IScheduler scheduler, TState state, Func<IScheduler, TState, CancellationToken, Task> action)
- {
- return scheduler.Schedule(state, (self, s) => InvokeAsync(self, s, action));
- }
-
- private static IDisposable ScheduleAsync_<TState>(IScheduler scheduler, TState state, Func<IScheduler, TState, CancellationToken, Task<IDisposable>> action)
- {
- return scheduler.Schedule(state, (self, s) => InvokeAsync(self, s, action));
- }
-
- private static IDisposable ScheduleAsync_<TState>(IScheduler scheduler, TState state, TimeSpan dueTime, Func<IScheduler, TState, CancellationToken, Task> action)
- {
- return scheduler.Schedule(state, dueTime, (self, s) => InvokeAsync(self, s, action));
- }
-
- private static IDisposable ScheduleAsync_<TState>(IScheduler scheduler, TState state, TimeSpan dueTime, Func<IScheduler, TState, CancellationToken, Task<IDisposable>> action)
- {
- return scheduler.Schedule(state, dueTime, (self, s) => InvokeAsync(self, s, action));
- }
-
- private static IDisposable ScheduleAsync_<TState>(IScheduler scheduler, TState state, DateTimeOffset dueTime, Func<IScheduler, TState, CancellationToken, Task> action)
- {
- return scheduler.Schedule(state, dueTime, (self, s) => InvokeAsync(self, s, action));
- }
-
- private static IDisposable ScheduleAsync_<TState>(IScheduler scheduler, TState state, DateTimeOffset dueTime, Func<IScheduler, TState, CancellationToken, Task<IDisposable>> action)
- {
- return scheduler.Schedule(state, dueTime, (self, s) => InvokeAsync(self, s, action));
- }
-
- private static IDisposable InvokeAsync<TState>(IScheduler self, TState s, Func<IScheduler, TState, CancellationToken, Task<IDisposable>> action)
- {
- var c = new CancellationDisposable();
- var d = new SingleAssignmentDisposable();
-
- action(new CancelableScheduler(self, c.Token), s, c.Token).ContinueWith(t =>
- {
- if (t.IsCanceled)
- return;
-
- if (t.Exception != null)
- t.Exception.Handle(e => e is OperationCanceledException);
-
- d.Disposable = t.Result;
- }, TaskContinuationOptions.ExecuteSynchronously);
-
- return new CompositeDisposable(c, d);
- }
-
- private static IDisposable InvokeAsync<TState>(IScheduler self, TState s, Func<IScheduler, TState, CancellationToken, Task> action)
- {
- return InvokeAsync(self, s, (self_, state, ct) => action(self_, state, ct).ContinueWith(_ => Disposable.Empty));
- }
-
- private static CancellationToken GetCancellationToken(this IScheduler scheduler)
- {
- var cs = scheduler as CancelableScheduler;
- return cs != null ? cs.Token : CancellationToken.None;
- }
-
- class CancelableScheduler : IScheduler
- {
- private readonly IScheduler _scheduler;
- private readonly CancellationToken _cancellationToken;
-
- public CancelableScheduler(IScheduler scheduler, CancellationToken cancellationToken)
- {
- _scheduler = scheduler;
- _cancellationToken = cancellationToken;
- }
-
- public CancellationToken Token
- {
- get { return _cancellationToken; }
- }
-
- public DateTimeOffset Now
- {
- get { return _scheduler.Now; }
- }
-
- public IDisposable Schedule<TState>(TState state, Func<IScheduler, TState, IDisposable> action)
- {
- return _scheduler.Schedule(state, action);
- }
-
- public IDisposable Schedule<TState>(TState state, TimeSpan dueTime, Func<IScheduler, TState, IDisposable> action)
- {
- return _scheduler.Schedule(state, dueTime, action);
- }
-
- public IDisposable Schedule<TState>(TState state, DateTimeOffset dueTime, Func<IScheduler, TState, IDisposable> action)
- {
- return _scheduler.Schedule(state, dueTime, action);
- }
- }
-
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Core/Reactive/Concurrency/Scheduler.Recursive.cs b/Rx.NET/System.Reactive.Core/Reactive/Concurrency/Scheduler.Recursive.cs
deleted file mode 100644
index 564b999..0000000
--- a/Rx.NET/System.Reactive.Core/Reactive/Concurrency/Scheduler.Recursive.cs
+++ /dev/null
@@ -1,254 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System;
-using System.Reactive.Disposables;
-
-namespace System.Reactive.Concurrency
-{
- public static partial class Scheduler
- {
- /// <summary>
- /// Schedules an action to be executed recursively.
- /// </summary>
- /// <param name="scheduler">Scheduler to execute the recursive action on.</param>
- /// <param name="action">Action to execute recursively. The parameter passed to the action is used to trigger recursive scheduling of the action.</param>
- /// <returns>The disposable object used to cancel the scheduled action (best effort).</returns>
- /// <exception cref="ArgumentNullException"><paramref name="scheduler"/> or <paramref name="action"/> is null.</exception>
- public static IDisposable Schedule(this IScheduler scheduler, Action<Action> action)
- {
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
- if (action == null)
- throw new ArgumentNullException("action");
-
- return scheduler.Schedule(action, (_action, self) => _action(() => self(_action)));
- }
-
- /// <summary>
- /// Schedules an action to be executed recursively.
- /// </summary>
- /// <typeparam name="TState">The type of the state passed to the scheduled action.</typeparam>
- /// <param name="scheduler">Scheduler to execute the recursive action on.</param>
- /// <param name="state">State passed to the action to be executed.</param>
- /// <param name="action">Action to execute recursively. The last parameter passed to the action is used to trigger recursive scheduling of the action, passing in recursive invocation state.</param>
- /// <returns>The disposable object used to cancel the scheduled action (best effort).</returns>
- /// <exception cref="ArgumentNullException"><paramref name="scheduler"/> or <paramref name="action"/> is null.</exception>
- public static IDisposable Schedule<TState>(this IScheduler scheduler, TState state, Action<TState, Action<TState>> action)
- {
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
- if (action == null)
- throw new ArgumentNullException("action");
-
- return scheduler.Schedule(new Pair<TState, Action<TState, Action<TState>>> { First = state, Second = action }, InvokeRec1);
- }
-
- static IDisposable InvokeRec1<TState>(IScheduler scheduler, Pair<TState, Action<TState, Action<TState>>> pair)
- {
- var group = new CompositeDisposable(1);
- var gate = new object();
- var state = pair.First;
- var action = pair.Second;
-
- Action<TState> recursiveAction = null;
- recursiveAction = state1 => action(state1, state2 =>
- {
- var isAdded = false;
- var isDone = false;
- var d = default(IDisposable);
- d = scheduler.Schedule(state2, (scheduler1, state3) =>
- {
- lock (gate)
- {
- if (isAdded)
- group.Remove(d);
- else
- isDone = true;
- }
- recursiveAction(state3);
- return Disposable.Empty;
- });
-
- lock (gate)
- {
- if (!isDone)
- {
- group.Add(d);
- isAdded = true;
- }
- }
- });
-
- recursiveAction(state);
-
- return group;
- }
-
- /// <summary>
- /// Schedules an action to be executed recursively after a specified relative due time.
- /// </summary>
- /// <param name="scheduler">Scheduler to execute the recursive action on.</param>
- /// <param name="action">Action to execute recursively. The parameter passed to the action is used to trigger recursive scheduling of the action at the specified relative time.</param>
- /// <param name="dueTime">Relative time after which to execute the action for the first time.</param>
- /// <returns>The disposable object used to cancel the scheduled action (best effort).</returns>
- /// <exception cref="ArgumentNullException"><paramref name="scheduler"/> or <paramref name="action"/> is null.</exception>
- public static IDisposable Schedule(this IScheduler scheduler, TimeSpan dueTime, Action<Action<TimeSpan>> action)
- {
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
- if (action == null)
- throw new ArgumentNullException("action");
-
- return scheduler.Schedule(action, dueTime, (_action, self) => _action(dt => self(_action, dt)));
- }
-
- /// <summary>
- /// Schedules an action to be executed recursively after a specified relative due time.
- /// </summary>
- /// <typeparam name="TState">The type of the state passed to the scheduled action.</typeparam>
- /// <param name="scheduler">Scheduler to execute the recursive action on.</param>
- /// <param name="state">State passed to the action to be executed.</param>
- /// <param name="action">Action to execute recursively. The last parameter passed to the action is used to trigger recursive scheduling of the action, passing in the recursive due time and invocation state.</param>
- /// <param name="dueTime">Relative time after which to execute the action for the first time.</param>
- /// <returns>The disposable object used to cancel the scheduled action (best effort).</returns>
- /// <exception cref="ArgumentNullException"><paramref name="scheduler"/> or <paramref name="action"/> is null.</exception>
- public static IDisposable Schedule<TState>(this IScheduler scheduler, TState state, TimeSpan dueTime, Action<TState, Action<TState, TimeSpan>> action)
- {
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
- if (action == null)
- throw new ArgumentNullException("action");
-
- return scheduler.Schedule(new Pair<TState, Action<TState, Action<TState, TimeSpan>>> { First = state, Second = action }, dueTime, InvokeRec2);
- }
-
- static IDisposable InvokeRec2<TState>(IScheduler scheduler, Pair<TState, Action<TState, Action<TState, TimeSpan>>> pair)
- {
- var group = new CompositeDisposable(1);
- var gate = new object();
- var state = pair.First;
- var action = pair.Second;
-
- Action<TState> recursiveAction = null;
- recursiveAction = state1 => action(state1, (state2, dueTime1) =>
- {
- var isAdded = false;
- var isDone = false;
- var d = default(IDisposable);
- d = scheduler.Schedule(state2, dueTime1, (scheduler1, state3) =>
- {
- lock (gate)
- {
- if (isAdded)
- group.Remove(d);
- else
- isDone = true;
- }
- recursiveAction(state3);
- return Disposable.Empty;
- });
-
- lock (gate)
- {
- if (!isDone)
- {
- group.Add(d);
- isAdded = true;
- }
- }
- });
-
- recursiveAction(state);
-
- return group;
- }
-
- /// <summary>
- /// Schedules an action to be executed recursively at a specified absolute due time.
- /// </summary>
- /// <param name="scheduler">Scheduler to execute the recursive action on.</param>
- /// <param name="action">Action to execute recursively. The parameter passed to the action is used to trigger recursive scheduling of the action at the specified absolute time.</param>
- /// <param name="dueTime">Absolute time at which to execute the action for the first time.</param>
- /// <returns>The disposable object used to cancel the scheduled action (best effort).</returns>
- /// <exception cref="ArgumentNullException"><paramref name="scheduler"/> or <paramref name="action"/> is null.</exception>
- public static IDisposable Schedule(this IScheduler scheduler, DateTimeOffset dueTime, Action<Action<DateTimeOffset>> action)
- {
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
- if (action == null)
- throw new ArgumentNullException("action");
-
- return scheduler.Schedule(action, dueTime, (_action, self) => _action(dt => self(_action, dt)));
- }
-
- /// <summary>
- /// Schedules an action to be executed recursively at a specified absolute due time.
- /// </summary>
- /// <typeparam name="TState">The type of the state passed to the scheduled action.</typeparam>
- /// <param name="scheduler">Scheduler to execute the recursive action on.</param>
- /// <param name="state">State passed to the action to be executed.</param>
- /// <param name="action">Action to execute recursively. The last parameter passed to the action is used to trigger recursive scheduling of the action, passing in the recursive due time and invocation state.</param>
- /// <param name="dueTime">Absolute time at which to execute the action for the first time.</param>
- /// <returns>The disposable object used to cancel the scheduled action (best effort).</returns>
- /// <exception cref="ArgumentNullException"><paramref name="scheduler"/> or <paramref name="action"/> is null.</exception>
- public static IDisposable Schedule<TState>(this IScheduler scheduler, TState state, DateTimeOffset dueTime, Action<TState, Action<TState, DateTimeOffset>> action)
- {
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
- if (action == null)
- throw new ArgumentNullException("action");
-
- return scheduler.Schedule(new Pair<TState, Action<TState, Action<TState, DateTimeOffset>>> { First = state, Second = action }, dueTime, InvokeRec3);
- }
-
- static IDisposable InvokeRec3<TState>(IScheduler scheduler, Pair<TState, Action<TState, Action<TState, DateTimeOffset>>> pair)
- {
- var group = new CompositeDisposable(1);
- var gate = new object();
- var state = pair.First;
- var action = pair.Second;
-
- Action<TState> recursiveAction = null;
- recursiveAction = state1 => action(state1, (state2, dueTime1) =>
- {
- var isAdded = false;
- var isDone = false;
- var d = default(IDisposable);
- d = scheduler.Schedule(state2, dueTime1, (scheduler1, state3) =>
- {
- lock (gate)
- {
- if (isAdded)
- group.Remove(d);
- else
- isDone = true;
- }
- recursiveAction(state3);
- return Disposable.Empty;
- });
-
- lock (gate)
- {
- if (!isDone)
- {
- group.Add(d);
- isAdded = true;
- }
- }
- });
-
- recursiveAction(state);
-
- return group;
- }
-
-#if !NO_SERIALIZABLE
- [Serializable]
-#endif
- struct Pair<T1, T2>
- {
- public T1 First;
- public T2 Second;
- }
- }
-}
diff --git a/Rx.NET/System.Reactive.Core/Reactive/Concurrency/Scheduler.Services.Emulation.cs b/Rx.NET/System.Reactive.Core/Reactive/Concurrency/Scheduler.Services.Emulation.cs
deleted file mode 100644
index c40959f..0000000
--- a/Rx.NET/System.Reactive.Core/Reactive/Concurrency/Scheduler.Services.Emulation.cs
+++ /dev/null
@@ -1,623 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System;
-using System.Diagnostics;
-using System.Reactive.Disposables;
-using System.Reactive.PlatformServices;
-using System.Threading;
-
-namespace System.Reactive.Concurrency
-{
- public static partial class Scheduler
- {
- /// <summary>
- /// Schedules a periodic piece of work by dynamically discovering the scheduler's capabilities.
- /// If the scheduler supports periodic scheduling, the request will be forwarded to the periodic scheduling implementation.
- /// If the scheduler provides stopwatch functionality, the periodic task will be emulated using recursive scheduling with a stopwatch to correct for time slippage.
- /// Otherwise, the periodic task will be emulated using recursive scheduling.
- /// </summary>
- /// <typeparam name="TState">The type of the state passed to the scheduled action.</typeparam>
- /// <param name="scheduler">The scheduler to run periodic work on.</param>
- /// <param name="state">Initial state passed to the action upon the first iteration.</param>
- /// <param name="period">Period for running the work periodically.</param>
- /// <param name="action">Action to be executed, potentially updating the state.</param>
- /// <returns>The disposable object used to cancel the scheduled recurring action (best effort).</returns>
- /// <exception cref="ArgumentNullException"><paramref name="scheduler"/> or <paramref name="action"/> is null.</exception>
- /// <exception cref="ArgumentOutOfRangeException"><paramref name="period"/> is less than TimeSpan.Zero.</exception>
- public static IDisposable SchedulePeriodic<TState>(this IScheduler scheduler, TState state, TimeSpan period, Func<TState, TState> action)
- {
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
- if (period < TimeSpan.Zero)
- throw new ArgumentOutOfRangeException("period");
- if (action == null)
- throw new ArgumentNullException("action");
-
- return SchedulePeriodic_(scheduler, state, period, action);
- }
-
- /// <summary>
- /// Schedules a periodic piece of work by dynamically discovering the scheduler's capabilities.
- /// If the scheduler supports periodic scheduling, the request will be forwarded to the periodic scheduling implementation.
- /// If the scheduler provides stopwatch functionality, the periodic task will be emulated using recursive scheduling with a stopwatch to correct for time slippage.
- /// Otherwise, the periodic task will be emulated using recursive scheduling.
- /// </summary>
- /// <typeparam name="TState">The type of the state passed to the scheduled action.</typeparam>
- /// <param name="scheduler">Scheduler to execute the action on.</param>
- /// <param name="state">State passed to the action to be executed.</param>
- /// <param name="period">Period for running the work periodically.</param>
- /// <param name="action">Action to be executed.</param>
- /// <returns>The disposable object used to cancel the scheduled recurring action (best effort).</returns>
- /// <exception cref="ArgumentNullException"><paramref name="scheduler"/> or <paramref name="action"/> is null.</exception>
- /// <exception cref="ArgumentOutOfRangeException"><paramref name="period"/> is less than TimeSpan.Zero.</exception>
- public static IDisposable SchedulePeriodic<TState>(this IScheduler scheduler, TState state, TimeSpan period, Action<TState> action)
- {
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
- if (period < TimeSpan.Zero)
- throw new ArgumentOutOfRangeException("period");
- if (action == null)
- throw new ArgumentNullException("action");
-
- return SchedulePeriodic_(scheduler, state, period, state_ => { action(state_); return state_; });
- }
-
- /// <summary>
- /// Schedules a periodic piece of work by dynamically discovering the scheduler's capabilities.
- /// If the scheduler supports periodic scheduling, the request will be forwarded to the periodic scheduling implementation.
- /// If the scheduler provides stopwatch functionality, the periodic task will be emulated using recursive scheduling with a stopwatch to correct for time slippage.
- /// Otherwise, the periodic task will be emulated using recursive scheduling.
- /// </summary>
- /// <param name="scheduler">Scheduler to execute the action on.</param>
- /// <param name="period">Period for running the work periodically.</param>
- /// <param name="action">Action to be executed.</param>
- /// <returns>The disposable object used to cancel the scheduled recurring action (best effort).</returns>
- /// <exception cref="ArgumentNullException"><paramref name="scheduler"/> or <paramref name="action"/> is null.</exception>
- /// <exception cref="ArgumentOutOfRangeException"><paramref name="period"/> is less than TimeSpan.Zero.</exception>
- public static IDisposable SchedulePeriodic(this IScheduler scheduler, TimeSpan period, Action action)
- {
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
- if (period < TimeSpan.Zero)
- throw new ArgumentOutOfRangeException("period");
- if (action == null)
- throw new ArgumentNullException("action");
-
- return SchedulePeriodic_(scheduler, default(object), period, _ => { action(); return _; });
- }
-
- /// <summary>
- /// Starts a new stopwatch object by dynamically discovering the scheduler's capabilities.
- /// If the scheduler provides stopwatch functionality, the request will be forwarded to the stopwatch provider implementation.
- /// Otherwise, the stopwatch will be emulated using the scheduler's notion of absolute time.
- /// </summary>
- /// <param name="scheduler">Scheduler to obtain a stopwatch for.</param>
- /// <returns>New stopwatch object; started at the time of the request.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="scheduler"/> is null.</exception>
- /// <remarks>The resulting stopwatch object can have non-monotonic behavior.</remarks>
- public static IStopwatch StartStopwatch(this IScheduler scheduler)
- {
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- //
- // All schedulers deriving from LocalScheduler will automatically pick up this
- // capability based on a local stopwatch, typically using QueryPerformanceCounter
- // through the System.Diagnostics.Stopwatch class.
- //
- // Notice virtual time schedulers do implement this facility starting from Rx v2.0,
- // using subtraction of their absolute time notion to compute elapsed time values.
- // This is fine because those schedulers do not allow the clock to go back in time.
- //
- // For schedulers that don't have a stopwatch, we have to pick some fallback logic
- // here. We could either dismiss the scheduler's notion of time and go for the CAL's
- // stopwatch facility, or go with a stopwatch based on "scheduler.Now", which has
- // the drawback of potentially going back in time:
- //
- // - Using the CAL's stopwatch facility causes us to abondon the scheduler's
- // potentially virtualized notion of time, always going for the local system
- // time instead.
- //
- // - Using the scheduler's Now property for calculations can break monotonicity,
- // and there's no right answer on how to deal with jumps back in time.
- //
- // However, even the built-in stopwatch in the BCL can potentially fall back to
- // subtraction of DateTime values in case no high-resolution performance counter is
- // available, causing monotonicity to break down. We're not trying to solve this
- // problem there either (though we could check IsHighResolution and smoothen out
- // non-monotonic points somehow), so we pick the latter option as the lesser of
- // two evils (also because it should occur rarely).
- //
- // Users of the stopwatch retrieved by this method could detect non-sensical data
- // revealing a jump back in time, or implement custom fallback logic like the one
- // shown below.
- //
- var swp = scheduler.AsStopwatchProvider();
- if (swp != null)
- return swp.StartStopwatch();
-
- return new EmulatedStopwatch(scheduler);
- }
-
- private static IDisposable SchedulePeriodic_<TState>(IScheduler scheduler, TState state, TimeSpan period, Func<TState, TState> action)
- {
- //
- // Design rationale:
- //
- // In Rx v1.x, we employed recursive scheduling for periodic tasks. The following code
- // fragment shows how the Timer (and hence Interval) function used to be implemented:
- //
- // var p = Normalize(period);
- //
- // return new AnonymousObservable<long>(observer =>
- // {
- // var d = dueTime;
- // long count = 0;
- // return scheduler.Schedule(d, self =>
- // {
- // if (p > TimeSpan.Zero)
- // {
- // var now = scheduler.Now;
- // d = d + p;
- // if (d <= now)
- // d = now + p;
- // }
- //
- // observer.OnNext(count);
- // count = unchecked(count + 1);
- // self(d);
- // });
- // });
- //
- // Despite the purity of this approach, it suffered from a set of drawbacks:
- //
- // 1) Usage of IScheduler.Now to correct for time drift did have a positive effect for
- // a limited number of scenarios, in particular when a short period was used. The
- // major issues with this are:
- //
- // a) Relying on absolute time at the LINQ layer in Rx's layer map, causing issues
- // when the system clock changes. Various customers hit this issue, reported to
- // us on the MSDN forums. Basically, when the clock goes forward, the recursive
- // loop wants to catch up as quickly as it can; when it goes backwards, a long
- // silence will occur. (See 2 for a discussion of WP7 related fixes.)
- //
- // b) Even if a) would be addressed by using Rx v2.0's capabilities to monitor for
- // system clock changes, the solution would violate the reasonable expectation
- // of operators overloads using TimeSpan *not* relying on absolute time.
- //
- // c) Drift correction doesn't work for large periods when the system encounters
- // systematic drift. For example, in the lab we've seen cases of drift up to
- // tens of seconds on a 24 hour timeframe. Correcting for this drift by making
- // a recursive call with a due time of 24 * 3600 with 10 seconds of adjustment
- // won't fix systematic drift.
- //
- // 2) This implementation has been plagued with issues around application container
- // lifecycle models, in particular Windows Phone 7's model of tombstoning and in
- // particular its "dormant state". This feature was introduced in Mango to enable
- // fast application switching. Essentially, the phone's OS puts the application
- // in a suspended state when the user navigates "forward" (or takes an incoming
- // call for instance). When the application is woken up again, threads are resumed
- // and we're faced with an illusion of missed events due to the use of absolute
- // time, not relative to how the application observes it. This caused nightmare
- // scenarios of fast battery drain due to the flood of catch-up work.
- //
- // See http://msdn.microsoft.com/en-us/library/ff817008(v=vs.92).aspx for more
- // information on this.
- //
- // 3) Recursive scheduling imposes a non-trivial cost due to the creation of many
- // single-shot timers and closures. For high frequency timers, this can cause a
- // lot of churn in the GC, which we like to avoid (operators shouldn't have hidden
- // linear - or worse - allocation cost).
- //
- // Notice these drawbacks weren't limited to the use of Timer and Interval directly,
- // as many operators such as Sample, Buffer, and Window used such sequences for their
- // periodic behavior (typically by delegating to a more general overload).
- //
- // As a result, in Rx v2.0, we took the decision to improve periodic timing based on
- // the following design decisions:
- //
- // 1) When the scheduler has the ability to run a periodic task, it should implement
- // the ISchedulerPeriodic interface and expose it through the IServiceProvider
- // interface. Passing the intent of the user through all layers of Rx, down to the
- // underlying infrastructure provides delegation of responsibilities. This allows
- // the target scheduler to optimize execution in various ways, e.g. by employing
- // techniques such as timer coalescing.
- //
- // See http://www.bing.com/search?q=windows+timer+coalescing for information on
- // techniques like timer coalescing which may be applied more aggressively in
- // future OS releases in order to reduce power consumption.
- //
- // 2) Emulation of periodic scheduling is used to avoid breaking existing code that
- // uses schedulers without this capability. We expect those fallback paths to be
- // exercised rarely, though the use of DisableOptimizations can trigger them as
- // well. In such cases we rely on stopwatches or a carefully crafted recursive
- // scheme to deal with (or maximally compensate for) slippage or time. Behavior
- // of periodic tasks is expected to be as follows:
- //
- // timer ticks 0-------1-------2-------3-------4-------5-------6----...
- // | | | +====+ +==+ | |
- // user code +~~~| +~| +~~~~~~~~~~~|+~~~~|+~~| +~~~| +~~|
- //
- // rather than the following scheme, where time slippage is introduced by user
- // code running on the scheduler:
- //
- // timer ticks 0####-------1##-------2############-------3#####-----...
- // | | | |
- // user code +~~~| +~| +~~~~~~~~~~~| +~~~~|
- //
- // (Side-note: Unfortunately, we didn't reserve the name Interval for the latter
- // behavior, but used it as an alias for "periodic scheduling" with
- // the former behavior, delegating to the Timer implementation. One
- // can simulate this behavior using Generate, which uses tail calls.)
- //
- // This behavior is important for operations like Sample, Buffer, and Window, all
- // of which expect proper spacing of events, even if the user code takes a long
- // time to complete (considered a bad practice nonetheless, cf. ObserveOn).
- //
- // 3) To deal with the issue of suspensions induced by application lifecycle events
- // in Windows Phone and WinRT applications, we decided to hook available system
- // events through IHostLifecycleNotifications, discovered through the PEP in order
- // to maintain portability of the core of Rx.
- //
- var periodic = scheduler.AsPeriodic();
- if (periodic != null)
- {
- return periodic.SchedulePeriodic(state, period, action);
- }
-
- var swp = scheduler.AsStopwatchProvider();
- if (swp != null)
- {
- var spr = new SchedulePeriodicStopwatch<TState>(scheduler, state, period, action, swp);
- return spr.Start();
- }
- else
- {
- var spr = new SchedulePeriodicRecursive<TState>(scheduler, state, period, action);
- return spr.Start();
- }
- }
-
- class SchedulePeriodicStopwatch<TState>
- {
- private readonly IScheduler _scheduler;
- private readonly TimeSpan _period;
- private readonly Func<TState, TState> _action;
- private readonly IStopwatchProvider _stopwatchProvider;
-
- public SchedulePeriodicStopwatch(IScheduler scheduler, TState state, TimeSpan period, Func<TState, TState> action, IStopwatchProvider stopwatchProvider)
- {
- _scheduler = scheduler;
- _period = period;
- _action = action;
- _stopwatchProvider = stopwatchProvider;
-
- _state = state;
- _runState = STOPPED;
- }
-
- private TState _state;
-
- private readonly object _gate = new object();
- private readonly AutoResetEvent _resumeEvent = new AutoResetEvent(false);
- private volatile int _runState;
- private IStopwatch _stopwatch;
- private TimeSpan _nextDue;
- private TimeSpan _suspendedAt;
- private TimeSpan _inactiveTime;
-
- //
- // State transition diagram:
- // (c)
- // +-----------<-----------+
- // / \
- // / (b) \
- // | +-->--SUSPENDED---+
- // (a) v / |
- // ^----STOPPED -->-- RUNNING -->--+ v (e)
- // \ |
- // +-->--DISPOSED----$
- // (d)
- //
- // (a) Start --> call to Schedule the Tick method
- // (b) Suspending event handler --> Tick gets blocked waiting for _resumeEvent
- // (c) Resuming event handler --> _resumeEvent is signaled, Tick continues
- // (d) Dispose returned object from Start --> scheduled work is cancelled
- // (e) Dispose returned object from Start --> unblocks _resumeEvent, Tick exits
- //
- private const int STOPPED = 0;
- private const int RUNNING = 1;
- private const int SUSPENDED = 2;
- private const int DISPOSED = 3;
-
- public IDisposable Start()
- {
- RegisterHostLifecycleEventHandlers();
-
- _stopwatch = _stopwatchProvider.StartStopwatch();
- _nextDue = _period;
- _runState = RUNNING;
-
- return new CompositeDisposable(2)
- {
- _scheduler.Schedule(_nextDue, Tick),
- Disposable.Create(Cancel)
- };
- }
-
- private void Tick(Action<TimeSpan> recurse)
- {
- _nextDue += _period;
- _state = _action(_state);
-
- var next = default(TimeSpan);
-
- while (true)
- {
- var shouldWaitForResume = false;
-
- lock (_gate)
- {
- if (_runState == RUNNING)
- {
- //
- // This is the fast path. We just let the stopwatch continue to
- // run while we're suspended, but compensate for time that was
- // recorded as inactive based on cumulative deltas computed in
- // the suspend and resume event handlers.
- //
- next = Normalize(_nextDue - (_stopwatch.Elapsed - _inactiveTime));
- break;
- }
- else if (_runState == DISPOSED)
- {
- //
- // In case the periodic job gets disposed but we are currently
- // waiting to come back out of suspension, we should make sure
- // we don't remain blocked indefinitely. Hence, we set the event
- // in the Cancel method and trap this case here to bail out from
- // the scheduled work gracefully.
- //
- return;
- }
- else
- {
- //
- // This is the least common case where we got suspended and need
- // to block such that future reevaluations of the next due time
- // will pick up the cumulative inactive time delta.
- //
- Debug.Assert(_runState == SUSPENDED);
- shouldWaitForResume = true;
- }
- }
-
- //
- // Only happens in the SUSPENDED case; otherwise we will have broken from
- // the loop or have quit the Tick method. After returning from the wait,
- // we'll either be RUNNING again, quit due to a DISPOSED transition, or
- // be extremely unlucky to find ourselves SUSPENDED again and be blocked
- // once more.
- //
- if (shouldWaitForResume)
- _resumeEvent.WaitOne();
- }
-
- recurse(next);
- }
-
- private void Cancel()
- {
- UnregisterHostLifecycleEventHandlers();
-
- lock (_gate)
- {
- _runState = DISPOSED;
-
- if (!Environment.HasShutdownStarted)
- _resumeEvent.Set();
- }
- }
-
- private void Suspending(object sender, HostSuspendingEventArgs args)
- {
- //
- // The host is telling us we're about to be suspended. At this point, time
- // computations will still be in a valid range (next <= _period), but after
- // we're woken up again, Tick would start to go on a crucade to catch up.
- //
- // This has caused problems in the past, where the flood of events caused
- // batteries to drain etc (see design rationale discussion higher up).
- //
- // In order to mitigate this problem, we force Tick to suspend before its
- // next computation of the next due time. Notice we can't afford to block
- // during the Suspending event handler; the host expects us to respond to
- // this event quickly, such that we're not keeping the application from
- // suspending promptly.
- //
- lock (_gate)
- {
- if (_runState == RUNNING)
- {
- _suspendedAt = _stopwatch.Elapsed;
- _runState = SUSPENDED;
-
- if (!Environment.HasShutdownStarted)
- _resumeEvent.Reset();
- }
- }
- }
-
- private void Resuming(object sender, HostResumingEventArgs args)
- {
- //
- // The host is telling us we're being resumed. At this point, code will
- // already be running in the process, so a past timer may still expire and
- // cause the code in Tick to run. Two interleavings are possible now:
- //
- // 1) We enter the gate first, and will adjust the cumulative inactive
- // time delta used for correction. The code in Tick will have the
- // illusion nothing happened and find itself RUNNING when entering
- // the gate, resuming activities as before.
- //
- // 2) The code in Tick enters the gate first, and takes notice of the
- // currently SUSPENDED state. It leaves the gate, entering the wait
- // state for _resumeEvent. Next, we enter to adjust the cumulative
- // inactive time delta, switch to the RUNNING state and signal the
- // event for Tick to carry on and recompute its next due time based
- // on the new cumulative delta.
- //
- lock (_gate)
- {
- if (_runState == SUSPENDED)
- {
- _inactiveTime += _stopwatch.Elapsed - _suspendedAt;
- _runState = RUNNING;
-
- if (!Environment.HasShutdownStarted)
- _resumeEvent.Set();
- }
- }
- }
-
- private void RegisterHostLifecycleEventHandlers()
- {
- HostLifecycleService.Suspending += Suspending;
- HostLifecycleService.Resuming += Resuming;
- HostLifecycleService.AddRef();
- }
-
- private void UnregisterHostLifecycleEventHandlers()
- {
- HostLifecycleService.Suspending -= Suspending;
- HostLifecycleService.Resuming -= Resuming;
- HostLifecycleService.Release();
- }
- }
-
- class SchedulePeriodicRecursive<TState>
- {
- private readonly IScheduler _scheduler;
- private readonly TimeSpan _period;
- private readonly Func<TState, TState> _action;
-
- public SchedulePeriodicRecursive(IScheduler scheduler, TState state, TimeSpan period, Func<TState, TState> action)
- {
- _scheduler = scheduler;
- _period = period;
- _action = action;
-
- _state = state;
- }
-
- private TState _state;
- private int _pendingTickCount;
- private IDisposable _cancel;
-
- public IDisposable Start()
- {
- _pendingTickCount = 0;
-
- var d = new SingleAssignmentDisposable();
- _cancel = d;
-
- d.Disposable = _scheduler.Schedule(TICK, _period, Tick);
-
- return d;
- }
-
- //
- // The protocol using the three commands is explained in the Tick implementation below.
- //
- private const int TICK = 0;
- private const int DISPATCH_START = 1;
- private const int DISPATCH_END = 2;
-
- private void Tick(int command, Action<int, TimeSpan> recurse)
- {
- switch (command)
- {
- case TICK:
- //
- // Ticks keep going at the specified periodic rate. We do a head call such
- // that no slippage is introduced because of DISPATCH_START work involving
- // user code that may take arbitrarily long.
- //
- recurse(TICK, _period);
-
- //
- // If we're not transitioning from 0 to 1 pending tick, another processing
- // request is in flight which will see a non-zero pending tick count after
- // doing the final decrement, causing it to reschedule immediately. We can
- // safely bail out, delegating work to the catch-up tail calls.
- //
- if (Interlocked.Increment(ref _pendingTickCount) == 1)
- goto case DISPATCH_START;
-
- break;
-
- case DISPATCH_START:
- try
- {
- _state = _action(_state);
- }
- catch (Exception e)
- {
- _cancel.Dispose();
- e.Throw();
- }
-
- //
- // This is very subtle. We can't do a goto case DISPATCH_END here because it
- // wouldn't introduce interleaving of periodic ticks that are due. In order
- // to have best effort behavior for schedulers that don't have concurrency,
- // we yield by doing a recursive call here. Notice this doesn't heal all of
- // the problem, because the TICK commands that may be dispatched before the
- // scheduled DISPATCH_END will do a "recurse(TICK, period)", which is relative
- // from the point of entrance. Really all we're doing here is damage control
- // for the case there's no stopwatch provider which should be rare (notice
- // the LocalScheduler base class always imposes a stopwatch, but it can get
- // disabled using DisableOptimizations; legacy implementations of schedulers
- // from the v1.x days will not have a stopwatch).
- //
- recurse(DISPATCH_END, TimeSpan.Zero);
-
- break;
-
- case DISPATCH_END:
- //
- // If work was due while we were still running user code, the count will have
- // been incremented by the periodic tick handler above. In that case, we will
- // reschedule ourselves for dispatching work immediately.
- //
- // Notice we don't run a loop here, in order to allow interleaving of work on
- // the scheduler by making recursive calls. In case we would use AsyncLock to
- // ensure serialized execution the owner could get stuck in such a loop, thus
- // we make tail calls to play nice with the scheduler.
- //
- if (Interlocked.Decrement(ref _pendingTickCount) > 0)
- recurse(DISPATCH_START, TimeSpan.Zero);
-
- break;
- }
- }
- }
-
- class EmulatedStopwatch : IStopwatch
- {
- private readonly IScheduler _scheduler;
- private readonly DateTimeOffset _start;
-
- public EmulatedStopwatch(IScheduler scheduler)
- {
- _scheduler = scheduler;
- _start = _scheduler.Now;
- }
-
- public TimeSpan Elapsed
- {
- get { return Scheduler.Normalize(_scheduler.Now - _start); }
- }
- }
- }
-}
diff --git a/Rx.NET/System.Reactive.Core/Reactive/Concurrency/Scheduler.Services.cs b/Rx.NET/System.Reactive.Core/Reactive/Concurrency/Scheduler.Services.cs
deleted file mode 100644
index be689b0..0000000
--- a/Rx.NET/System.Reactive.Core/Reactive/Concurrency/Scheduler.Services.cs
+++ /dev/null
@@ -1,89 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System;
-
-namespace System.Reactive.Concurrency
-{
- //
- // NOTE: When adding interface-based optimizations here, ensure to add the type to the list of
- // interface-based optimizations used by DisableOptimizations and the RawScheduler type.
- //
- public static partial class Scheduler
- {
- internal static Type[] OPTIMIZATIONS = new Type[] {
- typeof(ISchedulerLongRunning),
- typeof(IStopwatchProvider),
- typeof(ISchedulerPeriodic),
- /* update this list if new interface-based optimizations are added */
- };
-
- /// <summary>
- /// Returns the ISchedulerLongRunning implementation of the specified scheduler, or null if no such implementation is available.
- /// </summary>
- /// <param name="scheduler">Scheduler to get the ISchedulerLongRunning implementation for.</param>
- /// <returns>The scheduler's ISchedulerLongRunning implementation if available; null otherwise.</returns>
- /// <remarks>
- /// This helper method is made available for query operator authors in order to discover scheduler services by using the required
- /// IServiceProvider pattern, which allows for interception or redefinition of scheduler services.
- /// </remarks>
- public static ISchedulerLongRunning AsLongRunning(this IScheduler scheduler)
- {
- var svc = scheduler as IServiceProvider;
- if (svc != null)
- return (ISchedulerLongRunning)svc.GetService(typeof(ISchedulerLongRunning));
-
- return null;
- }
-
- /// <summary>
- /// Returns the IStopwatchProvider implementation of the specified scheduler, or null if no such implementation is available.
- /// </summary>
- /// <param name="scheduler">Scheduler to get the IStopwatchProvider implementation for.</param>
- /// <returns>The scheduler's IStopwatchProvider implementation if available; null otherwise.</returns>
- /// <remarks>
- /// <para>
- /// This helper method is made available for query operator authors in order to discover scheduler services by using the required
- /// IServiceProvider pattern, which allows for interception or redefinition of scheduler services.
- /// </para>
- /// <para>
- /// Consider using <see cref="Scheduler.StartStopwatch"/> in case a stopwatch is required, but use of emulation stopwatch based
- /// on the scheduler's clock is acceptable. Use of this method is recommended for best-effort use of the stopwatch provider
- /// scheduler service, where the caller falls back to not using stopwatches if this facility wasn't found.
- /// </para>
- /// </remarks>
- public static IStopwatchProvider AsStopwatchProvider(this IScheduler scheduler)
- {
- var svc = scheduler as IServiceProvider;
- if (svc != null)
- return (IStopwatchProvider)svc.GetService(typeof(IStopwatchProvider));
-
- return null;
- }
-
- /// <summary>
- /// Returns the IStopwatchProvider implementation of the specified scheduler, or null if no such implementation is available.
- /// </summary>
- /// <param name="scheduler">Scheduler to get the IStopwatchProvider implementation for.</param>
- /// <returns>The scheduler's IStopwatchProvider implementation if available; null otherwise.</returns>
- /// <remarks>
- /// <para>
- /// This helper method is made available for query operator authors in order to discover scheduler services by using the required
- /// IServiceProvider pattern, which allows for interception or redefinition of scheduler services.
- /// </para>
- /// <para>
- /// Consider using the Scheduler.SchedulePeriodic extension methods for IScheduler in case periodic scheduling is required and
- /// emulation of periodic behavior using other scheduler services is desirable. Use of this method is recommended for best-effort
- /// use of the periodic scheduling service, where the caller falls back to not using periodic scheduling if this facility wasn't
- /// found.
- /// </para>
- /// </remarks>
- public static ISchedulerPeriodic AsPeriodic(this IScheduler scheduler)
- {
- var svc = scheduler as IServiceProvider;
- if (svc != null)
- return (ISchedulerPeriodic)svc.GetService(typeof(ISchedulerPeriodic));
-
- return null;
- }
- }
-}
diff --git a/Rx.NET/System.Reactive.Core/Reactive/Concurrency/Scheduler.Simple.cs b/Rx.NET/System.Reactive.Core/Reactive/Concurrency/Scheduler.Simple.cs
deleted file mode 100644
index 7b91e62..0000000
--- a/Rx.NET/System.Reactive.Core/Reactive/Concurrency/Scheduler.Simple.cs
+++ /dev/null
@@ -1,86 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System;
-using System.Reactive.Disposables;
-
-namespace System.Reactive.Concurrency
-{
- public static partial class Scheduler
- {
- /// <summary>
- /// Schedules an action to be executed.
- /// </summary>
- /// <param name="scheduler">Scheduler to execute the action on.</param>
- /// <param name="action">Action to execute.</param>
- /// <returns>The disposable object used to cancel the scheduled action (best effort).</returns>
- /// <exception cref="ArgumentNullException"><paramref name="scheduler"/> or <paramref name="action"/> is null.</exception>
- public static IDisposable Schedule(this IScheduler scheduler, Action action)
- {
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
- if (action == null)
- throw new ArgumentNullException("action");
-
- return scheduler.Schedule(action, Invoke);
- }
-
- /// <summary>
- /// Schedules an action to be executed after the specified relative due time.
- /// </summary>
- /// <param name="scheduler">Scheduler to execute the action on.</param>
- /// <param name="action">Action to execute.</param>
- /// <param name="dueTime">Relative time after which to execute the action.</param>
- /// <returns>The disposable object used to cancel the scheduled action (best effort).</returns>
- /// <exception cref="ArgumentNullException"><paramref name="scheduler"/> or <paramref name="action"/> is null.</exception>
- public static IDisposable Schedule(this IScheduler scheduler, TimeSpan dueTime, Action action)
- {
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
- if (action == null)
- throw new ArgumentNullException("action");
-
- return scheduler.Schedule(action, dueTime, Invoke);
- }
-
- /// <summary>
- /// Schedules an action to be executed at the specified absolute due time.
- /// </summary>
- /// <param name="scheduler">Scheduler to execute the action on.</param>
- /// <param name="action">Action to execute.</param>
- /// <param name="dueTime">Absolute time at which to execute the action.</param>
- /// <returns>The disposable object used to cancel the scheduled action (best effort).</returns>
- /// <exception cref="ArgumentNullException"><paramref name="scheduler"/> or <paramref name="action"/> is null.</exception>
- public static IDisposable Schedule(this IScheduler scheduler, DateTimeOffset dueTime, Action action)
- {
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
- if (action == null)
- throw new ArgumentNullException("action");
-
- return scheduler.Schedule(action, dueTime, Invoke);
- }
-
- /// <summary>
- /// Schedules an action to be executed.
- /// </summary>
- /// <param name="scheduler">Scheduler to execute the action on.</param>
- /// <param name="action">Action to execute.</param>
- /// <returns>The disposable object used to cancel the scheduled action (best effort).</returns>
- /// <exception cref="ArgumentNullException"><paramref name="scheduler"/> or <paramref name="action"/> is null.</exception>
- public static IDisposable ScheduleLongRunning(this ISchedulerLongRunning scheduler, Action<ICancelable> action)
- {
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
- if (action == null)
- throw new ArgumentNullException("action");
-
- return scheduler.ScheduleLongRunning(action, (a, c) => a(c));
- }
-
- static IDisposable Invoke(IScheduler scheduler, Action action)
- {
- action();
- return Disposable.Empty;
- }
- }
-}
diff --git a/Rx.NET/System.Reactive.Core/Reactive/Concurrency/Scheduler.Wrappers.cs b/Rx.NET/System.Reactive.Core/Reactive/Concurrency/Scheduler.Wrappers.cs
deleted file mode 100644
index a30ff69..0000000
--- a/Rx.NET/System.Reactive.Core/Reactive/Concurrency/Scheduler.Wrappers.cs
+++ /dev/null
@@ -1,59 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System;
-
-namespace System.Reactive.Concurrency
-{
- public static partial class Scheduler
- {
- /// <summary>
- /// Returns a scheduler that represents the original scheduler, without any of its interface-based optimizations (e.g. long running scheduling).
- /// </summary>
- /// <param name="scheduler">Scheduler to disable all optimizations for.</param>
- /// <returns>Proxy to the original scheduler but without any optimizations enabled.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="scheduler"/> is null.</exception>
- public static IScheduler DisableOptimizations(this IScheduler scheduler)
- {
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return new DisableOptimizationsScheduler(scheduler);
- }
-
- /// <summary>
- /// Returns a scheduler that represents the original scheduler, without the specified set of interface-based optimizations (e.g. long running scheduling).
- /// </summary>
- /// <param name="scheduler">Scheduler to disable the specified optimizations for.</param>
- /// <param name="optimizationInterfaces">Types of the optimization interfaces that have to be disabled.</param>
- /// <returns>Proxy to the original scheduler but without the specified optimizations enabled.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="scheduler"/> or <paramref name="optimizationInterfaces"/> is null.</exception>
- public static IScheduler DisableOptimizations(this IScheduler scheduler, params Type[] optimizationInterfaces)
- {
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
- if (optimizationInterfaces == null)
- throw new ArgumentNullException("optimizationInterfaces");
-
- return new DisableOptimizationsScheduler(scheduler, optimizationInterfaces);
- }
-
- /// <summary>
- /// Returns a scheduler that wraps the original scheduler, adding exception handling for scheduled actions.
- /// </summary>
- /// <typeparam name="TException">Type of the exception to check for.</typeparam>
- /// <param name="scheduler">Scheduler to apply an exception filter for.</param>
- /// <param name="handler">Handler that's run if an exception is caught. The exception will be rethrown if the handler returns false.</param>
- /// <returns>Wrapper around the original scheduler, enforcing exception handling.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="scheduler"/> or <paramref name="handler"/> is null.</exception>
- public static IScheduler Catch<TException>(this IScheduler scheduler, Func<TException, bool> handler)
- where TException : Exception
- {
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
- if (handler == null)
- throw new ArgumentNullException("handler");
-
- return new CatchScheduler<TException>(scheduler, handler);
- }
- }
-}
diff --git a/Rx.NET/System.Reactive.Core/Reactive/Concurrency/Scheduler.cs b/Rx.NET/System.Reactive.Core/Reactive/Concurrency/Scheduler.cs
deleted file mode 100644
index 2b4a5ac..0000000
--- a/Rx.NET/System.Reactive.Core/Reactive/Concurrency/Scheduler.cs
+++ /dev/null
@@ -1,142 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System;
-using System.Reactive.Disposables;
-using System.Reactive.PlatformServices;
-using System.Globalization;
-
-namespace System.Reactive.Concurrency
-{
- /// <summary>
- /// Provides a set of static properties to access commonly used schedulers.
- /// </summary>
- public static partial class Scheduler
- {
- // TODO - Review whether this is too eager.
- // Make first use of Scheduler trigger access to and initialization of the CAL.
- private static DefaultScheduler s_default = DefaultScheduler.Instance;
-
- /// <summary>
- /// Gets the current time according to the local machine's system clock.
- /// </summary>
- public static DateTimeOffset Now
- {
- get
- {
- return SystemClock.UtcNow;
- }
- }
-
- /// <summary>
- /// Normalizes the specified TimeSpan value to a positive value.
- /// </summary>
- /// <param name="timeSpan">The TimeSpan value to normalize.</param>
- /// <returns>The specified TimeSpan value if it is zero or positive; otherwise, TimeSpan.Zero.</returns>
- public static TimeSpan Normalize(TimeSpan timeSpan)
- {
- if (timeSpan.Ticks < 0)
- return TimeSpan.Zero;
- return timeSpan;
- }
-
- /// <summary>
- /// Gets a scheduler that schedules work immediately on the current thread.
- /// </summary>
- public static ImmediateScheduler Immediate
- {
- get
- {
- return ImmediateScheduler.Instance;
- }
- }
-
- /// <summary>
- /// Gets a scheduler that schedules work as soon as possible on the current thread.
- /// </summary>
- public static CurrentThreadScheduler CurrentThread
- {
- get
- {
- return CurrentThreadScheduler.Instance;
- }
- }
-
- /// <summary>
- /// Gets a scheduler that schedules work on the platform's default scheduler.
- /// </summary>
- public static DefaultScheduler Default
- {
- get
- {
- return s_default;
- }
- }
-
-
- //
- // Notice we include all of the scheduler properties below, unconditionally. In Rx v2.0
- // beta and RC, we limited this a la carte menu to reflect the platform's capabilities.
- // However, this caused different builds for Windows 8, .NET 4.5, and Portable Library
- // to be required. In the RTM timeframe, we opted for unifying all of this based on a
- // single Portable Library build of the core set of assemblies. As such, we're presented
- // with a choice of either locking down those properties to the intersection, or keeping
- // compatibility for those who upgrade from.NET 4.0 to .NET 4.5. We chose the latter, so
- // we need to keep properties like NewThread here, even though they'll be obsolete from
- // day 0 of Rx v2.0 (including our Portable Library story). Also, the NewThread one will
- // be non-functional for Windows 8, causing a runtime exception to be thrown.
- //
-
-
- private static Lazy<IScheduler> s_threadPool = new Lazy<IScheduler>(() => Initialize("ThreadPool"));
-
- /// <summary>
- /// Gets a scheduler that schedules work on the thread pool.
- /// </summary>
- [Obsolete(Constants_Core.OBSOLETE_SCHEDULER_THREADPOOL)]
- public static IScheduler ThreadPool
- {
- get
- {
- return s_threadPool.Value;
- }
- }
-
- private static Lazy<IScheduler> s_newThread = new Lazy<IScheduler>(() => Initialize("NewThread"));
-
- /// <summary>
- /// Gets a scheduler that schedules work on a new thread using default thread creation options.
- /// </summary>
- [Obsolete(Constants_Core.OBSOLETE_SCHEDULER_NEWTHREAD)]
- public static IScheduler NewThread
- {
- get
- {
- return s_newThread.Value;
- }
- }
-
-#if !NO_TPL
- private static Lazy<IScheduler> s_taskPool = new Lazy<IScheduler>(() => Initialize("TaskPool"));
-
- /// <summary>
- /// Gets a scheduler that schedules work on Task Parallel Library (TPL) task pool using the default TaskScheduler.
- /// </summary>
- [Obsolete(Constants_Core.OBSOLETE_SCHEDULER_TASKPOOL)]
- public static IScheduler TaskPool
- {
- get
- {
- return s_taskPool.Value;
- }
- }
-#endif
-
- private static IScheduler Initialize(string name)
- {
- var res = PlatformEnlightenmentProvider.Current.GetService<IScheduler>(name);
- if (res == null)
- throw new NotSupportedException(string.Format(CultureInfo.CurrentCulture, Strings_Core.CANT_OBTAIN_SCHEDULER, name));
- return res;
- }
- }
-}
diff --git a/Rx.NET/System.Reactive.Core/Reactive/Concurrency/SchedulerDefaults.cs b/Rx.NET/System.Reactive.Core/Reactive/Concurrency/SchedulerDefaults.cs
deleted file mode 100644
index ecbe361..0000000
--- a/Rx.NET/System.Reactive.Core/Reactive/Concurrency/SchedulerDefaults.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System;
-
-namespace System.Reactive.Concurrency
-{
- internal static class SchedulerDefaults
- {
- internal static IScheduler ConstantTimeOperations { get { return ImmediateScheduler.Instance; } }
- internal static IScheduler TailRecursion { get { return ImmediateScheduler.Instance; } }
- internal static IScheduler Iteration { get { return CurrentThreadScheduler.Instance; } }
- internal static IScheduler TimeBasedOperations { get { return DefaultScheduler.Instance; } }
- internal static IScheduler AsyncConversions { get { return DefaultScheduler.Instance; } }
- }
-}
diff --git a/Rx.NET/System.Reactive.Core/Reactive/Concurrency/SchedulerOperation.cs b/Rx.NET/System.Reactive.Core/Reactive/Concurrency/SchedulerOperation.cs
deleted file mode 100644
index bcff761..0000000
--- a/Rx.NET/System.Reactive.Core/Reactive/Concurrency/SchedulerOperation.cs
+++ /dev/null
@@ -1,156 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if HAS_AWAIT
-using System.ComponentModel;
-using System.Runtime.CompilerServices;
-using System.Threading;
-
-namespace System.Reactive.Concurrency
-{
- /// <summary>
- /// Represents an awaitable scheduler operation. Awaiting the object causes the continuation to be posted back to the originating scheduler's work queue.
- /// </summary>
- public sealed class SchedulerOperation
- {
- private readonly Func<Action, IDisposable> _schedule;
- private readonly CancellationToken _cancellationToken;
- private readonly bool _postBackToOriginalContext;
-
- internal SchedulerOperation(Func<Action, IDisposable> schedule, CancellationToken cancellationToken)
- : this(schedule, cancellationToken, false)
- {
- }
-
- internal SchedulerOperation(Func<Action, IDisposable> schedule, CancellationToken cancellationToken, bool postBackToOriginalContext)
- {
- _schedule = schedule;
- _cancellationToken = cancellationToken;
- _postBackToOriginalContext = postBackToOriginalContext;
- }
-
- /// <summary>
- /// Controls whether the continuation is run on the originating synchronization context (false by default).
- /// </summary>
- /// <param name="continueOnCapturedContext">true to run the continuation on the captured synchronization context; false otherwise (default).</param>
- /// <returns>Scheduler operation object with configured await behavior.</returns>
- public SchedulerOperation ConfigureAwait(bool continueOnCapturedContext)
- {
- return new SchedulerOperation(_schedule, _cancellationToken, continueOnCapturedContext);
- }
-
- /// <summary>
- /// Gets an awaiter for the scheduler operation, used to post back the continuation.
- /// </summary>
- /// <returns>Awaiter for the scheduler operation.</returns>
- public SchedulerOperationAwaiter GetAwaiter()
- {
- return new SchedulerOperationAwaiter(_schedule, _cancellationToken, _postBackToOriginalContext);
- }
- }
-
- /// <summary>
- /// (Infrastructure) Scheduler operation awaiter type used by the code generated for C# await and Visual Basic Await expressions.
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public sealed class SchedulerOperationAwaiter
- : INotifyCompletion
- {
- private readonly Func<Action, IDisposable> _schedule;
- private readonly CancellationToken _cancellationToken;
- private readonly bool _postBackToOriginalContext;
- private readonly CancellationTokenRegistration _ctr;
-
- internal SchedulerOperationAwaiter(Func<Action, IDisposable> schedule, CancellationToken cancellationToken, bool postBackToOriginalContext)
- {
- _schedule = schedule;
- _cancellationToken = cancellationToken;
- _postBackToOriginalContext = postBackToOriginalContext;
-
- _ctr = _cancellationToken.Register(Cancel);
- }
-
- /// <summary>
- /// Indicates whether the scheduler operation has completed. Returns false unless cancellation was already requested.
- /// </summary>
- public bool IsCompleted
- {
- get { return _cancellationToken.IsCancellationRequested; }
- }
-
- /// <summary>
- /// Completes the scheduler operation, throwing an OperationCanceledException in case cancellation was requested.
- /// </summary>
- public void GetResult()
- {
- _cancellationToken.ThrowIfCancellationRequested();
- }
-
- /// <summary>
- /// Registers the continuation with the scheduler operation.
- /// </summary>
- /// <param name="continuation">Continuation to be run on the originating scheduler.</param>
- public void OnCompleted(Action continuation)
- {
- if (continuation == null)
- throw new ArgumentNullException("continuation");
-
- if (_continuation != null)
- throw new InvalidOperationException(Strings_Core.SCHEDULER_OPERATION_ALREADY_AWAITED);
-
- if (_postBackToOriginalContext)
- {
- var ctx = SynchronizationContext.Current;
- if (ctx != null)
- {
- var original = continuation;
- continuation = () =>
- {
- //
- // No need for OperationStarted and OperationCompleted calls here;
- // this code is invoked through await support and will have a way
- // to observe its start/complete behavior, either through returned
- // Task objects or the async method builder's interaction with the
- // SynchronizationContext object.
- //
- // In general though, Rx doesn't play nicely with synchronization
- // contexts objects at the scheduler level. It's possible to start
- // async operations by calling Schedule, without a way to observe
- // their completion. Not interacting with SynchronizationContext
- // is a concious design decision as the performance impact was non
- // negligable and our schedulers abstract over more constructs.
- //
- ctx.Post(a => ((Action)a)(), original);
- };
- }
- }
-
- var ran = 0;
-
- _continuation = () =>
- {
- if (Interlocked.Exchange(ref ran, 1) == 0)
- {
- _ctr.Dispose();
- continuation();
- }
- };
-
- _work = _schedule(_continuation);
- }
-
- private Action _continuation;
- private IDisposable _work;
-
- private void Cancel()
- {
- var w = _work;
- if (w != null)
- w.Dispose();
-
- var c = _continuation;
- if (c != null)
- c();
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Core/Reactive/Concurrency/SchedulerQueue.cs b/Rx.NET/System.Reactive.Core/Reactive/Concurrency/SchedulerQueue.cs
deleted file mode 100644
index 2cd7beb..0000000
--- a/Rx.NET/System.Reactive.Core/Reactive/Concurrency/SchedulerQueue.cs
+++ /dev/null
@@ -1,87 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System;
-
-namespace System.Reactive.Concurrency
-{
- /// <summary>
- /// Efficient scheduler queue that maintains scheduled items sorted by absolute time.
- /// </summary>
- /// <typeparam name="TAbsolute">Absolute time representation type.</typeparam>
- /// <remarks>This type is not thread safe; users should ensure proper synchronization.</remarks>
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix", Justification = "But it *is* a queue!")]
- public class SchedulerQueue<TAbsolute>
- where TAbsolute : IComparable<TAbsolute>
- {
- private readonly PriorityQueue<ScheduledItem<TAbsolute>> _queue;
-
- /// <summary>
- /// Creates a new scheduler queue with a default initial capacity.
- /// </summary>
- public SchedulerQueue()
- : this(1024)
- {
- }
-
- /// <summary>
- /// Creats a new scheduler queue with the specified initial capacity.
- /// </summary>
- /// <param name="capacity">Initial capacity of the scheduler queue.</param>
- /// <exception cref="ArgumentOutOfRangeException"><paramref name="capacity"/> is less than zero.</exception>
- public SchedulerQueue(int capacity)
- {
- if (capacity < 0)
- throw new ArgumentOutOfRangeException("capacity");
-
- _queue = new PriorityQueue<ScheduledItem<TAbsolute>>(capacity);
- }
-
- /// <summary>
- /// Gets the number of scheduled items in the scheduler queue.
- /// </summary>
- public int Count
- {
- get
- {
- return _queue.Count;
- }
- }
-
- /// <summary>
- /// Enqueues the specified work item to be scheduled.
- /// </summary>
- /// <param name="scheduledItem">Work item to be scheduled.</param>
- public void Enqueue(ScheduledItem<TAbsolute> scheduledItem)
- {
- _queue.Enqueue(scheduledItem);
- }
-
- /// <summary>
- /// Removes the specified work item from the scheduler queue.
- /// </summary>
- /// <param name="scheduledItem">Work item to be removed from the scheduler queue.</param>
- /// <returns>true if the item was found; false otherwise.</returns>
- public bool Remove(ScheduledItem<TAbsolute> scheduledItem)
- {
- return _queue.Remove(scheduledItem);
- }
-
- /// <summary>
- /// Dequeues the next work item from the scheduler queue.
- /// </summary>
- /// <returns>Next work item in the scheduler queue (removed).</returns>
- public ScheduledItem<TAbsolute> Dequeue()
- {
- return _queue.Dequeue();
- }
-
- /// <summary>
- /// Peeks the next work item in the scheduler queue.
- /// </summary>
- /// <returns>Next work item in the scheduler queue (not removed).</returns>
- public ScheduledItem<TAbsolute> Peek()
- {
- return _queue.Peek();
- }
- }
-}
diff --git a/Rx.NET/System.Reactive.Core/Reactive/Concurrency/SchedulerWrapper.cs b/Rx.NET/System.Reactive.Core/Reactive/Concurrency/SchedulerWrapper.cs
deleted file mode 100644
index 15ff59d..0000000
--- a/Rx.NET/System.Reactive.Core/Reactive/Concurrency/SchedulerWrapper.cs
+++ /dev/null
@@ -1,124 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System;
-
-#if !NO_WEAKTABLE
-using System.Runtime.CompilerServices;
-#endif
-
-namespace System.Reactive.Concurrency
-{
- internal abstract class SchedulerWrapper : IScheduler, IServiceProvider
- {
- protected readonly IScheduler _scheduler;
-
- public SchedulerWrapper(IScheduler scheduler)
- {
- _scheduler = scheduler;
-
-#if !NO_WEAKTABLE
- _cache = new ConditionalWeakTable<IScheduler, IScheduler>();
-#endif
- }
-
- public DateTimeOffset Now
- {
- get { return _scheduler.Now; }
- }
-
- public IDisposable Schedule<TState>(TState state, Func<IScheduler, TState, IDisposable> action)
- {
- if (action == null)
- throw new ArgumentNullException("action");
-
- return _scheduler.Schedule(state, Wrap(action));
- }
-
- public IDisposable Schedule<TState>(TState state, TimeSpan dueTime, Func<IScheduler, TState, IDisposable> action)
- {
- if (action == null)
- throw new ArgumentNullException("action");
-
- return _scheduler.Schedule(state, dueTime, Wrap(action));
- }
-
- public IDisposable Schedule<TState>(TState state, DateTimeOffset dueTime, Func<IScheduler, TState, IDisposable> action)
- {
- if (action == null)
- throw new ArgumentNullException("action");
-
- return _scheduler.Schedule(state, dueTime, Wrap(action));
- }
-
- protected virtual Func<IScheduler, TState, IDisposable> Wrap<TState>(Func<IScheduler, TState, IDisposable> action)
- {
- return (self, state) => action(GetRecursiveWrapper(self), state);
- }
-
-#if !NO_WEAKTABLE
- private readonly ConditionalWeakTable<IScheduler, IScheduler> _cache;
-
- public SchedulerWrapper(IScheduler scheduler, ConditionalWeakTable<IScheduler, IScheduler> cache)
- {
- _scheduler = scheduler;
- _cache = cache;
- }
-
- protected IScheduler GetRecursiveWrapper(IScheduler scheduler)
- {
- return _cache.GetValue(scheduler, s => Clone(s, _cache));
- }
-
- protected abstract SchedulerWrapper Clone(IScheduler scheduler, ConditionalWeakTable<IScheduler, IScheduler> cache);
-#else
- private readonly object _gate = new object();
- private IScheduler _recursiveOriginal;
- private IScheduler _recursiveWrapper;
-
- protected IScheduler GetRecursiveWrapper(IScheduler scheduler)
- {
- var recursiveWrapper = default(IScheduler);
-
- lock (_gate)
- {
- //
- // Chances are the recursive scheduler will remain the same. In practice, this
- // single-shot caching scheme works out quite well. Notice we propagate our
- // mini-cache to recursive raw scheduler wrappers too.
- //
- if (!object.ReferenceEquals(scheduler, _recursiveOriginal))
- {
- _recursiveOriginal = scheduler;
-
- var wrapper = Clone(scheduler);
- wrapper._recursiveOriginal = scheduler;
- wrapper._recursiveWrapper = wrapper;
-
- _recursiveWrapper = wrapper;
- }
-
- recursiveWrapper = _recursiveWrapper;
- }
-
- return recursiveWrapper;
- }
-
- protected abstract SchedulerWrapper Clone(IScheduler scheduler);
-#endif
-
- public object GetService(Type serviceType)
- {
- var serviceProvider = _scheduler as IServiceProvider;
- if (serviceProvider == null)
- return null;
-
- var result = default(object);
- if (TryGetService(serviceProvider, serviceType, out result))
- return result;
-
- return serviceProvider.GetService(serviceType);
- }
-
- protected abstract bool TryGetService(IServiceProvider provider, Type serviceType, out object service);
- }
-}
diff --git a/Rx.NET/System.Reactive.Core/Reactive/Concurrency/Stopwatch.Default.cs b/Rx.NET/System.Reactive.Core/Reactive/Concurrency/Stopwatch.Default.cs
deleted file mode 100644
index 028f0ae..0000000
--- a/Rx.NET/System.Reactive.Core/Reactive/Concurrency/Stopwatch.Default.cs
+++ /dev/null
@@ -1,48 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_STOPWATCH
-using System.Diagnostics;
-
-namespace System.Reactive.Concurrency
-{
- //
- // WARNING: This code is kept *identically* in two places. One copy is kept in System.Reactive.Core for non-PLIB platforms.
- // Another copy is kept in System.Reactive.PlatformServices to enlighten the default lowest common denominator
- // behavior of Rx for PLIB when used on a more capable platform.
- //
- internal class DefaultStopwatch/*Impl*/ : IStopwatch
- {
- private readonly Stopwatch _sw;
-
- public DefaultStopwatch()
- {
- _sw = Stopwatch.StartNew();
- }
-
- public TimeSpan Elapsed
- {
- get { return _sw.Elapsed; }
- }
- }
-}
-#else
-namespace System.Reactive.Concurrency
-{
- // This class is only used on Silverlight in the browser. It mimicks !Stopwatch.HighResolution behavior and suffers from
- // use of absolute time. See work item 486045.
- internal class DefaultStopwatch : IStopwatch
- {
- private readonly DateTime _start;
-
- public DefaultStopwatch()
- {
- _start = DateTime.UtcNow;
- }
-
- public TimeSpan Elapsed
- {
- get { return DateTime.UtcNow - _start; }
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Core/Reactive/Concurrency/Synchronization.ObserveOn.cs b/Rx.NET/System.Reactive.Core/Reactive/Concurrency/Synchronization.ObserveOn.cs
deleted file mode 100644
index 7fd80d0..0000000
--- a/Rx.NET/System.Reactive.Core/Reactive/Concurrency/Synchronization.ObserveOn.cs
+++ /dev/null
@@ -1,117 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_PERF
-using System;
-using System.Reactive.Concurrency;
-using System.Reactive.Disposables;
-using System.Threading;
-
-namespace System.Reactive.Concurrency
-{
- class ObserveOn<TSource> : Producer<TSource>
- {
- private readonly IObservable<TSource> _source;
- private readonly IScheduler _scheduler;
-
- public ObserveOn(IObservable<TSource> source, IScheduler scheduler)
- {
- _source = source;
- _scheduler = scheduler;
- }
-
-#if !NO_SYNCCTX
- private readonly SynchronizationContext _context;
-
- public ObserveOn(IObservable<TSource> source, SynchronizationContext context)
- {
- _source = source;
- _context = context;
- }
-#endif
-
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Justification = "Visibility restricted to friend assemblies. Those should be correct by inspection.")]
- protected override IDisposable Run(IObserver<TSource> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
-#if !NO_SYNCCTX
- if (_context != null)
- {
- var sink = new ς(this, observer, cancel);
- setSink(sink);
- return sink.Run();
- }
- else
-#endif
- {
- var sink = new ObserveOnObserver<TSource>(_scheduler, observer, cancel);
- setSink(sink);
- return _source.SubscribeSafe(sink);
- }
- }
-
-#if !NO_SYNCCTX
- class ς : Sink<TSource>, IObserver<TSource>
- {
- private readonly ObserveOn<TSource> _parent;
-
- public ς(ObserveOn<TSource> parent, IObserver<TSource> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _parent = parent;
- }
-
- public IDisposable Run()
- {
- //
- // The interactions with OperationStarted/OperationCompleted below allow
- // for test frameworks to wait until a whole sequence is observed, running
- // asserts on a per-message level. Also, for ASP.NET pages, the use of the
- // built-in synchronization context would allow processing to finished in
- // its entirety before moving on with the page lifecycle.
- //
- _parent._context.OperationStarted();
-
- var d = _parent._source.SubscribeSafe(this);
- var c = Disposable.Create(() =>
- {
- _parent._context.OperationCompleted();
- });
-
- return new CompositeDisposable(d, c);
- }
-
- public void OnNext(TSource value)
- {
- _parent._context.Post(OnNextPosted, value);
- }
-
- public void OnError(Exception error)
- {
- _parent._context.Post(OnErrorPosted, error);
- }
-
- public void OnCompleted()
- {
- _parent._context.Post(OnCompletedPosted, null);
- }
-
- private void OnNextPosted(object value)
- {
- base._observer.OnNext((TSource)value);
- }
-
- private void OnErrorPosted(object error)
- {
- base._observer.OnError((Exception)error);
- base.Dispose();
- }
-
- private void OnCompletedPosted(object ignored)
- {
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
-#endif
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Core/Reactive/Concurrency/Synchronization.Synchronize.cs b/Rx.NET/System.Reactive.Core/Reactive/Concurrency/Synchronization.Synchronize.cs
deleted file mode 100644
index 85cd0ec..0000000
--- a/Rx.NET/System.Reactive.Core/Reactive/Concurrency/Synchronization.Synchronize.cs
+++ /dev/null
@@ -1,72 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_PERF
-using System;
-
-namespace System.Reactive.Concurrency
-{
- class Synchronize<TSource> : Producer<TSource>
- {
- private readonly IObservable<TSource> _source;
- private readonly object _gate;
-
- public Synchronize(IObservable<TSource> source, object gate)
- {
- _source = source;
- _gate = gate;
- }
-
- public Synchronize(IObservable<TSource> source)
- {
- _source = source;
- }
-
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Justification = "Visibility restricted to friend assemblies. Those should be correct by inspection.")]
- protected override IDisposable Run(IObserver<TSource> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(this, observer, cancel);
- setSink(sink);
- return _source.SubscribeSafe(sink);
- }
-
- class _ : Sink<TSource>, IObserver<TSource>
- {
- private readonly Synchronize<TSource> _parent;
- private readonly object _gate;
-
- public _(Synchronize<TSource> parent, IObserver<TSource> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _parent = parent;
- _gate = _parent._gate ?? new object();
- }
-
- public void OnNext(TSource value)
- {
- lock (_gate)
- {
- base._observer.OnNext(value);
- }
- }
-
- public void OnError(Exception error)
- {
- lock (_gate)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
- }
-
- public void OnCompleted()
- {
- lock (_gate)
- {
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Core/Reactive/Concurrency/Synchronization.cs b/Rx.NET/System.Reactive.Core/Reactive/Concurrency/Synchronization.cs
deleted file mode 100644
index d923912..0000000
--- a/Rx.NET/System.Reactive.Core/Reactive/Concurrency/Synchronization.cs
+++ /dev/null
@@ -1,210 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System;
-using System.ComponentModel;
-using System.Reactive.Disposables;
-using System.Threading;
-
-namespace System.Reactive.Concurrency
-{
- /// <summary>
- /// Provides basic synchronization and scheduling services for observable sequences.
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- public static class Synchronization
- {
- #region SubscribeOn
-
- /// <summary>
- /// Wraps the source sequence in order to run its subscription and unsubscription logic on the specified scheduler.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence.</param>
- /// <param name="scheduler">Scheduler to perform subscription and unsubscription actions on.</param>
- /// <returns>The source sequence whose subscriptions and unsubscriptions happen on the specified scheduler.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="scheduler"/> is null.</exception>
- /// <remarks>
- /// Only the side-effects of subscribing to the source sequence and disposing subscriptions to the source sequence are run on the specified scheduler.
- /// In order to invoke observer callbacks on the specified scheduler, e.g. to offload callback processing to a dedicated thread, use <see cref="Synchronization.ObserveOn{TSource}(IObservable{TSource}, IScheduler)"/>.
- /// </remarks>
- public static IObservable<TSource> SubscribeOn<TSource>(IObservable<TSource> source, IScheduler scheduler)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return new AnonymousObservable<TSource>(observer =>
- {
- var m = new SingleAssignmentDisposable();
- var d = new SerialDisposable();
- d.Disposable = m;
-
- m.Disposable = scheduler.Schedule(() =>
- {
- d.Disposable = new ScheduledDisposable(scheduler, source.SubscribeSafe(observer));
- });
-
- return d;
- });
- }
-
-#if !NO_SYNCCTX
- /// <summary>
- /// Wraps the source sequence in order to run its subscription and unsubscription logic on the specified synchronization context.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence.</param>
- /// <param name="context">Synchronization context to perform subscription and unsubscription actions on.</param>
- /// <returns>The source sequence whose subscriptions and unsubscriptions happen on the specified synchronization context.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="context"/> is null.</exception>
- /// <remarks>
- /// Only the side-effects of subscribing to the source sequence and disposing subscriptions to the source sequence are run on the specified synchronization context.
- /// In order to invoke observer callbacks on the specified synchronization context, e.g. to post callbacks to a UI thread represented by the synchronization context, use <see cref="Synchronization.ObserveOn{TSource}(IObservable{TSource}, SynchronizationContext)"/>.
- /// </remarks>
- public static IObservable<TSource> SubscribeOn<TSource>(IObservable<TSource> source, SynchronizationContext context)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (context == null)
- throw new ArgumentNullException("context");
-
- return new AnonymousObservable<TSource>(observer =>
- {
- var subscription = new SingleAssignmentDisposable();
- context.PostWithStartComplete(() =>
- {
- if (!subscription.IsDisposed)
- subscription.Disposable = new ContextDisposable(context, source.SubscribeSafe(observer));
- });
- return subscription;
- });
- }
-#endif
-
- #endregion
-
- #region ObserveOn
-
- /// <summary>
- /// Wraps the source sequence in order to run its observer callbacks on the specified scheduler.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence.</param>
- /// <param name="scheduler">Scheduler to notify observers on.</param>
- /// <returns>The source sequence whose observations happen on the specified scheduler.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="scheduler"/> is null.</exception>
- public static IObservable<TSource> ObserveOn<TSource>(IObservable<TSource> source, IScheduler scheduler)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
-#if !NO_PERF
- return new ObserveOn<TSource>(source, scheduler);
-#else
- return new AnonymousObservable<TSource>(observer => source.Subscribe(new ObserveOnObserver<TSource>(scheduler, observer, null)));
-#endif
- }
-
-#if !NO_SYNCCTX
- /// <summary>
- /// Wraps the source sequence in order to run its observer callbacks on the specified synchronization context.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence.</param>
- /// <param name="context">Synchronization context to notify observers on.</param>
- /// <returns>The source sequence whose observations happen on the specified synchronization context.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="context"/> is null.</exception>
- public static IObservable<TSource> ObserveOn<TSource>(IObservable<TSource> source, SynchronizationContext context)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (context == null)
- throw new ArgumentNullException("context");
-
-#if !NO_PERF
- return new ObserveOn<TSource>(source, context);
-#else
- return new AnonymousObservable<TSource>(observer =>
- {
- context.OperationStarted();
-
- return source.Subscribe(
- x => context.Post(_ =>
- {
- observer.OnNext(x);
- }, null),
- exception => context.Post(_ =>
- {
- observer.OnError(exception);
- }, null),
- () => context.Post(_ =>
- {
- observer.OnCompleted();
- }, null)
- ).Finally(() =>
- {
- context.OperationCompleted();
- });
- });
-#endif
- }
-#endif
-
- #endregion
-
- #region Synchronize
-
- /// <summary>
- /// Wraps the source sequence in order to ensure observer callbacks are properly serialized.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence.</param>
- /// <returns>The source sequence whose outgoing calls to observers are synchronized.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- public static IObservable<TSource> Synchronize<TSource>(IObservable<TSource> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
-#if !NO_PERF
- return new Synchronize<TSource>(source);
-#else
- return new AnonymousObservable<TSource>(observer =>
- {
- var gate = new object();
- return source.Subscribe(Observer.Synchronize(observer, gate));
- });
-#endif
- }
-
- /// <summary>
- /// Wraps the source sequence in order to ensure observer callbacks are synchronized using the specified gate object.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence.</param>
- /// <param name="gate">Gate object to synchronize each observer call on.</param>
- /// <returns>The source sequence whose outgoing calls to observers are synchronized on the given gate object.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="gate"/> is null.</exception>
- public static IObservable<TSource> Synchronize<TSource>(IObservable<TSource> source, object gate)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (gate == null)
- throw new ArgumentNullException("gate");
-
-#if !NO_PERF
- return new Synchronize<TSource>(source, gate);
-#else
- return new AnonymousObservable<TSource>(observer =>
- {
- return source.Subscribe(Observer.Synchronize(observer, gate));
- });
-#endif
- }
-
- #endregion
- }
-}
diff --git a/Rx.NET/System.Reactive.Core/Reactive/Concurrency/SynchronizationContextScheduler.cs b/Rx.NET/System.Reactive.Core/Reactive/Concurrency/SynchronizationContextScheduler.cs
deleted file mode 100644
index a7a7de3..0000000
--- a/Rx.NET/System.Reactive.Core/Reactive/Concurrency/SynchronizationContextScheduler.cs
+++ /dev/null
@@ -1,99 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_SYNCCTX
-using System.Reactive.Disposables;
-using System.Threading;
-
-namespace System.Reactive.Concurrency
-{
- /// <summary>
- /// Represents an object that schedules units of work on a provided <seealso cref="T:System.Threading.SynchronizationContext"/>.
- /// </summary>
- public class SynchronizationContextScheduler : LocalScheduler
- {
- private readonly SynchronizationContext _context;
- private readonly bool _alwaysPost;
-
- /// <summary>
- /// Creates an object that schedules units of work on the provided <see cref="T:System.Threading.SynchronizationContext"/>.
- /// </summary>
- /// <param name="context">Synchronization context to schedule units of work on.</param>
- /// <exception cref="ArgumentNullException"><paramref name="context"/> is null.</exception>
- public SynchronizationContextScheduler(SynchronizationContext context)
- {
- if (context == null)
- throw new ArgumentNullException("context");
-
- _context = context;
- _alwaysPost = true;
- }
-
- /// <summary>
- /// Creates an object that schedules units of work on the provided <see cref="T:System.Threading.SynchronizationContext"/>.
- /// </summary>
- /// <param name="context">Synchronization context to schedule units of work on.</param>
- /// <param name="alwaysPost">Configures whether scheduling always posts to the synchronization context, regardless whether the caller is on the same synchronization context.</param>
- /// <exception cref="ArgumentNullException"><paramref name="context"/> is null.</exception>
- public SynchronizationContextScheduler(SynchronizationContext context, bool alwaysPost)
- {
- if (context == null)
- throw new ArgumentNullException("context");
-
- _context = context;
- _alwaysPost = alwaysPost;
- }
-
- /// <summary>
- /// Schedules an action to be executed.
- /// </summary>
- /// <typeparam name="TState">The type of the state passed to the scheduled action.</typeparam>
- /// <param name="state">State passed to the action to be executed.</param>
- /// <param name="action">Action to be executed.</param>
- /// <returns>The disposable object used to cancel the scheduled action (best effort).</returns>
- /// <exception cref="ArgumentNullException"><paramref name="action"/> is null.</exception>
- public override IDisposable Schedule<TState>(TState state, Func<IScheduler, TState, IDisposable> action)
- {
- if (action == null)
- throw new ArgumentNullException("action");
-
- var d = new SingleAssignmentDisposable();
-
- if (!_alwaysPost && _context == SynchronizationContext.Current)
- {
- d.Disposable = action(this, state);
- }
- else
- {
- _context.PostWithStartComplete(() =>
- {
- if (!d.IsDisposed)
- d.Disposable = action(this, state);
- });
- }
-
- return d;
- }
-
- /// <summary>
- /// Schedules an action to be executed after dueTime.
- /// </summary>
- /// <typeparam name="TState">The type of the state passed to the scheduled action.</typeparam>
- /// <param name="state">State passed to the action to be executed.</param>
- /// <param name="action">Action to be executed.</param>
- /// <param name="dueTime">Relative time after which to execute the action.</param>
- /// <returns>The disposable object used to cancel the scheduled action (best effort).</returns>
- /// <exception cref="ArgumentNullException"><paramref name="action"/> is null.</exception>
- public override IDisposable Schedule<TState>(TState state, TimeSpan dueTime, Func<IScheduler, TState, IDisposable> action)
- {
- if (action == null)
- throw new ArgumentNullException("action");
-
- var dt = Scheduler.Normalize(dueTime);
- if (dt.Ticks == 0)
- return Schedule(state, action);
-
- return DefaultScheduler.Instance.Schedule(state, dt, (_, state1) => Schedule(state1, action));
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Core/Reactive/Disposables/AnonymousDisposable.cs b/Rx.NET/System.Reactive.Core/Reactive/Disposables/AnonymousDisposable.cs
deleted file mode 100644
index f31bbf4..0000000
--- a/Rx.NET/System.Reactive.Core/Reactive/Disposables/AnonymousDisposable.cs
+++ /dev/null
@@ -1,47 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System.Threading;
-
-namespace System.Reactive.Disposables
-{
- /// <summary>
- /// Represents an Action-based disposable.
- /// </summary>
- internal sealed class AnonymousDisposable : ICancelable
- {
- private volatile Action _dispose;
-
- /// <summary>
- /// Constructs a new disposable with the given action used for disposal.
- /// </summary>
- /// <param name="dispose">Disposal action which will be run upon calling Dispose.</param>
- public AnonymousDisposable(Action dispose)
- {
- System.Diagnostics.Debug.Assert(dispose != null);
-
- _dispose = dispose;
- }
-
- /// <summary>
- /// Gets a value that indicates whether the object is disposed.
- /// </summary>
- public bool IsDisposed
- {
- get { return _dispose == null; }
- }
-
- /// <summary>
- /// Calls the disposal action if and only if the current instance hasn't been disposed yet.
- /// </summary>
- public void Dispose()
- {
-#pragma warning disable 0420
- var dispose = Interlocked.Exchange(ref _dispose, null);
-#pragma warning restore 0420
- if (dispose != null)
- {
- dispose();
- }
- }
- }
-}
diff --git a/Rx.NET/System.Reactive.Core/Reactive/Disposables/BooleanDisposable.cs b/Rx.NET/System.Reactive.Core/Reactive/Disposables/BooleanDisposable.cs
deleted file mode 100644
index 1f1a21f..0000000
--- a/Rx.NET/System.Reactive.Core/Reactive/Disposables/BooleanDisposable.cs
+++ /dev/null
@@ -1,45 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-namespace System.Reactive.Disposables
-{
- /// <summary>
- /// Represents a disposable resource that can be checked for disposal status.
- /// </summary>
- public sealed class BooleanDisposable : ICancelable
- {
- // Keep internal! This is used as sentinel in other IDisposable implementations to detect disposal and
- // should never be exposed to user code in order to prevent users from swapping in the sentinel. Have
- // a look at the code in e.g. SingleAssignmentDisposable for usage patterns.
- internal static readonly BooleanDisposable True = new BooleanDisposable(true);
-
- private volatile bool _isDisposed;
-
- /// <summary>
- /// Initializes a new instance of the <see cref="T:System.Reactive.Disposables.BooleanDisposable"/> class.
- /// </summary>
- public BooleanDisposable()
- {
- }
-
- private BooleanDisposable(bool isDisposed)
- {
- _isDisposed = isDisposed;
- }
-
- /// <summary>
- /// Gets a value that indicates whether the object is disposed.
- /// </summary>
- public bool IsDisposed
- {
- get { return _isDisposed; }
- }
-
- /// <summary>
- /// Sets the status to disposed, which can be observer through the <see cref="IsDisposed"/> property.
- /// </summary>
- public void Dispose()
- {
- _isDisposed = true;
- }
- }
-}
diff --git a/Rx.NET/System.Reactive.Core/Reactive/Disposables/CancellationDisposable.cs b/Rx.NET/System.Reactive.Core/Reactive/Disposables/CancellationDisposable.cs
deleted file mode 100644
index 5c67511..0000000
--- a/Rx.NET/System.Reactive.Core/Reactive/Disposables/CancellationDisposable.cs
+++ /dev/null
@@ -1,61 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_TPL
-using System.Threading;
-
-namespace System.Reactive.Disposables
-{
- /// <summary>
- /// Represents a disposable resource that has an associated <seealso cref="T:System.Threading.CancellationToken"/> that will be set to the cancellation requested state upon disposal.
- /// </summary>
- public sealed class CancellationDisposable : ICancelable
- {
- private readonly CancellationTokenSource _cts;
-
- /// <summary>
- /// Initializes a new instance of the <see cref="T:System.Reactive.Disposables.CancellationDisposable"/> class that uses an existing <seealso cref="T:System.Threading.CancellationTokenSource"/>.
- /// </summary>
- /// <param name="cts"><seealso cref="T:System.Threading.CancellationTokenSource"/> used for cancellation.</param>
- /// <exception cref="ArgumentNullException"><paramref name="cts"/> is null.</exception>
- public CancellationDisposable(CancellationTokenSource cts)
- {
- if (cts == null)
- throw new ArgumentNullException("cts");
-
- _cts = cts;
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="T:System.Reactive.Disposables.CancellationDisposable"/> class that uses a new <seealso cref="T:System.Threading.CancellationTokenSource"/>.
- /// </summary>
- public CancellationDisposable()
- : this(new CancellationTokenSource())
- {
- }
-
- /// <summary>
- /// Gets the <see cref="T:System.Threading.CancellationToken"/> used by this CancellationDisposable.
- /// </summary>
- public CancellationToken Token
- {
- get { return _cts.Token; }
- }
-
- /// <summary>
- /// Cancels the underlying <seealso cref="T:System.Threading.CancellationTokenSource"/>.
- /// </summary>
- public void Dispose()
- {
- _cts.Cancel();
- }
-
- /// <summary>
- /// Gets a value that indicates whether the object is disposed.
- /// </summary>
- public bool IsDisposed
- {
- get { return _cts.IsCancellationRequested; }
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Core/Reactive/Disposables/CompositeDisposable.cs b/Rx.NET/System.Reactive.Core/Reactive/Disposables/CompositeDisposable.cs
deleted file mode 100644
index 6416cff..0000000
--- a/Rx.NET/System.Reactive.Core/Reactive/Disposables/CompositeDisposable.cs
+++ /dev/null
@@ -1,276 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System.Collections.Generic;
-using System.Linq;
-
-namespace System.Reactive.Disposables
-{
- /// <summary>
- /// Represents a group of disposable resources that are disposed together.
- /// </summary>
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix", Justification = "Backward compat + ideally want to get rid of the ICollection nature of the type.")]
- public sealed class CompositeDisposable : ICollection<IDisposable>, ICancelable
- {
- private readonly object _gate = new object();
-
- private bool _disposed;
- private List<IDisposable> _disposables;
- private int _count;
- private const int SHRINK_THRESHOLD = 64;
-
- /// <summary>
- /// Initializes a new instance of the <see cref="T:System.Reactive.Disposables.CompositeDisposable"/> class with no disposables contained by it initially.
- /// </summary>
- public CompositeDisposable()
- {
- _disposables = new List<IDisposable>();
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="T:System.Reactive.Disposables.CompositeDisposable"/> class with the specified number of disposables.
- /// </summary>
- /// <param name="capacity">The number of disposables that the new CompositeDisposable can initially store.</param>
- /// <exception cref="ArgumentOutOfRangeException"><paramref name="capacity"/> is less than zero.</exception>
- public CompositeDisposable(int capacity)
- {
- if (capacity < 0)
- throw new ArgumentOutOfRangeException("capacity");
-
- _disposables = new List<IDisposable>(capacity);
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="T:System.Reactive.Disposables.CompositeDisposable"/> class from a group of disposables.
- /// </summary>
- /// <param name="disposables">Disposables that will be disposed together.</param>
- /// <exception cref="ArgumentNullException"><paramref name="disposables"/> is null.</exception>
- public CompositeDisposable(params IDisposable[] disposables)
- {
- if (disposables == null)
- throw new ArgumentNullException("disposables");
-
- _disposables = new List<IDisposable>(disposables);
- _count = _disposables.Count;
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="T:System.Reactive.Disposables.CompositeDisposable"/> class from a group of disposables.
- /// </summary>
- /// <param name="disposables">Disposables that will be disposed together.</param>
- /// <exception cref="ArgumentNullException"><paramref name="disposables"/> is null.</exception>
- public CompositeDisposable(IEnumerable<IDisposable> disposables)
- {
- if (disposables == null)
- throw new ArgumentNullException("disposables");
-
- _disposables = new List<IDisposable>(disposables);
- _count = _disposables.Count;
- }
-
- /// <summary>
- /// Gets the number of disposables contained in the CompositeDisposable.
- /// </summary>
- public int Count
- {
- get
- {
- return _count;
- }
- }
-
- /// <summary>
- /// Adds a disposable to the CompositeDisposable or disposes the disposable if the CompositeDisposable is disposed.
- /// </summary>
- /// <param name="item">Disposable to add.</param>
- /// <exception cref="ArgumentNullException"><paramref name="item"/> is null.</exception>
- public void Add(IDisposable item)
- {
- if (item == null)
- throw new ArgumentNullException("item");
-
- var shouldDispose = false;
- lock (_gate)
- {
- shouldDispose = _disposed;
- if (!_disposed)
- {
- _disposables.Add(item);
- _count++;
- }
- }
- if (shouldDispose)
- item.Dispose();
- }
-
- /// <summary>
- /// Removes and disposes the first occurrence of a disposable from the CompositeDisposable.
- /// </summary>
- /// <param name="item">Disposable to remove.</param>
- /// <returns>true if found; false otherwise.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="item"/> is null.</exception>
- public bool Remove(IDisposable item)
- {
- if (item == null)
- throw new ArgumentNullException("item");
-
- var shouldDispose = false;
-
- lock (_gate)
- {
- if (!_disposed)
- {
- //
- // List<T> doesn't shrink the size of the underlying array but does collapse the array
- // by copying the tail one position to the left of the removal index. We don't need
- // index-based lookup but only ordering for sequential disposal. So, instead of spending
- // cycles on the Array.Copy imposed by Remove, we use a null sentinel value. We also
- // do manual Swiss cheese detection to shrink the list if there's a lot of holes in it.
- //
- var i = _disposables.IndexOf(item);
- if (i >= 0)
- {
- shouldDispose = true;
- _disposables[i] = null;
- _count--;
-
- if (_disposables.Capacity > SHRINK_THRESHOLD && _count < _disposables.Capacity / 2)
- {
- var old = _disposables;
- _disposables = new List<IDisposable>(_disposables.Capacity / 2);
-
- foreach (var d in old)
- if (d != null)
- _disposables.Add(d);
- }
- }
- }
- }
-
- if (shouldDispose)
- item.Dispose();
-
- return shouldDispose;
- }
-
- /// <summary>
- /// Disposes all disposables in the group and removes them from the group.
- /// </summary>
- public void Dispose()
- {
- var currentDisposables = default(IDisposable[]);
- lock (_gate)
- {
- if (!_disposed)
- {
- _disposed = true;
- currentDisposables = _disposables.ToArray();
- _disposables.Clear();
- _count = 0;
- }
- }
-
- if (currentDisposables != null)
- {
- foreach (var d in currentDisposables)
- if (d != null)
- d.Dispose();
- }
- }
-
- /// <summary>
- /// Removes and disposes all disposables from the CompositeDisposable, but does not dispose the CompositeDisposable.
- /// </summary>
- public void Clear()
- {
- var currentDisposables = default(IDisposable[]);
- lock (_gate)
- {
- currentDisposables = _disposables.ToArray();
- _disposables.Clear();
- _count = 0;
- }
-
- foreach (var d in currentDisposables)
- if (d != null)
- d.Dispose();
- }
-
- /// <summary>
- /// Determines whether the CompositeDisposable contains a specific disposable.
- /// </summary>
- /// <param name="item">Disposable to search for.</param>
- /// <returns>true if the disposable was found; otherwise, false.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="item"/> is null.</exception>
- public bool Contains(IDisposable item)
- {
- if (item == null)
- throw new ArgumentNullException("item");
-
- lock (_gate)
- {
- return _disposables.Contains(item);
- }
- }
-
- /// <summary>
- /// Copies the disposables contained in the CompositeDisposable to an array, starting at a particular array index.
- /// </summary>
- /// <param name="array">Array to copy the contained disposables to.</param>
- /// <param name="arrayIndex">Target index at which to copy the first disposable of the group.</param>
- /// <exception cref="ArgumentNullException"><paramref name="array"/> is null.</exception>
- /// <exception cref="ArgumentOutOfRangeException"><paramref name="arrayIndex"/> is less than zero. -or - <paramref name="arrayIndex"/> is larger than or equal to the array length.</exception>
- public void CopyTo(IDisposable[] array, int arrayIndex)
- {
- if (array == null)
- throw new ArgumentNullException("array");
- if (arrayIndex < 0 || arrayIndex >= array.Length)
- throw new ArgumentOutOfRangeException("arrayIndex");
-
- lock (_gate)
- {
- Array.Copy(_disposables.Where(d => d != null).ToArray(), 0, array, arrayIndex, array.Length - arrayIndex);
- }
- }
-
- /// <summary>
- /// Always returns false.
- /// </summary>
- public bool IsReadOnly
- {
- get { return false; }
- }
-
- /// <summary>
- /// Returns an enumerator that iterates through the CompositeDisposable.
- /// </summary>
- /// <returns>An enumerator to iterate over the disposables.</returns>
- public IEnumerator<IDisposable> GetEnumerator()
- {
- var res = default(IEnumerable<IDisposable>);
-
- lock (_gate)
- {
- res = _disposables.Where(d => d != null).ToList();
- }
-
- return res.GetEnumerator();
- }
-
- /// <summary>
- /// Returns an enumerator that iterates through the CompositeDisposable.
- /// </summary>
- /// <returns>An enumerator to iterate over the disposables.</returns>
- System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
- {
- return GetEnumerator();
- }
-
- /// <summary>
- /// Gets a value that indicates whether the object is disposed.
- /// </summary>
- public bool IsDisposed
- {
- get { return _disposed; }
- }
- }
-}
diff --git a/Rx.NET/System.Reactive.Core/Reactive/Disposables/ContextDisposable.cs b/Rx.NET/System.Reactive.Core/Reactive/Disposables/ContextDisposable.cs
deleted file mode 100644
index ebe3479..0000000
--- a/Rx.NET/System.Reactive.Core/Reactive/Disposables/ContextDisposable.cs
+++ /dev/null
@@ -1,66 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_SYNCCTX
-using System.Reactive.Concurrency;
-using System.Threading;
-
-namespace System.Reactive.Disposables
-{
- /// <summary>
- /// Represents a disposable resource whose disposal invocation will be posted to the specified <seealso cref="T:System.Threading.SynchronizationContext"/>.
- /// </summary>
- public sealed class ContextDisposable : ICancelable
- {
- private readonly SynchronizationContext _context;
- private volatile IDisposable _disposable;
-
- /// <summary>
- /// Initializes a new instance of the <see cref="T:System.Reactive.Disposables.ContextDisposable"/> class that uses the specified <see cref="T:System.Threading.SynchronizationContext"/> on which to dispose the specified disposable resource.
- /// </summary>
- /// <param name="context">Context to perform disposal on.</param>
- /// <param name="disposable">Disposable whose Dispose operation to run on the given synchronization context.</param>
- /// <exception cref="ArgumentNullException"><paramref name="context"/> or <paramref name="disposable"/> is null.</exception>
- public ContextDisposable(SynchronizationContext context, IDisposable disposable)
- {
- if (context == null)
- throw new ArgumentNullException("context");
- if (disposable == null)
- throw new ArgumentNullException("disposable");
-
- _context = context;
- _disposable = disposable;
- }
-
- /// <summary>
- /// Gets the provided <see cref="T:System.Threading.SynchronizationContext"/>.
- /// </summary>
- public SynchronizationContext Context
- {
- get { return _context; }
- }
-
- /// <summary>
- /// Gets a value that indicates whether the object is disposed.
- /// </summary>
- public bool IsDisposed
- {
- get { return _disposable == BooleanDisposable.True; }
- }
-
- /// <summary>
- /// Disposes the underlying disposable on the provided <see cref="T:System.Threading.SynchronizationContext"/>.
- /// </summary>
- public void Dispose()
- {
-#pragma warning disable 0420
- var disposable = Interlocked.Exchange(ref _disposable, BooleanDisposable.True);
-#pragma warning restore 0420
-
- if (disposable != BooleanDisposable.True)
- {
- _context.PostWithStartComplete(d => d.Dispose(), disposable);
- }
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Core/Reactive/Disposables/DefaultDisposable.cs b/Rx.NET/System.Reactive.Core/Reactive/Disposables/DefaultDisposable.cs
deleted file mode 100644
index 6f643c3..0000000
--- a/Rx.NET/System.Reactive.Core/Reactive/Disposables/DefaultDisposable.cs
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-namespace System.Reactive.Disposables
-{
- /// <summary>
- /// Represents a disposable that does nothing on disposal.
- /// </summary>
- internal sealed class DefaultDisposable : IDisposable
- {
- /// <summary>
- /// Singleton default disposable.
- /// </summary>
- public static readonly DefaultDisposable Instance = new DefaultDisposable();
-
- private DefaultDisposable()
- {
- }
-
- /// <summary>
- /// Does nothing.
- /// </summary>
- public void Dispose()
- {
- // no op
- }
- }
-}
diff --git a/Rx.NET/System.Reactive.Core/Reactive/Disposables/Disposable.cs b/Rx.NET/System.Reactive.Core/Reactive/Disposables/Disposable.cs
deleted file mode 100644
index fc77f3b..0000000
--- a/Rx.NET/System.Reactive.Core/Reactive/Disposables/Disposable.cs
+++ /dev/null
@@ -1,32 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-namespace System.Reactive.Disposables
-{
- /// <summary>
- /// Provides a set of static methods for creating Disposables.
- /// </summary>
- public static class Disposable
- {
- /// <summary>
- /// Gets the disposable that does nothing when disposed.
- /// </summary>
- public static IDisposable Empty
- {
- get { return DefaultDisposable.Instance; }
- }
-
- /// <summary>
- /// Creates a disposable object that invokes the specified action when disposed.
- /// </summary>
- /// <param name="dispose">Action to run during the first call to <see cref="IDisposable.Dispose"/>. The action is guaranteed to be run at most once.</param>
- /// <returns>The disposable object that runs the given action upon disposal.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="dispose"/> is null.</exception>
- public static IDisposable Create(Action dispose)
- {
- if (dispose == null)
- throw new ArgumentNullException("dispose");
-
- return new AnonymousDisposable(dispose);
- }
- }
-}
diff --git a/Rx.NET/System.Reactive.Core/Reactive/Disposables/MultipleAssignmentDisposable.cs b/Rx.NET/System.Reactive.Core/Reactive/Disposables/MultipleAssignmentDisposable.cs
deleted file mode 100644
index 0fcc4dc..0000000
--- a/Rx.NET/System.Reactive.Core/Reactive/Disposables/MultipleAssignmentDisposable.cs
+++ /dev/null
@@ -1,92 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-namespace System.Reactive.Disposables
-{
- /// <summary>
- /// Represents a disposable resource whose underlying disposable resource can be swapped for another disposable resource.
- /// </summary>
- public sealed class MultipleAssignmentDisposable : ICancelable
- {
- private readonly object _gate = new object();
- private IDisposable _current;
-
- /// <summary>
- /// Initializes a new instance of the <see cref="T:System.Reactive.Disposables.MultipleAssignmentDisposable"/> class with no current underlying disposable.
- /// </summary>
- public MultipleAssignmentDisposable()
- {
- }
-
- /// <summary>
- /// Gets a value that indicates whether the object is disposed.
- /// </summary>
- public bool IsDisposed
- {
- get
- {
- lock (_gate)
- {
- // We use a sentinel value to indicate we've been disposed. This sentinel never leaks
- // to the outside world (see the Disposable property getter), so no-one can ever assign
- // this value to us manually.
- return _current == BooleanDisposable.True;
- }
- }
- }
-
- /// <summary>
- /// Gets or sets the underlying disposable. After disposal, the result of getting this property is undefined.
- /// </summary>
- /// <remarks>If the MutableDisposable has already been disposed, assignment to this property causes immediate disposal of the given disposable object.</remarks>
- public IDisposable Disposable
- {
- get
- {
- lock (_gate)
- {
- if (_current == BooleanDisposable.True)
- return DefaultDisposable.Instance; // Don't leak the sentinel value.
-
- return _current;
- }
- }
-
- set
- {
- var shouldDispose = false;
- lock (_gate)
- {
- shouldDispose = IsDisposed;
- if (!shouldDispose)
- {
- _current = value;
- }
- }
- if (shouldDispose && value != null)
- value.Dispose();
- }
- }
-
- /// <summary>
- /// Disposes the underlying disposable as well as all future replacements.
- /// </summary>
- public void Dispose()
- {
- var old = default(IDisposable);
-
- lock (_gate)
- {
- if (!IsDisposed)
- {
- old = _current;
-
- // See IsDisposed for rationale behind using the sentinel.
- _current = BooleanDisposable.True;
- }
- }
-
- if (old != null)
- old.Dispose();
- }
- }
-}
diff --git a/Rx.NET/System.Reactive.Core/Reactive/Disposables/RefCountDisposable.cs b/Rx.NET/System.Reactive.Core/Reactive/Disposables/RefCountDisposable.cs
deleted file mode 100644
index 9bd0407..0000000
--- a/Rx.NET/System.Reactive.Core/Reactive/Disposables/RefCountDisposable.cs
+++ /dev/null
@@ -1,131 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System.Threading;
-
-namespace System.Reactive.Disposables
-{
- /// <summary>
- /// Represents a disposable resource that only disposes its underlying disposable resource when all <see cref="GetDisposable">dependent disposable objects</see> have been disposed.
- /// </summary>
- public sealed class RefCountDisposable : ICancelable
- {
- private readonly object _gate = new object();
- private IDisposable _disposable;
- private bool _isPrimaryDisposed;
- private int _count;
-
- /// <summary>
- /// Initializes a new instance of the <see cref="T:System.Reactive.Disposables.RefCountDisposable"/> class with the specified disposable.
- /// </summary>
- /// <param name="disposable">Underlying disposable.</param>
- /// <exception cref="ArgumentNullException"><paramref name="disposable"/> is null.</exception>
- public RefCountDisposable(IDisposable disposable)
- {
- if (disposable == null)
- throw new ArgumentNullException("disposable");
-
- _disposable = disposable;
- _isPrimaryDisposed = false;
- _count = 0;
- }
-
- /// <summary>
- /// Gets a value that indicates whether the object is disposed.
- /// </summary>
- public bool IsDisposed
- {
- get { return _disposable == null; }
- }
-
- /// <summary>
- /// Returns a dependent disposable that when disposed decreases the refcount on the underlying disposable.
- /// </summary>
- /// <returns>A dependent disposable contributing to the reference count that manages the underlying disposable's lifetime.</returns>
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate", Justification = "Backward compat + non-trivial work for a property getter.")]
- public IDisposable GetDisposable()
- {
- lock (_gate)
- {
- if (_disposable == null)
- {
- return Disposable.Empty;
- }
- else
- {
- _count++;
- return new InnerDisposable(this);
- }
- }
- }
-
- /// <summary>
- /// Disposes the underlying disposable only when all dependent disposables have been disposed.
- /// </summary>
- public void Dispose()
- {
- var disposable = default(IDisposable);
- lock (_gate)
- {
- if (_disposable != null)
- {
- if (!_isPrimaryDisposed)
- {
- _isPrimaryDisposed = true;
-
- if (_count == 0)
- {
- disposable = _disposable;
- _disposable = null;
- }
- }
- }
- }
-
- if (disposable != null)
- disposable.Dispose();
- }
-
- private void Release()
- {
- var disposable = default(IDisposable);
- lock (_gate)
- {
- if (_disposable != null)
- {
- _count--;
-
- System.Diagnostics.Debug.Assert(_count >= 0);
-
- if (_isPrimaryDisposed)
- {
- if (_count == 0)
- {
- disposable = _disposable;
- _disposable = null;
- }
- }
- }
- }
-
- if (disposable != null)
- disposable.Dispose();
- }
-
- sealed class InnerDisposable : IDisposable
- {
- private RefCountDisposable _parent;
-
- public InnerDisposable(RefCountDisposable parent)
- {
- _parent = parent;
- }
-
- public void Dispose()
- {
- var parent = Interlocked.Exchange(ref _parent, null);
- if (parent != null)
- parent.Release();
- }
- }
- }
-}
diff --git a/Rx.NET/System.Reactive.Core/Reactive/Disposables/ScheduledDisposable.cs b/Rx.NET/System.Reactive.Core/Reactive/Disposables/ScheduledDisposable.cs
deleted file mode 100644
index eb742aa..0000000
--- a/Rx.NET/System.Reactive.Core/Reactive/Disposables/ScheduledDisposable.cs
+++ /dev/null
@@ -1,85 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System.Reactive.Concurrency;
-using System.Threading;
-
-namespace System.Reactive.Disposables
-{
- /// <summary>
- /// Represents a disposable resource whose disposal invocation will be scheduled on the specified <seealso cref="T:System.Reactive.Concurrency.IScheduler"/>.
- /// </summary>
- public sealed class ScheduledDisposable : ICancelable
- {
- private readonly IScheduler _scheduler;
- private volatile IDisposable _disposable;
-
- /// <summary>
- /// Initializes a new instance of the <see cref="T:System.Reactive.Disposables.ScheduledDisposable"/> class that uses an <see cref="T:System.Reactive.Concurrency.IScheduler"/> on which to dispose the disposable.
- /// </summary>
- /// <param name="scheduler">Scheduler where the disposable resource will be disposed on.</param>
- /// <param name="disposable">Disposable resource to dispose on the given scheduler.</param>
- /// <exception cref="ArgumentNullException"><paramref name="scheduler"/> or <paramref name="disposable"/> is null.</exception>
- public ScheduledDisposable(IScheduler scheduler, IDisposable disposable)
- {
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
- if (disposable == null)
- throw new ArgumentNullException("disposable");
-
- _scheduler = scheduler;
- _disposable = disposable;
- }
-
- /// <summary>
- /// Gets the scheduler where the disposable resource will be disposed on.
- /// </summary>
- public IScheduler Scheduler
- {
- get { return _scheduler; }
- }
-
- /// <summary>
- /// Gets the underlying disposable. After disposal, the result is undefined.
- /// </summary>
- public IDisposable Disposable
- {
- get
- {
- var current = _disposable;
-
- if (current == BooleanDisposable.True)
- return DefaultDisposable.Instance; // Don't leak the sentinel value.
-
- return current;
- }
- }
-
- /// <summary>
- /// Gets a value that indicates whether the object is disposed.
- /// </summary>
- public bool IsDisposed
- {
- get { return _disposable == BooleanDisposable.True; }
- }
-
- /// <summary>
- /// Disposes the wrapped disposable on the provided scheduler.
- /// </summary>
- public void Dispose()
- {
- Scheduler.Schedule(DisposeInner);
- }
-
- private void DisposeInner()
- {
-#pragma warning disable 0420
- var disposable = Interlocked.Exchange(ref _disposable, BooleanDisposable.True);
-#pragma warning restore 0420
-
- if (disposable != BooleanDisposable.True)
- {
- disposable.Dispose();
- }
- }
- }
-}
diff --git a/Rx.NET/System.Reactive.Core/Reactive/Disposables/SerialDisposable.cs b/Rx.NET/System.Reactive.Core/Reactive/Disposables/SerialDisposable.cs
deleted file mode 100644
index 835bd68..0000000
--- a/Rx.NET/System.Reactive.Core/Reactive/Disposables/SerialDisposable.cs
+++ /dev/null
@@ -1,87 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-namespace System.Reactive.Disposables
-{
- /// <summary>
- /// Represents a disposable resource whose underlying disposable resource can be replaced by another disposable resource, causing automatic disposal of the previous underlying disposable resource.
- /// </summary>
- public sealed class SerialDisposable : ICancelable
- {
- private readonly object _gate = new object();
- private IDisposable _current;
- private bool _disposed;
-
- /// <summary>
- /// Initializes a new instance of the <see cref="T:System.Reactive.Disposables.SerialDisposable"/> class.
- /// </summary>
- public SerialDisposable()
- {
- }
-
- /// <summary>
- /// Gets a value that indicates whether the object is disposed.
- /// </summary>
- public bool IsDisposed
- {
- get
- {
- lock (_gate)
- {
- return _disposed;
- }
- }
- }
-
- /// <summary>
- /// Gets or sets the underlying disposable.
- /// </summary>
- /// <remarks>If the SerialDisposable has already been disposed, assignment to this property causes immediate disposal of the given disposable object. Assigning this property disposes the previous disposable object.</remarks>
- public IDisposable Disposable
- {
- get
- {
- return _current;
- }
-
- set
- {
- var shouldDispose = false;
- var old = default(IDisposable);
- lock (_gate)
- {
- shouldDispose = _disposed;
- if (!shouldDispose)
- {
- old = _current;
- _current = value;
- }
- }
- if (old != null)
- old.Dispose();
- if (shouldDispose && value != null)
- value.Dispose();
- }
- }
-
- /// <summary>
- /// Disposes the underlying disposable as well as all future replacements.
- /// </summary>
- public void Dispose()
- {
- var old = default(IDisposable);
-
- lock (_gate)
- {
- if (!_disposed)
- {
- _disposed = true;
- old = _current;
- _current = null;
- }
- }
-
- if (old != null)
- old.Dispose();
- }
- }
-}
diff --git a/Rx.NET/System.Reactive.Core/Reactive/Disposables/SingleAssignmentDisposable.cs b/Rx.NET/System.Reactive.Core/Reactive/Disposables/SingleAssignmentDisposable.cs
deleted file mode 100644
index 8931c25..0000000
--- a/Rx.NET/System.Reactive.Core/Reactive/Disposables/SingleAssignmentDisposable.cs
+++ /dev/null
@@ -1,80 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System.Threading;
-
-namespace System.Reactive.Disposables
-{
- /// <summary>
- /// Represents a disposable resource which only allows a single assignment of its underlying disposable resource.
- /// If an underlying disposable resource has already been set, future attempts to set the underlying disposable resource will throw an <see cref="T:System.InvalidOperationException"/>.
- /// </summary>
- public sealed class SingleAssignmentDisposable : ICancelable
- {
- private volatile IDisposable _current;
-
- /// <summary>
- /// Initializes a new instance of the <see cref="T:System.Reactive.Disposables.SingleAssignmentDisposable"/> class.
- /// </summary>
- public SingleAssignmentDisposable()
- {
- }
-
- /// <summary>
- /// Gets a value that indicates whether the object is disposed.
- /// </summary>
- public bool IsDisposed
- {
- get
- {
- // We use a sentinel value to indicate we've been disposed. This sentinel never leaks
- // to the outside world (see the Disposable property getter), so no-one can ever assign
- // this value to us manually.
- return _current == BooleanDisposable.True;
- }
- }
-
- /// <summary>
- /// Gets or sets the underlying disposable. After disposal, the result of getting this property is undefined.
- /// </summary>
- /// <exception cref="InvalidOperationException">Thrown if the SingleAssignmentDisposable has already been assigned to.</exception>
- public IDisposable Disposable
- {
- get
- {
- var current = _current;
-
- if (current == BooleanDisposable.True)
- return DefaultDisposable.Instance; // Don't leak the sentinel value.
-
- return current;
- }
-
- set
- {
-#pragma warning disable 0420
- var old = Interlocked.CompareExchange(ref _current, value, null);
-#pragma warning restore 0420
- if (old == null)
- return;
-
- if (old != BooleanDisposable.True)
- throw new InvalidOperationException(Strings_Core.DISPOSABLE_ALREADY_ASSIGNED);
-
- if (value != null)
- value.Dispose();
- }
- }
-
- /// <summary>
- /// Disposes the underlying disposable.
- /// </summary>
- public void Dispose()
- {
-#pragma warning disable 0420
- var old = Interlocked.Exchange(ref _current, BooleanDisposable.True);
-#pragma warning restore 0420
- if (old != null)
- old.Dispose();
- }
- }
-}
diff --git a/Rx.NET/System.Reactive.Core/Reactive/Internal/AsyncLockObserver.cs b/Rx.NET/System.Reactive.Core/Reactive/Internal/AsyncLockObserver.cs
deleted file mode 100644
index 7db2116..0000000
--- a/Rx.NET/System.Reactive.Core/Reactive/Internal/AsyncLockObserver.cs
+++ /dev/null
@@ -1,40 +0,0 @@
-using System.Reactive.Concurrency;
-
-namespace System.Reactive
-{
- internal class AsyncLockObserver<T> : ObserverBase<T>
- {
- private readonly AsyncLock _gate;
- private readonly IObserver<T> _observer;
-
- public AsyncLockObserver(IObserver<T> observer, AsyncLock gate)
- {
- _gate = gate;
- _observer = observer;
- }
-
- protected override void OnNextCore(T value)
- {
- _gate.Wait(() =>
- {
- _observer.OnNext(value);
- });
- }
-
- protected override void OnErrorCore(Exception exception)
- {
- _gate.Wait(() =>
- {
- _observer.OnError(exception);
- });
- }
-
- protected override void OnCompletedCore()
- {
- _gate.Wait(() =>
- {
- _observer.OnCompleted();
- });
- }
- }
-}
diff --git a/Rx.NET/System.Reactive.Core/Reactive/Internal/AutoDetachObserver.cs b/Rx.NET/System.Reactive.Core/Reactive/Internal/AutoDetachObserver.cs
deleted file mode 100644
index e565a42..0000000
--- a/Rx.NET/System.Reactive.Core/Reactive/Internal/AutoDetachObserver.cs
+++ /dev/null
@@ -1,98 +0,0 @@
-using System.Reactive.Disposables;
-
-namespace System.Reactive
-{
- class AutoDetachObserver<T> : ObserverBase<T>
- {
- private readonly IObserver<T> observer;
- private readonly SingleAssignmentDisposable m = new SingleAssignmentDisposable();
-
- public AutoDetachObserver(IObserver<T> observer)
- {
- this.observer = observer;
- }
-
- public IDisposable Disposable
- {
- set { m.Disposable = value; }
- }
-
- protected override void OnNextCore(T value)
- {
- //
- // Safeguarding of the pipeline against rogue observers is required for proper
- // resource cleanup. Consider the following example:
- //
- // var xs = Observable.Interval(TimeSpan.FromSeconds(1));
- // var ys = <some random sequence>;
- // var res = xs.CombineLatest(ys, (x, y) => x + y);
- //
- // The marble diagram of the query above looks as follows:
- //
- // xs -----0-----1-----2-----3-----4-----5-----6-----7-----8-----9---...
- // | | | | | | | | |
- // ys --------4--+--5--+-----+--2--+--1--+-----+-----+--0--+-----+---...
- // | | | | | | | | | | | | | |
- // v v v v v v v v v v v v v v
- // res --------4--5--6--7-----8--5--6--5--6-----7-----8--7--8-----9---...
- // |
- // @#&
- //
- // Notice the free-threaded nature of Rx, where messages on the resulting sequence
- // are produced by either of the two input sequences to CombineLatest.
- //
- // Now assume an exception happens in the OnNext callback for the observer of res,
- // at the indicated point marked with @#& above. The callback runs in the context
- // of ys, so the exception will take down the scheduler thread of ys. This by
- // itself is a problem (that can be mitigated by a Catch operator on IScheduler),
- // but notice how the timer that produces xs is kept alive.
- //
- // The safe-guarding code below ensures the acquired resources are disposed when
- // the user callback throws.
- //
- var __noError = false;
- try
- {
- observer.OnNext(value);
- __noError = true;
- }
- finally
- {
- if (!__noError)
- Dispose();
- }
- }
-
- protected override void OnErrorCore(Exception exception)
- {
- try
- {
- observer.OnError(exception);
- }
- finally
- {
- Dispose();
- }
- }
-
- protected override void OnCompletedCore()
- {
- try
- {
- observer.OnCompleted();
- }
- finally
- {
- Dispose();
- }
- }
-
- protected override void Dispose(bool disposing)
- {
- base.Dispose(disposing);
-
- if (disposing)
- m.Dispose();
- }
- }
-} \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Core/Reactive/Internal/CheckedObserver.cs b/Rx.NET/System.Reactive.Core/Reactive/Internal/CheckedObserver.cs
deleted file mode 100644
index 7097027..0000000
--- a/Rx.NET/System.Reactive.Core/Reactive/Internal/CheckedObserver.cs
+++ /dev/null
@@ -1,73 +0,0 @@
-using System;
-using System.Threading;
-
-namespace System.Reactive
-{
- internal class CheckedObserver<T> : IObserver<T>
- {
- private readonly IObserver<T> _observer;
- private int _state;
-
- private const int IDLE = 0;
- private const int BUSY = 1;
- private const int DONE = 2;
-
- public CheckedObserver(IObserver<T> observer)
- {
- _observer = observer;
- }
-
- public void OnNext(T value)
- {
- CheckAccess();
-
- try
- {
- _observer.OnNext(value);
- }
- finally
- {
- Interlocked.Exchange(ref _state, IDLE);
- }
- }
-
- public void OnError(Exception error)
- {
- CheckAccess();
-
- try
- {
- _observer.OnError(error);
- }
- finally
- {
- Interlocked.Exchange(ref _state, DONE);
- }
- }
-
- public void OnCompleted()
- {
- CheckAccess();
-
- try
- {
- _observer.OnCompleted();
- }
- finally
- {
- Interlocked.Exchange(ref _state, DONE);
- }
- }
-
- private void CheckAccess()
- {
- switch (Interlocked.CompareExchange(ref _state, BUSY, IDLE))
- {
- case BUSY:
- throw new InvalidOperationException(Strings_Core.REENTRANCY_DETECTED);
- case DONE:
- throw new InvalidOperationException(Strings_Core.OBSERVER_TERMINATED);
- }
- }
- }
-}
diff --git a/Rx.NET/System.Reactive.Core/Reactive/Internal/ConcurrentDictionary.cs b/Rx.NET/System.Reactive.Core/Reactive/Internal/ConcurrentDictionary.cs
deleted file mode 100644
index 8b7ec81..0000000
--- a/Rx.NET/System.Reactive.Core/Reactive/Internal/ConcurrentDictionary.cs
+++ /dev/null
@@ -1,576 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-/*
- * WARNING: Auto-generated file (7/18/2012 4:59:53 PM)
- *
- * Stripped down code based on ndp\clr\src\BCL\System\Collections\Concurrent\ConcurrentDictionary.cs
- */
-
-#if NO_CDS_COLLECTIONS
-
-using System;
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-using System.Diagnostics.CodeAnalysis;
-using System.Reflection;
-using System.Threading;
-
-namespace System.Collections.Concurrent
-{
- internal class ConcurrentDictionary<TKey, TValue>
- {
- /* >>> Code copied from the Array class */
-
- // We impose limits on maximum array lenght in each dimension to allow efficient
- // implementation of advanced range check elimination in future.
- // Keep in sync with vm\gcscan.cpp and HashHelpers.MaxPrimeArrayLength.
- internal const int MaxArrayLength = 0X7FEFFFFF;
-
- /* <<< Code copied from the Array class */
-
- private class Tables
- {
- internal readonly Node[] m_buckets; // A singly-linked list for each bucket.
- internal readonly object[] m_locks; // A set of locks, each guarding a section of the table.
- internal volatile int[] m_countPerLock; // The number of elements guarded by each lock.
-
- internal Tables(Node[] buckets, object[] locks, int[] countPerLock)
- {
- m_buckets = buckets;
- m_locks = locks;
- m_countPerLock = countPerLock;
- }
- }
-
- private volatile Tables m_tables; // Internal tables of the dictionary
- private readonly IEqualityComparer<TKey> m_comparer; // Key equality comparer
- private readonly bool m_growLockArray; // Whether to dynamically increase the size of the striped lock
- private int m_budget; // The maximum number of elements per lock before a resize operation is triggered
-
- // The default concurrency level is DEFAULT_CONCURRENCY_MULTIPLIER * #CPUs. The higher the
- // DEFAULT_CONCURRENCY_MULTIPLIER, the more concurrent writes can take place without interference
- // and blocking, but also the more expensive operations that require all locks become (e.g. table
- // resizing, ToArray, Count, etc). According to brief benchmarks that we ran, 4 seems like a good
- // compromise.
- private const int DEFAULT_CONCURRENCY_MULTIPLIER = 4;
-
- // The default capacity, i.e. the initial # of buckets. When choosing this value, we are making
- // a trade-off between the size of a very small dictionary, and the number of resizes when
- // constructing a large dictionary. Also, the capacity should not be divisible by a small prime.
- private const int DEFAULT_CAPACITY = 31;
-
- // The maximum size of the striped lock that will not be exceeded when locks are automatically
- // added as the dictionary grows. However, the user is allowed to exceed this limit by passing
- // a concurrency level larger than MAX_LOCK_NUMBER into the constructor.
- private const int MAX_LOCK_NUMBER = 1024;
-
- // Whether TValue is a type that can be written atomically (i.e., with no danger of torn reads)
- private static readonly bool s_isValueWriteAtomic = IsValueWriteAtomic();
-
- private static bool IsValueWriteAtomic()
- {
- Type valueType = typeof(TValue);
-
- //
- // Section 12.6.6 of ECMA CLI explains which types can be read and written atomically without
- // the risk of tearing.
- //
- // See http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-335.pdf
- //
- bool isAtomic =
- (valueType.GetTypeInfo().IsClass)
- || valueType == typeof(Boolean)
- || valueType == typeof(Char)
- || valueType == typeof(Byte)
- || valueType == typeof(SByte)
- || valueType == typeof(Int16)
- || valueType == typeof(UInt16)
- || valueType == typeof(Int32)
- || valueType == typeof(UInt32)
- || valueType == typeof(Single);
-
- if (!isAtomic && IntPtr.Size == 8)
- {
- isAtomic |= valueType == typeof(Double) || valueType == typeof(Int64);
- }
-
- return isAtomic;
- }
-
- public ConcurrentDictionary(IEqualityComparer<TKey> comparer) : this(DefaultConcurrencyLevel, DEFAULT_CAPACITY, true, comparer) { }
-
- internal ConcurrentDictionary(int concurrencyLevel, int capacity, bool growLockArray, IEqualityComparer<TKey> comparer)
- {
- if (concurrencyLevel < 1)
- {
- throw new ArgumentOutOfRangeException("concurrencyLevel");
- }
- if (capacity < 0)
- {
- throw new ArgumentOutOfRangeException("capacity");
- }
- if (comparer == null) throw new ArgumentNullException("comparer");
-
- // The capacity should be at least as large as the concurrency level. Otherwise, we would have locks that don't guard
- // any buckets.
- if (capacity < concurrencyLevel)
- {
- capacity = concurrencyLevel;
- }
-
- object[] locks = new object[concurrencyLevel];
- for (int i = 0; i < locks.Length; i++)
- {
- locks[i] = new object();
- }
-
- int[] countPerLock = new int[locks.Length];
- Node[] buckets = new Node[capacity];
- m_tables = new Tables(buckets, locks, countPerLock);
-
- m_comparer = comparer;
- m_growLockArray = growLockArray;
- m_budget = buckets.Length / locks.Length;
- }
-
- public bool TryAdd(TKey key, TValue value)
- {
- if (key == null) throw new ArgumentNullException("key");
- TValue dummy;
- return TryAddInternal(key, value, false, true, out dummy);
- }
-
- public bool TryRemove(TKey key, out TValue value)
- {
- if (key == null) throw new ArgumentNullException("key");
-
- return TryRemoveInternal(key, out value, false, default(TValue));
- }
-
- [SuppressMessage("Microsoft.Concurrency", "CA8001", Justification = "Reviewed for thread safety")]
- private bool TryRemoveInternal(TKey key, out TValue value, bool matchValue, TValue oldValue)
- {
- while (true)
- {
- Tables tables = m_tables;
-
- int bucketNo, lockNo;
- GetBucketAndLockNo(m_comparer.GetHashCode(key), out bucketNo, out lockNo, tables.m_buckets.Length, tables.m_locks.Length);
-
- lock (tables.m_locks[lockNo])
- {
- // If the table just got resized, we may not be holding the right lock, and must retry.
- // This should be a rare occurence.
- if (tables != m_tables)
- {
- continue;
- }
-
- Node prev = null;
- for (Node curr = tables.m_buckets[bucketNo]; curr != null; curr = curr.m_next)
- {
- if (m_comparer.Equals(curr.m_key, key))
- {
- if (matchValue)
- {
- bool valuesMatch = EqualityComparer<TValue>.Default.Equals(oldValue, curr.m_value);
- if (!valuesMatch)
- {
- value = default(TValue);
- return false;
- }
- }
-
- if (prev == null)
- {
- Volatile.Write<Node>(ref tables.m_buckets[bucketNo], curr.m_next);
- }
- else
- {
- prev.m_next = curr.m_next;
- }
-
- value = curr.m_value;
- tables.m_countPerLock[lockNo]--;
- return true;
- }
- prev = curr;
- }
- }
-
- value = default(TValue);
- return false;
- }
- }
-
- [SuppressMessage("Microsoft.Concurrency", "CA8001", Justification = "Reviewed for thread safety")]
- public bool TryGetValue(TKey key, out TValue value)
- {
- if (key == null) throw new ArgumentNullException("key");
-
- int bucketNo, lockNoUnused;
-
- // We must capture the m_buckets field in a local variable. It is set to a new table on each table resize.
- Tables tables = m_tables;
-
- GetBucketAndLockNo(m_comparer.GetHashCode(key), out bucketNo, out lockNoUnused, tables.m_buckets.Length, tables.m_locks.Length);
-
- // We can get away w/out a lock here.
- // The Volatile.Read ensures that the load of the fields of 'n' doesn't move before the load from buckets[i].
- Node n = Volatile.Read<Node>(ref tables.m_buckets[bucketNo]);
-
- while (n != null)
- {
- if (m_comparer.Equals(n.m_key, key))
- {
- value = n.m_value;
- return true;
- }
- n = n.m_next;
- }
-
- value = default(TValue);
- return false;
- }
-
- [SuppressMessage("Microsoft.Concurrency", "CA8001", Justification = "Reviewed for thread safety")]
- private bool TryAddInternal(TKey key, TValue value, bool updateIfExists, bool acquireLock, out TValue resultingValue)
- {
- int hashcode = m_comparer.GetHashCode(key);
-
- while (true)
- {
- int bucketNo, lockNo;
-
- Tables tables = m_tables;
- GetBucketAndLockNo(hashcode, out bucketNo, out lockNo, tables.m_buckets.Length, tables.m_locks.Length);
-
- bool resizeDesired = false;
- bool lockTaken = false;
- try
- {
- if (acquireLock)
- Monitor.Enter(tables.m_locks[lockNo], ref lockTaken);
-
- // If the table just got resized, we may not be holding the right lock, and must retry.
- // This should be a rare occurence.
- if (tables != m_tables)
- {
- continue;
- }
-
- // Try to find this key in the bucket
- Node prev = null;
- for (Node node = tables.m_buckets[bucketNo]; node != null; node = node.m_next)
- {
- if (m_comparer.Equals(node.m_key, key))
- {
- // The key was found in the dictionary. If updates are allowed, update the value for that key.
- // We need to create a new node for the update, in order to support TValue types that cannot
- // be written atomically, since lock-free reads may be happening concurrently.
- if (updateIfExists)
- {
- if (s_isValueWriteAtomic)
- {
- node.m_value = value;
- }
- else
- {
- Node newNode = new Node(node.m_key, value, hashcode, node.m_next);
- if (prev == null)
- {
- tables.m_buckets[bucketNo] = newNode;
- }
- else
- {
- prev.m_next = newNode;
- }
- }
- resultingValue = value;
- }
- else
- {
- resultingValue = node.m_value;
- }
- return false;
- }
- prev = node;
- }
-
- // The key was not found in the bucket. Insert the key-value pair.
- Volatile.Write<Node>(ref tables.m_buckets[bucketNo], new Node(key, value, hashcode, tables.m_buckets[bucketNo]));
- checked
- {
- tables.m_countPerLock[lockNo]++;
- }
-
- //
- // If the number of elements guarded by this lock has exceeded the budget, resize the bucket table.
- // It is also possible that GrowTable will increase the budget but won't resize the bucket table.
- // That happens if the bucket table is found to be poorly utilized due to a bad hash function.
- //
- if (tables.m_countPerLock[lockNo] > m_budget)
- {
- resizeDesired = true;
- }
- }
- finally
- {
- if (lockTaken)
- Monitor.Exit(tables.m_locks[lockNo]);
- }
-
- //
- // The fact that we got here means that we just performed an insertion. If necessary, we will grow the table.
- //
- // Concurrency notes:
- // - Notice that we are not holding any locks at when calling GrowTable. This is necessary to prevent deadlocks.
- // - As a result, it is possible that GrowTable will be called unnecessarily. But, GrowTable will obtain lock 0
- // and then verify that the table we passed to it as the argument is still the current table.
- //
- if (resizeDesired)
- {
- GrowTable(tables);
- }
-
- resultingValue = value;
- return true;
- }
- }
-
- public ICollection<TValue> Values
- {
- get { return GetValues(); }
- }
-
- private void GrowTable(Tables tables)
- {
- int locksAcquired = 0;
- try
- {
- // The thread that first obtains m_locks[0] will be the one doing the resize operation
- AcquireLocks(0, 1, ref locksAcquired);
-
- // Make sure nobody resized the table while we were waiting for lock 0:
- if (tables != m_tables)
- {
- // We assume that since the table reference is different, it was already resized (or the budget
- // was adjusted). If we ever decide to do table shrinking, or replace the table for other reasons,
- // we will have to revisit this logic.
- return;
- }
-
- // Compute the (approx.) total size. Use an Int64 accumulation variable to avoid an overflow.
- long approxCount = 0;
- for (int i = 0; i < tables.m_countPerLock.Length; i++)
- {
- approxCount += tables.m_countPerLock[i];
- }
-
- //
- // If the bucket array is too empty, double the budget instead of resizing the table
- //
- if (approxCount < tables.m_buckets.Length / 4)
- {
- m_budget = 2 * m_budget;
- if (m_budget < 0)
- {
- m_budget = int.MaxValue;
- }
- return;
- }
-
-
- // Compute the new table size. We find the smallest integer larger than twice the previous table size, and not divisible by
- // 2,3,5 or 7. We can consider a different table-sizing policy in the future.
- int newLength = 0;
- bool maximizeTableSize = false;
- try
- {
- checked
- {
- // Double the size of the buckets table and add one, so that we have an odd integer.
- newLength = tables.m_buckets.Length * 2 + 1;
-
- // Now, we only need to check odd integers, and find the first that is not divisible
- // by 3, 5 or 7.
- while (newLength % 3 == 0 || newLength % 5 == 0 || newLength % 7 == 0)
- {
- newLength += 2;
- }
-
- if (newLength > MaxArrayLength)
- {
- maximizeTableSize = true;
- }
- }
- }
- catch (OverflowException)
- {
- maximizeTableSize = true;
- }
-
- if (maximizeTableSize)
- {
- newLength = MaxArrayLength;
-
- // We want to make sure that GrowTable will not be called again, since table is at the maximum size.
- // To achieve that, we set the budget to int.MaxValue.
- //
- // (There is one special case that would allow GrowTable() to be called in the future:
- // calling Clear() on the ConcurrentDictionary will shrink the table and lower the budget.)
- m_budget = int.MaxValue;
- }
-
- // Now acquire all other locks for the table
- AcquireLocks(1, tables.m_locks.Length, ref locksAcquired);
-
- object[] newLocks = tables.m_locks;
-
- // Add more locks
- if (m_growLockArray && tables.m_locks.Length < MAX_LOCK_NUMBER)
- {
- newLocks = new object[tables.m_locks.Length * 2];
- Array.Copy(tables.m_locks, newLocks, tables.m_locks.Length);
-
- for (int i = tables.m_locks.Length; i < newLocks.Length; i++)
- {
- newLocks[i] = new object();
- }
- }
-
- Node[] newBuckets = new Node[newLength];
- int[] newCountPerLock = new int[newLocks.Length];
-
- // Copy all data into a new table, creating new nodes for all elements
- for (int i = 0; i < tables.m_buckets.Length; i++)
- {
- Node current = tables.m_buckets[i];
- while (current != null)
- {
- Node next = current.m_next;
- int newBucketNo, newLockNo;
- GetBucketAndLockNo(current.m_hashcode, out newBucketNo, out newLockNo, newBuckets.Length, newLocks.Length);
-
- newBuckets[newBucketNo] = new Node(current.m_key, current.m_value, current.m_hashcode, newBuckets[newBucketNo]);
-
- checked
- {
- newCountPerLock[newLockNo]++;
- }
-
- current = next;
- }
- }
-
- // Adjust the budget
- m_budget = Math.Max(1, newBuckets.Length / newLocks.Length);
-
- // Replace tables with the new versions
- m_tables = new Tables(newBuckets, newLocks, newCountPerLock);
- }
- finally
- {
- // Release all locks that we took earlier
- ReleaseLocks(0, locksAcquired);
- }
- }
-
- private void GetBucketAndLockNo(
- int hashcode, out int bucketNo, out int lockNo, int bucketCount, int lockCount)
- {
- bucketNo = (hashcode & 0x7fffffff) % bucketCount;
- lockNo = bucketNo % lockCount;
- }
-
- private static int DefaultConcurrencyLevel
- {
- get { return DEFAULT_CONCURRENCY_MULTIPLIER * Environment.ProcessorCount; }
- }
-
- private void AcquireAllLocks(ref int locksAcquired)
- {
- // First, acquire lock 0
- AcquireLocks(0, 1, ref locksAcquired);
-
- // Now that we have lock 0, the m_locks array will not change (i.e., grow),
- // and so we can safely read m_locks.Length.
- AcquireLocks(1, m_tables.m_locks.Length, ref locksAcquired);
- }
-
- private void AcquireLocks(int fromInclusive, int toExclusive, ref int locksAcquired)
- {
- object[] locks = m_tables.m_locks;
-
- for (int i = fromInclusive; i < toExclusive; i++)
- {
- bool lockTaken = false;
- try
- {
- Monitor.Enter(locks[i], ref lockTaken);
- }
- finally
- {
- if (lockTaken)
- {
- locksAcquired++;
- }
- }
- }
- }
-
- [SuppressMessage("Microsoft.Concurrency", "CA8001", Justification = "Reviewed for thread safety")]
- private void ReleaseLocks(int fromInclusive, int toExclusive)
- {
- for (int i = fromInclusive; i < toExclusive; i++)
- {
- Monitor.Exit(m_tables.m_locks[i]);
- }
- }
-
- [SuppressMessage("Microsoft.Concurrency", "CA8001", Justification = "ConcurrencyCop just doesn't know about these locks")]
- private ReadOnlyCollection<TValue> GetValues()
- {
- int locksAcquired = 0;
- try
- {
- AcquireAllLocks(ref locksAcquired);
- List<TValue> values = new List<TValue>();
-
- for (int i = 0; i < m_tables.m_buckets.Length; i++)
- {
- Node current = m_tables.m_buckets[i];
- while (current != null)
- {
- values.Add(current.m_value);
- current = current.m_next;
- }
- }
-
- return new ReadOnlyCollection<TValue>(values);
- }
- finally
- {
- ReleaseLocks(0, locksAcquired);
- }
- }
-
- private class Node
- {
- internal TKey m_key;
- internal TValue m_value;
- internal volatile Node m_next;
- internal int m_hashcode;
-
- internal Node(TKey key, TValue value, int hashcode, Node next)
- {
- m_key = key;
- m_value = value;
- m_next = next;
- m_hashcode = hashcode;
- }
- }
- }
-}
-
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Core/Reactive/Internal/ConcurrentQueue.cs b/Rx.NET/System.Reactive.Core/Reactive/Internal/ConcurrentQueue.cs
deleted file mode 100644
index 76ab088..0000000
--- a/Rx.NET/System.Reactive.Core/Reactive/Internal/ConcurrentQueue.cs
+++ /dev/null
@@ -1,316 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-/*
- * WARNING: Auto-generated file (7/18/2012 4:47:38 PM)
- *
- * Stripped down code based on ndp\clr\src\BCL\System\Collections\Concurrent\ConcurrentQueue.cs
- */
-
-#if NO_CDS_COLLECTIONS
-
-#pragma warning disable 0420
-
-using System;
-using System.Collections.Generic;
-using System.Diagnostics.Contracts;
-using System.Threading;
-
-namespace System.Collections.Concurrent
-{
- internal class ConcurrentQueue<T>
- {
- private volatile Segment m_head;
- private volatile Segment m_tail;
-
- private const int SEGMENT_SIZE = 32;
-
- public ConcurrentQueue()
- {
- m_head = m_tail = new Segment(0, this);
- }
-
- public bool IsEmpty
- {
- get
- {
- Segment head = m_head;
- if (!head.IsEmpty)
- //fast route 1:
- //if current head is not empty, then queue is not empty
- return false;
- else if (head.Next == null)
- //fast route 2:
- //if current head is empty and it's the last segment
- //then queue is empty
- return true;
- else
- //slow route:
- //current head is empty and it is NOT the last segment,
- //it means another thread is growing new segment
- {
- SpinWait spin = new SpinWait();
- while (head.IsEmpty)
- {
- if (head.Next == null)
- return true;
-
- spin.SpinOnce();
- head = m_head;
- }
- return false;
- }
- }
- }
-
- public void Enqueue(T item)
- {
- SpinWait spin = new SpinWait();
- while (true)
- {
- Segment tail = m_tail;
- if (tail.TryAppend(item))
- return;
- spin.SpinOnce();
- }
- }
-
- public bool TryDequeue(out T result)
- {
- while (!IsEmpty)
- {
- Segment head = m_head;
- if (head.TryRemove(out result))
- return true;
- //since method IsEmpty spins, we don't need to spin in the while loop
- }
- result = default(T);
- return false;
- }
-
- private class Segment
- {
- //we define two volatile arrays: m_array and m_state. Note that the accesses to the array items
- //do not get volatile treatment. But we don't need to worry about loading adjacent elements or
- //store/load on adjacent elements would suffer reordering.
- // - Two stores: these are at risk, but CLRv2 memory model guarantees store-release hence we are safe.
- // - Two loads: because one item from two volatile arrays are accessed, the loads of the array references
- // are sufficient to prevent reordering of the loads of the elements.
- internal volatile T[] m_array;
-
- // For each entry in m_array, the corresponding entry in m_state indicates whether this position contains
- // a valid value. m_state is initially all false.
- internal volatile VolatileBool[] m_state;
-
- //pointer to the next segment. null if the current segment is the last segment
- private volatile Segment m_next;
-
- //We use this zero based index to track how many segments have been created for the queue, and
- //to compute how many active segments are there currently.
- // * The number of currently active segments is : m_tail.m_index - m_head.m_index + 1;
- // * m_index is incremented with every Segment.Grow operation. We use Int64 type, and we can safely
- // assume that it never overflows. To overflow, we need to do 2^63 increments, even at a rate of 4
- // billion (2^32) increments per second, it takes 2^31 seconds, which is about 64 years.
- internal readonly long m_index;
-
- //indices of where the first and last valid values
- // - m_low points to the position of the next element to pop from this segment, range [0, infinity)
- // m_low >= SEGMENT_SIZE implies the segment is disposable
- // - m_high points to the position of the latest pushed element, range [-1, infinity)
- // m_high == -1 implies the segment is new and empty
- // m_high >= SEGMENT_SIZE-1 means this segment is ready to grow.
- // and the thread who sets m_high to SEGMENT_SIZE-1 is responsible to grow the segment
- // - Math.Min(m_low, SEGMENT_SIZE) > Math.Min(m_high, SEGMENT_SIZE-1) implies segment is empty
- // - initially m_low =0 and m_high=-1;
- private volatile int m_low;
- private volatile int m_high;
-
- private volatile ConcurrentQueue<T> m_source;
-
- internal Segment(long index, ConcurrentQueue<T> source)
- {
- m_array = new T[SEGMENT_SIZE];
- m_state = new VolatileBool[SEGMENT_SIZE]; //all initialized to false
- m_high = -1;
- Contract.Assert(index >= 0);
- m_index = index;
- m_source = source;
- }
-
- internal Segment Next
- {
- get { return m_next; }
- }
-
- internal bool IsEmpty
- {
- get { return (Low > High); }
- }
-
- internal void UnsafeAdd(T value)
- {
- Contract.Assert(m_high < SEGMENT_SIZE - 1);
- m_high++;
- m_array[m_high] = value;
- m_state[m_high].m_value = true;
- }
-
- internal Segment UnsafeGrow()
- {
- Contract.Assert(m_high >= SEGMENT_SIZE - 1);
- Segment newSegment = new Segment(m_index + 1, m_source); //m_index is Int64, we don't need to worry about overflow
- m_next = newSegment;
- return newSegment;
- }
-
- internal void Grow()
- {
- //no CAS is needed, since there is no contention (other threads are blocked, busy waiting)
- Segment newSegment = new Segment(m_index + 1, m_source); //m_index is Int64, we don't need to worry about overflow
- m_next = newSegment;
- Contract.Assert(m_source.m_tail == this);
- m_source.m_tail = m_next;
- }
-
- internal bool TryAppend(T value)
- {
- //quickly check if m_high is already over the boundary, if so, bail out
- if (m_high >= SEGMENT_SIZE - 1)
- {
- return false;
- }
-
- //Now we will use a CAS to increment m_high, and store the result in newhigh.
- //Depending on how many free spots left in this segment and how many threads are doing this Increment
- //at this time, the returning "newhigh" can be
- // 1) < SEGMENT_SIZE - 1 : we took a spot in this segment, and not the last one, just insert the value
- // 2) == SEGMENT_SIZE - 1 : we took the last spot, insert the value AND grow the segment
- // 3) > SEGMENT_SIZE - 1 : we failed to reserve a spot in this segment, we return false to
- // Queue.Enqueue method, telling it to try again in the next segment.
-
- int newhigh = SEGMENT_SIZE; //initial value set to be over the boundary
-
- //We need do Interlocked.Increment and value/state update in a finally block to ensure that they run
- //without interuption. This is to prevent anything from happening between them, and another dequeue
- //thread maybe spinning forever to wait for m_state[] to be true;
- try
- { }
- finally
- {
- newhigh = Interlocked.Increment(ref m_high);
- if (newhigh <= SEGMENT_SIZE - 1)
- {
- m_array[newhigh] = value;
- m_state[newhigh].m_value = true;
- }
-
- //if this thread takes up the last slot in the segment, then this thread is responsible
- //to grow a new segment. Calling Grow must be in the finally block too for reliability reason:
- //if thread abort during Grow, other threads will be left busy spinning forever.
- if (newhigh == SEGMENT_SIZE - 1)
- {
- Grow();
- }
- }
-
- //if newhigh <= SEGMENT_SIZE-1, it means the current thread successfully takes up a spot
- return newhigh <= SEGMENT_SIZE - 1;
- }
-
- internal bool TryRemove(out T result)
- {
- SpinWait spin = new SpinWait();
- int lowLocal = Low, highLocal = High;
- while (lowLocal <= highLocal)
- {
- //try to update m_low
- if (Interlocked.CompareExchange(ref m_low, lowLocal + 1, lowLocal) == lowLocal)
- {
- //if the specified value is not available (this spot is taken by a push operation,
- // but the value is not written into yet), then spin
- SpinWait spinLocal = new SpinWait();
- while (!m_state[lowLocal].m_value)
- {
- spinLocal.SpinOnce();
- }
- result = m_array[lowLocal];
- m_array[lowLocal] = default(T); //release the reference to the object.
-
- //if the current thread sets m_low to SEGMENT_SIZE, which means the current segment becomes
- //disposable, then this thread is responsible to dispose this segment, and reset m_head
- if (lowLocal + 1 >= SEGMENT_SIZE)
- {
- // Invariant: we only dispose the current m_head, not any other segment
- // In usual situation, disposing a segment is simply seting m_head to m_head.m_next
- // But there is one special case, where m_head and m_tail points to the same and ONLY
- //segment of the queue: Another thread A is doing Enqueue and finds that it needs to grow,
- //while the *current* thread is doing *this* Dequeue operation, and finds that it needs to
- //dispose the current (and ONLY) segment. Then we need to wait till thread A finishes its
- //Grow operation, this is the reason of having the following while loop
- spinLocal = new SpinWait();
- while (m_next == null)
- {
- spinLocal.SpinOnce();
- }
- Contract.Assert(m_source.m_head == this);
- m_source.m_head = m_next;
- }
- return true;
- }
- else
- {
- //CAS failed due to contention: spin briefly and retry
- spin.SpinOnce();
- lowLocal = Low; highLocal = High;
- }
- }//end of while
- result = default(T);
- return false;
- }
-
- internal bool TryPeek(out T result)
- {
- result = default(T);
- int lowLocal = Low;
- if (lowLocal > High)
- return false;
- SpinWait spin = new SpinWait();
- while (!m_state[lowLocal].m_value)
- {
- spin.SpinOnce();
- }
- result = m_array[lowLocal];
- return true;
- }
-
- internal int Low
- {
- get
- {
- return Math.Min(m_low, SEGMENT_SIZE);
- }
- }
-
- internal int High
- {
- get
- {
- //if m_high > SEGMENT_SIZE, it means it's out of range, we should return
- //SEGMENT_SIZE-1 as the logical position
- return Math.Min(m_high, SEGMENT_SIZE - 1);
- }
- }
-
- }
- }//end of class Segment
-
- struct VolatileBool
- {
- public VolatileBool(bool value)
- {
- m_value = value;
- }
- public volatile bool m_value;
- }
-}
-
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Core/Reactive/Internal/Constants.cs b/Rx.NET/System.Reactive.Core/Reactive/Internal/Constants.cs
deleted file mode 100644
index a43acb2..0000000
--- a/Rx.NET/System.Reactive.Core/Reactive/Internal/Constants.cs
+++ /dev/null
@@ -1,17 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-namespace System.Reactive
-{
- // We can't make those based on the Strings_Core.resx file, because the ObsoleteAttribute needs a compile-time constant.
-
- class Constants_Core
- {
- private const string OBSOLETE_REFACTORING = "This property is no longer supported due to refactoring of the API surface and elimination of platform-specific dependencies.";
-
- public const string OBSOLETE_SCHEDULER_NEWTHREAD = OBSOLETE_REFACTORING + " Please add a reference to the System.Reactive.PlatformServices assembly for your target platform and use NewThreadScheduler.Default to obtain an instance of this scheduler type. See http://go.microsoft.com/fwlink/?LinkID=260866 for more information.";
- public const string OBSOLETE_SCHEDULER_TASKPOOL = OBSOLETE_REFACTORING + " Please add a reference to the System.Reactive.PlatformServices assembly for your target platform and use TaskPoolScheduler.Default to obtain an instance of this scheduler type. See http://go.microsoft.com/fwlink/?LinkID=260866 for more information.";
- public const string OBSOLETE_SCHEDULER_THREADPOOL = OBSOLETE_REFACTORING + " Consider using Scheduler.Default to obtain the platform's most appropriate pool-based scheduler. In order to access a specific pool-based scheduler, please add a reference to the System.Reactive.PlatformServices assembly for your target platform and use the appropriate scheduler in the System.Reactive.Concurrency namespace. See http://go.microsoft.com/fwlink/?LinkID=260866 for more information.";
-
- public const string OBSOLETE_SCHEDULEREQUIRED = "This instance property is no longer supported. Use CurrentThreadScheduler.IsScheduleRequired instead. See http://go.microsoft.com/fwlink/?LinkID=260866 for more information.";
- }
-}
diff --git a/Rx.NET/System.Reactive.Core/Reactive/Internal/ExceptionServices.Default.cs b/Rx.NET/System.Reactive.Core/Reactive/Internal/ExceptionServices.Default.cs
deleted file mode 100644
index 209bd55..0000000
--- a/Rx.NET/System.Reactive.Core/Reactive/Internal/ExceptionServices.Default.cs
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if HAS_EDI
-namespace System.Reactive.PlatformServices
-{
- //
- // WARNING: This code is kept *identically* in two places. One copy is kept in System.Reactive.Core for non-PLIB platforms.
- // Another copy is kept in System.Reactive.PlatformServices to enlighten the default lowest common denominator
- // behavior of Rx for PLIB when used on a more capable platform.
- //
- internal class DefaultExceptionServices/*Impl*/ : IExceptionServices
- {
- public void Rethrow(Exception exception)
- {
- System.Runtime.ExceptionServices.ExceptionDispatchInfo.Capture(exception).Throw();
- }
- }
-}
-#else
-namespace System.Reactive.PlatformServices
-{
- internal class DefaultExceptionServices : IExceptionServices
- {
- public void Rethrow(Exception exception)
- {
- throw exception;
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Core/Reactive/Internal/ExceptionServices.cs b/Rx.NET/System.Reactive.Core/Reactive/Internal/ExceptionServices.cs
deleted file mode 100644
index 1fceeba..0000000
--- a/Rx.NET/System.Reactive.Core/Reactive/Internal/ExceptionServices.cs
+++ /dev/null
@@ -1,48 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System.ComponentModel;
-using System.Reactive.PlatformServices;
-
-namespace System.Reactive
-{
- internal static class ExceptionHelpers
- {
- private static Lazy<IExceptionServices> s_services = new Lazy<IExceptionServices>(Initialize);
-
- public static void Throw(this Exception exception)
- {
- s_services.Value.Rethrow(exception);
- }
-
- public static void ThrowIfNotNull(this Exception exception)
- {
- if (exception != null)
- s_services.Value.Rethrow(exception);
- }
-
- private static IExceptionServices Initialize()
- {
- return PlatformEnlightenmentProvider.Current.GetService<IExceptionServices>() ?? new DefaultExceptionServices();
- }
- }
-}
-
-namespace System.Reactive.PlatformServices
-{
- /// <summary>
- /// (Infrastructure) Services to rethrow exceptions.
- /// </summary>
- /// <remarks>
- /// This type is used by the Rx infrastructure and not meant for public consumption or implementation.
- /// No guarantees are made about forward compatibility of the type's functionality and its usage.
- /// </remarks>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public interface IExceptionServices
- {
- /// <summary>
- /// Rethrows the specified exception.
- /// </summary>
- /// <param name="exception">Exception to rethrow.</param>
- void Rethrow(Exception exception);
- }
-}
diff --git a/Rx.NET/System.Reactive.Core/Reactive/Internal/HostLifecycleService.cs b/Rx.NET/System.Reactive.Core/Reactive/Internal/HostLifecycleService.cs
deleted file mode 100644
index a8f6a7a..0000000
--- a/Rx.NET/System.Reactive.Core/Reactive/Internal/HostLifecycleService.cs
+++ /dev/null
@@ -1,113 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System.ComponentModel;
-using System.Threading;
-
-namespace System.Reactive.PlatformServices
-{
- /// <summary>
- /// (Infrastructure) Provides access to the host's lifecycle management services.
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public static class HostLifecycleService
- {
- private static Lazy<IHostLifecycleNotifications> s_notifications = new Lazy<IHostLifecycleNotifications>(InitializeNotifications);
-
- private static int _refCount;
-
- /// <summary>
- /// Event that gets raised when the host suspends the application.
- /// </summary>
- public static event EventHandler<HostSuspendingEventArgs> Suspending;
-
- /// <summary>
- /// Event that gets raised when the host resumes the application.
- /// </summary>
- public static event EventHandler<HostResumingEventArgs> Resuming;
-
- /// <summary>
- /// Adds a reference to the host lifecycle manager, causing it to be sending notifications.
- /// </summary>
- public static void AddRef()
- {
- if (Interlocked.Increment(ref _refCount) == 1)
- {
- var notifications = s_notifications.Value;
- if (notifications != null)
- {
- notifications.Suspending += OnSuspending;
- notifications.Resuming += OnResuming;
- }
- }
- }
-
- /// <summary>
- /// Removes a reference to the host lifecycle manager, causing it to stop sending notifications
- /// if the removed reference was the last one.
- /// </summary>
- public static void Release()
- {
- if (Interlocked.Decrement(ref _refCount) == 0)
- {
- var notifications = s_notifications.Value;
- if (notifications != null)
- {
- notifications.Suspending -= OnSuspending;
- notifications.Resuming -= OnResuming;
- }
- }
- }
-
- private static void OnSuspending(object sender, HostSuspendingEventArgs e)
- {
- var suspending = Suspending;
- if (suspending != null)
- suspending(sender, e);
- }
-
- private static void OnResuming(object sender, HostResumingEventArgs e)
- {
- var resuming = Resuming;
- if (resuming != null)
- resuming(sender, e);
- }
-
- private static IHostLifecycleNotifications InitializeNotifications()
- {
- return PlatformEnlightenmentProvider.Current.GetService<IHostLifecycleNotifications>();
- }
- }
-
- /// <summary>
- /// (Infrastructure) Provides notifications about the host's lifecycle events.
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public interface IHostLifecycleNotifications
- {
- /// <summary>
- /// Event that gets raised when the host suspends.
- /// </summary>
- event EventHandler<HostSuspendingEventArgs> Suspending;
-
- /// <summary>
- /// Event that gets raised when the host resumes.
- /// </summary>
- event EventHandler<HostResumingEventArgs> Resuming;
- }
-
- /// <summary>
- /// (Infrastructure) Event arguments for host suspension events.
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public class HostSuspendingEventArgs : EventArgs
- {
- }
-
- /// <summary>
- /// (Infrastructure) Event arguments for host resumption events.
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public class HostResumingEventArgs : EventArgs
- {
- }
-}
diff --git a/Rx.NET/System.Reactive.Core/Reactive/Internal/ImmutableList.cs b/Rx.NET/System.Reactive.Core/Reactive/Internal/ImmutableList.cs
deleted file mode 100644
index 5cc9b2d..0000000
--- a/Rx.NET/System.Reactive.Core/Reactive/Internal/ImmutableList.cs
+++ /dev/null
@@ -1,51 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-namespace System.Reactive
-{
- internal class ImmutableList<T>
- {
- T[] data;
-
- public ImmutableList()
- {
- data = new T[0];
- }
-
- public ImmutableList(T[] data)
- {
- this.data = data;
- }
-
- public ImmutableList<T> Add(T value)
- {
- var newData = new T[data.Length + 1];
- Array.Copy(data, newData, data.Length);
- newData[data.Length] = value;
- return new ImmutableList<T>(newData);
- }
-
- public ImmutableList<T> Remove(T value)
- {
- var i = IndexOf(value);
- if (i < 0)
- return this;
- var newData = new T[data.Length - 1];
- Array.Copy(data, 0, newData, 0, i);
- Array.Copy(data, i + 1, newData, i, data.Length - i - 1);
- return new ImmutableList<T>(newData);
- }
-
- public int IndexOf(T value)
- {
- for (var i = 0; i < data.Length; ++i)
- if (data[i].Equals(value))
- return i;
- return -1;
- }
-
- public T[] Data
- {
- get { return data; }
- }
- }
-}
diff --git a/Rx.NET/System.Reactive.Core/Reactive/Internal/Lazy.cs b/Rx.NET/System.Reactive.Core/Reactive/Internal/Lazy.cs
deleted file mode 100644
index 4094dce..0000000
--- a/Rx.NET/System.Reactive.Core/Reactive/Internal/Lazy.cs
+++ /dev/null
@@ -1,126 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if NO_LAZY
-#pragma warning disable 0420
-
-//
-// Based on ndp\clr\src\BCL\System\Lazy.cs but with LazyThreadSafetyMode.ExecutionAndPublication mode behavior hardcoded.
-//
-
-using System.Diagnostics;
-using System.Threading;
-using System.Reactive;
-
-namespace System
-{
- internal class Lazy<T>
- {
- class Boxed
- {
- internal Boxed(T value)
- {
- m_value = value;
- }
-
- internal T m_value;
- }
-
- static Func<T> ALREADY_INVOKED_SENTINEL = delegate { return default(T); };
-
- private object m_boxed;
- private Func<T> m_valueFactory;
- private volatile object m_threadSafeObj;
-
- public Lazy(Func<T> valueFactory)
- {
- m_threadSafeObj = new object();
- m_valueFactory = valueFactory;
- }
-
-#if !NO_DEBUGGER_ATTRIBUTES
- [DebuggerBrowsable(DebuggerBrowsableState.Never)]
-#endif
- public T Value
- {
- get
- {
- Boxed boxed = null;
- if (m_boxed != null)
- {
- boxed = m_boxed as Boxed;
- if (boxed != null)
- {
- return boxed.m_value;
- }
-
- var exc = m_boxed as Exception;
- exc.Throw();
- }
-
- return LazyInitValue();
- }
- }
-
- private T LazyInitValue()
- {
- Boxed boxed = null;
- object threadSafeObj = m_threadSafeObj;
- bool lockTaken = false;
- try
- {
- if (threadSafeObj != (object)ALREADY_INVOKED_SENTINEL)
- {
- Monitor.Enter(threadSafeObj);
- lockTaken = true;
- }
-
- if (m_boxed == null)
- {
- boxed = CreateValue();
- m_boxed = boxed;
- m_threadSafeObj = ALREADY_INVOKED_SENTINEL;
- }
- else
- {
- boxed = m_boxed as Boxed;
- if (boxed == null)
- {
- var exc = m_boxed as Exception;
- exc.Throw();
- }
- }
- }
- finally
- {
- if (lockTaken)
- Monitor.Exit(threadSafeObj);
- }
-
- return boxed.m_value;
- }
-
- private Boxed CreateValue()
- {
- Boxed boxed = null;
- try
- {
- if (m_valueFactory == ALREADY_INVOKED_SENTINEL)
- throw new InvalidOperationException();
-
- Func<T> factory = m_valueFactory;
- m_valueFactory = ALREADY_INVOKED_SENTINEL;
-
- boxed = new Boxed(factory());
- }
- catch (Exception ex)
- {
- m_boxed = ex;
- throw;
- }
-
- return boxed;
- }
- }
-}
-#pragma warning restore 0420
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Core/Reactive/Internal/Observers.cs b/Rx.NET/System.Reactive.Core/Reactive/Internal/Observers.cs
deleted file mode 100644
index 6a2e2f8..0000000
--- a/Rx.NET/System.Reactive.Core/Reactive/Internal/Observers.cs
+++ /dev/null
@@ -1,109 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-namespace System.Reactive
-{
- internal class NopObserver<T> : IObserver<T>
- {
- public static readonly IObserver<T> Instance = new NopObserver<T>();
-
- public void OnCompleted()
- {
- }
-
- public void OnError(Exception error)
- {
- }
-
- public void OnNext(T value)
- {
- }
- }
-
- internal class DoneObserver<T> : IObserver<T>
- {
- public static readonly IObserver<T> Completed = new DoneObserver<T>();
-
- public Exception Exception { get; set; }
-
- public void OnCompleted()
- {
- }
-
- public void OnError(Exception error)
- {
- }
-
- public void OnNext(T value)
- {
- }
- }
-
- internal class DisposedObserver<T> : IObserver<T>
- {
- public static readonly IObserver<T> Instance = new DisposedObserver<T>();
-
- public void OnCompleted()
- {
- throw new ObjectDisposedException("");
- }
-
- public void OnError(Exception error)
- {
- throw new ObjectDisposedException("");
- }
-
- public void OnNext(T value)
- {
- throw new ObjectDisposedException("");
- }
- }
-
- internal class Observer<T> : IObserver<T>
- {
- private readonly ImmutableList<IObserver<T>> _observers;
-
- public Observer(ImmutableList<IObserver<T>> observers)
- {
- _observers = observers;
- }
-
- public void OnCompleted()
- {
- foreach (var observer in _observers.Data)
- observer.OnCompleted();
- }
-
- public void OnError(Exception error)
- {
- foreach (var observer in _observers.Data)
- observer.OnError(error);
- }
-
- public void OnNext(T value)
- {
- foreach (var observer in _observers.Data)
- observer.OnNext(value);
- }
-
- internal IObserver<T> Add(IObserver<T> observer)
- {
- return new Observer<T>(_observers.Add(observer));
- }
-
- internal IObserver<T> Remove(IObserver<T> observer)
- {
- var i = Array.IndexOf(_observers.Data, observer);
- if (i < 0)
- return this;
-
- if (_observers.Data.Length == 2)
- {
- return _observers.Data[1 - i];
- }
- else
- {
- return new Observer<T>(_observers.Remove(observer));
- }
- }
- }
-}
diff --git a/Rx.NET/System.Reactive.Core/Reactive/Internal/PlatformEnlightenmentProvider.cs b/Rx.NET/System.Reactive.Core/Reactive/Internal/PlatformEnlightenmentProvider.cs
deleted file mode 100644
index f2483e8..0000000
--- a/Rx.NET/System.Reactive.Core/Reactive/Internal/PlatformEnlightenmentProvider.cs
+++ /dev/null
@@ -1,102 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System.ComponentModel;
-using System.Reflection;
-
-namespace System.Reactive.PlatformServices
-{
- /// <summary>
- /// (Infrastructure) Interface for enlightenment providers.
- /// </summary>
- /// <remarks>
- /// This type is used by the Rx infrastructure and not meant for public consumption or implementation.
- /// No guarantees are made about forward compatibility of the type's functionality and its usage.
- /// </remarks>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public interface IPlatformEnlightenmentProvider
- {
- /// <summary>
- /// (Infastructure) Tries to gets the specified service.
- /// </summary>
- /// <typeparam name="T">Service type.</typeparam>
- /// <param name="args">Optional set of arguments.</param>
- /// <returns>Service instance or null if not found.</returns>
- T GetService<T>(params object[] args) where T : class;
- }
-
- /// <summary>
- /// (Infrastructure) Provider for platform-specific framework enlightenments.
- /// </summary>
- /// <remarks>
- /// This type is used by the Rx infrastructure and not meant for public consumption or implementation.
- /// </remarks>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public static class PlatformEnlightenmentProvider
- {
- private static readonly object s_gate = new object();
- private static IPlatformEnlightenmentProvider s_current;
-
- /// <summary>
- /// (Infrastructure) Gets the current enlightenment provider. If none is loaded yet, accessing this property triggers provider resolution.
- /// </summary>
- /// <remarks>
- /// This member is used by the Rx infrastructure and not meant for public consumption or implementation.
- /// </remarks>
- public static IPlatformEnlightenmentProvider Current
- {
- get
- {
- if (s_current == null)
- {
- lock (s_gate)
- {
- if (s_current == null)
- {
- //
- // TODO: Investigate whether we can simplify this logic to just use "System.Reactive.PlatformServices.PlatformEnlightenmentProvider, System.Reactive.PlatformServices".
- // It turns out this doesn't quite work on Silverlight. On the other hand, in .NET Compact Framework 3.5, we mysteriously have to use that path.
- //
-
-#if NETCF35
- var name = "System.Reactive.PlatformServices.CurrentPlatformEnlightenmentProvider, System.Reactive.PlatformServices";
-#else
-#if CRIPPLED_REFLECTION
- var ifType = typeof(IPlatformEnlightenmentProvider).GetTypeInfo();
-#else
- var ifType = typeof(IPlatformEnlightenmentProvider);
-#endif
- var asm = new AssemblyName(ifType.Assembly.FullName);
- asm.Name = "System.Reactive.PlatformServices";
- var name = "System.Reactive.PlatformServices.CurrentPlatformEnlightenmentProvider, " + asm.FullName;
-#endif
-
- var t = Type.GetType(name, false);
- if (t != null)
- s_current = (IPlatformEnlightenmentProvider)Activator.CreateInstance(t);
- else
- s_current = new DefaultPlatformEnlightenmentProvider();
- }
- }
- }
-
- return s_current;
- }
-
- set
- {
- lock (s_gate)
- {
- s_current = value;
- }
- }
- }
- }
-
- class DefaultPlatformEnlightenmentProvider : IPlatformEnlightenmentProvider
- {
- public T GetService<T>(object[] args) where T : class
- {
- return null;
- }
- }
-}
diff --git a/Rx.NET/System.Reactive.Core/Reactive/Internal/PriorityQueue.cs b/Rx.NET/System.Reactive.Core/Reactive/Internal/PriorityQueue.cs
deleted file mode 100644
index 8a02cd5..0000000
--- a/Rx.NET/System.Reactive.Core/Reactive/Internal/PriorityQueue.cs
+++ /dev/null
@@ -1,154 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System.Threading;
-using System.Collections.Generic;
-
-namespace System.Reactive
-{
- internal class PriorityQueue<T> where T : IComparable<T>
- {
-#if !NO_INTERLOCKED_64
- private static long _count = long.MinValue;
-#else
- private static int _count = int.MinValue;
-#endif
- private IndexedItem[] _items;
- private int _size;
-
- public PriorityQueue()
- : this(16)
- {
- }
-
- public PriorityQueue(int capacity)
- {
- _items = new IndexedItem[capacity];
- _size = 0;
- }
-
- private bool IsHigherPriority(int left, int right)
- {
- return _items[left].CompareTo(_items[right]) < 0;
- }
-
- private void Percolate(int index)
- {
- if (index >= _size || index < 0)
- return;
- var parent = (index - 1) / 2;
- if (parent < 0 || parent == index)
- return;
-
- if (IsHigherPriority(index, parent))
- {
- var temp = _items[index];
- _items[index] = _items[parent];
- _items[parent] = temp;
- Percolate(parent);
- }
- }
-
- private void Heapify()
- {
- Heapify(0);
- }
-
- private void Heapify(int index)
- {
- if (index >= _size || index < 0)
- return;
-
- var left = 2 * index + 1;
- var right = 2 * index + 2;
- var first = index;
-
- if (left < _size && IsHigherPriority(left, first))
- first = left;
- if (right < _size && IsHigherPriority(right, first))
- first = right;
- if (first != index)
- {
- var temp = _items[index];
- _items[index] = _items[first];
- _items[first] = temp;
- Heapify(first);
- }
- }
-
- public int Count { get { return _size; } }
-
- public T Peek()
- {
- if (_size == 0)
- throw new InvalidOperationException(Strings_Core.HEAP_EMPTY);
-
- return _items[0].Value;
- }
-
- private void RemoveAt(int index)
- {
- _items[index] = _items[--_size];
- _items[_size] = default(IndexedItem);
- Heapify();
- if (_size < _items.Length / 4)
- {
- var temp = _items;
- _items = new IndexedItem[_items.Length / 2];
- Array.Copy(temp, 0, _items, 0, _size);
- }
- }
-
- public T Dequeue()
- {
- var result = Peek();
- RemoveAt(0);
- return result;
- }
-
- public void Enqueue(T item)
- {
- if (_size >= _items.Length)
- {
- var temp = _items;
- _items = new IndexedItem[_items.Length * 2];
- Array.Copy(temp, _items, temp.Length);
- }
-
- var index = _size++;
- _items[index] = new IndexedItem { Value = item, Id = Interlocked.Increment(ref _count) };
- Percolate(index);
- }
-
- public bool Remove(T item)
- {
- for (var i = 0; i < _size; ++i)
- {
- if (EqualityComparer<T>.Default.Equals(_items[i].Value, item))
- {
- RemoveAt(i);
- return true;
- }
- }
-
- return false;
- }
-
- struct IndexedItem : IComparable<IndexedItem>
- {
- public T Value;
-#if !NO_INTERLOCKED_64
- public long Id;
-#else
- public int Id;
-#endif
-
- public int CompareTo(IndexedItem other)
- {
- var c = Value.CompareTo(other.Value);
- if (c == 0)
- c = Id.CompareTo(other.Id);
- return c;
- }
- }
- }
-}
diff --git a/Rx.NET/System.Reactive.Core/Reactive/Internal/Producer.cs b/Rx.NET/System.Reactive.Core/Reactive/Internal/Producer.cs
deleted file mode 100644
index 93b83de..0000000
--- a/Rx.NET/System.Reactive.Core/Reactive/Internal/Producer.cs
+++ /dev/null
@@ -1,87 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_PERF
-using System.Reactive.Concurrency;
-using System.Reactive.Disposables;
-
-namespace System.Reactive
-{
- /// <summary>
- /// Base class for implementation of query operators, providing performance benefits over the use of Observable.Create.
- /// </summary>
- /// <typeparam name="TSource">Type of the resulting sequence's elements.</typeparam>
- internal abstract class Producer<TSource> : IObservable<TSource>
- {
- /// <summary>
- /// Publicly visible Subscribe method.
- /// </summary>
- /// <param name="observer">Observer to send notifications on. The implementation of a producer must ensure the correct message grammar on the observer.</param>
- /// <returns>IDisposable to cancel the subscription. This causes the underlying sink to be notified of unsubscription, causing it to prevent further messages from being sent to the observer.</returns>
- public IDisposable Subscribe(IObserver<TSource> observer)
- {
- if (observer == null)
- throw new ArgumentNullException("observer");
-
- return SubscribeRaw(observer, true);
- }
-
- internal IDisposable SubscribeRaw(IObserver<TSource> observer, bool enableSafeguard)
- {
- var state = new State();
- state.observer = observer;
- state.sink = new SingleAssignmentDisposable();
- state.subscription = new SingleAssignmentDisposable();
-
- var d = new CompositeDisposable(2) { state.sink, state.subscription };
-
- //
- // See AutoDetachObserver.cs for more information on the safeguarding requirement and
- // its implementation aspects.
- //
- if (enableSafeguard)
- {
- state.observer = SafeObserver<TSource>.Create(state.observer, d);
- }
-
- if (CurrentThreadScheduler.IsScheduleRequired)
- {
- CurrentThreadScheduler.Instance.Schedule(state, Run);
- }
- else
- {
- state.subscription.Disposable = this.Run(state.observer, state.subscription, state.Assign);
- }
-
- return d;
- }
-
- struct State
- {
- public SingleAssignmentDisposable sink;
- public SingleAssignmentDisposable subscription;
- public IObserver<TSource> observer;
-
- public void Assign(IDisposable s)
- {
- sink.Disposable = s;
- }
- }
-
- private IDisposable Run(IScheduler _, State x)
- {
- x.subscription.Disposable = this.Run(x.observer, x.subscription, x.Assign);
- return Disposable.Empty;
- }
-
- /// <summary>
- /// Core implementation of the query operator, called upon a new subscription to the producer object.
- /// </summary>
- /// <param name="observer">Observer to send notifications on. The implementation of a producer must ensure the correct message grammar on the observer.</param>
- /// <param name="cancel">The subscription disposable object returned from the Run call, passed in such that it can be forwarded to the sink, allowing it to dispose the subscription upon sending a final message (or prematurely for other reasons).</param>
- /// <param name="setSink">Callback to communicate the sink object to the subscriber, allowing consumers to tunnel a Dispose call into the sink, which can stop the processing.</param>
- /// <returns>Disposable representing all the resources and/or subscriptions the operator uses to process events.</returns>
- /// <remarks>The <paramref name="observer">observer</paramref> passed in to this method is not protected using auto-detach behavior upon an OnError or OnCompleted call. The implementation must ensure proper resource disposal and enforce the message grammar.</remarks>
- protected abstract IDisposable Run(IObserver<TSource> observer, IDisposable cancel, Action<IDisposable> setSink);
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Core/Reactive/Internal/SafeObserver.cs b/Rx.NET/System.Reactive.Core/Reactive/Internal/SafeObserver.cs
deleted file mode 100644
index 2693569..0000000
--- a/Rx.NET/System.Reactive.Core/Reactive/Internal/SafeObserver.cs
+++ /dev/null
@@ -1,71 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System;
-
-namespace System.Reactive
-{
- //
- // See AutoDetachObserver.cs for more information on the safeguarding requirement and
- // its implementation aspects.
- //
-
- class SafeObserver<TSource> : IObserver<TSource>
- {
- private readonly IObserver<TSource> _observer;
- private readonly IDisposable _disposable;
-
- public static IObserver<TSource> Create(IObserver<TSource> observer, IDisposable disposable)
- {
- var a = observer as AnonymousObserver<TSource>;
- if (a != null)
- return a.MakeSafe(disposable);
- else
- return new SafeObserver<TSource>(observer, disposable);
- }
-
- private SafeObserver(IObserver<TSource> observer, IDisposable disposable)
- {
- _observer = observer;
- _disposable = disposable;
- }
-
- public void OnNext(TSource value)
- {
- var __noError = false;
- try
- {
- _observer.OnNext(value);
- __noError = true;
- }
- finally
- {
- if (!__noError)
- _disposable.Dispose();
- }
- }
-
- public void OnError(Exception error)
- {
- try
- {
- _observer.OnError(error);
- }
- finally
- {
- _disposable.Dispose();
- }
- }
-
- public void OnCompleted()
- {
- try
- {
- _observer.OnCompleted();
- }
- finally
- {
- _disposable.Dispose();
- }
- }
- }
-}
diff --git a/Rx.NET/System.Reactive.Core/Reactive/Internal/ScheduledObserver.cs b/Rx.NET/System.Reactive.Core/Reactive/Internal/ScheduledObserver.cs
deleted file mode 100644
index 2b728e2..0000000
--- a/Rx.NET/System.Reactive.Core/Reactive/Internal/ScheduledObserver.cs
+++ /dev/null
@@ -1,441 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System.Collections.Generic;
-using System.Reactive.Concurrency;
-using System.Reactive.Disposables;
-using System.Threading;
-
-namespace System.Reactive
-{
-#if !NO_PERF && !NO_CDS
- using System.Collections.Concurrent;
- using System.Diagnostics;
-
- internal class ScheduledObserver<T> : ObserverBase<T>, IDisposable
- {
- private volatile int _state = 0;
- private const int STOPPED = 0;
- private const int RUNNING = 1;
- private const int PENDING = 2;
- private const int FAULTED = 9;
-
- private readonly ConcurrentQueue<T> _queue = new ConcurrentQueue<T>();
- private volatile bool _failed;
- private volatile Exception _error;
- private volatile bool _completed;
-
- private readonly IObserver<T> _observer;
- private readonly IScheduler _scheduler;
- private readonly ISchedulerLongRunning _longRunning;
- private readonly SerialDisposable _disposable = new SerialDisposable();
-
- public ScheduledObserver(IScheduler scheduler, IObserver<T> observer)
- {
- _scheduler = scheduler;
- _observer = observer;
- _longRunning = _scheduler.AsLongRunning();
-
- if (_longRunning != null)
- _dispatcherEvent = new SemaphoreSlim(0);
- }
-
- private readonly object _dispatcherInitGate = new object();
- private SemaphoreSlim _dispatcherEvent;
- private IDisposable _dispatcherJob;
-
- private void EnsureDispatcher()
- {
- if (_dispatcherJob == null)
- {
- lock (_dispatcherInitGate)
- {
- if (_dispatcherJob == null)
- {
- _dispatcherJob = _longRunning.ScheduleLongRunning(Dispatch);
-
- _disposable.Disposable = new CompositeDisposable(2)
- {
- _dispatcherJob,
- Disposable.Create(() => _dispatcherEvent.Release())
- };
- }
- }
- }
- }
-
- private void Dispatch(ICancelable cancel)
- {
- while (true)
- {
- _dispatcherEvent.Wait();
-
- if (cancel.IsDisposed)
- return;
-
- var next = default(T);
- while (_queue.TryDequeue(out next))
- {
- try
- {
- _observer.OnNext(next);
- }
- catch
- {
- var nop = default(T);
- while (_queue.TryDequeue(out nop))
- ;
-
- throw;
- }
-
- _dispatcherEvent.Wait();
-
- if (cancel.IsDisposed)
- return;
- }
-
- if (_failed)
- {
- _observer.OnError(_error);
- Dispose();
- return;
- }
-
- if (_completed)
- {
- _observer.OnCompleted();
- Dispose();
- return;
- }
- }
- }
-
- public void EnsureActive()
- {
- EnsureActive(1);
- }
-
- public void EnsureActive(int n)
- {
- if (_longRunning != null)
- {
- if (n > 0)
- _dispatcherEvent.Release(n);
-
- EnsureDispatcher();
- }
- else
- EnsureActiveSlow();
- }
-
- private void EnsureActiveSlow()
- {
- var isOwner = false;
-
-#pragma warning disable 0420
- while (true)
- {
- var old = Interlocked.CompareExchange(ref _state, RUNNING, STOPPED);
- if (old == STOPPED)
- {
- isOwner = true; // RUNNING
- break;
- }
-
- if (old == FAULTED)
- return;
-
- // If we find the consumer loop running, we transition to PENDING to handle
- // the case where the queue is seen empty by the consumer, making it transition
- // to the STOPPED state, but we inserted an item into the queue.
- //
- // C: _queue.TryDequeue == false (RUNNING)
- // ----------------------------------------------
- // P: _queue.Enqueue(...)
- // EnsureActive
- // Exchange(ref _state, RUNNING) == RUNNING
- // ----------------------------------------------
- // C: transition to STOPPED (STOPPED)
- //
- // In this case, P would believe C is running and not invoke the scheduler
- // using the isOwner flag.
- //
- // By introducing an intermediate PENDING state and using CAS in the consumer
- // to only transition to STOPPED in case we were still RUNNING, we can force
- // the consumer to reconsider the decision to transition to STOPPED. In that
- // case, the consumer loops again and re-reads from the queue and other state
- // fields. At least one bit of state will have changed because EnsureActive
- // should only be called after invocation of IObserver<T> methods that touch
- // this state.
- //
- if (old == PENDING || old == RUNNING && Interlocked.CompareExchange(ref _state, PENDING, RUNNING) == RUNNING)
- break;
- }
-#pragma warning restore 0420
-
- if (isOwner)
- {
- _disposable.Disposable = _scheduler.Schedule<object>(null, Run);
- }
- }
-
- private void Run(object state, Action<object> recurse)
- {
-#pragma warning disable 0420
- var next = default(T);
- while (!_queue.TryDequeue(out next))
- {
- if (_failed)
- {
- // Between transitioning to _failed and the queue check in the loop,
- // items could have been queued, so we can't stop yet. We don't spin
- // and immediately re-check the queue.
- //
- // C: _queue.TryDequeue == false
- // ----------------------------------------------
- // P: OnNext(...)
- // _queue.Enqueue(...) // Will get lost
- // P: OnError(...)
- // _failed = true
- // ----------------------------------------------
- // C: if (_failed)
- // _observer.OnError(...) // Lost an OnNext
- //
- if (!_queue.IsEmpty)
- continue;
-
- Interlocked.Exchange(ref _state, STOPPED);
- _observer.OnError(_error);
- Dispose();
- return;
- }
-
- if (_completed)
- {
- // Between transitioning to _completed and the queue check in the loop,
- // items could have been queued, so we can't stop yet. We don't spin
- // and immediately re-check the queue.
- //
- // C: _queue.TryDequeue == false
- // ----------------------------------------------
- // P: OnNext(...)
- // _queue.Enqueue(...) // Will get lost
- // P: OnCompleted(...)
- // _completed = true
- // ----------------------------------------------
- // C: if (_completed)
- // _observer.OnCompleted() // Lost an OnNext
- //
- if (!_queue.IsEmpty)
- continue;
-
- Interlocked.Exchange(ref _state, STOPPED);
- _observer.OnCompleted();
- Dispose();
- return;
- }
-
- var old = Interlocked.CompareExchange(ref _state, STOPPED, RUNNING);
- if (old == RUNNING || old == FAULTED)
- return;
-
- Debug.Assert(old == PENDING);
-
- // The producer has put us in the PENDING state to prevent us from
- // transitioning to STOPPED, so we go RUNNING again and re-check our state.
- _state = RUNNING;
- }
-
- Interlocked.Exchange(ref _state, RUNNING);
-
-#pragma warning restore 0420
-
- try
- {
- _observer.OnNext(next);
- }
- catch
- {
-#pragma warning disable 0420
- Interlocked.Exchange(ref _state, FAULTED);
-#pragma warning restore 0420
-
- var nop = default(T);
- while (_queue.TryDequeue(out nop))
- ;
- throw;
- }
-
- recurse(state);
- }
-
- protected override void OnNextCore(T value)
- {
- _queue.Enqueue(value);
- }
-
- protected override void OnErrorCore(Exception exception)
- {
- _error = exception;
- _failed = true;
- }
-
- protected override void OnCompletedCore()
- {
- _completed = true;
- }
-
- protected override void Dispose(bool disposing)
- {
- base.Dispose(disposing);
-
- if (disposing)
- {
- _disposable.Dispose();
- }
- }
- }
-#else
- class ScheduledObserver<T> : ObserverBase<T>, IDisposable
- {
- private bool _isAcquired = false;
- private bool _hasFaulted = false;
- private readonly Queue<Action> _queue = new Queue<Action>();
- private readonly IObserver<T> _observer;
- private readonly IScheduler _scheduler;
- private readonly SerialDisposable _disposable = new SerialDisposable();
-
- public ScheduledObserver(IScheduler scheduler, IObserver<T> observer)
- {
- _scheduler = scheduler;
- _observer = observer;
- }
-
- public void EnsureActive(int n)
- {
- EnsureActive();
- }
-
- public void EnsureActive()
- {
- var isOwner = false;
-
- lock (_queue)
- {
- if (!_hasFaulted && _queue.Count > 0)
- {
- isOwner = !_isAcquired;
- _isAcquired = true;
- }
- }
-
- if (isOwner)
- {
- _disposable.Disposable = _scheduler.Schedule<object>(null, Run);
- }
- }
-
- private void Run(object state, Action<object> recurse)
- {
- var work = default(Action);
- lock (_queue)
- {
- if (_queue.Count > 0)
- work = _queue.Dequeue();
- else
- {
- _isAcquired = false;
- return;
- }
- }
-
- try
- {
- work();
- }
- catch
- {
- lock (_queue)
- {
- _queue.Clear();
- _hasFaulted = true;
- }
- throw;
- }
-
- recurse(state);
- }
-
- protected override void OnNextCore(T value)
- {
- lock (_queue)
- _queue.Enqueue(() => _observer.OnNext(value));
- }
-
- protected override void OnErrorCore(Exception exception)
- {
- lock (_queue)
- _queue.Enqueue(() => _observer.OnError(exception));
- }
-
- protected override void OnCompletedCore()
- {
- lock (_queue)
- _queue.Enqueue(() => _observer.OnCompleted());
- }
-
- protected override void Dispose(bool disposing)
- {
- base.Dispose(disposing);
-
- if (disposing)
- {
- _disposable.Dispose();
- }
- }
- }
-#endif
-
- class ObserveOnObserver<T> : ScheduledObserver<T>
- {
- private IDisposable _cancel;
-
- public ObserveOnObserver(IScheduler scheduler, IObserver<T> observer, IDisposable cancel)
- : base(scheduler, observer)
- {
- _cancel = cancel;
- }
-
- protected override void OnNextCore(T value)
- {
- base.OnNextCore(value);
- EnsureActive();
- }
-
- protected override void OnErrorCore(Exception exception)
- {
- base.OnErrorCore(exception);
- EnsureActive();
- }
-
- protected override void OnCompletedCore()
- {
- base.OnCompletedCore();
- EnsureActive();
- }
-
- protected override void Dispose(bool disposing)
- {
- base.Dispose(disposing);
-
- if (disposing)
- {
- var cancel = Interlocked.Exchange(ref _cancel, null);
- if (cancel != null)
- {
- cancel.Dispose();
- }
- }
- }
- }
-}
diff --git a/Rx.NET/System.Reactive.Core/Reactive/Internal/Semaphore.Silverlight.cs b/Rx.NET/System.Reactive.Core/Reactive/Internal/Semaphore.Silverlight.cs
deleted file mode 100644
index 4f5eeee..0000000
--- a/Rx.NET/System.Reactive.Core/Reactive/Internal/Semaphore.Silverlight.cs
+++ /dev/null
@@ -1,116 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if NO_SEMAPHORE && SILVERLIGHT
-using System;
-using System.Threading;
-
-namespace System.Reactive.Threading
-{
- //Monitor based implementation of Semaphore
- //that mimicks the .NET Semaphore class (System.Threading.Semaphore)
-
- internal sealed class Semaphore : IDisposable
- {
- private int m_currentCount;
- private readonly int m_maximumCount;
- private readonly object m_lockObject;
- private bool m_disposed;
-
- public Semaphore(int initialCount, int maximumCount)
- {
- if (initialCount < 0)
- {
- throw new ArgumentOutOfRangeException("initialCount", "Non-negative number required.");
- }
- if (maximumCount < 1)
- {
- throw new ArgumentOutOfRangeException("maximumCount", "Positive number required.");
- }
- if (initialCount > maximumCount)
- {
- throw new ArgumentException("Initial count must be smaller than maximum");
- }
-
- m_currentCount = initialCount;
- m_maximumCount = maximumCount;
- m_lockObject = new object();
- }
-
- public int Release()
- {
- return this.Release(1);
- }
-
- public int Release(int releaseCount)
- {
- if (releaseCount < 1)
- {
- throw new ArgumentOutOfRangeException("releaseCount", "Positive number required.");
- }
- if (m_disposed)
- {
- throw new ObjectDisposedException("Semaphore");
- }
-
- var oldCount = default(int);
- lock (m_lockObject)
- {
- oldCount = m_currentCount;
- if (releaseCount + m_currentCount > m_maximumCount)
- {
- throw new ArgumentOutOfRangeException("releaseCount", "Amount of releases would overflow maximum");
- }
- m_currentCount += releaseCount;
- //PulseAll makes sure all waiting threads get queued for acquiring the lock
- //Pulse would only queue one thread.
-
- Monitor.PulseAll(m_lockObject);
- }
- return oldCount;
- }
-
- public bool WaitOne()
- {
- return WaitOne(Timeout.Infinite);
- }
-
- public bool WaitOne(int millisecondsTimeout)
- {
- if (m_disposed)
- {
- throw new ObjectDisposedException("Semaphore");
- }
-
- lock (m_lockObject)
- {
- while (m_currentCount == 0)
- {
- if (!Monitor.Wait(m_lockObject, millisecondsTimeout))
- {
- return false;
- }
- }
- m_currentCount--;
- return true;
- }
- }
-
- public bool WaitOne(TimeSpan timeout)
- {
- return WaitOne((int)timeout.TotalMilliseconds);
- }
-
- public void Close()
- {
- Dispose();
- }
-
- public void Dispose()
- {
- //the .NET CLR semaphore does not release waits upon dispose
- //so we don't do that either.
- m_disposed = true;
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Core/Reactive/Internal/Semaphore.Xna.cs b/Rx.NET/System.Reactive.Core/Reactive/Internal/Semaphore.Xna.cs
deleted file mode 100644
index 847c14d..0000000
--- a/Rx.NET/System.Reactive.Core/Reactive/Internal/Semaphore.Xna.cs
+++ /dev/null
@@ -1,143 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if NO_SEMAPHORE && (XNA || NETCF)
-using System;
-using System.Collections.Generic;
-using System.Threading;
-
-namespace System.Reactive.Threading
-{
- //Monitor based implementation of Semaphore
- //that mimicks the .NET Semaphore class (System.Threading.Semaphore)
-
- internal sealed class Semaphore : IDisposable
- {
- private int m_currentCount;
- private readonly int m_maximumCount;
- private readonly object m_lockObject;
- private bool m_disposed;
- private readonly List<ManualResetEvent> m_waiting;
-
- public Semaphore(int initialCount, int maximumCount)
- {
- if (initialCount < 0)
- {
- throw new ArgumentOutOfRangeException("initialCount", "Non-negative number required.");
- }
- if (maximumCount < 1)
- {
- throw new ArgumentOutOfRangeException("maximumCount", "Positive number required.");
- }
- if (initialCount > maximumCount)
- {
- throw new ArgumentException("Initial count must be smaller than maximum");
- }
- m_waiting = new List<ManualResetEvent>();
- m_currentCount = initialCount;
- m_maximumCount = maximumCount;
- m_lockObject = new object();
- }
-
- public int Release()
- {
- return this.Release(1);
- }
-
- public int Release(int releaseCount)
- {
- if (releaseCount < 1)
- {
- throw new ArgumentOutOfRangeException("releaseCount", "Positive number required.");
- }
- if (m_disposed)
- {
- throw new ObjectDisposedException("Semaphore");
- }
-
- var oldCount = default(int);
- var toBeReleased = new List<ManualResetEvent>();
- lock (m_lockObject)
- {
- oldCount = m_currentCount;
- if (releaseCount + m_currentCount > m_maximumCount)
- {
- throw new ArgumentOutOfRangeException("releaseCount", "Amount of releases would overflow maximum");
- }
-
- var waiting = m_waiting.ToArray();
- var left = Math.Max(0, releaseCount - waiting.Length);
- for (var i = 0; i < releaseCount && i < m_waiting.Count; i++)
- {
- toBeReleased.Add(waiting[i]);
- m_waiting.RemoveAt(0);
- }
- m_currentCount += left;
- }
- foreach(var release in toBeReleased)
- {
- release.Set();
- }
- return oldCount;
- }
-
- public bool WaitOne()
- {
- return WaitOne(Timeout.Infinite);
- }
-
- public bool WaitOne(int millisecondsTimeout)
- {
- if (m_disposed)
- {
- throw new ObjectDisposedException("Semaphore");
- }
-
- var manualResetEvent = default(ManualResetEvent);
-
- lock (m_lockObject)
- {
- if (m_currentCount == 0)
- {
- manualResetEvent = new ManualResetEvent(false);
- m_waiting.Add(manualResetEvent);
- }
- else
- {
- m_currentCount--;
- return true;
- }
- }
-#if XNA_31_ZUNE || NETCF35
- if (!manualResetEvent.WaitOne(millisecondsTimeout, false))
-#else
- if (!manualResetEvent.WaitOne(millisecondsTimeout))
-#endif
- {
- lock(m_lockObject)
- {
- m_waiting.Remove(manualResetEvent);
- }
- return false;
- }
- return true;
- }
-
- public bool WaitOne(TimeSpan timeout)
- {
- return WaitOne((int)timeout.TotalMilliseconds);
- }
-
- public void Close()
- {
- Dispose();
- }
-
- public void Dispose()
- {
- //the .NET CLR semaphore does not release waits upon dispose
- //so we don't do that either.
- m_disposed = true;
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Core/Reactive/Internal/Sink.cs b/Rx.NET/System.Reactive.Core/Reactive/Internal/Sink.cs
deleted file mode 100644
index ffe6ee5..0000000
--- a/Rx.NET/System.Reactive.Core/Reactive/Internal/Sink.cs
+++ /dev/null
@@ -1,68 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_PERF
-using System.Threading;
-
-namespace System.Reactive
-{
- /// <summary>
- /// Base class for implementation of query operators, providing a lightweight sink that can be disposed to mute the outgoing observer.
- /// </summary>
- /// <typeparam name="TSource">Type of the resulting sequence's elements.</typeparam>
- /// <remarks>Implementations of sinks are responsible to enforce the message grammar on the associated observer. Upon sending a terminal message, a pairing Dispose call should be made to trigger cancellation of related resources and to mute the outgoing observer.</remarks>
- internal abstract class Sink<TSource> : IDisposable
- {
- protected internal volatile IObserver<TSource> _observer;
- private IDisposable _cancel;
-
- public Sink(IObserver<TSource> observer, IDisposable cancel)
- {
- _observer = observer;
- _cancel = cancel;
- }
-
- public virtual void Dispose()
- {
- _observer = NopObserver<TSource>.Instance;
-
- var cancel = Interlocked.Exchange(ref _cancel, null);
- if (cancel != null)
- {
- cancel.Dispose();
- }
- }
-
- public IObserver<TSource> GetForwarder()
- {
- return new _(this);
- }
-
- class _ : IObserver<TSource>
- {
- private readonly Sink<TSource> _forward;
-
- public _(Sink<TSource> forward)
- {
- _forward = forward;
- }
-
- public void OnNext(TSource value)
- {
- _forward._observer.OnNext(value);
- }
-
- public void OnError(Exception error)
- {
- _forward._observer.OnError(error);
- _forward.Dispose();
- }
-
- public void OnCompleted()
- {
- _forward._observer.OnCompleted();
- _forward.Dispose();
- }
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Core/Reactive/Internal/Stubs.cs b/Rx.NET/System.Reactive.Core/Reactive/Internal/Stubs.cs
deleted file mode 100644
index b54d395..0000000
--- a/Rx.NET/System.Reactive.Core/Reactive/Internal/Stubs.cs
+++ /dev/null
@@ -1,16 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-namespace System.Reactive
-{
- internal static class Stubs<T>
- {
- public static readonly Action<T> Ignore = _ => { };
- public static readonly Func<T, T> I = _ => _;
- }
-
- internal static class Stubs
- {
- public static readonly Action Nop = () => { };
- public static readonly Action<Exception> Throw = ex => { ex.Throw(); };
- }
-}
diff --git a/Rx.NET/System.Reactive.Core/Reactive/Internal/SynchronizationContextExtensions.cs b/Rx.NET/System.Reactive.Core/Reactive/Internal/SynchronizationContextExtensions.cs
deleted file mode 100644
index c417f90..0000000
--- a/Rx.NET/System.Reactive.Core/Reactive/Internal/SynchronizationContextExtensions.cs
+++ /dev/null
@@ -1,55 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_SYNCCTX
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading;
-
-namespace System.Reactive.Concurrency
-{
- internal static class SynchronizationContextExtensions
- {
- public static void PostWithStartComplete<T>(this SynchronizationContext context, Action<T> action, T state)
- {
- context.OperationStarted();
-
- context.Post(
- o =>
- {
- try
- {
- action((T)o);
- }
- finally
- {
- context.OperationCompleted();
- }
- },
- state
- );
- }
-
- public static void PostWithStartComplete(this SynchronizationContext context, Action action)
- {
- context.OperationStarted();
-
- context.Post(
- _ =>
- {
- try
- {
- action();
- }
- finally
- {
- context.OperationCompleted();
- }
- },
- null
- );
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Core/Reactive/Internal/SynchronizedObserver.cs b/Rx.NET/System.Reactive.Core/Reactive/Internal/SynchronizedObserver.cs
deleted file mode 100644
index e41294e..0000000
--- a/Rx.NET/System.Reactive.Core/Reactive/Internal/SynchronizedObserver.cs
+++ /dev/null
@@ -1,40 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-namespace System.Reactive
-{
- internal class SynchronizedObserver<T> : ObserverBase<T>
- {
- private readonly object _gate;
- private readonly IObserver<T> _observer;
-
- public SynchronizedObserver(IObserver<T> observer, object gate)
- {
- _gate = gate;
- _observer = observer;
- }
-
- protected override void OnNextCore(T value)
- {
- lock (_gate)
- {
- _observer.OnNext(value);
- }
- }
-
- protected override void OnErrorCore(Exception exception)
- {
- lock (_gate)
- {
- _observer.OnError(exception);
- }
- }
-
- protected override void OnCompletedCore()
- {
- lock (_gate)
- {
- _observer.OnCompleted();
- }
- }
- }
-}
diff --git a/Rx.NET/System.Reactive.Core/Reactive/Internal/SystemClock.Default.cs b/Rx.NET/System.Reactive.Core/Reactive/Internal/SystemClock.Default.cs
deleted file mode 100644
index b9c8167..0000000
--- a/Rx.NET/System.Reactive.Core/Reactive/Internal/SystemClock.Default.cs
+++ /dev/null
@@ -1,113 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System.ComponentModel;
-using System.Reactive.Concurrency;
-using System.Reactive.Disposables;
-
-namespace System.Reactive.PlatformServices
-{
- /// <summary>
- /// (Infrastructure) Provides access to the local system clock.
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public class DefaultSystemClock : ISystemClock
- {
- /// <summary>
- /// Gets the current time.
- /// </summary>
- public DateTimeOffset UtcNow
- {
- get { return DateTimeOffset.UtcNow; }
- }
- }
-
- internal class DefaultSystemClockMonitor : PeriodicTimerSystemClockMonitor
- {
- private static readonly TimeSpan DEFAULT_PERIOD = TimeSpan.FromSeconds(1);
-
- public DefaultSystemClockMonitor()
- : base(DEFAULT_PERIOD)
- {
- }
- }
-
- /// <summary>
- /// (Infrastructure) Monitors for system clock changes based on a periodic timer.
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public class PeriodicTimerSystemClockMonitor : INotifySystemClockChanged
- {
- private readonly TimeSpan _period;
- private readonly SerialDisposable _timer;
-
- private DateTimeOffset _lastTime;
- private EventHandler<SystemClockChangedEventArgs> _systemClockChanged;
-
- private const int SYNC_MAXRETRIES = 100;
- private const double SYNC_MAXDELTA = 10;
- private const int MAXERROR = 100;
-
- /// <summary>
- /// Creates a new monitor for system clock changes with the specified polling frequency.
- /// </summary>
- /// <param name="period">Polling frequency for system clock changes.</param>
- public PeriodicTimerSystemClockMonitor(TimeSpan period)
- {
- _period = period;
- _timer = new SerialDisposable();
- }
-
- /// <summary>
- /// Event that gets raised when a system clock change is detected.
- /// </summary>
- public event EventHandler<SystemClockChangedEventArgs> SystemClockChanged
- {
- add
- {
- NewTimer();
-
- _systemClockChanged += value;
- }
-
- remove
- {
- _systemClockChanged -= value;
-
- _timer.Disposable = Disposable.Empty;
- }
- }
-
- private void NewTimer()
- {
- _timer.Disposable = Disposable.Empty;
-
- var n = 0;
- do
- {
- _lastTime = SystemClock.UtcNow;
- _timer.Disposable = ConcurrencyAbstractionLayer.Current.StartPeriodicTimer(TimeChanged, _period);
- } while (Math.Abs((SystemClock.UtcNow - _lastTime).TotalMilliseconds) > SYNC_MAXDELTA && ++n < SYNC_MAXRETRIES);
-
- if (n >= SYNC_MAXRETRIES)
- throw new InvalidOperationException(Strings_Core.FAILED_CLOCK_MONITORING);
- }
-
- private void TimeChanged()
- {
- var now = SystemClock.UtcNow;
- var diff = now - (_lastTime + _period);
- if (Math.Abs(diff.TotalMilliseconds) >= MAXERROR)
- {
- var scc = _systemClockChanged;
- if (scc != null)
- scc(this, new SystemClockChangedEventArgs(_lastTime + _period, now));
-
- NewTimer();
- }
- else
- {
- _lastTime = SystemClock.UtcNow;
- }
- }
- }
-}
diff --git a/Rx.NET/System.Reactive.Core/Reactive/Internal/SystemClock.cs b/Rx.NET/System.Reactive.Core/Reactive/Internal/SystemClock.cs
deleted file mode 100644
index e482dd0..0000000
--- a/Rx.NET/System.Reactive.Core/Reactive/Internal/SystemClock.cs
+++ /dev/null
@@ -1,149 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System.ComponentModel;
-using System.Threading;
-
-namespace System.Reactive.PlatformServices
-{
- /// <summary>
- /// (Infrastructure) Provides access to local system clock services.
- /// </summary>
- /// <remarks>
- /// This type is used by the Rx infrastructure and not meant for public consumption or implementation.
- /// No guarantees are made about forward compatibility of the type's functionality and its usage.
- /// </remarks>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public static class SystemClock
- {
- private static Lazy<ISystemClock> s_serviceSystemClock = new Lazy<ISystemClock>(InitializeSystemClock);
- private static Lazy<INotifySystemClockChanged> s_serviceSystemClockChanged = new Lazy<INotifySystemClockChanged>(InitializeSystemClockChanged);
-
- private static int _refCount;
-
- /// <summary>
- /// Gets the local system clock time.
- /// </summary>
- public static DateTimeOffset UtcNow
- {
- get { return s_serviceSystemClock.Value.UtcNow; }
- }
-
- /// <summary>
- /// Event that gets raised when a system clock change is detected, if there's any interest as indicated by AddRef calls.
- /// </summary>
- public static event EventHandler<SystemClockChangedEventArgs> SystemClockChanged;
-
- /// <summary>
- /// Adds a reference to the system clock monitor, causing it to be sending notifications.
- /// </summary>
- /// <exception cref="NotSupportedException">Thrown when the system doesn't support sending clock change notifications.</exception>
- public static void AddRef()
- {
- if (Interlocked.Increment(ref _refCount) == 1)
- {
- s_serviceSystemClockChanged.Value.SystemClockChanged += OnSystemClockChanged;
- }
- }
-
- /// <summary>
- /// Removes a reference to the system clock monitor, causing it to stop sending notifications
- /// if the removed reference was the last one.
- /// </summary>
- public static void Release()
- {
- if (Interlocked.Decrement(ref _refCount) == 0)
- {
- s_serviceSystemClockChanged.Value.SystemClockChanged -= OnSystemClockChanged;
- }
- }
-
- private static void OnSystemClockChanged(object sender, SystemClockChangedEventArgs e)
- {
- var scc = SystemClockChanged;
- if (scc != null)
- scc(sender, e);
- }
-
- private static ISystemClock InitializeSystemClock()
- {
- return PlatformEnlightenmentProvider.Current.GetService<ISystemClock>() ?? new DefaultSystemClock();
- }
-
- private static INotifySystemClockChanged InitializeSystemClockChanged()
- {
- return PlatformEnlightenmentProvider.Current.GetService<INotifySystemClockChanged>() ?? new DefaultSystemClockMonitor();
- }
- }
-
- /// <summary>
- /// (Infrastructure) Provides access to the local system clock.
- /// </summary>
- /// <remarks>
- /// This type is used by the Rx infrastructure and not meant for public consumption or implementation.
- /// No guarantees are made about forward compatibility of the type's functionality and its usage.
- /// </remarks>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public interface ISystemClock
- {
- /// <summary>
- /// Gets the current time.
- /// </summary>
- DateTimeOffset UtcNow { get; }
- }
-
- /// <summary>
- /// (Infrastructure) Provides a mechanism to notify local schedulers about system clock changes.
- /// </summary>
- /// <remarks>
- /// This type is used by the Rx infrastructure and not meant for public consumption or implementation.
- /// No guarantees are made about forward compatibility of the type's functionality and its usage.
- /// </remarks>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public interface INotifySystemClockChanged
- {
- /// <summary>
- /// Event that gets raised when a system clock change is detected.
- /// </summary>
- event EventHandler<SystemClockChangedEventArgs> SystemClockChanged;
- }
-
- /// <summary>
- /// (Infrastructure) Event arguments for system clock change notifications.
- /// </summary>
- /// <remarks>
- /// This type is used by the Rx infrastructure and not meant for public consumption or implementation.
- /// No guarantees are made about forward compatibility of the type's functionality and its usage.
- /// </remarks>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public class SystemClockChangedEventArgs : EventArgs
- {
- /// <summary>
- /// Creates a new system clock notification object with unknown old and new times.
- /// </summary>
- public SystemClockChangedEventArgs()
- : this(DateTimeOffset.MinValue, DateTimeOffset.MaxValue)
- {
- }
-
- /// <summary>
- /// Creates a new system clock notification object with the specified old and new times.
- /// </summary>
- /// <param name="oldTime">Time before the system clock changed, or DateTimeOffset.MinValue if not known.</param>
- /// <param name="newTime">Time after the system clock changed, or DateTimeOffset.MaxValue if not known.</param>
- public SystemClockChangedEventArgs(DateTimeOffset oldTime, DateTimeOffset newTime)
- {
- OldTime = oldTime;
- NewTime = newTime;
- }
-
- /// <summary>
- /// Gets the time before the system clock changed, or DateTimeOffset.MinValue if not known.
- /// </summary>
- public DateTimeOffset OldTime { get; private set; }
-
- /// <summary>
- /// Gets the time after the system clock changed, or DateTimeOffset.MaxValue if not known.
- /// </summary>
- public DateTimeOffset NewTime { get; private set; }
- }
-}
diff --git a/Rx.NET/System.Reactive.Core/Reactive/Notification.cs b/Rx.NET/System.Reactive.Core/Reactive/Notification.cs
deleted file mode 100644
index 54c4e7c..0000000
--- a/Rx.NET/System.Reactive.Core/Reactive/Notification.cs
+++ /dev/null
@@ -1,649 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System.Diagnostics;
-using System.Globalization;
-using System.Collections.Generic;
-using System.Reactive.Concurrency;
-
-#pragma warning disable 0659
-#pragma warning disable 0661
-
-namespace System.Reactive
-{
- /// <summary>
- /// Indicates the type of a notification.
- /// </summary>
- public enum NotificationKind
- {
- /// <summary>
- /// Represents an OnNext notification.
- /// </summary>
- OnNext,
-
- /// <summary>
- /// Represents an OnError notification.
- /// </summary>
- OnError,
-
- /// <summary>
- /// Represents an OnCompleted notification.
- /// </summary>
- OnCompleted
- }
-
- /// <summary>
- /// Represents a notification to an observer.
- /// </summary>
- /// <typeparam name="T">The type of the elements received by the observer.</typeparam>
-#if !NO_SERIALIZABLE
- [Serializable]
-#endif
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2218:OverrideGetHashCodeOnOverridingEquals", Justification = "Resembles a discriminated union with finite number of subclasses (external users shouldn't create their own subtypes), each of which does override GetHashCode itself.")]
- public abstract class Notification<T> : IEquatable<Notification<T>>
- {
- /// <summary>
- /// Default constructor used by derived types.
- /// </summary>
- protected internal Notification()
- {
- }
-
- /// <summary>
- /// Returns the value of an OnNext notification or throws an exception.
- /// </summary>
- public abstract T Value
- {
- get;
- }
-
- /// <summary>
- /// Returns a value that indicates whether the notification has a value.
- /// </summary>
- public abstract bool HasValue
- {
- get;
- }
-
- /// <summary>
- /// Returns the exception of an OnError notification or returns null.
- /// </summary>
- public abstract Exception Exception
- {
- get;
- }
-
- /// <summary>
- /// Gets the kind of notification that is represented.
- /// </summary>
- public abstract NotificationKind Kind
- {
- get;
- }
-
- /// <summary>
- /// Represents an OnNext notification to an observer.
- /// </summary>
-#if !NO_DEBUGGER_ATTRIBUTES
- [DebuggerDisplay("OnNext({Value})")]
-#endif
-#if !NO_SERIALIZABLE
- [Serializable]
-#endif
- internal sealed class OnNextNotification : Notification<T>
- {
- T value;
-
- /// <summary>
- /// Constructs a notification of a new value.
- /// </summary>
- public OnNextNotification(T value)
- {
- this.value = value;
- }
-
- /// <summary>
- /// Returns the value of an OnNext notification.
- /// </summary>
- public override T Value { get { return value; } }
-
- /// <summary>
- /// Returns null.
- /// </summary>
- public override Exception Exception { get { return null; } }
-
- /// <summary>
- /// Returns true.
- /// </summary>
- public override bool HasValue { get { return true; } }
-
- /// <summary>
- /// Returns NotificationKind.OnNext.
- /// </summary>
- public override NotificationKind Kind { get { return NotificationKind.OnNext; } }
-
- /// <summary>
- /// Returns the hash code for this instance.
- /// </summary>
- public override int GetHashCode()
- {
- return EqualityComparer<T>.Default.GetHashCode(Value);
- }
-
- /// <summary>
- /// Indicates whether this instance and a specified object are equal.
- /// </summary>
- public override bool Equals(Notification<T> other)
- {
- if (Object.ReferenceEquals(this, other))
- return true;
- if (Object.ReferenceEquals(other, null))
- return false;
- if (other.Kind != NotificationKind.OnNext)
- return false;
- return EqualityComparer<T>.Default.Equals(Value, other.Value);
- }
-
- /// <summary>
- /// Returns a string representation of this instance.
- /// </summary>
- public override string ToString()
- {
- return String.Format(CultureInfo.CurrentCulture, "OnNext({0})", Value);
- }
-
- /// <summary>
- /// Invokes the observer's method corresponding to the notification.
- /// </summary>
- /// <param name="observer">Observer to invoke the notification on.</param>
- public override void Accept(IObserver<T> observer)
- {
- if (observer == null)
- throw new ArgumentNullException("observer");
-
- observer.OnNext(Value);
- }
-
- /// <summary>
- /// Invokes the observer's method corresponding to the notification and returns the produced result.
- /// </summary>
- /// <param name="observer">Observer to invoke the notification on.</param>
- /// <returns>Result produced by the observation.</returns>
- public override TResult Accept<TResult>(IObserver<T, TResult> observer)
- {
- if (observer == null)
- throw new ArgumentNullException("observer");
-
- return observer.OnNext(Value);
- }
-
- /// <summary>
- /// Invokes the delegate corresponding to the notification.
- /// </summary>
- /// <param name="onNext">Delegate to invoke for an OnNext notification.</param>
- /// <param name="onError">Delegate to invoke for an OnError notification.</param>
- /// <param name="onCompleted">Delegate to invoke for an OnCompleted notification.</param>
- public override void Accept(Action<T> onNext, Action<Exception> onError, Action onCompleted)
- {
- if (onNext == null)
- throw new ArgumentNullException("onNext");
- if (onError == null)
- throw new ArgumentNullException("onError");
- if (onCompleted == null)
- throw new ArgumentNullException("onCompleted");
-
- onNext(Value);
- }
-
- /// <summary>
- /// Invokes the delegate corresponding to the notification and returns the produced result.
- /// </summary>
- /// <param name="onNext">Delegate to invoke for an OnNext notification.</param>
- /// <param name="onError">Delegate to invoke for an OnError notification.</param>
- /// <param name="onCompleted">Delegate to invoke for an OnCompleted notification.</param>
- /// <returns>Result produced by the observation.</returns>
- public override TResult Accept<TResult>(Func<T, TResult> onNext, Func<Exception, TResult> onError, Func<TResult> onCompleted)
- {
- if (onNext == null)
- throw new ArgumentNullException("onNext");
- if (onError == null)
- throw new ArgumentNullException("onError");
- if (onCompleted == null)
- throw new ArgumentNullException("onCompleted");
-
- return onNext(Value);
- }
- }
-
- /// <summary>
- /// Represents an OnError notification to an observer.
- /// </summary>
-#if !NO_DEBUGGER_ATTRIBUTES
- [DebuggerDisplay("OnError({Exception})")]
-#endif
-#if !NO_SERIALIZABLE
- [Serializable]
-#endif
- internal sealed class OnErrorNotification : Notification<T>
- {
- Exception exception;
-
- /// <summary>
- /// Constructs a notification of an exception.
- /// </summary>
- public OnErrorNotification(Exception exception)
- {
- this.exception = exception;
- }
-
- /// <summary>
- /// Throws the exception.
- /// </summary>
- public override T Value { get { exception.Throw(); return default(T); } }
-
- /// <summary>
- /// Returns the exception.
- /// </summary>
- public override Exception Exception { get { return exception; } }
-
- /// <summary>
- /// Returns false.
- /// </summary>
- public override bool HasValue { get { return false; } }
-
- /// <summary>
- /// Returns NotificationKind.OnError.
- /// </summary>
- public override NotificationKind Kind { get { return NotificationKind.OnError; } }
-
- /// <summary>
- /// Returns the hash code for this instance.
- /// </summary>
- public override int GetHashCode()
- {
- return Exception.GetHashCode();
- }
-
- /// <summary>
- /// Indicates whether this instance and other are equal.
- /// </summary>
- public override bool Equals(Notification<T> other)
- {
- if (Object.ReferenceEquals(this, other))
- return true;
- if (Object.ReferenceEquals(other, null))
- return false;
- if (other.Kind != NotificationKind.OnError)
- return false;
- return Object.Equals(Exception, other.Exception);
- }
-
- /// <summary>
- /// Returns a string representation of this instance.
- /// </summary>
- public override string ToString()
- {
- return String.Format(CultureInfo.CurrentCulture, "OnError({0})", Exception.GetType().FullName);
- }
-
- /// <summary>
- /// Invokes the observer's method corresponding to the notification.
- /// </summary>
- /// <param name="observer">Observer to invoke the notification on.</param>
- public override void Accept(IObserver<T> observer)
- {
- if (observer == null)
- throw new ArgumentNullException("observer");
-
- observer.OnError(Exception);
- }
-
- /// <summary>
- /// Invokes the observer's method corresponding to the notification and returns the produced result.
- /// </summary>
- /// <param name="observer">Observer to invoke the notification on.</param>
- /// <returns>Result produced by the observation.</returns>
- public override TResult Accept<TResult>(IObserver<T, TResult> observer)
- {
- if (observer == null)
- throw new ArgumentNullException("observer");
-
- return observer.OnError(Exception);
- }
-
- /// <summary>
- /// Invokes the delegate corresponding to the notification.
- /// </summary>
- /// <param name="onNext">Delegate to invoke for an OnNext notification.</param>
- /// <param name="onError">Delegate to invoke for an OnError notification.</param>
- /// <param name="onCompleted">Delegate to invoke for an OnCompleted notification.</param>
- public override void Accept(Action<T> onNext, Action<Exception> onError, Action onCompleted)
- {
- if (onNext == null)
- throw new ArgumentNullException("onNext");
- if (onError == null)
- throw new ArgumentNullException("onError");
- if (onCompleted == null)
- throw new ArgumentNullException("onCompleted");
-
- onError(Exception);
- }
-
- /// <summary>
- /// Invokes the delegate corresponding to the notification and returns the produced result.
- /// </summary>
- /// <param name="onNext">Delegate to invoke for an OnNext notification.</param>
- /// <param name="onError">Delegate to invoke for an OnError notification.</param>
- /// <param name="onCompleted">Delegate to invoke for an OnCompleted notification.</param>
- /// <returns>Result produced by the observation.</returns>
- public override TResult Accept<TResult>(Func<T, TResult> onNext, Func<Exception, TResult> onError, Func<TResult> onCompleted)
- {
- if (onNext == null)
- throw new ArgumentNullException("onNext");
- if (onError == null)
- throw new ArgumentNullException("onError");
- if (onCompleted == null)
- throw new ArgumentNullException("onCompleted");
-
- return onError(Exception);
- }
- }
-
- /// <summary>
- /// Represents an OnCompleted notification to an observer.
- /// </summary>
-#if !NO_DEBUGGER_ATTRIBUTES
- [DebuggerDisplay("OnCompleted()")]
-#endif
-#if !NO_SERIALIZABLE
- [Serializable]
-#endif
- internal sealed class OnCompletedNotification : Notification<T>
- {
- /// <summary>
- /// Constructs a notification of the end of a sequence.
- /// </summary>
- public OnCompletedNotification()
- {
- }
-
- /// <summary>
- /// Throws an InvalidOperationException.
- /// </summary>
- public override T Value { get { throw new InvalidOperationException(Strings_Core.COMPLETED_NO_VALUE); } }
-
- /// <summary>
- /// Returns null.
- /// </summary>
- public override Exception Exception { get { return null; } }
-
- /// <summary>
- /// Returns false.
- /// </summary>
- public override bool HasValue { get { return false; } }
-
- /// <summary>
- /// Returns NotificationKind.OnCompleted.
- /// </summary>
- public override NotificationKind Kind { get { return NotificationKind.OnCompleted; } }
-
- /// <summary>
- /// Returns the hash code for this instance.
- /// </summary>
- public override int GetHashCode()
- {
- return typeof(T).GetHashCode() ^ 8510;
- }
-
- /// <summary>
- /// Indicates whether this instance and other are equal.
- /// </summary>
- public override bool Equals(Notification<T> other)
- {
- if (Object.ReferenceEquals(this, other))
- return true;
- if (Object.ReferenceEquals(other, null))
- return false;
- return other.Kind == NotificationKind.OnCompleted;
- }
-
- /// <summary>
- /// Returns a string representation of this instance.
- /// </summary>
- public override string ToString()
- {
- return "OnCompleted()";
- }
-
- /// <summary>
- /// Invokes the observer's method corresponding to the notification.
- /// </summary>
- /// <param name="observer">Observer to invoke the notification on.</param>
- public override void Accept(IObserver<T> observer)
- {
- if (observer == null)
- throw new ArgumentNullException("observer");
-
- observer.OnCompleted();
- }
-
- /// <summary>
- /// Invokes the observer's method corresponding to the notification and returns the produced result.
- /// </summary>
- /// <param name="observer">Observer to invoke the notification on.</param>
- /// <returns>Result produced by the observation.</returns>
- public override TResult Accept<TResult>(IObserver<T, TResult> observer)
- {
- if (observer == null)
- throw new ArgumentNullException("observer");
-
- return observer.OnCompleted();
- }
-
- /// <summary>
- /// Invokes the delegate corresponding to the notification.
- /// </summary>
- /// <param name="onNext">Delegate to invoke for an OnNext notification.</param>
- /// <param name="onError">Delegate to invoke for an OnError notification.</param>
- /// <param name="onCompleted">Delegate to invoke for an OnCompleted notification.</param>
- public override void Accept(Action<T> onNext, Action<Exception> onError, Action onCompleted)
- {
- if (onNext == null)
- throw new ArgumentNullException("onNext");
- if (onError == null)
- throw new ArgumentNullException("onError");
- if (onCompleted == null)
- throw new ArgumentNullException("onCompleted");
-
- onCompleted();
- }
-
- /// <summary>
- /// Invokes the delegate corresponding to the notification and returns the produced result.
- /// </summary>
- /// <param name="onNext">Delegate to invoke for an OnNext notification.</param>
- /// <param name="onError">Delegate to invoke for an OnError notification.</param>
- /// <param name="onCompleted">Delegate to invoke for an OnCompleted notification.</param>
- /// <returns>Result produced by the observation.</returns>
- public override TResult Accept<TResult>(Func<T, TResult> onNext, Func<Exception, TResult> onError, Func<TResult> onCompleted)
- {
- if (onNext == null)
- throw new ArgumentNullException("onNext");
- if (onError == null)
- throw new ArgumentNullException("onError");
- if (onCompleted == null)
- throw new ArgumentNullException("onCompleted");
-
- return onCompleted();
- }
- }
-
- /// <summary>
- /// Determines whether the current Notification&lt;T&gt; object has the same observer message payload as a specified Notification&lt;T&gt; value.
- /// </summary>
- /// <param name="other">An object to compare to the current Notification&lt;T&gt; object.</param>
- /// <returns>true if both Notification&lt;T&gt; objects have the same observer message payload; otherwise, false.</returns>
- /// <remarks>
- /// Equality of Notification&lt;T&gt; objects is based on the equality of the observer message payload they represent, including the notification Kind and the Value or Exception (if any).
- /// This means two Notification&lt;T&gt; objects can be equal even though they don't represent the same observer method call, but have the same Kind and have equal parameters passed to the observer method.
- /// In case one wants to determine whether two Notification&lt;T&gt; objects represent the same observer method call, use Object.ReferenceEquals identity equality instead.
- /// </remarks>
- public abstract bool Equals(Notification<T> other);
-
- /// <summary>
- /// Determines whether the two specified Notification&lt;T&gt; objects have the same observer message payload.
- /// </summary>
- /// <param name="left">The first Notification&lt;T&gt; to compare, or null.</param>
- /// <param name="right">The second Notification&lt;T&gt; to compare, or null.</param>
- /// <returns>true if the first Notification&lt;T&gt; value has the same observer message payload as the second Notification&lt;T&gt; value; otherwise, false.</returns>
- /// <remarks>
- /// Equality of Notification&lt;T&gt; objects is based on the equality of the observer message payload they represent, including the notification Kind and the Value or Exception (if any).
- /// This means two Notification&lt;T&gt; objects can be equal even though they don't represent the same observer method call, but have the same Kind and have equal parameters passed to the observer method.
- /// In case one wants to determine whether two Notification&lt;T&gt; objects represent the same observer method call, use Object.ReferenceEquals identity equality instead.
- /// </remarks>
- public static bool operator ==(Notification<T> left, Notification<T> right)
- {
- if (object.ReferenceEquals(left, right))
- return true;
-
- if ((object)left == null || (object)right == null)
- return false;
-
- return left.Equals(right);
- }
-
- /// <summary>
- /// Determines whether the two specified Notification&lt;T&gt; objects have a different observer message payload.
- /// </summary>
- /// <param name="left">The first Notification&lt;T&gt; to compare, or null.</param>
- /// <param name="right">The second Notification&lt;T&gt; to compare, or null.</param>
- /// <returns>true if the first Notification&lt;T&gt; value has a different observer message payload as the second Notification&lt;T&gt; value; otherwise, false.</returns>
- /// <remarks>
- /// Equality of Notification&lt;T&gt; objects is based on the equality of the observer message payload they represent, including the notification Kind and the Value or Exception (if any).
- /// This means two Notification&lt;T&gt; objects can be equal even though they don't represent the same observer method call, but have the same Kind and have equal parameters passed to the observer method.
- /// In case one wants to determine whether two Notification&lt;T&gt; objects represent a different observer method call, use Object.ReferenceEquals identity equality instead.
- /// </remarks>
- public static bool operator !=(Notification<T> left, Notification<T> right)
- {
- return !(left == right);
- }
-
- /// <summary>
- /// Determines whether the specified System.Object is equal to the current Notification&lt;T&gt;.
- /// </summary>
- /// <param name="obj">The System.Object to compare with the current Notification&lt;T&gt;.</param>
- /// <returns>true if the specified System.Object is equal to the current Notification&lt;T&gt;; otherwise, false.</returns>
- /// <remarks>
- /// Equality of Notification&lt;T&gt; objects is based on the equality of the observer message payload they represent, including the notification Kind and the Value or Exception (if any).
- /// This means two Notification&lt;T&gt; objects can be equal even though they don't represent the same observer method call, but have the same Kind and have equal parameters passed to the observer method.
- /// In case one wants to determine whether two Notification&lt;T&gt; objects represent the same observer method call, use Object.ReferenceEquals identity equality instead.
- /// </remarks>
- public override bool Equals(object obj)
- {
- return Equals(obj as Notification<T>);
- }
-
- /// <summary>
- /// Invokes the observer's method corresponding to the notification.
- /// </summary>
- /// <param name="observer">Observer to invoke the notification on.</param>
- public abstract void Accept(IObserver<T> observer);
-
- /// <summary>
- /// Invokes the observer's method corresponding to the notification and returns the produced result.
- /// </summary>
- /// <typeparam name="TResult">The type of the result returned from the observer's notification handlers.</typeparam>
- /// <param name="observer">Observer to invoke the notification on.</param>
- /// <returns>Result produced by the observation.</returns>
- public abstract TResult Accept<TResult>(IObserver<T, TResult> observer);
-
- /// <summary>
- /// Invokes the delegate corresponding to the notification.
- /// </summary>
- /// <param name="onNext">Delegate to invoke for an OnNext notification.</param>
- /// <param name="onError">Delegate to invoke for an OnError notification.</param>
- /// <param name="onCompleted">Delegate to invoke for an OnCompleted notification.</param>
- public abstract void Accept(Action<T> onNext, Action<Exception> onError, Action onCompleted);
-
- /// <summary>
- /// Invokes the delegate corresponding to the notification and returns the produced result.
- /// </summary>
- /// <typeparam name="TResult">The type of the result returned from the notification handler delegates.</typeparam>
- /// <param name="onNext">Delegate to invoke for an OnNext notification.</param>
- /// <param name="onError">Delegate to invoke for an OnError notification.</param>
- /// <param name="onCompleted">Delegate to invoke for an OnCompleted notification.</param>
- /// <returns>Result produced by the observation.</returns>
- public abstract TResult Accept<TResult>(Func<T, TResult> onNext, Func<Exception, TResult> onError, Func<TResult> onCompleted);
-
- /// <summary>
- /// Returns an observable sequence with a single notification, using the immediate scheduler.
- /// </summary>
- /// <returns>The observable sequence that surfaces the behavior of the notification upon subscription.</returns>
- public IObservable<T> ToObservable()
- {
- return this.ToObservable(ImmediateScheduler.Instance);
- }
-
- /// <summary>
- /// Returns an observable sequence with a single notification.
- /// </summary>
- /// <param name="scheduler">Scheduler to send out the notification calls on.</param>
- /// <returns>The observable sequence that surfaces the behavior of the notification upon subscription.</returns>
- public IObservable<T> ToObservable(IScheduler scheduler)
- {
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return new AnonymousObservable<T>(observer => scheduler.Schedule(() =>
- {
- this.Accept(observer);
- if (this.Kind == NotificationKind.OnNext)
- observer.OnCompleted();
- }));
- }
- }
-
- /// <summary>
- /// Provides a set of static methods for constructing notifications.
- /// </summary>
- public static class Notification
- {
- /// <summary>
- /// Creates an object that represents an OnNext notification to an observer.
- /// </summary>
- /// <typeparam name="T">The type of the elements received by the observer. Upon dematerialization of the notifications into an observable sequence, this type is used as the element type for the sequence.</typeparam>
- /// <param name="value">The value contained in the notification.</param>
- /// <returns>The OnNext notification containing the value.</returns>
- public static Notification<T> CreateOnNext<T>(T value)
- {
- return new Notification<T>.OnNextNotification(value);
- }
-
- /// <summary>
- /// Creates an object that represents an OnError notification to an observer.
- /// </summary>
- /// <typeparam name="T">The type of the elements received by the observer. Upon dematerialization of the notifications into an observable sequence, this type is used as the element type for the sequence.</typeparam>
- /// <param name="error">The exception contained in the notification.</param>
- /// <returns>The OnError notification containing the exception.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="error"/> is null.</exception>
- public static Notification<T> CreateOnError<T>(Exception error)
- {
- if (error == null)
- throw new ArgumentNullException("error");
-
- return new Notification<T>.OnErrorNotification(error);
- }
-
- /// <summary>
- /// Creates an object that represents an OnCompleted notification to an observer.
- /// </summary>
- /// <typeparam name="T">The type of the elements received by the observer. Upon dematerialization of the notifications into an observable sequence, this type is used as the element type for the sequence.</typeparam>
- /// <returns>The OnCompleted notification.</returns>
- public static Notification<T> CreateOnCompleted<T>()
- {
- return new Notification<T>.OnCompletedNotification();
- }
- }
-}
-
-#pragma warning restore 0659
-#pragma warning restore 0661 \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Core/Reactive/ObservableBase.cs b/Rx.NET/System.Reactive.Core/Reactive/ObservableBase.cs
deleted file mode 100644
index 8945b2f..0000000
--- a/Rx.NET/System.Reactive.Core/Reactive/ObservableBase.cs
+++ /dev/null
@@ -1,107 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System.Reactive.Concurrency;
-using System.Reactive.Disposables;
-
-namespace System.Reactive
-{
- /// <summary>
- /// Abstract base class for implementations of the IObservable&lt;T&gt; interface.
- /// </summary>
- /// <remarks>
- /// If you don't need a named type to create an observable sequence (i.e. you rather need
- /// an instance rather than a reusable type), use the Observable.Create method to create
- /// an observable sequence with specified subscription behavior.
- /// </remarks>
- /// <typeparam name="T">The type of the elements in the sequence.</typeparam>
- public abstract class ObservableBase<T> : IObservable<T>
- {
- /// <summary>
- /// Subscribes the given observer to the observable sequence.
- /// </summary>
- /// <param name="observer">Observer that will receive notifications from the observable sequence.</param>
- /// <returns>Disposable object representing an observer's subscription to the observable sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="observer"/> is null.</exception>
- public IDisposable Subscribe(IObserver<T> observer)
- {
- if (observer == null)
- throw new ArgumentNullException("observer");
-
- var autoDetachObserver = new AutoDetachObserver<T>(observer);
-
- if (CurrentThreadScheduler.IsScheduleRequired)
- {
- //
- // Notice we don't protect this piece of code using an exception handler to
- // redirect errors to the OnError channel. This call to Schedule will run the
- // trampoline, so we'd be catching all exceptions, including those from user
- // callbacks that happen to run there. For example, consider:
- //
- // Observable.Return(42, Scheduler.CurrentThread)
- // .Subscribe(x => { throw new Exception(); });
- //
- // Here, the OnNext(42) call would be scheduled on the trampoline, so when we
- // return from the scheduled Subscribe call, the CurrentThreadScheduler moves
- // on to invoking this work item. Too much of protection here would cause the
- // exception thrown in OnNext to circle back to OnError, which looks like the
- // sequence can't make up its mind.
- //
- CurrentThreadScheduler.Instance.Schedule(autoDetachObserver, ScheduledSubscribe);
- }
- else
- {
- try
- {
- autoDetachObserver.Disposable = SubscribeCore(autoDetachObserver);
- }
- catch (Exception exception)
- {
- //
- // This can happen when there's a synchronous callback to OnError in the
- // implementation of SubscribeCore, which also throws. So, we're seeing
- // an exception being thrown from a handler.
- //
- // For compat with v1.x, we rethrow the exception in this case, keeping
- // in mind this should be rare but if it happens, something's totally
- // screwed up.
- //
- if (!autoDetachObserver.Fail(exception))
- throw;
- }
- }
-
- return autoDetachObserver;
- }
-
- private IDisposable ScheduledSubscribe(IScheduler _, AutoDetachObserver<T> autoDetachObserver)
- {
- try
- {
- autoDetachObserver.Disposable = SubscribeCore(autoDetachObserver);
- }
- catch (Exception exception)
- {
- //
- // This can happen when there's a synchronous callback to OnError in the
- // implementation of SubscribeCore, which also throws. So, we're seeing
- // an exception being thrown from a handler.
- //
- // For compat with v1.x, we rethrow the exception in this case, keeping
- // in mind this should be rare but if it happens, something's totally
- // screwed up.
- //
- if (!autoDetachObserver.Fail(exception))
- throw;
- }
-
- return Disposable.Empty;
- }
-
- /// <summary>
- /// Implement this method with the core subscription logic for the observable sequence.
- /// </summary>
- /// <param name="observer">Observer to send notifications to.</param>
- /// <returns>Disposable object representing an observer's subscription to the observable sequence.</returns>
- protected abstract IDisposable SubscribeCore(IObserver<T> observer);
- }
-}
diff --git a/Rx.NET/System.Reactive.Core/Reactive/ObserverBase.cs b/Rx.NET/System.Reactive.Core/Reactive/ObserverBase.cs
deleted file mode 100644
index 389a923..0000000
--- a/Rx.NET/System.Reactive.Core/Reactive/ObserverBase.cs
+++ /dev/null
@@ -1,114 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System.Threading;
-
-namespace System.Reactive
-{
- /// <summary>
- /// Abstract base class for implementations of the IObserver&lt;T&gt; interface.
- /// </summary>
- /// <remarks>This base class enforces the grammar of observers where OnError and OnCompleted are terminal messages.</remarks>
- /// <typeparam name="T">The type of the elements in the sequence.</typeparam>
- public abstract class ObserverBase<T> : IObserver<T>, IDisposable
- {
- private int isStopped;
-
- /// <summary>
- /// Creates a new observer in a non-stopped state.
- /// </summary>
- protected ObserverBase()
- {
- isStopped = 0;
- }
-
- /// <summary>
- /// Notifies the observer of a new element in the sequence.
- /// </summary>
- /// <param name="value">Next element in the sequence.</param>
- public void OnNext(T value)
- {
- if (isStopped == 0)
- OnNextCore(value);
- }
-
- /// <summary>
- /// Implement this method to react to the receival of a new element in the sequence.
- /// </summary>
- /// <param name="value">Next element in the sequence.</param>
- /// <remarks>This method only gets called when the observer hasn't stopped yet.</remarks>
- protected abstract void OnNextCore(T value);
-
- /// <summary>
- /// Notifies the observer that an exception has occurred.
- /// </summary>
- /// <param name="error">The error that has occurred.</param>
- /// <exception cref="ArgumentNullException"><paramref name="error"/> is null.</exception>
- public void OnError(Exception error)
- {
- if (error == null)
- throw new ArgumentNullException("error");
-
- if (Interlocked.Exchange(ref isStopped, 1) == 0)
- {
- OnErrorCore(error);
- }
- }
-
- /// <summary>
- /// Implement this method to react to the occurrence of an exception.
- /// </summary>
- /// <param name="error">The error that has occurred.</param>
- /// <remarks>This method only gets called when the observer hasn't stopped yet, and causes the observer to stop.</remarks>
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Error", Justification = "Same name as in the IObserver<T> definition of OnError in the BCL.")]
- protected abstract void OnErrorCore(Exception error);
-
- /// <summary>
- /// Notifies the observer of the end of the sequence.
- /// </summary>
- public void OnCompleted()
- {
- if (Interlocked.Exchange(ref isStopped, 1) == 0)
- {
- OnCompletedCore();
- }
- }
-
- /// <summary>
- /// Implement this method to react to the end of the sequence.
- /// </summary>
- /// <remarks>This method only gets called when the observer hasn't stopped yet, and causes the observer to stop.</remarks>
- protected abstract void OnCompletedCore();
-
- /// <summary>
- /// Disposes the observer, causing it to transition to the stopped state.
- /// </summary>
- public void Dispose()
- {
- Dispose(true);
- GC.SuppressFinalize(this);
- }
-
- /// <summary>
- /// Core implementation of IDisposable.
- /// </summary>
- /// <param name="disposing">true if the Dispose call was triggered by the IDisposable.Dispose method; false if it was triggered by the finalizer.</param>
- protected virtual void Dispose(bool disposing)
- {
- if (disposing)
- {
- isStopped = 1;
- }
- }
-
- internal bool Fail(Exception error)
- {
- if (Interlocked.Exchange(ref isStopped, 1) == 0)
- {
- OnErrorCore(error);
- return true;
- }
-
- return false;
- }
- }
-}
diff --git a/Rx.NET/System.Reactive.Core/Reactive/Unit.cs b/Rx.NET/System.Reactive.Core/Reactive/Unit.cs
deleted file mode 100644
index 4d3429b..0000000
--- a/Rx.NET/System.Reactive.Core/Reactive/Unit.cs
+++ /dev/null
@@ -1,82 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-namespace System.Reactive
-{
- /// <summary>
- /// Represents a type with a single value. This type is often used to denote the successful completion of a void-returning method (C#) or a Sub procedure (Visual Basic).
- /// </summary>
-#if !NO_SERIALIZABLE
- [Serializable]
-#endif
- public struct Unit : IEquatable<Unit>
- {
- /// <summary>
- /// Determines whether the specified Unit values is equal to the current Unit. Because Unit has a single value, this always returns true.
- /// </summary>
- /// <param name="other">An object to compare to the current Unit value.</param>
- /// <returns>Because Unit has a single value, this always returns true.</returns>
- public bool Equals(Unit other)
- {
- return true;
- }
-
- /// <summary>
- /// Determines whether the specified System.Object is equal to the current Unit.
- /// </summary>
- /// <param name="obj">The System.Object to compare with the current Unit.</param>
- /// <returns>true if the specified System.Object is a Unit value; otherwise, false.</returns>
- public override bool Equals(object obj)
- {
- return obj is Unit;
- }
-
- /// <summary>
- /// Returns the hash code for the current Unit value.
- /// </summary>
- /// <returns>A hash code for the current Unit value.</returns>
- public override int GetHashCode()
- {
- return 0;
- }
-
- /// <summary>
- /// Returns a string representation of the current Unit value.
- /// </summary>
- /// <returns>String representation of the current Unit value.</returns>
- public override string ToString()
- {
- return "()";
- }
-
- /// <summary>
- /// Determines whether the two specified Unit values are equal. Because Unit has a single value, this always returns true.
- /// </summary>
- /// <param name="first">The first Unit value to compare.</param>
- /// <param name="second">The second Unit value to compare.</param>
- /// <returns>Because Unit has a single value, this always returns true.</returns>
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId = "first", Justification = "Parameter required for operator overloading."), System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId = "second", Justification = "Parameter required for operator overloading.")]
- public static bool operator ==(Unit first, Unit second)
- {
- return true;
- }
-
- /// <summary>
- /// Determines whether the two specified Unit values are not equal. Because Unit has a single value, this always returns false.
- /// </summary>
- /// <param name="first">The first Unit value to compare.</param>
- /// <param name="second">The second Unit value to compare.</param>
- /// <returns>Because Unit has a single value, this always returns false.</returns>
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId = "first", Justification = "Parameter required for operator overloading."), System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId = "second", Justification = "Parameter required for operator overloading.")]
- public static bool operator !=(Unit first, Unit second)
- {
- return false;
- }
-
- static readonly Unit _default = new Unit();
-
- /// <summary>
- /// Gets the single unit value.
- /// </summary>
- public static Unit Default { get { return _default; } }
- }
-}
diff --git a/Rx.NET/System.Reactive.Core/Strings_Core.Generated.cs b/Rx.NET/System.Reactive.Core/Strings_Core.Generated.cs
deleted file mode 100644
index 3e9a82e..0000000
--- a/Rx.NET/System.Reactive.Core/Strings_Core.Generated.cs
+++ /dev/null
@@ -1,172 +0,0 @@
-/*
- * This file is manually generated upon every change to the corresponding .resx file, using the built-in code generator.
- * However, we can't use auto-generated code because the output is different for .NET 4.5 for Metro and PLIB, due to
- * changes in the reflection APIs (search for CRIPPLED_REFLECTION in this file), and because regeneration doesn't happen
- * as part of build, but rather at design time in Visual Studio. While we likely could tweak MSBuild to force regeneration
- * using the right version of ResGen.exe, this approach turned out to be the easiest for the time being.
- *
- * Upon adding entries to the ResX file, regenerate this file, put this comment back, and make sure to add the #if checks
- * for conditional use of the right flavor of reflection (using the CRIPPLED_REFLECTION defined symbol).
- */
-
-// Required for the use of the GetTypeInfo extension method.
-#if CRIPPLED_REFLECTION
-using System.Reflection;
-#endif
-
-// GENERATED CODE starts here
-
-namespace System.Reactive
-{
- using System;
-
-
- /// <summary>
- /// A strongly-typed resource class, for looking up localized strings, etc.
- /// </summary>
- // This class was auto-generated by the StronglyTypedResourceBuilder
- // class via a tool like ResGen or Visual Studio.
- // To add or remove a member, edit your .ResX file then rerun ResGen
- // with the /str option, or rebuild your VS project.
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- internal class Strings_Core
- {
-
- private static global::System.Resources.ResourceManager resourceMan;
-
- private static global::System.Globalization.CultureInfo resourceCulture;
-
- [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
- internal Strings_Core()
- {
- }
-
- /// <summary>
- /// Returns the cached ResourceManager instance used by this class.
- /// </summary>
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Resources.ResourceManager ResourceManager
- {
- get
- {
- if (object.ReferenceEquals(resourceMan, null))
- {
-#if CRIPPLED_REFLECTION
- global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("System.Reactive.Strings_Core", typeof(Strings_Core).GetTypeInfo().Assembly);
-#else
- global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("System.Reactive.Strings_Core", typeof(Strings_Core).Assembly);
-#endif
- resourceMan = temp;
- }
- return resourceMan;
- }
- }
-
- /// <summary>
- /// Overrides the current thread's CurrentUICulture property for all
- /// resource lookups using this strongly typed resource class.
- /// </summary>
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Globalization.CultureInfo Culture
- {
- get
- {
- return resourceCulture;
- }
- set
- {
- resourceCulture = value;
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Using the Scheduler.{0} property is no longer supported due to refactoring of the API surface and elimination of platform-specific dependencies. Please include System.Reactive.PlatformServices for your target platform and use the {0}Scheduler type instead..
- /// </summary>
- internal static string CANT_OBTAIN_SCHEDULER
- {
- get
- {
- return ResourceManager.GetString("CANT_OBTAIN_SCHEDULER", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to OnCompleted notification doesn&apos;t have a value..
- /// </summary>
- internal static string COMPLETED_NO_VALUE
- {
- get
- {
- return ResourceManager.GetString("COMPLETED_NO_VALUE", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Disposable has already been assigned..
- /// </summary>
- internal static string DISPOSABLE_ALREADY_ASSIGNED
- {
- get
- {
- return ResourceManager.GetString("DISPOSABLE_ALREADY_ASSIGNED", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Failed to start monitoring system clock changes..
- /// </summary>
- internal static string FAILED_CLOCK_MONITORING
- {
- get
- {
- return ResourceManager.GetString("FAILED_CLOCK_MONITORING", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Heap is empty..
- /// </summary>
- internal static string HEAP_EMPTY
- {
- get
- {
- return ResourceManager.GetString("HEAP_EMPTY", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Reentrancy has been detected..
- /// </summary>
- internal static string REENTRANCY_DETECTED
- {
- get
- {
- return ResourceManager.GetString("REENTRANCY_DETECTED", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Observer has already terminated..
- /// </summary>
- internal static string OBSERVER_TERMINATED
- {
- get
- {
- return ResourceManager.GetString("OBSERVER_TERMINATED", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to This scheduler operation has already been awaited..
- /// </summary>
- internal static string SCHEDULER_OPERATION_ALREADY_AWAITED
- {
- get
- {
- return ResourceManager.GetString("SCHEDULER_OPERATION_ALREADY_AWAITED", resourceCulture);
- }
- }
- }
-}
diff --git a/Rx.NET/System.Reactive.Core/Strings_Core.resx b/Rx.NET/System.Reactive.Core/Strings_Core.resx
deleted file mode 100644
index 253ca99..0000000
--- a/Rx.NET/System.Reactive.Core/Strings_Core.resx
+++ /dev/null
@@ -1,145 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<root>
- <!--
- Microsoft ResX Schema
-
- Version 2.0
-
- The primary goals of this format is to allow a simple XML format
- that is mostly human readable. The generation and parsing of the
- various data types are done through the TypeConverter classes
- associated with the data types.
-
- Example:
-
- ... ado.net/XML headers & schema ...
- <resheader name="resmimetype">text/microsoft-resx</resheader>
- <resheader name="version">2.0</resheader>
- <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
- <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
- <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
- <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
- <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
- <value>[base64 mime encoded serialized .NET Framework object]</value>
- </data>
- <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
- <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
- <comment>This is a comment</comment>
- </data>
-
- There are any number of "resheader" rows that contain simple
- name/value pairs.
-
- Each data row contains a name, and value. The row also contains a
- type or mimetype. Type corresponds to a .NET class that support
- text/value conversion through the TypeConverter architecture.
- Classes that don't support this are serialized and stored with the
- mimetype set.
-
- The mimetype is used for serialized objects, and tells the
- ResXResourceReader how to depersist the object. This is currently not
- extensible. For a given mimetype the value must be set accordingly:
-
- Note - application/x-microsoft.net.object.binary.base64 is the format
- that the ResXResourceWriter will generate, however the reader can
- read any of the formats listed below.
-
- mimetype: application/x-microsoft.net.object.binary.base64
- value : The object must be serialized with
- : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
- : and then encoded with base64 encoding.
-
- mimetype: application/x-microsoft.net.object.soap.base64
- value : The object must be serialized with
- : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
- : and then encoded with base64 encoding.
-
- mimetype: application/x-microsoft.net.object.bytearray.base64
- value : The object must be serialized into a byte array
- : using a System.ComponentModel.TypeConverter
- : and then encoded with base64 encoding.
- -->
- <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
- <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
- <xsd:element name="root" msdata:IsDataSet="true">
- <xsd:complexType>
- <xsd:choice maxOccurs="unbounded">
- <xsd:element name="metadata">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="value" type="xsd:string" minOccurs="0" />
- </xsd:sequence>
- <xsd:attribute name="name" use="required" type="xsd:string" />
- <xsd:attribute name="type" type="xsd:string" />
- <xsd:attribute name="mimetype" type="xsd:string" />
- <xsd:attribute ref="xml:space" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="assembly">
- <xsd:complexType>
- <xsd:attribute name="alias" type="xsd:string" />
- <xsd:attribute name="name" type="xsd:string" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="data">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
- <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
- </xsd:sequence>
- <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
- <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
- <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
- <xsd:attribute ref="xml:space" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="resheader">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
- </xsd:sequence>
- <xsd:attribute name="name" type="xsd:string" use="required" />
- </xsd:complexType>
- </xsd:element>
- </xsd:choice>
- </xsd:complexType>
- </xsd:element>
- </xsd:schema>
- <resheader name="resmimetype">
- <value>text/microsoft-resx</value>
- </resheader>
- <resheader name="version">
- <value>2.0</value>
- </resheader>
- <resheader name="reader">
- <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
- </resheader>
- <resheader name="writer">
- <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
- </resheader>
- <data name="CANT_OBTAIN_SCHEDULER" xml:space="preserve">
- <value>Using the Scheduler.{0} property is no longer supported due to refactoring of the API surface and elimination of platform-specific dependencies. Please include System.Reactive.PlatformServices for your target platform and use the {0}Scheduler type instead. If you're building a Windows Store app, notice some schedulers are no longer supported. Consider using Scheduler.Default instead.</value>
- </data>
- <data name="COMPLETED_NO_VALUE" xml:space="preserve">
- <value>OnCompleted notification doesn't have a value.</value>
- </data>
- <data name="DISPOSABLE_ALREADY_ASSIGNED" xml:space="preserve">
- <value>Disposable has already been assigned.</value>
- </data>
- <data name="FAILED_CLOCK_MONITORING" xml:space="preserve">
- <value>Failed to start monitoring system clock changes.</value>
- </data>
- <data name="HEAP_EMPTY" xml:space="preserve">
- <value>Heap is empty.</value>
- </data>
- <data name="OBSERVER_TERMINATED" xml:space="preserve">
- <value>Observer has already terminated.</value>
- </data>
- <data name="REENTRANCY_DETECTED" xml:space="preserve">
- <value>Reentrancy has been detected.</value>
- </data>
- <data name="SCHEDULER_OPERATION_ALREADY_AWAITED" xml:space="preserve">
- <value>This scheduler operation has already been awaited.</value>
- <comment>Only on .NET 4.5 and above.</comment>
- </data>
-</root> \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Core/System.Reactive.Core.csproj b/Rx.NET/System.Reactive.Core/System.Reactive.Core.csproj
deleted file mode 100644
index bf37f0c..0000000
--- a/Rx.NET/System.Reactive.Core/System.Reactive.Core.csproj
+++ /dev/null
@@ -1,127 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <ProductVersion>8.0.30703</ProductVersion>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{4E516F10-DA7A-4D43-963E-A93865ABEA5B}</ProjectGuid>
- <OutputType>Library</OutputType>
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <RootNamespace>System.Reactive</RootNamespace>
- <AssemblyName>System.Reactive.Core</AssemblyName>
- <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
- <FileAlignment>512</FileAlignment>
- <ProductSignAssembly>true</ProductSignAssembly>
- <CodeAnalysisRuleSet>..\Rx.ruleset</CodeAnalysisRuleSet>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'ReleaseXBLV|AnyCPU'">
- <OutputPath>bin\ReleaseXBLV\</OutputPath>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'DebugXBLV|AnyCPU'">
- <OutputPath>bin\DebugXBLV\</OutputPath>
- </PropertyGroup>
- <Import Project="..\Common.targets" />
- <PropertyGroup>
- <DocumentationFile>$(OutputPath)\$(AssemblyName).XML</DocumentationFile>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)' == 'DebugPL' Or '$(Configuration)' == 'ReleasePL' ">
- <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
- <TargetFrameworkProfile>Profile7</TargetFrameworkProfile>
- </PropertyGroup>
- <ItemGroup>
- <Reference Include="mscorlib" Condition=" '$(BuildPlatform)' == 'SILVERLIGHT' Or '$(BuildPlatform)' == 'XNA' " />
- <Reference Include="System" />
- <Reference Include="System.Core" />
- <Reference Include="System.Observable" Condition=" '$(BuildFlavor)' == 'SILVERLIGHTM7' " />
- <Reference Include="Microsoft.Phone" Condition=" '$(BuildFlavor)' == 'SILVERLIGHTM7' " />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="GlobalSuppressions.cs" />
- <Compile Include="InternalsVisibleTo.cs" />
- <Compile Include="NamespaceDocs.cs" />
- <Compile Include="Observable.Extensions.cs" />
- <Compile Include="Observer.Extensions.cs" />
- <Compile Include="Properties\AssemblyInfo.cs" />
- <Compile Include="Reactive\AnonymousObservable.cs" />
- <Compile Include="Reactive\AnonymousObserver.cs" />
- <Compile Include="Reactive\AnonymousSafeObserver.cs" />
- <Compile Include="Reactive\Concurrency\AsyncLock.cs" />
- <Compile Include="Reactive\Concurrency\CatchScheduler.cs" />
- <Compile Include="Reactive\Concurrency\ConcurrencyAbstractionLayer.cs" />
- <Compile Include="Reactive\Concurrency\ConcurrencyAbstractionLayer.Default.cs" />
- <Compile Include="Reactive\Concurrency\Scheduler.Wrappers.cs" />
- <Compile Include="Reactive\Concurrency\DisableOptimizationsScheduler.cs" />
- <Compile Include="Reactive\Concurrency\Scheduler.Services.Emulation.cs" />
- <Compile Include="Reactive\Concurrency\LocalScheduler.TimerQueue.cs" />
- <Compile Include="Reactive\Concurrency\Scheduler.Services.cs" />
- <Compile Include="Reactive\Concurrency\CurrentThreadScheduler.cs" />
- <Compile Include="Reactive\Concurrency\ImmediateScheduler.cs" />
- <Compile Include="Reactive\Concurrency\LocalScheduler.cs" />
- <Compile Include="Reactive\Concurrency\ScheduledItem.cs" />
- <Compile Include="Reactive\Concurrency\Scheduler.Async.cs" />
- <Compile Include="Reactive\Concurrency\Scheduler.cs" />
- <Compile Include="Reactive\Concurrency\Scheduler.Recursive.cs" />
- <Compile Include="Reactive\Concurrency\Scheduler.Simple.cs" />
- <Compile Include="Reactive\Concurrency\SchedulerDefaults.cs" />
- <Compile Include="Reactive\Concurrency\SchedulerOperation.cs" />
- <Compile Include="Reactive\Concurrency\SchedulerQueue.cs" />
- <Compile Include="Reactive\Concurrency\SchedulerWrapper.cs" />
- <Compile Include="Reactive\Concurrency\Stopwatch.Default.cs" />
- <Compile Include="Reactive\Concurrency\Synchronization.cs" />
- <Compile Include="Reactive\Concurrency\Synchronization.ObserveOn.cs" />
- <Compile Include="Reactive\Concurrency\Synchronization.Synchronize.cs" />
- <Compile Include="Reactive\Concurrency\SynchronizationContextScheduler.cs" />
- <Compile Include="Reactive\Concurrency\DefaultScheduler.cs" />
- <Compile Include="Reactive\Internal\AsyncLockObserver.cs" />
- <Compile Include="Reactive\Internal\CheckedObserver.cs" />
- <Compile Include="Reactive\Internal\ConcurrentDictionary.cs" />
- <Compile Include="Reactive\Internal\ConcurrentQueue.cs" />
- <Compile Include="Reactive\Internal\Constants.cs" />
- <Compile Include="Reactive\Disposables\AnonymousDisposable.cs" />
- <Compile Include="Reactive\Disposables\BooleanDisposable.cs" />
- <Compile Include="Reactive\Disposables\CancellationDisposable.cs" />
- <Compile Include="Reactive\Disposables\CompositeDisposable.cs" />
- <Compile Include="Reactive\Disposables\ContextDisposable.cs" />
- <Compile Include="Reactive\Disposables\DefaultDisposable.cs" />
- <Compile Include="Reactive\Disposables\Disposable.cs" />
- <Compile Include="Reactive\Disposables\MultipleAssignmentDisposable.cs" />
- <Compile Include="Reactive\Disposables\RefCountDisposable.cs" />
- <Compile Include="Reactive\Disposables\ScheduledDisposable.cs" />
- <Compile Include="Reactive\Disposables\SerialDisposable.cs" />
- <Compile Include="Reactive\Disposables\SingleAssignmentDisposable.cs" />
- <Compile Include="Reactive\Internal\AutoDetachObserver.cs" />
- <Compile Include="Reactive\Internal\ExceptionServices.Default.cs" />
- <Compile Include="Reactive\Internal\ExceptionServices.cs" />
- <Compile Include="Reactive\Internal\HostLifecycleService.cs" />
- <Compile Include="Reactive\Internal\ImmutableList.cs" />
- <Compile Include="Reactive\Internal\Lazy.cs" />
- <Compile Include="Reactive\Internal\Observers.cs" />
- <Compile Include="Reactive\Internal\PlatformEnlightenmentProvider.cs" />
- <Compile Include="Reactive\Internal\PriorityQueue.cs" />
- <Compile Include="Reactive\Internal\Producer.cs" />
- <Compile Include="Reactive\Internal\SafeObserver.cs" />
- <Compile Include="Reactive\Internal\ScheduledObserver.cs" />
- <Compile Include="Reactive\Internal\Semaphore.Silverlight.cs" />
- <Compile Include="Reactive\Internal\Semaphore.Xna.cs" />
- <Compile Include="Reactive\Internal\Sink.cs" />
- <Compile Include="Reactive\Internal\Stubs.cs" />
- <Compile Include="Reactive\Internal\SynchronizationContextExtensions.cs" />
- <Compile Include="Reactive\Internal\SynchronizedObserver.cs" />
- <Compile Include="Reactive\Internal\SystemClock.cs" />
- <Compile Include="Reactive\Internal\SystemClock.Default.cs" />
- <Compile Include="Reactive\Notification.cs" />
- <Compile Include="Reactive\ObservableBase.cs" />
- <Compile Include="Reactive\ObserverBase.cs" />
- <Compile Include="Reactive\Unit.cs" />
- <Compile Include="Strings_Core.Generated.cs" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\System.Reactive.Interfaces\System.Reactive.Interfaces.csproj">
- <Project>{9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}</Project>
- <Name>System.Reactive.Interfaces</Name>
- </ProjectReference>
- </ItemGroup>
- <ItemGroup>
- <EmbeddedResource Include="Strings_Core.resx" />
- </ItemGroup>
- <Import Project="..\Import.targets" />
-</Project> \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Debugger/Properties/AssemblyInfo.cs b/Rx.NET/System.Reactive.Debugger/Properties/AssemblyInfo.cs
deleted file mode 100644
index ddf4da6..0000000
--- a/Rx.NET/System.Reactive.Debugger/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,37 +0,0 @@
-using System;
-using System.Reflection;
-using System.Resources;
-using System.Runtime.InteropServices;
-using System.Security;
-
-[assembly: AssemblyTitle("System.Reactive.Debugger")]
-// Notice: same description as in the .nuspec files; see Source/Rx/Setup/NuGet
-[assembly: AssemblyDescription("Reactive Extensions Debugger Library containing runtime hooks for query operators to allow debugging and tracing.")]
-#if DEBUG
-[assembly: AssemblyConfiguration("Debug")]
-#else
-[assembly: AssemblyConfiguration("Retail")]
-#endif
-[assembly: AssemblyCompany("Microsoft Corporation")]
-[assembly: AssemblyProduct("Reactive Extensions")]
-[assembly: AssemblyCopyright("\x00a9 Microsoft Corporation. All rights reserved.")]
-[assembly: NeutralResourcesLanguage("en-US")]
-
-#if !PLIB
-[assembly: ComVisible(false)]
-#endif
-
-[assembly: CLSCompliant(true)]
-
-#if HAS_APTCA && NO_CODECOVERAGE
-[assembly: AllowPartiallyTrustedCallers]
-#endif
-
-#if XBOX_LAKEVIEW
-[assembly: SecurityTransparent]
-#endif
-
-//
-// Note: Assembly (file) version numbers get inserted by the build system on the fly. Inspect the Team Build workflows
-// and the custom activity in Build/Source/Activities/AppendVersionInfo.cs for more information.
-//
diff --git a/Rx.NET/System.Reactive.Debugger/Reactive/Linq/QueryDebugger.cs b/Rx.NET/System.Reactive.Debugger/Reactive/Linq/QueryDebugger.cs
deleted file mode 100644
index 75e9a5a..0000000
--- a/Rx.NET/System.Reactive.Debugger/Reactive/Linq/QueryDebugger.cs
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-//
-// This file acts as a placeholder for future extension with a debugger service
-// intercepting all Observable[Ex] query operators, instrumenting those with a
-// set of debugger hooks. The code would boil down to a wrapper implementation
-// of IQueryLanguage[Ex] providing instrumentation for query operators, which
-// ultimately calls into the original "baseImpl" passed to the Extend method.
-//
-// Likely we want this code to be auto-generated based on certain patterns that
-// occur frequently in query operators. Also, to ensure debugger and target are
-// not going out of sync, we should properly version the interfaces and possibly
-// perform a runtime check for the loaded assembly versions to ensure everything
-// lines up correctly.
-//
-
-namespace System.Reactive.Linq
-{
- /// <summary>
- /// (Infrastructure) Implement query debugger services.
- /// </summary>
- public class QueryDebugger : IQueryServices
- {
- T IQueryServices.Extend<T>(T baseImpl)
- {
- return baseImpl;
- }
- }
-}
diff --git a/Rx.NET/System.Reactive.Debugger/System.Reactive.Debugger.csproj b/Rx.NET/System.Reactive.Debugger/System.Reactive.Debugger.csproj
deleted file mode 100644
index 58199a4..0000000
--- a/Rx.NET/System.Reactive.Debugger/System.Reactive.Debugger.csproj
+++ /dev/null
@@ -1,62 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <ProductVersion>8.0.30703</ProductVersion>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{FFB7A57C-BC22-4B71-88D4-2489B3FF10B6}</ProjectGuid>
- <OutputType>Library</OutputType>
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <RootNamespace>System.Reactive.Debugger</RootNamespace>
- <AssemblyName>System.Reactive.Debugger</AssemblyName>
- <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
- <FileAlignment>512</FileAlignment>
- <ProductSignAssembly>true</ProductSignAssembly>
- <CodeAnalysisRuleSet>..\Rx.ruleset</CodeAnalysisRuleSet>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'ReleaseXBLV|AnyCPU'">
- <OutputPath>bin\ReleaseXBLV\</OutputPath>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'DebugXBLV|AnyCPU'">
- <OutputPath>bin\DebugXBLV\</OutputPath>
- </PropertyGroup>
- <Import Project="..\Common.targets" />
- <PropertyGroup>
- <DocumentationFile>$(OutputPath)\$(AssemblyName).XML</DocumentationFile>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)' == 'DebugPL' Or '$(Configuration)' == 'ReleasePL' ">
- <TargetFrameworkProfile>Profile7</TargetFrameworkProfile>
- </PropertyGroup>
- <ItemGroup>
- <Reference Include="mscorlib" Condition=" '$(BuildPlatform)' == 'SILVERLIGHT' Or '$(BuildPlatform)' == 'XNA' " />
- <Reference Include="System" />
- <Reference Include="System.Core" />
- <Reference Include="System.Observable" Condition=" '$(BuildFlavor)' == 'SILVERLIGHTM7' " />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="Properties\AssemblyInfo.cs" />
- <Compile Include="Reactive\Linq\QueryDebugger.cs" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\System.Reactive.Core\System.Reactive.Core.csproj">
- <Project>{4E516F10-DA7A-4D43-963E-A93865ABEA5B}</Project>
- <Name>System.Reactive.Core</Name>
- </ProjectReference>
- <ProjectReference Include="..\System.Reactive.Experimental\System.Reactive.Experimental.csproj">
- <Project>{41E65B96-733B-41C4-A1BB-7476359B89EB}</Project>
- <Name>System.Reactive.Experimental</Name>
- </ProjectReference>
- <ProjectReference Include="..\System.Reactive.Interfaces\System.Reactive.Interfaces.csproj">
- <Project>{9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}</Project>
- <Name>System.Reactive.Interfaces</Name>
- </ProjectReference>
- <ProjectReference Include="..\System.Reactive.Linq\System.Reactive.Linq.csproj">
- <Project>{63252AE9-5186-45CA-BFCD-FA51C6B66A43}</Project>
- <Name>System.Reactive.Linq</Name>
- </ProjectReference>
- <ProjectReference Include="..\System.Reactive.PlatformServices\System.Reactive.PlatformServices.csproj">
- <Project>{0CCCF009-763F-40D2-8655-7A94828023BF}</Project>
- <Name>System.Reactive.PlatformServices</Name>
- </ProjectReference>
- </ItemGroup>
- <Import Project="..\Import.targets" />
-</Project> \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Experimental/ExperimentalAttribute.cs b/Rx.NET/System.Reactive.Experimental/ExperimentalAttribute.cs
deleted file mode 100644
index 0021461..0000000
--- a/Rx.NET/System.Reactive.Experimental/ExperimentalAttribute.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-namespace System.Reactive
-{
- /// <summary>
- /// Marks the program elements that are experimental. This class cannot be inherited.
- /// </summary>
- [Experimental, AttributeUsage(AttributeTargets.All, AllowMultiple=false, Inherited=true)]
- public sealed class ExperimentalAttribute : Attribute
- {
- }
-} \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Experimental/InternalsVisibleTo.cs b/Rx.NET/System.Reactive.Experimental/InternalsVisibleTo.cs
deleted file mode 100644
index 85f6f9a..0000000
--- a/Rx.NET/System.Reactive.Experimental/InternalsVisibleTo.cs
+++ /dev/null
@@ -1,17 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System;
-
-#if SIGNED
-
-#if SIGNENHANCED // Key 272 for .NET 4.5 and beyond
-[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("System.Reactive.Debugger, PublicKey=002400000c80000014010000060200000024000052534131000800000100010085aad0bef0688d1b994a0d78e1fd29fc24ac34ed3d3ac3fb9b3d0c48386ba834aa880035060a8848b2d8adf58e670ed20914be3681a891c9c8c01eef2ab22872547c39be00af0e6c72485d7cfd1a51df8947d36ceba9989106b58abe79e6a3e71a01ed6bdc867012883e0b1a4d35b1b5eeed6df21e401bb0c22f2246ccb69979dc9e61eef262832ed0f2064853725a75485fa8a3efb7e027319c86dec03dc3b1bca2b5081bab52a627b9917450dfad534799e1c7af58683bdfa135f1518ff1ea60e90d7b993a6c87fd3dd93408e35d1296f9a7f9a97c5db56c0f3cc25ad11e9777f94d138b3cea53b9a8331c2e6dcb8d2ea94e18bf1163ff112a22dbd92d429a")]
-#else // Key 35 for older platforms
-[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("System.Reactive.Debugger, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")]
-#endif
-
-#else
-
-[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("System.Reactive.Debugger")]
-
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Experimental/Properties/AssemblyInfo.cs b/Rx.NET/System.Reactive.Experimental/Properties/AssemblyInfo.cs
deleted file mode 100644
index c582456..0000000
--- a/Rx.NET/System.Reactive.Experimental/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,38 +0,0 @@
-using System;
-using System.Reflection;
-using System.Resources;
-using System.Runtime.InteropServices;
-using System.Security;
-
-[assembly: AssemblyTitle("System.Reactive.Experimental")]
-// Notice: same description as in the .nuspec files; see Source/Rx/Setup/NuGet
-[assembly: AssemblyDescription("Reactive Extensions Experimental Library containing unstable and infrequently used functionality.")]
-#if DEBUG
-[assembly: AssemblyConfiguration("Debug")]
-#else
-[assembly: AssemblyConfiguration("Retail")]
-#endif
-[assembly: AssemblyCompany("Microsoft Corporation")]
-[assembly: System.Reactive.Experimental]
-[assembly: AssemblyProduct("Reactive Extensions")]
-[assembly: AssemblyCopyright("\x00a9 Microsoft Corporation. All rights reserved.")]
-[assembly: NeutralResourcesLanguage("en-US")]
-
-#if !PLIB
-[assembly: ComVisible(false)]
-#endif
-
-[assembly: CLSCompliant(true)]
-
-#if HAS_APTCA && NO_CODECOVERAGE
-[assembly: AllowPartiallyTrustedCallers]
-#endif
-
-#if XBOX_LAKEVIEW
-[assembly: SecurityTransparent]
-#endif
-
-//
-// Note: Assembly (file) version numbers get inserted by the build system on the fly. Inspect the Team Build workflows
-// and the custom activity in Build/Source/Activities/AppendVersionInfo.cs for more information.
-//
diff --git a/Rx.NET/System.Reactive.Experimental/Reactive/Internal/BinaryObserver.cs b/Rx.NET/System.Reactive.Experimental/Reactive/Internal/BinaryObserver.cs
deleted file mode 100644
index 19cdb2d..0000000
--- a/Rx.NET/System.Reactive.Experimental/Reactive/Internal/BinaryObserver.cs
+++ /dev/null
@@ -1,34 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-namespace System.Reactive
-{
- class BinaryObserver<TLeft, TRight> : IObserver<Either<Notification<TLeft>, Notification<TRight>>>
- {
- public BinaryObserver(IObserver<TLeft> leftObserver, IObserver<TRight> rightObserver)
- {
- LeftObserver = leftObserver;
- RightObserver = rightObserver;
- }
-
- public BinaryObserver(Action<Notification<TLeft>> left, Action<Notification<TRight>> right)
- : this(left.ToObserver(), right.ToObserver())
- {
- }
-
- public IObserver<TLeft> LeftObserver { get; private set; }
- public IObserver<TRight> RightObserver { get; private set; }
-
- void IObserver<Either<Notification<TLeft>, Notification<TRight>>>.OnNext(Either<Notification<TLeft>, Notification<TRight>> value)
- {
- value.Switch(left => left.Accept(LeftObserver), right => right.Accept(RightObserver));
- }
-
- void IObserver<Either<Notification<TLeft>, Notification<TRight>>>.OnError(Exception exception)
- {
- }
-
- void IObserver<Either<Notification<TLeft>, Notification<TRight>>>.OnCompleted()
- {
- }
- }
-}
diff --git a/Rx.NET/System.Reactive.Experimental/Reactive/Linq/IQueryLanguageEx.cs b/Rx.NET/System.Reactive.Experimental/Reactive/Linq/IQueryLanguageEx.cs
deleted file mode 100644
index 3cfe58a..0000000
--- a/Rx.NET/System.Reactive.Experimental/Reactive/Linq/IQueryLanguageEx.cs
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System.Collections.Generic;
-using System.Reactive.Concurrency;
-
-namespace System.Reactive.Linq
-{
- /// <summary>
- /// Internal interface describing the LINQ to Events query language.
- /// </summary>
- internal interface IQueryLanguageEx
- {
- IObservable<TResult> Create<TResult>(Func<IObserver<TResult>, IEnumerable<IObservable<object>>> iteratorMethod);
- IObservable<Unit> Create(Func<IEnumerable<IObservable<object>>> iteratorMethod);
-
- IObservable<TSource> Expand<TSource>(IObservable<TSource> source, Func<TSource, IObservable<TSource>> selector);
- IObservable<TSource> Expand<TSource>(IObservable<TSource> source, Func<TSource, IObservable<TSource>> selector, IScheduler scheduler);
-
- IObservable<TResult> ForkJoin<TFirst, TSecond, TResult>(IObservable<TFirst> first, IObservable<TSecond> second, Func<TFirst, TSecond, TResult> resultSelector);
- IObservable<TSource[]> ForkJoin<TSource>(params IObservable<TSource>[] sources);
- IObservable<TSource[]> ForkJoin<TSource>(IEnumerable<IObservable<TSource>> sources);
-
- IObservable<TResult> Let<TSource, TResult>(IObservable<TSource> source, Func<IObservable<TSource>, IObservable<TResult>> function);
-
- IObservable<TResult> ManySelect<TSource, TResult>(IObservable<TSource> source, Func<IObservable<TSource>, TResult> selector);
- IObservable<TResult> ManySelect<TSource, TResult>(IObservable<TSource> source, Func<IObservable<TSource>, TResult> selector, IScheduler scheduler);
-
- ListObservable<TSource> ToListObservable<TSource>(IObservable<TSource> source);
- }
-}
diff --git a/Rx.NET/System.Reactive.Experimental/Reactive/Linq/ObservableEx.cs b/Rx.NET/System.Reactive.Experimental/Reactive/Linq/ObservableEx.cs
deleted file mode 100644
index 0ab6a06..0000000
--- a/Rx.NET/System.Reactive.Experimental/Reactive/Linq/ObservableEx.cs
+++ /dev/null
@@ -1,234 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System.Collections.Generic;
-using System.Reactive.Concurrency;
-
-namespace System.Reactive.Linq
-{
- /// <summary>
- /// Provides a set of static methods for writing in-memory queries over observable sequences.
- /// </summary>
- public static class ObservableEx
- {
- private static IQueryLanguageEx s_impl = QueryServices.GetQueryImpl<IQueryLanguageEx>(new QueryLanguageEx());
-
- #region Create
-
- /// <summary>
- /// Subscribes to each observable sequence returned by the iteratorMethod in sequence and returns the observable sequence of values sent to the observer given to the iteratorMethod.
- /// </summary>
- /// <typeparam name="TResult">The type of the elements in the produced sequence.</typeparam>
- /// <param name="iteratorMethod">Iterator method that produces elements in the resulting sequence by calling the given observer.</param>
- /// <returns>An observable sequence obtained by running the iterator and returning the elements that were sent to the observer.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="iteratorMethod"/> is null.</exception>
- [Experimental]
- public static IObservable<TResult> Create<TResult>(Func<IObserver<TResult>, IEnumerable<IObservable<object>>> iteratorMethod)
- {
- if (iteratorMethod == null)
- throw new ArgumentNullException("iteratorMethod");
-
- return s_impl.Create<TResult>(iteratorMethod);
- }
-
- /// <summary>
- /// Subscribes to each observable sequence returned by the iteratorMethod in sequence and produces a Unit value on the resulting sequence for each step of the iteration.
- /// </summary>
- /// <param name="iteratorMethod">Iterator method that drives the resulting observable sequence.</param>
- /// <returns>An observable sequence obtained by running the iterator and returning Unit values for each iteration step.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="iteratorMethod"/> is null.</exception>
- [Experimental]
- public static IObservable<Unit> Create(Func<IEnumerable<IObservable<object>>> iteratorMethod)
- {
- if (iteratorMethod == null)
- throw new ArgumentNullException("iteratorMethod");
-
- return s_impl.Create(iteratorMethod);
- }
-
- #endregion
-
- #region Expand
-
- /// <summary>
- /// Expands an observable sequence by recursively invoking selector, using the specified scheduler to enumerate the queue of obtained sequences.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence and each of the recursively expanded sources obtained by running the selector function.</typeparam>
- /// <param name="source">Source sequence with the initial elements.</param>
- /// <param name="selector">Selector function to invoke for each produced element, resulting in another sequence to which the selector will be invoked recursively again.</param>
- /// <param name="scheduler">Scheduler on which to perform the expansion by enumerating the internal queue of obtained sequences.</param>
- /// <returns>An observable sequence containing all the elements produced by the recursive expansion.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> or <paramref name="scheduler"/> is null.</exception>
- [Experimental]
- public static IObservable<TSource> Expand<TSource>(this IObservable<TSource> source, Func<TSource, IObservable<TSource>> selector, IScheduler scheduler)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return s_impl.Expand<TSource>(source, selector, scheduler);
- }
-
- /// <summary>
- /// Expands an observable sequence by recursively invoking selector.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence and each of the recursively expanded sources obtained by running the selector function.</typeparam>
- /// <param name="source">Source sequence with the initial elements.</param>
- /// <param name="selector">Selector function to invoke for each produced element, resulting in another sequence to which the selector will be invoked recursively again.</param>
- /// <returns>An observable sequence containing all the elements produced by the recursive expansion.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> is null.</exception>
- [Experimental]
- public static IObservable<TSource> Expand<TSource>(this IObservable<TSource> source, Func<TSource, IObservable<TSource>> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return s_impl.Expand<TSource>(source, selector);
- }
-
- #endregion
-
- #region ForkJoin
-
- /// <summary>
- /// Runs two observable sequences in parallel and combines their last elemenets.
- /// </summary>
- /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
- /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
- /// <param name="first">First observable sequence.</param>
- /// <param name="second">Second observable sequence.</param>
- /// <param name="resultSelector">Result selector function to invoke with the last elements of both sequences.</param>
- /// <returns>An observable sequence with the result of calling the selector function with the last elements of both input sequences.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="first"/> or <paramref name="second"/> or <paramref name="resultSelector"/> is null.</exception>
- [Experimental]
- public static IObservable<TResult> ForkJoin<TSource1, TSource2, TResult>(this IObservable<TSource1> first, IObservable<TSource2> second, Func<TSource1, TSource2, TResult> resultSelector)
- {
- if (first == null)
- throw new ArgumentNullException("first");
- if (second == null)
- throw new ArgumentNullException("second");
- if (resultSelector == null)
- throw new ArgumentNullException("resultSelector");
-
- return s_impl.ForkJoin<TSource1, TSource2, TResult>(first, second, resultSelector);
- }
-
- /// <summary>
- /// Runs all specified observable sequences in parallel and collects their last elements.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequences.</typeparam>
- /// <param name="sources">Observable sequence to collect the last elements for.</param>
- /// <returns>An observable sequence with an array collecting the last elements of all the input sequences.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="sources"/> is null.</exception>
- [Experimental]
- public static IObservable<TSource[]> ForkJoin<TSource>(params IObservable<TSource>[] sources)
- {
- if (sources == null)
- throw new ArgumentNullException("sources");
-
- return s_impl.ForkJoin<TSource>(sources);
- }
-
- /// <summary>
- /// Runs all observable sequences in the enumerable sources sequence in parallel and collect their last elements.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequences.</typeparam>
- /// <param name="sources">Observable sequence to collect the last elements for.</param>
- /// <returns>An observable sequence with an array collecting the last elements of all the input sequences.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="sources"/> is null.</exception>
- [Experimental]
- public static IObservable<TSource[]> ForkJoin<TSource>(this IEnumerable<IObservable<TSource>> sources)
- {
- if (sources == null)
- throw new ArgumentNullException("sources");
-
- return s_impl.ForkJoin<TSource>(sources);
- }
-
- #endregion
-
- #region Let
-
- /// <summary>
- /// Returns an observable sequence that is the result of invoking the selector on the source sequence, without sharing subscriptions.
- /// This operator allows for a fluent style of writing queries that use the same sequence multiple times.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence.</typeparam>
- /// <param name="source">Source sequence that will be shared in the selector function.</param>
- /// <param name="selector">Selector function which can use the source sequence as many times as needed, without sharing subscriptions to the source sequence.</param>
- /// <returns>An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> is null.</exception>
- [Experimental]
- public static IObservable<TResult> Let<TSource, TResult>(this IObservable<TSource> source, Func<IObservable<TSource>, IObservable<TResult>> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return s_impl.Let<TSource, TResult>(source, selector);
- }
-
- #endregion
-
- #region ManySelect
-
- /// <summary>
- /// Comonadic bind operator.
- /// </summary>
- [Experimental]
- public static IObservable<TResult> ManySelect<TSource, TResult>(this IObservable<TSource> source, Func<IObservable<TSource>, TResult> selector, IScheduler scheduler)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return s_impl.ManySelect<TSource, TResult>(source, selector, scheduler);
- }
-
- /// <summary>
- /// Comonadic bind operator.
- /// </summary>
- [Experimental]
- public static IObservable<TResult> ManySelect<TSource, TResult>(this IObservable<TSource> source, Func<IObservable<TSource>, TResult> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return s_impl.ManySelect<TSource, TResult>(source, selector);
- }
-
- #endregion
-
- #region ToListObservable
-
- /// <summary>
- /// Immediately subscribes to source and retains the elements in the observable sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence.</param>
- /// <returns>Object that's both an observable sequence and a list which can be used to access the source sequence's elements.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- [Experimental]
- public static ListObservable<TSource> ToListObservable<TSource>(this IObservable<TSource> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return s_impl.ToListObservable<TSource>(source);
- }
-
- #endregion
- }
-}
diff --git a/Rx.NET/System.Reactive.Experimental/Reactive/Linq/QbservableEx.Generated.cs b/Rx.NET/System.Reactive.Experimental/Reactive/Linq/QbservableEx.Generated.cs
deleted file mode 100644
index 4903e30..0000000
--- a/Rx.NET/System.Reactive.Experimental/Reactive/Linq/QbservableEx.Generated.cs
+++ /dev/null
@@ -1,368 +0,0 @@
-/*
- * WARNING: Auto-generated file (8/5/2012 1:55:31 PM)
- */
-
-#pragma warning disable 1591
-
-#if !NO_EXPRESSIONS
-
-using System;
-using System.Reactive.Concurrency;
-using System.Collections.Generic;
-using System.Reactive.Joins;
-using System.Linq;
-using System.Linq.Expressions;
-using System.Reflection;
-using System.Threading;
-using System.Reactive;
-using System.Reactive.Subjects;
-#if !NO_TPL
-using System.Threading.Tasks;
-#endif
-#if !NO_REMOTING
-using System.Runtime.Remoting.Lifetime;
-#endif
-
-namespace System.Reactive.Linq
-{
- public static partial class QbservableEx
- {
-#if !STABLE
- /// <summary>
- /// Subscribes to each observable sequence returned by the iteratorMethod in sequence and produces a Unit value on the resulting sequence for each step of the iteration.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <param name="iteratorMethod">Iterator method that drives the resulting observable sequence.</param>
- /// <returns>An observable sequence obtained by running the iterator and returning Unit values for each iteration step.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="iteratorMethod" /> is null.</exception>
- [Experimental]
- public static IQbservable<Unit> Create(this IQbservableProvider provider, Expression<Func<IEnumerable<IObservable<object>>>> iteratorMethod)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (iteratorMethod == null)
- throw new ArgumentNullException("iteratorMethod");
-
- return provider.CreateQuery<Unit>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => QbservableEx.Create(default(IQbservableProvider), default(Expression<Func<IEnumerable<IObservable<object>>>>))),
-#else
- (MethodInfo)MethodInfo.GetCurrentMethod(),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- iteratorMethod
- )
- );
- }
-#endif
-
-#if !STABLE
- /// <summary>
- /// Subscribes to each observable sequence returned by the iteratorMethod in sequence and returns the observable sequence of values sent to the observer given to the iteratorMethod.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TResult">The type of the elements in the produced sequence.</typeparam>
- /// <param name="iteratorMethod">Iterator method that produces elements in the resulting sequence by calling the given observer.</param>
- /// <returns>An observable sequence obtained by running the iterator and returning the elements that were sent to the observer.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="iteratorMethod" /> is null.</exception>
- [Experimental]
- public static IQbservable<TResult> Create<TResult>(this IQbservableProvider provider, Expression<Func<IObserver<TResult>, IEnumerable<IObservable<object>>>> iteratorMethod)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (iteratorMethod == null)
- throw new ArgumentNullException("iteratorMethod");
-
- return provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => QbservableEx.Create<TResult>(default(IQbservableProvider), default(Expression<Func<IObserver<TResult>, IEnumerable<IObservable<object>>>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TResult)),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- iteratorMethod
- )
- );
- }
-#endif
-
-#if !STABLE
- /// <summary>
- /// Expands an observable sequence by recursively invoking selector.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence and each of the recursively expanded sources obtained by running the selector function.</typeparam>
- /// <param name="source">Source sequence with the initial elements.</param>
- /// <param name="selector">Selector function to invoke for each produced element, resulting in another sequence to which the selector will be invoked recursively again.</param>
- /// <returns>An observable sequence containing all the elements produced by the recursive expansion.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
- [Experimental]
- public static IQbservable<TSource> Expand<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, IObservable<TSource>>> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return source.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => QbservableEx.Expand<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, IObservable<TSource>>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- selector
- )
- );
- }
-#endif
-
-#if !STABLE
- /// <summary>
- /// Expands an observable sequence by recursively invoking selector, using the specified scheduler to enumerate the queue of obtained sequences.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence and each of the recursively expanded sources obtained by running the selector function.</typeparam>
- /// <param name="source">Source sequence with the initial elements.</param>
- /// <param name="selector">Selector function to invoke for each produced element, resulting in another sequence to which the selector will be invoked recursively again.</param>
- /// <param name="scheduler">Scheduler on which to perform the expansion by enumerating the internal queue of obtained sequences.</param>
- /// <returns>An observable sequence containing all the elements produced by the recursive expansion.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="selector" /> or <paramref name="scheduler" /> is null.</exception>
- [Experimental]
- public static IQbservable<TSource> Expand<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, IObservable<TSource>>> selector, IScheduler scheduler)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return source.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => QbservableEx.Expand<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, IObservable<TSource>>>), default(IScheduler))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- selector,
- Expression.Constant(scheduler, typeof(IScheduler))
- )
- );
- }
-#endif
-
-#if !STABLE
- /// <summary>
- /// Runs all specified observable sequences in parallel and collects their last elements.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TSource">The type of the elements in the source sequences.</typeparam>
- /// <param name="sources">Observable sequence to collect the last elements for.</param>
- /// <returns>An observable sequence with an array collecting the last elements of all the input sequences.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="sources" /> is null.</exception>
- [Experimental]
- public static IQbservable<TSource[]> ForkJoin<TSource>(this IQbservableProvider provider, params IObservable<TSource>[] sources)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (sources == null)
- throw new ArgumentNullException("sources");
-
- return provider.CreateQuery<TSource[]>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => QbservableEx.ForkJoin<TSource>(default(IQbservableProvider), default(IObservable<TSource>[]))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- GetSourceExpression(sources)
- )
- );
- }
-#endif
-
-#if !STABLE
- /// <summary>
- /// Runs all observable sequences in the enumerable sources sequence in parallel and collect their last elements.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TSource">The type of the elements in the source sequences.</typeparam>
- /// <param name="sources">Observable sequence to collect the last elements for.</param>
- /// <returns>An observable sequence with an array collecting the last elements of all the input sequences.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="sources" /> is null.</exception>
- [Experimental]
- public static IQbservable<TSource[]> ForkJoin<TSource>(this IQbservableProvider provider, IEnumerable<IObservable<TSource>> sources)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (sources == null)
- throw new ArgumentNullException("sources");
-
- return provider.CreateQuery<TSource[]>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => QbservableEx.ForkJoin<TSource>(default(IQbservableProvider), default(IEnumerable<IObservable<TSource>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- GetSourceExpression(sources)
- )
- );
- }
-#endif
-
-#if !STABLE
- /// <summary>
- /// Runs two observable sequences in parallel and combines their last elemenets.
- /// </summary>
- /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
- /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
- /// <param name="first">First observable sequence.</param>
- /// <param name="second">Second observable sequence.</param>
- /// <param name="resultSelector">Result selector function to invoke with the last elements of both sequences.</param>
- /// <returns>An observable sequence with the result of calling the selector function with the last elements of both input sequences.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="first" /> or <paramref name="second" /> or <paramref name="resultSelector" /> is null.</exception>
- [Experimental]
- public static IQbservable<TResult> ForkJoin<TSource1, TSource2, TResult>(this IQbservable<TSource1> first, IObservable<TSource2> second, Expression<Func<TSource1, TSource2, TResult>> resultSelector)
- {
- if (first == null)
- throw new ArgumentNullException("first");
- if (second == null)
- throw new ArgumentNullException("second");
- if (resultSelector == null)
- throw new ArgumentNullException("resultSelector");
-
- return first.Provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => QbservableEx.ForkJoin<TSource1, TSource2, TResult>(default(IQbservable<TSource1>), default(IObservable<TSource2>), default(Expression<Func<TSource1, TSource2, TResult>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource1), typeof(TSource2), typeof(TResult)),
-#endif
- first.Expression,
- GetSourceExpression(second),
- resultSelector
- )
- );
- }
-#endif
-
-#if !STABLE
- /// <summary>
- /// Returns an observable sequence that is the result of invoking the selector on the source sequence, without sharing subscriptions.
- /// This operator allows for a fluent style of writing queries that use the same sequence multiple times.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence.</typeparam>
- /// <param name="source">Source sequence that will be shared in the selector function.</param>
- /// <param name="selector">Selector function which can use the source sequence as many times as needed, without sharing subscriptions to the source sequence.</param>
- /// <returns>An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
- [Experimental]
- public static IQbservable<TResult> Let<TSource, TResult>(this IQbservable<TSource> source, Expression<Func<IObservable<TSource>, IObservable<TResult>>> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return source.Provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => QbservableEx.Let<TSource, TResult>(default(IQbservable<TSource>), default(Expression<Func<IObservable<TSource>, IObservable<TResult>>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)),
-#endif
- source.Expression,
- selector
- )
- );
- }
-#endif
-
-#if !STABLE
- /// <summary>
- /// Comonadic bind operator.
- /// </summary>
- [Experimental]
- public static IQbservable<TResult> ManySelect<TSource, TResult>(this IQbservable<TSource> source, Expression<Func<IObservable<TSource>, TResult>> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return source.Provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => QbservableEx.ManySelect<TSource, TResult>(default(IQbservable<TSource>), default(Expression<Func<IObservable<TSource>, TResult>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)),
-#endif
- source.Expression,
- selector
- )
- );
- }
-#endif
-
-#if !STABLE
- /// <summary>
- /// Comonadic bind operator.
- /// </summary>
- [Experimental]
- public static IQbservable<TResult> ManySelect<TSource, TResult>(this IQbservable<TSource> source, Expression<Func<IObservable<TSource>, TResult>> selector, IScheduler scheduler)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return source.Provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => QbservableEx.ManySelect<TSource, TResult>(default(IQbservable<TSource>), default(Expression<Func<IObservable<TSource>, TResult>>), default(IScheduler))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)),
-#endif
- source.Expression,
- selector,
- Expression.Constant(scheduler, typeof(IScheduler))
- )
- );
- }
-#endif
-
- }
-}
-
-#endif
-
-#pragma warning restore 1591
-
diff --git a/Rx.NET/System.Reactive.Experimental/Reactive/Linq/QbservableEx.cs b/Rx.NET/System.Reactive.Experimental/Reactive/Linq/QbservableEx.cs
deleted file mode 100644
index 1cf5b99..0000000
--- a/Rx.NET/System.Reactive.Experimental/Reactive/Linq/QbservableEx.cs
+++ /dev/null
@@ -1,57 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_EXPRESSIONS
-using System.Collections.Generic;
-using System.Linq;
-using System.Linq.Expressions;
-using System.Reflection;
-
-namespace System.Reactive.Linq
-{
- /// <summary>
- /// Provides a set of static methods for writing queries over observable sequences, allowing translation to a target query language.
- /// </summary>
- [LocalQueryMethodImplementationType(typeof(ObservableEx))]
- public static partial class QbservableEx
- {
- internal static Expression GetSourceExpression<TSource>(IObservable<TSource> source)
- {
- var q = source as IQbservable<TSource>;
- if (q != null)
- return q.Expression;
-
- return Expression.Constant(source, typeof(IObservable<TSource>));
- }
-
- internal static Expression GetSourceExpression<TSource>(IEnumerable<TSource> source)
- {
- var q = source as IQueryable<TSource>;
- if (q != null)
- return q.Expression;
-
- return Expression.Constant(source, typeof(IEnumerable<TSource>));
- }
-
- internal static Expression GetSourceExpression<TSource>(IObservable<TSource>[] sources)
- {
- return Expression.NewArrayInit(
- typeof(IObservable<TSource>),
- sources.Select(source => GetSourceExpression(source))
- );
- }
-
- internal static Expression GetSourceExpression<TSource>(IEnumerable<TSource>[] sources)
- {
- return Expression.NewArrayInit(
- typeof(IEnumerable<TSource>),
- sources.Select(source => GetSourceExpression(source))
- );
- }
-
- internal static MethodInfo InfoOf<R>(Expression<Func<R>> f)
- {
- return ((MethodCallExpression)f.Body).Method;
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Experimental/Reactive/Linq/QueryLanguageEx.cs b/Rx.NET/System.Reactive.Experimental/Reactive/Linq/QueryLanguageEx.cs
deleted file mode 100644
index bc4cdc6..0000000
--- a/Rx.NET/System.Reactive.Experimental/Reactive/Linq/QueryLanguageEx.cs
+++ /dev/null
@@ -1,445 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System.Collections.Generic;
-using System.Linq;
-using System.Reactive.Concurrency;
-using System.Reactive.Disposables;
-using System.Reactive.Subjects;
-
-namespace System.Reactive.Linq
-{
- internal class QueryLanguageEx : IQueryLanguageEx
- {
- #region Create
-
- public virtual IObservable<TResult> Create<TResult>(Func<IObserver<TResult>, IEnumerable<IObservable<object>>> iteratorMethod)
- {
- return new AnonymousObservable<TResult>(observer =>
- iteratorMethod(observer).Concat().Subscribe(_ => { }, observer.OnError, observer.OnCompleted));
- }
-
- public virtual IObservable<Unit> Create(Func<IEnumerable<IObservable<object>>> iteratorMethod)
- {
- return new AnonymousObservable<Unit>(observer =>
- iteratorMethod().Concat().Subscribe(_ => { }, observer.OnError, observer.OnCompleted));
- }
-
- #endregion
-
- #region Expand
-
- public virtual IObservable<TSource> Expand<TSource>(IObservable<TSource> source, Func<TSource, IObservable<TSource>> selector, IScheduler scheduler)
- {
- return new AnonymousObservable<TSource>(observer =>
- {
- var outGate = new object();
- var q = new Queue<IObservable<TSource>>();
- var m = new SerialDisposable();
- var d = new CompositeDisposable { m };
- var activeCount = 0;
- var isAcquired = false;
-
- var ensureActive = default(Action);
-
- ensureActive = () =>
- {
- var isOwner = false;
-
- lock (q)
- {
- if (q.Count > 0)
- {
- isOwner = !isAcquired;
- isAcquired = true;
- }
- }
-
- if (isOwner)
- {
- m.Disposable = scheduler.Schedule(self =>
- {
- var work = default(IObservable<TSource>);
-
- lock (q)
- {
- if (q.Count > 0)
- work = q.Dequeue();
- else
- {
- isAcquired = false;
- return;
- }
- }
-
- var m1 = new SingleAssignmentDisposable();
- d.Add(m1);
- m1.Disposable = work.Subscribe(
- x =>
- {
- lock (outGate)
- observer.OnNext(x);
-
- var result = default(IObservable<TSource>);
- try
- {
- result = selector(x);
- }
- catch (Exception exception)
- {
- lock (outGate)
- observer.OnError(exception);
- }
-
- lock (q)
- {
- q.Enqueue(result);
- activeCount++;
- }
-
- ensureActive();
- },
- exception =>
- {
- lock (outGate)
- observer.OnError(exception);
- },
- () =>
- {
- d.Remove(m1);
-
- var done = false;
- lock (q)
- {
- activeCount--;
- if (activeCount == 0)
- done = true;
- }
- if (done)
- lock (outGate)
- observer.OnCompleted();
- });
- self();
- });
- }
- };
-
- lock (q)
- {
- q.Enqueue(source);
- activeCount++;
- }
- ensureActive();
-
- return d;
- });
- }
-
- public virtual IObservable<TSource> Expand<TSource>(IObservable<TSource> source, Func<TSource, IObservable<TSource>> selector)
- {
- return source.Expand(selector, SchedulerDefaults.Iteration);
- }
-
- #endregion
-
- #region ForkJoin
-
- public virtual IObservable<TResult> ForkJoin<TFirst, TSecond, TResult>(IObservable<TFirst> first, IObservable<TSecond> second, Func<TFirst, TSecond, TResult> resultSelector)
- {
- return Combine<TFirst, TSecond, TResult>(first, second, (observer, leftSubscription, rightSubscription) =>
- {
- var leftStopped = false;
- var rightStopped = false;
- var hasLeft = false;
- var hasRight = false;
- var lastLeft = default(TFirst);
- var lastRight = default(TSecond);
-
- return new BinaryObserver<TFirst, TSecond>(
- left =>
- {
- switch (left.Kind)
- {
- case NotificationKind.OnNext:
- hasLeft = true;
- lastLeft = left.Value;
- break;
- case NotificationKind.OnError:
- rightSubscription.Dispose();
- observer.OnError(left.Exception);
- break;
- case NotificationKind.OnCompleted:
- leftStopped = true;
- if (rightStopped)
- {
- if (!hasLeft)
- observer.OnCompleted();
- else if (!hasRight)
- observer.OnCompleted();
- else
- {
- TResult result;
- try
- {
- result = resultSelector(lastLeft, lastRight);
- }
- catch (Exception exception)
- {
- observer.OnError(exception);
- return;
- }
- observer.OnNext(result);
- observer.OnCompleted();
- }
- }
- break;
- }
- },
- right =>
- {
- switch (right.Kind)
- {
- case NotificationKind.OnNext:
- hasRight = true;
- lastRight = right.Value;
- break;
- case NotificationKind.OnError:
- leftSubscription.Dispose();
- observer.OnError(right.Exception);
- break;
- case NotificationKind.OnCompleted:
- rightStopped = true;
- if (leftStopped)
- {
- if (!hasLeft)
- observer.OnCompleted();
- else if (!hasRight)
- observer.OnCompleted();
- else
- {
- TResult result;
- try
- {
- result = resultSelector(lastLeft, lastRight);
- }
- catch (Exception exception)
- {
- observer.OnError(exception);
- return;
- }
- observer.OnNext(result);
- observer.OnCompleted();
- }
- }
- break;
- }
- });
- });
- }
-
- public virtual IObservable<TSource[]> ForkJoin<TSource>(params IObservable<TSource>[] sources)
- {
- return sources.ForkJoin();
- }
-
- public virtual IObservable<TSource[]> ForkJoin<TSource>(IEnumerable<IObservable<TSource>> sources)
- {
- return new AnonymousObservable<TSource[]>(subscriber =>
- {
- var allSources = sources.ToArray();
- var count = allSources.Length;
-
- if (count == 0)
- {
- subscriber.OnCompleted();
- return Disposable.Empty;
- }
-
- var group = new CompositeDisposable(allSources.Length);
- var gate = new object();
-
- var finished = false;
- var hasResults = new bool[count];
- var hasCompleted = new bool[count];
- var results = new List<TSource>(count);
-
- lock (gate)
- {
- for (var index = 0; index < count; index++)
- {
- var currentIndex = index;
- var source = allSources[index];
- results.Add(default(TSource));
- group.Add(source.Subscribe(
- value =>
- {
- lock (gate)
- {
- if (!finished)
- {
- hasResults[currentIndex] = true;
- results[currentIndex] = value;
- }
- }
- },
- error =>
- {
- lock (gate)
- {
- finished = true;
- subscriber.OnError(error);
- group.Dispose();
- }
- },
- () =>
- {
- lock (gate)
- {
- if (!finished)
- {
- if (!hasResults[currentIndex])
- {
- subscriber.OnCompleted();
- return;
- }
- hasCompleted[currentIndex] = true;
- foreach (var completed in hasCompleted)
- {
- if (!completed)
- return;
- }
- finished = true;
- subscriber.OnNext(results.ToArray());
- subscriber.OnCompleted();
- }
- }
- }));
- }
- }
- return group;
- });
- }
-
- #endregion
-
- #region Let
-
- public virtual IObservable<TResult> Let<TSource, TResult>(IObservable<TSource> source, Func<IObservable<TSource>, IObservable<TResult>> function)
- {
- return function(source);
- }
-
- #endregion
-
- #region ManySelect
-
- public virtual IObservable<TResult> ManySelect<TSource, TResult>(IObservable<TSource> source, Func<IObservable<TSource>, TResult> selector)
- {
- return ManySelect(source, selector, DefaultScheduler.Instance);
- }
-
- public virtual IObservable<TResult> ManySelect<TSource, TResult>(IObservable<TSource> source, Func<IObservable<TSource>, TResult> selector, IScheduler scheduler)
- {
- return Observable.Defer<TResult>(() =>
- {
- var chain = default(ChainObservable<TSource>);
-
- return source
- .Select(
- x =>
- {
- var curr = new ChainObservable<TSource>(x);
-
- if (chain != null)
- chain.OnNext(curr);
- chain = curr;
-
- return (IObservable<TSource>)curr;
- })
- .Do(
- _ => { },
- exception =>
- {
- if (chain != null)
- chain.OnError(exception);
- },
- () =>
- {
- if (chain != null)
- chain.OnCompleted();
- })
- .ObserveOn(scheduler)
- .Select(selector);
- });
- }
-
- class ChainObservable<T> : ISubject<IObservable<T>, T>
- {
- T head;
- AsyncSubject<IObservable<T>> tail = new AsyncSubject<IObservable<T>>();
-
- public ChainObservable(T head)
- {
- this.head = head;
- }
-
- public IDisposable Subscribe(IObserver<T> observer)
- {
- var g = new CompositeDisposable();
- g.Add(CurrentThreadScheduler.Instance.Schedule(() =>
- {
- observer.OnNext(head);
- g.Add(tail.Merge().Subscribe(observer));
- }));
- return g;
- }
-
- public void OnCompleted()
- {
- OnNext(Observable.Empty<T>());
- }
-
- public void OnError(Exception error)
- {
- OnNext(Observable.Throw<T>(error));
- }
-
- public void OnNext(IObservable<T> value)
- {
- tail.OnNext(value);
- tail.OnCompleted();
- }
- }
-
- #endregion
-
- #region ToListObservable
-
- public virtual ListObservable<TSource> ToListObservable<TSource>(IObservable<TSource> source)
- {
- return new ListObservable<TSource>(source);
- }
-
- #endregion
-
- #region |> Helpers <|
-
- private static IObservable<TResult> Combine<TLeft, TRight, TResult>(IObservable<TLeft> leftSource, IObservable<TRight> rightSource, Func<IObserver<TResult>, IDisposable, IDisposable, IObserver<Either<Notification<TLeft>, Notification<TRight>>>> combinerSelector)
- {
- return new AnonymousObservable<TResult>(observer =>
- {
- var leftSubscription = new SingleAssignmentDisposable();
- var rightSubscription = new SingleAssignmentDisposable();
-
- var combiner = combinerSelector(observer, leftSubscription, rightSubscription);
- var gate = new object();
-
- leftSubscription.Disposable = leftSource.Materialize().Select(x => Either<Notification<TLeft>, Notification<TRight>>.CreateLeft(x)).Synchronize(gate).Subscribe(combiner);
- rightSubscription.Disposable = rightSource.Materialize().Select(x => Either<Notification<TLeft>, Notification<TRight>>.CreateRight(x)).Synchronize(gate).Subscribe(combiner);
-
- return new CompositeDisposable(leftSubscription, rightSubscription);
- });
- }
-
- #endregion
- }
-}
diff --git a/Rx.NET/System.Reactive.Experimental/Reactive/ListObservable.cs b/Rx.NET/System.Reactive.Experimental/Reactive/ListObservable.cs
deleted file mode 100644
index c83893a..0000000
--- a/Rx.NET/System.Reactive.Experimental/Reactive/ListObservable.cs
+++ /dev/null
@@ -1,205 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System.Collections;
-using System.Collections.Generic;
-using System.Reactive.Disposables;
-using System.Reactive.Linq;
-using System.Reactive.Subjects;
-
-namespace System.Reactive
-{
- /// <summary>
- /// Represents an object that retains the elements of the observable sequence and signals the end of the sequence.
- /// </summary>
- /// <typeparam name="T">The type of elements received from the source sequence.</typeparam>
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix", Justification = "By design; Observable suffix takes precedence.")]
- [Experimental]
- public class ListObservable<T> : IList<T>, IObservable<object>
- {
- IDisposable subscription;
- AsyncSubject<object> subject = new AsyncSubject<object>();
- List<T> results = new List<T>();
-
- /// <summary>
- /// Constructs an object that retains the values of source and signals the end of the sequence.
- /// </summary>
- /// <param name="source">The observable sequence whose elements will be retained in the list.</param>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- public ListObservable(IObservable<T> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- subscription = source.Subscribe(results.Add, subject.OnError, subject.OnCompleted);
- }
-
- void Wait()
- {
- subject.DefaultIfEmpty().Wait();
- }
-
- /// <summary>
- /// Returns the last value of the observable sequence.
- /// </summary>
- public T Value
- {
- get
- {
- Wait();
- if (results.Count == 0)
- throw new InvalidOperationException(Strings_Linq.NO_ELEMENTS);
- return results[results.Count - 1];
- }
- }
- /// <summary>
- /// Determines the index of a specific item in the ListObservable.
- /// </summary>
- /// <param name="item">The element to determine the index for.</param>
- /// <returns>The index of the specified item in the list; -1 if not found.</returns>
- public int IndexOf(T item)
- {
- Wait();
- return results.IndexOf(item);
- }
-
- /// <summary>
- /// Inserts an item to the ListObservable at the specified index.
- /// </summary>
- /// <param name="index">The index to insert the item at.</param>
- /// <param name="item">The item to insert in the list.</param>
- public void Insert(int index, T item)
- {
- Wait();
- results.Insert(index, item);
- }
-
- /// <summary>
- /// Removes the ListObservable item at the specified index.
- /// </summary>
- /// <param name="index">The index of the item to remove.</param>
- public void RemoveAt(int index)
- {
- Wait();
- results.RemoveAt(index);
- }
-
- /// <summary>
- /// Gets or sets the element at the specified index.
- /// </summary>
- /// <param name="index">The index of the item to retrieve or set.</param>
- public T this[int index]
- {
- get
- {
- Wait();
- return results[index];
- }
- set
- {
- Wait();
- results[index] = value;
- }
- }
-
- /// <summary>
- /// Adds an item to the ListObservable.
- /// </summary>
- /// <param name="item">The item to add to the list.</param>
- public void Add(T item)
- {
- Wait();
- results.Add(item);
- }
-
- /// <summary>
- /// Removes all items from the ListObservable.
- /// </summary>
- public void Clear()
- {
- Wait();
- results.Clear();
- }
-
- /// <summary>
- /// Determines whether the ListObservable contains a specific value.
- /// </summary>
- /// <param name="item">The item to search for in the list.</param>
- /// <returns>true if found; false otherwise.</returns>
- public bool Contains(T item)
- {
- Wait();
- return results.Contains(item);
- }
-
- /// <summary>
- /// Copies the elements of the ListObservable to an System.Array, starting at a particular System.Array index.
- /// </summary>
- /// <param name="array">The array to copy elements to.</param>
- /// <param name="arrayIndex">The start index in the array to start copying elements to.</param>
- public void CopyTo(T[] array, int arrayIndex)
- {
- Wait();
- results.CopyTo(array, arrayIndex);
- }
-
- /// <summary>
- /// Gets the number of elements contained in the ListObservable.
- /// </summary>
- public int Count
- {
- get
- {
- Wait();
- return results.Count;
- }
- }
-
- /// <summary>
- /// Gets a value that indicates whether the ListObservable is read-only.
- /// </summary>
- public bool IsReadOnly
- {
- get { return false; }
- }
-
- /// <summary>
- /// Removes the first occurrence of a specific object from the ListObservable.
- /// </summary>
- /// <param name="item">The item to remove from the list.</param>
- /// <returns>true if the item was found; false otherwise.</returns>
- public bool Remove(T item)
- {
- Wait();
- return results.Remove(item);
- }
-
- /// <summary>
- /// Returns an enumerator that iterates through the collection.
- /// </summary>
- /// <returns>Enumerator over the list.</returns>
- public IEnumerator<T> GetEnumerator()
- {
- Wait();
- return results.GetEnumerator();
- }
-
- IEnumerator IEnumerable.GetEnumerator()
- {
- return this.GetEnumerator();
- }
-
- /// <summary>
- /// Subscribes an observer to the ListObservable which will be notified upon completion.
- /// </summary>
- /// <param name="observer">The observer to send completion or error messages to.</param>
- /// <returns>The disposable resource that can be used to unsubscribe.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="observer"/> is null.</exception>
- public IDisposable Subscribe(IObserver<object> observer)
- {
- if (observer == null)
- throw new ArgumentNullException("observer");
-
- return new CompositeDisposable(subscription, subject.Subscribe(observer));
- }
- }
-} \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Experimental/System.Reactive.Experimental.csproj b/Rx.NET/System.Reactive.Experimental/System.Reactive.Experimental.csproj
deleted file mode 100644
index 8cdf281..0000000
--- a/Rx.NET/System.Reactive.Experimental/System.Reactive.Experimental.csproj
+++ /dev/null
@@ -1,62 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <ProductVersion>8.0.30703</ProductVersion>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{41E65B96-733B-41C4-A1BB-7476359B89EB}</ProjectGuid>
- <OutputType>Library</OutputType>
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <RootNamespace>System.Reactive.Experimental</RootNamespace>
- <AssemblyName>System.Reactive.Experimental</AssemblyName>
- <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
- <FileAlignment>512</FileAlignment>
- <ProductSignAssembly>true</ProductSignAssembly>
- <CodeAnalysisRuleSet>..\Rx.ruleset</CodeAnalysisRuleSet>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'ReleaseXBLV|AnyCPU'">
- <OutputPath>bin\ReleaseXBLV\</OutputPath>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'DebugXBLV|AnyCPU'">
- <OutputPath>bin\DebugXBLV\</OutputPath>
- </PropertyGroup>
- <Import Project="..\Common.targets" />
- <PropertyGroup>
- <DocumentationFile>$(OutputPath)\$(AssemblyName).XML</DocumentationFile>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)' == 'DebugPL' Or '$(Configuration)' == 'ReleasePL' ">
- <TargetFrameworkProfile>Profile7</TargetFrameworkProfile>
- </PropertyGroup>
- <ItemGroup>
- <Reference Include="mscorlib" Condition=" '$(BuildPlatform)' == 'SILVERLIGHT' Or '$(BuildPlatform)' == 'XNA' " />
- <Reference Include="System" />
- <Reference Include="System.Core" />
- <Reference Include="System.Observable" Condition=" '$(BuildFlavor)' == 'SILVERLIGHTM7' " />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="ExperimentalAttribute.cs" />
- <Compile Include="InternalsVisibleTo.cs" />
- <Compile Include="Properties\AssemblyInfo.cs" />
- <Compile Include="Reactive\Internal\BinaryObserver.cs" />
- <Compile Include="Reactive\Linq\QbservableEx.cs" />
- <Compile Include="Reactive\Linq\IQueryLanguageEx.cs" />
- <Compile Include="Reactive\Linq\ObservableEx.cs" />
- <Compile Include="Reactive\Linq\QbservableEx.Generated.cs" />
- <Compile Include="Reactive\Linq\QueryLanguageEx.cs" />
- <Compile Include="Reactive\ListObservable.cs" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\System.Reactive.Linq\System.Reactive.Linq.csproj">
- <Project>{63252AE9-5186-45CA-BFCD-FA51C6B66A43}</Project>
- <Name>System.Reactive.Linq</Name>
- </ProjectReference>
- <ProjectReference Include="..\System.Reactive.Core\System.Reactive.Core.csproj">
- <Project>{4E516F10-DA7A-4D43-963E-A93865ABEA5B}</Project>
- <Name>System.Reactive.Core</Name>
- </ProjectReference>
- <ProjectReference Include="..\System.Reactive.Interfaces\System.Reactive.Interfaces.csproj">
- <Project>{9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}</Project>
- <Name>System.Reactive.Interfaces</Name>
- </ProjectReference>
- </ItemGroup>
- <Import Project="..\Import.targets" />
-</Project> \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Interfaces/AssemblyFileVersionAttribute.cs b/Rx.NET/System.Reactive.Interfaces/AssemblyFileVersionAttribute.cs
deleted file mode 100644
index a12fbdf..0000000
--- a/Rx.NET/System.Reactive.Interfaces/AssemblyFileVersionAttribute.cs
+++ /dev/null
@@ -1,22 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if NO_ASSEMBLYFILEVERSIONATTRIBUTE
-namespace System.Reflection
-{
- [AttributeUsage(AttributeTargets.Assembly)]
- public class AssemblyFileVersionAttribute : Attribute
- {
- private readonly string _version;
-
- public AssemblyFileVersionAttribute(string version)
- {
- _version = version;
- }
-
- public string Version
- {
- get { return _version; }
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Interfaces/DateTimeOffset.cs b/Rx.NET/System.Reactive.Interfaces/DateTimeOffset.cs
deleted file mode 100644
index 5667709..0000000
--- a/Rx.NET/System.Reactive.Interfaces/DateTimeOffset.cs
+++ /dev/null
@@ -1,805 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if NO_DATETIMEOFFSET
-
-/*BDS+*/
-/*
- * Copied from Dev11 source tree. Markers used to indicate changes.
- * Search for BDS- and BDS+ to find additions and removals of code.
- */
-/*BDS+*/
-
-// ==++==
-//
-// Copyright (c) Microsoft Corporation. All rights reserved.
-//
-// ==--==
-namespace System {
-
- using System;
- using System.Threading;
- using System.Globalization;
- using System.Runtime.InteropServices;
- using System.Runtime.CompilerServices;
- using System.Runtime.Serialization;
- using System.Security.Permissions;
- /*BDS-*/ //using System.Diagnostics.Contracts;
-
- // DateTimeOffset is a value type that consists of a DateTime and a time zone offset,
- // ie. how far away the time is from GMT. The DateTime is stored whole, and the offset
- // is stored as an Int16 internally to save space, but presented as a TimeSpan.
- //
- // The range is constrained so that both the represented clock time and the represented
- // UTC time fit within the boundaries of MaxValue. This gives it the same range as DateTime
- // for actual UTC times, and a slightly constrained range on one end when an offset is
- // present.
- //
- // This class should be substitutable for date time in most cases; so most operations
- // effectively work on the clock time. However, the underlying UTC time is what counts
- // for the purposes of identity, sorting and subtracting two instances.
- //
- //
- // There are theoretically two date times stored, the UTC and the relative local representation
- // or the 'clock' time. It actually does not matter which is stored in m_dateTime, so it is desirable
- // for most methods to go through the helpers UtcDateTime and ClockDateTime both to abstract this
- // out and for internal readability.
-
- [StructLayout(LayoutKind.Auto)]
- [Serializable]
- public struct DateTimeOffset : IComparable, /*BDS-*/ //IFormattable, ISerializable, IDeserializationCallback,
- IComparable<DateTimeOffset>, IEquatable<DateTimeOffset> {
-
- // Constants
- internal const Int64 MaxOffset = TimeSpan.TicksPerHour * 14;
- internal const Int64 MinOffset = -MaxOffset;
-
- // Static Fields
- /*BDS-*/ //public static readonly DateTimeOffset MinValue = new DateTimeOffset(DateTime.MinTicks, TimeSpan.Zero);
- /*BDS+*/ public static readonly DateTimeOffset MinValue = new DateTimeOffset(DateTime.MinValue.Ticks, TimeSpan.Zero);
- /*BDS-*/ //public static readonly DateTimeOffset MaxValue = new DateTimeOffset(DateTime.MaxTicks, TimeSpan.Zero);
- /*BDS+*/ public static readonly DateTimeOffset MaxValue = new DateTimeOffset(DateTime.MaxValue.Ticks, TimeSpan.Zero);
-
- // Instance Fields
- private DateTime m_dateTime;
- private Int16 m_offsetMinutes;
-
- // Constructors
-
- // Constructs a DateTimeOffset from a tick count and offset
- public DateTimeOffset(long ticks, TimeSpan offset) {
- m_offsetMinutes = ValidateOffset(offset);
- // Let the DateTime constructor do the range checks
- DateTime dateTime = new DateTime(ticks);
- m_dateTime = ValidateDate(dateTime, offset);
- }
-
- // Constructs a DateTimeOffset from a DateTime. For UTC and Unspecified kinds, creates a
- // UTC instance with a zero offset. For local, extracts the local offset.
- public DateTimeOffset(DateTime dateTime) {
- TimeSpan offset;
- if (dateTime.Kind != DateTimeKind.Utc) {
- // Local and Unspecified are both treated as Local
- /*BDS-*/ //offset = TimeZoneInfo.Local.GetUtcOffset(dateTime, TimeZoneInfoOptions.NoThrowOnInvalidTime);
- /*BDS+*/ offset = TimeZone.CurrentTimeZone.GetUtcOffset(dateTime);
- }
- else {
- offset = new TimeSpan(0);
- }
- m_offsetMinutes = ValidateOffset(offset);
- m_dateTime = ValidateDate(dateTime, offset);
- }
-
- // Constructs a DateTimeOffset from a DateTime. And an offset. Always makes the clock time
- // consistent with the DateTime. For Utc ensures the offset is zero. For local, ensures that
- // the offset corresponds to the local.
- public DateTimeOffset(DateTime dateTime, TimeSpan offset) {
- if (dateTime.Kind == DateTimeKind.Local) {
- /*BDS-*/ //if (offset != TimeZoneInfo.Local.GetUtcOffset(dateTime, TimeZoneInfoOptions.NoThrowOnInvalidTime)) {
- /*BDS+*/ if (offset != TimeZone.CurrentTimeZone.GetUtcOffset(dateTime)) {
- /*BDS-*/ //throw new ArgumentException(Environment.GetResourceString("Argument_OffsetLocalMismatch"), "offset");
- /*BDS+*/ throw new ArgumentException("OffsetLocalMismatch", "offset");
- }
- }
- else if (dateTime.Kind == DateTimeKind.Utc) {
- if (offset != TimeSpan.Zero) {
- /*BDS-*/ //throw new ArgumentException(Environment.GetResourceString("Argument_OffsetUtcMismatch"), "offset");
- /*BDS+*/ throw new ArgumentException("OffsetUtcMismatch", "offset");
- }
- }
- m_offsetMinutes = ValidateOffset(offset);
- m_dateTime = ValidateDate(dateTime, offset);
- }
-
- // Constructs a DateTimeOffset from a given year, month, day, hour,
- // minute, second and offset.
- public DateTimeOffset(int year, int month, int day, int hour, int minute, int second, TimeSpan offset) {
- m_offsetMinutes = ValidateOffset(offset);
- m_dateTime = ValidateDate(new DateTime(year, month, day, hour, minute, second), offset);
- }
-
- // Constructs a DateTimeOffset from a given year, month, day, hour,
- // minute, second, millsecond and offset
- public DateTimeOffset(int year, int month, int day, int hour, int minute, int second, int millisecond, TimeSpan offset) {
- m_offsetMinutes = ValidateOffset(offset);
- m_dateTime = ValidateDate(new DateTime(year, month, day, hour, minute, second, millisecond), offset);
- }
-
-
- // Constructs a DateTimeOffset from a given year, month, day, hour,
- // minute, second, millsecond, Calendar and offset.
- public DateTimeOffset(int year, int month, int day, int hour, int minute, int second, int millisecond, Calendar calendar, TimeSpan offset) {
- m_offsetMinutes = ValidateOffset(offset);
- m_dateTime = ValidateDate(new DateTime(year, month, day, hour, minute, second, millisecond, calendar), offset);
- }
-
- // Returns a DateTimeOffset representing the current date and time. The
- // resolution of the returned value depends on the system timer. For
- // Windows NT 3.5 and later the timer resolution is approximately 10ms,
- // for Windows NT 3.1 it is approximately 16ms, and for Windows 95 and 98
- // it is approximately 55ms.
- //
- public static DateTimeOffset Now {
- get {
- return new DateTimeOffset(DateTime.Now);
- }
- }
-
- public static DateTimeOffset UtcNow {
- get {
- return new DateTimeOffset(DateTime.UtcNow);
- }
- }
-
- public DateTime DateTime {
- get {
- return ClockDateTime;
- }
- }
-
- public DateTime UtcDateTime {
- /*BDS-*/ //[Pure]
- get {
- /*BDS-*/ //Contract.Ensures(Contract.Result<DateTime>().Kind == DateTimeKind.Utc);
- return DateTime.SpecifyKind(m_dateTime, DateTimeKind.Utc);
- }
- }
-
- public DateTime LocalDateTime {
- /*BDS-*/ //[Pure]
- get {
- /*BDS-*/ //Contract.Ensures(Contract.Result<DateTime>().Kind == DateTimeKind.Local);
- return UtcDateTime.ToLocalTime();
- }
- }
-
- // Adjust to a given offset with the same UTC time. Can throw ArgumentException
- //
- public DateTimeOffset ToOffset(TimeSpan offset) {
- return new DateTimeOffset((m_dateTime + offset).Ticks, offset);
- }
-
-
- // Instance Properties
-
- // The clock or visible time represented. This is just a wrapper around the internal date because this is
- // the chosen storage mechanism. Going through this helper is good for readability and maintainability.
- // This should be used for display but not identity.
- private DateTime ClockDateTime {
- get {
- return new DateTime((m_dateTime + Offset).Ticks, DateTimeKind.Unspecified);
- }
- }
-
- // Returns the date part of this DateTimeOffset. The resulting value
- // corresponds to this DateTimeOffset with the time-of-day part set to
- // zero (midnight).
- //
- public DateTime Date {
- get {
- return ClockDateTime.Date;
- }
- }
-
- // Returns the day-of-month part of this DateTimeOffset. The returned
- // value is an integer between 1 and 31.
- //
- public int Day {
- get {
- /*BDS-*/ //Contract.Ensures(Contract.Result<int>() >= 1);
- /*BDS-*/ //Contract.Ensures(Contract.Result<int>() <= 31);
- return ClockDateTime.Day;
- }
- }
-
- // Returns the day-of-week part of this DateTimeOffset. The returned value
- // is an integer between 0 and 6, where 0 indicates Sunday, 1 indicates
- // Monday, 2 indicates Tuesday, 3 indicates Wednesday, 4 indicates
- // Thursday, 5 indicates Friday, and 6 indicates Saturday.
- //
- public DayOfWeek DayOfWeek {
- get {
- /*BDS-*/ //Contract.Ensures(Contract.Result<DayOfWeek>() >= DayOfWeek.Sunday);
- /*BDS-*/ //Contract.Ensures(Contract.Result<DayOfWeek>() <= DayOfWeek.Saturday);
- return ClockDateTime.DayOfWeek;
- }
- }
-
- // Returns the day-of-year part of this DateTimeOffset. The returned value
- // is an integer between 1 and 366.
- //
- public int DayOfYear {
- get {
- /*BDS-*/ //Contract.Ensures(Contract.Result<int>() >= 1);
- /*BDS-*/ //Contract.Ensures(Contract.Result<int>() <= 366); // leap year
- return ClockDateTime.DayOfYear;
- }
- }
-
- // Returns the hour part of this DateTimeOffset. The returned value is an
- // integer between 0 and 23.
- //
- public int Hour {
- get {
- /*BDS-*/ //Contract.Ensures(Contract.Result<int>() >= 0);
- /*BDS-*/ //Contract.Ensures(Contract.Result<int>() < 24);
- return ClockDateTime.Hour;
- }
- }
-
-
- // Returns the millisecond part of this DateTimeOffset. The returned value
- // is an integer between 0 and 999.
- //
- public int Millisecond {
- get {
- /*BDS-*/ //Contract.Ensures(Contract.Result<int>() >= 0);
- /*BDS-*/ //Contract.Ensures(Contract.Result<int>() < 1000);
- return ClockDateTime.Millisecond;
- }
- }
-
- // Returns the minute part of this DateTimeOffset. The returned value is
- // an integer between 0 and 59.
- //
- public int Minute {
- get {
- /*BDS-*/ //Contract.Ensures(Contract.Result<int>() >= 0);
- /*BDS-*/ //Contract.Ensures(Contract.Result<int>() < 60);
- return ClockDateTime.Minute;
- }
- }
-
- // Returns the month part of this DateTimeOffset. The returned value is an
- // integer between 1 and 12.
- //
- public int Month {
- get {
- /*BDS-*/ //Contract.Ensures(Contract.Result<int>() >= 1);
- return ClockDateTime.Month;
- }
- }
-
- public TimeSpan Offset {
- get {
- return new TimeSpan(0, m_offsetMinutes, 0);
- }
- }
-
- // Returns the second part of this DateTimeOffset. The returned value is
- // an integer between 0 and 59.
- //
- public int Second {
- get {
- /*BDS-*/ //Contract.Ensures(Contract.Result<int>() >= 0);
- /*BDS-*/ //Contract.Ensures(Contract.Result<int>() < 60);
- return ClockDateTime.Second;
- }
- }
-
- // Returns the tick count for this DateTimeOffset. The returned value is
- // the number of 100-nanosecond intervals that have elapsed since 1/1/0001
- // 12:00am.
- //
- public long Ticks {
- get {
- return ClockDateTime.Ticks;
- }
- }
-
- public long UtcTicks {
- get {
- return UtcDateTime.Ticks;
- }
- }
-
- // Returns the time-of-day part of this DateTimeOffset. The returned value
- // is a TimeSpan that indicates the time elapsed since midnight.
- //
- public TimeSpan TimeOfDay {
- get {
- return ClockDateTime.TimeOfDay;
- }
- }
-
- // Returns the year part of this DateTimeOffset. The returned value is an
- // integer between 1 and 9999.
- //
- public int Year {
- get {
- /*BDS-*/ //Contract.Ensures(Contract.Result<int>() >= 1 && Contract.Result<int>() <= 9999);
- return ClockDateTime.Year;
- }
- }
-
- // Returns the DateTimeOffset resulting from adding the given
- // TimeSpan to this DateTimeOffset.
- //
- public DateTimeOffset Add(TimeSpan timeSpan) {
- return new DateTimeOffset(ClockDateTime.Add(timeSpan), Offset);
- }
-
- // Returns the DateTimeOffset resulting from adding a fractional number of
- // days to this DateTimeOffset. The result is computed by rounding the
- // fractional number of days given by value to the nearest
- // millisecond, and adding that interval to this DateTimeOffset. The
- // value argument is permitted to be negative.
- //
- public DateTimeOffset AddDays(double days) {
- return new DateTimeOffset(ClockDateTime.AddDays(days), Offset);
- }
-
- // Returns the DateTimeOffset resulting from adding a fractional number of
- // hours to this DateTimeOffset. The result is computed by rounding the
- // fractional number of hours given by value to the nearest
- // millisecond, and adding that interval to this DateTimeOffset. The
- // value argument is permitted to be negative.
- //
- public DateTimeOffset AddHours(double hours) {
- return new DateTimeOffset(ClockDateTime.AddHours(hours), Offset);
- }
-
- // Returns the DateTimeOffset resulting from the given number of
- // milliseconds to this DateTimeOffset. The result is computed by rounding
- // the number of milliseconds given by value to the nearest integer,
- // and adding that interval to this DateTimeOffset. The value
- // argument is permitted to be negative.
- //
- public DateTimeOffset AddMilliseconds(double milliseconds) {
- return new DateTimeOffset(ClockDateTime.AddMilliseconds(milliseconds), Offset);
- }
-
- // Returns the DateTimeOffset resulting from adding a fractional number of
- // minutes to this DateTimeOffset. The result is computed by rounding the
- // fractional number of minutes given by value to the nearest
- // millisecond, and adding that interval to this DateTimeOffset. The
- // value argument is permitted to be negative.
- //
- public DateTimeOffset AddMinutes(double minutes) {
- return new DateTimeOffset(ClockDateTime.AddMinutes(minutes), Offset);
- }
-
- public DateTimeOffset AddMonths(int months) {
- return new DateTimeOffset(ClockDateTime.AddMonths(months), Offset);
- }
-
- // Returns the DateTimeOffset resulting from adding a fractional number of
- // seconds to this DateTimeOffset. The result is computed by rounding the
- // fractional number of seconds given by value to the nearest
- // millisecond, and adding that interval to this DateTimeOffset. The
- // value argument is permitted to be negative.
- //
- public DateTimeOffset AddSeconds(double seconds) {
- return new DateTimeOffset(ClockDateTime.AddSeconds(seconds), Offset);
- }
-
- // Returns the DateTimeOffset resulting from adding the given number of
- // 100-nanosecond ticks to this DateTimeOffset. The value argument
- // is permitted to be negative.
- //
- public DateTimeOffset AddTicks(long ticks) {
- return new DateTimeOffset(ClockDateTime.AddTicks(ticks), Offset);
- }
-
- // Returns the DateTimeOffset resulting from adding the given number of
- // years to this DateTimeOffset. The result is computed by incrementing
- // (or decrementing) the year part of this DateTimeOffset by value
- // years. If the month and day of this DateTimeOffset is 2/29, and if the
- // resulting year is not a leap year, the month and day of the resulting
- // DateTimeOffset becomes 2/28. Otherwise, the month, day, and time-of-day
- // parts of the result are the same as those of this DateTimeOffset.
- //
- public DateTimeOffset AddYears(int years) {
- return new DateTimeOffset(ClockDateTime.AddYears(years), Offset);
- }
-
- // Compares two DateTimeOffset values, returning an integer that indicates
- // their relationship.
- //
- public static int Compare(DateTimeOffset first, DateTimeOffset second) {
- return DateTime.Compare(first.UtcDateTime, second.UtcDateTime);
- }
-
- // Compares this DateTimeOffset to a given object. This method provides an
- // implementation of the IComparable interface. The object
- // argument must be another DateTimeOffset, or otherwise an exception
- // occurs. Null is considered less than any instance.
- //
- int IComparable.CompareTo(Object obj) {
- if (obj == null) return 1;
- if (!(obj is DateTimeOffset)) {
- /*BDS-*/ //throw new ArgumentException(Environment.GetResourceString("Arg_MustBeDateTimeOffset"));
- /*BDS+*/ throw new ArgumentException("MustBeDateTimeOffset");
- }
-
- DateTime objUtc = ((DateTimeOffset)obj).UtcDateTime;
- DateTime utc = UtcDateTime;
- if (utc > objUtc) return 1;
- if (utc < objUtc) return -1;
- return 0;
- }
-
- public int CompareTo(DateTimeOffset other) {
- DateTime otherUtc = other.UtcDateTime;
- DateTime utc = UtcDateTime;
- if (utc > otherUtc) return 1;
- if (utc < otherUtc) return -1;
- return 0;
- }
-
-
- // Checks if this DateTimeOffset is equal to a given object. Returns
- // true if the given object is a boxed DateTimeOffset and its value
- // is equal to the value of this DateTimeOffset. Returns false
- // otherwise.
- //
- public override bool Equals(Object obj) {
- if (obj is DateTimeOffset) {
- return UtcDateTime.Equals(((DateTimeOffset)obj).UtcDateTime);
- }
- return false;
- }
-
- public bool Equals(DateTimeOffset other) {
- return UtcDateTime.Equals(other.UtcDateTime);
- }
-
- public bool EqualsExact(DateTimeOffset other) {
- //
- // returns true when the ClockDateTime, Kind, and Offset match
- //
- // currently the Kind should always be Unspecified, but there is always the possibility that a future version
- // of DateTimeOffset overloads the Kind field
- //
- return (ClockDateTime == other.ClockDateTime && Offset == other.Offset && ClockDateTime.Kind == other.ClockDateTime.Kind);
- }
-
- // Compares two DateTimeOffset values for equality. Returns true if
- // the two DateTimeOffset values are equal, or false if they are
- // not equal.
- //
- public static bool Equals(DateTimeOffset first, DateTimeOffset second) {
- return DateTime.Equals(first.UtcDateTime, second.UtcDateTime);
- }
-
- // Creates a DateTimeOffset from a Windows filetime. A Windows filetime is
- // a long representing the date and time as the number of
- // 100-nanosecond intervals that have elapsed since 1/1/1601 12:00am.
- //
- public static DateTimeOffset FromFileTime(long fileTime) {
- return new DateTimeOffset(DateTime.FromFileTime(fileTime));
- }
-
-
- // ----- SECTION: private serialization instance methods ----------------*
-
-#if FEATURE_SERIALIZATION
- void IDeserializationCallback.OnDeserialization(Object sender) {
- try {
- m_offsetMinutes = ValidateOffset(Offset);
- m_dateTime = ValidateDate(ClockDateTime, Offset);
- }
- catch (ArgumentException e) {
- throw new SerializationException(Environment.GetResourceString("Serialization_InvalidData"), e);
- }
- }
-
-
- [System.Security.SecurityCritical] // auto-generated_required
- void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context) {
- if (info == null) {
- throw new ArgumentNullException("info");
- }
-
- Contract.EndContractBlock();
-
- info.AddValue("DateTime", m_dateTime);
- info.AddValue("OffsetMinutes", m_offsetMinutes);
- }
-
-
- DateTimeOffset(SerializationInfo info, StreamingContext context) {
- if (info == null) {
- throw new ArgumentNullException("info");
- }
-
- m_dateTime = (DateTime)info.GetValue("DateTime", typeof(DateTime));
- m_offsetMinutes = (Int16)info.GetValue("OffsetMinutes", typeof(Int16));
- }
-#endif
-
- // Returns the hash code for this DateTimeOffset.
- //
- public override int GetHashCode() {
- return UtcDateTime.GetHashCode();
- }
-
-/*BDS-*/ /*
- // Constructs a DateTimeOffset from a string. The string must specify a
- // date and optionally a time in a culture-specific or universal format.
- // Leading and trailing whitespace characters are allowed.
- //
- public static DateTimeOffset Parse(String input) {
- TimeSpan offset;
- DateTime dateResult = DateTimeParse.Parse(input,
- DateTimeFormatInfo.CurrentInfo,
- DateTimeStyles.None,
- out offset);
- return new DateTimeOffset(dateResult.Ticks, offset);
- }
-
- // Constructs a DateTimeOffset from a string. The string must specify a
- // date and optionally a time in a culture-specific or universal format.
- // Leading and trailing whitespace characters are allowed.
- //
- public static DateTimeOffset Parse(String input, IFormatProvider formatProvider) {
- return Parse(input, formatProvider, DateTimeStyles.None);
- }
-
- public static DateTimeOffset Parse(String input, IFormatProvider formatProvider, DateTimeStyles styles) {
- styles = ValidateStyles(styles, "styles");
- TimeSpan offset;
- DateTime dateResult = DateTimeParse.Parse(input,
- DateTimeFormatInfo.GetInstance(formatProvider),
- styles,
- out offset);
- return new DateTimeOffset(dateResult.Ticks, offset);
- }
-
- // Constructs a DateTimeOffset from a string. The string must specify a
- // date and optionally a time in a culture-specific or universal format.
- // Leading and trailing whitespace characters are allowed.
- //
- public static DateTimeOffset ParseExact(String input, String format, IFormatProvider formatProvider) {
- return ParseExact(input, format, formatProvider, DateTimeStyles.None);
- }
-
- // Constructs a DateTimeOffset from a string. The string must specify a
- // date and optionally a time in a culture-specific or universal format.
- // Leading and trailing whitespace characters are allowed.
- //
- public static DateTimeOffset ParseExact(String input, String format, IFormatProvider formatProvider, DateTimeStyles styles) {
- styles = ValidateStyles(styles, "styles");
- TimeSpan offset;
- DateTime dateResult = DateTimeParse.ParseExact(input,
- format,
- DateTimeFormatInfo.GetInstance(formatProvider),
- styles,
- out offset);
- return new DateTimeOffset(dateResult.Ticks, offset);
- }
-
- public static DateTimeOffset ParseExact(String input, String[] formats, IFormatProvider formatProvider, DateTimeStyles styles) {
- styles = ValidateStyles(styles, "styles");
- TimeSpan offset;
- DateTime dateResult = DateTimeParse.ParseExactMultiple(input,
- formats,
- DateTimeFormatInfo.GetInstance(formatProvider),
- styles,
- out offset);
- return new DateTimeOffset(dateResult.Ticks, offset);
- }
-*/ /*BDS-*/
-
- public TimeSpan Subtract(DateTimeOffset value) {
- return UtcDateTime.Subtract(value.UtcDateTime);
- }
-
- public DateTimeOffset Subtract(TimeSpan value) {
- return new DateTimeOffset(ClockDateTime.Subtract(value), Offset);
- }
-
-
- public long ToFileTime() {
- return UtcDateTime.ToFileTime();
- }
-
- public DateTimeOffset ToLocalTime() {
- return new DateTimeOffset(UtcDateTime.ToLocalTime());
- }
-
-/*BDS-*/ /*
- public override String ToString() {
- Contract.Ensures(Contract.Result<String>() != null);
- return DateTimeFormat.Format(ClockDateTime, null, DateTimeFormatInfo.CurrentInfo, Offset);
- }
-
- public String ToString(String format) {
- Contract.Ensures(Contract.Result<String>() != null);
- return DateTimeFormat.Format(ClockDateTime, format, DateTimeFormatInfo.CurrentInfo, Offset);
- }
-
- public String ToString(IFormatProvider formatProvider) {
- Contract.Ensures(Contract.Result<String>() != null);
- return DateTimeFormat.Format(ClockDateTime, null, DateTimeFormatInfo.GetInstance(formatProvider), Offset);
- }
-
- public String ToString(String format, IFormatProvider formatProvider) {
- Contract.Ensures(Contract.Result<String>() != null);
- return DateTimeFormat.Format(ClockDateTime, format, DateTimeFormatInfo.GetInstance(formatProvider), Offset);
- }
-*/ /*BDS-*/
-
- public DateTimeOffset ToUniversalTime() {
- return new DateTimeOffset(UtcDateTime);
- }
-
-/*BDS-*/ /*
- public static Boolean TryParse(String input, out DateTimeOffset result) {
- TimeSpan offset;
- DateTime dateResult;
- Boolean parsed = DateTimeParse.TryParse(input,
- DateTimeFormatInfo.CurrentInfo,
- DateTimeStyles.None,
- out dateResult,
- out offset);
- result = new DateTimeOffset(dateResult.Ticks, offset);
- return parsed;
- }
-
- public static Boolean TryParse(String input, IFormatProvider formatProvider, DateTimeStyles styles, out DateTimeOffset result) {
- styles = ValidateStyles(styles, "styles");
- TimeSpan offset;
- DateTime dateResult;
- Boolean parsed = DateTimeParse.TryParse(input,
- DateTimeFormatInfo.GetInstance(formatProvider),
- styles,
- out dateResult,
- out offset);
- result = new DateTimeOffset(dateResult.Ticks, offset);
- return parsed;
- }
-
- public static Boolean TryParseExact(String input, String format, IFormatProvider formatProvider, DateTimeStyles styles,
- out DateTimeOffset result) {
- styles = ValidateStyles(styles, "styles");
- TimeSpan offset;
- DateTime dateResult;
- Boolean parsed = DateTimeParse.TryParseExact(input,
- format,
- DateTimeFormatInfo.GetInstance(formatProvider),
- styles,
- out dateResult,
- out offset);
- result = new DateTimeOffset(dateResult.Ticks, offset);
- return parsed;
- }
-
- public static Boolean TryParseExact(String input, String[] formats, IFormatProvider formatProvider, DateTimeStyles styles,
- out DateTimeOffset result) {
- styles = ValidateStyles(styles, "styles");
- TimeSpan offset;
- DateTime dateResult;
- Boolean parsed = DateTimeParse.TryParseExactMultiple(input,
- formats,
- DateTimeFormatInfo.GetInstance(formatProvider),
- styles,
- out dateResult,
- out offset);
- result = new DateTimeOffset(dateResult.Ticks, offset);
- return parsed;
- }
-*/ /*BDS-*/
-
- // Ensures the TimeSpan is valid to go in a DateTimeOffset.
- private static Int16 ValidateOffset(TimeSpan offset) {
- Int64 ticks = offset.Ticks;
- if (ticks % TimeSpan.TicksPerMinute != 0) {
- /*BDS-*/ //throw new ArgumentException(Environment.GetResourceString("Argument_OffsetPrecision"), "offset");
- /*BDS+*/ throw new ArgumentException("OffsetPrecision", "offset");
- }
- if (ticks < MinOffset || ticks > MaxOffset) {
- /*BDS-*/ //throw new ArgumentOutOfRangeException("offset", Environment.GetResourceString("Argument_OffsetOutOfRange"));
- /*BDS+*/ throw new ArgumentOutOfRangeException("offset", "OffsetOutOfRange");
- }
- return (Int16)(offset.Ticks / TimeSpan.TicksPerMinute);
- }
-
- // Ensures that the time and offset are in range.
- private static DateTime ValidateDate(DateTime dateTime, TimeSpan offset) {
- // The key validation is that both the UTC and clock times fit. The clock time is validated
- // by the DateTime constructor.
- /*BDS-*/ //Contract.Assert(offset.Ticks >= MinOffset && offset.Ticks <= MaxOffset, "Offset not validated.");
- // This operation cannot overflow because offset should have already been validated to be within
- // 14 hours and the DateTime instance is more than that distance from the boundaries of Int64.
- Int64 utcTicks = dateTime.Ticks - offset.Ticks;
- /*BDS-*/ //if (utcTicks < DateTime.MinTicks || utcTicks > DateTime.MaxTicks) {
- /*BDS+*/ if (utcTicks < DateTime.MinValue.Ticks || utcTicks > DateTime.MaxValue.Ticks) {
- /*BDS-*/ //throw new ArgumentOutOfRangeException("offset", Environment.GetResourceString("Argument_UTCOutOfRange"));
- /*BDS+*/ throw new ArgumentOutOfRangeException("offset", "UTCOutOfRange");
- }
- // make sure the Kind is set to Unspecified
- //
- return new DateTime(utcTicks, DateTimeKind.Unspecified);
- }
-
- private static DateTimeStyles ValidateStyles(DateTimeStyles style, String parameterName) {
-/*BDS-*/ /*
- if ((style & DateTimeFormatInfo.InvalidDateTimeStyles) != 0) {
- throw new ArgumentException(Environment.GetResourceString("Argument_InvalidDateTimeStyles"), parameterName);
- }
-*/ /*BDS-*/
- if (((style & (DateTimeStyles.AssumeLocal)) != 0) && ((style & (DateTimeStyles.AssumeUniversal)) != 0)) {
- /*BDS-*/ //throw new ArgumentException(Environment.GetResourceString("Argument_ConflictingDateTimeStyles"), parameterName);
- /*BDS+*/ throw new ArgumentException("ConflictingDateTimeStyles", parameterName);
- }
- if ((style & DateTimeStyles.NoCurrentDateDefault) != 0) {
- /*BDS-*/ //throw new ArgumentException(Environment.GetResourceString("Argument_DateTimeOffsetInvalidDateTimeStyles"), parameterName);
- /*BDS+*/ throw new ArgumentException("DateTimeOffsetInvalidDateTimeStyles", parameterName);
- }
-
- /*BDS-*/ //Contract.EndContractBlock();
- // RoundtripKind does not make sense for DateTimeOffset; ignore this flag for backward compatability with DateTime
- style &= ~DateTimeStyles.RoundtripKind;
-
- // AssumeLocal is also ignored as that is what we do by default with DateTimeOffset.Parse
- style &= ~DateTimeStyles.AssumeLocal;
-
- return style;
- }
-
- // Operators
-
- public static implicit operator DateTimeOffset (DateTime dateTime) {
- return new DateTimeOffset(dateTime);
- }
-
- public static DateTimeOffset operator +(DateTimeOffset dateTimeOffset, TimeSpan timeSpan) {
- return new DateTimeOffset(dateTimeOffset.ClockDateTime + timeSpan, dateTimeOffset.Offset);
- }
-
-
- public static DateTimeOffset operator -(DateTimeOffset dateTimeOffset, TimeSpan timeSpan) {
- return new DateTimeOffset(dateTimeOffset.ClockDateTime - timeSpan, dateTimeOffset.Offset);
- }
-
- public static TimeSpan operator -(DateTimeOffset left, DateTimeOffset right) {
- return left.UtcDateTime - right.UtcDateTime;
- }
-
- public static bool operator ==(DateTimeOffset left, DateTimeOffset right) {
- return left.UtcDateTime == right.UtcDateTime;
- }
-
- public static bool operator !=(DateTimeOffset left, DateTimeOffset right) {
- return left.UtcDateTime != right.UtcDateTime;
- }
-
- public static bool operator <(DateTimeOffset left, DateTimeOffset right) {
- return left.UtcDateTime < right.UtcDateTime;
- }
-
- public static bool operator <=(DateTimeOffset left, DateTimeOffset right) {
- return left.UtcDateTime <= right.UtcDateTime;
- }
-
- public static bool operator >(DateTimeOffset left, DateTimeOffset right) {
- return left.UtcDateTime > right.UtcDateTime;
- }
-
- public static bool operator >=(DateTimeOffset left, DateTimeOffset right) {
- return left.UtcDateTime >= right.UtcDateTime;
- }
-
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Interfaces/GlobalSuppressions.cs b/Rx.NET/System.Reactive.Interfaces/GlobalSuppressions.cs
deleted file mode 100644
index 6c0ef54..0000000
--- a/Rx.NET/System.Reactive.Interfaces/GlobalSuppressions.cs
+++ /dev/null
@@ -1,17 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-// This file is used by Code Analysis to maintain SuppressMessage
-// attributes that are applied to this project.
-// Project-level suppressions either have no target or are given
-// a specific target and scoped to a namespace, type, member, etc.
-//
-// To add a suppression to this file, right-click the message in the
-// Error List, point to "Suppress Message(s)", and click
-// "In Project Suppression File".
-// You do not need to add suppressions to this file manually.
-
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes", Scope = "namespace", Target = "System.Reactive", Justification = "By design.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes", Scope = "namespace", Target = "System.Reactive.Disposables", Justification = "By design.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes", Scope = "namespace", Target = "System.Reactive.Linq", Justification = "By design.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes", Scope = "namespace", Target = "System.Reactive.Subjects", Justification = "By design.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA2210:AssembliesShouldHaveValidStrongNames", Justification = "Taken care of by lab build.")]
diff --git a/Rx.NET/System.Reactive.Interfaces/IObservable.cs b/Rx.NET/System.Reactive.Interfaces/IObservable.cs
deleted file mode 100644
index f1b62d2..0000000
--- a/Rx.NET/System.Reactive.Interfaces/IObservable.cs
+++ /dev/null
@@ -1,21 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if NO_RXINTERFACES
-namespace System
-{
- /// <summary>
- /// Represents a push-style collection.
- /// </summary>
-#if !NO_VARIANCE
- public interface IObservable<out T>
-#else
- public interface IObservable<T>
-#endif
- {
- /// <summary>
- /// Subscribes an observer to the observable sequence.
- /// </summary>
- IDisposable Subscribe(IObserver<T> observer);
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Interfaces/IObserver.cs b/Rx.NET/System.Reactive.Interfaces/IObserver.cs
deleted file mode 100644
index 6ed6c58..0000000
--- a/Rx.NET/System.Reactive.Interfaces/IObserver.cs
+++ /dev/null
@@ -1,33 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if NO_RXINTERFACES
-namespace System
-{
- /// <summary>
- /// Supports push-style iteration over an observable sequence.
- /// </summary>
-#if !NO_VARIANCE
- public interface IObserver<in T>
-#else
- public interface IObserver<T>
-#endif
- {
- /// <summary>
- /// Notifies the observer of a new element in the sequence.
- /// </summary>
- /// <param name="value">Next element in the sequence.</param>
- void OnNext(T value);
-
- /// <summary>
- /// Notifies the observer that an exception has occurred.
- /// </summary>
- /// <param name="error">The error that has occurred.</param>
- void OnError(Exception error);
-
- /// <summary>
- /// Notifies the observer of the end of the sequence.
- /// </summary>
- void OnCompleted();
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Interfaces/NamespaceDocs.cs b/Rx.NET/System.Reactive.Interfaces/NamespaceDocs.cs
deleted file mode 100644
index c398bf7..0000000
--- a/Rx.NET/System.Reactive.Interfaces/NamespaceDocs.cs
+++ /dev/null
@@ -1,63 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-namespace System.Reactive
-{
- /// <summary>
- /// The <b>System.Reactive</b> namespace contains interfaces and classes used throughout the Reactive Extensions library.
- /// </summary>
- [System.Runtime.CompilerServices.CompilerGeneratedAttribute]
- class NamespaceDoc
- {
- }
-}
-
-namespace System.Reactive.Concurrency
-{
- /// <summary>
- /// The <b>System.Reactive.Concurrency</b> namespace contains interfaces and classes that provide the scheduler infrastructure used by Reactive Extensions to construct and
- /// process event streams. Schedulers are used to parameterize the concurrency introduced by query operators, provide means to virtualize time, to process historical data,
- /// and to write unit tests for functionality built using Reactive Extensions constructs.
- /// </summary>
- [System.Runtime.CompilerServices.CompilerGeneratedAttribute]
- class NamespaceDoc
- {
- }
-}
-
-namespace System.Reactive.Disposables
-{
- /// <summary>
- /// The <b>System.Reactive.Disposables</b> namespace contains interfaces and classes that provide a compositional set of constructs used to deal with resource and subscription
- /// management in Reactive Extensions. Those types are used extensively within the implementation of Reactive Extensions and are useful when writing custom query operators or
- /// schedulers.
- /// </summary>
- [System.Runtime.CompilerServices.CompilerGeneratedAttribute]
- class NamespaceDoc
- {
- }
-}
-
-namespace System.Reactive.Linq
-{
- /// <summary>
- /// The <b>System.Reactive.Linq</b> namespace contains interfaces and classes that support expressing queries over observable sequences, using Language Integrated Query (LINQ).
- /// Query operators are made available as extension methods for IObservable&lt;T&gt; and IQbservable&lt;T&gt; defined on the Observable and Qbservable classes, respectively.
- /// </summary>
- [System.Runtime.CompilerServices.CompilerGeneratedAttribute]
- class NamespaceDoc
- {
- }
-}
-
-namespace System.Reactive.Subjects
-{
- /// <summary>
- /// The <b>System.Reactive.Subjects</b> namespace contains interfaces and classes to represent subjects, which are objects implementing both IObservable&lt;T&gt; and IObserver&lt;T&gt;.
- /// Subjects are often used as sources of events, allowing one party to raise events and allowing another party to write queries over the event stream. Because of their ability to
- /// have multiple registered observers, subjects are also used as a facility to provide multicast behavior for event streams in queries.
- /// </summary>
- [System.Runtime.CompilerServices.CompilerGeneratedAttribute]
- class NamespaceDoc
- {
- }
-}
diff --git a/Rx.NET/System.Reactive.Interfaces/Properties/AssemblyInfo.cs b/Rx.NET/System.Reactive.Interfaces/Properties/AssemblyInfo.cs
deleted file mode 100644
index 62df774..0000000
--- a/Rx.NET/System.Reactive.Interfaces/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,39 +0,0 @@
-using System;
-using System.Reflection;
-using System.Resources;
-using System.Runtime.InteropServices;
-using System.Security;
-
-[assembly: AssemblyTitle("System.Reactive.Interfaces")]
-// Notice: same description as in the .nuspec files; see Source/Rx/Setup/NuGet
-[assembly: AssemblyDescription("Reactive Extensions Interfaces Library containing essential interfaces.")]
-#if DEBUG
-[assembly: AssemblyConfiguration("Debug")]
-#else
-[assembly: AssemblyConfiguration("Retail")]
-#endif
-[assembly: AssemblyCompany("Microsoft Corporation")]
-[assembly: AssemblyProduct("Reactive Extensions")]
-[assembly: AssemblyCopyright("\x00a9 Microsoft Corporation. All rights reserved.")]
-[assembly: NeutralResourcesLanguage("en-US")]
-
-#if !PLIB
-[assembly: ComVisible(false)]
-#endif
-
-[assembly: CLSCompliant(true)]
-
-#if HAS_APTCA && NO_CODECOVERAGE
-[assembly: AllowPartiallyTrustedCallers]
-#endif
-
-#if XBOX_LAKEVIEW
-[assembly: SecurityTransparent]
-#endif
-
-//
-// Starting with v2.0 RC, we're bumping this file's version number,
-// because MSI wouldn't pick it up as an update otherwise...
-//
-//[assembly: AssemblyVersion("2.0.0.0")]
-//[assembly: AssemblyFileVersion("2.0.0.0")]
diff --git a/Rx.NET/System.Reactive.Interfaces/Reactive/Concurrency/IScheduledItem.cs b/Rx.NET/System.Reactive.Interfaces/Reactive/Concurrency/IScheduledItem.cs
deleted file mode 100644
index ebb4879..0000000
--- a/Rx.NET/System.Reactive.Interfaces/Reactive/Concurrency/IScheduledItem.cs
+++ /dev/null
@@ -1,21 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-namespace System.Reactive.Concurrency
-{
- /// <summary>
- /// Represents a work item that has been scheduled.
- /// </summary>
- /// <typeparam name="TAbsolute">Absolute time representation type.</typeparam>
- public interface IScheduledItem<TAbsolute>
- {
- /// <summary>
- /// Gets the absolute time at which the item is due for invocation.
- /// </summary>
- TAbsolute DueTime { get; }
-
- /// <summary>
- /// Invokes the work item.
- /// </summary>
- void Invoke();
- }
-}
diff --git a/Rx.NET/System.Reactive.Interfaces/Reactive/Concurrency/IScheduler.cs b/Rx.NET/System.Reactive.Interfaces/Reactive/Concurrency/IScheduler.cs
deleted file mode 100644
index 1c837f0..0000000
--- a/Rx.NET/System.Reactive.Interfaces/Reactive/Concurrency/IScheduler.cs
+++ /dev/null
@@ -1,44 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-namespace System.Reactive.Concurrency
-{
- /// <summary>
- /// Represents an object that schedules units of work.
- /// </summary>
- public interface IScheduler
- {
- /// <summary>
- /// Gets the scheduler's notion of current time.
- /// </summary>
- DateTimeOffset Now { get; }
-
- /// <summary>
- /// Schedules an action to be executed.
- /// </summary>
- /// <typeparam name="TState">The type of the state passed to the scheduled action.</typeparam>
- /// <param name="state">State passed to the action to be executed.</param>
- /// <param name="action">Action to be executed.</param>
- /// <returns>The disposable object used to cancel the scheduled action (best effort).</returns>
- IDisposable Schedule<TState>(TState state, Func<IScheduler, TState, IDisposable> action);
-
- /// <summary>
- /// Schedules an action to be executed after dueTime.
- /// </summary>
- /// <typeparam name="TState">The type of the state passed to the scheduled action.</typeparam>
- /// <param name="state">State passed to the action to be executed.</param>
- /// <param name="action">Action to be executed.</param>
- /// <param name="dueTime">Relative time after which to execute the action.</param>
- /// <returns>The disposable object used to cancel the scheduled action (best effort).</returns>
- IDisposable Schedule<TState>(TState state, TimeSpan dueTime, Func<IScheduler, TState, IDisposable> action);
-
- /// <summary>
- /// Schedules an action to be executed at dueTime.
- /// </summary>
- /// <typeparam name="TState">The type of the state passed to the scheduled action.</typeparam>
- /// <param name="state">State passed to the action to be executed.</param>
- /// <param name="action">Action to be executed.</param>
- /// <param name="dueTime">Absolute time at which to execute the action.</param>
- /// <returns>The disposable object used to cancel the scheduled action (best effort).</returns>
- IDisposable Schedule<TState>(TState state, DateTimeOffset dueTime, Func<IScheduler, TState, IDisposable> action);
- }
-} \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Interfaces/Reactive/Concurrency/ISchedulerLongRunning.cs b/Rx.NET/System.Reactive.Interfaces/Reactive/Concurrency/ISchedulerLongRunning.cs
deleted file mode 100644
index 7d076b1..0000000
--- a/Rx.NET/System.Reactive.Interfaces/Reactive/Concurrency/ISchedulerLongRunning.cs
+++ /dev/null
@@ -1,26 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System.Reactive.Disposables;
-
-namespace System.Reactive.Concurrency
-{
- /// <summary>
- /// Scheduler with support for starting long-running tasks.
- /// This type of scheduler can be used to run loops more efficiently instead of using recursive scheduling.
- /// </summary>
- public interface ISchedulerLongRunning
- {
- /// <summary>
- /// Schedules a long-running piece of work.
- /// </summary>
- /// <typeparam name="TState">The type of the state passed to the scheduled action.</typeparam>
- /// <param name="state">State passed to the action to be executed.</param>
- /// <param name="action">Action to be executed.</param>
- /// <returns>The disposable object used to cancel the scheduled action (best effort).</returns>
- /// <remarks>
- /// <para><b>Notes to implementers</b></para>
- /// The returned disposable object should not prevent the work from starting, but only set the cancellation flag passed to the specified action.
- /// </remarks>
- IDisposable ScheduleLongRunning<TState>(TState state, Action<TState, ICancelable> action);
- }
-} \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Interfaces/Reactive/Concurrency/ISchedulerPeriodic.cs b/Rx.NET/System.Reactive.Interfaces/Reactive/Concurrency/ISchedulerPeriodic.cs
deleted file mode 100644
index 825a748..0000000
--- a/Rx.NET/System.Reactive.Interfaces/Reactive/Concurrency/ISchedulerPeriodic.cs
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System.Reactive.Disposables;
-
-namespace System.Reactive.Concurrency
-{
- /// <summary>
- /// Scheduler with support for running periodic tasks.
- /// This type of scheduler can be used to run timers more efficiently instead of using recursive scheduling.
- /// </summary>
- public interface ISchedulerPeriodic
- {
- /// <summary>
- /// Schedules a periodic piece of work.
- /// </summary>
- /// <typeparam name="TState">The type of the state passed to the scheduled action.</typeparam>
- /// <param name="state">Initial state passed to the action upon the first iteration.</param>
- /// <param name="period">Period for running the work periodically.</param>
- /// <param name="action">Action to be executed, potentially updating the state.</param>
- /// <returns>The disposable object used to cancel the scheduled recurring action (best effort).</returns>
- IDisposable SchedulePeriodic<TState>(TState state, TimeSpan period, Func<TState, TState> action);
- }
-}
diff --git a/Rx.NET/System.Reactive.Interfaces/Reactive/Concurrency/IStopwatch.cs b/Rx.NET/System.Reactive.Interfaces/Reactive/Concurrency/IStopwatch.cs
deleted file mode 100644
index 1b482ab..0000000
--- a/Rx.NET/System.Reactive.Interfaces/Reactive/Concurrency/IStopwatch.cs
+++ /dev/null
@@ -1,17 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System;
-
-namespace System.Reactive.Concurrency
-{
- /// <summary>
- /// Abstraction for a stopwatch to compute time relative to a starting point.
- /// </summary>
- public interface IStopwatch
- {
- /// <summary>
- /// Gets the time elapsed since the stopwatch object was obtained.
- /// </summary>
- TimeSpan Elapsed { get; }
- }
-}
diff --git a/Rx.NET/System.Reactive.Interfaces/Reactive/Concurrency/IStopwatchProvider.cs b/Rx.NET/System.Reactive.Interfaces/Reactive/Concurrency/IStopwatchProvider.cs
deleted file mode 100644
index 6a0d2a5..0000000
--- a/Rx.NET/System.Reactive.Interfaces/Reactive/Concurrency/IStopwatchProvider.cs
+++ /dev/null
@@ -1,25 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System;
-
-namespace System.Reactive.Concurrency
-{
- /*
- * The ability to request a stopwatch object has been introduced in Rx v2.0 to reduce the
- * number of allocations made by operators that use absolute time to compute relative time
- * diffs, such as TimeInterval and Delay. This causes a large number of related objects to
- * be allocated in the BCL, e.g. System.Globalization.DaylightTime.
- */
-
- /// <summary>
- /// Provider for IStopwatch objects.
- /// </summary>
- public interface IStopwatchProvider
- {
- /// <summary>
- /// Starts a new stopwatch object.
- /// </summary>
- /// <returns>New stopwatch object; started at the time of the request.</returns>
- IStopwatch StartStopwatch();
- }
-}
diff --git a/Rx.NET/System.Reactive.Interfaces/Reactive/Disposables/ICancelable.cs b/Rx.NET/System.Reactive.Interfaces/Reactive/Disposables/ICancelable.cs
deleted file mode 100644
index c361b3b..0000000
--- a/Rx.NET/System.Reactive.Interfaces/Reactive/Disposables/ICancelable.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-namespace System.Reactive.Disposables
-{
- /// <summary>
- /// Disposable resource with dipsosal state tracking.
- /// </summary>
- public interface ICancelable : IDisposable
- {
- /// <summary>
- /// Gets a value that indicates whether the object is disposed.
- /// </summary>
- bool IsDisposed { get; }
- }
-}
diff --git a/Rx.NET/System.Reactive.Interfaces/Reactive/IEventPattern.cs b/Rx.NET/System.Reactive.Interfaces/Reactive/IEventPattern.cs
deleted file mode 100644
index 3aab8da..0000000
--- a/Rx.NET/System.Reactive.Interfaces/Reactive/IEventPattern.cs
+++ /dev/null
@@ -1,37 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-namespace System.Reactive
-{
- /// <summary>
- /// Represents a .NET event invocation consisting of the strongly typed object that raised the event and the data that was generated by the event.
- /// </summary>
- /// <typeparam name="TSender">
- /// The type of the sender that raised the event.
- /// This type parameter is covariant. That is, you can use either the type you specified or any type that is more derived. For more information about covariance and contravariance, see Covariance and Contravariance in Generics.
- /// </typeparam>
- /// <typeparam name="TEventArgs">
- /// The type of the event data generated by the event.
- /// This type parameter is covariant. That is, you can use either the type you specified or any type that is more derived. For more information about covariance and contravariance, see Covariance and Contravariance in Generics.
- /// </typeparam>
- public interface IEventPattern<
-#if !NO_VARIANCE
- out TSender, out TEventArgs
-#else
- TSender, TEventArgs
-#endif
- >
-#if !NO_EVENTARGS_CONSTRAINT
- where TEventArgs : EventArgs
-#endif
- {
- /// <summary>
- /// Gets the sender object that raised the event.
- /// </summary>
- TSender Sender { get; }
-
- /// <summary>
- /// Gets the event data that was generated by the event.
- /// </summary>
- TEventArgs EventArgs { get; }
- }
-}
diff --git a/Rx.NET/System.Reactive.Interfaces/Reactive/IEventPatternSource.cs b/Rx.NET/System.Reactive.Interfaces/Reactive/IEventPatternSource.cs
deleted file mode 100644
index d87010d..0000000
--- a/Rx.NET/System.Reactive.Interfaces/Reactive/IEventPatternSource.cs
+++ /dev/null
@@ -1,19 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-namespace System.Reactive
-{
- /// <summary>
- /// Represents a data stream signaling its elements by means of an event.
- /// </summary>
- /// <typeparam name="TEventArgs">The type of the event data generated by the event.</typeparam>
- public interface IEventPatternSource<TEventArgs>
-#if !NO_EVENTARGS_CONSTRAINT
- where TEventArgs : EventArgs
-#endif
- {
- /// <summary>
- /// Event signaling the next element in the data stream.
- /// </summary>
- event EventHandler<TEventArgs> OnNext;
- }
-}
diff --git a/Rx.NET/System.Reactive.Interfaces/Reactive/IEventSource.cs b/Rx.NET/System.Reactive.Interfaces/Reactive/IEventSource.cs
deleted file mode 100644
index 1ab5135..0000000
--- a/Rx.NET/System.Reactive.Interfaces/Reactive/IEventSource.cs
+++ /dev/null
@@ -1,25 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-namespace System.Reactive
-{
- /// <summary>
- /// Represents a data stream signaling its elements by means of an event.
- /// </summary>
- /// <typeparam name="T">
- /// The type of the event data generated by the event.
- /// This type parameter is covariant. That is, you can use either the type you specified or any type that is more derived. For more information about covariance and contravariance, see Covariance and Contravariance in Generics.
- /// </typeparam>
- public interface IEventSource<
-#if !NO_VARIANCE && !SILVERLIGHT4 // SL4 doesn't mark Action<T> as contravariant!
- out
-#endif
- T>
- {
- /// <summary>
- /// Event signaling the next element in the data stream.
- /// </summary>
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix", Justification = "By design.")]
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1009:DeclareEventHandlersCorrectly", Justification = "Can't do this for Action<T>.")]
- event Action<T> OnNext;
- }
-}
diff --git a/Rx.NET/System.Reactive.Interfaces/Reactive/IObserver.Result.cs b/Rx.NET/System.Reactive.Interfaces/Reactive/IObserver.Result.cs
deleted file mode 100644
index 8a4307d..0000000
--- a/Rx.NET/System.Reactive.Interfaces/Reactive/IObserver.Result.cs
+++ /dev/null
@@ -1,42 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-namespace System.Reactive
-{
- /// <summary>
- /// Provides a mechanism for receiving push-based notifications and returning a response.
- /// </summary>
- /// <typeparam name="TValue">
- /// The type of the elements received by the observer.
- /// This type parameter is contravariant. That is, you can use either the type you specified or any type that is less derived. For more information about covariance and contravariance, see Covariance and Contravariance in Generics.
- /// </typeparam>
- /// <typeparam name="TResult">
- /// The type of the result returned from the observer's notification handlers.
- /// This type parameter is covariant. That is, you can use either the type you specified or any type that is more derived. For more information about covariance and contravariance, see Covariance and Contravariance in Generics.
- /// </typeparam>
-#if !NO_VARIANCE
- public interface IObserver<in TValue, out TResult>
-#else
- public interface IObserver<TValue, TResult>
-#endif
- {
- /// <summary>
- /// Notifies the observer of a new element in the sequence.
- /// </summary>
- /// <param name="value">The new element in the sequence.</param>
- /// <returns>Result returned upon observation of a new element.</returns>
- TResult OnNext(TValue value);
-
- /// <summary>
- /// Notifies the observer that an exception has occurred.
- /// </summary>
- /// <param name="exception">The exception that occurred.</param>
- /// <returns>Result returned upon observation of an error.</returns>
- TResult OnError(Exception exception);
-
- /// <summary>
- /// Notifies the observer of the end of the sequence.
- /// </summary>
- /// <returns>Result returned upon observation of the sequence completion.</returns>
- TResult OnCompleted();
- }
-} \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Interfaces/Reactive/Linq/IGroupedObservable.cs b/Rx.NET/System.Reactive.Interfaces/Reactive/Linq/IGroupedObservable.cs
deleted file mode 100644
index 050cf2a..0000000
--- a/Rx.NET/System.Reactive.Interfaces/Reactive/Linq/IGroupedObservable.cs
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-namespace System.Reactive.Linq
-{
- /// <summary>
- /// Represents an observable sequence of elements that have a common key.
- /// </summary>
- /// <typeparam name="TKey">
- /// The type of the key shared by all elements in the group.
- /// This type parameter is covariant. That is, you can use either the type you specified or any type that is more derived. For more information about covariance and contravariance, see Covariance and Contravariance in Generics.
- /// </typeparam>
- /// <typeparam name="TElement">
- /// The type of the elements in the group.
- /// This type parameter is covariant. That is, you can use either the type you specified or any type that is more derived. For more information about covariance and contravariance, see Covariance and Contravariance in Generics.
- /// </typeparam>
-#if !NO_VARIANCE
- public interface IGroupedObservable<out TKey, out TElement> : IObservable<TElement>
-#else
- public interface IGroupedObservable<TKey, TElement> : IObservable<TElement>
-#endif
- {
- /// <summary>
- /// Gets the common key.
- /// </summary>
- TKey Key { get; }
- }
-}
diff --git a/Rx.NET/System.Reactive.Interfaces/Reactive/Linq/IQbservable.cs b/Rx.NET/System.Reactive.Interfaces/Reactive/Linq/IQbservable.cs
deleted file mode 100644
index 3d0b610..0000000
--- a/Rx.NET/System.Reactive.Interfaces/Reactive/Linq/IQbservable.cs
+++ /dev/null
@@ -1,46 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_EXPRESSIONS
-using System.Linq.Expressions;
-
-namespace System.Reactive.Linq
-{
- /// <summary>
- /// Provides functionality to evaluate queries against a specific data source wherein the type of the data is known.
- /// </summary>
- /// <typeparam name="T">
- /// The type of the data in the data source.
- /// This type parameter is covariant. That is, you can use either the type you specified or any type that is more derived. For more information about covariance and contravariance, see Covariance and Contravariance in Generics.
- /// </typeparam>
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Qbservable", Justification = "What a pleasure to write 'by design' here.")]
- public interface IQbservable<
-#if !NO_VARIANCE
- out
-#endif
- T> : IQbservable, IObservable<T>
- {
- }
-
- /// <summary>
- /// Provides functionality to evaluate queries against a specific data source wherein the type of the data is not specified.
- /// </summary>
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Qbservable", Justification = "What a pleasure to write 'by design' here.")]
- public interface IQbservable
- {
- /// <summary>
- /// Gets the type of the element(s) that are returned when the expression tree associated with this instance of IQbservable is executed.
- /// </summary>
- Type ElementType { get; }
-
- /// <summary>
- /// Gets the expression tree that is associated with the instance of IQbservable.
- /// </summary>
- Expression Expression { get; }
-
- /// <summary>
- /// Gets the query provider that is associated with this data source.
- /// </summary>
- IQbservableProvider Provider { get; }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Interfaces/Reactive/Linq/IQbservableProvider.cs b/Rx.NET/System.Reactive.Interfaces/Reactive/Linq/IQbservableProvider.cs
deleted file mode 100644
index 767a6a4..0000000
--- a/Rx.NET/System.Reactive.Interfaces/Reactive/Linq/IQbservableProvider.cs
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_EXPRESSIONS
-using System.Linq.Expressions;
-
-namespace System.Reactive.Linq
-{
- /// <summary>
- /// Defines methods to create and execute queries that are described by an IQbservable object.
- /// </summary>
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Qbservable", Justification = "What a pleasure to write 'by design' here.")]
- public interface IQbservableProvider
- {
- /// <summary>
- /// Constructs an IQbservable&gt;TResult&lt; object that can evaluate the query represented by a specified expression tree.
- /// </summary>
- /// <typeparam name="TResult">The type of the elements of the System.Reactive.Linq.IQbservable&lt;T&gt; that is returned.</typeparam>
- /// <param name="expression">Expression tree representing the query.</param>
- /// <returns>IQbservable object that can evaluate the given query expression.</returns>
- IQbservable<TResult> CreateQuery<TResult>(Expression expression);
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Interfaces/Reactive/Subjects/IConnectableObservable.cs b/Rx.NET/System.Reactive.Interfaces/Reactive/Subjects/IConnectableObservable.cs
deleted file mode 100644
index 649e541..0000000
--- a/Rx.NET/System.Reactive.Interfaces/Reactive/Subjects/IConnectableObservable.cs
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-namespace System.Reactive.Subjects
-{
- /// <summary>
- /// Represents an observable wrapper that can be connected and disconnected from its underlying observable sequence.
- /// </summary>
- /// <typeparam name="T">
- /// The type of the elements in the sequence.
- /// This type parameter is covariant. That is, you can use either the type you specified or any type that is more derived. For more information about covariance and contravariance, see Covariance and Contravariance in Generics.
- /// </typeparam>
-#if !NO_VARIANCE
- public interface IConnectableObservable<out T> : IObservable<T>
-#else
- public interface IConnectableObservable<T> : IObservable<T>
-#endif
- {
- /// <summary>
- /// Connects the observable wrapper to its source. All subscribed observers will receive values from the underlying observable sequence as long as the connection is established.
- /// </summary>
- /// <returns>Disposable used to disconnect the observable wrapper from its source, causing subscribed observer to stop receiving values from the underlying observable sequence.</returns>
- IDisposable Connect();
- }
-}
diff --git a/Rx.NET/System.Reactive.Interfaces/Reactive/Subjects/ISubject.Multi.cs b/Rx.NET/System.Reactive.Interfaces/Reactive/Subjects/ISubject.Multi.cs
deleted file mode 100644
index 31ce1af..0000000
--- a/Rx.NET/System.Reactive.Interfaces/Reactive/Subjects/ISubject.Multi.cs
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-namespace System.Reactive.Subjects
-{
- /// <summary>
- /// Represents an object that is both an observable sequence as well as an observer.
- /// </summary>
- /// <typeparam name="TSource">
- /// The type of the elements received by the subject.
- /// This type parameter is contravariant. That is, you can use either the type you specified or any type that is less derived. For more information about covariance and contravariance, see Covariance and Contravariance in Generics.
- /// </typeparam>
- /// <typeparam name="TResult">
- /// The type of the elements produced by the subject.
- /// This type parameter is covariant. That is, you can use either the type you specified or any type that is more derived. For more information about covariance and contravariance, see Covariance and Contravariance in Generics.
- /// </typeparam>
-#if !NO_VARIANCE
- public interface ISubject<in TSource, out TResult> : IObserver<TSource>, IObservable<TResult>
-#else
- public interface ISubject<TSource, TResult> : IObserver<TSource>, IObservable<TResult>
-#endif
- {
- }
-}
diff --git a/Rx.NET/System.Reactive.Interfaces/Reactive/Subjects/ISubject.cs b/Rx.NET/System.Reactive.Interfaces/Reactive/Subjects/ISubject.cs
deleted file mode 100644
index 2c92b9d..0000000
--- a/Rx.NET/System.Reactive.Interfaces/Reactive/Subjects/ISubject.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-namespace System.Reactive.Subjects
-{
- /// <summary>
- /// Represents an object that is both an observable sequence as well as an observer.
- /// </summary>
- /// <typeparam name="T">The type of the elements processed by the subject.</typeparam>
- public interface ISubject<T> : ISubject<T, T>
- {
- }
-}
diff --git a/Rx.NET/System.Reactive.Interfaces/System.Reactive.Interfaces.csproj b/Rx.NET/System.Reactive.Interfaces/System.Reactive.Interfaces.csproj
deleted file mode 100644
index 54684a5..0000000
--- a/Rx.NET/System.Reactive.Interfaces/System.Reactive.Interfaces.csproj
+++ /dev/null
@@ -1,63 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <ProductVersion>8.0.30703</ProductVersion>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}</ProjectGuid>
- <OutputType>Library</OutputType>
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <RootNamespace>System.Reactive</RootNamespace>
- <AssemblyName>System.Reactive.Interfaces</AssemblyName>
- <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
- <FileAlignment>512</FileAlignment>
- <ProductSignAssembly>true</ProductSignAssembly>
- <CodeAnalysisRuleSet>..\Rx.ruleset</CodeAnalysisRuleSet>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'ReleaseXBLV|AnyCPU'">
- <OutputPath>bin\ReleaseXBLV\</OutputPath>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'DebugXBLV|AnyCPU'">
- <OutputPath>bin\DebugXBLV\</OutputPath>
- </PropertyGroup>
- <Import Project="..\Common.targets" />
- <PropertyGroup>
- <DocumentationFile>$(OutputPath)\$(AssemblyName).XML</DocumentationFile>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)' == 'DebugPL' Or '$(Configuration)' == 'ReleasePL' ">
- <TargetFrameworkProfile>Profile7</TargetFrameworkProfile>
- </PropertyGroup>
- <ItemGroup>
- <Reference Include="mscorlib" Condition=" '$(BuildPlatform)' == 'SILVERLIGHT' Or '$(BuildPlatform)' == 'XNA' " />
- <Reference Include="System" />
- <Reference Include="System.Core" />
- <Reference Include="System.Observable" Condition=" '$(BuildFlavor)' == 'SILVERLIGHTM7' " />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="AssemblyFileVersionAttribute.cs" />
- <Compile Include="DateTimeOffset.cs" />
- <Compile Include="GlobalSuppressions.cs" />
- <Compile Include="IObservable.cs" />
- <Compile Include="IObserver.cs" />
- <Compile Include="NamespaceDocs.cs" />
- <Compile Include="Properties\AssemblyInfo.cs" />
- <Compile Include="Reactive\Concurrency\ISchedulerPeriodic.cs" />
- <Compile Include="Reactive\Concurrency\IStopwatchProvider.cs" />
- <Compile Include="Reactive\Concurrency\IScheduledItem.cs" />
- <Compile Include="Reactive\Concurrency\IScheduler.cs" />
- <Compile Include="Reactive\Concurrency\ISchedulerLongRunning.cs" />
- <Compile Include="Reactive\Concurrency\IStopwatch.cs" />
- <Compile Include="Reactive\Disposables\ICancelable.cs" />
- <Compile Include="Reactive\IEventPattern.cs" />
- <Compile Include="Reactive\IEventPatternSource.cs" />
- <Compile Include="Reactive\IEventSource.cs" />
- <Compile Include="Reactive\IObserver.Result.cs" />
- <Compile Include="Reactive\Linq\IGroupedObservable.cs" />
- <Compile Include="Reactive\Linq\IQbservable.cs" />
- <Compile Include="Reactive\Linq\IQbservableProvider.cs" />
- <Compile Include="Reactive\Subjects\IConnectableObservable.cs" />
- <Compile Include="Reactive\Subjects\ISubject.cs" />
- <Compile Include="Reactive\Subjects\ISubject.Multi.cs" />
- </ItemGroup>
- <ItemGroup />
- <Import Project="..\Import.targets" />
-</Project> \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Linq/GlobalSuppressions.cs b/Rx.NET/System.Reactive.Linq/GlobalSuppressions.cs
deleted file mode 100644
index e0088a2..0000000
--- a/Rx.NET/System.Reactive.Linq/GlobalSuppressions.cs
+++ /dev/null
@@ -1,183 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-// This file is used by Code Analysis to maintain SuppressMessage
-// attributes that are applied to this project.
-// Project-level suppressions either have no target or are given
-// a specific target and scoped to a namespace, type, member, etc.
-//
-// To add a suppression to this file, right-click the message in the
-// Error List, point to "Suppress Message(s)", and click
-// "In Project Suppression File".
-// You do not need to add suppressions to this file manually.
-
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes", Scope = "namespace", Target = "System.Reactive.Concurrency", Justification = "By design.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes", Scope = "namespace", Target = "System.Reactive.Linq", Justification = "By design.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes", Scope = "namespace", Target = "System.Reactive.Threading.Tasks", Justification = "By design.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA2210:AssembliesShouldHaveValidStrongNames", Justification = "Taken care of by lab build.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1016:MarkAssembliesWithAssemblyVersion", Justification = "Taken care of by lab build.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.AddRef`1.#Run(System.IObserver`1<!0>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.Aggregate`2.#Run(System.IObserver`1<!1>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.Aggregate`1.#Run(System.IObserver`1<!0>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.All`1.#Run(System.IObserver`1<System.Boolean>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.Amb`1.#Run(System.IObserver`1<!0>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.Any`1.#Run(System.IObserver`1<System.Boolean>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.AsObservable`1.#Run(System.IObserver`1<!0>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.AverageDecimal.#Run(System.IObserver`1<System.Decimal>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.AverageDecimalNullable.#Run(System.IObserver`1<System.Nullable`1<System.Decimal>>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.AverageDouble.#Run(System.IObserver`1<System.Double>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.AverageDoubleNullable.#Run(System.IObserver`1<System.Nullable`1<System.Double>>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.AverageInt32.#Run(System.IObserver`1<System.Double>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.AverageInt32Nullable.#Run(System.IObserver`1<System.Nullable`1<System.Double>>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.AverageInt64.#Run(System.IObserver`1<System.Double>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.AverageInt64Nullable.#Run(System.IObserver`1<System.Nullable`1<System.Double>>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.AverageSingle.#Run(System.IObserver`1<System.Single>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.AverageSingleNullable.#Run(System.IObserver`1<System.Nullable`1<System.Single>>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.Buffer`2.#Run(System.IObserver`1<System.Collections.Generic.IList`1<!0>>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.Buffer`1.#Run(System.IObserver`1<System.Collections.Generic.IList`1<!0>>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.Cast`2.#Run(System.IObserver`1<!1>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.Catch`2.#Run(System.IObserver`1<!0>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.Catch`1.#Run(System.IObserver`1<!0>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.CombineLatest`17.#Run(System.IObserver`1<!16>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.CombineLatest`16.#Run(System.IObserver`1<!15>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.CombineLatest`15.#Run(System.IObserver`1<!14>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.CombineLatest`14.#Run(System.IObserver`1<!13>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.CombineLatest`13.#Run(System.IObserver`1<!12>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.CombineLatest`12.#Run(System.IObserver`1<!11>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.CombineLatest`11.#Run(System.IObserver`1<!10>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.CombineLatest`10.#Run(System.IObserver`1<!9>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.CombineLatest`9.#Run(System.IObserver`1<!8>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.CombineLatest`8.#Run(System.IObserver`1<!7>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.CombineLatest`7.#Run(System.IObserver`1<!6>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.CombineLatest`6.#Run(System.IObserver`1<!5>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.CombineLatest`5.#Run(System.IObserver`1<!4>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.CombineLatest`4.#Run(System.IObserver`1<!3>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.CombineLatest`3.#Run(System.IObserver`1<!2>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.CombineLatest`2.#Run(System.IObserver`1<!1>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.Concat`1.#Run(System.IObserver`1<!0>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.Contains`1.#Run(System.IObserver`1<System.Boolean>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.CountObservαble`1.#Run(System.IObserver`1<System.Int32>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.DefaultIfEmpty`1.#Run(System.IObserver`1<!0>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.Defer`1.#Run(System.IObserver`1<!0>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.Delay`2.#Run(System.IObserver`1<!0>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.Delay`1.#Run(System.IObserver`1<!0>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.DelaySubscription`1.#Run(System.IObserver`1<!0>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0", Scope = "member", Target = "System.Reactive.Linq.Observαble.Dematerialize`1+_.#OnNext(System.Reactive.Notification`1<!0>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.Dematerialize`1.#Run(System.IObserver`1<!0>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.Distinct`2.#Run(System.IObserver`1<!0>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.DistinctUntilChanged`2.#Run(System.IObserver`1<!0>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.Do`1.#Run(System.IObserver`1<!0>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0", Scope = "member", Target = "System.Reactive.Either`2+Left.#Switch(System.Action`1<!0>,System.Action`1<!1>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0", Scope = "member", Target = "System.Reactive.Either`2+Left.#Switch`1(System.Func`2<!0,!!0>,System.Func`2<!1,!!0>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "1", Scope = "member", Target = "System.Reactive.Either`2+Right.#Switch(System.Action`1<!0>,System.Action`1<!1>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "1", Scope = "member", Target = "System.Reactive.Either`2+Right.#Switch`1(System.Func`2<!0,!!0>,System.Func`2<!1,!!0>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.ElementAt`1.#Run(System.IObserver`1<!0>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.Empty`1.#Run(System.IObserver`1<!0>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.Finally`1.#Run(System.IObserver`1<!0>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.FirstAsync`1.#Run(System.IObserver`1<!0>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.Generate`2.#Run(System.IObserver`1<!1>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.GroupBy`3.#Run(System.IObserver`1<System.Reactive.Linq.IGroupedObservable`2<!1,!2>>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.GroupByUntil`4.#Run(System.IObserver`1<System.Reactive.Linq.IGroupedObservable`2<!1,!2>>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.GroupJoin`5.#Run(System.IObserver`1<!4>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.IgnoreElements`1.#Run(System.IObserver`1<!0>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.IsEmpty`1.#Run(System.IObserver`1<System.Boolean>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.Join`5.#Run(System.IObserver`1<!4>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0", Scope = "member", Target = "System.Reactive.Joins.JoinObserver`1.#OnNextCore(System.Reactive.Notification`1<!0>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.LastAsync`1.#Run(System.IObserver`1<!0>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.LongCountObservαble`1.#Run(System.IObserver`1<System.Int64>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.Materialize`1.#Run(System.IObserver`1<System.Reactive.Notification`1<!0>>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.Max`1.#Run(System.IObserver`1<!0>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.MaxBy`2.#Run(System.IObserver`1<System.Collections.Generic.IList`1<!0>>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.MaxDecimal.#Run(System.IObserver`1<System.Decimal>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.MaxDecimalNullable.#Run(System.IObserver`1<System.Nullable`1<System.Decimal>>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.MaxDouble.#Run(System.IObserver`1<System.Double>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.MaxDoubleNullable.#Run(System.IObserver`1<System.Nullable`1<System.Double>>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.MaxInt32.#Run(System.IObserver`1<System.Int32>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.MaxInt32Nullable.#Run(System.IObserver`1<System.Nullable`1<System.Int32>>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.MaxInt64.#Run(System.IObserver`1<System.Int64>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.MaxInt64Nullable.#Run(System.IObserver`1<System.Nullable`1<System.Int64>>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.MaxSingle.#Run(System.IObserver`1<System.Single>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.MaxSingleNullable.#Run(System.IObserver`1<System.Nullable`1<System.Single>>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.Merge`1.#Run(System.IObserver`1<!0>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.Min`1.#Run(System.IObserver`1<!0>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.MinBy`2.#Run(System.IObserver`1<System.Collections.Generic.IList`1<!0>>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.MinDecimal.#Run(System.IObserver`1<System.Decimal>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.MinDecimalNullable.#Run(System.IObserver`1<System.Nullable`1<System.Decimal>>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.MinDouble.#Run(System.IObserver`1<System.Double>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.MinDoubleNullable.#Run(System.IObserver`1<System.Nullable`1<System.Double>>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.MinInt32.#Run(System.IObserver`1<System.Int32>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.MinInt32Nullable.#Run(System.IObserver`1<System.Nullable`1<System.Int32>>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.MinInt64.#Run(System.IObserver`1<System.Int64>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.MinInt64Nullable.#Run(System.IObserver`1<System.Nullable`1<System.Int64>>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.MinSingle.#Run(System.IObserver`1<System.Single>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.MinSingleNullable.#Run(System.IObserver`1<System.Nullable`1<System.Single>>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.Multicast`3.#Run(System.IObserver`1<!2>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.OfType`2.#Run(System.IObserver`1<!1>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.OnErrorResumeNext`1.#Run(System.IObserver`1<!0>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.Range.#Run(System.IObserver`1<System.Int32>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.RefCount`1.#Run(System.IObserver`1<!0>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.Repeat`1.#Run(System.IObserver`1<!0>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.Return`1.#Run(System.IObserver`1<!0>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.Sample`2.#Run(System.IObserver`1<!0>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.Sample`1.#Run(System.IObserver`1<!0>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.Scan`2.#Run(System.IObserver`1<!1>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.Scan`1.#Run(System.IObserver`1<!0>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.Select`2.#Run(System.IObserver`1<!1>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.SelectMany`3.#Run(System.IObserver`1<!2>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.SelectMany`2.#Run(System.IObserver`1<!1>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.SequenceEqual`1.#Run(System.IObserver`1<System.Boolean>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.SingleAsync`1.#Run(System.IObserver`1<!0>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.Skip`1.#Run(System.IObserver`1<!0>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.SkipLast`1.#Run(System.IObserver`1<!0>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.SkipUntil`2.#Run(System.IObserver`1<!0>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.SkipUntil`1.#Run(System.IObserver`1<!0>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.SkipWhile`1.#Run(System.IObserver`1<!0>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.SumDecimal.#Run(System.IObserver`1<System.Decimal>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.SumDecimalNullable.#Run(System.IObserver`1<System.Nullable`1<System.Decimal>>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.SumDouble.#Run(System.IObserver`1<System.Double>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.SumDoubleNullable.#Run(System.IObserver`1<System.Nullable`1<System.Double>>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.SumInt32.#Run(System.IObserver`1<System.Int32>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.SumInt32Nullable.#Run(System.IObserver`1<System.Nullable`1<System.Int32>>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.SumInt64.#Run(System.IObserver`1<System.Int64>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.SumInt64Nullable.#Run(System.IObserver`1<System.Nullable`1<System.Int64>>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.SumSingle.#Run(System.IObserver`1<System.Single>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.SumSingleNullable.#Run(System.IObserver`1<System.Nullable`1<System.Single>>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.Switch`1.#Run(System.IObserver`1<!0>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.Take`1.#Run(System.IObserver`1<!0>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.TakeLast`1.#Run(System.IObserver`1<!0>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.TakeUntil`2.#Run(System.IObserver`1<!0>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.TakeUntil`1.#Run(System.IObserver`1<!0>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.TakeWhile`1.#Run(System.IObserver`1<!0>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.Throttle`2.#Run(System.IObserver`1<!0>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.Throttle`1.#Run(System.IObserver`1<!0>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.Throw`1.#Run(System.IObserver`1<!0>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.TimeInterval`1.#Run(System.IObserver`1<System.Reactive.TimeInterval`1<!0>>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.Timeout`2.#Run(System.IObserver`1<!0>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.Timeout`1.#Run(System.IObserver`1<!0>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.Timer.#Run(System.IObserver`1<System.Int64>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.Timestamp`1.#Run(System.IObserver`1<System.Reactive.Timestamped`1<!0>>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.ToArray`1.#Run(System.IObserver`1<!0[]>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.ToDictionary`3.#Run(System.IObserver`1<System.Collections.Generic.IDictionary`2<!1,!2>>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.ToList`1.#Run(System.IObserver`1<System.Collections.Generic.IList`1<!0>>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.ToLookup`3.#Run(System.IObserver`1<System.Linq.ILookup`2<!1,!2>>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.ToObservable`1.#Run(System.IObserver`1<!0>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.Using`2.#Run(System.IObserver`1<!0>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.Where`1.#Run(System.IObserver`1<!0>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.Window`2.#Run(System.IObserver`1<System.IObservable`1<!0>>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.Window`1.#Run(System.IObserver`1<System.IObservable`1<!0>>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.Zip`17.#Run(System.IObserver`1<!16>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.Zip`16.#Run(System.IObserver`1<!15>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.Zip`15.#Run(System.IObserver`1<!14>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.Zip`14.#Run(System.IObserver`1<!13>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.Zip`13.#Run(System.IObserver`1<!12>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.Zip`12.#Run(System.IObserver`1<!11>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.Zip`11.#Run(System.IObserver`1<!10>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.Zip`10.#Run(System.IObserver`1<!9>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.Zip`9.#Run(System.IObserver`1<!8>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.Zip`8.#Run(System.IObserver`1<!7>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.Zip`7.#Run(System.IObserver`1<!6>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.Zip`6.#Run(System.IObserver`1<!5>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.Zip`4.#Run(System.IObserver`1<!3>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.Zip`3.#Run(System.IObserver`1<!2>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.Zip`1.#Run(System.IObserver`1<System.Collections.Generic.IList`1<!0>>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Scope = "member", Target = "System.Reactive.Linq.Observαble.Zip`5.#Run(System.IObserver`1<!4>,System.IDisposable,System.Action`1<System.IDisposable>)", Justification = "Producer cannot pass null to setSink parameter.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2208:InstantiateArgumentExceptionsCorrectly", Scope = "member", Target = "System.Reactive.Linq.Observαble.ElementAt`1+_.#OnCompleted()", Justification = "Asynchronous behavior; no more index parameter in scope.")]
diff --git a/Rx.NET/System.Reactive.Linq/InternalsVisibleTo.cs b/Rx.NET/System.Reactive.Linq/InternalsVisibleTo.cs
deleted file mode 100644
index 6aafa69..0000000
--- a/Rx.NET/System.Reactive.Linq/InternalsVisibleTo.cs
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System;
-
-#if SIGNED
-
-#if SIGNENHANCED // Key 272 for .NET 4.5 and beyond
-[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("System.Reactive.Debugger, PublicKey=002400000c80000014010000060200000024000052534131000800000100010085aad0bef0688d1b994a0d78e1fd29fc24ac34ed3d3ac3fb9b3d0c48386ba834aa880035060a8848b2d8adf58e670ed20914be3681a891c9c8c01eef2ab22872547c39be00af0e6c72485d7cfd1a51df8947d36ceba9989106b58abe79e6a3e71a01ed6bdc867012883e0b1a4d35b1b5eeed6df21e401bb0c22f2246ccb69979dc9e61eef262832ed0f2064853725a75485fa8a3efb7e027319c86dec03dc3b1bca2b5081bab52a627b9917450dfad534799e1c7af58683bdfa135f1518ff1ea60e90d7b993a6c87fd3dd93408e35d1296f9a7f9a97c5db56c0f3cc25ad11e9777f94d138b3cea53b9a8331c2e6dcb8d2ea94e18bf1163ff112a22dbd92d429a")]
-[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("System.Reactive.Experimental, PublicKey=002400000c80000014010000060200000024000052534131000800000100010085aad0bef0688d1b994a0d78e1fd29fc24ac34ed3d3ac3fb9b3d0c48386ba834aa880035060a8848b2d8adf58e670ed20914be3681a891c9c8c01eef2ab22872547c39be00af0e6c72485d7cfd1a51df8947d36ceba9989106b58abe79e6a3e71a01ed6bdc867012883e0b1a4d35b1b5eeed6df21e401bb0c22f2246ccb69979dc9e61eef262832ed0f2064853725a75485fa8a3efb7e027319c86dec03dc3b1bca2b5081bab52a627b9917450dfad534799e1c7af58683bdfa135f1518ff1ea60e90d7b993a6c87fd3dd93408e35d1296f9a7f9a97c5db56c0f3cc25ad11e9777f94d138b3cea53b9a8331c2e6dcb8d2ea94e18bf1163ff112a22dbd92d429a")]
-[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("System.Reactive.PlatformServices, PublicKey=002400000c80000014010000060200000024000052534131000800000100010085aad0bef0688d1b994a0d78e1fd29fc24ac34ed3d3ac3fb9b3d0c48386ba834aa880035060a8848b2d8adf58e670ed20914be3681a891c9c8c01eef2ab22872547c39be00af0e6c72485d7cfd1a51df8947d36ceba9989106b58abe79e6a3e71a01ed6bdc867012883e0b1a4d35b1b5eeed6df21e401bb0c22f2246ccb69979dc9e61eef262832ed0f2064853725a75485fa8a3efb7e027319c86dec03dc3b1bca2b5081bab52a627b9917450dfad534799e1c7af58683bdfa135f1518ff1ea60e90d7b993a6c87fd3dd93408e35d1296f9a7f9a97c5db56c0f3cc25ad11e9777f94d138b3cea53b9a8331c2e6dcb8d2ea94e18bf1163ff112a22dbd92d429a")]
-#else // Key 35 for older platforms
-[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("System.Reactive.Debugger, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")]
-[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("System.Reactive.Experimental, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")]
-[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("System.Reactive.PlatformServices, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")]
-#endif
-
-#else
-
-[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("System.Reactive.Debugger")]
-[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("System.Reactive.Experimental")]
-[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("System.Reactive.PlatformServices")]
-
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Linq/NamespaceDocs.cs b/Rx.NET/System.Reactive.Linq/NamespaceDocs.cs
deleted file mode 100644
index d56f548..0000000
--- a/Rx.NET/System.Reactive.Linq/NamespaceDocs.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-namespace System.Reactive.Joins
-{
- /// <summary>
- /// The <b>System.Reactive.Joins</b> namespace contains classes used to express join patterns over observable sequences using fluent method syntax.
- /// </summary>
- [System.Runtime.CompilerServices.CompilerGeneratedAttribute]
- class NamespaceDoc
- {
- }
-} \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Linq/Properties/AssemblyInfo.cs b/Rx.NET/System.Reactive.Linq/Properties/AssemblyInfo.cs
deleted file mode 100644
index 21d9f44..0000000
--- a/Rx.NET/System.Reactive.Linq/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,37 +0,0 @@
-using System;
-using System.Reflection;
-using System.Resources;
-using System.Runtime.InteropServices;
-using System.Security;
-
-[assembly: AssemblyTitle("System.Reactive.Linq")]
-// Notice: same description as in the .nuspec files; see Source/Rx/Setup/NuGet
-[assembly: AssemblyDescription("Reactive Extensions Query Library used to express complex event processing queries over observable sequences.")]
-#if DEBUG
-[assembly: AssemblyConfiguration("Debug")]
-#else
-[assembly: AssemblyConfiguration("Retail")]
-#endif
-[assembly: AssemblyCompany("Microsoft Corporation")]
-[assembly: AssemblyProduct("Reactive Extensions")]
-[assembly: AssemblyCopyright("\x00a9 Microsoft Corporation. All rights reserved.")]
-[assembly: NeutralResourcesLanguage("en-US")]
-
-#if !PLIB
-[assembly: ComVisible(false)]
-#endif
-
-[assembly: CLSCompliant(true)]
-
-#if HAS_APTCA && NO_CODECOVERAGE
-[assembly: AllowPartiallyTrustedCallers]
-#endif
-
-#if XBOX_LAKEVIEW
-[assembly: SecurityTransparent]
-#endif
-
-//
-// Note: Assembly (file) version numbers get inserted by the build system on the fly. Inspect the Team Build workflows
-// and the custom activity in Build/Source/Activities/AppendVersionInfo.cs for more information.
-//
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Concurrency/HistoricalScheduler.cs b/Rx.NET/System.Reactive.Linq/Reactive/Concurrency/HistoricalScheduler.cs
deleted file mode 100644
index f42ea5c..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Concurrency/HistoricalScheduler.cs
+++ /dev/null
@@ -1,152 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System.Collections.Generic;
-using System.Reactive.Disposables;
-
-namespace System.Reactive.Concurrency
-{
- /// <summary>
- /// Base class for historical schedulers, which are virtual time schedulers that use DateTimeOffset for absolute time and TimeSpan for relative time.
- /// </summary>
- public abstract class HistoricalSchedulerBase : VirtualTimeSchedulerBase<DateTimeOffset, TimeSpan>
- {
- /// <summary>
- /// Creates a new historical scheduler with the minimum value of DateTimeOffset as the initial clock value.
- /// </summary>
- protected HistoricalSchedulerBase()
- : base(DateTimeOffset.MinValue, Comparer<DateTimeOffset>.Default)
- {
- }
-
- /// <summary>
- /// Creates a new historical scheduler with the specified initial clock value.
- /// </summary>
- /// <param name="initialClock">Initial clock value.</param>
- protected HistoricalSchedulerBase(DateTimeOffset initialClock)
- : base(initialClock, Comparer<DateTimeOffset>.Default)
- {
- }
-
- /// <summary>
- /// Creates a new historical scheduler with the specified initial clock value and absolute time comparer.
- /// </summary>
- /// <param name="initialClock">Initial value for the clock.</param>
- /// <param name="comparer">Comparer to determine causality of events based on absolute time.</param>
- protected HistoricalSchedulerBase(DateTimeOffset initialClock, IComparer<DateTimeOffset> comparer)
- : base(initialClock, comparer)
- {
- }
-
- /// <summary>
- /// Adds a relative time value to an absolute time value.
- /// </summary>
- /// <param name="absolute">Absolute time value.</param>
- /// <param name="relative">Relative time value to add.</param>
- /// <returns>The resulting absolute time sum value.</returns>
- protected override DateTimeOffset Add(DateTimeOffset absolute, TimeSpan relative)
- {
- return absolute.Add(relative);
- }
-
- /// <summary>
- /// Converts the absolute time value to a DateTimeOffset value.
- /// </summary>
- /// <param name="absolute">Absolute time value to convert.</param>
- /// <returns>The corresponding DateTimeOffset value.</returns>
- protected override DateTimeOffset ToDateTimeOffset(DateTimeOffset absolute)
- {
- return absolute;
- }
-
- /// <summary>
- /// Converts the TimeSpan value to a relative time value.
- /// </summary>
- /// <param name="timeSpan">TimeSpan value to convert.</param>
- /// <returns>The corresponding relative time value.</returns>
- protected override TimeSpan ToRelative(TimeSpan timeSpan)
- {
- return timeSpan;
- }
- }
-
- /// <summary>
- /// Provides a virtual time scheduler that uses DateTimeOffset for absolute time and TimeSpan for relative time.
- /// </summary>
- public class HistoricalScheduler : HistoricalSchedulerBase
- {
- private readonly SchedulerQueue<DateTimeOffset> queue = new SchedulerQueue<DateTimeOffset>();
-
- /// <summary>
- /// Creates a new historical scheduler with the minimum value of DateTimeOffset as the initial clock value.
- /// </summary>
- public HistoricalScheduler()
- : base()
- {
- }
-
- /// <summary>
- /// Creates a new historical scheduler with the specified initial clock value.
- /// </summary>
- /// <param name="initialClock">Initial value for the clock.</param>
- public HistoricalScheduler(DateTimeOffset initialClock)
- : base(initialClock)
- {
- }
-
- /// <summary>
- /// Creates a new historical scheduler with the specified initial clock value.
- /// </summary>
- /// <param name="initialClock">Initial value for the clock.</param>
- /// <param name="comparer">Comparer to determine causality of events based on absolute time.</param>
- /// <exception cref="ArgumentNullException"><paramref name="comparer"/> is null.</exception>
- public HistoricalScheduler(DateTimeOffset initialClock, IComparer<DateTimeOffset> comparer)
- : base(initialClock, comparer)
- {
- }
-
- /// <summary>
- /// Gets the next scheduled item to be executed.
- /// </summary>
- /// <returns>The next scheduled item.</returns>
- protected override IScheduledItem<DateTimeOffset> GetNext()
- {
- while (queue.Count > 0)
- {
- var next = queue.Peek();
- if (next.IsCanceled)
- queue.Dequeue();
- else
- return next;
- }
- return null;
- }
-
- /// <summary>
- /// Schedules an action to be executed at dueTime.
- /// </summary>
- /// <typeparam name="TState">The type of the state passed to the scheduled action.</typeparam>
- /// <param name="state">State passed to the action to be executed.</param>
- /// <param name="action">Action to be executed.</param>
- /// <param name="dueTime">Absolute time at which to execute the action.</param>
- /// <returns>The disposable object used to cancel the scheduled action (best effort).</returns>
- /// <exception cref="ArgumentNullException"><paramref name="action"/> is null.</exception>
- public override IDisposable ScheduleAbsolute<TState>(TState state, DateTimeOffset dueTime, Func<IScheduler, TState, IDisposable> action)
- {
- if (action == null)
- throw new ArgumentNullException("action");
-
- var si = default(ScheduledItem<DateTimeOffset, TState>);
-
- var run = new Func<IScheduler, TState, IDisposable>((scheduler, state1) =>
- {
- queue.Remove(si);
- return action(scheduler, state1);
- });
-
- si = new ScheduledItem<DateTimeOffset, TState>(this, state, run, dueTime, Comparer);
- queue.Enqueue(si);
-
- return Disposable.Create(si.Cancel);
- }
- }
-}
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Concurrency/VirtualTimeScheduler.Extensions.cs b/Rx.NET/System.Reactive.Linq/Reactive/Concurrency/VirtualTimeScheduler.Extensions.cs
deleted file mode 100644
index 6501e51..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Concurrency/VirtualTimeScheduler.Extensions.cs
+++ /dev/null
@@ -1,60 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System.Reactive.Disposables;
-
-namespace System.Reactive.Concurrency
-{
- /// <summary>
- /// Provides a set of extension methods for virtual time scheduling.
- /// </summary>
- public static class VirtualTimeSchedulerExtensions
- {
- /// <summary>
- /// Schedules an action to be executed at dueTime.
- /// </summary>
- /// <typeparam name="TAbsolute">Absolute time representation type.</typeparam>
- /// <typeparam name="TRelative">Relative time representation type.</typeparam>
- /// <param name="scheduler">Scheduler to execute the action on.</param>
- /// <param name="dueTime">Relative time after which to execute the action.</param>
- /// <param name="action">Action to be executed.</param>
- /// <returns>The disposable object used to cancel the scheduled action (best effort).</returns>
- /// <exception cref="ArgumentNullException"><paramref name="scheduler"/> or <paramref name="action"/> is null.</exception>
- public static IDisposable ScheduleRelative<TAbsolute, TRelative>(this VirtualTimeSchedulerBase<TAbsolute, TRelative> scheduler, TRelative dueTime, Action action)
- where TAbsolute : IComparable<TAbsolute>
- {
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
- if (action == null)
- throw new ArgumentNullException("action");
-
- return scheduler.ScheduleRelative(action, dueTime, Invoke);
- }
-
- /// <summary>
- /// Schedules an action to be executed at dueTime.
- /// </summary>
- /// <typeparam name="TAbsolute">Absolute time representation type.</typeparam>
- /// <typeparam name="TRelative">Relative time representation type.</typeparam>
- /// <param name="scheduler">Scheduler to execute the action on.</param>
- /// <param name="dueTime">Absolute time at which to execute the action.</param>
- /// <param name="action">Action to be executed.</param>
- /// <returns>The disposable object used to cancel the scheduled action (best effort).</returns>
- /// <exception cref="ArgumentNullException"><paramref name="scheduler"/> or <paramref name="action"/> is null.</exception>
- public static IDisposable ScheduleAbsolute<TAbsolute, TRelative>(this VirtualTimeSchedulerBase<TAbsolute, TRelative> scheduler, TAbsolute dueTime, Action action)
- where TAbsolute : IComparable<TAbsolute>
- {
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
- if (action == null)
- throw new ArgumentNullException("action");
-
- return scheduler.ScheduleAbsolute(action, dueTime, Invoke);
- }
-
- static IDisposable Invoke(IScheduler scheduler, Action action)
- {
- action();
- return Disposable.Empty;
- }
- }
-}
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Concurrency/VirtualTimeScheduler.cs b/Rx.NET/System.Reactive.Linq/Reactive/Concurrency/VirtualTimeScheduler.cs
deleted file mode 100644
index 4d67877..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Concurrency/VirtualTimeScheduler.cs
+++ /dev/null
@@ -1,415 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System.Collections.Generic;
-using System.Globalization;
-using System.Reactive.Disposables;
-
-namespace System.Reactive.Concurrency
-{
- /// <summary>
- /// Base class for virtual time schedulers.
- /// </summary>
- /// <typeparam name="TAbsolute">Absolute time representation type.</typeparam>
- /// <typeparam name="TRelative">Relative time representation type.</typeparam>
- public abstract class VirtualTimeSchedulerBase<TAbsolute, TRelative> : IScheduler, IServiceProvider, IStopwatchProvider
- where TAbsolute : IComparable<TAbsolute>
- {
- /// <summary>
- /// Creates a new virtual time scheduler with the default value of TAbsolute as the initial clock value.
- /// </summary>
- protected VirtualTimeSchedulerBase()
- : this(default(TAbsolute), Comparer<TAbsolute>.Default)
- {
- }
-
- /// <summary>
- /// Creates a new virtual time scheduler with the specified initial clock value and absolute time comparer.
- /// </summary>
- /// <param name="initialClock">Initial value for the clock.</param>
- /// <param name="comparer">Comparer to determine causality of events based on absolute time.</param>
- /// <exception cref="ArgumentNullException"><paramref name="comparer"/> is null.</exception>
- protected VirtualTimeSchedulerBase(TAbsolute initialClock, IComparer<TAbsolute> comparer)
- {
- if (comparer == null)
- throw new ArgumentNullException("comparer");
-
- Clock = initialClock;
- Comparer = comparer;
- }
-
- /// <summary>
- /// Adds a relative time value to an absolute time value.
- /// </summary>
- /// <param name="absolute">Absolute time value.</param>
- /// <param name="relative">Relative time value to add.</param>
- /// <returns>The resulting absolute time sum value.</returns>
- protected abstract TAbsolute Add(TAbsolute absolute, TRelative relative);
-
- /// <summary>
- /// Converts the absolute time value to a DateTimeOffset value.
- /// </summary>
- /// <param name="absolute">Absolute time value to convert.</param>
- /// <returns>The corresponding DateTimeOffset value.</returns>
- protected abstract DateTimeOffset ToDateTimeOffset(TAbsolute absolute);
-
- /// <summary>
- /// Converts the TimeSpan value to a relative time value.
- /// </summary>
- /// <param name="timeSpan">TimeSpan value to convert.</param>
- /// <returns>The corresponding relative time value.</returns>
- protected abstract TRelative ToRelative(TimeSpan timeSpan);
-
- /// <summary>
- /// Gets whether the scheduler is enabled to run work.
- /// </summary>
- public bool IsEnabled
- {
- get;
- private set;
- }
-
- /// <summary>
- /// Gets the comparer used to compare absolute time values.
- /// </summary>
- protected IComparer<TAbsolute> Comparer
- {
- get;
- private set;
- }
-
- /// <summary>
- /// Schedules an action to be executed at dueTime.
- /// </summary>
- /// <typeparam name="TState">The type of the state passed to the scheduled action.</typeparam>
- /// <param name="state">State passed to the action to be executed.</param>
- /// <param name="dueTime">Absolute time at which to execute the action.</param>
- /// <param name="action">Action to be executed.</param>
- /// <returns>The disposable object used to cancel the scheduled action (best effort).</returns>
- public abstract IDisposable ScheduleAbsolute<TState>(TState state, TAbsolute dueTime, Func<IScheduler, TState, IDisposable> action);
-
- /// <summary>
- /// Schedules an action to be executed at dueTime.
- /// </summary>
- /// <typeparam name="TState">The type of the state passed to the scheduled action.</typeparam>
- /// <param name="state">State passed to the action to be executed.</param>
- /// <param name="dueTime">Relative time after which to execute the action.</param>
- /// <param name="action">Action to be executed.</param>
- /// <returns>The disposable object used to cancel the scheduled action (best effort).</returns>
- public IDisposable ScheduleRelative<TState>(TState state, TRelative dueTime, Func<IScheduler, TState, IDisposable> action)
- {
- if (action == null)
- throw new ArgumentNullException("action");
-
- var runAt = Add(Clock, dueTime);
-
- return ScheduleAbsolute(state, runAt, action);
- }
-
- /// <summary>
- /// Schedules an action to be executed.
- /// </summary>
- /// <typeparam name="TState">The type of the state passed to the scheduled action.</typeparam>
- /// <param name="state">State passed to the action to be executed.</param>
- /// <param name="action">Action to be executed.</param>
- /// <returns>The disposable object used to cancel the scheduled action (best effort).</returns>
- /// <exception cref="ArgumentNullException"><paramref name="action"/> is null.</exception>
- public IDisposable Schedule<TState>(TState state, Func<IScheduler, TState, IDisposable> action)
- {
- if (action == null)
- throw new ArgumentNullException("action");
-
- return ScheduleAbsolute(state, Clock, action);
- }
-
- /// <summary>
- /// Schedules an action to be executed after dueTime.
- /// </summary>
- /// <typeparam name="TState">The type of the state passed to the scheduled action.</typeparam>
- /// <param name="state">State passed to the action to be executed.</param>
- /// <param name="dueTime">Relative time after which to execute the action.</param>
- /// <param name="action">Action to be executed.</param>
- /// <returns>The disposable object used to cancel the scheduled action (best effort).</returns>
- /// <exception cref="ArgumentNullException"><paramref name="action"/> is null.</exception>
- public IDisposable Schedule<TState>(TState state, TimeSpan dueTime, Func<IScheduler, TState, IDisposable> action)
- {
- if (action == null)
- throw new ArgumentNullException("action");
-
- return ScheduleRelative(state, ToRelative(dueTime), action);
- }
-
- /// <summary>
- /// Schedules an action to be executed at dueTime.
- /// </summary>
- /// <typeparam name="TState">The type of the state passed to the scheduled action.</typeparam>
- /// <param name="state">State passed to the action to be executed.</param>
- /// <param name="dueTime">Absolute time at which to execute the action.</param>
- /// <param name="action">Action to be executed.</param>
- /// <returns>The disposable object used to cancel the scheduled action (best effort).</returns>
- /// <exception cref="ArgumentNullException"><paramref name="action"/> is null.</exception>
- public IDisposable Schedule<TState>(TState state, DateTimeOffset dueTime, Func<IScheduler, TState, IDisposable> action)
- {
- if (action == null)
- throw new ArgumentNullException("action");
-
- return ScheduleRelative(state, ToRelative(dueTime - Now), action);
- }
-
- /// <summary>
- /// Starts the virtual time scheduler.
- /// </summary>
- public void Start()
- {
- if (!IsEnabled)
- {
- IsEnabled = true;
- do
- {
- var next = GetNext();
- if (next != null)
- {
- if (Comparer.Compare(next.DueTime, Clock) > 0)
- Clock = next.DueTime;
- next.Invoke();
- }
- else
- IsEnabled = false;
- } while (IsEnabled);
- }
- }
-
- /// <summary>
- /// Stops the virtual time scheduler.
- /// </summary>
- public void Stop()
- {
- IsEnabled = false;
- }
-
- /// <summary>
- /// Advances the scheduler's clock to the specified time, running all work till that point.
- /// </summary>
- /// <param name="time">Absolute time to advance the scheduler's clock to.</param>
- /// <exception cref="ArgumentOutOfRangeException"><paramref name="time"/> is in the past.</exception>
- /// <exception cref="InvalidOperationException">The scheduler is already running. VirtualTimeScheduler doesn't support running nested work dispatch loops. To simulate time slippage while running work on the scheduler, use <see cref="Sleep"/>.</exception>
- public void AdvanceTo(TAbsolute time)
- {
- var dueToClock = Comparer.Compare(time, Clock);
- if (dueToClock < 0)
- throw new ArgumentOutOfRangeException("time");
-
- if (dueToClock == 0)
- return;
-
- if (!IsEnabled)
- {
- IsEnabled = true;
- do
- {
- var next = GetNext();
- if (next != null && Comparer.Compare(next.DueTime, time) <= 0)
- {
- if (Comparer.Compare(next.DueTime, Clock) > 0)
- Clock = next.DueTime;
- next.Invoke();
- }
- else
- IsEnabled = false;
- } while (IsEnabled);
-
- Clock = time;
- }
- else
- {
- throw new InvalidOperationException(string.Format(CultureInfo.CurrentCulture, Strings_Linq.CANT_ADVANCE_WHILE_RUNNING, "AdvanceTo"));
- }
- }
-
- /// <summary>
- /// Advances the scheduler's clock by the specified relative time, running all work scheduled for that timespan.
- /// </summary>
- /// <param name="time">Relative time to advance the scheduler's clock by.</param>
- /// <exception cref="ArgumentOutOfRangeException"><paramref name="time"/> is negative.</exception>
- /// <exception cref="InvalidOperationException">The scheduler is already running. VirtualTimeScheduler doesn't support running nested work dispatch loops. To simulate time slippage while running work on the scheduler, use <see cref="Sleep"/>.</exception>
- public void AdvanceBy(TRelative time)
- {
- var dt = Add(Clock, time);
-
- var dueToClock = Comparer.Compare(dt, Clock);
- if (dueToClock < 0)
- throw new ArgumentOutOfRangeException("time");
-
- if (dueToClock == 0)
- return;
-
- if (!IsEnabled)
- {
- AdvanceTo(dt);
- }
- else
- {
- throw new InvalidOperationException(string.Format(CultureInfo.CurrentCulture, Strings_Linq.CANT_ADVANCE_WHILE_RUNNING, "AdvanceBy"));
- }
- }
-
- /// <summary>
- /// Advances the scheduler's clock by the specified relative time.
- /// </summary>
- /// <param name="time">Relative time to advance the scheduler's clock by.</param>
- /// <exception cref="ArgumentOutOfRangeException"><paramref name="time"/> is negative.</exception>
- public void Sleep(TRelative time)
- {
- var dt = Add(Clock, time);
-
- var dueToClock = Comparer.Compare(dt, Clock);
- if (dueToClock < 0)
- throw new ArgumentOutOfRangeException("time");
-
- Clock = dt;
- }
-
- /// <summary>
- /// Gets the scheduler's absolute time clock value.
- /// </summary>
- public TAbsolute Clock
- {
- get;
- protected set;
- }
-
- /// <summary>
- /// Gets the scheduler's notion of current time.
- /// </summary>
- public DateTimeOffset Now
- {
- get { return ToDateTimeOffset(Clock); }
- }
-
- /// <summary>
- /// Gets the next scheduled item to be executed.
- /// </summary>
- /// <returns>The next scheduled item.</returns>
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate", Justification = "By design. Side-effecting operation to retrieve the next element.")]
- protected abstract IScheduledItem<TAbsolute> GetNext();
-
- object IServiceProvider.GetService(Type serviceType)
- {
- return GetService(serviceType);
- }
-
- /// <summary>
- /// Discovers scheduler services by interface type. The base class implementation supports
- /// only the IStopwatchProvider service. To influence service discovery - such as adding
- /// support for other scheduler services - derived types can override this method.
- /// </summary>
- /// <param name="serviceType">Scheduler service interface type to discover.</param>
- /// <returns>Object implementing the requested service, if available; null otherwise.</returns>
- protected virtual object GetService(Type serviceType)
- {
- if (serviceType == typeof(IStopwatchProvider))
- return this as IStopwatchProvider;
-
- return null;
- }
-
- /// <summary>
- /// Starts a new stopwatch object.
- /// </summary>
- /// <returns>New stopwatch object; started at the time of the request.</returns>
- public IStopwatch StartStopwatch()
- {
- var start = ToDateTimeOffset(Clock);
- return new VirtualTimeStopwatch(() => ToDateTimeOffset(Clock) - start);
- }
-
- class VirtualTimeStopwatch : IStopwatch
- {
- private readonly Func<TimeSpan> _getElapsed;
-
- public VirtualTimeStopwatch(Func<TimeSpan> getElapsed)
- {
- _getElapsed = getElapsed;
- }
-
- public TimeSpan Elapsed
- {
- get { return _getElapsed(); }
- }
- }
- }
-
- /// <summary>
- /// Base class for virtual time schedulers using a priority queue for scheduled items.
- /// </summary>
- /// <typeparam name="TAbsolute">Absolute time representation type.</typeparam>
- /// <typeparam name="TRelative">Relative time representation type.</typeparam>
- public abstract class VirtualTimeScheduler<TAbsolute, TRelative> : VirtualTimeSchedulerBase<TAbsolute, TRelative>
- where TAbsolute : IComparable<TAbsolute>
- {
- private readonly SchedulerQueue<TAbsolute> queue = new SchedulerQueue<TAbsolute>();
-
- /// <summary>
- /// Creates a new virtual time scheduler with the default value of TAbsolute as the initial clock value.
- /// </summary>
- protected VirtualTimeScheduler()
- : base()
- {
- }
-
- /// <summary>
- /// Creates a new virtual time scheduler.
- /// </summary>
- /// <param name="initialClock">Initial value for the clock.</param>
- /// <param name="comparer">Comparer to determine causality of events based on absolute time.</param>
- /// <exception cref="ArgumentNullException"><paramref name="comparer"/> is null.</exception>
- protected VirtualTimeScheduler(TAbsolute initialClock, IComparer<TAbsolute> comparer)
- : base(initialClock, comparer)
- {
- }
-
- /// <summary>
- /// Gets the next scheduled item to be executed.
- /// </summary>
- /// <returns>The next scheduled item.</returns>
- protected override IScheduledItem<TAbsolute> GetNext()
- {
- while (queue.Count > 0)
- {
- var next = queue.Peek();
- if (next.IsCanceled)
- queue.Dequeue();
- else
- return next;
- }
- return null;
- }
-
- /// <summary>
- /// Schedules an action to be executed at dueTime.
- /// </summary>
- /// <typeparam name="TState">The type of the state passed to the scheduled action.</typeparam>
- /// <param name="state">State passed to the action to be executed.</param>
- /// <param name="action">Action to be executed.</param>
- /// <param name="dueTime">Absolute time at which to execute the action.</param>
- /// <returns>The disposable object used to cancel the scheduled action (best effort).</returns>
- /// <exception cref="ArgumentNullException"><paramref name="action"/> is null.</exception>
- public override IDisposable ScheduleAbsolute<TState>(TState state, TAbsolute dueTime, Func<IScheduler, TState, IDisposable> action)
- {
- if (action == null)
- throw new ArgumentNullException("action");
-
- var si = default(ScheduledItem<TAbsolute, TState>);
-
- var run = new Func<IScheduler, TState, IDisposable>((scheduler, state1) =>
- {
- queue.Remove(si);
- return action(scheduler, state1);
- });
-
- si = new ScheduledItem<TAbsolute, TState>(this, state, run, dueTime, Comparer);
- queue.Enqueue(si);
-
- return Disposable.Create(si.Cancel);
- }
- }
-}
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/EventPattern.cs b/Rx.NET/System.Reactive.Linq/Reactive/EventPattern.cs
deleted file mode 100644
index c3f6e44..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/EventPattern.cs
+++ /dev/null
@@ -1,116 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System.Collections.Generic;
-
-namespace System.Reactive
-{
- /// <summary>
- /// Represents a .NET event invocation consisting of the weakly typed object that raised the event and the data that was generated by the event.
- /// </summary>
- /// <typeparam name="TEventArgs">The type of the event data generated by the event.</typeparam>
- public class EventPattern<TEventArgs> : EventPattern<object, TEventArgs>
-#if !NO_EVENTARGS_CONSTRAINT
- where TEventArgs : EventArgs
-#endif
- {
- /// <summary>
- /// Creates a new data representation instance of a .NET event invocation with the given sender and event data.
- /// </summary>
- /// <param name="sender">The sender object that raised the event.</param>
- /// <param name="e">The event data that was generated by the event.</param>
- public EventPattern(object sender, TEventArgs e)
- : base(sender, e)
- {
- }
- }
-
- /// <summary>
- /// Represents a .NET event invocation consisting of the strongly typed object that raised the event and the data that was generated by the event.
- /// </summary>
- /// <typeparam name="TSender">The type of the sender that raised the event.</typeparam>
- /// <typeparam name="TEventArgs">The type of the event data generated by the event.</typeparam>
- public class EventPattern<TSender, TEventArgs> : IEquatable<EventPattern<TSender, TEventArgs>>, IEventPattern<TSender, TEventArgs>
-#if !NO_EVENTARGS_CONSTRAINT
- where TEventArgs : EventArgs
-#endif
- {
- /// <summary>
- /// Creates a new data representation instance of a .NET event invocation with the given sender and event data.
- /// </summary>
- /// <param name="sender">The sender object that raised the event.</param>
- /// <param name="e">The event data that was generated by the event.</param>
- public EventPattern(TSender sender, TEventArgs e)
- {
- Sender = sender;
- EventArgs = e;
- }
-
- /// <summary>
- /// Gets the sender object that raised the event.
- /// </summary>
- public TSender Sender { get; private set; }
-
- /// <summary>
- /// Gets the event data that was generated by the event.
- /// </summary>
- public TEventArgs EventArgs { get; private set; }
-
- /// <summary>
- /// Determines whether the current EventPattern&lt;TSender, TEventArgs&gt; object represents the same event as a specified EventPattern&lt;TSender, TEventArgs&gt; object.
- /// </summary>
- /// <param name="other">An object to compare to the current EventPattern&lt;TSender, TEventArgs&gt; object.</param>
- /// <returns>true if both EventPattern&lt;TSender, TEventArgs&gt; objects represent the same event; otherwise, false.</returns>
- public bool Equals(EventPattern<TSender, TEventArgs> other)
- {
- if (object.ReferenceEquals(null, other))
- return false;
- if (object.ReferenceEquals(this, other))
- return true;
-
- return EqualityComparer<TSender>.Default.Equals(Sender, other.Sender) && EqualityComparer<TEventArgs>.Default.Equals(EventArgs, other.EventArgs);
- }
-
- /// <summary>
- /// Determines whether the specified System.Object is equal to the current EventPattern&lt;TSender, TEventArgs&gt;.
- /// </summary>
- /// <param name="obj">The System.Object to compare with the current EventPattern&lt;TSender, TEventArgs&gt;.</param>
- /// <returns>true if the specified System.Object is equal to the current EventPattern&lt;TSender, TEventArgs&gt;; otherwise, false.</returns>
- public override bool Equals(object obj)
- {
- return Equals(obj as EventPattern<TSender, TEventArgs>);
- }
-
- /// <summary>
- /// Returns the hash code for the current EventPattern&lt;TSender, TEventArgs&gt; instance.
- /// </summary>
- /// <returns>A hash code for the current EventPattern&lt;TSender, TEventArgs&gt; instance.</returns>
- public override int GetHashCode()
- {
- var x = EqualityComparer<TSender>.Default.GetHashCode(Sender);
- var y = EqualityComparer<TEventArgs>.Default.GetHashCode(EventArgs);
- return (x << 5) + (x ^ y);
- }
-
- /// <summary>
- /// Determines whether two specified EventPattern&lt;TSender, TEventArgs&gt; objects represent the same event.
- /// </summary>
- /// <param name="first">The first EventPattern&lt;TSender, TEventArgs&gt; to compare, or null.</param>
- /// <param name="second">The second EventPattern&lt;TSender, TEventArgs&gt; to compare, or null.</param>
- /// <returns>true if both EventPattern&lt;TSender, TEventArgs&gt; objects represent the same event; otherwise, false.</returns>
- public static bool operator ==(EventPattern<TSender, TEventArgs> first, EventPattern<TSender, TEventArgs> second)
- {
- return object.Equals(first, second);
- }
-
- /// <summary>
- /// Determines whether two specified EventPattern&lt;TSender, TEventArgs&gt; objects represent a different event.
- /// </summary>
- /// <param name="first">The first EventPattern&lt;TSender, TEventArgs&gt; to compare, or null.</param>
- /// <param name="second">The second EventPattern&lt;TSender, TEventArgs&gt; to compare, or null.</param>
- /// <returns>true if both EventPattern&lt;TSender, TEventArgs&gt; objects don't represent the same event; otherwise, false.</returns>
- public static bool operator !=(EventPattern<TSender, TEventArgs> first, EventPattern<TSender, TEventArgs> second)
- {
- return !object.Equals(first, second);
- }
- }
-}
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/EventPatternSource.cs b/Rx.NET/System.Reactive.Linq/Reactive/EventPatternSource.cs
deleted file mode 100644
index 742970e..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/EventPatternSource.cs
+++ /dev/null
@@ -1,28 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-namespace System.Reactive
-{
- class EventPatternSource<TEventArgs> : EventPatternSourceBase<object, TEventArgs>, IEventPatternSource<TEventArgs>
-#if !NO_EVENTARGS_CONSTRAINT
- where TEventArgs : EventArgs
-#endif
- {
- public EventPatternSource(IObservable<EventPattern<object, TEventArgs>> source, Action<Action<object, TEventArgs>, /*object,*/ EventPattern<object, TEventArgs>> invokeHandler)
- : base(source, invokeHandler)
- {
- }
-
- event EventHandler<TEventArgs> IEventPatternSource<TEventArgs>.OnNext
- {
- add
- {
- Add(value, (o, e) => value(o, e));
- }
-
- remove
- {
- Remove(value);
- }
- }
- }
-}
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/EventPatternSourceBase.cs b/Rx.NET/System.Reactive.Linq/Reactive/EventPatternSourceBase.cs
deleted file mode 100644
index b3a7754..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/EventPatternSourceBase.cs
+++ /dev/null
@@ -1,127 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System.Collections.Generic;
-
-namespace System.Reactive
-{
- /// <summary>
- /// Base class for classes that expose an observable sequence as a well-known event pattern (sender, event arguments).
- /// Contains functionality to maintain a map of event handler delegates to observable sequence subscriptions. Subclasses
- /// should only add an event with custom add and remove methods calling into the base class's operations.
- /// </summary>
- /// <typeparam name="TSender">The type of the sender that raises the event.</typeparam>
- /// <typeparam name="TEventArgs">The type of the event data generated by the event.</typeparam>
- public abstract class EventPatternSourceBase<TSender, TEventArgs>
-#if !NO_EVENTARGS_CONSTRAINT
- where TEventArgs : EventArgs
-#endif
- {
- private readonly IObservable<EventPattern<TSender, TEventArgs>> _source;
- private readonly Dictionary<Delegate, Stack<IDisposable>> _subscriptions;
- private readonly Action<Action<TSender, TEventArgs>, /*object,*/ EventPattern<TSender, TEventArgs>> _invokeHandler;
-
- /// <summary>
- /// Creates a new event pattern source.
- /// </summary>
- /// <param name="source">Source sequence to expose as an event.</param>
- /// <param name="invokeHandler">Delegate used to invoke the event for each element of the sequence.</param>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="invokeHandler"/> is null.</exception>
- protected EventPatternSourceBase(IObservable<EventPattern<TSender, TEventArgs>> source, Action<Action<TSender, TEventArgs>, /*object,*/ EventPattern<TSender, TEventArgs>> invokeHandler)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (invokeHandler == null)
- throw new ArgumentNullException("invokeHandler");
-
- _source = source;
- _invokeHandler = invokeHandler;
- _subscriptions = new Dictionary<Delegate, Stack<IDisposable>>();
- }
-
- /// <summary>
- /// Adds the specified event handler, causing a subscription to the underlying source.
- /// </summary>
- /// <param name="handler">Event handler to add. The same delegate should be passed to the Remove operation in order to remove the event handler.</param>
- /// <param name="invoke">Invocation delegate to raise the event in the derived class.</param>
- /// <exception cref="ArgumentNullException"><paramref name="handler"/> or <paramref name="invoke"/> is null.</exception>
- protected void Add(Delegate handler, Action<TSender, TEventArgs> invoke)
- {
- if (handler == null)
- throw new ArgumentNullException("handler");
- if (invoke == null)
- throw new ArgumentNullException("invoke");
-
- var gate = new object();
- var isAdded = false;
- var isDone = false;
-
- var remove = new Action(() =>
- {
- lock (gate)
- {
- if (isAdded)
- Remove(handler);
- else
- isDone = true;
- }
- });
-
- //
- // [OK] Use of unsafe Subscribe: non-pretentious wrapper of an observable in an event; exceptions can occur during +=.
- //
- var d = _source.Subscribe/*Unsafe*/(
- x => _invokeHandler(invoke, /*this,*/ x),
- ex => { remove(); ex.Throw(); },
- () => remove()
- );
-
- lock (gate)
- {
- if (!isDone)
- {
- Add(handler, d);
- isAdded = true;
- }
- }
- }
-
- private void Add(Delegate handler, IDisposable disposable)
- {
- lock (_subscriptions)
- {
- var l = new Stack<IDisposable>();
- if (!_subscriptions.TryGetValue(handler, out l))
- _subscriptions[handler] = l = new Stack<IDisposable>();
-
- l.Push(disposable);
- }
- }
-
- /// <summary>
- /// Removes the specified event handler, causing a disposal of the corresponding subscription to the underlying source that was created during the Add operation.
- /// </summary>
- /// <param name="handler">Event handler to remove. This should be the same delegate as one that was passed to the Add operation.</param>
- /// <exception cref="ArgumentNullException"><paramref name="handler"/> is null.</exception>
- protected void Remove(Delegate handler)
- {
- if (handler == null)
- throw new ArgumentNullException("handler");
-
- var d = default(IDisposable);
-
- lock (_subscriptions)
- {
- var l = new Stack<IDisposable>();
- if (_subscriptions.TryGetValue(handler, out l))
- {
- d = l.Pop();
- if (l.Count == 0)
- _subscriptions.Remove(handler);
- }
- }
-
- if (d != null)
- d.Dispose();
- }
- }
-}
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/EventSource.cs b/Rx.NET/System.Reactive.Linq/Reactive/EventSource.cs
deleted file mode 100644
index b71504c..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/EventSource.cs
+++ /dev/null
@@ -1,95 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System.Collections.Generic;
-
-namespace System.Reactive
-{
- class EventSource<T> : IEventSource<T>
- {
- private readonly IObservable<T> _source;
- private readonly Dictionary<Delegate, Stack<IDisposable>> _subscriptions;
- private readonly Action<Action<T>, /*object,*/ T> _invokeHandler;
-
- public EventSource(IObservable<T> source, Action<Action<T>, /*object,*/ T> invokeHandler)
- {
- _source = source;
- _invokeHandler = invokeHandler;
- _subscriptions = new Dictionary<Delegate, Stack<IDisposable>>();
- }
-
- public event Action<T> OnNext
- {
- add
- {
- var gate = new object();
- var isAdded = false;
- var isDone = false;
-
- var remove = new Action(() =>
- {
- lock (gate)
- {
- if (isAdded)
- Remove(value);
- else
- isDone = true;
- }
- });
-
- //
- // [OK] Use of unsafe Subscribe: non-pretentious wrapper of an observable in an event; exceptions can occur during +=.
- //
- var d = _source.Subscribe/*Unsafe*/(
- x => _invokeHandler(value, /*this,*/ x),
- ex => { remove(); ex.Throw(); },
- () => remove()
- );
-
- lock (gate)
- {
- if (!isDone)
- {
- Add(value, d);
- isAdded = true;
- }
- }
- }
-
- remove
- {
- Remove(value);
- }
- }
-
- private void Add(Delegate handler, IDisposable disposable)
- {
- lock (_subscriptions)
- {
- var l = new Stack<IDisposable>();
- if (!_subscriptions.TryGetValue(handler, out l))
- _subscriptions[handler] = l = new Stack<IDisposable>();
-
- l.Push(disposable);
- }
- }
-
- private void Remove(Delegate handler)
- {
- var d = default(IDisposable);
-
- lock (_subscriptions)
- {
- var l = new Stack<IDisposable>();
- if (_subscriptions.TryGetValue(handler, out l))
- {
- d = l.Pop();
- if (l.Count == 0)
- _subscriptions.Remove(handler);
- }
- }
-
- if (d != null)
- d.Dispose();
- }
- }
-}
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Internal/AnonymousEnumerable.cs b/Rx.NET/System.Reactive.Linq/Reactive/Internal/AnonymousEnumerable.cs
deleted file mode 100644
index b14b89b..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Internal/AnonymousEnumerable.cs
+++ /dev/null
@@ -1,26 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System.Collections.Generic;
-
-namespace System.Reactive
-{
- internal sealed class AnonymousEnumerable<T> : IEnumerable<T>
- {
- private readonly Func<IEnumerator<T>> getEnumerator;
-
- public AnonymousEnumerable(Func<IEnumerator<T>> getEnumerator)
- {
- this.getEnumerator = getEnumerator;
- }
-
- public IEnumerator<T> GetEnumerator()
- {
- return getEnumerator();
- }
-
- System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
- {
- return this.GetEnumerator();
- }
- }
-}
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Internal/BinaryObserver.cs b/Rx.NET/System.Reactive.Linq/Reactive/Internal/BinaryObserver.cs
deleted file mode 100644
index 870b6a9..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Internal/BinaryObserver.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-namespace System.Reactive
-{
-#if NO_PERF
- class BinaryObserver<TLeft, TRight> : IObserver<Either<Notification<TLeft>, Notification<TRight>>>
- {
- public BinaryObserver(IObserver<TLeft> leftObserver, IObserver<TRight> rightObserver)
- {
- LeftObserver = leftObserver;
- RightObserver = rightObserver;
- }
-
- public BinaryObserver(Action<Notification<TLeft>> left, Action<Notification<TRight>> right)
- : this(left.ToObserver(), right.ToObserver())
- {
- }
-
- public IObserver<TLeft> LeftObserver { get; private set; }
- public IObserver<TRight> RightObserver { get; private set; }
-
- void IObserver<Either<Notification<TLeft>, Notification<TRight>>>.OnNext(Either<Notification<TLeft>, Notification<TRight>> value)
- {
- value.Switch(left => left.Accept(LeftObserver), right => right.Accept(RightObserver));
- }
-
- void IObserver<Either<Notification<TLeft>, Notification<TRight>>>.OnError(Exception exception)
- {
- }
-
- void IObserver<Either<Notification<TLeft>, Notification<TRight>>>.OnCompleted()
- {
- }
- }
-#endif
-}
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Internal/ConcatSink.cs b/Rx.NET/System.Reactive.Linq/Reactive/Internal/ConcatSink.cs
deleted file mode 100644
index 5f4a12f..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Internal/ConcatSink.cs
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System;
-using System.Collections.Generic;
-
-namespace System.Reactive
-{
- abstract class ConcatSink<TSource> : TailRecursiveSink<TSource>
- {
- public ConcatSink(IObserver<TSource> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- }
-
- protected override IEnumerable<IObservable<TSource>> Extract(IObservable<TSource> source)
- {
- var concat = source as IConcatenatable<TSource>;
- if (concat != null)
- return concat.GetSources();
-
- return null;
- }
-
- public override void OnCompleted()
- {
- _recurse();
- }
- }
-}
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Internal/Constants.cs b/Rx.NET/System.Reactive.Linq/Reactive/Internal/Constants.cs
deleted file mode 100644
index 3e6759b..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Internal/Constants.cs
+++ /dev/null
@@ -1,18 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-//
-// NOTE: Identical copies of this file are kept in System.Reactive.Linq and System.Reactive.Providers.
-//
-
-namespace System.Reactive
-{
- // We can't make those based on the Strings_*.resx file, because the ObsoleteAttribute needs a compile-time constant.
-
- class Constants_Linq
- {
-#if PREFER_ASYNC
- public const string USE_ASYNC = "This blocking operation is no longer supported. Instead, use the async version in combination with C# and Visual Basic async/await support. In case you need a blocking operation, use Wait or convert the resulting observable sequence to a Task object and block. See http://go.microsoft.com/fwlink/?LinkID=260866 for more information.";
- public const string USE_TASK_FROMASYNCPATTERN = "This conversion is no longer supported. Replace use of the Begin/End asynchronous method pair with a new Task-based async method, and convert the result using ToObservable. If no Task-based async method is available, use Task.Factory.FromAsync to obtain a Task object. See http://go.microsoft.com/fwlink/?LinkID=260866 for more information.";
-#endif
- }
-} \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Internal/Either.Generic.cs b/Rx.NET/System.Reactive.Linq/Reactive/Internal/Either.Generic.cs
deleted file mode 100644
index 6bb8372..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Internal/Either.Generic.cs
+++ /dev/null
@@ -1,115 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System.Collections.Generic;
-using System.Globalization;
-
-namespace System.Reactive
-{
- abstract class Either<TLeft, TRight>
- {
- Either()
- {
- }
-
- public static Either<TLeft, TRight> CreateLeft(TLeft value)
- {
- return new Either<TLeft, TRight>.Left(value);
- }
-
- public static Either<TLeft, TRight> CreateRight(TRight value)
- {
- return new Either<TLeft, TRight>.Right(value);
- }
-
- public abstract TResult Switch<TResult>(Func<TLeft, TResult> caseLeft, Func<TRight, TResult> caseRight);
- public abstract void Switch(Action<TLeft> caseLeft, Action<TRight> caseRight);
-
- public sealed class Left : Either<TLeft, TRight>, IEquatable<Left>
- {
- public TLeft Value { get; private set; }
-
- public Left(TLeft value)
- {
- Value = value;
- }
-
- public override TResult Switch<TResult>(Func<TLeft, TResult> caseLeft, Func<TRight, TResult> caseRight)
- {
- return caseLeft(Value);
- }
-
- public override void Switch(Action<TLeft> caseLeft, Action<TRight> caseRight)
- {
- caseLeft(Value);
- }
-
- public bool Equals(Left other)
- {
- if (other == this)
- return true;
- if (other == null)
- return false;
- return EqualityComparer<TLeft>.Default.Equals(Value, other.Value);
- }
-
- public override bool Equals(object obj)
- {
- return Equals(obj as Left);
- }
-
- public override int GetHashCode()
- {
- return EqualityComparer<TLeft>.Default.GetHashCode(Value);
- }
-
- public override string ToString()
- {
- return string.Format(CultureInfo.CurrentCulture, "Left({0})", Value);
- }
- }
-
- public sealed class Right : Either<TLeft, TRight>, IEquatable<Right>
- {
- public TRight Value { get; private set; }
-
- public Right(TRight value)
- {
- Value = value;
- }
-
- public override TResult Switch<TResult>(Func<TLeft, TResult> caseLeft, Func<TRight, TResult> caseRight)
- {
- return caseRight(Value);
- }
-
- public override void Switch(Action<TLeft> caseLeft, Action<TRight> caseRight)
- {
- caseRight(Value);
- }
-
- public bool Equals(Right other)
- {
- if (other == this)
- return true;
- if (other == null)
- return false;
- return EqualityComparer<TRight>.Default.Equals(Value, other.Value);
- }
-
- public override bool Equals(object obj)
- {
- return Equals(obj as Right);
- }
-
- public override int GetHashCode()
- {
- return EqualityComparer<TRight>.Default.GetHashCode(Value);
- }
-
- public override string ToString()
- {
- return string.Format(CultureInfo.CurrentCulture, "Right({0})", Value);
- }
- }
- }
-}
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Internal/HashSet.cs b/Rx.NET/System.Reactive.Linq/Reactive/Internal/HashSet.cs
deleted file mode 100644
index f2a7d79..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Internal/HashSet.cs
+++ /dev/null
@@ -1,28 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if NO_HASHSET
-using System;
-using System.Collections.Generic;
-
-namespace System.Reactive
-{
- class HashSet<T>
- {
- private Dictionary<T, object> _set;
-
- public HashSet(IEqualityComparer<T> comparer)
- {
- _set = new Dictionary<T, object>(comparer);
- }
-
- public bool Add(T value)
- {
- if (_set.ContainsKey(value))
- return false;
-
- _set[value] = null;
- return true;
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Internal/Helpers.cs b/Rx.NET/System.Reactive.Linq/Reactive/Internal/Helpers.cs
deleted file mode 100644
index dee33fb..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Internal/Helpers.cs
+++ /dev/null
@@ -1,45 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_PERF
-using System;
-using System.Collections.Generic;
-using System.Reactive.Linq.Observαble;
-
-namespace System.Reactive
-{
- internal static class Helpers
- {
- public static int? GetLength<T>(IEnumerable<T> source)
- {
- var array = source as T[];
- if (array != null)
- return array.Length;
-
- var list = source as IList<T>;
- if (list != null)
- return list.Count;
-
- return null;
- }
-
- public static IObservable<T> Unpack<T>(IObservable<T> source)
- {
- var hasOpt = default(bool);
-
- do
- {
- hasOpt = false;
-
- var eval = source as IEvaluatableObservable<T>;
- if (eval != null)
- {
- source = eval.Eval();
- hasOpt = true;
- }
- } while (hasOpt);
-
- return source;
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Internal/IConcatenatable.cs b/Rx.NET/System.Reactive.Linq/Reactive/Internal/IConcatenatable.cs
deleted file mode 100644
index 88a89c8..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Internal/IConcatenatable.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System;
-using System.Collections.Generic;
-
-namespace System.Reactive
-{
- interface IConcatenatable<TSource>
- {
- IEnumerable<IObservable<TSource>> GetSources();
- }
-}
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Internal/IEvaluatableObservable.cs b/Rx.NET/System.Reactive.Linq/Reactive/Internal/IEvaluatableObservable.cs
deleted file mode 100644
index d85c226..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Internal/IEvaluatableObservable.cs
+++ /dev/null
@@ -1,9 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-namespace System.Reactive
-{
- interface IEvaluatableObservable<T>
- {
- IObservable<T> Eval();
- }
-}
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Internal/ImmutableList.cs b/Rx.NET/System.Reactive.Linq/Reactive/Internal/ImmutableList.cs
deleted file mode 100644
index 5866778..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Internal/ImmutableList.cs
+++ /dev/null
@@ -1,49 +0,0 @@
-namespace System.Reactive
-{
- class ImmutableList<T>
- {
- T[] data;
-
- public ImmutableList()
- {
- data = new T[0];
- }
-
- public ImmutableList(T[] data)
- {
- this.data = data;
- }
-
- public ImmutableList<T> Add(T value)
- {
- var newData = new T[data.Length + 1];
- Array.Copy(data, newData, data.Length);
- newData[data.Length] = value;
- return new ImmutableList<T>(newData);
- }
-
- public ImmutableList<T> Remove(T value)
- {
- var i = IndexOf(value);
- if (i < 0)
- return this;
- var newData = new T[data.Length - 1];
- Array.Copy(data, 0, newData, 0, i);
- Array.Copy(data, i + 1, newData, i, data.Length - i - 1);
- return new ImmutableList<T>(newData);
- }
-
- public int IndexOf(T value)
- {
- for (var i = 0; i < data.Length; ++i)
- if (data[i].Equals(value))
- return i;
- return -1;
- }
-
- public T[] Data
- {
- get { return data; }
- }
- }
-}
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Internal/Lookup.cs b/Rx.NET/System.Reactive.Linq/Reactive/Internal/Lookup.cs
deleted file mode 100644
index 239f10d..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Internal/Lookup.cs
+++ /dev/null
@@ -1,83 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-
-namespace System.Reactive
-{
- class Lookup<K, E> : ILookup<K, E>
- {
- Dictionary<K, List<E>> d;
-
- public Lookup(IEqualityComparer<K> comparer)
- {
- d = new Dictionary<K, List<E>>(comparer);
- }
-
- public void Add(K key, E element)
- {
- var list = default(List<E>);
- if (!d.TryGetValue(key, out list))
- d[key] = list = new List<E>();
- list.Add(element);
- }
-
- public bool Contains(K key)
- {
- return d.ContainsKey(key);
- }
-
- public int Count
- {
- get { return d.Count; }
- }
-
- public IEnumerable<E> this[K key]
- {
- get { return Hide(d[key]); }
- }
-
- private IEnumerable<E> Hide(List<E> elements)
- {
- foreach (var x in elements)
- yield return x;
- }
-
- public IEnumerator<IGrouping<K, E>> GetEnumerator()
- {
- foreach (var kv in d)
- yield return new Grouping(kv);
- }
-
- class Grouping : IGrouping<K, E>
- {
- KeyValuePair<K, List<E>> kv;
-
- public Grouping(KeyValuePair<K, List<E>> kv)
- {
- this.kv = kv;
- }
-
- public K Key
- {
- get { return kv.Key; }
- }
-
- public IEnumerator<E> GetEnumerator()
- {
- return kv.Value.GetEnumerator();
- }
-
- Collections.IEnumerator Collections.IEnumerable.GetEnumerator()
- {
- return GetEnumerator();
- }
- }
-
- Collections.IEnumerator Collections.IEnumerable.GetEnumerator()
- {
- return GetEnumerator();
- }
- }
-} \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Internal/Observers.cs b/Rx.NET/System.Reactive.Linq/Reactive/Internal/Observers.cs
deleted file mode 100644
index f90096a..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Internal/Observers.cs
+++ /dev/null
@@ -1,107 +0,0 @@
-namespace System.Reactive
-{
- class NopObserver<T> : IObserver<T>
- {
- public static readonly IObserver<T> Instance = new NopObserver<T>();
-
- public void OnCompleted()
- {
- }
-
- public void OnError(Exception error)
- {
- }
-
- public void OnNext(T value)
- {
- }
- }
-
- class DoneObserver<T> : IObserver<T>
- {
- public static readonly IObserver<T> Completed = new DoneObserver<T>();
-
- public Exception Exception { get; set; }
-
- public void OnCompleted()
- {
- }
-
- public void OnError(Exception error)
- {
- }
-
- public void OnNext(T value)
- {
- }
- }
-
- class DisposedObserver<T> : IObserver<T>
- {
- public static readonly IObserver<T> Instance = new DisposedObserver<T>();
-
- public void OnCompleted()
- {
- throw new ObjectDisposedException("");
- }
-
- public void OnError(Exception error)
- {
- throw new ObjectDisposedException("");
- }
-
- public void OnNext(T value)
- {
- throw new ObjectDisposedException("");
- }
- }
-
- class Observer<T> : IObserver<T>
- {
- private readonly ImmutableList<IObserver<T>> _observers;
-
- public Observer(ImmutableList<IObserver<T>> observers)
- {
- _observers = observers;
- }
-
- public void OnCompleted()
- {
- foreach (var observer in _observers.Data)
- observer.OnCompleted();
- }
-
- public void OnError(Exception error)
- {
- foreach (var observer in _observers.Data)
- observer.OnError(error);
- }
-
- public void OnNext(T value)
- {
- foreach (var observer in _observers.Data)
- observer.OnNext(value);
- }
-
- internal IObserver<T> Add(IObserver<T> observer)
- {
- return new Observer<T>(_observers.Add(observer));
- }
-
- internal IObserver<T> Remove(IObserver<T> observer)
- {
- var i = Array.IndexOf(_observers.Data, observer);
- if (i < 0)
- return this;
-
- if (_observers.Data.Length == 2)
- {
- return _observers.Data[1 - i];
- }
- else
- {
- return new Observer<T>(_observers.Remove(observer));
- }
- }
- }
-}
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Internal/Producer.cs b/Rx.NET/System.Reactive.Linq/Reactive/Internal/Producer.cs
deleted file mode 100644
index 1e87e38..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Internal/Producer.cs
+++ /dev/null
@@ -1,49 +0,0 @@
-#if !NO_PERF
-using System.Reactive.Concurrency;
-using System.Reactive.Disposables;
-
-namespace System.Reactive
-{
- /// <summary>
- /// Base class for implementation of query operators, providing performance benefits over the use of <see cref="System.Reactive.Linq.Observable.Create">Observable.Create</see>.
- /// </summary>
- /// <typeparam name="TSource">Type of the resulting sequence's elements.</typeparam>
- abstract class Producer<TSource> : IObservable<TSource>
- {
- /// <summary>
- /// Publicly visible Subscribe method.
- /// </summary>
- /// <param name="observer">Observer to send notifications on. The implementation of a producer must ensure the correct message grammar on the observer.</param>
- /// <returns>IDisposable to cancel the subscription. This causes the underlying sink to be notified of unsubscription, causing it to prevent further messages from being sent to the observer.</returns>
- public IDisposable Subscribe(IObserver<TSource> observer)
- {
- if (observer == null)
- throw new ArgumentNullException("observer");
-
- var sink = new SingleAssignmentDisposable();
- var subscription = new SingleAssignmentDisposable();
-
- if (CurrentThreadScheduler.Instance.ScheduleRequired)
- {
- CurrentThreadScheduler.Instance.Schedule(this, (_, me) => subscription.Disposable = me.Run(observer, subscription, s => sink.Disposable = s));
- }
- else
- {
- subscription.Disposable = this.Run(observer, subscription, s => sink.Disposable = s);
- }
-
- return new CompositeDisposable(2) { sink, subscription };
- }
-
- /// <summary>
- /// Core implementation of the query operator, called upon a new subscription to the producer object.
- /// </summary>
- /// <param name="observer">Observer to send notifications on. The implementation of a producer must ensure the correct message grammar on the observer.</param>
- /// <param name="cancel">The subscription disposable object returned from the Run call, passed in such that it can be forwarded to the sink, allowing it to dispose the subscription upon sending a final message (or prematurely for other reasons).</param>
- /// <param name="setSink">Callback to communicate the sink object to the subscriber, allowing consumers to tunnel a Dispose call into the sink, which can stop the processing.</param>
- /// <returns>Disposable representing all the resources and/or subscriptions the operator uses to process events.</returns>
- /// <remarks>The <paramref name="observer">observer</paramref> passed in to this method is not protected using auto-detach behavior upon an OnError or OnCompleted call. The implementation must ensure proper resource disposal and enforce the message grammar.</remarks>
- protected abstract IDisposable Run(IObserver<TSource> observer, IDisposable cancel, Action<IDisposable> setSink);
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Internal/PushPullAdapter.cs b/Rx.NET/System.Reactive.Linq/Reactive/Internal/PushPullAdapter.cs
deleted file mode 100644
index 5804538..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Internal/PushPullAdapter.cs
+++ /dev/null
@@ -1,79 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if NO_CDS || NO_PERF
-using System.Collections.Generic;
-
-namespace System.Reactive
-{
- sealed class PushPullAdapter<T, R> : IObserver<T>, IEnumerator<R>
- {
- Action<Notification<T>> yield;
- Action dispose;
- Func<Notification<R>> moveNext;
- Notification<R> current;
- bool done = false;
- bool disposed;
-
- public PushPullAdapter(Action<Notification<T>> yield, Func<Notification<R>> moveNext, Action dispose)
- {
- this.yield = yield;
- this.moveNext = moveNext;
- this.dispose = dispose;
- }
-
- public void OnNext(T value)
- {
- yield(Notification.CreateOnNext<T>(value));
- }
-
- public void OnError(Exception exception)
- {
- yield(Notification.CreateOnError<T>(exception));
- dispose();
- }
-
- public void OnCompleted()
- {
- yield(Notification.CreateOnCompleted<T>());
- dispose();
- }
-
- public R Current
- {
- get { return current.Value; }
- }
-
- public void Dispose()
- {
- disposed = true;
- dispose();
- }
-
- object System.Collections.IEnumerator.Current
- {
- get { return this.Current; }
- }
-
- public bool MoveNext()
- {
- if (disposed)
- throw new ObjectDisposedException("");
-
- if (!done)
- {
- current = moveNext();
- done = current.Kind != NotificationKind.OnNext;
- }
-
- current.Exception.ThrowIfNotNull();
-
- return current.HasValue;
- }
-
- public void Reset()
- {
- throw new NotSupportedException();
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Internal/QueryServices.cs b/Rx.NET/System.Reactive.Linq/Reactive/Internal/QueryServices.cs
deleted file mode 100644
index 926f612..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Internal/QueryServices.cs
+++ /dev/null
@@ -1,35 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System;
-using System.Reactive.PlatformServices;
-
-namespace System.Reactive.Linq
-{
- internal static class QueryServices
- {
- private static Lazy<IQueryServices> s_services = new Lazy<IQueryServices>(Initialize);
-
- public static T GetQueryImpl<T>(T defaultInstance)
- {
- return s_services.Value.Extend(defaultInstance);
- }
-
- private static IQueryServices Initialize()
- {
- return PlatformEnlightenmentProvider.Current.GetService<IQueryServices>() ?? new DefaultQueryServices();
- }
- }
-
- internal interface IQueryServices
- {
- T Extend<T>(T baseImpl);
- }
-
- class DefaultQueryServices : IQueryServices
- {
- public T Extend<T>(T baseImpl)
- {
- return baseImpl;
- }
- }
-}
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Internal/ReflectionUtils.cs b/Rx.NET/System.Reactive.Linq/Reactive/Internal/ReflectionUtils.cs
deleted file mode 100644
index effdd08..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Internal/ReflectionUtils.cs
+++ /dev/null
@@ -1,152 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System;
-using System.Collections.Generic;
-using System.Globalization;
-using System.Reflection;
-
-#if HAS_WINRT
-using System.Runtime.InteropServices.WindowsRuntime;
-#endif
-
-namespace System.Reactive
-{
- static class ReflectionUtils
- {
- public static TDelegate CreateDelegate<TDelegate>(object o, MethodInfo method)
- {
-#if CRIPPLED_REFLECTION
- return (TDelegate)(object)method.CreateDelegate(typeof(TDelegate), o);
-#else
- return (TDelegate)(object)Delegate.CreateDelegate(typeof(TDelegate), o, method);
-#endif
- }
-
- public static Delegate CreateDelegate(Type delegateType, object o, MethodInfo method)
- {
-#if CRIPPLED_REFLECTION
- return method.CreateDelegate(delegateType, o);
-#else
- return Delegate.CreateDelegate(delegateType, o, method);
-#endif
- }
-
- public static void GetEventMethods<TSender, TEventArgs>(Type targetType, object target, string eventName, out MethodInfo addMethod, out MethodInfo removeMethod, out Type delegateType, out bool isWinRT)
-#if !NO_EVENTARGS_CONSTRAINT
- where TEventArgs : EventArgs
-#endif
- {
- var e = default(EventInfo);
-
- if (target == null)
- {
- e = targetType.GetEventEx(eventName, true);
- if (e == null)
- throw new InvalidOperationException(string.Format(CultureInfo.CurrentCulture, Strings_Linq.COULD_NOT_FIND_STATIC_EVENT, eventName, targetType.FullName));
- }
- else
- {
- e = targetType.GetEventEx(eventName, false);
- if (e == null)
- throw new InvalidOperationException(string.Format(CultureInfo.CurrentCulture, Strings_Linq.COULD_NOT_FIND_INSTANCE_EVENT, eventName, targetType.FullName));
- }
-
- addMethod = e.GetAddMethod();
- removeMethod = e.GetRemoveMethod();
-
- if (addMethod == null)
- throw new InvalidOperationException(Strings_Linq.EVENT_MISSING_ADD_METHOD);
- if (removeMethod == null)
- throw new InvalidOperationException(Strings_Linq.EVENT_MISSING_REMOVE_METHOD);
-
- var psa = addMethod.GetParameters();
- if (psa.Length != 1)
- throw new InvalidOperationException(Strings_Linq.EVENT_ADD_METHOD_SHOULD_TAKE_ONE_PARAMETER);
-
- var psr = removeMethod.GetParameters();
- if (psr.Length != 1)
- throw new InvalidOperationException(Strings_Linq.EVENT_REMOVE_METHOD_SHOULD_TAKE_ONE_PARAMETER);
-
- isWinRT = false;
-
-#if HAS_WINRT
- if (addMethod.ReturnType == typeof(EventRegistrationToken))
- {
- isWinRT = true;
-
- var pet = psr[0];
- if (pet.ParameterType != typeof(EventRegistrationToken))
- throw new InvalidOperationException(Strings_Linq.EVENT_WINRT_REMOVE_METHOD_SHOULD_TAKE_ERT);
- }
-#endif
-
- delegateType = psa[0].ParameterType;
-
- var invokeMethod = delegateType.GetMethod("Invoke");
-
- var parameters = invokeMethod.GetParameters();
-
- if (parameters.Length != 2)
- throw new InvalidOperationException(Strings_Linq.EVENT_PATTERN_REQUIRES_TWO_PARAMETERS);
-
- if (!typeof(TSender).IsAssignableFrom(parameters[0].ParameterType))
- throw new InvalidOperationException(string.Format(CultureInfo.CurrentCulture, Strings_Linq.EVENT_SENDER_NOT_ASSIGNABLE, typeof(TSender).FullName));
-
- if (!typeof(TEventArgs).IsAssignableFrom(parameters[1].ParameterType))
- throw new InvalidOperationException(string.Format(CultureInfo.CurrentCulture, Strings_Linq.EVENT_ARGS_NOT_ASSIGNABLE, typeof(TEventArgs).FullName));
-
- if (invokeMethod.ReturnType != typeof(void))
- throw new InvalidOperationException(Strings_Linq.EVENT_MUST_RETURN_VOID);
- }
-
- public static EventInfo GetEventEx(this Type type, string name, bool isStatic)
- {
-#if CRIPPLED_REFLECTION
- // TODO: replace in the future by System.Reflection.RuntimeExtensions extension methods
- var q = new Queue<TypeInfo>();
- q.Enqueue(type.GetTypeInfo());
-
- while (q.Count > 0)
- {
- var t = q.Dequeue();
-
- var e = t.GetDeclaredEvent(name);
- if (e != null)
- return e;
-
- foreach (var i in t.ImplementedInterfaces)
- q.Enqueue(i.GetTypeInfo());
-
- if (t.BaseType != null)
- q.Enqueue(t.BaseType.GetTypeInfo());
- }
-
- return null;
-#else
- return type.GetEvent(name, isStatic ? BindingFlags.Public | BindingFlags.Static : BindingFlags.Public | BindingFlags.Instance);
-#endif
- }
-
-#if CRIPPLED_REFLECTION
- public static MethodInfo GetMethod(this Type type, string name)
- {
- return type.GetTypeInfo().GetDeclaredMethod(name);
- }
-
- public static MethodInfo GetAddMethod(this EventInfo eventInfo)
- {
- return eventInfo.AddMethod;
- }
-
- public static MethodInfo GetRemoveMethod(this EventInfo eventInfo)
- {
- return eventInfo.RemoveMethod;
- }
-
- public static bool IsAssignableFrom(this Type type1, Type type2)
- {
- return type1.GetTypeInfo().IsAssignableFrom(type2.GetTypeInfo());
- }
-#endif
- }
-}
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Internal/Sink.cs b/Rx.NET/System.Reactive.Linq/Reactive/Internal/Sink.cs
deleted file mode 100644
index 4737504..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Internal/Sink.cs
+++ /dev/null
@@ -1,66 +0,0 @@
-#if !NO_PERF
-using System.Threading;
-
-namespace System.Reactive
-{
- /// <summary>
- /// Base class for implementation of query operators, providing a lightweight sink that can be disposed to mute the outgoing observer.
- /// </summary>
- /// <typeparam name="TSource">Type of the resulting sequence's elements.</typeparam>
- /// <remarks>Implementations of sinks are responsible to enforce the message grammar on the associated observer. Upon sending a terminal message, a pairing Dispose call should be made to trigger cancellation of related resources and to mute the outgoing observer.</remarks>
- abstract class Sink<TSource> : IDisposable
- {
- protected volatile IObserver<TSource> _observer;
- private IDisposable _cancel;
-
- public Sink(IObserver<TSource> observer, IDisposable cancel)
- {
- _observer = observer;
- _cancel = cancel;
- }
-
- public virtual void Dispose()
- {
- _observer = NopObserver<TSource>.Instance;
-
- var cancel = Interlocked.Exchange(ref _cancel, null);
- if (cancel != null)
- {
- cancel.Dispose();
- }
- }
-
- public IObserver<TSource> GetForwarder()
- {
- return new _(this);
- }
-
- class _ : IObserver<TSource>
- {
- private readonly Sink<TSource> _forward;
-
- public _(Sink<TSource> forward)
- {
- _forward = forward;
- }
-
- public void OnNext(TSource value)
- {
- _forward._observer.OnNext(value);
- }
-
- public void OnError(Exception error)
- {
- _forward._observer.OnError(error);
- _forward.Dispose();
- }
-
- public void OnCompleted()
- {
- _forward._observer.OnCompleted();
- _forward.Dispose();
- }
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Internal/TailRecursiveSink.cs b/Rx.NET/System.Reactive.Linq/Reactive/Internal/TailRecursiveSink.cs
deleted file mode 100644
index 3b974e6..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Internal/TailRecursiveSink.cs
+++ /dev/null
@@ -1,187 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_PERF
-using System.Collections.Generic;
-using System.Reactive.Concurrency;
-using System.Reactive.Disposables;
-
-namespace System.Reactive
-{
- abstract class TailRecursiveSink<TSource> : Sink<TSource>, IObserver<TSource>
- {
- public TailRecursiveSink(IObserver<TSource> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- }
-
- private bool _isDisposed;
- private SerialDisposable _subscription;
- private AsyncLock _gate;
- private Stack<IEnumerator<IObservable<TSource>>> _stack;
- private Stack<int?> _length;
- protected Action _recurse;
-
- public IDisposable Run(IEnumerable<IObservable<TSource>> sources)
- {
- _isDisposed = false;
- _subscription = new SerialDisposable();
- _gate = new AsyncLock();
- _stack = new Stack<IEnumerator<IObservable<TSource>>>();
- _length = new Stack<int?>();
-
- var e = default(IEnumerator<IObservable<TSource>>);
- if (!TryGetEnumerator(sources, out e))
- return Disposable.Empty;
-
- _stack.Push(e);
- _length.Push(Helpers.GetLength(sources));
-
- var cancelable = SchedulerDefaults.TailRecursion.Schedule(self =>
- {
- _recurse = self;
- _gate.Wait(MoveNext);
- });
-
- return new CompositeDisposable(_subscription, cancelable, Disposable.Create(() => _gate.Wait(Dispose)));
- }
-
- protected abstract IEnumerable<IObservable<TSource>> Extract(IObservable<TSource> source);
-
- private void MoveNext()
- {
- var hasNext = false;
- var next = default(IObservable<TSource>);
-
- do
- {
- if (_stack.Count == 0)
- break;
-
- if (_isDisposed)
- return;
-
- var e = _stack.Peek();
- var l = _length.Peek();
-
- var current = default(IObservable<TSource>);
- try
- {
- hasNext = e.MoveNext();
- if (hasNext)
- current = e.Current;
- }
- catch (Exception ex)
- {
- e.Dispose();
-
- base._observer.OnError(ex);
- base.Dispose();
- return;
- }
-
- if (!hasNext)
- {
- e.Dispose();
-
- _stack.Pop();
- _length.Pop();
- }
- else
- {
- var r = l - 1;
- _length.Pop();
- _length.Push(r);
-
- try
- {
- next = Helpers.Unpack(current);
- }
- catch (Exception exception)
- {
- e.Dispose();
- base._observer.OnError(exception);
- base.Dispose();
- return;
- }
-
- //
- // Tail recursive case; drop the current frame.
- //
- if (r == 0)
- {
- e.Dispose();
- _stack.Pop();
- _length.Pop();
- }
-
- //
- // Flattening of nested sequences. Prevents stack overflow in observers.
- //
- var nextSeq = Extract(next);
- if (nextSeq != null)
- {
- var nextEnumerator = default(IEnumerator<IObservable<TSource>>);
- if (!TryGetEnumerator(nextSeq, out nextEnumerator))
- return;
-
- _stack.Push(nextEnumerator);
- _length.Push(Helpers.GetLength(nextSeq));
-
- hasNext = false;
- }
- }
- } while (!hasNext);
-
- if (!hasNext)
- {
- Done();
- return;
- }
-
- var d = new SingleAssignmentDisposable();
- _subscription.Disposable = d;
- d.Disposable = next.SubscribeSafe(this);
- }
-
- private new void Dispose()
- {
- while (_stack.Count > 0)
- {
- var e = _stack.Pop();
- _length.Pop();
-
- e.Dispose();
- }
-
- _isDisposed = true;
- }
-
- private bool TryGetEnumerator(IEnumerable<IObservable<TSource>> sources, out IEnumerator<IObservable<TSource>> result)
- {
- try
- {
- result = sources.GetEnumerator();
- return true;
- }
- catch (Exception exception)
- {
- base._observer.OnError(exception);
- base.Dispose();
-
- result = null;
- return false;
- }
- }
-
- public abstract void OnCompleted();
- public abstract void OnError(Exception error);
- public abstract void OnNext(TSource value);
-
- protected virtual void Done()
- {
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Joins/ActivePlan.cs b/Rx.NET/System.Reactive.Linq/Reactive/Joins/ActivePlan.cs
deleted file mode 100644
index fe6f410..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Joins/ActivePlan.cs
+++ /dev/null
@@ -1,1435 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System.Collections.Generic;
-
-namespace System.Reactive.Joins
-{
- internal abstract class ActivePlan
- {
- Dictionary<IJoinObserver, IJoinObserver> joinObservers = new Dictionary<IJoinObserver, IJoinObserver>();
-
- internal abstract void Match();
-
- protected void AddJoinObserver(IJoinObserver joinObserver)
- {
- joinObservers.Add(joinObserver, joinObserver);
- }
-
- protected void Dequeue()
- {
- foreach (var joinObserver in joinObservers.Values)
- joinObserver.Dequeue();
- }
- }
-
- internal class ActivePlan<T1> : ActivePlan
- {
- private readonly Action<T1> onNext;
- private readonly Action onCompleted;
- private readonly JoinObserver<T1> first;
-
- internal ActivePlan(JoinObserver<T1> first, Action<T1> onNext, Action onCompleted)
- {
- this.onNext = onNext;
- this.onCompleted = onCompleted;
- this.first = first;
- AddJoinObserver(first);
- }
-
- internal override void Match()
- {
- if (first.Queue.Count > 0)
- {
- var n1 = first.Queue.Peek();
-
- if (n1.Kind == NotificationKind.OnCompleted)
- onCompleted();
- else
- {
- Dequeue();
- onNext(n1.Value
- );
- }
- }
- }
- }
-
- internal class ActivePlan<T1, T2> : ActivePlan
- {
- private readonly Action<T1, T2> onNext;
- private readonly Action onCompleted;
- private readonly JoinObserver<T1> first;
- private readonly JoinObserver<T2> second;
-
- internal ActivePlan(JoinObserver<T1> first, JoinObserver<T2> second, Action<T1, T2> onNext, Action onCompleted)
- {
- this.onNext = onNext;
- this.onCompleted = onCompleted;
- this.first = first;
- this.second = second;
- AddJoinObserver(first);
- AddJoinObserver(second);
- }
-
- internal override void Match()
- {
- if (first.Queue.Count > 0
- && second.Queue.Count > 0)
- {
- var n1 = first.Queue.Peek();
- var n2 = second.Queue.Peek();
-
- if ( n1.Kind == NotificationKind.OnCompleted
- || n2.Kind == NotificationKind.OnCompleted)
- onCompleted();
- else
- {
- Dequeue();
- onNext(n1.Value,
- n2.Value
- );
- }
- }
- }
- }
-
- internal class ActivePlan<T1, T2, T3> : ActivePlan
- {
- private readonly Action<T1, T2, T3> onNext;
- private readonly Action onCompleted;
- private readonly JoinObserver<T1> first;
- private readonly JoinObserver<T2> second;
- private readonly JoinObserver<T3> third;
-
- internal ActivePlan(JoinObserver<T1> first, JoinObserver<T2> second, JoinObserver<T3> third, Action<T1, T2, T3> onNext, Action onCompleted)
- {
- this.onNext = onNext;
- this.onCompleted = onCompleted;
- this.first = first;
- this.second = second;
- this.third = third;
- AddJoinObserver(first);
- AddJoinObserver(second);
- AddJoinObserver(third);
- }
-
- internal override void Match()
- {
- if (first.Queue.Count > 0
- && second.Queue.Count > 0
- && third.Queue.Count > 0)
- {
- var n1 = first.Queue.Peek();
- var n2 = second.Queue.Peek();
- var n3 = third.Queue.Peek();
-
- if ( n1.Kind == NotificationKind.OnCompleted
- || n2.Kind == NotificationKind.OnCompleted
- || n3.Kind == NotificationKind.OnCompleted)
- onCompleted();
- else
- {
- Dequeue();
- onNext(n1.Value,
- n2.Value,
- n3.Value
- );
- }
- }
- }
- }
-
- internal class ActivePlan<T1, T2, T3, T4> : ActivePlan
- {
- private readonly Action<T1, T2, T3, T4> onNext;
- private readonly Action onCompleted;
- private readonly JoinObserver<T1> first;
- private readonly JoinObserver<T2> second;
- private readonly JoinObserver<T3> third;
- private readonly JoinObserver<T4> fourth;
-
- internal ActivePlan(JoinObserver<T1> first, JoinObserver<T2> second, JoinObserver<T3> third, JoinObserver<T4> fourth, Action<T1, T2, T3, T4> onNext, Action onCompleted)
- {
- this.onNext = onNext;
- this.onCompleted = onCompleted;
- this.first = first;
- this.second = second;
- this.third = third;
- this.fourth = fourth;
- AddJoinObserver(first);
- AddJoinObserver(second);
- AddJoinObserver(third);
- AddJoinObserver(fourth);
- }
-
- internal override void Match()
- {
- if (first.Queue.Count > 0
- && second.Queue.Count > 0
- && third.Queue.Count > 0
- && fourth.Queue.Count > 0)
- {
- var n1 = first.Queue.Peek();
- var n2 = second.Queue.Peek();
- var n3 = third.Queue.Peek();
- var n4 = fourth.Queue.Peek();
-
- if ( n1.Kind == NotificationKind.OnCompleted
- || n2.Kind == NotificationKind.OnCompleted
- || n3.Kind == NotificationKind.OnCompleted
- || n4.Kind == NotificationKind.OnCompleted)
- onCompleted();
- else
- {
- Dequeue();
- onNext(n1.Value,
- n2.Value,
- n3.Value,
- n4.Value
- );
- }
- }
- }
- }
-#if !NO_LARGEARITY
-
- internal class ActivePlan<T1, T2, T3, T4, T5> : ActivePlan
- {
- private readonly Action<T1, T2, T3, T4, T5> onNext;
- private readonly Action onCompleted;
- private readonly JoinObserver<T1> first;
- private readonly JoinObserver<T2> second;
- private readonly JoinObserver<T3> third;
- private readonly JoinObserver<T4> fourth;
- private readonly JoinObserver<T5> fifth;
-
- internal ActivePlan(JoinObserver<T1> first, JoinObserver<T2> second, JoinObserver<T3> third,
- JoinObserver<T4> fourth, JoinObserver<T5> fifth, Action<T1, T2, T3, T4, T5> onNext, Action onCompleted)
- {
- this.onNext = onNext;
- this.onCompleted = onCompleted;
- this.first = first;
- this.second = second;
- this.third = third;
- this.fourth = fourth;
- this.fifth = fifth;
- AddJoinObserver(first);
- AddJoinObserver(second);
- AddJoinObserver(third);
- AddJoinObserver(fourth);
- AddJoinObserver(fifth);
- }
-
- internal override void Match()
- {
- if (first.Queue.Count > 0
- && second.Queue.Count > 0
- && third.Queue.Count > 0
- && fourth.Queue.Count > 0
- && fifth.Queue.Count > 0)
- {
- var n1 = first.Queue.Peek();
- var n2 = second.Queue.Peek();
- var n3 = third.Queue.Peek();
- var n4 = fourth.Queue.Peek();
- var n5 = fifth.Queue.Peek();
-
- if ( n1.Kind == NotificationKind.OnCompleted
- || n2.Kind == NotificationKind.OnCompleted
- || n3.Kind == NotificationKind.OnCompleted
- || n4.Kind == NotificationKind.OnCompleted
- || n5.Kind == NotificationKind.OnCompleted)
- onCompleted();
- else
- {
- Dequeue();
- onNext(n1.Value,
- n2.Value,
- n3.Value,
- n4.Value,
- n5.Value
- );
- }
- }
- }
- }
-
- internal class ActivePlan<T1, T2, T3, T4, T5, T6> : ActivePlan
- {
- private readonly Action<T1, T2, T3, T4, T5, T6> onNext;
- private readonly Action onCompleted;
- private readonly JoinObserver<T1> first;
- private readonly JoinObserver<T2> second;
- private readonly JoinObserver<T3> third;
- private readonly JoinObserver<T4> fourth;
- private readonly JoinObserver<T5> fifth;
- private readonly JoinObserver<T6> sixth;
-
- internal ActivePlan(JoinObserver<T1> first, JoinObserver<T2> second, JoinObserver<T3> third,
- JoinObserver<T4> fourth, JoinObserver<T5> fifth, JoinObserver<T6> sixth,
- Action<T1, T2, T3, T4, T5, T6> onNext, Action onCompleted)
- {
- this.onNext = onNext;
- this.onCompleted = onCompleted;
- this.first = first;
- this.second = second;
- this.third = third;
- this.fourth = fourth;
- this.fifth = fifth;
- this.sixth = sixth;
- AddJoinObserver(first);
- AddJoinObserver(second);
- AddJoinObserver(third);
- AddJoinObserver(fourth);
- AddJoinObserver(fifth);
- AddJoinObserver(sixth);
- }
-
- internal override void Match()
- {
- if (first.Queue.Count > 0
- && second.Queue.Count > 0
- && third.Queue.Count > 0
- && fourth.Queue.Count > 0
- && fifth.Queue.Count > 0
- && sixth.Queue.Count > 0)
- {
- var n1 = first.Queue.Peek();
- var n2 = second.Queue.Peek();
- var n3 = third.Queue.Peek();
- var n4 = fourth.Queue.Peek();
- var n5 = fifth.Queue.Peek();
- var n6 = sixth.Queue.Peek();
-
- if ( n1.Kind == NotificationKind.OnCompleted
- || n2.Kind == NotificationKind.OnCompleted
- || n3.Kind == NotificationKind.OnCompleted
- || n4.Kind == NotificationKind.OnCompleted
- || n5.Kind == NotificationKind.OnCompleted
- || n6.Kind == NotificationKind.OnCompleted)
- onCompleted();
- else
- {
- Dequeue();
- onNext(n1.Value,
- n2.Value,
- n3.Value,
- n4.Value,
- n5.Value,
- n6.Value
- );
- }
- }
- }
- }
-
- internal class ActivePlan<T1, T2, T3, T4, T5, T6, T7> : ActivePlan
- {
- private readonly Action<T1, T2, T3, T4, T5, T6, T7> onNext;
- private readonly Action onCompleted;
- private readonly JoinObserver<T1> first;
- private readonly JoinObserver<T2> second;
- private readonly JoinObserver<T3> third;
- private readonly JoinObserver<T4> fourth;
- private readonly JoinObserver<T5> fifth;
- private readonly JoinObserver<T6> sixth;
- private readonly JoinObserver<T7> seventh;
-
- internal ActivePlan(JoinObserver<T1> first, JoinObserver<T2> second, JoinObserver<T3> third,
- JoinObserver<T4> fourth, JoinObserver<T5> fifth, JoinObserver<T6> sixth, JoinObserver<T7> seventh,
- Action<T1, T2, T3, T4, T5, T6, T7> onNext, Action onCompleted)
- {
- this.onNext = onNext;
- this.onCompleted = onCompleted;
- this.first = first;
- this.second = second;
- this.third = third;
- this.fourth = fourth;
- this.fifth = fifth;
- this.sixth = sixth;
- this.seventh = seventh;
- AddJoinObserver(first);
- AddJoinObserver(second);
- AddJoinObserver(third);
- AddJoinObserver(fourth);
- AddJoinObserver(fifth);
- AddJoinObserver(sixth);
- AddJoinObserver(seventh);
- }
-
- internal override void Match()
- {
- if (first.Queue.Count > 0
- && second.Queue.Count > 0
- && third.Queue.Count > 0
- && fourth.Queue.Count > 0
- && fifth.Queue.Count > 0
- && sixth.Queue.Count > 0
- && seventh.Queue.Count > 0)
- {
- var n1 = first.Queue.Peek();
- var n2 = second.Queue.Peek();
- var n3 = third.Queue.Peek();
- var n4 = fourth.Queue.Peek();
- var n5 = fifth.Queue.Peek();
- var n6 = sixth.Queue.Peek();
- var n7 = seventh.Queue.Peek();
-
- if ( n1.Kind == NotificationKind.OnCompleted
- || n2.Kind == NotificationKind.OnCompleted
- || n3.Kind == NotificationKind.OnCompleted
- || n4.Kind == NotificationKind.OnCompleted
- || n5.Kind == NotificationKind.OnCompleted
- || n6.Kind == NotificationKind.OnCompleted
- || n7.Kind == NotificationKind.OnCompleted)
- onCompleted();
- else
- {
- Dequeue();
- onNext(n1.Value,
- n2.Value,
- n3.Value,
- n4.Value,
- n5.Value,
- n6.Value,
- n7.Value
- );
- }
- }
- }
- }
-
- internal class ActivePlan<T1, T2, T3, T4, T5, T6, T7, T8> : ActivePlan
- {
- private readonly Action<T1, T2, T3, T4, T5, T6, T7, T8> onNext;
- private readonly Action onCompleted;
- private readonly JoinObserver<T1> first;
- private readonly JoinObserver<T2> second;
- private readonly JoinObserver<T3> third;
- private readonly JoinObserver<T4> fourth;
- private readonly JoinObserver<T5> fifth;
- private readonly JoinObserver<T6> sixth;
- private readonly JoinObserver<T7> seventh;
- private readonly JoinObserver<T8> eighth;
-
- internal ActivePlan(JoinObserver<T1> first, JoinObserver<T2> second, JoinObserver<T3> third,
- JoinObserver<T4> fourth, JoinObserver<T5> fifth, JoinObserver<T6> sixth, JoinObserver<T7> seventh,
- JoinObserver<T8> eighth,
- Action<T1, T2, T3, T4, T5, T6, T7, T8> onNext, Action onCompleted)
- {
- this.onNext = onNext;
- this.onCompleted = onCompleted;
- this.first = first;
- this.second = second;
- this.third = third;
- this.fourth = fourth;
- this.fifth = fifth;
- this.sixth = sixth;
- this.seventh = seventh;
- this.eighth = eighth;
- AddJoinObserver(first);
- AddJoinObserver(second);
- AddJoinObserver(third);
- AddJoinObserver(fourth);
- AddJoinObserver(fifth);
- AddJoinObserver(sixth);
- AddJoinObserver(seventh);
- AddJoinObserver(eighth);
- }
-
- internal override void Match()
- {
- if (first.Queue.Count > 0
- && second.Queue.Count > 0
- && third.Queue.Count > 0
- && fourth.Queue.Count > 0
- && fifth.Queue.Count > 0
- && sixth.Queue.Count > 0
- && seventh.Queue.Count > 0
- && eighth.Queue.Count > 0)
- {
- var n1 = first.Queue.Peek();
- var n2 = second.Queue.Peek();
- var n3 = third.Queue.Peek();
- var n4 = fourth.Queue.Peek();
- var n5 = fifth.Queue.Peek();
- var n6 = sixth.Queue.Peek();
- var n7 = seventh.Queue.Peek();
- var n8 = eighth.Queue.Peek();
-
- if ( n1.Kind == NotificationKind.OnCompleted
- || n2.Kind == NotificationKind.OnCompleted
- || n3.Kind == NotificationKind.OnCompleted
- || n4.Kind == NotificationKind.OnCompleted
- || n5.Kind == NotificationKind.OnCompleted
- || n6.Kind == NotificationKind.OnCompleted
- || n7.Kind == NotificationKind.OnCompleted
- || n8.Kind == NotificationKind.OnCompleted
- )
- onCompleted();
- else
- {
- Dequeue();
- onNext(n1.Value,
- n2.Value,
- n3.Value,
- n4.Value,
- n5.Value,
- n6.Value,
- n7.Value,
- n8.Value
- );
- }
- }
- }
- }
-
- internal class ActivePlan<T1, T2, T3, T4, T5, T6, T7, T8, T9> : ActivePlan
- {
- private readonly Action<T1, T2, T3, T4, T5, T6, T7, T8, T9> onNext;
- private readonly Action onCompleted;
- private readonly JoinObserver<T1> first;
- private readonly JoinObserver<T2> second;
- private readonly JoinObserver<T3> third;
- private readonly JoinObserver<T4> fourth;
- private readonly JoinObserver<T5> fifth;
- private readonly JoinObserver<T6> sixth;
- private readonly JoinObserver<T7> seventh;
- private readonly JoinObserver<T8> eighth;
- private readonly JoinObserver<T9> ninth;
-
- internal ActivePlan(JoinObserver<T1> first, JoinObserver<T2> second, JoinObserver<T3> third,
- JoinObserver<T4> fourth, JoinObserver<T5> fifth, JoinObserver<T6> sixth, JoinObserver<T7> seventh,
- JoinObserver<T8> eighth, JoinObserver<T9> ninth,
- Action<T1, T2, T3, T4, T5, T6, T7, T8, T9> onNext, Action onCompleted)
- {
- this.onNext = onNext;
- this.onCompleted = onCompleted;
- this.first = first;
- this.second = second;
- this.third = third;
- this.fourth = fourth;
- this.fifth = fifth;
- this.sixth = sixth;
- this.seventh = seventh;
- this.eighth = eighth;
- this.ninth = ninth;
- AddJoinObserver(first);
- AddJoinObserver(second);
- AddJoinObserver(third);
- AddJoinObserver(fourth);
- AddJoinObserver(fifth);
- AddJoinObserver(sixth);
- AddJoinObserver(seventh);
- AddJoinObserver(eighth);
- AddJoinObserver(ninth);
- }
-
- internal override void Match()
- {
- if (first.Queue.Count > 0
- && second.Queue.Count > 0
- && third.Queue.Count > 0
- && fourth.Queue.Count > 0
- && fifth.Queue.Count > 0
- && sixth.Queue.Count > 0
- && seventh.Queue.Count > 0
- && eighth.Queue.Count > 0
- && ninth.Queue.Count > 0
- )
- {
- var n1 = first.Queue.Peek();
- var n2 = second.Queue.Peek();
- var n3 = third.Queue.Peek();
- var n4 = fourth.Queue.Peek();
- var n5 = fifth.Queue.Peek();
- var n6 = sixth.Queue.Peek();
- var n7 = seventh.Queue.Peek();
- var n8 = eighth.Queue.Peek();
- var n9 = ninth.Queue.Peek();
-
- if ( n1.Kind == NotificationKind.OnCompleted
- || n2.Kind == NotificationKind.OnCompleted
- || n3.Kind == NotificationKind.OnCompleted
- || n4.Kind == NotificationKind.OnCompleted
- || n5.Kind == NotificationKind.OnCompleted
- || n6.Kind == NotificationKind.OnCompleted
- || n7.Kind == NotificationKind.OnCompleted
- || n8.Kind == NotificationKind.OnCompleted
- || n9.Kind == NotificationKind.OnCompleted
- )
- onCompleted();
- else
- {
- Dequeue();
- onNext(n1.Value,
- n2.Value,
- n3.Value,
- n4.Value,
- n5.Value,
- n6.Value,
- n7.Value,
- n8.Value,
- n9.Value
- );
- }
- }
- }
- }
-
- internal class ActivePlan<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> : ActivePlan
- {
- private readonly Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> onNext;
- private readonly Action onCompleted;
- private readonly JoinObserver<T1> first;
- private readonly JoinObserver<T2> second;
- private readonly JoinObserver<T3> third;
- private readonly JoinObserver<T4> fourth;
- private readonly JoinObserver<T5> fifth;
- private readonly JoinObserver<T6> sixth;
- private readonly JoinObserver<T7> seventh;
- private readonly JoinObserver<T8> eighth;
- private readonly JoinObserver<T9> ninth;
- private readonly JoinObserver<T10> tenth;
-
- internal ActivePlan(JoinObserver<T1> first, JoinObserver<T2> second, JoinObserver<T3> third,
- JoinObserver<T4> fourth, JoinObserver<T5> fifth, JoinObserver<T6> sixth, JoinObserver<T7> seventh,
- JoinObserver<T8> eighth, JoinObserver<T9> ninth, JoinObserver<T10> tenth,
- Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> onNext, Action onCompleted)
- {
- this.onNext = onNext;
- this.onCompleted = onCompleted;
- this.first = first;
- this.second = second;
- this.third = third;
- this.fourth = fourth;
- this.fifth = fifth;
- this.sixth = sixth;
- this.seventh = seventh;
- this.eighth = eighth;
- this.ninth = ninth;
- this.tenth = tenth;
- AddJoinObserver(first);
- AddJoinObserver(second);
- AddJoinObserver(third);
- AddJoinObserver(fourth);
- AddJoinObserver(fifth);
- AddJoinObserver(sixth);
- AddJoinObserver(seventh);
- AddJoinObserver(eighth);
- AddJoinObserver(ninth);
- AddJoinObserver(tenth);
- }
-
- internal override void Match()
- {
- if (first.Queue.Count > 0
- && second.Queue.Count > 0
- && third.Queue.Count > 0
- && fourth.Queue.Count > 0
- && fifth.Queue.Count > 0
- && sixth.Queue.Count > 0
- && seventh.Queue.Count > 0
- && eighth.Queue.Count > 0
- && ninth.Queue.Count > 0
- && tenth.Queue.Count > 0
- )
- {
- var n1 = first.Queue.Peek();
- var n2 = second.Queue.Peek();
- var n3 = third.Queue.Peek();
- var n4 = fourth.Queue.Peek();
- var n5 = fifth.Queue.Peek();
- var n6 = sixth.Queue.Peek();
- var n7 = seventh.Queue.Peek();
- var n8 = eighth.Queue.Peek();
- var n9 = ninth.Queue.Peek();
- var n10 = tenth.Queue.Peek();
-
- if ( n1.Kind == NotificationKind.OnCompleted
- || n2.Kind == NotificationKind.OnCompleted
- || n3.Kind == NotificationKind.OnCompleted
- || n4.Kind == NotificationKind.OnCompleted
- || n5.Kind == NotificationKind.OnCompleted
- || n6.Kind == NotificationKind.OnCompleted
- || n7.Kind == NotificationKind.OnCompleted
- || n8.Kind == NotificationKind.OnCompleted
- || n9.Kind == NotificationKind.OnCompleted
- || n10.Kind == NotificationKind.OnCompleted
- )
- onCompleted();
- else
- {
- Dequeue();
- onNext(n1.Value,
- n2.Value,
- n3.Value,
- n4.Value,
- n5.Value,
- n6.Value,
- n7.Value,
- n8.Value,
- n9.Value,
- n10.Value
- );
- }
- }
- }
- }
-
- internal class ActivePlan<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> : ActivePlan
- {
- private readonly Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> onNext;
- private readonly Action onCompleted;
- private readonly JoinObserver<T1> first;
- private readonly JoinObserver<T2> second;
- private readonly JoinObserver<T3> third;
- private readonly JoinObserver<T4> fourth;
- private readonly JoinObserver<T5> fifth;
- private readonly JoinObserver<T6> sixth;
- private readonly JoinObserver<T7> seventh;
- private readonly JoinObserver<T8> eighth;
- private readonly JoinObserver<T9> ninth;
- private readonly JoinObserver<T10> tenth;
- private readonly JoinObserver<T11> eleventh;
-
- internal ActivePlan(JoinObserver<T1> first, JoinObserver<T2> second, JoinObserver<T3> third,
- JoinObserver<T4> fourth, JoinObserver<T5> fifth, JoinObserver<T6> sixth, JoinObserver<T7> seventh,
- JoinObserver<T8> eighth, JoinObserver<T9> ninth, JoinObserver<T10> tenth, JoinObserver<T11> eleventh,
- Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> onNext, Action onCompleted)
- {
- this.onNext = onNext;
- this.onCompleted = onCompleted;
- this.first = first;
- this.second = second;
- this.third = third;
- this.fourth = fourth;
- this.fifth = fifth;
- this.sixth = sixth;
- this.seventh = seventh;
- this.eighth = eighth;
- this.ninth = ninth;
- this.tenth = tenth;
- this.eleventh = eleventh;
- AddJoinObserver(first);
- AddJoinObserver(second);
- AddJoinObserver(third);
- AddJoinObserver(fourth);
- AddJoinObserver(fifth);
- AddJoinObserver(sixth);
- AddJoinObserver(seventh);
- AddJoinObserver(eighth);
- AddJoinObserver(ninth);
- AddJoinObserver(tenth);
- AddJoinObserver(eleventh);
- }
-
- internal override void Match()
- {
- if (first.Queue.Count > 0
- && second.Queue.Count > 0
- && third.Queue.Count > 0
- && fourth.Queue.Count > 0
- && fifth.Queue.Count > 0
- && sixth.Queue.Count > 0
- && seventh.Queue.Count > 0
- && eighth.Queue.Count > 0
- && ninth.Queue.Count > 0
- && tenth.Queue.Count > 0
- && eleventh.Queue.Count > 0
- )
- {
- var n1 = first.Queue.Peek();
- var n2 = second.Queue.Peek();
- var n3 = third.Queue.Peek();
- var n4 = fourth.Queue.Peek();
- var n5 = fifth.Queue.Peek();
- var n6 = sixth.Queue.Peek();
- var n7 = seventh.Queue.Peek();
- var n8 = eighth.Queue.Peek();
- var n9 = ninth.Queue.Peek();
- var n10 = tenth.Queue.Peek();
- var n11 = eleventh.Queue.Peek();
-
- if ( n1.Kind == NotificationKind.OnCompleted
- || n2.Kind == NotificationKind.OnCompleted
- || n3.Kind == NotificationKind.OnCompleted
- || n4.Kind == NotificationKind.OnCompleted
- || n5.Kind == NotificationKind.OnCompleted
- || n6.Kind == NotificationKind.OnCompleted
- || n7.Kind == NotificationKind.OnCompleted
- || n8.Kind == NotificationKind.OnCompleted
- || n9.Kind == NotificationKind.OnCompleted
- || n10.Kind == NotificationKind.OnCompleted
- || n11.Kind == NotificationKind.OnCompleted
- )
- onCompleted();
- else
- {
- Dequeue();
- onNext(n1.Value,
- n2.Value,
- n3.Value,
- n4.Value,
- n5.Value,
- n6.Value,
- n7.Value,
- n8.Value,
- n9.Value,
- n10.Value,
- n11.Value
- );
- }
- }
- }
- }
-
- internal class ActivePlan<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> : ActivePlan
- {
- private readonly Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> onNext;
- private readonly Action onCompleted;
- private readonly JoinObserver<T1> first;
- private readonly JoinObserver<T2> second;
- private readonly JoinObserver<T3> third;
- private readonly JoinObserver<T4> fourth;
- private readonly JoinObserver<T5> fifth;
- private readonly JoinObserver<T6> sixth;
- private readonly JoinObserver<T7> seventh;
- private readonly JoinObserver<T8> eighth;
- private readonly JoinObserver<T9> ninth;
- private readonly JoinObserver<T10> tenth;
- private readonly JoinObserver<T11> eleventh;
- private readonly JoinObserver<T12> twelfth;
-
- internal ActivePlan(JoinObserver<T1> first, JoinObserver<T2> second, JoinObserver<T3> third,
- JoinObserver<T4> fourth, JoinObserver<T5> fifth, JoinObserver<T6> sixth, JoinObserver<T7> seventh,
- JoinObserver<T8> eighth, JoinObserver<T9> ninth, JoinObserver<T10> tenth, JoinObserver<T11> eleventh,
- JoinObserver<T12> twelfth,
- Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> onNext, Action onCompleted)
- {
- this.onNext = onNext;
- this.onCompleted = onCompleted;
- this.first = first;
- this.second = second;
- this.third = third;
- this.fourth = fourth;
- this.fifth = fifth;
- this.sixth = sixth;
- this.seventh = seventh;
- this.eighth = eighth;
- this.ninth = ninth;
- this.tenth = tenth;
- this.eleventh = eleventh;
- this.twelfth = twelfth;
- AddJoinObserver(first);
- AddJoinObserver(second);
- AddJoinObserver(third);
- AddJoinObserver(fourth);
- AddJoinObserver(fifth);
- AddJoinObserver(sixth);
- AddJoinObserver(seventh);
- AddJoinObserver(eighth);
- AddJoinObserver(ninth);
- AddJoinObserver(tenth);
- AddJoinObserver(eleventh);
- AddJoinObserver(twelfth);
- }
-
- internal override void Match()
- {
- if (first.Queue.Count > 0
- && second.Queue.Count > 0
- && third.Queue.Count > 0
- && fourth.Queue.Count > 0
- && fifth.Queue.Count > 0
- && sixth.Queue.Count > 0
- && seventh.Queue.Count > 0
- && eighth.Queue.Count > 0
- && ninth.Queue.Count > 0
- && tenth.Queue.Count > 0
- && eleventh.Queue.Count > 0
- && twelfth.Queue.Count > 0
- )
- {
- var n1 = first.Queue.Peek();
- var n2 = second.Queue.Peek();
- var n3 = third.Queue.Peek();
- var n4 = fourth.Queue.Peek();
- var n5 = fifth.Queue.Peek();
- var n6 = sixth.Queue.Peek();
- var n7 = seventh.Queue.Peek();
- var n8 = eighth.Queue.Peek();
- var n9 = ninth.Queue.Peek();
- var n10 = tenth.Queue.Peek();
- var n11 = eleventh.Queue.Peek();
- var n12 = twelfth.Queue.Peek();
-
- if ( n1.Kind == NotificationKind.OnCompleted
- || n2.Kind == NotificationKind.OnCompleted
- || n3.Kind == NotificationKind.OnCompleted
- || n4.Kind == NotificationKind.OnCompleted
- || n5.Kind == NotificationKind.OnCompleted
- || n6.Kind == NotificationKind.OnCompleted
- || n7.Kind == NotificationKind.OnCompleted
- || n8.Kind == NotificationKind.OnCompleted
- || n9.Kind == NotificationKind.OnCompleted
- || n10.Kind == NotificationKind.OnCompleted
- || n11.Kind == NotificationKind.OnCompleted
- || n12.Kind == NotificationKind.OnCompleted
- )
- onCompleted();
- else
- {
- Dequeue();
- onNext(n1.Value,
- n2.Value,
- n3.Value,
- n4.Value,
- n5.Value,
- n6.Value,
- n7.Value,
- n8.Value,
- n9.Value,
- n10.Value,
- n11.Value,
- n12.Value
- );
- }
- }
- }
- }
-
- internal class ActivePlan<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> : ActivePlan
- {
- private readonly Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> onNext;
- private readonly Action onCompleted;
- private readonly JoinObserver<T1> first;
- private readonly JoinObserver<T2> second;
- private readonly JoinObserver<T3> third;
- private readonly JoinObserver<T4> fourth;
- private readonly JoinObserver<T5> fifth;
- private readonly JoinObserver<T6> sixth;
- private readonly JoinObserver<T7> seventh;
- private readonly JoinObserver<T8> eighth;
- private readonly JoinObserver<T9> ninth;
- private readonly JoinObserver<T10> tenth;
- private readonly JoinObserver<T11> eleventh;
- private readonly JoinObserver<T12> twelfth;
- private readonly JoinObserver<T13> thirteenth;
-
- internal ActivePlan(JoinObserver<T1> first, JoinObserver<T2> second, JoinObserver<T3> third,
- JoinObserver<T4> fourth, JoinObserver<T5> fifth, JoinObserver<T6> sixth, JoinObserver<T7> seventh,
- JoinObserver<T8> eighth, JoinObserver<T9> ninth, JoinObserver<T10> tenth, JoinObserver<T11> eleventh,
- JoinObserver<T12> twelfth, JoinObserver<T13> thirteenth,
- Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> onNext, Action onCompleted)
- {
- this.onNext = onNext;
- this.onCompleted = onCompleted;
- this.first = first;
- this.second = second;
- this.third = third;
- this.fourth = fourth;
- this.fifth = fifth;
- this.sixth = sixth;
- this.seventh = seventh;
- this.eighth = eighth;
- this.ninth = ninth;
- this.tenth = tenth;
- this.eleventh = eleventh;
- this.twelfth = twelfth;
- this.thirteenth = thirteenth;
- AddJoinObserver(first);
- AddJoinObserver(second);
- AddJoinObserver(third);
- AddJoinObserver(fourth);
- AddJoinObserver(fifth);
- AddJoinObserver(sixth);
- AddJoinObserver(seventh);
- AddJoinObserver(eighth);
- AddJoinObserver(ninth);
- AddJoinObserver(tenth);
- AddJoinObserver(eleventh);
- AddJoinObserver(twelfth);
- AddJoinObserver(thirteenth);
- }
-
- internal override void Match()
- {
- if (first.Queue.Count > 0
- && second.Queue.Count > 0
- && third.Queue.Count > 0
- && fourth.Queue.Count > 0
- && fifth.Queue.Count > 0
- && sixth.Queue.Count > 0
- && seventh.Queue.Count > 0
- && eighth.Queue.Count > 0
- && ninth.Queue.Count > 0
- && tenth.Queue.Count > 0
- && eleventh.Queue.Count > 0
- && twelfth.Queue.Count > 0
- && thirteenth.Queue.Count > 0
- )
- {
- var n1 = first.Queue.Peek();
- var n2 = second.Queue.Peek();
- var n3 = third.Queue.Peek();
- var n4 = fourth.Queue.Peek();
- var n5 = fifth.Queue.Peek();
- var n6 = sixth.Queue.Peek();
- var n7 = seventh.Queue.Peek();
- var n8 = eighth.Queue.Peek();
- var n9 = ninth.Queue.Peek();
- var n10 = tenth.Queue.Peek();
- var n11 = eleventh.Queue.Peek();
- var n12 = twelfth.Queue.Peek();
- var n13 = thirteenth.Queue.Peek();
-
- if ( n1.Kind == NotificationKind.OnCompleted
- || n2.Kind == NotificationKind.OnCompleted
- || n3.Kind == NotificationKind.OnCompleted
- || n4.Kind == NotificationKind.OnCompleted
- || n5.Kind == NotificationKind.OnCompleted
- || n6.Kind == NotificationKind.OnCompleted
- || n7.Kind == NotificationKind.OnCompleted
- || n8.Kind == NotificationKind.OnCompleted
- || n9.Kind == NotificationKind.OnCompleted
- || n10.Kind == NotificationKind.OnCompleted
- || n11.Kind == NotificationKind.OnCompleted
- || n12.Kind == NotificationKind.OnCompleted
- || n13.Kind == NotificationKind.OnCompleted
- )
- onCompleted();
- else
- {
- Dequeue();
- onNext(n1.Value,
- n2.Value,
- n3.Value,
- n4.Value,
- n5.Value,
- n6.Value,
- n7.Value,
- n8.Value,
- n9.Value,
- n10.Value,
- n11.Value,
- n12.Value,
- n13.Value
- );
- }
- }
- }
- }
-
- internal class ActivePlan<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> : ActivePlan
- {
- private readonly Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> onNext;
- private readonly Action onCompleted;
- private readonly JoinObserver<T1> first;
- private readonly JoinObserver<T2> second;
- private readonly JoinObserver<T3> third;
- private readonly JoinObserver<T4> fourth;
- private readonly JoinObserver<T5> fifth;
- private readonly JoinObserver<T6> sixth;
- private readonly JoinObserver<T7> seventh;
- private readonly JoinObserver<T8> eighth;
- private readonly JoinObserver<T9> ninth;
- private readonly JoinObserver<T10> tenth;
- private readonly JoinObserver<T11> eleventh;
- private readonly JoinObserver<T12> twelfth;
- private readonly JoinObserver<T13> thirteenth;
- private readonly JoinObserver<T14> fourteenth;
-
- internal ActivePlan(JoinObserver<T1> first, JoinObserver<T2> second, JoinObserver<T3> third,
- JoinObserver<T4> fourth, JoinObserver<T5> fifth, JoinObserver<T6> sixth, JoinObserver<T7> seventh,
- JoinObserver<T8> eighth, JoinObserver<T9> ninth, JoinObserver<T10> tenth, JoinObserver<T11> eleventh,
- JoinObserver<T12> twelfth, JoinObserver<T13> thirteenth, JoinObserver<T14> fourteenth,
- Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> onNext, Action onCompleted)
- {
- this.onNext = onNext;
- this.onCompleted = onCompleted;
- this.first = first;
- this.second = second;
- this.third = third;
- this.fourth = fourth;
- this.fifth = fifth;
- this.sixth = sixth;
- this.seventh = seventh;
- this.eighth = eighth;
- this.ninth = ninth;
- this.tenth = tenth;
- this.eleventh = eleventh;
- this.twelfth = twelfth;
- this.thirteenth = thirteenth;
- this.fourteenth = fourteenth;
- AddJoinObserver(first);
- AddJoinObserver(second);
- AddJoinObserver(third);
- AddJoinObserver(fourth);
- AddJoinObserver(fifth);
- AddJoinObserver(sixth);
- AddJoinObserver(seventh);
- AddJoinObserver(eighth);
- AddJoinObserver(ninth);
- AddJoinObserver(tenth);
- AddJoinObserver(eleventh);
- AddJoinObserver(twelfth);
- AddJoinObserver(thirteenth);
- AddJoinObserver(fourteenth);
- }
-
- internal override void Match()
- {
- if (first.Queue.Count > 0
- && second.Queue.Count > 0
- && third.Queue.Count > 0
- && fourth.Queue.Count > 0
- && fifth.Queue.Count > 0
- && sixth.Queue.Count > 0
- && seventh.Queue.Count > 0
- && eighth.Queue.Count > 0
- && ninth.Queue.Count > 0
- && tenth.Queue.Count > 0
- && eleventh.Queue.Count > 0
- && twelfth.Queue.Count > 0
- && thirteenth.Queue.Count > 0
- && fourteenth.Queue.Count > 0
- )
- {
- var n1 = first.Queue.Peek();
- var n2 = second.Queue.Peek();
- var n3 = third.Queue.Peek();
- var n4 = fourth.Queue.Peek();
- var n5 = fifth.Queue.Peek();
- var n6 = sixth.Queue.Peek();
- var n7 = seventh.Queue.Peek();
- var n8 = eighth.Queue.Peek();
- var n9 = ninth.Queue.Peek();
- var n10 = tenth.Queue.Peek();
- var n11 = eleventh.Queue.Peek();
- var n12 = twelfth.Queue.Peek();
- var n13 = thirteenth.Queue.Peek();
- var n14 = fourteenth.Queue.Peek();
-
- if ( n1.Kind == NotificationKind.OnCompleted
- || n2.Kind == NotificationKind.OnCompleted
- || n3.Kind == NotificationKind.OnCompleted
- || n4.Kind == NotificationKind.OnCompleted
- || n5.Kind == NotificationKind.OnCompleted
- || n6.Kind == NotificationKind.OnCompleted
- || n7.Kind == NotificationKind.OnCompleted
- || n8.Kind == NotificationKind.OnCompleted
- || n9.Kind == NotificationKind.OnCompleted
- || n10.Kind == NotificationKind.OnCompleted
- || n11.Kind == NotificationKind.OnCompleted
- || n12.Kind == NotificationKind.OnCompleted
- || n13.Kind == NotificationKind.OnCompleted
- || n14.Kind == NotificationKind.OnCompleted
- )
- onCompleted();
- else
- {
- Dequeue();
- onNext(n1.Value,
- n2.Value,
- n3.Value,
- n4.Value,
- n5.Value,
- n6.Value,
- n7.Value,
- n8.Value,
- n9.Value,
- n10.Value,
- n11.Value,
- n12.Value,
- n13.Value,
- n14.Value
- );
- }
- }
- }
- }
-
- internal class ActivePlan<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> : ActivePlan
- {
- private readonly Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> onNext;
- private readonly Action onCompleted;
- private readonly JoinObserver<T1> first;
- private readonly JoinObserver<T2> second;
- private readonly JoinObserver<T3> third;
- private readonly JoinObserver<T4> fourth;
- private readonly JoinObserver<T5> fifth;
- private readonly JoinObserver<T6> sixth;
- private readonly JoinObserver<T7> seventh;
- private readonly JoinObserver<T8> eighth;
- private readonly JoinObserver<T9> ninth;
- private readonly JoinObserver<T10> tenth;
- private readonly JoinObserver<T11> eleventh;
- private readonly JoinObserver<T12> twelfth;
- private readonly JoinObserver<T13> thirteenth;
- private readonly JoinObserver<T14> fourteenth;
- private readonly JoinObserver<T15> fifteenth;
-
- internal ActivePlan(JoinObserver<T1> first, JoinObserver<T2> second, JoinObserver<T3> third,
- JoinObserver<T4> fourth, JoinObserver<T5> fifth, JoinObserver<T6> sixth, JoinObserver<T7> seventh,
- JoinObserver<T8> eighth, JoinObserver<T9> ninth, JoinObserver<T10> tenth, JoinObserver<T11> eleventh,
- JoinObserver<T12> twelfth, JoinObserver<T13> thirteenth, JoinObserver<T14> fourteenth,
- JoinObserver<T15> fifteenth,
- Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> onNext, Action onCompleted)
- {
- this.onNext = onNext;
- this.onCompleted = onCompleted;
- this.first = first;
- this.second = second;
- this.third = third;
- this.fourth = fourth;
- this.fifth = fifth;
- this.sixth = sixth;
- this.seventh = seventh;
- this.eighth = eighth;
- this.ninth = ninth;
- this.tenth = tenth;
- this.eleventh = eleventh;
- this.twelfth = twelfth;
- this.thirteenth = thirteenth;
- this.fourteenth = fourteenth;
- this.fifteenth = fifteenth;
- AddJoinObserver(first);
- AddJoinObserver(second);
- AddJoinObserver(third);
- AddJoinObserver(fourth);
- AddJoinObserver(fifth);
- AddJoinObserver(sixth);
- AddJoinObserver(seventh);
- AddJoinObserver(eighth);
- AddJoinObserver(ninth);
- AddJoinObserver(tenth);
- AddJoinObserver(eleventh);
- AddJoinObserver(twelfth);
- AddJoinObserver(thirteenth);
- AddJoinObserver(fourteenth);
- AddJoinObserver(fifteenth);
- }
-
- internal override void Match()
- {
- if (first.Queue.Count > 0
- && second.Queue.Count > 0
- && third.Queue.Count > 0
- && fourth.Queue.Count > 0
- && fifth.Queue.Count > 0
- && sixth.Queue.Count > 0
- && seventh.Queue.Count > 0
- && eighth.Queue.Count > 0
- && ninth.Queue.Count > 0
- && tenth.Queue.Count > 0
- && eleventh.Queue.Count > 0
- && twelfth.Queue.Count > 0
- && thirteenth.Queue.Count > 0
- && fourteenth.Queue.Count > 0
- && fifteenth.Queue.Count > 0
- )
- {
- var n1 = first.Queue.Peek();
- var n2 = second.Queue.Peek();
- var n3 = third.Queue.Peek();
- var n4 = fourth.Queue.Peek();
- var n5 = fifth.Queue.Peek();
- var n6 = sixth.Queue.Peek();
- var n7 = seventh.Queue.Peek();
- var n8 = eighth.Queue.Peek();
- var n9 = ninth.Queue.Peek();
- var n10 = tenth.Queue.Peek();
- var n11 = eleventh.Queue.Peek();
- var n12 = twelfth.Queue.Peek();
- var n13 = thirteenth.Queue.Peek();
- var n14 = fourteenth.Queue.Peek();
- var n15 = fifteenth.Queue.Peek();
-
- if ( n1.Kind == NotificationKind.OnCompleted
- || n2.Kind == NotificationKind.OnCompleted
- || n3.Kind == NotificationKind.OnCompleted
- || n4.Kind == NotificationKind.OnCompleted
- || n5.Kind == NotificationKind.OnCompleted
- || n6.Kind == NotificationKind.OnCompleted
- || n7.Kind == NotificationKind.OnCompleted
- || n8.Kind == NotificationKind.OnCompleted
- || n9.Kind == NotificationKind.OnCompleted
- || n10.Kind == NotificationKind.OnCompleted
- || n11.Kind == NotificationKind.OnCompleted
- || n12.Kind == NotificationKind.OnCompleted
- || n13.Kind == NotificationKind.OnCompleted
- || n14.Kind == NotificationKind.OnCompleted
- || n15.Kind == NotificationKind.OnCompleted
- )
- onCompleted();
- else
- {
- Dequeue();
- onNext(n1.Value,
- n2.Value,
- n3.Value,
- n4.Value,
- n5.Value,
- n6.Value,
- n7.Value,
- n8.Value,
- n9.Value,
- n10.Value,
- n11.Value,
- n12.Value,
- n13.Value,
- n14.Value,
- n15.Value
- );
- }
- }
- }
- }
-
-
- internal class ActivePlan<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16> : ActivePlan
- {
- private readonly Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16> onNext;
- private readonly Action onCompleted;
- private readonly JoinObserver<T1> first;
- private readonly JoinObserver<T2> second;
- private readonly JoinObserver<T3> third;
- private readonly JoinObserver<T4> fourth;
- private readonly JoinObserver<T5> fifth;
- private readonly JoinObserver<T6> sixth;
- private readonly JoinObserver<T7> seventh;
- private readonly JoinObserver<T8> eighth;
- private readonly JoinObserver<T9> ninth;
- private readonly JoinObserver<T10> tenth;
- private readonly JoinObserver<T11> eleventh;
- private readonly JoinObserver<T12> twelfth;
- private readonly JoinObserver<T13> thirteenth;
- private readonly JoinObserver<T14> fourteenth;
- private readonly JoinObserver<T15> fifteenth;
- private readonly JoinObserver<T16> sixteenth;
-
- internal ActivePlan(JoinObserver<T1> first, JoinObserver<T2> second, JoinObserver<T3> third,
- JoinObserver<T4> fourth, JoinObserver<T5> fifth, JoinObserver<T6> sixth, JoinObserver<T7> seventh,
- JoinObserver<T8> eighth, JoinObserver<T9> ninth, JoinObserver<T10> tenth, JoinObserver<T11> eleventh,
- JoinObserver<T12> twelfth, JoinObserver<T13> thirteenth, JoinObserver<T14> fourteenth,
- JoinObserver<T15> fifteenth, JoinObserver<T16> sixteenth,
- Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16> onNext, Action onCompleted)
- {
- this.onNext = onNext;
- this.onCompleted = onCompleted;
- this.first = first;
- this.second = second;
- this.third = third;
- this.fourth = fourth;
- this.fifth = fifth;
- this.sixth = sixth;
- this.seventh = seventh;
- this.eighth = eighth;
- this.ninth = ninth;
- this.tenth = tenth;
- this.eleventh = eleventh;
- this.twelfth = twelfth;
- this.thirteenth = thirteenth;
- this.fourteenth = fourteenth;
- this.fifteenth = fifteenth;
- this.sixteenth = sixteenth;
- AddJoinObserver(first);
- AddJoinObserver(second);
- AddJoinObserver(third);
- AddJoinObserver(fourth);
- AddJoinObserver(fifth);
- AddJoinObserver(sixth);
- AddJoinObserver(seventh);
- AddJoinObserver(eighth);
- AddJoinObserver(ninth);
- AddJoinObserver(tenth);
- AddJoinObserver(eleventh);
- AddJoinObserver(twelfth);
- AddJoinObserver(thirteenth);
- AddJoinObserver(fourteenth);
- AddJoinObserver(fifteenth);
- AddJoinObserver(sixteenth);
- }
-
- internal override void Match()
- {
- if (first.Queue.Count > 0
- && second.Queue.Count > 0
- && third.Queue.Count > 0
- && fourth.Queue.Count > 0
- && fifth.Queue.Count > 0
- && sixth.Queue.Count > 0
- && seventh.Queue.Count > 0
- && eighth.Queue.Count > 0
- && ninth.Queue.Count > 0
- && tenth.Queue.Count > 0
- && eleventh.Queue.Count > 0
- && twelfth.Queue.Count > 0
- && thirteenth.Queue.Count > 0
- && fourteenth.Queue.Count > 0
- && fifteenth.Queue.Count > 0
- && sixteenth.Queue.Count > 0
- )
- {
- var n1 = first.Queue.Peek();
- var n2 = second.Queue.Peek();
- var n3 = third.Queue.Peek();
- var n4 = fourth.Queue.Peek();
- var n5 = fifth.Queue.Peek();
- var n6 = sixth.Queue.Peek();
- var n7 = seventh.Queue.Peek();
- var n8 = eighth.Queue.Peek();
- var n9 = ninth.Queue.Peek();
- var n10 = tenth.Queue.Peek();
- var n11 = eleventh.Queue.Peek();
- var n12 = twelfth.Queue.Peek();
- var n13 = thirteenth.Queue.Peek();
- var n14 = fourteenth.Queue.Peek();
- var n15 = fifteenth.Queue.Peek();
- var n16 = sixteenth.Queue.Peek();
-
- if ( n1.Kind == NotificationKind.OnCompleted
- || n2.Kind == NotificationKind.OnCompleted
- || n3.Kind == NotificationKind.OnCompleted
- || n4.Kind == NotificationKind.OnCompleted
- || n5.Kind == NotificationKind.OnCompleted
- || n6.Kind == NotificationKind.OnCompleted
- || n7.Kind == NotificationKind.OnCompleted
- || n8.Kind == NotificationKind.OnCompleted
- || n9.Kind == NotificationKind.OnCompleted
- || n10.Kind == NotificationKind.OnCompleted
- || n11.Kind == NotificationKind.OnCompleted
- || n12.Kind == NotificationKind.OnCompleted
- || n13.Kind == NotificationKind.OnCompleted
- || n14.Kind == NotificationKind.OnCompleted
- || n15.Kind == NotificationKind.OnCompleted
- || n16.Kind == NotificationKind.OnCompleted
- )
- onCompleted();
- else
- {
- Dequeue();
- onNext(n1.Value,
- n2.Value,
- n3.Value,
- n4.Value,
- n5.Value,
- n6.Value,
- n7.Value,
- n8.Value,
- n9.Value,
- n10.Value,
- n11.Value,
- n12.Value,
- n13.Value,
- n14.Value,
- n15.Value,
- n16.Value
- );
- }
- }
- }
- }
-#endif
-} \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Joins/JoinObserver.cs b/Rx.NET/System.Reactive.Linq/Reactive/Joins/JoinObserver.cs
deleted file mode 100644
index 8c88968..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Joins/JoinObserver.cs
+++ /dev/null
@@ -1,97 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System.Collections.Generic;
-using System.Reactive.Disposables;
-using System.Reactive.Linq;
-
-namespace System.Reactive.Joins
-{
- internal interface IJoinObserver : IDisposable
- {
- void Subscribe(object gate);
- void Dequeue();
- }
-
- internal sealed class JoinObserver<T> : ObserverBase<Notification<T>>, IJoinObserver
- {
- private object gate;
- private readonly IObservable<T> source;
- private readonly Action<Exception> onError;
- private List<ActivePlan> activePlans;
- public Queue<Notification<T>> Queue { get; private set; }
- private readonly SingleAssignmentDisposable subscription;
- private bool isDisposed;
-
- public JoinObserver(IObservable<T> source, Action<Exception> onError)
- {
- this.source = source;
- this.onError = onError;
- Queue = new Queue<Notification<T>>();
- subscription = new SingleAssignmentDisposable();
- activePlans = new List<ActivePlan>();
- }
-
- public void AddActivePlan(ActivePlan activePlan)
- {
- activePlans.Add(activePlan);
- }
-
- public void Subscribe(object gate)
- {
- this.gate = gate;
- subscription.Disposable = source.Materialize().SubscribeSafe(this);
- }
-
- public void Dequeue()
- {
- Queue.Dequeue();
- }
-
- protected override void OnNextCore(Notification<T> notification)
- {
- lock (gate)
- {
- if (!isDisposed)
- {
- if (notification.Kind == NotificationKind.OnError)
- {
- onError(notification.Exception);
- return;
- }
-
- Queue.Enqueue(notification);
- foreach (var activePlan in activePlans.ToArray())
- activePlan.Match();
- }
- }
- }
-
- protected override void OnErrorCore(Exception exception)
- {
- }
-
- protected override void OnCompletedCore()
- {
- }
-
- internal void RemoveActivePlan(ActivePlan activePlan)
- {
- activePlans.Remove(activePlan);
- if (activePlans.Count == 0)
- Dispose();
- }
-
- protected override void Dispose(bool disposing)
- {
- base.Dispose(disposing);
-
- if (!isDisposed)
- {
- if (disposing)
- subscription.Dispose();
-
- isDisposed = true;
- }
- }
- }
-} \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Joins/Pattern.cs b/Rx.NET/System.Reactive.Linq/Reactive/Joins/Pattern.cs
deleted file mode 100644
index 8d3a22c..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Joins/Pattern.cs
+++ /dev/null
@@ -1,1075 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-namespace System.Reactive.Joins
-{
- /// <summary>
- /// Abstract base class for join patterns.
- /// </summary>
- public abstract class Pattern
- {
- internal Pattern()
- {
- }
- }
-
- /* The following code is generated by a tool checked in to $/.../Source/Tools/CodeGenerators. */
-
- #region Joins auto-generated code (8/4/2012 1:00:26 AM)
-
- /// <summary>
- /// Represents a join pattern over one observable sequence.
- /// </summary>
- /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
- public class Pattern<TSource1> : Pattern
- {
- internal Pattern(IObservable<TSource1> first)
- {
- First = first;
- }
-
- internal IObservable<TSource1> First { get; private set; }
-
- /// <summary>
- /// Matches when all observable sequences have an available element and projects the elements by invoking the selector function.
- /// </summary>
- /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
- /// <param name="selector">Selector that will be invoked for elements in the source sequences.</param>
- /// <returns>Plan that produces the projected results, to be fed (with other plans) to the When operator.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="selector"/> is null.</exception>
- public Plan<TResult> Then<TResult>(Func<TSource1, TResult> selector)
- {
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return new Plan<TSource1, TResult>(this, selector);
- }
-
- }
-
- /// <summary>
- /// Represents a join pattern over two observable sequences.
- /// </summary>
- /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
- /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
- public class Pattern<TSource1, TSource2> : Pattern
- {
- internal Pattern(IObservable<TSource1> first, IObservable<TSource2> second)
- {
- First = first;
- Second = second;
- }
-
- internal IObservable<TSource1> First { get; private set; }
- internal IObservable<TSource2> Second { get; private set; }
-
- /// <summary>
- /// Creates a pattern that matches when all three observable sequences have an available element.
- /// </summary>
- /// <typeparam name="TSource3">The type of the elements in the third observable sequence.</typeparam>
- /// <param name="other">Observable sequence to match with the two previous sequences.</param>
- /// <returns>Pattern object that matches when all observable sequences have an available element.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="other"/> is null.</exception>
- public Pattern<TSource1, TSource2, TSource3> And<TSource3>(IObservable<TSource3> other)
- {
- if (other == null)
- throw new ArgumentNullException("other");
-
- return new Pattern<TSource1, TSource2, TSource3>(First, Second, other);
- }
-
- /// <summary>
- /// Matches when all observable sequences have an available element and projects the elements by invoking the selector function.
- /// </summary>
- /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
- /// <param name="selector">Selector that will be invoked for elements in the source sequences.</param>
- /// <returns>Plan that produces the projected results, to be fed (with other plans) to the When operator.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="selector"/> is null.</exception>
- public Plan<TResult> Then<TResult>(Func<TSource1, TSource2, TResult> selector)
- {
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return new Plan<TSource1, TSource2, TResult>(this, selector);
- }
-
- }
-
- /// <summary>
- /// Represents a join pattern over three observable sequences.
- /// </summary>
- /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
- /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
- /// <typeparam name="TSource3">The type of the elements in the third source sequence.</typeparam>
- public class Pattern<TSource1, TSource2, TSource3> : Pattern
- {
- internal Pattern(IObservable<TSource1> first, IObservable<TSource2> second, IObservable<TSource3> third)
- {
- First = first;
- Second = second;
- Third = third;
- }
-
- internal IObservable<TSource1> First { get; private set; }
- internal IObservable<TSource2> Second { get; private set; }
- internal IObservable<TSource3> Third { get; private set; }
-
- /// <summary>
- /// Creates a pattern that matches when all four observable sequences have an available element.
- /// </summary>
- /// <typeparam name="TSource4">The type of the elements in the fourth observable sequence.</typeparam>
- /// <param name="other">Observable sequence to match with the three previous sequences.</param>
- /// <returns>Pattern object that matches when all observable sequences have an available element.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="other"/> is null.</exception>
- public Pattern<TSource1, TSource2, TSource3, TSource4> And<TSource4>(IObservable<TSource4> other)
- {
- if (other == null)
- throw new ArgumentNullException("other");
-
- return new Pattern<TSource1, TSource2, TSource3, TSource4>(First, Second, Third, other);
- }
-
- /// <summary>
- /// Matches when all observable sequences have an available element and projects the elements by invoking the selector function.
- /// </summary>
- /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
- /// <param name="selector">Selector that will be invoked for elements in the source sequences.</param>
- /// <returns>Plan that produces the projected results, to be fed (with other plans) to the When operator.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="selector"/> is null.</exception>
- public Plan<TResult> Then<TResult>(Func<TSource1, TSource2, TSource3, TResult> selector)
- {
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return new Plan<TSource1, TSource2, TSource3, TResult>(this, selector);
- }
-
- }
-
- /// <summary>
- /// Represents a join pattern over four observable sequences.
- /// </summary>
- /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
- /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
- /// <typeparam name="TSource3">The type of the elements in the third source sequence.</typeparam>
- /// <typeparam name="TSource4">The type of the elements in the fourth source sequence.</typeparam>
- public class Pattern<TSource1, TSource2, TSource3, TSource4> : Pattern
- {
- internal Pattern(IObservable<TSource1> first, IObservable<TSource2> second, IObservable<TSource3> third, IObservable<TSource4> fourth)
- {
- First = first;
- Second = second;
- Third = third;
- Fourth = fourth;
- }
-
- internal IObservable<TSource1> First { get; private set; }
- internal IObservable<TSource2> Second { get; private set; }
- internal IObservable<TSource3> Third { get; private set; }
- internal IObservable<TSource4> Fourth { get; private set; }
-
-#if !NO_LARGEARITY
- /// <summary>
- /// Creates a pattern that matches when all five observable sequences have an available element.
- /// </summary>
- /// <typeparam name="TSource5">The type of the elements in the fifth observable sequence.</typeparam>
- /// <param name="other">Observable sequence to match with the four previous sequences.</param>
- /// <returns>Pattern object that matches when all observable sequences have an available element.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="other"/> is null.</exception>
- public Pattern<TSource1, TSource2, TSource3, TSource4, TSource5> And<TSource5>(IObservable<TSource5> other)
- {
- if (other == null)
- throw new ArgumentNullException("other");
-
- return new Pattern<TSource1, TSource2, TSource3, TSource4, TSource5>(First, Second, Third, Fourth, other);
- }
-#endif
-
- /// <summary>
- /// Matches when all observable sequences have an available element and projects the elements by invoking the selector function.
- /// </summary>
- /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
- /// <param name="selector">Selector that will be invoked for elements in the source sequences.</param>
- /// <returns>Plan that produces the projected results, to be fed (with other plans) to the When operator.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="selector"/> is null.</exception>
- public Plan<TResult> Then<TResult>(Func<TSource1, TSource2, TSource3, TSource4, TResult> selector)
- {
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return new Plan<TSource1, TSource2, TSource3, TSource4, TResult>(this, selector);
- }
-
- }
-
-#if !NO_LARGEARITY
- /// <summary>
- /// Represents a join pattern over five observable sequences.
- /// </summary>
- /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
- /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
- /// <typeparam name="TSource3">The type of the elements in the third source sequence.</typeparam>
- /// <typeparam name="TSource4">The type of the elements in the fourth source sequence.</typeparam>
- /// <typeparam name="TSource5">The type of the elements in the fifth source sequence.</typeparam>
- public class Pattern<TSource1, TSource2, TSource3, TSource4, TSource5> : Pattern
- {
- internal Pattern(IObservable<TSource1> first, IObservable<TSource2> second, IObservable<TSource3> third, IObservable<TSource4> fourth, IObservable<TSource5> fifth)
- {
- First = first;
- Second = second;
- Third = third;
- Fourth = fourth;
- Fifth = fifth;
- }
-
- internal IObservable<TSource1> First { get; private set; }
- internal IObservable<TSource2> Second { get; private set; }
- internal IObservable<TSource3> Third { get; private set; }
- internal IObservable<TSource4> Fourth { get; private set; }
- internal IObservable<TSource5> Fifth { get; private set; }
-
- /// <summary>
- /// Creates a pattern that matches when all six observable sequences have an available element.
- /// </summary>
- /// <typeparam name="TSource6">The type of the elements in the sixth observable sequence.</typeparam>
- /// <param name="other">Observable sequence to match with the five previous sequences.</param>
- /// <returns>Pattern object that matches when all observable sequences have an available element.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="other"/> is null.</exception>
- public Pattern<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6> And<TSource6>(IObservable<TSource6> other)
- {
- if (other == null)
- throw new ArgumentNullException("other");
-
- return new Pattern<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6>(First, Second, Third, Fourth, Fifth, other);
- }
-
- /// <summary>
- /// Matches when all observable sequences have an available element and projects the elements by invoking the selector function.
- /// </summary>
- /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
- /// <param name="selector">Selector that will be invoked for elements in the source sequences.</param>
- /// <returns>Plan that produces the projected results, to be fed (with other plans) to the When operator.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="selector"/> is null.</exception>
- public Plan<TResult> Then<TResult>(Func<TSource1, TSource2, TSource3, TSource4, TSource5, TResult> selector)
- {
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return new Plan<TSource1, TSource2, TSource3, TSource4, TSource5, TResult>(this, selector);
- }
-
- }
-
- /// <summary>
- /// Represents a join pattern over six observable sequences.
- /// </summary>
- /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
- /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
- /// <typeparam name="TSource3">The type of the elements in the third source sequence.</typeparam>
- /// <typeparam name="TSource4">The type of the elements in the fourth source sequence.</typeparam>
- /// <typeparam name="TSource5">The type of the elements in the fifth source sequence.</typeparam>
- /// <typeparam name="TSource6">The type of the elements in the sixth source sequence.</typeparam>
- public class Pattern<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6> : Pattern
- {
- internal Pattern(IObservable<TSource1> first, IObservable<TSource2> second, IObservable<TSource3> third, IObservable<TSource4> fourth, IObservable<TSource5> fifth, IObservable<TSource6> sixth)
- {
- First = first;
- Second = second;
- Third = third;
- Fourth = fourth;
- Fifth = fifth;
- Sixth = sixth;
- }
-
- internal IObservable<TSource1> First { get; private set; }
- internal IObservable<TSource2> Second { get; private set; }
- internal IObservable<TSource3> Third { get; private set; }
- internal IObservable<TSource4> Fourth { get; private set; }
- internal IObservable<TSource5> Fifth { get; private set; }
- internal IObservable<TSource6> Sixth { get; private set; }
-
- /// <summary>
- /// Creates a pattern that matches when all seven observable sequences have an available element.
- /// </summary>
- /// <typeparam name="TSource7">The type of the elements in the seventh observable sequence.</typeparam>
- /// <param name="other">Observable sequence to match with the six previous sequences.</param>
- /// <returns>Pattern object that matches when all observable sequences have an available element.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="other"/> is null.</exception>
- public Pattern<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7> And<TSource7>(IObservable<TSource7> other)
- {
- if (other == null)
- throw new ArgumentNullException("other");
-
- return new Pattern<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7>(First, Second, Third, Fourth, Fifth, Sixth, other);
- }
-
- /// <summary>
- /// Matches when all observable sequences have an available element and projects the elements by invoking the selector function.
- /// </summary>
- /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
- /// <param name="selector">Selector that will be invoked for elements in the source sequences.</param>
- /// <returns>Plan that produces the projected results, to be fed (with other plans) to the When operator.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="selector"/> is null.</exception>
- public Plan<TResult> Then<TResult>(Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TResult> selector)
- {
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return new Plan<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TResult>(this, selector);
- }
-
- }
-
- /// <summary>
- /// Represents a join pattern over seven observable sequences.
- /// </summary>
- /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
- /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
- /// <typeparam name="TSource3">The type of the elements in the third source sequence.</typeparam>
- /// <typeparam name="TSource4">The type of the elements in the fourth source sequence.</typeparam>
- /// <typeparam name="TSource5">The type of the elements in the fifth source sequence.</typeparam>
- /// <typeparam name="TSource6">The type of the elements in the sixth source sequence.</typeparam>
- /// <typeparam name="TSource7">The type of the elements in the seventh source sequence.</typeparam>
- public class Pattern<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7> : Pattern
- {
- internal Pattern(IObservable<TSource1> first, IObservable<TSource2> second, IObservable<TSource3> third, IObservable<TSource4> fourth, IObservable<TSource5> fifth, IObservable<TSource6> sixth, IObservable<TSource7> seventh)
- {
- First = first;
- Second = second;
- Third = third;
- Fourth = fourth;
- Fifth = fifth;
- Sixth = sixth;
- Seventh = seventh;
- }
-
- internal IObservable<TSource1> First { get; private set; }
- internal IObservable<TSource2> Second { get; private set; }
- internal IObservable<TSource3> Third { get; private set; }
- internal IObservable<TSource4> Fourth { get; private set; }
- internal IObservable<TSource5> Fifth { get; private set; }
- internal IObservable<TSource6> Sixth { get; private set; }
- internal IObservable<TSource7> Seventh { get; private set; }
-
- /// <summary>
- /// Creates a pattern that matches when all eight observable sequences have an available element.
- /// </summary>
- /// <typeparam name="TSource8">The type of the elements in the eighth observable sequence.</typeparam>
- /// <param name="other">Observable sequence to match with the seven previous sequences.</param>
- /// <returns>Pattern object that matches when all observable sequences have an available element.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="other"/> is null.</exception>
- public Pattern<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8> And<TSource8>(IObservable<TSource8> other)
- {
- if (other == null)
- throw new ArgumentNullException("other");
-
- return new Pattern<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8>(First, Second, Third, Fourth, Fifth, Sixth, Seventh, other);
- }
-
- /// <summary>
- /// Matches when all observable sequences have an available element and projects the elements by invoking the selector function.
- /// </summary>
- /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
- /// <param name="selector">Selector that will be invoked for elements in the source sequences.</param>
- /// <returns>Plan that produces the projected results, to be fed (with other plans) to the When operator.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="selector"/> is null.</exception>
- public Plan<TResult> Then<TResult>(Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TResult> selector)
- {
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return new Plan<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TResult>(this, selector);
- }
-
- }
-
- /// <summary>
- /// Represents a join pattern over eight observable sequences.
- /// </summary>
- /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
- /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
- /// <typeparam name="TSource3">The type of the elements in the third source sequence.</typeparam>
- /// <typeparam name="TSource4">The type of the elements in the fourth source sequence.</typeparam>
- /// <typeparam name="TSource5">The type of the elements in the fifth source sequence.</typeparam>
- /// <typeparam name="TSource6">The type of the elements in the sixth source sequence.</typeparam>
- /// <typeparam name="TSource7">The type of the elements in the seventh source sequence.</typeparam>
- /// <typeparam name="TSource8">The type of the elements in the eighth source sequence.</typeparam>
- public class Pattern<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8> : Pattern
- {
- internal Pattern(IObservable<TSource1> first, IObservable<TSource2> second, IObservable<TSource3> third, IObservable<TSource4> fourth, IObservable<TSource5> fifth, IObservable<TSource6> sixth, IObservable<TSource7> seventh, IObservable<TSource8> eighth)
- {
- First = first;
- Second = second;
- Third = third;
- Fourth = fourth;
- Fifth = fifth;
- Sixth = sixth;
- Seventh = seventh;
- Eighth = eighth;
- }
-
- internal IObservable<TSource1> First { get; private set; }
- internal IObservable<TSource2> Second { get; private set; }
- internal IObservable<TSource3> Third { get; private set; }
- internal IObservable<TSource4> Fourth { get; private set; }
- internal IObservable<TSource5> Fifth { get; private set; }
- internal IObservable<TSource6> Sixth { get; private set; }
- internal IObservable<TSource7> Seventh { get; private set; }
- internal IObservable<TSource8> Eighth { get; private set; }
-
- /// <summary>
- /// Creates a pattern that matches when all nine observable sequences have an available element.
- /// </summary>
- /// <typeparam name="TSource9">The type of the elements in the ninth observable sequence.</typeparam>
- /// <param name="other">Observable sequence to match with the eight previous sequences.</param>
- /// <returns>Pattern object that matches when all observable sequences have an available element.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="other"/> is null.</exception>
- public Pattern<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9> And<TSource9>(IObservable<TSource9> other)
- {
- if (other == null)
- throw new ArgumentNullException("other");
-
- return new Pattern<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9>(First, Second, Third, Fourth, Fifth, Sixth, Seventh, Eighth, other);
- }
-
- /// <summary>
- /// Matches when all observable sequences have an available element and projects the elements by invoking the selector function.
- /// </summary>
- /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
- /// <param name="selector">Selector that will be invoked for elements in the source sequences.</param>
- /// <returns>Plan that produces the projected results, to be fed (with other plans) to the When operator.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="selector"/> is null.</exception>
- public Plan<TResult> Then<TResult>(Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TResult> selector)
- {
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return new Plan<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TResult>(this, selector);
- }
-
- }
-
- /// <summary>
- /// Represents a join pattern over nine observable sequences.
- /// </summary>
- /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
- /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
- /// <typeparam name="TSource3">The type of the elements in the third source sequence.</typeparam>
- /// <typeparam name="TSource4">The type of the elements in the fourth source sequence.</typeparam>
- /// <typeparam name="TSource5">The type of the elements in the fifth source sequence.</typeparam>
- /// <typeparam name="TSource6">The type of the elements in the sixth source sequence.</typeparam>
- /// <typeparam name="TSource7">The type of the elements in the seventh source sequence.</typeparam>
- /// <typeparam name="TSource8">The type of the elements in the eighth source sequence.</typeparam>
- /// <typeparam name="TSource9">The type of the elements in the ninth source sequence.</typeparam>
- public class Pattern<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9> : Pattern
- {
- internal Pattern(IObservable<TSource1> first, IObservable<TSource2> second, IObservable<TSource3> third, IObservable<TSource4> fourth, IObservable<TSource5> fifth, IObservable<TSource6> sixth, IObservable<TSource7> seventh, IObservable<TSource8> eighth, IObservable<TSource9> ninth)
- {
- First = first;
- Second = second;
- Third = third;
- Fourth = fourth;
- Fifth = fifth;
- Sixth = sixth;
- Seventh = seventh;
- Eighth = eighth;
- Ninth = ninth;
- }
-
- internal IObservable<TSource1> First { get; private set; }
- internal IObservable<TSource2> Second { get; private set; }
- internal IObservable<TSource3> Third { get; private set; }
- internal IObservable<TSource4> Fourth { get; private set; }
- internal IObservable<TSource5> Fifth { get; private set; }
- internal IObservable<TSource6> Sixth { get; private set; }
- internal IObservable<TSource7> Seventh { get; private set; }
- internal IObservable<TSource8> Eighth { get; private set; }
- internal IObservable<TSource9> Ninth { get; private set; }
-
- /// <summary>
- /// Creates a pattern that matches when all ten observable sequences have an available element.
- /// </summary>
- /// <typeparam name="TSource10">The type of the elements in the tenth observable sequence.</typeparam>
- /// <param name="other">Observable sequence to match with the nine previous sequences.</param>
- /// <returns>Pattern object that matches when all observable sequences have an available element.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="other"/> is null.</exception>
- public Pattern<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10> And<TSource10>(IObservable<TSource10> other)
- {
- if (other == null)
- throw new ArgumentNullException("other");
-
- return new Pattern<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10>(First, Second, Third, Fourth, Fifth, Sixth, Seventh, Eighth, Ninth, other);
- }
-
- /// <summary>
- /// Matches when all observable sequences have an available element and projects the elements by invoking the selector function.
- /// </summary>
- /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
- /// <param name="selector">Selector that will be invoked for elements in the source sequences.</param>
- /// <returns>Plan that produces the projected results, to be fed (with other plans) to the When operator.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="selector"/> is null.</exception>
- public Plan<TResult> Then<TResult>(Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TResult> selector)
- {
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return new Plan<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TResult>(this, selector);
- }
-
- }
-
- /// <summary>
- /// Represents a join pattern over ten observable sequences.
- /// </summary>
- /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
- /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
- /// <typeparam name="TSource3">The type of the elements in the third source sequence.</typeparam>
- /// <typeparam name="TSource4">The type of the elements in the fourth source sequence.</typeparam>
- /// <typeparam name="TSource5">The type of the elements in the fifth source sequence.</typeparam>
- /// <typeparam name="TSource6">The type of the elements in the sixth source sequence.</typeparam>
- /// <typeparam name="TSource7">The type of the elements in the seventh source sequence.</typeparam>
- /// <typeparam name="TSource8">The type of the elements in the eighth source sequence.</typeparam>
- /// <typeparam name="TSource9">The type of the elements in the ninth source sequence.</typeparam>
- /// <typeparam name="TSource10">The type of the elements in the tenth source sequence.</typeparam>
- public class Pattern<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10> : Pattern
- {
- internal Pattern(IObservable<TSource1> first, IObservable<TSource2> second, IObservable<TSource3> third, IObservable<TSource4> fourth, IObservable<TSource5> fifth, IObservable<TSource6> sixth, IObservable<TSource7> seventh, IObservable<TSource8> eighth, IObservable<TSource9> ninth, IObservable<TSource10> tenth)
- {
- First = first;
- Second = second;
- Third = third;
- Fourth = fourth;
- Fifth = fifth;
- Sixth = sixth;
- Seventh = seventh;
- Eighth = eighth;
- Ninth = ninth;
- Tenth = tenth;
- }
-
- internal IObservable<TSource1> First { get; private set; }
- internal IObservable<TSource2> Second { get; private set; }
- internal IObservable<TSource3> Third { get; private set; }
- internal IObservable<TSource4> Fourth { get; private set; }
- internal IObservable<TSource5> Fifth { get; private set; }
- internal IObservable<TSource6> Sixth { get; private set; }
- internal IObservable<TSource7> Seventh { get; private set; }
- internal IObservable<TSource8> Eighth { get; private set; }
- internal IObservable<TSource9> Ninth { get; private set; }
- internal IObservable<TSource10> Tenth { get; private set; }
-
- /// <summary>
- /// Creates a pattern that matches when all eleven observable sequences have an available element.
- /// </summary>
- /// <typeparam name="TSource11">The type of the elements in the eleventh observable sequence.</typeparam>
- /// <param name="other">Observable sequence to match with the ten previous sequences.</param>
- /// <returns>Pattern object that matches when all observable sequences have an available element.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="other"/> is null.</exception>
- public Pattern<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11> And<TSource11>(IObservable<TSource11> other)
- {
- if (other == null)
- throw new ArgumentNullException("other");
-
- return new Pattern<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11>(First, Second, Third, Fourth, Fifth, Sixth, Seventh, Eighth, Ninth, Tenth, other);
- }
-
- /// <summary>
- /// Matches when all observable sequences have an available element and projects the elements by invoking the selector function.
- /// </summary>
- /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
- /// <param name="selector">Selector that will be invoked for elements in the source sequences.</param>
- /// <returns>Plan that produces the projected results, to be fed (with other plans) to the When operator.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="selector"/> is null.</exception>
- public Plan<TResult> Then<TResult>(Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TResult> selector)
- {
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return new Plan<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TResult>(this, selector);
- }
-
- }
-
- /// <summary>
- /// Represents a join pattern over eleven observable sequences.
- /// </summary>
- /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
- /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
- /// <typeparam name="TSource3">The type of the elements in the third source sequence.</typeparam>
- /// <typeparam name="TSource4">The type of the elements in the fourth source sequence.</typeparam>
- /// <typeparam name="TSource5">The type of the elements in the fifth source sequence.</typeparam>
- /// <typeparam name="TSource6">The type of the elements in the sixth source sequence.</typeparam>
- /// <typeparam name="TSource7">The type of the elements in the seventh source sequence.</typeparam>
- /// <typeparam name="TSource8">The type of the elements in the eighth source sequence.</typeparam>
- /// <typeparam name="TSource9">The type of the elements in the ninth source sequence.</typeparam>
- /// <typeparam name="TSource10">The type of the elements in the tenth source sequence.</typeparam>
- /// <typeparam name="TSource11">The type of the elements in the eleventh source sequence.</typeparam>
- public class Pattern<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11> : Pattern
- {
- internal Pattern(IObservable<TSource1> first, IObservable<TSource2> second, IObservable<TSource3> third, IObservable<TSource4> fourth, IObservable<TSource5> fifth, IObservable<TSource6> sixth, IObservable<TSource7> seventh, IObservable<TSource8> eighth, IObservable<TSource9> ninth, IObservable<TSource10> tenth, IObservable<TSource11> eleventh)
- {
- First = first;
- Second = second;
- Third = third;
- Fourth = fourth;
- Fifth = fifth;
- Sixth = sixth;
- Seventh = seventh;
- Eighth = eighth;
- Ninth = ninth;
- Tenth = tenth;
- Eleventh = eleventh;
- }
-
- internal IObservable<TSource1> First { get; private set; }
- internal IObservable<TSource2> Second { get; private set; }
- internal IObservable<TSource3> Third { get; private set; }
- internal IObservable<TSource4> Fourth { get; private set; }
- internal IObservable<TSource5> Fifth { get; private set; }
- internal IObservable<TSource6> Sixth { get; private set; }
- internal IObservable<TSource7> Seventh { get; private set; }
- internal IObservable<TSource8> Eighth { get; private set; }
- internal IObservable<TSource9> Ninth { get; private set; }
- internal IObservable<TSource10> Tenth { get; private set; }
- internal IObservable<TSource11> Eleventh { get; private set; }
-
- /// <summary>
- /// Creates a pattern that matches when all twelve observable sequences have an available element.
- /// </summary>
- /// <typeparam name="TSource12">The type of the elements in the twelfth observable sequence.</typeparam>
- /// <param name="other">Observable sequence to match with the eleven previous sequences.</param>
- /// <returns>Pattern object that matches when all observable sequences have an available element.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="other"/> is null.</exception>
- public Pattern<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12> And<TSource12>(IObservable<TSource12> other)
- {
- if (other == null)
- throw new ArgumentNullException("other");
-
- return new Pattern<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12>(First, Second, Third, Fourth, Fifth, Sixth, Seventh, Eighth, Ninth, Tenth, Eleventh, other);
- }
-
- /// <summary>
- /// Matches when all observable sequences have an available element and projects the elements by invoking the selector function.
- /// </summary>
- /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
- /// <param name="selector">Selector that will be invoked for elements in the source sequences.</param>
- /// <returns>Plan that produces the projected results, to be fed (with other plans) to the When operator.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="selector"/> is null.</exception>
- public Plan<TResult> Then<TResult>(Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TResult> selector)
- {
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return new Plan<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TResult>(this, selector);
- }
-
- }
-
- /// <summary>
- /// Represents a join pattern over twelve observable sequences.
- /// </summary>
- /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
- /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
- /// <typeparam name="TSource3">The type of the elements in the third source sequence.</typeparam>
- /// <typeparam name="TSource4">The type of the elements in the fourth source sequence.</typeparam>
- /// <typeparam name="TSource5">The type of the elements in the fifth source sequence.</typeparam>
- /// <typeparam name="TSource6">The type of the elements in the sixth source sequence.</typeparam>
- /// <typeparam name="TSource7">The type of the elements in the seventh source sequence.</typeparam>
- /// <typeparam name="TSource8">The type of the elements in the eighth source sequence.</typeparam>
- /// <typeparam name="TSource9">The type of the elements in the ninth source sequence.</typeparam>
- /// <typeparam name="TSource10">The type of the elements in the tenth source sequence.</typeparam>
- /// <typeparam name="TSource11">The type of the elements in the eleventh source sequence.</typeparam>
- /// <typeparam name="TSource12">The type of the elements in the twelfth source sequence.</typeparam>
- public class Pattern<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12> : Pattern
- {
- internal Pattern(IObservable<TSource1> first, IObservable<TSource2> second, IObservable<TSource3> third, IObservable<TSource4> fourth, IObservable<TSource5> fifth, IObservable<TSource6> sixth, IObservable<TSource7> seventh, IObservable<TSource8> eighth, IObservable<TSource9> ninth, IObservable<TSource10> tenth, IObservable<TSource11> eleventh, IObservable<TSource12> twelfth)
- {
- First = first;
- Second = second;
- Third = third;
- Fourth = fourth;
- Fifth = fifth;
- Sixth = sixth;
- Seventh = seventh;
- Eighth = eighth;
- Ninth = ninth;
- Tenth = tenth;
- Eleventh = eleventh;
- Twelfth = twelfth;
- }
-
- internal IObservable<TSource1> First { get; private set; }
- internal IObservable<TSource2> Second { get; private set; }
- internal IObservable<TSource3> Third { get; private set; }
- internal IObservable<TSource4> Fourth { get; private set; }
- internal IObservable<TSource5> Fifth { get; private set; }
- internal IObservable<TSource6> Sixth { get; private set; }
- internal IObservable<TSource7> Seventh { get; private set; }
- internal IObservable<TSource8> Eighth { get; private set; }
- internal IObservable<TSource9> Ninth { get; private set; }
- internal IObservable<TSource10> Tenth { get; private set; }
- internal IObservable<TSource11> Eleventh { get; private set; }
- internal IObservable<TSource12> Twelfth { get; private set; }
-
- /// <summary>
- /// Creates a pattern that matches when all thirteen observable sequences have an available element.
- /// </summary>
- /// <typeparam name="TSource13">The type of the elements in the thirteenth observable sequence.</typeparam>
- /// <param name="other">Observable sequence to match with the twelve previous sequences.</param>
- /// <returns>Pattern object that matches when all observable sequences have an available element.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="other"/> is null.</exception>
- public Pattern<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13> And<TSource13>(IObservable<TSource13> other)
- {
- if (other == null)
- throw new ArgumentNullException("other");
-
- return new Pattern<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13>(First, Second, Third, Fourth, Fifth, Sixth, Seventh, Eighth, Ninth, Tenth, Eleventh, Twelfth, other);
- }
-
- /// <summary>
- /// Matches when all observable sequences have an available element and projects the elements by invoking the selector function.
- /// </summary>
- /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
- /// <param name="selector">Selector that will be invoked for elements in the source sequences.</param>
- /// <returns>Plan that produces the projected results, to be fed (with other plans) to the When operator.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="selector"/> is null.</exception>
- public Plan<TResult> Then<TResult>(Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TResult> selector)
- {
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return new Plan<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TResult>(this, selector);
- }
-
- }
-
- /// <summary>
- /// Represents a join pattern over thirteen observable sequences.
- /// </summary>
- /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
- /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
- /// <typeparam name="TSource3">The type of the elements in the third source sequence.</typeparam>
- /// <typeparam name="TSource4">The type of the elements in the fourth source sequence.</typeparam>
- /// <typeparam name="TSource5">The type of the elements in the fifth source sequence.</typeparam>
- /// <typeparam name="TSource6">The type of the elements in the sixth source sequence.</typeparam>
- /// <typeparam name="TSource7">The type of the elements in the seventh source sequence.</typeparam>
- /// <typeparam name="TSource8">The type of the elements in the eighth source sequence.</typeparam>
- /// <typeparam name="TSource9">The type of the elements in the ninth source sequence.</typeparam>
- /// <typeparam name="TSource10">The type of the elements in the tenth source sequence.</typeparam>
- /// <typeparam name="TSource11">The type of the elements in the eleventh source sequence.</typeparam>
- /// <typeparam name="TSource12">The type of the elements in the twelfth source sequence.</typeparam>
- /// <typeparam name="TSource13">The type of the elements in the thirteenth source sequence.</typeparam>
- public class Pattern<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13> : Pattern
- {
- internal Pattern(IObservable<TSource1> first, IObservable<TSource2> second, IObservable<TSource3> third, IObservable<TSource4> fourth, IObservable<TSource5> fifth, IObservable<TSource6> sixth, IObservable<TSource7> seventh, IObservable<TSource8> eighth, IObservable<TSource9> ninth, IObservable<TSource10> tenth, IObservable<TSource11> eleventh, IObservable<TSource12> twelfth, IObservable<TSource13> thirteenth)
- {
- First = first;
- Second = second;
- Third = third;
- Fourth = fourth;
- Fifth = fifth;
- Sixth = sixth;
- Seventh = seventh;
- Eighth = eighth;
- Ninth = ninth;
- Tenth = tenth;
- Eleventh = eleventh;
- Twelfth = twelfth;
- Thirteenth = thirteenth;
- }
-
- internal IObservable<TSource1> First { get; private set; }
- internal IObservable<TSource2> Second { get; private set; }
- internal IObservable<TSource3> Third { get; private set; }
- internal IObservable<TSource4> Fourth { get; private set; }
- internal IObservable<TSource5> Fifth { get; private set; }
- internal IObservable<TSource6> Sixth { get; private set; }
- internal IObservable<TSource7> Seventh { get; private set; }
- internal IObservable<TSource8> Eighth { get; private set; }
- internal IObservable<TSource9> Ninth { get; private set; }
- internal IObservable<TSource10> Tenth { get; private set; }
- internal IObservable<TSource11> Eleventh { get; private set; }
- internal IObservable<TSource12> Twelfth { get; private set; }
- internal IObservable<TSource13> Thirteenth { get; private set; }
-
- /// <summary>
- /// Creates a pattern that matches when all fourteen observable sequences have an available element.
- /// </summary>
- /// <typeparam name="TSource14">The type of the elements in the fourteenth observable sequence.</typeparam>
- /// <param name="other">Observable sequence to match with the thirteen previous sequences.</param>
- /// <returns>Pattern object that matches when all observable sequences have an available element.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="other"/> is null.</exception>
- public Pattern<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TSource14> And<TSource14>(IObservable<TSource14> other)
- {
- if (other == null)
- throw new ArgumentNullException("other");
-
- return new Pattern<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TSource14>(First, Second, Third, Fourth, Fifth, Sixth, Seventh, Eighth, Ninth, Tenth, Eleventh, Twelfth, Thirteenth, other);
- }
-
- /// <summary>
- /// Matches when all observable sequences have an available element and projects the elements by invoking the selector function.
- /// </summary>
- /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
- /// <param name="selector">Selector that will be invoked for elements in the source sequences.</param>
- /// <returns>Plan that produces the projected results, to be fed (with other plans) to the When operator.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="selector"/> is null.</exception>
- public Plan<TResult> Then<TResult>(Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TResult> selector)
- {
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return new Plan<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TResult>(this, selector);
- }
-
- }
-
- /// <summary>
- /// Represents a join pattern over fourteen observable sequences.
- /// </summary>
- /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
- /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
- /// <typeparam name="TSource3">The type of the elements in the third source sequence.</typeparam>
- /// <typeparam name="TSource4">The type of the elements in the fourth source sequence.</typeparam>
- /// <typeparam name="TSource5">The type of the elements in the fifth source sequence.</typeparam>
- /// <typeparam name="TSource6">The type of the elements in the sixth source sequence.</typeparam>
- /// <typeparam name="TSource7">The type of the elements in the seventh source sequence.</typeparam>
- /// <typeparam name="TSource8">The type of the elements in the eighth source sequence.</typeparam>
- /// <typeparam name="TSource9">The type of the elements in the ninth source sequence.</typeparam>
- /// <typeparam name="TSource10">The type of the elements in the tenth source sequence.</typeparam>
- /// <typeparam name="TSource11">The type of the elements in the eleventh source sequence.</typeparam>
- /// <typeparam name="TSource12">The type of the elements in the twelfth source sequence.</typeparam>
- /// <typeparam name="TSource13">The type of the elements in the thirteenth source sequence.</typeparam>
- /// <typeparam name="TSource14">The type of the elements in the fourteenth source sequence.</typeparam>
- public class Pattern<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TSource14> : Pattern
- {
- internal Pattern(IObservable<TSource1> first, IObservable<TSource2> second, IObservable<TSource3> third, IObservable<TSource4> fourth, IObservable<TSource5> fifth, IObservable<TSource6> sixth, IObservable<TSource7> seventh, IObservable<TSource8> eighth, IObservable<TSource9> ninth, IObservable<TSource10> tenth, IObservable<TSource11> eleventh, IObservable<TSource12> twelfth, IObservable<TSource13> thirteenth, IObservable<TSource14> fourteenth)
- {
- First = first;
- Second = second;
- Third = third;
- Fourth = fourth;
- Fifth = fifth;
- Sixth = sixth;
- Seventh = seventh;
- Eighth = eighth;
- Ninth = ninth;
- Tenth = tenth;
- Eleventh = eleventh;
- Twelfth = twelfth;
- Thirteenth = thirteenth;
- Fourteenth = fourteenth;
- }
-
- internal IObservable<TSource1> First { get; private set; }
- internal IObservable<TSource2> Second { get; private set; }
- internal IObservable<TSource3> Third { get; private set; }
- internal IObservable<TSource4> Fourth { get; private set; }
- internal IObservable<TSource5> Fifth { get; private set; }
- internal IObservable<TSource6> Sixth { get; private set; }
- internal IObservable<TSource7> Seventh { get; private set; }
- internal IObservable<TSource8> Eighth { get; private set; }
- internal IObservable<TSource9> Ninth { get; private set; }
- internal IObservable<TSource10> Tenth { get; private set; }
- internal IObservable<TSource11> Eleventh { get; private set; }
- internal IObservable<TSource12> Twelfth { get; private set; }
- internal IObservable<TSource13> Thirteenth { get; private set; }
- internal IObservable<TSource14> Fourteenth { get; private set; }
-
- /// <summary>
- /// Creates a pattern that matches when all fifteen observable sequences have an available element.
- /// </summary>
- /// <typeparam name="TSource15">The type of the elements in the fifteenth observable sequence.</typeparam>
- /// <param name="other">Observable sequence to match with the fourteen previous sequences.</param>
- /// <returns>Pattern object that matches when all observable sequences have an available element.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="other"/> is null.</exception>
- public Pattern<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TSource14, TSource15> And<TSource15>(IObservable<TSource15> other)
- {
- if (other == null)
- throw new ArgumentNullException("other");
-
- return new Pattern<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TSource14, TSource15>(First, Second, Third, Fourth, Fifth, Sixth, Seventh, Eighth, Ninth, Tenth, Eleventh, Twelfth, Thirteenth, Fourteenth, other);
- }
-
- /// <summary>
- /// Matches when all observable sequences have an available element and projects the elements by invoking the selector function.
- /// </summary>
- /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
- /// <param name="selector">Selector that will be invoked for elements in the source sequences.</param>
- /// <returns>Plan that produces the projected results, to be fed (with other plans) to the When operator.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="selector"/> is null.</exception>
- public Plan<TResult> Then<TResult>(Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TSource14, TResult> selector)
- {
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return new Plan<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TSource14, TResult>(this, selector);
- }
-
- }
-
- /// <summary>
- /// Represents a join pattern over fifteen observable sequences.
- /// </summary>
- /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
- /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
- /// <typeparam name="TSource3">The type of the elements in the third source sequence.</typeparam>
- /// <typeparam name="TSource4">The type of the elements in the fourth source sequence.</typeparam>
- /// <typeparam name="TSource5">The type of the elements in the fifth source sequence.</typeparam>
- /// <typeparam name="TSource6">The type of the elements in the sixth source sequence.</typeparam>
- /// <typeparam name="TSource7">The type of the elements in the seventh source sequence.</typeparam>
- /// <typeparam name="TSource8">The type of the elements in the eighth source sequence.</typeparam>
- /// <typeparam name="TSource9">The type of the elements in the ninth source sequence.</typeparam>
- /// <typeparam name="TSource10">The type of the elements in the tenth source sequence.</typeparam>
- /// <typeparam name="TSource11">The type of the elements in the eleventh source sequence.</typeparam>
- /// <typeparam name="TSource12">The type of the elements in the twelfth source sequence.</typeparam>
- /// <typeparam name="TSource13">The type of the elements in the thirteenth source sequence.</typeparam>
- /// <typeparam name="TSource14">The type of the elements in the fourteenth source sequence.</typeparam>
- /// <typeparam name="TSource15">The type of the elements in the fifteenth source sequence.</typeparam>
- public class Pattern<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TSource14, TSource15> : Pattern
- {
- internal Pattern(IObservable<TSource1> first, IObservable<TSource2> second, IObservable<TSource3> third, IObservable<TSource4> fourth, IObservable<TSource5> fifth, IObservable<TSource6> sixth, IObservable<TSource7> seventh, IObservable<TSource8> eighth, IObservable<TSource9> ninth, IObservable<TSource10> tenth, IObservable<TSource11> eleventh, IObservable<TSource12> twelfth, IObservable<TSource13> thirteenth, IObservable<TSource14> fourteenth, IObservable<TSource15> fifteenth)
- {
- First = first;
- Second = second;
- Third = third;
- Fourth = fourth;
- Fifth = fifth;
- Sixth = sixth;
- Seventh = seventh;
- Eighth = eighth;
- Ninth = ninth;
- Tenth = tenth;
- Eleventh = eleventh;
- Twelfth = twelfth;
- Thirteenth = thirteenth;
- Fourteenth = fourteenth;
- Fifteenth = fifteenth;
- }
-
- internal IObservable<TSource1> First { get; private set; }
- internal IObservable<TSource2> Second { get; private set; }
- internal IObservable<TSource3> Third { get; private set; }
- internal IObservable<TSource4> Fourth { get; private set; }
- internal IObservable<TSource5> Fifth { get; private set; }
- internal IObservable<TSource6> Sixth { get; private set; }
- internal IObservable<TSource7> Seventh { get; private set; }
- internal IObservable<TSource8> Eighth { get; private set; }
- internal IObservable<TSource9> Ninth { get; private set; }
- internal IObservable<TSource10> Tenth { get; private set; }
- internal IObservable<TSource11> Eleventh { get; private set; }
- internal IObservable<TSource12> Twelfth { get; private set; }
- internal IObservable<TSource13> Thirteenth { get; private set; }
- internal IObservable<TSource14> Fourteenth { get; private set; }
- internal IObservable<TSource15> Fifteenth { get; private set; }
-
- /// <summary>
- /// Creates a pattern that matches when all sixteen observable sequences have an available element.
- /// </summary>
- /// <typeparam name="TSource16">The type of the elements in the sixteenth observable sequence.</typeparam>
- /// <param name="other">Observable sequence to match with the fifteen previous sequences.</param>
- /// <returns>Pattern object that matches when all observable sequences have an available element.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="other"/> is null.</exception>
- public Pattern<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TSource14, TSource15, TSource16> And<TSource16>(IObservable<TSource16> other)
- {
- if (other == null)
- throw new ArgumentNullException("other");
-
- return new Pattern<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TSource14, TSource15, TSource16>(First, Second, Third, Fourth, Fifth, Sixth, Seventh, Eighth, Ninth, Tenth, Eleventh, Twelfth, Thirteenth, Fourteenth, Fifteenth, other);
- }
-
- /// <summary>
- /// Matches when all observable sequences have an available element and projects the elements by invoking the selector function.
- /// </summary>
- /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
- /// <param name="selector">Selector that will be invoked for elements in the source sequences.</param>
- /// <returns>Plan that produces the projected results, to be fed (with other plans) to the When operator.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="selector"/> is null.</exception>
- public Plan<TResult> Then<TResult>(Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TSource14, TSource15, TResult> selector)
- {
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return new Plan<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TSource14, TSource15, TResult>(this, selector);
- }
-
- }
-
- /// <summary>
- /// Represents a join pattern over sixteen observable sequences.
- /// </summary>
- /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
- /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
- /// <typeparam name="TSource3">The type of the elements in the third source sequence.</typeparam>
- /// <typeparam name="TSource4">The type of the elements in the fourth source sequence.</typeparam>
- /// <typeparam name="TSource5">The type of the elements in the fifth source sequence.</typeparam>
- /// <typeparam name="TSource6">The type of the elements in the sixth source sequence.</typeparam>
- /// <typeparam name="TSource7">The type of the elements in the seventh source sequence.</typeparam>
- /// <typeparam name="TSource8">The type of the elements in the eighth source sequence.</typeparam>
- /// <typeparam name="TSource9">The type of the elements in the ninth source sequence.</typeparam>
- /// <typeparam name="TSource10">The type of the elements in the tenth source sequence.</typeparam>
- /// <typeparam name="TSource11">The type of the elements in the eleventh source sequence.</typeparam>
- /// <typeparam name="TSource12">The type of the elements in the twelfth source sequence.</typeparam>
- /// <typeparam name="TSource13">The type of the elements in the thirteenth source sequence.</typeparam>
- /// <typeparam name="TSource14">The type of the elements in the fourteenth source sequence.</typeparam>
- /// <typeparam name="TSource15">The type of the elements in the fifteenth source sequence.</typeparam>
- /// <typeparam name="TSource16">The type of the elements in the sixteenth source sequence.</typeparam>
- public class Pattern<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TSource14, TSource15, TSource16> : Pattern
- {
- internal Pattern(IObservable<TSource1> first, IObservable<TSource2> second, IObservable<TSource3> third, IObservable<TSource4> fourth, IObservable<TSource5> fifth, IObservable<TSource6> sixth, IObservable<TSource7> seventh, IObservable<TSource8> eighth, IObservable<TSource9> ninth, IObservable<TSource10> tenth, IObservable<TSource11> eleventh, IObservable<TSource12> twelfth, IObservable<TSource13> thirteenth, IObservable<TSource14> fourteenth, IObservable<TSource15> fifteenth, IObservable<TSource16> sixteenth)
- {
- First = first;
- Second = second;
- Third = third;
- Fourth = fourth;
- Fifth = fifth;
- Sixth = sixth;
- Seventh = seventh;
- Eighth = eighth;
- Ninth = ninth;
- Tenth = tenth;
- Eleventh = eleventh;
- Twelfth = twelfth;
- Thirteenth = thirteenth;
- Fourteenth = fourteenth;
- Fifteenth = fifteenth;
- Sixteenth = sixteenth;
- }
-
- internal IObservable<TSource1> First { get; private set; }
- internal IObservable<TSource2> Second { get; private set; }
- internal IObservable<TSource3> Third { get; private set; }
- internal IObservable<TSource4> Fourth { get; private set; }
- internal IObservable<TSource5> Fifth { get; private set; }
- internal IObservable<TSource6> Sixth { get; private set; }
- internal IObservable<TSource7> Seventh { get; private set; }
- internal IObservable<TSource8> Eighth { get; private set; }
- internal IObservable<TSource9> Ninth { get; private set; }
- internal IObservable<TSource10> Tenth { get; private set; }
- internal IObservable<TSource11> Eleventh { get; private set; }
- internal IObservable<TSource12> Twelfth { get; private set; }
- internal IObservable<TSource13> Thirteenth { get; private set; }
- internal IObservable<TSource14> Fourteenth { get; private set; }
- internal IObservable<TSource15> Fifteenth { get; private set; }
- internal IObservable<TSource16> Sixteenth { get; private set; }
-
- /// <summary>
- /// Matches when all observable sequences have an available element and projects the elements by invoking the selector function.
- /// </summary>
- /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
- /// <param name="selector">Selector that will be invoked for elements in the source sequences.</param>
- /// <returns>Plan that produces the projected results, to be fed (with other plans) to the When operator.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="selector"/> is null.</exception>
- public Plan<TResult> Then<TResult>(Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TSource14, TSource15, TSource16, TResult> selector)
- {
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return new Plan<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TSource14, TSource15, TSource16, TResult>(this, selector);
- }
-
- }
-
-#endif
-
- #endregion
-} \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Joins/Plan.cs b/Rx.NET/System.Reactive.Linq/Reactive/Joins/Plan.cs
deleted file mode 100644
index 2c27a60..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Joins/Plan.cs
+++ /dev/null
@@ -1,1169 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System.Collections.Generic;
-
-namespace System.Reactive.Joins
-{
- /// <summary>
- /// Represents an execution plan for join patterns.
- /// </summary>
- /// <typeparam name="TResult">The type of the results produced by the plan.</typeparam>
- public abstract class Plan<TResult>
- {
- internal Plan()
- {
- }
-
- internal abstract ActivePlan Activate(Dictionary<object, IJoinObserver> externalSubscriptions,
- IObserver<TResult> observer, Action<ActivePlan> deactivate);
-
- internal static JoinObserver<TSource> CreateObserver<TSource>(
- Dictionary<object, IJoinObserver> externalSubscriptions, IObservable<TSource> observable, Action<Exception> onError)
- {
- var observer = default(JoinObserver<TSource>);
- var nonGeneric = default(IJoinObserver);
- if (!externalSubscriptions.TryGetValue(observable, out nonGeneric))
- {
- observer = new JoinObserver<TSource>(observable, onError);
- externalSubscriptions.Add(observable, observer);
- }
- else
- {
- observer = (JoinObserver<TSource>) nonGeneric;
- }
- return observer;
- }
- }
-
- internal class Plan<T1, TResult> : Plan<TResult>
- {
- internal Pattern<T1> Expression { get; private set; }
-
- internal Func<T1, TResult> Selector { get; private set; }
-
- internal Plan(Pattern<T1> expression, Func<T1, TResult> selector)
- {
- Expression = expression;
- Selector = selector;
- }
-
- internal override ActivePlan Activate(Dictionary<object, IJoinObserver> externalSubscriptions,
- IObserver<TResult> observer, Action<ActivePlan> deactivate)
- {
- var onError = new Action<Exception>(observer.OnError);
- var firstJoinObserver = CreateObserver(externalSubscriptions, Expression.First, onError);
- var activePlan = default(ActivePlan<T1>);
-
- activePlan = new ActivePlan<T1>(firstJoinObserver,
- first =>
- {
- var result = default(TResult);
- try
- {
- result = Selector(first);
- }
- catch (Exception exception)
- {
- observer.OnError(exception);
- return;
- }
- observer.OnNext(result);
- },
- () =>
- {
- firstJoinObserver.RemoveActivePlan(activePlan);
- deactivate(activePlan);
- });
-
- firstJoinObserver.AddActivePlan(activePlan);
- return activePlan;
- }
- }
-
- internal class Plan<T1, T2, TResult> : Plan<TResult>
- {
- internal Pattern<T1, T2> Expression { get; private set; }
-
- internal Func<T1, T2, TResult> Selector { get; private set; }
-
- internal Plan(Pattern<T1, T2> expression, Func<T1, T2, TResult> selector)
- {
- Expression = expression;
- Selector = selector;
- }
-
- internal override ActivePlan Activate(Dictionary<object, IJoinObserver> externalSubscriptions,
- IObserver<TResult> observer, Action<ActivePlan> deactivate)
- {
- var onError = new Action<Exception>(observer.OnError);
- var firstJoinObserver = CreateObserver(externalSubscriptions, Expression.First, onError);
- var secondJoinObserver = CreateObserver(externalSubscriptions, Expression.Second, onError);
- var activePlan = default(ActivePlan<T1, T2>);
-
- activePlan = new ActivePlan<T1, T2>(firstJoinObserver, secondJoinObserver,
- (first, second) =>
- {
- var result = default(TResult);
- try
- {
- result = Selector(first, second);
- }
- catch (Exception exception)
- {
- observer.OnError(exception);
- return;
- }
- observer.OnNext(result);
- },
- () =>
- {
- firstJoinObserver.RemoveActivePlan(activePlan);
- secondJoinObserver.RemoveActivePlan(activePlan);
- deactivate(activePlan);
- });
-
- firstJoinObserver.AddActivePlan(activePlan);
- secondJoinObserver.AddActivePlan(activePlan);
- return activePlan;
- }
- }
-
- internal class Plan<T1, T2, T3, TResult> : Plan<TResult>
- {
- internal Pattern<T1, T2, T3> Expression { get; private set; }
-
- internal Func<T1, T2, T3, TResult> Selector { get; private set; }
-
- internal Plan(Pattern<T1, T2, T3> expression, Func<T1, T2, T3, TResult> selector)
- {
- Expression = expression;
- Selector = selector;
- }
-
-
- internal override ActivePlan Activate(Dictionary<object, IJoinObserver> externalSubscriptions,
- IObserver<TResult> observer, Action<ActivePlan> deactivate)
- {
- var onError = new Action<Exception>(observer.OnError);
- var firstJoinObserver = CreateObserver(externalSubscriptions, Expression.First, onError);
- var secondJoinObserver = CreateObserver(externalSubscriptions, Expression.Second, onError);
- var thirdJoinObserver = CreateObserver(externalSubscriptions, Expression.Third, onError);
- var activePlan = default(ActivePlan<T1, T2, T3>);
-
- activePlan = new ActivePlan<T1, T2, T3>(firstJoinObserver, secondJoinObserver, thirdJoinObserver,
- (first, second, third) =>
- {
- var result = default(TResult);
- try
- {
- result = Selector(first, second, third);
- }
- catch (Exception exception)
- {
- observer.OnError(exception);
- return;
- }
- observer.OnNext(result);
- },
- () =>
- {
- firstJoinObserver.RemoveActivePlan(activePlan);
- secondJoinObserver.RemoveActivePlan(activePlan);
- thirdJoinObserver.RemoveActivePlan(activePlan);
- deactivate(activePlan);
- });
-
- firstJoinObserver.AddActivePlan(activePlan);
- secondJoinObserver.AddActivePlan(activePlan);
- thirdJoinObserver.AddActivePlan(activePlan);
- return activePlan;
- }
- }
-
- internal class Plan<T1, T2, T3, T4, TResult> : Plan<TResult>
- {
- internal Pattern<T1, T2, T3, T4> Expression { get; private set; }
-
- internal Func<T1, T2, T3, T4, TResult> Selector { get; private set; }
-
- internal Plan(Pattern<T1, T2, T3, T4> expression,
- Func<T1, T2, T3, T4, TResult> selector)
- {
- Expression = expression;
- Selector = selector;
- }
-
- internal override ActivePlan Activate(Dictionary<object, IJoinObserver> externalSubscriptions,
- IObserver<TResult> observer, Action<ActivePlan> deactivate)
- {
- var onError = new Action<Exception>(observer.OnError);
- var firstJoinObserver = CreateObserver(externalSubscriptions, Expression.First, onError);
- var secondJoinObserver = CreateObserver(externalSubscriptions, Expression.Second, onError);
- var thirdJoinObserver = CreateObserver(externalSubscriptions, Expression.Third, onError);
- var fourthJoinObserver = CreateObserver(externalSubscriptions, Expression.Fourth, onError);
- var activePlan = default(ActivePlan<T1, T2, T3, T4>);
-
- activePlan = new ActivePlan<T1, T2, T3, T4>(firstJoinObserver, secondJoinObserver, thirdJoinObserver, fourthJoinObserver,
- (first, second, third, fourth) =>
- {
- var result = default(TResult);
- try
- {
- result = Selector(first, second, third, fourth);
- }
- catch (Exception exception)
- {
- observer.OnError(exception);
- return;
- }
- observer.OnNext(result);
- },
- () =>
- {
- firstJoinObserver.RemoveActivePlan(activePlan);
- secondJoinObserver.RemoveActivePlan(activePlan);
- thirdJoinObserver.RemoveActivePlan(activePlan);
- fourthJoinObserver.RemoveActivePlan(activePlan);
- deactivate(activePlan);
- });
-
- firstJoinObserver.AddActivePlan(activePlan);
- secondJoinObserver.AddActivePlan(activePlan);
- thirdJoinObserver.AddActivePlan(activePlan);
- fourthJoinObserver.AddActivePlan(activePlan);
- return activePlan;
- }
- }
-
-#if !NO_LARGEARITY
- internal class Plan<T1, T2, T3, T4, T5, TResult> : Plan<TResult>
- {
- internal Pattern<T1, T2, T3, T4, T5> Expression { get; private set; }
-
- internal Func<T1, T2, T3, T4, T5, TResult> Selector { get; private set; }
-
- internal Plan(Pattern<T1, T2, T3, T4, T5> expression,
- Func<T1, T2, T3, T4, T5, TResult> selector)
- {
- Expression = expression;
- Selector = selector;
- }
-
- internal override ActivePlan Activate(Dictionary<object, IJoinObserver> externalSubscriptions,
- IObserver<TResult> observer, Action<ActivePlan> deactivate)
- {
- var onError = new Action<Exception>(observer.OnError);
- var firstJoinObserver = CreateObserver(externalSubscriptions, Expression.First, onError);
- var secondJoinObserver = CreateObserver(externalSubscriptions, Expression.Second, onError);
- var thirdJoinObserver = CreateObserver(externalSubscriptions, Expression.Third, onError);
- var fourthJoinObserver = CreateObserver(externalSubscriptions, Expression.Fourth, onError);
- var fifthJoinObserver = CreateObserver(externalSubscriptions, Expression.Fifth, onError);
- var activePlan = default(ActivePlan<T1, T2, T3, T4, T5>);
-
- activePlan = new ActivePlan<T1, T2, T3, T4, T5>(firstJoinObserver, secondJoinObserver, thirdJoinObserver, fourthJoinObserver, fifthJoinObserver,
- (first, second, third, fourth, fifth) =>
- {
- var result = default(TResult);
- try
- {
- result = Selector(first, second, third, fourth, fifth);
- }
- catch (Exception exception)
- {
- observer.OnError(exception);
- return;
- }
- observer.OnNext(result);
- },
- () =>
- {
- firstJoinObserver.RemoveActivePlan(activePlan);
- secondJoinObserver.RemoveActivePlan(activePlan);
- thirdJoinObserver.RemoveActivePlan(activePlan);
- fourthJoinObserver.RemoveActivePlan(activePlan);
- fifthJoinObserver.RemoveActivePlan(activePlan);
- deactivate(activePlan);
- });
-
- firstJoinObserver.AddActivePlan(activePlan);
- secondJoinObserver.AddActivePlan(activePlan);
- thirdJoinObserver.AddActivePlan(activePlan);
- fourthJoinObserver.AddActivePlan(activePlan);
- fifthJoinObserver.AddActivePlan(activePlan);
- return activePlan;
- }
- }
-
- internal class Plan<T1, T2, T3, T4, T5, T6, TResult> : Plan<TResult>
- {
- internal Pattern<T1, T2, T3, T4, T5, T6> Expression { get; private set; }
-
- internal Func<T1, T2, T3, T4, T5, T6, TResult> Selector { get; private set; }
-
- internal Plan(Pattern<T1, T2, T3, T4, T5, T6> expression,
- Func<T1, T2, T3, T4, T5, T6, TResult> selector)
- {
- Expression = expression;
- Selector = selector;
- }
-
- internal override ActivePlan Activate(Dictionary<object, IJoinObserver> externalSubscriptions,
- IObserver<TResult> observer, Action<ActivePlan> deactivate)
- {
- var onError = new Action<Exception>(observer.OnError);
- var firstJoinObserver = CreateObserver(externalSubscriptions, Expression.First, onError);
- var secondJoinObserver = CreateObserver(externalSubscriptions, Expression.Second, onError);
- var thirdJoinObserver = CreateObserver(externalSubscriptions, Expression.Third, onError);
- var fourthJoinObserver = CreateObserver(externalSubscriptions, Expression.Fourth, onError);
- var fifthJoinObserver = CreateObserver(externalSubscriptions, Expression.Fifth, onError);
- var sixthJoinObserver = CreateObserver(externalSubscriptions, Expression.Sixth, onError);
- var activePlan = default(ActivePlan<T1, T2, T3, T4, T5, T6>);
-
- activePlan = new ActivePlan<T1, T2, T3, T4, T5, T6>(firstJoinObserver, secondJoinObserver, thirdJoinObserver,
- fourthJoinObserver, fifthJoinObserver, sixthJoinObserver,
- (first, second, third, fourth, fifth, sixth) =>
- {
- var result = default(TResult);
- try
- {
- result = Selector(first, second, third, fourth, fifth, sixth);
- }
- catch (Exception exception)
- {
- observer.OnError(exception);
- return;
- }
- observer.OnNext(result);
- },
- () =>
- {
- firstJoinObserver.RemoveActivePlan(activePlan);
- secondJoinObserver.RemoveActivePlan(activePlan);
- thirdJoinObserver.RemoveActivePlan(activePlan);
- fourthJoinObserver.RemoveActivePlan(activePlan);
- fifthJoinObserver.RemoveActivePlan(activePlan);
- sixthJoinObserver.RemoveActivePlan(activePlan);
- deactivate(activePlan);
- });
-
- firstJoinObserver.AddActivePlan(activePlan);
- secondJoinObserver.AddActivePlan(activePlan);
- thirdJoinObserver.AddActivePlan(activePlan);
- fourthJoinObserver.AddActivePlan(activePlan);
- fifthJoinObserver.AddActivePlan(activePlan);
- sixthJoinObserver.AddActivePlan(activePlan);
- return activePlan;
- }
- }
-
- internal class Plan<T1, T2, T3, T4, T5, T6, T7, TResult> : Plan<TResult>
- {
- internal Pattern<T1, T2, T3, T4, T5, T6, T7> Expression { get; private set; }
-
- internal Func<T1, T2, T3, T4, T5, T6, T7, TResult> Selector { get; private set; }
-
- internal Plan(Pattern<T1, T2, T3, T4, T5, T6, T7> expression,
- Func<T1, T2, T3, T4, T5, T6, T7, TResult> selector)
- {
- Expression = expression;
- Selector = selector;
- }
-
- internal override ActivePlan Activate(Dictionary<object, IJoinObserver> externalSubscriptions,
- IObserver<TResult> observer, Action<ActivePlan> deactivate)
- {
- var onError = new Action<Exception>(observer.OnError);
- var firstJoinObserver = CreateObserver(externalSubscriptions, Expression.First, onError);
- var secondJoinObserver = CreateObserver(externalSubscriptions, Expression.Second, onError);
- var thirdJoinObserver = CreateObserver(externalSubscriptions, Expression.Third, onError);
- var fourthJoinObserver = CreateObserver(externalSubscriptions, Expression.Fourth, onError);
- var fifthJoinObserver = CreateObserver(externalSubscriptions, Expression.Fifth, onError);
- var sixthJoinObserver = CreateObserver(externalSubscriptions, Expression.Sixth, onError);
- var seventhJoinObserver = CreateObserver(externalSubscriptions, Expression.Seventh, onError);
- var activePlan = default(ActivePlan<T1, T2, T3, T4, T5, T6, T7>);
-
- activePlan = new ActivePlan<T1, T2, T3, T4, T5, T6, T7>(firstJoinObserver, secondJoinObserver, thirdJoinObserver,
- fourthJoinObserver, fifthJoinObserver, sixthJoinObserver, seventhJoinObserver,
- (first, second, third, fourth, fifth, sixth, seventh) =>
- {
- var result = default(TResult);
- try
- {
- result = Selector(first, second, third, fourth, fifth, sixth, seventh);
- }
- catch (Exception exception)
- {
- observer.OnError(exception);
- return;
- }
- observer.OnNext(result);
- },
- () =>
- {
- firstJoinObserver.RemoveActivePlan(activePlan);
- secondJoinObserver.RemoveActivePlan(activePlan);
- thirdJoinObserver.RemoveActivePlan(activePlan);
- fourthJoinObserver.RemoveActivePlan(activePlan);
- fifthJoinObserver.RemoveActivePlan(activePlan);
- sixthJoinObserver.RemoveActivePlan(activePlan);
- seventhJoinObserver.RemoveActivePlan(activePlan);
- deactivate(activePlan);
- });
-
- firstJoinObserver.AddActivePlan(activePlan);
- secondJoinObserver.AddActivePlan(activePlan);
- thirdJoinObserver.AddActivePlan(activePlan);
- fourthJoinObserver.AddActivePlan(activePlan);
- fifthJoinObserver.AddActivePlan(activePlan);
- sixthJoinObserver.AddActivePlan(activePlan);
- seventhJoinObserver.AddActivePlan(activePlan);
- return activePlan;
- }
- }
-
- internal class Plan<T1, T2, T3, T4, T5, T6, T7, T8, TResult> : Plan<TResult>
- {
- internal Pattern<T1, T2, T3, T4, T5, T6, T7, T8> Expression { get; private set; }
-
- internal Func<T1, T2, T3, T4, T5, T6, T7, T8, TResult> Selector { get; private set; }
-
- internal Plan(Pattern<T1, T2, T3, T4, T5, T6, T7, T8> expression,
- Func<T1, T2, T3, T4, T5, T6, T7, T8, TResult> selector)
- {
- Expression = expression;
- Selector = selector;
- }
-
- internal override ActivePlan Activate(Dictionary<object, IJoinObserver> externalSubscriptions,
- IObserver<TResult> observer, Action<ActivePlan> deactivate)
- {
- var onError = new Action<Exception>(observer.OnError);
- var firstJoinObserver = CreateObserver(externalSubscriptions, Expression.First, onError);
- var secondJoinObserver = CreateObserver(externalSubscriptions, Expression.Second, onError);
- var thirdJoinObserver = CreateObserver(externalSubscriptions, Expression.Third, onError);
- var fourthJoinObserver = CreateObserver(externalSubscriptions, Expression.Fourth, onError);
- var fifthJoinObserver = CreateObserver(externalSubscriptions, Expression.Fifth, onError);
- var sixthJoinObserver = CreateObserver(externalSubscriptions, Expression.Sixth, onError);
- var seventhJoinObserver = CreateObserver(externalSubscriptions, Expression.Seventh, onError);
- var eighthJoinObserver = CreateObserver(externalSubscriptions, Expression.Eighth, onError);
- var activePlan = default(ActivePlan<T1, T2, T3, T4, T5, T6, T7, T8>);
-
- activePlan = new ActivePlan<T1, T2, T3, T4, T5, T6, T7, T8>(firstJoinObserver, secondJoinObserver, thirdJoinObserver,
- fourthJoinObserver, fifthJoinObserver, sixthJoinObserver, seventhJoinObserver, eighthJoinObserver,
- (first, second, third, fourth, fifth, sixth, seventh, eighth) =>
- {
- var result = default(TResult);
- try
- {
- result = Selector(first, second, third, fourth, fifth, sixth, seventh, eighth);
- }
- catch (Exception exception)
- {
- observer.OnError(exception);
- return;
- }
- observer.OnNext(result);
- },
- () =>
- {
- firstJoinObserver.RemoveActivePlan(activePlan);
- secondJoinObserver.RemoveActivePlan(activePlan);
- thirdJoinObserver.RemoveActivePlan(activePlan);
- fourthJoinObserver.RemoveActivePlan(activePlan);
- fifthJoinObserver.RemoveActivePlan(activePlan);
- sixthJoinObserver.RemoveActivePlan(activePlan);
- seventhJoinObserver.RemoveActivePlan(activePlan);
- eighthJoinObserver.RemoveActivePlan(activePlan);
- deactivate(activePlan);
- });
-
- firstJoinObserver.AddActivePlan(activePlan);
- secondJoinObserver.AddActivePlan(activePlan);
- thirdJoinObserver.AddActivePlan(activePlan);
- fourthJoinObserver.AddActivePlan(activePlan);
- fifthJoinObserver.AddActivePlan(activePlan);
- sixthJoinObserver.AddActivePlan(activePlan);
- seventhJoinObserver.AddActivePlan(activePlan);
- eighthJoinObserver.AddActivePlan(activePlan);
- return activePlan;
- }
- }
-
- internal class Plan<T1, T2, T3, T4, T5, T6, T7, T8, T9, TResult> : Plan<TResult>
- {
- internal Pattern<T1, T2, T3, T4, T5, T6, T7, T8, T9> Expression { get; private set; }
-
- internal Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, TResult> Selector { get; private set; }
-
- internal Plan(Pattern<T1, T2, T3, T4, T5, T6, T7, T8, T9> expression,
- Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, TResult> selector)
- {
- Expression = expression;
- Selector = selector;
- }
-
- internal override ActivePlan Activate(Dictionary<object, IJoinObserver> externalSubscriptions,
- IObserver<TResult> observer, Action<ActivePlan> deactivate)
- {
- var onError = new Action<Exception>(observer.OnError);
- var firstJoinObserver = CreateObserver(externalSubscriptions, Expression.First, onError);
- var secondJoinObserver = CreateObserver(externalSubscriptions, Expression.Second, onError);
- var thirdJoinObserver = CreateObserver(externalSubscriptions, Expression.Third, onError);
- var fourthJoinObserver = CreateObserver(externalSubscriptions, Expression.Fourth, onError);
- var fifthJoinObserver = CreateObserver(externalSubscriptions, Expression.Fifth, onError);
- var sixthJoinObserver = CreateObserver(externalSubscriptions, Expression.Sixth, onError);
- var seventhJoinObserver = CreateObserver(externalSubscriptions, Expression.Seventh, onError);
- var eighthJoinObserver = CreateObserver(externalSubscriptions, Expression.Eighth, onError);
- var ninthJoinObserver = CreateObserver(externalSubscriptions, Expression.Ninth, onError);
- var activePlan = default(ActivePlan<T1, T2, T3, T4, T5, T6, T7, T8, T9>);
-
- activePlan = new ActivePlan<T1, T2, T3, T4, T5, T6, T7, T8, T9>(firstJoinObserver, secondJoinObserver, thirdJoinObserver,
- fourthJoinObserver, fifthJoinObserver, sixthJoinObserver, seventhJoinObserver, eighthJoinObserver, ninthJoinObserver,
- (first, second, third, fourth, fifth, sixth, seventh, eighth, ninth) =>
- {
- var result = default(TResult);
- try
- {
- result = Selector(first, second, third, fourth, fifth, sixth, seventh, eighth, ninth);
- }
- catch (Exception exception)
- {
- observer.OnError(exception);
- return;
- }
- observer.OnNext(result);
- },
- () =>
- {
- firstJoinObserver.RemoveActivePlan(activePlan);
- secondJoinObserver.RemoveActivePlan(activePlan);
- thirdJoinObserver.RemoveActivePlan(activePlan);
- fourthJoinObserver.RemoveActivePlan(activePlan);
- fifthJoinObserver.RemoveActivePlan(activePlan);
- sixthJoinObserver.RemoveActivePlan(activePlan);
- seventhJoinObserver.RemoveActivePlan(activePlan);
- eighthJoinObserver.RemoveActivePlan(activePlan);
- ninthJoinObserver.RemoveActivePlan(activePlan);
- deactivate(activePlan);
- });
-
- firstJoinObserver.AddActivePlan(activePlan);
- secondJoinObserver.AddActivePlan(activePlan);
- thirdJoinObserver.AddActivePlan(activePlan);
- fourthJoinObserver.AddActivePlan(activePlan);
- fifthJoinObserver.AddActivePlan(activePlan);
- sixthJoinObserver.AddActivePlan(activePlan);
- seventhJoinObserver.AddActivePlan(activePlan);
- eighthJoinObserver.AddActivePlan(activePlan);
- ninthJoinObserver.AddActivePlan(activePlan);
- return activePlan;
- }
- }
-
- internal class Plan<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, TResult> : Plan<TResult>
- {
- internal Pattern<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> Expression { get; private set; }
-
- internal Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, TResult> Selector { get; private set; }
-
- internal Plan(Pattern<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> expression,
- Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, TResult> selector)
- {
- Expression = expression;
- Selector = selector;
- }
-
- internal override ActivePlan Activate(Dictionary<object, IJoinObserver> externalSubscriptions,
- IObserver<TResult> observer, Action<ActivePlan> deactivate)
- {
- var onError = new Action<Exception>(observer.OnError);
- var firstJoinObserver = CreateObserver(externalSubscriptions, Expression.First, onError);
- var secondJoinObserver = CreateObserver(externalSubscriptions, Expression.Second, onError);
- var thirdJoinObserver = CreateObserver(externalSubscriptions, Expression.Third, onError);
- var fourthJoinObserver = CreateObserver(externalSubscriptions, Expression.Fourth, onError);
- var fifthJoinObserver = CreateObserver(externalSubscriptions, Expression.Fifth, onError);
- var sixthJoinObserver = CreateObserver(externalSubscriptions, Expression.Sixth, onError);
- var seventhJoinObserver = CreateObserver(externalSubscriptions, Expression.Seventh, onError);
- var eighthJoinObserver = CreateObserver(externalSubscriptions, Expression.Eighth, onError);
- var ninthJoinObserver = CreateObserver(externalSubscriptions, Expression.Ninth, onError);
- var tenthJoinObserver = CreateObserver(externalSubscriptions, Expression.Tenth, onError);
- var activePlan = default(ActivePlan<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>);
-
- activePlan = new ActivePlan<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(firstJoinObserver, secondJoinObserver, thirdJoinObserver,
- fourthJoinObserver, fifthJoinObserver, sixthJoinObserver, seventhJoinObserver, eighthJoinObserver, ninthJoinObserver, tenthJoinObserver,
- (first, second, third, fourth, fifth, sixth, seventh, eighth, ninth, tenth) =>
- {
- var result = default(TResult);
- try
- {
- result = Selector(first, second, third, fourth, fifth, sixth, seventh, eighth, ninth, tenth);
- }
- catch (Exception exception)
- {
- observer.OnError(exception);
- return;
- }
- observer.OnNext(result);
- },
- () =>
- {
- firstJoinObserver.RemoveActivePlan(activePlan);
- secondJoinObserver.RemoveActivePlan(activePlan);
- thirdJoinObserver.RemoveActivePlan(activePlan);
- fourthJoinObserver.RemoveActivePlan(activePlan);
- fifthJoinObserver.RemoveActivePlan(activePlan);
- sixthJoinObserver.RemoveActivePlan(activePlan);
- seventhJoinObserver.RemoveActivePlan(activePlan);
- eighthJoinObserver.RemoveActivePlan(activePlan);
- ninthJoinObserver.RemoveActivePlan(activePlan);
- tenthJoinObserver.RemoveActivePlan(activePlan);
- deactivate(activePlan);
- });
-
- firstJoinObserver.AddActivePlan(activePlan);
- secondJoinObserver.AddActivePlan(activePlan);
- thirdJoinObserver.AddActivePlan(activePlan);
- fourthJoinObserver.AddActivePlan(activePlan);
- fifthJoinObserver.AddActivePlan(activePlan);
- sixthJoinObserver.AddActivePlan(activePlan);
- seventhJoinObserver.AddActivePlan(activePlan);
- eighthJoinObserver.AddActivePlan(activePlan);
- ninthJoinObserver.AddActivePlan(activePlan);
- tenthJoinObserver.AddActivePlan(activePlan);
- return activePlan;
- }
- }
-
- internal class Plan<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, TResult> : Plan<TResult>
- {
- internal Pattern<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> Expression { get; private set; }
-
- internal Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, TResult> Selector { get; private set; }
-
- internal Plan(Pattern<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> expression,
- Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, TResult> selector)
- {
- Expression = expression;
- Selector = selector;
- }
-
- internal override ActivePlan Activate(Dictionary<object, IJoinObserver> externalSubscriptions,
- IObserver<TResult> observer, Action<ActivePlan> deactivate)
- {
- var onError = new Action<Exception>(observer.OnError);
- var firstJoinObserver = CreateObserver(externalSubscriptions, Expression.First, onError);
- var secondJoinObserver = CreateObserver(externalSubscriptions, Expression.Second, onError);
- var thirdJoinObserver = CreateObserver(externalSubscriptions, Expression.Third, onError);
- var fourthJoinObserver = CreateObserver(externalSubscriptions, Expression.Fourth, onError);
- var fifthJoinObserver = CreateObserver(externalSubscriptions, Expression.Fifth, onError);
- var sixthJoinObserver = CreateObserver(externalSubscriptions, Expression.Sixth, onError);
- var seventhJoinObserver = CreateObserver(externalSubscriptions, Expression.Seventh, onError);
- var eighthJoinObserver = CreateObserver(externalSubscriptions, Expression.Eighth, onError);
- var ninthJoinObserver = CreateObserver(externalSubscriptions, Expression.Ninth, onError);
- var tenthJoinObserver = CreateObserver(externalSubscriptions, Expression.Tenth, onError);
- var eleventhJoinObserver = CreateObserver(externalSubscriptions, Expression.Eleventh, onError);
-
- var activePlan = default(ActivePlan<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>);
-
- activePlan = new ActivePlan<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>(firstJoinObserver, secondJoinObserver, thirdJoinObserver,
- fourthJoinObserver, fifthJoinObserver, sixthJoinObserver, seventhJoinObserver, eighthJoinObserver, ninthJoinObserver, tenthJoinObserver,eleventhJoinObserver,
- (first, second, third, fourth, fifth, sixth, seventh, eighth, ninth, tenth, eleventh) =>
- {
- var result = default(TResult);
- try
- {
- result = Selector(first, second, third, fourth, fifth, sixth, seventh, eighth, ninth, tenth, eleventh);
- }
- catch (Exception exception)
- {
- observer.OnError(exception);
- return;
- }
- observer.OnNext(result);
- },
- () =>
- {
- firstJoinObserver.RemoveActivePlan(activePlan);
- secondJoinObserver.RemoveActivePlan(activePlan);
- thirdJoinObserver.RemoveActivePlan(activePlan);
- fourthJoinObserver.RemoveActivePlan(activePlan);
- fifthJoinObserver.RemoveActivePlan(activePlan);
- sixthJoinObserver.RemoveActivePlan(activePlan);
- seventhJoinObserver.RemoveActivePlan(activePlan);
- eighthJoinObserver.RemoveActivePlan(activePlan);
- ninthJoinObserver.RemoveActivePlan(activePlan);
- tenthJoinObserver.RemoveActivePlan(activePlan);
- eleventhJoinObserver.RemoveActivePlan(activePlan);
- deactivate(activePlan);
- });
-
- firstJoinObserver.AddActivePlan(activePlan);
- secondJoinObserver.AddActivePlan(activePlan);
- thirdJoinObserver.AddActivePlan(activePlan);
- fourthJoinObserver.AddActivePlan(activePlan);
- fifthJoinObserver.AddActivePlan(activePlan);
- sixthJoinObserver.AddActivePlan(activePlan);
- seventhJoinObserver.AddActivePlan(activePlan);
- eighthJoinObserver.AddActivePlan(activePlan);
- ninthJoinObserver.AddActivePlan(activePlan);
- tenthJoinObserver.AddActivePlan(activePlan);
- eleventhJoinObserver.AddActivePlan(activePlan);
- return activePlan;
- }
- }
-
- internal class Plan<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, TResult> : Plan<TResult>
- {
- internal Pattern<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> Expression { get; private set; }
-
- internal Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, TResult> Selector { get; private set; }
-
- internal Plan(Pattern<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> expression,
- Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, TResult> selector)
- {
- Expression = expression;
- Selector = selector;
- }
-
- internal override ActivePlan Activate(Dictionary<object, IJoinObserver> externalSubscriptions,
- IObserver<TResult> observer, Action<ActivePlan> deactivate)
- {
- var onError = new Action<Exception>(observer.OnError);
- var firstJoinObserver = CreateObserver(externalSubscriptions, Expression.First, onError);
- var secondJoinObserver = CreateObserver(externalSubscriptions, Expression.Second, onError);
- var thirdJoinObserver = CreateObserver(externalSubscriptions, Expression.Third, onError);
- var fourthJoinObserver = CreateObserver(externalSubscriptions, Expression.Fourth, onError);
- var fifthJoinObserver = CreateObserver(externalSubscriptions, Expression.Fifth, onError);
- var sixthJoinObserver = CreateObserver(externalSubscriptions, Expression.Sixth, onError);
- var seventhJoinObserver = CreateObserver(externalSubscriptions, Expression.Seventh, onError);
- var eighthJoinObserver = CreateObserver(externalSubscriptions, Expression.Eighth, onError);
- var ninthJoinObserver = CreateObserver(externalSubscriptions, Expression.Ninth, onError);
- var tenthJoinObserver = CreateObserver(externalSubscriptions, Expression.Tenth, onError);
- var eleventhJoinObserver = CreateObserver(externalSubscriptions, Expression.Eleventh, onError);
- var twelfthJoinObserver = CreateObserver(externalSubscriptions, Expression.Twelfth, onError);
-
- var activePlan = default(ActivePlan<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>);
-
- activePlan = new ActivePlan<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>(firstJoinObserver, secondJoinObserver, thirdJoinObserver,
- fourthJoinObserver, fifthJoinObserver, sixthJoinObserver, seventhJoinObserver, eighthJoinObserver, ninthJoinObserver, tenthJoinObserver, eleventhJoinObserver,
- twelfthJoinObserver,
- (first, second, third, fourth, fifth, sixth, seventh, eighth, ninth, tenth, eleventh, twelfth) =>
- {
- var result = default(TResult);
- try
- {
- result = Selector(first, second, third, fourth, fifth, sixth, seventh, eighth, ninth, tenth, eleventh, twelfth);
- }
- catch (Exception exception)
- {
- observer.OnError(exception);
- return;
- }
- observer.OnNext(result);
- },
- () =>
- {
- firstJoinObserver.RemoveActivePlan(activePlan);
- secondJoinObserver.RemoveActivePlan(activePlan);
- thirdJoinObserver.RemoveActivePlan(activePlan);
- fourthJoinObserver.RemoveActivePlan(activePlan);
- fifthJoinObserver.RemoveActivePlan(activePlan);
- sixthJoinObserver.RemoveActivePlan(activePlan);
- seventhJoinObserver.RemoveActivePlan(activePlan);
- eighthJoinObserver.RemoveActivePlan(activePlan);
- ninthJoinObserver.RemoveActivePlan(activePlan);
- tenthJoinObserver.RemoveActivePlan(activePlan);
- eleventhJoinObserver.RemoveActivePlan(activePlan);
- twelfthJoinObserver.RemoveActivePlan(activePlan);
- deactivate(activePlan);
- });
-
- firstJoinObserver.AddActivePlan(activePlan);
- secondJoinObserver.AddActivePlan(activePlan);
- thirdJoinObserver.AddActivePlan(activePlan);
- fourthJoinObserver.AddActivePlan(activePlan);
- fifthJoinObserver.AddActivePlan(activePlan);
- sixthJoinObserver.AddActivePlan(activePlan);
- seventhJoinObserver.AddActivePlan(activePlan);
- eighthJoinObserver.AddActivePlan(activePlan);
- ninthJoinObserver.AddActivePlan(activePlan);
- tenthJoinObserver.AddActivePlan(activePlan);
- eleventhJoinObserver.AddActivePlan(activePlan);
- twelfthJoinObserver.AddActivePlan(activePlan);
- return activePlan;
- }
- }
-
-
- internal class Plan<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, TResult> : Plan<TResult>
- {
- internal Pattern<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> Expression { get; private set; }
-
- internal Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, TResult> Selector { get; private set; }
-
- internal Plan(Pattern<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> expression,
- Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, TResult> selector)
- {
- Expression = expression;
- Selector = selector;
- }
-
- internal override ActivePlan Activate(Dictionary<object, IJoinObserver> externalSubscriptions,
- IObserver<TResult> observer, Action<ActivePlan> deactivate)
- {
- var onError = new Action<Exception>(observer.OnError);
- var firstJoinObserver = CreateObserver(externalSubscriptions, Expression.First, onError);
- var secondJoinObserver = CreateObserver(externalSubscriptions, Expression.Second, onError);
- var thirdJoinObserver = CreateObserver(externalSubscriptions, Expression.Third, onError);
- var fourthJoinObserver = CreateObserver(externalSubscriptions, Expression.Fourth, onError);
- var fifthJoinObserver = CreateObserver(externalSubscriptions, Expression.Fifth, onError);
- var sixthJoinObserver = CreateObserver(externalSubscriptions, Expression.Sixth, onError);
- var seventhJoinObserver = CreateObserver(externalSubscriptions, Expression.Seventh, onError);
- var eighthJoinObserver = CreateObserver(externalSubscriptions, Expression.Eighth, onError);
- var ninthJoinObserver = CreateObserver(externalSubscriptions, Expression.Ninth, onError);
- var tenthJoinObserver = CreateObserver(externalSubscriptions, Expression.Tenth, onError);
- var eleventhJoinObserver = CreateObserver(externalSubscriptions, Expression.Eleventh, onError);
- var twelfthJoinObserver = CreateObserver(externalSubscriptions, Expression.Twelfth, onError);
- var thirteenthJoinObserver = CreateObserver(externalSubscriptions, Expression.Thirteenth, onError);
-
- var activePlan = default(ActivePlan<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>);
-
- activePlan = new ActivePlan<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>(firstJoinObserver, secondJoinObserver, thirdJoinObserver,
- fourthJoinObserver, fifthJoinObserver, sixthJoinObserver, seventhJoinObserver, eighthJoinObserver, ninthJoinObserver, tenthJoinObserver, eleventhJoinObserver,
- twelfthJoinObserver, thirteenthJoinObserver,
- (first, second, third, fourth, fifth, sixth, seventh, eighth, ninth, tenth, eleventh, twelfth, thirteenth) =>
- {
- var result = default(TResult);
- try
- {
- result = Selector(first, second, third, fourth, fifth, sixth, seventh, eighth, ninth, tenth, eleventh, twelfth, thirteenth);
- }
- catch (Exception exception)
- {
- observer.OnError(exception);
- return;
- }
- observer.OnNext(result);
- },
- () =>
- {
- firstJoinObserver.RemoveActivePlan(activePlan);
- secondJoinObserver.RemoveActivePlan(activePlan);
- thirdJoinObserver.RemoveActivePlan(activePlan);
- fourthJoinObserver.RemoveActivePlan(activePlan);
- fifthJoinObserver.RemoveActivePlan(activePlan);
- sixthJoinObserver.RemoveActivePlan(activePlan);
- seventhJoinObserver.RemoveActivePlan(activePlan);
- eighthJoinObserver.RemoveActivePlan(activePlan);
- ninthJoinObserver.RemoveActivePlan(activePlan);
- tenthJoinObserver.RemoveActivePlan(activePlan);
- eleventhJoinObserver.RemoveActivePlan(activePlan);
- twelfthJoinObserver.RemoveActivePlan(activePlan);
- thirteenthJoinObserver.RemoveActivePlan(activePlan);
- deactivate(activePlan);
- });
-
- firstJoinObserver.AddActivePlan(activePlan);
- secondJoinObserver.AddActivePlan(activePlan);
- thirdJoinObserver.AddActivePlan(activePlan);
- fourthJoinObserver.AddActivePlan(activePlan);
- fifthJoinObserver.AddActivePlan(activePlan);
- sixthJoinObserver.AddActivePlan(activePlan);
- seventhJoinObserver.AddActivePlan(activePlan);
- eighthJoinObserver.AddActivePlan(activePlan);
- ninthJoinObserver.AddActivePlan(activePlan);
- tenthJoinObserver.AddActivePlan(activePlan);
- eleventhJoinObserver.AddActivePlan(activePlan);
- twelfthJoinObserver.AddActivePlan(activePlan);
- thirteenthJoinObserver.AddActivePlan(activePlan);
- return activePlan;
- }
- }
-
-
- internal class Plan<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, TResult> : Plan<TResult>
- {
- internal Pattern<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> Expression { get; private set; }
-
- internal Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, TResult> Selector { get; private set; }
-
- internal Plan(Pattern<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> expression,
- Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, TResult> selector)
- {
- Expression = expression;
- Selector = selector;
- }
-
- internal override ActivePlan Activate(Dictionary<object, IJoinObserver> externalSubscriptions,
- IObserver<TResult> observer, Action<ActivePlan> deactivate)
- {
- var onError = new Action<Exception>(observer.OnError);
- var firstJoinObserver = CreateObserver(externalSubscriptions, Expression.First, onError);
- var secondJoinObserver = CreateObserver(externalSubscriptions, Expression.Second, onError);
- var thirdJoinObserver = CreateObserver(externalSubscriptions, Expression.Third, onError);
- var fourthJoinObserver = CreateObserver(externalSubscriptions, Expression.Fourth, onError);
- var fifthJoinObserver = CreateObserver(externalSubscriptions, Expression.Fifth, onError);
- var sixthJoinObserver = CreateObserver(externalSubscriptions, Expression.Sixth, onError);
- var seventhJoinObserver = CreateObserver(externalSubscriptions, Expression.Seventh, onError);
- var eighthJoinObserver = CreateObserver(externalSubscriptions, Expression.Eighth, onError);
- var ninthJoinObserver = CreateObserver(externalSubscriptions, Expression.Ninth, onError);
- var tenthJoinObserver = CreateObserver(externalSubscriptions, Expression.Tenth, onError);
- var eleventhJoinObserver = CreateObserver(externalSubscriptions, Expression.Eleventh, onError);
- var twelfthJoinObserver = CreateObserver(externalSubscriptions, Expression.Twelfth, onError);
- var thirteenthJoinObserver = CreateObserver(externalSubscriptions, Expression.Thirteenth, onError);
- var fourteenthJoinObserver = CreateObserver(externalSubscriptions, Expression.Fourteenth, onError);
-
- var activePlan = default(ActivePlan<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>);
-
- activePlan = new ActivePlan<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>(
- firstJoinObserver, secondJoinObserver, thirdJoinObserver,
- fourthJoinObserver, fifthJoinObserver, sixthJoinObserver,
- seventhJoinObserver, eighthJoinObserver, ninthJoinObserver,
- tenthJoinObserver, eleventhJoinObserver,
- twelfthJoinObserver, thirteenthJoinObserver,
- fourteenthJoinObserver,
- (first, second, third, fourth, fifth, sixth, seventh, eighth, ninth, tenth, eleventh, twelfth, thirteenth, fourteenth) =>
- {
- var result = default(TResult);
- try
- {
- result = Selector(first, second, third, fourth, fifth, sixth, seventh, eighth, ninth, tenth, eleventh, twelfth, thirteenth, fourteenth);
- }
- catch (Exception exception)
- {
- observer.OnError(exception);
- return;
- }
- observer.OnNext(result);
- },
- () =>
- {
- firstJoinObserver.RemoveActivePlan(activePlan);
- secondJoinObserver.RemoveActivePlan(activePlan);
- thirdJoinObserver.RemoveActivePlan(activePlan);
- fourthJoinObserver.RemoveActivePlan(activePlan);
- fifthJoinObserver.RemoveActivePlan(activePlan);
- sixthJoinObserver.RemoveActivePlan(activePlan);
- seventhJoinObserver.RemoveActivePlan(activePlan);
- eighthJoinObserver.RemoveActivePlan(activePlan);
- ninthJoinObserver.RemoveActivePlan(activePlan);
- tenthJoinObserver.RemoveActivePlan(activePlan);
- eleventhJoinObserver.RemoveActivePlan(activePlan);
- twelfthJoinObserver.RemoveActivePlan(activePlan);
- thirteenthJoinObserver.RemoveActivePlan(activePlan);
- fourteenthJoinObserver.RemoveActivePlan(activePlan);
- deactivate(activePlan);
- });
-
- firstJoinObserver.AddActivePlan(activePlan);
- secondJoinObserver.AddActivePlan(activePlan);
- thirdJoinObserver.AddActivePlan(activePlan);
- fourthJoinObserver.AddActivePlan(activePlan);
- fifthJoinObserver.AddActivePlan(activePlan);
- sixthJoinObserver.AddActivePlan(activePlan);
- seventhJoinObserver.AddActivePlan(activePlan);
- eighthJoinObserver.AddActivePlan(activePlan);
- ninthJoinObserver.AddActivePlan(activePlan);
- tenthJoinObserver.AddActivePlan(activePlan);
- eleventhJoinObserver.AddActivePlan(activePlan);
- twelfthJoinObserver.AddActivePlan(activePlan);
- thirteenthJoinObserver.AddActivePlan(activePlan);
- fourteenthJoinObserver.AddActivePlan(activePlan);
- return activePlan;
- }
- }
-
- internal class Plan<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, TResult> : Plan<TResult>
- {
- internal Pattern<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> Expression { get; private set; }
-
- internal Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, TResult> Selector { get; private set; }
-
- internal Plan(Pattern<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> expression,
- Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, TResult> selector)
- {
- Expression = expression;
- Selector = selector;
- }
-
- internal override ActivePlan Activate(Dictionary<object, IJoinObserver> externalSubscriptions,
- IObserver<TResult> observer, Action<ActivePlan> deactivate)
- {
- var onError = new Action<Exception>(observer.OnError);
- var firstJoinObserver = CreateObserver(externalSubscriptions, Expression.First, onError);
- var secondJoinObserver = CreateObserver(externalSubscriptions, Expression.Second, onError);
- var thirdJoinObserver = CreateObserver(externalSubscriptions, Expression.Third, onError);
- var fourthJoinObserver = CreateObserver(externalSubscriptions, Expression.Fourth, onError);
- var fifthJoinObserver = CreateObserver(externalSubscriptions, Expression.Fifth, onError);
- var sixthJoinObserver = CreateObserver(externalSubscriptions, Expression.Sixth, onError);
- var seventhJoinObserver = CreateObserver(externalSubscriptions, Expression.Seventh, onError);
- var eighthJoinObserver = CreateObserver(externalSubscriptions, Expression.Eighth, onError);
- var ninthJoinObserver = CreateObserver(externalSubscriptions, Expression.Ninth, onError);
- var tenthJoinObserver = CreateObserver(externalSubscriptions, Expression.Tenth, onError);
- var eleventhJoinObserver = CreateObserver(externalSubscriptions, Expression.Eleventh, onError);
- var twelfthJoinObserver = CreateObserver(externalSubscriptions, Expression.Twelfth, onError);
- var thirteenthJoinObserver = CreateObserver(externalSubscriptions, Expression.Thirteenth, onError);
- var fourteenthJoinObserver = CreateObserver(externalSubscriptions, Expression.Fourteenth, onError);
- var fifteenthJoinObserver = CreateObserver(externalSubscriptions, Expression.Fifteenth, onError);
-
- var activePlan = default(ActivePlan<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>);
-
- activePlan = new ActivePlan<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>(
- firstJoinObserver, secondJoinObserver, thirdJoinObserver,
- fourthJoinObserver, fifthJoinObserver, sixthJoinObserver,
- seventhJoinObserver, eighthJoinObserver, ninthJoinObserver,
- tenthJoinObserver, eleventhJoinObserver,
- twelfthJoinObserver, thirteenthJoinObserver,
- fourteenthJoinObserver, fifteenthJoinObserver,
- (first, second, third, fourth, fifth, sixth, seventh, eighth, ninth, tenth, eleventh, twelfth, thirteenth, fourteenth, fifteenth) =>
- {
- var result = default(TResult);
- try
- {
- result = Selector(first, second, third, fourth, fifth, sixth, seventh, eighth, ninth, tenth, eleventh, twelfth, thirteenth, fourteenth, fifteenth);
- }
- catch (Exception exception)
- {
- observer.OnError(exception);
- return;
- }
- observer.OnNext(result);
- },
- () =>
- {
- firstJoinObserver.RemoveActivePlan(activePlan);
- secondJoinObserver.RemoveActivePlan(activePlan);
- thirdJoinObserver.RemoveActivePlan(activePlan);
- fourthJoinObserver.RemoveActivePlan(activePlan);
- fifthJoinObserver.RemoveActivePlan(activePlan);
- sixthJoinObserver.RemoveActivePlan(activePlan);
- seventhJoinObserver.RemoveActivePlan(activePlan);
- eighthJoinObserver.RemoveActivePlan(activePlan);
- ninthJoinObserver.RemoveActivePlan(activePlan);
- tenthJoinObserver.RemoveActivePlan(activePlan);
- eleventhJoinObserver.RemoveActivePlan(activePlan);
- twelfthJoinObserver.RemoveActivePlan(activePlan);
- thirteenthJoinObserver.RemoveActivePlan(activePlan);
- fourteenthJoinObserver.RemoveActivePlan(activePlan);
- fifteenthJoinObserver.RemoveActivePlan(activePlan);
- deactivate(activePlan);
- });
-
- firstJoinObserver.AddActivePlan(activePlan);
- secondJoinObserver.AddActivePlan(activePlan);
- thirdJoinObserver.AddActivePlan(activePlan);
- fourthJoinObserver.AddActivePlan(activePlan);
- fifthJoinObserver.AddActivePlan(activePlan);
- sixthJoinObserver.AddActivePlan(activePlan);
- seventhJoinObserver.AddActivePlan(activePlan);
- eighthJoinObserver.AddActivePlan(activePlan);
- ninthJoinObserver.AddActivePlan(activePlan);
- tenthJoinObserver.AddActivePlan(activePlan);
- eleventhJoinObserver.AddActivePlan(activePlan);
- twelfthJoinObserver.AddActivePlan(activePlan);
- thirteenthJoinObserver.AddActivePlan(activePlan);
- fourteenthJoinObserver.AddActivePlan(activePlan);
- fifteenthJoinObserver.AddActivePlan(activePlan);
- return activePlan;
- }
- }
- internal class Plan<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, TResult> : Plan<TResult>
- {
- internal Pattern<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16> Expression { get; private set; }
-
- internal Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, TResult> Selector { get; private set; }
-
- internal Plan(Pattern<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16> expression,
- Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, TResult> selector)
- {
- Expression = expression;
- Selector = selector;
- }
-
- internal override ActivePlan Activate(Dictionary<object, IJoinObserver> externalSubscriptions,
- IObserver<TResult> observer, Action<ActivePlan> deactivate)
- {
- var onError = new Action<Exception>(observer.OnError);
- var firstJoinObserver = CreateObserver(externalSubscriptions, Expression.First, onError);
- var secondJoinObserver = CreateObserver(externalSubscriptions, Expression.Second, onError);
- var thirdJoinObserver = CreateObserver(externalSubscriptions, Expression.Third, onError);
- var fourthJoinObserver = CreateObserver(externalSubscriptions, Expression.Fourth, onError);
- var fifthJoinObserver = CreateObserver(externalSubscriptions, Expression.Fifth, onError);
- var sixthJoinObserver = CreateObserver(externalSubscriptions, Expression.Sixth, onError);
- var seventhJoinObserver = CreateObserver(externalSubscriptions, Expression.Seventh, onError);
- var eighthJoinObserver = CreateObserver(externalSubscriptions, Expression.Eighth, onError);
- var ninthJoinObserver = CreateObserver(externalSubscriptions, Expression.Ninth, onError);
- var tenthJoinObserver = CreateObserver(externalSubscriptions, Expression.Tenth, onError);
- var eleventhJoinObserver = CreateObserver(externalSubscriptions, Expression.Eleventh, onError);
- var twelfthJoinObserver = CreateObserver(externalSubscriptions, Expression.Twelfth, onError);
- var thirteenthJoinObserver = CreateObserver(externalSubscriptions, Expression.Thirteenth, onError);
- var fourteenthJoinObserver = CreateObserver(externalSubscriptions, Expression.Fourteenth, onError);
- var fifteenthJoinObserver = CreateObserver(externalSubscriptions, Expression.Fifteenth, onError);
- var sixteenthJoinObserver = CreateObserver(externalSubscriptions, Expression.Sixteenth, onError);
-
- var activePlan = default(ActivePlan<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16>);
-
- activePlan = new ActivePlan<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16>(
- firstJoinObserver, secondJoinObserver, thirdJoinObserver,
- fourthJoinObserver, fifthJoinObserver, sixthJoinObserver,
- seventhJoinObserver, eighthJoinObserver, ninthJoinObserver,
- tenthJoinObserver, eleventhJoinObserver,
- twelfthJoinObserver, thirteenthJoinObserver,
- fourteenthJoinObserver, fifteenthJoinObserver,
- sixteenthJoinObserver,
- (first, second, third, fourth, fifth, sixth, seventh, eighth, ninth, tenth, eleventh, twelfth, thirteenth, fourteenth, fifteenth, sixteenth) =>
- {
- var result = default(TResult);
- try
- {
- result = Selector(first, second, third, fourth, fifth, sixth, seventh, eighth, ninth, tenth, eleventh, twelfth, thirteenth, fourteenth, fifteenth, sixteenth);
- }
- catch (Exception exception)
- {
- observer.OnError(exception);
- return;
- }
- observer.OnNext(result);
- },
- () =>
- {
- firstJoinObserver.RemoveActivePlan(activePlan);
- secondJoinObserver.RemoveActivePlan(activePlan);
- thirdJoinObserver.RemoveActivePlan(activePlan);
- fourthJoinObserver.RemoveActivePlan(activePlan);
- fifthJoinObserver.RemoveActivePlan(activePlan);
- sixthJoinObserver.RemoveActivePlan(activePlan);
- seventhJoinObserver.RemoveActivePlan(activePlan);
- eighthJoinObserver.RemoveActivePlan(activePlan);
- ninthJoinObserver.RemoveActivePlan(activePlan);
- tenthJoinObserver.RemoveActivePlan(activePlan);
- eleventhJoinObserver.RemoveActivePlan(activePlan);
- twelfthJoinObserver.RemoveActivePlan(activePlan);
- thirteenthJoinObserver.RemoveActivePlan(activePlan);
- fourteenthJoinObserver.RemoveActivePlan(activePlan);
- fifteenthJoinObserver.RemoveActivePlan(activePlan);
- sixteenthJoinObserver.RemoveActivePlan(activePlan);
- deactivate(activePlan);
- });
-
- firstJoinObserver.AddActivePlan(activePlan);
- secondJoinObserver.AddActivePlan(activePlan);
- thirdJoinObserver.AddActivePlan(activePlan);
- fourthJoinObserver.AddActivePlan(activePlan);
- fifthJoinObserver.AddActivePlan(activePlan);
- sixthJoinObserver.AddActivePlan(activePlan);
- seventhJoinObserver.AddActivePlan(activePlan);
- eighthJoinObserver.AddActivePlan(activePlan);
- ninthJoinObserver.AddActivePlan(activePlan);
- tenthJoinObserver.AddActivePlan(activePlan);
- eleventhJoinObserver.AddActivePlan(activePlan);
- twelfthJoinObserver.AddActivePlan(activePlan);
- thirteenthJoinObserver.AddActivePlan(activePlan);
- fourteenthJoinObserver.AddActivePlan(activePlan);
- fifteenthJoinObserver.AddActivePlan(activePlan);
- sixteenthJoinObserver.AddActivePlan(activePlan);
- return activePlan;
- }
- }
-#endif
-} \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/GroupedObservable.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/GroupedObservable.cs
deleted file mode 100644
index f3ab0ad..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/GroupedObservable.cs
+++ /dev/null
@@ -1,52 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System.Reactive.Disposables;
-using System.Reactive.Subjects;
-
-namespace System.Reactive.Linq
-{
- class GroupedObservable<TKey, TElement> : ObservableBase<TElement>, IGroupedObservable<TKey, TElement>
- {
- private readonly TKey _key;
- private readonly IObservable<TElement> _subject;
- private readonly RefCountDisposable _refCount;
-
- public GroupedObservable(TKey key, ISubject<TElement> subject, RefCountDisposable refCount)
- {
- _key = key;
- _subject = subject;
- _refCount = refCount;
- }
-
- public GroupedObservable(TKey key, ISubject<TElement> subject)
- {
- _key = key;
- _subject = subject;
- }
-
- public TKey Key
- {
- get { return _key; }
- }
-
- protected override IDisposable SubscribeCore(IObserver<TElement> observer)
- {
- if (_refCount != null)
- {
- //
- // [OK] Use of unsafe Subscribe: called on a known subject implementation.
- //
- var release = _refCount.GetDisposable();
- var subscription = _subject.Subscribe/*Unsafe*/(observer);
- return new CompositeDisposable(release, subscription);
- }
- else
- {
- //
- // [OK] Use of unsafe Subscribe: called on a known subject implementation.
- //
- return _subject.Subscribe/*Unsafe*/(observer);
- }
- }
- }
-}
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/IQueryLanguage.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/IQueryLanguage.cs
deleted file mode 100644
index 27a0fe7..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/IQueryLanguage.cs
+++ /dev/null
@@ -1,797 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Reactive.Concurrency;
-using System.Reactive.Joins;
-using System.Reactive.Subjects;
-using System.Threading;
-
-#if !NO_REMOTING
-using System.Runtime.Remoting.Lifetime;
-#endif
-
-#if !NO_TPL
-using System.Threading.Tasks;
-#endif
-
-namespace System.Reactive.Linq
-{
- /// <summary>
- /// Internal interface describing the LINQ to Events query language.
- /// </summary>
- internal interface IQueryLanguage
- {
- #region * Aggregates *
-
- IObservable<TAccumulate> Aggregate<TSource, TAccumulate>(IObservable<TSource> source, TAccumulate seed, Func<TAccumulate, TSource, TAccumulate> accumulator);
- IObservable<TResult> Aggregate<TSource, TAccumulate, TResult>(IObservable<TSource> source, TAccumulate seed, Func<TAccumulate, TSource, TAccumulate> accumulator, Func<TAccumulate, TResult> resultSelector);
- IObservable<TSource> Aggregate<TSource>(IObservable<TSource> source, Func<TSource, TSource, TSource> accumulator);
- IObservable<bool> All<TSource>(IObservable<TSource> source, Func<TSource, bool> predicate);
- IObservable<bool> Any<TSource>(IObservable<TSource> source);
- IObservable<bool> Any<TSource>(IObservable<TSource> source, Func<TSource, bool> predicate);
- IObservable<double> Average(IObservable<double> source);
- IObservable<float> Average(IObservable<float> source);
- IObservable<decimal> Average(IObservable<decimal> source);
- IObservable<double> Average(IObservable<int> source);
- IObservable<double> Average(IObservable<long> source);
- IObservable<double?> Average(IObservable<double?> source);
- IObservable<float?> Average(IObservable<float?> source);
- IObservable<decimal?> Average(IObservable<decimal?> source);
- IObservable<double?> Average(IObservable<int?> source);
- IObservable<double?> Average(IObservable<long?> source);
- IObservable<double> Average<TSource>(IObservable<TSource> source, Func<TSource, double> selector);
- IObservable<float> Average<TSource>(IObservable<TSource> source, Func<TSource, float> selector);
- IObservable<decimal> Average<TSource>(IObservable<TSource> source, Func<TSource, decimal> selector);
- IObservable<double> Average<TSource>(IObservable<TSource> source, Func<TSource, int> selector);
- IObservable<double> Average<TSource>(IObservable<TSource> source, Func<TSource, long> selector);
- IObservable<double?> Average<TSource>(IObservable<TSource> source, Func<TSource, double?> selector);
- IObservable<float?> Average<TSource>(IObservable<TSource> source, Func<TSource, float?> selector);
- IObservable<decimal?> Average<TSource>(IObservable<TSource> source, Func<TSource, decimal?> selector);
- IObservable<double?> Average<TSource>(IObservable<TSource> source, Func<TSource, int?> selector);
- IObservable<double?> Average<TSource>(IObservable<TSource> source, Func<TSource, long?> selector);
- IObservable<bool> Contains<TSource>(IObservable<TSource> source, TSource value);
- IObservable<bool> Contains<TSource>(IObservable<TSource> source, TSource value, IEqualityComparer<TSource> comparer);
- IObservable<int> Count<TSource>(IObservable<TSource> source);
- IObservable<int> Count<TSource>(IObservable<TSource> source, Func<TSource, bool> predicate);
- IObservable<TSource> ElementAt<TSource>(IObservable<TSource> source, int index);
- IObservable<TSource> ElementAtOrDefault<TSource>(IObservable<TSource> source, int index);
- IObservable<TSource> FirstAsync<TSource>(IObservable<TSource> source);
- IObservable<TSource> FirstAsync<TSource>(IObservable<TSource> source, Func<TSource, bool> predicate);
- IObservable<TSource> FirstOrDefaultAsync<TSource>(IObservable<TSource> source);
- IObservable<TSource> FirstOrDefaultAsync<TSource>(IObservable<TSource> source, Func<TSource, bool> predicate);
- IObservable<bool> IsEmpty<TSource>(IObservable<TSource> source);
- IObservable<TSource> LastAsync<TSource>(IObservable<TSource> source);
- IObservable<TSource> LastAsync<TSource>(IObservable<TSource> source, Func<TSource, bool> predicate);
- IObservable<TSource> LastOrDefaultAsync<TSource>(IObservable<TSource> source);
- IObservable<TSource> LastOrDefaultAsync<TSource>(IObservable<TSource> source, Func<TSource, bool> predicate);
- IObservable<long> LongCount<TSource>(IObservable<TSource> source);
- IObservable<long> LongCount<TSource>(IObservable<TSource> source, Func<TSource, bool> predicate);
- IObservable<TSource> Max<TSource>(IObservable<TSource> source);
- IObservable<TSource> Max<TSource>(IObservable<TSource> source, IComparer<TSource> comparer);
- IObservable<double> Max(IObservable<double> source);
- IObservable<float> Max(IObservable<float> source);
- IObservable<decimal> Max(IObservable<decimal> source);
- IObservable<int> Max(IObservable<int> source);
- IObservable<long> Max(IObservable<long> source);
- IObservable<double?> Max(IObservable<double?> source);
- IObservable<float?> Max(IObservable<float?> source);
- IObservable<decimal?> Max(IObservable<decimal?> source);
- IObservable<int?> Max(IObservable<int?> source);
- IObservable<long?> Max(IObservable<long?> source);
- IObservable<TResult> Max<TSource, TResult>(IObservable<TSource> source, Func<TSource, TResult> selector);
- IObservable<TResult> Max<TSource, TResult>(IObservable<TSource> source, Func<TSource, TResult> selector, IComparer<TResult> comparer);
- IObservable<double> Max<TSource>(IObservable<TSource> source, Func<TSource, double> selector);
- IObservable<float> Max<TSource>(IObservable<TSource> source, Func<TSource, float> selector);
- IObservable<decimal> Max<TSource>(IObservable<TSource> source, Func<TSource, decimal> selector);
- IObservable<int> Max<TSource>(IObservable<TSource> source, Func<TSource, int> selector);
- IObservable<long> Max<TSource>(IObservable<TSource> source, Func<TSource, long> selector);
- IObservable<double?> Max<TSource>(IObservable<TSource> source, Func<TSource, double?> selector);
- IObservable<float?> Max<TSource>(IObservable<TSource> source, Func<TSource, float?> selector);
- IObservable<decimal?> Max<TSource>(IObservable<TSource> source, Func<TSource, decimal?> selector);
- IObservable<int?> Max<TSource>(IObservable<TSource> source, Func<TSource, int?> selector);
- IObservable<long?> Max<TSource>(IObservable<TSource> source, Func<TSource, long?> selector);
- IObservable<IList<TSource>> MaxBy<TSource, TKey>(IObservable<TSource> source, Func<TSource, TKey> keySelector);
- IObservable<IList<TSource>> MaxBy<TSource, TKey>(IObservable<TSource> source, Func<TSource, TKey> keySelector, IComparer<TKey> comparer);
- IObservable<TSource> Min<TSource>(IObservable<TSource> source);
- IObservable<TSource> Min<TSource>(IObservable<TSource> source, IComparer<TSource> comparer);
- IObservable<double> Min(IObservable<double> source);
- IObservable<float> Min(IObservable<float> source);
- IObservable<decimal> Min(IObservable<decimal> source);
- IObservable<int> Min(IObservable<int> source);
- IObservable<long> Min(IObservable<long> source);
- IObservable<double?> Min(IObservable<double?> source);
- IObservable<float?> Min(IObservable<float?> source);
- IObservable<decimal?> Min(IObservable<decimal?> source);
- IObservable<int?> Min(IObservable<int?> source);
- IObservable<long?> Min(IObservable<long?> source);
- IObservable<TResult> Min<TSource, TResult>(IObservable<TSource> source, Func<TSource, TResult> selector);
- IObservable<TResult> Min<TSource, TResult>(IObservable<TSource> source, Func<TSource, TResult> selector, IComparer<TResult> comparer);
- IObservable<double> Min<TSource>(IObservable<TSource> source, Func<TSource, double> selector);
- IObservable<float> Min<TSource>(IObservable<TSource> source, Func<TSource, float> selector);
- IObservable<decimal> Min<TSource>(IObservable<TSource> source, Func<TSource, decimal> selector);
- IObservable<int> Min<TSource>(IObservable<TSource> source, Func<TSource, int> selector);
- IObservable<long> Min<TSource>(IObservable<TSource> source, Func<TSource, long> selector);
- IObservable<double?> Min<TSource>(IObservable<TSource> source, Func<TSource, double?> selector);
- IObservable<float?> Min<TSource>(IObservable<TSource> source, Func<TSource, float?> selector);
- IObservable<decimal?> Min<TSource>(IObservable<TSource> source, Func<TSource, decimal?> selector);
- IObservable<int?> Min<TSource>(IObservable<TSource> source, Func<TSource, int?> selector);
- IObservable<long?> Min<TSource>(IObservable<TSource> source, Func<TSource, long?> selector);
- IObservable<IList<TSource>> MinBy<TSource, TKey>(IObservable<TSource> source, Func<TSource, TKey> keySelector);
- IObservable<IList<TSource>> MinBy<TSource, TKey>(IObservable<TSource> source, Func<TSource, TKey> keySelector, IComparer<TKey> comparer);
- IObservable<bool> SequenceEqual<TSource>(IObservable<TSource> first, IObservable<TSource> second);
- IObservable<bool> SequenceEqual<TSource>(IObservable<TSource> first, IObservable<TSource> second, IEqualityComparer<TSource> comparer);
- IObservable<bool> SequenceEqual<TSource>(IObservable<TSource> first, IEnumerable<TSource> second);
- IObservable<bool> SequenceEqual<TSource>(IObservable<TSource> first, IEnumerable<TSource> second, IEqualityComparer<TSource> comparer);
- IObservable<TSource> SingleAsync<TSource>(IObservable<TSource> source);
- IObservable<TSource> SingleAsync<TSource>(IObservable<TSource> source, Func<TSource, bool> predicate);
- IObservable<TSource> SingleOrDefaultAsync<TSource>(IObservable<TSource> source);
- IObservable<TSource> SingleOrDefaultAsync<TSource>(IObservable<TSource> source, Func<TSource, bool> predicate);
- IObservable<double> Sum(IObservable<double> source);
- IObservable<float> Sum(IObservable<float> source);
- IObservable<decimal> Sum(IObservable<decimal> source);
- IObservable<int> Sum(IObservable<int> source);
- IObservable<long> Sum(IObservable<long> source);
- IObservable<double?> Sum(IObservable<double?> source);
- IObservable<float?> Sum(IObservable<float?> source);
- IObservable<decimal?> Sum(IObservable<decimal?> source);
- IObservable<int?> Sum(IObservable<int?> source);
- IObservable<long?> Sum(IObservable<long?> source);
- IObservable<double> Sum<TSource>(IObservable<TSource> source, Func<TSource, double> selector);
- IObservable<float> Sum<TSource>(IObservable<TSource> source, Func<TSource, float> selector);
- IObservable<decimal> Sum<TSource>(IObservable<TSource> source, Func<TSource, decimal> selector);
- IObservable<int> Sum<TSource>(IObservable<TSource> source, Func<TSource, int> selector);
- IObservable<long> Sum<TSource>(IObservable<TSource> source, Func<TSource, long> selector);
- IObservable<double?> Sum<TSource>(IObservable<TSource> source, Func<TSource, double?> selector);
- IObservable<float?> Sum<TSource>(IObservable<TSource> source, Func<TSource, float?> selector);
- IObservable<decimal?> Sum<TSource>(IObservable<TSource> source, Func<TSource, decimal?> selector);
- IObservable<int?> Sum<TSource>(IObservable<TSource> source, Func<TSource, int?> selector);
- IObservable<long?> Sum<TSource>(IObservable<TSource> source, Func<TSource, long?> selector);
- IObservable<TSource[]> ToArray<TSource>(IObservable<TSource> source);
- IObservable<IDictionary<TKey, TElement>> ToDictionary<TSource, TKey, TElement>(IObservable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector, IEqualityComparer<TKey> comparer);
- IObservable<IDictionary<TKey, TElement>> ToDictionary<TSource, TKey, TElement>(IObservable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector);
- IObservable<IDictionary<TKey, TSource>> ToDictionary<TSource, TKey>(IObservable<TSource> source, Func<TSource, TKey> keySelector, IEqualityComparer<TKey> comparer);
- IObservable<IDictionary<TKey, TSource>> ToDictionary<TSource, TKey>(IObservable<TSource> source, Func<TSource, TKey> keySelector);
- IObservable<IList<TSource>> ToList<TSource>(IObservable<TSource> source);
- IObservable<ILookup<TKey, TElement>> ToLookup<TSource, TKey, TElement>(IObservable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector, IEqualityComparer<TKey> comparer);
- IObservable<ILookup<TKey, TSource>> ToLookup<TSource, TKey>(IObservable<TSource> source, Func<TSource, TKey> keySelector, IEqualityComparer<TKey> comparer);
- IObservable<ILookup<TKey, TElement>> ToLookup<TSource, TKey, TElement>(IObservable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector);
- IObservable<ILookup<TKey, TSource>> ToLookup<TSource, TKey>(IObservable<TSource> source, Func<TSource, TKey> keySelector);
-
- #endregion
-
- #region * Async *
-
- Func<IObservable<TResult>> FromAsyncPattern<TResult>(Func<AsyncCallback, object, IAsyncResult> begin, Func<IAsyncResult, TResult> end);
- Func<T1, IObservable<TResult>> FromAsyncPattern<T1, TResult>(Func<T1, AsyncCallback, object, IAsyncResult> begin, Func<IAsyncResult, TResult> end);
- Func<T1, T2, IObservable<TResult>> FromAsyncPattern<T1, T2, TResult>(Func<T1, T2, AsyncCallback, object, IAsyncResult> begin, Func<IAsyncResult, TResult> end);
-
-#if !NO_LARGEARITY
- Func<T1, T2, T3, IObservable<TResult>> FromAsyncPattern<T1, T2, T3, TResult>(Func<T1, T2, T3, AsyncCallback, object, IAsyncResult> begin, Func<IAsyncResult, TResult> end);
- Func<T1, T2, T3, T4, IObservable<TResult>> FromAsyncPattern<T1, T2, T3, T4, TResult>(Func<T1, T2, T3, T4, AsyncCallback, object, IAsyncResult> begin, Func<IAsyncResult, TResult> end);
- Func<T1, T2, T3, T4, T5, IObservable<TResult>> FromAsyncPattern<T1, T2, T3, T4, T5, TResult>(Func<T1, T2, T3, T4, T5, AsyncCallback, object, IAsyncResult> begin, Func<IAsyncResult, TResult> end);
- Func<T1, T2, T3, T4, T5, T6, IObservable<TResult>> FromAsyncPattern<T1, T2, T3, T4, T5, T6, TResult>(Func<T1, T2, T3, T4, T5, T6, AsyncCallback, object, IAsyncResult> begin, Func<IAsyncResult, TResult> end);
- Func<T1, T2, T3, T4, T5, T6, T7, IObservable<TResult>> FromAsyncPattern<T1, T2, T3, T4, T5, T6, T7, TResult>(Func<T1, T2, T3, T4, T5, T6, T7, AsyncCallback, object, IAsyncResult> begin, Func<IAsyncResult, TResult> end);
- Func<T1, T2, T3, T4, T5, T6, T7, T8, IObservable<TResult>> FromAsyncPattern<T1, T2, T3, T4, T5, T6, T7, T8, TResult>(Func<T1, T2, T3, T4, T5, T6, T7, T8, AsyncCallback, object, IAsyncResult> begin, Func<IAsyncResult, TResult> end);
- Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, IObservable<TResult>> FromAsyncPattern<T1, T2, T3, T4, T5, T6, T7, T8, T9, TResult>(Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, AsyncCallback, object, IAsyncResult> begin, Func<IAsyncResult, TResult> end);
- Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, IObservable<TResult>> FromAsyncPattern<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, TResult>(Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, AsyncCallback, object, IAsyncResult> begin, Func<IAsyncResult, TResult> end);
- Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, IObservable<TResult>> FromAsyncPattern<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, TResult>(Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, AsyncCallback, object, IAsyncResult> begin, Func<IAsyncResult, TResult> end);
- Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, IObservable<TResult>> FromAsyncPattern<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, TResult>(Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, AsyncCallback, object, IAsyncResult> begin, Func<IAsyncResult, TResult> end);
- Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, IObservable<TResult>> FromAsyncPattern<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, TResult>(Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, AsyncCallback, object, IAsyncResult> begin, Func<IAsyncResult, TResult> end);
- Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, IObservable<TResult>> FromAsyncPattern<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, TResult>(Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, AsyncCallback, object, IAsyncResult> begin, Func<IAsyncResult, TResult> end);
-#endif
-
- Func<IObservable<Unit>> FromAsyncPattern(Func<AsyncCallback, object, IAsyncResult> begin, Action<IAsyncResult> end);
- Func<T1, IObservable<Unit>> FromAsyncPattern<T1>(Func<T1, AsyncCallback, object, IAsyncResult> begin, Action<IAsyncResult> end);
- Func<T1, T2, IObservable<Unit>> FromAsyncPattern<T1, T2>(Func<T1, T2, AsyncCallback, object, IAsyncResult> begin, Action<IAsyncResult> end);
-
-#if !NO_LARGEARITY
- Func<T1, T2, T3, IObservable<Unit>> FromAsyncPattern<T1, T2, T3>(Func<T1, T2, T3, AsyncCallback, object, IAsyncResult> begin, Action<IAsyncResult> end);
- Func<T1, T2, T3, T4, IObservable<Unit>> FromAsyncPattern<T1, T2, T3, T4>(Func<T1, T2, T3, T4, AsyncCallback, object, IAsyncResult> begin, Action<IAsyncResult> end);
- Func<T1, T2, T3, T4, T5, IObservable<Unit>> FromAsyncPattern<T1, T2, T3, T4, T5>(Func<T1, T2, T3, T4, T5, AsyncCallback, object, IAsyncResult> begin, Action<IAsyncResult> end);
- Func<T1, T2, T3, T4, T5, T6, IObservable<Unit>> FromAsyncPattern<T1, T2, T3, T4, T5, T6>(Func<T1, T2, T3, T4, T5, T6, AsyncCallback, object, IAsyncResult> begin, Action<IAsyncResult> end);
- Func<T1, T2, T3, T4, T5, T6, T7, IObservable<Unit>> FromAsyncPattern<T1, T2, T3, T4, T5, T6, T7>(Func<T1, T2, T3, T4, T5, T6, T7, AsyncCallback, object, IAsyncResult> begin, Action<IAsyncResult> end);
- Func<T1, T2, T3, T4, T5, T6, T7, T8, IObservable<Unit>> FromAsyncPattern<T1, T2, T3, T4, T5, T6, T7, T8>(Func<T1, T2, T3, T4, T5, T6, T7, T8, AsyncCallback, object, IAsyncResult> begin, Action<IAsyncResult> end);
- Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, IObservable<Unit>> FromAsyncPattern<T1, T2, T3, T4, T5, T6, T7, T8, T9>(Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, AsyncCallback, object, IAsyncResult> begin, Action<IAsyncResult> end);
- Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, IObservable<Unit>> FromAsyncPattern<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, AsyncCallback, object, IAsyncResult> begin, Action<IAsyncResult> end);
- Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, IObservable<Unit>> FromAsyncPattern<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>(Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, AsyncCallback, object, IAsyncResult> begin, Action<IAsyncResult> end);
- Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, IObservable<Unit>> FromAsyncPattern<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>(Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, AsyncCallback, object, IAsyncResult> begin, Action<IAsyncResult> end);
- Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, IObservable<Unit>> FromAsyncPattern<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>(Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, AsyncCallback, object, IAsyncResult> begin, Action<IAsyncResult> end);
- Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, IObservable<Unit>> FromAsyncPattern<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>(Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, AsyncCallback, object, IAsyncResult> begin, Action<IAsyncResult> end);
-#endif
-
- IObservable<TSource> Start<TSource>(Func<TSource> function);
- IObservable<TSource> Start<TSource>(Func<TSource> function, IScheduler scheduler);
-
-#if !NO_TPL
- IObservable<TSource> StartAsync<TSource>(Func<Task<TSource>> functionAsync);
- IObservable<TSource> StartAsync<TSource>(Func<CancellationToken, Task<TSource>> functionAsync);
-#endif
-
- IObservable<Unit> Start(Action action);
- IObservable<Unit> Start(Action action, IScheduler scheduler);
-
-#if !NO_TPL
- IObservable<Unit> StartAsync(Func<Task> actionAsync);
- IObservable<Unit> StartAsync(Func<CancellationToken, Task> actionAsync);
-#endif
-
-#if !NO_TPL
- IObservable<TResult> FromAsync<TResult>(Func<Task<TResult>> functionAsync);
- IObservable<TResult> FromAsync<TResult>(Func<CancellationToken, Task<TResult>> functionAsync);
- IObservable<Unit> FromAsync(Func<Task> actionAsync);
- IObservable<Unit> FromAsync(Func<CancellationToken, Task> actionAsync);
-#endif
-
- Func<IObservable<TResult>> ToAsync<TResult>(Func<TResult> function);
- Func<IObservable<TResult>> ToAsync<TResult>(Func<TResult> function, IScheduler scheduler);
- Func<T, IObservable<TResult>> ToAsync<T, TResult>(Func<T, TResult> function);
- Func<T, IObservable<TResult>> ToAsync<T, TResult>(Func<T, TResult> function, IScheduler scheduler);
- Func<T1, T2, IObservable<TResult>> ToAsync<T1, T2, TResult>(Func<T1, T2, TResult> function);
- Func<T1, T2, IObservable<TResult>> ToAsync<T1, T2, TResult>(Func<T1, T2, TResult> function, IScheduler scheduler);
- Func<T1, T2, T3, IObservable<TResult>> ToAsync<T1, T2, T3, TResult>(Func<T1, T2, T3, TResult> function);
- Func<T1, T2, T3, IObservable<TResult>> ToAsync<T1, T2, T3, TResult>(Func<T1, T2, T3, TResult> function, IScheduler scheduler);
- Func<T1, T2, T3, T4, IObservable<TResult>> ToAsync<T1, T2, T3, T4, TResult>(Func<T1, T2, T3, T4, TResult> function);
- Func<T1, T2, T3, T4, IObservable<TResult>> ToAsync<T1, T2, T3, T4, TResult>(Func<T1, T2, T3, T4, TResult> function, IScheduler scheduler);
-
-#if !NO_LARGEARITY
- Func<T1, T2, T3, T4, T5, IObservable<TResult>> ToAsync<T1, T2, T3, T4, T5, TResult>(Func<T1, T2, T3, T4, T5, TResult> function);
- Func<T1, T2, T3, T4, T5, IObservable<TResult>> ToAsync<T1, T2, T3, T4, T5, TResult>(Func<T1, T2, T3, T4, T5, TResult> function, IScheduler scheduler);
- Func<T1, T2, T3, T4, T5, T6, IObservable<TResult>> ToAsync<T1, T2, T3, T4, T5, T6, TResult>(Func<T1, T2, T3, T4, T5, T6, TResult> function);
- Func<T1, T2, T3, T4, T5, T6, IObservable<TResult>> ToAsync<T1, T2, T3, T4, T5, T6, TResult>(Func<T1, T2, T3, T4, T5, T6, TResult> function, IScheduler scheduler);
- Func<T1, T2, T3, T4, T5, T6, T7, IObservable<TResult>> ToAsync<T1, T2, T3, T4, T5, T6, T7, TResult>(Func<T1, T2, T3, T4, T5, T6, T7, TResult> function);
- Func<T1, T2, T3, T4, T5, T6, T7, IObservable<TResult>> ToAsync<T1, T2, T3, T4, T5, T6, T7, TResult>(Func<T1, T2, T3, T4, T5, T6, T7, TResult> function, IScheduler scheduler);
- Func<T1, T2, T3, T4, T5, T6, T7, T8, IObservable<TResult>> ToAsync<T1, T2, T3, T4, T5, T6, T7, T8, TResult>(Func<T1, T2, T3, T4, T5, T6, T7, T8, TResult> function);
- Func<T1, T2, T3, T4, T5, T6, T7, T8, IObservable<TResult>> ToAsync<T1, T2, T3, T4, T5, T6, T7, T8, TResult>(Func<T1, T2, T3, T4, T5, T6, T7, T8, TResult> function, IScheduler scheduler);
- Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, IObservable<TResult>> ToAsync<T1, T2, T3, T4, T5, T6, T7, T8, T9, TResult>(Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, TResult> function);
- Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, IObservable<TResult>> ToAsync<T1, T2, T3, T4, T5, T6, T7, T8, T9, TResult>(Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, TResult> function, IScheduler scheduler);
- Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, IObservable<TResult>> ToAsync<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, TResult>(Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, TResult> function);
- Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, IObservable<TResult>> ToAsync<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, TResult>(Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, TResult> function, IScheduler scheduler);
- Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, IObservable<TResult>> ToAsync<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, TResult>(Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, TResult> function);
- Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, IObservable<TResult>> ToAsync<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, TResult>(Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, TResult> function, IScheduler scheduler);
- Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, IObservable<TResult>> ToAsync<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, TResult>(Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, TResult> function);
- Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, IObservable<TResult>> ToAsync<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, TResult>(Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, TResult> function, IScheduler scheduler);
- Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, IObservable<TResult>> ToAsync<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, TResult>(Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, TResult> function);
- Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, IObservable<TResult>> ToAsync<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, TResult>(Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, TResult> function, IScheduler scheduler);
- Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, IObservable<TResult>> ToAsync<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, TResult>(Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, TResult> function);
- Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, IObservable<TResult>> ToAsync<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, TResult>(Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, TResult> function, IScheduler scheduler);
- Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, IObservable<TResult>> ToAsync<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, TResult>(Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, TResult> function);
- Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, IObservable<TResult>> ToAsync<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, TResult>(Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, TResult> function, IScheduler scheduler);
- Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, IObservable<TResult>> ToAsync<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, TResult>(Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, TResult> function);
- Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, IObservable<TResult>> ToAsync<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, TResult>(Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, TResult> function, IScheduler scheduler);
-#endif
-
- Func<IObservable<Unit>> ToAsync(Action action);
- Func<IObservable<Unit>> ToAsync(Action action, IScheduler scheduler);
- Func<TSource, IObservable<Unit>> ToAsync<TSource>(Action<TSource> action);
- Func<TSource, IObservable<Unit>> ToAsync<TSource>(Action<TSource> action, IScheduler scheduler);
- Func<T1, T2, IObservable<Unit>> ToAsync<T1, T2>(Action<T1, T2> action);
- Func<T1, T2, IObservable<Unit>> ToAsync<T1, T2>(Action<T1, T2> action, IScheduler scheduler);
- Func<T1, T2, T3, IObservable<Unit>> ToAsync<T1, T2, T3>(Action<T1, T2, T3> action);
- Func<T1, T2, T3, IObservable<Unit>> ToAsync<T1, T2, T3>(Action<T1, T2, T3> action, IScheduler scheduler);
- Func<T1, T2, T3, T4, IObservable<Unit>> ToAsync<T1, T2, T3, T4>(Action<T1, T2, T3, T4> action);
- Func<T1, T2, T3, T4, IObservable<Unit>> ToAsync<T1, T2, T3, T4>(Action<T1, T2, T3, T4> action, IScheduler scheduler);
-
-#if !NO_LARGEARITY
- Func<T1, T2, T3, T4, T5, IObservable<Unit>> ToAsync<T1, T2, T3, T4, T5>(Action<T1, T2, T3, T4, T5> action);
- Func<T1, T2, T3, T4, T5, IObservable<Unit>> ToAsync<T1, T2, T3, T4, T5>(Action<T1, T2, T3, T4, T5> action, IScheduler scheduler);
- Func<T1, T2, T3, T4, T5, T6, IObservable<Unit>> ToAsync<T1, T2, T3, T4, T5, T6>(Action<T1, T2, T3, T4, T5, T6> action);
- Func<T1, T2, T3, T4, T5, T6, IObservable<Unit>> ToAsync<T1, T2, T3, T4, T5, T6>(Action<T1, T2, T3, T4, T5, T6> action, IScheduler scheduler);
- Func<T1, T2, T3, T4, T5, T6, T7, IObservable<Unit>> ToAsync<T1, T2, T3, T4, T5, T6, T7>(Action<T1, T2, T3, T4, T5, T6, T7> action);
- Func<T1, T2, T3, T4, T5, T6, T7, IObservable<Unit>> ToAsync<T1, T2, T3, T4, T5, T6, T7>(Action<T1, T2, T3, T4, T5, T6, T7> action, IScheduler scheduler);
- Func<T1, T2, T3, T4, T5, T6, T7, T8, IObservable<Unit>> ToAsync<T1, T2, T3, T4, T5, T6, T7, T8>(Action<T1, T2, T3, T4, T5, T6, T7, T8> action);
- Func<T1, T2, T3, T4, T5, T6, T7, T8, IObservable<Unit>> ToAsync<T1, T2, T3, T4, T5, T6, T7, T8>(Action<T1, T2, T3, T4, T5, T6, T7, T8> action, IScheduler scheduler);
- Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, IObservable<Unit>> ToAsync<T1, T2, T3, T4, T5, T6, T7, T8, T9>(Action<T1, T2, T3, T4, T5, T6, T7, T8, T9> action);
- Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, IObservable<Unit>> ToAsync<T1, T2, T3, T4, T5, T6, T7, T8, T9>(Action<T1, T2, T3, T4, T5, T6, T7, T8, T9> action, IScheduler scheduler);
- Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, IObservable<Unit>> ToAsync<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> action);
- Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, IObservable<Unit>> ToAsync<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> action, IScheduler scheduler);
- Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, IObservable<Unit>> ToAsync<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>(Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> action);
- Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, IObservable<Unit>> ToAsync<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>(Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> action, IScheduler scheduler);
- Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, IObservable<Unit>> ToAsync<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>(Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> action);
- Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, IObservable<Unit>> ToAsync<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>(Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> action, IScheduler scheduler);
- Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, IObservable<Unit>> ToAsync<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>(Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> action);
- Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, IObservable<Unit>> ToAsync<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>(Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> action, IScheduler scheduler);
- Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, IObservable<Unit>> ToAsync<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>(Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> action);
- Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, IObservable<Unit>> ToAsync<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>(Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> action, IScheduler scheduler);
- Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, IObservable<Unit>> ToAsync<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>(Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> action);
- Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, IObservable<Unit>> ToAsync<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>(Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> action, IScheduler scheduler);
- Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, IObservable<Unit>> ToAsync<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16>(Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16> action);
- Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, IObservable<Unit>> ToAsync<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16>(Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16> action, IScheduler scheduler);
-#endif
-
- #endregion
-
- #region * Awaiter *
-
-#if HAS_AWAIT
- AsyncSubject<TSource> GetAwaiter<TSource>(IObservable<TSource> source);
- AsyncSubject<TSource> GetAwaiter<TSource>(IConnectableObservable<TSource> source);
- AsyncSubject<TSource> RunAsync<TSource>(IObservable<TSource> source, CancellationToken cancellationToken);
- AsyncSubject<TSource> RunAsync<TSource>(IConnectableObservable<TSource> source, CancellationToken cancellationToken);
-#endif
-
- #endregion
-
- #region * Binding *
-
- IConnectableObservable<TResult> Multicast<TSource, TResult>(IObservable<TSource> source, ISubject<TSource, TResult> subject);
- IObservable<TResult> Multicast<TSource, TIntermediate, TResult>(IObservable<TSource> source, Func<ISubject<TSource, TIntermediate>> subjectSelector, Func<IObservable<TIntermediate>, IObservable<TResult>> selector);
- IConnectableObservable<TSource> Publish<TSource>(IObservable<TSource> source);
- IObservable<TResult> Publish<TSource, TResult>(IObservable<TSource> source, Func<IObservable<TSource>, IObservable<TResult>> selector);
- IConnectableObservable<TSource> Publish<TSource>(IObservable<TSource> source, TSource initialValue);
- IObservable<TResult> Publish<TSource, TResult>(IObservable<TSource> source, Func<IObservable<TSource>, IObservable<TResult>> selector, TSource initialValue);
- IConnectableObservable<TSource> PublishLast<TSource>(IObservable<TSource> source);
- IObservable<TResult> PublishLast<TSource, TResult>(IObservable<TSource> source, Func<IObservable<TSource>, IObservable<TResult>> selector);
- IObservable<TSource> RefCount<TSource>(IConnectableObservable<TSource> source);
- IConnectableObservable<TSource> Replay<TSource>(IObservable<TSource> source);
- IConnectableObservable<TSource> Replay<TSource>(IObservable<TSource> source, IScheduler scheduler);
- IObservable<TResult> Replay<TSource, TResult>(IObservable<TSource> source, Func<IObservable<TSource>, IObservable<TResult>> selector);
- IObservable<TResult> Replay<TSource, TResult>(IObservable<TSource> source, Func<IObservable<TSource>, IObservable<TResult>> selector, IScheduler scheduler);
- IConnectableObservable<TSource> Replay<TSource>(IObservable<TSource> source, TimeSpan window);
- IObservable<TResult> Replay<TSource, TResult>(IObservable<TSource> source, Func<IObservable<TSource>, IObservable<TResult>> selector, TimeSpan window);
- IConnectableObservable<TSource> Replay<TSource>(IObservable<TSource> source, TimeSpan window, IScheduler scheduler);
- IObservable<TResult> Replay<TSource, TResult>(IObservable<TSource> source, Func<IObservable<TSource>, IObservable<TResult>> selector, TimeSpan window, IScheduler scheduler);
- IConnectableObservable<TSource> Replay<TSource>(IObservable<TSource> source, int bufferSize, IScheduler scheduler);
- IObservable<TResult> Replay<TSource, TResult>(IObservable<TSource> source, Func<IObservable<TSource>, IObservable<TResult>> selector, int bufferSize, IScheduler scheduler);
- IConnectableObservable<TSource> Replay<TSource>(IObservable<TSource> source, int bufferSize);
- IObservable<TResult> Replay<TSource, TResult>(IObservable<TSource> source, Func<IObservable<TSource>, IObservable<TResult>> selector, int bufferSize);
- IConnectableObservable<TSource> Replay<TSource>(IObservable<TSource> source, int bufferSize, TimeSpan window);
- IObservable<TResult> Replay<TSource, TResult>(IObservable<TSource> source, Func<IObservable<TSource>, IObservable<TResult>> selector, int bufferSize, TimeSpan window);
- IConnectableObservable<TSource> Replay<TSource>(IObservable<TSource> source, int bufferSize, TimeSpan window, IScheduler scheduler);
- IObservable<TResult> Replay<TSource, TResult>(IObservable<TSource> source, Func<IObservable<TSource>, IObservable<TResult>> selector, int bufferSize, TimeSpan window, IScheduler scheduler);
-
- #endregion
-
- #region * Blocking *
-
- IEnumerable<IList<TSource>> Chunkify<TSource>(IObservable<TSource> source);
- IEnumerable<TResult> Collect<TSource, TResult>(IObservable<TSource> source, Func<TResult> newCollector, Func<TResult, TSource, TResult> merge);
- IEnumerable<TResult> Collect<TSource, TResult>(IObservable<TSource> source, Func<TResult> getInitialCollector, Func<TResult, TSource, TResult> merge, Func<TResult, TResult> getNewCollector);
- TSource First<TSource>(IObservable<TSource> source);
- TSource First<TSource>(IObservable<TSource> source, Func<TSource, bool> predicate);
- TSource FirstOrDefault<TSource>(IObservable<TSource> source);
- TSource FirstOrDefault<TSource>(IObservable<TSource> source, Func<TSource, bool> predicate);
- void ForEach<TSource>(IObservable<TSource> source, Action<TSource> onNext);
- void ForEach<TSource>(IObservable<TSource> source, Action<TSource, int> onNext);
- IEnumerator<TSource> GetEnumerator<TSource>(IObservable<TSource> source);
- TSource Last<TSource>(IObservable<TSource> source);
- TSource Last<TSource>(IObservable<TSource> source, Func<TSource, bool> predicate);
- TSource LastOrDefault<TSource>(IObservable<TSource> source);
- TSource LastOrDefault<TSource>(IObservable<TSource> source, Func<TSource, bool> predicate);
- IEnumerable<TSource> Latest<TSource>(IObservable<TSource> source);
- IEnumerable<TSource> MostRecent<TSource>(IObservable<TSource> source, TSource initialValue);
- IEnumerable<TSource> Next<TSource>(IObservable<TSource> source);
- TSource Single<TSource>(IObservable<TSource> source);
- TSource SingleOrDefault<TSource>(IObservable<TSource> source, Func<TSource, bool> predicate);
- TSource SingleOrDefault<TSource>(IObservable<TSource> source);
- TSource Single<TSource>(IObservable<TSource> source, Func<TSource, bool> predicate);
- TSource Wait<TSource>(IObservable<TSource> source);
-
- #endregion
-
- #region * Concurrency *
-
- IObservable<TSource> ObserveOn<TSource>(IObservable<TSource> source, IScheduler scheduler);
-#if !NO_SYNCCTX
- IObservable<TSource> ObserveOn<TSource>(IObservable<TSource> source, SynchronizationContext context);
-#endif
- IObservable<TSource> SubscribeOn<TSource>(IObservable<TSource> source, IScheduler scheduler);
-#if !NO_SYNCCTX
- IObservable<TSource> SubscribeOn<TSource>(IObservable<TSource> source, SynchronizationContext context);
-#endif
- IObservable<TSource> Synchronize<TSource>(IObservable<TSource> source);
- IObservable<TSource> Synchronize<TSource>(IObservable<TSource> source, object gate);
-
- #endregion
-
- #region * Conversions *
-
- IDisposable Subscribe<TSource>(IEnumerable<TSource> source, IObserver<TSource> observer);
- IDisposable Subscribe<TSource>(IEnumerable<TSource> source, IObserver<TSource> observer, IScheduler scheduler);
- IEnumerable<TSource> ToEnumerable<TSource>(IObservable<TSource> source);
- IEventSource<Unit> ToEvent(IObservable<Unit> source);
- IEventSource<TSource> ToEvent<TSource>(IObservable<TSource> source);
-#if !NO_EVENTARGS_CONSTRAINT
- IEventPatternSource<TEventArgs> ToEventPattern<TEventArgs>(IObservable<EventPattern<TEventArgs>> source) where TEventArgs : EventArgs;
-#else
- IEventPatternSource<TEventArgs> ToEventPattern<TEventArgs>(IObservable<EventPattern<TEventArgs>> source);
-#endif
- IObservable<TSource> ToObservable<TSource>(IEnumerable<TSource> source);
- IObservable<TSource> ToObservable<TSource>(IEnumerable<TSource> source, IScheduler scheduler);
-
- #endregion
-
- #region * Creation *
-
- IObservable<TSource> Create<TSource>(Func<IObserver<TSource>, IDisposable> subscribe);
- IObservable<TSource> Create<TSource>(Func<IObserver<TSource>, Action> subscribe);
-
-#if !NO_TPL
- IObservable<TResult> Create<TResult>(Func<IObserver<TResult>, CancellationToken, Task> subscribeAsync);
- IObservable<TResult> Create<TResult>(Func<IObserver<TResult>, Task> subscribeAsync);
- IObservable<TResult> Create<TResult>(Func<IObserver<TResult>, CancellationToken, Task<IDisposable>> subscribeAsync);
- IObservable<TResult> Create<TResult>(Func<IObserver<TResult>, Task<IDisposable>> subscribeAsync);
- IObservable<TResult> Create<TResult>(Func<IObserver<TResult>, CancellationToken, Task<Action>> subscribeAsync);
- IObservable<TResult> Create<TResult>(Func<IObserver<TResult>, Task<Action>> subscribeAsync);
-#endif
-
- IObservable<TValue> Defer<TValue>(Func<IObservable<TValue>> observableFactory);
-
-#if !NO_TPL
- IObservable<TValue> Defer<TValue>(Func<Task<IObservable<TValue>>> observableFactoryAsync);
- IObservable<TValue> Defer<TValue>(Func<CancellationToken, Task<IObservable<TValue>>> observableFactoryAsync);
-#endif
-
- IObservable<TResult> Empty<TResult>();
- IObservable<TResult> Empty<TResult>(IScheduler scheduler);
- IObservable<TResult> Generate<TState, TResult>(TState initialState, Func<TState, bool> condition, Func<TState, TState> iterate, Func<TState, TResult> resultSelector);
- IObservable<TResult> Generate<TState, TResult>(TState initialState, Func<TState, bool> condition, Func<TState, TState> iterate, Func<TState, TResult> resultSelector, IScheduler scheduler);
- IObservable<TResult> Never<TResult>();
- IObservable<int> Range(int start, int count);
- IObservable<int> Range(int start, int count, IScheduler scheduler);
- IObservable<TResult> Repeat<TResult>(TResult value);
- IObservable<TResult> Repeat<TResult>(TResult value, IScheduler scheduler);
- IObservable<TResult> Repeat<TResult>(TResult value, int repeatCount);
- IObservable<TResult> Repeat<TResult>(TResult value, int repeatCount, IScheduler scheduler);
- IObservable<TResult> Return<TResult>(TResult value);
- IObservable<TResult> Return<TResult>(TResult value, IScheduler scheduler);
- IObservable<TResult> Throw<TResult>(Exception exception);
- IObservable<TResult> Throw<TResult>(Exception exception, IScheduler scheduler);
- IObservable<TSource> Using<TSource, TResource>(Func<TResource> resourceFactory, Func<TResource, IObservable<TSource>> observableFactory) where TResource : IDisposable;
-
-#if !NO_TPL
- IObservable<TSource> Using<TSource, TResource>(Func<CancellationToken, Task<TResource>> resourceFactoryAsync, Func<TResource, CancellationToken, Task<IObservable<TSource>>> observableFactoryAsync) where TResource : IDisposable;
-#endif
-
- #endregion
-
- #region * Events *
-
-#if !NO_EVENTARGS_CONSTRAINT
- IObservable<EventPattern<EventArgs>> FromEventPattern(Action<EventHandler> addHandler, Action<EventHandler> removeHandler);
- IObservable<EventPattern<EventArgs>> FromEventPattern(Action<EventHandler> addHandler, Action<EventHandler> removeHandler, IScheduler scheduler);
- IObservable<EventPattern<TEventArgs>> FromEventPattern<TDelegate, TEventArgs>(Action<TDelegate> addHandler, Action<TDelegate> removeHandler) where TEventArgs : EventArgs;
- IObservable<EventPattern<TEventArgs>> FromEventPattern<TDelegate, TEventArgs>(Action<TDelegate> addHandler, Action<TDelegate> removeHandler, IScheduler scheduler) where TEventArgs : EventArgs;
- IObservable<EventPattern<TEventArgs>> FromEventPattern<TDelegate, TEventArgs>(Func<EventHandler<TEventArgs>, TDelegate> conversion, Action<TDelegate> addHandler, Action<TDelegate> removeHandler) where TEventArgs : EventArgs;
- IObservable<EventPattern<TEventArgs>> FromEventPattern<TDelegate, TEventArgs>(Func<EventHandler<TEventArgs>, TDelegate> conversion, Action<TDelegate> addHandler, Action<TDelegate> removeHandler, IScheduler scheduler) where TEventArgs : EventArgs;
- IObservable<EventPattern<TEventArgs>> FromEventPattern<TEventArgs>(Action<EventHandler<TEventArgs>> addHandler, Action<EventHandler<TEventArgs>> removeHandler) where TEventArgs : EventArgs;
- IObservable<EventPattern<TEventArgs>> FromEventPattern<TEventArgs>(Action<EventHandler<TEventArgs>> addHandler, Action<EventHandler<TEventArgs>> removeHandler, IScheduler scheduler) where TEventArgs : EventArgs;
- IObservable<EventPattern<TSender, TEventArgs>> FromEventPattern<TDelegate, TSender, TEventArgs>(Action<TDelegate> addHandler, Action<TDelegate> removeHandler) where TEventArgs : EventArgs;
- IObservable<EventPattern<TSender, TEventArgs>> FromEventPattern<TDelegate, TSender, TEventArgs>(Action<TDelegate> addHandler, Action<TDelegate> removeHandler, IScheduler scheduler) where TEventArgs : EventArgs;
- IObservable<EventPattern<EventArgs>> FromEventPattern(object target, string eventName);
- IObservable<EventPattern<EventArgs>> FromEventPattern(object target, string eventName, IScheduler scheduler);
- IObservable<EventPattern<TEventArgs>> FromEventPattern<TEventArgs>(object target, string eventName) where TEventArgs : EventArgs;
- IObservable<EventPattern<TEventArgs>> FromEventPattern<TEventArgs>(object target, string eventName, IScheduler scheduler) where TEventArgs : EventArgs;
- IObservable<EventPattern<TSender, TEventArgs>> FromEventPattern<TSender, TEventArgs>(object target, string eventName) where TEventArgs : EventArgs;
- IObservable<EventPattern<TSender, TEventArgs>> FromEventPattern<TSender, TEventArgs>(object target, string eventName, IScheduler scheduler) where TEventArgs : EventArgs;
- IObservable<EventPattern<EventArgs>> FromEventPattern(Type type, string eventName);
- IObservable<EventPattern<EventArgs>> FromEventPattern(Type type, string eventName, IScheduler scheduler);
- IObservable<EventPattern<TEventArgs>> FromEventPattern<TEventArgs>(Type type, string eventName) where TEventArgs : EventArgs;
- IObservable<EventPattern<TEventArgs>> FromEventPattern<TEventArgs>(Type type, string eventName, IScheduler scheduler) where TEventArgs : EventArgs;
- IObservable<EventPattern<TSender, TEventArgs>> FromEventPattern<TSender, TEventArgs>(Type type, string eventName) where TEventArgs : EventArgs;
- IObservable<EventPattern<TSender, TEventArgs>> FromEventPattern<TSender, TEventArgs>(Type type, string eventName, IScheduler scheduler) where TEventArgs : EventArgs;
-#else
- IObservable<EventPattern<object>> FromEventPattern(Action<EventHandler> addHandler, Action<EventHandler> removeHandler);
- IObservable<EventPattern<object>> FromEventPattern(Action<EventHandler> addHandler, Action<EventHandler> removeHandler, IScheduler scheduler);
- IObservable<EventPattern<TEventArgs>> FromEventPattern<TDelegate, TEventArgs>(Action<TDelegate> addHandler, Action<TDelegate> removeHandler);
- IObservable<EventPattern<TEventArgs>> FromEventPattern<TDelegate, TEventArgs>(Action<TDelegate> addHandler, Action<TDelegate> removeHandler, IScheduler scheduler);
- IObservable<EventPattern<TEventArgs>> FromEventPattern<TDelegate, TEventArgs>(Func<EventHandler<TEventArgs>, TDelegate> conversion, Action<TDelegate> addHandler, Action<TDelegate> removeHandler);
- IObservable<EventPattern<TEventArgs>> FromEventPattern<TDelegate, TEventArgs>(Func<EventHandler<TEventArgs>, TDelegate> conversion, Action<TDelegate> addHandler, Action<TDelegate> removeHandler, IScheduler scheduler);
- IObservable<EventPattern<TEventArgs>> FromEventPattern<TEventArgs>(Action<EventHandler<TEventArgs>> addHandler, Action<EventHandler<TEventArgs>> removeHandler);
- IObservable<EventPattern<TEventArgs>> FromEventPattern<TEventArgs>(Action<EventHandler<TEventArgs>> addHandler, Action<EventHandler<TEventArgs>> removeHandler, IScheduler scheduler);
- IObservable<EventPattern<TSender, TEventArgs>> FromEventPattern<TDelegate, TSender, TEventArgs>(Action<TDelegate> addHandler, Action<TDelegate> removeHandler);
- IObservable<EventPattern<TSender, TEventArgs>> FromEventPattern<TDelegate, TSender, TEventArgs>(Action<TDelegate> addHandler, Action<TDelegate> removeHandler, IScheduler scheduler);
- IObservable<EventPattern<object>> FromEventPattern(object target, string eventName);
- IObservable<EventPattern<object>> FromEventPattern(object target, string eventName, IScheduler scheduler);
- IObservable<EventPattern<TEventArgs>> FromEventPattern<TEventArgs>(object target, string eventName);
- IObservable<EventPattern<TEventArgs>> FromEventPattern<TEventArgs>(object target, string eventName, IScheduler scheduler);
- IObservable<EventPattern<TSender, TEventArgs>> FromEventPattern<TSender, TEventArgs>(object target, string eventName);
- IObservable<EventPattern<TSender, TEventArgs>> FromEventPattern<TSender, TEventArgs>(object target, string eventName, IScheduler scheduler);
- IObservable<EventPattern<object>> FromEventPattern(Type type, string eventName);
- IObservable<EventPattern<object>> FromEventPattern(Type type, string eventName, IScheduler scheduler);
- IObservable<EventPattern<TEventArgs>> FromEventPattern<TEventArgs>(Type type, string eventName);
- IObservable<EventPattern<TEventArgs>> FromEventPattern<TEventArgs>(Type type, string eventName, IScheduler scheduler);
- IObservable<EventPattern<TSender, TEventArgs>> FromEventPattern<TSender, TEventArgs>(Type type, string eventName);
- IObservable<EventPattern<TSender, TEventArgs>> FromEventPattern<TSender, TEventArgs>(Type type, string eventName, IScheduler scheduler);
-#endif
- IObservable<TEventArgs> FromEvent<TDelegate, TEventArgs>(Func<Action<TEventArgs>, TDelegate> conversion, Action<TDelegate> addHandler, Action<TDelegate> removeHandler);
- IObservable<TEventArgs> FromEvent<TDelegate, TEventArgs>(Func<Action<TEventArgs>, TDelegate> conversion, Action<TDelegate> addHandler, Action<TDelegate> removeHandler, IScheduler scheduler);
- IObservable<TEventArgs> FromEvent<TDelegate, TEventArgs>(Action<TDelegate> addHandler, Action<TDelegate> removeHandler);
- IObservable<TEventArgs> FromEvent<TDelegate, TEventArgs>(Action<TDelegate> addHandler, Action<TDelegate> removeHandler, IScheduler scheduler);
- IObservable<TEventArgs> FromEvent<TEventArgs>(Action<Action<TEventArgs>> addHandler, Action<Action<TEventArgs>> removeHandler);
- IObservable<TEventArgs> FromEvent<TEventArgs>(Action<Action<TEventArgs>> addHandler, Action<Action<TEventArgs>> removeHandler, IScheduler scheduler);
- IObservable<Unit> FromEvent(Action<Action> addHandler, Action<Action> removeHandler);
- IObservable<Unit> FromEvent(Action<Action> addHandler, Action<Action> removeHandler, IScheduler scheduler);
-
- #endregion
-
- #region * Imperative *
-
-#if !NO_TPL
- Task ForEachAsync<TSource>(IObservable<TSource> source, Action<TSource> onNext);
- Task ForEachAsync<TSource>(IObservable<TSource> source, Action<TSource> onNext, CancellationToken cancellationToken);
- Task ForEachAsync<TSource>(IObservable<TSource> source, Action<TSource, int> onNext);
- Task ForEachAsync<TSource>(IObservable<TSource> source, Action<TSource, int> onNext, CancellationToken cancellationToken);
-#endif
-
- IObservable<TResult> Case<TValue, TResult>(Func<TValue> selector, IDictionary<TValue, IObservable<TResult>> sources, IObservable<TResult> defaultSource);
- IObservable<TResult> Case<TValue, TResult>(Func<TValue> selector, IDictionary<TValue, IObservable<TResult>> sources, IScheduler scheduler);
- IObservable<TResult> Case<TValue, TResult>(Func<TValue> selector, IDictionary<TValue, IObservable<TResult>> sources);
- IObservable<TSource> DoWhile<TSource>(IObservable<TSource> source, Func<bool> condition);
- IObservable<TResult> For<TSource, TResult>(IEnumerable<TSource> source, Func<TSource, IObservable<TResult>> resultSelector);
- IObservable<TResult> If<TResult>(Func<bool> condition, IObservable<TResult> thenSource, IObservable<TResult> elseSource);
- IObservable<TResult> If<TResult>(Func<bool> condition, IObservable<TResult> thenSource);
- IObservable<TResult> If<TResult>(Func<bool> condition, IObservable<TResult> thenSource, IScheduler scheduler);
- IObservable<TSource> While<TSource>(Func<bool> condition, IObservable<TSource> source);
-
- #endregion
-
- #region * Joins *
-
- Pattern<TLeft, TRight> And<TLeft, TRight>(IObservable<TLeft> left, IObservable<TRight> right);
- Plan<TResult> Then<TSource, TResult>(IObservable<TSource> source, Func<TSource, TResult> selector);
- IObservable<TResult> When<TResult>(params Plan<TResult>[] plans);
- IObservable<TResult> When<TResult>(IEnumerable<Plan<TResult>> plans);
-
- #endregion
-
- #region * Multiple *
-
- IObservable<TSource> Amb<TSource>(IObservable<TSource> first, IObservable<TSource> second);
- IObservable<TSource> Amb<TSource>(params IObservable<TSource>[] sources);
- IObservable<TSource> Amb<TSource>(IEnumerable<IObservable<TSource>> sources);
- IObservable<IList<TSource>> Buffer<TSource, TBufferClosing>(IObservable<TSource> source, Func<IObservable<TBufferClosing>> bufferClosingSelector);
- IObservable<IList<TSource>> Buffer<TSource, TBufferOpening, TBufferClosing>(IObservable<TSource> source, IObservable<TBufferOpening> bufferOpenings, Func<TBufferOpening, IObservable<TBufferClosing>> bufferClosingSelector);
- IObservable<IList<TSource>> Buffer<TSource, TBufferBoundary>(IObservable<TSource> source, IObservable<TBufferBoundary> bufferBoundaries);
- IObservable<TSource> Catch<TSource, TException>(IObservable<TSource> source, Func<TException, IObservable<TSource>> handler) where TException : Exception;
- IObservable<TSource> Catch<TSource>(IObservable<TSource> first, IObservable<TSource> second);
- IObservable<TSource> Catch<TSource>(params IObservable<TSource>[] sources);
- IObservable<TSource> Catch<TSource>(IEnumerable<IObservable<TSource>> sources);
- IObservable<TResult> CombineLatest<TFirst, TSecond, TResult>(IObservable<TFirst> first, IObservable<TSecond> second, Func<TFirst, TSecond, TResult> resultSelector);
-
-#if !NO_PERF
-
- IObservable<TResult> CombineLatest<T1, T2, T3, TResult>(IObservable<T1> source1, IObservable<T2> source2, IObservable<T3> source3, Func<T1, T2, T3, TResult> resultSelector);
- IObservable<TResult> CombineLatest<T1, T2, T3, T4, TResult>(IObservable<T1> source1, IObservable<T2> source2, IObservable<T3> source3, IObservable<T4> source4, Func<T1, T2, T3, T4, TResult> resultSelector);
-
-#if !NO_LARGEARITY
- IObservable<TResult> CombineLatest<T1, T2, T3, T4, T5, TResult>(IObservable<T1> source1, IObservable<T2> source2, IObservable<T3> source3, IObservable<T4> source4, IObservable<T5> source5, Func<T1, T2, T3, T4, T5, TResult> resultSelector);
- IObservable<TResult> CombineLatest<T1, T2, T3, T4, T5, T6, TResult>(IObservable<T1> source1, IObservable<T2> source2, IObservable<T3> source3, IObservable<T4> source4, IObservable<T5> source5, IObservable<T6> source6, Func<T1, T2, T3, T4, T5, T6, TResult> resultSelector);
- IObservable<TResult> CombineLatest<T1, T2, T3, T4, T5, T6, T7, TResult>(IObservable<T1> source1, IObservable<T2> source2, IObservable<T3> source3, IObservable<T4> source4, IObservable<T5> source5, IObservable<T6> source6, IObservable<T7> source7, Func<T1, T2, T3, T4, T5, T6, T7, TResult> resultSelector);
- IObservable<TResult> CombineLatest<T1, T2, T3, T4, T5, T6, T7, T8, TResult>(IObservable<T1> source1, IObservable<T2> source2, IObservable<T3> source3, IObservable<T4> source4, IObservable<T5> source5, IObservable<T6> source6, IObservable<T7> source7, IObservable<T8> source8, Func<T1, T2, T3, T4, T5, T6, T7, T8, TResult> resultSelector);
- IObservable<TResult> CombineLatest<T1, T2, T3, T4, T5, T6, T7, T8, T9, TResult>(IObservable<T1> source1, IObservable<T2> source2, IObservable<T3> source3, IObservable<T4> source4, IObservable<T5> source5, IObservable<T6> source6, IObservable<T7> source7, IObservable<T8> source8, IObservable<T9> source9, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, TResult> resultSelector);
- IObservable<TResult> CombineLatest<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, TResult>(IObservable<T1> source1, IObservable<T2> source2, IObservable<T3> source3, IObservable<T4> source4, IObservable<T5> source5, IObservable<T6> source6, IObservable<T7> source7, IObservable<T8> source8, IObservable<T9> source9, IObservable<T10> source10, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, TResult> resultSelector);
- IObservable<TResult> CombineLatest<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, TResult>(IObservable<T1> source1, IObservable<T2> source2, IObservable<T3> source3, IObservable<T4> source4, IObservable<T5> source5, IObservable<T6> source6, IObservable<T7> source7, IObservable<T8> source8, IObservable<T9> source9, IObservable<T10> source10, IObservable<T11> source11, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, TResult> resultSelector);
- IObservable<TResult> CombineLatest<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, TResult>(IObservable<T1> source1, IObservable<T2> source2, IObservable<T3> source3, IObservable<T4> source4, IObservable<T5> source5, IObservable<T6> source6, IObservable<T7> source7, IObservable<T8> source8, IObservable<T9> source9, IObservable<T10> source10, IObservable<T11> source11, IObservable<T12> source12, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, TResult> resultSelector);
- IObservable<TResult> CombineLatest<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, TResult>(IObservable<T1> source1, IObservable<T2> source2, IObservable<T3> source3, IObservable<T4> source4, IObservable<T5> source5, IObservable<T6> source6, IObservable<T7> source7, IObservable<T8> source8, IObservable<T9> source9, IObservable<T10> source10, IObservable<T11> source11, IObservable<T12> source12, IObservable<T13> source13, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, TResult> resultSelector);
- IObservable<TResult> CombineLatest<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, TResult>(IObservable<T1> source1, IObservable<T2> source2, IObservable<T3> source3, IObservable<T4> source4, IObservable<T5> source5, IObservable<T6> source6, IObservable<T7> source7, IObservable<T8> source8, IObservable<T9> source9, IObservable<T10> source10, IObservable<T11> source11, IObservable<T12> source12, IObservable<T13> source13, IObservable<T14> source14, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, TResult> resultSelector);
- IObservable<TResult> CombineLatest<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, TResult>(IObservable<T1> source1, IObservable<T2> source2, IObservable<T3> source3, IObservable<T4> source4, IObservable<T5> source5, IObservable<T6> source6, IObservable<T7> source7, IObservable<T8> source8, IObservable<T9> source9, IObservable<T10> source10, IObservable<T11> source11, IObservable<T12> source12, IObservable<T13> source13, IObservable<T14> source14, IObservable<T15> source15, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, TResult> resultSelector);
- IObservable<TResult> CombineLatest<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, TResult>(IObservable<T1> source1, IObservable<T2> source2, IObservable<T3> source3, IObservable<T4> source4, IObservable<T5> source5, IObservable<T6> source6, IObservable<T7> source7, IObservable<T8> source8, IObservable<T9> source9, IObservable<T10> source10, IObservable<T11> source11, IObservable<T12> source12, IObservable<T13> source13, IObservable<T14> source14, IObservable<T15> source15, IObservable<T16> source16, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, TResult> resultSelector);
-#endif
-
-#endif
-
- IObservable<TResult> CombineLatest<TSource, TResult>(IEnumerable<IObservable<TSource>> sources, Func<IList<TSource>, TResult> resultSelector);
- IObservable<IList<TSource>> CombineLatest<TSource>(IEnumerable<IObservable<TSource>> sources);
- IObservable<IList<TSource>> CombineLatest<TSource>(params IObservable<TSource>[] sources);
- IObservable<TSource> Concat<TSource>(IObservable<TSource> first, IObservable<TSource> second);
- IObservable<TSource> Concat<TSource>(params IObservable<TSource>[] sources);
- IObservable<TSource> Concat<TSource>(IEnumerable<IObservable<TSource>> sources);
- IObservable<TSource> Concat<TSource>(IObservable<IObservable<TSource>> sources);
- IObservable<TSource> Merge<TSource>(IObservable<IObservable<TSource>> sources);
- IObservable<TSource> Merge<TSource>(IObservable<IObservable<TSource>> sources, int maxConcurrent);
- IObservable<TSource> Merge<TSource>(IEnumerable<IObservable<TSource>> sources, int maxConcurrent);
- IObservable<TSource> Merge<TSource>(IEnumerable<IObservable<TSource>> sources, int maxConcurrent, IScheduler scheduler);
- IObservable<TSource> Merge<TSource>(IObservable<TSource> first, IObservable<TSource> second);
- IObservable<TSource> Merge<TSource>(IObservable<TSource> first, IObservable<TSource> second, IScheduler scheduler);
- IObservable<TSource> Merge<TSource>(params IObservable<TSource>[] sources);
- IObservable<TSource> Merge<TSource>(IScheduler scheduler, params IObservable<TSource>[] sources);
- IObservable<TSource> Merge<TSource>(IEnumerable<IObservable<TSource>> sources);
- IObservable<TSource> Merge<TSource>(IEnumerable<IObservable<TSource>> sources, IScheduler scheduler);
- IObservable<TSource> OnErrorResumeNext<TSource>(IObservable<TSource> first, IObservable<TSource> second);
- IObservable<TSource> OnErrorResumeNext<TSource>(params IObservable<TSource>[] sources);
- IObservable<TSource> OnErrorResumeNext<TSource>(IEnumerable<IObservable<TSource>> sources);
- IObservable<TSource> SkipUntil<TSource, TOther>(IObservable<TSource> source, IObservable<TOther> other);
- IObservable<TSource> Switch<TSource>(IObservable<IObservable<TSource>> sources);
- IObservable<TSource> TakeUntil<TSource, TOther>(IObservable<TSource> source, IObservable<TOther> other);
- IObservable<IObservable<TSource>> Window<TSource, TWindowClosing>(IObservable<TSource> source, Func<IObservable<TWindowClosing>> windowClosingSelector);
- IObservable<IObservable<TSource>> Window<TSource, TWindowOpening, TWindowClosing>(IObservable<TSource> source, IObservable<TWindowOpening> windowOpenings, Func<TWindowOpening, IObservable<TWindowClosing>> windowClosingSelector);
- IObservable<IObservable<TSource>> Window<TSource, TWindowBoundary>(IObservable<TSource> source, IObservable<TWindowBoundary> windowBoundaries);
- IObservable<TResult> Zip<TFirst, TSecond, TResult>(IObservable<TFirst> first, IObservable<TSecond> second, Func<TFirst, TSecond, TResult> resultSelector);
- IObservable<TResult> Zip<TSource, TResult>(IEnumerable<IObservable<TSource>> sources, Func<IList<TSource>, TResult> resultSelector);
- IObservable<IList<TSource>> Zip<TSource>(IEnumerable<IObservable<TSource>> sources);
- IObservable<IList<TSource>> Zip<TSource>(params IObservable<TSource>[] sources);
-
-#if !NO_PERF
-
- IObservable<TResult> Zip<T1, T2, T3, TResult>(IObservable<T1> source1, IObservable<T2> source2, IObservable<T3> source3, Func<T1, T2, T3, TResult> resultSelector);
- IObservable<TResult> Zip<T1, T2, T3, T4, TResult>(IObservable<T1> source1, IObservable<T2> source2, IObservable<T3> source3, IObservable<T4> source4, Func<T1, T2, T3, T4, TResult> resultSelector);
-
-#if !NO_LARGEARITY
- IObservable<TResult> Zip<T1, T2, T3, T4, T5, TResult>(IObservable<T1> source1, IObservable<T2> source2, IObservable<T3> source3, IObservable<T4> source4, IObservable<T5> source5, Func<T1, T2, T3, T4, T5, TResult> resultSelector);
- IObservable<TResult> Zip<T1, T2, T3, T4, T5, T6, TResult>(IObservable<T1> source1, IObservable<T2> source2, IObservable<T3> source3, IObservable<T4> source4, IObservable<T5> source5, IObservable<T6> source6, Func<T1, T2, T3, T4, T5, T6, TResult> resultSelector);
- IObservable<TResult> Zip<T1, T2, T3, T4, T5, T6, T7, TResult>(IObservable<T1> source1, IObservable<T2> source2, IObservable<T3> source3, IObservable<T4> source4, IObservable<T5> source5, IObservable<T6> source6, IObservable<T7> source7, Func<T1, T2, T3, T4, T5, T6, T7, TResult> resultSelector);
- IObservable<TResult> Zip<T1, T2, T3, T4, T5, T6, T7, T8, TResult>(IObservable<T1> source1, IObservable<T2> source2, IObservable<T3> source3, IObservable<T4> source4, IObservable<T5> source5, IObservable<T6> source6, IObservable<T7> source7, IObservable<T8> source8, Func<T1, T2, T3, T4, T5, T6, T7, T8, TResult> resultSelector);
- IObservable<TResult> Zip<T1, T2, T3, T4, T5, T6, T7, T8, T9, TResult>(IObservable<T1> source1, IObservable<T2> source2, IObservable<T3> source3, IObservable<T4> source4, IObservable<T5> source5, IObservable<T6> source6, IObservable<T7> source7, IObservable<T8> source8, IObservable<T9> source9, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, TResult> resultSelector);
- IObservable<TResult> Zip<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, TResult>(IObservable<T1> source1, IObservable<T2> source2, IObservable<T3> source3, IObservable<T4> source4, IObservable<T5> source5, IObservable<T6> source6, IObservable<T7> source7, IObservable<T8> source8, IObservable<T9> source9, IObservable<T10> source10, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, TResult> resultSelector);
- IObservable<TResult> Zip<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, TResult>(IObservable<T1> source1, IObservable<T2> source2, IObservable<T3> source3, IObservable<T4> source4, IObservable<T5> source5, IObservable<T6> source6, IObservable<T7> source7, IObservable<T8> source8, IObservable<T9> source9, IObservable<T10> source10, IObservable<T11> source11, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, TResult> resultSelector);
- IObservable<TResult> Zip<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, TResult>(IObservable<T1> source1, IObservable<T2> source2, IObservable<T3> source3, IObservable<T4> source4, IObservable<T5> source5, IObservable<T6> source6, IObservable<T7> source7, IObservable<T8> source8, IObservable<T9> source9, IObservable<T10> source10, IObservable<T11> source11, IObservable<T12> source12, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, TResult> resultSelector);
- IObservable<TResult> Zip<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, TResult>(IObservable<T1> source1, IObservable<T2> source2, IObservable<T3> source3, IObservable<T4> source4, IObservable<T5> source5, IObservable<T6> source6, IObservable<T7> source7, IObservable<T8> source8, IObservable<T9> source9, IObservable<T10> source10, IObservable<T11> source11, IObservable<T12> source12, IObservable<T13> source13, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, TResult> resultSelector);
- IObservable<TResult> Zip<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, TResult>(IObservable<T1> source1, IObservable<T2> source2, IObservable<T3> source3, IObservable<T4> source4, IObservable<T5> source5, IObservable<T6> source6, IObservable<T7> source7, IObservable<T8> source8, IObservable<T9> source9, IObservable<T10> source10, IObservable<T11> source11, IObservable<T12> source12, IObservable<T13> source13, IObservable<T14> source14, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, TResult> resultSelector);
- IObservable<TResult> Zip<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, TResult>(IObservable<T1> source1, IObservable<T2> source2, IObservable<T3> source3, IObservable<T4> source4, IObservable<T5> source5, IObservable<T6> source6, IObservable<T7> source7, IObservable<T8> source8, IObservable<T9> source9, IObservable<T10> source10, IObservable<T11> source11, IObservable<T12> source12, IObservable<T13> source13, IObservable<T14> source14, IObservable<T15> source15, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, TResult> resultSelector);
- IObservable<TResult> Zip<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, TResult>(IObservable<T1> source1, IObservable<T2> source2, IObservable<T3> source3, IObservable<T4> source4, IObservable<T5> source5, IObservable<T6> source6, IObservable<T7> source7, IObservable<T8> source8, IObservable<T9> source9, IObservable<T10> source10, IObservable<T11> source11, IObservable<T12> source12, IObservable<T13> source13, IObservable<T14> source14, IObservable<T15> source15, IObservable<T16> source16, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, TResult> resultSelector);
-#endif
-
-#endif
-
- IObservable<TResult> Zip<TFirst, TSecond, TResult>(IObservable<TFirst> first, IEnumerable<TSecond> second, Func<TFirst, TSecond, TResult> resultSelector);
-
-#if !NO_TPL
- IObservable<TSource> Concat<TSource>(IObservable<Task<TSource>> sources);
- IObservable<TSource> Merge<TSource>(IObservable<Task<TSource>> sources);
- IObservable<TSource> Switch<TSource>(IObservable<Task<TSource>> sources);
-#endif
-
- #endregion
-
- #region * Single *
-
- IObservable<TSource> AsObservable<TSource>(IObservable<TSource> source);
- IObservable<IList<TSource>> Buffer<TSource>(IObservable<TSource> source, int count);
- IObservable<IList<TSource>> Buffer<TSource>(IObservable<TSource> source, int count, int skip);
- IObservable<TSource> Dematerialize<TSource>(IObservable<Notification<TSource>> source);
- IObservable<TSource> DistinctUntilChanged<TSource>(IObservable<TSource> source);
- IObservable<TSource> DistinctUntilChanged<TSource>(IObservable<TSource> source, IEqualityComparer<TSource> comparer);
- IObservable<TSource> DistinctUntilChanged<TSource, TKey>(IObservable<TSource> source, Func<TSource, TKey> keySelector);
- IObservable<TSource> DistinctUntilChanged<TSource, TKey>(IObservable<TSource> source, Func<TSource, TKey> keySelector, IEqualityComparer<TKey> comparer);
- IObservable<TSource> Do<TSource>(IObservable<TSource> source, Action<TSource> onNext);
- IObservable<TSource> Do<TSource>(IObservable<TSource> source, Action<TSource> onNext, Action onCompleted);
- IObservable<TSource> Do<TSource>(IObservable<TSource> source, Action<TSource> onNext, Action<Exception> onError);
- IObservable<TSource> Do<TSource>(IObservable<TSource> source, Action<TSource> onNext, Action<Exception> onError, Action onCompleted);
- IObservable<TSource> Do<TSource>(IObservable<TSource> source, IObserver<TSource> observer);
- IObservable<TSource> Finally<TSource>(IObservable<TSource> source, Action finallyAction);
- IObservable<TSource> IgnoreElements<TSource>(IObservable<TSource> source);
- IObservable<Notification<TSource>> Materialize<TSource>(IObservable<TSource> source);
- IObservable<TSource> Repeat<TSource>(IObservable<TSource> source);
- IObservable<TSource> Repeat<TSource>(IObservable<TSource> source, int repeatCount);
- IObservable<TSource> Retry<TSource>(IObservable<TSource> source);
- IObservable<TSource> Retry<TSource>(IObservable<TSource> source, int retryCount);
- IObservable<TAccumulate> Scan<TSource, TAccumulate>(IObservable<TSource> source, TAccumulate seed, Func<TAccumulate, TSource, TAccumulate> accumulator);
- IObservable<TSource> Scan<TSource>(IObservable<TSource> source, Func<TSource, TSource, TSource> accumulator);
- IObservable<TSource> SkipLast<TSource>(IObservable<TSource> source, int count);
- IObservable<TSource> StartWith<TSource>(IObservable<TSource> source, params TSource[] values);
- IObservable<TSource> StartWith<TSource>(IObservable<TSource> source, IScheduler scheduler, params TSource[] values);
- IObservable<TSource> TakeLast<TSource>(IObservable<TSource> source, int count);
- IObservable<TSource> TakeLast<TSource>(IObservable<TSource> source, int count, IScheduler scheduler);
- IObservable<IList<TSource>> TakeLastBuffer<TSource>(IObservable<TSource> source, int count);
- IObservable<IObservable<TSource>> Window<TSource>(IObservable<TSource> source, int count, int skip);
- IObservable<IObservable<TSource>> Window<TSource>(IObservable<TSource> source, int count);
-
- #endregion
-
- #region * StandardSequenceOperators *
-
- IObservable<TResult> Cast<TResult>(IObservable<object> source);
- IObservable<TSource> DefaultIfEmpty<TSource>(IObservable<TSource> source);
- IObservable<TSource> DefaultIfEmpty<TSource>(IObservable<TSource> source, TSource defaultValue);
- IObservable<TSource> Distinct<TSource>(IObservable<TSource> source);
- IObservable<TSource> Distinct<TSource>(IObservable<TSource> source, IEqualityComparer<TSource> comparer);
- IObservable<TSource> Distinct<TSource, TKey>(IObservable<TSource> source, Func<TSource, TKey> keySelector);
- IObservable<TSource> Distinct<TSource, TKey>(IObservable<TSource> source, Func<TSource, TKey> keySelector, IEqualityComparer<TKey> comparer);
- IObservable<IGroupedObservable<TKey, TElement>> GroupBy<TSource, TKey, TElement>(IObservable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector);
- IObservable<IGroupedObservable<TKey, TSource>> GroupBy<TSource, TKey>(IObservable<TSource> source, Func<TSource, TKey> keySelector, IEqualityComparer<TKey> comparer);
- IObservable<IGroupedObservable<TKey, TSource>> GroupBy<TSource, TKey>(IObservable<TSource> source, Func<TSource, TKey> keySelector);
- IObservable<IGroupedObservable<TKey, TElement>> GroupBy<TSource, TKey, TElement>(IObservable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector, IEqualityComparer<TKey> comparer);
- IObservable<IGroupedObservable<TKey, TElement>> GroupByUntil<TSource, TKey, TElement, TDuration>(IObservable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector, Func<IGroupedObservable<TKey, TElement>, IObservable<TDuration>> durationSelector, IEqualityComparer<TKey> comparer);
- IObservable<IGroupedObservable<TKey, TElement>> GroupByUntil<TSource, TKey, TElement, TDuration>(IObservable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector, Func<IGroupedObservable<TKey, TElement>, IObservable<TDuration>> durationSelector);
- IObservable<IGroupedObservable<TKey, TSource>> GroupByUntil<TSource, TKey, TDuration>(IObservable<TSource> source, Func<TSource, TKey> keySelector,Func<IGroupedObservable<TKey, TSource>, IObservable<TDuration>> durationSelector, IEqualityComparer<TKey> comparer);
- IObservable<IGroupedObservable<TKey, TSource>> GroupByUntil<TSource, TKey, TDuration>(IObservable<TSource> source, Func<TSource, TKey> keySelector, Func<IGroupedObservable<TKey, TSource>, IObservable<TDuration>> durationSelector);
- IObservable<TResult> GroupJoin<TLeft, TRight, TLeftDuration, TRightDuration, TResult>(IObservable<TLeft> left, IObservable<TRight> right, Func<TLeft, IObservable<TLeftDuration>> leftDurationSelector, Func<TRight, IObservable<TRightDuration>> rightDurationSelector, Func<TLeft, IObservable<TRight>, TResult> resultSelector);
- IObservable<TResult> Join<TLeft, TRight, TLeftDuration, TRightDuration, TResult>(IObservable<TLeft> left, IObservable<TRight> right, Func<TLeft, IObservable<TLeftDuration>> leftDurationSelector, Func<TRight, IObservable<TRightDuration>> rightDurationSelector, Func<TLeft, TRight, TResult> resultSelector);
- IObservable<TResult> OfType<TResult>(IObservable<object> source);
- IObservable<TResult> Select<TSource, TResult>(IObservable<TSource> source, Func<TSource, TResult> selector);
- IObservable<TResult> Select<TSource, TResult>(IObservable<TSource> source, Func<TSource, int, TResult> selector);
- IObservable<TOther> SelectMany<TSource, TOther>(IObservable<TSource> source, IObservable<TOther> other);
- IObservable<TResult> SelectMany<TSource, TResult>(IObservable<TSource> source, Func<TSource, IObservable<TResult>> selector);
- IObservable<TResult> SelectMany<TSource, TCollection, TResult>(IObservable<TSource> source, Func<TSource, IObservable<TCollection>> collectionSelector, Func<TSource, TCollection, TResult> resultSelector);
- IObservable<TResult> SelectMany<TSource, TResult>(IObservable<TSource> source, Func<TSource, IObservable<TResult>> onNext, Func<Exception, IObservable<TResult>> onError, Func<IObservable<TResult>> onCompleted);
- IObservable<TResult> SelectMany<TSource, TResult>(IObservable<TSource> source, Func<TSource, IEnumerable<TResult>> selector);
- IObservable<TResult> SelectMany<TSource, TCollection, TResult>(IObservable<TSource> source, Func<TSource, IEnumerable<TCollection>> collectionSelector, Func<TSource, TCollection, TResult> resultSelector);
- IObservable<TSource> Skip<TSource>(IObservable<TSource> source, int count);
- IObservable<TSource> SkipWhile<TSource>(IObservable<TSource> source, Func<TSource, bool> predicate);
- IObservable<TSource> SkipWhile<TSource>(IObservable<TSource> source, Func<TSource, int, bool> predicate);
- IObservable<TSource> Take<TSource>(IObservable<TSource> source, int count);
- IObservable<TSource> Take<TSource>(IObservable<TSource> source, int count, IScheduler scheduler);
- IObservable<TSource> TakeWhile<TSource>(IObservable<TSource> source, Func<TSource, bool> predicate);
- IObservable<TSource> TakeWhile<TSource>(IObservable<TSource> source, Func<TSource, int, bool> predicate);
- IObservable<TSource> Where<TSource>(IObservable<TSource> source, Func<TSource, bool> predicate);
- IObservable<TSource> Where<TSource>(IObservable<TSource> source, Func<TSource, int, bool> predicate);
-
-#if !NO_TPL
- IObservable<TResult> SelectMany<TSource, TResult>(IObservable<TSource> source, Func<TSource, Task<TResult>> selector);
- IObservable<TResult> SelectMany<TSource, TResult>(IObservable<TSource> source, Func<TSource, CancellationToken, Task<TResult>> selector);
- IObservable<TResult> SelectMany<TSource, TTaskResult, TResult>(IObservable<TSource> source, Func<TSource, Task<TTaskResult>> taskSelector, Func<TSource, TTaskResult, TResult> resultSelector);
- IObservable<TResult> SelectMany<TSource, TTaskResult, TResult>(IObservable<TSource> source, Func<TSource, CancellationToken, Task<TTaskResult>> taskSelector, Func<TSource, TTaskResult, TResult> resultSelector);
-#endif
-
- #endregion
-
- #region * Time *
-
- IObservable<IList<TSource>> Buffer<TSource>(IObservable<TSource> source, TimeSpan timeSpan);
- IObservable<IList<TSource>> Buffer<TSource>(IObservable<TSource> source, TimeSpan timeSpan, IScheduler scheduler);
- IObservable<IList<TSource>> Buffer<TSource>(IObservable<TSource> source, TimeSpan timeSpan, TimeSpan timeShift);
- IObservable<IList<TSource>> Buffer<TSource>(IObservable<TSource> source, TimeSpan timeSpan, TimeSpan timeShift, IScheduler scheduler);
- IObservable<IList<TSource>> Buffer<TSource>(IObservable<TSource> source, TimeSpan timeSpan, int count);
- IObservable<IList<TSource>> Buffer<TSource>(IObservable<TSource> source, TimeSpan timeSpan, int count, IScheduler scheduler);
- IObservable<TSource> Delay<TSource>(IObservable<TSource> source, TimeSpan dueTime);
- IObservable<TSource> Delay<TSource>(IObservable<TSource> source, TimeSpan dueTime, IScheduler scheduler);
- IObservable<TSource> Delay<TSource>(IObservable<TSource> source, DateTimeOffset dueTime);
- IObservable<TSource> Delay<TSource>(IObservable<TSource> source, DateTimeOffset dueTime, IScheduler scheduler);
- IObservable<TSource> Delay<TSource, TDelay>(IObservable<TSource> source, Func<TSource, IObservable<TDelay>> delayDurationSelector);
- IObservable<TSource> Delay<TSource, TDelay>(IObservable<TSource> source, IObservable<TDelay> subscriptionDelay, Func<TSource, IObservable<TDelay>> delayDurationSelector);
- IObservable<TSource> DelaySubscription<TSource>(IObservable<TSource> source, TimeSpan dueTime);
- IObservable<TSource> DelaySubscription<TSource>(IObservable<TSource> source, TimeSpan dueTime, IScheduler scheduler);
- IObservable<TSource> DelaySubscription<TSource>(IObservable<TSource> source, DateTimeOffset dueTime);
- IObservable<TSource> DelaySubscription<TSource>(IObservable<TSource> source, DateTimeOffset dueTime, IScheduler scheduler);
- IObservable<TResult> Generate<TState, TResult>(TState initialState, Func<TState, bool> condition, Func<TState, TState> iterate, Func<TState, TResult> resultSelector, Func<TState, TimeSpan> timeSelector);
- IObservable<TResult> Generate<TState, TResult>(TState initialState, Func<TState, bool> condition, Func<TState, TState> iterate, Func<TState, TResult> resultSelector, Func<TState, TimeSpan> timeSelector, IScheduler scheduler);
- IObservable<TResult> Generate<TState, TResult>(TState initialState, Func<TState, bool> condition, Func<TState, TState> iterate, Func<TState, TResult> resultSelector, Func<TState, DateTimeOffset> timeSelector);
- IObservable<TResult> Generate<TState, TResult>(TState initialState, Func<TState, bool> condition, Func<TState, TState> iterate, Func<TState, TResult> resultSelector, Func<TState, DateTimeOffset> timeSelector, IScheduler scheduler);
- IObservable<long> Interval(TimeSpan period);
- IObservable<long> Interval(TimeSpan period, IScheduler scheduler);
- IObservable<TSource> Sample<TSource>(IObservable<TSource> source, TimeSpan interval);
- IObservable<TSource> Sample<TSource>(IObservable<TSource> source, TimeSpan interval, IScheduler scheduler);
- IObservable<TSource> Sample<TSource, TSample>(IObservable<TSource> source, IObservable<TSample> sampler);
- IObservable<TSource> Skip<TSource>(IObservable<TSource> source, TimeSpan duration);
- IObservable<TSource> Skip<TSource>(IObservable<TSource> source, TimeSpan duration, IScheduler scheduler);
- IObservable<TSource> SkipLast<TSource>(IObservable<TSource> source, TimeSpan duration);
- IObservable<TSource> SkipLast<TSource>(IObservable<TSource> source, TimeSpan duration, IScheduler scheduler);
- IObservable<TSource> SkipUntil<TSource>(IObservable<TSource> source, DateTimeOffset startTime);
- IObservable<TSource> SkipUntil<TSource>(IObservable<TSource> source, DateTimeOffset startTime, IScheduler scheduler);
- IObservable<TSource> Take<TSource>(IObservable<TSource> source, TimeSpan duration);
- IObservable<TSource> Take<TSource>(IObservable<TSource> source, TimeSpan duration, IScheduler scheduler);
- IObservable<TSource> TakeLast<TSource>(IObservable<TSource> source, TimeSpan duration);
- IObservable<TSource> TakeLast<TSource>(IObservable<TSource> source, TimeSpan duration, IScheduler scheduler);
- IObservable<TSource> TakeLast<TSource>(IObservable<TSource> source, TimeSpan duration, IScheduler timerScheduler, IScheduler loopScheduler);
- IObservable<IList<TSource>> TakeLastBuffer<TSource>(IObservable<TSource> source, TimeSpan duration);
- IObservable<IList<TSource>> TakeLastBuffer<TSource>(IObservable<TSource> source, TimeSpan duration, IScheduler scheduler);
- IObservable<TSource> TakeUntil<TSource>(IObservable<TSource> source, DateTimeOffset endTime);
- IObservable<TSource> TakeUntil<TSource>(IObservable<TSource> source, DateTimeOffset endTime, IScheduler scheduler);
- IObservable<TSource> Throttle<TSource>(IObservable<TSource> source, TimeSpan dueTime);
- IObservable<TSource> Throttle<TSource>(IObservable<TSource> source, TimeSpan dueTime, IScheduler scheduler);
- IObservable<TSource> Throttle<TSource, TThrottle>(IObservable<TSource> source, Func<TSource, IObservable<TThrottle>> throttleDurationSelector);
- IObservable<System.Reactive.TimeInterval<TSource>> TimeInterval<TSource>(IObservable<TSource> source);
- IObservable<System.Reactive.TimeInterval<TSource>> TimeInterval<TSource>(IObservable<TSource> source, IScheduler scheduler);
- IObservable<TSource> Timeout<TSource>(IObservable<TSource> source, TimeSpan dueTime);
- IObservable<TSource> Timeout<TSource>(IObservable<TSource> source, TimeSpan dueTime, IScheduler scheduler);
- IObservable<TSource> Timeout<TSource>(IObservable<TSource> source, TimeSpan dueTime, IObservable<TSource> other);
- IObservable<TSource> Timeout<TSource>(IObservable<TSource> source, TimeSpan dueTime, IObservable<TSource> other, IScheduler scheduler);
- IObservable<TSource> Timeout<TSource>(IObservable<TSource> source, DateTimeOffset dueTime);
- IObservable<TSource> Timeout<TSource>(IObservable<TSource> source, DateTimeOffset dueTime, IScheduler scheduler);
- IObservable<TSource> Timeout<TSource>(IObservable<TSource> source, DateTimeOffset dueTime, IObservable<TSource> other);
- IObservable<TSource> Timeout<TSource>(IObservable<TSource> source, DateTimeOffset dueTime, IObservable<TSource> other, IScheduler scheduler);
- IObservable<TSource> Timeout<TSource, TTimeout>(IObservable<TSource> source, Func<TSource, IObservable<TTimeout>> timeoutDurationSelector);
- IObservable<TSource> Timeout<TSource, TTimeout>(IObservable<TSource> source, Func<TSource, IObservable<TTimeout>> timeoutDurationSelector, IObservable<TSource> other);
- IObservable<TSource> Timeout<TSource, TTimeout>(IObservable<TSource> source, IObservable<TTimeout> firstTimeout, Func<TSource, IObservable<TTimeout>> timeoutDurationSelector);
- IObservable<TSource> Timeout<TSource, TTimeout>(IObservable<TSource> source, IObservable<TTimeout> firstTimeout, Func<TSource, IObservable<TTimeout>> timeoutDurationSelector, IObservable<TSource> other);
- IObservable<long> Timer(TimeSpan dueTime);
- IObservable<long> Timer(DateTimeOffset dueTime);
- IObservable<long> Timer(TimeSpan dueTime, TimeSpan period);
- IObservable<long> Timer(DateTimeOffset dueTime, TimeSpan period);
- IObservable<long> Timer(TimeSpan dueTime, IScheduler scheduler);
- IObservable<long> Timer(DateTimeOffset dueTime, IScheduler scheduler);
- IObservable<long> Timer(TimeSpan dueTime, TimeSpan period, IScheduler scheduler);
- IObservable<long> Timer(DateTimeOffset dueTime, TimeSpan period, IScheduler scheduler);
- IObservable<Timestamped<TSource>> Timestamp<TSource>(IObservable<TSource> source);
- IObservable<Timestamped<TSource>> Timestamp<TSource>(IObservable<TSource> source, IScheduler scheduler);
- IObservable<IObservable<TSource>> Window<TSource>(IObservable<TSource> source, TimeSpan timeSpan);
- IObservable<IObservable<TSource>> Window<TSource>(IObservable<TSource> source, TimeSpan timeSpan, IScheduler scheduler);
- IObservable<IObservable<TSource>> Window<TSource>(IObservable<TSource> source, TimeSpan timeSpan, TimeSpan timeShift);
- IObservable<IObservable<TSource>> Window<TSource>(IObservable<TSource> source, TimeSpan timeSpan, TimeSpan timeShift, IScheduler scheduler);
- IObservable<IObservable<TSource>> Window<TSource>(IObservable<TSource> source, TimeSpan timeSpan, int count);
- IObservable<IObservable<TSource>> Window<TSource>(IObservable<TSource> source, TimeSpan timeSpan, int count, IScheduler scheduler);
-
- #endregion
- }
-}
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/LocalQueryMethodImplementationTypeAttribute.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/LocalQueryMethodImplementationTypeAttribute.cs
deleted file mode 100644
index f8cb882..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/LocalQueryMethodImplementationTypeAttribute.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System;
-using System.ComponentModel;
-
-namespace System.Reactive.Linq
-{
- /// <summary>
- /// Attribute applied to static classes providing expression tree forms of query methods,
- /// mapping those to the corresponding methods for local query execution on the specified
- /// target class type.
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
- public sealed class LocalQueryMethodImplementationTypeAttribute : Attribute
- {
- private readonly Type _targetType;
-
- /// <summary>
- /// Creates a new mapping to the specified local execution query method implementation type.
- /// </summary>
- /// <param name="targetType">Type with query methods for local execution.</param>
- public LocalQueryMethodImplementationTypeAttribute(Type targetType)
- {
- _targetType = targetType;
- }
-
- /// <summary>
- /// Gets the type with the implementation of local query methods.
- /// </summary>
- public Type TargetType
- {
- get { return _targetType; }
- }
- }
-}
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observable.Aggregates.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observable.Aggregates.cs
deleted file mode 100644
index b541765..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observable.Aggregates.cs
+++ /dev/null
@@ -1,2554 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System.Collections.Generic;
-using System.Linq;
-
-namespace System.Reactive.Linq
-{
- public static partial class Observable
- {
- #region + Aggregate +
-
- /// <summary>
- /// Applies an accumulator function over an observable sequence, returning the result of the aggregation as a single element in the result sequence. The specified seed value is used as the initial accumulator value.
- /// For aggregation behavior with incremental intermediate results, see <see cref="Observable.Scan&lt;TSource, Accumulate&gt;"/>.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TAccumulate">The type of the result of the aggregation.</typeparam>
- /// <param name="source">An observable sequence to aggregate over.</param>
- /// <param name="seed">The initial accumulator value.</param>
- /// <param name="accumulator">An accumulator function to be invoked on each element.</param>
- /// <returns>An observable sequence containing a single element with the final accumulator value.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="accumulator"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<TAccumulate> Aggregate<TSource, TAccumulate>(this IObservable<TSource> source, TAccumulate seed, Func<TAccumulate, TSource, TAccumulate> accumulator)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (accumulator == null)
- throw new ArgumentNullException("accumulator");
-
- return s_impl.Aggregate<TSource, TAccumulate>(source, seed, accumulator);
- }
-
- /// <summary>
- /// Applies an accumulator function over an observable sequence, returning the result of the aggregation as a single element in the result sequence. The specified seed value is used as the initial accumulator value,
- /// and the specified result selector function is used to select the result value.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TAccumulate">The type of the accumulator value.</typeparam>
- /// <typeparam name="TResult">The type of the resulting value.</typeparam>
- /// <param name="source">An observable sequence to aggregate over.</param>
- /// <param name="seed">The initial accumulator value.</param>
- /// <param name="accumulator">An accumulator function to be invoked on each element.</param>
- /// <param name="resultSelector">A function to transform the final accumulator value into the result value.</param>
- /// <returns>An observable sequence containing a single element with the final accumulator value.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="accumulator"/> or <paramref name="resultSelector"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<TResult> Aggregate<TSource, TAccumulate, TResult>(this IObservable<TSource> source, TAccumulate seed, Func<TAccumulate, TSource, TAccumulate> accumulator, Func<TAccumulate, TResult> resultSelector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (accumulator == null)
- throw new ArgumentNullException("accumulator");
- if (resultSelector == null)
- throw new ArgumentNullException("resultSelector");
-
- return s_impl.Aggregate<TSource, TAccumulate, TResult>(source, seed, accumulator, resultSelector);
- }
-
- /// <summary>
- /// Applies an accumulator function over an observable sequence, returning the result of the aggregation as a single element in the result sequence.
- /// For aggregation behavior with incremental intermediate results, see <see cref="Observable.Scan&lt;TSource&gt;"/>.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence and the result of the aggregation.</typeparam>
- /// <param name="source">An observable sequence to aggregate over.</param>
- /// <param name="accumulator">An accumulator function to be invoked on each element.</param>
- /// <returns>An observable sequence containing a single element with the final accumulator value.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="accumulator"/> is null.</exception>
- /// <exception cref="InvalidOperationException">(Asynchronous) The source sequence is empty.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<TSource> Aggregate<TSource>(this IObservable<TSource> source, Func<TSource, TSource, TSource> accumulator)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (accumulator == null)
- throw new ArgumentNullException("accumulator");
-
- return s_impl.Aggregate<TSource>(source, accumulator);
- }
-
- #endregion
-
- #region + All +
-
- /// <summary>
- /// Determines whether all elements of an observable sequence satisfy a condition.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">An observable sequence whose elements to apply the predicate to.</param>
- /// <param name="predicate">A function to test each element for a condition.</param>
- /// <returns>An observable sequence containing a single element determining whether all elements in the source sequence pass the test in the specified predicate.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="predicate"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<bool> All<TSource>(this IObservable<TSource> source, Func<TSource, bool> predicate)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (predicate == null)
- throw new ArgumentNullException("predicate");
-
- return s_impl.All<TSource>(source, predicate);
- }
-
- #endregion
-
- #region + Any +
-
- /// <summary>
- /// Determines whether an observable sequence contains any elements.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">An observable sequence to check for non-emptiness.</param>
- /// <returns>An observable sequence containing a single element determining whether the source sequence contains any elements.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<bool> Any<TSource>(this IObservable<TSource> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return s_impl.Any<TSource>(source);
- }
-
- /// <summary>
- /// Determines whether any element of an observable sequence satisfies a condition.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">An observable sequence whose elements to apply the predicate to.</param>
- /// <param name="predicate">A function to test each element for a condition.</param>
- /// <returns>An observable sequence containing a single element determining whether any elements in the source sequence pass the test in the specified predicate.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="predicate"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<bool> Any<TSource>(this IObservable<TSource> source, Func<TSource, bool> predicate)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (predicate == null)
- throw new ArgumentNullException("predicate");
-
- return s_impl.Any<TSource>(source, predicate);
- }
-
- #endregion
-
- #region + Average +
-
- /// <summary>
- /// Computes the average of an observable sequence of <see cref="T:System.Double" /> values.
- /// </summary>
- /// <param name="source">A sequence of <see cref="T:System.Double" /> values to calculate the average of.</param>
- /// <returns>An observable sequence containing a single element with the average of the sequence of values.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <exception cref="InvalidOperationException">(Asynchronous) The source sequence is empty.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<double> Average(this IObservable<double> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return s_impl.Average(source);
- }
-
- /// <summary>
- /// Computes the average of an observable sequence of <see cref="T:System.Single" /> values.
- /// </summary>
- /// <param name="source">A sequence of <see cref="T:System.Single" /> values to calculate the average of.</param>
- /// <returns>An observable sequence containing a single element with the average of the sequence of values.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <exception cref="InvalidOperationException">(Asynchronous) The source sequence is empty.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<float> Average(this IObservable<float> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return s_impl.Average(source);
- }
-
- /// <summary>
- /// Computes the average of an observable sequence of <see cref="T:System.Decimal" /> values.
- /// </summary>
- /// <param name="source">A sequence of <see cref="T:System.Decimal" /> values to calculate the average of.</param>
- /// <returns>An observable sequence containing a single element with the average of the sequence of values.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <exception cref="InvalidOperationException">(Asynchronous) The source sequence is empty.</exception>
- /// <exception cref="OverflowException">(Asynchronous) The sum of the elements in the source sequence is larger than <see cref="M:System.Decimal.MaxValue"/>.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<decimal> Average(this IObservable<decimal> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return s_impl.Average(source);
- }
-
- /// <summary>
- /// Computes the average of an observable sequence of <see cref="T:System.Int32" /> values.
- /// </summary>
- /// <param name="source">A sequence of <see cref="T:System.Int32" /> values to calculate the average of.</param>
- /// <returns>An observable sequence containing a single element with the average of the sequence of values.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <exception cref="InvalidOperationException">(Asynchronous) The source sequence is empty.</exception>
- /// <exception cref="OverflowException">(Asynchronous) The sum of the elements in the source sequence is larger than <see cref="M:System.Int64.MaxValue"/>.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<double> Average(this IObservable<int> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return s_impl.Average(source);
- }
-
- /// <summary>
- /// Computes the average of an observable sequence of <see cref="T:System.Int64" /> values.
- /// </summary>
- /// <param name="source">A sequence of <see cref="T:System.Int64" /> values to calculate the average of.</param>
- /// <returns>An observable sequence containing a single element with the average of the sequence of values.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <exception cref="InvalidOperationException">(Asynchronous) The source sequence is empty.</exception>
- /// <exception cref="OverflowException">(Asynchronous) The sum of the elements in the source sequence is larger than <see cref="M:System.Int64.MaxValue"/>.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<double> Average(this IObservable<long> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return s_impl.Average(source);
- }
-
- /// <summary>
- /// Computes the average of an observable sequence of nullable <see cref="T:System.Double" /> values.
- /// </summary>
- /// <param name="source">A sequence of nullable <see cref="T:System.Double" /> values to calculate the average of.</param>
- /// <returns>An observable sequence containing a single element with the average of the sequence of values, or null if the source sequence is empty or contains only values that are null.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <exception cref="InvalidOperationException">(Asynchronous) The source sequence is empty.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<double?> Average(this IObservable<double?> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return s_impl.Average(source);
- }
-
- /// <summary>
- /// Computes the average of an observable sequence of nullable <see cref="T:System.Single" /> values.
- /// </summary>
- /// <param name="source">A sequence of nullable <see cref="T:System.Single" /> values to calculate the average of.</param>
- /// <returns>An observable sequence containing a single element with the average of the sequence of values, or null if the source sequence is empty or contains only values that are null.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <exception cref="InvalidOperationException">(Asynchronous) The source sequence is empty.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<float?> Average(this IObservable<float?> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return s_impl.Average(source);
- }
-
- /// <summary>
- /// Computes the average of an observable sequence of nullable <see cref="T:System.Decimal" /> values.
- /// </summary>
- /// <param name="source">A sequence of nullable <see cref="T:System.Decimal" /> values to calculate the average of.</param>
- /// <returns>An observable sequence containing a single element with the average of the sequence of values, or null if the source sequence is empty or contains only values that are null.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <exception cref="InvalidOperationException">(Asynchronous) The source sequence is empty.</exception>
- /// <exception cref="OverflowException">(Asynchronous) The sum of the elements in the source sequence is larger than <see cref="M:System.Decimal.MaxValue"/>.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<decimal?> Average(this IObservable<decimal?> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return s_impl.Average(source);
- }
-
- /// <summary>
- /// Computes the average of an observable sequence of nullable <see cref="T:System.Int32" /> values.
- /// </summary>
- /// <param name="source">A sequence of nullable <see cref="T:System.Int32" /> values to calculate the average of.</param>
- /// <returns>An observable sequence containing a single element with the average of the sequence of values, or null if the source sequence is empty or contains only values that are null.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <exception cref="InvalidOperationException">(Asynchronous) The source sequence is empty.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- /// <exception cref="OverflowException">(Asynchronous) The sum of the elements in the source sequence is larger than <see cref="M:System.Int64.MaxValue"/>.</exception>
- public static IObservable<double?> Average(this IObservable<int?> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return s_impl.Average(source);
- }
-
- /// <summary>
- /// Computes the average of an observable sequence of nullable <see cref="T:System.Int64" /> values.
- /// </summary>
- /// <param name="source">A sequence of nullable <see cref="T:System.Int64" /> values to calculate the average of.</param>
- /// <returns>An observable sequence containing a single element with the average of the sequence of values, or null if the source sequence is empty or contains only values that are null.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <exception cref="InvalidOperationException">(Asynchronous) The source sequence is empty.</exception>
- /// <exception cref="OverflowException">(Asynchronous) The sum of the elements in the source sequence is larger than <see cref="M:System.Int64.MaxValue"/>.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<double?> Average(this IObservable<long?> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return s_impl.Average(source);
- }
-
- /// <summary>
- /// Computes the average of an observable sequence of <see cref="T:System.Decimal" /> values that are obtained by invoking a transform function on each element of the input sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values to calculate the average of.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the average of the sequence of values.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> is null.</exception>
- /// <exception cref="InvalidOperationException">(Asynchronous) The source sequence is empty.</exception>
- /// <exception cref="OverflowException">(Asynchronous) The sum of the projected values for the elements in the source sequence is larger than <see cref="M:System.Decimal.MaxValue"/>.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<decimal> Average<TSource>(this IObservable<TSource> source, Func<TSource, decimal> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return s_impl.Average<TSource>(source, selector);
- }
-
- /// <summary>
- /// Computes the average of an observable sequence of <see cref="T:System.Double" /> values that are obtained by invoking a transform function on each element of the input sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values to calculate the average of.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the average of the sequence of values.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> is null.</exception>
- /// <exception cref="InvalidOperationException">(Asynchronous) The source sequence is empty.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<double> Average<TSource>(this IObservable<TSource> source, Func<TSource, double> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return s_impl.Average<TSource>(source, selector);
- }
-
- /// <summary>
- /// Computes the average of an observable sequence of <see cref="T:System.Single" /> values that are obtained by invoking a transform function on each element of the input sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values to calculate the average of.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the average of the sequence of values.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> is null.</exception>
- /// <exception cref="InvalidOperationException">(Asynchronous) The source sequence is empty.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<float> Average<TSource>(this IObservable<TSource> source, Func<TSource, float> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return s_impl.Average<TSource>(source, selector);
- }
-
- /// <summary>
- /// Computes the average of an observable sequence of <see cref="T:System.Int32" /> values that are obtained by invoking a transform function on each element of the input sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values to calculate the average of.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the average of the sequence of values.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> is null.</exception>
- /// <exception cref="InvalidOperationException">(Asynchronous) The source sequence is empty.</exception>
- /// <exception cref="OverflowException">(Asynchronous) The sum of the projected values for the elements in the source sequence is larger than <see cref="M:System.Int64.MaxValue"/>.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<double> Average<TSource>(this IObservable<TSource> source, Func<TSource, int> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return s_impl.Average<TSource>(source, selector);
- }
-
- /// <summary>
- /// Computes the average of an observable sequence of <see cref="T:System.Int64" /> values that are obtained by invoking a transform function on each element of the input sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values to calculate the average of.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the average of the sequence of values.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> is null.</exception>
- /// <exception cref="InvalidOperationException">(Asynchronous) The source sequence is empty.</exception>
- /// <exception cref="OverflowException">(Asynchronous) The sum of the projected values for the elements in the source sequence is larger than <see cref="M:System.Int64.MaxValue"/>.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<double> Average<TSource>(this IObservable<TSource> source, Func<TSource, long> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return s_impl.Average<TSource>(source, selector);
- }
-
- /// <summary>
- /// Computes the average of an observable sequence of nullable <see cref="T:System.Decimal" /> values that are obtained by invoking a transform function on each element of the input sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values to calculate the average of.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the average of the sequence of values, or null if the source sequence is empty or contains only values that are null.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> is null.</exception>
- /// <exception cref="InvalidOperationException">(Asynchronous) The source sequence is empty.</exception>
- /// <exception cref="OverflowException">(Asynchronous) The sum of the projected values for the elements in the source sequence is larger than <see cref="M:System.Decimal.MaxValue"/>.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<decimal?> Average<TSource>(this IObservable<TSource> source, Func<TSource, decimal?> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return s_impl.Average<TSource>(source, selector);
- }
-
- /// <summary>
- /// Computes the average of an observable sequence of nullable <see cref="T:System.Double" /> values that are obtained by invoking a transform function on each element of the input sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values to calculate the average of.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the average of the sequence of values, or null if the source sequence is empty or contains only values that are null.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> is null.</exception>
- /// <exception cref="InvalidOperationException">(Asynchronous) The source sequence is empty.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<double?> Average<TSource>(this IObservable<TSource> source, Func<TSource, double?> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return s_impl.Average<TSource>(source, selector);
- }
-
- /// <summary>
- /// Computes the average of an observable sequence of nullable <see cref="T:System.Single" /> values that are obtained by invoking a transform function on each element of the input sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values to calculate the average of.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the average of the sequence of values, or null if the source sequence is empty or contains only values that are null.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> is null.</exception>
- /// <exception cref="InvalidOperationException">(Asynchronous) The source sequence is empty.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<float?> Average<TSource>(this IObservable<TSource> source, Func<TSource, float?> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return s_impl.Average<TSource>(source, selector);
- }
-
- /// <summary>
- /// Computes the average of an observable sequence of nullable <see cref="T:System.Int32" /> values that are obtained by invoking a transform function on each element of the input sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values to calculate the average of.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the average of the sequence of values, or null if the source sequence is empty or contains only values that are null.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> is null.</exception>
- /// <exception cref="InvalidOperationException">(Asynchronous) The source sequence is empty.</exception>
- /// <exception cref="OverflowException">(Asynchronous) The sum of the projected values for the elements in the source sequence is larger than <see cref="M:System.Int64.MaxValue"/>.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<double?> Average<TSource>(this IObservable<TSource> source, Func<TSource, int?> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return s_impl.Average<TSource>(source, selector);
- }
-
- /// <summary>
- /// Computes the average of an observable sequence of nullable <see cref="T:System.Int64" /> values that are obtained by invoking a transform function on each element of the input sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values to calculate the average of.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the average of the sequence of values, or null if the source sequence is empty or contains only values that are null.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> is null.</exception>
- /// <exception cref="InvalidOperationException">(Asynchronous) The source sequence is empty.</exception>
- /// <exception cref="OverflowException">(Asynchronous) The sum of the projected values for the elements in the source sequence is larger than <see cref="M:System.Int64.MaxValue"/>.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<double?> Average<TSource>(this IObservable<TSource> source, Func<TSource, long?> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return s_impl.Average<TSource>(source, selector);
- }
-
- #endregion
-
- #region + Contains +
-
- /// <summary>
- /// Determines whether an observable sequence contains a specified element by using the default equality comparer.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">An observable sequence in which to locate a value.</param>
- /// <param name="value">The value to locate in the source sequence.</param>
- /// <returns>An observable sequence containing a single element determining whether the source sequence contains an element that has the specified value.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<bool> Contains<TSource>(this IObservable<TSource> source, TSource value)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return s_impl.Contains<TSource>(source, value);
- }
-
- /// <summary>
- /// Determines whether an observable sequence contains a specified element by using a specified System.Collections.Generic.IEqualityComparer&lt;T&gt;.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">An observable sequence in which to locate a value.</param>
- /// <param name="value">The value to locate in the source sequence.</param>
- /// <param name="comparer">An equality comparer to compare elements.</param>
- /// <returns>An observable sequence containing a single element determining whether the source sequence contains an element that has the specified value.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="comparer"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<bool> Contains<TSource>(this IObservable<TSource> source, TSource value, IEqualityComparer<TSource> comparer)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (comparer == null)
- throw new ArgumentNullException("comparer");
-
- return s_impl.Contains<TSource>(source, value, comparer);
- }
-
- #endregion
-
- #region + Count +
-
- /// <summary>
- /// Returns an observable sequence containing an <see cref="T:System.Int32" /> that represents the total number of elements in an observable sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">An observable sequence that contains elements to be counted.</param>
- /// <returns>An observable sequence containing a single element with the number of elements in the input sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <exception cref="OverflowException">(Asynchronous) The number of elements in the source sequence is larger than <see cref="M:System.Int64.MaxValue"/>.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<int> Count<TSource>(this IObservable<TSource> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return s_impl.Count<TSource>(source);
- }
-
- /// <summary>
- /// Returns an observable sequence containing an <see cref="T:System.Int32" /> that represents how many elements in the specified observable sequence satisfy a condition.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">An observable sequence that contains elements to be counted.</param>
- /// <param name="predicate">A function to test each element for a condition.</param>
- /// <returns>An observable sequence containing a single element with a number that represents how many elements in the input sequence satisfy the condition in the predicate function.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="predicate"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<int> Count<TSource>(this IObservable<TSource> source, Func<TSource, bool> predicate)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (predicate == null)
- throw new ArgumentNullException("predicate");
-
- return s_impl.Count<TSource>(source, predicate);
- }
-
- #endregion
-
- #region + ElementAt +
-
- /// <summary>
- /// Returns the element at a specified index in a sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Observable sequence to return the element from.</param>
- /// <param name="index">The zero-based index of the element to retrieve.</param>
- /// <returns>An observable sequence that produces the element at the specified position in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <exception cref="ArgumentOutOfRangeException"><paramref name="index"/> is less than zero.</exception>
- /// <exception cref="ArgumentOutOfRangeException">(Asynchronous) <paramref name="index"/> is greater than or equal to the number of elements in the source sequence.</exception>
- public static IObservable<TSource> ElementAt<TSource>(this IObservable<TSource> source, int index)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (index < 0)
- throw new ArgumentOutOfRangeException("index");
-
- return s_impl.ElementAt<TSource>(source, index);
- }
-
- #endregion
-
- #region + ElementAtOrDefault +
-
- /// <summary>
- /// Returns the element at a specified index in a sequence or a default value if the index is out of range.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Observable sequence to return the element from.</param>
- /// <param name="index">The zero-based index of the element to retrieve.</param>
- /// <returns>An observable sequence that produces the element at the specified position in the source sequence, or a default value if the index is outside the bounds of the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <exception cref="ArgumentOutOfRangeException"><paramref name="index"/> is less than zero.</exception>
- public static IObservable<TSource> ElementAtOrDefault<TSource>(this IObservable<TSource> source, int index)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (index < 0)
- throw new ArgumentOutOfRangeException("index");
-
- return s_impl.ElementAtOrDefault<TSource>(source, index);
- }
-
- #endregion
-
- #region + FirstAsync +
-
- /// <summary>
- /// Returns the first element of an observable sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source observable sequence.</param>
- /// <returns>Sequence containing the first element in the observable sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <exception cref="InvalidOperationException">(Asynchronous) The source sequence is empty.</exception>
- public static IObservable<TSource> FirstAsync<TSource>(this IObservable<TSource> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return s_impl.FirstAsync<TSource>(source);
- }
-
- /// <summary>
- /// Returns the first element of an observable sequence that satisfies the condition in the predicate.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source observable sequence.</param>
- /// <param name="predicate">A predicate function to evaluate for elements in the source sequence.</param>
- /// <returns>Sequence containing the first element in the observable sequence that satisfies the condition in the predicate.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="predicate"/> is null.</exception>
- /// <exception cref="InvalidOperationException">(Asynchronous) No element satisfies the condition in the predicate. -or- The source sequence is empty.</exception>
- public static IObservable<TSource> FirstAsync<TSource>(this IObservable<TSource> source, Func<TSource, bool> predicate)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (predicate == null)
- throw new ArgumentNullException("predicate");
-
- return s_impl.FirstAsync<TSource>(source, predicate);
- }
-
- #endregion
-
- #region + FirstOrDefaultAsync +
-
- /// <summary>
- /// Returns the first element of an observable sequence, or a default value if no such element exists.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source observable sequence.</param>
- /// <returns>Sequence containing the first element in the observable sequence, or a default value if no such element exists.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- public static IObservable<TSource> FirstOrDefaultAsync<TSource>(this IObservable<TSource> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return s_impl.FirstOrDefaultAsync<TSource>(source);
- }
-
- /// <summary>
- /// Returns the first element of an observable sequence that satisfies the condition in the predicate, or a default value if no such element exists.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source observable sequence.</param>
- /// <param name="predicate">A predicate function to evaluate for elements in the source sequence.</param>
- /// <returns>Sequence containing the first element in the observable sequence that satisfies the condition in the predicate, or a default value if no such element exists.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="predicate"/> is null.</exception>
- public static IObservable<TSource> FirstOrDefaultAsync<TSource>(this IObservable<TSource> source, Func<TSource, bool> predicate)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (predicate == null)
- throw new ArgumentNullException("predicate");
-
- return s_impl.FirstOrDefaultAsync<TSource>(source, predicate);
- }
-
- #endregion
-
- #region + IsEmpty +
-
- /// <summary>
- /// Determines whether an observable sequence is empty.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">An observable sequence to check for emptiness.</param>
- /// <returns>An observable sequence containing a single element determining whether the source sequence is empty.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- public static IObservable<bool> IsEmpty<TSource>(this IObservable<TSource> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return s_impl.IsEmpty<TSource>(source);
- }
-
- #endregion
-
- #region + LastAsync +
-
- /// <summary>
- /// Returns the last element of an observable sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source observable sequence.</param>
- /// <returns>Sequence containing the last element in the observable sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <exception cref="InvalidOperationException">(Asynchronous) The source sequence is empty.</exception>
- public static IObservable<TSource> LastAsync<TSource>(this IObservable<TSource> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return s_impl.LastAsync<TSource>(source);
- }
-
- /// <summary>
- /// Returns the last element of an observable sequence that satisfies the condition in the predicate.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source observable sequence.</param>
- /// <param name="predicate">A predicate function to evaluate for elements in the source sequence.</param>
- /// <returns>Sequence containing the last element in the observable sequence that satisfies the condition in the predicate.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="predicate"/> is null.</exception>
- /// <exception cref="InvalidOperationException">(Asynchronous) No element satisfies the condition in the predicate. -or- The source sequence is empty.</exception>
- public static IObservable<TSource> LastAsync<TSource>(this IObservable<TSource> source, Func<TSource, bool> predicate)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (predicate == null)
- throw new ArgumentNullException("predicate");
-
- return s_impl.LastAsync<TSource>(source, predicate);
- }
-
- #endregion
-
- #region + LastOrDefaultAsync +
-
- /// <summary>
- /// Returns the last element of an observable sequence, or a default value if no such element exists.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source observable sequence.</param>
- /// <returns>Sequence containing the last element in the observable sequence, or a default value if no such element exists.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- public static IObservable<TSource> LastOrDefaultAsync<TSource>(this IObservable<TSource> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return s_impl.LastOrDefaultAsync<TSource>(source);
- }
-
- /// <summary>
- /// Returns the last element of an observable sequence that satisfies the condition in the predicate, or a default value if no such element exists.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source observable sequence.</param>
- /// <param name="predicate">A predicate function to evaluate for elements in the source sequence.</param>
- /// <returns>Sequence containing the last element in the observable sequence that satisfies the condition in the predicate, or a default value if no such element exists.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="predicate"/> is null.</exception>
- public static IObservable<TSource> LastOrDefaultAsync<TSource>(this IObservable<TSource> source, Func<TSource, bool> predicate)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (predicate == null)
- throw new ArgumentNullException("predicate");
-
- return s_impl.LastOrDefaultAsync<TSource>(source, predicate);
- }
-
- #endregion
-
- #region + LongCount +
-
- /// <summary>
- /// Returns an observable sequence containing an <see cref="T:System.Int64" /> that represents the total number of elements in an observable sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">An observable sequence that contains elements to be counted.</param>
- /// <returns>An observable sequence containing a single element with the number of elements in the input sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <exception cref="OverflowException">(Asynchronous) The number of elements in the source sequence is larger than <see cref="M:System.Int64.MaxValue"/>.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<long> LongCount<TSource>(this IObservable<TSource> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return s_impl.LongCount<TSource>(source);
- }
-
- /// <summary>
- /// Returns an observable sequence containing an <see cref="T:System.Int64" /> that represents how many elements in the specified observable sequence satisfy a condition.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">An observable sequence that contains elements to be counted.</param>
- /// <param name="predicate">A function to test each element for a condition.</param>
- /// <returns>An observable sequence containing a single element with a number that represents how many elements in the input sequence satisfy the condition in the predicate function.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="predicate"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<long> LongCount<TSource>(this IObservable<TSource> source, Func<TSource, bool> predicate)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (predicate == null)
- throw new ArgumentNullException("predicate");
-
- return s_impl.LongCount<TSource>(source, predicate);
- }
-
- #endregion
-
- #region + Max +
-
- /// <summary>
- /// Returns the maximum element in an observable sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">An observable sequence to determine the maximum element of.</param>
- /// <returns>An observable sequence containing a single element with the maximum element in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<TSource> Max<TSource>(this IObservable<TSource> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return s_impl.Max<TSource>(source);
- }
-
- /// <summary>
- /// Returns the maximum value in an observable sequence according to the specified comparer.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">An observable sequence to determine the maximum element of.</param>
- /// <param name="comparer">Comparer used to compare elements.</param>
- /// <returns>An observable sequence containing a single element with the maximum element in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="comparer"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<TSource> Max<TSource>(this IObservable<TSource> source, IComparer<TSource> comparer)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (comparer == null)
- throw new ArgumentNullException("comparer");
-
- return s_impl.Max<TSource>(source, comparer);
- }
-
- /// <summary>
- /// Returns the maximum value in an observable sequence of <see cref="T:System.Double" /> values.
- /// </summary>
- /// <param name="source">A sequence of <see cref="T:System.Double" /> values to determine the maximum value of.</param>
- /// <returns>An observable sequence containing a single element with the maximum value in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<double> Max(this IObservable<double> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return s_impl.Max(source);
- }
-
- /// <summary>
- /// Returns the maximum value in an observable sequence of <see cref="T:System.Single" /> values.
- /// </summary>
- /// <param name="source">A sequence of <see cref="T:System.Single" /> values to determine the maximum value of.</param>
- /// <returns>An observable sequence containing a single element with the maximum value in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<float> Max(this IObservable<float> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return s_impl.Max(source);
- }
-
- /// <summary>
- /// Returns the maximum value in an observable sequence of <see cref="T:System.Decimal" /> values.
- /// </summary>
- /// <param name="source">A sequence of <see cref="T:System.Decimal" /> values to determine the maximum value of.</param>
- /// <returns>An observable sequence containing a single element with the maximum value in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<decimal> Max(this IObservable<decimal> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return s_impl.Max(source);
- }
-
- /// <summary>
- /// Returns the maximum value in an observable sequence of <see cref="T:System.Int32" /> values.
- /// </summary>
- /// <param name="source">A sequence of <see cref="T:System.Int32" /> values to determine the maximum value of.</param>
- /// <returns>An observable sequence containing a single element with the maximum value in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<int> Max(this IObservable<int> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return s_impl.Max(source);
- }
-
- /// <summary>
- /// Returns the maximum value in an observable sequence of <see cref="T:System.Int64" /> values.
- /// </summary>
- /// <param name="source">A sequence of <see cref="T:System.Int64" /> values to determine the maximum value of.</param>
- /// <returns>An observable sequence containing a single element with the maximum value in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<long> Max(this IObservable<long> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return s_impl.Max(source);
- }
-
- /// <summary>
- /// Returns the maximum value in an observable sequence of nullable <see cref="T:System.Double" /> values.
- /// </summary>
- /// <param name="source">A sequence of nullable <see cref="T:System.Double" /> values to determine the maximum value of.</param>
- /// <returns>An observable sequence containing a single element with the maximum value in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<double?> Max(this IObservable<double?> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return s_impl.Max(source);
- }
-
- /// <summary>
- /// Returns the maximum value in an observable sequence of nullable <see cref="T:System.Single" /> values.
- /// </summary>
- /// <param name="source">A sequence of nullable <see cref="T:System.Single" /> values to determine the maximum value of.</param>
- /// <returns>An observable sequence containing a single element with the maximum value in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<float?> Max(this IObservable<float?> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return s_impl.Max(source);
- }
-
- /// <summary>
- /// Returns the maximum value in an observable sequence of nullable <see cref="T:System.Decimal" /> values.
- /// </summary>
- /// <param name="source">A sequence of nullable <see cref="T:System.Decimal" /> values to determine the maximum value of.</param>
- /// <returns>An observable sequence containing a single element with the maximum value in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<decimal?> Max(this IObservable<decimal?> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return s_impl.Max(source);
- }
-
- /// <summary>
- /// Returns the maximum value in an observable sequence of nullable <see cref="T:System.Int32" /> values.
- /// </summary>
- /// <param name="source">A sequence of nullable <see cref="T:System.Int32" /> values to determine the maximum value of.</param>
- /// <returns>An observable sequence containing a single element with the maximum value in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<int?> Max(this IObservable<int?> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return s_impl.Max(source);
- }
-
- /// <summary>
- /// Returns the maximum value in an observable sequence of nullable <see cref="T:System.Int64" /> values.
- /// </summary>
- /// <param name="source">A sequence of nullable <see cref="T:System.Int64" /> values to determine the maximum value of.</param>
- /// <returns>An observable sequence containing a single element with the maximum value in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<long?> Max(this IObservable<long?> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return s_impl.Max(source);
- }
-
- /// <summary>
- /// Invokes a transform function on each element of a sequence and returns the maximum value.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the objects derived from the elements in the source sequence to determine the maximum of.</typeparam>
- /// <param name="source">An observable sequence to determine the mimimum element of.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the value that corresponds to the maximum element in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<TResult> Max<TSource, TResult>(this IObservable<TSource> source, Func<TSource, TResult> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return s_impl.Max<TSource, TResult>(source, selector);
- }
-
- /// <summary>
- /// Invokes a transform function on each element of a sequence and returns the maximum value according to the specified comparer.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the objects derived from the elements in the source sequence to determine the maximum of.</typeparam>
- /// <param name="source">An observable sequence to determine the mimimum element of.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <param name="comparer">Comparer used to compare elements.</param>
- /// <returns>An observable sequence containing a single element with the value that corresponds to the maximum element in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> or <paramref name="comparer"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<TResult> Max<TSource, TResult>(this IObservable<TSource> source, Func<TSource, TResult> selector, IComparer<TResult> comparer)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
- if (comparer == null)
- throw new ArgumentNullException("comparer");
-
- return s_impl.Max<TSource, TResult>(source, selector, comparer);
- }
-
- /// <summary>
- /// Invokes a transform function on each element of a sequence and returns the maximum <see cref="T:System.Double" /> value.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values to determine the maximum value of.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the value of type <see cref="T:System.Double" /> that corresponds to the maximum value in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<double> Max<TSource>(this IObservable<TSource> source, Func<TSource, double> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return s_impl.Max<TSource>(source, selector);
- }
-
- /// <summary>
- /// Invokes a transform function on each element of a sequence and returns the maximum <see cref="T:System.Single" /> value.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values to determine the maximum value of.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the value of type <see cref="T:System.Single" /> that corresponds to the maximum value in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<float> Max<TSource>(this IObservable<TSource> source, Func<TSource, float> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return s_impl.Max<TSource>(source, selector);
- }
-
- /// <summary>
- /// Invokes a transform function on each element of a sequence and returns the maximum <see cref="T:System.Decimal" /> value.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values to determine the maximum value of.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the value of type <see cref="T:System.Decimal" /> that corresponds to the maximum value in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<decimal> Max<TSource>(this IObservable<TSource> source, Func<TSource, decimal> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return s_impl.Max<TSource>(source, selector);
- }
-
- /// <summary>
- /// Invokes a transform function on each element of a sequence and returns the maximum <see cref="T:System.Int32" /> value.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values to determine the maximum value of.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the value of type <see cref="T:System.Int32" /> that corresponds to the maximum value in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<int> Max<TSource>(this IObservable<TSource> source, Func<TSource, int> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return s_impl.Max<TSource>(source, selector);
- }
-
- /// <summary>
- /// Invokes a transform function on each element of a sequence and returns the maximum <see cref="T:System.Int64" /> value.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values to determine the maximum value of.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the value of type <see cref="T:System.Int64" /> that corresponds to the maximum value in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<long> Max<TSource>(this IObservable<TSource> source, Func<TSource, long> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return s_impl.Max<TSource>(source, selector);
- }
-
- /// <summary>
- /// Invokes a transform function on each element of a sequence and returns the maximum nullable <see cref="T:System.Double" /> value.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values to determine the maximum value of.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the value of type <see cref="T:System.Nullable&lt;System.Double&gt;" /> that corresponds to the maximum value in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<double?> Max<TSource>(this IObservable<TSource> source, Func<TSource, double?> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return s_impl.Max<TSource>(source, selector);
- }
-
- /// <summary>
- /// Invokes a transform function on each element of a sequence and returns the maximum nullable <see cref="T:System.Single" /> value.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values to determine the maximum value of.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the value of type <see cref="T:System.Nullable&lt;System.Single&gt;" /> that corresponds to the maximum value in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<float?> Max<TSource>(this IObservable<TSource> source, Func<TSource, float?> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return s_impl.Max<TSource>(source, selector);
- }
-
- /// <summary>
- /// Invokes a transform function on each element of a sequence and returns the maximum nullable <see cref="T:System.Decimal" /> value.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values to determine the maximum value of.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the value of type <see cref="T:System.Nullable&lt;System.Decimal&gt;" /> that corresponds to the maximum value in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<decimal?> Max<TSource>(this IObservable<TSource> source, Func<TSource, decimal?> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return s_impl.Max<TSource>(source, selector);
- }
-
- /// <summary>
- /// Invokes a transform function on each element of a sequence and returns the maximum nullable <see cref="T:System.Int32" /> value.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values to determine the maximum value of.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the value of type <see cref="T:System.Nullable&lt;System.Int32&gt;" /> that corresponds to the maximum value in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<int?> Max<TSource>(this IObservable<TSource> source, Func<TSource, int?> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return s_impl.Max<TSource>(source, selector);
- }
-
- /// <summary>
- /// Invokes a transform function on each element of a sequence and returns the maximum nullable <see cref="T:System.Int64" /> value.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values to determine the maximum value of.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the value of type <see cref="T:System.Nullable&lt;System.Int64&gt;" /> that corresponds to the maximum value in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<long?> Max<TSource>(this IObservable<TSource> source, Func<TSource, long?> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return s_impl.Max<TSource>(source, selector);
- }
-
- #endregion
-
- #region + MaxBy +
-
- /// <summary>
- /// Returns the elements in an observable sequence with the maximum key value.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TKey">The type of the key computed for each element in the source sequence.</typeparam>
- /// <param name="source">An observable sequence to get the maximum elements for.</param>
- /// <param name="keySelector">Key selector function.</param>
- /// <returns>An observable sequence containing a list of zero or more elements that have a maximum key value.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="keySelector"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<IList<TSource>> MaxBy<TSource, TKey>(this IObservable<TSource> source, Func<TSource, TKey> keySelector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (keySelector == null)
- throw new ArgumentNullException("keySelector");
-
- return s_impl.MaxBy<TSource, TKey>(source, keySelector);
- }
-
- /// <summary>
- /// Returns the elements in an observable sequence with the maximum key value according to the specified comparer.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TKey">The type of the key computed for each element in the source sequence.</typeparam>
- /// <param name="source">An observable sequence to get the maximum elements for.</param>
- /// <param name="keySelector">Key selector function.</param>
- /// <param name="comparer">Comparer used to compare key values.</param>
- /// <returns>An observable sequence containing a list of zero or more elements that have a maximum key value.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="keySelector"/> or <paramref name="comparer"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<IList<TSource>> MaxBy<TSource, TKey>(this IObservable<TSource> source, Func<TSource, TKey> keySelector, IComparer<TKey> comparer)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (keySelector == null)
- throw new ArgumentNullException("keySelector");
- if (comparer == null)
- throw new ArgumentNullException("comparer");
-
- return s_impl.MaxBy<TSource, TKey>(source, keySelector, comparer);
- }
-
- #endregion
-
- #region + Min +
-
- /// <summary>
- /// Returns the minimum element in an observable sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">An observable sequence to determine the mimimum element of.</param>
- /// <returns>An observable sequence containing a single element with the minimum element in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<TSource> Min<TSource>(this IObservable<TSource> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return s_impl.Min<TSource>(source);
- }
-
- /// <summary>
- /// Returns the minimum element in an observable sequence according to the specified comparer.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">An observable sequence to determine the mimimum element of.</param>
- /// <param name="comparer">Comparer used to compare elements.</param>
- /// <returns>An observable sequence containing a single element with the minimum element in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="comparer"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<TSource> Min<TSource>(this IObservable<TSource> source, IComparer<TSource> comparer)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (comparer == null)
- throw new ArgumentNullException("comparer");
-
- return s_impl.Min<TSource>(source, comparer);
- }
-
- /// <summary>
- /// Returns the minimum value in an observable sequence of <see cref="T:System.Double" /> values.
- /// </summary>
- /// <param name="source">A sequence of <see cref="T:System.Double" /> values to determine the minimum value of.</param>
- /// <returns>An observable sequence containing a single element with the minimum value in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<double> Min(this IObservable<double> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return s_impl.Min(source);
- }
-
- /// <summary>
- /// Returns the minimum value in an observable sequence of <see cref="T:System.Single" /> values.
- /// </summary>
- /// <param name="source">A sequence of <see cref="T:System.Single" /> values to determine the minimum value of.</param>
- /// <returns>An observable sequence containing a single element with the minimum value in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<float> Min(this IObservable<float> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return s_impl.Min(source);
- }
-
- /// <summary>
- /// Returns the minimum value in an observable sequence of <see cref="T:System.Decimal" /> values.
- /// </summary>
- /// <param name="source">A sequence of <see cref="T:System.Decimal" /> values to determine the minimum value of.</param>
- /// <returns>An observable sequence containing a single element with the minimum value in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<decimal> Min(this IObservable<decimal> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return s_impl.Min(source);
- }
-
- /// <summary>
- /// Returns the minimum value in an observable sequence of <see cref="T:System.Int32" /> values.
- /// </summary>
- /// <param name="source">A sequence of <see cref="T:System.Int32" /> values to determine the minimum value of.</param>
- /// <returns>An observable sequence containing a single element with the minimum value in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<int> Min(this IObservable<int> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return s_impl.Min(source);
- }
-
- /// <summary>
- /// Returns the minimum value in an observable sequence of <see cref="T:System.Int64" /> values.
- /// </summary>
- /// <param name="source">A sequence of <see cref="T:System.Int64" /> values to determine the minimum value of.</param>
- /// <returns>An observable sequence containing a single element with the minimum value in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<long> Min(this IObservable<long> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return s_impl.Min(source);
- }
-
- /// <summary>
- /// Returns the minimum value in an observable sequence of nullable <see cref="T:System.Double" /> values.
- /// </summary>
- /// <param name="source">A sequence of nullable <see cref="T:System.Double" /> values to determine the minimum value of.</param>
- /// <returns>An observable sequence containing a single element with the minimum value in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<double?> Min(this IObservable<double?> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return s_impl.Min(source);
- }
-
- /// <summary>
- /// Returns the minimum value in an observable sequence of nullable <see cref="T:System.Single" /> values.
- /// </summary>
- /// <param name="source">A sequence of nullable <see cref="T:System.Single" /> values to determine the minimum value of.</param>
- /// <returns>An observable sequence containing a single element with the minimum value in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<float?> Min(this IObservable<float?> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return s_impl.Min(source);
- }
-
- /// <summary>
- /// Returns the minimum value in an observable sequence of nullable <see cref="T:System.Decimal" /> values.
- /// </summary>
- /// <param name="source">A sequence of nullable <see cref="T:System.Decimal" /> values to determine the minimum value of.</param>
- /// <returns>An observable sequence containing a single element with the minimum value in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<decimal?> Min(this IObservable<decimal?> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return s_impl.Min(source);
- }
-
- /// <summary>
- /// Returns the minimum value in an observable sequence of nullable <see cref="T:System.Int32" /> values.
- /// </summary>
- /// <param name="source">A sequence of nullable <see cref="T:System.Int32" /> values to determine the minimum value of.</param>
- /// <returns>An observable sequence containing a single element with the minimum value in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<int?> Min(this IObservable<int?> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return s_impl.Min(source);
- }
-
- /// <summary>
- /// Returns the minimum value in an observable sequence of nullable <see cref="T:System.Int64" /> values.
- /// </summary>
- /// <param name="source">A sequence of nullable <see cref="T:System.Int64" /> values to determine the minimum value of.</param>
- /// <returns>An observable sequence containing a single element with the minimum value in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<long?> Min(this IObservable<long?> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return s_impl.Min(source);
- }
-
- /// <summary>
- /// Invokes a transform function on each element of a sequence and returns the minimum value.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the objects derived from the elements in the source sequence to determine the minimum of.</typeparam>
- /// <param name="source">An observable sequence to determine the mimimum element of.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the value that corresponds to the minimum element in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<TResult> Min<TSource, TResult>(this IObservable<TSource> source, Func<TSource, TResult> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return s_impl.Min<TSource, TResult>(source, selector);
- }
-
- /// <summary>
- /// Invokes a transform function on each element of a sequence and returns the minimum value according to the specified comparer.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the objects derived from the elements in the source sequence to determine the minimum of.</typeparam>
- /// <param name="source">An observable sequence to determine the mimimum element of.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <param name="comparer">Comparer used to compare elements.</param>
- /// <returns>An observable sequence containing a single element with the value that corresponds to the minimum element in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> or <paramref name="comparer"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<TResult> Min<TSource, TResult>(this IObservable<TSource> source, Func<TSource, TResult> selector, IComparer<TResult> comparer)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
- if (comparer == null)
- throw new ArgumentNullException("comparer");
-
- return s_impl.Min<TSource, TResult>(source, selector, comparer);
- }
-
- /// <summary>
- /// Invokes a transform function on each element of a sequence and returns the minimum <see cref="T:System.Double" /> value.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values to determine the minimum value of.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the value of type <see cref="T:System.Double" /> that corresponds to the minimum value in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<double> Min<TSource>(this IObservable<TSource> source, Func<TSource, double> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return s_impl.Min<TSource>(source, selector);
- }
-
- /// <summary>
- /// Invokes a transform function on each element of a sequence and returns the minimum <see cref="T:System.Single" /> value.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values to determine the minimum value of.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the value of type <see cref="T:System.Single" /> that corresponds to the minimum value in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<float> Min<TSource>(this IObservable<TSource> source, Func<TSource, float> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return s_impl.Min<TSource>(source, selector);
- }
-
- /// <summary>
- /// Invokes a transform function on each element of a sequence and returns the minimum <see cref="T:System.Decimal" /> value.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values to determine the minimum value of.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the value of type <see cref="T:System.Decimal" /> that corresponds to the minimum value in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<decimal> Min<TSource>(this IObservable<TSource> source, Func<TSource, decimal> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return s_impl.Min<TSource>(source, selector);
- }
-
- /// <summary>
- /// Invokes a transform function on each element of a sequence and returns the minimum <see cref="T:System.Int32" /> value.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values to determine the minimum value of.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the value of type <see cref="T:System.Int32" /> that corresponds to the minimum value in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<int> Min<TSource>(this IObservable<TSource> source, Func<TSource, int> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return s_impl.Min<TSource>(source, selector);
- }
-
- /// <summary>
- /// Invokes a transform function on each element of a sequence and returns the minimum <see cref="T:System.Int64" /> value.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values to determine the minimum value of.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the value of type <see cref="T:System.Int64" /> that corresponds to the minimum value in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<long> Min<TSource>(this IObservable<TSource> source, Func<TSource, long> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return s_impl.Min<TSource>(source, selector);
- }
-
- /// <summary>
- /// Invokes a transform function on each element of a sequence and returns the minimum nullable <see cref="T:System.Double" /> value.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values to determine the minimum value of.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the value of type <see cref="T:System.Nullable&lt;System.Double&gt;" /> that corresponds to the minimum value in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<double?> Min<TSource>(this IObservable<TSource> source, Func<TSource, double?> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return s_impl.Min<TSource>(source, selector);
- }
-
- /// <summary>
- /// Invokes a transform function on each element of a sequence and returns the minimum nullable <see cref="T:System.Single" /> value.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values to determine the minimum value of.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the value of type <see cref="T:System.Nullable&lt;System.Single&gt;" /> that corresponds to the minimum value in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<float?> Min<TSource>(this IObservable<TSource> source, Func<TSource, float?> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return s_impl.Min<TSource>(source, selector);
- }
-
- /// <summary>
- /// Invokes a transform function on each element of a sequence and returns the minimum nullable <see cref="T:System.Decimal" /> value.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values to determine the minimum value of.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the value of type <see cref="T:System.Nullable&lt;System.Decimal&gt;" /> that corresponds to the minimum value in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<decimal?> Min<TSource>(this IObservable<TSource> source, Func<TSource, decimal?> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return s_impl.Min<TSource>(source, selector);
- }
-
- /// <summary>
- /// Invokes a transform function on each element of a sequence and returns the minimum nullable <see cref="T:System.Int32" /> value.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values to determine the minimum value of.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the value of type <see cref="T:System.Nullable&lt;System.Int32&gt;" /> that corresponds to the minimum value in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<int?> Min<TSource>(this IObservable<TSource> source, Func<TSource, int?> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return s_impl.Min<TSource>(source, selector);
- }
-
- /// <summary>
- /// Invokes a transform function on each element of a sequence and returns the minimum nullable <see cref="T:System.Int64" /> value.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values to determine the minimum value of.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the value of type <see cref="T:System.Nullable&lt;System.Int64&gt;" /> that corresponds to the minimum value in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<long?> Min<TSource>(this IObservable<TSource> source, Func<TSource, long?> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return s_impl.Min<TSource>(source, selector);
- }
-
- #endregion
-
- #region + MinBy +
-
- /// <summary>
- /// Returns the elements in an observable sequence with the minimum key value.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TKey">The type of the key computed for each element in the source sequence.</typeparam>
- /// <param name="source">An observable sequence to get the minimum elements for.</param>
- /// <param name="keySelector">Key selector function.</param>
- /// <returns>An observable sequence containing a list of zero or more elements that have a minimum key value.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="keySelector"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<IList<TSource>> MinBy<TSource, TKey>(this IObservable<TSource> source, Func<TSource, TKey> keySelector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (keySelector == null)
- throw new ArgumentNullException("keySelector");
-
- return s_impl.MinBy<TSource, TKey>(source, keySelector);
- }
-
- /// <summary>
- /// Returns the elements in an observable sequence with the minimum key value according to the specified comparer.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TKey">The type of the key computed for each element in the source sequence.</typeparam>
- /// <param name="source">An observable sequence to get the minimum elements for.</param>
- /// <param name="keySelector">Key selector function.</param>
- /// <param name="comparer">Comparer used to compare key values.</param>
- /// <returns>An observable sequence containing a list of zero or more elements that have a minimum key value.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="keySelector"/> or <paramref name="comparer"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<IList<TSource>> MinBy<TSource, TKey>(this IObservable<TSource> source, Func<TSource, TKey> keySelector, IComparer<TKey> comparer)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (keySelector == null)
- throw new ArgumentNullException("keySelector");
- if (comparer == null)
- throw new ArgumentNullException("comparer");
-
- return s_impl.MinBy<TSource, TKey>(source, keySelector, comparer);
- }
-
- #endregion
-
- #region + SequenceEqual +
-
- /// <summary>
- /// Determines whether two sequences are equal by comparing the elements pairwise.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="first">First observable sequence to compare.</param>
- /// <param name="second">Second observable sequence to compare.</param>
- /// <returns>An observable sequence that contains a single element which indicates whether both sequences are of equal length and their corresponding elements are equal according to the default equality comparer for their type.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="first"/> or <paramref name="second"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<bool> SequenceEqual<TSource>(this IObservable<TSource> first, IObservable<TSource> second)
- {
- if (first == null)
- throw new ArgumentNullException("first");
- if (second == null)
- throw new ArgumentNullException("second");
-
- return s_impl.SequenceEqual<TSource>(first, second);
- }
-
- /// <summary>
- /// Determines whether two sequences are equal by comparing the elements pairwise using a specified equality comparer.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="first">First observable sequence to compare.</param>
- /// <param name="second">Second observable sequence to compare.</param>
- /// <param name="comparer">Comparer used to compare elements of both sequences.</param>
- /// <returns>An observable sequence that contains a single element which indicates whether both sequences are of equal length and their corresponding elements are equal according to the specified equality comparer.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="first"/> or <paramref name="second"/> or <paramref name="comparer"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<bool> SequenceEqual<TSource>(this IObservable<TSource> first, IObservable<TSource> second, IEqualityComparer<TSource> comparer)
- {
- if (first == null)
- throw new ArgumentNullException("first");
- if (second == null)
- throw new ArgumentNullException("second");
- if (comparer == null)
- throw new ArgumentNullException("comparer");
-
- return s_impl.SequenceEqual<TSource>(first, second, comparer);
- }
-
- /// <summary>
- /// Determines whether an observable and enumerable sequence are equal by comparing the elements pairwise.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="first">First observable sequence to compare.</param>
- /// <param name="second">Second observable sequence to compare.</param>
- /// <returns>An observable sequence that contains a single element which indicates whether both sequences are of equal length and their corresponding elements are equal according to the default equality comparer for their type.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="first"/> or <paramref name="second"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<bool> SequenceEqual<TSource>(this IObservable<TSource> first, IEnumerable<TSource> second)
- {
- if (first == null)
- throw new ArgumentNullException("first");
- if (second == null)
- throw new ArgumentNullException("second");
-
- return s_impl.SequenceEqual<TSource>(first, second);
- }
-
- /// <summary>
- /// Determines whether an observable and enumerable sequence are equal by comparing the elements pairwise using a specified equality comparer.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="first">First observable sequence to compare.</param>
- /// <param name="second">Second observable sequence to compare.</param>
- /// <param name="comparer">Comparer used to compare elements of both sequences.</param>
- /// <returns>An observable sequence that contains a single element which indicates whether both sequences are of equal length and their corresponding elements are equal according to the specified equality comparer.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="first"/> or <paramref name="second"/> or <paramref name="comparer"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<bool> SequenceEqual<TSource>(this IObservable<TSource> first, IEnumerable<TSource> second, IEqualityComparer<TSource> comparer)
- {
- if (first == null)
- throw new ArgumentNullException("first");
- if (second == null)
- throw new ArgumentNullException("second");
- if (comparer == null)
- throw new ArgumentNullException("comparer");
-
- return s_impl.SequenceEqual<TSource>(first, second, comparer);
- }
-
- #endregion
-
- #region + SingleAsync +
-
- /// <summary>
- /// Returns the only element of an observable sequence, and reports an exception if there is not exactly one element in the observable sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source observable sequence.</param>
- /// <returns>Sequence containing the single element in the observable sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <exception cref="InvalidOperationException">(Asynchronous) The source sequence contains more than one element. -or- The source sequence is empty.</exception>
- public static IObservable<TSource> SingleAsync<TSource>(this IObservable<TSource> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return s_impl.SingleAsync<TSource>(source);
- }
-
- /// <summary>
- /// Returns the only element of an observable sequence that satisfies the condition in the predicate, and reports an exception if there is not exactly one element in the observable sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source observable sequence.</param>
- /// <param name="predicate">A predicate function to evaluate for elements in the source sequence.</param>
- /// <returns>Sequence containing the single element in the observable sequence that satisfies the condition in the predicate.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="predicate"/> is null.</exception>
- /// <exception cref="InvalidOperationException">(Asynchronous) No element satisfies the condition in the predicate. -or- More than one element satisfies the condition in the predicate. -or- The source sequence is empty.</exception>
- public static IObservable<TSource> SingleAsync<TSource>(this IObservable<TSource> source, Func<TSource, bool> predicate)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (predicate == null)
- throw new ArgumentNullException("predicate");
-
- return s_impl.SingleAsync<TSource>(source, predicate);
- }
-
- #endregion
-
- #region + SingleOrDefaultAsync +
-
- /// <summary>
- /// Returns the only element of an observable sequence, or a default value if the observable sequence is empty; this method reports an exception if there is more than one element in the observable sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source observable sequence.</param>
- /// <returns>Sequence containing the single element in the observable sequence, or a default value if no such element exists.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <exception cref="InvalidOperationException">(Asynchronous) The source sequence contains more than one element.</exception>
- public static IObservable<TSource> SingleOrDefaultAsync<TSource>(this IObservable<TSource> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return s_impl.SingleOrDefaultAsync<TSource>(source);
- }
-
- /// <summary>
- /// Returns the only element of an observable sequence that matches the predicate, or a default value if no such element exists; this method reports an exception if there is more than one element in the observable sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source observable sequence.</param>
- /// <param name="predicate">A predicate function to evaluate for elements in the source sequence.</param>
- /// <returns>Sequence containing the single element in the observable sequence that satisfies the condition in the predicate, or a default value if no such element exists.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="predicate"/> is null.</exception>
- /// <exception cref="InvalidOperationException">(Asynchronous) The sequence contains more than one element that satisfies the condition in the predicate.</exception>
- public static IObservable<TSource> SingleOrDefaultAsync<TSource>(this IObservable<TSource> source, Func<TSource, bool> predicate)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (predicate == null)
- throw new ArgumentNullException("predicate");
-
- return s_impl.SingleOrDefaultAsync<TSource>(source, predicate);
- }
-
- #endregion
-
- #region + Sum +
-
- /// <summary>
- /// Computes the sum of a sequence of <see cref="T:System.Double" /> values.
- /// </summary>
- /// <param name="source">A sequence of <see cref="T:System.Double" /> values to calculate the sum of.</param>
- /// <returns>An observable sequence containing a single element with the sum of the values in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<double> Sum(this IObservable<double> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return s_impl.Sum(source);
- }
-
- /// <summary>
- /// Computes the sum of a sequence of <see cref="T:System.Single" /> values.
- /// </summary>
- /// <param name="source">A sequence of <see cref="T:System.Single" /> values to calculate the sum of.</param>
- /// <returns>An observable sequence containing a single element with the sum of the values in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<float> Sum(this IObservable<float> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return s_impl.Sum(source);
- }
-
- /// <summary>
- /// Computes the sum of a sequence of <see cref="T:System.Decimal" /> values.
- /// </summary>
- /// <param name="source">A sequence of <see cref="T:System.Decimal" /> values to calculate the sum of.</param>
- /// <returns>An observable sequence containing a single element with the sum of the values in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <exception cref="OverflowException">(Asynchronous) The sum of the elements in the source sequence is larger than <see cref="M:System.Decimal.MaxValue"/>.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<decimal> Sum(this IObservable<decimal> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return s_impl.Sum(source);
- }
-
- /// <summary>
- /// Computes the sum of a sequence of <see cref="T:System.Int32" /> values.
- /// </summary>
- /// <param name="source">A sequence of <see cref="T:System.Int32" /> values to calculate the sum of.</param>
- /// <returns>An observable sequence containing a single element with the sum of the values in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <exception cref="OverflowException">(Asynchronous) The sum of the elements in the source sequence is larger than <see cref="M:System.Int32.MaxValue"/>.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<int> Sum(this IObservable<int> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return s_impl.Sum(source);
- }
-
- /// <summary>
- /// Computes the sum of a sequence of <see cref="T:System.Int64" /> values.
- /// </summary>
- /// <param name="source">A sequence of <see cref="T:System.Int64" /> values to calculate the sum of.</param>
- /// <returns>An observable sequence containing a single element with the sum of the values in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <exception cref="OverflowException">(Asynchronous) The sum of the elements in the source sequence is larger than <see cref="M:System.Int64.MaxValue"/>.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<long> Sum(this IObservable<long> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return s_impl.Sum(source);
- }
-
- /// <summary>
- /// Computes the sum of a sequence of nullable <see cref="T:System.Double" /> values.
- /// </summary>
- /// <param name="source">A sequence of nullable <see cref="T:System.Double" /> values to calculate the sum of.</param>
- /// <returns>An observable sequence containing a single element with the sum of the values in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<double?> Sum(this IObservable<double?> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return s_impl.Sum(source);
- }
-
- /// <summary>
- /// Computes the sum of a sequence of nullable <see cref="T:System.Single" /> values.
- /// </summary>
- /// <param name="source">A sequence of nullable <see cref="T:System.Single" /> values to calculate the sum of.</param>
- /// <returns>An observable sequence containing a single element with the sum of the values in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<float?> Sum(this IObservable<float?> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return s_impl.Sum(source);
- }
-
- /// <summary>
- /// Computes the sum of a sequence of nullable <see cref="T:System.Decimal" /> values.
- /// </summary>
- /// <param name="source">A sequence of nullable <see cref="T:System.Decimal" /> values to calculate the sum of.</param>
- /// <returns>An observable sequence containing a single element with the sum of the values in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <exception cref="OverflowException">(Asynchronous) The sum of the elements in the source sequence is larger than <see cref="M:System.Decimal.MaxValue"/>.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<decimal?> Sum(this IObservable<decimal?> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return s_impl.Sum(source);
- }
-
- /// <summary>
- /// Computes the sum of a sequence of nullable <see cref="T:System.Int32" /> values.
- /// </summary>
- /// <param name="source">A sequence of nullable <see cref="T:System.Int32" /> values to calculate the sum of.</param>
- /// <returns>An observable sequence containing a single element with the sum of the values in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <exception cref="OverflowException">(Asynchronous) The sum of the elements in the source sequence is larger than <see cref="M:System.Int32.MaxValue"/>.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<int?> Sum(this IObservable<int?> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return s_impl.Sum(source);
- }
-
- /// <summary>
- /// Computes the sum of a sequence of nullable <see cref="T:System.Int64" /> values.
- /// </summary>
- /// <param name="source">A sequence of nullable <see cref="T:System.Int64" /> values to calculate the sum of.</param>
- /// <returns>An observable sequence containing a single element with the sum of the values in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <exception cref="OverflowException">(Asynchronous) The sum of the elements in the source sequence is larger than <see cref="M:System.Int64.MaxValue"/>.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<long?> Sum(this IObservable<long?> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return s_impl.Sum(source);
- }
-
- /// <summary>
- /// Computes the sum of a sequence of <see cref="T:System.Double" /> values that are obtained by invoking a transform function on each element of the input sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values that are used to calculate a sum.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the sum of the values in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<double> Sum<TSource>(this IObservable<TSource> source, Func<TSource, double> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return s_impl.Sum<TSource>(source, selector);
- }
-
- /// <summary>
- /// Computes the sum of a sequence of <see cref="T:System.Single" /> values that are obtained by invoking a transform function on each element of the input sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values that are used to calculate a sum.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the sum of the values in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<float> Sum<TSource>(this IObservable<TSource> source, Func<TSource, float> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return s_impl.Sum<TSource>(source, selector);
- }
-
- /// <summary>
- /// Computes the sum of a sequence of <see cref="T:System.Decimal" /> values that are obtained by invoking a transform function on each element of the input sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values that are used to calculate a sum.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the sum of the values in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> is null.</exception>
- /// <exception cref="OverflowException">(Asynchronous) The sum of the projected values for the elements in the source sequence is larger than <see cref="M:System.Decimal.MaxValue"/>.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<decimal> Sum<TSource>(this IObservable<TSource> source, Func<TSource, decimal> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return s_impl.Sum<TSource>(source, selector);
- }
-
- /// <summary>
- /// Computes the sum of a sequence of <see cref="T:System.Int32" /> values that are obtained by invoking a transform function on each element of the input sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values that are used to calculate a sum.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the sum of the values in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> is null.</exception>
- /// <exception cref="OverflowException">(Asynchronous) The sum of the projected values for the elements in the source sequence is larger than <see cref="M:System.Int32.MaxValue"/>.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<int> Sum<TSource>(this IObservable<TSource> source, Func<TSource, int> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return s_impl.Sum<TSource>(source, selector);
- }
-
- /// <summary>
- /// Computes the sum of a sequence of <see cref="T:System.Int64" /> values that are obtained by invoking a transform function on each element of the input sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values that are used to calculate a sum.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the sum of the values in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> is null.</exception>
- /// <exception cref="OverflowException">(Asynchronous) The sum of the projected values for the elements in the source sequence is larger than <see cref="M:System.Int64.MaxValue"/>.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<long> Sum<TSource>(this IObservable<TSource> source, Func<TSource, long> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return s_impl.Sum<TSource>(source, selector);
- }
-
- /// <summary>
- /// Computes the sum of a sequence of nullable <see cref="T:System.Double" /> values that are obtained by invoking a transform function on each element of the input sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values that are used to calculate a sum.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the sum of the values in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<double?> Sum<TSource>(this IObservable<TSource> source, Func<TSource, double?> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return s_impl.Sum<TSource>(source, selector);
- }
-
- /// <summary>
- /// Computes the sum of a sequence of nullable <see cref="T:System.Single" /> values that are obtained by invoking a transform function on each element of the input sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values that are used to calculate a sum.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the sum of the values in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<float?> Sum<TSource>(this IObservable<TSource> source, Func<TSource, float?> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return s_impl.Sum<TSource>(source, selector);
- }
-
- /// <summary>
- /// Computes the sum of a sequence of nullable <see cref="T:System.Decimal" /> values that are obtained by invoking a transform function on each element of the input sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values that are used to calculate a sum.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the sum of the values in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> is null.</exception>
- /// <exception cref="OverflowException">(Asynchronous) The sum of the projected values for the elements in the source sequence is larger than <see cref="M:System.Decimal.MaxValue"/>.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<decimal?> Sum<TSource>(this IObservable<TSource> source, Func<TSource, decimal?> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return s_impl.Sum<TSource>(source, selector);
- }
-
- /// <summary>
- /// Computes the sum of a sequence of nullable <see cref="T:System.Int32" /> values that are obtained by invoking a transform function on each element of the input sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values that are used to calculate a sum.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the sum of the values in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> is null.</exception>
- /// <exception cref="OverflowException">(Asynchronous) The sum of the projected values for the elements in the source sequence is larger than <see cref="M:System.Int32.MaxValue"/>.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<int?> Sum<TSource>(this IObservable<TSource> source, Func<TSource, int?> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return s_impl.Sum<TSource>(source, selector);
- }
-
- /// <summary>
- /// Computes the sum of a sequence of nullable <see cref="T:System.Int64" /> values that are obtained by invoking a transform function on each element of the input sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values that are used to calculate a sum.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the sum of the values in the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> is null.</exception>
- /// <exception cref="OverflowException">(Asynchronous) The sum of the projected values for the elements in the source sequence is larger than <see cref="M:System.Int64.MaxValue"/>.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<long?> Sum<TSource>(this IObservable<TSource> source, Func<TSource, long?> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return s_impl.Sum<TSource>(source, selector);
- }
-
- #endregion
-
- #region + ToArray +
-
- /// <summary>
- /// Creates an array from an observable sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">The source observable sequence to get an array of elements for.</param>
- /// <returns>An observable sequence containing a single element with an array containing all the elements of the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<TSource[]> ToArray<TSource>(this IObservable<TSource> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return s_impl.ToArray<TSource>(source);
- }
-
- #endregion
-
- #region + ToDictionary +
-
- /// <summary>
- /// Creates a dictionary from an observable sequence according to a specified key selector function.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TKey">The type of the dictionary key computed for each element in the source sequence.</typeparam>
- /// <param name="source">An observable sequence to create a dictionary for.</param>
- /// <param name="keySelector">A function to extract a key from each element.</param>
- /// <returns>An observable sequence containing a single element with a dictionary mapping unique key values onto the corresponding source sequence's element.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="keySelector"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<IDictionary<TKey, TSource>> ToDictionary<TSource, TKey>(this IObservable<TSource> source, Func<TSource, TKey> keySelector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (keySelector == null)
- throw new ArgumentNullException("keySelector");
-
- return s_impl.ToDictionary<TSource, TKey>(source, keySelector);
- }
-
- /// <summary>
- /// Creates a dictionary from an observable sequence according to a specified key selector function, and a comparer.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TKey">The type of the dictionary key computed for each element in the source sequence.</typeparam>
- /// <param name="source">An observable sequence to create a dictionary for.</param>
- /// <param name="keySelector">A function to extract a key from each element.</param>
- /// <param name="comparer">An equality comparer to compare keys.</param>
- /// <returns>An observable sequence containing a single element with a dictionary mapping unique key values onto the corresponding source sequence's element.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="keySelector"/> or <paramref name="comparer"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<IDictionary<TKey, TSource>> ToDictionary<TSource, TKey>(this IObservable<TSource> source, Func<TSource, TKey> keySelector, IEqualityComparer<TKey> comparer)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (keySelector == null)
- throw new ArgumentNullException("keySelector");
- if (comparer == null)
- throw new ArgumentNullException("comparer");
-
- return s_impl.ToDictionary<TSource, TKey>(source, keySelector, comparer);
- }
-
- /// <summary>
- /// Creates a dictionary from an observable sequence according to a specified key selector function, and an element selector function.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TKey">The type of the dictionary key computed for each element in the source sequence.</typeparam>
- /// <typeparam name="TElement">The type of the dictionary value computed for each element in the source sequence.</typeparam>
- /// <param name="source">An observable sequence to create a dictionary for.</param>
- /// <param name="keySelector">A function to extract a key from each element.</param>
- /// <param name="elementSelector">A transform function to produce a result element value from each element.</param>
- /// <returns>An observable sequence containing a single element with a dictionary mapping unique key values onto the corresponding source sequence's element.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="keySelector"/> or <paramref name="elementSelector"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<IDictionary<TKey, TElement>> ToDictionary<TSource, TKey, TElement>(this IObservable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (keySelector == null)
- throw new ArgumentNullException("keySelector");
- if (elementSelector == null)
- throw new ArgumentNullException("elementSelector");
-
- return s_impl.ToDictionary<TSource, TKey, TElement>(source, keySelector, elementSelector);
- }
-
- /// <summary>
- /// Creates a dictionary from an observable sequence according to a specified key selector function, a comparer, and an element selector function.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TKey">The type of the dictionary key computed for each element in the source sequence.</typeparam>
- /// <typeparam name="TElement">The type of the dictionary value computed for each element in the source sequence.</typeparam>
- /// <param name="source">An observable sequence to create a dictionary for.</param>
- /// <param name="keySelector">A function to extract a key from each element.</param>
- /// <param name="elementSelector">A transform function to produce a result element value from each element.</param>
- /// <param name="comparer">An equality comparer to compare keys.</param>
- /// <returns>An observable sequence containing a single element with a dictionary mapping unique key values onto the corresponding source sequence's element.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="keySelector"/> or <paramref name="elementSelector"/> or <paramref name="comparer"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<IDictionary<TKey, TElement>> ToDictionary<TSource, TKey, TElement>(this IObservable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector, IEqualityComparer<TKey> comparer)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (keySelector == null)
- throw new ArgumentNullException("keySelector");
- if (elementSelector == null)
- throw new ArgumentNullException("elementSelector");
- if (comparer == null)
- throw new ArgumentNullException("comparer");
-
- return s_impl.ToDictionary<TSource, TKey, TElement>(source, keySelector, elementSelector, comparer);
- }
-
- #endregion
-
- #region + ToList +
-
- /// <summary>
- /// Creates a list from an observable sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">The source observable sequence to get a list of elements for.</param>
- /// <returns>An observable sequence containing a single element with a list containing all the elements of the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<IList<TSource>> ToList<TSource>(this IObservable<TSource> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return s_impl.ToList<TSource>(source);
- }
-
- #endregion
-
- #region + ToLookup +
-
- /// <summary>
- /// Creates a lookup from an observable sequence according to a specified key selector function.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TKey">The type of the lookup key computed for each element in the source sequence.</typeparam>
- /// <param name="source">An observable sequence to create a lookup for.</param>
- /// <param name="keySelector">A function to extract a key from each element.</param>
- /// <returns>An observable sequence containing a single element with a lookup mapping unique key values onto the corresponding source sequence's elements.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="keySelector"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<ILookup<TKey, TSource>> ToLookup<TSource, TKey>(this IObservable<TSource> source, Func<TSource, TKey> keySelector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (keySelector == null)
- throw new ArgumentNullException("keySelector");
-
- return s_impl.ToLookup<TSource, TKey>(source, keySelector);
- }
-
- /// <summary>
- /// Creates a lookup from an observable sequence according to a specified key selector function, and a comparer.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TKey">The type of the lookup key computed for each element in the source sequence.</typeparam>
- /// <param name="source">An observable sequence to create a lookup for.</param>
- /// <param name="keySelector">A function to extract a key from each element.</param>
- /// <param name="comparer">An equality comparer to compare keys.</param>
- /// <returns>An observable sequence containing a single element with a lookup mapping unique key values onto the corresponding source sequence's elements.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="keySelector"/> or <paramref name="comparer"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<ILookup<TKey, TSource>> ToLookup<TSource, TKey>(this IObservable<TSource> source, Func<TSource, TKey> keySelector, IEqualityComparer<TKey> comparer)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (keySelector == null)
- throw new ArgumentNullException("keySelector");
- if (comparer == null)
- throw new ArgumentNullException("comparer");
-
- return s_impl.ToLookup<TSource, TKey>(source, keySelector, comparer);
- }
-
- /// <summary>
- /// Creates a lookup from an observable sequence according to a specified key selector function, and an element selector function.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TKey">The type of the lookup key computed for each element in the source sequence.</typeparam>
- /// <typeparam name="TElement">The type of the lookup value computed for each element in the source sequence.</typeparam>
- /// <param name="source">An observable sequence to create a lookup for.</param>
- /// <param name="keySelector">A function to extract a key from each element.</param>
- /// <param name="elementSelector">A transform function to produce a result element value from each element.</param>
- /// <returns>An observable sequence containing a single element with a lookup mapping unique key values onto the corresponding source sequence's elements.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="keySelector"/> or <paramref name="elementSelector"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<ILookup<TKey, TElement>> ToLookup<TSource, TKey, TElement>(this IObservable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (keySelector == null)
- throw new ArgumentNullException("keySelector");
- if (elementSelector == null)
- throw new ArgumentNullException("elementSelector");
-
- return s_impl.ToLookup<TSource, TKey, TElement>(source, keySelector, elementSelector);
- }
-
- /// <summary>
- /// Creates a lookup from an observable sequence according to a specified key selector function, a comparer, and an element selector function.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TKey">The type of the lookup key computed for each element in the source sequence.</typeparam>
- /// <typeparam name="TElement">The type of the lookup value computed for each element in the source sequence.</typeparam>
- /// <param name="source">An observable sequence to create a lookup for.</param>
- /// <param name="keySelector">A function to extract a key from each element.</param>
- /// <param name="elementSelector">A transform function to produce a result element value from each element.</param>
- /// <param name="comparer">An equality comparer to compare keys.</param>
- /// <returns>An observable sequence containing a single element with a lookup mapping unique key values onto the corresponding source sequence's elements.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="keySelector"/> or <paramref name="elementSelector"/> or <paramref name="comparer"/> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IObservable<ILookup<TKey, TElement>> ToLookup<TSource, TKey, TElement>(this IObservable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector, IEqualityComparer<TKey> comparer)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (keySelector == null)
- throw new ArgumentNullException("keySelector");
- if (elementSelector == null)
- throw new ArgumentNullException("elementSelector");
- if (comparer == null)
- throw new ArgumentNullException("comparer");
-
- return s_impl.ToLookup<TSource, TKey, TElement>(source, keySelector, elementSelector, comparer);
- }
-
- #endregion
- }
-}
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observable.Async.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observable.Async.cs
deleted file mode 100644
index 8f74075..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observable.Async.cs
+++ /dev/null
@@ -1,2802 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System.Reactive.Concurrency;
-using System.Threading;
-
-#if !NO_TPL
-using System.Threading.Tasks;
-#endif
-
-namespace System.Reactive.Linq
-{
- public static partial class Observable
- {
- #region FromAsyncPattern
-
- #region Func
-
- /// <summary>
- /// Converts a Begin/End invoke function pair into an asynchronous function.
- /// </summary>
- /// <typeparam name="TResult">The type of the result returned by the end delegate.</typeparam>
- /// <param name="begin">The delegate that begins the asynchronous operation.</param>
- /// <param name="end">The delegate that ends the asynchronous operation.</param>
- /// <returns>Function that can be used to start the asynchronous operation and retrieve the result as an observable sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="begin"/> or <paramref name="end"/> is null.</exception>
- /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
-#if PREFER_ASYNC
- [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
-#endif
- public static Func<IObservable<TResult>> FromAsyncPattern<TResult>(Func<AsyncCallback, object, IAsyncResult> begin, Func<IAsyncResult, TResult> end)
- {
- if (begin == null)
- throw new ArgumentNullException("begin");
- if (end == null)
- throw new ArgumentNullException("end");
-
- return s_impl.FromAsyncPattern<TResult>(begin, end);
- }
-
- /// <summary>
- /// Converts a Begin/End invoke function pair into an asynchronous function.
- /// </summary>
- /// <typeparam name="TArg1">The type of the first argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TResult">The type of the result returned by the end delegate.</typeparam>
- /// <param name="begin">The delegate that begins the asynchronous operation.</param>
- /// <param name="end">The delegate that ends the asynchronous operation.</param>
- /// <returns>Function that can be used to start the asynchronous operation and retrieve the result as an observable sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="begin"/> or <paramref name="end"/> is null.</exception>
- /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
-#if PREFER_ASYNC
- [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
-#endif
- public static Func<TArg1, IObservable<TResult>> FromAsyncPattern<TArg1, TResult>(Func<TArg1, AsyncCallback, object, IAsyncResult> begin, Func<IAsyncResult, TResult> end)
- {
- if (begin == null)
- throw new ArgumentNullException("begin");
- if (end == null)
- throw new ArgumentNullException("end");
-
- return s_impl.FromAsyncPattern<TArg1, TResult>(begin, end);
- }
-
- /// <summary>
- /// Converts a Begin/End invoke function pair into an asynchronous function.
- /// </summary>
- /// <typeparam name="TArg1">The type of the first argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TResult">The type of the result returned by the end delegate.</typeparam>
- /// <param name="begin">The delegate that begins the asynchronous operation.</param>
- /// <param name="end">The delegate that ends the asynchronous operation.</param>
- /// <returns>Function that can be used to start the asynchronous operation and retrieve the result as an observable sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="begin"/> or <paramref name="end"/> is null.</exception>
- /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
-#if PREFER_ASYNC
- [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
-#endif
- public static Func<TArg1, TArg2, IObservable<TResult>> FromAsyncPattern<TArg1, TArg2, TResult>(Func<TArg1, TArg2, AsyncCallback, object, IAsyncResult> begin, Func<IAsyncResult, TResult> end)
- {
- if (begin == null)
- throw new ArgumentNullException("begin");
- if (end == null)
- throw new ArgumentNullException("end");
-
- return s_impl.FromAsyncPattern<TArg1, TArg2, TResult>(begin, end);
- }
-
-#if !NO_LARGEARITY
- /// <summary>
- /// Converts a Begin/End invoke function pair into an asynchronous function.
- /// </summary>
- /// <typeparam name="TArg1">The type of the first argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TResult">The type of the result returned by the end delegate.</typeparam>
- /// <param name="begin">The delegate that begins the asynchronous operation.</param>
- /// <param name="end">The delegate that ends the asynchronous operation.</param>
- /// <returns>Function that can be used to start the asynchronous operation and retrieve the result as an observable sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="begin"/> or <paramref name="end"/> is null.</exception>
- /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
-#if PREFER_ASYNC
- [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
-#endif
- public static Func<TArg1, TArg2, TArg3, IObservable<TResult>> FromAsyncPattern<TArg1, TArg2, TArg3, TResult>(Func<TArg1, TArg2, TArg3, AsyncCallback, object, IAsyncResult> begin, Func<IAsyncResult, TResult> end)
- {
- if (begin == null)
- throw new ArgumentNullException("begin");
- if (end == null)
- throw new ArgumentNullException("end");
-
- return s_impl.FromAsyncPattern<TArg1, TArg2, TArg3, TResult>(begin, end);
- }
-
- /// <summary>
- /// Converts a Begin/End invoke function pair into an asynchronous function.
- /// </summary>
- /// <typeparam name="TArg1">The type of the first argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TResult">The type of the result returned by the end delegate.</typeparam>
- /// <param name="begin">The delegate that begins the asynchronous operation.</param>
- /// <param name="end">The delegate that ends the asynchronous operation.</param>
- /// <returns>Function that can be used to start the asynchronous operation and retrieve the result as an observable sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="begin"/> or <paramref name="end"/> is null.</exception>
- /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
-#if PREFER_ASYNC
- [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
-#endif
- public static Func<TArg1, TArg2, TArg3, TArg4, IObservable<TResult>> FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TResult>(Func<TArg1, TArg2, TArg3, TArg4, AsyncCallback, object, IAsyncResult> begin, Func<IAsyncResult, TResult> end)
- {
- if (begin == null)
- throw new ArgumentNullException("begin");
- if (end == null)
- throw new ArgumentNullException("end");
-
- return s_impl.FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TResult>(begin, end);
- }
-
- /// <summary>
- /// Converts a Begin/End invoke function pair into an asynchronous function.
- /// </summary>
- /// <typeparam name="TArg1">The type of the first argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TResult">The type of the result returned by the end delegate.</typeparam>
- /// <param name="begin">The delegate that begins the asynchronous operation.</param>
- /// <param name="end">The delegate that ends the asynchronous operation.</param>
- /// <returns>Function that can be used to start the asynchronous operation and retrieve the result as an observable sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="begin"/> or <paramref name="end"/> is null.</exception>
- /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
-#if PREFER_ASYNC
- [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
-#endif
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, IObservable<TResult>> FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TResult>(Func<TArg1, TArg2, TArg3, TArg4, TArg5, AsyncCallback, object, IAsyncResult> begin, Func<IAsyncResult, TResult> end)
- {
- if (begin == null)
- throw new ArgumentNullException("begin");
- if (end == null)
- throw new ArgumentNullException("end");
-
- return s_impl.FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TResult>(begin, end);
- }
-
- /// <summary>
- /// Converts a Begin/End invoke function pair into an asynchronous function.
- /// </summary>
- /// <typeparam name="TArg1">The type of the first argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TResult">The type of the result returned by the end delegate.</typeparam>
- /// <param name="begin">The delegate that begins the asynchronous operation.</param>
- /// <param name="end">The delegate that ends the asynchronous operation.</param>
- /// <returns>Function that can be used to start the asynchronous operation and retrieve the result as an observable sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="begin"/> or <paramref name="end"/> is null.</exception>
- /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
-#if PREFER_ASYNC
- [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
-#endif
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, IObservable<TResult>> FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TResult>(Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, AsyncCallback, object, IAsyncResult> begin, Func<IAsyncResult, TResult> end)
- {
- if (begin == null)
- throw new ArgumentNullException("begin");
- if (end == null)
- throw new ArgumentNullException("end");
-
- return s_impl.FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TResult>(begin, end);
- }
-
- /// <summary>
- /// Converts a Begin/End invoke function pair into an asynchronous function.
- /// </summary>
- /// <typeparam name="TArg1">The type of the first argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg7">The type of the seventh argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TResult">The type of the result returned by the end delegate.</typeparam>
- /// <param name="begin">The delegate that begins the asynchronous operation.</param>
- /// <param name="end">The delegate that ends the asynchronous operation.</param>
- /// <returns>Function that can be used to start the asynchronous operation and retrieve the result as an observable sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="begin"/> or <paramref name="end"/> is null.</exception>
- /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
-#if PREFER_ASYNC
- [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
-#endif
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, IObservable<TResult>> FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TResult>(Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, AsyncCallback, object, IAsyncResult> begin, Func<IAsyncResult, TResult> end)
- {
- if (begin == null)
- throw new ArgumentNullException("begin");
- if (end == null)
- throw new ArgumentNullException("end");
-
- return s_impl.FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TResult>(begin, end);
- }
-
- /// <summary>
- /// Converts a Begin/End invoke function pair into an asynchronous function.
- /// </summary>
- /// <typeparam name="TArg1">The type of the first argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg7">The type of the seventh argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg8">The type of the eighth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TResult">The type of the result returned by the end delegate.</typeparam>
- /// <param name="begin">The delegate that begins the asynchronous operation.</param>
- /// <param name="end">The delegate that ends the asynchronous operation.</param>
- /// <returns>Function that can be used to start the asynchronous operation and retrieve the result as an observable sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="begin"/> or <paramref name="end"/> is null.</exception>
- /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
-#if PREFER_ASYNC
- [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
-#endif
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, IObservable<TResult>> FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TResult>(Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, AsyncCallback, object, IAsyncResult> begin, Func<IAsyncResult, TResult> end)
- {
- if (begin == null)
- throw new ArgumentNullException("begin");
- if (end == null)
- throw new ArgumentNullException("end");
-
- return s_impl.FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TResult>(begin, end);
- }
-
- /// <summary>
- /// Converts a Begin/End invoke function pair into an asynchronous function.
- /// </summary>
- /// <typeparam name="TArg1">The type of the first argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg7">The type of the seventh argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg8">The type of the eighth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg9">The type of the ninth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TResult">The type of the result returned by the end delegate.</typeparam>
- /// <param name="begin">The delegate that begins the asynchronous operation.</param>
- /// <param name="end">The delegate that ends the asynchronous operation.</param>
- /// <returns>Function that can be used to start the asynchronous operation and retrieve the result as an observable sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="begin"/> or <paramref name="end"/> is null.</exception>
- /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
-#if PREFER_ASYNC
- [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
-#endif
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, IObservable<TResult>> FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TResult>(Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, AsyncCallback, object, IAsyncResult> begin, Func<IAsyncResult, TResult> end)
- {
- if (begin == null)
- throw new ArgumentNullException("begin");
- if (end == null)
- throw new ArgumentNullException("end");
-
- return s_impl.FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TResult>(begin, end);
- }
-
- /// <summary>
- /// Converts a Begin/End invoke function pair into an asynchronous function.
- /// </summary>
- /// <typeparam name="TArg1">The type of the first argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg7">The type of the seventh argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg8">The type of the eighth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg9">The type of the ninth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg10">The type of the tenth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TResult">The type of the result returned by the end delegate.</typeparam>
- /// <param name="begin">The delegate that begins the asynchronous operation.</param>
- /// <param name="end">The delegate that ends the asynchronous operation.</param>
- /// <returns>Function that can be used to start the asynchronous operation and retrieve the result as an observable sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="begin"/> or <paramref name="end"/> is null.</exception>
- /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
-#if PREFER_ASYNC
- [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
-#endif
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, IObservable<TResult>> FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TResult>(Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, AsyncCallback, object, IAsyncResult> begin, Func<IAsyncResult, TResult> end)
- {
- if (begin == null)
- throw new ArgumentNullException("begin");
- if (end == null)
- throw new ArgumentNullException("end");
-
- return s_impl.FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TResult>(begin, end);
- }
-
- /// <summary>
- /// Converts a Begin/End invoke function pair into an asynchronous function.
- /// </summary>
- /// <typeparam name="TArg1">The type of the first argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg7">The type of the seventh argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg8">The type of the eighth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg9">The type of the ninth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg10">The type of the tenth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg11">The type of the eleventh argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TResult">The type of the result returned by the end delegate.</typeparam>
- /// <param name="begin">The delegate that begins the asynchronous operation.</param>
- /// <param name="end">The delegate that ends the asynchronous operation.</param>
- /// <returns>Function that can be used to start the asynchronous operation and retrieve the result as an observable sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="begin"/> or <paramref name="end"/> is null.</exception>
- /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
-#if PREFER_ASYNC
- [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
-#endif
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, IObservable<TResult>> FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TResult>(Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, AsyncCallback, object, IAsyncResult> begin, Func<IAsyncResult, TResult> end)
- {
- if (begin == null)
- throw new ArgumentNullException("begin");
- if (end == null)
- throw new ArgumentNullException("end");
-
- return s_impl.FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TResult>(begin, end);
- }
-
- /// <summary>
- /// Converts a Begin/End invoke function pair into an asynchronous function.
- /// </summary>
- /// <typeparam name="TArg1">The type of the first argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg7">The type of the seventh argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg8">The type of the eighth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg9">The type of the ninth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg10">The type of the tenth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg11">The type of the eleventh argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg12">The type of the twelfth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TResult">The type of the result returned by the end delegate.</typeparam>
- /// <param name="begin">The delegate that begins the asynchronous operation.</param>
- /// <param name="end">The delegate that ends the asynchronous operation.</param>
- /// <returns>Function that can be used to start the asynchronous operation and retrieve the result as an observable sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="begin"/> or <paramref name="end"/> is null.</exception>
- /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
-#if PREFER_ASYNC
- [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
-#endif
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, IObservable<TResult>> FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TResult>(Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, AsyncCallback, object, IAsyncResult> begin, Func<IAsyncResult, TResult> end)
- {
- if (begin == null)
- throw new ArgumentNullException("begin");
- if (end == null)
- throw new ArgumentNullException("end");
-
- return s_impl.FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TResult>(begin, end);
- }
-
- /// <summary>
- /// Converts a Begin/End invoke function pair into an asynchronous function.
- /// </summary>
- /// <typeparam name="TArg1">The type of the first argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg7">The type of the seventh argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg8">The type of the eighth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg9">The type of the ninth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg10">The type of the tenth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg11">The type of the eleventh argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg12">The type of the twelfth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg13">The type of the thirteenth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TResult">The type of the result returned by the end delegate.</typeparam>
- /// <param name="begin">The delegate that begins the asynchronous operation.</param>
- /// <param name="end">The delegate that ends the asynchronous operation.</param>
- /// <returns>Function that can be used to start the asynchronous operation and retrieve the result as an observable sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="begin"/> or <paramref name="end"/> is null.</exception>
- /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
-#if PREFER_ASYNC
- [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
-#endif
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, IObservable<TResult>> FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TResult>(Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, AsyncCallback, object, IAsyncResult> begin, Func<IAsyncResult, TResult> end)
- {
- if (begin == null)
- throw new ArgumentNullException("begin");
- if (end == null)
- throw new ArgumentNullException("end");
-
- return s_impl.FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TResult>(begin, end);
- }
-
- /// <summary>
- /// Converts a Begin/End invoke function pair into an asynchronous function.
- /// </summary>
- /// <typeparam name="TArg1">The type of the first argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg7">The type of the seventh argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg8">The type of the eighth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg9">The type of the ninth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg10">The type of the tenth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg11">The type of the eleventh argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg12">The type of the twelfth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg13">The type of the thirteenth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg14">The type of the fourteenth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TResult">The type of the result returned by the end delegate.</typeparam>
- /// <param name="begin">The delegate that begins the asynchronous operation.</param>
- /// <param name="end">The delegate that ends the asynchronous operation.</param>
- /// <returns>Function that can be used to start the asynchronous operation and retrieve the result as an observable sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="begin"/> or <paramref name="end"/> is null.</exception>
- /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
-#if PREFER_ASYNC
- [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
-#endif
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, IObservable<TResult>> FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TResult>(Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, AsyncCallback, object, IAsyncResult> begin, Func<IAsyncResult, TResult> end)
- {
- if (begin == null)
- throw new ArgumentNullException("begin");
- if (end == null)
- throw new ArgumentNullException("end");
-
- return s_impl.FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TResult>(begin, end);
- }
-#endif
-
- #endregion
-
- #region Action
-
- /// <summary>
- /// Converts a Begin/End invoke function pair into an asynchronous function.
- /// </summary>
- /// <param name="begin">The delegate that begins the asynchronous operation.</param>
- /// <param name="end">The delegate that ends the asynchronous operation.</param>
- /// <returns>Function that can be used to start the asynchronous operation and retrieve the result (represented as a Unit value) as an observable sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="begin"/> or <paramref name="end"/> is null.</exception>
- /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
-#if PREFER_ASYNC
- [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
-#endif
- public static Func<IObservable<Unit>> FromAsyncPattern(Func<AsyncCallback, object, IAsyncResult> begin, Action<IAsyncResult> end)
- {
- if (begin == null)
- throw new ArgumentNullException("begin");
- if (end == null)
- throw new ArgumentNullException("end");
-
- return s_impl.FromAsyncPattern(begin, end);
- }
-
- /// <summary>
- /// Converts a Begin/End invoke function pair into an asynchronous function.
- /// </summary>
- /// <typeparam name="TArg1">The type of the first argument passed to the begin delegate.</typeparam>
- /// <param name="begin">The delegate that begins the asynchronous operation.</param>
- /// <param name="end">The delegate that ends the asynchronous operation.</param>
- /// <returns>Function that can be used to start the asynchronous operation and retrieve the result (represented as a Unit value) as an observable sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="begin"/> or <paramref name="end"/> is null.</exception>
- /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
-#if PREFER_ASYNC
- [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
-#endif
- public static Func<TArg1, IObservable<Unit>> FromAsyncPattern<TArg1>(Func<TArg1, AsyncCallback, object, IAsyncResult> begin, Action<IAsyncResult> end)
- {
- if (begin == null)
- throw new ArgumentNullException("begin");
- if (end == null)
- throw new ArgumentNullException("end");
-
- return s_impl.FromAsyncPattern<TArg1>(begin, end);
- }
-
- /// <summary>
- /// Converts a Begin/End invoke function pair into an asynchronous function.
- /// </summary>
- /// <typeparam name="TArg1">The type of the first argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the begin delegate.</typeparam>
- /// <param name="begin">The delegate that begins the asynchronous operation.</param>
- /// <param name="end">The delegate that ends the asynchronous operation.</param>
- /// <returns>Function that can be used to start the asynchronous operation and retrieve the result (represented as a Unit value) as an observable sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="begin"/> or <paramref name="end"/> is null.</exception>
- /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
-#if PREFER_ASYNC
- [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
-#endif
- public static Func<TArg1, TArg2, IObservable<Unit>> FromAsyncPattern<TArg1, TArg2>(Func<TArg1, TArg2, AsyncCallback, object, IAsyncResult> begin, Action<IAsyncResult> end)
- {
- if (begin == null)
- throw new ArgumentNullException("begin");
- if (end == null)
- throw new ArgumentNullException("end");
-
- return s_impl.FromAsyncPattern<TArg1, TArg2>(begin, end);
- }
-
-#if !NO_LARGEARITY
- /// <summary>
- /// Converts a Begin/End invoke function pair into an asynchronous function.
- /// </summary>
- /// <typeparam name="TArg1">The type of the first argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the begin delegate.</typeparam>
- /// <param name="begin">The delegate that begins the asynchronous operation.</param>
- /// <param name="end">The delegate that ends the asynchronous operation.</param>
- /// <returns>Function that can be used to start the asynchronous operation and retrieve the result (represented as a Unit value) as an observable sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="begin"/> or <paramref name="end"/> is null.</exception>
- /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
-#if PREFER_ASYNC
- [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
-#endif
- public static Func<TArg1, TArg2, TArg3, IObservable<Unit>> FromAsyncPattern<TArg1, TArg2, TArg3>(Func<TArg1, TArg2, TArg3, AsyncCallback, object, IAsyncResult> begin, Action<IAsyncResult> end)
- {
- if (begin == null)
- throw new ArgumentNullException("begin");
- if (end == null)
- throw new ArgumentNullException("end");
-
- return s_impl.FromAsyncPattern<TArg1, TArg2, TArg3>(begin, end);
- }
-
- /// <summary>
- /// Converts a Begin/End invoke function pair into an asynchronous function.
- /// </summary>
- /// <typeparam name="TArg1">The type of the first argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the begin delegate.</typeparam>
- /// <param name="begin">The delegate that begins the asynchronous operation.</param>
- /// <param name="end">The delegate that ends the asynchronous operation.</param>
- /// <returns>Function that can be used to start the asynchronous operation and retrieve the result (represented as a Unit value) as an observable sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="begin"/> or <paramref name="end"/> is null.</exception>
- /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
-#if PREFER_ASYNC
- [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
-#endif
- public static Func<TArg1, TArg2, TArg3, TArg4, IObservable<Unit>> FromAsyncPattern<TArg1, TArg2, TArg3, TArg4>(Func<TArg1, TArg2, TArg3, TArg4, AsyncCallback, object, IAsyncResult> begin, Action<IAsyncResult> end)
- {
- if (begin == null)
- throw new ArgumentNullException("begin");
- if (end == null)
- throw new ArgumentNullException("end");
-
- return s_impl.FromAsyncPattern<TArg1, TArg2, TArg3, TArg4>(begin, end);
- }
-
- /// <summary>
- /// Converts a Begin/End invoke function pair into an asynchronous function.
- /// </summary>
- /// <typeparam name="TArg1">The type of the first argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the begin delegate.</typeparam>
- /// <param name="begin">The delegate that begins the asynchronous operation.</param>
- /// <param name="end">The delegate that ends the asynchronous operation.</param>
- /// <returns>Function that can be used to start the asynchronous operation and retrieve the result (represented as a Unit value) as an observable sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="begin"/> or <paramref name="end"/> is null.</exception>
- /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
-#if PREFER_ASYNC
- [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
-#endif
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, IObservable<Unit>> FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5>(Func<TArg1, TArg2, TArg3, TArg4, TArg5, AsyncCallback, object, IAsyncResult> begin, Action<IAsyncResult> end)
- {
- if (begin == null)
- throw new ArgumentNullException("begin");
- if (end == null)
- throw new ArgumentNullException("end");
-
- return s_impl.FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5>(begin, end);
- }
-
- /// <summary>
- /// Converts a Begin/End invoke function pair into an asynchronous function.
- /// </summary>
- /// <typeparam name="TArg1">The type of the first argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the begin delegate.</typeparam>
- /// <param name="begin">The delegate that begins the asynchronous operation.</param>
- /// <param name="end">The delegate that ends the asynchronous operation.</param>
- /// <returns>Function that can be used to start the asynchronous operation and retrieve the result (represented as a Unit value) as an observable sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="begin"/> or <paramref name="end"/> is null.</exception>
- /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
-#if PREFER_ASYNC
- [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
-#endif
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, IObservable<Unit>> FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6>(Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, AsyncCallback, object, IAsyncResult> begin, Action<IAsyncResult> end)
- {
- if (begin == null)
- throw new ArgumentNullException("begin");
- if (end == null)
- throw new ArgumentNullException("end");
-
- return s_impl.FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6>(begin, end);
- }
-
- /// <summary>
- /// Converts a Begin/End invoke function pair into an asynchronous function.
- /// </summary>
- /// <typeparam name="TArg1">The type of the first argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg7">The type of the seventh argument passed to the begin delegate.</typeparam>
- /// <param name="begin">The delegate that begins the asynchronous operation.</param>
- /// <param name="end">The delegate that ends the asynchronous operation.</param>
- /// <returns>Function that can be used to start the asynchronous operation and retrieve the result (represented as a Unit value) as an observable sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="begin"/> or <paramref name="end"/> is null.</exception>
- /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
-#if PREFER_ASYNC
- [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
-#endif
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, IObservable<Unit>> FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7>(Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, AsyncCallback, object, IAsyncResult> begin, Action<IAsyncResult> end)
- {
- if (begin == null)
- throw new ArgumentNullException("begin");
- if (end == null)
- throw new ArgumentNullException("end");
-
- return s_impl.FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7>(begin, end);
- }
-
- /// <summary>
- /// Converts a Begin/End invoke function pair into an asynchronous function.
- /// </summary>
- /// <typeparam name="TArg1">The type of the first argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg7">The type of the seventh argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg8">The type of the eighth argument passed to the begin delegate.</typeparam>
- /// <param name="begin">The delegate that begins the asynchronous operation.</param>
- /// <param name="end">The delegate that ends the asynchronous operation.</param>
- /// <returns>Function that can be used to start the asynchronous operation and retrieve the result (represented as a Unit value) as an observable sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="begin"/> or <paramref name="end"/> is null.</exception>
- /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
-#if PREFER_ASYNC
- [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
-#endif
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, IObservable<Unit>> FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8>(Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, AsyncCallback, object, IAsyncResult> begin, Action<IAsyncResult> end)
- {
- if (begin == null)
- throw new ArgumentNullException("begin");
- if (end == null)
- throw new ArgumentNullException("end");
-
- return s_impl.FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8>(begin, end);
- }
-
- /// <summary>
- /// Converts a Begin/End invoke function pair into an asynchronous function.
- /// </summary>
- /// <typeparam name="TArg1">The type of the first argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg7">The type of the seventh argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg8">The type of the eighth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg9">The type of the ninth argument passed to the begin delegate.</typeparam>
- /// <param name="begin">The delegate that begins the asynchronous operation.</param>
- /// <param name="end">The delegate that ends the asynchronous operation.</param>
- /// <returns>Function that can be used to start the asynchronous operation and retrieve the result (represented as a Unit value) as an observable sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="begin"/> or <paramref name="end"/> is null.</exception>
- /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
-#if PREFER_ASYNC
- [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
-#endif
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, IObservable<Unit>> FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9>(Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, AsyncCallback, object, IAsyncResult> begin, Action<IAsyncResult> end)
- {
- if (begin == null)
- throw new ArgumentNullException("begin");
- if (end == null)
- throw new ArgumentNullException("end");
-
- return s_impl.FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9>(begin, end);
- }
-
- /// <summary>
- /// Converts a Begin/End invoke function pair into an asynchronous function.
- /// </summary>
- /// <typeparam name="TArg1">The type of the first argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg7">The type of the seventh argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg8">The type of the eighth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg9">The type of the ninth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg10">The type of the tenth argument passed to the begin delegate.</typeparam>
- /// <param name="begin">The delegate that begins the asynchronous operation.</param>
- /// <param name="end">The delegate that ends the asynchronous operation.</param>
- /// <returns>Function that can be used to start the asynchronous operation and retrieve the result (represented as a Unit value) as an observable sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="begin"/> or <paramref name="end"/> is null.</exception>
- /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
-#if PREFER_ASYNC
- [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
-#endif
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, IObservable<Unit>> FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10>(Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, AsyncCallback, object, IAsyncResult> begin, Action<IAsyncResult> end)
- {
- if (begin == null)
- throw new ArgumentNullException("begin");
- if (end == null)
- throw new ArgumentNullException("end");
-
- return s_impl.FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10>(begin, end);
- }
-
- /// <summary>
- /// Converts a Begin/End invoke function pair into an asynchronous function.
- /// </summary>
- /// <typeparam name="TArg1">The type of the first argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg7">The type of the seventh argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg8">The type of the eighth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg9">The type of the ninth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg10">The type of the tenth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg11">The type of the eleventh argument passed to the begin delegate.</typeparam>
- /// <param name="begin">The delegate that begins the asynchronous operation.</param>
- /// <param name="end">The delegate that ends the asynchronous operation.</param>
- /// <returns>Function that can be used to start the asynchronous operation and retrieve the result (represented as a Unit value) as an observable sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="begin"/> or <paramref name="end"/> is null.</exception>
- /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
-#if PREFER_ASYNC
- [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
-#endif
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, IObservable<Unit>> FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11>(Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, AsyncCallback, object, IAsyncResult> begin, Action<IAsyncResult> end)
- {
- if (begin == null)
- throw new ArgumentNullException("begin");
- if (end == null)
- throw new ArgumentNullException("end");
-
- return s_impl.FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11>(begin, end);
- }
-
- /// <summary>
- /// Converts a Begin/End invoke function pair into an asynchronous function.
- /// </summary>
- /// <typeparam name="TArg1">The type of the first argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg7">The type of the seventh argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg8">The type of the eighth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg9">The type of the ninth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg10">The type of the tenth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg11">The type of the eleventh argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg12">The type of the twelfth argument passed to the begin delegate.</typeparam>
- /// <param name="begin">The delegate that begins the asynchronous operation.</param>
- /// <param name="end">The delegate that ends the asynchronous operation.</param>
- /// <returns>Function that can be used to start the asynchronous operation and retrieve the result (represented as a Unit value) as an observable sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="begin"/> or <paramref name="end"/> is null.</exception>
- /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
-#if PREFER_ASYNC
- [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
-#endif
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, IObservable<Unit>> FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12>(Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, AsyncCallback, object, IAsyncResult> begin, Action<IAsyncResult> end)
- {
- if (begin == null)
- throw new ArgumentNullException("begin");
- if (end == null)
- throw new ArgumentNullException("end");
-
- return s_impl.FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12>(begin, end);
- }
-
- /// <summary>
- /// Converts a Begin/End invoke function pair into an asynchronous function.
- /// </summary>
- /// <typeparam name="TArg1">The type of the first argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg7">The type of the seventh argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg8">The type of the eighth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg9">The type of the ninth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg10">The type of the tenth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg11">The type of the eleventh argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg12">The type of the twelfth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg13">The type of the thirteenth argument passed to the begin delegate.</typeparam>
- /// <param name="begin">The delegate that begins the asynchronous operation.</param>
- /// <param name="end">The delegate that ends the asynchronous operation.</param>
- /// <returns>Function that can be used to start the asynchronous operation and retrieve the result (represented as a Unit value) as an observable sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="begin"/> or <paramref name="end"/> is null.</exception>
- /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
-#if PREFER_ASYNC
- [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
-#endif
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, IObservable<Unit>> FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13>(Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, AsyncCallback, object, IAsyncResult> begin, Action<IAsyncResult> end)
- {
- if (begin == null)
- throw new ArgumentNullException("begin");
- if (end == null)
- throw new ArgumentNullException("end");
-
- return s_impl.FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13>(begin, end);
- }
-
- /// <summary>
- /// Converts a Begin/End invoke function pair into an asynchronous function.
- /// </summary>
- /// <typeparam name="TArg1">The type of the first argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg7">The type of the seventh argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg8">The type of the eighth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg9">The type of the ninth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg10">The type of the tenth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg11">The type of the eleventh argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg12">The type of the twelfth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg13">The type of the thirteenth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg14">The type of the fourteenth argument passed to the begin delegate.</typeparam>
- /// <param name="begin">The delegate that begins the asynchronous operation.</param>
- /// <param name="end">The delegate that ends the asynchronous operation.</param>
- /// <returns>Function that can be used to start the asynchronous operation and retrieve the result (represented as a Unit value) as an observable sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="begin"/> or <paramref name="end"/> is null.</exception>
- /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
-#if PREFER_ASYNC
- [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
-#endif
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, IObservable<Unit>> FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14>(Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, AsyncCallback, object, IAsyncResult> begin, Action<IAsyncResult> end)
- {
- if (begin == null)
- throw new ArgumentNullException("begin");
- if (end == null)
- throw new ArgumentNullException("end");
-
- return s_impl.FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14>(begin, end);
- }
-#endif
-
- #endregion
-
- #endregion
-
- #region Start[Async]
-
- #region Func
-
- /// <summary>
- /// Invokes the specified function asynchronously, surfacing the result through an observable sequence.
- /// </summary>
- /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
- /// <param name="function">Function to run asynchronously.</param>
- /// <returns>An observable sequence exposing the function's result value, or an exception.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="function"/> is null.</exception>
- /// <remarks>
- /// <list type="bullet">
- /// <item><description>The function is called immediately, not during the subscription of the resulting sequence.</description></item>
- /// <item><description>Multiple subscriptions to the resulting sequence can observe the function's result.</description></item>
- /// </list>
- /// </remarks>
- public static IObservable<TResult> Start<TResult>(Func<TResult> function)
- {
- if (function == null)
- throw new ArgumentNullException("function");
-
- return s_impl.Start<TResult>(function);
- }
-
- /// <summary>
- /// Invokes the specified function asynchronously on the specified scheduler, surfacing the result through an observable sequence
- /// </summary>
- /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
- /// <param name="function">Function to run asynchronously.</param>
- /// <param name="scheduler">Scheduler to run the function on.</param>
- /// <returns>An observable sequence exposing the function's result value, or an exception.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="function"/> or <paramref name="scheduler"/> is null.</exception>
- /// <remarks>
- /// <list type="bullet">
- /// <item><description>The function is called immediately, not during the subscription of the resulting sequence.</description></item>
- /// <item><description>Multiple subscriptions to the resulting sequence can observe the function's result.</description></item>
- /// </list>
- /// </remarks>
- public static IObservable<TResult> Start<TResult>(Func<TResult> function, IScheduler scheduler)
- {
- if (function == null)
- throw new ArgumentNullException("function");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return s_impl.Start<TResult>(function, scheduler);
- }
-
-#if !NO_TPL
- /// <summary>
- /// Invokes the asynchronous function, surfacing the result through an observable sequence.
- /// </summary>
- /// <typeparam name="TResult">The type of the result returned by the asynchronous function.</typeparam>
- /// <param name="functionAsync">Asynchronous function to run.</param>
- /// <returns>An observable sequence exposing the function's result value, or an exception.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="functionAsync"/> is null.</exception>
- /// <remarks>
- /// <list type="bullet">
- /// <item><description>The function is started immediately, not during the subscription of the resulting sequence.</description></item>
- /// <item><description>Multiple subscriptions to the resulting sequence can observe the function's result.</description></item>
- /// </list>
- /// </remarks>
- public static IObservable<TResult> StartAsync<TResult>(Func<Task<TResult>> functionAsync)
- {
- if (functionAsync == null)
- throw new ArgumentNullException("functionAsync");
-
- return s_impl.StartAsync<TResult>(functionAsync);
- }
-
- /// <summary>
- /// Invokes the asynchronous function, surfacing the result through an observable sequence.
- /// The CancellationToken is shared by all subscriptions on the resulting observable sequence. See the remarks section for more information.
- /// </summary>
- /// <typeparam name="TResult">The type of the result returned by the asynchronous function.</typeparam>
- /// <param name="functionAsync">Asynchronous function to run.</param>
- /// <returns>An observable sequence exposing the function's result value, or an exception.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="functionAsync"/> is null.</exception>
- /// <remarks>
- /// <list type="bullet">
- /// <item><description>The function is started immediately, not during the subscription of the resulting sequence.</description></item>
- /// <item><description>Multiple subscriptions to the resulting sequence can observe the function's result.</description></item>
- /// <item><description>
- /// If any subscription to the resulting sequence is disposed, the CancellationToken is set. The observer associated to the disposed
- /// subscription won't see the TaskCanceledException, but other observers will. You can protect against this using the Catch operator.
- /// Be careful when handing out the resulting sequence because of this behavior. The most common use is to have a single subscription
- /// to the resulting sequence, which controls the CancellationToken state. Alternatively, you can control subscription behavior using
- /// multicast operators.
- /// </description></item>
- /// </list>
- /// </remarks>
- public static IObservable<TResult> StartAsync<TResult>(Func<CancellationToken, Task<TResult>> functionAsync)
- {
- if (functionAsync == null)
- throw new ArgumentNullException("functionAsync");
-
- return s_impl.StartAsync<TResult>(functionAsync);
- }
-#endif
-
- #endregion
-
- #region Action
-
- /// <summary>
- /// Invokes the action asynchronously, surfacing the result through an observable sequence.
- /// </summary>
- /// <param name="action">Action to run asynchronously.</param>
- /// <returns>An observable sequence exposing a Unit value upon completion of the action, or an exception.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="action"/> is null.</exception>
- /// <remarks>
- /// <list type="bullet">
- /// <item><description>The action is called immediately, not during the subscription of the resulting sequence.</description></item>
- /// <item><description>Multiple subscriptions to the resulting sequence can observe the action's outcome.</description></item>
- /// </list>
- /// </remarks>
- public static IObservable<Unit> Start(Action action)
- {
- if (action == null)
- throw new ArgumentNullException("action");
-
- return s_impl.Start(action);
- }
-
- /// <summary>
- /// Invokes the action asynchronously on the specified scheduler, surfacing the result through an observable sequence.
- /// </summary>
- /// <param name="action">Action to run asynchronously.</param>
- /// <param name="scheduler">Scheduler to run the action on.</param>
- /// <returns>An observable sequence exposing a Unit value upon completion of the action, or an exception.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="action"/> or <paramref name="scheduler"/> is null.</exception>
- /// <remarks>
- /// <list type="bullet">
- /// <item><description>The action is called immediately, not during the subscription of the resulting sequence.</description></item>
- /// <item><description>Multiple subscriptions to the resulting sequence can observe the action's outcome.</description></item>
- /// </list>
- /// </remarks>
- public static IObservable<Unit> Start(Action action, IScheduler scheduler)
- {
- if (action == null)
- throw new ArgumentNullException("action");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return s_impl.Start(action, scheduler);
- }
-
-#if !NO_TPL
- /// <summary>
- /// Invokes the asynchronous action, surfacing the result through an observable sequence.
- /// </summary>
- /// <param name="actionAsync">Asynchronous action to run.</param>
- /// <returns>An observable sequence exposing a Unit value upon completion of the action, or an exception.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="actionAsync"/> is null.</exception>
- /// <remarks>
- /// <list type="bullet">
- /// <item><description>The action is started immediately, not during the subscription of the resulting sequence.</description></item>
- /// <item><description>Multiple subscriptions to the resulting sequence can observe the action's outcome.</description></item>
- /// </list>
- /// </remarks>
- public static IObservable<Unit> StartAsync(Func<Task> actionAsync)
- {
- if (actionAsync == null)
- throw new ArgumentNullException("actionAsync");
-
- return s_impl.StartAsync(actionAsync);
- }
-
- /// <summary>
- /// Invokes the asynchronous action, surfacing the result through an observable sequence.
- /// The CancellationToken is shared by all subscriptions on the resulting observable sequence. See the remarks section for more information.
- /// </summary>
- /// <param name="actionAsync">Asynchronous action to run.</param>
- /// <returns>An observable sequence exposing a Unit value upon completion of the action, or an exception.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="actionAsync"/> is null.</exception>
- /// <remarks>
- /// <list type="bullet">
- /// <item><description>The action is started immediately, not during the subscription of the resulting sequence.</description></item>
- /// <item><description>Multiple subscriptions to the resulting sequence can observe the action's outcome.</description></item>
- /// <item><description>
- /// If any subscription to the resulting sequence is disposed, the CancellationToken is set. The observer associated to the disposed
- /// subscription won't see the TaskCanceledException, but other observers will. You can protect against this using the Catch operator.
- /// Be careful when handing out the resulting sequence because of this behavior. The most common use is to have a single subscription
- /// to the resulting sequence, which controls the CancellationToken state. Alternatively, you can control subscription behavior using
- /// multicast operators.
- /// </description></item>
- /// </list>
- /// </remarks>
- public static IObservable<Unit> StartAsync(Func<CancellationToken, Task> actionAsync)
- {
- if (actionAsync == null)
- throw new ArgumentNullException("actionAsync");
-
- return s_impl.StartAsync(actionAsync);
- }
-#endif
-
- #endregion
-
- #endregion
-
- #region FromAsync
-
-#if !NO_TPL
-
- #region Func
-
- /// <summary>
- /// Converts to asynchronous function into an observable sequence. Each subscription to the resulting sequence causes the function to be started.
- /// </summary>
- /// <typeparam name="TResult">The type of the result returned by the asynchronous function.</typeparam>
- /// <param name="functionAsync">Asynchronous function to convert.</param>
- /// <returns>An observable sequence exposing the result of invoking the function, or an exception.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="functionAsync"/> is null.</exception>
- public static IObservable<TResult> FromAsync<TResult>(Func<Task<TResult>> functionAsync)
- {
- return s_impl.FromAsync<TResult>(functionAsync);
- }
-
- /// <summary>
- /// Converts to asynchronous function into an observable sequence. Each subscription to the resulting sequence causes the function to be started.
- /// The CancellationToken passed to the asynchronous function is tied to the observable sequence's subscription that triggered the function's invocation and can be used for best-effort cancellation.
- /// </summary>
- /// <typeparam name="TResult">The type of the result returned by the asynchronous function.</typeparam>
- /// <param name="functionAsync">Asynchronous function to convert.</param>
- /// <returns>An observable sequence exposing the result of invoking the function, or an exception.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="functionAsync"/> is null.</exception>
- /// <remarks>When a subscription to the resulting sequence is disposed, the CancellationToken that was fed to the asynchronous function will be signaled.</remarks>
- public static IObservable<TResult> FromAsync<TResult>(Func<CancellationToken, Task<TResult>> functionAsync)
- {
- return s_impl.FromAsync<TResult>(functionAsync);
- }
-
- #endregion
-
- #region Action
-
- /// <summary>
- /// Converts to asynchronous action into an observable sequence. Each subscription to the resulting sequence causes the action to be started.
- /// </summary>
- /// <param name="actionAsync">Asynchronous action to convert.</param>
- /// <returns>An observable sequence exposing a Unit value upon completion of the action, or an exception.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="actionAsync"/> is null.</exception>
- public static IObservable<Unit> FromAsync(Func<Task> actionAsync)
- {
- return s_impl.FromAsync(actionAsync);
- }
-
- /// <summary>
- /// Converts to asynchronous action into an observable sequence. Each subscription to the resulting sequence causes the action to be started.
- /// The CancellationToken passed to the asynchronous action is tied to the observable sequence's subscription that triggered the action's invocation and can be used for best-effort cancellation.
- /// </summary>
- /// <param name="actionAsync">Asynchronous action to convert.</param>
- /// <returns>An observable sequence exposing a Unit value upon completion of the action, or an exception.</returns>
- /// <remarks>When a subscription to the resulting sequence is disposed, the CancellationToken that was fed to the asynchronous function will be signaled.</remarks>
- /// <exception cref="ArgumentNullException"><paramref name="actionAsync"/> is null.</exception>
- public static IObservable<Unit> FromAsync(Func<CancellationToken, Task> actionAsync)
- {
- return s_impl.FromAsync(actionAsync);
- }
-
- #endregion
-
-#endif
-
- #endregion
-
- #region ToAsync
-
- #region Func
-
- /// <summary>
- /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function.
- /// </summary>
- /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
- /// <param name="function">Function to convert to an asynchronous function.</param>
- /// <returns>Asynchronous function.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="function"/> is null.</exception>
- public static Func<IObservable<TResult>> ToAsync<TResult>(this Func<TResult> function)
- {
- if (function == null)
- throw new ArgumentNullException("function");
-
- return s_impl.ToAsync<TResult>(function);
- }
-
- /// <summary>
- /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function on the specified scheduler.
- /// </summary>
- /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
- /// <param name="function">Function to convert to an asynchronous function.</param>
- /// <param name="scheduler">Scheduler to invoke the original function on.</param>
- /// <returns>Asynchronous function.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="function"/> or <paramref name="scheduler"/> is null.</exception>
- public static Func<IObservable<TResult>> ToAsync<TResult>(this Func<TResult> function, IScheduler scheduler)
- {
- if (function == null)
- throw new ArgumentNullException("function");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return s_impl.ToAsync<TResult>(function, scheduler);
- }
-
- /// <summary>
- /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function.
- /// </summary>
- /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
- /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
- /// <param name="function">Function to convert to an asynchronous function.</param>
- /// <returns>Asynchronous function.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="function"/> is null.</exception>
- public static Func<TArg1, IObservable<TResult>> ToAsync<TArg1, TResult>(this Func<TArg1, TResult> function)
- {
- if (function == null)
- throw new ArgumentNullException("function");
-
- return s_impl.ToAsync<TArg1, TResult>(function);
- }
-
- /// <summary>
- /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function on the specified scheduler.
- /// </summary>
- /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
- /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
- /// <param name="function">Function to convert to an asynchronous function.</param>
- /// <param name="scheduler">Scheduler to invoke the original function on.</param>
- /// <returns>Asynchronous function.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="function"/> or <paramref name="scheduler"/> is null.</exception>
- public static Func<TArg1, IObservable<TResult>> ToAsync<TArg1, TResult>(this Func<TArg1, TResult> function, IScheduler scheduler)
- {
- if (function == null)
- throw new ArgumentNullException("function");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return s_impl.ToAsync<TArg1, TResult>(function, scheduler);
- }
-
- /// <summary>
- /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function.
- /// </summary>
- /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
- /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
- /// <param name="function">Function to convert to an asynchronous function.</param>
- /// <returns>Asynchronous function.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="function"/> is null.</exception>
- public static Func<TArg1, TArg2, IObservable<TResult>> ToAsync<TArg1, TArg2, TResult>(this Func<TArg1, TArg2, TResult> function)
- {
- if (function == null)
- throw new ArgumentNullException("function");
-
- return s_impl.ToAsync<TArg1, TArg2, TResult>(function);
- }
-
- /// <summary>
- /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function on the specified scheduler.
- /// </summary>
- /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
- /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
- /// <param name="function">Function to convert to an asynchronous function.</param>
- /// <param name="scheduler">Scheduler to invoke the original function on.</param>
- /// <returns>Asynchronous function.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="function"/> or <paramref name="scheduler"/> is null.</exception>
- public static Func<TArg1, TArg2, IObservable<TResult>> ToAsync<TArg1, TArg2, TResult>(this Func<TArg1, TArg2, TResult> function, IScheduler scheduler)
- {
- if (function == null)
- throw new ArgumentNullException("function");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return s_impl.ToAsync<TArg1, TArg2, TResult>(function, scheduler);
- }
-
- /// <summary>
- /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function.
- /// </summary>
- /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the function.</typeparam>
- /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
- /// <param name="function">Function to convert to an asynchronous function.</param>
- /// <returns>Asynchronous function.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="function"/> is null.</exception>
- public static Func<TArg1, TArg2, TArg3, IObservable<TResult>> ToAsync<TArg1, TArg2, TArg3, TResult>(this Func<TArg1, TArg2, TArg3, TResult> function)
- {
- if (function == null)
- throw new ArgumentNullException("function");
-
- return s_impl.ToAsync<TArg1, TArg2, TArg3, TResult>(function);
- }
-
- /// <summary>
- /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function on the specified scheduler.
- /// </summary>
- /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the function.</typeparam>
- /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
- /// <param name="function">Function to convert to an asynchronous function.</param>
- /// <param name="scheduler">Scheduler to invoke the original function on.</param>
- /// <returns>Asynchronous function.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="function"/> or <paramref name="scheduler"/> is null.</exception>
- public static Func<TArg1, TArg2, TArg3, IObservable<TResult>> ToAsync<TArg1, TArg2, TArg3, TResult>(this Func<TArg1, TArg2, TArg3, TResult> function, IScheduler scheduler)
- {
- if (function == null)
- throw new ArgumentNullException("function");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return s_impl.ToAsync<TArg1, TArg2, TArg3, TResult>(function, scheduler);
- }
-
- /// <summary>
- /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function.
- /// </summary>
- /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the function.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the function.</typeparam>
- /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
- /// <param name="function">Function to convert to an asynchronous function.</param>
- /// <returns>Asynchronous function.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="function"/> is null.</exception>
- public static Func<TArg1, TArg2, TArg3, TArg4, IObservable<TResult>> ToAsync<TArg1, TArg2, TArg3, TArg4, TResult>(this Func<TArg1, TArg2, TArg3, TArg4, TResult> function)
- {
- if (function == null)
- throw new ArgumentNullException("function");
-
- return s_impl.ToAsync<TArg1, TArg2, TArg3, TArg4, TResult>(function);
- }
-
- /// <summary>
- /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function on the specified scheduler.
- /// </summary>
- /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the function.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the function.</typeparam>
- /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
- /// <param name="function">Function to convert to an asynchronous function.</param>
- /// <param name="scheduler">Scheduler to invoke the original function on.</param>
- /// <returns>Asynchronous function.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="function"/> or <paramref name="scheduler"/> is null.</exception>
- public static Func<TArg1, TArg2, TArg3, TArg4, IObservable<TResult>> ToAsync<TArg1, TArg2, TArg3, TArg4, TResult>(this Func<TArg1, TArg2, TArg3, TArg4, TResult> function, IScheduler scheduler)
- {
- if (function == null)
- throw new ArgumentNullException("function");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return s_impl.ToAsync<TArg1, TArg2, TArg3, TArg4, TResult>(function, scheduler);
- }
-
-#if !NO_LARGEARITY
- /// <summary>
- /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function.
- /// </summary>
- /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the function.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the function.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the function.</typeparam>
- /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
- /// <param name="function">Function to convert to an asynchronous function.</param>
- /// <returns>Asynchronous function.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="function"/> is null.</exception>
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, IObservable<TResult>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TResult>(this Func<TArg1, TArg2, TArg3, TArg4, TArg5, TResult> function)
- {
- if (function == null)
- throw new ArgumentNullException("function");
-
- return s_impl.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TResult>(function);
- }
-
- /// <summary>
- /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function on the specified scheduler.
- /// </summary>
- /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the function.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the function.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the function.</typeparam>
- /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
- /// <param name="function">Function to convert to an asynchronous function.</param>
- /// <param name="scheduler">Scheduler to invoke the original function on.</param>
- /// <returns>Asynchronous function.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="function"/> or <paramref name="scheduler"/> is null.</exception>
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, IObservable<TResult>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TResult>(this Func<TArg1, TArg2, TArg3, TArg4, TArg5, TResult> function, IScheduler scheduler)
- {
- if (function == null)
- throw new ArgumentNullException("function");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return s_impl.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TResult>(function, scheduler);
- }
-
- /// <summary>
- /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function.
- /// </summary>
- /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the function.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the function.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the function.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the function.</typeparam>
- /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
- /// <param name="function">Function to convert to an asynchronous function.</param>
- /// <returns>Asynchronous function.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="function"/> is null.</exception>
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, IObservable<TResult>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TResult>(this Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TResult> function)
- {
- if (function == null)
- throw new ArgumentNullException("function");
-
- return s_impl.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TResult>(function);
- }
-
- /// <summary>
- /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function on the specified scheduler.
- /// </summary>
- /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the function.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the function.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the function.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the function.</typeparam>
- /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
- /// <param name="function">Function to convert to an asynchronous function.</param>
- /// <param name="scheduler">Scheduler to invoke the original function on.</param>
- /// <returns>Asynchronous function.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="function"/> or <paramref name="scheduler"/> is null.</exception>
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, IObservable<TResult>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TResult>(this Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TResult> function, IScheduler scheduler)
- {
- if (function == null)
- throw new ArgumentNullException("function");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return s_impl.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TResult>(function, scheduler);
- }
-
- /// <summary>
- /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function.
- /// </summary>
- /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the function.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the function.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the function.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the function.</typeparam>
- /// <typeparam name="TArg7">The type of the seventh argument passed to the function.</typeparam>
- /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
- /// <param name="function">Function to convert to an asynchronous function.</param>
- /// <returns>Asynchronous function.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="function"/> is null.</exception>
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, IObservable<TResult>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TResult>(this Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TResult> function)
- {
- if (function == null)
- throw new ArgumentNullException("function");
-
- return s_impl.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TResult>(function);
- }
-
- /// <summary>
- /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function on the specified scheduler.
- /// </summary>
- /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the function.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the function.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the function.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the function.</typeparam>
- /// <typeparam name="TArg7">The type of the seventh argument passed to the function.</typeparam>
- /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
- /// <param name="function">Function to convert to an asynchronous function.</param>
- /// <param name="scheduler">Scheduler to invoke the original function on.</param>
- /// <returns>Asynchronous function.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="function"/> or <paramref name="scheduler"/> is null.</exception>
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, IObservable<TResult>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TResult>(this Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TResult> function, IScheduler scheduler)
- {
- if (function == null)
- throw new ArgumentNullException("function");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return s_impl.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TResult>(function, scheduler);
- }
-
- /// <summary>
- /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function.
- /// </summary>
- /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the function.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the function.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the function.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the function.</typeparam>
- /// <typeparam name="TArg7">The type of the seventh argument passed to the function.</typeparam>
- /// <typeparam name="TArg8">The type of the eighth argument passed to the function.</typeparam>
- /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
- /// <param name="function">Function to convert to an asynchronous function.</param>
- /// <returns>Asynchronous function.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="function"/> is null.</exception>
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, IObservable<TResult>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TResult>(this Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TResult> function)
- {
- if (function == null)
- throw new ArgumentNullException("function");
-
- return s_impl.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TResult>(function);
- }
-
- /// <summary>
- /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function on the specified scheduler.
- /// </summary>
- /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the function.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the function.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the function.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the function.</typeparam>
- /// <typeparam name="TArg7">The type of the seventh argument passed to the function.</typeparam>
- /// <typeparam name="TArg8">The type of the eighth argument passed to the function.</typeparam>
- /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
- /// <param name="function">Function to convert to an asynchronous function.</param>
- /// <param name="scheduler">Scheduler to invoke the original function on.</param>
- /// <returns>Asynchronous function.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="function"/> or <paramref name="scheduler"/> is null.</exception>
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, IObservable<TResult>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TResult>(this Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TResult> function, IScheduler scheduler)
- {
- if (function == null)
- throw new ArgumentNullException("function");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return s_impl.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TResult>(function, scheduler);
- }
-
- /// <summary>
- /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function.
- /// </summary>
- /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the function.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the function.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the function.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the function.</typeparam>
- /// <typeparam name="TArg7">The type of the seventh argument passed to the function.</typeparam>
- /// <typeparam name="TArg8">The type of the eighth argument passed to the function.</typeparam>
- /// <typeparam name="TArg9">The type of the ninth argument passed to the function.</typeparam>
- /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
- /// <param name="function">Function to convert to an asynchronous function.</param>
- /// <returns>Asynchronous function.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="function"/> is null.</exception>
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, IObservable<TResult>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TResult>(this Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TResult> function)
- {
- if (function == null)
- throw new ArgumentNullException("function");
-
- return s_impl.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TResult>(function);
- }
-
- /// <summary>
- /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function on the specified scheduler.
- /// </summary>
- /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the function.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the function.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the function.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the function.</typeparam>
- /// <typeparam name="TArg7">The type of the seventh argument passed to the function.</typeparam>
- /// <typeparam name="TArg8">The type of the eighth argument passed to the function.</typeparam>
- /// <typeparam name="TArg9">The type of the ninth argument passed to the function.</typeparam>
- /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
- /// <param name="function">Function to convert to an asynchronous function.</param>
- /// <param name="scheduler">Scheduler to invoke the original function on.</param>
- /// <returns>Asynchronous function.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="function"/> or <paramref name="scheduler"/> is null.</exception>
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, IObservable<TResult>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TResult>(this Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TResult> function, IScheduler scheduler)
- {
- if (function == null)
- throw new ArgumentNullException("function");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return s_impl.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TResult>(function, scheduler);
- }
-
- /// <summary>
- /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function.
- /// </summary>
- /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the function.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the function.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the function.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the function.</typeparam>
- /// <typeparam name="TArg7">The type of the seventh argument passed to the function.</typeparam>
- /// <typeparam name="TArg8">The type of the eighth argument passed to the function.</typeparam>
- /// <typeparam name="TArg9">The type of the ninth argument passed to the function.</typeparam>
- /// <typeparam name="TArg10">The type of the tenth argument passed to the function.</typeparam>
- /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
- /// <param name="function">Function to convert to an asynchronous function.</param>
- /// <returns>Asynchronous function.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="function"/> is null.</exception>
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, IObservable<TResult>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TResult>(this Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TResult> function)
- {
- if (function == null)
- throw new ArgumentNullException("function");
-
- return s_impl.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TResult>(function);
- }
-
- /// <summary>
- /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function on the specified scheduler.
- /// </summary>
- /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the function.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the function.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the function.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the function.</typeparam>
- /// <typeparam name="TArg7">The type of the seventh argument passed to the function.</typeparam>
- /// <typeparam name="TArg8">The type of the eighth argument passed to the function.</typeparam>
- /// <typeparam name="TArg9">The type of the ninth argument passed to the function.</typeparam>
- /// <typeparam name="TArg10">The type of the tenth argument passed to the function.</typeparam>
- /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
- /// <param name="function">Function to convert to an asynchronous function.</param>
- /// <param name="scheduler">Scheduler to invoke the original function on.</param>
- /// <returns>Asynchronous function.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="function"/> or <paramref name="scheduler"/> is null.</exception>
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, IObservable<TResult>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TResult>(this Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TResult> function, IScheduler scheduler)
- {
- if (function == null)
- throw new ArgumentNullException("function");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return s_impl.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TResult>(function, scheduler);
- }
-
- /// <summary>
- /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function.
- /// </summary>
- /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the function.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the function.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the function.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the function.</typeparam>
- /// <typeparam name="TArg7">The type of the seventh argument passed to the function.</typeparam>
- /// <typeparam name="TArg8">The type of the eighth argument passed to the function.</typeparam>
- /// <typeparam name="TArg9">The type of the ninth argument passed to the function.</typeparam>
- /// <typeparam name="TArg10">The type of the tenth argument passed to the function.</typeparam>
- /// <typeparam name="TArg11">The type of the eleventh argument passed to the function.</typeparam>
- /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
- /// <param name="function">Function to convert to an asynchronous function.</param>
- /// <returns>Asynchronous function.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="function"/> is null.</exception>
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, IObservable<TResult>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TResult>(this Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TResult> function)
- {
- if (function == null)
- throw new ArgumentNullException("function");
-
- return s_impl.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TResult>(function);
- }
-
- /// <summary>
- /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function on the specified scheduler.
- /// </summary>
- /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the function.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the function.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the function.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the function.</typeparam>
- /// <typeparam name="TArg7">The type of the seventh argument passed to the function.</typeparam>
- /// <typeparam name="TArg8">The type of the eighth argument passed to the function.</typeparam>
- /// <typeparam name="TArg9">The type of the ninth argument passed to the function.</typeparam>
- /// <typeparam name="TArg10">The type of the tenth argument passed to the function.</typeparam>
- /// <typeparam name="TArg11">The type of the eleventh argument passed to the function.</typeparam>
- /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
- /// <param name="function">Function to convert to an asynchronous function.</param>
- /// <param name="scheduler">Scheduler to invoke the original function on.</param>
- /// <returns>Asynchronous function.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="function"/> or <paramref name="scheduler"/> is null.</exception>
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, IObservable<TResult>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TResult>(this Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TResult> function, IScheduler scheduler)
- {
- if (function == null)
- throw new ArgumentNullException("function");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return s_impl.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TResult>(function, scheduler);
- }
-
- /// <summary>
- /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function.
- /// </summary>
- /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the function.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the function.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the function.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the function.</typeparam>
- /// <typeparam name="TArg7">The type of the seventh argument passed to the function.</typeparam>
- /// <typeparam name="TArg8">The type of the eighth argument passed to the function.</typeparam>
- /// <typeparam name="TArg9">The type of the ninth argument passed to the function.</typeparam>
- /// <typeparam name="TArg10">The type of the tenth argument passed to the function.</typeparam>
- /// <typeparam name="TArg11">The type of the eleventh argument passed to the function.</typeparam>
- /// <typeparam name="TArg12">The type of the twelfth argument passed to the function.</typeparam>
- /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
- /// <param name="function">Function to convert to an asynchronous function.</param>
- /// <returns>Asynchronous function.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="function"/> is null.</exception>
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, IObservable<TResult>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TResult>(this Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TResult> function)
- {
- if (function == null)
- throw new ArgumentNullException("function");
-
- return s_impl.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TResult>(function);
- }
-
- /// <summary>
- /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function on the specified scheduler.
- /// </summary>
- /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the function.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the function.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the function.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the function.</typeparam>
- /// <typeparam name="TArg7">The type of the seventh argument passed to the function.</typeparam>
- /// <typeparam name="TArg8">The type of the eighth argument passed to the function.</typeparam>
- /// <typeparam name="TArg9">The type of the ninth argument passed to the function.</typeparam>
- /// <typeparam name="TArg10">The type of the tenth argument passed to the function.</typeparam>
- /// <typeparam name="TArg11">The type of the eleventh argument passed to the function.</typeparam>
- /// <typeparam name="TArg12">The type of the twelfth argument passed to the function.</typeparam>
- /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
- /// <param name="function">Function to convert to an asynchronous function.</param>
- /// <param name="scheduler">Scheduler to invoke the original function on.</param>
- /// <returns>Asynchronous function.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="function"/> or <paramref name="scheduler"/> is null.</exception>
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, IObservable<TResult>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TResult>(this Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TResult> function, IScheduler scheduler)
- {
- if (function == null)
- throw new ArgumentNullException("function");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return s_impl.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TResult>(function, scheduler);
- }
-
- /// <summary>
- /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function.
- /// </summary>
- /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the function.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the function.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the function.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the function.</typeparam>
- /// <typeparam name="TArg7">The type of the seventh argument passed to the function.</typeparam>
- /// <typeparam name="TArg8">The type of the eighth argument passed to the function.</typeparam>
- /// <typeparam name="TArg9">The type of the ninth argument passed to the function.</typeparam>
- /// <typeparam name="TArg10">The type of the tenth argument passed to the function.</typeparam>
- /// <typeparam name="TArg11">The type of the eleventh argument passed to the function.</typeparam>
- /// <typeparam name="TArg12">The type of the twelfth argument passed to the function.</typeparam>
- /// <typeparam name="TArg13">The type of the thirteenth argument passed to the function.</typeparam>
- /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
- /// <param name="function">Function to convert to an asynchronous function.</param>
- /// <returns>Asynchronous function.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="function"/> is null.</exception>
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, IObservable<TResult>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TResult>(this Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TResult> function)
- {
- if (function == null)
- throw new ArgumentNullException("function");
-
- return s_impl.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TResult>(function);
- }
-
- /// <summary>
- /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function on the specified scheduler.
- /// </summary>
- /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the function.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the function.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the function.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the function.</typeparam>
- /// <typeparam name="TArg7">The type of the seventh argument passed to the function.</typeparam>
- /// <typeparam name="TArg8">The type of the eighth argument passed to the function.</typeparam>
- /// <typeparam name="TArg9">The type of the ninth argument passed to the function.</typeparam>
- /// <typeparam name="TArg10">The type of the tenth argument passed to the function.</typeparam>
- /// <typeparam name="TArg11">The type of the eleventh argument passed to the function.</typeparam>
- /// <typeparam name="TArg12">The type of the twelfth argument passed to the function.</typeparam>
- /// <typeparam name="TArg13">The type of the thirteenth argument passed to the function.</typeparam>
- /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
- /// <param name="function">Function to convert to an asynchronous function.</param>
- /// <param name="scheduler">Scheduler to invoke the original function on.</param>
- /// <returns>Asynchronous function.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="function"/> or <paramref name="scheduler"/> is null.</exception>
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, IObservable<TResult>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TResult>(this Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TResult> function, IScheduler scheduler)
- {
- if (function == null)
- throw new ArgumentNullException("function");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return s_impl.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TResult>(function, scheduler);
- }
-
- /// <summary>
- /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function.
- /// </summary>
- /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the function.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the function.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the function.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the function.</typeparam>
- /// <typeparam name="TArg7">The type of the seventh argument passed to the function.</typeparam>
- /// <typeparam name="TArg8">The type of the eighth argument passed to the function.</typeparam>
- /// <typeparam name="TArg9">The type of the ninth argument passed to the function.</typeparam>
- /// <typeparam name="TArg10">The type of the tenth argument passed to the function.</typeparam>
- /// <typeparam name="TArg11">The type of the eleventh argument passed to the function.</typeparam>
- /// <typeparam name="TArg12">The type of the twelfth argument passed to the function.</typeparam>
- /// <typeparam name="TArg13">The type of the thirteenth argument passed to the function.</typeparam>
- /// <typeparam name="TArg14">The type of the fourteenth argument passed to the function.</typeparam>
- /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
- /// <param name="function">Function to convert to an asynchronous function.</param>
- /// <returns>Asynchronous function.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="function"/> is null.</exception>
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, IObservable<TResult>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TResult>(this Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TResult> function)
- {
- if (function == null)
- throw new ArgumentNullException("function");
-
- return s_impl.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TResult>(function);
- }
-
- /// <summary>
- /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function on the specified scheduler.
- /// </summary>
- /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the function.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the function.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the function.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the function.</typeparam>
- /// <typeparam name="TArg7">The type of the seventh argument passed to the function.</typeparam>
- /// <typeparam name="TArg8">The type of the eighth argument passed to the function.</typeparam>
- /// <typeparam name="TArg9">The type of the ninth argument passed to the function.</typeparam>
- /// <typeparam name="TArg10">The type of the tenth argument passed to the function.</typeparam>
- /// <typeparam name="TArg11">The type of the eleventh argument passed to the function.</typeparam>
- /// <typeparam name="TArg12">The type of the twelfth argument passed to the function.</typeparam>
- /// <typeparam name="TArg13">The type of the thirteenth argument passed to the function.</typeparam>
- /// <typeparam name="TArg14">The type of the fourteenth argument passed to the function.</typeparam>
- /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
- /// <param name="function">Function to convert to an asynchronous function.</param>
- /// <param name="scheduler">Scheduler to invoke the original function on.</param>
- /// <returns>Asynchronous function.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="function"/> or <paramref name="scheduler"/> is null.</exception>
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, IObservable<TResult>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TResult>(this Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TResult> function, IScheduler scheduler)
- {
- if (function == null)
- throw new ArgumentNullException("function");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return s_impl.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TResult>(function, scheduler);
- }
-
- /// <summary>
- /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function.
- /// </summary>
- /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the function.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the function.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the function.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the function.</typeparam>
- /// <typeparam name="TArg7">The type of the seventh argument passed to the function.</typeparam>
- /// <typeparam name="TArg8">The type of the eighth argument passed to the function.</typeparam>
- /// <typeparam name="TArg9">The type of the ninth argument passed to the function.</typeparam>
- /// <typeparam name="TArg10">The type of the tenth argument passed to the function.</typeparam>
- /// <typeparam name="TArg11">The type of the eleventh argument passed to the function.</typeparam>
- /// <typeparam name="TArg12">The type of the twelfth argument passed to the function.</typeparam>
- /// <typeparam name="TArg13">The type of the thirteenth argument passed to the function.</typeparam>
- /// <typeparam name="TArg14">The type of the fourteenth argument passed to the function.</typeparam>
- /// <typeparam name="TArg15">The type of the fifteenth argument passed to the function.</typeparam>
- /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
- /// <param name="function">Function to convert to an asynchronous function.</param>
- /// <returns>Asynchronous function.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="function"/> is null.</exception>
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, IObservable<TResult>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, TResult>(this Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, TResult> function)
- {
- if (function == null)
- throw new ArgumentNullException("function");
-
- return s_impl.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, TResult>(function);
- }
-
- /// <summary>
- /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function on the specified scheduler.
- /// </summary>
- /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the function.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the function.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the function.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the function.</typeparam>
- /// <typeparam name="TArg7">The type of the seventh argument passed to the function.</typeparam>
- /// <typeparam name="TArg8">The type of the eighth argument passed to the function.</typeparam>
- /// <typeparam name="TArg9">The type of the ninth argument passed to the function.</typeparam>
- /// <typeparam name="TArg10">The type of the tenth argument passed to the function.</typeparam>
- /// <typeparam name="TArg11">The type of the eleventh argument passed to the function.</typeparam>
- /// <typeparam name="TArg12">The type of the twelfth argument passed to the function.</typeparam>
- /// <typeparam name="TArg13">The type of the thirteenth argument passed to the function.</typeparam>
- /// <typeparam name="TArg14">The type of the fourteenth argument passed to the function.</typeparam>
- /// <typeparam name="TArg15">The type of the fifteenth argument passed to the function.</typeparam>
- /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
- /// <param name="function">Function to convert to an asynchronous function.</param>
- /// <param name="scheduler">Scheduler to invoke the original function on.</param>
- /// <returns>Asynchronous function.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="function"/> or <paramref name="scheduler"/> is null.</exception>
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, IObservable<TResult>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, TResult>(this Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, TResult> function, IScheduler scheduler)
- {
- if (function == null)
- throw new ArgumentNullException("function");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return s_impl.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, TResult>(function, scheduler);
- }
-
- /// <summary>
- /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function.
- /// </summary>
- /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the function.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the function.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the function.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the function.</typeparam>
- /// <typeparam name="TArg7">The type of the seventh argument passed to the function.</typeparam>
- /// <typeparam name="TArg8">The type of the eighth argument passed to the function.</typeparam>
- /// <typeparam name="TArg9">The type of the ninth argument passed to the function.</typeparam>
- /// <typeparam name="TArg10">The type of the tenth argument passed to the function.</typeparam>
- /// <typeparam name="TArg11">The type of the eleventh argument passed to the function.</typeparam>
- /// <typeparam name="TArg12">The type of the twelfth argument passed to the function.</typeparam>
- /// <typeparam name="TArg13">The type of the thirteenth argument passed to the function.</typeparam>
- /// <typeparam name="TArg14">The type of the fourteenth argument passed to the function.</typeparam>
- /// <typeparam name="TArg15">The type of the fifteenth argument passed to the function.</typeparam>
- /// <typeparam name="TArg16">The type of the sixteenth argument passed to the function.</typeparam>
- /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
- /// <param name="function">Function to convert to an asynchronous function.</param>
- /// <returns>Asynchronous function.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="function"/> is null.</exception>
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, TArg16, IObservable<TResult>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, TArg16, TResult>(this Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, TArg16, TResult> function)
- {
- if (function == null)
- throw new ArgumentNullException("function");
-
- return s_impl.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, TArg16, TResult>(function);
- }
-
- /// <summary>
- /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function on the specified scheduler.
- /// </summary>
- /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the function.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the function.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the function.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the function.</typeparam>
- /// <typeparam name="TArg7">The type of the seventh argument passed to the function.</typeparam>
- /// <typeparam name="TArg8">The type of the eighth argument passed to the function.</typeparam>
- /// <typeparam name="TArg9">The type of the ninth argument passed to the function.</typeparam>
- /// <typeparam name="TArg10">The type of the tenth argument passed to the function.</typeparam>
- /// <typeparam name="TArg11">The type of the eleventh argument passed to the function.</typeparam>
- /// <typeparam name="TArg12">The type of the twelfth argument passed to the function.</typeparam>
- /// <typeparam name="TArg13">The type of the thirteenth argument passed to the function.</typeparam>
- /// <typeparam name="TArg14">The type of the fourteenth argument passed to the function.</typeparam>
- /// <typeparam name="TArg15">The type of the fifteenth argument passed to the function.</typeparam>
- /// <typeparam name="TArg16">The type of the sixteenth argument passed to the function.</typeparam>
- /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
- /// <param name="function">Function to convert to an asynchronous function.</param>
- /// <param name="scheduler">Scheduler to invoke the original function on.</param>
- /// <returns>Asynchronous function.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="function"/> or <paramref name="scheduler"/> is null.</exception>
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, TArg16, IObservable<TResult>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, TArg16, TResult>(this Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, TArg16, TResult> function, IScheduler scheduler)
- {
- if (function == null)
- throw new ArgumentNullException("function");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return s_impl.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, TArg16, TResult>(function, scheduler);
- }
-#endif
-
- #endregion
-
- #region Action
-
- /// <summary>
- /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the specified scheduler.
- /// </summary>
- /// <param name="action">Action to convert to an asynchronous action.</param>
- /// <returns>Asynchronous action.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="action"/> is null.</exception>
- public static Func<IObservable<Unit>> ToAsync(this Action action)
- {
- if (action == null)
- throw new ArgumentNullException("action");
-
- return s_impl.ToAsync(action);
- }
-
- /// <summary>
- /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the specified scheduler.
- /// </summary>
- /// <param name="action">Action to convert to an asynchronous action.</param>
- /// <param name="scheduler">Scheduler to invoke the original action on.</param>
- /// <returns>Asynchronous action.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="action"/> or <paramref name="scheduler"/> is null.</exception>
- public static Func<IObservable<Unit>> ToAsync(this Action action, IScheduler scheduler)
- {
- if (action == null)
- throw new ArgumentNullException("action");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return s_impl.ToAsync(action, scheduler);
- }
-
- /// <summary>
- /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the default scheduler.
- /// </summary>
- /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
- /// <param name="action">Action to convert to an asynchronous action.</param>
- /// <returns>Asynchronous action.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="action"/> is null.</exception>
- public static Func<TArg1, IObservable<Unit>> ToAsync<TArg1>(this Action<TArg1> action)
- {
- if (action == null)
- throw new ArgumentNullException("action");
-
- return s_impl.ToAsync<TArg1>(action);
- }
-
- /// <summary>
- /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the specified scheduler.
- /// </summary>
- /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
- /// <param name="action">Action to convert to an asynchronous action.</param>
- /// <param name="scheduler">Scheduler to invoke the original action on.</param>
- /// <returns>Asynchronous action.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="action"/> or <paramref name="scheduler"/> is null.</exception>
- public static Func<TArg1, IObservable<Unit>> ToAsync<TArg1>(this Action<TArg1> action, IScheduler scheduler)
- {
- if (action == null)
- throw new ArgumentNullException("action");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return s_impl.ToAsync<TArg1>(action, scheduler);
- }
-
- /// <summary>
- /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the default scheduler.
- /// </summary>
- /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
- /// <param name="action">Action to convert to an asynchronous action.</param>
- /// <returns>Asynchronous action.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="action"/> is null.</exception>
- public static Func<TArg1, TArg2, IObservable<Unit>> ToAsync<TArg1, TArg2>(this Action<TArg1, TArg2> action)
- {
- if (action == null)
- throw new ArgumentNullException("action");
-
- return s_impl.ToAsync<TArg1, TArg2>(action);
- }
-
- /// <summary>
- /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the specified scheduler.
- /// </summary>
- /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
- /// <param name="action">Action to convert to an asynchronous action.</param>
- /// <param name="scheduler">Scheduler to invoke the original action on.</param>
- /// <returns>Asynchronous action.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="action"/> or <paramref name="scheduler"/> is null.</exception>
- public static Func<TArg1, TArg2, IObservable<Unit>> ToAsync<TArg1, TArg2>(this Action<TArg1, TArg2> action, IScheduler scheduler)
- {
- if (action == null)
- throw new ArgumentNullException("action");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return s_impl.ToAsync<TArg1, TArg2>(action, scheduler);
- }
-
- /// <summary>
- /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the default scheduler.
- /// </summary>
- /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the action.</typeparam>
- /// <param name="action">Action to convert to an asynchronous action.</param>
- /// <returns>Asynchronous action.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="action"/> is null.</exception>
- public static Func<TArg1, TArg2, TArg3, IObservable<Unit>> ToAsync<TArg1, TArg2, TArg3>(this Action<TArg1, TArg2, TArg3> action)
- {
- if (action == null)
- throw new ArgumentNullException("action");
-
- return s_impl.ToAsync<TArg1, TArg2, TArg3>(action);
- }
-
- /// <summary>
- /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the specified scheduler.
- /// </summary>
- /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the action.</typeparam>
- /// <param name="action">Action to convert to an asynchronous action.</param>
- /// <param name="scheduler">Scheduler to invoke the original action on.</param>
- /// <returns>Asynchronous action.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="action"/> or <paramref name="scheduler"/> is null.</exception>
- public static Func<TArg1, TArg2, TArg3, IObservable<Unit>> ToAsync<TArg1, TArg2, TArg3>(this Action<TArg1, TArg2, TArg3> action, IScheduler scheduler)
- {
- if (action == null)
- throw new ArgumentNullException("action");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return s_impl.ToAsync<TArg1, TArg2, TArg3>(action, scheduler);
- }
-
- /// <summary>
- /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the default scheduler.
- /// </summary>
- /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the action.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the action.</typeparam>
- /// <param name="action">Action to convert to an asynchronous action.</param>
- /// <returns>Asynchronous action.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="action"/> is null.</exception>
- public static Func<TArg1, TArg2, TArg3, TArg4, IObservable<Unit>> ToAsync<TArg1, TArg2, TArg3, TArg4>(this Action<TArg1, TArg2, TArg3, TArg4> action)
- {
- if (action == null)
- throw new ArgumentNullException("action");
-
- return s_impl.ToAsync<TArg1, TArg2, TArg3, TArg4>(action);
- }
-
- /// <summary>
- /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the specified scheduler.
- /// </summary>
- /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the action.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the action.</typeparam>
- /// <param name="action">Action to convert to an asynchronous action.</param>
- /// <param name="scheduler">Scheduler to invoke the original action on.</param>
- /// <returns>Asynchronous action.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="action"/> or <paramref name="scheduler"/> is null.</exception>
- public static Func<TArg1, TArg2, TArg3, TArg4, IObservable<Unit>> ToAsync<TArg1, TArg2, TArg3, TArg4>(this Action<TArg1, TArg2, TArg3, TArg4> action, IScheduler scheduler)
- {
- if (action == null)
- throw new ArgumentNullException("action");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return s_impl.ToAsync<TArg1, TArg2, TArg3, TArg4>(action, scheduler);
- }
-
-#if !NO_LARGEARITY
-
- /// <summary>
- /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the default scheduler.
- /// </summary>
- /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the action.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the action.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the action.</typeparam>
- /// <param name="action">Action to convert to an asynchronous action.</param>
- /// <returns>Asynchronous action.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="action"/> is null.</exception>
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, IObservable<Unit>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5>(this Action<TArg1, TArg2, TArg3, TArg4, TArg5> action)
- {
- if (action == null)
- throw new ArgumentNullException("action");
-
- return s_impl.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5>(action);
- }
-
- /// <summary>
- /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the specified scheduler.
- /// </summary>
- /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the action.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the action.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the action.</typeparam>
- /// <param name="action">Action to convert to an asynchronous action.</param>
- /// <param name="scheduler">Scheduler to invoke the original action on.</param>
- /// <returns>Asynchronous action.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="action"/> or <paramref name="scheduler"/> is null.</exception>
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, IObservable<Unit>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5>(this Action<TArg1, TArg2, TArg3, TArg4, TArg5> action, IScheduler scheduler)
- {
- if (action == null)
- throw new ArgumentNullException("action");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return s_impl.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5>(action, scheduler);
- }
-
- /// <summary>
- /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the default scheduler.
- /// </summary>
- /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the action.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the action.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the action.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the action.</typeparam>
- /// <param name="action">Action to convert to an asynchronous action.</param>
- /// <returns>Asynchronous action.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="action"/> is null.</exception>
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, IObservable<Unit>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6>(this Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6> action)
- {
- if (action == null)
- throw new ArgumentNullException("action");
-
- return s_impl.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6>(action);
- }
-
- /// <summary>
- /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the specified scheduler.
- /// </summary>
- /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the action.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the action.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the action.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the action.</typeparam>
- /// <param name="action">Action to convert to an asynchronous action.</param>
- /// <param name="scheduler">Scheduler to invoke the original action on.</param>
- /// <returns>Asynchronous action.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="action"/> or <paramref name="scheduler"/> is null.</exception>
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, IObservable<Unit>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6>(this Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6> action, IScheduler scheduler)
- {
- if (action == null)
- throw new ArgumentNullException("action");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return s_impl.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6>(action, scheduler);
- }
-
- /// <summary>
- /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the default scheduler.
- /// </summary>
- /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the action.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the action.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the action.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the action.</typeparam>
- /// <typeparam name="TArg7">The type of the seventh argument passed to the action.</typeparam>
- /// <param name="action">Action to convert to an asynchronous action.</param>
- /// <returns>Asynchronous action.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="action"/> is null.</exception>
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, IObservable<Unit>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7>(this Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7> action)
- {
- if (action == null)
- throw new ArgumentNullException("action");
-
- return s_impl.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7>(action);
- }
-
- /// <summary>
- /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the specified scheduler.
- /// </summary>
- /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the action.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the action.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the action.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the action.</typeparam>
- /// <typeparam name="TArg7">The type of the seventh argument passed to the action.</typeparam>
- /// <param name="action">Action to convert to an asynchronous action.</param>
- /// <param name="scheduler">Scheduler to invoke the original action on.</param>
- /// <returns>Asynchronous action.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="action"/> or <paramref name="scheduler"/> is null.</exception>
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, IObservable<Unit>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7>(this Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7> action, IScheduler scheduler)
- {
- if (action == null)
- throw new ArgumentNullException("action");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return s_impl.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7>(action, scheduler);
- }
-
- /// <summary>
- /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the default scheduler.
- /// </summary>
- /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the action.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the action.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the action.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the action.</typeparam>
- /// <typeparam name="TArg7">The type of the seventh argument passed to the action.</typeparam>
- /// <typeparam name="TArg8">The type of the eighth argument passed to the action.</typeparam>
- /// <param name="action">Action to convert to an asynchronous action.</param>
- /// <returns>Asynchronous action.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="action"/> is null.</exception>
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, IObservable<Unit>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8>(this Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8> action)
- {
- if (action == null)
- throw new ArgumentNullException("action");
-
- return s_impl.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8>(action);
- }
-
- /// <summary>
- /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the specified scheduler.
- /// </summary>
- /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the action.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the action.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the action.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the action.</typeparam>
- /// <typeparam name="TArg7">The type of the seventh argument passed to the action.</typeparam>
- /// <typeparam name="TArg8">The type of the eighth argument passed to the action.</typeparam>
- /// <param name="action">Action to convert to an asynchronous action.</param>
- /// <param name="scheduler">Scheduler to invoke the original action on.</param>
- /// <returns>Asynchronous action.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="action"/> or <paramref name="scheduler"/> is null.</exception>
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, IObservable<Unit>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8>(this Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8> action, IScheduler scheduler)
- {
- if (action == null)
- throw new ArgumentNullException("action");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return s_impl.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8>(action, scheduler);
- }
-
- /// <summary>
- /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the default scheduler.
- /// </summary>
- /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the action.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the action.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the action.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the action.</typeparam>
- /// <typeparam name="TArg7">The type of the seventh argument passed to the action.</typeparam>
- /// <typeparam name="TArg8">The type of the eighth argument passed to the action.</typeparam>
- /// <typeparam name="TArg9">The type of the ninth argument passed to the action.</typeparam>
- /// <param name="action">Action to convert to an asynchronous action.</param>
- /// <returns>Asynchronous action.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="action"/> is null.</exception>
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, IObservable<Unit>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9>(this Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9> action)
- {
- if (action == null)
- throw new ArgumentNullException("action");
-
- return s_impl.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9>(action);
- }
-
- /// <summary>
- /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the specified scheduler.
- /// </summary>
- /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the action.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the action.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the action.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the action.</typeparam>
- /// <typeparam name="TArg7">The type of the seventh argument passed to the action.</typeparam>
- /// <typeparam name="TArg8">The type of the eighth argument passed to the action.</typeparam>
- /// <typeparam name="TArg9">The type of the ninth argument passed to the action.</typeparam>
- /// <param name="action">Action to convert to an asynchronous action.</param>
- /// <param name="scheduler">Scheduler to invoke the original action on.</param>
- /// <returns>Asynchronous action.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="action"/> or <paramref name="scheduler"/> is null.</exception>
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, IObservable<Unit>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9>(this Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9> action, IScheduler scheduler)
- {
- if (action == null)
- throw new ArgumentNullException("action");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return s_impl.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9>(action, scheduler);
- }
-
- /// <summary>
- /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the default scheduler.
- /// </summary>
- /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the action.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the action.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the action.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the action.</typeparam>
- /// <typeparam name="TArg7">The type of the seventh argument passed to the action.</typeparam>
- /// <typeparam name="TArg8">The type of the eighth argument passed to the action.</typeparam>
- /// <typeparam name="TArg9">The type of the ninth argument passed to the action.</typeparam>
- /// <typeparam name="TArg10">The type of the tenth argument passed to the action.</typeparam>
- /// <param name="action">Action to convert to an asynchronous action.</param>
- /// <returns>Asynchronous action.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="action"/> is null.</exception>
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, IObservable<Unit>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10>(this Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10> action)
- {
- if (action == null)
- throw new ArgumentNullException("action");
-
- return s_impl.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10>(action);
- }
-
- /// <summary>
- /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the specified scheduler.
- /// </summary>
- /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the action.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the action.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the action.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the action.</typeparam>
- /// <typeparam name="TArg7">The type of the seventh argument passed to the action.</typeparam>
- /// <typeparam name="TArg8">The type of the eighth argument passed to the action.</typeparam>
- /// <typeparam name="TArg9">The type of the ninth argument passed to the action.</typeparam>
- /// <typeparam name="TArg10">The type of the tenth argument passed to the action.</typeparam>
- /// <param name="action">Action to convert to an asynchronous action.</param>
- /// <param name="scheduler">Scheduler to invoke the original action on.</param>
- /// <returns>Asynchronous action.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="action"/> or <paramref name="scheduler"/> is null.</exception>
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, IObservable<Unit>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10>(this Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10> action, IScheduler scheduler)
- {
- if (action == null)
- throw new ArgumentNullException("action");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return s_impl.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10>(action, scheduler);
- }
-
- /// <summary>
- /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the default scheduler.
- /// </summary>
- /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the action.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the action.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the action.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the action.</typeparam>
- /// <typeparam name="TArg7">The type of the seventh argument passed to the action.</typeparam>
- /// <typeparam name="TArg8">The type of the eighth argument passed to the action.</typeparam>
- /// <typeparam name="TArg9">The type of the ninth argument passed to the action.</typeparam>
- /// <typeparam name="TArg10">The type of the tenth argument passed to the action.</typeparam>
- /// <typeparam name="TArg11">The type of the eleventh argument passed to the action.</typeparam>
- /// <param name="action">Action to convert to an asynchronous action.</param>
- /// <returns>Asynchronous action.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="action"/> is null.</exception>
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, IObservable<Unit>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11>(this Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11> action)
- {
- if (action == null)
- throw new ArgumentNullException("action");
-
- return s_impl.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11>(action);
- }
-
- /// <summary>
- /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the specified scheduler.
- /// </summary>
- /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the action.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the action.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the action.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the action.</typeparam>
- /// <typeparam name="TArg7">The type of the seventh argument passed to the action.</typeparam>
- /// <typeparam name="TArg8">The type of the eighth argument passed to the action.</typeparam>
- /// <typeparam name="TArg9">The type of the ninth argument passed to the action.</typeparam>
- /// <typeparam name="TArg10">The type of the tenth argument passed to the action.</typeparam>
- /// <typeparam name="TArg11">The type of the eleventh argument passed to the action.</typeparam>
- /// <param name="action">Action to convert to an asynchronous action.</param>
- /// <param name="scheduler">Scheduler to invoke the original action on.</param>
- /// <returns>Asynchronous action.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="action"/> or <paramref name="scheduler"/> is null.</exception>
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, IObservable<Unit>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11>(this Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11> action, IScheduler scheduler)
- {
- if (action == null)
- throw new ArgumentNullException("action");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return s_impl.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11>(action, scheduler);
- }
-
- /// <summary>
- /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the default scheduler.
- /// </summary>
- /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the action.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the action.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the action.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the action.</typeparam>
- /// <typeparam name="TArg7">The type of the seventh argument passed to the action.</typeparam>
- /// <typeparam name="TArg8">The type of the eighth argument passed to the action.</typeparam>
- /// <typeparam name="TArg9">The type of the ninth argument passed to the action.</typeparam>
- /// <typeparam name="TArg10">The type of the tenth argument passed to the action.</typeparam>
- /// <typeparam name="TArg11">The type of the eleventh argument passed to the action.</typeparam>
- /// <typeparam name="TArg12">The type of the twelfth argument passed to the action.</typeparam>
- /// <param name="action">Action to convert to an asynchronous action.</param>
- /// <returns>Asynchronous action.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="action"/> is null.</exception>
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, IObservable<Unit>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12>(this Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12> action)
- {
- if (action == null)
- throw new ArgumentNullException("action");
-
- return s_impl.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12>(action);
- }
-
- /// <summary>
- /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the specified scheduler.
- /// </summary>
- /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the action.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the action.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the action.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the action.</typeparam>
- /// <typeparam name="TArg7">The type of the seventh argument passed to the action.</typeparam>
- /// <typeparam name="TArg8">The type of the eighth argument passed to the action.</typeparam>
- /// <typeparam name="TArg9">The type of the ninth argument passed to the action.</typeparam>
- /// <typeparam name="TArg10">The type of the tenth argument passed to the action.</typeparam>
- /// <typeparam name="TArg11">The type of the eleventh argument passed to the action.</typeparam>
- /// <typeparam name="TArg12">The type of the twelfth argument passed to the action.</typeparam>
- /// <param name="action">Action to convert to an asynchronous action.</param>
- /// <param name="scheduler">Scheduler to invoke the original action on.</param>
- /// <returns>Asynchronous action.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="action"/> or <paramref name="scheduler"/> is null.</exception>
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, IObservable<Unit>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12>(this Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12> action, IScheduler scheduler)
- {
- if (action == null)
- throw new ArgumentNullException("action");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return s_impl.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12>(action, scheduler);
- }
-
- /// <summary>
- /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the default scheduler.
- /// </summary>
- /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the action.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the action.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the action.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the action.</typeparam>
- /// <typeparam name="TArg7">The type of the seventh argument passed to the action.</typeparam>
- /// <typeparam name="TArg8">The type of the eighth argument passed to the action.</typeparam>
- /// <typeparam name="TArg9">The type of the ninth argument passed to the action.</typeparam>
- /// <typeparam name="TArg10">The type of the tenth argument passed to the action.</typeparam>
- /// <typeparam name="TArg11">The type of the eleventh argument passed to the action.</typeparam>
- /// <typeparam name="TArg12">The type of the twelfth argument passed to the action.</typeparam>
- /// <typeparam name="TArg13">The type of the thirteenth argument passed to the action.</typeparam>
- /// <param name="action">Action to convert to an asynchronous action.</param>
- /// <returns>Asynchronous action.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="action"/> is null.</exception>
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, IObservable<Unit>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13>(this Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13> action)
- {
- if (action == null)
- throw new ArgumentNullException("action");
-
- return s_impl.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13>(action);
- }
-
- /// <summary>
- /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the specified scheduler.
- /// </summary>
- /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the action.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the action.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the action.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the action.</typeparam>
- /// <typeparam name="TArg7">The type of the seventh argument passed to the action.</typeparam>
- /// <typeparam name="TArg8">The type of the eighth argument passed to the action.</typeparam>
- /// <typeparam name="TArg9">The type of the ninth argument passed to the action.</typeparam>
- /// <typeparam name="TArg10">The type of the tenth argument passed to the action.</typeparam>
- /// <typeparam name="TArg11">The type of the eleventh argument passed to the action.</typeparam>
- /// <typeparam name="TArg12">The type of the twelfth argument passed to the action.</typeparam>
- /// <typeparam name="TArg13">The type of the thirteenth argument passed to the action.</typeparam>
- /// <param name="action">Action to convert to an asynchronous action.</param>
- /// <param name="scheduler">Scheduler to invoke the original action on.</param>
- /// <returns>Asynchronous action.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="action"/> or <paramref name="scheduler"/> is null.</exception>
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, IObservable<Unit>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13>(this Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13> action, IScheduler scheduler)
- {
- if (action == null)
- throw new ArgumentNullException("action");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return s_impl.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13>(action, scheduler);
- }
-
- /// <summary>
- /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the default scheduler.
- /// </summary>
- /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the action.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the action.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the action.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the action.</typeparam>
- /// <typeparam name="TArg7">The type of the seventh argument passed to the action.</typeparam>
- /// <typeparam name="TArg8">The type of the eighth argument passed to the action.</typeparam>
- /// <typeparam name="TArg9">The type of the ninth argument passed to the action.</typeparam>
- /// <typeparam name="TArg10">The type of the tenth argument passed to the action.</typeparam>
- /// <typeparam name="TArg11">The type of the eleventh argument passed to the action.</typeparam>
- /// <typeparam name="TArg12">The type of the twelfth argument passed to the action.</typeparam>
- /// <typeparam name="TArg13">The type of the thirteenth argument passed to the action.</typeparam>
- /// <typeparam name="TArg14">The type of the fourteenth argument passed to the action.</typeparam>
- /// <param name="action">Action to convert to an asynchronous action.</param>
- /// <returns>Asynchronous action.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="action"/> is null.</exception>
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, IObservable<Unit>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14>(this Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14> action)
- {
- if (action == null)
- throw new ArgumentNullException("action");
-
- return s_impl.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14>(action);
- }
-
- /// <summary>
- /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the specified scheduler.
- /// </summary>
- /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the action.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the action.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the action.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the action.</typeparam>
- /// <typeparam name="TArg7">The type of the seventh argument passed to the action.</typeparam>
- /// <typeparam name="TArg8">The type of the eighth argument passed to the action.</typeparam>
- /// <typeparam name="TArg9">The type of the ninth argument passed to the action.</typeparam>
- /// <typeparam name="TArg10">The type of the tenth argument passed to the action.</typeparam>
- /// <typeparam name="TArg11">The type of the eleventh argument passed to the action.</typeparam>
- /// <typeparam name="TArg12">The type of the twelfth argument passed to the action.</typeparam>
- /// <typeparam name="TArg13">The type of the thirteenth argument passed to the action.</typeparam>
- /// <typeparam name="TArg14">The type of the fourteenth argument passed to the action.</typeparam>
- /// <param name="action">Action to convert to an asynchronous action.</param>
- /// <param name="scheduler">Scheduler to invoke the original action on.</param>
- /// <returns>Asynchronous action.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="action"/> or <paramref name="scheduler"/> is null.</exception>
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, IObservable<Unit>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14>(this Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14> action, IScheduler scheduler)
- {
- if (action == null)
- throw new ArgumentNullException("action");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return s_impl.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14>(action, scheduler);
- }
-
- /// <summary>
- /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the default scheduler.
- /// </summary>
- /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the action.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the action.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the action.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the action.</typeparam>
- /// <typeparam name="TArg7">The type of the seventh argument passed to the action.</typeparam>
- /// <typeparam name="TArg8">The type of the eighth argument passed to the action.</typeparam>
- /// <typeparam name="TArg9">The type of the ninth argument passed to the action.</typeparam>
- /// <typeparam name="TArg10">The type of the tenth argument passed to the action.</typeparam>
- /// <typeparam name="TArg11">The type of the eleventh argument passed to the action.</typeparam>
- /// <typeparam name="TArg12">The type of the twelfth argument passed to the action.</typeparam>
- /// <typeparam name="TArg13">The type of the thirteenth argument passed to the action.</typeparam>
- /// <typeparam name="TArg14">The type of the fourteenth argument passed to the action.</typeparam>
- /// <typeparam name="TArg15">The type of the fifteenth argument passed to the action.</typeparam>
- /// <param name="action">Action to convert to an asynchronous action.</param>
- /// <returns>Asynchronous action.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="action"/> is null.</exception>
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, IObservable<Unit>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15>(this Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15> action)
- {
- if (action == null)
- throw new ArgumentNullException("action");
-
- return s_impl.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15>(action);
- }
-
- /// <summary>
- /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the specified scheduler.
- /// </summary>
- /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the action.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the action.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the action.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the action.</typeparam>
- /// <typeparam name="TArg7">The type of the seventh argument passed to the action.</typeparam>
- /// <typeparam name="TArg8">The type of the eighth argument passed to the action.</typeparam>
- /// <typeparam name="TArg9">The type of the ninth argument passed to the action.</typeparam>
- /// <typeparam name="TArg10">The type of the tenth argument passed to the action.</typeparam>
- /// <typeparam name="TArg11">The type of the eleventh argument passed to the action.</typeparam>
- /// <typeparam name="TArg12">The type of the twelfth argument passed to the action.</typeparam>
- /// <typeparam name="TArg13">The type of the thirteenth argument passed to the action.</typeparam>
- /// <typeparam name="TArg14">The type of the fourteenth argument passed to the action.</typeparam>
- /// <typeparam name="TArg15">The type of the fifteenth argument passed to the action.</typeparam>
- /// <param name="action">Action to convert to an asynchronous action.</param>
- /// <param name="scheduler">Scheduler to invoke the original action on.</param>
- /// <returns>Asynchronous action.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="action"/> or <paramref name="scheduler"/> is null.</exception>
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, IObservable<Unit>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15>(this Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15> action, IScheduler scheduler)
- {
- if (action == null)
- throw new ArgumentNullException("action");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return s_impl.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15>(action, scheduler);
- }
-
- /// <summary>
- /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the default scheduler.
- /// </summary>
- /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the action.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the action.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the action.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the action.</typeparam>
- /// <typeparam name="TArg7">The type of the seventh argument passed to the action.</typeparam>
- /// <typeparam name="TArg8">The type of the eighth argument passed to the action.</typeparam>
- /// <typeparam name="TArg9">The type of the ninth argument passed to the action.</typeparam>
- /// <typeparam name="TArg10">The type of the tenth argument passed to the action.</typeparam>
- /// <typeparam name="TArg11">The type of the eleventh argument passed to the action.</typeparam>
- /// <typeparam name="TArg12">The type of the twelfth argument passed to the action.</typeparam>
- /// <typeparam name="TArg13">The type of the thirteenth argument passed to the action.</typeparam>
- /// <typeparam name="TArg14">The type of the fourteenth argument passed to the action.</typeparam>
- /// <typeparam name="TArg15">The type of the fifteenth argument passed to the action.</typeparam>
- /// <typeparam name="TArg16">The type of the sixteenth argument passed to the action.</typeparam>
- /// <param name="action">Action to convert to an asynchronous action.</param>
- /// <returns>Asynchronous action.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="action"/> is null.</exception>
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, TArg16, IObservable<Unit>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, TArg16>(this Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, TArg16> action)
- {
- if (action == null)
- throw new ArgumentNullException("action");
-
- return s_impl.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, TArg16>(action);
- }
-
- /// <summary>
- /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the specified scheduler.
- /// </summary>
- /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the action.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the action.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the action.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the action.</typeparam>
- /// <typeparam name="TArg7">The type of the seventh argument passed to the action.</typeparam>
- /// <typeparam name="TArg8">The type of the eighth argument passed to the action.</typeparam>
- /// <typeparam name="TArg9">The type of the ninth argument passed to the action.</typeparam>
- /// <typeparam name="TArg10">The type of the tenth argument passed to the action.</typeparam>
- /// <typeparam name="TArg11">The type of the eleventh argument passed to the action.</typeparam>
- /// <typeparam name="TArg12">The type of the twelfth argument passed to the action.</typeparam>
- /// <typeparam name="TArg13">The type of the thirteenth argument passed to the action.</typeparam>
- /// <typeparam name="TArg14">The type of the fourteenth argument passed to the action.</typeparam>
- /// <typeparam name="TArg15">The type of the fifteenth argument passed to the action.</typeparam>
- /// <typeparam name="TArg16">The type of the sixteenth argument passed to the action.</typeparam>
- /// <param name="action">Action to convert to an asynchronous action.</param>
- /// <param name="scheduler">Scheduler to invoke the original action on.</param>
- /// <returns>Asynchronous action.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="action"/> or <paramref name="scheduler"/> is null.</exception>
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, TArg16, IObservable<Unit>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, TArg16>(this Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, TArg16> action, IScheduler scheduler)
- {
- if (action == null)
- throw new ArgumentNullException("action");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return s_impl.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, TArg16>(action, scheduler);
- }
-#endif
-
- #endregion
-
- #endregion
- }
-}
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observable.Awaiter.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observable.Awaiter.cs
deleted file mode 100644
index 00db9c0..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observable.Awaiter.cs
+++ /dev/null
@@ -1,79 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if HAS_AWAIT
-using System.Threading;
-using System.Reactive.Disposables;
-using System.Reactive.Subjects;
-
-namespace System.Reactive.Linq
-{
- public static partial class Observable
- {
- /// <summary>
- /// Gets an awaiter that returns the last value of the observable sequence or throws an exception if the sequence is empty.
- /// This operation subscribes to the observable sequence, making it hot.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence to await.</param>
- /// <returns>Object that can be awaited.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- public static AsyncSubject<TSource> GetAwaiter<TSource>(this IObservable<TSource> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return s_impl.GetAwaiter<TSource>(source);
- }
-
- /// <summary>
- /// Gets an awaiter that returns the last value of the observable sequence or throws an exception if the sequence is empty.
- /// This operation subscribes and connects to the observable sequence, making it hot.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence to await.</param>
- /// <returns>Object that can be awaited.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- public static AsyncSubject<TSource> GetAwaiter<TSource>(this IConnectableObservable<TSource> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return s_impl.GetAwaiter<TSource>(source);
- }
-
- /// <summary>
- /// Gets an awaiter that returns the last value of the observable sequence or throws an exception if the sequence is empty.
- /// This operation subscribes to the observable sequence, making it hot. The supplied CancellationToken can be used to cancel the subscription.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence to await.</param>
- /// <param name="cancellationToken">Cancellation token.</param>
- /// <returns>Object that can be awaited.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- public static AsyncSubject<TSource> RunAsync<TSource>(this IObservable<TSource> source, CancellationToken cancellationToken)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return s_impl.RunAsync<TSource>(source, cancellationToken);
- }
-
- /// <summary>
- /// Gets an awaiter that returns the last value of the observable sequence or throws an exception if the sequence is empty.
- /// This operation subscribes and connects to the observable sequence, making it hot. The supplied CancellationToken can be used to cancel the subscription and connection.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence to await.</param>
- /// <param name="cancellationToken">Cancellation token.</param>
- /// <returns>Object that can be awaited.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- public static AsyncSubject<TSource> RunAsync<TSource>(this IConnectableObservable<TSource> source, CancellationToken cancellationToken)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return s_impl.RunAsync<TSource>(source, cancellationToken);
- }
- }
-}
-#endif
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observable.Binding.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observable.Binding.cs
deleted file mode 100644
index 3529e97..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observable.Binding.cs
+++ /dev/null
@@ -1,610 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System.Reactive.Concurrency;
-using System.Reactive.Subjects;
-
-namespace System.Reactive.Linq
-{
- public static partial class Observable
- {
- #region + Multicast +
-
- /// <summary>
- /// Multicasts the source sequence notifications through the specified subject to the resulting connectable observable. Upon connection of the
- /// connectable observable, the subject is subscribed to the source exactly one, and messages are forwarded to the observers registered with
- /// the connectable observable. For specializations with fixed subject types, see Publish, PublishLast, and Replay.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence.</typeparam>
- /// <param name="source">Source sequence whose elements will be pushed into the specified subject.</param>
- /// <param name="subject">Subject to push source elements into.</param>
- /// <returns>A connectable observable sequence that upon connection causes the source sequence to push results into the specified subject.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="subject"/> is null.</exception>
- public static IConnectableObservable<TResult> Multicast<TSource, TResult>(this IObservable<TSource> source, ISubject<TSource, TResult> subject)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (subject == null)
- throw new ArgumentNullException("subject");
-
- return s_impl.Multicast<TSource, TResult>(source, subject);
- }
-
- /// <summary>
- /// Multicasts the source sequence notifications through an instantiated subject into all uses of the sequence within a selector function. Each
- /// subscription to the resulting sequence causes a separate multicast invocation, exposing the sequence resulting from the selector function's
- /// invocation. For specializations with fixed subject types, see Publish, PublishLast, and Replay.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TIntermediate">The type of the elements produced by the intermediate subject.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence.</typeparam>
- /// <param name="source">Source sequence which will be multicasted in the specified selector function.</param>
- /// <param name="subjectSelector">Factory function to create an intermediate subject through which the source sequence's elements will be multicast to the selector function.</param>
- /// <param name="selector">Selector function which can use the multicasted source sequence subject to the policies enforced by the created subject.</param>
- /// <returns>An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="subjectSelector"/> or <paramref name="selector"/> is null.</exception>
- public static IObservable<TResult> Multicast<TSource, TIntermediate, TResult>(this IObservable<TSource> source, Func<ISubject<TSource, TIntermediate>> subjectSelector, Func<IObservable<TIntermediate>, IObservable<TResult>> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (subjectSelector == null)
- throw new ArgumentNullException("subjectSelector");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return s_impl.Multicast<TSource, TIntermediate, TResult>(source, subjectSelector, selector);
- }
-
- #endregion
-
- #region + Publish +
-
- /// <summary>
- /// Returns a connectable observable sequence that shares a single subscription to the underlying sequence.
- /// This operator is a specialization of Multicast using a regular <see cref="System.Reactive.Subjects.Subject&lt;T&gt;"/>.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence whose elements will be multicasted through a single shared subscription.</param>
- /// <returns>A connectable observable sequence that shares a single subscription to the underlying sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <remarks>Subscribers will receive all notifications of the source from the time of the subscription on.</remarks>
- /// <seealso cref="System.Reactive.Subjects.Subject&lt;T&gt;"/>
- public static IConnectableObservable<TSource> Publish<TSource>(this IObservable<TSource> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return s_impl.Publish<TSource>(source);
- }
-
- /// <summary>
- /// Returns an observable sequence that is the result of invoking the selector on a connectable observable sequence that shares a single subscription to the underlying sequence.
- /// This operator is a specialization of Multicast using a regular <see cref="System.Reactive.Subjects.Subject&lt;T&gt;"/>.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence.</typeparam>
- /// <param name="source">Source sequence whose elements will be multicasted through a single shared subscription.</param>
- /// <param name="selector">Selector function which can use the multicasted source sequence as many times as needed, without causing multiple subscriptions to the source sequence. Subscribers to the given source will receive all notifications of the source from the time of the subscription on.</param>
- /// <returns>An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> is null.</exception>
- /// <seealso cref="System.Reactive.Subjects.Subject&lt;T&gt;"/>
- public static IObservable<TResult> Publish<TSource, TResult>(this IObservable<TSource> source, Func<IObservable<TSource>, IObservable<TResult>> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return s_impl.Publish<TSource, TResult>(source, selector);
- }
-
- /// <summary>
- /// Returns a connectable observable sequence that shares a single subscription to the underlying sequence and starts with initialValue.
- /// This operator is a specialization of Multicast using a <see cref="System.Reactive.Subjects.BehaviorSubject&lt;T&gt;"/>.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence whose elements will be multicasted through a single shared subscription.</param>
- /// <param name="initialValue">Initial value received by observers upon subscription.</param>
- /// <returns>A connectable observable sequence that shares a single subscription to the underlying sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <remarks>Subscribers will receive immediately receive the initial value, followed by all notifications of the source from the time of the subscription on.</remarks>
- /// <seealso cref="System.Reactive.Subjects.BehaviorSubject&lt;T&gt;"/>
- public static IConnectableObservable<TSource> Publish<TSource>(this IObservable<TSource> source, TSource initialValue)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return s_impl.Publish<TSource>(source, initialValue);
- }
-
- /// <summary>
- /// Returns an observable sequence that is the result of invoking the selector on a connectable observable sequence that shares a single subscription to the underlying sequence and starts with initialValue.
- /// This operator is a specialization of Multicast using a <see cref="System.Reactive.Subjects.BehaviorSubject&lt;T&gt;"/>.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence.</typeparam>
- /// <param name="source">Source sequence whose elements will be multicasted through a single shared subscription.</param>
- /// <param name="selector">Selector function which can use the multicasted source sequence as many times as needed, without causing multiple subscriptions to the source sequence. Subscribers to the given source will receive immediately receive the initial value, followed by all notifications of the source from the time of the subscription on.</param>
- /// <param name="initialValue">Initial value received by observers upon subscription.</param>
- /// <returns>An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> is null.</exception>
- /// <seealso cref="System.Reactive.Subjects.BehaviorSubject&lt;T&gt;"/>
- public static IObservable<TResult> Publish<TSource, TResult>(this IObservable<TSource> source, Func<IObservable<TSource>, IObservable<TResult>> selector, TSource initialValue)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return s_impl.Publish<TSource, TResult>(source, selector, initialValue);
- }
-
- #endregion
-
- #region + PublishLast +
-
- /// <summary>
- /// Returns a connectable observable sequence that shares a single subscription to the underlying sequence containing only the last notification.
- /// This operator is a specialization of Multicast using a <see cref="System.Reactive.Subjects.AsyncSubject&lt;T&gt;"/>.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence whose elements will be multicasted through a single shared subscription.</param>
- /// <returns>A connectable observable sequence that shares a single subscription to the underlying sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <remarks>Subscribers will only receive the last notification of the source.</remarks>
- /// <seealso cref="System.Reactive.Subjects.AsyncSubject&lt;T&gt;"/>
- public static IConnectableObservable<TSource> PublishLast<TSource>(this IObservable<TSource> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return s_impl.PublishLast<TSource>(source);
- }
-
- /// <summary>
- /// Returns an observable sequence that is the result of invoking the selector on a connectable observable sequence that shares a single subscription to the underlying sequence containing only the last notification.
- /// This operator is a specialization of Multicast using a <see cref="System.Reactive.Subjects.AsyncSubject&lt;T&gt;"/>.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence.</typeparam>
- /// <param name="source">Source sequence whose elements will be multicasted through a single shared subscription.</param>
- /// <param name="selector">Selector function which can use the multicasted source sequence as many times as needed, without causing multiple subscriptions to the source sequence. Subscribers to the given source will only receive the last notification of the source.</param>
- /// <returns>An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> is null.</exception>
- /// <seealso cref="System.Reactive.Subjects.AsyncSubject&lt;T&gt;"/>
- public static IObservable<TResult> PublishLast<TSource, TResult>(this IObservable<TSource> source, Func<IObservable<TSource>, IObservable<TResult>> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return s_impl.PublishLast<TSource, TResult>(source, selector);
- }
-
- #endregion
-
- #region + RefCount +
-
- /// <summary>
- /// Returns an observable sequence that stays connected to the source as long as there is at least one subscription to the observable sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Connectable observable sequence.</param>
- /// <returns>An observable sequence that stays connected to the source as long as there is at least one subscription to the observable sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- public static IObservable<TSource> RefCount<TSource>(this IConnectableObservable<TSource> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return s_impl.RefCount<TSource>(source);
- }
-
- #endregion
-
- #region + Replay +
-
- /// <summary>
- /// Returns a connectable observable sequence that shares a single subscription to the underlying sequence replaying all notifications.
- /// This operator is a specialization of Multicast using a <see cref="System.Reactive.Subjects.ReplaySubject&lt;T&gt;"/>.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence whose elements will be multicasted through a single shared subscription.</param>
- /// <returns>A connectable observable sequence that shares a single subscription to the underlying sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <remarks>Subscribers will receive all the notifications of the source.</remarks>
- /// <seealso cref="System.Reactive.Subjects.ReplaySubject&lt;T&gt;"/>
- public static IConnectableObservable<TSource> Replay<TSource>(this IObservable<TSource> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return s_impl.Replay<TSource>(source);
- }
-
- /// <summary>
- /// Returns a connectable observable sequence that shares a single subscription to the underlying sequence replaying all notifications.
- /// This operator is a specialization of Multicast using a <see cref="System.Reactive.Subjects.ReplaySubject&lt;T&gt;"/>.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence whose elements will be multicasted through a single shared subscription.</param>
- /// <param name="scheduler">Scheduler where connected observers will be invoked on.</param>
- /// <returns>A connectable observable sequence that shares a single subscription to the underlying sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="scheduler"/> is null.</exception>
- /// <remarks>Subscribers will receive all the notifications of the source.</remarks>
- /// <seealso cref="System.Reactive.Subjects.ReplaySubject&lt;T&gt;"/>
- public static IConnectableObservable<TSource> Replay<TSource>(this IObservable<TSource> source, IScheduler scheduler)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return s_impl.Replay<TSource>(source, scheduler);
- }
-
- /// <summary>
- /// Returns an observable sequence that is the result of invoking the selector on a connectable observable sequence that shares a single subscription to the underlying sequence replaying all notifications.
- /// This operator is a specialization of Multicast using a <see cref="System.Reactive.Subjects.ReplaySubject&lt;T&gt;"/>.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence.</typeparam>
- /// <param name="source">Source sequence whose elements will be multicasted through a single shared subscription.</param>
- /// <param name="selector">Selector function which can use the multicasted source sequence as many times as needed, without causing multiple subscriptions to the source sequence. Subscribers to the given source will receive all the notifications of the source.</param>
- /// <returns>An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> is null.</exception>
- /// <seealso cref="System.Reactive.Subjects.ReplaySubject&lt;T&gt;"/>
- public static IObservable<TResult> Replay<TSource, TResult>(this IObservable<TSource> source, Func<IObservable<TSource>, IObservable<TResult>> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return s_impl.Replay<TSource, TResult>(source, selector);
- }
-
- /// <summary>
- /// Returns an observable sequence that is the result of invoking the selector on a connectable observable sequence that shares a single subscription to the underlying sequence replaying all notifications.
- /// This operator is a specialization of Multicast using a <see cref="System.Reactive.Subjects.ReplaySubject&lt;T&gt;"/>.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence.</typeparam>
- /// <param name="source">Source sequence whose elements will be multicasted through a single shared subscription.</param>
- /// <param name="selector">Selector function which can use the multicasted source sequence as many times as needed, without causing multiple subscriptions to the source sequence. Subscribers to the given source will receive all the notifications of the source.</param>
- /// <param name="scheduler">Scheduler where connected observers within the selector function will be invoked on.</param>
- /// <returns>An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> or <paramref name="scheduler"/> is null.</exception>
- /// <seealso cref="System.Reactive.Subjects.ReplaySubject&lt;T&gt;"/>
- public static IObservable<TResult> Replay<TSource, TResult>(this IObservable<TSource> source, Func<IObservable<TSource>, IObservable<TResult>> selector, IScheduler scheduler)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return s_impl.Replay<TSource, TResult>(source, selector, scheduler);
- }
-
- /// <summary>
- /// Returns a connectable observable sequence that shares a single subscription to the underlying sequence replaying notifications subject to a maximum time length for the replay buffer.
- /// This operator is a specialization of Multicast using a <see cref="System.Reactive.Subjects.ReplaySubject&lt;T&gt;"/>.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence whose elements will be multicasted through a single shared subscription.</param>
- /// <param name="window">Maximum time length of the replay buffer.</param>
- /// <returns>A connectable observable sequence that shares a single subscription to the underlying sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <exception cref="ArgumentOutOfRangeException"><paramref name="window"/> is less than TimeSpan.Zero.</exception>
- /// <remarks>Subscribers will receive all the notifications of the source subject to the specified replay buffer trimming policy.</remarks>
- /// <seealso cref="System.Reactive.Subjects.ReplaySubject&lt;T&gt;"/>
- public static IConnectableObservable<TSource> Replay<TSource>(this IObservable<TSource> source, TimeSpan window)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (window < TimeSpan.Zero)
- throw new ArgumentOutOfRangeException("window");
-
- return s_impl.Replay<TSource>(source, window);
- }
-
- /// <summary>
- /// Returns an observable sequence that is the result of invoking the selector on a connectable observable sequence that shares a single subscription to the underlying sequence replaying notifications subject to a maximum time length for the replay buffer.
- /// This operator is a specialization of Multicast using a <see cref="System.Reactive.Subjects.ReplaySubject&lt;T&gt;"/>.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence.</typeparam>
- /// <param name="source">Source sequence whose elements will be multicasted through a single shared subscription.</param>
- /// <param name="selector">Selector function which can use the multicasted source sequence as many times as needed, without causing multiple subscriptions to the source sequence. Subscribers to the given source will receive all the notifications of the source subject to the specified replay buffer trimming policy.</param>
- /// <param name="window">Maximum time length of the replay buffer.</param>
- /// <returns>An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> is null.</exception>
- /// <exception cref="ArgumentOutOfRangeException"><paramref name="window"/> is less than TimeSpan.Zero.</exception>
- /// <seealso cref="System.Reactive.Subjects.ReplaySubject&lt;T&gt;"/>
- public static IObservable<TResult> Replay<TSource, TResult>(this IObservable<TSource> source, Func<IObservable<TSource>, IObservable<TResult>> selector, TimeSpan window)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
- if (window < TimeSpan.Zero)
- throw new ArgumentOutOfRangeException("window");
-
- return s_impl.Replay<TSource, TResult>(source, selector, window);
- }
-
- /// <summary>
- /// Returns a connectable observable sequence that shares a single subscription to the underlying sequence replaying notifications subject to a maximum time length for the replay buffer.
- /// This operator is a specialization of Multicast using a <see cref="System.Reactive.Subjects.ReplaySubject&lt;T&gt;"/>.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence whose elements will be multicasted through a single shared subscription.</param>
- /// <param name="window">Maximum time length of the replay buffer.</param>
- /// <param name="scheduler">Scheduler where connected observers will be invoked on.</param>
- /// <returns>A connectable observable sequence that shares a single subscription to the underlying sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="scheduler"/> is null.</exception>
- /// <exception cref="ArgumentOutOfRangeException"><paramref name="window"/> is less than TimeSpan.Zero.</exception>
- /// <remarks>Subscribers will receive all the notifications of the source subject to the specified replay buffer trimming policy.</remarks>
- /// <seealso cref="System.Reactive.Subjects.ReplaySubject&lt;T&gt;"/>
- public static IConnectableObservable<TSource> Replay<TSource>(this IObservable<TSource> source, TimeSpan window, IScheduler scheduler)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (window < TimeSpan.Zero)
- throw new ArgumentOutOfRangeException("window");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return s_impl.Replay<TSource>(source, window, scheduler);
- }
-
- /// <summary>
- /// Returns an observable sequence that is the result of invoking the selector on a connectable observable sequence that shares a single subscription to the underlying sequence replaying notifications subject to a maximum time length for the replay buffer.
- /// This operator is a specialization of Multicast using a <see cref="System.Reactive.Subjects.ReplaySubject&lt;T&gt;"/>.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence.</typeparam>
- /// <param name="source">Source sequence whose elements will be multicasted through a single shared subscription.</param>
- /// <param name="selector">Selector function which can use the multicasted source sequence as many times as needed, without causing multiple subscriptions to the source sequence. Subscribers to the given source will receive all the notifications of the source subject to the specified replay buffer trimming policy.</param>
- /// <param name="window">Maximum time length of the replay buffer.</param>
- /// <param name="scheduler">Scheduler where connected observers within the selector function will be invoked on.</param>
- /// <returns>An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> or <paramref name="scheduler"/> is null.</exception>
- /// <exception cref="ArgumentOutOfRangeException"><paramref name="window"/> is less than TimeSpan.Zero.</exception>
- /// <seealso cref="System.Reactive.Subjects.ReplaySubject&lt;T&gt;"/>
- public static IObservable<TResult> Replay<TSource, TResult>(this IObservable<TSource> source, Func<IObservable<TSource>, IObservable<TResult>> selector, TimeSpan window, IScheduler scheduler)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
- if (window < TimeSpan.Zero)
- throw new ArgumentOutOfRangeException("window");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return s_impl.Replay<TSource, TResult>(source, selector, window, scheduler);
- }
-
- /// <summary>
- /// Returns a connectable observable sequence that shares a single subscription to the underlying sequence replaying bufferSize notifications.
- /// This operator is a specialization of Multicast using a <see cref="System.Reactive.Subjects.ReplaySubject&lt;T&gt;"/>.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence whose elements will be multicasted through a single shared subscription.</param>
- /// <param name="bufferSize">Maximum element count of the replay buffer.</param>
- /// <param name="scheduler">Scheduler where connected observers will be invoked on.</param>
- /// <returns>A connectable observable sequence that shares a single subscription to the underlying sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="scheduler"/> is null.</exception>
- /// <exception cref="ArgumentOutOfRangeException"><paramref name="bufferSize"/> is less than zero.</exception>
- /// <remarks>Subscribers will receive all the notifications of the source subject to the specified replay buffer trimming policy.</remarks>
- /// <seealso cref="System.Reactive.Subjects.ReplaySubject&lt;T&gt;"/>
- public static IConnectableObservable<TSource> Replay<TSource>(this IObservable<TSource> source, int bufferSize, IScheduler scheduler)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (bufferSize < 0)
- throw new ArgumentOutOfRangeException("bufferSize");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return s_impl.Replay<TSource>(source, bufferSize, scheduler);
- }
-
- /// <summary>
- /// Returns an observable sequence that is the result of invoking the selector on a connectable observable sequence that shares a single subscription to the underlying sequence replaying notifications subject to a maximum element count for the replay buffer.
- /// This operator is a specialization of Multicast using a <see cref="System.Reactive.Subjects.ReplaySubject&lt;T&gt;"/>.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence.</typeparam>
- /// <param name="source">Source sequence whose elements will be multicasted through a single shared subscription.</param>
- /// <param name="selector">Selector function which can use the multicasted source sequence as many times as needed, without causing multiple subscriptions to the source sequence. Subscribers to the given source will receive all the notifications of the source subject to the specified replay buffer trimming policy.</param>
- /// <param name="bufferSize">Maximum element count of the replay buffer.</param>
- /// <param name="scheduler">Scheduler where connected observers within the selector function will be invoked on.</param>
- /// <returns>An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> or <paramref name="scheduler"/> is null.</exception>
- /// <exception cref="ArgumentOutOfRangeException"><paramref name="bufferSize"/> is less than zero.</exception>
- /// <seealso cref="System.Reactive.Subjects.ReplaySubject&lt;T&gt;"/>
- public static IObservable<TResult> Replay<TSource, TResult>(this IObservable<TSource> source, Func<IObservable<TSource>, IObservable<TResult>> selector, int bufferSize, IScheduler scheduler)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
- if (bufferSize < 0)
- throw new ArgumentOutOfRangeException("bufferSize");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return s_impl.Replay<TSource, TResult>(source, selector, bufferSize, scheduler);
- }
-
- /// <summary>
- /// Returns a connectable observable sequence that shares a single subscription to the underlying sequence replaying notifications subject to a maximum element count for the replay buffer.
- /// This operator is a specialization of Multicast using a <see cref="System.Reactive.Subjects.ReplaySubject&lt;T&gt;"/>.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence whose elements will be multicasted through a single shared subscription.</param>
- /// <param name="bufferSize">Maximum element count of the replay buffer.</param>
- /// <returns>A connectable observable sequence that shares a single subscription to the underlying sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <exception cref="ArgumentOutOfRangeException"><paramref name="bufferSize"/> is less than zero.</exception>
- /// <remarks>Subscribers will receive all the notifications of the source subject to the specified replay buffer trimming policy.</remarks>
- /// <seealso cref="System.Reactive.Subjects.ReplaySubject&lt;T&gt;"/>
- public static IConnectableObservable<TSource> Replay<TSource>(this IObservable<TSource> source, int bufferSize)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (bufferSize < 0)
- throw new ArgumentOutOfRangeException("bufferSize");
-
- return s_impl.Replay<TSource>(source, bufferSize);
- }
-
- /// <summary>
- /// Returns an observable sequence that is the result of invoking the selector on a connectable observable sequence that shares a single subscription to the underlying sequence replaying notifications subject to a maximum element count for the replay buffer.
- /// This operator is a specialization of Multicast using a <see cref="System.Reactive.Subjects.ReplaySubject&lt;T&gt;"/>.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence.</typeparam>
- /// <param name="source">Source sequence whose elements will be multicasted through a single shared subscription.</param>
- /// <param name="selector">Selector function which can use the multicasted source sequence as many times as needed, without causing multiple subscriptions to the source sequence. Subscribers to the given source will receive all the notifications of the source subject to the specified replay buffer trimming policy.</param>
- /// <param name="bufferSize">Maximum element count of the replay buffer.</param>
- /// <returns>An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> is null.</exception>
- /// <exception cref="ArgumentOutOfRangeException"><paramref name="bufferSize"/> is less than zero.</exception>
- /// <seealso cref="System.Reactive.Subjects.ReplaySubject&lt;T&gt;"/>
- public static IObservable<TResult> Replay<TSource, TResult>(this IObservable<TSource> source, Func<IObservable<TSource>, IObservable<TResult>> selector, int bufferSize)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
- if (bufferSize < 0)
- throw new ArgumentOutOfRangeException("bufferSize");
-
- return s_impl.Replay<TSource, TResult>(source, selector, bufferSize);
- }
-
- /// <summary>
- /// Returns a connectable observable sequence that shares a single subscription to the underlying sequence replaying notifications subject to a maximum time length and element count for the replay buffer.
- /// This operator is a specialization of Multicast using a <see cref="System.Reactive.Subjects.ReplaySubject&lt;T&gt;"/>.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence whose elements will be multicasted through a single shared subscription.</param>
- /// <param name="bufferSize">Maximum element count of the replay buffer.</param>
- /// <param name="window">Maximum time length of the replay buffer.</param>
- /// <returns>A connectable observable sequence that shares a single subscription to the underlying sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <exception cref="ArgumentOutOfRangeException"><paramref name="bufferSize"/> is less than zero.</exception>
- /// <exception cref="ArgumentOutOfRangeException"><paramref name="window"/> is less than TimeSpan.Zero.</exception>
- /// <remarks>Subscribers will receive all the notifications of the source subject to the specified replay buffer trimming policy.</remarks>
- /// <seealso cref="System.Reactive.Subjects.ReplaySubject&lt;T&gt;"/>
- public static IConnectableObservable<TSource> Replay<TSource>(this IObservable<TSource> source, int bufferSize, TimeSpan window)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (bufferSize < 0)
- throw new ArgumentOutOfRangeException("bufferSize");
- if (window < TimeSpan.Zero)
- throw new ArgumentOutOfRangeException("window");
-
- return s_impl.Replay<TSource>(source, bufferSize, window);
- }
-
- /// <summary>
- /// Returns an observable sequence that is the result of invoking the selector on a connectable observable sequence that shares a single subscription to the underlying sequence replaying notifications subject to a maximum time length and element count for the replay buffer.
- /// This operator is a specialization of Multicast using a <see cref="System.Reactive.Subjects.ReplaySubject&lt;T&gt;"/>.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence.</typeparam>
- /// <param name="source">Source sequence whose elements will be multicasted through a single shared subscription.</param>
- /// <param name="selector">Selector function which can use the multicasted source sequence as many times as needed, without causing multiple subscriptions to the source sequence. Subscribers to the given source will receive all the notifications of the source subject to the specified replay buffer trimming policy.</param>
- /// <param name="bufferSize">Maximum element count of the replay buffer.</param>
- /// <param name="window">Maximum time length of the replay buffer.</param>
- /// <returns>An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> is null.</exception>
- /// <exception cref="ArgumentOutOfRangeException"><paramref name="bufferSize"/> is less than zero.</exception>
- /// <exception cref="ArgumentOutOfRangeException"><paramref name="window"/> is less than TimeSpan.Zero.</exception>
- /// <seealso cref="System.Reactive.Subjects.ReplaySubject&lt;T&gt;"/>
- public static IObservable<TResult> Replay<TSource, TResult>(this IObservable<TSource> source, Func<IObservable<TSource>, IObservable<TResult>> selector, int bufferSize, TimeSpan window)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
- if (bufferSize < 0)
- throw new ArgumentOutOfRangeException("bufferSize");
- if (window < TimeSpan.Zero)
- throw new ArgumentOutOfRangeException("window");
-
- return s_impl.Replay<TSource, TResult>(source, selector, bufferSize, window);
- }
-
- /// <summary>
- /// Returns a connectable observable sequence that shares a single subscription to the underlying sequence replaying notifications subject to a maximum time length and element count for the replay buffer.
- /// This operator is a specialization of Multicast using a <see cref="System.Reactive.Subjects.ReplaySubject&lt;T&gt;"/>.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence whose elements will be multicasted through a single shared subscription.</param>
- /// <param name="bufferSize">Maximum element count of the replay buffer.</param>
- /// <param name="window">Maximum time length of the replay buffer.</param>
- /// <param name="scheduler">Scheduler where connected observers will be invoked on.</param>
- /// <returns>A connectable observable sequence that shares a single subscription to the underlying sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="scheduler"/> is null.</exception>
- /// <exception cref="ArgumentOutOfRangeException"><paramref name="bufferSize"/> is less than zero.</exception>
- /// <exception cref="ArgumentOutOfRangeException"><paramref name="window"/> is less than TimeSpan.Zero.</exception>
- /// <remarks>Subscribers will receive all the notifications of the source subject to the specified replay buffer trimming policy.</remarks>
- /// <seealso cref="System.Reactive.Subjects.ReplaySubject&lt;T&gt;"/>
- public static IConnectableObservable<TSource> Replay<TSource>(this IObservable<TSource> source, int bufferSize, TimeSpan window, IScheduler scheduler)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (bufferSize < 0)
- throw new ArgumentOutOfRangeException("bufferSize");
- if (window < TimeSpan.Zero)
- throw new ArgumentOutOfRangeException("window");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return s_impl.Replay<TSource>(source, bufferSize, window, scheduler);
- }
-
- /// <summary>
- /// Returns an observable sequence that is the result of invoking the selector on a connectable observable sequence that shares a single subscription to the underlying sequence replaying notifications subject to a maximum time length and element count for the replay buffer.
- /// This operator is a specialization of Multicast using a <see cref="System.Reactive.Subjects.ReplaySubject&lt;T&gt;"/>.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence.</typeparam>
- /// <param name="source">Source sequence whose elements will be multicasted through a single shared subscription.</param>
- /// <param name="selector">Selector function which can use the multicasted source sequence as many times as needed, without causing multiple subscriptions to the source sequence. Subscribers to the given source will receive all the notifications of the source subject to the specified replay buffer trimming policy.</param>
- /// <param name="bufferSize">Maximum element count of the replay buffer.</param>
- /// <param name="window">Maximum time length of the replay buffer.</param>
- /// <param name="scheduler">Scheduler where connected observers within the selector function will be invoked on.</param>
- /// <returns>An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> or <paramref name="scheduler"/> is null.</exception>
- /// <exception cref="ArgumentOutOfRangeException"><paramref name="bufferSize"/> is less than zero.</exception>
- /// <exception cref="ArgumentOutOfRangeException"><paramref name="window"/> is less than TimeSpan.Zero.</exception>
- /// <seealso cref="System.Reactive.Subjects.ReplaySubject&lt;T&gt;"/>
- public static IObservable<TResult> Replay<TSource, TResult>(this IObservable<TSource> source, Func<IObservable<TSource>, IObservable<TResult>> selector, int bufferSize, TimeSpan window, IScheduler scheduler)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
- if (bufferSize < 0)
- throw new ArgumentOutOfRangeException("bufferSize");
- if (window < TimeSpan.Zero)
- throw new ArgumentOutOfRangeException("window");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return s_impl.Replay<TSource, TResult>(source, selector, bufferSize, window, scheduler);
- }
-
- #endregion
- }
-}
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observable.Blocking.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observable.Blocking.cs
deleted file mode 100644
index 1575b3d..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observable.Blocking.cs
+++ /dev/null
@@ -1,503 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System.Collections.Generic;
-
-namespace System.Reactive.Linq
-{
- public static partial class Observable
- {
- #region + Chunkify +
-
- /// <summary>
- /// Produces an enumerable sequence of consecutive (possibly empty) chunks of the source sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source observable sequence.</param>
- /// <returns>The enumerable sequence that returns consecutive (possibly empty) chunks upon each iteration.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- public static IEnumerable<IList<TSource>> Chunkify<TSource>(this IObservable<TSource> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return s_impl.Chunkify<TSource>(source);
- }
-
- #endregion
-
- #region + Collect +
-
- /// <summary>
- /// Produces an enumerable sequence that returns elements collected/aggregated from the source sequence between consecutive iterations.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the elements produced by the merge operation during collection.</typeparam>
- /// <param name="source">Source observable sequence.</param>
- /// <param name="newCollector">Factory to create a new collector object.</param>
- /// <param name="merge">Merges a sequence element with the current collector.</param>
- /// <returns>The enumerable sequence that returns collected/aggregated elements from the source sequence upon each iteration.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="newCollector"/> or <paramref name="merge"/> is null.</exception>
- public static IEnumerable<TResult> Collect<TSource, TResult>(this IObservable<TSource> source, Func<TResult> newCollector, Func<TResult, TSource, TResult> merge)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (newCollector == null)
- throw new ArgumentNullException("newCollector");
- if (merge == null)
- throw new ArgumentNullException("merge");
-
- return s_impl.Collect<TSource, TResult>(source, newCollector, merge);
- }
-
- /// <summary>
- /// Produces an enumerable sequence that returns elements collected/aggregated from the source sequence between consecutive iterations.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the elements produced by the merge operation during collection.</typeparam>
- /// <param name="source">Source observable sequence.</param>
- /// <param name="getInitialCollector">Factory to create the initial collector object.</param>
- /// <param name="merge">Merges a sequence element with the current collector.</param>
- /// <param name="getNewCollector">Factory to replace the current collector by a new collector.</param>
- /// <returns>The enumerable sequence that returns collected/aggregated elements from the source sequence upon each iteration.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="getInitialCollector"/> or <paramref name="merge"/> or <paramref name="getNewCollector"/> is null.</exception>
- public static IEnumerable<TResult> Collect<TSource, TResult>(this IObservable<TSource> source, Func<TResult> getInitialCollector, Func<TResult, TSource, TResult> merge, Func<TResult, TResult> getNewCollector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (getInitialCollector == null)
- throw new ArgumentNullException("getInitialCollector");
- if (merge == null)
- throw new ArgumentNullException("merge");
- if (getNewCollector == null)
- throw new ArgumentNullException("getNewCollector");
-
- return s_impl.Collect<TSource, TResult>(source, getInitialCollector, merge, getNewCollector);
- }
-
- #endregion
-
- #region First
-
- /// <summary>
- /// Returns the first element of an observable sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source observable sequence.</param>
- /// <returns>The first element in the observable sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <exception cref="InvalidOperationException">The source sequence is empty.</exception>
- /// <seealso cref="Observable.FirstAsync{TSource}(IObservable{TSource})"/>
-#if PREFER_ASYNC
- [Obsolete(Constants_Linq.USE_ASYNC)]
-#endif
- public static TSource First<TSource>(this IObservable<TSource> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return s_impl.First<TSource>(source);
- }
-
- /// <summary>
- /// Returns the first element of an observable sequence that satisfies the condition in the predicate.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source observable sequence.</param>
- /// <param name="predicate">A predicate function to evaluate for elements in the source sequence.</param>
- /// <returns>The first element in the observable sequence that satisfies the condition in the predicate.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="predicate"/> is null.</exception>
- /// <exception cref="InvalidOperationException">No element satisfies the condition in the predicate. -or- The source sequence is empty.</exception>
- /// <seealso cref="Observable.FirstAsync{TSource}(IObservable{TSource}, Func{TSource, bool})"/>
-#if PREFER_ASYNC
- [Obsolete(Constants_Linq.USE_ASYNC)]
-#endif
- public static TSource First<TSource>(this IObservable<TSource> source, Func<TSource, bool> predicate)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (predicate == null)
- throw new ArgumentNullException("predicate");
-
- return s_impl.First<TSource>(source, predicate);
- }
-
- #endregion
-
- #region FirstOrDefault
-
- /// <summary>
- /// Returns the first element of an observable sequence, or a default value if no such element exists.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source observable sequence.</param>
- /// <returns>The first element in the observable sequence, or a default value if no such element exists.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <seealso cref="Observable.FirstOrDefaultAsync{TSource}(IObservable{TSource})"/>
-#if PREFER_ASYNC
- [Obsolete(Constants_Linq.USE_ASYNC)]
-#endif
- public static TSource FirstOrDefault<TSource>(this IObservable<TSource> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return s_impl.FirstOrDefault<TSource>(source);
- }
-
- /// <summary>
- /// Returns the first element of an observable sequence that satisfies the condition in the predicate, or a default value if no such element exists.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source observable sequence.</param>
- /// <param name="predicate">A predicate function to evaluate for elements in the source sequence.</param>
- /// <returns>The first element in the observable sequence that satisfies the condition in the predicate, or a default value if no such element exists.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="predicate"/> is null.</exception>
- /// <seealso cref="Observable.FirstOrDefaultAsync{TSource}(IObservable{TSource}, Func{TSource, bool})"/>
-#if PREFER_ASYNC
- [Obsolete(Constants_Linq.USE_ASYNC)]
-#endif
- public static TSource FirstOrDefault<TSource>(this IObservable<TSource> source, Func<TSource, bool> predicate)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (predicate == null)
- throw new ArgumentNullException("predicate");
-
- return s_impl.FirstOrDefault<TSource>(source, predicate);
- }
-
- #endregion
-
- #region + ForEach +
-
- /// <summary>
- /// Invokes an action for each element in the observable sequence, and blocks until the sequence is terminated.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence.</param>
- /// <param name="onNext">Action to invoke for each element in the observable sequence.</param>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="onNext"/> is null.</exception>
- /// <remarks>Because of its blocking nature, this operator is mainly used for testing.</remarks>
-#if PREFER_ASYNC
- [Obsolete(Constants_Linq.USE_ASYNC)]
-#endif
- public static void ForEach<TSource>(this IObservable<TSource> source, Action<TSource> onNext)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (onNext == null)
- throw new ArgumentNullException("onNext");
-
- s_impl.ForEach<TSource>(source, onNext);
- }
-
- /// <summary>
- /// Invokes an action for each element in the observable sequence, incorporating the element's index, and blocks until the sequence is terminated.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence.</param>
- /// <param name="onNext">Action to invoke for each element in the observable sequence.</param>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="onNext"/> is null.</exception>
- /// <remarks>Because of its blocking nature, this operator is mainly used for testing.</remarks>
-#if PREFER_ASYNC
- [Obsolete(Constants_Linq.USE_ASYNC)]
-#endif
- public static void ForEach<TSource>(this IObservable<TSource> source, Action<TSource, int> onNext)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (onNext == null)
- throw new ArgumentNullException("onNext");
-
- s_impl.ForEach<TSource>(source, onNext);
- }
-
- #endregion
-
- #region + GetEnumerator +
-
- /// <summary>
- /// Returns an enumerator that enumerates all values of the observable sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">An observable sequence to get an enumerator for.</param>
- /// <returns>The enumerator that can be used to enumerate over the elements in the observable sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- public static IEnumerator<TSource> GetEnumerator<TSource>(this IObservable<TSource> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return s_impl.GetEnumerator<TSource>(source);
- }
-
- #endregion
-
- #region Last
-
- /// <summary>
- /// Returns the last element of an observable sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source observable sequence.</param>
- /// <returns>The last element in the observable sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <exception cref="InvalidOperationException">The source sequence is empty.</exception>
- /// <seealso cref="Observable.LastAsync{TSource}(IObservable{TSource})"/>
-#if PREFER_ASYNC
- [Obsolete(Constants_Linq.USE_ASYNC)]
-#endif
- public static TSource Last<TSource>(this IObservable<TSource> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return s_impl.Last<TSource>(source);
- }
-
- /// <summary>
- /// Returns the last element of an observable sequence that satisfies the condition in the predicate.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source observable sequence.</param>
- /// <param name="predicate">A predicate function to evaluate for elements in the source sequence.</param>
- /// <returns>The last element in the observable sequence that satisfies the condition in the predicate.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="predicate"/> is null.</exception>
- /// <exception cref="InvalidOperationException">No element satisfies the condition in the predicate. -or- The source sequence is empty.</exception>
- /// <seealso cref="Observable.LastAsync{TSource}(IObservable{TSource}, Func{TSource, bool})"/>
-#if PREFER_ASYNC
- [Obsolete(Constants_Linq.USE_ASYNC)]
-#endif
- public static TSource Last<TSource>(this IObservable<TSource> source, Func<TSource, bool> predicate)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (predicate == null)
- throw new ArgumentNullException("predicate");
-
- return s_impl.Last<TSource>(source, predicate);
- }
-
- #endregion
-
- #region LastOrDefault
-
- /// <summary>
- /// Returns the last element of an observable sequence, or a default value if no such element exists.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source observable sequence.</param>
- /// <returns>The last element in the observable sequence, or a default value if no such element exists.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <seealso cref="Observable.LastOrDefaultAsync{TSource}(IObservable{TSource})"/>
-#if PREFER_ASYNC
- [Obsolete(Constants_Linq.USE_ASYNC)]
-#endif
- public static TSource LastOrDefault<TSource>(this IObservable<TSource> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return s_impl.LastOrDefault<TSource>(source);
- }
-
- /// <summary>
- /// Returns the last element of an observable sequence that satisfies the condition in the predicate, or a default value if no such element exists.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source observable sequence.</param>
- /// <param name="predicate">A predicate function to evaluate for elements in the source sequence.</param>
- /// <returns>The last element in the observable sequence that satisfies the condition in the predicate, or a default value if no such element exists.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="predicate"/> is null.</exception>
- /// <seealso cref="Observable.LastOrDefaultAsync{TSource}(IObservable{TSource}, Func{TSource, bool})"/>
-#if PREFER_ASYNC
- [Obsolete(Constants_Linq.USE_ASYNC)]
-#endif
- public static TSource LastOrDefault<TSource>(this IObservable<TSource> source, Func<TSource, bool> predicate)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (predicate == null)
- throw new ArgumentNullException("predicate");
-
- return s_impl.LastOrDefault<TSource>(source, predicate);
- }
-
- #endregion
-
- #region + Latest +
-
- /// <summary>
- /// Returns an enumerable sequence whose enumeration returns the latest observed element in the source observable sequence.
- /// Enumerators on the resulting sequence will never produce the same element repeatedly, and will block until the next element becomes available.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source observable sequence.</param>
- /// <returns>The enumerable sequence that returns the last sampled element upon each iteration and subsequently blocks until the next element in the observable source sequence becomes available.</returns>
- public static IEnumerable<TSource> Latest<TSource>(this IObservable<TSource> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return s_impl.Latest<TSource>(source);
- }
-
- #endregion
-
- #region + MostRecent +
-
- /// <summary>
- /// Returns an enumerable sequence whose enumeration returns the most recently observed element in the source observable sequence, using the specified initial value in case no element has been sampled yet.
- /// Enumerators on the resulting sequence never block and can produce the same element repeatedly.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source observable sequence.</param>
- /// <param name="initialValue">Initial value that will be yielded by the enumerable sequence if no element has been sampled yet.</param>
- /// <returns>The enumerable sequence that returns the last sampled element upon each iteration.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- public static IEnumerable<TSource> MostRecent<TSource>(this IObservable<TSource> source, TSource initialValue)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return s_impl.MostRecent<TSource>(source, initialValue);
- }
-
- #endregion
-
- #region + Next +
-
- /// <summary>
- /// Returns an enumerable sequence whose enumeration blocks until the next element in the source observable sequence becomes available.
- /// Enumerators on the resulting sequence will block until the next element becomes available.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source observable sequence.</param>
- /// <returns>The enumerable sequence that blocks upon each iteration until the next element in the observable source sequence becomes available.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- public static IEnumerable<TSource> Next<TSource>(this IObservable<TSource> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return s_impl.Next<TSource>(source);
- }
-
- #endregion
-
- #region Single
-
- /// <summary>
- /// Returns the only element of an observable sequence, and throws an exception if there is not exactly one element in the observable sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source observable sequence.</param>
- /// <returns>The single element in the observable sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <exception cref="InvalidOperationException">The source sequence contains more than one element. -or- The source sequence is empty.</exception>
- /// <seealso cref="Observable.SingleAsync{TSource}(IObservable{TSource})"/>
-#if PREFER_ASYNC
- [Obsolete(Constants_Linq.USE_ASYNC)]
-#endif
- public static TSource Single<TSource>(this IObservable<TSource> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return s_impl.Single<TSource>(source);
- }
-
- /// <summary>
- /// Returns the only element of an observable sequence that satisfies the condition in the predicate, and throws an exception if there is not exactly one element matching the predicate in the observable sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source observable sequence.</param>
- /// <param name="predicate">A predicate function to evaluate for elements in the source sequence.</param>
- /// <returns>The single element in the observable sequence that satisfies the condition in the predicate.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="predicate"/> is null.</exception>
- /// <exception cref="InvalidOperationException">No element satisfies the condition in the predicate. -or- More than one element satisfies the condition in the predicate. -or- The source sequence is empty.</exception>
- /// <seealso cref="Observable.SingleAsync{TSource}(IObservable{TSource}, Func{TSource, bool})"/>
-#if PREFER_ASYNC
- [Obsolete(Constants_Linq.USE_ASYNC)]
-#endif
- public static TSource Single<TSource>(this IObservable<TSource> source, Func<TSource, bool> predicate)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (predicate == null)
- throw new ArgumentNullException("predicate");
-
- return s_impl.Single<TSource>(source, predicate);
- }
-
- #endregion
-
- #region SingleOrDefault
-
- /// <summary>
- /// Returns the only element of an observable sequence, or a default value if the observable sequence is empty; this method throws an exception if there is more than one element in the observable sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source observable sequence.</param>
- /// <returns>The single element in the observable sequence, or a default value if no such element exists.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <exception cref="InvalidOperationException">The source sequence contains more than one element.</exception>
- /// <seealso cref="Observable.SingleOrDefaultAsync{TSource}(IObservable{TSource})"/>
-#if PREFER_ASYNC
- [Obsolete(Constants_Linq.USE_ASYNC)]
-#endif
- public static TSource SingleOrDefault<TSource>(this IObservable<TSource> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return s_impl.SingleOrDefault<TSource>(source);
- }
-
- /// <summary>
- /// Returns the only element of an observable sequence that satisfies the condition in the predicate, or a default value if no such element exists; this method throws an exception if there is more than one element matching the predicate in the observable sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source observable sequence.</param>
- /// <param name="predicate">A predicate function to evaluate for elements in the source sequence.</param>
- /// <returns>The single element in the observable sequence that satisfies the condition in the predicate, or a default value if no such element exists.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="predicate"/> is null.</exception>
- /// <exception cref="InvalidOperationException">The sequence contains more than one element that satisfies the condition in the predicate.</exception>
- /// <seealso cref="Observable.SingleOrDefaultAsync{TSource}(IObservable{TSource}, Func{TSource, bool})"/>
-#if PREFER_ASYNC
- [Obsolete(Constants_Linq.USE_ASYNC)]
-#endif
- public static TSource SingleOrDefault<TSource>(this IObservable<TSource> source, Func<TSource, bool> predicate)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (predicate == null)
- throw new ArgumentNullException("predicate");
-
- return s_impl.SingleOrDefault<TSource>(source, predicate);
- }
-
- #endregion
-
- #region Wait
-
- /// <summary>
- /// Waits for the observable sequence to complete and returns the last element of the sequence.
- /// If the sequence terminates with an OnError notification, the exception is throw.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source observable sequence.</param>
- /// <returns>The last element in the observable sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <exception cref="InvalidOperationException">The source sequence is empty.</exception>
- public static TSource Wait<TSource>(this IObservable<TSource> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return s_impl.Wait<TSource>(source);
- }
-
- #endregion
- }
-}
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observable.Concurrency.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observable.Concurrency.cs
deleted file mode 100644
index e14df19..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observable.Concurrency.cs
+++ /dev/null
@@ -1,155 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System.Reactive.Concurrency;
-using System.Threading;
-
-namespace System.Reactive.Linq
-{
- public static partial class Observable
- {
- #region + ObserveOn +
-
- /// <summary>
- /// Wraps the source sequence in order to run its observer callbacks on the specified scheduler.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence.</param>
- /// <param name="scheduler">Scheduler to notify observers on.</param>
- /// <returns>The source sequence whose observations happen on the specified scheduler.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="scheduler"/> is null.</exception>
- /// <remarks>
- /// This only invokes observer callbacks on a scheduler. In case the subscription and/or unsubscription actions have side-effects
- /// that require to be run on a scheduler, use <see cref="Observable.SubscribeOn{TSource}(IObservable{TSource}, IScheduler)"/>.
- /// </remarks>
- public static IObservable<TSource> ObserveOn<TSource>(this IObservable<TSource> source, IScheduler scheduler)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return s_impl.ObserveOn<TSource>(source, scheduler);
- }
-
-#if !NO_SYNCCTX
- /// <summary>
- /// Wraps the source sequence in order to run its observer callbacks on the specified synchronization context.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence.</param>
- /// <param name="context">Synchronization context to notify observers on.</param>
- /// <returns>The source sequence whose observations happen on the specified synchronization context.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="context"/> is null.</exception>
- /// <remarks>
- /// This only invokes observer callbacks on a synchronization context. In case the subscription and/or unsubscription actions have side-effects
- /// that require to be run on a synchronization context, use <see cref="Observable.SubscribeOn{TSource}(IObservable{TSource}, SynchronizationContext)"/>.
- /// </remarks>
- public static IObservable<TSource> ObserveOn<TSource>(this IObservable<TSource> source, SynchronizationContext context)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (context == null)
- throw new ArgumentNullException("context");
-
- return s_impl.ObserveOn<TSource>(source, context);
- }
-#endif
-
- #endregion
-
- #region + SubscribeOn +
-
- /// <summary>
- /// Wraps the source sequence in order to run its subscription and unsubscription logic on the specified scheduler. This operation is not commonly used;
- /// see the remarks section for more information on the distinction between SubscribeOn and ObserveOn.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence.</param>
- /// <param name="scheduler">Scheduler to perform subscription and unsubscription actions on.</param>
- /// <returns>The source sequence whose subscriptions and unsubscriptions happen on the specified scheduler.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="scheduler"/> is null.</exception>
- /// <remarks>
- /// This only performs the side-effects of subscription and unsubscription on the specified scheduler. In order to invoke observer
- /// callbacks on a scheduler, use <see cref="Observable.ObserveOn{TSource}(IObservable{TSource}, IScheduler)"/>.
- /// </remarks>
- public static IObservable<TSource> SubscribeOn<TSource>(this IObservable<TSource> source, IScheduler scheduler)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return s_impl.SubscribeOn<TSource>(source, scheduler);
- }
-
-#if !NO_SYNCCTX
- /// <summary>
- /// Wraps the source sequence in order to run its subscription and unsubscription logic on the specified synchronization context. This operation is not commonly used;
- /// see the remarks section for more information on the distinction between SubscribeOn and ObserveOn.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence.</param>
- /// <param name="context">Synchronization context to perform subscription and unsubscription actions on.</param>
- /// <returns>The source sequence whose subscriptions and unsubscriptions happen on the specified synchronization context.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="context"/> is null.</exception>
- /// <remarks>
- /// This only performs the side-effects of subscription and unsubscription on the specified synchronization context. In order to invoke observer
- /// callbacks on a synchronization context, use <see cref="Observable.ObserveOn{TSource}(IObservable{TSource}, SynchronizationContext)"/>.
- /// </remarks>
- public static IObservable<TSource> SubscribeOn<TSource>(this IObservable<TSource> source, SynchronizationContext context)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (context == null)
- throw new ArgumentNullException("context");
-
- return s_impl.SubscribeOn<TSource>(source, context);
- }
-#endif
-
- #endregion
-
- #region + Synchronize +
-
- /// <summary>
- /// Synchronizes the observable sequence such that observer notifications cannot be delivered concurrently.
- /// This overload is useful to "fix" an observable sequence that exhibits concurrent callbacks on individual observers, which is invalid behavior for the query processor.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence.</param>
- /// <returns>The source sequence whose outgoing calls to observers are synchronized.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <remarks>
- /// It's invalid behavior - according to the observer grammar - for a sequence to exhibit concurrent callbacks on a given observer.
- /// This operator can be used to "fix" a source that doesn't conform to this rule.
- /// </remarks>
- public static IObservable<TSource> Synchronize<TSource>(this IObservable<TSource> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return s_impl.Synchronize<TSource>(source);
- }
-
- /// <summary>
- /// Synchronizes the observable sequence such that observer notifications cannot be delivered concurrently, using the specified gate object.
- /// This overload is useful when writing n-ary query operators, in order to prevent concurrent callbacks from different sources by synchronizing on a common gate object.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence.</param>
- /// <param name="gate">Gate object to synchronize each observer call on.</param>
- /// <returns>The source sequence whose outgoing calls to observers are synchronized on the given gate object.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="gate"/> is null.</exception>
- public static IObservable<TSource> Synchronize<TSource>(this IObservable<TSource> source, object gate)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (gate == null)
- throw new ArgumentNullException("gate");
-
- return s_impl.Synchronize<TSource>(source, gate);
- }
-
- #endregion
- }
-}
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observable.Conversions.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observable.Conversions.cs
deleted file mode 100644
index d99126f..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observable.Conversions.cs
+++ /dev/null
@@ -1,164 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System.Collections.Generic;
-using System.Reactive.Concurrency;
-
-namespace System.Reactive.Linq
-{
- public static partial class Observable
- {
- #region + Subscribe +
-
- /// <summary>
- /// Subscribes an observer to an enumerable sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Enumerable sequence to subscribe to.</param>
- /// <param name="observer">Observer that will receive notifications from the enumerable sequence.</param>
- /// <returns>Disposable object that can be used to unsubscribe the observer from the enumerable</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="observer"/> is null.</exception>
- public static IDisposable Subscribe<TSource>(this IEnumerable<TSource> source, IObserver<TSource> observer)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (observer == null)
- throw new ArgumentNullException("observer");
-
- return s_impl.Subscribe<TSource>(source, observer);
- }
-
- /// <summary>
- /// Subscribes an observer to an enumerable sequence, using the specified scheduler to run the enumeration loop.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Enumerable sequence to subscribe to.</param>
- /// <param name="observer">Observer that will receive notifications from the enumerable sequence.</param>
- /// <param name="scheduler">Scheduler to perform the enumeration on.</param>
- /// <returns>Disposable object that can be used to unsubscribe the observer from the enumerable</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="observer"/> or <paramref name="scheduler"/> is null.</exception>
- public static IDisposable Subscribe<TSource>(this IEnumerable<TSource> source, IObserver<TSource> observer, IScheduler scheduler)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (observer == null)
- throw new ArgumentNullException("observer");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return s_impl.Subscribe<TSource>(source, observer, scheduler);
- }
-
- #endregion
-
- #region + ToEnumerable +
-
- /// <summary>
- /// Converts an observable sequence to an enumerable sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">An observable sequence to convert to an enumerable sequence.</param>
- /// <returns>The enumerable sequence containing the elements in the observable sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- public static IEnumerable<TSource> ToEnumerable<TSource>(this IObservable<TSource> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return s_impl.ToEnumerable<TSource>(source);
- }
-
- #endregion
-
- #region ToEvent
-
- /// <summary>
- /// Exposes an observable sequence as an object with an Action-based .NET event.
- /// </summary>
- /// <param name="source">Observable source sequence.</param>
- /// <returns>The event source object.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- public static IEventSource<Unit> ToEvent(this IObservable<Unit> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return s_impl.ToEvent(source);
- }
-
- /// <summary>
- /// Exposes an observable sequence as an object with an Action&lt;TSource&gt;-based .NET event.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Observable source sequence.</param>
- /// <returns>The event source object.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- public static IEventSource<TSource> ToEvent<TSource>(this IObservable<TSource> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return s_impl.ToEvent<TSource>(source);
- }
-
- #endregion
-
- #region ToEventPattern
-
- /// <summary>
- /// Exposes an observable sequence as an object with a .NET event, conforming to the standard .NET event pattern.
- /// </summary>
- /// <typeparam name="TEventArgs">The type of the event data generated by the event.</typeparam>
- /// <param name="source">Observable source sequence.</param>
- /// <returns>The event source object.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- public static IEventPatternSource<TEventArgs> ToEventPattern<TEventArgs>(this IObservable<EventPattern<TEventArgs>> source)
-#if !NO_EVENTARGS_CONSTRAINT
- where TEventArgs : EventArgs
-#endif
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return s_impl.ToEventPattern<TEventArgs>(source);
- }
-
- #endregion
-
- #region + ToObservable +
-
- /// <summary>
- /// Converts an enumerable sequence to an observable sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Enumerable sequence to convert to an observable sequence.</param>
- /// <returns>The observable sequence whose elements are pulled from the given enumerable sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- public static IObservable<TSource> ToObservable<TSource>(this IEnumerable<TSource> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return s_impl.ToObservable<TSource>(source);
- }
-
- /// <summary>
- /// Converts an enumerable sequence to an observable sequence, using the specified scheduler to run the enumeration loop.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Enumerable sequence to convert to an observable sequence.</param>
- /// <param name="scheduler">Scheduler to run the enumeration of the input sequence on.</param>
- /// <returns>The observable sequence whose elements are pulled from the given enumerable sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="scheduler"/> is null.</exception>
- public static IObservable<TSource> ToObservable<TSource>(this IEnumerable<TSource> source, IScheduler scheduler)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return s_impl.ToObservable<TSource>(source, scheduler);
- }
-
- #endregion
- }
-}
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observable.Creation.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observable.Creation.cs
deleted file mode 100644
index 3de4a43..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observable.Creation.cs
+++ /dev/null
@@ -1,624 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System.Collections.Generic;
-using System.Reactive.Concurrency;
-using System.Threading;
-
-#if !NO_TPL
-using System.Threading.Tasks;
-#endif
-
-namespace System.Reactive.Linq
-{
- public static partial class Observable
- {
- #region - Create -
-
- /// <summary>
- /// Creates an observable sequence from a specified Subscribe method implementation.
- /// </summary>
- /// <typeparam name="TResult">The type of the elements in the produced sequence.</typeparam>
- /// <param name="subscribe">Implementation of the resulting observable sequence's Subscribe method.</param>
- /// <returns>The observable sequence with the specified implementation for the Subscribe method.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="subscribe"/> is null.</exception>
- /// <remarks>
- /// Use of this operator is preferred over manual implementation of the IObservable&lt;T&gt; interface. In case
- /// you need a type implementing IObservable&lt;T&gt; rather than an anonymous implementation, consider using
- /// the <see cref="System.Reactive.ObservableBase&lt;T&gt;"/> abstract base class.
- /// </remarks>
- public static IObservable<TResult> Create<TResult>(Func<IObserver<TResult>, IDisposable> subscribe)
- {
- if (subscribe == null)
- throw new ArgumentNullException("subscribe");
-
- return s_impl.Create<TResult>(subscribe);
- }
-
- /// <summary>
- /// Creates an observable sequence from a specified Subscribe method implementation.
- /// </summary>
- /// <typeparam name="TResult">The type of the elements in the produced sequence.</typeparam>
- /// <param name="subscribe">Implementation of the resulting observable sequence's Subscribe method, returning an Action delegate that will be wrapped in an IDisposable.</param>
- /// <returns>The observable sequence with the specified implementation for the Subscribe method.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="subscribe"/> is null.</exception>
- /// <remarks>
- /// Use of this operator is preferred over manual implementation of the IObservable&lt;T&gt; interface. In case
- /// you need a type implementing IObservable&lt;T&gt; rather than an anonymous implementation, consider using
- /// the <see cref="System.Reactive.ObservableBase&lt;T&gt;"/> abstract base class.
- /// </remarks>
- public static IObservable<TResult> Create<TResult>(Func<IObserver<TResult>, Action> subscribe)
- {
- if (subscribe == null)
- throw new ArgumentNullException("subscribe");
-
- return s_impl.Create<TResult>(subscribe);
- }
-
- #endregion
-
- #region - CreateAsync -
-
-#if !NO_TPL
- /// <summary>
- /// Creates an observable sequence from a specified cancellable asynchronous Subscribe method.
- /// The CancellationToken passed to the asynchronous Subscribe method is tied to the returned disposable subscription, allowing best-effort cancellation.
- /// </summary>
- /// <typeparam name="TResult">The type of the elements in the produced sequence.</typeparam>
- /// <param name="subscribeAsync">Asynchronous method used to produce elements.</param>
- /// <returns>The observable sequence surfacing the elements produced by the asynchronous method.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="subscribeAsync"/> is null.</exception>
- /// <remarks>This operator is especially useful in conjunction with the asynchronous programming features introduced in C# 5.0 and Visual Basic 11.</remarks>
- /// <remarks>When a subscription to the resulting sequence is disposed, the CancellationToken that was fed to the asynchronous subscribe function will be signaled.</remarks>
- public static IObservable<TResult> Create<TResult>(Func<IObserver<TResult>, CancellationToken, Task> subscribeAsync)
- {
- if (subscribeAsync == null)
- throw new ArgumentNullException("subscribeAsync");
-
- return s_impl.Create<TResult>(subscribeAsync);
- }
-
- /// <summary>
- /// Creates an observable sequence from a specified asynchronous Subscribe method.
- /// </summary>
- /// <typeparam name="TResult">The type of the elements in the produced sequence.</typeparam>
- /// <param name="subscribeAsync">Asynchronous method used to produce elements.</param>
- /// <returns>The observable sequence surfacing the elements produced by the asynchronous method.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="subscribeAsync"/> is null.</exception>
- /// <remarks>This operator is especially useful in conjunction with the asynchronous programming features introduced in C# 5.0 and Visual Basic 11.</remarks>
- public static IObservable<TResult> Create<TResult>(Func<IObserver<TResult>, Task> subscribeAsync)
- {
- if (subscribeAsync == null)
- throw new ArgumentNullException("subscribeAsync");
-
- return s_impl.Create<TResult>(subscribeAsync);
- }
-
- /// <summary>
- /// Creates an observable sequence from a specified cancellable asynchronous Subscribe method.
- /// The CancellationToken passed to the asynchronous Subscribe method is tied to the returned disposable subscription, allowing best-effort cancellation.
- /// </summary>
- /// <typeparam name="TResult">The type of the elements in the produced sequence.</typeparam>
- /// <param name="subscribeAsync">Asynchronous method used to implemented the resulting sequence's Subscribe method.</param>
- /// <returns>The observable sequence with the specified implementation for the Subscribe method.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="subscribeAsync"/> is null.</exception>
- /// <remarks>This operator is especially useful in conjunction with the asynchronous programming features introduced in C# 5.0 and Visual Basic 11.</remarks>
- /// <remarks>When a subscription to the resulting sequence is disposed, the CancellationToken that was fed to the asynchronous subscribe function will be signaled.</remarks>
- public static IObservable<TResult> Create<TResult>(Func<IObserver<TResult>, CancellationToken, Task<IDisposable>> subscribeAsync)
- {
- if (subscribeAsync == null)
- throw new ArgumentNullException("subscribeAsync");
-
- return s_impl.Create<TResult>(subscribeAsync);
- }
-
- /// <summary>
- /// Creates an observable sequence from a specified asynchronous Subscribe method.
- /// </summary>
- /// <typeparam name="TResult">The type of the elements in the produced sequence.</typeparam>
- /// <param name="subscribeAsync">Asynchronous method used to implemented the resulting sequence's Subscribe method.</param>
- /// <returns>The observable sequence with the specified implementation for the Subscribe method.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="subscribeAsync"/> is null.</exception>
- /// <remarks>This operator is especially useful in conjunction with the asynchronous programming features introduced in C# 5.0 and Visual Basic 11.</remarks>
- public static IObservable<TResult> Create<TResult>(Func<IObserver<TResult>, Task<IDisposable>> subscribeAsync)
- {
- if (subscribeAsync == null)
- throw new ArgumentNullException("subscribeAsync");
-
- return s_impl.Create<TResult>(subscribeAsync);
- }
-
- /// <summary>
- /// Creates an observable sequence from a specified cancellable asynchronous Subscribe method.
- /// The CancellationToken passed to the asynchronous Subscribe method is tied to the returned disposable subscription, allowing best-effort cancellation.
- /// </summary>
- /// <typeparam name="TResult">The type of the elements in the produced sequence.</typeparam>
- /// <param name="subscribeAsync">Asynchronous method used to implemented the resulting sequence's Subscribe method, returning an Action delegate that will be wrapped in an IDisposable.</param>
- /// <returns>The observable sequence with the specified implementation for the Subscribe method.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="subscribeAsync"/> is null.</exception>
- /// <remarks>This operator is especially useful in conjunction with the asynchronous programming features introduced in C# 5.0 and Visual Basic 11.</remarks>
- /// <remarks>When a subscription to the resulting sequence is disposed, the CancellationToken that was fed to the asynchronous subscribe function will be signaled.</remarks>
- public static IObservable<TResult> Create<TResult>(Func<IObserver<TResult>, CancellationToken, Task<Action>> subscribeAsync)
- {
- if (subscribeAsync == null)
- throw new ArgumentNullException("subscribeAsync");
-
- return s_impl.Create<TResult>(subscribeAsync);
- }
-
- /// <summary>
- /// Creates an observable sequence from a specified asynchronous Subscribe method.
- /// </summary>
- /// <typeparam name="TResult">The type of the elements in the produced sequence.</typeparam>
- /// <param name="subscribeAsync">Asynchronous method used to implemented the resulting sequence's Subscribe method, returning an Action delegate that will be wrapped in an IDisposable.</param>
- /// <returns>The observable sequence with the specified implementation for the Subscribe method.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="subscribeAsync"/> is null.</exception>
- /// <remarks>This operator is especially useful in conjunction with the asynchronous programming features introduced in C# 5.0 and Visual Basic 11.</remarks>
- public static IObservable<TResult> Create<TResult>(Func<IObserver<TResult>, Task<Action>> subscribeAsync)
- {
- if (subscribeAsync == null)
- throw new ArgumentNullException("subscribeAsync");
-
- return s_impl.Create<TResult>(subscribeAsync);
- }
-#endif
-
- #endregion
-
- #region + Defer +
-
- /// <summary>
- /// Returns an observable sequence that invokes the specified factory function whenever a new observer subscribes.
- /// </summary>
- /// <typeparam name="TResult">The type of the elements in the sequence returned by the factory function, and in the resulting sequence.</typeparam>
- /// <param name="observableFactory">Observable factory function to invoke for each observer that subscribes to the resulting sequence.</param>
- /// <returns>An observable sequence whose observers trigger an invocation of the given observable factory function.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="observableFactory"/> is null.</exception>
- public static IObservable<TResult> Defer<TResult>(Func<IObservable<TResult>> observableFactory)
- {
- if (observableFactory == null)
- throw new ArgumentNullException("observableFactory");
-
- return s_impl.Defer<TResult>(observableFactory);
- }
-
- #endregion
-
- #region + DeferAsync +
-
-#if !NO_TPL
- /// <summary>
- /// Returns an observable sequence that starts the specified asynchronous factory function whenever a new observer subscribes.
- /// </summary>
- /// <typeparam name="TResult">The type of the elements in the sequence returned by the factory function, and in the resulting sequence.</typeparam>
- /// <param name="observableFactoryAsync">Asynchronous factory function to start for each observer that subscribes to the resulting sequence.</param>
- /// <returns>An observable sequence whose observers trigger the given asynchronous observable factory function to be started.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="observableFactoryAsync"/> is null.</exception>
- /// <remarks>This operator is especially useful in conjunction with the asynchronous programming features introduced in C# 5.0 and Visual Basic 11.</remarks>
- public static IObservable<TResult> Defer<TResult>(Func<Task<IObservable<TResult>>> observableFactoryAsync)
- {
- if (observableFactoryAsync == null)
- throw new ArgumentNullException("observableFactoryAsync");
-
- return s_impl.Defer<TResult>(observableFactoryAsync);
- }
-
- /// <summary>
- /// Returns an observable sequence that starts the specified cancellable asynchronous factory function whenever a new observer subscribes.
- /// The CancellationToken passed to the asynchronous factory function is tied to the returned disposable subscription, allowing best-effort cancellation.
- /// </summary>
- /// <typeparam name="TResult">The type of the elements in the sequence returned by the factory function, and in the resulting sequence.</typeparam>
- /// <param name="observableFactoryAsync">Asynchronous factory function to start for each observer that subscribes to the resulting sequence.</param>
- /// <returns>An observable sequence whose observers trigger the given asynchronous observable factory function to be started.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="observableFactoryAsync"/> is null.</exception>
- /// <remarks>This operator is especially useful in conjunction with the asynchronous programming features introduced in C# 5.0 and Visual Basic 11.</remarks>
- /// <remarks>When a subscription to the resulting sequence is disposed, the CancellationToken that was fed to the asynchronous observable factory function will be signaled.</remarks>
- public static IObservable<TResult> DeferAsync<TResult>(Func<CancellationToken, Task<IObservable<TResult>>> observableFactoryAsync)
- {
- if (observableFactoryAsync == null)
- throw new ArgumentNullException("observableFactoryAsync");
-
- return s_impl.Defer<TResult>(observableFactoryAsync);
- }
-#endif
-
- #endregion
-
- #region + Empty +
-
- /// <summary>
- /// Returns an empty observable sequence.
- /// </summary>
- /// <typeparam name="TResult">The type used for the IObservable&lt;T&gt; type parameter of the resulting sequence.</typeparam>
- /// <returns>An observable sequence with no elements.</returns>
- public static IObservable<TResult> Empty<TResult>()
- {
- return s_impl.Empty<TResult>();
- }
-
- /// <summary>
- /// Returns an empty observable sequence.
- /// </summary>
- /// <typeparam name="TResult">The type used for the IObservable&lt;T&gt; type parameter of the resulting sequence.</typeparam>
- /// <param name="witness">Object solely used to infer the type of the <typeparamref name="TResult"/> type parameter. This parameter is typically used when creating a sequence of anonymously typed elements.</param>
- /// <returns>An observable sequence with no elements.</returns>
- public static IObservable<TResult> Empty<TResult>(TResult witness)
- {
- return s_impl.Empty<TResult>(); // Pure inference - no specialized target method.
- }
-
- /// <summary>
- /// Returns an empty observable sequence, using the specified scheduler to send out the single OnCompleted message.
- /// </summary>
- /// <typeparam name="TResult">The type used for the IObservable&lt;T&gt; type parameter of the resulting sequence.</typeparam>
- /// <param name="scheduler">Scheduler to send the termination call on.</param>
- /// <returns>An observable sequence with no elements.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="scheduler"/> is null.</exception>
- public static IObservable<TResult> Empty<TResult>(IScheduler scheduler)
- {
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return s_impl.Empty<TResult>(scheduler);
- }
-
- /// <summary>
- /// Returns an empty observable sequence, using the specified scheduler to send out the single OnCompleted message.
- /// </summary>
- /// <typeparam name="TResult">The type used for the IObservable&lt;T&gt; type parameter of the resulting sequence.</typeparam>
- /// <param name="scheduler">Scheduler to send the termination call on.</param>
- /// <param name="witness">Object solely used to infer the type of the <typeparamref name="TResult"/> type parameter. This parameter is typically used when creating a sequence of anonymously typed elements.</param>
- /// <returns>An observable sequence with no elements.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="scheduler"/> is null.</exception>
- public static IObservable<TResult> Empty<TResult>(IScheduler scheduler, TResult witness)
- {
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return s_impl.Empty<TResult>(scheduler); // Pure inference - no specialized target method.
- }
-
- #endregion
-
- #region + Generate +
-
- /// <summary>
- /// Generates an observable sequence by running a state-driven loop producing the sequence's elements.
- /// </summary>
- /// <typeparam name="TState">The type of the state used in the generator loop.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the produced sequence.</typeparam>
- /// <param name="initialState">Initial state.</param>
- /// <param name="condition">Condition to terminate generation (upon returning false).</param>
- /// <param name="iterate">Iteration step function.</param>
- /// <param name="resultSelector">Selector function for results produced in the sequence.</param>
- /// <returns>The generated sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="condition"/> or <paramref name="iterate"/> or <paramref name="resultSelector"/> is null.</exception>
- public static IObservable<TResult> Generate<TState, TResult>(TState initialState, Func<TState, bool> condition, Func<TState, TState> iterate, Func<TState, TResult> resultSelector)
- {
- if (condition == null)
- throw new ArgumentNullException("condition");
- if (iterate == null)
- throw new ArgumentNullException("iterate");
- if (resultSelector == null)
- throw new ArgumentNullException("resultSelector");
-
- return s_impl.Generate<TState, TResult>(initialState, condition, iterate, resultSelector);
- }
-
- /// <summary>
- /// Generates an observable sequence by running a state-driven loop producing the sequence's elements, using the specified scheduler to send out observer messages.
- /// </summary>
- /// <typeparam name="TState">The type of the state used in the generator loop.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the produced sequence.</typeparam>
- /// <param name="initialState">Initial state.</param>
- /// <param name="condition">Condition to terminate generation (upon returning false).</param>
- /// <param name="iterate">Iteration step function.</param>
- /// <param name="resultSelector">Selector function for results produced in the sequence.</param>
- /// <param name="scheduler">Scheduler on which to run the generator loop.</param>
- /// <returns>The generated sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="condition"/> or <paramref name="iterate"/> or <paramref name="resultSelector"/> or <paramref name="scheduler"/> is null.</exception>
- public static IObservable<TResult> Generate<TState, TResult>(TState initialState, Func<TState, bool> condition, Func<TState, TState> iterate, Func<TState, TResult> resultSelector, IScheduler scheduler)
- {
- if (condition == null)
- throw new ArgumentNullException("condition");
- if (iterate == null)
- throw new ArgumentNullException("iterate");
- if (resultSelector == null)
- throw new ArgumentNullException("resultSelector");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return s_impl.Generate<TState, TResult>(initialState, condition, iterate, resultSelector, scheduler);
- }
-
- #endregion
-
- #region + Never +
-
- /// <summary>
- /// Returns a non-terminating observable sequence, which can be used to denote an infinite duration (e.g. when using reactive joins).
- /// </summary>
- /// <typeparam name="TResult">The type used for the IObservable&lt;T&gt; type parameter of the resulting sequence.</typeparam>
- /// <returns>An observable sequence whose observers will never get called.</returns>
- public static IObservable<TResult> Never<TResult>()
- {
- return s_impl.Never<TResult>();
- }
-
- /// <summary>
- /// Returns a non-terminating observable sequence, which can be used to denote an infinite duration (e.g. when using reactive joins).
- /// </summary>
- /// <typeparam name="TResult">The type used for the IObservable&lt;T&gt; type parameter of the resulting sequence.</typeparam>
- /// <param name="witness">Object solely used to infer the type of the <typeparamref name="TResult"/> type parameter. This parameter is typically used when creating a sequence of anonymously typed elements.</param>
- /// <returns>An observable sequence whose observers will never get called.</returns>
- public static IObservable<TResult> Never<TResult>(TResult witness)
- {
- return s_impl.Never<TResult>(); // Pure inference - no specialized target method.
- }
-
- #endregion
-
- #region + Range +
-
- /// <summary>
- /// Generates an observable sequence of integral numbers within a specified range.
- /// </summary>
- /// <param name="start">The value of the first integer in the sequence.</param>
- /// <param name="count">The number of sequential integers to generate.</param>
- /// <returns>An observable sequence that contains a range of sequential integral numbers.</returns>
- /// <exception cref="ArgumentOutOfRangeException"><paramref name="count"/> is less than zero. -or- <paramref name="start"/> + <paramref name="count"/> - 1 is larger than <see cref="M:System.Int32.MaxValue"/>.</exception>
- public static IObservable<int> Range(int start, int count)
- {
- var max = ((long)start) + count - 1;
- if (count < 0 || max > int.MaxValue)
- throw new ArgumentOutOfRangeException("count");
-
- return s_impl.Range(start, count);
- }
-
- /// <summary>
- /// Generates an observable sequence of integral numbers within a specified range, using the specified scheduler to send out observer messages.
- /// </summary>
- /// <param name="start">The value of the first integer in the sequence.</param>
- /// <param name="count">The number of sequential integers to generate.</param>
- /// <param name="scheduler">Scheduler to run the generator loop on.</param>
- /// <returns>An observable sequence that contains a range of sequential integral numbers.</returns>
- /// <exception cref="ArgumentOutOfRangeException"><paramref name="count"/> is less than zero. -or- <paramref name="start"/> + <paramref name="count"/> - 1 is larger than <see cref="M:System.Int32.MaxValue"/>.</exception>
- /// <exception cref="ArgumentNullException"><paramref name="scheduler"/> is null.</exception>
- public static IObservable<int> Range(int start, int count, IScheduler scheduler)
- {
- var max = ((long)start) + count - 1;
- if (count < 0 || max > int.MaxValue)
- throw new ArgumentOutOfRangeException("count");
-
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return s_impl.Range(start, count, scheduler);
- }
-
- #endregion
-
- #region + Repeat +
-
- /// <summary>
- /// Generates an observable sequence that repeats the given element infinitely.
- /// </summary>
- /// <typeparam name="TResult">The type of the element that will be repeated in the produced sequence.</typeparam>
- /// <param name="value">Element to repeat.</param>
- /// <returns>An observable sequence that repeats the given element infinitely.</returns>
- public static IObservable<TResult> Repeat<TResult>(TResult value)
- {
- return s_impl.Repeat<TResult>(value);
- }
-
- /// <summary>
- /// Generates an observable sequence that repeats the given element infinitely, using the specified scheduler to send out observer messages.
- /// </summary>
- /// <typeparam name="TResult">The type of the element that will be repeated in the produced sequence.</typeparam>
- /// <param name="value">Element to repeat.</param>
- /// <param name="scheduler">Scheduler to run the producer loop on.</param>
- /// <returns>An observable sequence that repeats the given element infinitely.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="scheduler"/> is null.</exception>
- public static IObservable<TResult> Repeat<TResult>(TResult value, IScheduler scheduler)
- {
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return s_impl.Repeat<TResult>(value, scheduler);
- }
-
- /// <summary>
- /// Generates an observable sequence that repeats the given element the specified number of times.
- /// </summary>
- /// <typeparam name="TResult">The type of the element that will be repeated in the produced sequence.</typeparam>
- /// <param name="value">Element to repeat.</param>
- /// <param name="repeatCount">Number of times to repeat the element.</param>
- /// <returns>An observable sequence that repeats the given element the specified number of times.</returns>
- /// <exception cref="ArgumentOutOfRangeException"><paramref name="repeatCount"/> is less than zero.</exception>
- public static IObservable<TResult> Repeat<TResult>(TResult value, int repeatCount)
- {
- if (repeatCount < 0)
- throw new ArgumentOutOfRangeException("repeatCount");
-
- return s_impl.Repeat<TResult>(value, repeatCount);
- }
-
- /// <summary>
- /// Generates an observable sequence that repeats the given element the specified number of times, using the specified scheduler to send out observer messages.
- /// </summary>
- /// <typeparam name="TResult">The type of the element that will be repeated in the produced sequence.</typeparam>
- /// <param name="value">Element to repeat.</param>
- /// <param name="repeatCount">Number of times to repeat the element.</param>
- /// <param name="scheduler">Scheduler to run the producer loop on.</param>
- /// <returns>An observable sequence that repeats the given element the specified number of times.</returns>
- /// <exception cref="ArgumentOutOfRangeException"><paramref name="repeatCount"/> is less than zero.</exception>
- /// <exception cref="ArgumentNullException"><paramref name="scheduler"/> is null.</exception>
- public static IObservable<TResult> Repeat<TResult>(TResult value, int repeatCount, IScheduler scheduler)
- {
- if (repeatCount < 0)
- throw new ArgumentOutOfRangeException("repeatCount");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return s_impl.Repeat<TResult>(value, repeatCount, scheduler);
- }
-
- #endregion
-
- #region + Return +
-
- /// <summary>
- /// Returns an observable sequence that contains a single element.
- /// </summary>
- /// <typeparam name="TResult">The type of the element that will be returned in the produced sequence.</typeparam>
- /// <param name="value">Single element in the resulting observable sequence.</param>
- /// <returns>An observable sequence containing the single specified element.</returns>
- public static IObservable<TResult> Return<TResult>(TResult value)
- {
- return s_impl.Return<TResult>(value);
- }
-
- /// <summary>
- /// Returns an observable sequence that contains a single element, using the specified scheduler to send out observer messages.
- /// </summary>
- /// <typeparam name="TResult">The type of the element that will be returned in the produced sequence.</typeparam>
- /// <param name="value">Single element in the resulting observable sequence.</param>
- /// <param name="scheduler">Scheduler to send the single element on.</param>
- /// <returns>An observable sequence containing the single specified element.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="scheduler"/> is null.</exception>
- public static IObservable<TResult> Return<TResult>(TResult value, IScheduler scheduler)
- {
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return s_impl.Return<TResult>(value, scheduler);
- }
-
- #endregion
-
- #region + Throw +
-
- /// <summary>
- /// Returns an observable sequence that terminates with an exception.
- /// </summary>
- /// <typeparam name="TResult">The type used for the IObservable&lt;T&gt; type parameter of the resulting sequence.</typeparam>
- /// <param name="exception">Exception object used for the sequence's termination.</param>
- /// <returns>The observable sequence that terminates exceptionally with the specified exception object.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="exception"/> is null.</exception>
- public static IObservable<TResult> Throw<TResult>(Exception exception)
- {
- if (exception == null)
- throw new ArgumentNullException("exception");
-
- return s_impl.Throw<TResult>(exception);
- }
-
- /// <summary>
- /// Returns an observable sequence that terminates with an exception.
- /// </summary>
- /// <typeparam name="TResult">The type used for the IObservable&lt;T&gt; type parameter of the resulting sequence.</typeparam>
- /// <param name="exception">Exception object used for the sequence's termination.</param>
- /// <param name="witness">Object solely used to infer the type of the <typeparamref name="TResult"/> type parameter. This parameter is typically used when creating a sequence of anonymously typed elements.</param>
- /// <returns>The observable sequence that terminates exceptionally with the specified exception object.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="exception"/> is null.</exception>
- public static IObservable<TResult> Throw<TResult>(Exception exception, TResult witness)
- {
- if (exception == null)
- throw new ArgumentNullException("exception");
-
- return s_impl.Throw<TResult>(exception); // Pure inference - no specialized target method.
- }
-
- /// <summary>
- /// Returns an observable sequence that terminates with an exception, using the specified scheduler to send out the single OnError message.
- /// </summary>
- /// <typeparam name="TResult">The type used for the IObservable&lt;T&gt; type parameter of the resulting sequence.</typeparam>
- /// <param name="exception">Exception object used for the sequence's termination.</param>
- /// <param name="scheduler">Scheduler to send the exceptional termination call on.</param>
- /// <returns>The observable sequence that terminates exceptionally with the specified exception object.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="exception"/> or <paramref name="scheduler"/> is null.</exception>
- public static IObservable<TResult> Throw<TResult>(Exception exception, IScheduler scheduler)
- {
- if (exception == null)
- throw new ArgumentNullException("exception");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return s_impl.Throw<TResult>(exception, scheduler);
- }
-
- /// <summary>
- /// Returns an observable sequence that terminates with an exception, using the specified scheduler to send out the single OnError message.
- /// </summary>
- /// <typeparam name="TResult">The type used for the IObservable&lt;T&gt; type parameter of the resulting sequence.</typeparam>
- /// <param name="exception">Exception object used for the sequence's termination.</param>
- /// <param name="scheduler">Scheduler to send the exceptional termination call on.</param>
- /// <param name="witness">Object solely used to infer the type of the <typeparamref name="TResult"/> type parameter. This parameter is typically used when creating a sequence of anonymously typed elements.</param>
- /// <returns>The observable sequence that terminates exceptionally with the specified exception object.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="exception"/> or <paramref name="scheduler"/> is null.</exception>
- public static IObservable<TResult> Throw<TResult>(Exception exception, IScheduler scheduler, TResult witness)
- {
- if (exception == null)
- throw new ArgumentNullException("exception");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return s_impl.Throw<TResult>(exception, scheduler); // Pure inference - no specialized target method.
- }
-
- #endregion
-
- #region + Using +
-
- /// <summary>
- /// Constructs an observable sequence that depends on a resource object, whose lifetime is tied to the resulting observable sequence's lifetime.
- /// </summary>
- /// <typeparam name="TResult">The type of the elements in the produced sequence.</typeparam>
- /// <typeparam name="TResource">The type of the resource used during the generation of the resulting sequence. Needs to implement <see cref="System.IDisposable"/>.</typeparam>
- /// <param name="resourceFactory">Factory function to obtain a resource object.</param>
- /// <param name="observableFactory">Factory function to obtain an observable sequence that depends on the obtained resource.</param>
- /// <returns>An observable sequence whose lifetime controls the lifetime of the dependent resource object.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="resourceFactory"/> or <paramref name="observableFactory"/> is null.</exception>
- public static IObservable<TResult> Using<TResult, TResource>(Func<TResource> resourceFactory, Func<TResource, IObservable<TResult>> observableFactory) where TResource : IDisposable
- {
- if (resourceFactory == null)
- throw new ArgumentNullException("resourceFactory");
- if (observableFactory == null)
- throw new ArgumentNullException("observableFactory");
-
- return s_impl.Using<TResult, TResource>(resourceFactory, observableFactory);
- }
-
- #endregion
-
- #region - UsingAsync -
-
-#if !NO_TPL
-
- /// <summary>
- /// Constructs an observable sequence that depends on a resource object, whose lifetime is tied to the resulting observable sequence's lifetime. The resource is obtained and used through asynchronous methods.
- /// The CancellationToken passed to the asynchronous methods is tied to the returned disposable subscription, allowing best-effort cancellation at any stage of the resource acquisition or usage.
- /// </summary>
- /// <typeparam name="TResult">The type of the elements in the produced sequence.</typeparam>
- /// <typeparam name="TResource">The type of the resource used during the generation of the resulting sequence. Needs to implement <see cref="System.IDisposable"/>.</typeparam>
- /// <param name="resourceFactoryAsync">Asynchronous factory function to obtain a resource object.</param>
- /// <param name="observableFactoryAsync">Asynchronous factory function to obtain an observable sequence that depends on the obtained resource.</param>
- /// <returns>An observable sequence whose lifetime controls the lifetime of the dependent resource object.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="resourceFactoryAsync"/> or <paramref name="observableFactoryAsync"/> is null.</exception>
- /// <remarks>This operator is especially useful in conjunction with the asynchronous programming features introduced in C# 5.0 and Visual Basic 11.</remarks>
- /// <remarks>When a subscription to the resulting sequence is disposed, the CancellationToken that was fed to the asynchronous resource factory and observable factory functions will be signaled.</remarks>
- public static IObservable<TResult> Using<TResult, TResource>(Func<CancellationToken, Task<TResource>> resourceFactoryAsync, Func<TResource, CancellationToken, Task<IObservable<TResult>>> observableFactoryAsync) where TResource : IDisposable
- {
- if (resourceFactoryAsync == null)
- throw new ArgumentNullException("resourceFactoryAsync");
- if (observableFactoryAsync == null)
- throw new ArgumentNullException("observableFactoryAsync");
-
- return s_impl.Using<TResult, TResource>(resourceFactoryAsync, observableFactoryAsync);
- }
-
-#endif
-
- #endregion
- }
-}
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observable.Events.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observable.Events.cs
deleted file mode 100644
index 9bb3026..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observable.Events.cs
+++ /dev/null
@@ -1,1403 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System.Reactive.Concurrency;
-using System.Threading;
-
-namespace System.Reactive.Linq
-{
- public static partial class Observable
- {
- #region + FromEventPattern +
-
- #region Strongly typed
-
- #region Action<EventHandler>
-
- /// <summary>
- /// Converts a .NET event, conforming to the standard .NET event pattern based on <see cref="EventHandler"/>, to an observable sequence.
- /// Each event invocation is surfaced through an OnNext message in the resulting sequence.
- /// For conversion of events that don't conform to the standard .NET event pattern, use any of the FromEvent overloads instead.
- /// </summary>
- /// <param name="addHandler">Action that attaches the given event handler to the underlying .NET event.</param>
- /// <param name="removeHandler">Action that detaches the given event handler from the underlying .NET event.</param>
- /// <returns>The observable sequence that contains data representations of invocations of the underlying .NET event.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="addHandler"/> or <paramref name="removeHandler"/> is null.</exception>
- /// <remarks>
- /// <para>
- /// Add and remove handler invocations are made whenever the number of observers grows beyond zero.
- /// As such, an event handler may be shared by multiple simultaneously active observers, using a subject for multicasting.
- /// </para>
- /// <para>
- /// The current <see cref="SynchronizationContext"/> is captured during the call to FromEventPattern, and is used to post add and remove handler invocations.
- /// This behavior ensures add and remove handler operations for thread-affine events are accessed from the same context, as required by some UI frameworks.
- /// </para>
- /// <para>
- /// If no SynchronizationContext is present at the point of calling FromEventPattern, add and remove handler invocations are made synchronously on the thread
- /// making the Subscribe or Dispose call, respectively.
- /// </para>
- /// <para>
- /// It's recommended to lift FromEventPattern calls outside event stream query expressions due to the free-threaded nature of Reactive Extensions. Doing so
- /// makes the captured SynchronizationContext predictable. This best practice also reduces clutter of bridging code inside queries, making the query expressions
- /// more concise and easier to understand.
- /// </para>
- /// </remarks>
- /// <seealso cref="Observable.ToEventPattern"/>
-#if !NO_EVENTARGS_CONSTRAINT
- public static IObservable<EventPattern<EventArgs>> FromEventPattern(Action<EventHandler> addHandler, Action<EventHandler> removeHandler)
- {
- if (addHandler == null)
- throw new ArgumentNullException("addHandler");
- if (removeHandler == null)
- throw new ArgumentNullException("removeHandler");
-
- return s_impl.FromEventPattern(addHandler, removeHandler);
- }
-#else
- public static IObservable<EventPattern<object>> FromEventPattern(Action<EventHandler> addHandler, Action<EventHandler> removeHandler)
- {
- if (addHandler == null)
- throw new ArgumentNullException("addHandler");
- if (removeHandler == null)
- throw new ArgumentNullException("removeHandler");
-
- return s_impl.FromEventPattern(addHandler, removeHandler);
- }
-#endif
-
- /// <summary>
- /// Converts a .NET event, conforming to the standard .NET event pattern based on <see cref="EventHandler"/>, to an observable sequence.
- /// Each event invocation is surfaced through an OnNext message in the resulting sequence.
- /// For conversion of events that don't conform to the standard .NET event pattern, use any of the FromEvent overloads instead.
- /// </summary>
- /// <param name="addHandler">Action that attaches the given event handler to the underlying .NET event.</param>
- /// <param name="removeHandler">Action that detaches the given event handler from the underlying .NET event.</param>
- /// <param name="scheduler">The scheduler to run the add and remove event handler logic on.</param>
- /// <returns>The observable sequence that contains data representations of invocations of the underlying .NET event.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="addHandler"/> or <paramref name="removeHandler"/> or <paramref name="scheduler"/> is null.</exception>
- /// <remarks>
- /// <para>
- /// Add and remove handler invocations are made whenever the number of observers grows beyond zero.
- /// As such, an event handler may be shared by multiple simultaneously active observers, using a subject for multicasting.
- /// </para>
- /// <para>
- /// Add and remove handler invocations are run on the specified scheduler. This behavior allows add and remove handler operations for thread-affine events to be
- /// accessed from the same context, as required by some UI frameworks.
- /// </para>
- /// <para>
- /// It's recommended to lift FromEventPattern calls outside event stream query expressions. This best practice reduces clutter of bridging code inside queries,
- /// making the query expressions more concise and easier to understand. This has additional benefits for overloads of FromEventPattern that omit the IScheduler
- /// parameter. For more information, see the remarks section on those overloads.
- /// </para>
- /// </remarks>
- /// <seealso cref="Observable.ToEventPattern"/>
-#if !NO_EVENTARGS_CONSTRAINT
- public static IObservable<EventPattern<EventArgs>> FromEventPattern(Action<EventHandler> addHandler, Action<EventHandler> removeHandler, IScheduler scheduler)
- {
- if (addHandler == null)
- throw new ArgumentNullException("addHandler");
- if (removeHandler == null)
- throw new ArgumentNullException("removeHandler");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return s_impl.FromEventPattern(addHandler, removeHandler, scheduler);
- }
-#else
- public static IObservable<EventPattern<object>> FromEventPattern(Action<EventHandler> addHandler, Action<EventHandler> removeHandler, IScheduler scheduler)
- {
- if (addHandler == null)
- throw new ArgumentNullException("addHandler");
- if (removeHandler == null)
- throw new ArgumentNullException("removeHandler");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return s_impl.FromEventPattern(addHandler, removeHandler, scheduler);
- }
-#endif
-
- #endregion
-
- #region Action<TDelegate>
-
- /// <summary>
- /// Converts a .NET event, conforming to the standard .NET event pattern based on a supplied event delegate type, to an observable sequence.
- /// Each event invocation is surfaced through an OnNext message in the resulting sequence.
- /// For conversion of events that don't conform to the standard .NET event pattern, use any of the FromEvent overloads instead.
- /// </summary>
- /// <typeparam name="TDelegate">The delegate type of the event to be converted.</typeparam>
- /// <typeparam name="TEventArgs">The type of the event data generated by the event.</typeparam>
- /// <param name="addHandler">Action that attaches the given event handler to the underlying .NET event.</param>
- /// <param name="removeHandler">Action that detaches the given event handler from the underlying .NET event.</param>
- /// <returns>The observable sequence that contains data representations of invocations of the underlying .NET event.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="addHandler"/> or <paramref name="removeHandler"/> is null.</exception>
- /// <remarks>
- /// <para>
- /// Add and remove handler invocations are made whenever the number of observers grows beyond zero.
- /// As such, an event handler may be shared by multiple simultaneously active observers, using a subject for multicasting.
- /// </para>
- /// <para>
- /// The current <see cref="SynchronizationContext"/> is captured during the call to FromEventPattern, and is used to post add and remove handler invocations.
- /// This behavior ensures add and remove handler operations for thread-affine events are accessed from the same context, as required by some UI frameworks.
- /// </para>
- /// <para>
- /// If no SynchronizationContext is present at the point of calling FromEventPattern, add and remove handler invocations are made synchronously on the thread
- /// making the Subscribe or Dispose call, respectively.
- /// </para>
- /// <para>
- /// It's recommended to lift FromEventPattern calls outside event stream query expressions due to the free-threaded nature of Reactive Extensions. Doing so
- /// makes the captured SynchronizationContext predictable. This best practice also reduces clutter of bridging code inside queries, making the query expressions
- /// more concise and easier to understand.
- /// </para>
- /// </remarks>
- /// <seealso cref="Observable.ToEventPattern"/>
- public static IObservable<EventPattern<TEventArgs>> FromEventPattern<TDelegate, TEventArgs>(Action<TDelegate> addHandler, Action<TDelegate> removeHandler)
-#if !NO_EVENTARGS_CONSTRAINT
- where TEventArgs : EventArgs
-#endif
- {
- if (addHandler == null)
- throw new ArgumentNullException("addHandler");
- if (removeHandler == null)
- throw new ArgumentNullException("removeHandler");
-
- return s_impl.FromEventPattern<TDelegate, TEventArgs>(addHandler, removeHandler);
- }
-
- /// <summary>
- /// Converts a .NET event, conforming to the standard .NET event pattern based on a supplied event delegate type, to an observable sequence.
- /// Each event invocation is surfaced through an OnNext message in the resulting sequence.
- /// For conversion of events that don't conform to the standard .NET event pattern, use any of the FromEvent overloads instead.
- /// </summary>
- /// <typeparam name="TDelegate">The delegate type of the event to be converted.</typeparam>
- /// <typeparam name="TEventArgs">The type of the event data generated by the event.</typeparam>
- /// <param name="addHandler">Action that attaches the given event handler to the underlying .NET event.</param>
- /// <param name="removeHandler">Action that detaches the given event handler from the underlying .NET event.</param>
- /// <param name="scheduler">The scheduler to run the add and remove event handler logic on.</param>
- /// <returns>The observable sequence that contains data representations of invocations of the underlying .NET event.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="addHandler"/> or <paramref name="removeHandler"/> or <paramref name="scheduler"/> is null.</exception>
- /// <remarks>
- /// <para>
- /// Add and remove handler invocations are made whenever the number of observers grows beyond zero.
- /// As such, an event handler may be shared by multiple simultaneously active observers, using a subject for multicasting.
- /// </para>
- /// <para>
- /// Add and remove handler invocations are run on the specified scheduler. This behavior allows add and remove handler operations for thread-affine events to be
- /// accessed from the same context, as required by some UI frameworks.
- /// </para>
- /// <para>
- /// It's recommended to lift FromEventPattern calls outside event stream query expressions. This best practice reduces clutter of bridging code inside queries,
- /// making the query expressions more concise and easier to understand. This has additional benefits for overloads of FromEventPattern that omit the IScheduler
- /// parameter. For more information, see the remarks section on those overloads.
- /// </para>
- /// </remarks>
- /// <seealso cref="Observable.ToEventPattern"/>
- public static IObservable<EventPattern<TEventArgs>> FromEventPattern<TDelegate, TEventArgs>(Action<TDelegate> addHandler, Action<TDelegate> removeHandler, IScheduler scheduler)
-#if !NO_EVENTARGS_CONSTRAINT
- where TEventArgs : EventArgs
-#endif
- {
- if (addHandler == null)
- throw new ArgumentNullException("addHandler");
- if (removeHandler == null)
- throw new ArgumentNullException("removeHandler");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return s_impl.FromEventPattern<TDelegate, TEventArgs>(addHandler, removeHandler, scheduler);
- }
-
- /// <summary>
- /// Converts a .NET event, conforming to the standard .NET event pattern based on <see cref="EventHandler&lt;TEventArgs&gt;"/>, to an observable sequence.
- /// Each event invocation is surfaced through an OnNext message in the resulting sequence.
- /// For conversion of events that don't conform to the standard .NET event pattern, use any of the FromEvent overloads instead.
- /// </summary>
- /// <typeparam name="TDelegate">The delegate type of the event to be converted.</typeparam>
- /// <typeparam name="TEventArgs">The type of the event data generated by the event.</typeparam>
- /// <param name="conversion">A function used to convert the given event handler to a delegate compatible with the underlying .NET event. The resulting delegate is used in calls to the addHandler and removeHandler action parameters.</param>
- /// <param name="addHandler">Action that attaches the given event handler to the underlying .NET event.</param>
- /// <param name="removeHandler">Action that detaches the given event handler from the underlying .NET event.</param>
- /// <returns>The observable sequence that contains data representations of invocations of the underlying .NET event.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="conversion"/> or <paramref name="addHandler"/> or <paramref name="removeHandler"/> is null.</exception>
- /// <remarks>
- /// <para>
- /// Add and remove handler invocations are made whenever the number of observers grows beyond zero.
- /// As such, an event handler may be shared by multiple simultaneously active observers, using a subject for multicasting.
- /// </para>
- /// <para>
- /// The current <see cref="SynchronizationContext"/> is captured during the call to FromEventPattern, and is used to post add and remove handler invocations.
- /// This behavior ensures add and remove handler operations for thread-affine events are accessed from the same context, as required by some UI frameworks.
- /// </para>
- /// <para>
- /// If no SynchronizationContext is present at the point of calling FromEventPattern, add and remove handler invocations are made synchronously on the thread
- /// making the Subscribe or Dispose call, respectively.
- /// </para>
- /// <para>
- /// It's recommended to lift FromEventPattern calls outside event stream query expressions due to the free-threaded nature of Reactive Extensions. Doing so
- /// makes the captured SynchronizationContext predictable. This best practice also reduces clutter of bridging code inside queries, making the query expressions
- /// more concise and easier to understand.
- /// </para>
- /// </remarks>
- /// <seealso cref="Observable.ToEventPattern"/>
- public static IObservable<EventPattern<TEventArgs>> FromEventPattern<TDelegate, TEventArgs>(Func<EventHandler<TEventArgs>, TDelegate> conversion, Action<TDelegate> addHandler, Action<TDelegate> removeHandler)
-#if !NO_EVENTARGS_CONSTRAINT
- where TEventArgs : EventArgs
-#endif
- {
- if (conversion == null)
- throw new ArgumentNullException("conversion");
- if (addHandler == null)
- throw new ArgumentNullException("addHandler");
- if (removeHandler == null)
- throw new ArgumentNullException("removeHandler");
-
- return s_impl.FromEventPattern<TDelegate, TEventArgs>(conversion, addHandler, removeHandler);
- }
-
- /// <summary>
- /// Converts a .NET event, conforming to the standard .NET event pattern based on <see cref="EventHandler&lt;TEventArgs&gt;"/>, to an observable sequence.
- /// Each event invocation is surfaced through an OnNext message in the resulting sequence.
- /// For conversion of events that don't conform to the standard .NET event pattern, use any of the FromEvent overloads instead.
- /// </summary>
- /// <typeparam name="TDelegate">The delegate type of the event to be converted.</typeparam>
- /// <typeparam name="TEventArgs">The type of the event data generated by the event.</typeparam>
- /// <param name="conversion">A function used to convert the given event handler to a delegate compatible with the underlying .NET event. The resulting delegate is used in calls to the addHandler and removeHandler action parameters.</param>
- /// <param name="addHandler">Action that attaches the given event handler to the underlying .NET event.</param>
- /// <param name="removeHandler">Action that detaches the given event handler from the underlying .NET event.</param>
- /// <param name="scheduler">The scheduler to run the add and remove event handler logic on.</param>
- /// <returns>The observable sequence that contains data representations of invocations of the underlying .NET event.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="conversion"/> or <paramref name="addHandler"/> or <paramref name="removeHandler"/> or <paramref name="scheduler"/> is null.</exception>
- /// <remarks>
- /// <para>
- /// Add and remove handler invocations are made whenever the number of observers grows beyond zero.
- /// As such, an event handler may be shared by multiple simultaneously active observers, using a subject for multicasting.
- /// </para>
- /// <para>
- /// Add and remove handler invocations are run on the specified scheduler. This behavior allows add and remove handler operations for thread-affine events to be
- /// accessed from the same context, as required by some UI frameworks.
- /// </para>
- /// <para>
- /// It's recommended to lift FromEventPattern calls outside event stream query expressions. This best practice reduces clutter of bridging code inside queries,
- /// making the query expressions more concise and easier to understand. This has additional benefits for overloads of FromEventPattern that omit the IScheduler
- /// parameter. For more information, see the remarks section on those overloads.
- /// </para>
- /// </remarks>
- /// <seealso cref="Observable.ToEventPattern"/>
- public static IObservable<EventPattern<TEventArgs>> FromEventPattern<TDelegate, TEventArgs>(Func<EventHandler<TEventArgs>, TDelegate> conversion, Action<TDelegate> addHandler, Action<TDelegate> removeHandler, IScheduler scheduler)
-#if !NO_EVENTARGS_CONSTRAINT
- where TEventArgs : EventArgs
-#endif
- {
- if (conversion == null)
- throw new ArgumentNullException("conversion");
- if (addHandler == null)
- throw new ArgumentNullException("addHandler");
- if (removeHandler == null)
- throw new ArgumentNullException("removeHandler");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return s_impl.FromEventPattern<TDelegate, TEventArgs>(conversion, addHandler, removeHandler, scheduler);
- }
-
- /// <summary>
- /// Converts a .NET event, conforming to the standard .NET event pattern based on a supplied event delegate type with a strongly typed sender parameter, to an observable sequence.
- /// Each event invocation is surfaced through an OnNext message in the resulting sequence.
- /// For conversion of events that don't conform to the standard .NET event pattern, use any of the FromEvent overloads instead.
- /// </summary>
- /// <typeparam name="TDelegate">The delegate type of the event to be converted.</typeparam>
- /// <typeparam name="TSender">The type of the sender that raises the event.</typeparam>
- /// <typeparam name="TEventArgs">The type of the event data generated by the event.</typeparam>
- /// <param name="addHandler">Action that attaches the given event handler to the underlying .NET event.</param>
- /// <param name="removeHandler">Action that detaches the given event handler from the underlying .NET event.</param>
- /// <returns>The observable sequence that contains data representations of invocations of the underlying .NET event.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="addHandler"/> or <paramref name="removeHandler"/> is null.</exception>
- /// <remarks>
- /// <para>
- /// Add and remove handler invocations are made whenever the number of observers grows beyond zero.
- /// As such, an event handler may be shared by multiple simultaneously active observers, using a subject for multicasting.
- /// </para>
- /// <para>
- /// The current <see cref="SynchronizationContext"/> is captured during the call to FromEventPattern, and is used to post add and remove handler invocations.
- /// This behavior ensures add and remove handler operations for thread-affine events are accessed from the same context, as required by some UI frameworks.
- /// </para>
- /// <para>
- /// If no SynchronizationContext is present at the point of calling FromEventPattern, add and remove handler invocations are made synchronously on the thread
- /// making the Subscribe or Dispose call, respectively.
- /// </para>
- /// <para>
- /// It's recommended to lift FromEventPattern calls outside event stream query expressions due to the free-threaded nature of Reactive Extensions. Doing so
- /// makes the captured SynchronizationContext predictable. This best practice also reduces clutter of bridging code inside queries, making the query expressions
- /// more concise and easier to understand.
- /// </para>
- /// </remarks>
- /// <seealso cref="Observable.ToEventPattern"/>
- public static IObservable<EventPattern<TSender, TEventArgs>> FromEventPattern<TDelegate, TSender, TEventArgs>(Action<TDelegate> addHandler, Action<TDelegate> removeHandler)
-#if !NO_EVENTARGS_CONSTRAINT
- where TEventArgs : EventArgs
-#endif
- {
- if (addHandler == null)
- throw new ArgumentNullException("addHandler");
- if (removeHandler == null)
- throw new ArgumentNullException("removeHandler");
-
- return s_impl.FromEventPattern<TDelegate, TSender, TEventArgs>(addHandler, removeHandler);
- }
-
- /// <summary>
- /// Converts a .NET event, conforming to the standard .NET event pattern based on a supplied event delegate type with a strongly typed sender parameter, to an observable sequence.
- /// Each event invocation is surfaced through an OnNext message in the resulting sequence.
- /// For conversion of events that don't conform to the standard .NET event pattern, use any of the FromEvent overloads instead.
- /// </summary>
- /// <typeparam name="TDelegate">The delegate type of the event to be converted.</typeparam>
- /// <typeparam name="TSender">The type of the sender that raises the event.</typeparam>
- /// <typeparam name="TEventArgs">The type of the event data generated by the event.</typeparam>
- /// <param name="addHandler">Action that attaches the given event handler to the underlying .NET event.</param>
- /// <param name="removeHandler">Action that detaches the given event handler from the underlying .NET event.</param>
- /// <param name="scheduler">The scheduler to run the add and remove event handler logic on.</param>
- /// <returns>The observable sequence that contains data representations of invocations of the underlying .NET event.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="addHandler"/> or <paramref name="removeHandler"/> or <paramref name="scheduler"/> is null.</exception>
- /// <remarks>
- /// <para>
- /// Add and remove handler invocations are made whenever the number of observers grows beyond zero.
- /// As such, an event handler may be shared by multiple simultaneously active observers, using a subject for multicasting.
- /// </para>
- /// <para>
- /// Add and remove handler invocations are run on the specified scheduler. This behavior allows add and remove handler operations for thread-affine events to be
- /// accessed from the same context, as required by some UI frameworks.
- /// </para>
- /// <para>
- /// It's recommended to lift FromEventPattern calls outside event stream query expressions. This best practice reduces clutter of bridging code inside queries,
- /// making the query expressions more concise and easier to understand. This has additional benefits for overloads of FromEventPattern that omit the IScheduler
- /// parameter. For more information, see the remarks section on those overloads.
- /// </para>
- /// </remarks>
- /// <seealso cref="Observable.ToEventPattern"/>
- public static IObservable<EventPattern<TSender, TEventArgs>> FromEventPattern<TDelegate, TSender, TEventArgs>(Action<TDelegate> addHandler, Action<TDelegate> removeHandler, IScheduler scheduler)
-#if !NO_EVENTARGS_CONSTRAINT
- where TEventArgs : EventArgs
-#endif
- {
- if (addHandler == null)
- throw new ArgumentNullException("addHandler");
- if (removeHandler == null)
- throw new ArgumentNullException("removeHandler");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return s_impl.FromEventPattern<TDelegate, TSender, TEventArgs>(addHandler, removeHandler, scheduler);
- }
-
- #endregion
-
- #region Action<EventHandler<TEventArgs>>
-
- /// <summary>
- /// Converts a .NET event, conforming to the standard .NET event pattern based on <see cref="EventHandler&lt;TEventArgs&gt;"/>, to an observable sequence.
- /// Each event invocation is surfaced through an OnNext message in the resulting sequence.
- /// For conversion of events that don't conform to the standard .NET event pattern, use any of the FromEvent overloads instead.
- /// </summary>
- /// <typeparam name="TEventArgs">The type of the event data generated by the event.</typeparam>
- /// <param name="addHandler">Action that attaches the given event handler to the underlying .NET event.</param>
- /// <param name="removeHandler">Action that detaches the given event handler from the underlying .NET event.</param>
- /// <returns>The observable sequence that contains data representations of invocations of the underlying .NET event.</returns>
- /// <remarks>
- /// <para>
- /// Add and remove handler invocations are made whenever the number of observers grows beyond zero.
- /// As such, an event handler may be shared by multiple simultaneously active observers, using a subject for multicasting.
- /// </para>
- /// <para>
- /// The current <see cref="SynchronizationContext"/> is captured during the call to FromEventPattern, and is used to post add and remove handler invocations.
- /// This behavior ensures add and remove handler operations for thread-affine events are accessed from the same context, as required by some UI frameworks.
- /// </para>
- /// <para>
- /// If no SynchronizationContext is present at the point of calling FromEventPattern, add and remove handler invocations are made synchronously on the thread
- /// making the Subscribe or Dispose call, respectively.
- /// </para>
- /// <para>
- /// It's recommended to lift FromEventPattern calls outside event stream query expressions due to the free-threaded nature of Reactive Extensions. Doing so
- /// makes the captured SynchronizationContext predictable. This best practice also reduces clutter of bridging code inside queries, making the query expressions
- /// more concise and easier to understand.
- /// </para>
- /// </remarks>
- /// <seealso cref="Observable.ToEventPattern"/>
- public static IObservable<EventPattern<TEventArgs>> FromEventPattern<TEventArgs>(Action<EventHandler<TEventArgs>> addHandler, Action<EventHandler<TEventArgs>> removeHandler)
-#if !NO_EVENTARGS_CONSTRAINT
- where TEventArgs : EventArgs
-#endif
- {
- if (addHandler == null)
- throw new ArgumentNullException("addHandler");
- if (removeHandler == null)
- throw new ArgumentNullException("removeHandler");
-
- return s_impl.FromEventPattern<TEventArgs>(addHandler, removeHandler);
- }
-
- /// <summary>
- /// Converts a .NET event, conforming to the standard .NET event pattern based on <see cref="EventHandler&lt;TEventArgs&gt;"/>, to an observable sequence.
- /// Each event invocation is surfaced through an OnNext message in the resulting sequence.
- /// For conversion of events that don't conform to the standard .NET event pattern, use any of the FromEvent overloads instead.
- /// </summary>
- /// <typeparam name="TEventArgs">The type of the event data generated by the event.</typeparam>
- /// <param name="addHandler">Action that attaches the given event handler to the underlying .NET event.</param>
- /// <param name="removeHandler">Action that detaches the given event handler from the underlying .NET event.</param>
- /// <param name="scheduler">The scheduler to run the add and remove event handler logic on.</param>
- /// <returns>The observable sequence that contains data representations of invocations of the underlying .NET event.</returns>
- /// <remarks>
- /// <para>
- /// Add and remove handler invocations are made whenever the number of observers grows beyond zero.
- /// As such, an event handler may be shared by multiple simultaneously active observers, using a subject for multicasting.
- /// </para>
- /// <para>
- /// Add and remove handler invocations are run on the specified scheduler. This behavior allows add and remove handler operations for thread-affine events to be
- /// accessed from the same context, as required by some UI frameworks.
- /// </para>
- /// <para>
- /// It's recommended to lift FromEventPattern calls outside event stream query expressions. This best practice reduces clutter of bridging code inside queries,
- /// making the query expressions more concise and easier to understand. This has additional benefits for overloads of FromEventPattern that omit the IScheduler
- /// parameter. For more information, see the remarks section on those overloads.
- /// </para>
- /// </remarks>
- /// <seealso cref="Observable.ToEventPattern"/>
- public static IObservable<EventPattern<TEventArgs>> FromEventPattern<TEventArgs>(Action<EventHandler<TEventArgs>> addHandler, Action<EventHandler<TEventArgs>> removeHandler, IScheduler scheduler)
-#if !NO_EVENTARGS_CONSTRAINT
- where TEventArgs : EventArgs
-#endif
- {
- if (addHandler == null)
- throw new ArgumentNullException("addHandler");
- if (removeHandler == null)
- throw new ArgumentNullException("removeHandler");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return s_impl.FromEventPattern<TEventArgs>(addHandler, removeHandler, scheduler);
- }
-
- #endregion
-
- #endregion
-
- #region Reflection
-
- #region Instance events
-
- /// <summary>
- /// Converts an instance .NET event, conforming to the standard .NET event pattern with an <see cref="EventArgs"/> parameter, to an observable sequence.
- /// Each event invocation is surfaced through an OnNext message in the resulting sequence.
- /// Reflection is used to discover the event based on the target object type and the specified event name.
- /// For conversion of events that don't conform to the standard .NET event pattern, use any of the FromEvent overloads instead.
- /// </summary>
- /// <param name="target">Object instance that exposes the event to convert.</param>
- /// <param name="eventName">Name of the event to convert.</param>
- /// <returns>The observable sequence that contains data representations of invocations of the underlying .NET event.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="target"/> or <paramref name="eventName"/> is null.</exception>
- /// <exception cref="InvalidOperationException">The event could not be found. -or- The event does not conform to the standard .NET event pattern.</exception>
- /// <remarks>
- /// <para>
- /// Add and remove handler invocations are made whenever the number of observers grows beyond zero.
- /// As such, an event handler may be shared by multiple simultaneously active observers, using a subject for multicasting.
- /// </para>
- /// <para>
- /// The current <see cref="SynchronizationContext"/> is captured during the call to FromEventPattern, and is used to post add and remove handler invocations.
- /// This behavior ensures add and remove handler operations for thread-affine events are accessed from the same context, as required by some UI frameworks.
- /// </para>
- /// <para>
- /// If no SynchronizationContext is present at the point of calling FromEventPattern, add and remove handler invocations are made synchronously on the thread
- /// making the Subscribe or Dispose call, respectively.
- /// </para>
- /// <para>
- /// It's recommended to lift FromEventPattern calls outside event stream query expressions due to the free-threaded nature of Reactive Extensions. Doing so
- /// makes the captured SynchronizationContext predictable. This best practice also reduces clutter of bridging code inside queries, making the query expressions
- /// more concise and easier to understand.
- /// </para>
- /// </remarks>
- /// <seealso cref="Observable.ToEventPattern"/>
-#if !NO_EVENTARGS_CONSTRAINT
- public static IObservable<EventPattern<EventArgs>> FromEventPattern(object target, string eventName)
- {
- if (target == null)
- throw new ArgumentNullException("target");
- if (eventName == null)
- throw new ArgumentNullException("eventName");
-
- return s_impl.FromEventPattern(target, eventName);
- }
-#else
- public static IObservable<EventPattern<object>> FromEventPattern(object target, string eventName)
- {
- if (target == null)
- throw new ArgumentNullException("target");
- if (eventName == null)
- throw new ArgumentNullException("eventName");
-
- return s_impl.FromEventPattern(target, eventName);
- }
-#endif
-
- /// <summary>
- /// Converts an instance .NET event, conforming to the standard .NET event pattern with an <see cref="EventArgs"/> parameter, to an observable sequence.
- /// Each event invocation is surfaced through an OnNext message in the resulting sequence.
- /// Reflection is used to discover the event based on the target object type and the specified event name.
- /// For conversion of events that don't conform to the standard .NET event pattern, use any of the FromEvent overloads instead.
- /// </summary>
- /// <param name="target">Object instance that exposes the event to convert.</param>
- /// <param name="eventName">Name of the event to convert.</param>
- /// <param name="scheduler">The scheduler to run the add and remove event handler logic on.</param>
- /// <returns>The observable sequence that contains data representations of invocations of the underlying .NET event.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="target"/> or <paramref name="eventName"/> or <paramref name="scheduler"/> is null.</exception>
- /// <exception cref="InvalidOperationException">The event could not be found. -or- The event does not conform to the standard .NET event pattern.</exception>
- /// <remarks>
- /// <para>
- /// Add and remove handler invocations are made whenever the number of observers grows beyond zero.
- /// As such, an event handler may be shared by multiple simultaneously active observers, using a subject for multicasting.
- /// </para>
- /// <para>
- /// Add and remove handler invocations are run on the specified scheduler. This behavior allows add and remove handler operations for thread-affine events to be
- /// accessed from the same context, as required by some UI frameworks.
- /// </para>
- /// <para>
- /// It's recommended to lift FromEventPattern calls outside event stream query expressions. This best practice reduces clutter of bridging code inside queries,
- /// making the query expressions more concise and easier to understand. This has additional benefits for overloads of FromEventPattern that omit the IScheduler
- /// parameter. For more information, see the remarks section on those overloads.
- /// </para>
- /// </remarks>
- /// <seealso cref="Observable.ToEventPattern"/>
-#if !NO_EVENTARGS_CONSTRAINT
- public static IObservable<EventPattern<EventArgs>> FromEventPattern(object target, string eventName, IScheduler scheduler)
- {
- if (target == null)
- throw new ArgumentNullException("target");
- if (eventName == null)
- throw new ArgumentNullException("eventName");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return s_impl.FromEventPattern(target, eventName, scheduler);
- }
-#else
- public static IObservable<EventPattern<object>> FromEventPattern(object target, string eventName, IScheduler scheduler)
- {
- if (target == null)
- throw new ArgumentNullException("target");
- if (eventName == null)
- throw new ArgumentNullException("eventName");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return s_impl.FromEventPattern(target, eventName, scheduler);
- }
-#endif
-
- /// <summary>
- /// Converts an instance .NET event, conforming to the standard .NET event pattern with strongly typed event arguments, to an observable sequence.
- /// Each event invocation is surfaced through an OnNext message in the resulting sequence.
- /// Reflection is used to discover the event based on the target object type and the specified event name.
- /// For conversion of events that don't conform to the standard .NET event pattern, use any of the FromEvent overloads instead.
- /// </summary>
- /// <typeparam name="TEventArgs">The type of the event data generated by the event.</typeparam>
- /// <param name="target">Object instance that exposes the event to convert.</param>
- /// <param name="eventName">Name of the event to convert.</param>
- /// <returns>The observable sequence that contains data representations of invocations of the underlying .NET event.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="target"/> or <paramref name="eventName"/> is null.</exception>
- /// <exception cref="InvalidOperationException">The event could not be found. -or- The event does not conform to the standard .NET event pattern. -or- The event's second argument type is not assignable to TEventArgs.</exception>
- /// <remarks>
- /// <para>
- /// Add and remove handler invocations are made whenever the number of observers grows beyond zero.
- /// As such, an event handler may be shared by multiple simultaneously active observers, using a subject for multicasting.
- /// </para>
- /// <para>
- /// The current <see cref="SynchronizationContext"/> is captured during the call to FromEventPattern, and is used to post add and remove handler invocations.
- /// This behavior ensures add and remove handler operations for thread-affine events are accessed from the same context, as required by some UI frameworks.
- /// </para>
- /// <para>
- /// If no SynchronizationContext is present at the point of calling FromEventPattern, add and remove handler invocations are made synchronously on the thread
- /// making the Subscribe or Dispose call, respectively.
- /// </para>
- /// <para>
- /// It's recommended to lift FromEventPattern calls outside event stream query expressions due to the free-threaded nature of Reactive Extensions. Doing so
- /// makes the captured SynchronizationContext predictable. This best practice also reduces clutter of bridging code inside queries, making the query expressions
- /// more concise and easier to understand.
- /// </para>
- /// </remarks>
- /// <seealso cref="Observable.ToEventPattern"/>
- public static IObservable<EventPattern<TEventArgs>> FromEventPattern<TEventArgs>(object target, string eventName)
-#if !NO_EVENTARGS_CONSTRAINT
- where TEventArgs : EventArgs
-#endif
- {
- if (target == null)
- throw new ArgumentNullException("target");
- if (eventName == null)
- throw new ArgumentNullException("eventName");
-
- return s_impl.FromEventPattern<TEventArgs>(target, eventName);
- }
-
- /// <summary>
- /// Converts an instance .NET event, conforming to the standard .NET event pattern with strongly typed event arguments, to an observable sequence.
- /// Each event invocation is surfaced through an OnNext message in the resulting sequence.
- /// Reflection is used to discover the event based on the target object type and the specified event name.
- /// For conversion of events that don't conform to the standard .NET event pattern, use any of the FromEvent overloads instead.
- /// </summary>
- /// <typeparam name="TEventArgs">The type of the event data generated by the event.</typeparam>
- /// <param name="target">Object instance that exposes the event to convert.</param>
- /// <param name="eventName">Name of the event to convert.</param>
- /// <param name="scheduler">The scheduler to run the add and remove event handler logic on.</param>
- /// <returns>The observable sequence that contains data representations of invocations of the underlying .NET event.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="target"/> or <paramref name="eventName"/> or <paramref name="scheduler"/> is null.</exception>
- /// <exception cref="InvalidOperationException">The event could not be found. -or- The event does not conform to the standard .NET event pattern. -or- The event's second argument type is not assignable to TEventArgs.</exception>
- /// <remarks>
- /// <para>
- /// Add and remove handler invocations are made whenever the number of observers grows beyond zero.
- /// As such, an event handler may be shared by multiple simultaneously active observers, using a subject for multicasting.
- /// </para>
- /// <para>
- /// Add and remove handler invocations are run on the specified scheduler. This behavior allows add and remove handler operations for thread-affine events to be
- /// accessed from the same context, as required by some UI frameworks.
- /// </para>
- /// <para>
- /// It's recommended to lift FromEventPattern calls outside event stream query expressions. This best practice reduces clutter of bridging code inside queries,
- /// making the query expressions more concise and easier to understand. This has additional benefits for overloads of FromEventPattern that omit the IScheduler
- /// parameter. For more information, see the remarks section on those overloads.
- /// </para>
- /// </remarks>
- /// <seealso cref="Observable.ToEventPattern"/>
- public static IObservable<EventPattern<TEventArgs>> FromEventPattern<TEventArgs>(object target, string eventName, IScheduler scheduler)
-#if !NO_EVENTARGS_CONSTRAINT
- where TEventArgs : EventArgs
-#endif
- {
- if (target == null)
- throw new ArgumentNullException("target");
- if (eventName == null)
- throw new ArgumentNullException("eventName");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return s_impl.FromEventPattern<TEventArgs>(target, eventName, scheduler);
- }
-
- /// <summary>
- /// Converts an instance .NET event, conforming to the standard .NET event pattern with a strongly typed sender and strongly typed event arguments, to an observable sequence.
- /// Each event invocation is surfaced through an OnNext message in the resulting sequence.
- /// Reflection is used to discover the event based on the target object type and the specified event name.
- /// For conversion of events that don't conform to the standard .NET event pattern, use any of the FromEvent overloads instead.
- /// </summary>
- /// <typeparam name="TSender">The type of the sender that raises the event.</typeparam>
- /// <typeparam name="TEventArgs">The type of the event data generated by the event.</typeparam>
- /// <param name="target">Object instance that exposes the event to convert.</param>
- /// <param name="eventName">Name of the event to convert.</param>
- /// <returns>The observable sequence that contains data representations of invocations of the underlying .NET event.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="target"/> or <paramref name="eventName"/> is null.</exception>
- /// <exception cref="InvalidOperationException">The event could not be found. -or- The event does not conform to the standard .NET event pattern. -or- The event's first argument type is not assignable to TSender. -or- The event's second argument type is not assignable to TEventArgs.</exception>
- /// <remarks>
- /// <para>
- /// Add and remove handler invocations are made whenever the number of observers grows beyond zero.
- /// As such, an event handler may be shared by multiple simultaneously active observers, using a subject for multicasting.
- /// </para>
- /// <para>
- /// The current <see cref="SynchronizationContext"/> is captured during the call to FromEventPattern, and is used to post add and remove handler invocations.
- /// This behavior ensures add and remove handler operations for thread-affine events are accessed from the same context, as required by some UI frameworks.
- /// </para>
- /// <para>
- /// If no SynchronizationContext is present at the point of calling FromEventPattern, add and remove handler invocations are made synchronously on the thread
- /// making the Subscribe or Dispose call, respectively.
- /// </para>
- /// <para>
- /// It's recommended to lift FromEventPattern calls outside event stream query expressions due to the free-threaded nature of Reactive Extensions. Doing so
- /// makes the captured SynchronizationContext predictable. This best practice also reduces clutter of bridging code inside queries, making the query expressions
- /// more concise and easier to understand.
- /// </para>
- /// </remarks>
- /// <seealso cref="Observable.ToEventPattern"/>
- public static IObservable<EventPattern<TSender, TEventArgs>> FromEventPattern<TSender, TEventArgs>(object target, string eventName)
-#if !NO_EVENTARGS_CONSTRAINT
- where TEventArgs : EventArgs
-#endif
- {
- if (target == null)
- throw new ArgumentNullException("target");
- if (eventName == null)
- throw new ArgumentNullException("eventName");
-
- return s_impl.FromEventPattern<TSender, TEventArgs>(target, eventName);
- }
-
- /// <summary>
- /// Converts an instance .NET event, conforming to the standard .NET event pattern with a strongly typed sender and strongly typed event arguments, to an observable sequence.
- /// Each event invocation is surfaced through an OnNext message in the resulting sequence.
- /// Reflection is used to discover the event based on the target object type and the specified event name.
- /// For conversion of events that don't conform to the standard .NET event pattern, use any of the FromEvent overloads instead.
- /// </summary>
- /// <typeparam name="TSender">The type of the sender that raises the event.</typeparam>
- /// <typeparam name="TEventArgs">The type of the event data generated by the event.</typeparam>
- /// <param name="target">Object instance that exposes the event to convert.</param>
- /// <param name="eventName">Name of the event to convert.</param>
- /// <param name="scheduler">The scheduler to run the add and remove event handler logic on.</param>
- /// <returns>The observable sequence that contains data representations of invocations of the underlying .NET event.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="target"/> or <paramref name="eventName"/> or <paramref name="scheduler"/> is null.</exception>
- /// <exception cref="InvalidOperationException">The event could not be found. -or- The event does not conform to the standard .NET event pattern. -or- The event's first argument type is not assignable to TSender. -or- The event's second argument type is not assignable to TEventArgs.</exception>
- /// <remarks>
- /// <para>
- /// Add and remove handler invocations are made whenever the number of observers grows beyond zero.
- /// As such, an event handler may be shared by multiple simultaneously active observers, using a subject for multicasting.
- /// </para>
- /// <para>
- /// Add and remove handler invocations are run on the specified scheduler. This behavior allows add and remove handler operations for thread-affine events to be
- /// accessed from the same context, as required by some UI frameworks.
- /// </para>
- /// <para>
- /// It's recommended to lift FromEventPattern calls outside event stream query expressions. This best practice reduces clutter of bridging code inside queries,
- /// making the query expressions more concise and easier to understand. This has additional benefits for overloads of FromEventPattern that omit the IScheduler
- /// parameter. For more information, see the remarks section on those overloads.
- /// </para>
- /// </remarks>
- /// <seealso cref="Observable.ToEventPattern"/>
- public static IObservable<EventPattern<TSender, TEventArgs>> FromEventPattern<TSender, TEventArgs>(object target, string eventName, IScheduler scheduler)
-#if !NO_EVENTARGS_CONSTRAINT
- where TEventArgs : EventArgs
-#endif
- {
- if (target == null)
- throw new ArgumentNullException("target");
- if (eventName == null)
- throw new ArgumentNullException("eventName");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return s_impl.FromEventPattern<TSender, TEventArgs>(target, eventName, scheduler);
- }
-
- #endregion
-
- #region Static events
-
- /// <summary>
- /// Converts a static .NET event, conforming to the standard .NET event pattern with an <see cref="EventArgs"/> parameter, to an observable sequence.
- /// Each event invocation is surfaced through an OnNext message in the resulting sequence.
- /// Reflection is used to discover the event based on the specified type and the specified event name.
- /// For conversion of events that don't conform to the standard .NET event pattern, use any of the FromEvent overloads instead.
- /// </summary>
- /// <param name="type">Type that exposes the static event to convert.</param>
- /// <param name="eventName">Name of the event to convert.</param>
- /// <returns>The observable sequence that contains data representations of invocations of the underlying .NET event.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="type"/> or <paramref name="eventName"/> is null.</exception>
- /// <exception cref="InvalidOperationException">The event could not be found. -or- The event does not conform to the standard .NET event pattern.</exception>
- /// <remarks>
- /// <para>
- /// Add and remove handler invocations are made whenever the number of observers grows beyond zero.
- /// As such, an event handler may be shared by multiple simultaneously active observers, using a subject for multicasting.
- /// </para>
- /// <para>
- /// The current <see cref="SynchronizationContext"/> is captured during the call to FromEventPattern, and is used to post add and remove handler invocations.
- /// This behavior ensures add and remove handler operations for thread-affine events are accessed from the same context, as required by some UI frameworks.
- /// </para>
- /// <para>
- /// If no SynchronizationContext is present at the point of calling FromEventPattern, add and remove handler invocations are made synchronously on the thread
- /// making the Subscribe or Dispose call, respectively.
- /// </para>
- /// <para>
- /// It's recommended to lift FromEventPattern calls outside event stream query expressions due to the free-threaded nature of Reactive Extensions. Doing so
- /// makes the captured SynchronizationContext predictable. This best practice also reduces clutter of bridging code inside queries, making the query expressions
- /// more concise and easier to understand.
- /// </para>
- /// </remarks>
- /// <seealso cref="Observable.ToEventPattern"/>
-#if !NO_EVENTARGS_CONSTRAINT
- public static IObservable<EventPattern<EventArgs>> FromEventPattern(Type type, string eventName)
- {
- if (type == null)
- throw new ArgumentNullException("type");
- if (eventName == null)
- throw new ArgumentNullException("eventName");
-
- return s_impl.FromEventPattern(type, eventName);
- }
-#else
- public static IObservable<EventPattern<object>> FromEventPattern(Type type, string eventName)
- {
- if (type == null)
- throw new ArgumentNullException("type");
- if (eventName == null)
- throw new ArgumentNullException("eventName");
-
- return s_impl.FromEventPattern(type, eventName);
- }
-#endif
-
- /// <summary>
- /// Converts a static .NET event, conforming to the standard .NET event pattern with an <see cref="EventArgs"/> parameter, to an observable sequence.
- /// Each event invocation is surfaced through an OnNext message in the resulting sequence.
- /// Reflection is used to discover the event based on the specified type and the specified event name.
- /// For conversion of events that don't conform to the standard .NET event pattern, use any of the FromEvent overloads instead.
- /// </summary>
- /// <param name="type">Type that exposes the static event to convert.</param>
- /// <param name="eventName">Name of the event to convert.</param>
- /// <param name="scheduler">The scheduler to run the add and remove event handler logic on.</param>
- /// <returns>The observable sequence that contains data representations of invocations of the underlying .NET event.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="type"/> or <paramref name="eventName"/> or <paramref name="scheduler"/> is null.</exception>
- /// <exception cref="InvalidOperationException">The event could not be found. -or- The event does not conform to the standard .NET event pattern.</exception>
- /// <remarks>
- /// <para>
- /// Add and remove handler invocations are made whenever the number of observers grows beyond zero.
- /// As such, an event handler may be shared by multiple simultaneously active observers, using a subject for multicasting.
- /// </para>
- /// <para>
- /// Add and remove handler invocations are run on the specified scheduler. This behavior allows add and remove handler operations for thread-affine events to be
- /// accessed from the same context, as required by some UI frameworks.
- /// </para>
- /// <para>
- /// It's recommended to lift FromEventPattern calls outside event stream query expressions. This best practice reduces clutter of bridging code inside queries,
- /// making the query expressions more concise and easier to understand. This has additional benefits for overloads of FromEventPattern that omit the IScheduler
- /// parameter. For more information, see the remarks section on those overloads.
- /// </para>
- /// </remarks>
- /// <seealso cref="Observable.ToEventPattern"/>
-#if !NO_EVENTARGS_CONSTRAINT
- public static IObservable<EventPattern<EventArgs>> FromEventPattern(Type type, string eventName, IScheduler scheduler)
- {
- if (type == null)
- throw new ArgumentNullException("type");
- if (eventName == null)
- throw new ArgumentNullException("eventName");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return s_impl.FromEventPattern(type, eventName, scheduler);
- }
-#else
- public static IObservable<EventPattern<object>> FromEventPattern(Type type, string eventName, IScheduler scheduler)
- {
- if (type == null)
- throw new ArgumentNullException("type");
- if (eventName == null)
- throw new ArgumentNullException("eventName");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return s_impl.FromEventPattern(type, eventName, scheduler);
- }
-#endif
-
- /// <summary>
- /// Converts a static .NET event, conforming to the standard .NET event pattern with strongly typed event arguments, to an observable sequence.
- /// Each event invocation is surfaced through an OnNext message in the resulting sequence.
- /// Reflection is used to discover the event based on the specified type and the specified event name.
- /// For conversion of events that don't conform to the standard .NET event pattern, use any of the FromEvent overloads instead.
- /// </summary>
- /// <typeparam name="TEventArgs">The type of the event data generated by the event.</typeparam>
- /// <param name="type">Type that exposes the static event to convert.</param>
- /// <param name="eventName">Name of the event to convert.</param>
- /// <returns>The observable sequence that contains data representations of invocations of the underlying .NET event.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="type"/> or <paramref name="eventName"/> is null.</exception>
- /// <exception cref="InvalidOperationException">The event could not be found. -or- The event does not conform to the standard .NET event pattern. -or- The event's second argument type is not assignable to TEventArgs.</exception>
- /// <remarks>
- /// <para>
- /// Add and remove handler invocations are made whenever the number of observers grows beyond zero.
- /// As such, an event handler may be shared by multiple simultaneously active observers, using a subject for multicasting.
- /// </para>
- /// <para>
- /// The current <see cref="SynchronizationContext"/> is captured during the call to FromEventPattern, and is used to post add and remove handler invocations.
- /// This behavior ensures add and remove handler operations for thread-affine events are accessed from the same context, as required by some UI frameworks.
- /// </para>
- /// <para>
- /// If no SynchronizationContext is present at the point of calling FromEventPattern, add and remove handler invocations are made synchronously on the thread
- /// making the Subscribe or Dispose call, respectively.
- /// </para>
- /// <para>
- /// It's recommended to lift FromEventPattern calls outside event stream query expressions due to the free-threaded nature of Reactive Extensions. Doing so
- /// makes the captured SynchronizationContext predictable. This best practice also reduces clutter of bridging code inside queries, making the query expressions
- /// more concise and easier to understand.
- /// </para>
- /// </remarks>
- /// <seealso cref="Observable.ToEventPattern"/>
- public static IObservable<EventPattern<TEventArgs>> FromEventPattern<TEventArgs>(Type type, string eventName)
-#if !NO_EVENTARGS_CONSTRAINT
- where TEventArgs : EventArgs
-#endif
- {
- if (type == null)
- throw new ArgumentNullException("type");
- if (eventName == null)
- throw new ArgumentNullException("eventName");
-
- return s_impl.FromEventPattern<TEventArgs>(type, eventName);
- }
-
- /// <summary>
- /// Converts a static .NET event, conforming to the standard .NET event pattern with strongly typed event arguments, to an observable sequence.
- /// Each event invocation is surfaced through an OnNext message in the resulting sequence.
- /// Reflection is used to discover the event based on the specified type and the specified event name.
- /// For conversion of events that don't conform to the standard .NET event pattern, use any of the FromEvent overloads instead.
- /// </summary>
- /// <typeparam name="TEventArgs">The type of the event data generated by the event.</typeparam>
- /// <param name="type">Type that exposes the static event to convert.</param>
- /// <param name="eventName">Name of the event to convert.</param>
- /// <param name="scheduler">The scheduler to run the add and remove event handler logic on.</param>
- /// <returns>The observable sequence that contains data representations of invocations of the underlying .NET event.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="type"/> or <paramref name="eventName"/> or <paramref name="scheduler"/> is null.</exception>
- /// <exception cref="InvalidOperationException">The event could not be found. -or- The event does not conform to the standard .NET event pattern. -or- The event's second argument type is not assignable to TEventArgs.</exception>
- /// <remarks>
- /// <para>
- /// Add and remove handler invocations are made whenever the number of observers grows beyond zero.
- /// As such, an event handler may be shared by multiple simultaneously active observers, using a subject for multicasting.
- /// </para>
- /// <para>
- /// Add and remove handler invocations are run on the specified scheduler. This behavior allows add and remove handler operations for thread-affine events to be
- /// accessed from the same context, as required by some UI frameworks.
- /// </para>
- /// <para>
- /// It's recommended to lift FromEventPattern calls outside event stream query expressions. This best practice reduces clutter of bridging code inside queries,
- /// making the query expressions more concise and easier to understand. This has additional benefits for overloads of FromEventPattern that omit the IScheduler
- /// parameter. For more information, see the remarks section on those overloads.
- /// </para>
- /// </remarks>
- /// <seealso cref="Observable.ToEventPattern"/>
- public static IObservable<EventPattern<TEventArgs>> FromEventPattern<TEventArgs>(Type type, string eventName, IScheduler scheduler)
-#if !NO_EVENTARGS_CONSTRAINT
- where TEventArgs : EventArgs
-#endif
- {
- if (type == null)
- throw new ArgumentNullException("type");
- if (eventName == null)
- throw new ArgumentNullException("eventName");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return s_impl.FromEventPattern<TEventArgs>(type, eventName, scheduler);
- }
-
- /// <summary>
- /// Converts a static .NET event, conforming to the standard .NET event pattern with a strongly typed sender and strongly typed event arguments, to an observable sequence.
- /// Each event invocation is surfaced through an OnNext message in the resulting sequence.
- /// Reflection is used to discover the event based on the specified type and the specified event name.
- /// For conversion of events that don't conform to the standard .NET event pattern, use any of the FromEvent overloads instead.
- /// </summary>
- /// <typeparam name="TSender">The type of the sender that raises the event.</typeparam>
- /// <typeparam name="TEventArgs">The type of the event data generated by the event.</typeparam>
- /// <param name="type">Type that exposes the static event to convert.</param>
- /// <param name="eventName">Name of the event to convert.</param>
- /// <returns>The observable sequence that contains data representations of invocations of the underlying .NET event.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="type"/> or <paramref name="eventName"/> is null.</exception>
- /// <exception cref="InvalidOperationException">The event could not be found. -or- The event does not conform to the standard .NET event pattern. -or- The event's first argument type is not assignable to TSender. -or- The event's second argument type is not assignable to TEventArgs.</exception>
- /// <remarks>
- /// <para>
- /// Add and remove handler invocations are made whenever the number of observers grows beyond zero.
- /// As such, an event handler may be shared by multiple simultaneously active observers, using a subject for multicasting.
- /// </para>
- /// <para>
- /// The current <see cref="SynchronizationContext"/> is captured during the call to FromEventPattern, and is used to post add and remove handler invocations.
- /// This behavior ensures add and remove handler operations for thread-affine events are accessed from the same context, as required by some UI frameworks.
- /// </para>
- /// <para>
- /// If no SynchronizationContext is present at the point of calling FromEventPattern, add and remove handler invocations are made synchronously on the thread
- /// making the Subscribe or Dispose call, respectively.
- /// </para>
- /// <para>
- /// It's recommended to lift FromEventPattern calls outside event stream query expressions due to the free-threaded nature of Reactive Extensions. Doing so
- /// makes the captured SynchronizationContext predictable. This best practice also reduces clutter of bridging code inside queries, making the query expressions
- /// more concise and easier to understand.
- /// </para>
- /// </remarks>
- /// <seealso cref="Observable.ToEventPattern"/>
- public static IObservable<EventPattern<TSender, TEventArgs>> FromEventPattern<TSender, TEventArgs>(Type type, string eventName)
-#if !NO_EVENTARGS_CONSTRAINT
- where TEventArgs : EventArgs
-#endif
- {
- if (type == null)
- throw new ArgumentNullException("type");
- if (eventName == null)
- throw new ArgumentNullException("eventName");
-
- return s_impl.FromEventPattern<TSender, TEventArgs>(type, eventName);
- }
-
- /// <summary>
- /// Converts a static .NET event, conforming to the standard .NET event pattern with a strongly typed sender and strongly typed event arguments, to an observable sequence.
- /// Each event invocation is surfaced through an OnNext message in the resulting sequence.
- /// Reflection is used to discover the event based on the specified type and the specified event name.
- /// For conversion of events that don't conform to the standard .NET event pattern, use any of the FromEvent overloads instead.
- /// </summary>
- /// <typeparam name="TSender">The type of the sender that raises the event.</typeparam>
- /// <typeparam name="TEventArgs">The type of the event data generated by the event.</typeparam>
- /// <param name="type">Type that exposes the static event to convert.</param>
- /// <param name="eventName">Name of the event to convert.</param>
- /// <param name="scheduler">The scheduler to run the add and remove event handler logic on.</param>
- /// <returns>The observable sequence that contains data representations of invocations of the underlying .NET event.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="type"/> or <paramref name="eventName"/> or <paramref name="scheduler"/> is null.</exception>
- /// <exception cref="InvalidOperationException">The event could not be found. -or- The event does not conform to the standard .NET event pattern. -or- The event's first argument type is not assignable to TSender. -or- The event's second argument type is not assignable to TEventArgs.</exception>
- /// <remarks>
- /// <para>
- /// Add and remove handler invocations are made whenever the number of observers grows beyond zero.
- /// As such, an event handler may be shared by multiple simultaneously active observers, using a subject for multicasting.
- /// </para>
- /// <para>
- /// Add and remove handler invocations are run on the specified scheduler. This behavior allows add and remove handler operations for thread-affine events to be
- /// accessed from the same context, as required by some UI frameworks.
- /// </para>
- /// <para>
- /// It's recommended to lift FromEventPattern calls outside event stream query expressions. This best practice reduces clutter of bridging code inside queries,
- /// making the query expressions more concise and easier to understand. This has additional benefits for overloads of FromEventPattern that omit the IScheduler
- /// parameter. For more information, see the remarks section on those overloads.
- /// </para>
- /// </remarks>
- /// <seealso cref="Observable.ToEventPattern"/>
- public static IObservable<EventPattern<TSender, TEventArgs>> FromEventPattern<TSender, TEventArgs>(Type type, string eventName, IScheduler scheduler)
-#if !NO_EVENTARGS_CONSTRAINT
- where TEventArgs : EventArgs
-#endif
- {
- if (type == null)
- throw new ArgumentNullException("type");
- if (eventName == null)
- throw new ArgumentNullException("eventName");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return s_impl.FromEventPattern<TSender, TEventArgs>(type, eventName, scheduler);
- }
-
- #endregion
-
- #endregion
-
- #endregion
-
- #region + FromEvent +
-
- #region Action<TDelegate>
-
- /// <summary>
- /// Converts a .NET event to an observable sequence, using a conversion function to obtain the event delegate. Each event invocation is surfaced through an OnNext message in the resulting sequence.
- /// For conversion of events conforming to the standard .NET event pattern, use any of the FromEventPattern overloads instead.
- /// </summary>
- /// <typeparam name="TDelegate">The delegate type of the event to be converted.</typeparam>
- /// <typeparam name="TEventArgs">The type of the event data generated by the event.</typeparam>
- /// <param name="conversion">A function used to convert the given event handler to a delegate compatible with the underlying .NET event. The resulting delegate is used in calls to the addHandler and removeHandler action parameters.</param>
- /// <param name="addHandler">Action that attaches the given event handler to the underlying .NET event.</param>
- /// <param name="removeHandler">Action that detaches the given event handler from the underlying .NET event.</param>
- /// <returns>The observable sequence that contains the event argument objects passed to the invocations of the underlying .NET event.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="conversion"/> or <paramref name="addHandler"/> or <paramref name="removeHandler"/> is null.</exception>
- /// <remarks>
- /// <para>
- /// Add and remove handler invocations are made whenever the number of observers grows beyond zero.
- /// As such, an event handler may be shared by multiple simultaneously active observers, using a subject for multicasting.
- /// </para>
- /// <para>
- /// The current <see cref="SynchronizationContext"/> is captured during the call to FromEvent, and is used to post add and remove handler invocations.
- /// This behavior ensures add and remove handler operations for thread-affine events are accessed from the same context, as required by some UI frameworks.
- /// </para>
- /// <para>
- /// If no SynchronizationContext is present at the point of calling FromEvent, add and remove handler invocations are made synchronously on the thread
- /// making the Subscribe or Dispose call, respectively.
- /// </para>
- /// <para>
- /// It's recommended to lift FromEvent calls outside event stream query expressions due to the free-threaded nature of Reactive Extensions. Doing so
- /// makes the captured SynchronizationContext predictable. This best practice also reduces clutter of bridging code inside queries, making the query expressions
- /// more concise and easier to understand.
- /// </para>
- /// </remarks>
- /// <seealso cref="Observable.ToEvent"/>
- public static IObservable<TEventArgs> FromEvent<TDelegate, TEventArgs>(Func<Action<TEventArgs>, TDelegate> conversion, Action<TDelegate> addHandler, Action<TDelegate> removeHandler)
- {
- if (conversion == null)
- throw new ArgumentNullException("conversion");
- if (addHandler == null)
- throw new ArgumentNullException("addHandler");
- if (removeHandler == null)
- throw new ArgumentNullException("removeHandler");
-
- return s_impl.FromEvent<TDelegate, TEventArgs>(conversion, addHandler, removeHandler);
- }
-
- /// <summary>
- /// Converts a .NET event to an observable sequence, using a conversion function to obtain the event delegate. Each event invocation is surfaced through an OnNext message in the resulting sequence.
- /// For conversion of events conforming to the standard .NET event pattern, use any of the FromEventPattern overloads instead.
- /// </summary>
- /// <typeparam name="TDelegate">The delegate type of the event to be converted.</typeparam>
- /// <typeparam name="TEventArgs">The type of the event data generated by the event.</typeparam>
- /// <param name="conversion">A function used to convert the given event handler to a delegate compatible with the underlying .NET event. The resulting delegate is used in calls to the addHandler and removeHandler action parameters.</param>
- /// <param name="addHandler">Action that attaches the given event handler to the underlying .NET event.</param>
- /// <param name="removeHandler">Action that detaches the given event handler from the underlying .NET event.</param>
- /// <param name="scheduler">The scheduler to run the add and remove event handler logic on.</param>
- /// <returns>The observable sequence that contains the event argument objects passed to the invocations of the underlying .NET event.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="conversion"/> or <paramref name="addHandler"/> or <paramref name="removeHandler"/> or <paramref name="scheduler"/> is null.</exception>
- /// <remarks>
- /// <para>
- /// Add and remove handler invocations are made whenever the number of observers grows beyond zero.
- /// As such, an event handler may be shared by multiple simultaneously active observers, using a subject for multicasting.
- /// </para>
- /// <para>
- /// Add and remove handler invocations are run on the specified scheduler. This behavior allows add and remove handler operations for thread-affine events to be
- /// accessed from the same context, as required by some UI frameworks.
- /// </para>
- /// <para>
- /// It's recommended to lift FromEvent calls outside event stream query expressions. This best practice reduces clutter of bridging code inside queries,
- /// making the query expressions more concise and easier to understand. This has additional benefits for overloads of FromEvent that omit the IScheduler
- /// parameter. For more information, see the remarks section on those overloads.
- /// </para>
- /// </remarks>
- /// <seealso cref="Observable.ToEvent"/>
- public static IObservable<TEventArgs> FromEvent<TDelegate, TEventArgs>(Func<Action<TEventArgs>, TDelegate> conversion, Action<TDelegate> addHandler, Action<TDelegate> removeHandler, IScheduler scheduler)
- {
- if (conversion == null)
- throw new ArgumentNullException("conversion");
- if (addHandler == null)
- throw new ArgumentNullException("addHandler");
- if (removeHandler == null)
- throw new ArgumentNullException("removeHandler");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return s_impl.FromEvent<TDelegate, TEventArgs>(conversion, addHandler, removeHandler, scheduler);
- }
-
- /// <summary>
- /// Converts a .NET event to an observable sequence, using a supplied event delegate type. Each event invocation is surfaced through an OnNext message in the resulting sequence.
- /// For conversion of events conforming to the standard .NET event pattern, use any of the FromEventPattern overloads instead.
- /// </summary>
- /// <typeparam name="TDelegate">The delegate type of the event to be converted.</typeparam>
- /// <typeparam name="TEventArgs">The type of the event data generated by the event.</typeparam>
- /// <param name="addHandler">Action that attaches the given event handler to the underlying .NET event.</param>
- /// <param name="removeHandler">Action that detaches the given event handler from the underlying .NET event.</param>
- /// <returns>The observable sequence that contains the event argument objects passed to the invocations of the underlying .NET event.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="addHandler"/> or <paramref name="removeHandler"/> is null.</exception>
- /// <remarks>
- /// <para>
- /// Add and remove handler invocations are made whenever the number of observers grows beyond zero.
- /// As such, an event handler may be shared by multiple simultaneously active observers, using a subject for multicasting.
- /// </para>
- /// <para>
- /// The current <see cref="SynchronizationContext"/> is captured during the call to FromEvent, and is used to post add and remove handler invocations.
- /// This behavior ensures add and remove handler operations for thread-affine events are accessed from the same context, as required by some UI frameworks.
- /// </para>
- /// <para>
- /// If no SynchronizationContext is present at the point of calling FromEvent, add and remove handler invocations are made synchronously on the thread
- /// making the Subscribe or Dispose call, respectively.
- /// </para>
- /// <para>
- /// It's recommended to lift FromEvent calls outside event stream query expressions due to the free-threaded nature of Reactive Extensions. Doing so
- /// makes the captured SynchronizationContext predictable. This best practice also reduces clutter of bridging code inside queries, making the query expressions
- /// more concise and easier to understand.
- /// </para>
- /// </remarks>
- /// <seealso cref="Observable.ToEvent"/>
- public static IObservable<TEventArgs> FromEvent<TDelegate, TEventArgs>(Action<TDelegate> addHandler, Action<TDelegate> removeHandler)
- {
- if (addHandler == null)
- throw new ArgumentNullException("addHandler");
- if (removeHandler == null)
- throw new ArgumentNullException("removeHandler");
-
- return s_impl.FromEvent<TDelegate, TEventArgs>(addHandler, removeHandler);
- }
-
- /// <summary>
- /// Converts a .NET event to an observable sequence, using a supplied event delegate type. Each event invocation is surfaced through an OnNext message in the resulting sequence.
- /// For conversion of events conforming to the standard .NET event pattern, use any of the FromEventPattern overloads instead.
- /// </summary>
- /// <typeparam name="TDelegate">The delegate type of the event to be converted.</typeparam>
- /// <typeparam name="TEventArgs">The type of the event data generated by the event.</typeparam>
- /// <param name="addHandler">Action that attaches the given event handler to the underlying .NET event.</param>
- /// <param name="removeHandler">Action that detaches the given event handler from the underlying .NET event.</param>
- /// <param name="scheduler">The scheduler to run the add and remove event handler logic on.</param>
- /// <returns>The observable sequence that contains the event argument objects passed to the invocations of the underlying .NET event.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="addHandler"/> or <paramref name="removeHandler"/> or <paramref name="scheduler"/> is null.</exception>
- /// <remarks>
- /// <para>
- /// Add and remove handler invocations are made whenever the number of observers grows beyond zero.
- /// As such, an event handler may be shared by multiple simultaneously active observers, using a subject for multicasting.
- /// </para>
- /// <para>
- /// Add and remove handler invocations are run on the specified scheduler. This behavior allows add and remove handler operations for thread-affine events to be
- /// accessed from the same context, as required by some UI frameworks.
- /// </para>
- /// <para>
- /// It's recommended to lift FromEvent calls outside event stream query expressions. This best practice reduces clutter of bridging code inside queries,
- /// making the query expressions more concise and easier to understand. This has additional benefits for overloads of FromEvent that omit the IScheduler
- /// parameter. For more information, see the remarks section on those overloads.
- /// </para>
- /// </remarks>
- /// <seealso cref="Observable.ToEvent"/>
- public static IObservable<TEventArgs> FromEvent<TDelegate, TEventArgs>(Action<TDelegate> addHandler, Action<TDelegate> removeHandler, IScheduler scheduler)
- {
- if (addHandler == null)
- throw new ArgumentNullException("addHandler");
- if (removeHandler == null)
- throw new ArgumentNullException("removeHandler");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return s_impl.FromEvent<TDelegate, TEventArgs>(addHandler, removeHandler, scheduler);
- }
-
- #endregion
-
- #region Action<Action<TEventArgs>>
-
- /// <summary>
- /// Converts a generic Action-based .NET event to an observable sequence. Each event invocation is surfaced through an OnNext message in the resulting sequence.
- /// For conversion of events conforming to the standard .NET event pattern, use any of the FromEventPattern overloads instead.
- /// </summary>
- /// <typeparam name="TEventArgs">The type of the event data generated by the event.</typeparam>
- /// <param name="addHandler">Action that attaches the given event handler to the underlying .NET event.</param>
- /// <param name="removeHandler">Action that detaches the given event handler from the underlying .NET event.</param>
- /// <returns>The observable sequence that contains the event argument objects passed to the invocations of the underlying .NET event.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="addHandler"/> or <paramref name="removeHandler"/> is null.</exception>
- /// <remarks>
- /// <para>
- /// Add and remove handler invocations are made whenever the number of observers grows beyond zero.
- /// As such, an event handler may be shared by multiple simultaneously active observers, using a subject for multicasting.
- /// </para>
- /// <para>
- /// The current <see cref="SynchronizationContext"/> is captured during the call to FromEvent, and is used to post add and remove handler invocations.
- /// This behavior ensures add and remove handler operations for thread-affine events are accessed from the same context, as required by some UI frameworks.
- /// </para>
- /// <para>
- /// If no SynchronizationContext is present at the point of calling FromEvent, add and remove handler invocations are made synchronously on the thread
- /// making the Subscribe or Dispose call, respectively.
- /// </para>
- /// <para>
- /// It's recommended to lift FromEvent calls outside event stream query expressions due to the free-threaded nature of Reactive Extensions. Doing so
- /// makes the captured SynchronizationContext predictable. This best practice also reduces clutter of bridging code inside queries, making the query expressions
- /// more concise and easier to understand.
- /// </para>
- /// </remarks>
- /// <seealso cref="Observable.ToEvent"/>
- public static IObservable<TEventArgs> FromEvent<TEventArgs>(Action<Action<TEventArgs>> addHandler, Action<Action<TEventArgs>> removeHandler)
- {
- if (addHandler == null)
- throw new ArgumentNullException("addHandler");
- if (removeHandler == null)
- throw new ArgumentNullException("removeHandler");
-
- return s_impl.FromEvent<TEventArgs>(addHandler, removeHandler);
- }
-
- /// <summary>
- /// Converts a generic Action-based .NET event to an observable sequence. Each event invocation is surfaced through an OnNext message in the resulting sequence.
- /// For conversion of events conforming to the standard .NET event pattern, use any of the FromEventPattern overloads instead.
- /// </summary>
- /// <typeparam name="TEventArgs">The type of the event data generated by the event.</typeparam>
- /// <param name="addHandler">Action that attaches the given event handler to the underlying .NET event.</param>
- /// <param name="removeHandler">Action that detaches the given event handler from the underlying .NET event.</param>
- /// <param name="scheduler">The scheduler to run the add and remove event handler logic on.</param>
- /// <returns>The observable sequence that contains the event argument objects passed to the invocations of the underlying .NET event.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="addHandler"/> or <paramref name="removeHandler"/> or <paramref name="scheduler"/> is null.</exception>
- /// <remarks>
- /// <para>
- /// Add and remove handler invocations are made whenever the number of observers grows beyond zero.
- /// As such, an event handler may be shared by multiple simultaneously active observers, using a subject for multicasting.
- /// </para>
- /// <para>
- /// Add and remove handler invocations are run on the specified scheduler. This behavior allows add and remove handler operations for thread-affine events to be
- /// accessed from the same context, as required by some UI frameworks.
- /// </para>
- /// <para>
- /// It's recommended to lift FromEvent calls outside event stream query expressions. This best practice reduces clutter of bridging code inside queries,
- /// making the query expressions more concise and easier to understand. This has additional benefits for overloads of FromEvent that omit the IScheduler
- /// parameter. For more information, see the remarks section on those overloads.
- /// </para>
- /// </remarks>
- /// <seealso cref="Observable.ToEvent"/>
- public static IObservable<TEventArgs> FromEvent<TEventArgs>(Action<Action<TEventArgs>> addHandler, Action<Action<TEventArgs>> removeHandler, IScheduler scheduler)
- {
- if (addHandler == null)
- throw new ArgumentNullException("addHandler");
- if (removeHandler == null)
- throw new ArgumentNullException("removeHandler");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return s_impl.FromEvent<TEventArgs>(addHandler, removeHandler, scheduler);
- }
-
- #endregion
-
- #region Action<Action>
-
- /// <summary>
- /// Converts an Action-based .NET event to an observable sequence. Each event invocation is surfaced through an OnNext message in the resulting sequence.
- /// For conversion of events conforming to the standard .NET event pattern, use any of the FromEventPattern overloads instead.
- /// </summary>
- /// <param name="addHandler">Action that attaches the given event handler to the underlying .NET event.</param>
- /// <param name="removeHandler">Action that detaches the given event handler from the underlying .NET event.</param>
- /// <returns>The observable sequence that contains the event argument objects passed to the invocations of the underlying .NET event.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="addHandler"/> or <paramref name="removeHandler"/> is null.</exception>
- /// <remarks>
- /// <para>
- /// Add and remove handler invocations are made whenever the number of observers grows beyond zero.
- /// As such, an event handler may be shared by multiple simultaneously active observers, using a subject for multicasting.
- /// </para>
- /// <para>
- /// The current <see cref="SynchronizationContext"/> is captured during the call to FromEvent, and is used to post add and remove handler invocations.
- /// This behavior ensures add and remove handler operations for thread-affine events are accessed from the same context, as required by some UI frameworks.
- /// </para>
- /// <para>
- /// If no SynchronizationContext is present at the point of calling FromEvent, add and remove handler invocations are made synchronously on the thread
- /// making the Subscribe or Dispose call, respectively.
- /// </para>
- /// <para>
- /// It's recommended to lift FromEvent calls outside event stream query expressions due to the free-threaded nature of Reactive Extensions. Doing so
- /// makes the captured SynchronizationContext predictable. This best practice also reduces clutter of bridging code inside queries, making the query expressions
- /// more concise and easier to understand.
- /// </para>
- /// </remarks>
- /// <seealso cref="Observable.ToEvent"/>
- public static IObservable<Unit> FromEvent(Action<Action> addHandler, Action<Action> removeHandler)
- {
- if (addHandler == null)
- throw new ArgumentNullException("addHandler");
- if (removeHandler == null)
- throw new ArgumentNullException("removeHandler");
-
- return s_impl.FromEvent(addHandler, removeHandler);
- }
-
- /// <summary>
- /// Converts an Action-based .NET event to an observable sequence. Each event invocation is surfaced through an OnNext message in the resulting sequence.
- /// For conversion of events conforming to the standard .NET event pattern, use any of the FromEventPattern overloads instead.
- /// </summary>
- /// <param name="addHandler">Action that attaches the given event handler to the underlying .NET event.</param>
- /// <param name="removeHandler">Action that detaches the given event handler from the underlying .NET event.</param>
- /// <param name="scheduler">The scheduler to run the add and remove event handler logic on.</param>
- /// <returns>The observable sequence that contains the event argument objects passed to the invocations of the underlying .NET event.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="addHandler"/> or <paramref name="removeHandler"/> or <paramref name="scheduler"/> is null.</exception>
- /// <remarks>
- /// <para>
- /// Add and remove handler invocations are made whenever the number of observers grows beyond zero.
- /// As such, an event handler may be shared by multiple simultaneously active observers, using a subject for multicasting.
- /// </para>
- /// <para>
- /// Add and remove handler invocations are run on the specified scheduler. This behavior allows add and remove handler operations for thread-affine events to be
- /// accessed from the same context, as required by some UI frameworks.
- /// </para>
- /// <para>
- /// It's recommended to lift FromEvent calls outside event stream query expressions. This best practice reduces clutter of bridging code inside queries,
- /// making the query expressions more concise and easier to understand. This has additional benefits for overloads of FromEvent that omit the IScheduler
- /// parameter. For more information, see the remarks section on those overloads.
- /// </para>
- /// </remarks>
- /// <seealso cref="Observable.ToEvent"/>
- public static IObservable<Unit> FromEvent(Action<Action> addHandler, Action<Action> removeHandler, IScheduler scheduler)
- {
- if (addHandler == null)
- throw new ArgumentNullException("addHandler");
- if (removeHandler == null)
- throw new ArgumentNullException("removeHandler");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return s_impl.FromEvent(addHandler, removeHandler, scheduler);
- }
-
- #endregion
-
- #endregion
- }
-}
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observable.Imperative.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observable.Imperative.cs
deleted file mode 100644
index 0c8089e..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observable.Imperative.cs
+++ /dev/null
@@ -1,299 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System.Collections.Generic;
-using System.Reactive.Concurrency;
-using System.Threading;
-
-#if !NO_TPL
-using System.Threading.Tasks;
-#endif
-
-namespace System.Reactive.Linq
-{
- public static partial class Observable
- {
- #region ForEachAsync
-
-#if !NO_TPL
- /// <summary>
- /// Invokes an action for each element in the observable sequence, and returns a Task object that will get signaled when the sequence terminates.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence.</param>
- /// <param name="onNext">Action to invoke for each element in the observable sequence.</param>
- /// <returns>Task that signals the termination of the sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="onNext"/> is null.</exception>
- /// <remarks>This operator is especially useful in conjunction with the asynchronous programming features introduced in C# 5.0 and Visual Basic 11.</remarks>
- public static Task ForEachAsync<TSource>(this IObservable<TSource> source, Action<TSource> onNext)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (onNext == null)
- throw new ArgumentNullException("onNext");
-
- return s_impl.ForEachAsync<TSource>(source, onNext);
- }
-
- /// <summary>
- /// Invokes an action for each element in the observable sequence, and returns a Task object that will get signaled when the sequence terminates.
- /// The loop can be quit prematurely by setting the specified cancellation token.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence.</param>
- /// <param name="onNext">Action to invoke for each element in the observable sequence.</param>
- /// <param name="cancellationToken">Cancellation token used to stop the loop.</param>
- /// <returns>Task that signals the termination of the sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="onNext"/> is null.</exception>
- /// <remarks>This operator is especially useful in conjunction with the asynchronous programming features introduced in C# 5.0 and Visual Basic 11.</remarks>
- public static Task ForEachAsync<TSource>(this IObservable<TSource> source, Action<TSource> onNext, CancellationToken cancellationToken)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (onNext == null)
- throw new ArgumentNullException("onNext");
-
- return s_impl.ForEachAsync<TSource>(source, onNext, cancellationToken);
- }
-
- /// <summary>
- /// Invokes an action for each element in the observable sequence, incorporating the element's index, and returns a Task object that will get signaled when the sequence terminates.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence.</param>
- /// <param name="onNext">Action to invoke for each element in the observable sequence.</param>
- /// <returns>Task that signals the termination of the sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="onNext"/> is null.</exception>
- /// <remarks>This operator is especially useful in conjunction with the asynchronous programming features introduced in C# 5.0 and Visual Basic 11.</remarks>
- public static Task ForEachAsync<TSource>(this IObservable<TSource> source, Action<TSource, int> onNext)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (onNext == null)
- throw new ArgumentNullException("onNext");
-
- return s_impl.ForEachAsync<TSource>(source, onNext);
- }
-
- /// <summary>
- /// Invokes an action for each element in the observable sequence, incorporating the element's index, and returns a Task object that will get signaled when the sequence terminates.
- /// The loop can be quit prematurely by setting the specified cancellation token.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence.</param>
- /// <param name="onNext">Action to invoke for each element in the observable sequence.</param>
- /// <param name="cancellationToken">Cancellation token used to stop the loop.</param>
- /// <returns>Task that signals the termination of the sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="onNext"/> is null.</exception>
- /// <remarks>This operator is especially useful in conjunction with the asynchronous programming features introduced in C# 5.0 and Visual Basic 11.</remarks>
- public static Task ForEachAsync<TSource>(this IObservable<TSource> source, Action<TSource, int> onNext, CancellationToken cancellationToken)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (onNext == null)
- throw new ArgumentNullException("onNext");
-
- return s_impl.ForEachAsync<TSource>(source, onNext, cancellationToken);
- }
-#endif
-
- #endregion
-
- #region + Case +
-
- /// <summary>
- /// Uses <paramref name="selector"/> to determine which source in <paramref name="sources"/> to return, choosing <paramref name="defaultSource"/> if no match is found.
- /// </summary>
- /// <typeparam name="TValue">The type of the value returned by the selector function, used to look up the resulting source.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence.</typeparam>
- /// <param name="selector">Selector function invoked to determine the source to lookup in the <paramref name="sources"/> dictionary.</param>
- /// <param name="sources">Dictionary of sources to select from based on the <paramref name="selector"/> invocation result.</param>
- /// <param name="defaultSource">Default source to select in case no matching source in <paramref name="sources"/> is found.</param>
- /// <returns>The observable sequence retrieved from the <paramref name="sources"/> dictionary based on the <paramref name="selector"/> invocation result, or <paramref name="defaultSource"/> if no match is found.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="selector"/> or <paramref name="sources"/> or <paramref name="defaultSource"/> is null.</exception>
- public static IObservable<TResult> Case<TValue, TResult>(Func<TValue> selector, IDictionary<TValue, IObservable<TResult>> sources, IObservable<TResult> defaultSource)
- {
- if (selector == null)
- throw new ArgumentNullException("selector");
- if (sources == null)
- throw new ArgumentNullException("sources");
- if (defaultSource == null)
- throw new ArgumentNullException("defaultSource");
-
- return s_impl.Case<TValue, TResult>(selector, sources, defaultSource);
- }
-
- /// <summary>
- /// Uses <paramref name="selector"/> to determine which source in <paramref name="sources"/> to return, choosing an empty sequence on the specified scheduler if no match is found.
- /// </summary>
- /// <typeparam name="TValue">The type of the value returned by the selector function, used to look up the resulting source.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence.</typeparam>
- /// <param name="selector">Selector function invoked to determine the source to lookup in the <paramref name="sources"/> dictionary.</param>
- /// <param name="sources">Dictionary of sources to select from based on the <paramref name="selector"/> invocation result.</param>
- /// <param name="scheduler">Scheduler to generate an empty sequence on in case no matching source in <paramref name="sources"/> is found.</param>
- /// <returns>The observable sequence retrieved from the <paramref name="sources"/> dictionary based on the <paramref name="selector"/> invocation result, or an empty sequence if no match is found.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="selector"/> or <paramref name="sources"/> or <paramref name="scheduler"/> is null.</exception>
- public static IObservable<TResult> Case<TValue, TResult>(Func<TValue> selector, IDictionary<TValue, IObservable<TResult>> sources, IScheduler scheduler)
- {
- if (selector == null)
- throw new ArgumentNullException("selector");
- if (sources == null)
- throw new ArgumentNullException("sources");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return s_impl.Case<TValue, TResult>(selector, sources, scheduler);
- }
-
- /// <summary>
- /// Uses <paramref name="selector"/> to determine which source in <paramref name="sources"/> to return, choosing an empty sequence if no match is found.
- /// </summary>
- /// <typeparam name="TValue">The type of the value returned by the selector function, used to look up the resulting source.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence.</typeparam>
- /// <param name="selector">Selector function invoked to determine the source to lookup in the <paramref name="sources"/> dictionary.</param>
- /// <param name="sources">Dictionary of sources to select from based on the <paramref name="selector"/> invocation result.</param>
- /// <returns>The observable sequence retrieved from the <paramref name="sources"/> dictionary based on the <paramref name="selector"/> invocation result, or an empty sequence if no match is found.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="selector"/> or <paramref name="sources"/> is null.</exception>
- public static IObservable<TResult> Case<TValue, TResult>(Func<TValue> selector, IDictionary<TValue, IObservable<TResult>> sources)
- {
- if (selector == null)
- throw new ArgumentNullException("selector");
- if (sources == null)
- throw new ArgumentNullException("sources");
-
- return s_impl.Case<TValue, TResult>(selector, sources);
- }
-
- #endregion
-
- #region + DoWhile +
-
- /// <summary>
- /// Repeats the given <paramref name="source"/> as long as the specified <paramref name="condition"/> holds, where the <paramref name="condition"/> is evaluated after each repeated <paramref name="source"/> completed.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source to repeat as long as the <paramref name="condition"/> function evaluates to true.</param>
- /// <param name="condition">Condition that will be evaluated upon the completion of an iteration through the <paramref name="source"/>, to determine whether repetition of the source is required.</param>
- /// <returns>The observable sequence obtained by concatenating the <paramref name="source"/> sequence as long as the <paramref name="condition"/> holds.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="condition"/> is null.</exception>
- public static IObservable<TSource> DoWhile<TSource>(this IObservable<TSource> source, Func<bool> condition)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (condition == null)
- throw new ArgumentNullException("condition");
-
- return s_impl.DoWhile<TSource>(source, condition);
- }
-
- #endregion
-
- #region + For +
-
- /// <summary>
- /// Concatenates the observable sequences obtained by running the <paramref name="resultSelector"/> for each element in the given enumerable <paramref name="source"/>.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the enumerable source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the observable result sequence.</typeparam>
- /// <param name="source">Enumerable source for which each element will be mapped onto an observable source that will be concatenated in the result sequence.</param>
- /// <param name="resultSelector">Function to select an observable source for each element in the <paramref name="source"/>.</param>
- /// <returns>The observable sequence obtained by concatenating the sources returned by <paramref name="resultSelector"/> for each element in the <paramref name="source"/>.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="resultSelector"/> is null.</exception>
- public static IObservable<TResult> For<TSource, TResult>(IEnumerable<TSource> source, Func<TSource, IObservable<TResult>> resultSelector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (resultSelector == null)
- throw new ArgumentNullException("resultSelector");
-
- return s_impl.For<TSource, TResult>(source, resultSelector);
- }
-
- #endregion
-
- #region + If +
-
- /// <summary>
- /// If the specified <paramref name="condition"/> evaluates true, select the <paramref name="thenSource"/> sequence. Otherwise, select the <paramref name="elseSource"/> sequence.
- /// </summary>
- /// <typeparam name="TResult">The type of the elements in the result sequence.</typeparam>
- /// <param name="condition">Condition evaluated to decide which sequence to return.</param>
- /// <param name="thenSource">Sequence returned in case <paramref name="condition"/> evaluates true.</param>
- /// <param name="elseSource">Sequence returned in case <paramref name="condition"/> evaluates false.</param>
- /// <returns><paramref name="thenSource"/> if <paramref name="condition"/> evaluates true; <paramref name="elseSource"/> otherwise.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="condition"/> or <paramref name="thenSource"/> or <paramref name="elseSource"/> is null.</exception>
- public static IObservable<TResult> If<TResult>(Func<bool> condition, IObservable<TResult> thenSource, IObservable<TResult> elseSource)
- {
- if (condition == null)
- throw new ArgumentNullException("condition");
- if (thenSource == null)
- throw new ArgumentNullException("thenSource");
- if (elseSource == null)
- throw new ArgumentNullException("elseSource");
-
- return s_impl.If<TResult>(condition, thenSource, elseSource);
- }
-
- /// <summary>
- /// If the specified <paramref name="condition"/> evaluates true, select the <paramref name="thenSource"/> sequence. Otherwise, return an empty sequence.
- /// </summary>
- /// <typeparam name="TResult">The type of the elements in the result sequence.</typeparam>
- /// <param name="condition">Condition evaluated to decide which sequence to return.</param>
- /// <param name="thenSource">Sequence returned in case <paramref name="condition"/> evaluates true.</param>
- /// <returns><paramref name="thenSource"/> if <paramref name="condition"/> evaluates true; an empty sequence otherwise.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="condition"/> or <paramref name="thenSource"/> is null.</exception>
- public static IObservable<TResult> If<TResult>(Func<bool> condition, IObservable<TResult> thenSource)
- {
- if (condition == null)
- throw new ArgumentNullException("condition");
- if (thenSource == null)
- throw new ArgumentNullException("thenSource");
-
- return s_impl.If<TResult>(condition, thenSource);
- }
-
- /// <summary>
- /// If the specified <paramref name="condition"/> evaluates true, select the <paramref name="thenSource"/> sequence. Otherwise, return an empty sequence generated on the specified scheduler.
- /// </summary>
- /// <typeparam name="TResult">The type of the elements in the result sequence.</typeparam>
- /// <param name="condition">Condition evaluated to decide which sequence to return.</param>
- /// <param name="thenSource">Sequence returned in case <paramref name="condition"/> evaluates true.</param>
- /// <param name="scheduler">Scheduler to generate an empty sequence on in case <paramref name="condition"/> evaluates false.</param>
- /// <returns><paramref name="thenSource"/> if <paramref name="condition"/> evaluates true; an empty sequence otherwise.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="condition"/> or <paramref name="thenSource"/> or <paramref name="scheduler"/> is null.</exception>
- public static IObservable<TResult> If<TResult>(Func<bool> condition, IObservable<TResult> thenSource, IScheduler scheduler)
- {
- if (condition == null)
- throw new ArgumentNullException("condition");
- if (thenSource == null)
- throw new ArgumentNullException("thenSource");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return s_impl.If<TResult>(condition, thenSource, scheduler);
- }
-
- #endregion
-
- #region + While +
-
- /// <summary>
- /// Repeats the given <paramref name="source"/> as long as the specified <paramref name="condition"/> holds, where the <paramref name="condition"/> is evaluated before each repeated <paramref name="source"/> is subscribed to.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source to repeat as long as the <paramref name="condition"/> function evaluates to true.</param>
- /// <param name="condition">Condition that will be evaluated before subscription to the <paramref name="source"/>, to determine whether repetition of the source is required.</param>
- /// <returns>The observable sequence obtained by concatenating the <paramref name="source"/> sequence as long as the <paramref name="condition"/> holds.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="condition"/> or <paramref name="source"/> is null.</exception>
- public static IObservable<TSource> While<TSource>(Func<bool> condition, IObservable<TSource> source)
- {
- if (condition == null)
- throw new ArgumentNullException("condition");
- if (source == null)
- throw new ArgumentNullException("source");
-
- return s_impl.While<TSource>(condition, source);
- }
-
- #endregion
- }
-} \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observable.Joins.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observable.Joins.cs
deleted file mode 100644
index 68afbb9..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observable.Joins.cs
+++ /dev/null
@@ -1,91 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System.Collections.Generic;
-using System.Reactive.Disposables;
-using System.Reactive.Joins;
-
-namespace System.Reactive.Linq
-{
- public static partial class Observable
- {
- #region And
-
- /// <summary>
- /// Creates a pattern that matches when both observable sequences have an available element.
- /// </summary>
- /// <typeparam name="TLeft">The type of the elements in the left sequence.</typeparam>
- /// <typeparam name="TRight">The type of the elements in the right sequence.</typeparam>
- /// <param name="left">Observable sequence to match with the right sequence.</param>
- /// <param name="right">Observable sequence to match with the left sequence.</param>
- /// <returns>Pattern object that matches when both observable sequences have an available element.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="left"/> or <paramref name="right"/> is null.</exception>
- public static Pattern<TLeft, TRight> And<TLeft, TRight>(this IObservable<TLeft> left, IObservable<TRight> right)
- {
- if (left == null)
- throw new ArgumentNullException("left");
- if (right == null)
- throw new ArgumentNullException("right");
-
- return s_impl.And<TLeft, TRight>(left, right);
- }
-
- #endregion
-
- #region Then
-
- /// <summary>
- /// Matches when the observable sequence has an available element and projects the element by invoking the selector function.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
- /// <param name="source">Observable sequence to apply the selector on.</param>
- /// <param name="selector">Selector that will be invoked for elements in the source sequence.</param>
- /// <returns>Plan that produces the projected results, to be fed (with other plans) to the When operator.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> is null.</exception>
- public static Plan<TResult> Then<TSource, TResult>(this IObservable<TSource> source, Func<TSource, TResult> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return s_impl.Then<TSource, TResult>(source, selector);
- }
-
- #endregion
-
- #region When
-
- /// <summary>
- /// Joins together the results from several patterns.
- /// </summary>
- /// <typeparam name="TResult">The type of the elements in the result sequence, obtained from the specified patterns.</typeparam>
- /// <param name="plans">A series of plans created by use of the Then operator on patterns.</param>
- /// <returns>An observable sequence with the results from matching several patterns.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="plans"/> is null.</exception>
- public static IObservable<TResult> When<TResult>(params Plan<TResult>[] plans)
- {
- if (plans == null)
- throw new ArgumentNullException("plans");
-
- return s_impl.When<TResult>(plans);
- }
-
- /// <summary>
- /// Joins together the results from several patterns.
- /// </summary>
- /// <typeparam name="TResult">The type of the elements in the result sequence, obtained from the specified patterns.</typeparam>
- /// <param name="plans">A series of plans created by use of the Then operator on patterns.</param>
- /// <returns>An observable sequence with the results form matching several patterns.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="plans"/> is null.</exception>
- public static IObservable<TResult> When<TResult>(this IEnumerable<Plan<TResult>> plans)
- {
- if (plans == null)
- throw new ArgumentNullException("plans");
-
- return s_impl.When<TResult>(plans);
- }
-
- #endregion
- }
-}
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observable.Multiple.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observable.Multiple.cs
deleted file mode 100644
index 9cb62de..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observable.Multiple.cs
+++ /dev/null
@@ -1,2386 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System.Collections.Generic;
-using System.Reactive.Concurrency;
-
-#if !NO_TPL
-using System.Threading; // Used in XML doc comments
-using System.Threading.Tasks;
-#endif
-
-namespace System.Reactive.Linq
-{
- public static partial class Observable
- {
- #region + Amb +
-
- /// <summary>
- /// Propagates the observable sequence that reacts first.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequences.</typeparam>
- /// <param name="first">First observable sequence.</param>
- /// <param name="second">Second observable sequence.</param>
- /// <returns>An observable sequence that surfaces either of the given sequences, whichever reacted first.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="first"/> or <paramref name="second"/> is null.</exception>
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Amb", Justification = "In honor of McCarthy.")]
- public static IObservable<TSource> Amb<TSource>(this IObservable<TSource> first, IObservable<TSource> second)
- {
- if (first == null)
- throw new ArgumentNullException("first");
- if (second == null)
- throw new ArgumentNullException("second");
-
- return s_impl.Amb<TSource>(first, second);
- }
-
- /// <summary>
- /// Propagates the observable sequence that reacts first.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequences.</typeparam>
- /// <param name="sources">Observable sources competing to react first.</param>
- /// <returns>An observable sequence that surfaces any of the given sequences, whichever reacted first.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="sources"/> is null.</exception>
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Amb", Justification = "In honor of McCarthy.")]
- public static IObservable<TSource> Amb<TSource>(params IObservable<TSource>[] sources)
- {
- if (sources == null)
- throw new ArgumentNullException("sources");
-
- return s_impl.Amb<TSource>(sources);
- }
-
- /// <summary>
- /// Propagates the observable sequence that reacts first.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequences.</typeparam>
- /// <param name="sources">Observable sources competing to react first.</param>
- /// <returns>An observable sequence that surfaces any of the given sequences, whichever reacted first.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="sources"/> is null.</exception>
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Amb", Justification = "In honor of McCarthy.")]
- public static IObservable<TSource> Amb<TSource>(this IEnumerable<IObservable<TSource>> sources)
- {
- if (sources == null)
- throw new ArgumentNullException("sources");
-
- return s_impl.Amb<TSource>(sources);
- }
-
- #endregion
-
- #region Buffer
-
- /// <summary>
- /// Projects each element of an observable sequence into consecutive non-overlapping buffers.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence, and in the lists in the result sequence.</typeparam>
- /// <typeparam name="TBufferClosing">The type of the elements in the sequences indicating buffer closing events.</typeparam>
- /// <param name="source">Source sequence to produce buffers over.</param>
- /// <param name="bufferClosingSelector">A function invoked to define the boundaries of the produced buffers. A new buffer is started when the previous one is closed.</param>
- /// <returns>An observable sequence of buffers.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="bufferClosingSelector"/> is null.</exception>
- public static IObservable<IList<TSource>> Buffer<TSource, TBufferClosing>(this IObservable<TSource> source, Func<IObservable<TBufferClosing>> bufferClosingSelector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (bufferClosingSelector == null)
- throw new ArgumentNullException("bufferClosingSelector");
-
- return s_impl.Buffer<TSource, TBufferClosing>(source, bufferClosingSelector);
- }
-
- /// <summary>
- /// Projects each element of an observable sequence into zero or more buffers.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence, and in the lists in the result sequence.</typeparam>
- /// <typeparam name="TBufferOpening">The type of the elements in the sequence indicating buffer opening events, also passed to the closing selector to obtain a sequence of buffer closing events.</typeparam>
- /// <typeparam name="TBufferClosing">The type of the elements in the sequences indicating buffer closing events.</typeparam>
- /// <param name="source">Source sequence to produce buffers over.</param>
- /// <param name="bufferOpenings">Observable sequence whose elements denote the creation of new buffers.</param>
- /// <param name="bufferClosingSelector">A function invoked to define the closing of each produced buffer.</param>
- /// <returns>An observable sequence of buffers.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="bufferOpenings"/> or <paramref name="bufferClosingSelector"/> is null.</exception>
- public static IObservable<IList<TSource>> Buffer<TSource, TBufferOpening, TBufferClosing>(this IObservable<TSource> source, IObservable<TBufferOpening> bufferOpenings, Func<TBufferOpening, IObservable<TBufferClosing>> bufferClosingSelector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (bufferOpenings == null)
- throw new ArgumentNullException("bufferOpenings");
- if (bufferClosingSelector == null)
- throw new ArgumentNullException("bufferClosingSelector");
-
- return s_impl.Buffer<TSource, TBufferOpening, TBufferClosing>(source, bufferOpenings, bufferClosingSelector);
- }
-
- /// <summary>
- /// Projects each element of an observable sequence into consecutive non-overlapping buffers.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence, and in the lists in the result sequence.</typeparam>
- /// <typeparam name="TBufferBoundary">The type of the elements in the sequences indicating buffer boundary events.</typeparam>
- /// <param name="source">Source sequence to produce buffers over.</param>
- /// <param name="bufferBoundaries">Sequence of buffer boundary markers. The current buffer is closed and a new buffer is opened upon receiving a boundary marker.</param>
- /// <returns>An observable sequence of buffers.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="bufferBoundaries"/> is null.</exception>
- public static IObservable<IList<TSource>> Buffer<TSource, TBufferBoundary>(this IObservable<TSource> source, IObservable<TBufferBoundary> bufferBoundaries)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (bufferBoundaries == null)
- throw new ArgumentNullException("bufferBoundaries");
-
- return s_impl.Buffer<TSource, TBufferBoundary>(source, bufferBoundaries);
- }
-
- #endregion
-
- #region + Catch +
-
- /// <summary>
- /// Continues an observable sequence that is terminated by an exception of the specified type with the observable sequence produced by the handler.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence and sequences returned by the exception handler function.</typeparam>
- /// <typeparam name="TException">The type of the exception to catch and handle. Needs to derive from <see cref="System.Exception"/>.</typeparam>
- /// <param name="source">Source sequence.</param>
- /// <param name="handler">Exception handler function, producing another observable sequence.</param>
- /// <returns>An observable sequence containing the source sequence's elements, followed by the elements produced by the handler's resulting observable sequence in case an exception occurred.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="handler"/> is null.</exception>
- public static IObservable<TSource> Catch<TSource, TException>(this IObservable<TSource> source, Func<TException, IObservable<TSource>> handler) where TException : Exception
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (handler == null)
- throw new ArgumentNullException("handler");
-
- return s_impl.Catch<TSource, TException>(source, handler);
- }
-
- /// <summary>
- /// Continues an observable sequence that is terminated by an exception with the next observable sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence and handler sequence.</typeparam>
- /// <param name="first">First observable sequence whose exception (if any) is caught.</param>
- /// <param name="second">Second observable sequence used to produce results when an error occurred in the first sequence.</param>
- /// <returns>An observable sequence containing the first sequence's elements, followed by the elements of the second sequence in case an exception occurred.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="first"/> or <paramref name="second"/> is null.</exception>
- public static IObservable<TSource> Catch<TSource>(this IObservable<TSource> first, IObservable<TSource> second)
- {
- if (first == null)
- throw new ArgumentNullException("first");
- if (second == null)
- throw new ArgumentNullException("second");
-
- return s_impl.Catch<TSource>(first, second);
- }
-
- /// <summary>
- /// Continues an observable sequence that is terminated by an exception with the next observable sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source and handler sequences.</typeparam>
- /// <param name="sources">Observable sequences to catch exceptions for.</param>
- /// <returns>An observable sequence containing elements from consecutive source sequences until a source sequence terminates successfully.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="sources"/> is null.</exception>
- public static IObservable<TSource> Catch<TSource>(params IObservable<TSource>[] sources)
- {
- if (sources == null)
- throw new ArgumentNullException("sources");
-
- return s_impl.Catch<TSource>(sources);
- }
-
- /// <summary>
- /// Continues an observable sequence that is terminated by an exception with the next observable sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source and handler sequences.</typeparam>
- /// <param name="sources">Observable sequences to catch exceptions for.</param>
- /// <returns>An observable sequence containing elements from consecutive source sequences until a source sequence terminates successfully.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="sources"/> is null.</exception>
- public static IObservable<TSource> Catch<TSource>(this IEnumerable<IObservable<TSource>> sources)
- {
- if (sources == null)
- throw new ArgumentNullException("sources");
-
- return s_impl.Catch<TSource>(sources);
- }
-
- #endregion
-
- #region + CombineLatest +
-
- /// <summary>
- /// Merges two observable sequences into one observable sequence by using the selector function whenever one of the observable sequences produces an element.
- /// </summary>
- /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
- /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
- /// <param name="first">First observable source.</param>
- /// <param name="second">Second observable source.</param>
- /// <param name="resultSelector">Function to invoke whenever either of the sources produces an element.</param>
- /// <returns>An observable sequence containing the result of combining elements of both sources using the specified result selector function.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="first"/> or <paramref name="second"/> or <paramref name="resultSelector"/> is null.</exception>
- public static IObservable<TResult> CombineLatest<TSource1, TSource2, TResult>(this IObservable<TSource1> first, IObservable<TSource2> second, Func<TSource1, TSource2, TResult> resultSelector)
- {
- if (first == null)
- throw new ArgumentNullException("first");
- if (second == null)
- throw new ArgumentNullException("second");
- if (resultSelector == null)
- throw new ArgumentNullException("resultSelector");
-
- return s_impl.CombineLatest<TSource1, TSource2, TResult>(first, second, resultSelector);
- }
-
-#if !NO_PERF
-
- /* The following code is generated by a tool checked in to $/.../Source/Tools/CodeGenerators. */
-
- #region CombineLatest auto-generated code (8/3/2012 6:37:08 PM)
-
- /// <summary>
- /// Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element.
- /// </summary>
- /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
- /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
- /// <typeparam name="TSource3">The type of the elements in the third source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
- /// <param name="source1">First observable source.</param>
- /// <param name="source2">Second observable source.</param>
- /// <param name="source3">Third observable source.</param>
- /// <param name="resultSelector">Function to invoke whenever any of the sources produces an element.</param>
- /// <returns>An observable sequence containing the result of combining elements of the sources using the specified result selector function.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source1"/> or <paramref name="source2"/> or <paramref name="source3"/> or <paramref name="resultSelector"/> is null.</exception>
- public static IObservable<TResult> CombineLatest<TSource1, TSource2, TSource3, TResult>(this IObservable<TSource1> source1, IObservable<TSource2> source2, IObservable<TSource3> source3, Func<TSource1, TSource2, TSource3, TResult> resultSelector)
- {
- if (source1 == null)
- throw new ArgumentNullException("source1");
- if (source2 == null)
- throw new ArgumentNullException("source2");
- if (source3 == null)
- throw new ArgumentNullException("source3");
- if (resultSelector == null)
- throw new ArgumentNullException("resultSelector");
-
- return s_impl.CombineLatest<TSource1, TSource2, TSource3, TResult>(source1, source2, source3, resultSelector);
- }
-
- /// <summary>
- /// Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element.
- /// </summary>
- /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
- /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
- /// <typeparam name="TSource3">The type of the elements in the third source sequence.</typeparam>
- /// <typeparam name="TSource4">The type of the elements in the fourth source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
- /// <param name="source1">First observable source.</param>
- /// <param name="source2">Second observable source.</param>
- /// <param name="source3">Third observable source.</param>
- /// <param name="source4">Fourth observable source.</param>
- /// <param name="resultSelector">Function to invoke whenever any of the sources produces an element.</param>
- /// <returns>An observable sequence containing the result of combining elements of the sources using the specified result selector function.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source1"/> or <paramref name="source2"/> or <paramref name="source3"/> or <paramref name="source4"/> or <paramref name="resultSelector"/> is null.</exception>
- public static IObservable<TResult> CombineLatest<TSource1, TSource2, TSource3, TSource4, TResult>(this IObservable<TSource1> source1, IObservable<TSource2> source2, IObservable<TSource3> source3, IObservable<TSource4> source4, Func<TSource1, TSource2, TSource3, TSource4, TResult> resultSelector)
- {
- if (source1 == null)
- throw new ArgumentNullException("source1");
- if (source2 == null)
- throw new ArgumentNullException("source2");
- if (source3 == null)
- throw new ArgumentNullException("source3");
- if (source4 == null)
- throw new ArgumentNullException("source4");
- if (resultSelector == null)
- throw new ArgumentNullException("resultSelector");
-
- return s_impl.CombineLatest<TSource1, TSource2, TSource3, TSource4, TResult>(source1, source2, source3, source4, resultSelector);
- }
-
-#if !NO_LARGEARITY
- /// <summary>
- /// Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element.
- /// </summary>
- /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
- /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
- /// <typeparam name="TSource3">The type of the elements in the third source sequence.</typeparam>
- /// <typeparam name="TSource4">The type of the elements in the fourth source sequence.</typeparam>
- /// <typeparam name="TSource5">The type of the elements in the fifth source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
- /// <param name="source1">First observable source.</param>
- /// <param name="source2">Second observable source.</param>
- /// <param name="source3">Third observable source.</param>
- /// <param name="source4">Fourth observable source.</param>
- /// <param name="source5">Fifth observable source.</param>
- /// <param name="resultSelector">Function to invoke whenever any of the sources produces an element.</param>
- /// <returns>An observable sequence containing the result of combining elements of the sources using the specified result selector function.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source1"/> or <paramref name="source2"/> or <paramref name="source3"/> or <paramref name="source4"/> or <paramref name="source5"/> or <paramref name="resultSelector"/> is null.</exception>
- public static IObservable<TResult> CombineLatest<TSource1, TSource2, TSource3, TSource4, TSource5, TResult>(this IObservable<TSource1> source1, IObservable<TSource2> source2, IObservable<TSource3> source3, IObservable<TSource4> source4, IObservable<TSource5> source5, Func<TSource1, TSource2, TSource3, TSource4, TSource5, TResult> resultSelector)
- {
- if (source1 == null)
- throw new ArgumentNullException("source1");
- if (source2 == null)
- throw new ArgumentNullException("source2");
- if (source3 == null)
- throw new ArgumentNullException("source3");
- if (source4 == null)
- throw new ArgumentNullException("source4");
- if (source5 == null)
- throw new ArgumentNullException("source5");
- if (resultSelector == null)
- throw new ArgumentNullException("resultSelector");
-
- return s_impl.CombineLatest<TSource1, TSource2, TSource3, TSource4, TSource5, TResult>(source1, source2, source3, source4, source5, resultSelector);
- }
-
- /// <summary>
- /// Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element.
- /// </summary>
- /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
- /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
- /// <typeparam name="TSource3">The type of the elements in the third source sequence.</typeparam>
- /// <typeparam name="TSource4">The type of the elements in the fourth source sequence.</typeparam>
- /// <typeparam name="TSource5">The type of the elements in the fifth source sequence.</typeparam>
- /// <typeparam name="TSource6">The type of the elements in the sixth source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
- /// <param name="source1">First observable source.</param>
- /// <param name="source2">Second observable source.</param>
- /// <param name="source3">Third observable source.</param>
- /// <param name="source4">Fourth observable source.</param>
- /// <param name="source5">Fifth observable source.</param>
- /// <param name="source6">Sixth observable source.</param>
- /// <param name="resultSelector">Function to invoke whenever any of the sources produces an element.</param>
- /// <returns>An observable sequence containing the result of combining elements of the sources using the specified result selector function.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source1"/> or <paramref name="source2"/> or <paramref name="source3"/> or <paramref name="source4"/> or <paramref name="source5"/> or <paramref name="source6"/> or <paramref name="resultSelector"/> is null.</exception>
- public static IObservable<TResult> CombineLatest<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TResult>(this IObservable<TSource1> source1, IObservable<TSource2> source2, IObservable<TSource3> source3, IObservable<TSource4> source4, IObservable<TSource5> source5, IObservable<TSource6> source6, Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TResult> resultSelector)
- {
- if (source1 == null)
- throw new ArgumentNullException("source1");
- if (source2 == null)
- throw new ArgumentNullException("source2");
- if (source3 == null)
- throw new ArgumentNullException("source3");
- if (source4 == null)
- throw new ArgumentNullException("source4");
- if (source5 == null)
- throw new ArgumentNullException("source5");
- if (source6 == null)
- throw new ArgumentNullException("source6");
- if (resultSelector == null)
- throw new ArgumentNullException("resultSelector");
-
- return s_impl.CombineLatest<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TResult>(source1, source2, source3, source4, source5, source6, resultSelector);
- }
-
- /// <summary>
- /// Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element.
- /// </summary>
- /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
- /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
- /// <typeparam name="TSource3">The type of the elements in the third source sequence.</typeparam>
- /// <typeparam name="TSource4">The type of the elements in the fourth source sequence.</typeparam>
- /// <typeparam name="TSource5">The type of the elements in the fifth source sequence.</typeparam>
- /// <typeparam name="TSource6">The type of the elements in the sixth source sequence.</typeparam>
- /// <typeparam name="TSource7">The type of the elements in the seventh source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
- /// <param name="source1">First observable source.</param>
- /// <param name="source2">Second observable source.</param>
- /// <param name="source3">Third observable source.</param>
- /// <param name="source4">Fourth observable source.</param>
- /// <param name="source5">Fifth observable source.</param>
- /// <param name="source6">Sixth observable source.</param>
- /// <param name="source7">Seventh observable source.</param>
- /// <param name="resultSelector">Function to invoke whenever any of the sources produces an element.</param>
- /// <returns>An observable sequence containing the result of combining elements of the sources using the specified result selector function.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source1"/> or <paramref name="source2"/> or <paramref name="source3"/> or <paramref name="source4"/> or <paramref name="source5"/> or <paramref name="source6"/> or <paramref name="source7"/> or <paramref name="resultSelector"/> is null.</exception>
- public static IObservable<TResult> CombineLatest<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TResult>(this IObservable<TSource1> source1, IObservable<TSource2> source2, IObservable<TSource3> source3, IObservable<TSource4> source4, IObservable<TSource5> source5, IObservable<TSource6> source6, IObservable<TSource7> source7, Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TResult> resultSelector)
- {
- if (source1 == null)
- throw new ArgumentNullException("source1");
- if (source2 == null)
- throw new ArgumentNullException("source2");
- if (source3 == null)
- throw new ArgumentNullException("source3");
- if (source4 == null)
- throw new ArgumentNullException("source4");
- if (source5 == null)
- throw new ArgumentNullException("source5");
- if (source6 == null)
- throw new ArgumentNullException("source6");
- if (source7 == null)
- throw new ArgumentNullException("source7");
- if (resultSelector == null)
- throw new ArgumentNullException("resultSelector");
-
- return s_impl.CombineLatest<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TResult>(source1, source2, source3, source4, source5, source6, source7, resultSelector);
- }
-
- /// <summary>
- /// Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element.
- /// </summary>
- /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
- /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
- /// <typeparam name="TSource3">The type of the elements in the third source sequence.</typeparam>
- /// <typeparam name="TSource4">The type of the elements in the fourth source sequence.</typeparam>
- /// <typeparam name="TSource5">The type of the elements in the fifth source sequence.</typeparam>
- /// <typeparam name="TSource6">The type of the elements in the sixth source sequence.</typeparam>
- /// <typeparam name="TSource7">The type of the elements in the seventh source sequence.</typeparam>
- /// <typeparam name="TSource8">The type of the elements in the eighth source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
- /// <param name="source1">First observable source.</param>
- /// <param name="source2">Second observable source.</param>
- /// <param name="source3">Third observable source.</param>
- /// <param name="source4">Fourth observable source.</param>
- /// <param name="source5">Fifth observable source.</param>
- /// <param name="source6">Sixth observable source.</param>
- /// <param name="source7">Seventh observable source.</param>
- /// <param name="source8">Eighth observable source.</param>
- /// <param name="resultSelector">Function to invoke whenever any of the sources produces an element.</param>
- /// <returns>An observable sequence containing the result of combining elements of the sources using the specified result selector function.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source1"/> or <paramref name="source2"/> or <paramref name="source3"/> or <paramref name="source4"/> or <paramref name="source5"/> or <paramref name="source6"/> or <paramref name="source7"/> or <paramref name="source8"/> or <paramref name="resultSelector"/> is null.</exception>
- public static IObservable<TResult> CombineLatest<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TResult>(this IObservable<TSource1> source1, IObservable<TSource2> source2, IObservable<TSource3> source3, IObservable<TSource4> source4, IObservable<TSource5> source5, IObservable<TSource6> source6, IObservable<TSource7> source7, IObservable<TSource8> source8, Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TResult> resultSelector)
- {
- if (source1 == null)
- throw new ArgumentNullException("source1");
- if (source2 == null)
- throw new ArgumentNullException("source2");
- if (source3 == null)
- throw new ArgumentNullException("source3");
- if (source4 == null)
- throw new ArgumentNullException("source4");
- if (source5 == null)
- throw new ArgumentNullException("source5");
- if (source6 == null)
- throw new ArgumentNullException("source6");
- if (source7 == null)
- throw new ArgumentNullException("source7");
- if (source8 == null)
- throw new ArgumentNullException("source8");
- if (resultSelector == null)
- throw new ArgumentNullException("resultSelector");
-
- return s_impl.CombineLatest<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TResult>(source1, source2, source3, source4, source5, source6, source7, source8, resultSelector);
- }
-
- /// <summary>
- /// Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element.
- /// </summary>
- /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
- /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
- /// <typeparam name="TSource3">The type of the elements in the third source sequence.</typeparam>
- /// <typeparam name="TSource4">The type of the elements in the fourth source sequence.</typeparam>
- /// <typeparam name="TSource5">The type of the elements in the fifth source sequence.</typeparam>
- /// <typeparam name="TSource6">The type of the elements in the sixth source sequence.</typeparam>
- /// <typeparam name="TSource7">The type of the elements in the seventh source sequence.</typeparam>
- /// <typeparam name="TSource8">The type of the elements in the eighth source sequence.</typeparam>
- /// <typeparam name="TSource9">The type of the elements in the ninth source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
- /// <param name="source1">First observable source.</param>
- /// <param name="source2">Second observable source.</param>
- /// <param name="source3">Third observable source.</param>
- /// <param name="source4">Fourth observable source.</param>
- /// <param name="source5">Fifth observable source.</param>
- /// <param name="source6">Sixth observable source.</param>
- /// <param name="source7">Seventh observable source.</param>
- /// <param name="source8">Eighth observable source.</param>
- /// <param name="source9">Ninth observable source.</param>
- /// <param name="resultSelector">Function to invoke whenever any of the sources produces an element.</param>
- /// <returns>An observable sequence containing the result of combining elements of the sources using the specified result selector function.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source1"/> or <paramref name="source2"/> or <paramref name="source3"/> or <paramref name="source4"/> or <paramref name="source5"/> or <paramref name="source6"/> or <paramref name="source7"/> or <paramref name="source8"/> or <paramref name="source9"/> or <paramref name="resultSelector"/> is null.</exception>
- public static IObservable<TResult> CombineLatest<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TResult>(this IObservable<TSource1> source1, IObservable<TSource2> source2, IObservable<TSource3> source3, IObservable<TSource4> source4, IObservable<TSource5> source5, IObservable<TSource6> source6, IObservable<TSource7> source7, IObservable<TSource8> source8, IObservable<TSource9> source9, Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TResult> resultSelector)
- {
- if (source1 == null)
- throw new ArgumentNullException("source1");
- if (source2 == null)
- throw new ArgumentNullException("source2");
- if (source3 == null)
- throw new ArgumentNullException("source3");
- if (source4 == null)
- throw new ArgumentNullException("source4");
- if (source5 == null)
- throw new ArgumentNullException("source5");
- if (source6 == null)
- throw new ArgumentNullException("source6");
- if (source7 == null)
- throw new ArgumentNullException("source7");
- if (source8 == null)
- throw new ArgumentNullException("source8");
- if (source9 == null)
- throw new ArgumentNullException("source9");
- if (resultSelector == null)
- throw new ArgumentNullException("resultSelector");
-
- return s_impl.CombineLatest<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TResult>(source1, source2, source3, source4, source5, source6, source7, source8, source9, resultSelector);
- }
-
- /// <summary>
- /// Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element.
- /// </summary>
- /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
- /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
- /// <typeparam name="TSource3">The type of the elements in the third source sequence.</typeparam>
- /// <typeparam name="TSource4">The type of the elements in the fourth source sequence.</typeparam>
- /// <typeparam name="TSource5">The type of the elements in the fifth source sequence.</typeparam>
- /// <typeparam name="TSource6">The type of the elements in the sixth source sequence.</typeparam>
- /// <typeparam name="TSource7">The type of the elements in the seventh source sequence.</typeparam>
- /// <typeparam name="TSource8">The type of the elements in the eighth source sequence.</typeparam>
- /// <typeparam name="TSource9">The type of the elements in the ninth source sequence.</typeparam>
- /// <typeparam name="TSource10">The type of the elements in the tenth source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
- /// <param name="source1">First observable source.</param>
- /// <param name="source2">Second observable source.</param>
- /// <param name="source3">Third observable source.</param>
- /// <param name="source4">Fourth observable source.</param>
- /// <param name="source5">Fifth observable source.</param>
- /// <param name="source6">Sixth observable source.</param>
- /// <param name="source7">Seventh observable source.</param>
- /// <param name="source8">Eighth observable source.</param>
- /// <param name="source9">Ninth observable source.</param>
- /// <param name="source10">Tenth observable source.</param>
- /// <param name="resultSelector">Function to invoke whenever any of the sources produces an element.</param>
- /// <returns>An observable sequence containing the result of combining elements of the sources using the specified result selector function.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source1"/> or <paramref name="source2"/> or <paramref name="source3"/> or <paramref name="source4"/> or <paramref name="source5"/> or <paramref name="source6"/> or <paramref name="source7"/> or <paramref name="source8"/> or <paramref name="source9"/> or <paramref name="source10"/> or <paramref name="resultSelector"/> is null.</exception>
- public static IObservable<TResult> CombineLatest<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TResult>(this IObservable<TSource1> source1, IObservable<TSource2> source2, IObservable<TSource3> source3, IObservable<TSource4> source4, IObservable<TSource5> source5, IObservable<TSource6> source6, IObservable<TSource7> source7, IObservable<TSource8> source8, IObservable<TSource9> source9, IObservable<TSource10> source10, Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TResult> resultSelector)
- {
- if (source1 == null)
- throw new ArgumentNullException("source1");
- if (source2 == null)
- throw new ArgumentNullException("source2");
- if (source3 == null)
- throw new ArgumentNullException("source3");
- if (source4 == null)
- throw new ArgumentNullException("source4");
- if (source5 == null)
- throw new ArgumentNullException("source5");
- if (source6 == null)
- throw new ArgumentNullException("source6");
- if (source7 == null)
- throw new ArgumentNullException("source7");
- if (source8 == null)
- throw new ArgumentNullException("source8");
- if (source9 == null)
- throw new ArgumentNullException("source9");
- if (source10 == null)
- throw new ArgumentNullException("source10");
- if (resultSelector == null)
- throw new ArgumentNullException("resultSelector");
-
- return s_impl.CombineLatest<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TResult>(source1, source2, source3, source4, source5, source6, source7, source8, source9, source10, resultSelector);
- }
-
- /// <summary>
- /// Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element.
- /// </summary>
- /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
- /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
- /// <typeparam name="TSource3">The type of the elements in the third source sequence.</typeparam>
- /// <typeparam name="TSource4">The type of the elements in the fourth source sequence.</typeparam>
- /// <typeparam name="TSource5">The type of the elements in the fifth source sequence.</typeparam>
- /// <typeparam name="TSource6">The type of the elements in the sixth source sequence.</typeparam>
- /// <typeparam name="TSource7">The type of the elements in the seventh source sequence.</typeparam>
- /// <typeparam name="TSource8">The type of the elements in the eighth source sequence.</typeparam>
- /// <typeparam name="TSource9">The type of the elements in the ninth source sequence.</typeparam>
- /// <typeparam name="TSource10">The type of the elements in the tenth source sequence.</typeparam>
- /// <typeparam name="TSource11">The type of the elements in the eleventh source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
- /// <param name="source1">First observable source.</param>
- /// <param name="source2">Second observable source.</param>
- /// <param name="source3">Third observable source.</param>
- /// <param name="source4">Fourth observable source.</param>
- /// <param name="source5">Fifth observable source.</param>
- /// <param name="source6">Sixth observable source.</param>
- /// <param name="source7">Seventh observable source.</param>
- /// <param name="source8">Eighth observable source.</param>
- /// <param name="source9">Ninth observable source.</param>
- /// <param name="source10">Tenth observable source.</param>
- /// <param name="source11">Eleventh observable source.</param>
- /// <param name="resultSelector">Function to invoke whenever any of the sources produces an element.</param>
- /// <returns>An observable sequence containing the result of combining elements of the sources using the specified result selector function.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source1"/> or <paramref name="source2"/> or <paramref name="source3"/> or <paramref name="source4"/> or <paramref name="source5"/> or <paramref name="source6"/> or <paramref name="source7"/> or <paramref name="source8"/> or <paramref name="source9"/> or <paramref name="source10"/> or <paramref name="source11"/> or <paramref name="resultSelector"/> is null.</exception>
- public static IObservable<TResult> CombineLatest<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TResult>(this IObservable<TSource1> source1, IObservable<TSource2> source2, IObservable<TSource3> source3, IObservable<TSource4> source4, IObservable<TSource5> source5, IObservable<TSource6> source6, IObservable<TSource7> source7, IObservable<TSource8> source8, IObservable<TSource9> source9, IObservable<TSource10> source10, IObservable<TSource11> source11, Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TResult> resultSelector)
- {
- if (source1 == null)
- throw new ArgumentNullException("source1");
- if (source2 == null)
- throw new ArgumentNullException("source2");
- if (source3 == null)
- throw new ArgumentNullException("source3");
- if (source4 == null)
- throw new ArgumentNullException("source4");
- if (source5 == null)
- throw new ArgumentNullException("source5");
- if (source6 == null)
- throw new ArgumentNullException("source6");
- if (source7 == null)
- throw new ArgumentNullException("source7");
- if (source8 == null)
- throw new ArgumentNullException("source8");
- if (source9 == null)
- throw new ArgumentNullException("source9");
- if (source10 == null)
- throw new ArgumentNullException("source10");
- if (source11 == null)
- throw new ArgumentNullException("source11");
- if (resultSelector == null)
- throw new ArgumentNullException("resultSelector");
-
- return s_impl.CombineLatest<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TResult>(source1, source2, source3, source4, source5, source6, source7, source8, source9, source10, source11, resultSelector);
- }
-
- /// <summary>
- /// Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element.
- /// </summary>
- /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
- /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
- /// <typeparam name="TSource3">The type of the elements in the third source sequence.</typeparam>
- /// <typeparam name="TSource4">The type of the elements in the fourth source sequence.</typeparam>
- /// <typeparam name="TSource5">The type of the elements in the fifth source sequence.</typeparam>
- /// <typeparam name="TSource6">The type of the elements in the sixth source sequence.</typeparam>
- /// <typeparam name="TSource7">The type of the elements in the seventh source sequence.</typeparam>
- /// <typeparam name="TSource8">The type of the elements in the eighth source sequence.</typeparam>
- /// <typeparam name="TSource9">The type of the elements in the ninth source sequence.</typeparam>
- /// <typeparam name="TSource10">The type of the elements in the tenth source sequence.</typeparam>
- /// <typeparam name="TSource11">The type of the elements in the eleventh source sequence.</typeparam>
- /// <typeparam name="TSource12">The type of the elements in the twelfth source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
- /// <param name="source1">First observable source.</param>
- /// <param name="source2">Second observable source.</param>
- /// <param name="source3">Third observable source.</param>
- /// <param name="source4">Fourth observable source.</param>
- /// <param name="source5">Fifth observable source.</param>
- /// <param name="source6">Sixth observable source.</param>
- /// <param name="source7">Seventh observable source.</param>
- /// <param name="source8">Eighth observable source.</param>
- /// <param name="source9">Ninth observable source.</param>
- /// <param name="source10">Tenth observable source.</param>
- /// <param name="source11">Eleventh observable source.</param>
- /// <param name="source12">Twelfth observable source.</param>
- /// <param name="resultSelector">Function to invoke whenever any of the sources produces an element.</param>
- /// <returns>An observable sequence containing the result of combining elements of the sources using the specified result selector function.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source1"/> or <paramref name="source2"/> or <paramref name="source3"/> or <paramref name="source4"/> or <paramref name="source5"/> or <paramref name="source6"/> or <paramref name="source7"/> or <paramref name="source8"/> or <paramref name="source9"/> or <paramref name="source10"/> or <paramref name="source11"/> or <paramref name="source12"/> or <paramref name="resultSelector"/> is null.</exception>
- public static IObservable<TResult> CombineLatest<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TResult>(this IObservable<TSource1> source1, IObservable<TSource2> source2, IObservable<TSource3> source3, IObservable<TSource4> source4, IObservable<TSource5> source5, IObservable<TSource6> source6, IObservable<TSource7> source7, IObservable<TSource8> source8, IObservable<TSource9> source9, IObservable<TSource10> source10, IObservable<TSource11> source11, IObservable<TSource12> source12, Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TResult> resultSelector)
- {
- if (source1 == null)
- throw new ArgumentNullException("source1");
- if (source2 == null)
- throw new ArgumentNullException("source2");
- if (source3 == null)
- throw new ArgumentNullException("source3");
- if (source4 == null)
- throw new ArgumentNullException("source4");
- if (source5 == null)
- throw new ArgumentNullException("source5");
- if (source6 == null)
- throw new ArgumentNullException("source6");
- if (source7 == null)
- throw new ArgumentNullException("source7");
- if (source8 == null)
- throw new ArgumentNullException("source8");
- if (source9 == null)
- throw new ArgumentNullException("source9");
- if (source10 == null)
- throw new ArgumentNullException("source10");
- if (source11 == null)
- throw new ArgumentNullException("source11");
- if (source12 == null)
- throw new ArgumentNullException("source12");
- if (resultSelector == null)
- throw new ArgumentNullException("resultSelector");
-
- return s_impl.CombineLatest<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TResult>(source1, source2, source3, source4, source5, source6, source7, source8, source9, source10, source11, source12, resultSelector);
- }
-
- /// <summary>
- /// Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element.
- /// </summary>
- /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
- /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
- /// <typeparam name="TSource3">The type of the elements in the third source sequence.</typeparam>
- /// <typeparam name="TSource4">The type of the elements in the fourth source sequence.</typeparam>
- /// <typeparam name="TSource5">The type of the elements in the fifth source sequence.</typeparam>
- /// <typeparam name="TSource6">The type of the elements in the sixth source sequence.</typeparam>
- /// <typeparam name="TSource7">The type of the elements in the seventh source sequence.</typeparam>
- /// <typeparam name="TSource8">The type of the elements in the eighth source sequence.</typeparam>
- /// <typeparam name="TSource9">The type of the elements in the ninth source sequence.</typeparam>
- /// <typeparam name="TSource10">The type of the elements in the tenth source sequence.</typeparam>
- /// <typeparam name="TSource11">The type of the elements in the eleventh source sequence.</typeparam>
- /// <typeparam name="TSource12">The type of the elements in the twelfth source sequence.</typeparam>
- /// <typeparam name="TSource13">The type of the elements in the thirteenth source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
- /// <param name="source1">First observable source.</param>
- /// <param name="source2">Second observable source.</param>
- /// <param name="source3">Third observable source.</param>
- /// <param name="source4">Fourth observable source.</param>
- /// <param name="source5">Fifth observable source.</param>
- /// <param name="source6">Sixth observable source.</param>
- /// <param name="source7">Seventh observable source.</param>
- /// <param name="source8">Eighth observable source.</param>
- /// <param name="source9">Ninth observable source.</param>
- /// <param name="source10">Tenth observable source.</param>
- /// <param name="source11">Eleventh observable source.</param>
- /// <param name="source12">Twelfth observable source.</param>
- /// <param name="source13">Thirteenth observable source.</param>
- /// <param name="resultSelector">Function to invoke whenever any of the sources produces an element.</param>
- /// <returns>An observable sequence containing the result of combining elements of the sources using the specified result selector function.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source1"/> or <paramref name="source2"/> or <paramref name="source3"/> or <paramref name="source4"/> or <paramref name="source5"/> or <paramref name="source6"/> or <paramref name="source7"/> or <paramref name="source8"/> or <paramref name="source9"/> or <paramref name="source10"/> or <paramref name="source11"/> or <paramref name="source12"/> or <paramref name="source13"/> or <paramref name="resultSelector"/> is null.</exception>
- public static IObservable<TResult> CombineLatest<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TResult>(this IObservable<TSource1> source1, IObservable<TSource2> source2, IObservable<TSource3> source3, IObservable<TSource4> source4, IObservable<TSource5> source5, IObservable<TSource6> source6, IObservable<TSource7> source7, IObservable<TSource8> source8, IObservable<TSource9> source9, IObservable<TSource10> source10, IObservable<TSource11> source11, IObservable<TSource12> source12, IObservable<TSource13> source13, Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TResult> resultSelector)
- {
- if (source1 == null)
- throw new ArgumentNullException("source1");
- if (source2 == null)
- throw new ArgumentNullException("source2");
- if (source3 == null)
- throw new ArgumentNullException("source3");
- if (source4 == null)
- throw new ArgumentNullException("source4");
- if (source5 == null)
- throw new ArgumentNullException("source5");
- if (source6 == null)
- throw new ArgumentNullException("source6");
- if (source7 == null)
- throw new ArgumentNullException("source7");
- if (source8 == null)
- throw new ArgumentNullException("source8");
- if (source9 == null)
- throw new ArgumentNullException("source9");
- if (source10 == null)
- throw new ArgumentNullException("source10");
- if (source11 == null)
- throw new ArgumentNullException("source11");
- if (source12 == null)
- throw new ArgumentNullException("source12");
- if (source13 == null)
- throw new ArgumentNullException("source13");
- if (resultSelector == null)
- throw new ArgumentNullException("resultSelector");
-
- return s_impl.CombineLatest<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TResult>(source1, source2, source3, source4, source5, source6, source7, source8, source9, source10, source11, source12, source13, resultSelector);
- }
-
- /// <summary>
- /// Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element.
- /// </summary>
- /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
- /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
- /// <typeparam name="TSource3">The type of the elements in the third source sequence.</typeparam>
- /// <typeparam name="TSource4">The type of the elements in the fourth source sequence.</typeparam>
- /// <typeparam name="TSource5">The type of the elements in the fifth source sequence.</typeparam>
- /// <typeparam name="TSource6">The type of the elements in the sixth source sequence.</typeparam>
- /// <typeparam name="TSource7">The type of the elements in the seventh source sequence.</typeparam>
- /// <typeparam name="TSource8">The type of the elements in the eighth source sequence.</typeparam>
- /// <typeparam name="TSource9">The type of the elements in the ninth source sequence.</typeparam>
- /// <typeparam name="TSource10">The type of the elements in the tenth source sequence.</typeparam>
- /// <typeparam name="TSource11">The type of the elements in the eleventh source sequence.</typeparam>
- /// <typeparam name="TSource12">The type of the elements in the twelfth source sequence.</typeparam>
- /// <typeparam name="TSource13">The type of the elements in the thirteenth source sequence.</typeparam>
- /// <typeparam name="TSource14">The type of the elements in the fourteenth source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
- /// <param name="source1">First observable source.</param>
- /// <param name="source2">Second observable source.</param>
- /// <param name="source3">Third observable source.</param>
- /// <param name="source4">Fourth observable source.</param>
- /// <param name="source5">Fifth observable source.</param>
- /// <param name="source6">Sixth observable source.</param>
- /// <param name="source7">Seventh observable source.</param>
- /// <param name="source8">Eighth observable source.</param>
- /// <param name="source9">Ninth observable source.</param>
- /// <param name="source10">Tenth observable source.</param>
- /// <param name="source11">Eleventh observable source.</param>
- /// <param name="source12">Twelfth observable source.</param>
- /// <param name="source13">Thirteenth observable source.</param>
- /// <param name="source14">Fourteenth observable source.</param>
- /// <param name="resultSelector">Function to invoke whenever any of the sources produces an element.</param>
- /// <returns>An observable sequence containing the result of combining elements of the sources using the specified result selector function.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source1"/> or <paramref name="source2"/> or <paramref name="source3"/> or <paramref name="source4"/> or <paramref name="source5"/> or <paramref name="source6"/> or <paramref name="source7"/> or <paramref name="source8"/> or <paramref name="source9"/> or <paramref name="source10"/> or <paramref name="source11"/> or <paramref name="source12"/> or <paramref name="source13"/> or <paramref name="source14"/> or <paramref name="resultSelector"/> is null.</exception>
- public static IObservable<TResult> CombineLatest<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TSource14, TResult>(this IObservable<TSource1> source1, IObservable<TSource2> source2, IObservable<TSource3> source3, IObservable<TSource4> source4, IObservable<TSource5> source5, IObservable<TSource6> source6, IObservable<TSource7> source7, IObservable<TSource8> source8, IObservable<TSource9> source9, IObservable<TSource10> source10, IObservable<TSource11> source11, IObservable<TSource12> source12, IObservable<TSource13> source13, IObservable<TSource14> source14, Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TSource14, TResult> resultSelector)
- {
- if (source1 == null)
- throw new ArgumentNullException("source1");
- if (source2 == null)
- throw new ArgumentNullException("source2");
- if (source3 == null)
- throw new ArgumentNullException("source3");
- if (source4 == null)
- throw new ArgumentNullException("source4");
- if (source5 == null)
- throw new ArgumentNullException("source5");
- if (source6 == null)
- throw new ArgumentNullException("source6");
- if (source7 == null)
- throw new ArgumentNullException("source7");
- if (source8 == null)
- throw new ArgumentNullException("source8");
- if (source9 == null)
- throw new ArgumentNullException("source9");
- if (source10 == null)
- throw new ArgumentNullException("source10");
- if (source11 == null)
- throw new ArgumentNullException("source11");
- if (source12 == null)
- throw new ArgumentNullException("source12");
- if (source13 == null)
- throw new ArgumentNullException("source13");
- if (source14 == null)
- throw new ArgumentNullException("source14");
- if (resultSelector == null)
- throw new ArgumentNullException("resultSelector");
-
- return s_impl.CombineLatest<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TSource14, TResult>(source1, source2, source3, source4, source5, source6, source7, source8, source9, source10, source11, source12, source13, source14, resultSelector);
- }
-
- /// <summary>
- /// Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element.
- /// </summary>
- /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
- /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
- /// <typeparam name="TSource3">The type of the elements in the third source sequence.</typeparam>
- /// <typeparam name="TSource4">The type of the elements in the fourth source sequence.</typeparam>
- /// <typeparam name="TSource5">The type of the elements in the fifth source sequence.</typeparam>
- /// <typeparam name="TSource6">The type of the elements in the sixth source sequence.</typeparam>
- /// <typeparam name="TSource7">The type of the elements in the seventh source sequence.</typeparam>
- /// <typeparam name="TSource8">The type of the elements in the eighth source sequence.</typeparam>
- /// <typeparam name="TSource9">The type of the elements in the ninth source sequence.</typeparam>
- /// <typeparam name="TSource10">The type of the elements in the tenth source sequence.</typeparam>
- /// <typeparam name="TSource11">The type of the elements in the eleventh source sequence.</typeparam>
- /// <typeparam name="TSource12">The type of the elements in the twelfth source sequence.</typeparam>
- /// <typeparam name="TSource13">The type of the elements in the thirteenth source sequence.</typeparam>
- /// <typeparam name="TSource14">The type of the elements in the fourteenth source sequence.</typeparam>
- /// <typeparam name="TSource15">The type of the elements in the fifteenth source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
- /// <param name="source1">First observable source.</param>
- /// <param name="source2">Second observable source.</param>
- /// <param name="source3">Third observable source.</param>
- /// <param name="source4">Fourth observable source.</param>
- /// <param name="source5">Fifth observable source.</param>
- /// <param name="source6">Sixth observable source.</param>
- /// <param name="source7">Seventh observable source.</param>
- /// <param name="source8">Eighth observable source.</param>
- /// <param name="source9">Ninth observable source.</param>
- /// <param name="source10">Tenth observable source.</param>
- /// <param name="source11">Eleventh observable source.</param>
- /// <param name="source12">Twelfth observable source.</param>
- /// <param name="source13">Thirteenth observable source.</param>
- /// <param name="source14">Fourteenth observable source.</param>
- /// <param name="source15">Fifteenth observable source.</param>
- /// <param name="resultSelector">Function to invoke whenever any of the sources produces an element.</param>
- /// <returns>An observable sequence containing the result of combining elements of the sources using the specified result selector function.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source1"/> or <paramref name="source2"/> or <paramref name="source3"/> or <paramref name="source4"/> or <paramref name="source5"/> or <paramref name="source6"/> or <paramref name="source7"/> or <paramref name="source8"/> or <paramref name="source9"/> or <paramref name="source10"/> or <paramref name="source11"/> or <paramref name="source12"/> or <paramref name="source13"/> or <paramref name="source14"/> or <paramref name="source15"/> or <paramref name="resultSelector"/> is null.</exception>
- public static IObservable<TResult> CombineLatest<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TSource14, TSource15, TResult>(this IObservable<TSource1> source1, IObservable<TSource2> source2, IObservable<TSource3> source3, IObservable<TSource4> source4, IObservable<TSource5> source5, IObservable<TSource6> source6, IObservable<TSource7> source7, IObservable<TSource8> source8, IObservable<TSource9> source9, IObservable<TSource10> source10, IObservable<TSource11> source11, IObservable<TSource12> source12, IObservable<TSource13> source13, IObservable<TSource14> source14, IObservable<TSource15> source15, Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TSource14, TSource15, TResult> resultSelector)
- {
- if (source1 == null)
- throw new ArgumentNullException("source1");
- if (source2 == null)
- throw new ArgumentNullException("source2");
- if (source3 == null)
- throw new ArgumentNullException("source3");
- if (source4 == null)
- throw new ArgumentNullException("source4");
- if (source5 == null)
- throw new ArgumentNullException("source5");
- if (source6 == null)
- throw new ArgumentNullException("source6");
- if (source7 == null)
- throw new ArgumentNullException("source7");
- if (source8 == null)
- throw new ArgumentNullException("source8");
- if (source9 == null)
- throw new ArgumentNullException("source9");
- if (source10 == null)
- throw new ArgumentNullException("source10");
- if (source11 == null)
- throw new ArgumentNullException("source11");
- if (source12 == null)
- throw new ArgumentNullException("source12");
- if (source13 == null)
- throw new ArgumentNullException("source13");
- if (source14 == null)
- throw new ArgumentNullException("source14");
- if (source15 == null)
- throw new ArgumentNullException("source15");
- if (resultSelector == null)
- throw new ArgumentNullException("resultSelector");
-
- return s_impl.CombineLatest<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TSource14, TSource15, TResult>(source1, source2, source3, source4, source5, source6, source7, source8, source9, source10, source11, source12, source13, source14, source15, resultSelector);
- }
-
- /// <summary>
- /// Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element.
- /// </summary>
- /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
- /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
- /// <typeparam name="TSource3">The type of the elements in the third source sequence.</typeparam>
- /// <typeparam name="TSource4">The type of the elements in the fourth source sequence.</typeparam>
- /// <typeparam name="TSource5">The type of the elements in the fifth source sequence.</typeparam>
- /// <typeparam name="TSource6">The type of the elements in the sixth source sequence.</typeparam>
- /// <typeparam name="TSource7">The type of the elements in the seventh source sequence.</typeparam>
- /// <typeparam name="TSource8">The type of the elements in the eighth source sequence.</typeparam>
- /// <typeparam name="TSource9">The type of the elements in the ninth source sequence.</typeparam>
- /// <typeparam name="TSource10">The type of the elements in the tenth source sequence.</typeparam>
- /// <typeparam name="TSource11">The type of the elements in the eleventh source sequence.</typeparam>
- /// <typeparam name="TSource12">The type of the elements in the twelfth source sequence.</typeparam>
- /// <typeparam name="TSource13">The type of the elements in the thirteenth source sequence.</typeparam>
- /// <typeparam name="TSource14">The type of the elements in the fourteenth source sequence.</typeparam>
- /// <typeparam name="TSource15">The type of the elements in the fifteenth source sequence.</typeparam>
- /// <typeparam name="TSource16">The type of the elements in the sixteenth source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
- /// <param name="source1">First observable source.</param>
- /// <param name="source2">Second observable source.</param>
- /// <param name="source3">Third observable source.</param>
- /// <param name="source4">Fourth observable source.</param>
- /// <param name="source5">Fifth observable source.</param>
- /// <param name="source6">Sixth observable source.</param>
- /// <param name="source7">Seventh observable source.</param>
- /// <param name="source8">Eighth observable source.</param>
- /// <param name="source9">Ninth observable source.</param>
- /// <param name="source10">Tenth observable source.</param>
- /// <param name="source11">Eleventh observable source.</param>
- /// <param name="source12">Twelfth observable source.</param>
- /// <param name="source13">Thirteenth observable source.</param>
- /// <param name="source14">Fourteenth observable source.</param>
- /// <param name="source15">Fifteenth observable source.</param>
- /// <param name="source16">Sixteenth observable source.</param>
- /// <param name="resultSelector">Function to invoke whenever any of the sources produces an element.</param>
- /// <returns>An observable sequence containing the result of combining elements of the sources using the specified result selector function.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source1"/> or <paramref name="source2"/> or <paramref name="source3"/> or <paramref name="source4"/> or <paramref name="source5"/> or <paramref name="source6"/> or <paramref name="source7"/> or <paramref name="source8"/> or <paramref name="source9"/> or <paramref name="source10"/> or <paramref name="source11"/> or <paramref name="source12"/> or <paramref name="source13"/> or <paramref name="source14"/> or <paramref name="source15"/> or <paramref name="source16"/> or <paramref name="resultSelector"/> is null.</exception>
- public static IObservable<TResult> CombineLatest<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TSource14, TSource15, TSource16, TResult>(this IObservable<TSource1> source1, IObservable<TSource2> source2, IObservable<TSource3> source3, IObservable<TSource4> source4, IObservable<TSource5> source5, IObservable<TSource6> source6, IObservable<TSource7> source7, IObservable<TSource8> source8, IObservable<TSource9> source9, IObservable<TSource10> source10, IObservable<TSource11> source11, IObservable<TSource12> source12, IObservable<TSource13> source13, IObservable<TSource14> source14, IObservable<TSource15> source15, IObservable<TSource16> source16, Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TSource14, TSource15, TSource16, TResult> resultSelector)
- {
- if (source1 == null)
- throw new ArgumentNullException("source1");
- if (source2 == null)
- throw new ArgumentNullException("source2");
- if (source3 == null)
- throw new ArgumentNullException("source3");
- if (source4 == null)
- throw new ArgumentNullException("source4");
- if (source5 == null)
- throw new ArgumentNullException("source5");
- if (source6 == null)
- throw new ArgumentNullException("source6");
- if (source7 == null)
- throw new ArgumentNullException("source7");
- if (source8 == null)
- throw new ArgumentNullException("source8");
- if (source9 == null)
- throw new ArgumentNullException("source9");
- if (source10 == null)
- throw new ArgumentNullException("source10");
- if (source11 == null)
- throw new ArgumentNullException("source11");
- if (source12 == null)
- throw new ArgumentNullException("source12");
- if (source13 == null)
- throw new ArgumentNullException("source13");
- if (source14 == null)
- throw new ArgumentNullException("source14");
- if (source15 == null)
- throw new ArgumentNullException("source15");
- if (source16 == null)
- throw new ArgumentNullException("source16");
- if (resultSelector == null)
- throw new ArgumentNullException("resultSelector");
-
- return s_impl.CombineLatest<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TSource14, TSource15, TSource16, TResult>(source1, source2, source3, source4, source5, source6, source7, source8, source9, source10, source11, source12, source13, source14, source15, source16, resultSelector);
- }
-
-#endif
-
- #endregion
-
-#endif
-
- /// <summary>
- /// Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequences.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
- /// <param name="sources">Observable sources.</param>
- /// <param name="resultSelector">Function to invoke whenever any of the sources produces an element. For efficiency, the input list is reused after the selector returns. Either aggregate or copy the values during the function call.</param>
- /// <returns>An observable sequence containing the result of combining elements of the sources using the specified result selector function.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="sources"/> or <paramref name="resultSelector"/> is null.</exception>
- public static IObservable<TResult> CombineLatest<TSource, TResult>(this IEnumerable<IObservable<TSource>> sources, Func<IList<TSource>, TResult> resultSelector)
- {
- if (sources == null)
- throw new ArgumentNullException("sources");
- if (resultSelector == null)
- throw new ArgumentNullException("resultSelector");
-
- return s_impl.CombineLatest<TSource, TResult>(sources, resultSelector);
- }
-
- /// <summary>
- /// Merges the specified observable sequences into one observable sequence by emitting a list with the latest source elements whenever any of the observable sequences produces an element.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequences, and in the lists in the result sequence.</typeparam>
- /// <param name="sources">Observable sources.</param>
- /// <returns>An observable sequence containing lists of the latest elements of the sources.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="sources"/> is null.</exception>
- public static IObservable<IList<TSource>> CombineLatest<TSource>(this IEnumerable<IObservable<TSource>> sources)
- {
- if (sources == null)
- throw new ArgumentNullException("sources");
-
- return s_impl.CombineLatest<TSource>(sources);
- }
-
- /// <summary>
- /// Merges the specified observable sequences into one observable sequence by emitting a list with the latest source elements whenever any of the observable sequences produces an element.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequences, and in the lists in the result sequence.</typeparam>
- /// <param name="sources">Observable sources.</param>
- /// <returns>An observable sequence containing lists of the latest elements of the sources.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="sources"/> is null.</exception>
- public static IObservable<IList<TSource>> CombineLatest<TSource>(params IObservable<TSource>[] sources)
- {
- if (sources == null)
- throw new ArgumentNullException("sources");
-
- return s_impl.CombineLatest<TSource>(sources);
- }
-
- #endregion
-
- #region + Concat +
-
- /// <summary>
- /// Concatenates the second observable sequence to the first observable sequence upon successful termination of the first.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequences.</typeparam>
- /// <param name="first">First observable sequence.</param>
- /// <param name="second">Second observable sequence.</param>
- /// <returns>An observable sequence that contains the elements of the first sequence, followed by those of the second the sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="first"/> or <paramref name="second"/> is null.</exception>
- public static IObservable<TSource> Concat<TSource>(this IObservable<TSource> first, IObservable<TSource> second)
- {
- if (first == null)
- throw new ArgumentNullException("first");
- if (second == null)
- throw new ArgumentNullException("second");
-
- return s_impl.Concat<TSource>(first, second);
- }
-
- /// <summary>
- /// Concatenates all of the specified observable sequences, as long as the previous observable sequence terminated successfully.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequences.</typeparam>
- /// <param name="sources">Observable sequences to concatenate.</param>
- /// <returns>An observable sequence that contains the elements of each given sequence, in sequential order.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="sources"/> is null.</exception>
- public static IObservable<TSource> Concat<TSource>(params IObservable<TSource>[] sources)
- {
- if (sources == null)
- throw new ArgumentNullException("sources");
-
- return s_impl.Concat<TSource>(sources);
- }
-
- /// <summary>
- /// Concatenates all observable sequences in the given enumerable sequence, as long as the previous observable sequence terminated successfully.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequences.</typeparam>
- /// <param name="sources">Observable sequences to concatenate.</param>
- /// <returns>An observable sequence that contains the elements of each given sequence, in sequential order.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="sources"/> is null.</exception>
- public static IObservable<TSource> Concat<TSource>(this IEnumerable<IObservable<TSource>> sources)
- {
- if (sources == null)
- throw new ArgumentNullException("sources");
-
- return s_impl.Concat<TSource>(sources);
- }
-
- /// <summary>
- /// Concatenates all inner observable sequences, as long as the previous observable sequence terminated successfully.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequences.</typeparam>
- /// <param name="sources">Observable sequence of inner observable sequences.</param>
- /// <returns>An observable sequence that contains the elements of each observed inner sequence, in sequential order.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="sources"/> is null.</exception>
- public static IObservable<TSource> Concat<TSource>(this IObservable<IObservable<TSource>> sources)
- {
- if (sources == null)
- throw new ArgumentNullException("sources");
-
- return s_impl.Concat<TSource>(sources);
- }
-
-#if !NO_TPL
-
- /// <summary>
- /// Concatenates all task results, as long as the previous task terminated successfully.
- /// </summary>
- /// <typeparam name="TSource">The type of the results produced by the tasks.</typeparam>
- /// <param name="sources">Observable sequence of tasks.</param>
- /// <returns>An observable sequence that contains the results of each task, in sequential order.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="sources"/> is null.</exception>
- /// <remarks>If the tasks support cancellation, consider manual conversion of the tasks using <see cref="Observable.FromAsync{TSource}(Func{CancellationToken, Task{TSource}})"/>, followed by a concatenation operation using <see cref="Observable.Concat{TSource}(IObservable{IObservable{TSource}})"/>.</remarks>
- public static IObservable<TSource> Concat<TSource>(this IObservable<Task<TSource>> sources)
- {
- if (sources == null)
- throw new ArgumentNullException("sources");
-
- return s_impl.Concat<TSource>(sources);
- }
-
-#endif
-
- #endregion
-
- #region + Merge +
-
- /// <summary>
- /// Merges elements from all inner observable sequences into a single observable sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequences.</typeparam>
- /// <param name="sources">Observable sequence of inner observable sequences.</param>
- /// <returns>The observable sequence that merges the elements of the inner sequences.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="sources"/> is null.</exception>
- public static IObservable<TSource> Merge<TSource>(this IObservable<IObservable<TSource>> sources)
- {
- if (sources == null)
- throw new ArgumentNullException("sources");
-
- return s_impl.Merge<TSource>(sources);
- }
-
-#if !NO_TPL
-
- /// <summary>
- /// Merges results from all source tasks into a single observable sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the results produced by the source tasks.</typeparam>
- /// <param name="sources">Observable sequence of tasks.</param>
- /// <returns>The observable sequence that merges the results of the source tasks.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="sources"/> is null.</exception>
- /// <remarks>If the tasks support cancellation, consider manual conversion of the tasks using <see cref="Observable.FromAsync{TSource}(Func{CancellationToken, Task{TSource}})"/>, followed by a merge operation using <see cref="Observable.Merge{TSource}(IObservable{IObservable{TSource}})"/>.</remarks>
- public static IObservable<TSource> Merge<TSource>(this IObservable<Task<TSource>> sources)
- {
- if (sources == null)
- throw new ArgumentNullException("sources");
-
- return s_impl.Merge<TSource>(sources);
- }
-
-#endif
-
- /// <summary>
- /// Merges elements from all inner observable sequences into a single observable sequence, limiting the number of concurrent subscriptions to inner sequences.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequences.</typeparam>
- /// <param name="sources">Observable sequence of inner observable sequences.</param>
- /// <param name="maxConcurrent">Maximum number of inner observable sequences being subscribed to concurrently.</param>
- /// <returns>The observable sequence that merges the elements of the inner sequences.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="sources"/> is null.</exception>
- /// <exception cref="ArgumentOutOfRangeException"><paramref name="maxConcurrent"/> is less than or equal to zero.</exception>
- public static IObservable<TSource> Merge<TSource>(this IObservable<IObservable<TSource>> sources, int maxConcurrent)
- {
- if (sources == null)
- throw new ArgumentNullException("sources");
- if (maxConcurrent <= 0)
- throw new ArgumentOutOfRangeException("maxConcurrent");
-
- return s_impl.Merge<TSource>(sources, maxConcurrent);
- }
-
- /// <summary>
- /// Merges elements from all observable sequences in the given enumerable sequence into a single observable sequence, limiting the number of concurrent subscriptions to inner sequences.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequences.</typeparam>
- /// <param name="sources">Enumerable sequence of observable sequences.</param>
- /// <param name="maxConcurrent">Maximum number of observable sequences being subscribed to concurrently.</param>
- /// <returns>The observable sequence that merges the elements of the observable sequences.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="sources"/> is null.</exception>
- /// <exception cref="ArgumentOutOfRangeException"><paramref name="maxConcurrent"/> is less than or equal to zero.</exception>
- public static IObservable<TSource> Merge<TSource>(this IEnumerable<IObservable<TSource>> sources, int maxConcurrent)
- {
- if (sources == null)
- throw new ArgumentNullException("sources");
- if (maxConcurrent <= 0)
- throw new ArgumentOutOfRangeException("maxConcurrent");
-
- return s_impl.Merge<TSource>(sources, maxConcurrent);
- }
-
- /// <summary>
- /// Merges elements from all observable sequences in the given enumerable sequence into a single observable sequence, limiting the number of concurrent subscriptions to inner sequences, and using the specified scheduler for enumeration of and subscription to the sources.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequences.</typeparam>
- /// <param name="sources">Enumerable sequence of observable sequences.</param>
- /// <param name="maxConcurrent">Maximum number of observable sequences being subscribed to concurrently.</param>
- /// <param name="scheduler">Scheduler to run the enumeration of the sequence of sources on.</param>
- /// <returns>The observable sequence that merges the elements of the observable sequences.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="sources"/> or <paramref name="scheduler"/> is null.</exception>
- /// <exception cref="ArgumentOutOfRangeException"><paramref name="maxConcurrent"/> is less than or equal to zero.</exception>
- public static IObservable<TSource> Merge<TSource>(this IEnumerable<IObservable<TSource>> sources, int maxConcurrent, IScheduler scheduler)
- {
- if (sources == null)
- throw new ArgumentNullException("sources");
- if (maxConcurrent <= 0)
- throw new ArgumentOutOfRangeException("maxConcurrent");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return s_impl.Merge<TSource>(sources, maxConcurrent, scheduler);
- }
-
- /// <summary>
- /// Merges elements from two observable sequences into a single observable sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequences.</typeparam>
- /// <param name="first">First observable sequence.</param>
- /// <param name="second">Second observable sequence.</param>
- /// <returns>The observable sequence that merges the elements of the given sequences.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="first"/> or <paramref name="second"/> is null.</exception>
- public static IObservable<TSource> Merge<TSource>(this IObservable<TSource> first, IObservable<TSource> second)
- {
- if (first == null)
- throw new ArgumentNullException("first");
- if (second == null)
- throw new ArgumentNullException("second");
-
- return s_impl.Merge<TSource>(first, second);
- }
-
- /// <summary>
- /// Merges elements from two observable sequences into a single observable sequence, using the specified scheduler for enumeration of and subscription to the sources.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequences.</typeparam>
- /// <param name="first">First observable sequence.</param>
- /// <param name="second">Second observable sequence.</param>
- /// <param name="scheduler">Scheduler used to introduce concurrency for making subscriptions to the given sequences.</param>
- /// <returns>The observable sequence that merges the elements of the given sequences.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="first"/> or <paramref name="second"/> or <paramref name="scheduler"/> is null.</exception>
- public static IObservable<TSource> Merge<TSource>(this IObservable<TSource> first, IObservable<TSource> second, IScheduler scheduler)
- {
- if (first == null)
- throw new ArgumentNullException("first");
- if (second == null)
- throw new ArgumentNullException("second");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return s_impl.Merge<TSource>(first, second, scheduler);
- }
-
- /// <summary>
- /// Merges elements from all of the specified observable sequences into a single observable sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequences.</typeparam>
- /// <param name="sources">Observable sequences.</param>
- /// <returns>The observable sequence that merges the elements of the observable sequences.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="sources"/> is null.</exception>
- public static IObservable<TSource> Merge<TSource>(params IObservable<TSource>[] sources)
- {
- if (sources == null)
- throw new ArgumentNullException("sources");
-
- return s_impl.Merge<TSource>(sources);
- }
-
- /// <summary>
- /// Merges elements from all of the specified observable sequences into a single observable sequence, using the specified scheduler for enumeration of and subscription to the sources.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequences.</typeparam>
- /// <param name="sources">Observable sequences.</param>
- /// <param name="scheduler">Scheduler to run the enumeration of the sequence of sources on.</param>
- /// <returns>The observable sequence that merges the elements of the observable sequences.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="scheduler"/> or <paramref name="sources"/> is null.</exception>
- public static IObservable<TSource> Merge<TSource>(IScheduler scheduler, params IObservable<TSource>[] sources)
- {
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
- if (sources == null)
- throw new ArgumentNullException("sources");
-
- return s_impl.Merge<TSource>(scheduler, sources);
- }
-
- /// <summary>
- /// Merges elements from all observable sequences in the given enumerable sequence into a single observable sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequences.</typeparam>
- /// <param name="sources">Enumerable sequence of observable sequences.</param>
- /// <returns>The observable sequence that merges the elements of the observable sequences.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="sources"/> is null.</exception>
- public static IObservable<TSource> Merge<TSource>(this IEnumerable<IObservable<TSource>> sources)
- {
- if (sources == null)
- throw new ArgumentNullException("sources");
-
- return s_impl.Merge<TSource>(sources);
- }
-
- /// <summary>
- /// Merges elements from all observable sequences in the given enumerable sequence into a single observable sequence, using the specified scheduler for enumeration of and subscription to the sources.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequences.</typeparam>
- /// <param name="sources">Enumerable sequence of observable sequences.</param>
- /// <param name="scheduler">Scheduler to run the enumeration of the sequence of sources on.</param>
- /// <returns>The observable sequence that merges the elements of the observable sequences.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="sources"/> or <paramref name="scheduler"/> is null.</exception>
- public static IObservable<TSource> Merge<TSource>(this IEnumerable<IObservable<TSource>> sources, IScheduler scheduler)
- {
- if (sources == null)
- throw new ArgumentNullException("sources");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return s_impl.Merge<TSource>(sources, scheduler);
- }
-
- #endregion
-
- #region + OnErrorResumeNext +
-
- /// <summary>
- /// Concatenates the second observable sequence to the first observable sequence upon successful or exceptional termination of the first.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequences.</typeparam>
- /// <param name="first">First observable sequence whose exception (if any) is caught.</param>
- /// <param name="second">Second observable sequence used to produce results after the first sequence terminates.</param>
- /// <returns>An observable sequence that concatenates the first and second sequence, even if the first sequence terminates exceptionally.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="first"/> or <paramref name="second"/> is null.</exception>
- public static IObservable<TSource> OnErrorResumeNext<TSource>(this IObservable<TSource> first, IObservable<TSource> second)
- {
- if (first == null)
- throw new ArgumentNullException("first");
- if (second == null)
- throw new ArgumentNullException("second");
-
- return s_impl.OnErrorResumeNext<TSource>(first, second);
- }
-
- /// <summary>
- /// Concatenates all of the specified observable sequences, even if the previous observable sequence terminated exceptionally.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequences.</typeparam>
- /// <param name="sources">Observable sequences to concatenate.</param>
- /// <returns>An observable sequence that concatenates the source sequences, even if a sequence terminates exceptionally.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="sources"/> is null.</exception>
- public static IObservable<TSource> OnErrorResumeNext<TSource>(params IObservable<TSource>[] sources)
- {
- if (sources == null)
- throw new ArgumentNullException("sources");
-
- return s_impl.OnErrorResumeNext<TSource>(sources);
- }
-
- /// <summary>
- /// Concatenates all observable sequences in the given enumerable sequence, even if the previous observable sequence terminated exceptionally.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequences.</typeparam>
- /// <param name="sources">Observable sequences to concatenate.</param>
- /// <returns>An observable sequence that concatenates the source sequences, even if a sequence terminates exceptionally.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="sources"/> is null.</exception>
- public static IObservable<TSource> OnErrorResumeNext<TSource>(this IEnumerable<IObservable<TSource>> sources)
- {
- if (sources == null)
- throw new ArgumentNullException("sources");
-
- return s_impl.OnErrorResumeNext<TSource>(sources);
- }
-
- #endregion
-
- #region + SkipUntil +
-
- /// <summary>
- /// Returns the elements from the source observable sequence only after the other observable sequence produces an element.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TOther">The type of the elements in the other sequence that indicates the end of skip behavior.</typeparam>
- /// <param name="source">Source sequence to propagate elements for.</param>
- /// <param name="other">Observable sequence that triggers propagation of elements of the source sequence.</param>
- /// <returns>An observable sequence containing the elements of the source sequence starting from the point the other sequence triggered propagation.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="other"/> is null.</exception>
- public static IObservable<TSource> SkipUntil<TSource, TOther>(this IObservable<TSource> source, IObservable<TOther> other)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (other == null)
- throw new ArgumentNullException("other");
-
- return s_impl.SkipUntil<TSource, TOther>(source, other);
- }
-
- #endregion
-
- #region + Switch +
-
- /// <summary>
- /// Switches between the inner observable sequences such that the resulting sequence always produces elements from the most recently received inner observable sequence.
- /// Each time a new inner observable sequence is received, the previous inner observable sequence is unsubscribed from.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequences.</typeparam>
- /// <param name="sources">Observable sequence of inner observable sequences.</param>
- /// <returns>The observable sequence that at any point in time produces the elements of the most recent inner observable sequence that has been received.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="sources"/> is null.</exception>
- public static IObservable<TSource> Switch<TSource>(this IObservable<IObservable<TSource>> sources)
- {
- if (sources == null)
- throw new ArgumentNullException("sources");
-
- return s_impl.Switch<TSource>(sources);
- }
-
-#if !NO_TPL
-
- /// <summary>
- /// Switches between the tasks such that the resulting sequence always produces results from the most recently received task.
- /// Each time a new task is received, the previous task's result is ignored.
- /// </summary>
- /// <typeparam name="TSource">The type of the results produced by the source tasks.</typeparam>
- /// <param name="sources">Observable sequence of tasks.</param>
- /// <returns>The observable sequence that at any point in time produces the result of the most recent task that has been received.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="sources"/> is null.</exception>
- /// <remarks>If the tasks support cancellation, consider manual conversion of the tasks using <see cref="Observable.FromAsync{TSource}(Func{CancellationToken, Task{TSource}})"/>, followed by a switch operation using <see cref="Observable.Switch{TSource}(IObservable{IObservable{TSource}})"/>.</remarks>
- public static IObservable<TSource> Switch<TSource>(this IObservable<Task<TSource>> sources)
- {
- if (sources == null)
- throw new ArgumentNullException("sources");
-
- return s_impl.Switch<TSource>(sources);
- }
-
-#endif
-
- #endregion
-
- #region + TakeUntil +
-
- /// <summary>
- /// Returns the elements from the source observable sequence until the other observable sequence produces an element.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TOther">The type of the elements in the other sequence that indicates the end of take behavior.</typeparam>
- /// <param name="source">Source sequence to propagate elements for.</param>
- /// <param name="other">Observable sequence that terminates propagation of elements of the source sequence.</param>
- /// <returns>An observable sequence containing the elements of the source sequence up to the point the other sequence interrupted further propagation.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="other"/> is null.</exception>
- public static IObservable<TSource> TakeUntil<TSource, TOther>(this IObservable<TSource> source, IObservable<TOther> other)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (other == null)
- throw new ArgumentNullException("other");
-
- return s_impl.TakeUntil<TSource, TOther>(source, other);
- }
-
- #endregion
-
- #region Window
-
- /// <summary>
- /// Projects each element of an observable sequence into consecutive non-overlapping windows.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence, and in the windows in the result sequence.</typeparam>
- /// <typeparam name="TWindowClosing">The type of the elements in the sequences indicating window closing events.</typeparam>
- /// <param name="source">Source sequence to produce windows over.</param>
- /// <param name="windowClosingSelector">A function invoked to define the boundaries of the produced windows. A new window is started when the previous one is closed.</param>
- /// <returns>An observable sequence of windows.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="windowClosingSelector"/> is null.</exception>
- public static IObservable<IObservable<TSource>> Window<TSource, TWindowClosing>(this IObservable<TSource> source, Func<IObservable<TWindowClosing>> windowClosingSelector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (windowClosingSelector == null)
- throw new ArgumentNullException("windowClosingSelector");
-
- return s_impl.Window<TSource, TWindowClosing>(source, windowClosingSelector);
- }
-
- /// <summary>
- /// Projects each element of an observable sequence into zero or more windows.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence, and in the windows in the result sequence.</typeparam>
- /// <typeparam name="TWindowOpening">The type of the elements in the sequence indicating window opening events, also passed to the closing selector to obtain a sequence of window closing events.</typeparam>
- /// <typeparam name="TWindowClosing">The type of the elements in the sequences indicating window closing events.</typeparam>
- /// <param name="source">Source sequence to produce windows over.</param>
- /// <param name="windowOpenings">Observable sequence whose elements denote the creation of new windows.</param>
- /// <param name="windowClosingSelector">A function invoked to define the closing of each produced window.</param>
- /// <returns>An observable sequence of windows.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="windowOpenings"/> or <paramref name="windowClosingSelector"/> is null.</exception>
- public static IObservable<IObservable<TSource>> Window<TSource, TWindowOpening, TWindowClosing>(this IObservable<TSource> source, IObservable<TWindowOpening> windowOpenings, Func<TWindowOpening, IObservable<TWindowClosing>> windowClosingSelector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (windowOpenings == null)
- throw new ArgumentNullException("windowOpenings");
- if (windowClosingSelector == null)
- throw new ArgumentNullException("windowClosingSelector");
-
- return s_impl.Window<TSource, TWindowOpening, TWindowClosing>(source, windowOpenings, windowClosingSelector);
- }
-
- /// <summary>
- /// Projects each element of an observable sequence into consecutive non-overlapping windows.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence, and in the windows in the result sequence.</typeparam>
- /// <typeparam name="TWindowBoundary">The type of the elements in the sequences indicating window boundary events.</typeparam>
- /// <param name="source">Source sequence to produce windows over.</param>
- /// <param name="windowBoundaries">Sequence of window boundary markers. The current window is closed and a new window is opened upon receiving a boundary marker.</param>
- /// <returns>An observable sequence of windows.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="windowBoundaries"/> is null.</exception>
- public static IObservable<IObservable<TSource>> Window<TSource, TWindowBoundary>(this IObservable<TSource> source, IObservable<TWindowBoundary> windowBoundaries)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (windowBoundaries == null)
- throw new ArgumentNullException("windowBoundaries");
-
- return s_impl.Window<TSource, TWindowBoundary>(source, windowBoundaries);
- }
-
- #endregion
-
- #region + Zip +
-
- /// <summary>
- /// Merges two observable sequences into one observable sequence by combining their elements in a pairwise fashion.
- /// </summary>
- /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
- /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
- /// <param name="first">First observable source.</param>
- /// <param name="second">Second observable source.</param>
- /// <param name="resultSelector">Function to invoke for each consecutive pair of elements from the first and second source.</param>
- /// <returns>An observable sequence containing the result of pairwise combining the elements of the first and second source using the specified result selector function.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="first"/> or <paramref name="second"/> or <paramref name="resultSelector"/> is null.</exception>
- public static IObservable<TResult> Zip<TSource1, TSource2, TResult>(this IObservable<TSource1> first, IObservable<TSource2> second, Func<TSource1, TSource2, TResult> resultSelector)
- {
- if (first == null)
- throw new ArgumentNullException("first");
- if (second == null)
- throw new ArgumentNullException("second");
- if (resultSelector == null)
- throw new ArgumentNullException("resultSelector");
-
- return s_impl.Zip<TSource1, TSource2, TResult>(first, second, resultSelector);
- }
-
-#if !NO_PERF
-
- /* The following code is generated by a tool checked in to $/.../Source/Tools/CodeGenerators. */
-
- #region Zip auto-generated code (8/3/2012 6:37:02 PM)
-
- /// <summary>
- /// Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index.
- /// </summary>
- /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
- /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
- /// <typeparam name="TSource3">The type of the elements in the third source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
- /// <param name="source1">First observable source.</param>
- /// <param name="source2">Second observable source.</param>
- /// <param name="source3">Third observable source.</param>
- /// <param name="resultSelector">Function to invoke for each series of elements at corresponding indexes in the sources.</param>
- /// <returns>An observable sequence containing the result of combining elements of the sources using the specified result selector function.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source1"/> or <paramref name="source2"/> or <paramref name="source3"/> or <paramref name="resultSelector"/> is null.</exception>
- public static IObservable<TResult> Zip<TSource1, TSource2, TSource3, TResult>(this IObservable<TSource1> source1, IObservable<TSource2> source2, IObservable<TSource3> source3, Func<TSource1, TSource2, TSource3, TResult> resultSelector)
- {
- if (source1 == null)
- throw new ArgumentNullException("source1");
- if (source2 == null)
- throw new ArgumentNullException("source2");
- if (source3 == null)
- throw new ArgumentNullException("source3");
- if (resultSelector == null)
- throw new ArgumentNullException("resultSelector");
-
- return s_impl.Zip<TSource1, TSource2, TSource3, TResult>(source1, source2, source3, resultSelector);
- }
-
- /// <summary>
- /// Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index.
- /// </summary>
- /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
- /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
- /// <typeparam name="TSource3">The type of the elements in the third source sequence.</typeparam>
- /// <typeparam name="TSource4">The type of the elements in the fourth source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
- /// <param name="source1">First observable source.</param>
- /// <param name="source2">Second observable source.</param>
- /// <param name="source3">Third observable source.</param>
- /// <param name="source4">Fourth observable source.</param>
- /// <param name="resultSelector">Function to invoke for each series of elements at corresponding indexes in the sources.</param>
- /// <returns>An observable sequence containing the result of combining elements of the sources using the specified result selector function.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source1"/> or <paramref name="source2"/> or <paramref name="source3"/> or <paramref name="source4"/> or <paramref name="resultSelector"/> is null.</exception>
- public static IObservable<TResult> Zip<TSource1, TSource2, TSource3, TSource4, TResult>(this IObservable<TSource1> source1, IObservable<TSource2> source2, IObservable<TSource3> source3, IObservable<TSource4> source4, Func<TSource1, TSource2, TSource3, TSource4, TResult> resultSelector)
- {
- if (source1 == null)
- throw new ArgumentNullException("source1");
- if (source2 == null)
- throw new ArgumentNullException("source2");
- if (source3 == null)
- throw new ArgumentNullException("source3");
- if (source4 == null)
- throw new ArgumentNullException("source4");
- if (resultSelector == null)
- throw new ArgumentNullException("resultSelector");
-
- return s_impl.Zip<TSource1, TSource2, TSource3, TSource4, TResult>(source1, source2, source3, source4, resultSelector);
- }
-
-#if !NO_LARGEARITY
- /// <summary>
- /// Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index.
- /// </summary>
- /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
- /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
- /// <typeparam name="TSource3">The type of the elements in the third source sequence.</typeparam>
- /// <typeparam name="TSource4">The type of the elements in the fourth source sequence.</typeparam>
- /// <typeparam name="TSource5">The type of the elements in the fifth source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
- /// <param name="source1">First observable source.</param>
- /// <param name="source2">Second observable source.</param>
- /// <param name="source3">Third observable source.</param>
- /// <param name="source4">Fourth observable source.</param>
- /// <param name="source5">Fifth observable source.</param>
- /// <param name="resultSelector">Function to invoke for each series of elements at corresponding indexes in the sources.</param>
- /// <returns>An observable sequence containing the result of combining elements of the sources using the specified result selector function.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source1"/> or <paramref name="source2"/> or <paramref name="source3"/> or <paramref name="source4"/> or <paramref name="source5"/> or <paramref name="resultSelector"/> is null.</exception>
- public static IObservable<TResult> Zip<TSource1, TSource2, TSource3, TSource4, TSource5, TResult>(this IObservable<TSource1> source1, IObservable<TSource2> source2, IObservable<TSource3> source3, IObservable<TSource4> source4, IObservable<TSource5> source5, Func<TSource1, TSource2, TSource3, TSource4, TSource5, TResult> resultSelector)
- {
- if (source1 == null)
- throw new ArgumentNullException("source1");
- if (source2 == null)
- throw new ArgumentNullException("source2");
- if (source3 == null)
- throw new ArgumentNullException("source3");
- if (source4 == null)
- throw new ArgumentNullException("source4");
- if (source5 == null)
- throw new ArgumentNullException("source5");
- if (resultSelector == null)
- throw new ArgumentNullException("resultSelector");
-
- return s_impl.Zip<TSource1, TSource2, TSource3, TSource4, TSource5, TResult>(source1, source2, source3, source4, source5, resultSelector);
- }
-
- /// <summary>
- /// Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index.
- /// </summary>
- /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
- /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
- /// <typeparam name="TSource3">The type of the elements in the third source sequence.</typeparam>
- /// <typeparam name="TSource4">The type of the elements in the fourth source sequence.</typeparam>
- /// <typeparam name="TSource5">The type of the elements in the fifth source sequence.</typeparam>
- /// <typeparam name="TSource6">The type of the elements in the sixth source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
- /// <param name="source1">First observable source.</param>
- /// <param name="source2">Second observable source.</param>
- /// <param name="source3">Third observable source.</param>
- /// <param name="source4">Fourth observable source.</param>
- /// <param name="source5">Fifth observable source.</param>
- /// <param name="source6">Sixth observable source.</param>
- /// <param name="resultSelector">Function to invoke for each series of elements at corresponding indexes in the sources.</param>
- /// <returns>An observable sequence containing the result of combining elements of the sources using the specified result selector function.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source1"/> or <paramref name="source2"/> or <paramref name="source3"/> or <paramref name="source4"/> or <paramref name="source5"/> or <paramref name="source6"/> or <paramref name="resultSelector"/> is null.</exception>
- public static IObservable<TResult> Zip<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TResult>(this IObservable<TSource1> source1, IObservable<TSource2> source2, IObservable<TSource3> source3, IObservable<TSource4> source4, IObservable<TSource5> source5, IObservable<TSource6> source6, Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TResult> resultSelector)
- {
- if (source1 == null)
- throw new ArgumentNullException("source1");
- if (source2 == null)
- throw new ArgumentNullException("source2");
- if (source3 == null)
- throw new ArgumentNullException("source3");
- if (source4 == null)
- throw new ArgumentNullException("source4");
- if (source5 == null)
- throw new ArgumentNullException("source5");
- if (source6 == null)
- throw new ArgumentNullException("source6");
- if (resultSelector == null)
- throw new ArgumentNullException("resultSelector");
-
- return s_impl.Zip<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TResult>(source1, source2, source3, source4, source5, source6, resultSelector);
- }
-
- /// <summary>
- /// Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index.
- /// </summary>
- /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
- /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
- /// <typeparam name="TSource3">The type of the elements in the third source sequence.</typeparam>
- /// <typeparam name="TSource4">The type of the elements in the fourth source sequence.</typeparam>
- /// <typeparam name="TSource5">The type of the elements in the fifth source sequence.</typeparam>
- /// <typeparam name="TSource6">The type of the elements in the sixth source sequence.</typeparam>
- /// <typeparam name="TSource7">The type of the elements in the seventh source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
- /// <param name="source1">First observable source.</param>
- /// <param name="source2">Second observable source.</param>
- /// <param name="source3">Third observable source.</param>
- /// <param name="source4">Fourth observable source.</param>
- /// <param name="source5">Fifth observable source.</param>
- /// <param name="source6">Sixth observable source.</param>
- /// <param name="source7">Seventh observable source.</param>
- /// <param name="resultSelector">Function to invoke for each series of elements at corresponding indexes in the sources.</param>
- /// <returns>An observable sequence containing the result of combining elements of the sources using the specified result selector function.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source1"/> or <paramref name="source2"/> or <paramref name="source3"/> or <paramref name="source4"/> or <paramref name="source5"/> or <paramref name="source6"/> or <paramref name="source7"/> or <paramref name="resultSelector"/> is null.</exception>
- public static IObservable<TResult> Zip<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TResult>(this IObservable<TSource1> source1, IObservable<TSource2> source2, IObservable<TSource3> source3, IObservable<TSource4> source4, IObservable<TSource5> source5, IObservable<TSource6> source6, IObservable<TSource7> source7, Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TResult> resultSelector)
- {
- if (source1 == null)
- throw new ArgumentNullException("source1");
- if (source2 == null)
- throw new ArgumentNullException("source2");
- if (source3 == null)
- throw new ArgumentNullException("source3");
- if (source4 == null)
- throw new ArgumentNullException("source4");
- if (source5 == null)
- throw new ArgumentNullException("source5");
- if (source6 == null)
- throw new ArgumentNullException("source6");
- if (source7 == null)
- throw new ArgumentNullException("source7");
- if (resultSelector == null)
- throw new ArgumentNullException("resultSelector");
-
- return s_impl.Zip<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TResult>(source1, source2, source3, source4, source5, source6, source7, resultSelector);
- }
-
- /// <summary>
- /// Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index.
- /// </summary>
- /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
- /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
- /// <typeparam name="TSource3">The type of the elements in the third source sequence.</typeparam>
- /// <typeparam name="TSource4">The type of the elements in the fourth source sequence.</typeparam>
- /// <typeparam name="TSource5">The type of the elements in the fifth source sequence.</typeparam>
- /// <typeparam name="TSource6">The type of the elements in the sixth source sequence.</typeparam>
- /// <typeparam name="TSource7">The type of the elements in the seventh source sequence.</typeparam>
- /// <typeparam name="TSource8">The type of the elements in the eighth source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
- /// <param name="source1">First observable source.</param>
- /// <param name="source2">Second observable source.</param>
- /// <param name="source3">Third observable source.</param>
- /// <param name="source4">Fourth observable source.</param>
- /// <param name="source5">Fifth observable source.</param>
- /// <param name="source6">Sixth observable source.</param>
- /// <param name="source7">Seventh observable source.</param>
- /// <param name="source8">Eighth observable source.</param>
- /// <param name="resultSelector">Function to invoke for each series of elements at corresponding indexes in the sources.</param>
- /// <returns>An observable sequence containing the result of combining elements of the sources using the specified result selector function.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source1"/> or <paramref name="source2"/> or <paramref name="source3"/> or <paramref name="source4"/> or <paramref name="source5"/> or <paramref name="source6"/> or <paramref name="source7"/> or <paramref name="source8"/> or <paramref name="resultSelector"/> is null.</exception>
- public static IObservable<TResult> Zip<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TResult>(this IObservable<TSource1> source1, IObservable<TSource2> source2, IObservable<TSource3> source3, IObservable<TSource4> source4, IObservable<TSource5> source5, IObservable<TSource6> source6, IObservable<TSource7> source7, IObservable<TSource8> source8, Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TResult> resultSelector)
- {
- if (source1 == null)
- throw new ArgumentNullException("source1");
- if (source2 == null)
- throw new ArgumentNullException("source2");
- if (source3 == null)
- throw new ArgumentNullException("source3");
- if (source4 == null)
- throw new ArgumentNullException("source4");
- if (source5 == null)
- throw new ArgumentNullException("source5");
- if (source6 == null)
- throw new ArgumentNullException("source6");
- if (source7 == null)
- throw new ArgumentNullException("source7");
- if (source8 == null)
- throw new ArgumentNullException("source8");
- if (resultSelector == null)
- throw new ArgumentNullException("resultSelector");
-
- return s_impl.Zip<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TResult>(source1, source2, source3, source4, source5, source6, source7, source8, resultSelector);
- }
-
- /// <summary>
- /// Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index.
- /// </summary>
- /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
- /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
- /// <typeparam name="TSource3">The type of the elements in the third source sequence.</typeparam>
- /// <typeparam name="TSource4">The type of the elements in the fourth source sequence.</typeparam>
- /// <typeparam name="TSource5">The type of the elements in the fifth source sequence.</typeparam>
- /// <typeparam name="TSource6">The type of the elements in the sixth source sequence.</typeparam>
- /// <typeparam name="TSource7">The type of the elements in the seventh source sequence.</typeparam>
- /// <typeparam name="TSource8">The type of the elements in the eighth source sequence.</typeparam>
- /// <typeparam name="TSource9">The type of the elements in the ninth source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
- /// <param name="source1">First observable source.</param>
- /// <param name="source2">Second observable source.</param>
- /// <param name="source3">Third observable source.</param>
- /// <param name="source4">Fourth observable source.</param>
- /// <param name="source5">Fifth observable source.</param>
- /// <param name="source6">Sixth observable source.</param>
- /// <param name="source7">Seventh observable source.</param>
- /// <param name="source8">Eighth observable source.</param>
- /// <param name="source9">Ninth observable source.</param>
- /// <param name="resultSelector">Function to invoke for each series of elements at corresponding indexes in the sources.</param>
- /// <returns>An observable sequence containing the result of combining elements of the sources using the specified result selector function.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source1"/> or <paramref name="source2"/> or <paramref name="source3"/> or <paramref name="source4"/> or <paramref name="source5"/> or <paramref name="source6"/> or <paramref name="source7"/> or <paramref name="source8"/> or <paramref name="source9"/> or <paramref name="resultSelector"/> is null.</exception>
- public static IObservable<TResult> Zip<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TResult>(this IObservable<TSource1> source1, IObservable<TSource2> source2, IObservable<TSource3> source3, IObservable<TSource4> source4, IObservable<TSource5> source5, IObservable<TSource6> source6, IObservable<TSource7> source7, IObservable<TSource8> source8, IObservable<TSource9> source9, Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TResult> resultSelector)
- {
- if (source1 == null)
- throw new ArgumentNullException("source1");
- if (source2 == null)
- throw new ArgumentNullException("source2");
- if (source3 == null)
- throw new ArgumentNullException("source3");
- if (source4 == null)
- throw new ArgumentNullException("source4");
- if (source5 == null)
- throw new ArgumentNullException("source5");
- if (source6 == null)
- throw new ArgumentNullException("source6");
- if (source7 == null)
- throw new ArgumentNullException("source7");
- if (source8 == null)
- throw new ArgumentNullException("source8");
- if (source9 == null)
- throw new ArgumentNullException("source9");
- if (resultSelector == null)
- throw new ArgumentNullException("resultSelector");
-
- return s_impl.Zip<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TResult>(source1, source2, source3, source4, source5, source6, source7, source8, source9, resultSelector);
- }
-
- /// <summary>
- /// Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index.
- /// </summary>
- /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
- /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
- /// <typeparam name="TSource3">The type of the elements in the third source sequence.</typeparam>
- /// <typeparam name="TSource4">The type of the elements in the fourth source sequence.</typeparam>
- /// <typeparam name="TSource5">The type of the elements in the fifth source sequence.</typeparam>
- /// <typeparam name="TSource6">The type of the elements in the sixth source sequence.</typeparam>
- /// <typeparam name="TSource7">The type of the elements in the seventh source sequence.</typeparam>
- /// <typeparam name="TSource8">The type of the elements in the eighth source sequence.</typeparam>
- /// <typeparam name="TSource9">The type of the elements in the ninth source sequence.</typeparam>
- /// <typeparam name="TSource10">The type of the elements in the tenth source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
- /// <param name="source1">First observable source.</param>
- /// <param name="source2">Second observable source.</param>
- /// <param name="source3">Third observable source.</param>
- /// <param name="source4">Fourth observable source.</param>
- /// <param name="source5">Fifth observable source.</param>
- /// <param name="source6">Sixth observable source.</param>
- /// <param name="source7">Seventh observable source.</param>
- /// <param name="source8">Eighth observable source.</param>
- /// <param name="source9">Ninth observable source.</param>
- /// <param name="source10">Tenth observable source.</param>
- /// <param name="resultSelector">Function to invoke for each series of elements at corresponding indexes in the sources.</param>
- /// <returns>An observable sequence containing the result of combining elements of the sources using the specified result selector function.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source1"/> or <paramref name="source2"/> or <paramref name="source3"/> or <paramref name="source4"/> or <paramref name="source5"/> or <paramref name="source6"/> or <paramref name="source7"/> or <paramref name="source8"/> or <paramref name="source9"/> or <paramref name="source10"/> or <paramref name="resultSelector"/> is null.</exception>
- public static IObservable<TResult> Zip<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TResult>(this IObservable<TSource1> source1, IObservable<TSource2> source2, IObservable<TSource3> source3, IObservable<TSource4> source4, IObservable<TSource5> source5, IObservable<TSource6> source6, IObservable<TSource7> source7, IObservable<TSource8> source8, IObservable<TSource9> source9, IObservable<TSource10> source10, Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TResult> resultSelector)
- {
- if (source1 == null)
- throw new ArgumentNullException("source1");
- if (source2 == null)
- throw new ArgumentNullException("source2");
- if (source3 == null)
- throw new ArgumentNullException("source3");
- if (source4 == null)
- throw new ArgumentNullException("source4");
- if (source5 == null)
- throw new ArgumentNullException("source5");
- if (source6 == null)
- throw new ArgumentNullException("source6");
- if (source7 == null)
- throw new ArgumentNullException("source7");
- if (source8 == null)
- throw new ArgumentNullException("source8");
- if (source9 == null)
- throw new ArgumentNullException("source9");
- if (source10 == null)
- throw new ArgumentNullException("source10");
- if (resultSelector == null)
- throw new ArgumentNullException("resultSelector");
-
- return s_impl.Zip<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TResult>(source1, source2, source3, source4, source5, source6, source7, source8, source9, source10, resultSelector);
- }
-
- /// <summary>
- /// Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index.
- /// </summary>
- /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
- /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
- /// <typeparam name="TSource3">The type of the elements in the third source sequence.</typeparam>
- /// <typeparam name="TSource4">The type of the elements in the fourth source sequence.</typeparam>
- /// <typeparam name="TSource5">The type of the elements in the fifth source sequence.</typeparam>
- /// <typeparam name="TSource6">The type of the elements in the sixth source sequence.</typeparam>
- /// <typeparam name="TSource7">The type of the elements in the seventh source sequence.</typeparam>
- /// <typeparam name="TSource8">The type of the elements in the eighth source sequence.</typeparam>
- /// <typeparam name="TSource9">The type of the elements in the ninth source sequence.</typeparam>
- /// <typeparam name="TSource10">The type of the elements in the tenth source sequence.</typeparam>
- /// <typeparam name="TSource11">The type of the elements in the eleventh source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
- /// <param name="source1">First observable source.</param>
- /// <param name="source2">Second observable source.</param>
- /// <param name="source3">Third observable source.</param>
- /// <param name="source4">Fourth observable source.</param>
- /// <param name="source5">Fifth observable source.</param>
- /// <param name="source6">Sixth observable source.</param>
- /// <param name="source7">Seventh observable source.</param>
- /// <param name="source8">Eighth observable source.</param>
- /// <param name="source9">Ninth observable source.</param>
- /// <param name="source10">Tenth observable source.</param>
- /// <param name="source11">Eleventh observable source.</param>
- /// <param name="resultSelector">Function to invoke for each series of elements at corresponding indexes in the sources.</param>
- /// <returns>An observable sequence containing the result of combining elements of the sources using the specified result selector function.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source1"/> or <paramref name="source2"/> or <paramref name="source3"/> or <paramref name="source4"/> or <paramref name="source5"/> or <paramref name="source6"/> or <paramref name="source7"/> or <paramref name="source8"/> or <paramref name="source9"/> or <paramref name="source10"/> or <paramref name="source11"/> or <paramref name="resultSelector"/> is null.</exception>
- public static IObservable<TResult> Zip<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TResult>(this IObservable<TSource1> source1, IObservable<TSource2> source2, IObservable<TSource3> source3, IObservable<TSource4> source4, IObservable<TSource5> source5, IObservable<TSource6> source6, IObservable<TSource7> source7, IObservable<TSource8> source8, IObservable<TSource9> source9, IObservable<TSource10> source10, IObservable<TSource11> source11, Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TResult> resultSelector)
- {
- if (source1 == null)
- throw new ArgumentNullException("source1");
- if (source2 == null)
- throw new ArgumentNullException("source2");
- if (source3 == null)
- throw new ArgumentNullException("source3");
- if (source4 == null)
- throw new ArgumentNullException("source4");
- if (source5 == null)
- throw new ArgumentNullException("source5");
- if (source6 == null)
- throw new ArgumentNullException("source6");
- if (source7 == null)
- throw new ArgumentNullException("source7");
- if (source8 == null)
- throw new ArgumentNullException("source8");
- if (source9 == null)
- throw new ArgumentNullException("source9");
- if (source10 == null)
- throw new ArgumentNullException("source10");
- if (source11 == null)
- throw new ArgumentNullException("source11");
- if (resultSelector == null)
- throw new ArgumentNullException("resultSelector");
-
- return s_impl.Zip<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TResult>(source1, source2, source3, source4, source5, source6, source7, source8, source9, source10, source11, resultSelector);
- }
-
- /// <summary>
- /// Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index.
- /// </summary>
- /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
- /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
- /// <typeparam name="TSource3">The type of the elements in the third source sequence.</typeparam>
- /// <typeparam name="TSource4">The type of the elements in the fourth source sequence.</typeparam>
- /// <typeparam name="TSource5">The type of the elements in the fifth source sequence.</typeparam>
- /// <typeparam name="TSource6">The type of the elements in the sixth source sequence.</typeparam>
- /// <typeparam name="TSource7">The type of the elements in the seventh source sequence.</typeparam>
- /// <typeparam name="TSource8">The type of the elements in the eighth source sequence.</typeparam>
- /// <typeparam name="TSource9">The type of the elements in the ninth source sequence.</typeparam>
- /// <typeparam name="TSource10">The type of the elements in the tenth source sequence.</typeparam>
- /// <typeparam name="TSource11">The type of the elements in the eleventh source sequence.</typeparam>
- /// <typeparam name="TSource12">The type of the elements in the twelfth source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
- /// <param name="source1">First observable source.</param>
- /// <param name="source2">Second observable source.</param>
- /// <param name="source3">Third observable source.</param>
- /// <param name="source4">Fourth observable source.</param>
- /// <param name="source5">Fifth observable source.</param>
- /// <param name="source6">Sixth observable source.</param>
- /// <param name="source7">Seventh observable source.</param>
- /// <param name="source8">Eighth observable source.</param>
- /// <param name="source9">Ninth observable source.</param>
- /// <param name="source10">Tenth observable source.</param>
- /// <param name="source11">Eleventh observable source.</param>
- /// <param name="source12">Twelfth observable source.</param>
- /// <param name="resultSelector">Function to invoke for each series of elements at corresponding indexes in the sources.</param>
- /// <returns>An observable sequence containing the result of combining elements of the sources using the specified result selector function.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source1"/> or <paramref name="source2"/> or <paramref name="source3"/> or <paramref name="source4"/> or <paramref name="source5"/> or <paramref name="source6"/> or <paramref name="source7"/> or <paramref name="source8"/> or <paramref name="source9"/> or <paramref name="source10"/> or <paramref name="source11"/> or <paramref name="source12"/> or <paramref name="resultSelector"/> is null.</exception>
- public static IObservable<TResult> Zip<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TResult>(this IObservable<TSource1> source1, IObservable<TSource2> source2, IObservable<TSource3> source3, IObservable<TSource4> source4, IObservable<TSource5> source5, IObservable<TSource6> source6, IObservable<TSource7> source7, IObservable<TSource8> source8, IObservable<TSource9> source9, IObservable<TSource10> source10, IObservable<TSource11> source11, IObservable<TSource12> source12, Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TResult> resultSelector)
- {
- if (source1 == null)
- throw new ArgumentNullException("source1");
- if (source2 == null)
- throw new ArgumentNullException("source2");
- if (source3 == null)
- throw new ArgumentNullException("source3");
- if (source4 == null)
- throw new ArgumentNullException("source4");
- if (source5 == null)
- throw new ArgumentNullException("source5");
- if (source6 == null)
- throw new ArgumentNullException("source6");
- if (source7 == null)
- throw new ArgumentNullException("source7");
- if (source8 == null)
- throw new ArgumentNullException("source8");
- if (source9 == null)
- throw new ArgumentNullException("source9");
- if (source10 == null)
- throw new ArgumentNullException("source10");
- if (source11 == null)
- throw new ArgumentNullException("source11");
- if (source12 == null)
- throw new ArgumentNullException("source12");
- if (resultSelector == null)
- throw new ArgumentNullException("resultSelector");
-
- return s_impl.Zip<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TResult>(source1, source2, source3, source4, source5, source6, source7, source8, source9, source10, source11, source12, resultSelector);
- }
-
- /// <summary>
- /// Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index.
- /// </summary>
- /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
- /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
- /// <typeparam name="TSource3">The type of the elements in the third source sequence.</typeparam>
- /// <typeparam name="TSource4">The type of the elements in the fourth source sequence.</typeparam>
- /// <typeparam name="TSource5">The type of the elements in the fifth source sequence.</typeparam>
- /// <typeparam name="TSource6">The type of the elements in the sixth source sequence.</typeparam>
- /// <typeparam name="TSource7">The type of the elements in the seventh source sequence.</typeparam>
- /// <typeparam name="TSource8">The type of the elements in the eighth source sequence.</typeparam>
- /// <typeparam name="TSource9">The type of the elements in the ninth source sequence.</typeparam>
- /// <typeparam name="TSource10">The type of the elements in the tenth source sequence.</typeparam>
- /// <typeparam name="TSource11">The type of the elements in the eleventh source sequence.</typeparam>
- /// <typeparam name="TSource12">The type of the elements in the twelfth source sequence.</typeparam>
- /// <typeparam name="TSource13">The type of the elements in the thirteenth source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
- /// <param name="source1">First observable source.</param>
- /// <param name="source2">Second observable source.</param>
- /// <param name="source3">Third observable source.</param>
- /// <param name="source4">Fourth observable source.</param>
- /// <param name="source5">Fifth observable source.</param>
- /// <param name="source6">Sixth observable source.</param>
- /// <param name="source7">Seventh observable source.</param>
- /// <param name="source8">Eighth observable source.</param>
- /// <param name="source9">Ninth observable source.</param>
- /// <param name="source10">Tenth observable source.</param>
- /// <param name="source11">Eleventh observable source.</param>
- /// <param name="source12">Twelfth observable source.</param>
- /// <param name="source13">Thirteenth observable source.</param>
- /// <param name="resultSelector">Function to invoke for each series of elements at corresponding indexes in the sources.</param>
- /// <returns>An observable sequence containing the result of combining elements of the sources using the specified result selector function.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source1"/> or <paramref name="source2"/> or <paramref name="source3"/> or <paramref name="source4"/> or <paramref name="source5"/> or <paramref name="source6"/> or <paramref name="source7"/> or <paramref name="source8"/> or <paramref name="source9"/> or <paramref name="source10"/> or <paramref name="source11"/> or <paramref name="source12"/> or <paramref name="source13"/> or <paramref name="resultSelector"/> is null.</exception>
- public static IObservable<TResult> Zip<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TResult>(this IObservable<TSource1> source1, IObservable<TSource2> source2, IObservable<TSource3> source3, IObservable<TSource4> source4, IObservable<TSource5> source5, IObservable<TSource6> source6, IObservable<TSource7> source7, IObservable<TSource8> source8, IObservable<TSource9> source9, IObservable<TSource10> source10, IObservable<TSource11> source11, IObservable<TSource12> source12, IObservable<TSource13> source13, Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TResult> resultSelector)
- {
- if (source1 == null)
- throw new ArgumentNullException("source1");
- if (source2 == null)
- throw new ArgumentNullException("source2");
- if (source3 == null)
- throw new ArgumentNullException("source3");
- if (source4 == null)
- throw new ArgumentNullException("source4");
- if (source5 == null)
- throw new ArgumentNullException("source5");
- if (source6 == null)
- throw new ArgumentNullException("source6");
- if (source7 == null)
- throw new ArgumentNullException("source7");
- if (source8 == null)
- throw new ArgumentNullException("source8");
- if (source9 == null)
- throw new ArgumentNullException("source9");
- if (source10 == null)
- throw new ArgumentNullException("source10");
- if (source11 == null)
- throw new ArgumentNullException("source11");
- if (source12 == null)
- throw new ArgumentNullException("source12");
- if (source13 == null)
- throw new ArgumentNullException("source13");
- if (resultSelector == null)
- throw new ArgumentNullException("resultSelector");
-
- return s_impl.Zip<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TResult>(source1, source2, source3, source4, source5, source6, source7, source8, source9, source10, source11, source12, source13, resultSelector);
- }
-
- /// <summary>
- /// Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index.
- /// </summary>
- /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
- /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
- /// <typeparam name="TSource3">The type of the elements in the third source sequence.</typeparam>
- /// <typeparam name="TSource4">The type of the elements in the fourth source sequence.</typeparam>
- /// <typeparam name="TSource5">The type of the elements in the fifth source sequence.</typeparam>
- /// <typeparam name="TSource6">The type of the elements in the sixth source sequence.</typeparam>
- /// <typeparam name="TSource7">The type of the elements in the seventh source sequence.</typeparam>
- /// <typeparam name="TSource8">The type of the elements in the eighth source sequence.</typeparam>
- /// <typeparam name="TSource9">The type of the elements in the ninth source sequence.</typeparam>
- /// <typeparam name="TSource10">The type of the elements in the tenth source sequence.</typeparam>
- /// <typeparam name="TSource11">The type of the elements in the eleventh source sequence.</typeparam>
- /// <typeparam name="TSource12">The type of the elements in the twelfth source sequence.</typeparam>
- /// <typeparam name="TSource13">The type of the elements in the thirteenth source sequence.</typeparam>
- /// <typeparam name="TSource14">The type of the elements in the fourteenth source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
- /// <param name="source1">First observable source.</param>
- /// <param name="source2">Second observable source.</param>
- /// <param name="source3">Third observable source.</param>
- /// <param name="source4">Fourth observable source.</param>
- /// <param name="source5">Fifth observable source.</param>
- /// <param name="source6">Sixth observable source.</param>
- /// <param name="source7">Seventh observable source.</param>
- /// <param name="source8">Eighth observable source.</param>
- /// <param name="source9">Ninth observable source.</param>
- /// <param name="source10">Tenth observable source.</param>
- /// <param name="source11">Eleventh observable source.</param>
- /// <param name="source12">Twelfth observable source.</param>
- /// <param name="source13">Thirteenth observable source.</param>
- /// <param name="source14">Fourteenth observable source.</param>
- /// <param name="resultSelector">Function to invoke for each series of elements at corresponding indexes in the sources.</param>
- /// <returns>An observable sequence containing the result of combining elements of the sources using the specified result selector function.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source1"/> or <paramref name="source2"/> or <paramref name="source3"/> or <paramref name="source4"/> or <paramref name="source5"/> or <paramref name="source6"/> or <paramref name="source7"/> or <paramref name="source8"/> or <paramref name="source9"/> or <paramref name="source10"/> or <paramref name="source11"/> or <paramref name="source12"/> or <paramref name="source13"/> or <paramref name="source14"/> or <paramref name="resultSelector"/> is null.</exception>
- public static IObservable<TResult> Zip<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TSource14, TResult>(this IObservable<TSource1> source1, IObservable<TSource2> source2, IObservable<TSource3> source3, IObservable<TSource4> source4, IObservable<TSource5> source5, IObservable<TSource6> source6, IObservable<TSource7> source7, IObservable<TSource8> source8, IObservable<TSource9> source9, IObservable<TSource10> source10, IObservable<TSource11> source11, IObservable<TSource12> source12, IObservable<TSource13> source13, IObservable<TSource14> source14, Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TSource14, TResult> resultSelector)
- {
- if (source1 == null)
- throw new ArgumentNullException("source1");
- if (source2 == null)
- throw new ArgumentNullException("source2");
- if (source3 == null)
- throw new ArgumentNullException("source3");
- if (source4 == null)
- throw new ArgumentNullException("source4");
- if (source5 == null)
- throw new ArgumentNullException("source5");
- if (source6 == null)
- throw new ArgumentNullException("source6");
- if (source7 == null)
- throw new ArgumentNullException("source7");
- if (source8 == null)
- throw new ArgumentNullException("source8");
- if (source9 == null)
- throw new ArgumentNullException("source9");
- if (source10 == null)
- throw new ArgumentNullException("source10");
- if (source11 == null)
- throw new ArgumentNullException("source11");
- if (source12 == null)
- throw new ArgumentNullException("source12");
- if (source13 == null)
- throw new ArgumentNullException("source13");
- if (source14 == null)
- throw new ArgumentNullException("source14");
- if (resultSelector == null)
- throw new ArgumentNullException("resultSelector");
-
- return s_impl.Zip<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TSource14, TResult>(source1, source2, source3, source4, source5, source6, source7, source8, source9, source10, source11, source12, source13, source14, resultSelector);
- }
-
- /// <summary>
- /// Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index.
- /// </summary>
- /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
- /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
- /// <typeparam name="TSource3">The type of the elements in the third source sequence.</typeparam>
- /// <typeparam name="TSource4">The type of the elements in the fourth source sequence.</typeparam>
- /// <typeparam name="TSource5">The type of the elements in the fifth source sequence.</typeparam>
- /// <typeparam name="TSource6">The type of the elements in the sixth source sequence.</typeparam>
- /// <typeparam name="TSource7">The type of the elements in the seventh source sequence.</typeparam>
- /// <typeparam name="TSource8">The type of the elements in the eighth source sequence.</typeparam>
- /// <typeparam name="TSource9">The type of the elements in the ninth source sequence.</typeparam>
- /// <typeparam name="TSource10">The type of the elements in the tenth source sequence.</typeparam>
- /// <typeparam name="TSource11">The type of the elements in the eleventh source sequence.</typeparam>
- /// <typeparam name="TSource12">The type of the elements in the twelfth source sequence.</typeparam>
- /// <typeparam name="TSource13">The type of the elements in the thirteenth source sequence.</typeparam>
- /// <typeparam name="TSource14">The type of the elements in the fourteenth source sequence.</typeparam>
- /// <typeparam name="TSource15">The type of the elements in the fifteenth source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
- /// <param name="source1">First observable source.</param>
- /// <param name="source2">Second observable source.</param>
- /// <param name="source3">Third observable source.</param>
- /// <param name="source4">Fourth observable source.</param>
- /// <param name="source5">Fifth observable source.</param>
- /// <param name="source6">Sixth observable source.</param>
- /// <param name="source7">Seventh observable source.</param>
- /// <param name="source8">Eighth observable source.</param>
- /// <param name="source9">Ninth observable source.</param>
- /// <param name="source10">Tenth observable source.</param>
- /// <param name="source11">Eleventh observable source.</param>
- /// <param name="source12">Twelfth observable source.</param>
- /// <param name="source13">Thirteenth observable source.</param>
- /// <param name="source14">Fourteenth observable source.</param>
- /// <param name="source15">Fifteenth observable source.</param>
- /// <param name="resultSelector">Function to invoke for each series of elements at corresponding indexes in the sources.</param>
- /// <returns>An observable sequence containing the result of combining elements of the sources using the specified result selector function.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source1"/> or <paramref name="source2"/> or <paramref name="source3"/> or <paramref name="source4"/> or <paramref name="source5"/> or <paramref name="source6"/> or <paramref name="source7"/> or <paramref name="source8"/> or <paramref name="source9"/> or <paramref name="source10"/> or <paramref name="source11"/> or <paramref name="source12"/> or <paramref name="source13"/> or <paramref name="source14"/> or <paramref name="source15"/> or <paramref name="resultSelector"/> is null.</exception>
- public static IObservable<TResult> Zip<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TSource14, TSource15, TResult>(this IObservable<TSource1> source1, IObservable<TSource2> source2, IObservable<TSource3> source3, IObservable<TSource4> source4, IObservable<TSource5> source5, IObservable<TSource6> source6, IObservable<TSource7> source7, IObservable<TSource8> source8, IObservable<TSource9> source9, IObservable<TSource10> source10, IObservable<TSource11> source11, IObservable<TSource12> source12, IObservable<TSource13> source13, IObservable<TSource14> source14, IObservable<TSource15> source15, Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TSource14, TSource15, TResult> resultSelector)
- {
- if (source1 == null)
- throw new ArgumentNullException("source1");
- if (source2 == null)
- throw new ArgumentNullException("source2");
- if (source3 == null)
- throw new ArgumentNullException("source3");
- if (source4 == null)
- throw new ArgumentNullException("source4");
- if (source5 == null)
- throw new ArgumentNullException("source5");
- if (source6 == null)
- throw new ArgumentNullException("source6");
- if (source7 == null)
- throw new ArgumentNullException("source7");
- if (source8 == null)
- throw new ArgumentNullException("source8");
- if (source9 == null)
- throw new ArgumentNullException("source9");
- if (source10 == null)
- throw new ArgumentNullException("source10");
- if (source11 == null)
- throw new ArgumentNullException("source11");
- if (source12 == null)
- throw new ArgumentNullException("source12");
- if (source13 == null)
- throw new ArgumentNullException("source13");
- if (source14 == null)
- throw new ArgumentNullException("source14");
- if (source15 == null)
- throw new ArgumentNullException("source15");
- if (resultSelector == null)
- throw new ArgumentNullException("resultSelector");
-
- return s_impl.Zip<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TSource14, TSource15, TResult>(source1, source2, source3, source4, source5, source6, source7, source8, source9, source10, source11, source12, source13, source14, source15, resultSelector);
- }
-
- /// <summary>
- /// Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index.
- /// </summary>
- /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
- /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
- /// <typeparam name="TSource3">The type of the elements in the third source sequence.</typeparam>
- /// <typeparam name="TSource4">The type of the elements in the fourth source sequence.</typeparam>
- /// <typeparam name="TSource5">The type of the elements in the fifth source sequence.</typeparam>
- /// <typeparam name="TSource6">The type of the elements in the sixth source sequence.</typeparam>
- /// <typeparam name="TSource7">The type of the elements in the seventh source sequence.</typeparam>
- /// <typeparam name="TSource8">The type of the elements in the eighth source sequence.</typeparam>
- /// <typeparam name="TSource9">The type of the elements in the ninth source sequence.</typeparam>
- /// <typeparam name="TSource10">The type of the elements in the tenth source sequence.</typeparam>
- /// <typeparam name="TSource11">The type of the elements in the eleventh source sequence.</typeparam>
- /// <typeparam name="TSource12">The type of the elements in the twelfth source sequence.</typeparam>
- /// <typeparam name="TSource13">The type of the elements in the thirteenth source sequence.</typeparam>
- /// <typeparam name="TSource14">The type of the elements in the fourteenth source sequence.</typeparam>
- /// <typeparam name="TSource15">The type of the elements in the fifteenth source sequence.</typeparam>
- /// <typeparam name="TSource16">The type of the elements in the sixteenth source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
- /// <param name="source1">First observable source.</param>
- /// <param name="source2">Second observable source.</param>
- /// <param name="source3">Third observable source.</param>
- /// <param name="source4">Fourth observable source.</param>
- /// <param name="source5">Fifth observable source.</param>
- /// <param name="source6">Sixth observable source.</param>
- /// <param name="source7">Seventh observable source.</param>
- /// <param name="source8">Eighth observable source.</param>
- /// <param name="source9">Ninth observable source.</param>
- /// <param name="source10">Tenth observable source.</param>
- /// <param name="source11">Eleventh observable source.</param>
- /// <param name="source12">Twelfth observable source.</param>
- /// <param name="source13">Thirteenth observable source.</param>
- /// <param name="source14">Fourteenth observable source.</param>
- /// <param name="source15">Fifteenth observable source.</param>
- /// <param name="source16">Sixteenth observable source.</param>
- /// <param name="resultSelector">Function to invoke for each series of elements at corresponding indexes in the sources.</param>
- /// <returns>An observable sequence containing the result of combining elements of the sources using the specified result selector function.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source1"/> or <paramref name="source2"/> or <paramref name="source3"/> or <paramref name="source4"/> or <paramref name="source5"/> or <paramref name="source6"/> or <paramref name="source7"/> or <paramref name="source8"/> or <paramref name="source9"/> or <paramref name="source10"/> or <paramref name="source11"/> or <paramref name="source12"/> or <paramref name="source13"/> or <paramref name="source14"/> or <paramref name="source15"/> or <paramref name="source16"/> or <paramref name="resultSelector"/> is null.</exception>
- public static IObservable<TResult> Zip<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TSource14, TSource15, TSource16, TResult>(this IObservable<TSource1> source1, IObservable<TSource2> source2, IObservable<TSource3> source3, IObservable<TSource4> source4, IObservable<TSource5> source5, IObservable<TSource6> source6, IObservable<TSource7> source7, IObservable<TSource8> source8, IObservable<TSource9> source9, IObservable<TSource10> source10, IObservable<TSource11> source11, IObservable<TSource12> source12, IObservable<TSource13> source13, IObservable<TSource14> source14, IObservable<TSource15> source15, IObservable<TSource16> source16, Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TSource14, TSource15, TSource16, TResult> resultSelector)
- {
- if (source1 == null)
- throw new ArgumentNullException("source1");
- if (source2 == null)
- throw new ArgumentNullException("source2");
- if (source3 == null)
- throw new ArgumentNullException("source3");
- if (source4 == null)
- throw new ArgumentNullException("source4");
- if (source5 == null)
- throw new ArgumentNullException("source5");
- if (source6 == null)
- throw new ArgumentNullException("source6");
- if (source7 == null)
- throw new ArgumentNullException("source7");
- if (source8 == null)
- throw new ArgumentNullException("source8");
- if (source9 == null)
- throw new ArgumentNullException("source9");
- if (source10 == null)
- throw new ArgumentNullException("source10");
- if (source11 == null)
- throw new ArgumentNullException("source11");
- if (source12 == null)
- throw new ArgumentNullException("source12");
- if (source13 == null)
- throw new ArgumentNullException("source13");
- if (source14 == null)
- throw new ArgumentNullException("source14");
- if (source15 == null)
- throw new ArgumentNullException("source15");
- if (source16 == null)
- throw new ArgumentNullException("source16");
- if (resultSelector == null)
- throw new ArgumentNullException("resultSelector");
-
- return s_impl.Zip<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TSource14, TSource15, TSource16, TResult>(source1, source2, source3, source4, source5, source6, source7, source8, source9, source10, source11, source12, source13, source14, source15, source16, resultSelector);
- }
-
-#endif
-
- #endregion
-
-#endif
-
- /// <summary>
- /// Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequences.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
- /// <param name="sources">Observable sources.</param>
- /// <param name="resultSelector">Function to invoke for each series of elements at corresponding indexes in the sources.</param>
- /// <returns>An observable sequence containing the result of combining elements of the sources using the specified result selector function.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="sources"/> or <paramref name="resultSelector"/> is null.</exception>
- public static IObservable<TResult> Zip<TSource, TResult>(this IEnumerable<IObservable<TSource>> sources, Func<IList<TSource>, TResult> resultSelector)
- {
- if (sources == null)
- throw new ArgumentNullException("sources");
- if (resultSelector == null)
- throw new ArgumentNullException("resultSelector");
-
- return s_impl.Zip<TSource, TResult>(sources, resultSelector);
- }
-
- /// <summary>
- /// Merges the specified observable sequences into one observable sequence by emitting a list with the elements of the observable sequences at corresponding indexes.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequences, and in the lists in the result sequence.</typeparam>
- /// <param name="sources">Observable sources.</param>
- /// <returns>An observable sequence containing lists of elements at corresponding indexes.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="sources"/> is null.</exception>
- public static IObservable<IList<TSource>> Zip<TSource>(this IEnumerable<IObservable<TSource>> sources)
- {
- if (sources == null)
- throw new ArgumentNullException("sources");
-
- return s_impl.Zip<TSource>(sources);
- }
-
- /// <summary>
- /// Merges the specified observable sequences into one observable sequence by emitting a list with the elements of the observable sequences at corresponding indexes.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequences, and in the lists in the result sequence.</typeparam>
- /// <param name="sources">Observable sources.</param>
- /// <returns>An observable sequence containing lists of elements at corresponding indexes.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="sources"/> is null.</exception>
- public static IObservable<IList<TSource>> Zip<TSource>(params IObservable<TSource>[] sources)
- {
- if (sources == null)
- throw new ArgumentNullException("sources");
-
- return s_impl.Zip<TSource>(sources);
- }
-
- /// <summary>
- /// Merges an observable sequence and an enumerable sequence into one observable sequence by using the selector function.
- /// </summary>
- /// <typeparam name="TSource1">The type of the elements in the first observable source sequence.</typeparam>
- /// <typeparam name="TSource2">The type of the elements in the second enumerable source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
- /// <param name="first">First observable source.</param>
- /// <param name="second">Second enumerable source.</param>
- /// <param name="resultSelector">Function to invoke for each consecutive pair of elements from the first and second source.</param>
- /// <returns>An observable sequence containing the result of pairwise combining the elements of the first and second source using the specified result selector function.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="first"/> or <paramref name="second"/> or <paramref name="resultSelector"/> is null.</exception>
- public static IObservable<TResult> Zip<TSource1, TSource2, TResult>(this IObservable<TSource1> first, IEnumerable<TSource2> second, Func<TSource1, TSource2, TResult> resultSelector)
- {
- if (first == null)
- throw new ArgumentNullException("first");
- if (second == null)
- throw new ArgumentNullException("second");
- if (resultSelector == null)
- throw new ArgumentNullException("resultSelector");
-
- return s_impl.Zip<TSource1, TSource2, TResult>(first, second, resultSelector);
- }
-
- #endregion
- }
-}
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observable.Single.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observable.Single.cs
deleted file mode 100644
index 749f823..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observable.Single.cs
+++ /dev/null
@@ -1,657 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System.Collections.Generic;
-using System.Reactive.Concurrency;
-
-namespace System.Reactive.Linq
-{
- public static partial class Observable
- {
- #region + AsObservable +
-
- /// <summary>
- /// Hides the identity of an observable sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">An observable sequence whose identity to hide.</param>
- /// <returns>An observable sequence that hides the identity of the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- public static IObservable<TSource> AsObservable<TSource>(this IObservable<TSource> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return s_impl.AsObservable<TSource>(source);
- }
-
- #endregion
-
- #region + Buffer +
-
- /// <summary>
- /// Projects each element of an observable sequence into consecutive non-overlapping buffers which are produced based on element count information.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence, and in the lists in the result sequence.</typeparam>
- /// <param name="source">Source sequence to produce buffers over.</param>
- /// <param name="count">Length of each buffer.</param>
- /// <returns>An observable sequence of buffers.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <exception cref="ArgumentOutOfRangeException"><paramref name="count"/> is less than or equal to zero.</exception>
- public static IObservable<IList<TSource>> Buffer<TSource>(this IObservable<TSource> source, int count)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (count <= 0)
- throw new ArgumentOutOfRangeException("count");
-
- return s_impl.Buffer<TSource>(source, count);
- }
-
- /// <summary>
- /// Projects each element of an observable sequence into zero or more buffers which are produced based on element count information.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence, and in the lists in the result sequence.</typeparam>
- /// <param name="source">Source sequence to produce buffers over.</param>
- /// <param name="count">Length of each buffer.</param>
- /// <param name="skip">Number of elements to skip between creation of consecutive buffers.</param>
- /// <returns>An observable sequence of buffers.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <exception cref="ArgumentOutOfRangeException"><paramref name="count"/> or <paramref name="skip"/> is less than or equal to zero.</exception>
- public static IObservable<IList<TSource>> Buffer<TSource>(this IObservable<TSource> source, int count, int skip)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (count <= 0)
- throw new ArgumentOutOfRangeException("count");
- if (skip <= 0)
- throw new ArgumentOutOfRangeException("skip");
-
- return s_impl.Buffer<TSource>(source, count, skip);
- }
-
- #endregion
-
- #region + Dematerialize +
-
- /// <summary>
- /// Dematerializes the explicit notification values of an observable sequence as implicit notifications.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements materialized in the source sequence notification objects.</typeparam>
- /// <param name="source">An observable sequence containing explicit notification values which have to be turned into implicit notifications.</param>
- /// <returns>An observable sequence exhibiting the behavior corresponding to the source sequence's notification values.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- public static IObservable<TSource> Dematerialize<TSource>(this IObservable<Notification<TSource>> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return s_impl.Dematerialize<TSource>(source);
- }
-
- #endregion
-
- #region + DistinctUntilChanged +
-
- /// <summary>
- /// Returns an observable sequence that contains only distinct contiguous elements.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">An observable sequence to retain distinct contiguous elements for.</param>
- /// <returns>An observable sequence only containing the distinct contiguous elements from the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- public static IObservable<TSource> DistinctUntilChanged<TSource>(this IObservable<TSource> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return s_impl.DistinctUntilChanged<TSource>(source);
- }
-
- /// <summary>
- /// Returns an observable sequence that contains only distinct contiguous elements according to the comparer.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">An observable sequence to retain distinct contiguous elements for.</param>
- /// <param name="comparer">Equality comparer for source elements.</param>
- /// <returns>An observable sequence only containing the distinct contiguous elements from the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="comparer"/> is null.</exception>
- public static IObservable<TSource> DistinctUntilChanged<TSource>(this IObservable<TSource> source, IEqualityComparer<TSource> comparer)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (comparer == null)
- throw new ArgumentNullException("comparer");
-
- return s_impl.DistinctUntilChanged<TSource>(source, comparer);
- }
-
- /// <summary>
- /// Returns an observable sequence that contains only distinct contiguous elements according to the keySelector.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TKey">The type of the discriminator key computed for each element in the source sequence.</typeparam>
- /// <param name="source">An observable sequence to retain distinct contiguous elements for, based on a computed key value.</param>
- /// <param name="keySelector">A function to compute the comparison key for each element.</param>
- /// <returns>An observable sequence only containing the distinct contiguous elements, based on a computed key value, from the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="keySelector"/> is null.</exception>
- public static IObservable<TSource> DistinctUntilChanged<TSource, TKey>(this IObservable<TSource> source, Func<TSource, TKey> keySelector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (keySelector == null)
- throw new ArgumentNullException("keySelector");
-
- return s_impl.DistinctUntilChanged<TSource, TKey>(source, keySelector);
- }
-
- /// <summary>
- /// Returns an observable sequence that contains only distinct contiguous elements according to the keySelector and the comparer.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TKey">The type of the discriminator key computed for each element in the source sequence.</typeparam>
- /// <param name="source">An observable sequence to retain distinct contiguous elements for, based on a computed key value.</param>
- /// <param name="keySelector">A function to compute the comparison key for each element.</param>
- /// <param name="comparer">Equality comparer for computed key values.</param>
- /// <returns>An observable sequence only containing the distinct contiguous elements, based on a computed key value, from the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="keySelector"/> or <paramref name="comparer"/> is null.</exception>
- public static IObservable<TSource> DistinctUntilChanged<TSource, TKey>(this IObservable<TSource> source, Func<TSource, TKey> keySelector, IEqualityComparer<TKey> comparer)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (keySelector == null)
- throw new ArgumentNullException("keySelector");
- if (comparer == null)
- throw new ArgumentNullException("comparer");
-
- return s_impl.DistinctUntilChanged<TSource, TKey>(source, keySelector, comparer);
- }
-
- #endregion
-
- #region + Do +
-
- /// <summary>
- /// Invokes an action for each element in the observable sequence, and propagates all observer messages through the result sequence.
- /// This method can be used for debugging, logging, etc. of query behavior by intercepting the message stream to run arbitrary actions for messages on the pipeline.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence.</param>
- /// <param name="onNext">Action to invoke for each element in the observable sequence.</param>
- /// <returns>The source sequence with the side-effecting behavior applied.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="onNext"/> is null.</exception>
- public static IObservable<TSource> Do<TSource>(this IObservable<TSource> source, Action<TSource> onNext)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (onNext == null)
- throw new ArgumentNullException("onNext");
-
- return s_impl.Do<TSource>(source, onNext);
- }
-
- /// <summary>
- /// Invokes an action for each element in the observable sequence and invokes an action upon graceful termination of the observable sequence.
- /// This method can be used for debugging, logging, etc. of query behavior by intercepting the message stream to run arbitrary actions for messages on the pipeline.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence.</param>
- /// <param name="onNext">Action to invoke for each element in the observable sequence.</param>
- /// <param name="onCompleted">Action to invoke upon graceful termination of the observable sequence.</param>
- /// <returns>The source sequence with the side-effecting behavior applied.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="onNext"/> or <paramref name="onCompleted"/> is null.</exception>
- public static IObservable<TSource> Do<TSource>(this IObservable<TSource> source, Action<TSource> onNext, Action onCompleted)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (onNext == null)
- throw new ArgumentNullException("onNext");
- if (onCompleted == null)
- throw new ArgumentNullException("onCompleted");
-
- return s_impl.Do<TSource>(source, onNext, onCompleted);
- }
-
- /// <summary>
- /// Invokes an action for each element in the observable sequence and invokes an action upon exceptional termination of the observable sequence.
- /// This method can be used for debugging, logging, etc. of query behavior by intercepting the message stream to run arbitrary actions for messages on the pipeline.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence.</param>
- /// <param name="onNext">Action to invoke for each element in the observable sequence.</param>
- /// <param name="onError">Action to invoke upon exceptional termination of the observable sequence.</param>
- /// <returns>The source sequence with the side-effecting behavior applied.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="onNext"/> or <paramref name="onError"/> is null.</exception>
- public static IObservable<TSource> Do<TSource>(this IObservable<TSource> source, Action<TSource> onNext, Action<Exception> onError)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (onNext == null)
- throw new ArgumentNullException("onNext");
- if (onError == null)
- throw new ArgumentNullException("onError");
-
- return s_impl.Do<TSource>(source, onNext, onError);
- }
-
- /// <summary>
- /// Invokes an action for each element in the observable sequence and invokes an action upon graceful or exceptional termination of the observable sequence.
- /// This method can be used for debugging, logging, etc. of query behavior by intercepting the message stream to run arbitrary actions for messages on the pipeline.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence.</param>
- /// <param name="onNext">Action to invoke for each element in the observable sequence.</param>
- /// <param name="onError">Action to invoke upon exceptional termination of the observable sequence.</param>
- /// <param name="onCompleted">Action to invoke upon graceful termination of the observable sequence.</param>
- /// <returns>The source sequence with the side-effecting behavior applied.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="onNext"/> or <paramref name="onError"/> or <paramref name="onCompleted"/> is null.</exception>
- public static IObservable<TSource> Do<TSource>(this IObservable<TSource> source, Action<TSource> onNext, Action<Exception> onError, Action onCompleted)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (onNext == null)
- throw new ArgumentNullException("onNext");
- if (onError == null)
- throw new ArgumentNullException("onError");
- if (onCompleted == null)
- throw new ArgumentNullException("onCompleted");
-
- return s_impl.Do<TSource>(source, onNext, onError, onCompleted);
- }
-
- /// <summary>
- /// Invokes the observer's methods for each message in the source sequence.
- /// This method can be used for debugging, logging, etc. of query behavior by intercepting the message stream to run arbitrary actions for messages on the pipeline.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence.</param>
- /// <param name="observer">Observer whose methods to invoke as part of the source sequence's observation.</param>
- /// <returns>The source sequence with the side-effecting behavior applied.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="observer"/> is null.</exception>
- public static IObservable<TSource> Do<TSource>(this IObservable<TSource> source, IObserver<TSource> observer)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (observer == null)
- throw new ArgumentNullException("observer");
-
- return s_impl.Do<TSource>(source, observer);
- }
-
- #endregion
-
- #region + Finally +
-
- /// <summary>
- /// Invokes a specified action after the source observable sequence terminates gracefully or exceptionally.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence.</param>
- /// <param name="finallyAction">Action to invoke after the source observable sequence terminates.</param>
- /// <returns>Source sequence with the action-invoking termination behavior applied.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="finallyAction"/> is null.</exception>
- public static IObservable<TSource> Finally<TSource>(this IObservable<TSource> source, Action finallyAction)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (finallyAction == null)
- throw new ArgumentNullException("finallyAction");
-
- return s_impl.Finally<TSource>(source, finallyAction);
- }
-
- #endregion
-
- #region + IgnoreElements +
-
- /// <summary>
- /// Ignores all elements in an observable sequence leaving only the termination messages.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence.</param>
- /// <returns>An empty observable sequence that signals termination, successful or exceptional, of the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- public static IObservable<TSource> IgnoreElements<TSource>(this IObservable<TSource> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return s_impl.IgnoreElements<TSource>(source);
- }
-
- #endregion
-
- #region + Materialize +
-
- /// <summary>
- /// Materializes the implicit notifications of an observable sequence as explicit notification values.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">An observable sequence to get notification values for.</param>
- /// <returns>An observable sequence containing the materialized notification values from the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- public static IObservable<Notification<TSource>> Materialize<TSource>(this IObservable<TSource> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return s_impl.Materialize<TSource>(source);
- }
-
- #endregion
-
- #region - Repeat -
-
- /// <summary>
- /// Repeats the observable sequence indefinitely.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Observable sequence to repeat.</param>
- /// <returns>The observable sequence producing the elements of the given sequence repeatedly and sequentially.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- public static IObservable<TSource> Repeat<TSource>(this IObservable<TSource> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return s_impl.Repeat<TSource>(source);
- }
-
- /// <summary>
- /// Repeats the observable sequence a specified number of times.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Observable sequence to repeat.</param>
- /// <param name="repeatCount">Number of times to repeat the sequence.</param>
- /// <returns>The observable sequence producing the elements of the given sequence repeatedly.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <exception cref="ArgumentOutOfRangeException"><paramref name="repeatCount"/> is less than zero.</exception>
- public static IObservable<TSource> Repeat<TSource>(this IObservable<TSource> source, int repeatCount)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (repeatCount < 0)
- throw new ArgumentOutOfRangeException("repeatCount");
-
- return s_impl.Repeat<TSource>(source, repeatCount);
- }
-
- #endregion
-
- #region - Retry -
-
- /// <summary>
- /// Repeats the source observable sequence until it successfully terminates.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Observable sequence to repeat until it successfully terminates.</param>
- /// <returns>An observable sequence producing the elements of the given sequence repeatedly until it terminates successfully.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- public static IObservable<TSource> Retry<TSource>(this IObservable<TSource> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return s_impl.Retry<TSource>(source);
- }
-
- /// <summary>
- /// Repeats the source observable sequence the specified number of times or until it successfully terminates.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Observable sequence to repeat until it successfully terminates.</param>
- /// <param name="retryCount">Number of times to repeat the sequence.</param>
- /// <returns>An observable sequence producing the elements of the given sequence repeatedly until it terminates successfully.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <exception cref="ArgumentOutOfRangeException"><paramref name="retryCount"/> is less than zero.</exception>
- public static IObservable<TSource> Retry<TSource>(this IObservable<TSource> source, int retryCount)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (retryCount < 0)
- throw new ArgumentOutOfRangeException("retryCount");
-
- return s_impl.Retry<TSource>(source, retryCount);
- }
-
- #endregion
-
- #region + Scan +
-
- /// <summary>
- /// Applies an accumulator function over an observable sequence and returns each intermediate result. The specified seed value is used as the initial accumulator value.
- /// For aggregation behavior with no intermediate results, see <see cref="Observable.Aggregate&lt;TSource, Accumulate&gt;"/>.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TAccumulate">The type of the result of the aggregation.</typeparam>
- /// <param name="source">An observable sequence to accumulate over.</param>
- /// <param name="seed">The initial accumulator value.</param>
- /// <param name="accumulator">An accumulator function to be invoked on each element.</param>
- /// <returns>An observable sequence containing the accumulated values.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="accumulator"/> is null.</exception>
- public static IObservable<TAccumulate> Scan<TSource, TAccumulate>(this IObservable<TSource> source, TAccumulate seed, Func<TAccumulate, TSource, TAccumulate> accumulator)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (accumulator == null)
- throw new ArgumentNullException("accumulator");
-
- return s_impl.Scan<TSource, TAccumulate>(source, seed, accumulator);
- }
-
- /// <summary>
- /// Applies an accumulator function over an observable sequence and returns each intermediate result.
- /// For aggregation behavior with no intermediate results, see <see cref="Observable.Aggregate&lt;TSource&gt;"/>.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence and the result of the aggregation.</typeparam>
- /// <param name="source">An observable sequence to accumulate over.</param>
- /// <param name="accumulator">An accumulator function to be invoked on each element.</param>
- /// <returns>An observable sequence containing the accumulated values.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="accumulator"/> is null.</exception>
- public static IObservable<TSource> Scan<TSource>(this IObservable<TSource> source, Func<TSource, TSource, TSource> accumulator)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (accumulator == null)
- throw new ArgumentNullException("accumulator");
-
- return s_impl.Scan<TSource>(source, accumulator);
- }
-
- #endregion
-
- #region + SkipLast +
-
- /// <summary>
- /// Bypasses a specified number of elements at the end of an observable sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence.</param>
- /// <param name="count">Number of elements to bypass at the end of the source sequence.</param>
- /// <returns>An observable sequence containing the source sequence elements except for the bypassed ones at the end.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <exception cref="ArgumentOutOfRangeException"><paramref name="count"/> is less than zero.</exception>
- /// <remarks>
- /// This operator accumulates a queue with a length enough to store the first <paramref name="count"/> elements. As more elements are
- /// received, elements are taken from the front of the queue and produced on the result sequence. This causes elements to be delayed.
- /// </remarks>
- public static IObservable<TSource> SkipLast<TSource>(this IObservable<TSource> source, int count)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (count < 0)
- throw new ArgumentOutOfRangeException("count");
-
- return s_impl.SkipLast<TSource>(source, count);
- }
-
- #endregion
-
- #region - StartWith -
-
- /// <summary>
- /// Prepends a sequence of values to an observable sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence to prepend values to.</param>
- /// <param name="values">Values to prepend to the specified sequence.</param>
- /// <returns>The source sequence prepended with the specified values.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="values"/> is null.</exception>
- public static IObservable<TSource> StartWith<TSource>(this IObservable<TSource> source, params TSource[] values)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (values == null)
- throw new ArgumentNullException("values");
-
- return s_impl.StartWith<TSource>(source, values);
- }
-
- /// <summary>
- /// Prepends a sequence of values to an observable sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence to prepend values to.</param>
- /// <param name="scheduler">Scheduler to emit the prepended values on.</param>
- /// <param name="values">Values to prepend to the specified sequence.</param>
- /// <returns>The source sequence prepended with the specified values.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="scheduler"/> or <paramref name="values"/> is null.</exception>
- public static IObservable<TSource> StartWith<TSource>(this IObservable<TSource> source, IScheduler scheduler, params TSource[] values)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
- if (values == null)
- throw new ArgumentNullException("values");
-
- return s_impl.StartWith<TSource>(source, scheduler, values);
- }
-
- #endregion
-
- #region + TakeLast +
-
- /// <summary>
- /// Returns a specified number of contiguous elements from the end of an observable sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence.</param>
- /// <param name="count">Number of elements to take from the end of the source sequence.</param>
- /// <returns>An observable sequence containing the specified number of elements from the end of the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <exception cref="ArgumentOutOfRangeException"><paramref name="count"/> is less than zero.</exception>
- /// <remarks>
- /// This operator accumulates a buffer with a length enough to store elements <paramref name="count"/> elements. Upon completion of
- /// the source sequence, this buffer is drained on the result sequence. This causes the elements to be delayed.
- /// </remarks>
- public static IObservable<TSource> TakeLast<TSource>(this IObservable<TSource> source, int count)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (count < 0)
- throw new ArgumentOutOfRangeException("count");
-
- return s_impl.TakeLast<TSource>(source, count);
- }
-
- /// <summary>
- /// Returns a specified number of contiguous elements from the end of an observable sequence, using the specified scheduler to drain the queue.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence.</param>
- /// <param name="count">Number of elements to take from the end of the source sequence.</param>
- /// <param name="scheduler">Scheduler used to drain the queue upon completion of the source sequence.</param>
- /// <returns>An observable sequence containing the specified number of elements from the end of the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="scheduler"/> is null.</exception>
- /// <exception cref="ArgumentOutOfRangeException"><paramref name="count"/> is less than zero.</exception>
- /// <remarks>
- /// This operator accumulates a buffer with a length enough to store elements <paramref name="count"/> elements. Upon completion of
- /// the source sequence, this buffer is drained on the result sequence. This causes the elements to be delayed.
- /// </remarks>
- public static IObservable<TSource> TakeLast<TSource>(this IObservable<TSource> source, int count, IScheduler scheduler)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (count < 0)
- throw new ArgumentOutOfRangeException("count");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return s_impl.TakeLast<TSource>(source, count, scheduler);
- }
-
- #endregion
-
- #region + TakeLastBuffer +
-
- /// <summary>
- /// Returns a list with the specified number of contiguous elements from the end of an observable sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence.</param>
- /// <param name="count">Number of elements to take from the end of the source sequence.</param>
- /// <returns>An observable sequence containing a single list with the specified number of elements from the end of the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <exception cref="ArgumentOutOfRangeException"><paramref name="count"/> is less than zero.</exception>
- /// <remarks>
- /// This operator accumulates a buffer with a length enough to store <paramref name="count"/> elements. Upon completion of the
- /// source sequence, this buffer is produced on the result sequence.
- /// </remarks>
- public static IObservable<IList<TSource>> TakeLastBuffer<TSource>(this IObservable<TSource> source, int count)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (count < 0)
- throw new ArgumentOutOfRangeException("count");
-
- return s_impl.TakeLastBuffer<TSource>(source, count);
- }
-
- #endregion
-
- #region + Window +
-
- /// <summary>
- /// Projects each element of an observable sequence into consecutive non-overlapping windows which are produced based on element count information.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence, and in the windows in the result sequence.</typeparam>
- /// <param name="source">Source sequence to produce windows over.</param>
- /// <param name="count">Length of each window.</param>
- /// <returns>An observable sequence of windows.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <exception cref="ArgumentOutOfRangeException"><paramref name="count"/> is less than or equal to zero.</exception>
- public static IObservable<IObservable<TSource>> Window<TSource>(this IObservable<TSource> source, int count)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (count <= 0)
- throw new ArgumentOutOfRangeException("count");
-
- return s_impl.Window<TSource>(source, count);
- }
-
- /// <summary>
- /// Projects each element of an observable sequence into zero or more windows which are produced based on element count information.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence, and in the windows in the result sequence.</typeparam>
- /// <param name="source">Source sequence to produce windows over.</param>
- /// <param name="count">Length of each window.</param>
- /// <param name="skip">Number of elements to skip between creation of consecutive windows.</param>
- /// <returns>An observable sequence of windows.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <exception cref="ArgumentOutOfRangeException"><paramref name="count"/> or <paramref name="skip"/> is less than or equal to zero.</exception>
- public static IObservable<IObservable<TSource>> Window<TSource>(this IObservable<TSource> source, int count, int skip)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (count <= 0)
- throw new ArgumentOutOfRangeException("count");
- if (skip <= 0)
- throw new ArgumentOutOfRangeException("skip");
-
- return s_impl.Window<TSource>(source, count, skip);
- }
-
- #endregion
- }
-}
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observable.StandardSequenceOperators.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observable.StandardSequenceOperators.cs
deleted file mode 100644
index e20e3eb..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observable.StandardSequenceOperators.cs
+++ /dev/null
@@ -1,923 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System.Collections.Generic;
-using System.Reactive.Concurrency;
-
-#if !NO_TPL
-using System.Reactive.Threading.Tasks; // needed for doc comments
-using System.Threading;
-using System.Threading.Tasks;
-#endif
-
-namespace System.Reactive.Linq
-{
- public static partial class Observable
- {
- #region + Cast +
-
- /// <summary>
- /// Converts the elements of an observable sequence to the specified type.
- /// </summary>
- /// <typeparam name="TResult">The type to convert the elements in the source sequence to.</typeparam>
- /// <param name="source">The observable sequence that contains the elements to be converted.</param>
- /// <returns>An observable sequence that contains each element of the source sequence converted to the specified type.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- public static IObservable<TResult> Cast<TResult>(this IObservable<object> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return s_impl.Cast<TResult>(source);
- }
-
- #endregion
-
- #region + DefaultIfEmpty +
-
- /// <summary>
- /// Returns the elements of the specified sequence or the type parameter's default value in a singleton sequence if the sequence is empty.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence (if any), whose default value will be taken if the sequence is empty.</typeparam>
- /// <param name="source">The sequence to return a default value for if it is empty.</param>
- /// <returns>An observable sequence that contains the default value for the TSource type if the source is empty; otherwise, the elements of the source itself.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- public static IObservable<TSource> DefaultIfEmpty<TSource>(this IObservable<TSource> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return s_impl.DefaultIfEmpty<TSource>(source);
- }
-
- /// <summary>
- /// Returns the elements of the specified sequence or the specified value in a singleton sequence if the sequence is empty.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence (if any), and the specified default value which will be taken if the sequence is empty.</typeparam>
- /// <param name="source">The sequence to return the specified value for if it is empty.</param>
- /// <param name="defaultValue">The value to return if the sequence is empty.</param>
- /// <returns>An observable sequence that contains the specified default value if the source is empty; otherwise, the elements of the source itself.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- public static IObservable<TSource> DefaultIfEmpty<TSource>(this IObservable<TSource> source, TSource defaultValue)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return s_impl.DefaultIfEmpty<TSource>(source, defaultValue);
- }
-
- #endregion
-
- #region + Distinct +
-
- /// <summary>
- /// Returns an observable sequence that contains only distinct elements.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">An observable sequence to retain distinct elements for.</param>
- /// <returns>An observable sequence only containing the distinct elements from the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <remarks>Usage of this operator should be considered carefully due to the maintenance of an internal lookup structure which can grow large.</remarks>
- public static IObservable<TSource> Distinct<TSource>(this IObservable<TSource> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return s_impl.Distinct<TSource>(source);
- }
-
- /// <summary>
- /// Returns an observable sequence that contains only distinct elements according to the comparer.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">An observable sequence to retain distinct elements for.</param>
- /// <param name="comparer">Equality comparer for source elements.</param>
- /// <returns>An observable sequence only containing the distinct elements from the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="comparer"/> is null.</exception>
- /// <remarks>Usage of this operator should be considered carefully due to the maintenance of an internal lookup structure which can grow large.</remarks>
- public static IObservable<TSource> Distinct<TSource>(this IObservable<TSource> source, IEqualityComparer<TSource> comparer)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (comparer == null)
- throw new ArgumentNullException("comparer");
-
- return s_impl.Distinct<TSource>(source, comparer);
- }
-
- /// <summary>
- /// Returns an observable sequence that contains only distinct elements according to the keySelector.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TKey">The type of the discriminator key computed for each element in the source sequence.</typeparam>
- /// <param name="source">An observable sequence to retain distinct elements for.</param>
- /// <param name="keySelector">A function to compute the comparison key for each element.</param>
- /// <returns>An observable sequence only containing the distinct elements, based on a computed key value, from the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="keySelector"/> is null.</exception>
- /// <remarks>Usage of this operator should be considered carefully due to the maintenance of an internal lookup structure which can grow large.</remarks>
- public static IObservable<TSource> Distinct<TSource, TKey>(this IObservable<TSource> source, Func<TSource, TKey> keySelector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (keySelector == null)
- throw new ArgumentNullException("keySelector");
-
- return s_impl.Distinct<TSource, TKey>(source, keySelector);
- }
-
- /// <summary>
- /// Returns an observable sequence that contains only distinct elements according to the keySelector and the comparer.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TKey">The type of the discriminator key computed for each element in the source sequence.</typeparam>
- /// <param name="source">An observable sequence to retain distinct elements for.</param>
- /// <param name="keySelector">A function to compute the comparison key for each element.</param>
- /// <param name="comparer">Equality comparer for source elements.</param>
- /// <returns>An observable sequence only containing the distinct elements, based on a computed key value, from the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="keySelector"/> or <paramref name="comparer"/> is null.</exception>
- /// <remarks>Usage of this operator should be considered carefully due to the maintenance of an internal lookup structure which can grow large.</remarks>
- public static IObservable<TSource> Distinct<TSource, TKey>(this IObservable<TSource> source, Func<TSource, TKey> keySelector, IEqualityComparer<TKey> comparer)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (keySelector == null)
- throw new ArgumentNullException("keySelector");
- if (comparer == null)
- throw new ArgumentNullException("comparer");
-
- return s_impl.Distinct<TSource, TKey>(source, keySelector, comparer);
- }
-
- #endregion
-
- #region + GroupBy +
-
- /// <summary>
- /// Groups the elements of an observable sequence according to a specified key selector function.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TKey">The type of the grouping key computed for each element in the source sequence.</typeparam>
- /// <param name="source">An observable sequence whose elements to group.</param>
- /// <param name="keySelector">A function to extract the key for each element.</param>
- /// <returns>A sequence of observable groups, each of which corresponds to a unique key value, containing all elements that share that same key value.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="keySelector"/> is null.</exception>
- public static IObservable<IGroupedObservable<TKey, TSource>> GroupBy<TSource, TKey>(this IObservable<TSource> source, Func<TSource, TKey> keySelector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (keySelector == null)
- throw new ArgumentNullException("keySelector");
-
- return s_impl.GroupBy<TSource, TKey>(source, keySelector);
- }
-
- /// <summary>
- /// Groups the elements of an observable sequence according to a specified key selector function and comparer.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TKey">The type of the grouping key computed for each element in the source sequence.</typeparam>
- /// <param name="source">An observable sequence whose elements to group.</param>
- /// <param name="keySelector">A function to extract the key for each element.</param>
- /// <param name="comparer">An equality comparer to compare keys with.</param>
- /// <returns>A sequence of observable groups, each of which corresponds to a unique key value, containing all elements that share that same key value.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="keySelector"/> or <paramref name="comparer"/> is null.</exception>
- public static IObservable<IGroupedObservable<TKey, TSource>> GroupBy<TSource, TKey>(this IObservable<TSource> source, Func<TSource, TKey> keySelector, IEqualityComparer<TKey> comparer)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (keySelector == null)
- throw new ArgumentNullException("keySelector");
- if (comparer == null)
- throw new ArgumentNullException("comparer");
-
- return s_impl.GroupBy<TSource, TKey>(source, keySelector, comparer);
- }
-
- /// <summary>
- /// Groups the elements of an observable sequence and selects the resulting elements by using a specified function.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TKey">The type of the grouping key computed for each element in the source sequence.</typeparam>
- /// <typeparam name="TElement">The type of the elements within the groups computed for each element in the source sequence.</typeparam>
- /// <param name="source">An observable sequence whose elements to group.</param>
- /// <param name="keySelector">A function to extract the key for each element.</param>
- /// <param name="elementSelector">A function to map each source element to an element in an observable group.</param>
- /// <returns>A sequence of observable groups, each of which corresponds to a unique key value, containing all elements that share that same key value.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="keySelector"/> or <paramref name="elementSelector"/> is null.</exception>
- public static IObservable<IGroupedObservable<TKey, TElement>> GroupBy<TSource, TKey, TElement>(this IObservable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (keySelector == null)
- throw new ArgumentNullException("keySelector");
- if (elementSelector == null)
- throw new ArgumentNullException("elementSelector");
-
- return s_impl.GroupBy<TSource, TKey, TElement>(source, keySelector, elementSelector);
- }
-
- /// <summary>
- /// Groups the elements of an observable sequence according to a specified key selector function and comparer and selects the resulting elements by using a specified function.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TKey">The type of the grouping key computed for each element in the source sequence.</typeparam>
- /// <typeparam name="TElement">The type of the elements within the groups computed for each element in the source sequence.</typeparam>
- /// <param name="source">An observable sequence whose elements to group.</param>
- /// <param name="keySelector">A function to extract the key for each element.</param>
- /// <param name="elementSelector">A function to map each source element to an element in an observable group.</param>
- /// <param name="comparer">An equality comparer to compare keys with.</param>
- /// <returns>A sequence of observable groups, each of which corresponds to a unique key value, containing all elements that share that same key value.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="keySelector"/> or <paramref name="elementSelector"/> or <paramref name="comparer"/> is null.</exception>
- public static IObservable<IGroupedObservable<TKey, TElement>> GroupBy<TSource, TKey, TElement>(this IObservable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector, IEqualityComparer<TKey> comparer)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (keySelector == null)
- throw new ArgumentNullException("keySelector");
- if (elementSelector == null)
- throw new ArgumentNullException("elementSelector");
- if (comparer == null)
- throw new ArgumentNullException("comparer");
-
- return s_impl.GroupBy<TSource, TKey, TElement>(source, keySelector, elementSelector, comparer);
- }
-
- #endregion
-
- #region + GroupByUntil +
-
- /// <summary>
- /// Groups the elements of an observable sequence according to a specified key selector function and comparer and selects the resulting elements by using a specified function.
- /// A duration selector function is used to control the lifetime of groups. When a group expires, it receives an OnCompleted notification. When a new element with the same
- /// key value as a reclaimed group occurs, the group will be reborn with a new lifetime request.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TKey">The type of the grouping key computed for each element in the source sequence.</typeparam>
- /// <typeparam name="TElement">The type of the elements within the groups computed for each element in the source sequence.</typeparam>
- /// <typeparam name="TDuration">The type of the elements in the duration sequences obtained for each group to denote its lifetime.</typeparam>
- /// <param name="source">An observable sequence whose elements to group.</param>
- /// <param name="keySelector">A function to extract the key for each element.</param>
- /// <param name="elementSelector">A function to map each source element to an element in an observable group.</param>
- /// <param name="durationSelector">A function to signal the expiration of a group.</param>
- /// <param name="comparer">An equality comparer to compare keys with.</param>
- /// <returns>
- /// A sequence of observable groups, each of which corresponds to a unique key value, containing all elements that share that same key value.
- /// If a group's lifetime expires, a new group with the same key value can be created once an element with such a key value is encountered.
- /// </returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="keySelector"/> or <paramref name="elementSelector"/> or <paramref name="durationSelector"/> or <paramref name="comparer"/> is null.</exception>
- public static IObservable<IGroupedObservable<TKey, TElement>> GroupByUntil<TSource, TKey, TElement, TDuration>(this IObservable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector, Func<IGroupedObservable<TKey, TElement>, IObservable<TDuration>> durationSelector, IEqualityComparer<TKey> comparer)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (keySelector == null)
- throw new ArgumentNullException("keySelector");
- if (elementSelector == null)
- throw new ArgumentNullException("elementSelector");
- if (durationSelector == null)
- throw new ArgumentNullException("durationSelector");
- if (comparer == null)
- throw new ArgumentNullException("comparer");
-
- return s_impl.GroupByUntil<TSource, TKey, TElement, TDuration>(source, keySelector, elementSelector, durationSelector, comparer);
- }
-
- /// <summary>
- /// Groups the elements of an observable sequence according to a specified key selector function and selects the resulting elements by using a specified function.
- /// A duration selector function is used to control the lifetime of groups. When a group expires, it receives an OnCompleted notification. When a new element with the same
- /// key value as a reclaimed group occurs, the group will be reborn with a new lifetime request.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TKey">The type of the grouping key computed for each element in the source sequence.</typeparam>
- /// <typeparam name="TElement">The type of the elements within the groups computed for each element in the source sequence.</typeparam>
- /// <typeparam name="TDuration">The type of the elements in the duration sequences obtained for each group to denote its lifetime.</typeparam>
- /// <param name="source">An observable sequence whose elements to group.</param>
- /// <param name="keySelector">A function to extract the key for each element.</param>
- /// <param name="elementSelector">A function to map each source element to an element in an observable group.</param>
- /// <param name="durationSelector">A function to signal the expiration of a group.</param>
- /// <returns>
- /// A sequence of observable groups, each of which corresponds to a unique key value, containing all elements that share that same key value.
- /// If a group's lifetime expires, a new group with the same key value can be created once an element with such a key value is encoutered.
- /// </returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="keySelector"/> or <paramref name="elementSelector"/> or <paramref name="durationSelector"/> is null.</exception>
- public static IObservable<IGroupedObservable<TKey, TElement>> GroupByUntil<TSource, TKey, TElement, TDuration>(this IObservable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector, Func<IGroupedObservable<TKey, TElement>, IObservable<TDuration>> durationSelector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (keySelector == null)
- throw new ArgumentNullException("keySelector");
- if (elementSelector == null)
- throw new ArgumentNullException("elementSelector");
- if (durationSelector == null)
- throw new ArgumentNullException("durationSelector");
-
- return s_impl.GroupByUntil<TSource, TKey, TElement, TDuration>(source, keySelector, elementSelector, durationSelector);
- }
-
- /// <summary>
- /// Groups the elements of an observable sequence according to a specified key selector function and comparer.
- /// A duration selector function is used to control the lifetime of groups. When a group expires, it receives an OnCompleted notification. When a new element with the same
- /// key value as a reclaimed group occurs, the group will be reborn with a new lifetime request.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TKey">The type of the grouping key computed for each element in the source sequence.</typeparam>
- /// <typeparam name="TDuration">The type of the elements in the duration sequences obtained for each group to denote its lifetime.</typeparam>
- /// <param name="source">An observable sequence whose elements to group.</param>
- /// <param name="keySelector">A function to extract the key for each element.</param>
- /// <param name="durationSelector">A function to signal the expiration of a group.</param>
- /// <param name="comparer">An equality comparer to compare keys with.</param>
- /// <returns>
- /// A sequence of observable groups, each of which corresponds to a unique key value, containing all elements that share that same key value.
- /// If a group's lifetime expires, a new group with the same key value can be created once an element with such a key value is encoutered.
- /// </returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="keySelector"/> or <paramref name="durationSelector"/> or <paramref name="comparer"/> is null.</exception>
- public static IObservable<IGroupedObservable<TKey, TSource>> GroupByUntil<TSource, TKey, TDuration>(this IObservable<TSource> source, Func<TSource, TKey> keySelector,Func<IGroupedObservable<TKey, TSource>, IObservable<TDuration>> durationSelector, IEqualityComparer<TKey> comparer)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (keySelector == null)
- throw new ArgumentNullException("keySelector");
- if (durationSelector == null)
- throw new ArgumentNullException("durationSelector");
- if (comparer == null)
- throw new ArgumentNullException("comparer");
-
- return s_impl.GroupByUntil<TSource, TKey, TDuration>(source, keySelector, durationSelector, comparer);
- }
-
- /// <summary>
- /// Groups the elements of an observable sequence according to a specified key selector function.
- /// A duration selector function is used to control the lifetime of groups. When a group expires, it receives an OnCompleted notification. When a new element with the same
- /// key value as a reclaimed group occurs, the group will be reborn with a new lifetime request.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TKey">The type of the grouping key computed for each element in the source sequence.</typeparam>
- /// <typeparam name="TDuration">The type of the elements in the duration sequences obtained for each group to denote its lifetime.</typeparam>
- /// <param name="source">An observable sequence whose elements to group.</param>
- /// <param name="keySelector">A function to extract the key for each element.</param>
- /// <param name="durationSelector">A function to signal the expiration of a group.</param>
- /// <returns>
- /// A sequence of observable groups, each of which corresponds to a unique key value, containing all elements that share that same key value.
- /// If a group's lifetime expires, a new group with the same key value can be created once an element with such a key value is encoutered.
- /// </returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="keySelector"/> or <paramref name="durationSelector"/> is null.</exception>
- public static IObservable<IGroupedObservable<TKey, TSource>> GroupByUntil<TSource, TKey, TDuration>(this IObservable<TSource> source, Func<TSource, TKey> keySelector, Func<IGroupedObservable<TKey, TSource>, IObservable<TDuration>> durationSelector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (keySelector == null)
- throw new ArgumentNullException("keySelector");
- if (durationSelector == null)
- throw new ArgumentNullException("durationSelector");
-
- return s_impl.GroupByUntil<TSource, TKey, TDuration>(source, keySelector, durationSelector);
- }
-
- #endregion
-
- #region + GroupJoin +
-
- /// <summary>
- /// Correlates the elements of two sequences based on overlapping durations, and groups the results.
- /// </summary>
- /// <typeparam name="TLeft">The type of the elements in the left source sequence.</typeparam>
- /// <typeparam name="TRight">The type of the elements in the right source sequence.</typeparam>
- /// <typeparam name="TLeftDuration">The type of the elements in the duration sequence denoting the computed duration of each element in the left source sequence.</typeparam>
- /// <typeparam name="TRightDuration">The type of the elements in the duration sequence denoting the computed duration of each element in the right source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence, obtained by invoking the result selector function for source elements with overlapping duration.</typeparam>
- /// <param name="left">The left observable sequence to join elements for.</param>
- /// <param name="right">The right observable sequence to join elements for.</param>
- /// <param name="leftDurationSelector">A function to select the duration of each element of the left observable sequence, used to determine overlap.</param>
- /// <param name="rightDurationSelector">A function to select the duration of each element of the right observable sequence, used to determine overlap.</param>
- /// <param name="resultSelector">A function invoked to compute a result element for any element of the left sequence with overlapping elements from the right observable sequence.</param>
- /// <returns>An observable sequence that contains result elements computed from source elements that have an overlapping duration.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="left"/> or <paramref name="right"/> or <paramref name="leftDurationSelector"/> or <paramref name="rightDurationSelector"/> or <paramref name="resultSelector"/> is null.</exception>
- public static IObservable<TResult> GroupJoin<TLeft, TRight, TLeftDuration, TRightDuration, TResult>(this IObservable<TLeft> left, IObservable<TRight> right, Func<TLeft, IObservable<TLeftDuration>> leftDurationSelector, Func<TRight, IObservable<TRightDuration>> rightDurationSelector, Func<TLeft, IObservable<TRight>, TResult> resultSelector)
- {
- if (left == null)
- throw new ArgumentNullException("left");
- if (right == null)
- throw new ArgumentNullException("right");
- if (leftDurationSelector == null)
- throw new ArgumentNullException("leftDurationSelector");
- if (rightDurationSelector == null)
- throw new ArgumentNullException("rightDurationSelector");
- if (resultSelector == null)
- throw new ArgumentNullException("resultSelector");
-
- return s_impl.GroupJoin<TLeft, TRight, TLeftDuration, TRightDuration, TResult>(left, right, leftDurationSelector, rightDurationSelector, resultSelector);
- }
-
- #endregion
-
- #region + Join +
-
- /// <summary>
- /// Correlates the elements of two sequences based on overlapping durations.
- /// </summary>
- /// <typeparam name="TLeft">The type of the elements in the left source sequence.</typeparam>
- /// <typeparam name="TRight">The type of the elements in the right source sequence.</typeparam>
- /// <typeparam name="TLeftDuration">The type of the elements in the duration sequence denoting the computed duration of each element in the left source sequence.</typeparam>
- /// <typeparam name="TRightDuration">The type of the elements in the duration sequence denoting the computed duration of each element in the right source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence, obtained by invoking the result selector function for source elements with overlapping duration.</typeparam>
- /// <param name="left">The left observable sequence to join elements for.</param>
- /// <param name="right">The right observable sequence to join elements for.</param>
- /// <param name="leftDurationSelector">A function to select the duration of each element of the left observable sequence, used to determine overlap.</param>
- /// <param name="rightDurationSelector">A function to select the duration of each element of the right observable sequence, used to determine overlap.</param>
- /// <param name="resultSelector">A function invoked to compute a result element for any two overlapping elements of the left and right observable sequences.</param>
- /// <returns>An observable sequence that contains result elements computed from source elements that have an overlapping duration.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="left"/> or <paramref name="right"/> or <paramref name="leftDurationSelector"/> or <paramref name="rightDurationSelector"/> or <paramref name="resultSelector"/> is null.</exception>
- public static IObservable<TResult> Join<TLeft, TRight, TLeftDuration, TRightDuration, TResult>(this IObservable<TLeft> left, IObservable<TRight> right, Func<TLeft, IObservable<TLeftDuration>> leftDurationSelector, Func<TRight, IObservable<TRightDuration>> rightDurationSelector, Func<TLeft, TRight, TResult> resultSelector)
- {
- if (left == null)
- throw new ArgumentNullException("left");
- if (right == null)
- throw new ArgumentNullException("right");
- if (leftDurationSelector == null)
- throw new ArgumentNullException("leftDurationSelector");
- if (rightDurationSelector == null)
- throw new ArgumentNullException("rightDurationSelector");
- if (resultSelector == null)
- throw new ArgumentNullException("resultSelector");
-
- return s_impl.Join<TLeft, TRight, TLeftDuration, TRightDuration, TResult>(left, right, leftDurationSelector, rightDurationSelector, resultSelector);
- }
-
- #endregion
-
- #region + OfType +
-
- /// <summary>
- /// Filters the elements of an observable sequence based on the specified type.
- /// </summary>
- /// <typeparam name="TResult">The type to filter the elements in the source sequence on.</typeparam>
- /// <param name="source">The observable sequence that contains the elements to be filtered.</param>
- /// <returns>An observable sequence that contains elements from the input sequence of type TResult.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- public static IObservable<TResult> OfType<TResult>(this IObservable<object> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return s_impl.OfType<TResult>(source);
- }
-
- #endregion
-
- #region + Select +
-
- /// <summary>
- /// Projects each element of an observable sequence into a new form.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence, obtained by running the selector function for each element in the source sequence.</typeparam>
- /// <param name="source">A sequence of elements to invoke a transform function on.</param>
- /// <param name="selector">A transform function to apply to each source element.</param>
- /// <returns>An observable sequence whose elements are the result of invoking the transform function on each element of source.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> is null.</exception>
- public static IObservable<TResult> Select<TSource, TResult>(this IObservable<TSource> source, Func<TSource, TResult> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return s_impl.Select<TSource, TResult>(source, selector);
- }
-
- /// <summary>
- /// Projects each element of an observable sequence into a new form by incorporating the element's index.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence, obtained by running the selector function for each element in the source sequence.</typeparam>
- /// <param name="source">A sequence of elements to invoke a transform function on.</param>
- /// <param name="selector">A transform function to apply to each source element; the second parameter of the function represents the index of the source element.</param>
- /// <returns>An observable sequence whose elements are the result of invoking the transform function on each element of source.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> is null.</exception>
- public static IObservable<TResult> Select<TSource, TResult>(this IObservable<TSource> source, Func<TSource, int, TResult> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return s_impl.Select<TSource, TResult>(source, selector);
- }
-
- #endregion
-
- #region + SelectMany +
-
- /// <summary>
- /// Projects each element of the source observable sequence to the other observable sequence and merges the resulting observable sequences into one observable sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TOther">The type of the elements in the other sequence and the elements in the result sequence.</typeparam>
- /// <param name="source">An observable sequence of elements to project.</param>
- /// <param name="other">An observable sequence to project each element from the source sequence onto.</param>
- /// <returns>An observable sequence whose elements are the result of projecting each source element onto the other sequence and merging all the resulting sequences together.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="other"/> is null.</exception>
- public static IObservable<TOther> SelectMany<TSource, TOther>(this IObservable<TSource> source, IObservable<TOther> other)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (other == null)
- throw new ArgumentNullException("other");
-
- return s_impl.SelectMany<TSource, TOther>(source, other);
- }
-
- /// <summary>
- /// Projects each element of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the projected inner sequences and the elements in the merged result sequence.</typeparam>
- /// <param name="source">An observable sequence of elements to project.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence whose elements are the result of invoking the one-to-many transform function on each element of the input sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> is null.</exception>
- public static IObservable<TResult> SelectMany<TSource, TResult>(this IObservable<TSource> source, Func<TSource, IObservable<TResult>> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return s_impl.SelectMany<TSource, TResult>(source, selector);
- }
-
-#if !NO_TPL
- /// <summary>
- /// Projects each element of an observable sequence to a task and merges all of the task results into one observable sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the result produced by the projected tasks and the elements in the merged result sequence.</typeparam>
- /// <param name="source">An observable sequence of elements to project.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence whose elements are the result of the tasks executed for each element of the input sequence.</returns>
- /// <remarks>This overload supports composition of observable sequences and tasks, without requiring manual conversion of the tasks to observable sequences using <see cref="TaskObservableExtensions.ToObservable&lt;TResult&gt;"/>.</remarks>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> is null.</exception>
- public static IObservable<TResult> SelectMany<TSource, TResult>(this IObservable<TSource> source, Func<TSource, Task<TResult>> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return s_impl.SelectMany<TSource, TResult>(source, selector);
- }
-
- /// <summary>
- /// Projects each element of an observable sequence to a task with cancellation support and merges all of the task results into one observable sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the result produced by the projected tasks and the elements in the merged result sequence.</typeparam>
- /// <param name="source">An observable sequence of elements to project.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence whose elements are the result of the tasks executed for each element of the input sequence.</returns>
- /// <remarks>This overload supports composition of observable sequences and tasks, without requiring manual conversion of the tasks to observable sequences using <see cref="TaskObservableExtensions.ToObservable&lt;TResult&gt;"/>.</remarks>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> is null.</exception>
- public static IObservable<TResult> SelectMany<TSource, TResult>(this IObservable<TSource> source, Func<TSource, CancellationToken, Task<TResult>> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return s_impl.SelectMany<TSource, TResult>(source, selector);
- }
-#endif
-
- /// <summary>
- /// Projects each element of an observable sequence to an observable sequence, invokes the result selector for the source element and each of the corresponding inner sequence's elements, and merges the results into one observable sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TCollection">The type of the elements in the projected intermediate sequences.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence, obtained by using the selector to combine source sequence elements with their corresponding intermediate sequence elements.</typeparam>
- /// <param name="source">An observable sequence of elements to project.</param>
- /// <param name="collectionSelector">A transform function to apply to each element.</param>
- /// <param name="resultSelector">A transform function to apply to each element of the intermediate sequence.</param>
- /// <returns>An observable sequence whose elements are the result of invoking the one-to-many transform function collectionSelector on each element of the input sequence and then mapping each of those sequence elements and their corresponding source element to a result element.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="collectionSelector"/> or <paramref name="resultSelector"/> is null.</exception>
- public static IObservable<TResult> SelectMany<TSource, TCollection, TResult>(this IObservable<TSource> source, Func<TSource, IObservable<TCollection>> collectionSelector, Func<TSource, TCollection, TResult> resultSelector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (collectionSelector == null)
- throw new ArgumentNullException("collectionSelector");
- if (resultSelector == null)
- throw new ArgumentNullException("resultSelector");
-
- return s_impl.SelectMany<TSource, TCollection, TResult>(source, collectionSelector, resultSelector);
- }
-
-#if !NO_TPL
- /// <summary>
- /// Projects each element of an observable sequence to a task, invokes the result selector for the source element and the task result, and merges the results into one observable sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TTaskResult">The type of the results produced by the projected intermediate tasks.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence, obtained by using the selector to combine source sequence elements with their corresponding intermediate task results.</typeparam>
- /// <param name="source">An observable sequence of elements to project.</param>
- /// <param name="taskSelector">A transform function to apply to each element.</param>
- /// <param name="resultSelector">A transform function to apply to each element of the intermediate sequence.</param>
- /// <returns>An observable sequence whose elements are the result of obtaining a task for each element of the input sequence and then mapping the task's result and its corresponding source element to a result element.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="taskSelector"/> or <paramref name="resultSelector"/> is null.</exception>
- /// <remarks>This overload supports using LINQ query comprehension syntax in C# and Visual Basic to compose observable sequences and tasks, without requiring manual conversion of the tasks to observable sequences using <see cref="TaskObservableExtensions.ToObservable&lt;TResult&gt;"/>.</remarks>
- public static IObservable<TResult> SelectMany<TSource, TTaskResult, TResult>(this IObservable<TSource> source, Func<TSource, Task<TTaskResult>> taskSelector, Func<TSource, TTaskResult, TResult> resultSelector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (taskSelector == null)
- throw new ArgumentNullException("taskSelector");
- if (resultSelector == null)
- throw new ArgumentNullException("resultSelector");
-
- return s_impl.SelectMany<TSource, TTaskResult, TResult>(source, taskSelector, resultSelector);
- }
-
- /// <summary>
- /// Projects each element of an observable sequence to a task with cancellation support, invokes the result selector for the source element and the task result, and merges the results into one observable sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TTaskResult">The type of the results produced by the projected intermediate tasks.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence, obtained by using the selector to combine source sequence elements with their corresponding intermediate task results.</typeparam>
- /// <param name="source">An observable sequence of elements to project.</param>
- /// <param name="taskSelector">A transform function to apply to each element.</param>
- /// <param name="resultSelector">A transform function to apply to each element of the intermediate sequence.</param>
- /// <returns>An observable sequence whose elements are the result of obtaining a task for each element of the input sequence and then mapping the task's result and its corresponding source element to a result element.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="taskSelector"/> or <paramref name="resultSelector"/> is null.</exception>
- /// <remarks>This overload supports using LINQ query comprehension syntax in C# and Visual Basic to compose observable sequences and tasks, without requiring manual conversion of the tasks to observable sequences using <see cref="TaskObservableExtensions.ToObservable&lt;TResult&gt;"/>.</remarks>
- public static IObservable<TResult> SelectMany<TSource, TTaskResult, TResult>(this IObservable<TSource> source, Func<TSource, CancellationToken, Task<TTaskResult>> taskSelector, Func<TSource, TTaskResult, TResult> resultSelector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (taskSelector == null)
- throw new ArgumentNullException("taskSelector");
- if (resultSelector == null)
- throw new ArgumentNullException("resultSelector");
-
- return s_impl.SelectMany<TSource, TTaskResult, TResult>(source, taskSelector, resultSelector);
- }
-#endif
-
- /// <summary>
- /// Projects each notification of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the projected inner sequences and the elements in the merged result sequence.</typeparam>
- /// <param name="source">An observable sequence of notifications to project.</param>
- /// <param name="onNext">A transform function to apply to each element.</param>
- /// <param name="onError">A transform function to apply when an error occurs in the source sequence.</param>
- /// <param name="onCompleted">A transform function to apply when the end of the source sequence is reached.</param>
- /// <returns>An observable sequence whose elements are the result of invoking the one-to-many transform function corresponding to each notification in the input sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="onNext"/> or <paramref name="onError"/> or <paramref name="onCompleted"/> is null.</exception>
- public static IObservable<TResult> SelectMany<TSource, TResult>(this IObservable<TSource> source, Func<TSource, IObservable<TResult>> onNext, Func<Exception, IObservable<TResult>> onError, Func<IObservable<TResult>> onCompleted)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (onNext == null)
- throw new ArgumentNullException("onNext");
- if (onError == null)
- throw new ArgumentNullException("onError");
- if (onCompleted == null)
- throw new ArgumentNullException("onCompleted");
-
- return s_impl.SelectMany<TSource, TResult>(source, onNext, onError, onCompleted);
- }
-
- /// <summary>
- /// Projects each element of an observable sequence to an enumerable sequence and concatenates the resulting enumerable sequences into one observable sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the projected inner enumerable sequences and the elements in the merged result sequence.</typeparam>
- /// <param name="source">An observable sequence of elements to project.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence whose elements are the result of invoking the one-to-many transform function on each element of the input sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> is null.</exception>
- /// <remarks>The projected sequences are enumerated synchonously within the OnNext call of the source sequence. In order to do a concurrent, non-blocking merge, change the selector to return an observable sequence obtained using the <see cref="Observable.ToObservable&lt;TSource&gt;(IEnumerable&lt;TSource&gt;)"/> conversion.</remarks>
- public static IObservable<TResult> SelectMany<TSource, TResult>(this IObservable<TSource> source, Func<TSource, IEnumerable<TResult>> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return s_impl.SelectMany<TSource, TResult>(source, selector);
- }
-
- /// <summary>
- /// Projects each element of an observable sequence to an enumerable sequence, invokes the result selector for the source element and each of the corresponding inner sequence's elements, and merges the results into one observable sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TCollection">The type of the elements in the projected intermediate enumerable sequences.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence, obtained by using the selector to combine source sequence elements with their corresponding intermediate sequence elements.</typeparam>
- /// <param name="source">An observable sequence of elements to project.</param>
- /// <param name="collectionSelector">A transform function to apply to each element.</param>
- /// <param name="resultSelector">A transform function to apply to each element of the intermediate sequence.</param>
- /// <returns>An observable sequence whose elements are the result of invoking the one-to-many transform function collectionSelector on each element of the input sequence and then mapping each of those sequence elements and their corresponding source element to a result element.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="collectionSelector"/> or <paramref name="resultSelector"/> is null.</exception>
- /// <remarks>The projected sequences are enumerated synchonously within the OnNext call of the source sequence. In order to do a concurrent, non-blocking merge, change the selector to return an observable sequence obtained using the <see cref="Observable.ToObservable&lt;TSource&gt;(IEnumerable&lt;TSource&gt;)"/> conversion.</remarks>
- public static IObservable<TResult> SelectMany<TSource, TCollection, TResult>(this IObservable<TSource> source, Func<TSource, IEnumerable<TCollection>> collectionSelector, Func<TSource, TCollection, TResult> resultSelector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (collectionSelector == null)
- throw new ArgumentNullException("collectionSelector");
- if (resultSelector == null)
- throw new ArgumentNullException("resultSelector");
-
- return s_impl.SelectMany<TSource, TCollection, TResult>(source, collectionSelector, resultSelector);
- }
-
- #endregion
-
- #region + Skip +
-
- /// <summary>
- /// Bypasses a specified number of elements in an observable sequence and then returns the remaining elements.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">The sequence to take elements from.</param>
- /// <param name="count">The number of elements to skip before returning the remaining elements.</param>
- /// <returns>An observable sequence that contains the elements that occur after the specified index in the input sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <exception cref="ArgumentOutOfRangeException"><paramref name="count"/> is less than zero.</exception>
- public static IObservable<TSource> Skip<TSource>(this IObservable<TSource> source, int count)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (count < 0)
- throw new ArgumentOutOfRangeException("count");
-
- return s_impl.Skip<TSource>(source, count);
- }
-
- #endregion
-
- #region + SkipWhile +
-
- /// <summary>
- /// Bypasses elements in an observable sequence as long as a specified condition is true and then returns the remaining elements.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">An observable sequence to return elements from.</param>
- /// <param name="predicate">A function to test each element for a condition.</param>
- /// <returns>An observable sequence that contains the elements from the input sequence starting at the first element in the linear series that does not pass the test specified by predicate.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="predicate"/> is null.</exception>
- public static IObservable<TSource> SkipWhile<TSource>(this IObservable<TSource> source, Func<TSource, bool> predicate)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (predicate == null)
- throw new ArgumentNullException("predicate");
-
- return s_impl.SkipWhile<TSource>(source, predicate);
- }
-
- /// <summary>
- /// Bypasses elements in an observable sequence as long as a specified condition is true and then returns the remaining elements.
- /// The element's index is used in the logic of the predicate function.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">An observable sequence to return elements from.</param>
- /// <param name="predicate">A function to test each element for a condition; the second parameter of the function represents the index of the source element.</param>
- /// <returns>An observable sequence that contains the elements from the input sequence starting at the first element in the linear series that does not pass the test specified by predicate.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="predicate"/> is null.</exception>
- public static IObservable<TSource> SkipWhile<TSource>(this IObservable<TSource> source, Func<TSource, int, bool> predicate)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (predicate == null)
- throw new ArgumentNullException("predicate");
-
- return s_impl.SkipWhile<TSource>(source, predicate);
- }
-
- #endregion
-
- #region + Take +
-
- /// <summary>
- /// Returns a specified number of contiguous elements from the start of an observable sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">The sequence to take elements from.</param>
- /// <param name="count">The number of elements to return.</param>
- /// <returns>An observable sequence that contains the specified number of elements from the start of the input sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <exception cref="ArgumentOutOfRangeException"><paramref name="count"/> is less than zero.</exception>
- public static IObservable<TSource> Take<TSource>(this IObservable<TSource> source, int count)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (count < 0)
- throw new ArgumentOutOfRangeException("count");
-
- return s_impl.Take<TSource>(source, count);
- }
-
- /// <summary>
- /// Returns a specified number of contiguous elements from the start of an observable sequence, using the specified scheduler for the edge case of Take(0).
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">The sequence to take elements from.</param>
- /// <param name="count">The number of elements to return.</param>
- /// <param name="scheduler">Scheduler used to produce an OnCompleted message in case <paramref name="count">count</paramref> is set to 0.</param>
- /// <returns>An observable sequence that contains the specified number of elements from the start of the input sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="scheduler"/> is null.</exception>
- /// <exception cref="ArgumentOutOfRangeException"><paramref name="count"/> is less than zero.</exception>
- public static IObservable<TSource> Take<TSource>(this IObservable<TSource> source, int count, IScheduler scheduler)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (count < 0)
- throw new ArgumentOutOfRangeException("count");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return s_impl.Take<TSource>(source, count, scheduler);
- }
-
- #endregion
-
- #region + TakeWhile +
-
- /// <summary>
- /// Returns elements from an observable sequence as long as a specified condition is true.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence to return elements from.</param>
- /// <param name="predicate">A function to test each element for a condition.</param>
- /// <returns>An observable sequence that contains the elements from the input sequence that occur before the element at which the test no longer passes.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="predicate"/> is null.</exception>
- public static IObservable<TSource> TakeWhile<TSource>(this IObservable<TSource> source, Func<TSource, bool> predicate)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (predicate == null)
- throw new ArgumentNullException("predicate");
-
- return s_impl.TakeWhile<TSource>(source, predicate);
- }
-
- /// <summary>
- /// Returns elements from an observable sequence as long as a specified condition is true.
- /// The element's index is used in the logic of the predicate function.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence to return elements from.</param>
- /// <param name="predicate">A function to test each element for a condition; the second parameter of the function represents the index of the source element.</param>
- /// <returns>An observable sequence that contains the elements from the input sequence that occur before the element at which the test no longer passes.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="predicate"/> is null.</exception>
- public static IObservable<TSource> TakeWhile<TSource>(this IObservable<TSource> source, Func<TSource, int, bool> predicate)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (predicate == null)
- throw new ArgumentNullException("predicate");
-
- return s_impl.TakeWhile<TSource>(source, predicate);
- }
-
- #endregion
-
- #region + Where +
-
- /// <summary>
- /// Filters the elements of an observable sequence based on a predicate.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">An observable sequence whose elements to filter.</param>
- /// <param name="predicate">A function to test each source element for a condition.</param>
- /// <returns>An observable sequence that contains elements from the input sequence that satisfy the condition.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="predicate"/> is null.</exception>
- public static IObservable<TSource> Where<TSource>(this IObservable<TSource> source, Func<TSource, bool> predicate)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (predicate == null)
- throw new ArgumentNullException("predicate");
-
- return s_impl.Where<TSource>(source, predicate);
- }
-
- /// <summary>
- /// Filters the elements of an observable sequence based on a predicate by incorporating the element's index.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">An observable sequence whose elements to filter.</param>
- /// <param name="predicate">A function to test each source element for a conditio; the second parameter of the function represents the index of the source element.</param>
- /// <returns>An observable sequence that contains elements from the input sequence that satisfy the condition.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="predicate"/> is null.</exception>
- public static IObservable<TSource> Where<TSource>(this IObservable<TSource> source, Func<TSource, int, bool> predicate)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (predicate == null)
- throw new ArgumentNullException("predicate");
-
- return s_impl.Where<TSource>(source, predicate);
- }
-
- #endregion
- }
-}
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observable.Time.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observable.Time.cs
deleted file mode 100644
index 3736416..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observable.Time.cs
+++ /dev/null
@@ -1,1985 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System.Collections.Generic;
-using System.Reactive.Concurrency;
-
-namespace System.Reactive.Linq
-{
- public static partial class Observable
- {
- #region + Buffer +
-
- #region TimeSpan only
-
- /// <summary>
- /// Projects each element of an observable sequence into consecutive non-overlapping buffers which are produced based on timing information.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence, and in the lists in the result sequence.</typeparam>
- /// <param name="source">Source sequence to produce buffers over.</param>
- /// <param name="timeSpan">Length of each buffer.</param>
- /// <returns>An observable sequence of buffers.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <exception cref="ArgumentOutOfRangeException"><paramref name="timeSpan"/> is less than TimeSpan.Zero.</exception>
- /// <remarks>
- /// Specifying a TimeSpan.Zero value for <paramref name="timeSpan"/> is not recommended but supported, causing the scheduler to create buffers as fast as it can.
- /// Because all source sequence elements end up in one of the buffers, some buffers won't have a zero time span. This is a side-effect of the asynchrony introduced
- /// by the scheduler, where the action to close the current buffer and to create a new buffer may not execute immediately, despite the TimeSpan.Zero due time.
- /// </remarks>
- public static IObservable<IList<TSource>> Buffer<TSource>(this IObservable<TSource> source, TimeSpan timeSpan)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (timeSpan < TimeSpan.Zero)
- throw new ArgumentOutOfRangeException("timeSpan");
-
- return s_impl.Buffer<TSource>(source, timeSpan);
- }
-
- /// <summary>
- /// Projects each element of an observable sequence into consecutive non-overlapping buffers which are produced based on timing information, using the specified scheduler to run timers.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence, and in the lists in the result sequence.</typeparam>
- /// <param name="source">Source sequence to produce buffers over.</param>
- /// <param name="timeSpan">Length of each buffer.</param>
- /// <param name="scheduler">Scheduler to run buffering timers on.</param>
- /// <returns>An observable sequence of buffers.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="scheduler"/> is null.</exception>
- /// <exception cref="ArgumentOutOfRangeException"><paramref name="timeSpan"/> is less than TimeSpan.Zero.</exception>
- /// <remarks>
- /// Specifying a TimeSpan.Zero value for <paramref name="timeSpan"/> is not recommended but supported, causing the scheduler to create buffers as fast as it can.
- /// Because all source sequence elements end up in one of the buffers, some buffers won't have a zero time span. This is a side-effect of the asynchrony introduced
- /// by the scheduler, where the action to close the current buffer and to create a new buffer may not execute immediately, despite the TimeSpan.Zero due time.
- /// </remarks>
- public static IObservable<IList<TSource>> Buffer<TSource>(this IObservable<TSource> source, TimeSpan timeSpan, IScheduler scheduler)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (timeSpan < TimeSpan.Zero)
- throw new ArgumentOutOfRangeException("timeSpan");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return s_impl.Buffer<TSource>(source, timeSpan, scheduler);
- }
-
- /// <summary>
- /// Projects each element of an observable sequence into zero or more buffers which are produced based on timing information.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence, and in the lists in the result sequence.</typeparam>
- /// <param name="source">Source sequence to produce buffers over.</param>
- /// <param name="timeSpan">Length of each buffer.</param>
- /// <param name="timeShift">Interval between creation of consecutive buffers.</param>
- /// <returns>An observable sequence of buffers.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <exception cref="ArgumentOutOfRangeException"><paramref name="timeSpan"/> or <paramref name="timeSpan"/> is less than TimeSpan.Zero.</exception>
- /// <remarks>
- /// <para>
- /// Specifying a TimeSpan.Zero value for <paramref name="timeSpan"/> is not recommended but supported, causing the scheduler to create buffers with minimum duration
- /// length. However, some buffers won't have a zero time span. This is a side-effect of the asynchrony introduced by the scheduler, where the action to close the
- /// current buffer may not execute immediately, despite the TimeSpan.Zero due time.
- /// </para>
- /// <para>
- /// Specifying a TimeSpan.Zero value for <paramref name="timeShift"/> is not recommended but supported, causing the scheduler to create buffers as fast as it can.
- /// However, this doesn't mean all buffers will start at the beginning of the source sequence. This is a side-effect of the asynchrony introduced by the scheduler,
- /// where the action to create a new buffer may not execute immediately, despite the TimeSpan.Zero due time.
- /// </para>
- /// </remarks>
- public static IObservable<IList<TSource>> Buffer<TSource>(this IObservable<TSource> source, TimeSpan timeSpan, TimeSpan timeShift)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (timeSpan < TimeSpan.Zero)
- throw new ArgumentOutOfRangeException("timeSpan");
- if (timeShift < TimeSpan.Zero)
- throw new ArgumentOutOfRangeException("timeShift");
-
- return s_impl.Buffer<TSource>(source, timeSpan, timeShift);
- }
-
- /// <summary>
- /// Projects each element of an observable sequence into zero or more buffers which are produced based on timing information, using the specified scheduler to run timers.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence, and in the lists in the result sequence.</typeparam>
- /// <param name="source">Source sequence to produce buffers over.</param>
- /// <param name="timeSpan">Length of each buffer.</param>
- /// <param name="timeShift">Interval between creation of consecutive buffers.</param>
- /// <param name="scheduler">Scheduler to run buffering timers on.</param>
- /// <returns>An observable sequence of buffers.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="scheduler"/> is null.</exception>
- /// <exception cref="ArgumentOutOfRangeException"><paramref name="timeSpan"/> or <paramref name="timeSpan"/> is less than TimeSpan.Zero.</exception>
- /// <remarks>
- /// <para>
- /// Specifying a TimeSpan.Zero value for <paramref name="timeSpan"/> is not recommended but supported, causing the scheduler to create buffers with minimum duration
- /// length. However, some buffers won't have a zero time span. This is a side-effect of the asynchrony introduced by the scheduler, where the action to close the
- /// current buffer may not execute immediately, despite the TimeSpan.Zero due time.
- /// </para>
- /// <para>
- /// Specifying a TimeSpan.Zero value for <paramref name="timeShift"/> is not recommended but supported, causing the scheduler to create buffers as fast as it can.
- /// However, this doesn't mean all buffers will start at the beginning of the source sequence. This is a side-effect of the asynchrony introduced by the scheduler,
- /// where the action to create a new buffer may not execute immediately, despite the TimeSpan.Zero due time.
- /// </para>
- /// </remarks>
- public static IObservable<IList<TSource>> Buffer<TSource>(this IObservable<TSource> source, TimeSpan timeSpan, TimeSpan timeShift, IScheduler scheduler)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (timeSpan < TimeSpan.Zero)
- throw new ArgumentOutOfRangeException("timeSpan");
- if (timeShift < TimeSpan.Zero)
- throw new ArgumentOutOfRangeException("timeShift");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return s_impl.Buffer<TSource>(source, timeSpan, timeShift, scheduler);
- }
-
- #endregion
-
- #region TimeSpan + int
-
- /// <summary>
- /// Projects each element of an observable sequence into a buffer that's sent out when either it's full or a given amount of time has elapsed.
- /// A useful real-world analogy of this overload is the behavior of a ferry leaving the dock when all seats are taken, or at the scheduled time of departure, whichever event occurs first.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence, and in the lists in the result sequence.</typeparam>
- /// <param name="source">Source sequence to produce buffers over.</param>
- /// <param name="timeSpan">Maximum time length of a window.</param>
- /// <param name="count">Maximum element count of a window.</param>
- /// <returns>An observable sequence of buffers.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <exception cref="ArgumentOutOfRangeException"><paramref name="timeSpan"/> is less than TimeSpan.Zero. -or- <paramref name="count"/> is less than or equal to zero.</exception>
- /// <remarks>
- /// Specifying a TimeSpan.Zero value for <paramref name="timeSpan"/> is not recommended but supported, causing the scheduler to create buffers as fast as it can.
- /// Because all source sequence elements end up in one of the buffers, some buffers won't have a zero time span. This is a side-effect of the asynchrony introduced
- /// by the scheduler, where the action to close the current buffer and to create a new buffer may not execute immediately, despite the TimeSpan.Zero due time.
- /// </remarks>
- public static IObservable<IList<TSource>> Buffer<TSource>(this IObservable<TSource> source, TimeSpan timeSpan, int count)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (timeSpan < TimeSpan.Zero)
- throw new ArgumentOutOfRangeException("timeSpan");
- if (count <= 0)
- throw new ArgumentOutOfRangeException("count");
-
- return s_impl.Buffer<TSource>(source, timeSpan, count);
- }
-
- /// <summary>
- /// Projects each element of an observable sequence into a buffer that's sent out when either it's full or a given amount of time has elapsed, using the specified scheduler to run timers.
- /// A useful real-world analogy of this overload is the behavior of a ferry leaving the dock when all seats are taken, or at the scheduled time of departure, whichever event occurs first.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence, and in the lists in the result sequence.</typeparam>
- /// <param name="source">Source sequence to produce buffers over.</param>
- /// <param name="timeSpan">Maximum time length of a buffer.</param>
- /// <param name="count">Maximum element count of a buffer.</param>
- /// <param name="scheduler">Scheduler to run buffering timers on.</param>
- /// <returns>An observable sequence of buffers.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="scheduler"/> is null.</exception>
- /// <exception cref="ArgumentOutOfRangeException"><paramref name="timeSpan"/> is less than TimeSpan.Zero. -or- <paramref name="count"/> is less than or equal to zero.</exception>
- /// <remarks>
- /// Specifying a TimeSpan.Zero value for <paramref name="timeSpan"/> is not recommended but supported, causing the scheduler to create buffers as fast as it can.
- /// Because all source sequence elements end up in one of the buffers, some buffers won't have a zero time span. This is a side-effect of the asynchrony introduced
- /// by the scheduler, where the action to close the current buffer and to create a new buffer may not execute immediately, despite the TimeSpan.Zero due time.
- /// </remarks>
- public static IObservable<IList<TSource>> Buffer<TSource>(this IObservable<TSource> source, TimeSpan timeSpan, int count, IScheduler scheduler)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (timeSpan < TimeSpan.Zero)
- throw new ArgumentOutOfRangeException("timeSpan");
- if (count <= 0)
- throw new ArgumentOutOfRangeException("count");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return s_impl.Buffer<TSource>(source, timeSpan, count, scheduler);
- }
-
- #endregion
-
- #endregion
-
- #region + Delay +
-
- #region TimeSpan
-
- /// <summary>
- /// Time shifts the observable sequence by the specified relative time duration.
- /// The relative time intervals between the values are preserved.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence to delay values for.</param>
- /// <param name="dueTime">Relative time by which to shift the observable sequence. If this value is equal to TimeSpan.Zero, the scheduler will dispatch observer callbacks as soon as possible.</param>
- /// <returns>Time-shifted sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <exception cref="ArgumentOutOfRangeException"><paramref name="dueTime"/> is less than TimeSpan.Zero.</exception>
- /// <remarks>
- /// <para>
- /// This operator is less efficient than <see cref="Observable.DelaySubscription{T}(IObservable{T}, TimeSpan)">DelaySubscription</see> because it records all notifications and time-delays those. This allows for immediate propagation of errors.
- /// </para>
- /// <para>
- /// Observer callbacks for the resulting sequence will be run on the default scheduler. This effect is similar to using ObserveOn.
- /// </para>
- /// <para>
- /// Exceptions signaled by the source sequence through an OnError callback are forwarded immediately to the result sequence. Any OnNext notifications that were in the queue at the point of the OnError callback will be dropped.
- /// In order to delay error propagation, consider using the <see cref="Observable.Materialize">Observable.Materialize</see> and <see cref="Observable.Dematerialize">Observable.Dematerialize</see> operators, or use <see cref="Observable.DelaySubscription{T}(IObservable{T}, TimeSpan)">DelaySubscription</see>.
- /// </para>
- /// </remarks>
- public static IObservable<TSource> Delay<TSource>(this IObservable<TSource> source, TimeSpan dueTime)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (dueTime < TimeSpan.Zero)
- throw new ArgumentOutOfRangeException("dueTime");
-
- return s_impl.Delay<TSource>(source, dueTime);
- }
-
- /// <summary>
- /// Time shifts the observable sequence by the specified relative time duration, using the specified scheduler to run timers.
- /// The relative time intervals between the values are preserved.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence to delay values for.</param>
- /// <param name="dueTime">Relative time by which to shift the observable sequence. If this value is equal to TimeSpan.Zero, the scheduler will dispatch observer callbacks as soon as possible.</param>
- /// <param name="scheduler">Scheduler to run the delay timers on.</param>
- /// <returns>Time-shifted sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="scheduler"/> is null.</exception>
- /// <exception cref="ArgumentOutOfRangeException"><paramref name="dueTime"/> is less than TimeSpan.Zero.</exception>
- /// <remarks>
- /// <para>
- /// This operator is less efficient than <see cref="Observable.DelaySubscription{T}(IObservable{T}, TimeSpan, IScheduler)">DelaySubscription</see> because it records all notifications and time-delays those. This allows for immediate propagation of errors.
- /// </para>
- /// <para>
- /// Observer callbacks for the resulting sequence will be run on the specified scheduler. This effect is similar to using ObserveOn.
- /// </para>
- /// <para>
- /// Exceptions signaled by the source sequence through an OnError callback are forwarded immediately to the result sequence. Any OnNext notifications that were in the queue at the point of the OnError callback will be dropped.
- /// </para>
- /// <para>
- /// Exceptions signaled by the source sequence through an OnError callback are forwarded immediately to the result sequence. Any OnNext notifications that were in the queue at the point of the OnError callback will be dropped.
- /// In order to delay error propagation, consider using the <see cref="Observable.Materialize">Observable.Materialize</see> and <see cref="Observable.Dematerialize">Observable.Dematerialize</see> operators, or use <see cref="Observable.DelaySubscription{T}(IObservable{T}, TimeSpan, IScheduler)">DelaySubscription</see>.
- /// </para>
- /// </remarks>
- public static IObservable<TSource> Delay<TSource>(this IObservable<TSource> source, TimeSpan dueTime, IScheduler scheduler)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (dueTime < TimeSpan.Zero)
- throw new ArgumentOutOfRangeException("dueTime");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return s_impl.Delay<TSource>(source, dueTime, scheduler);
- }
-
- #endregion
-
- #region DateTimeOffset
-
- /// <summary>
- /// Time shifts the observable sequence to start propagating notifications at the specified absolute time.
- /// The relative time intervals between the values are preserved.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence to delay values for.</param>
- /// <param name="dueTime">Absolute time used to shift the observable sequence; the relative time shift gets computed upon subscription. If this value is less than or equal to DateTimeOffset.UtcNow, the scheduler will dispatch observer callbacks as soon as possible.</param>
- /// <returns>Time-shifted sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <remarks>
- /// <para>
- /// This operator is less efficient than <see cref="Observable.DelaySubscription{T}(IObservable{T}, DateTimeOffset)">DelaySubscription</see> because it records all notifications and time-delays those. This allows for immediate propagation of errors.
- /// </para>
- /// <para>
- /// Observer callbacks for the resulting sequence will be run on the default scheduler. This effect is similar to using ObserveOn.
- /// </para>
- /// <para>
- /// Exceptions signaled by the source sequence through an OnError callback are forwarded immediately to the result sequence. Any OnNext notifications that were in the queue at the point of the OnError callback will be dropped.
- /// In order to delay error propagation, consider using the <see cref="Observable.Materialize">Observable.Materialize</see> and <see cref="Observable.Dematerialize">Observable.Dematerialize</see> operators, or use <see cref="Observable.DelaySubscription{T}(IObservable{T}, DateTimeOffset)">DelaySubscription</see>.
- /// </para>
- /// </remarks>
- public static IObservable<TSource> Delay<TSource>(this IObservable<TSource> source, DateTimeOffset dueTime)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return s_impl.Delay<TSource>(source, dueTime);
- }
-
- /// <summary>
- /// Time shifts the observable sequence to start propagating notifications at the specified absolute time, using the specified scheduler to run timers.
- /// The relative time intervals between the values are preserved.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence to delay values for.</param>
- /// <param name="dueTime">Absolute time used to shift the observable sequence; the relative time shift gets computed upon subscription. If this value is less than or equal to DateTimeOffset.UtcNow, the scheduler will dispatch observer callbacks as soon as possible.</param>
- /// <param name="scheduler">Scheduler to run the delay timers on.</param>
- /// <returns>Time-shifted sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="scheduler"/> is null.</exception>
- /// <remarks>
- /// <para>
- /// This operator is less efficient than <see cref="Observable.DelaySubscription{T}(IObservable{T}, DateTimeOffset, IScheduler)">DelaySubscription</see> because it records all notifications and time-delays those. This allows for immediate propagation of errors.
- /// </para>
- /// <para>
- /// Observer callbacks for the resulting sequence will be run on the specified scheduler. This effect is similar to using ObserveOn.
- /// </para>
- /// <para>
- /// Exceptions signaled by the source sequence through an OnError callback are forwarded immediately to the result sequence. Any OnNext notifications that were in the queue at the point of the OnError callback will be dropped.
- /// In order to delay error propagation, consider using the <see cref="Observable.Materialize">Observable.Materialize</see> and <see cref="Observable.Dematerialize">Observable.Dematerialize</see> operators, or use <see cref="Observable.DelaySubscription{T}(IObservable{T}, DateTimeOffset, IScheduler)">DelaySubscription</see>.
- /// </para>
- /// </remarks>
- public static IObservable<TSource> Delay<TSource>(this IObservable<TSource> source, DateTimeOffset dueTime, IScheduler scheduler)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return s_impl.Delay<TSource>(source, dueTime, scheduler);
- }
-
- #endregion
-
- #region Duration selector
-
- /// <summary>
- /// Time shifts the observable sequence based on a delay selector function for each element.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TDelay">The type of the elements in the delay sequences used to denote the delay duration of each element in the source sequence.</typeparam>
- /// <param name="source">Source sequence to delay values for.</param>
- /// <param name="delayDurationSelector">Selector function to retrieve a sequence indicating the delay for each given element.</param>
- /// <returns>Time-shifted sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="delayDurationSelector"/> is null.</exception>
- public static IObservable<TSource> Delay<TSource, TDelay>(this IObservable<TSource> source, Func<TSource, IObservable<TDelay>> delayDurationSelector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (delayDurationSelector == null)
- throw new ArgumentNullException("delayDurationSelector");
-
- return s_impl.Delay<TSource, TDelay>(source, delayDurationSelector);
- }
-
- /// <summary>
- /// Time shifts the observable sequence based on a subscription delay and a delay selector function for each element.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TDelay">The type of the elements in the delay sequences used to denote the delay duration of each element in the source sequence.</typeparam>
- /// <param name="source">Source sequence to delay values for.</param>
- /// <param name="subscriptionDelay">Sequence indicating the delay for the subscription to the source.</param>
- /// <param name="delayDurationSelector">Selector function to retrieve a sequence indicating the delay for each given element.</param>
- /// <returns>Time-shifted sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="subscriptionDelay"/> or <paramref name="delayDurationSelector"/> is null.</exception>
- public static IObservable<TSource> Delay<TSource, TDelay>(this IObservable<TSource> source, IObservable<TDelay> subscriptionDelay, Func<TSource, IObservable<TDelay>> delayDurationSelector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (subscriptionDelay == null)
- throw new ArgumentNullException("subscriptionDelay");
- if (delayDurationSelector == null)
- throw new ArgumentNullException("delayDurationSelector");
-
- return s_impl.Delay<TSource, TDelay>(source, subscriptionDelay, delayDurationSelector);
- }
-
- #endregion
-
- #endregion
-
- #region + DelaySubscription +
-
- /// <summary>
- /// Time shifts the observable sequence by delaying the subscription with the specified relative time duration.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence to delay subscription for.</param>
- /// <param name="dueTime">Relative time shift of the subscription.</param>
- /// <returns>Time-shifted sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <exception cref="ArgumentOutOfRangeException"><paramref name="dueTime"/> is less than TimeSpan.Zero.</exception>
- /// <remarks>
- /// <para>
- /// This operator is more efficient than <see cref="Observable.Delay{T}(IObservable{T}, TimeSpan)">Delay</see> but postpones all side-effects of subscription and affects error propagation timing.
- /// </para>
- /// <para>
- /// The side-effects of subscribing to the source sequence will be run on the default scheduler. Observer callbacks will not be affected.
- /// </para>
- /// </remarks>
- public static IObservable<TSource> DelaySubscription<TSource>(this IObservable<TSource> source, TimeSpan dueTime)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (dueTime < TimeSpan.Zero)
- throw new ArgumentOutOfRangeException("dueTime");
-
- return s_impl.DelaySubscription<TSource>(source, dueTime);
- }
-
- /// <summary>
- /// Time shifts the observable sequence by delaying the subscription with the specified relative time duration, using the specified scheduler to run timers.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence to delay subscription for.</param>
- /// <param name="dueTime">Relative time shift of the subscription.</param>
- /// <param name="scheduler">Scheduler to run the subscription delay timer on.</param>
- /// <returns>Time-shifted sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="scheduler"/> is null.</exception>
- /// <exception cref="ArgumentOutOfRangeException"><paramref name="dueTime"/> is less than TimeSpan.Zero.</exception>
- /// <remarks>
- /// <para>
- /// This operator is more efficient than <see cref="Observable.Delay{T}(IObservable{T}, TimeSpan, IScheduler)">Delay</see> but postpones all side-effects of subscription and affects error propagation timing.
- /// </para>
- /// <para>
- /// The side-effects of subscribing to the source sequence will be run on the specified scheduler. Observer callbacks will not be affected.
- /// </para>
- /// </remarks>
- public static IObservable<TSource> DelaySubscription<TSource>(this IObservable<TSource> source, TimeSpan dueTime, IScheduler scheduler)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (dueTime < TimeSpan.Zero)
- throw new ArgumentOutOfRangeException("dueTime");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return s_impl.DelaySubscription<TSource>(source, dueTime, scheduler);
- }
-
- /// <summary>
- /// Time shifts the observable sequence by delaying the subscription to the specified absolute time.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence to delay subscription for.</param>
- /// <param name="dueTime">Absolute time to perform the subscription at.</param>
- /// <returns>Time-shifted sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <remarks>
- /// <para>
- /// This operator is more efficient than <see cref="Observable.Delay{T}(IObservable{T}, DateTimeOffset)">Delay</see> but postpones all side-effects of subscription and affects error propagation timing.
- /// </para>
- /// <para>
- /// The side-effects of subscribing to the source sequence will be run on the default scheduler. Observer callbacks will not be affected.
- /// </para>
- /// </remarks>
- public static IObservable<TSource> DelaySubscription<TSource>(this IObservable<TSource> source, DateTimeOffset dueTime)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return s_impl.DelaySubscription<TSource>(source, dueTime);
- }
-
- /// <summary>
- /// Time shifts the observable sequence by delaying the subscription to the specified absolute time, using the specified scheduler to run timers.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence to delay subscription for.</param>
- /// <param name="dueTime">Absolute time to perform the subscription at.</param>
- /// <param name="scheduler">Scheduler to run the subscription delay timer on.</param>
- /// <returns>Time-shifted sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="scheduler"/> is null.</exception>
- /// <remarks>
- /// <para>
- /// This operator is more efficient than <see cref="Observable.Delay{T}(IObservable{T}, DateTimeOffset, IScheduler)">Delay</see> but postpones all side-effects of subscription and affects error propagation timing.
- /// </para>
- /// <para>
- /// The side-effects of subscribing to the source sequence will be run on the specified scheduler. Observer callbacks will not be affected.
- /// </para>
- /// </remarks>
- public static IObservable<TSource> DelaySubscription<TSource>(this IObservable<TSource> source, DateTimeOffset dueTime, IScheduler scheduler)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return s_impl.DelaySubscription<TSource>(source, dueTime, scheduler);
- }
-
- #endregion
-
- #region + Generate +
-
- /// <summary>
- /// Generates an observable sequence by running a state-driven and temporal loop producing the sequence's elements.
- /// </summary>
- /// <typeparam name="TState">The type of the state used in the generator loop.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the produced sequence.</typeparam>
- /// <param name="initialState">Initial state.</param>
- /// <param name="condition">Condition to terminate generation (upon returning false).</param>
- /// <param name="iterate">Iteration step function.</param>
- /// <param name="resultSelector">Selector function for results produced in the sequence.</param>
- /// <param name="timeSelector">Time selector function to control the speed of values being produced each iteration.</param>
- /// <returns>The generated sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="condition"/> or <paramref name="iterate"/> or <paramref name="resultSelector"/> or <paramref name="timeSelector"/> is null.</exception>
- public static IObservable<TResult> Generate<TState, TResult>(TState initialState, Func<TState, bool> condition, Func<TState, TState> iterate, Func<TState, TResult> resultSelector, Func<TState, TimeSpan> timeSelector)
- {
- if (condition == null)
- throw new ArgumentNullException("condition");
- if (iterate == null)
- throw new ArgumentNullException("iterate");
- if (resultSelector == null)
- throw new ArgumentNullException("resultSelector");
- if (timeSelector == null)
- throw new ArgumentNullException("timeSelector");
-
- return s_impl.Generate<TState, TResult>(initialState, condition, iterate, resultSelector, timeSelector);
- }
-
- /// <summary>
- /// Generates an observable sequence by running a state-driven and temporal loop producing the sequence's elements, using the specified scheduler to run timers and to send out observer messages.
- /// </summary>
- /// <typeparam name="TState">The type of the state used in the generator loop.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the produced sequence.</typeparam>
- /// <param name="initialState">Initial state.</param>
- /// <param name="condition">Condition to terminate generation (upon returning false).</param>
- /// <param name="iterate">Iteration step function.</param>
- /// <param name="resultSelector">Selector function for results produced in the sequence.</param>
- /// <param name="timeSelector">Time selector function to control the speed of values being produced each iteration.</param>
- /// <param name="scheduler">Scheduler on which to run the generator loop.</param>
- /// <returns>The generated sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="condition"/> or <paramref name="iterate"/> or <paramref name="resultSelector"/> or <paramref name="timeSelector"/> or <paramref name="scheduler"/> is null.</exception>
- public static IObservable<TResult> Generate<TState, TResult>(TState initialState, Func<TState, bool> condition, Func<TState, TState> iterate, Func<TState, TResult> resultSelector, Func<TState, TimeSpan> timeSelector, IScheduler scheduler)
- {
- if (condition == null)
- throw new ArgumentNullException("condition");
- if (iterate == null)
- throw new ArgumentNullException("iterate");
- if (resultSelector == null)
- throw new ArgumentNullException("resultSelector");
- if (timeSelector == null)
- throw new ArgumentNullException("timeSelector");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return s_impl.Generate<TState, TResult>(initialState, condition, iterate, resultSelector, timeSelector, scheduler);
- }
-
- /// <summary>
- /// Generates an observable sequence by running a state-driven and temporal loop producing the sequence's elements.
- /// </summary>
- /// <typeparam name="TState">The type of the state used in the generator loop.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the produced sequence.</typeparam>
- /// <param name="initialState">Initial state.</param>
- /// <param name="condition">Condition to terminate generation (upon returning false).</param>
- /// <param name="iterate">Iteration step function.</param>
- /// <param name="resultSelector">Selector function for results produced in the sequence.</param>
- /// <param name="timeSelector">Time selector function to control the speed of values being produced each iteration.</param>
- /// <returns>The generated sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="condition"/> or <paramref name="iterate"/> or <paramref name="resultSelector"/> or <paramref name="timeSelector"/> is null.</exception>
- public static IObservable<TResult> Generate<TState, TResult>(TState initialState, Func<TState, bool> condition, Func<TState, TState> iterate, Func<TState, TResult> resultSelector, Func<TState, DateTimeOffset> timeSelector)
- {
- if (condition == null)
- throw new ArgumentNullException("condition");
- if (iterate == null)
- throw new ArgumentNullException("iterate");
- if (resultSelector == null)
- throw new ArgumentNullException("resultSelector");
- if (timeSelector == null)
- throw new ArgumentNullException("timeSelector");
-
- return s_impl.Generate<TState, TResult>(initialState, condition, iterate, resultSelector, timeSelector);
- }
-
- /// <summary>
- /// Generates an observable sequence by running a state-driven and temporal loop producing the sequence's elements, using the specified scheduler to run timers and to send out observer messages.
- /// </summary>
- /// <typeparam name="TState">The type of the state used in the generator loop.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the produced sequence.</typeparam>
- /// <param name="initialState">Initial state.</param>
- /// <param name="condition">Condition to terminate generation (upon returning false).</param>
- /// <param name="iterate">Iteration step function.</param>
- /// <param name="resultSelector">Selector function for results produced in the sequence.</param>
- /// <param name="timeSelector">Time selector function to control the speed of values being produced each iteration.</param>
- /// <param name="scheduler">Scheduler on which to run the generator loop.</param>
- /// <returns>The generated sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="condition"/> or <paramref name="iterate"/> or <paramref name="resultSelector"/> or <paramref name="timeSelector"/> or <paramref name="scheduler"/> is null.</exception>
- public static IObservable<TResult> Generate<TState, TResult>(TState initialState, Func<TState, bool> condition, Func<TState, TState> iterate, Func<TState, TResult> resultSelector, Func<TState, DateTimeOffset> timeSelector, IScheduler scheduler)
- {
- if (condition == null)
- throw new ArgumentNullException("condition");
- if (iterate == null)
- throw new ArgumentNullException("iterate");
- if (resultSelector == null)
- throw new ArgumentNullException("resultSelector");
- if (timeSelector == null)
- throw new ArgumentNullException("timeSelector");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return s_impl.Generate<TState, TResult>(initialState, condition, iterate, resultSelector, timeSelector, scheduler);
- }
-
- #endregion
-
- #region + Interval +
-
- /// <summary>
- /// Returns an observable sequence that produces a value after each period.
- /// </summary>
- /// <param name="period">Period for producing the values in the resulting sequence. If this value is equal to TimeSpan.Zero, the timer will recur as fast as possible.</param>
- /// <returns>An observable sequence that produces a value after each period.</returns>
- /// <exception cref="ArgumentOutOfRangeException"><paramref name="period"/> is less than TimeSpan.Zero.</exception>
- /// <remarks>
- /// Intervals are measured between the start of subsequent notifications, not between the end of the previous and the start of the next notification.
- /// If the observer takes longer than the interval period to handle the message, the subsequent notification will be delivered immediately after the
- /// current one has been handled. In case you need to control the time between the end and the start of consecutive notifications, consider using the
- /// <see cref="Observable.Generate{TState, TResult}(TState, Func{TState, bool}, Func{TState, TState}, Func{TState, TResult}, Func{TState, TimeSpan})"/>
- /// operator instead.
- /// </remarks>
- public static IObservable<long> Interval(TimeSpan period)
- {
- if (period < TimeSpan.Zero)
- throw new ArgumentOutOfRangeException("period");
-
- return s_impl.Interval(period);
- }
-
- /// <summary>
- /// Returns an observable sequence that produces a value after each period, using the specified scheduler to run timers and to send out observer messages.
- /// </summary>
- /// <param name="period">Period for producing the values in the resulting sequence. If this value is equal to TimeSpan.Zero, the timer will recur as fast as possible.</param>
- /// <param name="scheduler">Scheduler to run the timer on.</param>
- /// <returns>An observable sequence that produces a value after each period.</returns>
- /// <exception cref="ArgumentOutOfRangeException"><paramref name="period"/> is less than TimeSpan.Zero.</exception>
- /// <exception cref="ArgumentNullException"><paramref name="scheduler"/> is null.</exception>
- /// <remarks>
- /// Intervals are measured between the start of subsequent notifications, not between the end of the previous and the start of the next notification.
- /// If the observer takes longer than the interval period to handle the message, the subsequent notification will be delivered immediately after the
- /// current one has been handled. In case you need to control the time between the end and the start of consecutive notifications, consider using the
- /// <see cref="Observable.Generate{TState, TResult}(TState, Func{TState, bool}, Func{TState, TState}, Func{TState, TResult}, Func{TState, TimeSpan}, IScheduler)"/>
- /// operator instead.
- /// </remarks>
- public static IObservable<long> Interval(TimeSpan period, IScheduler scheduler)
- {
- if (period < TimeSpan.Zero)
- throw new ArgumentOutOfRangeException("period");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return s_impl.Interval(period, scheduler);
- }
-
- #endregion
-
- #region + Sample +
-
- /// <summary>
- /// Samples the observable sequence at each interval.
- /// Upon each sampling tick, the latest element (if any) in the source sequence during the last sampling interval is sent to the resulting sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence to sample.</param>
- /// <param name="interval">Interval at which to sample. If this value is equal to TimeSpan.Zero, the scheduler will continuously sample the stream.</param>
- /// <returns>Sampled observable sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <exception cref="ArgumentOutOfRangeException"><paramref name="interval"/> is less than TimeSpan.Zero.</exception>
- /// <remarks>
- /// Specifying a TimeSpan.Zero value for <paramref name="interval"/> doesn't guarantee all source sequence elements will be preserved. This is a side-effect
- /// of the asynchrony introduced by the scheduler, where the sampling action may not execute immediately, despite the TimeSpan.Zero due time.
- /// </remarks>
- public static IObservable<TSource> Sample<TSource>(this IObservable<TSource> source, TimeSpan interval)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (interval < TimeSpan.Zero)
- throw new ArgumentOutOfRangeException("interval");
-
- return s_impl.Sample<TSource>(source, interval);
- }
-
- /// <summary>
- /// Samples the observable sequence at each interval, using the specified scheduler to run sampling timers.
- /// Upon each sampling tick, the latest element (if any) in the source sequence during the last sampling interval is sent to the resulting sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence to sample.</param>
- /// <param name="interval">Interval at which to sample. If this value is equal to TimeSpan.Zero, the scheduler will continuously sample the stream.</param>
- /// <param name="scheduler">Scheduler to run the sampling timer on.</param>
- /// <returns>Sampled observable sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="scheduler"/> is null.</exception>
- /// <exception cref="ArgumentOutOfRangeException"><paramref name="interval"/> is less than TimeSpan.Zero.</exception>
- /// <remarks>
- /// Specifying a TimeSpan.Zero value for <paramref name="interval"/> doesn't guarantee all source sequence elements will be preserved. This is a side-effect
- /// of the asynchrony introduced by the scheduler, where the sampling action may not execute immediately, despite the TimeSpan.Zero due time.
- /// </remarks>
- public static IObservable<TSource> Sample<TSource>(this IObservable<TSource> source, TimeSpan interval, IScheduler scheduler)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (interval < TimeSpan.Zero)
- throw new ArgumentOutOfRangeException("interval");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return s_impl.Sample<TSource>(source, interval, scheduler);
- }
-
- /// <summary>
- /// Samples the source observable sequence using a samper observable sequence producing sampling ticks.
- /// Upon each sampling tick, the latest element (if any) in the source sequence during the last sampling interval is sent to the resulting sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TSample">The type of the elements in the sampling sequence.</typeparam>
- /// <param name="source">Source sequence to sample.</param>
- /// <param name="sampler">Sampling tick sequence.</param>
- /// <returns>Sampled observable sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="sampler"/> is null.</exception>
- public static IObservable<TSource> Sample<TSource, TSample>(this IObservable<TSource> source, IObservable<TSample> sampler)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (sampler == null)
- throw new ArgumentNullException("sampler");
-
- return s_impl.Sample<TSource, TSample>(source, sampler);
- }
-
- #endregion
-
- #region + Skip +
-
- /// <summary>
- /// Skips elements for the specified duration from the start of the observable source sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence to skip elements for.</param>
- /// <param name="duration">Duration for skipping elements from the start of the sequence.</param>
- /// <returns>An observable sequence with the elements skipped during the specified duration from the start of the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <exception cref="ArgumentOutOfRangeException"><paramref name="duration"/> is less than TimeSpan.Zero.</exception>
- /// <remarks>
- /// <para>
- /// Specifying a TimeSpan.Zero value for <paramref name="duration"/> doesn't guarantee no elements will be dropped from the start of the source sequence.
- /// This is a side-effect of the asynchrony introduced by the scheduler, where the action that causes callbacks from the source sequence to be forwarded
- /// may not execute immediately, despite the TimeSpan.Zero due time.
- /// </para>
- /// <para>
- /// Errors produced by the source sequence are always forwarded to the result sequence, even if the error occurs before the <paramref name="duration"/>.
- /// </para>
- /// </remarks>
- public static IObservable<TSource> Skip<TSource>(this IObservable<TSource> source, TimeSpan duration)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (duration < TimeSpan.Zero)
- throw new ArgumentOutOfRangeException("duration");
-
- return s_impl.Skip<TSource>(source, duration);
- }
-
- /// <summary>
- /// Skips elements for the specified duration from the start of the observable source sequence, using the specified scheduler to run timers.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence to skip elements for.</param>
- /// <param name="duration">Duration for skipping elements from the start of the sequence.</param>
- /// <param name="scheduler">Scheduler to run the timer on.</param>
- /// <returns>An observable sequence with the elements skipped during the specified duration from the start of the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="scheduler"/> is null.</exception>
- /// <exception cref="ArgumentOutOfRangeException"><paramref name="duration"/> is less than TimeSpan.Zero.</exception>
- /// <remarks>
- /// <para>
- /// Specifying a TimeSpan.Zero value for <paramref name="duration"/> doesn't guarantee no elements will be dropped from the start of the source sequence.
- /// This is a side-effect of the asynchrony introduced by the scheduler, where the action that causes callbacks from the source sequence to be forwarded
- /// may not execute immediately, despite the TimeSpan.Zero due time.
- /// </para>
- /// <para>
- /// Errors produced by the source sequence are always forwarded to the result sequence, even if the error occurs before the <paramref name="duration"/>.
- /// </para>
- /// </remarks>
- public static IObservable<TSource> Skip<TSource>(this IObservable<TSource> source, TimeSpan duration, IScheduler scheduler)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (duration < TimeSpan.Zero)
- throw new ArgumentOutOfRangeException("duration");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return s_impl.Skip<TSource>(source, duration, scheduler);
- }
-
- #endregion
-
- #region + SkipLast +
-
- /// <summary>
- /// Skips elements for the specified duration from the end of the observable source sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence to skip elements for.</param>
- /// <param name="duration">Duration for skipping elements from the end of the sequence.</param>
- /// <returns>An observable sequence with the elements skipped during the specified duration from the end of the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <exception cref="ArgumentOutOfRangeException"><paramref name="duration"/> is less than TimeSpan.Zero.</exception>
- /// <remarks>
- /// This operator accumulates a queue with a length enough to store elements received during the initial <paramref name="duration"/> window.
- /// As more elements are received, elements older than the specified <paramref name="duration"/> are taken from the queue and produced on the
- /// result sequence. This causes elements to be delayed with <paramref name="duration"/>.
- /// </remarks>
- public static IObservable<TSource> SkipLast<TSource>(this IObservable<TSource> source, TimeSpan duration)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (duration < TimeSpan.Zero)
- throw new ArgumentOutOfRangeException("duration");
-
- return s_impl.SkipLast<TSource>(source, duration);
- }
-
- /// <summary>
- /// Skips elements for the specified duration from the end of the observable source sequence, using the specified scheduler to run timers.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence to skip elements for.</param>
- /// <param name="duration">Duration for skipping elements from the end of the sequence.</param>
- /// <param name="scheduler">Scheduler to run the timer on.</param>
- /// <returns>An observable sequence with the elements skipped during the specified duration from the end of the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="scheduler"/> is null.</exception>
- /// <exception cref="ArgumentOutOfRangeException"><paramref name="duration"/> is less than TimeSpan.Zero.</exception>
- /// <remarks>
- /// This operator accumulates a queue with a length enough to store elements received during the initial <paramref name="duration"/> window.
- /// As more elements are received, elements older than the specified <paramref name="duration"/> are taken from the queue and produced on the
- /// result sequence. This causes elements to be delayed with <paramref name="duration"/>.
- /// </remarks>
- public static IObservable<TSource> SkipLast<TSource>(this IObservable<TSource> source, TimeSpan duration, IScheduler scheduler)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (duration < TimeSpan.Zero)
- throw new ArgumentOutOfRangeException("duration");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return s_impl.SkipLast<TSource>(source, duration, scheduler);
- }
-
- #endregion
-
- #region + SkipUntil +
-
- /// <summary>
- /// Skips elements from the observable source sequence until the specified start time.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence to skip elements for.</param>
- /// <param name="startTime">Time to start taking elements from the source sequence. If this value is less than or equal to DateTimeOffset.UtcNow, no elements will be skipped.</param>
- /// <returns>An observable sequence with the elements skipped until the specified start time.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <remarks>
- /// Errors produced by the source sequence are always forwarded to the result sequence, even if the error occurs before the <paramref name="startTime"/>.
- /// </remarks>
- public static IObservable<TSource> SkipUntil<TSource>(this IObservable<TSource> source, DateTimeOffset startTime)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return s_impl.SkipUntil<TSource>(source, startTime);
- }
-
- /// <summary>
- /// Skips elements from the observable source sequence until the specified start time, using the specified scheduler to run timers.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence to skip elements for.</param>
- /// <param name="startTime">Time to start taking elements from the source sequence. If this value is less than or equal to DateTimeOffset.UtcNow, no elements will be skipped.</param>
- /// <param name="scheduler">Scheduler to run the timer on.</param>
- /// <returns>An observable sequence with the elements skipped until the specified start time.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="scheduler"/> is null.</exception>
- /// <remarks>
- /// Errors produced by the source sequence are always forwarded to the result sequence, even if the error occurs before the <paramref name="startTime"/>.
- /// </remarks>
- public static IObservable<TSource> SkipUntil<TSource>(this IObservable<TSource> source, DateTimeOffset startTime, IScheduler scheduler)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return s_impl.SkipUntil<TSource>(source, startTime, scheduler);
- }
-
- #endregion
-
- #region + Take +
-
- /// <summary>
- /// Takes elements for the specified duration from the start of the observable source sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence to take elements from.</param>
- /// <param name="duration">Duration for taking elements from the start of the sequence.</param>
- /// <returns>An observable sequence with the elements taken during the specified duration from the start of the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <exception cref="ArgumentOutOfRangeException"><paramref name="duration"/> is less than TimeSpan.Zero.</exception>
- /// <remarks>
- /// Specifying a TimeSpan.Zero value for <paramref name="duration"/> doesn't guarantee an empty sequence will be returned. This is a side-effect
- /// of the asynchrony introduced by the scheduler, where the action that stops forwarding callbacks from the source sequence may not execute
- /// immediately, despite the TimeSpan.Zero due time.
- /// </remarks>
- public static IObservable<TSource> Take<TSource>(this IObservable<TSource> source, TimeSpan duration)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (duration < TimeSpan.Zero)
- throw new ArgumentOutOfRangeException("duration");
-
- return s_impl.Take<TSource>(source, duration);
- }
-
- /// <summary>
- /// Takes elements for the specified duration from the start of the observable source sequence, using the specified scheduler to run timers.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence to take elements from.</param>
- /// <param name="duration">Duration for taking elements from the start of the sequence.</param>
- /// <param name="scheduler">Scheduler to run the timer on.</param>
- /// <returns>An observable sequence with the elements taken during the specified duration from the start of the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="scheduler"/> is null.</exception>
- /// <exception cref="ArgumentOutOfRangeException"><paramref name="duration"/> is less than TimeSpan.Zero.</exception>
- /// <remarks>
- /// Specifying a TimeSpan.Zero value for <paramref name="duration"/> doesn't guarantee an empty sequence will be returned. This is a side-effect
- /// of the asynchrony introduced by the scheduler, where the action that stops forwarding callbacks from the source sequence may not execute
- /// immediately, despite the TimeSpan.Zero due time.
- /// </remarks>
- public static IObservable<TSource> Take<TSource>(this IObservable<TSource> source, TimeSpan duration, IScheduler scheduler)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (duration < TimeSpan.Zero)
- throw new ArgumentOutOfRangeException("duration");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return s_impl.Take<TSource>(source, duration, scheduler);
- }
-
- #endregion
-
- #region + TakeLast +
-
- /// <summary>
- /// Returns elements within the specified duration from the end of the observable source sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence to take elements from.</param>
- /// <param name="duration">Duration for taking elements from the end of the sequence.</param>
- /// <returns>An observable sequence with the elements taken during the specified duration from the end of the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <exception cref="ArgumentOutOfRangeException"><paramref name="duration"/> is less than TimeSpan.Zero.</exception>
- /// <remarks>
- /// This operator accumulates a buffer with a length enough to store elements for any <paramref name="duration"/> window during the lifetime of
- /// the source sequence. Upon completion of the source sequence, this buffer is drained on the result sequence. This causes the result elements
- /// to be delayed with <paramref name="duration"/>.
- /// </remarks>
- public static IObservable<TSource> TakeLast<TSource>(this IObservable<TSource> source, TimeSpan duration)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (duration < TimeSpan.Zero)
- throw new ArgumentOutOfRangeException("duration");
-
- return s_impl.TakeLast<TSource>(source, duration);
- }
-
- /// <summary>
- /// Returns elements within the specified duration from the end of the observable source sequence, using the specified scheduler to run timers.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence to take elements from.</param>
- /// <param name="duration">Duration for taking elements from the end of the sequence.</param>
- /// <param name="scheduler">Scheduler to run the timer on.</param>
- /// <returns>An observable sequence with the elements taken during the specified duration from the end of the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="scheduler"/> is null.</exception>
- /// <exception cref="ArgumentOutOfRangeException"><paramref name="duration"/> is less than TimeSpan.Zero.</exception>
- /// <remarks>
- /// This operator accumulates a buffer with a length enough to store elements for any <paramref name="duration"/> window during the lifetime of
- /// the source sequence. Upon completion of the source sequence, this buffer is drained on the result sequence. This causes the result elements
- /// to be delayed with <paramref name="duration"/>.
- /// </remarks>
- public static IObservable<TSource> TakeLast<TSource>(this IObservable<TSource> source, TimeSpan duration, IScheduler scheduler)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (duration < TimeSpan.Zero)
- throw new ArgumentOutOfRangeException("duration");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return s_impl.TakeLast<TSource>(source, duration, scheduler);
- }
-
- /// <summary>
- /// Returns elements within the specified duration from the end of the observable source sequence, using the specified schedulers to run timers and to drain the collected elements.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence to take elements from.</param>
- /// <param name="duration">Duration for taking elements from the end of the sequence.</param>
- /// <param name="timerScheduler">Scheduler to run the timer on.</param>
- /// <param name="loopScheduler">Scheduler to drain the collected elements.</param>
- /// <returns>An observable sequence with the elements taken during the specified duration from the end of the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="timerScheduler"/> or <paramref name="loopScheduler"/> is null.</exception>
- /// <exception cref="ArgumentOutOfRangeException"><paramref name="duration"/> is less than TimeSpan.Zero.</exception>
- /// <remarks>
- /// This operator accumulates a buffer with a length enough to store elements for any <paramref name="duration"/> window during the lifetime of
- /// the source sequence. Upon completion of the source sequence, this buffer is drained on the result sequence. This causes the result elements
- /// to be delayed with <paramref name="duration"/>.
- /// </remarks>
- public static IObservable<TSource> TakeLast<TSource>(this IObservable<TSource> source, TimeSpan duration, IScheduler timerScheduler, IScheduler loopScheduler)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (duration < TimeSpan.Zero)
- throw new ArgumentOutOfRangeException("duration");
- if (timerScheduler == null)
- throw new ArgumentNullException("timerScheduler");
- if (loopScheduler == null)
- throw new ArgumentNullException("loopScheduler");
-
- return s_impl.TakeLast<TSource>(source, duration, timerScheduler, loopScheduler);
- }
-
- #endregion
-
- #region + TakeLastBuffer +
-
- /// <summary>
- /// Returns a list with the elements within the specified duration from the end of the observable source sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence to take elements from.</param>
- /// <param name="duration">Duration for taking elements from the end of the sequence.</param>
- /// <returns>An observable sequence containing a single list with the elements taken during the specified duration from the end of the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <exception cref="ArgumentOutOfRangeException"><paramref name="duration"/> is less than TimeSpan.Zero.</exception>
- /// <remarks>
- /// This operator accumulates a buffer with a length enough to store elements for any <paramref name="duration"/> window during the lifetime of
- /// the source sequence. Upon completion of the source sequence, this buffer is produced on the result sequence.
- /// </remarks>
- public static IObservable<IList<TSource>> TakeLastBuffer<TSource>(this IObservable<TSource> source, TimeSpan duration)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (duration < TimeSpan.Zero)
- throw new ArgumentOutOfRangeException("duration");
-
- return s_impl.TakeLastBuffer<TSource>(source, duration);
- }
-
- /// <summary>
- /// Returns a list with the elements within the specified duration from the end of the observable source sequence, using the specified scheduler to run timers.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence to take elements from.</param>
- /// <param name="duration">Duration for taking elements from the end of the sequence.</param>
- /// <param name="scheduler">Scheduler to run the timer on.</param>
- /// <returns>An observable sequence containing a single list with the elements taken during the specified duration from the end of the source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="scheduler"/> is null.</exception>
- /// <exception cref="ArgumentOutOfRangeException"><paramref name="duration"/> is less than TimeSpan.Zero.</exception>
- /// <remarks>
- /// This operator accumulates a buffer with a length enough to store elements for any <paramref name="duration"/> window during the lifetime of
- /// the source sequence. Upon completion of the source sequence, this buffer is produced on the result sequence.
- /// </remarks>
- public static IObservable<IList<TSource>> TakeLastBuffer<TSource>(this IObservable<TSource> source, TimeSpan duration, IScheduler scheduler)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (duration < TimeSpan.Zero)
- throw new ArgumentOutOfRangeException("duration");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return s_impl.TakeLastBuffer<TSource>(source, duration, scheduler);
- }
-
- #endregion
-
- #region + TakeUntil +
-
- /// <summary>
- /// Takes elements for the specified duration until the specified end time.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence to take elements from.</param>
- /// <param name="endTime">Time to stop taking elements from the source sequence. If this value is less than or equal to DateTimeOffset.UtcNow, the result stream will complete immediately.</param>
- /// <returns>An observable sequence with the elements taken until the specified end time.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- public static IObservable<TSource> TakeUntil<TSource>(this IObservable<TSource> source, DateTimeOffset endTime)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return s_impl.TakeUntil<TSource>(source, endTime);
- }
-
- /// <summary>
- /// Takes elements for the specified duration until the specified end time, using the specified scheduler to run timers.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence to take elements from.</param>
- /// <param name="endTime">Time to stop taking elements from the source sequence. If this value is less than or equal to DateTimeOffset.UtcNow, the result stream will complete immediately.</param>
- /// <param name="scheduler">Scheduler to run the timer on.</param>
- /// <returns>An observable sequence with the elements taken until the specified end time.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="scheduler"/> is null.</exception>
- public static IObservable<TSource> TakeUntil<TSource>(this IObservable<TSource> source, DateTimeOffset endTime, IScheduler scheduler)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return s_impl.TakeUntil<TSource>(source, endTime, scheduler);
- }
-
- #endregion
-
- #region + Throttle +
-
- /// <summary>
- /// Ignores elements from an observable sequence which are followed by another element within a specified relative time duration.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence to throttle.</param>
- /// <param name="dueTime">Throttling duration for each element.</param>
- /// <returns>The throttled sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <exception cref="ArgumentOutOfRangeException"><paramref name="dueTime"/> is less than TimeSpan.Zero.</exception>
- /// <remarks>
- /// <para>
- /// This operator throttles the source sequence by holding on to each element for the duration specified in <paramref name="dueTime"/>. If another
- /// element is produced within this time window, the element is dropped and a new timer is started for the current element, repeating this whole
- /// process. For streams that never have gaps larger than or equal to <paramref name="dueTime"/> between elements, the resulting stream won't
- /// produce any elements. In order to reduce the volume of a stream whilst guaranteeing the periodic production of elements, consider using the
- /// Observable.Sample set of operators.
- /// </para>
- /// <para>
- /// Specifying a TimeSpan.Zero value for <paramref name="dueTime"/> is not recommended but supported, causing throttling timers to be scheduled
- /// that are due immediately. However, this doesn't guarantee all elements will be retained in the result sequence. This is a side-effect of the
- /// asynchrony introduced by the scheduler, where the action to forward the current element may not execute immediately, despite the TimeSpan.Zero
- /// due time. In such cases, the next element may arrive before the scheduler gets a chance to run the throttling action.
- /// </para>
- /// </remarks>
- public static IObservable<TSource> Throttle<TSource>(this IObservable<TSource> source, TimeSpan dueTime)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (dueTime < TimeSpan.Zero)
- throw new ArgumentOutOfRangeException("dueTime");
-
- return s_impl.Throttle<TSource>(source, dueTime);
- }
-
- /// <summary>
- /// Ignores elements from an observable sequence which are followed by another element within a specified relative time duration, using the specified scheduler to run throttling timers.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence to throttle.</param>
- /// <param name="dueTime">Throttling duration for each element.</param>
- /// <param name="scheduler">Scheduler to run the throttle timers on.</param>
- /// <returns>The throttled sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="scheduler"/> is null.</exception>
- /// <exception cref="ArgumentOutOfRangeException"><paramref name="dueTime"/> is less than TimeSpan.Zero.</exception>
- /// <remarks>
- /// <para>
- /// This operator throttles the source sequence by holding on to each element for the duration specified in <paramref name="dueTime"/>. If another
- /// element is produced within this time window, the element is dropped and a new timer is started for the current element, repeating this whole
- /// process. For streams that never have gaps larger than or equal to <paramref name="dueTime"/> between elements, the resulting stream won't
- /// produce any elements. In order to reduce the volume of a stream whilst guaranteeing the periodic production of elements, consider using the
- /// Observable.Sample set of operators.
- /// </para>
- /// <para>
- /// Specifying a TimeSpan.Zero value for <paramref name="dueTime"/> is not recommended but supported, causing throttling timers to be scheduled
- /// that are due immediately. However, this doesn't guarantee all elements will be retained in the result sequence. This is a side-effect of the
- /// asynchrony introduced by the scheduler, where the action to forward the current element may not execute immediately, despite the TimeSpan.Zero
- /// due time. In such cases, the next element may arrive before the scheduler gets a chance to run the throttling action.
- /// </para>
- /// </remarks>
- public static IObservable<TSource> Throttle<TSource>(this IObservable<TSource> source, TimeSpan dueTime, IScheduler scheduler)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (dueTime < TimeSpan.Zero)
- throw new ArgumentOutOfRangeException("dueTime");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return s_impl.Throttle<TSource>(source, dueTime, scheduler);
- }
-
- /// <summary>
- /// Ignores elements from an observable sequence which are followed by another value within a computed throttle duration.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TThrottle">The type of the elements in the throttle sequences selected for each element in the source sequence.</typeparam>
- /// <param name="source">Source sequence to throttle.</param>
- /// <param name="throttleDurationSelector">Selector function to retrieve a sequence indicating the throttle duration for each given element.</param>
- /// <returns>The throttled sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="throttleDurationSelector"/> is null.</exception>
- /// <remarks>
- /// This operator throttles the source sequence by holding on to each element for the duration denoted by <paramref name="throttleDurationSelector"/>.
- /// If another element is produced within this time window, the element is dropped and a new timer is started for the current element, repeating this
- /// whole process. For streams where the duration computed by applying the <paramref name="throttleDurationSelector"/> to each element overlaps with
- /// the occurrence of the successor element, the resulting stream won't produce any elements. In order to reduce the volume of a stream whilst
- /// guaranteeing the periodic production of elements, consider using the Observable.Sample set of operators.
- /// </remarks>
- public static IObservable<TSource> Throttle<TSource, TThrottle>(this IObservable<TSource> source, Func<TSource, IObservable<TThrottle>> throttleDurationSelector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (throttleDurationSelector == null)
- throw new ArgumentNullException("throttleDurationSelector");
-
- return s_impl.Throttle<TSource, TThrottle>(source, throttleDurationSelector);
- }
-
- #endregion
-
- #region + TimeInterval +
-
- /// <summary>
- /// Records the time interval between consecutive elements in an observable sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence to record time intervals for.</param>
- /// <returns>An observable sequence with time interval information on elements.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- public static IObservable<System.Reactive.TimeInterval<TSource>> TimeInterval<TSource>(this IObservable<TSource> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return s_impl.TimeInterval<TSource>(source);
- }
-
- /// <summary>
- /// Records the time interval between consecutive elements in an observable sequence, using the specified scheduler to compute time intervals.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence to record time intervals for.</param>
- /// <param name="scheduler">Scheduler used to compute time intervals.</param>
- /// <returns>An observable sequence with time interval information on elements.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="scheduler"/> is null.</exception>
- public static IObservable<System.Reactive.TimeInterval<TSource>> TimeInterval<TSource>(this IObservable<TSource> source, IScheduler scheduler)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return s_impl.TimeInterval<TSource>(source, scheduler);
- }
-
- #endregion
-
- #region + Timeout +
-
- #region TimeSpan
-
- /// <summary>
- /// Applies a timeout policy for each element in the observable sequence.
- /// If the next element isn't received within the specified timeout duration starting from its predecessor, a TimeoutException is propagated to the observer.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence to perform a timeout for.</param>
- /// <param name="dueTime">Maximum duration between values before a timeout occurs.</param>
- /// <returns>The source sequence with a TimeoutException in case of a timeout.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <exception cref="ArgumentOutOfRangeException"><paramref name="dueTime"/> is less than TimeSpan.Zero.</exception>
- /// <exception cref="TimeoutException">(Asynchronous) If no element is produced within <paramref name="dueTime"/> from the previous element.</exception>
- /// <remarks>
- /// <para>
- /// In case you only want to timeout on the first element, consider using the <see cref="Observable.Amb{TSource}(IObservable{TSource}, IObservable{TSource})"/>
- /// operator applied to the source sequence and a delayed <see cref="Observable.Throw{TResult}(Exception)"/> sequence. Alternatively, the general-purpose overload
- /// of Timeout, <see cref="Timeout{TSource, TTimeout}(IObservable{TSource}, IObservable{TTimeout}, Func{TSource, IObservable{TTimeout}})"/> can be used.
- /// </para>
- /// <para>
- /// Specifying a TimeSpan.Zero value for <paramref name="dueTime"/> is not recommended but supported, causing timeout timers to be scheduled that are due
- /// immediately. However, this doesn't guarantee a timeout will occur, even for the first element. This is a side-effect of the asynchrony introduced by the
- /// scheduler, where the action to propagate a timeout may not execute immediately, despite the TimeSpan.Zero due time. In such cases, the next element may
- /// arrive before the scheduler gets a chance to run the timeout action.
- /// </para>
- /// </remarks>
- public static IObservable<TSource> Timeout<TSource>(this IObservable<TSource> source, TimeSpan dueTime)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (dueTime < TimeSpan.Zero)
- throw new ArgumentOutOfRangeException("dueTime");
-
- return s_impl.Timeout<TSource>(source, dueTime);
- }
-
- /// <summary>
- /// Applies a timeout policy for each element in the observable sequence, using the specified scheduler to run timeout timers.
- /// If the next element isn't received within the specified timeout duration starting from its predecessor, a TimeoutException is propagated to the observer.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence to perform a timeout for.</param>
- /// <param name="dueTime">Maximum duration between values before a timeout occurs.</param>
- /// <param name="scheduler">Scheduler to run the timeout timers on.</param>
- /// <returns>The source sequence with a TimeoutException in case of a timeout.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="scheduler"/> is null.</exception>
- /// <exception cref="ArgumentOutOfRangeException"><paramref name="dueTime"/> is less than TimeSpan.Zero.</exception>
- /// <exception cref="TimeoutException">(Asynchronous) If no element is produced within <paramref name="dueTime"/> from the previous element.</exception>
- /// <remarks>
- /// <para>
- /// In case you only want to timeout on the first element, consider using the <see cref="Observable.Amb{TSource}(IObservable{TSource}, IObservable{TSource})"/>
- /// operator applied to the source sequence and a delayed <see cref="Observable.Throw{TResult}(Exception)"/> sequence. Alternatively, the general-purpose overload
- /// of Timeout, <see cref="Timeout{TSource, TTimeout}(IObservable{TSource}, IObservable{TTimeout}, Func{TSource, IObservable{TTimeout}})"/> can be used.
- /// </para>
- /// <para>
- /// Specifying a TimeSpan.Zero value for <paramref name="dueTime"/> is not recommended but supported, causing timeout timers to be scheduled that are due
- /// immediately. However, this doesn't guarantee a timeout will occur, even for the first element. This is a side-effect of the asynchrony introduced by the
- /// scheduler, where the action to propagate a timeout may not execute immediately, despite the TimeSpan.Zero due time. In such cases, the next element may
- /// arrive before the scheduler gets a chance to run the timeout action.
- /// </para>
- /// </remarks>
- public static IObservable<TSource> Timeout<TSource>(this IObservable<TSource> source, TimeSpan dueTime, IScheduler scheduler)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (dueTime < TimeSpan.Zero)
- throw new ArgumentOutOfRangeException("dueTime");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return s_impl.Timeout<TSource>(source, dueTime, scheduler);
- }
-
- /// <summary>
- /// Applies a timeout policy for each element in the observable sequence.
- /// If the next element isn't received within the specified timeout duration starting from its predecessor, the other observable sequence is used to produce future messages from that point on.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence and the other sequence used upon a timeout.</typeparam>
- /// <param name="source">Source sequence to perform a timeout for.</param>
- /// <param name="dueTime">Maximum duration between values before a timeout occurs.</param>
- /// <param name="other">Sequence to return in case of a timeout.</param>
- /// <returns>The source sequence switching to the other sequence in case of a timeout.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="other"/> is null.</exception>
- /// <exception cref="ArgumentOutOfRangeException"><paramref name="dueTime"/> is less than TimeSpan.Zero.</exception>
- /// <remarks>
- /// <para>
- /// In case you only want to timeout on the first element, consider using the <see cref="Observable.Amb{TSource}(IObservable{TSource}, IObservable{TSource})"/>
- /// operator applied to the source sequence and a delayed <see cref="Observable.Throw{TResult}(Exception)"/> sequence. Alternatively, the general-purpose overload
- /// of Timeout, <see cref="Timeout{TSource, TTimeout}(IObservable{TSource}, IObservable{TTimeout}, Func{TSource, IObservable{TTimeout}})"/> can be used.
- /// </para>
- /// <para>
- /// Specifying a TimeSpan.Zero value for <paramref name="dueTime"/> is not recommended but supported, causing timeout timers to be scheduled that are due
- /// immediately. However, this doesn't guarantee a timeout will occur, even for the first element. This is a side-effect of the asynchrony introduced by the
- /// scheduler, where the action to propagate a timeout may not execute immediately, despite the TimeSpan.Zero due time. In such cases, the next element may
- /// arrive before the scheduler gets a chance to run the timeout action.
- /// </para>
- /// </remarks>
- public static IObservable<TSource> Timeout<TSource>(this IObservable<TSource> source, TimeSpan dueTime, IObservable<TSource> other)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (dueTime < TimeSpan.Zero)
- throw new ArgumentOutOfRangeException("dueTime");
- if (other == null)
- throw new ArgumentNullException("other");
-
- return s_impl.Timeout<TSource>(source, dueTime, other);
- }
-
- /// <summary>
- /// Applies a timeout policy for each element in the observable sequence, using the specified scheduler to run timeout timers.
- /// If the next element isn't received within the specified timeout duration starting from its predecessor, the other observable sequence is used to produce future messages from that point on.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence and the other sequence used upon a timeout.</typeparam>
- /// <param name="source">Source sequence to perform a timeout for.</param>
- /// <param name="dueTime">Maximum duration between values before a timeout occurs.</param>
- /// <param name="other">Sequence to return in case of a timeout.</param>
- /// <param name="scheduler">Scheduler to run the timeout timers on.</param>
- /// <returns>The source sequence switching to the other sequence in case of a timeout.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="other"/> or <paramref name="scheduler"/> is null.</exception>
- /// <exception cref="ArgumentOutOfRangeException"><paramref name="dueTime"/> is less than TimeSpan.Zero.</exception>
- /// <remarks>
- /// <para>
- /// In case you only want to timeout on the first element, consider using the <see cref="Observable.Amb{TSource}(IObservable{TSource}, IObservable{TSource})"/>
- /// operator applied to the source sequence and a delayed <see cref="Observable.Throw{TResult}(Exception)"/> sequence. Alternatively, the general-purpose overload
- /// of Timeout, <see cref="Timeout{TSource, TTimeout}(IObservable{TSource}, IObservable{TTimeout}, Func{TSource, IObservable{TTimeout}})"/> can be used.
- /// </para>
- /// <para>
- /// Specifying a TimeSpan.Zero value for <paramref name="dueTime"/> is not recommended but supported, causing timeout timers to be scheduled that are due
- /// immediately. However, this doesn't guarantee a timeout will occur, even for the first element. This is a side-effect of the asynchrony introduced by the
- /// scheduler, where the action to propagate a timeout may not execute immediately, despite the TimeSpan.Zero due time. In such cases, the next element may
- /// arrive before the scheduler gets a chance to run the timeout action.
- /// </para>
- /// </remarks>
- public static IObservable<TSource> Timeout<TSource>(this IObservable<TSource> source, TimeSpan dueTime, IObservable<TSource> other, IScheduler scheduler)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (dueTime < TimeSpan.Zero)
- throw new ArgumentOutOfRangeException("dueTime");
- if (other == null)
- throw new ArgumentNullException("other");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return s_impl.Timeout<TSource>(source, dueTime, other, scheduler);
- }
-
- #endregion
-
- #region DateTimeOffset
-
- /// <summary>
- /// Applies a timeout policy to the observable sequence based on an absolute time.
- /// If the sequence doesn't terminate before the specified absolute due time, a TimeoutException is propagated to the observer.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence to perform a timeout for.</param>
- /// <param name="dueTime">Time when a timeout occurs. If this value is less than or equal to DateTimeOffset.UtcNow, the timeout occurs immediately.</param>
- /// <returns>The source sequence with a TimeoutException in case of a timeout.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <exception cref="TimeoutException">(Asynchronous) If the sequence hasn't terminated before <paramref name="dueTime"/>.</exception>
- /// <remarks>
- /// In case you only want to timeout on the first element, consider using the <see cref="Observable.Amb{TSource}(IObservable{TSource}, IObservable{TSource})"/>
- /// operator applied to the source sequence and a delayed <see cref="Observable.Throw{TResult}(Exception)"/> sequence. Alternatively, the general-purpose overload
- /// of Timeout, <see cref="Timeout{TSource, TTimeout}(IObservable{TSource}, IObservable{TTimeout}, Func{TSource, IObservable{TTimeout}})"/> can be used.
- /// </remarks>
- public static IObservable<TSource> Timeout<TSource>(this IObservable<TSource> source, DateTimeOffset dueTime)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return s_impl.Timeout<TSource>(source, dueTime);
- }
-
- /// <summary>
- /// Applies a timeout policy to the observable sequence based on an absolute time, using the specified scheduler to run timeout timers.
- /// If the sequence doesn't terminate before the specified absolute due time, a TimeoutException is propagated to the observer.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence to perform a timeout for.</param>
- /// <param name="dueTime">Time when a timeout occurs. If this value is less than or equal to DateTimeOffset.UtcNow, the timeout occurs immediately.</param>
- /// <param name="scheduler">Scheduler to run the timeout timers on.</param>
- /// <returns>The source sequence with a TimeoutException in case of a timeout.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="scheduler"/> is null.</exception>
- /// <exception cref="TimeoutException">(Asynchronous) If the sequence hasn't terminated before <paramref name="dueTime"/>.</exception>
- /// <remarks>
- /// In case you only want to timeout on the first element, consider using the <see cref="Observable.Amb{TSource}(IObservable{TSource}, IObservable{TSource})"/>
- /// operator applied to the source sequence and a delayed <see cref="Observable.Throw{TResult}(Exception)"/> sequence. Alternatively, the general-purpose overload
- /// of Timeout, <see cref="Timeout{TSource, TTimeout}(IObservable{TSource}, IObservable{TTimeout}, Func{TSource, IObservable{TTimeout}})"/> can be used.
- /// </remarks>
- public static IObservable<TSource> Timeout<TSource>(this IObservable<TSource> source, DateTimeOffset dueTime, IScheduler scheduler)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return s_impl.Timeout<TSource>(source, dueTime, scheduler);
- }
-
- /// <summary>
- /// Applies a timeout policy to the observable sequence based on an absolute time.
- /// If the sequence doesn't terminate before the specified absolute due time, the other observable sequence is used to produce future messages from that point on.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence and the other sequence used upon a timeout.</typeparam>
- /// <param name="source">Source sequence to perform a timeout for.</param>
- /// <param name="dueTime">Time when a timeout occurs. If this value is less than or equal to DateTimeOffset.UtcNow, the timeout occurs immediately.</param>
- /// <param name="other">Sequence to return in case of a timeout.</param>
- /// <returns>The source sequence switching to the other sequence in case of a timeout.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="other"/> is null.</exception>
- /// <remarks>
- /// In case you only want to timeout on the first element, consider using the <see cref="Observable.Amb{TSource}(IObservable{TSource}, IObservable{TSource})"/>
- /// operator applied to the source sequence and a delayed <see cref="Observable.Throw{TResult}(Exception)"/> sequence. Alternatively, the general-purpose overload
- /// of Timeout, <see cref="Timeout{TSource, TTimeout}(IObservable{TSource}, IObservable{TTimeout}, Func{TSource, IObservable{TTimeout}})"/> can be used.
- /// </remarks>
- public static IObservable<TSource> Timeout<TSource>(this IObservable<TSource> source, DateTimeOffset dueTime, IObservable<TSource> other)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (other == null)
- throw new ArgumentNullException("other");
-
- return s_impl.Timeout<TSource>(source, dueTime, other);
- }
-
- /// <summary>
- /// Applies a timeout policy to the observable sequence based on an absolute time, using the specified scheduler to run timeout timers.
- /// If the sequence doesn't terminate before the specified absolute due time, the other observable sequence is used to produce future messages from that point on.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence and the other sequence used upon a timeout.</typeparam>
- /// <param name="source">Source sequence to perform a timeout for.</param>
- /// <param name="dueTime">Time when a timeout occurs. If this value is less than or equal to DateTimeOffset.UtcNow, the timeout occurs immediately.</param>
- /// <param name="other">Sequence to return in case of a timeout.</param>
- /// <param name="scheduler">Scheduler to run the timeout timers on.</param>
- /// <returns>The source sequence switching to the other sequence in case of a timeout.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="other"/> or <paramref name="scheduler"/> is null.</exception>
- /// <remarks>
- /// In case you only want to timeout on the first element, consider using the <see cref="Observable.Amb{TSource}(IObservable{TSource}, IObservable{TSource})"/>
- /// operator applied to the source sequence and a delayed <see cref="Observable.Throw{TResult}(Exception)"/> sequence. Alternatively, the general-purpose overload
- /// of Timeout, <see cref="Timeout{TSource, TTimeout}(IObservable{TSource}, IObservable{TTimeout}, Func{TSource, IObservable{TTimeout}})"/> can be used.
- /// </remarks>
- public static IObservable<TSource> Timeout<TSource>(this IObservable<TSource> source, DateTimeOffset dueTime, IObservable<TSource> other, IScheduler scheduler)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
- if (other == null)
- throw new ArgumentNullException("other");
-
- return s_impl.Timeout<TSource>(source, dueTime, other, scheduler);
- }
-
- #endregion
-
- #region Duration selector
-
- /// <summary>
- /// Applies a timeout policy to the observable sequence based on a timeout duration computed for each element.
- /// If the next element isn't received within the computed duration starting from its predecessor, a TimeoutException is propagated to the observer.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TTimeout">The type of the elements in the timeout sequences used to indicate the timeout duration for each element in the source sequence.</typeparam>
- /// <param name="source">Source sequence to perform a timeout for.</param>
- /// <param name="timeoutDurationSelector">Selector to retrieve an observable sequence that represents the timeout between the current element and the next element.</param>
- /// <returns>The source sequence with a TimeoutException in case of a timeout.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="timeoutDurationSelector"/> is null.</exception>
- public static IObservable<TSource> Timeout<TSource, TTimeout>(this IObservable<TSource> source, Func<TSource, IObservable<TTimeout>> timeoutDurationSelector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (timeoutDurationSelector == null)
- throw new ArgumentNullException("timeoutDurationSelector");
-
- return s_impl.Timeout<TSource, TTimeout>(source, timeoutDurationSelector);
- }
-
- /// <summary>
- /// Applies a timeout policy to the observable sequence based on a timeout duration computed for each element.
- /// If the next element isn't received within the computed duration starting from its predecessor, the other observable sequence is used to produce future messages from that point on.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence and the other sequence used upon a timeout.</typeparam>
- /// <typeparam name="TTimeout">The type of the elements in the timeout sequences used to indicate the timeout duration for each element in the source sequence.</typeparam>
- /// <param name="source">Source sequence to perform a timeout for.</param>
- /// <param name="timeoutDurationSelector">Selector to retrieve an observable sequence that represents the timeout between the current element and the next element.</param>
- /// <param name="other">Sequence to return in case of a timeout.</param>
- /// <returns>The source sequence switching to the other sequence in case of a timeout.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="timeoutDurationSelector"/> or <paramref name="other"/> is null.</exception>
- public static IObservable<TSource> Timeout<TSource, TTimeout>(this IObservable<TSource> source, Func<TSource, IObservable<TTimeout>> timeoutDurationSelector, IObservable<TSource> other)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (timeoutDurationSelector == null)
- throw new ArgumentNullException("timeoutDurationSelector");
- if (other == null)
- throw new ArgumentNullException("other");
-
- return s_impl.Timeout<TSource, TTimeout>(source, timeoutDurationSelector, other);
- }
-
- /// <summary>
- /// Applies a timeout policy to the observable sequence based on an initial timeout duration for the first element, and a timeout duration computed for each subsequent element.
- /// If the next element isn't received within the computed duration starting from its predecessor, a TimeoutException is propagated to the observer.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TTimeout">The type of the elements in the timeout sequences used to indicate the timeout duration for each element in the source sequence.</typeparam>
- /// <param name="source">Source sequence to perform a timeout for.</param>
- /// <param name="firstTimeout">Observable sequence that represents the timeout for the first element.</param>
- /// <param name="timeoutDurationSelector">Selector to retrieve an observable sequence that represents the timeout between the current element and the next element.</param>
- /// <returns>The source sequence with a TimeoutException in case of a timeout.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="firstTimeout"/> or <paramref name="timeoutDurationSelector"/> is null.</exception>
- public static IObservable<TSource> Timeout<TSource, TTimeout>(this IObservable<TSource> source, IObservable<TTimeout> firstTimeout, Func<TSource, IObservable<TTimeout>> timeoutDurationSelector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (firstTimeout == null)
- throw new ArgumentNullException("firstTimeout");
- if (timeoutDurationSelector == null)
- throw new ArgumentNullException("timeoutDurationSelector");
-
- return s_impl.Timeout<TSource, TTimeout>(source, firstTimeout, timeoutDurationSelector);
- }
-
- /// <summary>
- /// Applies a timeout policy to the observable sequence based on an initial timeout duration for the first element, and a timeout duration computed for each subsequent element.
- /// If the next element isn't received within the computed duration starting from its predecessor, the other observable sequence is used to produce future messages from that point on.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence and the other sequence used upon a timeout.</typeparam>
- /// <typeparam name="TTimeout">The type of the elements in the timeout sequences used to indicate the timeout duration for each element in the source sequence.</typeparam>
- /// <param name="source">Source sequence to perform a timeout for.</param>
- /// <param name="firstTimeout">Observable sequence that represents the timeout for the first element.</param>
- /// <param name="timeoutDurationSelector">Selector to retrieve an observable sequence that represents the timeout between the current element and the next element.</param>
- /// <param name="other">Sequence to return in case of a timeout.</param>
- /// <returns>The source sequence switching to the other sequence in case of a timeout.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="firstTimeout"/> or <paramref name="timeoutDurationSelector"/> or <paramref name="other"/> is null.</exception>
- public static IObservable<TSource> Timeout<TSource, TTimeout>(this IObservable<TSource> source, IObservable<TTimeout> firstTimeout, Func<TSource, IObservable<TTimeout>> timeoutDurationSelector, IObservable<TSource> other)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (firstTimeout == null)
- throw new ArgumentNullException("firstTimeout");
- if (timeoutDurationSelector == null)
- throw new ArgumentNullException("timeoutDurationSelector");
- if (other == null)
- throw new ArgumentNullException("other");
-
- return s_impl.Timeout<TSource, TTimeout>(source, firstTimeout, timeoutDurationSelector, other);
- }
-
- #endregion
-
- #endregion
-
- #region + Timer +
-
- /// <summary>
- /// Returns an observable sequence that produces a single value after the specified relative due time has elapsed.
- /// </summary>
- /// <param name="dueTime">Relative time at which to produce the value. If this value is less than or equal to TimeSpan.Zero, the timer will fire as soon as possible.</param>
- /// <returns>An observable sequence that produces a value after the due time has elapsed.</returns>
- public static IObservable<long> Timer(TimeSpan dueTime)
- {
- return s_impl.Timer(dueTime);
- }
-
- /// <summary>
- /// Returns an observable sequence that produces a single value at the specified absolute due time.
- /// </summary>
- /// <param name="dueTime">Absolute time at which to produce the value. If this value is less than or equal to DateTimeOffset.UtcNow, the timer will fire as soon as possible.</param>
- /// <returns>An observable sequence that produces a value at due time.</returns>
- public static IObservable<long> Timer(DateTimeOffset dueTime)
- {
- return s_impl.Timer(dueTime);
- }
-
- /// <summary>
- /// Returns an observable sequence that periodically produces a value after the specified initial relative due time has elapsed.
- /// </summary>
- /// <param name="dueTime">Relative time at which to produce the first value. If this value is less than or equal to TimeSpan.Zero, the timer will fire as soon as possible.</param>
- /// <param name="period">Period to produce subsequent values. If this value is equal to TimeSpan.Zero, the timer will recur as fast as possible.</param>
- /// <returns>An observable sequence that produces a value after due time has elapsed and then after each period.</returns>
- /// <exception cref="ArgumentOutOfRangeException"><paramref name="period"/> is less than TimeSpan.Zero.</exception>
- public static IObservable<long> Timer(TimeSpan dueTime, TimeSpan period)
- {
- if (period < TimeSpan.Zero)
- throw new ArgumentOutOfRangeException("period");
-
- return s_impl.Timer(dueTime, period);
- }
-
- /// <summary>
- /// Returns an observable sequence that periodically produces a value starting at the specified initial absolute due time.
- /// </summary>
- /// <param name="dueTime">Absolute time at which to produce the first value. If this value is less than or equal to DateTimeOffset.UtcNow, the timer will fire as soon as possible.</param>
- /// <param name="period">Period to produce subsequent values. If this value is equal to TimeSpan.Zero, the timer will recur as fast as possible.</param>
- /// <returns>An observable sequence that produces a value at due time and then after each period.</returns>
- /// <exception cref="ArgumentOutOfRangeException"><paramref name="period"/> is less than TimeSpan.Zero.</exception>
- public static IObservable<long> Timer(DateTimeOffset dueTime, TimeSpan period)
- {
- if (period < TimeSpan.Zero)
- throw new ArgumentOutOfRangeException("period");
-
- return s_impl.Timer(dueTime, period);
- }
-
- /// <summary>
- /// Returns an observable sequence that produces a single value after the specified relative due time has elapsed, using the specified scheduler to run the timer.
- /// </summary>
- /// <param name="dueTime">Relative time at which to produce the value. If this value is less than or equal to TimeSpan.Zero, the timer will fire as soon as possible.</param>
- /// <param name="scheduler">Scheduler to run the timer on.</param>
- /// <returns>An observable sequence that produces a value after the due time has elapsed.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="scheduler"/> is null.</exception>
- public static IObservable<long> Timer(TimeSpan dueTime, IScheduler scheduler)
- {
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return s_impl.Timer(dueTime, scheduler);
- }
-
- /// <summary>
- /// Returns an observable sequence that produces a single value at the specified absolute due time, using the specified scheduler to run the timer.
- /// </summary>
- /// <param name="dueTime">Absolute time at which to produce the value. If this value is less than or equal to DateTimeOffset.UtcNow, the timer will fire as soon as possible.</param>
- /// <param name="scheduler">Scheduler to run the timer on.</param>
- /// <returns>An observable sequence that produces a value at due time.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="scheduler"/> is null.</exception>
- public static IObservable<long> Timer(DateTimeOffset dueTime, IScheduler scheduler)
- {
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return s_impl.Timer(dueTime, scheduler);
- }
-
- /// <summary>
- /// Returns an observable sequence that periodically produces a value after the specified initial relative due time has elapsed, using the specified scheduler to run timers.
- /// </summary>
- /// <param name="dueTime">Relative time at which to produce the first value. If this value is less than or equal to TimeSpan.Zero, the timer will fire as soon as possible.</param>
- /// <param name="period">Period to produce subsequent values. If this value is equal to TimeSpan.Zero, the timer will recur as fast as possible.</param>
- /// <param name="scheduler">Scheduler to run timers on.</param>
- /// <returns>An observable sequence that produces a value after due time has elapsed and then each period.</returns>
- /// <exception cref="ArgumentOutOfRangeException"><paramref name="period"/> is less than TimeSpan.Zero.</exception>
- /// <exception cref="ArgumentNullException"><paramref name="scheduler"/> is null.</exception>
- public static IObservable<long> Timer(TimeSpan dueTime, TimeSpan period, IScheduler scheduler)
- {
- if (period < TimeSpan.Zero)
- throw new ArgumentOutOfRangeException("period");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return s_impl.Timer(dueTime, period, scheduler);
- }
-
- /// <summary>
- /// Returns an observable sequence that periodically produces a value starting at the specified initial absolute due time, using the specified scheduler to run timers.
- /// </summary>
- /// <param name="dueTime">Absolute time at which to produce the first value. If this value is less than or equal to DateTimeOffset.UtcNow, the timer will fire as soon as possible.</param>
- /// <param name="period">Period to produce subsequent values. If this value is equal to TimeSpan.Zero, the timer will recur as fast as possible.</param>
- /// <param name="scheduler">Scheduler to run timers on.</param>
- /// <returns>An observable sequence that produces a value at due time and then after each period.</returns>
- /// <exception cref="ArgumentOutOfRangeException"><paramref name="period"/> is less than TimeSpan.Zero.</exception>
- /// <exception cref="ArgumentNullException"><paramref name="scheduler"/> is null.</exception>
- public static IObservable<long> Timer(DateTimeOffset dueTime, TimeSpan period, IScheduler scheduler)
- {
- if (period < TimeSpan.Zero)
- throw new ArgumentOutOfRangeException("period");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return s_impl.Timer(dueTime, period, scheduler);
- }
-
- #endregion
-
- #region + Timestamp +
-
- /// <summary>
- /// Timestamps each element in an observable sequence using the local system clock.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence to timestamp elements for.</param>
- /// <returns>An observable sequence with timestamp information on elements.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- public static IObservable<Timestamped<TSource>> Timestamp<TSource>(this IObservable<TSource> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return s_impl.Timestamp<TSource>(source);
- }
-
- /// <summary>
- /// Timestamp each element in an observable sequence using the clock of the specified scheduler.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence to timestamp elements for.</param>
- /// <param name="scheduler">Scheduler used to compute timestamps.</param>
- /// <returns>An observable sequence with timestamp information on elements.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="scheduler"/> is null.</exception>
- public static IObservable<Timestamped<TSource>> Timestamp<TSource>(this IObservable<TSource> source, IScheduler scheduler)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return s_impl.Timestamp<TSource>(source, scheduler);
- }
-
- #endregion
-
- #region + Window +
-
- #region TimeSpan only
-
- /// <summary>
- /// Projects each element of an observable sequence into consecutive non-overlapping windows which are produced based on timing information.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence, and in the windows in the result sequence.</typeparam>
- /// <param name="source">Source sequence to produce windows over.</param>
- /// <param name="timeSpan">Length of each window.</param>
- /// <returns>The sequence of windows.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <exception cref="ArgumentOutOfRangeException"><paramref name="timeSpan"/> is less than TimeSpan.Zero.</exception>
- /// <remarks>
- /// Specifying a TimeSpan.Zero value for <paramref name="timeSpan"/> is not recommended but supported, causing the scheduler to create windows as fast as it can.
- /// Because all source sequence elements end up in one of the windows, some windows won't have a zero time span. This is a side-effect of the asynchrony introduced
- /// by the scheduler, where the action to close the current window and to create a new window may not execute immediately, despite the TimeSpan.Zero due time.
- /// </remarks>
- public static IObservable<IObservable<TSource>> Window<TSource>(this IObservable<TSource> source, TimeSpan timeSpan)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (timeSpan < TimeSpan.Zero)
- throw new ArgumentOutOfRangeException("timeSpan");
-
- return s_impl.Window<TSource>(source, timeSpan);
- }
-
- /// <summary>
- /// Projects each element of an observable sequence into consecutive non-overlapping windows which are produced based on timing information, using the specified scheduler to run timers.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence, and in the windows in the result sequence.</typeparam>
- /// <param name="source">Source sequence to produce windows over.</param>
- /// <param name="timeSpan">Length of each window.</param>
- /// <param name="scheduler">Scheduler to run windowing timers on.</param>
- /// <returns>An observable sequence of windows.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="scheduler"/> is null.</exception>
- /// <exception cref="ArgumentOutOfRangeException"><paramref name="timeSpan"/> is less than TimeSpan.Zero.</exception>
- /// <remarks>
- /// Specifying a TimeSpan.Zero value for <paramref name="timeSpan"/> is not recommended but supported, causing the scheduler to create windows as fast as it can.
- /// Because all source sequence elements end up in one of the windows, some windows won't have a zero time span. This is a side-effect of the asynchrony introduced
- /// by the scheduler, where the action to close the current window and to create a new window may not execute immediately, despite the TimeSpan.Zero due time.
- /// </remarks>
- public static IObservable<IObservable<TSource>> Window<TSource>(this IObservable<TSource> source, TimeSpan timeSpan, IScheduler scheduler)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (timeSpan < TimeSpan.Zero)
- throw new ArgumentOutOfRangeException("timeSpan");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return s_impl.Window<TSource>(source, timeSpan, scheduler);
- }
-
- /// <summary>
- /// Projects each element of an observable sequence into zero or more windows which are produced based on timing information.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence, and in the windows in the result sequence.</typeparam>
- /// <param name="source">Source sequence to produce windows over.</param>
- /// <param name="timeSpan">Length of each window.</param>
- /// <param name="timeShift">Interval between creation of consecutive windows.</param>
- /// <returns>An observable sequence of windows.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <exception cref="ArgumentOutOfRangeException"><paramref name="timeSpan"/> or <paramref name="timeSpan"/> is less than TimeSpan.Zero.</exception>
- /// <remarks>
- /// <para>
- /// Specifying a TimeSpan.Zero value for <paramref name="timeSpan"/> is not recommended but supported, causing the scheduler to create windows with minimum duration
- /// length. However, some windows won't have a zero time span. This is a side-effect of the asynchrony introduced by the scheduler, where the action to close the
- /// current window may not execute immediately, despite the TimeSpan.Zero due time.
- /// </para>
- /// <para>
- /// Specifying a TimeSpan.Zero value for <paramref name="timeShift"/> is not recommended but supported, causing the scheduler to create windows as fast as it can.
- /// However, this doesn't mean all windows will start at the beginning of the source sequence. This is a side-effect of the asynchrony introduced by the scheduler,
- /// where the action to create a new window may not execute immediately, despite the TimeSpan.Zero due time.
- /// </para>
- /// </remarks>
- public static IObservable<IObservable<TSource>> Window<TSource>(this IObservable<TSource> source, TimeSpan timeSpan, TimeSpan timeShift)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (timeSpan < TimeSpan.Zero)
- throw new ArgumentOutOfRangeException("timeSpan");
- if (timeShift < TimeSpan.Zero)
- throw new ArgumentOutOfRangeException("timeShift");
-
- return s_impl.Window<TSource>(source, timeSpan, timeShift);
- }
-
- /// <summary>
- /// Projects each element of an observable sequence into zero or more windows which are produced based on timing information, using the specified scheduler to run timers.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence, and in the windows in the result sequence.</typeparam>
- /// <param name="source">Source sequence to produce windows over.</param>
- /// <param name="timeSpan">Length of each window.</param>
- /// <param name="timeShift">Interval between creation of consecutive windows.</param>
- /// <param name="scheduler">Scheduler to run windowing timers on.</param>
- /// <returns>An observable sequence of windows.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="scheduler"/> is null.</exception>
- /// <exception cref="ArgumentOutOfRangeException"><paramref name="timeSpan"/> or <paramref name="timeSpan"/> is less than TimeSpan.Zero.</exception>
- /// <remarks>
- /// <para>
- /// Specifying a TimeSpan.Zero value for <paramref name="timeSpan"/> is not recommended but supported, causing the scheduler to create windows with minimum duration
- /// length. However, some windows won't have a zero time span. This is a side-effect of the asynchrony introduced by the scheduler, where the action to close the
- /// current window may not execute immediately, despite the TimeSpan.Zero due time.
- /// </para>
- /// <para>
- /// Specifying a TimeSpan.Zero value for <paramref name="timeShift"/> is not recommended but supported, causing the scheduler to create windows as fast as it can.
- /// However, this doesn't mean all windows will start at the beginning of the source sequence. This is a side-effect of the asynchrony introduced by the scheduler,
- /// where the action to create a new window may not execute immediately, despite the TimeSpan.Zero due time.
- /// </para>
- /// </remarks>
- public static IObservable<IObservable<TSource>> Window<TSource>(this IObservable<TSource> source, TimeSpan timeSpan, TimeSpan timeShift, IScheduler scheduler)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (timeSpan < TimeSpan.Zero)
- throw new ArgumentOutOfRangeException("timeSpan");
- if (timeShift < TimeSpan.Zero)
- throw new ArgumentOutOfRangeException("timeShift");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return s_impl.Window<TSource>(source, timeSpan, timeShift, scheduler);
- }
-
- #endregion
-
- #region TimeSpan + int
-
- /// <summary>
- /// Projects each element of an observable sequence into a window that is completed when either it's full or a given amount of time has elapsed.
- /// A useful real-world analogy of this overload is the behavior of a ferry leaving the dock when all seats are taken, or at the scheduled time of departure, whichever event occurs first.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence, and in the windows in the result sequence.</typeparam>
- /// <param name="source">Source sequence to produce windows over.</param>
- /// <param name="timeSpan">Maximum time length of a window.</param>
- /// <param name="count">Maximum element count of a window.</param>
- /// <returns>An observable sequence of windows.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <exception cref="ArgumentOutOfRangeException"><paramref name="timeSpan"/> is less than TimeSpan.Zero. -or- <paramref name="count"/> is less than or equal to zero.</exception>
- /// <remarks>
- /// Specifying a TimeSpan.Zero value for <paramref name="timeSpan"/> is not recommended but supported, causing the scheduler to create windows as fast as it can.
- /// Because all source sequence elements end up in one of the windows, some windows won't have a zero time span. This is a side-effect of the asynchrony introduced
- /// by the scheduler, where the action to close the current window and to create a new window may not execute immediately, despite the TimeSpan.Zero due time.
- /// </remarks>
- public static IObservable<IObservable<TSource>> Window<TSource>(this IObservable<TSource> source, TimeSpan timeSpan, int count)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (timeSpan < TimeSpan.Zero)
- throw new ArgumentOutOfRangeException("timeSpan");
- if (count <= 0)
- throw new ArgumentOutOfRangeException("count");
-
- return s_impl.Window<TSource>(source, timeSpan, count);
- }
-
- /// <summary>
- /// Projects each element of an observable sequence into a window that is completed when either it's full or a given amount of time has elapsed, using the specified scheduler to run timers.
- /// A useful real-world analogy of this overload is the behavior of a ferry leaving the dock when all seats are taken, or at the scheduled time of departure, whichever event occurs first.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence, and in the windows in the result sequence.</typeparam>
- /// <param name="source">Source sequence to produce windows over.</param>
- /// <param name="timeSpan">Maximum time length of a window.</param>
- /// <param name="count">Maximum element count of a window.</param>
- /// <param name="scheduler">Scheduler to run windowing timers on.</param>
- /// <returns>An observable sequence of windows.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="scheduler"/> is null.</exception>
- /// <exception cref="ArgumentOutOfRangeException"><paramref name="timeSpan"/> is less than TimeSpan.Zero. -or- <paramref name="count"/> is less than or equal to zero.</exception>
- /// <remarks>
- /// Specifying a TimeSpan.Zero value for <paramref name="timeSpan"/> is not recommended but supported, causing the scheduler to create windows as fast as it can.
- /// Because all source sequence elements end up in one of the windows, some windows won't have a zero time span. This is a side-effect of the asynchrony introduced
- /// by the scheduler, where the action to close the current window and to create a new window may not execute immediately, despite the TimeSpan.Zero due time.
- /// </remarks>
- public static IObservable<IObservable<TSource>> Window<TSource>(this IObservable<TSource> source, TimeSpan timeSpan, int count, IScheduler scheduler)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (timeSpan < TimeSpan.Zero)
- throw new ArgumentOutOfRangeException("timeSpan");
- if (count <= 0)
- throw new ArgumentOutOfRangeException("count");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return s_impl.Window<TSource>(source, timeSpan, count, scheduler);
- }
-
- #endregion
-
- #endregion
- }
-}
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observable_.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observable_.cs
deleted file mode 100644
index a7c6b0e..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observable_.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-namespace System.Reactive.Linq
-{
- /// <summary>
- /// Provides a set of static methods for writing in-memory queries over observable sequences.
- /// </summary>
- public static partial class Observable
- {
- private static IQueryLanguage s_impl = QueryServices.GetQueryImpl<IQueryLanguage>(new QueryLanguage());
- }
-}
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/AddRef.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/AddRef.cs
deleted file mode 100644
index 3fc6962..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/AddRef.cs
+++ /dev/null
@@ -1,55 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_PERF
-using System;
-using System.Reactive.Disposables;
-
-namespace System.Reactive.Linq.Observαble
-{
- class AddRef<TSource> : Producer<TSource>
- {
- private readonly IObservable<TSource> _source;
- private readonly RefCountDisposable _refCount;
-
- public AddRef(IObservable<TSource> source, RefCountDisposable refCount)
- {
- _source = source;
- _refCount = refCount;
- }
-
- protected override IDisposable Run(IObserver<TSource> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var d = new CompositeDisposable(_refCount.GetDisposable(), cancel);
-
- var sink = new _(observer, d);
- setSink(sink);
- return _source.SubscribeSafe(sink);
- }
-
- class _ : Sink<TSource>, IObserver<TSource>
- {
- public _(IObserver<TSource> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- }
-
- public void OnNext(TSource value)
- {
- base._observer.OnNext(value);
- }
-
- public void OnError(Exception error)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
-
- public void OnCompleted()
- {
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Aggregate.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Aggregate.cs
deleted file mode 100644
index d1b6ef8..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Aggregate.cs
+++ /dev/null
@@ -1,158 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_PERF
-using System;
-
-namespace System.Reactive.Linq.Observαble
-{
- class Aggregate<TSource, TAccumulate, TResult> : Producer<TResult>
- {
- private readonly IObservable<TSource> _source;
- private readonly TAccumulate _seed;
- private readonly Func<TAccumulate, TSource, TAccumulate> _accumulator;
- private readonly Func<TAccumulate, TResult> _resultSelector;
-
- public Aggregate(IObservable<TSource> source, TAccumulate seed, Func<TAccumulate, TSource, TAccumulate> accumulator, Func<TAccumulate, TResult> resultSelector)
- {
- _source = source;
- _seed = seed;
- _accumulator = accumulator;
- _resultSelector = resultSelector;
- }
-
- protected override IDisposable Run(IObserver<TResult> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(this, observer, cancel);
- setSink(sink);
- return _source.SubscribeSafe(sink);
- }
-
- class _ : Sink<TResult>, IObserver<TSource>
- {
- private readonly Aggregate<TSource, TAccumulate, TResult> _parent;
- private TAccumulate _accumulation;
-
- public _(Aggregate<TSource, TAccumulate, TResult> parent, IObserver<TResult> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _parent = parent;
- _accumulation = _parent._seed;
- }
-
- public void OnNext(TSource value)
- {
- try
- {
- _accumulation = _parent._accumulator(_accumulation, value);
- }
- catch (Exception exception)
- {
- base._observer.OnError(exception);
- base.Dispose();
- }
- }
-
- public void OnError(Exception error)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
-
- public void OnCompleted()
- {
- var result = default(TResult);
- try
- {
- result = _parent._resultSelector(_accumulation);
- }
- catch (Exception exception)
- {
- base._observer.OnError(exception);
- base.Dispose();
- return;
- }
-
- base._observer.OnNext(result);
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
- }
-
- class Aggregate<TSource> : Producer<TSource>
- {
- private readonly IObservable<TSource> _source;
- private readonly Func<TSource, TSource, TSource> _accumulator;
-
- public Aggregate(IObservable<TSource> source, Func<TSource, TSource, TSource> accumulator)
- {
- _source = source;
- _accumulator = accumulator;
- }
-
- protected override IDisposable Run(IObserver<TSource> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(this, observer, cancel);
- setSink(sink);
- return _source.SubscribeSafe(sink);
- }
-
- class _ : Sink<TSource>, IObserver<TSource>
- {
- private readonly Aggregate<TSource> _parent;
- private TSource _accumulation;
- private bool _hasAccumulation;
-
- public _(Aggregate<TSource> parent, IObserver<TSource> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _parent = parent;
- _accumulation = default(TSource);
- _hasAccumulation = false;
- }
-
- public void OnNext(TSource value)
- {
- if (!_hasAccumulation)
- {
- _accumulation = value;
- _hasAccumulation = true;
- }
- else
- {
- try
- {
- _accumulation = _parent._accumulator(_accumulation, value);
- }
- catch (Exception exception)
- {
- base._observer.OnError(exception);
- base.Dispose();
- }
- }
- }
-
- public void OnError(Exception error)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
-
- public void OnCompleted()
- {
- if (!_hasAccumulation)
- {
- base._observer.OnError(new InvalidOperationException(Strings_Linq.NO_ELEMENTS));
- base.Dispose();
- }
- else
- {
- base._observer.OnNext(_accumulation);
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/All.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/All.cs
deleted file mode 100644
index 09c825d..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/All.cs
+++ /dev/null
@@ -1,73 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_PERF
-using System;
-
-namespace System.Reactive.Linq.Observαble
-{
- class All<TSource> : Producer<bool>
- {
- private readonly IObservable<TSource> _source;
- private readonly Func<TSource, bool> _predicate;
-
- public All(IObservable<TSource> source, Func<TSource, bool> predicate)
- {
- _source = source;
- _predicate = predicate;
- }
-
- protected override IDisposable Run(IObserver<bool> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(this, observer, cancel);
- setSink(sink);
- return _source.SubscribeSafe(sink);
- }
-
- class _ : Sink<bool>, IObserver<TSource>
- {
- private readonly All<TSource> _parent;
-
- public _(All<TSource> parent, IObserver<bool> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _parent = parent;
- }
-
- public void OnNext(TSource value)
- {
- var res = false;
- try
- {
- res = _parent._predicate(value);
- }
- catch (Exception ex)
- {
- base._observer.OnError(ex);
- base.Dispose();
- return;
- }
-
- if (!res)
- {
- base._observer.OnNext(false);
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
-
- public void OnError(Exception error)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
-
- public void OnCompleted()
- {
- base._observer.OnNext(true);
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Amb.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Amb.cs
deleted file mode 100644
index 7272cee..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Amb.cs
+++ /dev/null
@@ -1,173 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_PERF
-using System;
-using System.Reactive.Disposables;
-
-namespace System.Reactive.Linq.Observαble
-{
- class Amb<TSource> : Producer<TSource>
- {
- private readonly IObservable<TSource> _left;
- private readonly IObservable<TSource> _right;
-
- public Amb(IObservable<TSource> left, IObservable<TSource> right)
- {
- _left = left;
- _right = right;
- }
-
- protected override IDisposable Run(IObserver<TSource> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(this, observer, cancel);
- setSink(sink);
- return sink.Run();
- }
-
- class _ : Sink<TSource>
- {
- private readonly Amb<TSource> _parent;
-
- public _(Amb<TSource> parent, IObserver<TSource> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _parent = parent;
- }
-
- private AmbState _choice;
-
- public IDisposable Run()
- {
- var ls = new SingleAssignmentDisposable();
- var rs = new SingleAssignmentDisposable();
- var d = new CompositeDisposable(ls, rs);
-
- var gate = new object();
-
- var lo = new AmbObserver();
- lo._disposable = d;
- lo._target = new DecisionObserver(this, gate, AmbState.Left, ls, rs, lo);
-
- var ro = new AmbObserver();
- ro._disposable = d;
- ro._target = new DecisionObserver(this, gate, AmbState.Right, rs, ls, ro);
-
- _choice = AmbState.Neither;
-
- ls.Disposable = _parent._left.SubscribeSafe(lo);
- rs.Disposable = _parent._right.SubscribeSafe(ro);
-
- return d;
- }
-
- class DecisionObserver : IObserver<TSource>
- {
- private readonly _ _parent;
- private readonly AmbState _me;
- private readonly IDisposable _subscription;
- private readonly IDisposable _otherSubscription;
- private readonly object _gate;
- private readonly AmbObserver _observer;
-
- public DecisionObserver(_ parent, object gate, AmbState me, IDisposable subscription, IDisposable otherSubscription, AmbObserver observer)
- {
- _parent = parent;
- _gate = gate;
- _me = me;
- _subscription = subscription;
- _otherSubscription = otherSubscription;
- _observer = observer;
- }
-
- public void OnNext(TSource value)
- {
- lock (_gate)
- {
- if (_parent._choice == AmbState.Neither)
- {
- _parent._choice = _me;
- _otherSubscription.Dispose();
- _observer._disposable = _subscription;
- _observer._target = _parent._observer;
- }
-
- if (_parent._choice == _me)
- _parent._observer.OnNext(value);
- }
- }
-
- public void OnError(Exception error)
- {
- lock (_gate)
- {
- if (_parent._choice == AmbState.Neither)
- {
- _parent._choice = _me;
- _otherSubscription.Dispose();
- _observer._disposable = _subscription;
- _observer._target = _parent._observer;
- }
-
- if (_parent._choice == _me)
- {
- _parent._observer.OnError(error);
- _parent.Dispose();
- }
- }
- }
-
- public void OnCompleted()
- {
- lock (_gate)
- {
- if (_parent._choice == AmbState.Neither)
- {
- _parent._choice = _me;
- _otherSubscription.Dispose();
- _observer._disposable = _subscription;
- _observer._target = _parent._observer;
- }
-
- if (_parent._choice == _me)
- {
- _parent._observer.OnCompleted();
- _parent.Dispose();
- }
- }
- }
- }
-
- class AmbObserver : IObserver<TSource>
- {
- public IObserver<TSource> _target;
-
- public IDisposable _disposable;
-
- public void OnNext(TSource value)
- {
- _target.OnNext(value);
- }
-
- public void OnError(Exception error)
- {
- _target.OnError(error);
- _disposable.Dispose();
- }
-
- public void OnCompleted()
- {
- _target.OnCompleted();
- _disposable.Dispose();
- }
- }
-
- enum AmbState
- {
- Left,
- Right,
- Neither
- }
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Any.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Any.cs
deleted file mode 100644
index 1414bdd..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Any.cs
+++ /dev/null
@@ -1,115 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_PERF
-using System;
-
-namespace System.Reactive.Linq.Observαble
-{
- class Any<TSource> : Producer<bool>
- {
- private readonly IObservable<TSource> _source;
- private readonly Func<TSource, bool> _predicate;
-
- public Any(IObservable<TSource> source)
- {
- _source = source;
- }
-
- public Any(IObservable<TSource> source, Func<TSource, bool> predicate)
- {
- _source = source;
- _predicate = predicate;
- }
-
- protected override IDisposable Run(IObserver<bool> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- if (_predicate != null)
- {
- var sink = new π(this, observer, cancel);
- setSink(sink);
- return _source.SubscribeSafe(sink);
- }
- else
- {
- var sink = new _(observer, cancel);
- setSink(sink);
- return _source.SubscribeSafe(sink);
- }
- }
-
- class _ : Sink<bool>, IObserver<TSource>
- {
- public _(IObserver<bool> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- }
-
- public void OnNext(TSource value)
- {
- base._observer.OnNext(true);
- base._observer.OnCompleted();
- base.Dispose();
- }
-
- public void OnError(Exception error)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
-
- public void OnCompleted()
- {
- base._observer.OnNext(false);
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
-
- class π : Sink<bool>, IObserver<TSource>
- {
- private readonly Any<TSource> _parent;
-
- public π(Any<TSource> parent, IObserver<bool> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _parent = parent;
- }
-
- public void OnNext(TSource value)
- {
- var res = false;
- try
- {
- res = _parent._predicate(value);
- }
- catch (Exception ex)
- {
- base._observer.OnError(ex);
- base.Dispose();
- return;
- }
-
- if (res)
- {
- base._observer.OnNext(true);
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
-
- public void OnError(Exception error)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
-
- public void OnCompleted()
- {
- base._observer.OnNext(false);
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/AsObservable.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/AsObservable.cs
deleted file mode 100644
index 09d5f14..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/AsObservable.cs
+++ /dev/null
@@ -1,60 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_PERF
-using System;
-
-namespace System.Reactive.Linq.Observαble
-{
- class AsObservable<TSource> : Producer<TSource>, IEvaluatableObservable<TSource>
- {
- private readonly IObservable<TSource> _source;
-
- public AsObservable(IObservable<TSource> source)
- {
- _source = source;
- }
-
- public IObservable<TSource> Ω()
- {
- return this;
- }
-
- public IObservable<TSource> Eval()
- {
- return _source;
- }
-
- protected override IDisposable Run(IObserver<TSource> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(observer, cancel);
- setSink(sink);
- return _source.SubscribeSafe(sink);
- }
-
- class _ : Sink<TSource>, IObserver<TSource>
- {
- public _(IObserver<TSource> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- }
-
- public void OnNext(TSource value)
- {
- base._observer.OnNext(value);
- }
-
- public void OnError(Exception error)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
-
- public void OnCompleted()
- {
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Average.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Average.cs
deleted file mode 100644
index fb2d6b7..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Average.cs
+++ /dev/null
@@ -1,703 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_PERF
-using System;
-
-namespace System.Reactive.Linq.Observαble
-{
- class AverageDouble : Producer<double>
- {
- private readonly IObservable<double> _source;
-
- public AverageDouble(IObservable<double> source)
- {
- _source = source;
- }
-
- protected override IDisposable Run(IObserver<double> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(observer, cancel);
- setSink(sink);
- return _source.SubscribeSafe(sink);
- }
-
- class _ : Sink<double>, IObserver<double>
- {
- private double _sum;
- private long _count;
-
- public _(IObserver<double> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _sum = 0.0;
- _count = 0L;
- }
-
- public void OnNext(double value)
- {
- try
- {
- checked
- {
- _sum += value;
- _count++;
- }
- }
- catch (Exception ex)
- {
- base._observer.OnError(ex);
- base.Dispose();
- }
- }
-
- public void OnError(Exception error)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
-
- public void OnCompleted()
- {
- if (_count > 0)
- {
- base._observer.OnNext(_sum / _count);
- base._observer.OnCompleted();
- }
- else
- {
- base._observer.OnError(new InvalidOperationException(Strings_Linq.NO_ELEMENTS));
- }
-
- base.Dispose();
- }
- }
- }
-
- class AverageSingle : Producer<float>
- {
- private readonly IObservable<float> _source;
-
- public AverageSingle(IObservable<float> source)
- {
- _source = source;
- }
-
- protected override IDisposable Run(IObserver<float> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(observer, cancel);
- setSink(sink);
- return _source.SubscribeSafe(sink);
- }
-
- class _ : Sink<float>, IObserver<float>
- {
- private double _sum; // NOTE: Uses a different accumulator type (double), conform LINQ to Objects.
- private long _count;
-
- public _(IObserver<float> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _sum = 0.0;
- _count = 0L;
- }
-
- public void OnNext(float value)
- {
- try
- {
- checked
- {
- _sum += value;
- _count++;
- }
- }
- catch (Exception ex)
- {
- base._observer.OnError(ex);
- base.Dispose();
- }
- }
-
- public void OnError(Exception error)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
-
- public void OnCompleted()
- {
- if (_count > 0)
- {
- base._observer.OnNext((float)(_sum / _count));
- base._observer.OnCompleted();
- }
- else
- {
- base._observer.OnError(new InvalidOperationException(Strings_Linq.NO_ELEMENTS));
- }
-
- base.Dispose();
- }
- }
- }
-
- class AverageDecimal : Producer<decimal>
- {
- private readonly IObservable<decimal> _source;
-
- public AverageDecimal(IObservable<decimal> source)
- {
- _source = source;
- }
-
- protected override IDisposable Run(IObserver<decimal> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(observer, cancel);
- setSink(sink);
- return _source.SubscribeSafe(sink);
- }
-
- class _ : Sink<decimal>, IObserver<decimal>
- {
- private decimal _sum;
- private long _count;
-
- public _(IObserver<decimal> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _sum = 0M;
- _count = 0L;
- }
-
- public void OnNext(decimal value)
- {
- try
- {
- checked
- {
- _sum += value;
- _count++;
- }
- }
- catch (Exception ex)
- {
- base._observer.OnError(ex);
- base.Dispose();
- }
- }
-
- public void OnError(Exception error)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
-
- public void OnCompleted()
- {
- if (_count > 0)
- {
- base._observer.OnNext(_sum / _count);
- base._observer.OnCompleted();
- }
- else
- {
- base._observer.OnError(new InvalidOperationException(Strings_Linq.NO_ELEMENTS));
- }
-
- base.Dispose();
- }
- }
- }
-
- class AverageInt32 : Producer<double>
- {
- private readonly IObservable<int> _source;
-
- public AverageInt32(IObservable<int> source)
- {
- _source = source;
- }
-
- protected override IDisposable Run(IObserver<double> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(observer, cancel);
- setSink(sink);
- return _source.SubscribeSafe(sink);
- }
-
- class _ : Sink<double>, IObserver<int>
- {
- private long _sum;
- private long _count;
-
- public _(IObserver<double> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _sum = 0L;
- _count = 0L;
- }
-
- public void OnNext(int value)
- {
- try
- {
- checked
- {
- _sum += value;
- _count++;
- }
- }
- catch (Exception ex)
- {
- base._observer.OnError(ex);
- base.Dispose();
- }
- }
-
- public void OnError(Exception error)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
-
- public void OnCompleted()
- {
- if (_count > 0)
- {
- base._observer.OnNext((double)_sum / _count);
- base._observer.OnCompleted();
- }
- else
- {
- base._observer.OnError(new InvalidOperationException(Strings_Linq.NO_ELEMENTS));
- }
-
- base.Dispose();
- }
- }
- }
-
- class AverageInt64 : Producer<double>
- {
- private readonly IObservable<long> _source;
-
- public AverageInt64(IObservable<long> source)
- {
- _source = source;
- }
-
- protected override IDisposable Run(IObserver<double> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(observer, cancel);
- setSink(sink);
- return _source.SubscribeSafe(sink);
- }
-
- class _ : Sink<double>, IObserver<long>
- {
- private long _sum;
- private long _count;
-
- public _(IObserver<double> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _sum = 0L;
- _count = 0L;
- }
-
- public void OnNext(long value)
- {
- try
- {
- checked
- {
- _sum += value;
- _count++;
- }
- }
- catch (Exception ex)
- {
- base._observer.OnError(ex);
- base.Dispose();
- }
- }
-
- public void OnError(Exception error)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
-
- public void OnCompleted()
- {
- if (_count > 0)
- {
- base._observer.OnNext((double)_sum / _count);
- base._observer.OnCompleted();
- }
- else
- {
- base._observer.OnError(new InvalidOperationException(Strings_Linq.NO_ELEMENTS));
- }
-
- base.Dispose();
- }
- }
- }
-
- class AverageDoubleNullable : Producer<double?>
- {
- private readonly IObservable<double?> _source;
-
- public AverageDoubleNullable(IObservable<double?> source)
- {
- _source = source;
- }
-
- protected override IDisposable Run(IObserver<double?> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(observer, cancel);
- setSink(sink);
- return _source.SubscribeSafe(sink);
- }
-
- class _ : Sink<double?>, IObserver<double?>
- {
- private double _sum;
- private long _count;
-
- public _(IObserver<double?> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _sum = 0.0;
- _count = 0L;
- }
-
- public void OnNext(double? value)
- {
- try
- {
- checked
- {
- if (value != null)
- {
- _sum += value.Value;
- _count++;
- }
- }
- }
- catch (Exception ex)
- {
- base._observer.OnError(ex);
- base.Dispose();
- }
- }
-
- public void OnError(Exception error)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
-
- public void OnCompleted()
- {
- if (_count > 0)
- {
- base._observer.OnNext(_sum / _count);
- }
- else
- {
- base._observer.OnNext(null);
- }
-
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
- }
-
- class AverageSingleNullable : Producer<float?>
- {
- private readonly IObservable<float?> _source;
-
- public AverageSingleNullable(IObservable<float?> source)
- {
- _source = source;
- }
-
- protected override IDisposable Run(IObserver<float?> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(observer, cancel);
- setSink(sink);
- return _source.SubscribeSafe(sink);
- }
-
- class _ : Sink<float?>, IObserver<float?>
- {
- private double _sum; // NOTE: Uses a different accumulator type (double), conform LINQ to Objects.
- private long _count;
-
- public _(IObserver<float?> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _sum = 0.0;
- _count = 0L;
- }
-
- public void OnNext(float? value)
- {
- try
- {
- checked
- {
- if (value != null)
- {
- _sum += value.Value;
- _count++;
- }
- }
- }
- catch (Exception ex)
- {
- base._observer.OnError(ex);
- base.Dispose();
- }
- }
-
- public void OnError(Exception error)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
-
- public void OnCompleted()
- {
- if (_count > 0)
- {
- base._observer.OnNext((float)(_sum / _count));
- }
- else
- {
- base._observer.OnNext(null);
- }
-
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
- }
-
- class AverageDecimalNullable : Producer<decimal?>
- {
- private readonly IObservable<decimal?> _source;
-
- public AverageDecimalNullable(IObservable<decimal?> source)
- {
- _source = source;
- }
-
- protected override IDisposable Run(IObserver<decimal?> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(observer, cancel);
- setSink(sink);
- return _source.SubscribeSafe(sink);
- }
-
- class _ : Sink<decimal?>, IObserver<decimal?>
- {
- private decimal _sum;
- private long _count;
-
- public _(IObserver<decimal?> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _sum = 0M;
- _count = 0L;
- }
-
- public void OnNext(decimal? value)
- {
- try
- {
- checked
- {
- if (value != null)
- {
- _sum += value.Value;
- _count++;
- }
- }
- }
- catch (Exception ex)
- {
- base._observer.OnError(ex);
- base.Dispose();
- }
- }
-
- public void OnError(Exception error)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
-
- public void OnCompleted()
- {
- if (_count > 0)
- {
- base._observer.OnNext(_sum / _count);
- }
- else
- {
- base._observer.OnNext(null);
- }
-
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
- }
-
- class AverageInt32Nullable : Producer<double?>
- {
- private readonly IObservable<int?> _source;
-
- public AverageInt32Nullable(IObservable<int?> source)
- {
- _source = source;
- }
-
- protected override IDisposable Run(IObserver<double?> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(observer, cancel);
- setSink(sink);
- return _source.SubscribeSafe(sink);
- }
-
- class _ : Sink<double?>, IObserver<int?>
- {
- private long _sum;
- private long _count;
-
- public _(IObserver<double?> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _sum = 0L;
- _count = 0L;
- }
-
- public void OnNext(int? value)
- {
- try
- {
- checked
- {
- if (value != null)
- {
- _sum += value.Value;
- _count++;
- }
- }
- }
- catch (Exception ex)
- {
- base._observer.OnError(ex);
- base.Dispose();
- }
- }
-
- public void OnError(Exception error)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
-
- public void OnCompleted()
- {
- if (_count > 0)
- {
- base._observer.OnNext((double)_sum / _count);
- }
- else
- {
- base._observer.OnNext(null);
- }
-
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
- }
-
- class AverageInt64Nullable : Producer<double?>
- {
- private readonly IObservable<long?> _source;
-
- public AverageInt64Nullable(IObservable<long?> source)
- {
- _source = source;
- }
-
- protected override IDisposable Run(IObserver<double?> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(observer, cancel);
- setSink(sink);
- return _source.SubscribeSafe(sink);
- }
-
- class _ : Sink<double?>, IObserver<long?>
- {
- private long _sum;
- private long _count;
-
- public _(IObserver<double?> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _sum = 0L;
- _count = 0L;
- }
-
- public void OnNext(long? value)
- {
- try
- {
- checked
- {
- if (value != null)
- {
- _sum += value.Value;
- _count++;
- }
- }
- }
- catch (Exception ex)
- {
- base._observer.OnError(ex);
- base.Dispose();
- }
- }
-
- public void OnError(Exception error)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
-
- public void OnCompleted()
- {
- if (_count > 0)
- {
- base._observer.OnNext((double)_sum / _count);
- }
- else
- {
- base._observer.OnNext(null);
- }
-
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Buffer.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Buffer.cs
deleted file mode 100644
index a82b550..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Buffer.cs
+++ /dev/null
@@ -1,709 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_PERF
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Reactive.Concurrency;
-using System.Reactive.Disposables;
-using System.Threading;
-
-namespace System.Reactive.Linq.Observαble
-{
- class Buffer<TSource> : Producer<IList<TSource>>
- {
- private readonly IObservable<TSource> _source;
- private readonly int _count;
- private readonly int _skip;
-
- private readonly TimeSpan _timeSpan;
- private readonly TimeSpan _timeShift;
- private readonly IScheduler _scheduler;
-
- public Buffer(IObservable<TSource> source, int count, int skip)
- {
- _source = source;
- _count = count;
- _skip = skip;
- }
-
- public Buffer(IObservable<TSource> source, TimeSpan timeSpan, TimeSpan timeShift, IScheduler scheduler)
- {
- _source = source;
- _timeSpan = timeSpan;
- _timeShift = timeShift;
- _scheduler = scheduler;
- }
-
- public Buffer(IObservable<TSource> source, TimeSpan timeSpan, int count, IScheduler scheduler)
- {
- _source = source;
- _timeSpan = timeSpan;
- _count = count;
- _scheduler = scheduler;
- }
-
- protected override IDisposable Run(IObserver<IList<TSource>> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- if (_scheduler == null)
- {
- var sink = new _(this, observer, cancel);
- setSink(sink);
- return sink.Run();
- }
- else if (_count > 0)
- {
- var sink = new μ(this, observer, cancel);
- setSink(sink);
- return sink.Run();
- }
- else
- {
- if (_timeSpan == _timeShift)
- {
- var sink = new π(this, observer, cancel);
- setSink(sink);
- return sink.Run();
- }
- else
- {
- var sink = new τ(this, observer, cancel);
- setSink(sink);
- return sink.Run();
- }
- }
- }
-
- class _ : Sink<IList<TSource>>, IObserver<TSource>
- {
- private readonly Buffer<TSource> _parent;
-
- public _(Buffer<TSource> parent, IObserver<IList<TSource>> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _parent = parent;
- }
-
- private Queue<IList<TSource>> _queue;
- private int _n;
-
- public IDisposable Run()
- {
- _queue = new Queue<IList<TSource>>();
- _n = 0;
-
- CreateWindow();
- return _parent._source.SubscribeSafe(this);
- }
-
- private void CreateWindow()
- {
- var s = new List<TSource>();
- _queue.Enqueue(s);
- }
-
- public void OnNext(TSource value)
- {
- foreach (var s in _queue)
- s.Add(value);
-
- var c = _n - _parent._count + 1;
- if (c >= 0 && c % _parent._skip == 0)
- {
- var s = _queue.Dequeue();
- if (s.Count > 0)
- base._observer.OnNext(s);
- }
-
- _n++;
- if (_n % _parent._skip == 0)
- CreateWindow();
- }
-
- public void OnError(Exception error)
- {
- while (_queue.Count > 0)
- _queue.Dequeue().Clear();
-
- base._observer.OnError(error);
- base.Dispose();
- }
-
- public void OnCompleted()
- {
- while (_queue.Count > 0)
- {
- var s = _queue.Dequeue();
- if (s.Count > 0)
- base._observer.OnNext(s);
- }
-
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
-
- class τ : Sink<IList<TSource>>, IObserver<TSource>
- {
- private readonly Buffer<TSource> _parent;
-
- public τ(Buffer<TSource> parent, IObserver<IList<TSource>> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _parent = parent;
- }
-
- private TimeSpan _totalTime;
- private TimeSpan _nextShift;
- private TimeSpan _nextSpan;
-
- private object _gate;
- private Queue<List<TSource>> _q;
-
- private SerialDisposable _timerD;
-
- public IDisposable Run()
- {
- _totalTime = TimeSpan.Zero;
- _nextShift = _parent._timeShift;
- _nextSpan = _parent._timeSpan;
-
- _gate = new object();
- _q = new Queue<List<TSource>>();
-
- _timerD = new SerialDisposable();
-
- CreateWindow();
- CreateTimer();
-
- var subscription = _parent._source.SubscribeSafe(this);
-
- return new CompositeDisposable { _timerD, subscription };
- }
-
- private void CreateWindow()
- {
- var s = new List<TSource>();
- _q.Enqueue(s);
- }
-
- private void CreateTimer()
- {
- var m = new SingleAssignmentDisposable();
- _timerD.Disposable = m;
-
- var isSpan = false;
- var isShift = false;
- if (_nextSpan == _nextShift)
- {
- isSpan = true;
- isShift = true;
- }
- else if (_nextSpan < _nextShift)
- isSpan = true;
- else
- isShift = true;
-
- var newTotalTime = isSpan ? _nextSpan : _nextShift;
- var ts = newTotalTime - _totalTime;
- _totalTime = newTotalTime;
-
- if (isSpan)
- _nextSpan += _parent._timeShift;
- if (isShift)
- _nextShift += _parent._timeShift;
-
- m.Disposable = _parent._scheduler.Schedule(new State { isSpan = isSpan, isShift = isShift }, ts, Tick);
- }
-
- struct State
- {
- public bool isSpan;
- public bool isShift;
- }
-
- private IDisposable Tick(IScheduler self, State state)
- {
- lock (_gate)
- {
- //
- // Before v2, the two operations below were reversed. This doesn't have an observable
- // difference for Buffer, but is done to keep code consistent with Window, where we
- // took a breaking change in v2 to ensure consistency across overloads. For more info,
- // see the comment in Tick for Window.
- //
- if (state.isSpan)
- {
- var s = _q.Dequeue();
- base._observer.OnNext(s);
- }
-
- if (state.isShift)
- {
- CreateWindow();
- }
- }
-
- CreateTimer();
-
- return Disposable.Empty;
- }
-
- public void OnNext(TSource value)
- {
- lock (_gate)
- {
- foreach (var s in _q)
- s.Add(value);
- }
- }
-
- public void OnError(Exception error)
- {
- lock (_gate)
- {
- while (_q.Count > 0)
- _q.Dequeue().Clear();
-
- base._observer.OnError(error);
- base.Dispose();
- }
- }
-
- public void OnCompleted()
- {
- lock (_gate)
- {
- while (_q.Count > 0)
- base._observer.OnNext(_q.Dequeue());
-
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
- }
-
- class π : Sink<IList<TSource>>, IObserver<TSource>
- {
- private readonly Buffer<TSource> _parent;
-
- public π(Buffer<TSource> parent, IObserver<IList<TSource>> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _parent = parent;
- }
-
- private object _gate;
- private List<TSource> _list;
-
- public IDisposable Run()
- {
- _gate = new object();
- _list = new List<TSource>();
-
- var d = _parent._scheduler.SchedulePeriodic(_parent._timeSpan, Tick);
- var s = _parent._source.SubscribeSafe(this);
-
- return new CompositeDisposable(d, s);
- }
-
- private void Tick()
- {
- lock (_gate)
- {
- base._observer.OnNext(_list);
- _list = new List<TSource>();
- }
- }
-
- public void OnNext(TSource value)
- {
- lock (_gate)
- {
- _list.Add(value);
- }
- }
-
- public void OnError(Exception error)
- {
- lock (_gate)
- {
- _list.Clear();
-
- base._observer.OnError(error);
- base.Dispose();
- }
- }
-
- public void OnCompleted()
- {
- lock (_gate)
- {
- base._observer.OnNext(_list);
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
- }
-
- class μ : Sink<IList<TSource>>, IObserver<TSource>
- {
- private readonly Buffer<TSource> _parent;
-
- public μ(Buffer<TSource> parent, IObserver<IList<TSource>> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _parent = parent;
- }
-
- private object _gate;
- private IList<TSource> _s;
- private int _n;
- private int _windowId;
-
- private SerialDisposable _timerD;
-
- public IDisposable Run()
- {
- _gate = new object();
- _s = default(IList<TSource>);
- _n = 0;
- _windowId = 0;
-
- _timerD = new SerialDisposable();
-
- _s = new List<TSource>();
- CreateTimer(0);
-
- var subscription = _parent._source.SubscribeSafe(this);
-
- return new CompositeDisposable { _timerD, subscription };
- }
-
- private void CreateTimer(int id)
- {
- var m = new SingleAssignmentDisposable();
- _timerD.Disposable = m;
-
- m.Disposable = _parent._scheduler.Schedule(id, _parent._timeSpan, Tick);
- }
-
- private IDisposable Tick(IScheduler self, int id)
- {
- var d = Disposable.Empty;
-
- var newId = 0;
- lock (_gate)
- {
- if (id != _windowId)
- return d;
-
- _n = 0;
- newId = ++_windowId;
-
- var res = _s;
- _s = new List<TSource>();
- base._observer.OnNext(res);
- }
-
- CreateTimer(newId);
-
- return d;
- }
-
- public void OnNext(TSource value)
- {
- var newWindow = false;
- var newId = 0;
-
- lock (_gate)
- {
- _s.Add(value);
-
- _n++;
- if (_n == _parent._count)
- {
- newWindow = true;
- _n = 0;
- newId = ++_windowId;
-
- var res = _s;
- _s = new List<TSource>();
- base._observer.OnNext(res);
- }
- }
-
- if (newWindow)
- CreateTimer(newId);
- }
-
- public void OnError(Exception error)
- {
- lock (_gate)
- {
- _s.Clear();
- base._observer.OnError(error);
- base.Dispose();
- }
- }
-
- public void OnCompleted()
- {
- lock (_gate)
- {
- base._observer.OnNext(_s);
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
- }
- }
-
- class Buffer<TSource, TBufferClosing> : Producer<IList<TSource>>
- {
- private readonly IObservable<TSource> _source;
- private readonly Func<IObservable<TBufferClosing>> _bufferClosingSelector;
- private readonly IObservable<TBufferClosing> _bufferBoundaries;
-
- public Buffer(IObservable<TSource> source, Func<IObservable<TBufferClosing>> bufferClosingSelector)
- {
- _source = source;
- _bufferClosingSelector = bufferClosingSelector;
- }
-
- public Buffer(IObservable<TSource> source, IObservable<TBufferClosing> bufferBoundaries)
- {
- _source = source;
- _bufferBoundaries = bufferBoundaries;
- }
-
- protected override IDisposable Run(IObserver<IList<TSource>> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- if (_bufferClosingSelector != null)
- {
- var sink = new _(this, observer, cancel);
- setSink(sink);
- return sink.Run();
- }
- else
- {
- var sink = new β(this, observer, cancel);
- setSink(sink);
- return sink.Run();
- }
- }
-
- class _ : Sink<IList<TSource>>, IObserver<TSource>
- {
- private readonly Buffer<TSource, TBufferClosing> _parent;
-
- public _(Buffer<TSource, TBufferClosing> parent, IObserver<IList<TSource>> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _parent = parent;
- }
-
- private IList<TSource> _buffer;
- private object _gate;
- private AsyncLock _bufferGate;
-
- private SerialDisposable _m;
-
- public IDisposable Run()
- {
- _buffer = new List<TSource>();
- _gate = new object();
- _bufferGate = new AsyncLock();
-
- _m = new SerialDisposable();
- var groupDisposable = new CompositeDisposable(2) { _m };
-
- groupDisposable.Add(_parent._source.SubscribeSafe(this));
-
- _bufferGate.Wait(CreateBufferClose);
-
- return groupDisposable;
- }
-
- private void CreateBufferClose()
- {
- var bufferClose = default(IObservable<TBufferClosing>);
- try
- {
- bufferClose = _parent._bufferClosingSelector();
- }
- catch (Exception exception)
- {
- lock (_gate)
- {
- base._observer.OnError(exception);
- base.Dispose();
- }
- return;
- }
-
- var closingSubscription = new SingleAssignmentDisposable();
- _m.Disposable = closingSubscription;
- closingSubscription.Disposable = bufferClose.SubscribeSafe(new ω(this, closingSubscription));
- }
-
- private void CloseBuffer(IDisposable closingSubscription)
- {
- closingSubscription.Dispose();
-
- lock (_gate)
- {
- var res = _buffer;
- _buffer = new List<TSource>();
- base._observer.OnNext(res);
- }
-
- _bufferGate.Wait(CreateBufferClose);
- }
-
- class ω : IObserver<TBufferClosing>
- {
- private readonly _ _parent;
- private readonly IDisposable _self;
-
- public ω(_ parent, IDisposable self)
- {
- _parent = parent;
- _self = self;
- }
-
- public void OnNext(TBufferClosing value)
- {
- _parent.CloseBuffer(_self);
- }
-
- public void OnError(Exception error)
- {
- _parent.OnError(error);
- }
-
- public void OnCompleted()
- {
- _parent.CloseBuffer(_self);
- }
- }
-
- public void OnNext(TSource value)
- {
- lock (_gate)
- {
- _buffer.Add(value);
- }
- }
-
- public void OnError(Exception error)
- {
- lock (_gate)
- {
- _buffer.Clear();
- base._observer.OnError(error);
- base.Dispose();
- }
- }
-
- public void OnCompleted()
- {
- lock (_gate)
- {
- base._observer.OnNext(_buffer);
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
- }
-
- class β : Sink<IList<TSource>>, IObserver<TSource>
- {
- private readonly Buffer<TSource, TBufferClosing> _parent;
-
- public β(Buffer<TSource, TBufferClosing> parent, IObserver<IList<TSource>> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _parent = parent;
- }
-
- private IList<TSource> _buffer;
- private object _gate;
-
- private RefCountDisposable _refCountDisposable;
-
- public IDisposable Run()
- {
- _buffer = new List<TSource>();
- _gate = new object();
-
- var d = new CompositeDisposable(2);
- _refCountDisposable = new RefCountDisposable(d);
-
- d.Add(_parent._source.SubscribeSafe(this));
- d.Add(_parent._bufferBoundaries.SubscribeSafe(new ω(this)));
-
- return _refCountDisposable;
- }
-
- class ω : IObserver<TBufferClosing>
- {
- private readonly β _parent;
-
- public ω(β parent)
- {
- _parent = parent;
- }
-
- public void OnNext(TBufferClosing value)
- {
- lock (_parent._gate)
- {
- var res = _parent._buffer;
- _parent._buffer = new List<TSource>();
- _parent._observer.OnNext(res);
- }
- }
-
- public void OnError(Exception error)
- {
- _parent.OnError(error);
- }
-
- public void OnCompleted()
- {
- _parent.OnCompleted();
- }
- }
-
- public void OnNext(TSource value)
- {
- lock (_gate)
- {
- _buffer.Add(value);
- }
- }
-
- public void OnError(Exception error)
- {
- lock (_gate)
- {
- _buffer.Clear();
- base._observer.OnError(error);
- base.Dispose();
- }
- }
-
- public void OnCompleted()
- {
- lock (_gate)
- {
- base._observer.OnNext(_buffer);
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Case.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Case.cs
deleted file mode 100644
index b104050..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Case.cs
+++ /dev/null
@@ -1,85 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_PERF
-using System;
-using System.Collections.Generic;
-using System.Reactive.Disposables;
-
-namespace System.Reactive.Linq.Observαble
-{
- class Case<TValue, TResult> : Producer<TResult>, IEvaluatableObservable<TResult>
- {
- private readonly Func<TValue> _selector;
- private readonly IDictionary<TValue, IObservable<TResult>> _sources;
- private readonly IObservable<TResult> _defaultSource;
-
- public Case(Func<TValue> selector, IDictionary<TValue, IObservable<TResult>> sources, IObservable<TResult> defaultSource)
- {
- _selector = selector;
- _sources = sources;
- _defaultSource = defaultSource;
- }
-
- public IObservable<TResult> Eval()
- {
- var res = default(IObservable<TResult>);
- if (_sources.TryGetValue(_selector(), out res))
- return res;
-
- return _defaultSource;
- }
-
- protected override IDisposable Run(IObserver<TResult> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(this, observer, cancel);
- setSink(sink);
- return sink.Run();
- }
-
- class _ : Sink<TResult>, IObserver<TResult>
- {
- private readonly Case<TValue, TResult> _parent;
-
- public _(Case<TValue, TResult> parent, IObserver<TResult> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _parent = parent;
- }
-
- public IDisposable Run()
- {
- var result = default(IObservable<TResult>);
- try
- {
- result = _parent.Eval();
- }
- catch (Exception exception)
- {
- base._observer.OnError(exception);
- base.Dispose();
- return Disposable.Empty;
- }
-
- return result.SubscribeSafe(this);
- }
-
- public void OnNext(TResult value)
- {
- base._observer.OnNext(value);
- }
-
- public void OnError(Exception error)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
-
- public void OnCompleted()
- {
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
- }
-}
-#endif
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Cast.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Cast.cs
deleted file mode 100644
index 48820b3..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Cast.cs
+++ /dev/null
@@ -1,62 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_PERF
-using System;
-
-namespace System.Reactive.Linq.Observαble
-{
- class Cast<TSource, TResult> : Producer<TResult> /* Could optimize further by deriving from Select<TResult> and providing Ω<TResult2>. We're not doing this (yet) for debuggability. */
- {
- private readonly IObservable<TSource> _source;
-
- public Cast(IObservable<TSource> source)
- {
- _source = source;
- }
-
- protected override IDisposable Run(IObserver<TResult> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(observer, cancel);
- setSink(sink);
- return _source.SubscribeSafe(sink);
- }
-
- class _ : Sink<TResult>, IObserver<TSource>
- {
- public _(IObserver<TResult> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- }
-
- public void OnNext(TSource value)
- {
- var result = default(TResult);
- try
- {
- result = (TResult)(object)value;
- }
- catch (Exception exception)
- {
- base._observer.OnError(exception);
- base.Dispose();
- return;
- }
-
- base._observer.OnNext(result);
- }
-
- public void OnError(Exception error)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
-
- public void OnCompleted()
- {
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Catch.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Catch.cs
deleted file mode 100644
index 71e0037..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Catch.cs
+++ /dev/null
@@ -1,183 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_PERF
-using System;
-using System.Collections.Generic;
-using System.Reactive.Concurrency;
-using System.Reactive.Disposables;
-
-namespace System.Reactive.Linq.Observαble
-{
- class Catch<TSource> : Producer<TSource>
- {
- private readonly IEnumerable<IObservable<TSource>> _sources;
-
- public Catch(IEnumerable<IObservable<TSource>> sources)
- {
- _sources = sources;
- }
-
- protected override IDisposable Run(IObserver<TSource> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(observer, cancel);
- setSink(sink);
- return sink.Run(_sources);
- }
-
- class _ : TailRecursiveSink<TSource>
- {
- public _(IObserver<TSource> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- }
-
- protected override IEnumerable<IObservable<TSource>> Extract(IObservable<TSource> source)
- {
- var @catch = source as Catch<TSource>;
- if (@catch != null)
- return @catch._sources;
-
- return null;
- }
-
- public override void OnNext(TSource value)
- {
- base._observer.OnNext(value);
- }
-
- private Exception _lastException;
-
- public override void OnError(Exception error)
- {
- _lastException = error;
- _recurse();
- }
-
- public override void OnCompleted()
- {
- base._observer.OnCompleted();
- base.Dispose();
- }
-
- protected override void Done()
- {
- if (_lastException != null)
- base._observer.OnError(_lastException);
- else
- base._observer.OnCompleted();
-
- base.Dispose();
- }
- }
- }
-
- class Catch<TSource, TException> : Producer<TSource> where TException : Exception
- {
- private readonly IObservable<TSource> _source;
- private readonly Func<TException, IObservable<TSource>> _handler;
-
- public Catch(IObservable<TSource> source, Func<TException, IObservable<TSource>> handler)
- {
- _source = source;
- _handler = handler;
- }
-
- protected override IDisposable Run(IObserver<TSource> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(this, observer, cancel);
- setSink(sink);
- return sink.Run();
- }
-
- class _ : Sink<TSource>, IObserver<TSource>
- {
- private readonly Catch<TSource, TException> _parent;
-
- public _(Catch<TSource, TException> parent, IObserver<TSource> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _parent = parent;
- }
-
- private SerialDisposable _subscription;
-
- public IDisposable Run()
- {
- _subscription = new SerialDisposable();
-
- var d1 = new SingleAssignmentDisposable();
- _subscription.Disposable = d1;
- d1.Disposable = _parent._source.SubscribeSafe(this);
-
- return _subscription;
- }
-
- public void OnNext(TSource value)
- {
- base._observer.OnNext(value);
- }
-
- public void OnError(Exception error)
- {
- var e = error as TException;
- if (e != null)
- {
- var result = default(IObservable<TSource>);
- try
- {
- result = _parent._handler(e);
- }
- catch (Exception ex)
- {
- base._observer.OnError(ex);
- base.Dispose();
- return;
- }
-
- var d = new SingleAssignmentDisposable();
- _subscription.Disposable = d;
- d.Disposable = result.SubscribeSafe(new ε(this));
- }
- else
- {
- base._observer.OnError(error);
- base.Dispose();
- }
- }
-
- public void OnCompleted()
- {
- base._observer.OnCompleted();
- base.Dispose();
- }
-
- class ε : IObserver<TSource>
- {
- private readonly _ _parent;
-
- public ε(_ parent)
- {
- _parent = parent;
- }
-
- public void OnNext(TSource value)
- {
- _parent._observer.OnNext(value);
- }
-
- public void OnError(Exception error)
- {
- _parent._observer.OnError(error);
- _parent.Dispose();
- }
-
- public void OnCompleted()
- {
- _parent._observer.OnCompleted();
- _parent.Dispose();
- }
- }
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Collect.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Collect.cs
deleted file mode 100644
index 2cfd240..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Collect.cs
+++ /dev/null
@@ -1,139 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_PERF
-using System;
-using System.Collections.Generic;
-using System.Reactive;
-using System.Reactive.Threading;
-using System.Threading;
-
-namespace System.Reactive.Linq.Observαble
-{
- class Collect<TSource, TResult> : PushToPullAdapter<TSource, TResult>
- {
- private readonly Func<TResult> _getInitialCollector;
- private readonly Func<TResult, TSource, TResult> _merge;
- private readonly Func<TResult, TResult> _getNewCollector;
-
- public Collect(IObservable<TSource> source, Func<TResult> getInitialCollector, Func<TResult, TSource, TResult> merge, Func<TResult, TResult> getNewCollector)
- : base(source)
- {
- _getInitialCollector = getInitialCollector;
- _merge = merge;
- _getNewCollector = getNewCollector;
- }
-
- protected override PushToPullSink<TSource, TResult> Run(IDisposable subscription)
- {
- var sink = new _(this, subscription);
- sink.Initialize();
- return sink;
- }
-
- class _ : PushToPullSink<TSource, TResult>
- {
- private readonly Collect<TSource, TResult> _parent;
-
- public _(Collect<TSource, TResult> parent, IDisposable subscription)
- : base(subscription)
- {
- _parent = parent;
- }
-
- private object _gate;
- private TResult _collector;
- private bool _hasFailed;
- private Exception _error;
- private bool _hasCompleted;
- private bool _done;
-
- public void Initialize()
- {
- _gate = new object();
- _collector = _parent._getInitialCollector();
- }
-
- public override void OnNext(TSource value)
- {
- lock (_gate)
- {
- try
- {
- _collector = _parent._merge(_collector, value);
- }
- catch (Exception ex)
- {
- _error = ex;
- _hasFailed = true;
-
- base.Dispose();
- }
- }
- }
-
- public override void OnError(Exception error)
- {
- base.Dispose();
-
- lock (_gate)
- {
- _error = error;
- _hasFailed = true;
- }
- }
-
- public override void OnCompleted()
- {
- base.Dispose();
-
- lock (_gate)
- {
- _hasCompleted = true;
- }
- }
-
- public override bool TryMoveNext(out TResult current)
- {
- lock (_gate)
- {
- if (_hasFailed)
- {
- current = default(TResult);
- _error.Throw();
- }
- else
- {
- if (_hasCompleted)
- {
- if (_done)
- {
- current = default(TResult);
- return false;
- }
-
- current = _collector;
- _done = true;
- }
- else
- {
- current = _collector;
-
- try
- {
- _collector = _parent._getNewCollector(current);
- }
- catch
- {
- base.Dispose();
- throw;
- }
- }
- }
-
- return true;
- }
- }
- }
- }
-}
-#endif
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/CombineLatest.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/CombineLatest.cs
deleted file mode 100644
index 2188307..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/CombineLatest.cs
+++ /dev/null
@@ -1,1863 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_PERF
-using System;
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-using System.Linq;
-using System.Reactive.Disposables;
-
-namespace System.Reactive.Linq.Observαble
-{
- #region Binary
-
- class CombineLatest<TFirst, TSecond, TResult> : Producer<TResult>
- {
- private readonly IObservable<TFirst> _first;
- private readonly IObservable<TSecond> _second;
- private readonly Func<TFirst, TSecond, TResult> _resultSelector;
-
- public CombineLatest(IObservable<TFirst> first, IObservable<TSecond> second, Func<TFirst, TSecond, TResult> resultSelector)
- {
- _first = first;
- _second = second;
- _resultSelector = resultSelector;
- }
-
- protected override IDisposable Run(IObserver<TResult> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(this, observer, cancel);
- setSink(sink);
- return sink.Run();
- }
-
- class _ : Sink<TResult>
- {
- private readonly CombineLatest<TFirst, TSecond, TResult> _parent;
-
- public _(CombineLatest<TFirst, TSecond, TResult> parent, IObserver<TResult> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _parent = parent;
- }
-
- private object _gate;
-
- public IDisposable Run()
- {
- _gate = new object();
-
- var fstSubscription = new SingleAssignmentDisposable();
- var sndSubscription = new SingleAssignmentDisposable();
-
- var fstO = new F(this, fstSubscription);
- var sndO = new S(this, sndSubscription);
-
- fstO.Other = sndO;
- sndO.Other = fstO;
-
- fstSubscription.Disposable = _parent._first.SubscribeSafe(fstO);
- sndSubscription.Disposable = _parent._second.SubscribeSafe(sndO);
-
- return new CompositeDisposable(fstSubscription, sndSubscription);
- }
-
- class F : IObserver<TFirst>
- {
- private readonly _ _parent;
- private readonly IDisposable _self;
- private S _other;
-
- public F(_ parent, IDisposable self)
- {
- _parent = parent;
- _self = self;
- }
-
- public S Other { set { _other = value; } }
-
- public bool HasValue { get; private set; }
- public TFirst Value { get; private set; }
- public bool Done { get; private set; }
-
- public void OnNext(TFirst value)
- {
- lock (_parent._gate)
- {
- HasValue = true;
- Value = value;
-
- if (_other.HasValue)
- {
- var res = default(TResult);
- try
- {
- res = _parent._parent._resultSelector(value, _other.Value);
- }
- catch (Exception ex)
- {
- _parent._observer.OnError(ex);
- _parent.Dispose();
- return;
- }
-
- _parent._observer.OnNext(res);
- }
- else if (_other.Done)
- {
- _parent._observer.OnCompleted();
- _parent.Dispose();
- return;
- }
- }
- }
-
- public void OnError(Exception error)
- {
- lock (_parent._gate)
- {
- _parent._observer.OnError(error);
- _parent.Dispose();
- }
- }
-
- public void OnCompleted()
- {
- lock (_parent._gate)
- {
- Done = true;
-
- if (_other.Done)
- {
- _parent._observer.OnCompleted();
- _parent.Dispose();
- return;
- }
- else
- {
- _self.Dispose();
- }
- }
- }
- }
-
- class S : IObserver<TSecond>
- {
- private readonly _ _parent;
- private readonly IDisposable _self;
- private F _other;
-
- public S(_ parent, IDisposable self)
- {
- _parent = parent;
- _self = self;
- }
-
- public F Other { set { _other = value; } }
-
- public bool HasValue { get; private set; }
- public TSecond Value { get; private set; }
- public bool Done { get; private set; }
-
- public void OnNext(TSecond value)
- {
- lock (_parent._gate)
- {
- HasValue = true;
- Value = value;
-
- if (_other.HasValue)
- {
- var res = default(TResult);
- try
- {
- res = _parent._parent._resultSelector(_other.Value, value);
- }
- catch (Exception ex)
- {
- _parent._observer.OnError(ex);
- _parent.Dispose();
- return;
- }
-
- _parent._observer.OnNext(res);
- }
- else if (_other.Done)
- {
- _parent._observer.OnCompleted();
- _parent.Dispose();
- return;
- }
- }
- }
-
- public void OnError(Exception error)
- {
- lock (_parent._gate)
- {
- _parent._observer.OnError(error);
- _parent.Dispose();
- }
- }
-
- public void OnCompleted()
- {
- lock (_parent._gate)
- {
- Done = true;
-
- if (_other.Done)
- {
- _parent._observer.OnCompleted();
- _parent.Dispose();
- return;
- }
- else
- {
- _self.Dispose();
- }
- }
- }
- }
- }
- }
-
- #endregion
-
- #region [3,16]-ary
-
- /* The following code is generated by a tool checked in to $/.../Source/Tools/CodeGenerators. */
-
- #region CombineLatest auto-generated code (6/10/2012 7:22:14 PM)
-
- class CombineLatest<T1, T2, T3, TResult> : Producer<TResult>
- {
- private readonly IObservable<T1> _source1;
- private readonly IObservable<T2> _source2;
- private readonly IObservable<T3> _source3;
- private readonly Func<T1, T2, T3, TResult> _resultSelector;
-
- public CombineLatest(IObservable<T1> source1, IObservable<T2> source2, IObservable<T3> source3, Func<T1, T2, T3, TResult> resultSelector)
- {
- _source1 = source1;
- _source2 = source2;
- _source3 = source3;
- _resultSelector = resultSelector;
- }
-
- protected override IDisposable Run(IObserver<TResult> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(this, observer, cancel);
- setSink(sink);
- return sink.Run();
- }
-
- class _ : CombineLatestSink<TResult>
- {
- private readonly CombineLatest<T1, T2, T3, TResult> _parent;
-
- public _(CombineLatest<T1, T2, T3, TResult> parent, IObserver<TResult> observer, IDisposable cancel)
- : base(3, observer, cancel)
- {
- _parent = parent;
- }
-
- private CombineLatestObserver<T1> _observer1;
- private CombineLatestObserver<T2> _observer2;
- private CombineLatestObserver<T3> _observer3;
-
- public IDisposable Run()
- {
- var subscriptions = new SingleAssignmentDisposable[3];
- for (int i = 0; i < 3; i++)
- subscriptions[i] = new SingleAssignmentDisposable();
-
- _observer1 = new CombineLatestObserver<T1>(_gate, this, 0, subscriptions[0]);
- _observer2 = new CombineLatestObserver<T2>(_gate, this, 1, subscriptions[1]);
- _observer3 = new CombineLatestObserver<T3>(_gate, this, 2, subscriptions[2]);
-
- subscriptions[0].Disposable = _parent._source1.SubscribeSafe(_observer1);
- subscriptions[1].Disposable = _parent._source2.SubscribeSafe(_observer2);
- subscriptions[2].Disposable = _parent._source3.SubscribeSafe(_observer3);
-
- return new CompositeDisposable(subscriptions);
- }
-
- protected override TResult GetResult()
- {
- return _parent._resultSelector(_observer1.Value, _observer2.Value, _observer3.Value);
- }
- }
- }
-
- class CombineLatest<T1, T2, T3, T4, TResult> : Producer<TResult>
- {
- private readonly IObservable<T1> _source1;
- private readonly IObservable<T2> _source2;
- private readonly IObservable<T3> _source3;
- private readonly IObservable<T4> _source4;
- private readonly Func<T1, T2, T3, T4, TResult> _resultSelector;
-
- public CombineLatest(IObservable<T1> source1, IObservable<T2> source2, IObservable<T3> source3, IObservable<T4> source4, Func<T1, T2, T3, T4, TResult> resultSelector)
- {
- _source1 = source1;
- _source2 = source2;
- _source3 = source3;
- _source4 = source4;
- _resultSelector = resultSelector;
- }
-
- protected override IDisposable Run(IObserver<TResult> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(this, observer, cancel);
- setSink(sink);
- return sink.Run();
- }
-
- class _ : CombineLatestSink<TResult>
- {
- private readonly CombineLatest<T1, T2, T3, T4, TResult> _parent;
-
- public _(CombineLatest<T1, T2, T3, T4, TResult> parent, IObserver<TResult> observer, IDisposable cancel)
- : base(4, observer, cancel)
- {
- _parent = parent;
- }
-
- private CombineLatestObserver<T1> _observer1;
- private CombineLatestObserver<T2> _observer2;
- private CombineLatestObserver<T3> _observer3;
- private CombineLatestObserver<T4> _observer4;
-
- public IDisposable Run()
- {
- var subscriptions = new SingleAssignmentDisposable[4];
- for (int i = 0; i < 4; i++)
- subscriptions[i] = new SingleAssignmentDisposable();
-
- _observer1 = new CombineLatestObserver<T1>(_gate, this, 0, subscriptions[0]);
- _observer2 = new CombineLatestObserver<T2>(_gate, this, 1, subscriptions[1]);
- _observer3 = new CombineLatestObserver<T3>(_gate, this, 2, subscriptions[2]);
- _observer4 = new CombineLatestObserver<T4>(_gate, this, 3, subscriptions[3]);
-
- subscriptions[0].Disposable = _parent._source1.SubscribeSafe(_observer1);
- subscriptions[1].Disposable = _parent._source2.SubscribeSafe(_observer2);
- subscriptions[2].Disposable = _parent._source3.SubscribeSafe(_observer3);
- subscriptions[3].Disposable = _parent._source4.SubscribeSafe(_observer4);
-
- return new CompositeDisposable(subscriptions);
- }
-
- protected override TResult GetResult()
- {
- return _parent._resultSelector(_observer1.Value, _observer2.Value, _observer3.Value, _observer4.Value);
- }
- }
- }
-
-#if !NO_LARGEARITY
-
- class CombineLatest<T1, T2, T3, T4, T5, TResult> : Producer<TResult>
- {
- private readonly IObservable<T1> _source1;
- private readonly IObservable<T2> _source2;
- private readonly IObservable<T3> _source3;
- private readonly IObservable<T4> _source4;
- private readonly IObservable<T5> _source5;
- private readonly Func<T1, T2, T3, T4, T5, TResult> _resultSelector;
-
- public CombineLatest(IObservable<T1> source1, IObservable<T2> source2, IObservable<T3> source3, IObservable<T4> source4, IObservable<T5> source5, Func<T1, T2, T3, T4, T5, TResult> resultSelector)
- {
- _source1 = source1;
- _source2 = source2;
- _source3 = source3;
- _source4 = source4;
- _source5 = source5;
- _resultSelector = resultSelector;
- }
-
- protected override IDisposable Run(IObserver<TResult> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(this, observer, cancel);
- setSink(sink);
- return sink.Run();
- }
-
- class _ : CombineLatestSink<TResult>
- {
- private readonly CombineLatest<T1, T2, T3, T4, T5, TResult> _parent;
-
- public _(CombineLatest<T1, T2, T3, T4, T5, TResult> parent, IObserver<TResult> observer, IDisposable cancel)
- : base(5, observer, cancel)
- {
- _parent = parent;
- }
-
- private CombineLatestObserver<T1> _observer1;
- private CombineLatestObserver<T2> _observer2;
- private CombineLatestObserver<T3> _observer3;
- private CombineLatestObserver<T4> _observer4;
- private CombineLatestObserver<T5> _observer5;
-
- public IDisposable Run()
- {
- var subscriptions = new SingleAssignmentDisposable[5];
- for (int i = 0; i < 5; i++)
- subscriptions[i] = new SingleAssignmentDisposable();
-
- _observer1 = new CombineLatestObserver<T1>(_gate, this, 0, subscriptions[0]);
- _observer2 = new CombineLatestObserver<T2>(_gate, this, 1, subscriptions[1]);
- _observer3 = new CombineLatestObserver<T3>(_gate, this, 2, subscriptions[2]);
- _observer4 = new CombineLatestObserver<T4>(_gate, this, 3, subscriptions[3]);
- _observer5 = new CombineLatestObserver<T5>(_gate, this, 4, subscriptions[4]);
-
- subscriptions[0].Disposable = _parent._source1.SubscribeSafe(_observer1);
- subscriptions[1].Disposable = _parent._source2.SubscribeSafe(_observer2);
- subscriptions[2].Disposable = _parent._source3.SubscribeSafe(_observer3);
- subscriptions[3].Disposable = _parent._source4.SubscribeSafe(_observer4);
- subscriptions[4].Disposable = _parent._source5.SubscribeSafe(_observer5);
-
- return new CompositeDisposable(subscriptions);
- }
-
- protected override TResult GetResult()
- {
- return _parent._resultSelector(_observer1.Value, _observer2.Value, _observer3.Value, _observer4.Value, _observer5.Value);
- }
- }
- }
-
- class CombineLatest<T1, T2, T3, T4, T5, T6, TResult> : Producer<TResult>
- {
- private readonly IObservable<T1> _source1;
- private readonly IObservable<T2> _source2;
- private readonly IObservable<T3> _source3;
- private readonly IObservable<T4> _source4;
- private readonly IObservable<T5> _source5;
- private readonly IObservable<T6> _source6;
- private readonly Func<T1, T2, T3, T4, T5, T6, TResult> _resultSelector;
-
- public CombineLatest(IObservable<T1> source1, IObservable<T2> source2, IObservable<T3> source3, IObservable<T4> source4, IObservable<T5> source5, IObservable<T6> source6, Func<T1, T2, T3, T4, T5, T6, TResult> resultSelector)
- {
- _source1 = source1;
- _source2 = source2;
- _source3 = source3;
- _source4 = source4;
- _source5 = source5;
- _source6 = source6;
- _resultSelector = resultSelector;
- }
-
- protected override IDisposable Run(IObserver<TResult> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(this, observer, cancel);
- setSink(sink);
- return sink.Run();
- }
-
- class _ : CombineLatestSink<TResult>
- {
- private readonly CombineLatest<T1, T2, T3, T4, T5, T6, TResult> _parent;
-
- public _(CombineLatest<T1, T2, T3, T4, T5, T6, TResult> parent, IObserver<TResult> observer, IDisposable cancel)
- : base(6, observer, cancel)
- {
- _parent = parent;
- }
-
- private CombineLatestObserver<T1> _observer1;
- private CombineLatestObserver<T2> _observer2;
- private CombineLatestObserver<T3> _observer3;
- private CombineLatestObserver<T4> _observer4;
- private CombineLatestObserver<T5> _observer5;
- private CombineLatestObserver<T6> _observer6;
-
- public IDisposable Run()
- {
- var subscriptions = new SingleAssignmentDisposable[6];
- for (int i = 0; i < 6; i++)
- subscriptions[i] = new SingleAssignmentDisposable();
-
- _observer1 = new CombineLatestObserver<T1>(_gate, this, 0, subscriptions[0]);
- _observer2 = new CombineLatestObserver<T2>(_gate, this, 1, subscriptions[1]);
- _observer3 = new CombineLatestObserver<T3>(_gate, this, 2, subscriptions[2]);
- _observer4 = new CombineLatestObserver<T4>(_gate, this, 3, subscriptions[3]);
- _observer5 = new CombineLatestObserver<T5>(_gate, this, 4, subscriptions[4]);
- _observer6 = new CombineLatestObserver<T6>(_gate, this, 5, subscriptions[5]);
-
- subscriptions[0].Disposable = _parent._source1.SubscribeSafe(_observer1);
- subscriptions[1].Disposable = _parent._source2.SubscribeSafe(_observer2);
- subscriptions[2].Disposable = _parent._source3.SubscribeSafe(_observer3);
- subscriptions[3].Disposable = _parent._source4.SubscribeSafe(_observer4);
- subscriptions[4].Disposable = _parent._source5.SubscribeSafe(_observer5);
- subscriptions[5].Disposable = _parent._source6.SubscribeSafe(_observer6);
-
- return new CompositeDisposable(subscriptions);
- }
-
- protected override TResult GetResult()
- {
- return _parent._resultSelector(_observer1.Value, _observer2.Value, _observer3.Value, _observer4.Value, _observer5.Value, _observer6.Value);
- }
- }
- }
-
- class CombineLatest<T1, T2, T3, T4, T5, T6, T7, TResult> : Producer<TResult>
- {
- private readonly IObservable<T1> _source1;
- private readonly IObservable<T2> _source2;
- private readonly IObservable<T3> _source3;
- private readonly IObservable<T4> _source4;
- private readonly IObservable<T5> _source5;
- private readonly IObservable<T6> _source6;
- private readonly IObservable<T7> _source7;
- private readonly Func<T1, T2, T3, T4, T5, T6, T7, TResult> _resultSelector;
-
- public CombineLatest(IObservable<T1> source1, IObservable<T2> source2, IObservable<T3> source3, IObservable<T4> source4, IObservable<T5> source5, IObservable<T6> source6, IObservable<T7> source7, Func<T1, T2, T3, T4, T5, T6, T7, TResult> resultSelector)
- {
- _source1 = source1;
- _source2 = source2;
- _source3 = source3;
- _source4 = source4;
- _source5 = source5;
- _source6 = source6;
- _source7 = source7;
- _resultSelector = resultSelector;
- }
-
- protected override IDisposable Run(IObserver<TResult> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(this, observer, cancel);
- setSink(sink);
- return sink.Run();
- }
-
- class _ : CombineLatestSink<TResult>
- {
- private readonly CombineLatest<T1, T2, T3, T4, T5, T6, T7, TResult> _parent;
-
- public _(CombineLatest<T1, T2, T3, T4, T5, T6, T7, TResult> parent, IObserver<TResult> observer, IDisposable cancel)
- : base(7, observer, cancel)
- {
- _parent = parent;
- }
-
- private CombineLatestObserver<T1> _observer1;
- private CombineLatestObserver<T2> _observer2;
- private CombineLatestObserver<T3> _observer3;
- private CombineLatestObserver<T4> _observer4;
- private CombineLatestObserver<T5> _observer5;
- private CombineLatestObserver<T6> _observer6;
- private CombineLatestObserver<T7> _observer7;
-
- public IDisposable Run()
- {
- var subscriptions = new SingleAssignmentDisposable[7];
- for (int i = 0; i < 7; i++)
- subscriptions[i] = new SingleAssignmentDisposable();
-
- _observer1 = new CombineLatestObserver<T1>(_gate, this, 0, subscriptions[0]);
- _observer2 = new CombineLatestObserver<T2>(_gate, this, 1, subscriptions[1]);
- _observer3 = new CombineLatestObserver<T3>(_gate, this, 2, subscriptions[2]);
- _observer4 = new CombineLatestObserver<T4>(_gate, this, 3, subscriptions[3]);
- _observer5 = new CombineLatestObserver<T5>(_gate, this, 4, subscriptions[4]);
- _observer6 = new CombineLatestObserver<T6>(_gate, this, 5, subscriptions[5]);
- _observer7 = new CombineLatestObserver<T7>(_gate, this, 6, subscriptions[6]);
-
- subscriptions[0].Disposable = _parent._source1.SubscribeSafe(_observer1);
- subscriptions[1].Disposable = _parent._source2.SubscribeSafe(_observer2);
- subscriptions[2].Disposable = _parent._source3.SubscribeSafe(_observer3);
- subscriptions[3].Disposable = _parent._source4.SubscribeSafe(_observer4);
- subscriptions[4].Disposable = _parent._source5.SubscribeSafe(_observer5);
- subscriptions[5].Disposable = _parent._source6.SubscribeSafe(_observer6);
- subscriptions[6].Disposable = _parent._source7.SubscribeSafe(_observer7);
-
- return new CompositeDisposable(subscriptions);
- }
-
- protected override TResult GetResult()
- {
- return _parent._resultSelector(_observer1.Value, _observer2.Value, _observer3.Value, _observer4.Value, _observer5.Value, _observer6.Value, _observer7.Value);
- }
- }
- }
-
- class CombineLatest<T1, T2, T3, T4, T5, T6, T7, T8, TResult> : Producer<TResult>
- {
- private readonly IObservable<T1> _source1;
- private readonly IObservable<T2> _source2;
- private readonly IObservable<T3> _source3;
- private readonly IObservable<T4> _source4;
- private readonly IObservable<T5> _source5;
- private readonly IObservable<T6> _source6;
- private readonly IObservable<T7> _source7;
- private readonly IObservable<T8> _source8;
- private readonly Func<T1, T2, T3, T4, T5, T6, T7, T8, TResult> _resultSelector;
-
- public CombineLatest(IObservable<T1> source1, IObservable<T2> source2, IObservable<T3> source3, IObservable<T4> source4, IObservable<T5> source5, IObservable<T6> source6, IObservable<T7> source7, IObservable<T8> source8, Func<T1, T2, T3, T4, T5, T6, T7, T8, TResult> resultSelector)
- {
- _source1 = source1;
- _source2 = source2;
- _source3 = source3;
- _source4 = source4;
- _source5 = source5;
- _source6 = source6;
- _source7 = source7;
- _source8 = source8;
- _resultSelector = resultSelector;
- }
-
- protected override IDisposable Run(IObserver<TResult> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(this, observer, cancel);
- setSink(sink);
- return sink.Run();
- }
-
- class _ : CombineLatestSink<TResult>
- {
- private readonly CombineLatest<T1, T2, T3, T4, T5, T6, T7, T8, TResult> _parent;
-
- public _(CombineLatest<T1, T2, T3, T4, T5, T6, T7, T8, TResult> parent, IObserver<TResult> observer, IDisposable cancel)
- : base(8, observer, cancel)
- {
- _parent = parent;
- }
-
- private CombineLatestObserver<T1> _observer1;
- private CombineLatestObserver<T2> _observer2;
- private CombineLatestObserver<T3> _observer3;
- private CombineLatestObserver<T4> _observer4;
- private CombineLatestObserver<T5> _observer5;
- private CombineLatestObserver<T6> _observer6;
- private CombineLatestObserver<T7> _observer7;
- private CombineLatestObserver<T8> _observer8;
-
- public IDisposable Run()
- {
- var subscriptions = new SingleAssignmentDisposable[8];
- for (int i = 0; i < 8; i++)
- subscriptions[i] = new SingleAssignmentDisposable();
-
- _observer1 = new CombineLatestObserver<T1>(_gate, this, 0, subscriptions[0]);
- _observer2 = new CombineLatestObserver<T2>(_gate, this, 1, subscriptions[1]);
- _observer3 = new CombineLatestObserver<T3>(_gate, this, 2, subscriptions[2]);
- _observer4 = new CombineLatestObserver<T4>(_gate, this, 3, subscriptions[3]);
- _observer5 = new CombineLatestObserver<T5>(_gate, this, 4, subscriptions[4]);
- _observer6 = new CombineLatestObserver<T6>(_gate, this, 5, subscriptions[5]);
- _observer7 = new CombineLatestObserver<T7>(_gate, this, 6, subscriptions[6]);
- _observer8 = new CombineLatestObserver<T8>(_gate, this, 7, subscriptions[7]);
-
- subscriptions[0].Disposable = _parent._source1.SubscribeSafe(_observer1);
- subscriptions[1].Disposable = _parent._source2.SubscribeSafe(_observer2);
- subscriptions[2].Disposable = _parent._source3.SubscribeSafe(_observer3);
- subscriptions[3].Disposable = _parent._source4.SubscribeSafe(_observer4);
- subscriptions[4].Disposable = _parent._source5.SubscribeSafe(_observer5);
- subscriptions[5].Disposable = _parent._source6.SubscribeSafe(_observer6);
- subscriptions[6].Disposable = _parent._source7.SubscribeSafe(_observer7);
- subscriptions[7].Disposable = _parent._source8.SubscribeSafe(_observer8);
-
- return new CompositeDisposable(subscriptions);
- }
-
- protected override TResult GetResult()
- {
- return _parent._resultSelector(_observer1.Value, _observer2.Value, _observer3.Value, _observer4.Value, _observer5.Value, _observer6.Value, _observer7.Value, _observer8.Value);
- }
- }
- }
-
- class CombineLatest<T1, T2, T3, T4, T5, T6, T7, T8, T9, TResult> : Producer<TResult>
- {
- private readonly IObservable<T1> _source1;
- private readonly IObservable<T2> _source2;
- private readonly IObservable<T3> _source3;
- private readonly IObservable<T4> _source4;
- private readonly IObservable<T5> _source5;
- private readonly IObservable<T6> _source6;
- private readonly IObservable<T7> _source7;
- private readonly IObservable<T8> _source8;
- private readonly IObservable<T9> _source9;
- private readonly Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, TResult> _resultSelector;
-
- public CombineLatest(IObservable<T1> source1, IObservable<T2> source2, IObservable<T3> source3, IObservable<T4> source4, IObservable<T5> source5, IObservable<T6> source6, IObservable<T7> source7, IObservable<T8> source8, IObservable<T9> source9, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, TResult> resultSelector)
- {
- _source1 = source1;
- _source2 = source2;
- _source3 = source3;
- _source4 = source4;
- _source5 = source5;
- _source6 = source6;
- _source7 = source7;
- _source8 = source8;
- _source9 = source9;
- _resultSelector = resultSelector;
- }
-
- protected override IDisposable Run(IObserver<TResult> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(this, observer, cancel);
- setSink(sink);
- return sink.Run();
- }
-
- class _ : CombineLatestSink<TResult>
- {
- private readonly CombineLatest<T1, T2, T3, T4, T5, T6, T7, T8, T9, TResult> _parent;
-
- public _(CombineLatest<T1, T2, T3, T4, T5, T6, T7, T8, T9, TResult> parent, IObserver<TResult> observer, IDisposable cancel)
- : base(9, observer, cancel)
- {
- _parent = parent;
- }
-
- private CombineLatestObserver<T1> _observer1;
- private CombineLatestObserver<T2> _observer2;
- private CombineLatestObserver<T3> _observer3;
- private CombineLatestObserver<T4> _observer4;
- private CombineLatestObserver<T5> _observer5;
- private CombineLatestObserver<T6> _observer6;
- private CombineLatestObserver<T7> _observer7;
- private CombineLatestObserver<T8> _observer8;
- private CombineLatestObserver<T9> _observer9;
-
- public IDisposable Run()
- {
- var subscriptions = new SingleAssignmentDisposable[9];
- for (int i = 0; i < 9; i++)
- subscriptions[i] = new SingleAssignmentDisposable();
-
- _observer1 = new CombineLatestObserver<T1>(_gate, this, 0, subscriptions[0]);
- _observer2 = new CombineLatestObserver<T2>(_gate, this, 1, subscriptions[1]);
- _observer3 = new CombineLatestObserver<T3>(_gate, this, 2, subscriptions[2]);
- _observer4 = new CombineLatestObserver<T4>(_gate, this, 3, subscriptions[3]);
- _observer5 = new CombineLatestObserver<T5>(_gate, this, 4, subscriptions[4]);
- _observer6 = new CombineLatestObserver<T6>(_gate, this, 5, subscriptions[5]);
- _observer7 = new CombineLatestObserver<T7>(_gate, this, 6, subscriptions[6]);
- _observer8 = new CombineLatestObserver<T8>(_gate, this, 7, subscriptions[7]);
- _observer9 = new CombineLatestObserver<T9>(_gate, this, 8, subscriptions[8]);
-
- subscriptions[0].Disposable = _parent._source1.SubscribeSafe(_observer1);
- subscriptions[1].Disposable = _parent._source2.SubscribeSafe(_observer2);
- subscriptions[2].Disposable = _parent._source3.SubscribeSafe(_observer3);
- subscriptions[3].Disposable = _parent._source4.SubscribeSafe(_observer4);
- subscriptions[4].Disposable = _parent._source5.SubscribeSafe(_observer5);
- subscriptions[5].Disposable = _parent._source6.SubscribeSafe(_observer6);
- subscriptions[6].Disposable = _parent._source7.SubscribeSafe(_observer7);
- subscriptions[7].Disposable = _parent._source8.SubscribeSafe(_observer8);
- subscriptions[8].Disposable = _parent._source9.SubscribeSafe(_observer9);
-
- return new CompositeDisposable(subscriptions);
- }
-
- protected override TResult GetResult()
- {
- return _parent._resultSelector(_observer1.Value, _observer2.Value, _observer3.Value, _observer4.Value, _observer5.Value, _observer6.Value, _observer7.Value, _observer8.Value, _observer9.Value);
- }
- }
- }
-
- class CombineLatest<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, TResult> : Producer<TResult>
- {
- private readonly IObservable<T1> _source1;
- private readonly IObservable<T2> _source2;
- private readonly IObservable<T3> _source3;
- private readonly IObservable<T4> _source4;
- private readonly IObservable<T5> _source5;
- private readonly IObservable<T6> _source6;
- private readonly IObservable<T7> _source7;
- private readonly IObservable<T8> _source8;
- private readonly IObservable<T9> _source9;
- private readonly IObservable<T10> _source10;
- private readonly Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, TResult> _resultSelector;
-
- public CombineLatest(IObservable<T1> source1, IObservable<T2> source2, IObservable<T3> source3, IObservable<T4> source4, IObservable<T5> source5, IObservable<T6> source6, IObservable<T7> source7, IObservable<T8> source8, IObservable<T9> source9, IObservable<T10> source10, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, TResult> resultSelector)
- {
- _source1 = source1;
- _source2 = source2;
- _source3 = source3;
- _source4 = source4;
- _source5 = source5;
- _source6 = source6;
- _source7 = source7;
- _source8 = source8;
- _source9 = source9;
- _source10 = source10;
- _resultSelector = resultSelector;
- }
-
- protected override IDisposable Run(IObserver<TResult> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(this, observer, cancel);
- setSink(sink);
- return sink.Run();
- }
-
- class _ : CombineLatestSink<TResult>
- {
- private readonly CombineLatest<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, TResult> _parent;
-
- public _(CombineLatest<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, TResult> parent, IObserver<TResult> observer, IDisposable cancel)
- : base(10, observer, cancel)
- {
- _parent = parent;
- }
-
- private CombineLatestObserver<T1> _observer1;
- private CombineLatestObserver<T2> _observer2;
- private CombineLatestObserver<T3> _observer3;
- private CombineLatestObserver<T4> _observer4;
- private CombineLatestObserver<T5> _observer5;
- private CombineLatestObserver<T6> _observer6;
- private CombineLatestObserver<T7> _observer7;
- private CombineLatestObserver<T8> _observer8;
- private CombineLatestObserver<T9> _observer9;
- private CombineLatestObserver<T10> _observer10;
-
- public IDisposable Run()
- {
- var subscriptions = new SingleAssignmentDisposable[10];
- for (int i = 0; i < 10; i++)
- subscriptions[i] = new SingleAssignmentDisposable();
-
- _observer1 = new CombineLatestObserver<T1>(_gate, this, 0, subscriptions[0]);
- _observer2 = new CombineLatestObserver<T2>(_gate, this, 1, subscriptions[1]);
- _observer3 = new CombineLatestObserver<T3>(_gate, this, 2, subscriptions[2]);
- _observer4 = new CombineLatestObserver<T4>(_gate, this, 3, subscriptions[3]);
- _observer5 = new CombineLatestObserver<T5>(_gate, this, 4, subscriptions[4]);
- _observer6 = new CombineLatestObserver<T6>(_gate, this, 5, subscriptions[5]);
- _observer7 = new CombineLatestObserver<T7>(_gate, this, 6, subscriptions[6]);
- _observer8 = new CombineLatestObserver<T8>(_gate, this, 7, subscriptions[7]);
- _observer9 = new CombineLatestObserver<T9>(_gate, this, 8, subscriptions[8]);
- _observer10 = new CombineLatestObserver<T10>(_gate, this, 9, subscriptions[9]);
-
- subscriptions[0].Disposable = _parent._source1.SubscribeSafe(_observer1);
- subscriptions[1].Disposable = _parent._source2.SubscribeSafe(_observer2);
- subscriptions[2].Disposable = _parent._source3.SubscribeSafe(_observer3);
- subscriptions[3].Disposable = _parent._source4.SubscribeSafe(_observer4);
- subscriptions[4].Disposable = _parent._source5.SubscribeSafe(_observer5);
- subscriptions[5].Disposable = _parent._source6.SubscribeSafe(_observer6);
- subscriptions[6].Disposable = _parent._source7.SubscribeSafe(_observer7);
- subscriptions[7].Disposable = _parent._source8.SubscribeSafe(_observer8);
- subscriptions[8].Disposable = _parent._source9.SubscribeSafe(_observer9);
- subscriptions[9].Disposable = _parent._source10.SubscribeSafe(_observer10);
-
- return new CompositeDisposable(subscriptions);
- }
-
- protected override TResult GetResult()
- {
- return _parent._resultSelector(_observer1.Value, _observer2.Value, _observer3.Value, _observer4.Value, _observer5.Value, _observer6.Value, _observer7.Value, _observer8.Value, _observer9.Value, _observer10.Value);
- }
- }
- }
-
- class CombineLatest<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, TResult> : Producer<TResult>
- {
- private readonly IObservable<T1> _source1;
- private readonly IObservable<T2> _source2;
- private readonly IObservable<T3> _source3;
- private readonly IObservable<T4> _source4;
- private readonly IObservable<T5> _source5;
- private readonly IObservable<T6> _source6;
- private readonly IObservable<T7> _source7;
- private readonly IObservable<T8> _source8;
- private readonly IObservable<T9> _source9;
- private readonly IObservable<T10> _source10;
- private readonly IObservable<T11> _source11;
- private readonly Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, TResult> _resultSelector;
-
- public CombineLatest(IObservable<T1> source1, IObservable<T2> source2, IObservable<T3> source3, IObservable<T4> source4, IObservable<T5> source5, IObservable<T6> source6, IObservable<T7> source7, IObservable<T8> source8, IObservable<T9> source9, IObservable<T10> source10, IObservable<T11> source11, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, TResult> resultSelector)
- {
- _source1 = source1;
- _source2 = source2;
- _source3 = source3;
- _source4 = source4;
- _source5 = source5;
- _source6 = source6;
- _source7 = source7;
- _source8 = source8;
- _source9 = source9;
- _source10 = source10;
- _source11 = source11;
- _resultSelector = resultSelector;
- }
-
- protected override IDisposable Run(IObserver<TResult> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(this, observer, cancel);
- setSink(sink);
- return sink.Run();
- }
-
- class _ : CombineLatestSink<TResult>
- {
- private readonly CombineLatest<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, TResult> _parent;
-
- public _(CombineLatest<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, TResult> parent, IObserver<TResult> observer, IDisposable cancel)
- : base(11, observer, cancel)
- {
- _parent = parent;
- }
-
- private CombineLatestObserver<T1> _observer1;
- private CombineLatestObserver<T2> _observer2;
- private CombineLatestObserver<T3> _observer3;
- private CombineLatestObserver<T4> _observer4;
- private CombineLatestObserver<T5> _observer5;
- private CombineLatestObserver<T6> _observer6;
- private CombineLatestObserver<T7> _observer7;
- private CombineLatestObserver<T8> _observer8;
- private CombineLatestObserver<T9> _observer9;
- private CombineLatestObserver<T10> _observer10;
- private CombineLatestObserver<T11> _observer11;
-
- public IDisposable Run()
- {
- var subscriptions = new SingleAssignmentDisposable[11];
- for (int i = 0; i < 11; i++)
- subscriptions[i] = new SingleAssignmentDisposable();
-
- _observer1 = new CombineLatestObserver<T1>(_gate, this, 0, subscriptions[0]);
- _observer2 = new CombineLatestObserver<T2>(_gate, this, 1, subscriptions[1]);
- _observer3 = new CombineLatestObserver<T3>(_gate, this, 2, subscriptions[2]);
- _observer4 = new CombineLatestObserver<T4>(_gate, this, 3, subscriptions[3]);
- _observer5 = new CombineLatestObserver<T5>(_gate, this, 4, subscriptions[4]);
- _observer6 = new CombineLatestObserver<T6>(_gate, this, 5, subscriptions[5]);
- _observer7 = new CombineLatestObserver<T7>(_gate, this, 6, subscriptions[6]);
- _observer8 = new CombineLatestObserver<T8>(_gate, this, 7, subscriptions[7]);
- _observer9 = new CombineLatestObserver<T9>(_gate, this, 8, subscriptions[8]);
- _observer10 = new CombineLatestObserver<T10>(_gate, this, 9, subscriptions[9]);
- _observer11 = new CombineLatestObserver<T11>(_gate, this, 10, subscriptions[10]);
-
- subscriptions[0].Disposable = _parent._source1.SubscribeSafe(_observer1);
- subscriptions[1].Disposable = _parent._source2.SubscribeSafe(_observer2);
- subscriptions[2].Disposable = _parent._source3.SubscribeSafe(_observer3);
- subscriptions[3].Disposable = _parent._source4.SubscribeSafe(_observer4);
- subscriptions[4].Disposable = _parent._source5.SubscribeSafe(_observer5);
- subscriptions[5].Disposable = _parent._source6.SubscribeSafe(_observer6);
- subscriptions[6].Disposable = _parent._source7.SubscribeSafe(_observer7);
- subscriptions[7].Disposable = _parent._source8.SubscribeSafe(_observer8);
- subscriptions[8].Disposable = _parent._source9.SubscribeSafe(_observer9);
- subscriptions[9].Disposable = _parent._source10.SubscribeSafe(_observer10);
- subscriptions[10].Disposable = _parent._source11.SubscribeSafe(_observer11);
-
- return new CompositeDisposable(subscriptions);
- }
-
- protected override TResult GetResult()
- {
- return _parent._resultSelector(_observer1.Value, _observer2.Value, _observer3.Value, _observer4.Value, _observer5.Value, _observer6.Value, _observer7.Value, _observer8.Value, _observer9.Value, _observer10.Value, _observer11.Value);
- }
- }
- }
-
- class CombineLatest<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, TResult> : Producer<TResult>
- {
- private readonly IObservable<T1> _source1;
- private readonly IObservable<T2> _source2;
- private readonly IObservable<T3> _source3;
- private readonly IObservable<T4> _source4;
- private readonly IObservable<T5> _source5;
- private readonly IObservable<T6> _source6;
- private readonly IObservable<T7> _source7;
- private readonly IObservable<T8> _source8;
- private readonly IObservable<T9> _source9;
- private readonly IObservable<T10> _source10;
- private readonly IObservable<T11> _source11;
- private readonly IObservable<T12> _source12;
- private readonly Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, TResult> _resultSelector;
-
- public CombineLatest(IObservable<T1> source1, IObservable<T2> source2, IObservable<T3> source3, IObservable<T4> source4, IObservable<T5> source5, IObservable<T6> source6, IObservable<T7> source7, IObservable<T8> source8, IObservable<T9> source9, IObservable<T10> source10, IObservable<T11> source11, IObservable<T12> source12, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, TResult> resultSelector)
- {
- _source1 = source1;
- _source2 = source2;
- _source3 = source3;
- _source4 = source4;
- _source5 = source5;
- _source6 = source6;
- _source7 = source7;
- _source8 = source8;
- _source9 = source9;
- _source10 = source10;
- _source11 = source11;
- _source12 = source12;
- _resultSelector = resultSelector;
- }
-
- protected override IDisposable Run(IObserver<TResult> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(this, observer, cancel);
- setSink(sink);
- return sink.Run();
- }
-
- class _ : CombineLatestSink<TResult>
- {
- private readonly CombineLatest<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, TResult> _parent;
-
- public _(CombineLatest<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, TResult> parent, IObserver<TResult> observer, IDisposable cancel)
- : base(12, observer, cancel)
- {
- _parent = parent;
- }
-
- private CombineLatestObserver<T1> _observer1;
- private CombineLatestObserver<T2> _observer2;
- private CombineLatestObserver<T3> _observer3;
- private CombineLatestObserver<T4> _observer4;
- private CombineLatestObserver<T5> _observer5;
- private CombineLatestObserver<T6> _observer6;
- private CombineLatestObserver<T7> _observer7;
- private CombineLatestObserver<T8> _observer8;
- private CombineLatestObserver<T9> _observer9;
- private CombineLatestObserver<T10> _observer10;
- private CombineLatestObserver<T11> _observer11;
- private CombineLatestObserver<T12> _observer12;
-
- public IDisposable Run()
- {
- var subscriptions = new SingleAssignmentDisposable[12];
- for (int i = 0; i < 12; i++)
- subscriptions[i] = new SingleAssignmentDisposable();
-
- _observer1 = new CombineLatestObserver<T1>(_gate, this, 0, subscriptions[0]);
- _observer2 = new CombineLatestObserver<T2>(_gate, this, 1, subscriptions[1]);
- _observer3 = new CombineLatestObserver<T3>(_gate, this, 2, subscriptions[2]);
- _observer4 = new CombineLatestObserver<T4>(_gate, this, 3, subscriptions[3]);
- _observer5 = new CombineLatestObserver<T5>(_gate, this, 4, subscriptions[4]);
- _observer6 = new CombineLatestObserver<T6>(_gate, this, 5, subscriptions[5]);
- _observer7 = new CombineLatestObserver<T7>(_gate, this, 6, subscriptions[6]);
- _observer8 = new CombineLatestObserver<T8>(_gate, this, 7, subscriptions[7]);
- _observer9 = new CombineLatestObserver<T9>(_gate, this, 8, subscriptions[8]);
- _observer10 = new CombineLatestObserver<T10>(_gate, this, 9, subscriptions[9]);
- _observer11 = new CombineLatestObserver<T11>(_gate, this, 10, subscriptions[10]);
- _observer12 = new CombineLatestObserver<T12>(_gate, this, 11, subscriptions[11]);
-
- subscriptions[0].Disposable = _parent._source1.SubscribeSafe(_observer1);
- subscriptions[1].Disposable = _parent._source2.SubscribeSafe(_observer2);
- subscriptions[2].Disposable = _parent._source3.SubscribeSafe(_observer3);
- subscriptions[3].Disposable = _parent._source4.SubscribeSafe(_observer4);
- subscriptions[4].Disposable = _parent._source5.SubscribeSafe(_observer5);
- subscriptions[5].Disposable = _parent._source6.SubscribeSafe(_observer6);
- subscriptions[6].Disposable = _parent._source7.SubscribeSafe(_observer7);
- subscriptions[7].Disposable = _parent._source8.SubscribeSafe(_observer8);
- subscriptions[8].Disposable = _parent._source9.SubscribeSafe(_observer9);
- subscriptions[9].Disposable = _parent._source10.SubscribeSafe(_observer10);
- subscriptions[10].Disposable = _parent._source11.SubscribeSafe(_observer11);
- subscriptions[11].Disposable = _parent._source12.SubscribeSafe(_observer12);
-
- return new CompositeDisposable(subscriptions);
- }
-
- protected override TResult GetResult()
- {
- return _parent._resultSelector(_observer1.Value, _observer2.Value, _observer3.Value, _observer4.Value, _observer5.Value, _observer6.Value, _observer7.Value, _observer8.Value, _observer9.Value, _observer10.Value, _observer11.Value, _observer12.Value);
- }
- }
- }
-
- class CombineLatest<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, TResult> : Producer<TResult>
- {
- private readonly IObservable<T1> _source1;
- private readonly IObservable<T2> _source2;
- private readonly IObservable<T3> _source3;
- private readonly IObservable<T4> _source4;
- private readonly IObservable<T5> _source5;
- private readonly IObservable<T6> _source6;
- private readonly IObservable<T7> _source7;
- private readonly IObservable<T8> _source8;
- private readonly IObservable<T9> _source9;
- private readonly IObservable<T10> _source10;
- private readonly IObservable<T11> _source11;
- private readonly IObservable<T12> _source12;
- private readonly IObservable<T13> _source13;
- private readonly Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, TResult> _resultSelector;
-
- public CombineLatest(IObservable<T1> source1, IObservable<T2> source2, IObservable<T3> source3, IObservable<T4> source4, IObservable<T5> source5, IObservable<T6> source6, IObservable<T7> source7, IObservable<T8> source8, IObservable<T9> source9, IObservable<T10> source10, IObservable<T11> source11, IObservable<T12> source12, IObservable<T13> source13, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, TResult> resultSelector)
- {
- _source1 = source1;
- _source2 = source2;
- _source3 = source3;
- _source4 = source4;
- _source5 = source5;
- _source6 = source6;
- _source7 = source7;
- _source8 = source8;
- _source9 = source9;
- _source10 = source10;
- _source11 = source11;
- _source12 = source12;
- _source13 = source13;
- _resultSelector = resultSelector;
- }
-
- protected override IDisposable Run(IObserver<TResult> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(this, observer, cancel);
- setSink(sink);
- return sink.Run();
- }
-
- class _ : CombineLatestSink<TResult>
- {
- private readonly CombineLatest<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, TResult> _parent;
-
- public _(CombineLatest<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, TResult> parent, IObserver<TResult> observer, IDisposable cancel)
- : base(13, observer, cancel)
- {
- _parent = parent;
- }
-
- private CombineLatestObserver<T1> _observer1;
- private CombineLatestObserver<T2> _observer2;
- private CombineLatestObserver<T3> _observer3;
- private CombineLatestObserver<T4> _observer4;
- private CombineLatestObserver<T5> _observer5;
- private CombineLatestObserver<T6> _observer6;
- private CombineLatestObserver<T7> _observer7;
- private CombineLatestObserver<T8> _observer8;
- private CombineLatestObserver<T9> _observer9;
- private CombineLatestObserver<T10> _observer10;
- private CombineLatestObserver<T11> _observer11;
- private CombineLatestObserver<T12> _observer12;
- private CombineLatestObserver<T13> _observer13;
-
- public IDisposable Run()
- {
- var subscriptions = new SingleAssignmentDisposable[13];
- for (int i = 0; i < 13; i++)
- subscriptions[i] = new SingleAssignmentDisposable();
-
- _observer1 = new CombineLatestObserver<T1>(_gate, this, 0, subscriptions[0]);
- _observer2 = new CombineLatestObserver<T2>(_gate, this, 1, subscriptions[1]);
- _observer3 = new CombineLatestObserver<T3>(_gate, this, 2, subscriptions[2]);
- _observer4 = new CombineLatestObserver<T4>(_gate, this, 3, subscriptions[3]);
- _observer5 = new CombineLatestObserver<T5>(_gate, this, 4, subscriptions[4]);
- _observer6 = new CombineLatestObserver<T6>(_gate, this, 5, subscriptions[5]);
- _observer7 = new CombineLatestObserver<T7>(_gate, this, 6, subscriptions[6]);
- _observer8 = new CombineLatestObserver<T8>(_gate, this, 7, subscriptions[7]);
- _observer9 = new CombineLatestObserver<T9>(_gate, this, 8, subscriptions[8]);
- _observer10 = new CombineLatestObserver<T10>(_gate, this, 9, subscriptions[9]);
- _observer11 = new CombineLatestObserver<T11>(_gate, this, 10, subscriptions[10]);
- _observer12 = new CombineLatestObserver<T12>(_gate, this, 11, subscriptions[11]);
- _observer13 = new CombineLatestObserver<T13>(_gate, this, 12, subscriptions[12]);
-
- subscriptions[0].Disposable = _parent._source1.SubscribeSafe(_observer1);
- subscriptions[1].Disposable = _parent._source2.SubscribeSafe(_observer2);
- subscriptions[2].Disposable = _parent._source3.SubscribeSafe(_observer3);
- subscriptions[3].Disposable = _parent._source4.SubscribeSafe(_observer4);
- subscriptions[4].Disposable = _parent._source5.SubscribeSafe(_observer5);
- subscriptions[5].Disposable = _parent._source6.SubscribeSafe(_observer6);
- subscriptions[6].Disposable = _parent._source7.SubscribeSafe(_observer7);
- subscriptions[7].Disposable = _parent._source8.SubscribeSafe(_observer8);
- subscriptions[8].Disposable = _parent._source9.SubscribeSafe(_observer9);
- subscriptions[9].Disposable = _parent._source10.SubscribeSafe(_observer10);
- subscriptions[10].Disposable = _parent._source11.SubscribeSafe(_observer11);
- subscriptions[11].Disposable = _parent._source12.SubscribeSafe(_observer12);
- subscriptions[12].Disposable = _parent._source13.SubscribeSafe(_observer13);
-
- return new CompositeDisposable(subscriptions);
- }
-
- protected override TResult GetResult()
- {
- return _parent._resultSelector(_observer1.Value, _observer2.Value, _observer3.Value, _observer4.Value, _observer5.Value, _observer6.Value, _observer7.Value, _observer8.Value, _observer9.Value, _observer10.Value, _observer11.Value, _observer12.Value, _observer13.Value);
- }
- }
- }
-
- class CombineLatest<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, TResult> : Producer<TResult>
- {
- private readonly IObservable<T1> _source1;
- private readonly IObservable<T2> _source2;
- private readonly IObservable<T3> _source3;
- private readonly IObservable<T4> _source4;
- private readonly IObservable<T5> _source5;
- private readonly IObservable<T6> _source6;
- private readonly IObservable<T7> _source7;
- private readonly IObservable<T8> _source8;
- private readonly IObservable<T9> _source9;
- private readonly IObservable<T10> _source10;
- private readonly IObservable<T11> _source11;
- private readonly IObservable<T12> _source12;
- private readonly IObservable<T13> _source13;
- private readonly IObservable<T14> _source14;
- private readonly Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, TResult> _resultSelector;
-
- public CombineLatest(IObservable<T1> source1, IObservable<T2> source2, IObservable<T3> source3, IObservable<T4> source4, IObservable<T5> source5, IObservable<T6> source6, IObservable<T7> source7, IObservable<T8> source8, IObservable<T9> source9, IObservable<T10> source10, IObservable<T11> source11, IObservable<T12> source12, IObservable<T13> source13, IObservable<T14> source14, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, TResult> resultSelector)
- {
- _source1 = source1;
- _source2 = source2;
- _source3 = source3;
- _source4 = source4;
- _source5 = source5;
- _source6 = source6;
- _source7 = source7;
- _source8 = source8;
- _source9 = source9;
- _source10 = source10;
- _source11 = source11;
- _source12 = source12;
- _source13 = source13;
- _source14 = source14;
- _resultSelector = resultSelector;
- }
-
- protected override IDisposable Run(IObserver<TResult> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(this, observer, cancel);
- setSink(sink);
- return sink.Run();
- }
-
- class _ : CombineLatestSink<TResult>
- {
- private readonly CombineLatest<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, TResult> _parent;
-
- public _(CombineLatest<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, TResult> parent, IObserver<TResult> observer, IDisposable cancel)
- : base(14, observer, cancel)
- {
- _parent = parent;
- }
-
- private CombineLatestObserver<T1> _observer1;
- private CombineLatestObserver<T2> _observer2;
- private CombineLatestObserver<T3> _observer3;
- private CombineLatestObserver<T4> _observer4;
- private CombineLatestObserver<T5> _observer5;
- private CombineLatestObserver<T6> _observer6;
- private CombineLatestObserver<T7> _observer7;
- private CombineLatestObserver<T8> _observer8;
- private CombineLatestObserver<T9> _observer9;
- private CombineLatestObserver<T10> _observer10;
- private CombineLatestObserver<T11> _observer11;
- private CombineLatestObserver<T12> _observer12;
- private CombineLatestObserver<T13> _observer13;
- private CombineLatestObserver<T14> _observer14;
-
- public IDisposable Run()
- {
- var subscriptions = new SingleAssignmentDisposable[14];
- for (int i = 0; i < 14; i++)
- subscriptions[i] = new SingleAssignmentDisposable();
-
- _observer1 = new CombineLatestObserver<T1>(_gate, this, 0, subscriptions[0]);
- _observer2 = new CombineLatestObserver<T2>(_gate, this, 1, subscriptions[1]);
- _observer3 = new CombineLatestObserver<T3>(_gate, this, 2, subscriptions[2]);
- _observer4 = new CombineLatestObserver<T4>(_gate, this, 3, subscriptions[3]);
- _observer5 = new CombineLatestObserver<T5>(_gate, this, 4, subscriptions[4]);
- _observer6 = new CombineLatestObserver<T6>(_gate, this, 5, subscriptions[5]);
- _observer7 = new CombineLatestObserver<T7>(_gate, this, 6, subscriptions[6]);
- _observer8 = new CombineLatestObserver<T8>(_gate, this, 7, subscriptions[7]);
- _observer9 = new CombineLatestObserver<T9>(_gate, this, 8, subscriptions[8]);
- _observer10 = new CombineLatestObserver<T10>(_gate, this, 9, subscriptions[9]);
- _observer11 = new CombineLatestObserver<T11>(_gate, this, 10, subscriptions[10]);
- _observer12 = new CombineLatestObserver<T12>(_gate, this, 11, subscriptions[11]);
- _observer13 = new CombineLatestObserver<T13>(_gate, this, 12, subscriptions[12]);
- _observer14 = new CombineLatestObserver<T14>(_gate, this, 13, subscriptions[13]);
-
- subscriptions[0].Disposable = _parent._source1.SubscribeSafe(_observer1);
- subscriptions[1].Disposable = _parent._source2.SubscribeSafe(_observer2);
- subscriptions[2].Disposable = _parent._source3.SubscribeSafe(_observer3);
- subscriptions[3].Disposable = _parent._source4.SubscribeSafe(_observer4);
- subscriptions[4].Disposable = _parent._source5.SubscribeSafe(_observer5);
- subscriptions[5].Disposable = _parent._source6.SubscribeSafe(_observer6);
- subscriptions[6].Disposable = _parent._source7.SubscribeSafe(_observer7);
- subscriptions[7].Disposable = _parent._source8.SubscribeSafe(_observer8);
- subscriptions[8].Disposable = _parent._source9.SubscribeSafe(_observer9);
- subscriptions[9].Disposable = _parent._source10.SubscribeSafe(_observer10);
- subscriptions[10].Disposable = _parent._source11.SubscribeSafe(_observer11);
- subscriptions[11].Disposable = _parent._source12.SubscribeSafe(_observer12);
- subscriptions[12].Disposable = _parent._source13.SubscribeSafe(_observer13);
- subscriptions[13].Disposable = _parent._source14.SubscribeSafe(_observer14);
-
- return new CompositeDisposable(subscriptions);
- }
-
- protected override TResult GetResult()
- {
- return _parent._resultSelector(_observer1.Value, _observer2.Value, _observer3.Value, _observer4.Value, _observer5.Value, _observer6.Value, _observer7.Value, _observer8.Value, _observer9.Value, _observer10.Value, _observer11.Value, _observer12.Value, _observer13.Value, _observer14.Value);
- }
- }
- }
-
- class CombineLatest<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, TResult> : Producer<TResult>
- {
- private readonly IObservable<T1> _source1;
- private readonly IObservable<T2> _source2;
- private readonly IObservable<T3> _source3;
- private readonly IObservable<T4> _source4;
- private readonly IObservable<T5> _source5;
- private readonly IObservable<T6> _source6;
- private readonly IObservable<T7> _source7;
- private readonly IObservable<T8> _source8;
- private readonly IObservable<T9> _source9;
- private readonly IObservable<T10> _source10;
- private readonly IObservable<T11> _source11;
- private readonly IObservable<T12> _source12;
- private readonly IObservable<T13> _source13;
- private readonly IObservable<T14> _source14;
- private readonly IObservable<T15> _source15;
- private readonly Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, TResult> _resultSelector;
-
- public CombineLatest(IObservable<T1> source1, IObservable<T2> source2, IObservable<T3> source3, IObservable<T4> source4, IObservable<T5> source5, IObservable<T6> source6, IObservable<T7> source7, IObservable<T8> source8, IObservable<T9> source9, IObservable<T10> source10, IObservable<T11> source11, IObservable<T12> source12, IObservable<T13> source13, IObservable<T14> source14, IObservable<T15> source15, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, TResult> resultSelector)
- {
- _source1 = source1;
- _source2 = source2;
- _source3 = source3;
- _source4 = source4;
- _source5 = source5;
- _source6 = source6;
- _source7 = source7;
- _source8 = source8;
- _source9 = source9;
- _source10 = source10;
- _source11 = source11;
- _source12 = source12;
- _source13 = source13;
- _source14 = source14;
- _source15 = source15;
- _resultSelector = resultSelector;
- }
-
- protected override IDisposable Run(IObserver<TResult> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(this, observer, cancel);
- setSink(sink);
- return sink.Run();
- }
-
- class _ : CombineLatestSink<TResult>
- {
- private readonly CombineLatest<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, TResult> _parent;
-
- public _(CombineLatest<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, TResult> parent, IObserver<TResult> observer, IDisposable cancel)
- : base(15, observer, cancel)
- {
- _parent = parent;
- }
-
- private CombineLatestObserver<T1> _observer1;
- private CombineLatestObserver<T2> _observer2;
- private CombineLatestObserver<T3> _observer3;
- private CombineLatestObserver<T4> _observer4;
- private CombineLatestObserver<T5> _observer5;
- private CombineLatestObserver<T6> _observer6;
- private CombineLatestObserver<T7> _observer7;
- private CombineLatestObserver<T8> _observer8;
- private CombineLatestObserver<T9> _observer9;
- private CombineLatestObserver<T10> _observer10;
- private CombineLatestObserver<T11> _observer11;
- private CombineLatestObserver<T12> _observer12;
- private CombineLatestObserver<T13> _observer13;
- private CombineLatestObserver<T14> _observer14;
- private CombineLatestObserver<T15> _observer15;
-
- public IDisposable Run()
- {
- var subscriptions = new SingleAssignmentDisposable[15];
- for (int i = 0; i < 15; i++)
- subscriptions[i] = new SingleAssignmentDisposable();
-
- _observer1 = new CombineLatestObserver<T1>(_gate, this, 0, subscriptions[0]);
- _observer2 = new CombineLatestObserver<T2>(_gate, this, 1, subscriptions[1]);
- _observer3 = new CombineLatestObserver<T3>(_gate, this, 2, subscriptions[2]);
- _observer4 = new CombineLatestObserver<T4>(_gate, this, 3, subscriptions[3]);
- _observer5 = new CombineLatestObserver<T5>(_gate, this, 4, subscriptions[4]);
- _observer6 = new CombineLatestObserver<T6>(_gate, this, 5, subscriptions[5]);
- _observer7 = new CombineLatestObserver<T7>(_gate, this, 6, subscriptions[6]);
- _observer8 = new CombineLatestObserver<T8>(_gate, this, 7, subscriptions[7]);
- _observer9 = new CombineLatestObserver<T9>(_gate, this, 8, subscriptions[8]);
- _observer10 = new CombineLatestObserver<T10>(_gate, this, 9, subscriptions[9]);
- _observer11 = new CombineLatestObserver<T11>(_gate, this, 10, subscriptions[10]);
- _observer12 = new CombineLatestObserver<T12>(_gate, this, 11, subscriptions[11]);
- _observer13 = new CombineLatestObserver<T13>(_gate, this, 12, subscriptions[12]);
- _observer14 = new CombineLatestObserver<T14>(_gate, this, 13, subscriptions[13]);
- _observer15 = new CombineLatestObserver<T15>(_gate, this, 14, subscriptions[14]);
-
- subscriptions[0].Disposable = _parent._source1.SubscribeSafe(_observer1);
- subscriptions[1].Disposable = _parent._source2.SubscribeSafe(_observer2);
- subscriptions[2].Disposable = _parent._source3.SubscribeSafe(_observer3);
- subscriptions[3].Disposable = _parent._source4.SubscribeSafe(_observer4);
- subscriptions[4].Disposable = _parent._source5.SubscribeSafe(_observer5);
- subscriptions[5].Disposable = _parent._source6.SubscribeSafe(_observer6);
- subscriptions[6].Disposable = _parent._source7.SubscribeSafe(_observer7);
- subscriptions[7].Disposable = _parent._source8.SubscribeSafe(_observer8);
- subscriptions[8].Disposable = _parent._source9.SubscribeSafe(_observer9);
- subscriptions[9].Disposable = _parent._source10.SubscribeSafe(_observer10);
- subscriptions[10].Disposable = _parent._source11.SubscribeSafe(_observer11);
- subscriptions[11].Disposable = _parent._source12.SubscribeSafe(_observer12);
- subscriptions[12].Disposable = _parent._source13.SubscribeSafe(_observer13);
- subscriptions[13].Disposable = _parent._source14.SubscribeSafe(_observer14);
- subscriptions[14].Disposable = _parent._source15.SubscribeSafe(_observer15);
-
- return new CompositeDisposable(subscriptions);
- }
-
- protected override TResult GetResult()
- {
- return _parent._resultSelector(_observer1.Value, _observer2.Value, _observer3.Value, _observer4.Value, _observer5.Value, _observer6.Value, _observer7.Value, _observer8.Value, _observer9.Value, _observer10.Value, _observer11.Value, _observer12.Value, _observer13.Value, _observer14.Value, _observer15.Value);
- }
- }
- }
-
- class CombineLatest<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, TResult> : Producer<TResult>
- {
- private readonly IObservable<T1> _source1;
- private readonly IObservable<T2> _source2;
- private readonly IObservable<T3> _source3;
- private readonly IObservable<T4> _source4;
- private readonly IObservable<T5> _source5;
- private readonly IObservable<T6> _source6;
- private readonly IObservable<T7> _source7;
- private readonly IObservable<T8> _source8;
- private readonly IObservable<T9> _source9;
- private readonly IObservable<T10> _source10;
- private readonly IObservable<T11> _source11;
- private readonly IObservable<T12> _source12;
- private readonly IObservable<T13> _source13;
- private readonly IObservable<T14> _source14;
- private readonly IObservable<T15> _source15;
- private readonly IObservable<T16> _source16;
- private readonly Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, TResult> _resultSelector;
-
- public CombineLatest(IObservable<T1> source1, IObservable<T2> source2, IObservable<T3> source3, IObservable<T4> source4, IObservable<T5> source5, IObservable<T6> source6, IObservable<T7> source7, IObservable<T8> source8, IObservable<T9> source9, IObservable<T10> source10, IObservable<T11> source11, IObservable<T12> source12, IObservable<T13> source13, IObservable<T14> source14, IObservable<T15> source15, IObservable<T16> source16, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, TResult> resultSelector)
- {
- _source1 = source1;
- _source2 = source2;
- _source3 = source3;
- _source4 = source4;
- _source5 = source5;
- _source6 = source6;
- _source7 = source7;
- _source8 = source8;
- _source9 = source9;
- _source10 = source10;
- _source11 = source11;
- _source12 = source12;
- _source13 = source13;
- _source14 = source14;
- _source15 = source15;
- _source16 = source16;
- _resultSelector = resultSelector;
- }
-
- protected override IDisposable Run(IObserver<TResult> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(this, observer, cancel);
- setSink(sink);
- return sink.Run();
- }
-
- class _ : CombineLatestSink<TResult>
- {
- private readonly CombineLatest<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, TResult> _parent;
-
- public _(CombineLatest<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, TResult> parent, IObserver<TResult> observer, IDisposable cancel)
- : base(16, observer, cancel)
- {
- _parent = parent;
- }
-
- private CombineLatestObserver<T1> _observer1;
- private CombineLatestObserver<T2> _observer2;
- private CombineLatestObserver<T3> _observer3;
- private CombineLatestObserver<T4> _observer4;
- private CombineLatestObserver<T5> _observer5;
- private CombineLatestObserver<T6> _observer6;
- private CombineLatestObserver<T7> _observer7;
- private CombineLatestObserver<T8> _observer8;
- private CombineLatestObserver<T9> _observer9;
- private CombineLatestObserver<T10> _observer10;
- private CombineLatestObserver<T11> _observer11;
- private CombineLatestObserver<T12> _observer12;
- private CombineLatestObserver<T13> _observer13;
- private CombineLatestObserver<T14> _observer14;
- private CombineLatestObserver<T15> _observer15;
- private CombineLatestObserver<T16> _observer16;
-
- public IDisposable Run()
- {
- var subscriptions = new SingleAssignmentDisposable[16];
- for (int i = 0; i < 16; i++)
- subscriptions[i] = new SingleAssignmentDisposable();
-
- _observer1 = new CombineLatestObserver<T1>(_gate, this, 0, subscriptions[0]);
- _observer2 = new CombineLatestObserver<T2>(_gate, this, 1, subscriptions[1]);
- _observer3 = new CombineLatestObserver<T3>(_gate, this, 2, subscriptions[2]);
- _observer4 = new CombineLatestObserver<T4>(_gate, this, 3, subscriptions[3]);
- _observer5 = new CombineLatestObserver<T5>(_gate, this, 4, subscriptions[4]);
- _observer6 = new CombineLatestObserver<T6>(_gate, this, 5, subscriptions[5]);
- _observer7 = new CombineLatestObserver<T7>(_gate, this, 6, subscriptions[6]);
- _observer8 = new CombineLatestObserver<T8>(_gate, this, 7, subscriptions[7]);
- _observer9 = new CombineLatestObserver<T9>(_gate, this, 8, subscriptions[8]);
- _observer10 = new CombineLatestObserver<T10>(_gate, this, 9, subscriptions[9]);
- _observer11 = new CombineLatestObserver<T11>(_gate, this, 10, subscriptions[10]);
- _observer12 = new CombineLatestObserver<T12>(_gate, this, 11, subscriptions[11]);
- _observer13 = new CombineLatestObserver<T13>(_gate, this, 12, subscriptions[12]);
- _observer14 = new CombineLatestObserver<T14>(_gate, this, 13, subscriptions[13]);
- _observer15 = new CombineLatestObserver<T15>(_gate, this, 14, subscriptions[14]);
- _observer16 = new CombineLatestObserver<T16>(_gate, this, 15, subscriptions[15]);
-
- subscriptions[0].Disposable = _parent._source1.SubscribeSafe(_observer1);
- subscriptions[1].Disposable = _parent._source2.SubscribeSafe(_observer2);
- subscriptions[2].Disposable = _parent._source3.SubscribeSafe(_observer3);
- subscriptions[3].Disposable = _parent._source4.SubscribeSafe(_observer4);
- subscriptions[4].Disposable = _parent._source5.SubscribeSafe(_observer5);
- subscriptions[5].Disposable = _parent._source6.SubscribeSafe(_observer6);
- subscriptions[6].Disposable = _parent._source7.SubscribeSafe(_observer7);
- subscriptions[7].Disposable = _parent._source8.SubscribeSafe(_observer8);
- subscriptions[8].Disposable = _parent._source9.SubscribeSafe(_observer9);
- subscriptions[9].Disposable = _parent._source10.SubscribeSafe(_observer10);
- subscriptions[10].Disposable = _parent._source11.SubscribeSafe(_observer11);
- subscriptions[11].Disposable = _parent._source12.SubscribeSafe(_observer12);
- subscriptions[12].Disposable = _parent._source13.SubscribeSafe(_observer13);
- subscriptions[13].Disposable = _parent._source14.SubscribeSafe(_observer14);
- subscriptions[14].Disposable = _parent._source15.SubscribeSafe(_observer15);
- subscriptions[15].Disposable = _parent._source16.SubscribeSafe(_observer16);
-
- return new CompositeDisposable(subscriptions);
- }
-
- protected override TResult GetResult()
- {
- return _parent._resultSelector(_observer1.Value, _observer2.Value, _observer3.Value, _observer4.Value, _observer5.Value, _observer6.Value, _observer7.Value, _observer8.Value, _observer9.Value, _observer10.Value, _observer11.Value, _observer12.Value, _observer13.Value, _observer14.Value, _observer15.Value, _observer16.Value);
- }
- }
- }
-
-#endif
-
- #endregion
-
- #region Helpers for n-ary overloads
-
- interface ICombineLatest
- {
- void Next(int index);
- void Fail(Exception error);
- void Done(int index);
- }
-
- abstract class CombineLatestSink<TResult> : Sink<TResult>, ICombineLatest
- {
- protected readonly object _gate;
-
- private bool _hasValueAll;
- private readonly bool[] _hasValue;
- private readonly bool[] _isDone;
-
- public CombineLatestSink(int arity, IObserver<TResult> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _gate = new object();
-
- _hasValue = new bool[arity];
- _isDone = new bool[arity];
- }
-
- public void Next(int index)
- {
- if (!_hasValueAll)
- {
- _hasValue[index] = true;
-
- var hasValueAll = true;
- foreach (var hasValue in _hasValue)
- {
- if (!hasValue)
- {
- hasValueAll = false;
- break;
- }
- }
-
- _hasValueAll = hasValueAll;
- }
-
- if (_hasValueAll)
- {
- var res = default(TResult);
- try
- {
- res = GetResult();
- }
- catch (Exception ex)
- {
- base._observer.OnError(ex);
- base.Dispose();
- return;
- }
-
- base._observer.OnNext(res);
- }
- else
- {
- var allOthersDone = true;
- for (int i = 0; i < _isDone.Length; i++)
- {
- if (i != index && !_isDone[i])
- {
- allOthersDone = false;
- break;
- }
- }
-
- if (allOthersDone)
- {
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
- }
-
- protected abstract TResult GetResult();
-
- public void Fail(Exception error)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
-
- public void Done(int index)
- {
- _isDone[index] = true;
-
- var allDone = true;
- foreach (var isDone in _isDone)
- {
- if (!isDone)
- {
- allDone = false;
- break;
- }
- }
-
- if (allDone)
- {
- base._observer.OnCompleted();
- base.Dispose();
- return;
- }
- }
- }
-
- class CombineLatestObserver<T> : IObserver<T>
- {
- private readonly object _gate;
- private readonly ICombineLatest _parent;
- private readonly int _index;
- private readonly IDisposable _self;
- private T _value;
-
- public CombineLatestObserver(object gate, ICombineLatest parent, int index, IDisposable self)
- {
- _gate = gate;
- _parent = parent;
- _index = index;
- _self = self;
- }
-
- public T Value
- {
- get { return _value; }
- }
-
- public void OnNext(T value)
- {
- lock (_gate)
- {
- _value = value;
- _parent.Next(_index);
- }
- }
-
- public void OnError(Exception error)
- {
- _self.Dispose();
-
- lock (_gate)
- {
- _parent.Fail(error);
- }
- }
-
- public void OnCompleted()
- {
- _self.Dispose();
-
- lock (_gate)
- {
- _parent.Done(_index);
- }
- }
- }
-
- #endregion
-
- #endregion
-
- #region N-ary
-
- class CombineLatest<TSource, TResult> : Producer<TResult>
- {
- private readonly IEnumerable<IObservable<TSource>> _sources;
- private readonly Func<IList<TSource>, TResult> _resultSelector;
-
- public CombineLatest(IEnumerable<IObservable<TSource>> sources, Func<IList<TSource>, TResult> resultSelector)
- {
- _sources = sources;
- _resultSelector = resultSelector;
- }
-
- protected override IDisposable Run(IObserver<TResult> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(this, observer, cancel);
- setSink(sink);
- return sink.Run();
- }
-
- class _ : Sink<TResult>
- {
- private readonly CombineLatest<TSource, TResult> _parent;
-
- public _(CombineLatest<TSource, TResult> parent, IObserver<TResult> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _parent = parent;
- }
-
- private object _gate;
- private bool[] _hasValue;
- private bool _hasValueAll;
- private List<TSource> _values;
- private bool[] _isDone;
- private IDisposable[] _subscriptions;
-
- public IDisposable Run()
- {
- var srcs = _parent._sources.ToArray();
-
- var N = srcs.Length;
-
- _hasValue = new bool[N];
- _hasValueAll = false;
-
- _values = new List<TSource>(N);
- for (int i = 0; i < N; i++)
- _values.Add(default(TSource));
-
- _isDone = new bool[N];
-
- _subscriptions = new IDisposable[N];
-
- _gate = new object();
-
- for (int i = 0; i < N; i++)
- {
- var j = i;
-
- var d = new SingleAssignmentDisposable();
- _subscriptions[j] = d;
-
- var o = new O(this, j);
- d.Disposable = srcs[j].SubscribeSafe(o);
- }
-
- return new CompositeDisposable(_subscriptions);
- }
-
- private void OnNext(int index, TSource value)
- {
- lock (_gate)
- {
- _values[index] = value;
-
- _hasValue[index] = true;
-
- if (_hasValueAll || (_hasValueAll = _hasValue.All(Stubs<bool>.I)))
- {
- var res = default(TResult);
- try
- {
- res = _parent._resultSelector(new ReadOnlyCollection<TSource>(_values));
- }
- catch (Exception ex)
- {
- base._observer.OnError(ex);
- base.Dispose();
- return;
- }
-
- _observer.OnNext(res);
- }
- else if (_isDone.Where((x, i) => i != index).All(Stubs<bool>.I))
- {
- base._observer.OnCompleted();
- base.Dispose();
- return;
- }
- }
- }
-
- private void OnError(Exception error)
- {
- lock (_gate)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
- }
-
- private void OnCompleted(int index)
- {
- lock (_gate)
- {
- _isDone[index] = true;
-
- if (_isDone.All(Stubs<bool>.I))
- {
- base._observer.OnCompleted();
- base.Dispose();
- return;
- }
- else
- {
- _subscriptions[index].Dispose();
- }
- }
- }
-
- class O : IObserver<TSource>
- {
- private readonly _ _parent;
- private readonly int _index;
-
- public O(_ parent, int index)
- {
- _parent = parent;
- _index = index;
- }
-
- public void OnNext(TSource value)
- {
- _parent.OnNext(_index, value);
- }
-
- public void OnError(Exception error)
- {
- _parent.OnError(error);
- }
-
- public void OnCompleted()
- {
- _parent.OnCompleted(_index);
- }
- }
- }
- }
-
- #endregion
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Concat.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Concat.cs
deleted file mode 100644
index 5a9b2e4..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Concat.cs
+++ /dev/null
@@ -1,52 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_PERF
-using System;
-using System.Collections.Generic;
-using System.Reactive.Concurrency;
-using System.Reactive.Disposables;
-
-namespace System.Reactive.Linq.Observαble
-{
- class Concat<TSource> : Producer<TSource>, IConcatenatable<TSource>
- {
- private readonly IEnumerable<IObservable<TSource>> _sources;
-
- public Concat(IEnumerable<IObservable<TSource>> sources)
- {
- _sources = sources;
- }
-
- protected override IDisposable Run(IObserver<TSource> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(observer, cancel);
- setSink(sink);
- return sink.Run(_sources);
- }
-
- public IEnumerable<IObservable<TSource>> GetSources()
- {
- return _sources;
- }
-
- class _ : ConcatSink<TSource>
- {
- public _(IObserver<TSource> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- }
-
- public override void OnNext(TSource value)
- {
- base._observer.OnNext(value);
- }
-
- public override void OnError(Exception error)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Contains.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Contains.cs
deleted file mode 100644
index b26e2d4..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Contains.cs
+++ /dev/null
@@ -1,76 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_PERF
-using System;
-using System.Collections.Generic;
-
-namespace System.Reactive.Linq.Observαble
-{
- class Contains<TSource> : Producer<bool>
- {
- private readonly IObservable<TSource> _source;
- private readonly TSource _value;
- private readonly IEqualityComparer<TSource> _comparer;
-
- public Contains(IObservable<TSource> source, TSource value, IEqualityComparer<TSource> comparer)
- {
- _source = source;
- _value = value;
- _comparer = comparer;
- }
-
- protected override IDisposable Run(IObserver<bool> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(this, observer, cancel);
- setSink(sink);
- return _source.SubscribeSafe(sink);
- }
-
- class _ : Sink<bool>, IObserver<TSource>
- {
- private readonly Contains<TSource> _parent;
-
- public _(Contains<TSource> parent, IObserver<bool> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _parent = parent;
- }
-
- public void OnNext(TSource value)
- {
- var res = false;
- try
- {
- res = _parent._comparer.Equals(value, _parent._value);
- }
- catch (Exception ex)
- {
- base._observer.OnError(ex);
- base.Dispose();
- return;
- }
-
- if (res)
- {
- base._observer.OnNext(true);
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
-
- public void OnError(Exception error)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
-
- public void OnCompleted()
- {
- base._observer.OnNext(false);
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Count.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Count.cs
deleted file mode 100644
index 7432816..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Count.cs
+++ /dev/null
@@ -1,124 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_PERF
-using System;
-
-namespace System.Reactive.Linq.Observαble
-{
- class Count<TSource> : Producer<int>
- {
- private readonly IObservable<TSource> _source;
- private readonly Func<TSource, bool> _predicate;
-
- public Count(IObservable<TSource> source)
- {
- _source = source;
- }
-
- public Count(IObservable<TSource> source, Func<TSource, bool> predicate)
- {
- _source = source;
- _predicate = predicate;
- }
-
- protected override IDisposable Run(IObserver<int> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- if (_predicate == null)
- {
- var sink = new _(observer, cancel);
- setSink(sink);
- return _source.SubscribeSafe(sink);
- }
- else
- {
- var sink = new π(this, observer, cancel);
- setSink(sink);
- return _source.SubscribeSafe(sink);
- }
- }
-
- class _ : Sink<int>, IObserver<TSource>
- {
- private int _count;
-
- public _(IObserver<int> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _count = 0;
- }
-
- public void OnNext(TSource value)
- {
- try
- {
- checked
- {
- _count++;
- }
- }
- catch (Exception ex)
- {
- base._observer.OnError(ex);
- base.Dispose();
- }
- }
-
- public void OnError(Exception error)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
-
- public void OnCompleted()
- {
- base._observer.OnNext(_count);
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
-
- class π : Sink<int>, IObserver<TSource>
- {
- private readonly Count<TSource> _parent;
- private int _count;
-
- public π(Count<TSource> parent, IObserver<int> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _parent = parent;
- _count = 0;
- }
-
- public void OnNext(TSource value)
- {
- try
- {
- checked
- {
- if (_parent._predicate(value))
- _count++;
- }
- }
- catch (Exception ex)
- {
- base._observer.OnError(ex);
- base.Dispose();
- }
- }
-
- public void OnError(Exception error)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
-
- public void OnCompleted()
- {
- base._observer.OnNext(_count);
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/DefaultIfEmpty.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/DefaultIfEmpty.cs
deleted file mode 100644
index ed4bb89..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/DefaultIfEmpty.cs
+++ /dev/null
@@ -1,60 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_PERF
-using System;
-
-namespace System.Reactive.Linq.Observαble
-{
- class DefaultIfEmpty<TSource> : Producer<TSource>
- {
- private readonly IObservable<TSource> _source;
- private readonly TSource _defaultValue;
-
- public DefaultIfEmpty(IObservable<TSource> source, TSource defaultValue)
- {
- _source = source;
- _defaultValue = defaultValue;
- }
-
- protected override IDisposable Run(IObserver<TSource> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(this, observer, cancel);
- setSink(sink);
- return _source.SubscribeSafe(sink);
- }
-
- class _ : Sink<TSource>, IObserver<TSource>
- {
- private readonly DefaultIfEmpty<TSource> _parent;
- private bool _found;
-
- public _(DefaultIfEmpty<TSource> parent, IObserver<TSource> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _parent = parent;
- _found = false;
- }
-
- public void OnNext(TSource value)
- {
- _found = true;
- base._observer.OnNext(value);
- }
-
- public void OnError(Exception error)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
-
- public void OnCompleted()
- {
- if (!_found)
- base._observer.OnNext(_parent._defaultValue);
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Defer.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Defer.cs
deleted file mode 100644
index ba3dcc4..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Defer.cs
+++ /dev/null
@@ -1,76 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_PERF
-using System;
-using System.Reactive.Disposables;
-
-namespace System.Reactive.Linq.Observαble
-{
- class Defer<TValue> : Producer<TValue>, IEvaluatableObservable<TValue>
- {
- private readonly Func<IObservable<TValue>> _observableFactory;
-
- public Defer(Func<IObservable<TValue>> observableFactory)
- {
- _observableFactory = observableFactory;
- }
-
- protected override IDisposable Run(IObserver<TValue> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(this, observer, cancel);
- setSink(sink);
- return sink.Run();
- }
-
- public IObservable<TValue> Eval()
- {
- return _observableFactory();
- }
-
- class _ : Sink<TValue>, IObserver<TValue>
- {
- private readonly Defer<TValue> _parent;
-
- public _(Defer<TValue> parent, IObserver<TValue> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _parent = parent;
- }
-
- public IDisposable Run()
- {
- var result = default(IObservable<TValue>);
- try
- {
- result = _parent.Eval();
- }
- catch (Exception exception)
- {
- base._observer.OnError(exception);
- base.Dispose();
- return Disposable.Empty;
- }
-
- return result.SubscribeSafe(this);
- }
-
- public void OnNext(TValue value)
- {
- base._observer.OnNext(value);
- }
-
- public void OnError(Exception error)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
-
- public void OnCompleted()
- {
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Delay.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Delay.cs
deleted file mode 100644
index 3e2cbba..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Delay.cs
+++ /dev/null
@@ -1,768 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_PERF
-using System.Collections.Generic;
-using System.Reactive.Concurrency;
-using System.Reactive.Disposables;
-using System.Threading;
-
-#if NO_SEMAPHORE
-using System.Reactive.Threading;
-#endif
-
-namespace System.Reactive.Linq.Observαble
-{
- class Delay<TSource> : Producer<TSource>
- {
- private readonly IObservable<TSource> _source;
- private readonly TimeSpan? _dueTimeR;
- private readonly DateTimeOffset? _dueTimeA;
- private readonly IScheduler _scheduler;
-
- public Delay(IObservable<TSource> source, TimeSpan dueTime, IScheduler scheduler)
- {
- _source = source;
- _dueTimeR = dueTime;
- _scheduler = scheduler;
- }
-
- public Delay(IObservable<TSource> source, DateTimeOffset dueTime, IScheduler scheduler)
- {
- _source = source;
- _dueTimeA = dueTime;
- _scheduler = scheduler;
- }
-
- protected override IDisposable Run(IObserver<TSource> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- if (_scheduler.AsLongRunning() != null)
- {
- var sink = new λ(this, observer, cancel);
- setSink(sink);
- return sink.Run();
- }
- else
- {
- var sink = new _(this, observer, cancel);
- setSink(sink);
- return sink.Run();
- }
- }
-
- class _ : Sink<TSource>, IObserver<TSource>
- {
- private readonly Delay<TSource> _parent;
-
- public _(Delay<TSource> parent, IObserver<TSource> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _parent = parent;
- }
-
- private IScheduler _scheduler;
- private IDisposable _sourceSubscription;
- private SerialDisposable _cancelable;
- private TimeSpan _delay;
- private IStopwatch _watch;
-
- private object _gate;
- private bool _ready;
- private bool _active;
- private bool _running;
- private Queue<System.Reactive.TimeInterval<TSource>> _queue;
- private bool _hasCompleted;
- private TimeSpan _completeAt;
- private bool _hasFailed;
- private Exception _exception;
-
- public IDisposable Run()
- {
- _scheduler = _parent._scheduler;
-
- _cancelable = new SerialDisposable();
-
- _gate = new object();
- _active = false;
- _running = false;
- _queue = new Queue<System.Reactive.TimeInterval<TSource>>();
- _hasCompleted = false;
- _completeAt = default(TimeSpan);
- _hasFailed = false;
- _exception = default(Exception);
-
- _watch = _scheduler.StartStopwatch();
-
- if (_parent._dueTimeA.HasValue)
- {
- _ready = false;
-
- var dueTimeA = _parent._dueTimeA.Value;
- _cancelable.Disposable = _scheduler.Schedule(dueTimeA, Start);
- }
- else
- {
- _ready = true;
-
- var dueTimeR = _parent._dueTimeR.Value;
- _delay = Scheduler.Normalize(dueTimeR);
- }
-
- var sourceSubscription = new SingleAssignmentDisposable();
- _sourceSubscription = sourceSubscription;
- sourceSubscription.Disposable = _parent._source.SubscribeSafe(this);
-
- return new CompositeDisposable(_sourceSubscription, _cancelable);
- }
-
- private void Start()
- {
- var next = default(TimeSpan);
- var shouldRun = false;
-
- lock (_gate)
- {
- _delay = _watch.Elapsed;
-
- var oldQueue = _queue;
- _queue = new Queue<Reactive.TimeInterval<TSource>>();
-
- if (oldQueue.Count > 0)
- {
- next = oldQueue.Peek().Interval;
-
- while (oldQueue.Count > 0)
- {
- var item = oldQueue.Dequeue();
- _queue.Enqueue(new Reactive.TimeInterval<TSource>(item.Value, item.Interval.Add(_delay)));
- }
-
- shouldRun = true;
- _active = true;
- }
-
- _ready = true;
- }
-
- if (shouldRun)
- {
- _cancelable.Disposable = _scheduler.Schedule(next, DrainQueue);
- }
- }
-
- public void OnNext(TSource value)
- {
- var next = _watch.Elapsed.Add(_delay);
- var shouldRun = false;
-
- lock (_gate)
- {
- _queue.Enqueue(new System.Reactive.TimeInterval<TSource>(value, next));
-
- shouldRun = _ready && !_active;
- _active = true;
- }
-
- if (shouldRun)
- {
- _cancelable.Disposable = _scheduler.Schedule(_delay, DrainQueue);
- }
- }
-
- public void OnError(Exception error)
- {
- _sourceSubscription.Dispose();
-
- var shouldRun = false;
-
- lock (_gate)
- {
- _queue.Clear();
-
- _exception = error;
- _hasFailed = true;
-
- shouldRun = !_running;
- }
-
- if (shouldRun)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
- }
-
- public void OnCompleted()
- {
- _sourceSubscription.Dispose();
-
- var next = _watch.Elapsed.Add(_delay);
- var shouldRun = false;
-
- lock (_gate)
- {
- _completeAt = next;
- _hasCompleted = true;
-
- shouldRun = _ready && !_active;
- _active = true;
- }
-
- if (shouldRun)
- {
- _cancelable.Disposable = _scheduler.Schedule(_delay, DrainQueue);
- }
- }
-
- private void DrainQueue(Action<TimeSpan> recurse)
- {
- lock (_gate)
- {
- if (_hasFailed)
- return;
- _running = true;
- }
-
- //
- // The shouldYield flag was added to address TFS 487881: "Delay can be unfair". In the old
- // implementation, the loop below kept running while there was work for immediate dispatch,
- // potentially causing a long running work item on the target scheduler. With the addition
- // of long-running scheduling in Rx v2.0, we can check whether the scheduler supports this
- // interface and perform different processing (see λ). To reduce the code churn in the old
- // loop code here, we set the shouldYield flag to true after the first dispatch iteration,
- // in order to break from the loop and enter the recursive scheduling path.
- //
- var shouldYield = false;
-
- while (true)
- {
- var hasFailed = false;
- var error = default(Exception);
-
- var hasValue = false;
- var value = default(TSource);
- var hasCompleted = false;
-
- var shouldRecurse = false;
- var recurseDueTime = default(TimeSpan);
-
- lock (_gate)
- {
- if (_hasFailed)
- {
- error = _exception;
- hasFailed = true;
- _running = false;
- }
- else
- {
- var now = _watch.Elapsed;
-
- if (_queue.Count > 0)
- {
- var nextDue = _queue.Peek().Interval;
-
- if (nextDue.CompareTo(now) <= 0 && !shouldYield)
- {
- value = _queue.Dequeue().Value;
- hasValue = true;
- }
- else
- {
- shouldRecurse = true;
- recurseDueTime = Scheduler.Normalize(nextDue.Subtract(now));
- _running = false;
- }
- }
- else if (_hasCompleted)
- {
- if (_completeAt.CompareTo(now) <= 0 && !shouldYield)
- {
- hasCompleted = true;
- }
- else
- {
- shouldRecurse = true;
- recurseDueTime = Scheduler.Normalize(_completeAt.Subtract(now));
- _running = false;
- }
- }
- else
- {
- _running = false;
- _active = false;
- }
- }
- } /* lock (_gate) */
-
- if (hasValue)
- {
- base._observer.OnNext(value);
- shouldYield = true;
- }
- else
- {
- if (hasCompleted)
- {
- base._observer.OnCompleted();
- base.Dispose();
- }
- else if (hasFailed)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
- else if (shouldRecurse)
- {
- recurse(recurseDueTime);
- }
-
- return;
- }
- } /* while (true) */
- }
- }
-
- class λ : Sink<TSource>, IObserver<TSource>
- {
- private readonly Delay<TSource> _parent;
-
- public λ(Delay<TSource> parent, IObserver<TSource> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _parent = parent;
- }
-
- private IDisposable _sourceSubscription;
- private SerialDisposable _cancelable;
- private TimeSpan _delay;
- private IStopwatch _watch;
-
- private object _gate;
-#if !NO_CDS
- private SemaphoreSlim _evt;
- private CancellationTokenSource _stop;
-#else
- private Semaphore _evt;
- private bool _stopped;
- private ManualResetEvent _stop;
-#endif
- private Queue<System.Reactive.TimeInterval<TSource>> _queue;
- private bool _hasCompleted;
- private TimeSpan _completeAt;
- private bool _hasFailed;
- private Exception _exception;
-
- public IDisposable Run()
- {
- _cancelable = new SerialDisposable();
-
- _gate = new object();
-#if !NO_CDS
- _evt = new SemaphoreSlim(0);
-#else
- _evt = new Semaphore(0, int.MaxValue);
-#endif
- _queue = new Queue<System.Reactive.TimeInterval<TSource>>();
- _hasCompleted = false;
- _completeAt = default(TimeSpan);
- _hasFailed = false;
- _exception = default(Exception);
-
- _watch = _parent._scheduler.StartStopwatch();
-
- if (_parent._dueTimeA.HasValue)
- {
- var dueTimeA = _parent._dueTimeA.Value;
- _cancelable.Disposable = _parent._scheduler.Schedule(dueTimeA, Start);
- }
- else
- {
- var dueTimeR = _parent._dueTimeR.Value;
- _delay = Scheduler.Normalize(dueTimeR);
- ScheduleDrain();
- }
-
- var sourceSubscription = new SingleAssignmentDisposable();
- _sourceSubscription = sourceSubscription;
- sourceSubscription.Disposable = _parent._source.SubscribeSafe(this);
-
- return new CompositeDisposable(_sourceSubscription, _cancelable);
- }
-
- private void Start()
- {
- lock (_gate)
- {
- _delay = _watch.Elapsed;
-
- var oldQueue = _queue;
- _queue = new Queue<Reactive.TimeInterval<TSource>>();
-
- while (oldQueue.Count > 0)
- {
- var item = oldQueue.Dequeue();
- _queue.Enqueue(new Reactive.TimeInterval<TSource>(item.Value, item.Interval.Add(_delay)));
- }
- }
-
- ScheduleDrain();
- }
-
- private void ScheduleDrain()
- {
-#if !NO_CDS
- _stop = new CancellationTokenSource();
- _cancelable.Disposable = Disposable.Create(() => _stop.Cancel());
-#else
- _stop = new ManualResetEvent(false);
- _cancelable.Disposable = Disposable.Create(() =>
- {
- _stopped = true;
- _stop.Set();
- _evt.Release();
- });
-#endif
-
- _parent._scheduler.AsLongRunning().ScheduleLongRunning(DrainQueue);
- }
-
- public void OnNext(TSource value)
- {
- var next = _watch.Elapsed.Add(_delay);
-
- lock (_gate)
- {
- _queue.Enqueue(new System.Reactive.TimeInterval<TSource>(value, next));
-
- _evt.Release();
- }
- }
-
- public void OnError(Exception error)
- {
- _sourceSubscription.Dispose();
-
- lock (_gate)
- {
- _queue.Clear();
-
- _exception = error;
- _hasFailed = true;
-
- _evt.Release();
- }
- }
-
- public void OnCompleted()
- {
- _sourceSubscription.Dispose();
-
- var next = _watch.Elapsed.Add(_delay);
-
- lock (_gate)
- {
- _completeAt = next;
- _hasCompleted = true;
-
- _evt.Release();
- }
- }
-
- private void DrainQueue(ICancelable cancel)
- {
- while (true)
- {
-#if !NO_CDS
- try
- {
- _evt.Wait(_stop.Token);
- }
- catch (OperationCanceledException)
- {
- return;
- }
-#else
- _evt.WaitOne();
- if (_stopped)
- return;
-#endif
-
- var hasFailed = false;
- var error = default(Exception);
-
- var hasValue = false;
- var value = default(TSource);
- var hasCompleted = false;
-
- var shouldWait = false;
- var waitTime = default(TimeSpan);
-
- lock (_gate)
- {
- if (_hasFailed)
- {
- error = _exception;
- hasFailed = true;
- }
- else
- {
- var now = _watch.Elapsed;
-
- if (_queue.Count > 0)
- {
- var next = _queue.Dequeue();
-
- hasValue = true;
- value = next.Value;
-
- var nextDue = next.Interval;
- if (nextDue.CompareTo(now) > 0)
- {
- shouldWait = true;
- waitTime = Scheduler.Normalize(nextDue.Subtract(now));
- }
- }
- else if (_hasCompleted)
- {
- hasCompleted = true;
-
- if (_completeAt.CompareTo(now) > 0)
- {
- shouldWait = true;
- waitTime = Scheduler.Normalize(_completeAt.Subtract(now));
- }
- }
- }
- } /* lock (_gate) */
-
- if (shouldWait)
- {
-#if !NO_CDS
- var timer = new ManualResetEventSlim();
- _parent._scheduler.Schedule(waitTime, () => { timer.Set(); });
-
- try
- {
- timer.Wait(_stop.Token);
- }
- catch (OperationCanceledException)
- {
- return;
- }
-#else
- var timer = new ManualResetEvent(false);
- _parent._scheduler.Schedule(waitTime, () => { timer.Set(); });
- if (WaitHandle.WaitAny(new[] { timer, _stop }) == 1)
- return;
-#endif
- }
-
- if (hasValue)
- {
- base._observer.OnNext(value);
- }
- else
- {
- if (hasCompleted)
- {
- base._observer.OnCompleted();
- base.Dispose();
- }
- else if (hasFailed)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
-
- return;
- }
- }
- }
- }
- }
-
- class Delay<TSource, TDelay> : Producer<TSource>
- {
- private readonly IObservable<TSource> _source;
- private readonly IObservable<TDelay> _subscriptionDelay;
- private readonly Func<TSource, IObservable<TDelay>> _delaySelector;
-
- public Delay(IObservable<TSource> source, IObservable<TDelay> subscriptionDelay, Func<TSource, IObservable<TDelay>> delaySelector)
- {
- _source = source;
- _subscriptionDelay = subscriptionDelay;
- _delaySelector = delaySelector;
- }
-
- protected override IDisposable Run(IObserver<TSource> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(this, observer, cancel);
- setSink(sink);
- return sink.Run();
- }
-
- class _ : Sink<TSource>, IObserver<TSource>
- {
- private readonly Delay<TSource, TDelay> _parent;
-
- public _(Delay<TSource, TDelay> parent, IObserver<TSource> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _parent = parent;
- }
-
- private CompositeDisposable _delays;
- private object _gate;
- private bool _atEnd;
- private SerialDisposable _subscription;
-
- public IDisposable Run()
- {
- _delays = new CompositeDisposable();
- _gate = new object();
- _atEnd = false;
- _subscription = new SerialDisposable();
-
- if (_parent._subscriptionDelay == null)
- {
- Start();
- }
- else
- {
- _subscription.Disposable = _parent._subscriptionDelay.SubscribeSafe(new σ(this));
- }
-
- return new CompositeDisposable(_subscription, _delays);
- }
-
- private void Start()
- {
- _subscription.Disposable = _parent._source.SubscribeSafe(this);
- }
-
- public void OnNext(TSource value)
- {
- var delay = default(IObservable<TDelay>);
- try
- {
- delay = _parent._delaySelector(value);
- }
- catch (Exception error)
- {
- lock (_gate)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
-
- return;
- }
-
- var d = new SingleAssignmentDisposable();
- _delays.Add(d);
- d.Disposable = delay.SubscribeSafe(new δ(this, value, d));
- }
-
- public void OnError(Exception error)
- {
- lock (_gate)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
- }
-
- public void OnCompleted()
- {
- lock (_gate)
- {
- _atEnd = true;
- _subscription.Dispose();
-
- CheckDone();
- }
- }
-
- private void CheckDone()
- {
- if (_atEnd && _delays.Count == 0)
- {
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
-
- class σ : IObserver<TDelay>
- {
- private readonly _ _parent;
-
- public σ(_ parent)
- {
- _parent = parent;
- }
-
- public void OnNext(TDelay value)
- {
- _parent.Start();
- }
-
- public void OnError(Exception error)
- {
- _parent._observer.OnError(error);
- _parent.Dispose();
- }
-
- public void OnCompleted()
- {
- _parent.Start();
- }
- }
-
- class δ : IObserver<TDelay>
- {
- private readonly _ _parent;
- private readonly TSource _value;
- private readonly IDisposable _self;
-
- public δ(_ parent, TSource value, IDisposable self)
- {
- _parent = parent;
- _value = value;
- _self = self;
- }
-
- public void OnNext(TDelay value)
- {
- lock (_parent._gate)
- {
- _parent._observer.OnNext(_value);
-
- _parent._delays.Remove(_self);
- _parent.CheckDone();
- }
- }
-
- public void OnError(Exception error)
- {
- lock (_parent._gate)
- {
- _parent._observer.OnError(error);
- _parent.Dispose();
- }
- }
-
- public void OnCompleted()
- {
- lock (_parent._gate)
- {
- _parent._observer.OnNext(_value);
-
- _parent._delays.Remove(_self);
- _parent.CheckDone();
- }
- }
- }
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/DelaySubscription.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/DelaySubscription.cs
deleted file mode 100644
index c6a05cc..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/DelaySubscription.cs
+++ /dev/null
@@ -1,76 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_PERF
-using System;
-using System.Reactive.Concurrency;
-
-namespace System.Reactive.Linq.Observαble
-{
- class DelaySubscription<TSource> : Producer<TSource>
- {
- private readonly IObservable<TSource> _source;
- private readonly DateTimeOffset? _dueTimeA;
- private readonly TimeSpan? _dueTimeR;
- private readonly IScheduler _scheduler;
-
- public DelaySubscription(IObservable<TSource> source, DateTimeOffset dueTime, IScheduler scheduler)
- {
- _source = source;
- _dueTimeA = dueTime;
- _scheduler = scheduler;
- }
-
- public DelaySubscription(IObservable<TSource> source, TimeSpan dueTime, IScheduler scheduler)
- {
- _source = source;
- _dueTimeR = dueTime;
- _scheduler = scheduler;
- }
-
- protected override IDisposable Run(IObserver<TSource> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(observer, cancel);
- setSink(sink);
-
- if (_dueTimeA.HasValue)
- {
- return _scheduler.Schedule(sink, _dueTimeA.Value, Subscribe);
- }
- else
- {
- return _scheduler.Schedule(sink, _dueTimeR.Value, Subscribe);
- }
- }
-
- private IDisposable Subscribe(IScheduler _, _ sink)
- {
- return _source.SubscribeSafe(sink);
- }
-
- class _ : Sink<TSource>, IObserver<TSource>
- {
- public _(IObserver<TSource> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- }
-
- public void OnNext(TSource value)
- {
- base._observer.OnNext(value);
- }
-
- public void OnError(Exception error)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
-
- public void OnCompleted()
- {
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Dematerialize.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Dematerialize.cs
deleted file mode 100644
index 112b156..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Dematerialize.cs
+++ /dev/null
@@ -1,63 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_PERF
-using System;
-
-namespace System.Reactive.Linq.Observαble
-{
- class Dematerialize<TSource> : Producer<TSource>
- {
- private readonly IObservable<Notification<TSource>> _source;
-
- public Dematerialize(IObservable<Notification<TSource>> source)
- {
- _source = source;
- }
-
- protected override IDisposable Run(IObserver<TSource> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(observer, cancel);
- setSink(sink);
- return _source.SubscribeSafe(sink);
- }
-
- class _ : Sink<TSource>, IObserver<Notification<TSource>>
- {
- public _(IObserver<TSource> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- }
-
- public void OnNext(Notification<TSource> value)
- {
- switch (value.Kind)
- {
- case NotificationKind.OnNext:
- base._observer.OnNext(value.Value);
- break;
- case NotificationKind.OnError:
- base._observer.OnError(value.Exception);
- base.Dispose();
- break;
- case NotificationKind.OnCompleted:
- base._observer.OnCompleted();
- base.Dispose();
- break;
- }
- }
-
- public void OnError(Exception error)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
-
- public void OnCompleted()
- {
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Distinct.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Distinct.cs
deleted file mode 100644
index af20277..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Distinct.cs
+++ /dev/null
@@ -1,75 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_PERF
-using System;
-using System.Collections.Generic;
-
-namespace System.Reactive.Linq.Observαble
-{
- class Distinct<TSource, TKey> : Producer<TSource>
- {
- private readonly IObservable<TSource> _source;
- private readonly Func<TSource, TKey> _keySelector;
- private readonly IEqualityComparer<TKey> _comparer;
-
- public Distinct(IObservable<TSource> source, Func<TSource, TKey> keySelector, IEqualityComparer<TKey> comparer)
- {
- _source = source;
- _keySelector = keySelector;
- _comparer = comparer;
- }
-
- protected override IDisposable Run(IObserver<TSource> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(this, observer, cancel);
- setSink(sink);
- return _source.SubscribeSafe(sink);
- }
-
- class _ : Sink<TSource>, IObserver<TSource>
- {
- private readonly Distinct<TSource, TKey> _parent;
- private HashSet<TKey> _hashSet;
-
- public _(Distinct<TSource, TKey> parent, IObserver<TSource> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _parent = parent;
- _hashSet = new HashSet<TKey>(_parent._comparer);
- }
-
- public void OnNext(TSource value)
- {
- var key = default(TKey);
- var hasAdded = false;
- try
- {
- key = _parent._keySelector(value);
- hasAdded = _hashSet.Add(key);
- }
- catch (Exception exception)
- {
- base._observer.OnError(exception);
- base.Dispose();
- return;
- }
-
- if (hasAdded)
- base._observer.OnNext(value);
- }
-
- public void OnError(Exception error)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
-
- public void OnCompleted()
- {
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/DistinctUntilChanged.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/DistinctUntilChanged.cs
deleted file mode 100644
index 10c7923..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/DistinctUntilChanged.cs
+++ /dev/null
@@ -1,94 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_PERF
-using System;
-using System.Collections.Generic;
-
-namespace System.Reactive.Linq.Observαble
-{
- class DistinctUntilChanged<TSource, TKey> : Producer<TSource>
- {
- private readonly IObservable<TSource> _source;
- private readonly Func<TSource, TKey> _keySelector;
- private readonly IEqualityComparer<TKey> _comparer;
-
- public DistinctUntilChanged(IObservable<TSource> source, Func<TSource, TKey> keySelector, IEqualityComparer<TKey> comparer)
- {
- _source = source;
- _keySelector = keySelector;
- _comparer = comparer;
- }
-
- protected override IDisposable Run(IObserver<TSource> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(this, observer, cancel);
- setSink(sink);
- return _source.SubscribeSafe(sink);
- }
-
- class _ : Sink<TSource>, IObserver<TSource>
- {
- private readonly DistinctUntilChanged<TSource, TKey> _parent;
- private TKey _currentKey;
- private bool _hasCurrentKey;
-
- public _(DistinctUntilChanged<TSource, TKey> parent, IObserver<TSource> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _parent = parent;
- _currentKey = default(TKey);
- _hasCurrentKey = false;
- }
-
- public void OnNext(TSource value)
- {
- var key = default(TKey);
- try
- {
- key = _parent._keySelector(value);
- }
- catch (Exception exception)
- {
- base._observer.OnError(exception);
- base.Dispose();
- return;
- }
-
- var comparerEquals = false;
- if (_hasCurrentKey)
- {
- try
- {
- comparerEquals = _parent._comparer.Equals(_currentKey, key);
- }
- catch (Exception exception)
- {
- base._observer.OnError(exception);
- base.Dispose();
- return;
- }
- }
-
- if (!_hasCurrentKey || !comparerEquals)
- {
- _hasCurrentKey = true;
- _currentKey = key;
- base._observer.OnNext(value);
- }
- }
-
- public void OnError(Exception error)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
-
- public void OnCompleted()
- {
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Do.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Do.cs
deleted file mode 100644
index 2f73cfa..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Do.cs
+++ /dev/null
@@ -1,92 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_PERF
-using System;
-
-namespace System.Reactive.Linq.Observαble
-{
- class Do<TSource> : Producer<TSource>
- {
- private readonly IObservable<TSource> _source;
- private readonly Action<TSource> _onNext;
- private readonly Action<Exception> _onError;
- private readonly Action _onCompleted;
-
- public Do(IObservable<TSource> source, Action<TSource> onNext, Action<Exception> onError, Action onCompleted)
- {
- _source = source;
- _onNext = onNext;
- _onError = onError;
- _onCompleted = onCompleted;
- }
-
- protected override IDisposable Run(IObserver<TSource> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(this, observer, cancel);
- setSink(sink);
- return _source.SubscribeSafe(sink);
- }
-
- class _ : Sink<TSource>, IObserver<TSource>
- {
- private readonly Do<TSource> _parent;
-
- public _(Do<TSource> parent, IObserver<TSource> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _parent = parent;
- }
-
- public void OnNext(TSource value)
- {
- try
- {
- _parent._onNext(value);
- }
- catch (Exception ex)
- {
- base._observer.OnError(ex);
- base.Dispose();
- return;
- }
-
- base._observer.OnNext(value);
- }
-
- public void OnError(Exception error)
- {
- try
- {
- _parent._onError(error);
- }
- catch (Exception ex)
- {
- base._observer.OnError(ex);
- base.Dispose();
- return;
- }
-
- base._observer.OnError(error);
- base.Dispose();
- }
-
- public void OnCompleted()
- {
- try
- {
- _parent._onCompleted();
- }
- catch (Exception ex)
- {
- base._observer.OnError(ex);
- base.Dispose();
- return;
- }
-
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/DoWhile.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/DoWhile.cs
deleted file mode 100644
index 3ef40eb..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/DoWhile.cs
+++ /dev/null
@@ -1,54 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_PERF
-using System;
-using System.Collections.Generic;
-
-namespace System.Reactive.Linq.Observαble
-{
- class DoWhile<TSource> : Producer<TSource>, IConcatenatable<TSource>
- {
- private readonly IObservable<TSource> _source;
- private readonly Func<bool> _condition;
-
- public DoWhile(IObservable<TSource> source, Func<bool> condition)
- {
- _condition = condition;
- _source = source;
- }
-
- protected override IDisposable Run(IObserver<TSource> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(observer, cancel);
- setSink(sink);
- return sink.Run(GetSources());
- }
-
- public IEnumerable<IObservable<TSource>> GetSources()
- {
- yield return _source;
- while (_condition())
- yield return _source;
- }
-
- class _ : ConcatSink<TSource>
- {
- public _(IObserver<TSource> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- }
-
- public override void OnNext(TSource value)
- {
- base._observer.OnNext(value);
- }
-
- public override void OnError(Exception error)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
- }
- }
-}
-#endif
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/ElementAt.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/ElementAt.cs
deleted file mode 100644
index b2b1212..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/ElementAt.cs
+++ /dev/null
@@ -1,75 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_PERF
-using System;
-
-namespace System.Reactive.Linq.Observαble
-{
- class ElementAt<TSource> : Producer<TSource>
- {
- private readonly IObservable<TSource> _source;
- private readonly int _index;
- private readonly bool _throwOnEmpty;
-
- public ElementAt(IObservable<TSource> source, int index, bool throwOnEmpty)
- {
- _source = source;
- _index = index;
- _throwOnEmpty = throwOnEmpty;
- }
-
- protected override IDisposable Run(IObserver<TSource> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(this, observer, cancel);
- setSink(sink);
- return _source.SubscribeSafe(sink);
- }
-
- class _ : Sink<TSource>, IObserver<TSource>
- {
- private readonly ElementAt<TSource> _parent;
- private int _i;
-
- public _(ElementAt<TSource> parent, IObserver<TSource> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _parent = parent;
- _i = _parent._index;
- }
-
- public void OnNext(TSource value)
- {
- if (_i == 0)
- {
- base._observer.OnNext(value);
- base._observer.OnCompleted();
- base.Dispose();
- }
-
- _i--;
- }
-
- public void OnError(Exception error)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
-
- public void OnCompleted()
- {
- if (_parent._throwOnEmpty)
- {
- base._observer.OnError(new ArgumentOutOfRangeException("index"));
- }
- else
- {
- base._observer.OnNext(default(TSource));
- base._observer.OnCompleted();
- }
-
- base.Dispose();
- }
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Empty.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Empty.cs
deleted file mode 100644
index 42c7241..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Empty.cs
+++ /dev/null
@@ -1,48 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_PERF
-using System;
-using System.Reactive.Concurrency;
-
-namespace System.Reactive.Linq.Observαble
-{
- class Empty<TResult> : Producer<TResult>
- {
- private readonly IScheduler _scheduler;
-
- public Empty(IScheduler scheduler)
- {
- _scheduler = scheduler;
- }
-
- protected override IDisposable Run(IObserver<TResult> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(this, observer, cancel);
- setSink(sink);
- return sink.Run();
- }
-
- class _ : Sink<TResult>
- {
- private readonly Empty<TResult> _parent;
-
- public _(Empty<TResult> parent, IObserver<TResult> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _parent = parent;
- }
-
- public IDisposable Run()
- {
- return _parent._scheduler.Schedule(Invoke);
- }
-
- private void Invoke()
- {
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Finally.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Finally.cs
deleted file mode 100644
index ca9a5d8..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Finally.cs
+++ /dev/null
@@ -1,73 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_PERF
-using System;
-using System.Reactive.Disposables;
-
-namespace System.Reactive.Linq.Observαble
-{
- class Finally<TSource> : Producer<TSource>
- {
- private readonly IObservable<TSource> _source;
- private readonly Action _finallyAction;
-
- public Finally(IObservable<TSource> source, Action finallyAction)
- {
- _source = source;
- _finallyAction = finallyAction;
- }
-
- protected override IDisposable Run(IObserver<TSource> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(this, observer, cancel);
- setSink(sink);
- return sink.Run();
- }
-
- class _ : Sink<TSource>, IObserver<TSource>
- {
- private readonly Finally<TSource> _parent;
-
- public _(Finally<TSource> parent, IObserver<TSource> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _parent = parent;
- }
-
- public IDisposable Run()
- {
- var subscription = _parent._source.SubscribeSafe(this);
-
- return Disposable.Create(() =>
- {
- try
- {
- subscription.Dispose();
- }
- finally
- {
- _parent._finallyAction();
- }
- });
- }
-
- public void OnNext(TSource value)
- {
- base._observer.OnNext(value);
- }
-
- public void OnError(Exception error)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
-
- public void OnCompleted()
- {
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/FirstAsync.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/FirstAsync.cs
deleted file mode 100644
index 8d8bba7..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/FirstAsync.cs
+++ /dev/null
@@ -1,132 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_PERF
-using System;
-
-namespace System.Reactive.Linq.Observαble
-{
- class FirstAsync<TSource> : Producer<TSource>
- {
- private readonly IObservable<TSource> _source;
- private readonly Func<TSource, bool> _predicate;
- private readonly bool _throwOnEmpty;
-
- public FirstAsync(IObservable<TSource> source, Func<TSource, bool> predicate, bool throwOnEmpty)
- {
- _source = source;
- _predicate = predicate;
- _throwOnEmpty = throwOnEmpty;
- }
-
- protected override IDisposable Run(IObserver<TSource> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- if (_predicate != null)
- {
- var sink = new π(this, observer, cancel);
- setSink(sink);
- return _source.SubscribeSafe(sink);
- }
- else
- {
- var sink = new _(this, observer, cancel);
- setSink(sink);
- return _source.SubscribeSafe(sink);
- }
- }
-
- class _ : Sink<TSource>, IObserver<TSource>
- {
- private readonly FirstAsync<TSource> _parent;
-
- public _(FirstAsync<TSource> parent, IObserver<TSource> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _parent = parent;
- }
-
- public void OnNext(TSource value)
- {
- base._observer.OnNext(value);
- base._observer.OnCompleted();
- base.Dispose();
- }
-
- public void OnError(Exception error)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
-
- public void OnCompleted()
- {
- if (_parent._throwOnEmpty)
- {
- base._observer.OnError(new InvalidOperationException(Strings_Linq.NO_ELEMENTS));
- }
- else
- {
- base._observer.OnNext(default(TSource));
- base._observer.OnCompleted();
- }
-
- base.Dispose();
- }
- }
-
- class π : Sink<TSource>, IObserver<TSource>
- {
- private readonly FirstAsync<TSource> _parent;
-
- public π(FirstAsync<TSource> parent, IObserver<TSource> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _parent = parent;
- }
-
- public void OnNext(TSource value)
- {
- var b = false;
-
- try
- {
- b = _parent._predicate(value);
- }
- catch (Exception ex)
- {
- base._observer.OnError(ex);
- base.Dispose();
- return;
- }
-
- if (b)
- {
- base._observer.OnNext(value);
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
-
- public void OnError(Exception error)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
-
- public void OnCompleted()
- {
- if (_parent._throwOnEmpty)
- {
- base._observer.OnError(new InvalidOperationException(Strings_Linq.NO_MATCHING_ELEMENTS));
- }
- else
- {
- base._observer.OnNext(default(TSource));
- base._observer.OnCompleted();
- }
-
- base.Dispose();
- }
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/For.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/For.cs
deleted file mode 100644
index 85b9e03..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/For.cs
+++ /dev/null
@@ -1,53 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_PERF
-using System;
-using System.Collections.Generic;
-
-namespace System.Reactive.Linq.Observαble
-{
- class For<TSource, TResult> : Producer<TResult>, IConcatenatable<TResult>
- {
- private readonly IEnumerable<TSource> _source;
- private readonly Func<TSource, IObservable<TResult>> _resultSelector;
-
- public For(IEnumerable<TSource> source, Func<TSource, IObservable<TResult>> resultSelector)
- {
- _source = source;
- _resultSelector = resultSelector;
- }
-
- protected override IDisposable Run(IObserver<TResult> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(observer, cancel);
- setSink(sink);
- return sink.Run(GetSources());
- }
-
- public IEnumerable<IObservable<TResult>> GetSources()
- {
- foreach (var item in _source)
- yield return _resultSelector(item);
- }
-
- class _ : ConcatSink<TResult>
- {
- public _(IObserver<TResult> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- }
-
- public override void OnNext(TResult value)
- {
- base._observer.OnNext(value);
- }
-
- public override void OnError(Exception error)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
- }
- }
-}
-#endif
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/ForEach.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/ForEach.cs
deleted file mode 100644
index 38e112d..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/ForEach.cs
+++ /dev/null
@@ -1,122 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_PERF
-using System;
-using System.Threading;
-
-namespace System.Reactive.Linq.Observαble
-{
- class ForEach<TSource>
- {
- public class _ : IObserver<TSource>
- {
- private readonly Action<TSource> _onNext;
- private readonly Action _done;
-
- private Exception _exception;
- private int _stopped;
-
- public _(Action<TSource> onNext, Action done)
- {
- _onNext = onNext;
- _done = done;
-
- _stopped = 0;
- }
-
- public Exception Error
- {
- get { return _exception; }
- }
-
- public void OnNext(TSource value)
- {
- if (_stopped == 0)
- {
- try
- {
- _onNext(value);
- }
- catch (Exception ex)
- {
- OnError(ex);
- }
- }
- }
-
- public void OnError(Exception error)
- {
- if (Interlocked.Exchange(ref _stopped, 1) == 0)
- {
- _exception = error;
- _done();
- }
- }
-
- public void OnCompleted()
- {
- if (Interlocked.Exchange(ref _stopped, 1) == 0)
- {
- _done();
- }
- }
- }
-
- public class τ : IObserver<TSource>
- {
- private readonly Action<TSource, int> _onNext;
- private readonly Action _done;
-
- private int _index;
- private Exception _exception;
- private int _stopped;
-
- public τ(Action<TSource, int> onNext, Action done)
- {
- _onNext = onNext;
- _done = done;
-
- _index = 0;
- _stopped = 0;
- }
-
- public Exception Error
- {
- get { return _exception; }
- }
-
- public void OnNext(TSource value)
- {
- if (_stopped == 0)
- {
- try
- {
- _onNext(value, checked(_index++));
- }
- catch (Exception ex)
- {
- OnError(ex);
- }
- }
- }
-
- public void OnError(Exception error)
- {
- if (Interlocked.Exchange(ref _stopped, 1) == 0)
- {
- _exception = error;
- _done();
- }
- }
-
- public void OnCompleted()
- {
- if (Interlocked.Exchange(ref _stopped, 1) == 0)
- {
- _done();
- }
- }
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/FromEvent.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/FromEvent.cs
deleted file mode 100644
index 82c4348..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/FromEvent.cs
+++ /dev/null
@@ -1,368 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_PERF
-using System;
-using System.Diagnostics;
-using System.Reactive.Concurrency;
-using System.Reactive.Disposables;
-using System.Reactive.Subjects;
-
-//
-// BREAKING CHANGE v2 > v1.x - FromEvent[Pattern] now has an implicit SubscribeOn and Publish operation.
-//
-// The free-threaded nature of Rx is key to the performance characteristics of the event processing
-// pipeline. However, in places where we bridge with the external world, this sometimes has negative
-// effects due to thread-affine operations involved. The FromEvent[Pattern] bridges are one such
-// place where we reach out to add and remove operations on events.
-//
-// Consider the following piece of code, assuming Rx v1.x usage:
-//
-// var txt = Observable.FromEventPattern(txtInput, "TextChanged");
-// var res = from term in txt
-// from word in svc.Lookup(term).TakeUntil(txt)
-// select word;
-//
-// This code is flawed for various reasons. Seasoned Rx developers will immediately suggest usage of
-// the Publish operator to share the side-effects of subscribing to the txt sequence, resulting in
-// only one subscription to the event:
-//
-// var txt = Observable.FromEventPattern(txtInput, "TextChanged");
-// var res = txt.Publish(txt_ => from term in txt_
-// from word in svc.Lookup(term).TakeUntil(txt_)
-// select word);
-//
-// Customers are typically confused as to why FromEvent[Pattern] causes multiple handlers to be added
-// to the underlying event. This is in contrast with other From* bridges which involve the use of a
-// subject (e.g. FromAsyncPattern, FromAsync, and ToObservable on Task<T>).
-//
-// But there are more issues with the code fragment above. Upon completion of the svc.Lookup(term)
-// sequence, TakeUntil will unsubscribe from both sequences, causing the unsubscription to happen in
-// the context of the source's OnCompleted, which may be the thread pool. Some thread-affine events
-// don't quite like this. In UI frameworks like WPF and Silverlight, this turns out to be not much of
-// a problem typically, but it's merely an accident things work out. From an e-mail conversion with
-// the WPF/SL/Jupiter experts:
-//
-// "Unfortunately, as I expected, it’s confusing, and implementation details are showing through.
-// The bottom line is that event add/remove should always be done on the right thread.
-//
-// Where events are implemented with compiler-generated code, i.e. MultiCastDelegate, the add/remove
-// will be thread safe/agile. Where events are implemented in custom code, across Wpf/SL/WP/Jupiter,
-// the add/remove are expected to happen on the Dispatcher thread.
-//
-// Jupiter actually has the consistent story here, where all the event add/remove implementations do
-// the thread check. It should still be a “wrong thread” error, though, not an AV.
-//
-// In SL there’s a mix of core events (which do the thread check) and framework events (which use
-// compiler-generated event implementations). So you get an exception if you unhook Button.Loaded
-// from off thread, but you don’t get an exception if you unhook Button.Click.
-//
-// In WPF there’s a similar mix (some events are compiler-generated and some use the EventHandlerStore).
-// But I don’t see any thread safety or thread check in the EventHandlerStore. So while it works, IIUC,
-// it should have race conditions and corruptions."
-//
-// Starting with "Jupiter" (Windows XAML aka "Metro"), checks are added to ensure the add and remove
-// operations for UI events are called from the UI thread. As a result, the dictionary suggest sample
-// code shown above starts to fail. A possible fix is to use SubscribeOnDispatcher:
-//
-// var txt = Observable.FromEventPattern(txtInput, "TextChanged").SubscribeOnDispatcher();
-// var res = from term in txt
-// from word in svc.Lookup(term).TakeUntil(txt)
-// select word;
-//
-// This fix has two problems:
-//
-// 1. Customers often don't quite understand the difference between ObserveOn and SubscribeOn. In fact,
-// we've given guidance that use of the latter is typically indicative of a misunderstanding, and
-// is used rarely. Also, the fragment above would likely be extended with some UI binding code where
-// one needs to use ObserveOnDispatcher, so the combination of both becomes even more confusing.
-//
-// 2. There's a subtle race condition now. Upon receiving a new term from the txt sequence, SelectMany's
-// invocation of the result selector involves TakeUntil subscribing to txt again. However, the use
-// of SubscribeOnDispatcher means the subscription is now happening asynchronously, leaving a time
-// gap between returning from Subscribe and doing the += on the underlying event:
-//
-// (Subscription of TakeUntil to txt)
-// |
-// v
-// txt --------------------------------------------------------------
-// |
-// +-----...----+ (SubscribeOnDispatcher's post of Subscribe)
-// |
-// TextChanged ------"re"---------"rea"-------------"reac"-----"react"----...
-// ^
-// |
-// (where += on the event happens)
-//
-// While this problem is rare and sometimes gets mitigated by accident because code is posting back
-// to e.g. the UI message loop, it's extremely hard to debug when things go wrong.
-//
-// In order to fix this behavior such that code has the expected behavior, we do two things in Rx v2.0:
-//
-// - To solve the cross-thread add/remove handler operations and make them single-thread affine, we
-// now do an implicit SubscribeOn with the SynchronizationContext.Current retrieved eagerly upon
-// calling FromEvent[Pattern]. This goes hand-in-hand with a recommendation:
-//
-// "Always call FromEvent[Pattern] in a place where you'd normally write += and -= operations
-// yourself. Don't inline the creation of a FromEvent[Pattern] object inside a query."
-//
-// This recommendation helps to keep code clean (bridging operations are moved outside queries) and
-// ensures the captured SynchronizationContext is the least surprising one. E.g in the sample code
-// above, the whole query likely lives in a button_Click handler or so.
-//
-// - To solve the time gap issue, we now add implicit Publish behavior with ref-counted behavior. In
-// other words, the new FromEvent[Pattern] is pretty much the same as:
-//
-// Observable_v2.FromEvent[Pattern](<args>)
-// ==
-// Observable_v1.FromEvent[Pattern](<args>).SubscribeOn(SynchronizationContext.Current)
-// .Publish()
-// .RefCount()
-//
-// Overloads to FromEvent[Pattern] allow to specify the scheduler used for the SubscribeOn operation
-// that's taking place internally. When omitted, a SynchronizationContextScheduler will be supplied
-// if a current SynchronizationContext is found. If no current SynchronizationContext is found, the
-// default scheduler is the immediate scheduler, falling back to the free-threaded behavior we had
-// before in v1.x. (See GetSchedulerForCurrentContext in QueryLanguage.Events.cs).
-//
-// Notice a time gap can still occur at the point of the first subscription to the event sequence,
-// or when the ref count fell back to zero. In cases of nested uses of the sequence (such as in the
-// running example here), this is fine because the top-level subscription is kept alive for the whole
-// duration. In other cases, there's already a race condition between the underlying event and the
-// observable wrapper (assuming events are hot). For cold events that have side-effects upon add and
-// remove handler operations, use of Observable.Create is recommended. This should be rather rare,
-// as most events follow the typical MulticastDelegate implementation pattern:
-//
-// public event EventHandler<BarEventArgs> Bar;
-//
-// protected void OnBar(int value)
-// {
-// var bar = Bar;
-// if (bar != null)
-// bar(this, new BarEventArgs(value));
-// }
-//
-// In here, there's already a race between the user hooking up an event handler through the += add
-// operation and the event producer (possibly on a different thread) calling OnBar. It's also worth
-// pointing out that this race condition is migitated by a check in SynchronizationContextScheduler
-// causing synchronous execution in case the caller is already on the target SynchronizationContext.
-// This situation is common when using FromEvent[Pattern] immediately after declaring it, e.g. in
-// the context of a UI event handler.
-//
-// Finally, notice we can't simply connect the event to a Subject<T> upon a FromEvent[Pattern] call,
-// because this would make it impossible to get rid of this one event handler (unless we expose some
-// other means of resource maintenance, e.g. by making the returned object implement IDisposable).
-// Also, this would cause the event producer to see the event's delegate in a non-null state all the
-// time, causing event argument objects to be newed up, possibly sending those into a zero-observer
-// subject (which is opaque to the event producer). Not to mention that the subject would always be
-// rooted by the target event (even when the FromEvent[Pattern] observable wrapper is unreachable).
-//
-namespace System.Reactive.Linq.Observαble
-{
- class FromEvent<TDelegate, TEventArgs> : ClassicEventProducer<TDelegate, TEventArgs>
- {
- private readonly Func<Action<TEventArgs>, TDelegate> _conversion;
-
- public FromEvent(Action<TDelegate> addHandler, Action<TDelegate> removeHandler, IScheduler scheduler)
- : base(addHandler, removeHandler, scheduler)
- {
- }
-
- public FromEvent(Func<Action<TEventArgs>, TDelegate> conversion, Action<TDelegate> addHandler, Action<TDelegate> removeHandler, IScheduler scheduler)
- : base(addHandler, removeHandler, scheduler)
- {
- _conversion = conversion;
- }
-
- protected override TDelegate GetHandler(Action<TEventArgs> onNext)
- {
- var handler = default(TDelegate);
-
- if (_conversion == null)
- {
- handler = ReflectionUtils.CreateDelegate<TDelegate>(onNext, typeof(Action<TEventArgs>).GetMethod("Invoke"));
- }
- else
- {
- handler = _conversion(onNext);
- }
-
- return handler;
- }
- }
-
- abstract class EventProducer<TDelegate, TArgs> : Producer<TArgs>
- {
- private readonly IScheduler _scheduler;
- private readonly object _gate;
-
- public EventProducer(IScheduler scheduler)
- {
- _scheduler = scheduler;
- _gate = new object();
- }
-
- protected abstract TDelegate GetHandler(Action<TArgs> onNext);
- protected abstract IDisposable AddHandler(TDelegate handler);
-
- private Session _session;
-
- protected override IDisposable Run(IObserver<TArgs> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var connection = default(IDisposable);
-
- lock (_gate)
- {
- //
- // A session object holds on to a single handler to the underlying event, feeding
- // into a subject. It also ref counts the number of connections to the subject.
- //
- // When the ref count goes back to zero, the event handler is unregistered, and
- // the session will reach out to reset the _session field to null under the _gate
- // lock. Future subscriptions will cause a new session to be created.
- //
- if (_session == null)
- _session = new Session(this);
-
- connection = _session.Connect(observer);
- }
-
- return connection;
- }
-
- class Session
- {
- private readonly EventProducer<TDelegate, TArgs> _parent;
- private readonly Subject<TArgs> _subject;
-
- private SingleAssignmentDisposable _removeHandler;
- private int _count;
-
- public Session(EventProducer<TDelegate, TArgs> parent)
- {
- _parent = parent;
- _subject = new Subject<TArgs>();
- }
-
- public IDisposable Connect(IObserver<TArgs> observer)
- {
- /*
- * CALLERS - Ensure this is called under the lock!
- *
- lock (_parent._gate) */
- {
- //
- // We connect the given observer to the subject first, before performing any kind
- // of initialization which will register an event handler. This is done to ensure
- // we don't have a time gap between adding the handler and connecting the user's
- // subject, e.g. when the ImmediateScheduler is used.
- //
- // [OK] Use of unsafe Subscribe: called on a known subject implementation.
- //
- var connection = _subject.Subscribe/*Unsafe*/(observer);
-
- if (++_count == 1)
- {
- try
- {
- Initialize();
- }
- catch (Exception exception)
- {
- --_count;
- connection.Dispose();
-
- observer.OnError(exception);
- return Disposable.Empty;
- }
- }
-
- return Disposable.Create(() =>
- {
- connection.Dispose();
-
- lock (_parent._gate)
- {
- if (--_count == 0)
- {
- _parent._scheduler.Schedule(_removeHandler.Dispose);
- _parent._session = null;
- }
- }
- });
- }
- }
-
- private void Initialize()
- {
- /*
- * CALLERS - Ensure this is called under the lock!
- *
- lock (_parent._gate) */
- {
- //
- // When the ref count goes to zero, no-one should be able to perform operations on
- // the session object anymore, because it gets nulled out.
- //
- Debug.Assert(_removeHandler == null);
- _removeHandler = new SingleAssignmentDisposable();
-
- //
- // Conversion code is supposed to be a pure function and shouldn't be run on the
- // scheduler, but the add handler call should. Notice the scheduler can be the
- // ImmediateScheduler, causing synchronous invocation. This is the default when
- // no SynchronizationContext is found (see QueryLanguage.Events.cs and search for
- // the GetSchedulerForCurrentContext method).
- //
- var onNext = _parent.GetHandler(_subject.OnNext);
- _parent._scheduler.Schedule(onNext, AddHandler);
- }
- }
-
- private IDisposable AddHandler(IScheduler self, TDelegate onNext)
- {
- var removeHandler = default(IDisposable);
- try
- {
- removeHandler = _parent.AddHandler(onNext);
- }
- catch (Exception exception)
- {
- _subject.OnError(exception);
- return Disposable.Empty;
- }
-
- //
- // We don't propagate the exception to the OnError channel upon Dispose. This is
- // not possible at this stage, because we've already auto-detached in the base
- // class Producer implementation. Even if we would switch the OnError and auto-
- // detach calls, it wouldn't work because the remove handler logic is scheduled
- // on the given scheduler, causing asynchrony. We can't block waiting for the
- // remove handler to run on the scheduler.
- //
- _removeHandler.Disposable = removeHandler;
-
- return Disposable.Empty;
- }
- }
- }
-
- abstract class ClassicEventProducer<TDelegate, TArgs> : EventProducer<TDelegate, TArgs>
- {
- private readonly Action<TDelegate> _addHandler;
- private readonly Action<TDelegate> _removeHandler;
-
- public ClassicEventProducer(Action<TDelegate> addHandler, Action<TDelegate> removeHandler, IScheduler scheduler)
- : base(scheduler)
- {
- _addHandler = addHandler;
- _removeHandler = removeHandler;
- }
-
- protected override IDisposable AddHandler(TDelegate handler)
- {
- _addHandler(handler);
- return Disposable.Create(() => _removeHandler(handler));
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/FromEventPattern.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/FromEventPattern.cs
deleted file mode 100644
index 76da050..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/FromEventPattern.cs
+++ /dev/null
@@ -1,143 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_PERF
-using System;
-using System.Reactive.Concurrency;
-using System.Reactive.Disposables;
-using System.Reflection;
-using System.Threading;
-
-//
-// BREAKING CHANGE v2 > v1.x - FromEvent[Pattern] now has an implicit SubscribeOn and Publish operation.
-//
-// See FromEvent.cs for more information.
-//
-namespace System.Reactive.Linq.Observαble
-{
- class FromEventPattern
- {
- public class τ<TDelegate, TEventArgs> : ClassicEventProducer<TDelegate, EventPattern<TEventArgs>>
-#if !NO_EVENTARGS_CONSTRAINT
- where TEventArgs : EventArgs
-#endif
- {
- private readonly Func<EventHandler<TEventArgs>, TDelegate> _conversion;
-
- public τ(Action<TDelegate> addHandler, Action<TDelegate> removeHandler, IScheduler scheduler)
- : base(addHandler, removeHandler, scheduler)
- {
- }
-
- public τ(Func<EventHandler<TEventArgs>, TDelegate> conversion, Action<TDelegate> addHandler, Action<TDelegate> removeHandler, IScheduler scheduler)
- : base(addHandler, removeHandler, scheduler)
- {
- _conversion = conversion;
- }
-
- protected override TDelegate GetHandler(Action<EventPattern<TEventArgs>> onNext)
- {
- var handler = default(TDelegate);
-
- if (_conversion == null)
- {
- Action<object, TEventArgs> h = (sender, eventArgs) => onNext(new EventPattern<TEventArgs>(sender, eventArgs));
- handler = ReflectionUtils.CreateDelegate<TDelegate>(h, typeof(Action<object, TEventArgs>).GetMethod("Invoke"));
- }
- else
- {
- handler = _conversion((sender, eventArgs) => onNext(new EventPattern<TEventArgs>(sender, eventArgs)));
- }
-
- return handler;
- }
- }
-
- public class τ<TDelegate, TSender, TEventArgs> : ClassicEventProducer<TDelegate, EventPattern<TSender, TEventArgs>>
-#if !NO_EVENTARGS_CONSTRAINT
- where TEventArgs : EventArgs
-#endif
- {
- public τ(Action<TDelegate> addHandler, Action<TDelegate> removeHandler, IScheduler scheduler)
- : base(addHandler, removeHandler, scheduler)
- {
- }
-
- protected override TDelegate GetHandler(Action<EventPattern<TSender, TEventArgs>> onNext)
- {
- Action<TSender, TEventArgs> h = (sender, eventArgs) => onNext(new EventPattern<TSender, TEventArgs>(sender, eventArgs));
- return ReflectionUtils.CreateDelegate<TDelegate>(h, typeof(Action<TSender, TEventArgs>).GetMethod("Invoke"));
- }
- }
-
- public class ρ<TSender, TEventArgs, TResult> : EventProducer<Delegate, TResult>
- {
- private readonly object _target;
- private readonly Type _delegateType;
- private readonly MethodInfo _addMethod;
- private readonly MethodInfo _removeMethod;
- private readonly Func<TSender, TEventArgs, TResult> _getResult;
-#if HAS_WINRT
- private readonly bool _isWinRT;
-#endif
-
- public ρ(object target, Type delegateType, MethodInfo addMethod, MethodInfo removeMethod, Func<TSender, TEventArgs, TResult> getResult, bool isWinRT, IScheduler scheduler)
- : base(scheduler)
- {
-#if HAS_WINRT
- _isWinRT = isWinRT;
-#else
- System.Diagnostics.Debug.Assert(!isWinRT);
-#endif
- _target = target;
- _delegateType = delegateType;
- _addMethod = addMethod;
- _removeMethod = removeMethod;
- _getResult = getResult;
- }
-
- protected override Delegate GetHandler(Action<TResult> onNext)
- {
- Action<TSender, TEventArgs> h = (sender, eventArgs) => onNext(_getResult(sender, eventArgs));
- return ReflectionUtils.CreateDelegate(_delegateType, h, typeof(Action<TSender, TEventArgs>).GetMethod("Invoke"));
- }
-
- protected override IDisposable AddHandler(Delegate handler)
- {
- var removeHandler = default(Action);
-
- try
- {
-#if HAS_WINRT
- if (_isWinRT)
- {
- var token = _addMethod.Invoke(_target, new object[] { handler });
- removeHandler = () => _removeMethod.Invoke(_target, new object[] { token });
- }
- else
-#endif
- {
- _addMethod.Invoke(_target, new object[] { handler });
- removeHandler = () => _removeMethod.Invoke(_target, new object[] { handler });
- }
- }
- catch (TargetInvocationException tie)
- {
- throw tie.InnerException;
- }
-
- return Disposable.Create(() =>
- {
- try
- {
- removeHandler();
- }
- catch (TargetInvocationException tie)
- {
- throw tie.InnerException;
- }
- });
- }
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Generate.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Generate.cs
deleted file mode 100644
index 89ef862..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Generate.cs
+++ /dev/null
@@ -1,292 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_PERF
-using System;
-using System.Diagnostics;
-using System.Reactive.Concurrency;
-using System.Reactive.Disposables;
-using System.Threading;
-
-namespace System.Reactive.Linq.Observαble
-{
- class Generate<TState, TResult> : Producer<TResult>
- {
- private readonly TState _initialState;
- private readonly Func<TState, bool> _condition;
- private readonly Func<TState, TState> _iterate;
- private readonly Func<TState, TResult> _resultSelector;
- private readonly Func<TState, DateTimeOffset> _timeSelectorA;
- private readonly Func<TState, TimeSpan> _timeSelectorR;
- private readonly IScheduler _scheduler;
-
- public Generate(TState initialState, Func<TState, bool> condition, Func<TState, TState> iterate, Func<TState, TResult> resultSelector, IScheduler scheduler)
- {
- _initialState = initialState;
- _condition = condition;
- _iterate = iterate;
- _resultSelector = resultSelector;
- _scheduler = scheduler;
- }
-
- public Generate(TState initialState, Func<TState, bool> condition, Func<TState, TState> iterate, Func<TState, TResult> resultSelector, Func<TState, DateTimeOffset> timeSelector, IScheduler scheduler)
- {
- _initialState = initialState;
- _condition = condition;
- _iterate = iterate;
- _resultSelector = resultSelector;
- _timeSelectorA = timeSelector;
- _scheduler = scheduler;
- }
-
- public Generate(TState initialState, Func<TState, bool> condition, Func<TState, TState> iterate, Func<TState, TResult> resultSelector, Func<TState, TimeSpan> timeSelector, IScheduler scheduler)
- {
- _initialState = initialState;
- _condition = condition;
- _iterate = iterate;
- _resultSelector = resultSelector;
- _timeSelectorR = timeSelector;
- _scheduler = scheduler;
- }
-
- protected override IDisposable Run(IObserver<TResult> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- if (_timeSelectorA != null)
- {
- var sink = new α(this, observer, cancel);
- setSink(sink);
- return sink.Run();
- }
- else if (_timeSelectorR != null)
- {
- var sink = new δ(this, observer, cancel);
- setSink(sink);
- return sink.Run();
- }
- else
- {
- var sink = new _(this, observer, cancel);
- setSink(sink);
- return sink.Run();
- }
- }
-
- class α : Sink<TResult>
- {
- private readonly Generate<TState, TResult> _parent;
-
- public α(Generate<TState, TResult> parent, IObserver<TResult> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _parent = parent;
- }
-
- private bool _first;
- private bool _hasResult;
- private TResult _result;
-
- public IDisposable Run()
- {
- _first = true;
- _hasResult = false;
- _result = default(TResult);
-
- return _parent._scheduler.Schedule(_parent._initialState, InvokeRec);
- }
-
- private IDisposable InvokeRec(IScheduler self, TState state)
- {
- var time = default(DateTimeOffset);
-
- if (_hasResult)
- base._observer.OnNext(_result);
- try
- {
- if (_first)
- _first = false;
- else
- state = _parent._iterate(state);
- _hasResult = _parent._condition(state);
- if (_hasResult)
- {
- _result = _parent._resultSelector(state);
- time = _parent._timeSelectorA(state);
- }
- }
- catch (Exception exception)
- {
- base._observer.OnError(exception);
- base.Dispose();
- return Disposable.Empty;
- }
-
- if (!_hasResult)
- {
- base._observer.OnCompleted();
- base.Dispose();
- return Disposable.Empty;
- }
-
- return self.Schedule(state, time, InvokeRec);
- }
- }
-
- class δ : Sink<TResult>
- {
- private readonly Generate<TState, TResult> _parent;
-
- public δ(Generate<TState, TResult> parent, IObserver<TResult> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _parent = parent;
- }
-
- private bool _first;
- private bool _hasResult;
- private TResult _result;
-
- public IDisposable Run()
- {
- _first = true;
- _hasResult = false;
- _result = default(TResult);
-
- return _parent._scheduler.Schedule(_parent._initialState, InvokeRec);
- }
-
- private IDisposable InvokeRec(IScheduler self, TState state)
- {
- var time = default(TimeSpan);
-
- if (_hasResult)
- base._observer.OnNext(_result);
- try
- {
- if (_first)
- _first = false;
- else
- state = _parent._iterate(state);
- _hasResult = _parent._condition(state);
- if (_hasResult)
- {
- _result = _parent._resultSelector(state);
- time = _parent._timeSelectorR(state);
- }
- }
- catch (Exception exception)
- {
- base._observer.OnError(exception);
- base.Dispose();
- return Disposable.Empty;
- }
-
- if (!_hasResult)
- {
- base._observer.OnCompleted();
- base.Dispose();
- return Disposable.Empty;
- }
-
- return self.Schedule(state, time, InvokeRec);
- }
- }
-
- class _ : Sink<TResult>
- {
- private readonly Generate<TState, TResult> _parent;
-
- public _(Generate<TState, TResult> parent, IObserver<TResult> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _parent = parent;
- }
-
- private TState _state;
- private bool _first;
-
- public IDisposable Run()
- {
- _state = _parent._initialState;
- _first = true;
-
- var longRunning = _parent._scheduler.AsLongRunning();
- if (longRunning != null)
- {
- return longRunning.ScheduleLongRunning(Loop);
- }
- else
- {
- return _parent._scheduler.Schedule(LoopRec);
- }
- }
-
- private void Loop(ICancelable cancel)
- {
- while (!cancel.IsDisposed)
- {
- var hasResult = false;
- var result = default(TResult);
- try
- {
- if (_first)
- _first = false;
- else
- _state = _parent._iterate(_state);
- hasResult = _parent._condition(_state);
- if (hasResult)
- result = _parent._resultSelector(_state);
- }
- catch (Exception exception)
- {
- base._observer.OnError(exception);
- base.Dispose();
- return;
- }
-
- if (hasResult)
- base._observer.OnNext(result);
- else
- break;
- }
-
- if (!cancel.IsDisposed)
- base._observer.OnCompleted();
-
- base.Dispose();
- }
-
- private void LoopRec(Action recurse)
- {
- var hasResult = false;
- var result = default(TResult);
- try
- {
- if (_first)
- _first = false;
- else
- _state = _parent._iterate(_state);
- hasResult = _parent._condition(_state);
- if (hasResult)
- result = _parent._resultSelector(_state);
- }
- catch (Exception exception)
- {
- base._observer.OnError(exception);
- base.Dispose();
- return;
- }
-
- if (hasResult)
- {
- base._observer.OnNext(result);
- recurse();
- }
- else
- {
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/GetEnumerator.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/GetEnumerator.cs
deleted file mode 100644
index 05bf20b..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/GetEnumerator.cs
+++ /dev/null
@@ -1,102 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_PERF && !NO_CDS
-using System;
-using System.Collections.Concurrent;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Reactive.Disposables;
-using System.Threading;
-
-namespace System.Reactive.Linq.Observαble
-{
- class GetEnumerator<TSource> : IEnumerator<TSource>, IObserver<TSource>
- {
- private readonly ConcurrentQueue<TSource> _queue;
- private TSource _current;
- private Exception _error;
- private bool _done;
- private bool _disposed;
-
- private readonly SemaphoreSlim _gate;
- private readonly SingleAssignmentDisposable _subscription;
-
- public GetEnumerator()
- {
- _queue = new ConcurrentQueue<TSource>();
- _gate = new SemaphoreSlim(0);
- _subscription = new SingleAssignmentDisposable();
- }
-
- public IEnumerator<TSource> Run(IObservable<TSource> source)
- {
- //
- // [OK] Use of unsafe Subscribe: non-pretentious exact mirror with the dual GetEnumerator method.
- //
- _subscription.Disposable = source.Subscribe/*Unsafe*/(this);
- return this;
- }
-
- public void OnNext(TSource value)
- {
- _queue.Enqueue(value);
- _gate.Release();
- }
-
- public void OnError(Exception error)
- {
- _error = error;
- _subscription.Dispose();
- _gate.Release();
- }
-
- public void OnCompleted()
- {
- _done = true;
- _subscription.Dispose();
- _gate.Release();
- }
-
- public bool MoveNext()
- {
- _gate.Wait();
-
- if (_disposed)
- throw new ObjectDisposedException("");
-
- if (_queue.TryDequeue(out _current))
- return true;
-
- _error.ThrowIfNotNull();
-
- Debug.Assert(_done);
-
- _gate.Release(); // In the (rare) case the user calls MoveNext again we shouldn't block!
- return false;
- }
-
- public TSource Current
- {
- get { return _current; }
- }
-
- object Collections.IEnumerator.Current
- {
- get { return _current; }
- }
-
- public void Dispose()
- {
- _subscription.Dispose();
-
- _disposed = true;
- _gate.Release();
- }
-
- public void Reset()
- {
- throw new NotSupportedException();
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/GroupBy.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/GroupBy.cs
deleted file mode 100644
index c840b0d..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/GroupBy.cs
+++ /dev/null
@@ -1,129 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_PERF
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Reactive.Disposables;
-using System.Reactive.Subjects;
-
-namespace System.Reactive.Linq.Observαble
-{
- class GroupBy<TSource, TKey, TElement> : Producer<IGroupedObservable<TKey, TElement>>
- {
- private readonly IObservable<TSource> _source;
- private readonly Func<TSource, TKey> _keySelector;
- private readonly Func<TSource, TElement> _elementSelector;
- private readonly IEqualityComparer<TKey> _comparer;
-
- public GroupBy(IObservable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector, IEqualityComparer<TKey> comparer)
- {
- _source = source;
- _keySelector = keySelector;
- _elementSelector = elementSelector;
- _comparer = comparer;
- }
-
- private CompositeDisposable _groupDisposable;
- private RefCountDisposable _refCountDisposable;
-
- protected override IDisposable Run(IObserver<IGroupedObservable<TKey, TElement>> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- _groupDisposable = new CompositeDisposable();
- _refCountDisposable = new RefCountDisposable(_groupDisposable);
-
- var sink = new _(this, observer, cancel);
- setSink(sink);
- _groupDisposable.Add(_source.SubscribeSafe(sink));
-
- return _refCountDisposable;
- }
-
- class _ : Sink<IGroupedObservable<TKey, TElement>>, IObserver<TSource>
- {
- private readonly GroupBy<TSource, TKey, TElement> _parent;
- private readonly Dictionary<TKey, ISubject<TElement>> _map;
-
- public _(GroupBy<TSource, TKey, TElement> parent, IObserver<IGroupedObservable<TKey, TElement>> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _parent = parent;
- _map = new Dictionary<TKey, ISubject<TElement>>(_parent._comparer);
- }
-
- public void OnNext(TSource value)
- {
- var key = default(TKey);
- try
- {
- key = _parent._keySelector(value);
- }
- catch (Exception exception)
- {
- Error(exception);
- return;
- }
-
- var fireNewMapEntry = false;
- var writer = default(ISubject<TElement>);
- try
- {
- if (!_map.TryGetValue(key, out writer))
- {
- writer = new Subject<TElement>();
- _map.Add(key, writer);
- fireNewMapEntry = true;
- }
- }
- catch (Exception exception)
- {
- Error(exception);
- return;
- }
-
- if (fireNewMapEntry)
- {
- var group = new GroupedObservable<TKey, TElement>(key, writer, _parent._refCountDisposable);
- _observer.OnNext(group);
- }
-
- var element = default(TElement);
- try
- {
- element = _parent._elementSelector(value);
- }
- catch (Exception exception)
- {
- Error(exception);
- return;
- }
-
- writer.OnNext(element);
- }
-
- public void OnError(Exception error)
- {
- Error(error);
- }
-
- public void OnCompleted()
- {
- foreach (var w in _map.Values)
- w.OnCompleted();
-
- base._observer.OnCompleted();
- base.Dispose();
- }
-
- private void Error(Exception exception)
- {
- foreach (var w in _map.Values)
- w.OnError(exception);
-
- base._observer.OnError(exception);
- base.Dispose();
- }
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/GroupByUntil.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/GroupByUntil.cs
deleted file mode 100644
index dfc843d..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/GroupByUntil.cs
+++ /dev/null
@@ -1,289 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_PERF
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Reactive.Disposables;
-using System.Reactive.Subjects;
-
-namespace System.Reactive.Linq.Observαble
-{
- class GroupByUntil<TSource, TKey, TElement, TDuration> : Producer<IGroupedObservable<TKey, TElement>>
- {
- private readonly IObservable<TSource> _source;
- private readonly Func<TSource, TKey> _keySelector;
- private readonly Func<TSource, TElement> _elementSelector;
- private readonly Func<IGroupedObservable<TKey, TElement>, IObservable<TDuration>> _durationSelector;
- private readonly IEqualityComparer<TKey> _comparer;
-
- public GroupByUntil(IObservable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector, Func<IGroupedObservable<TKey, TElement>, IObservable<TDuration>> durationSelector, IEqualityComparer<TKey> comparer)
- {
- _source = source;
- _keySelector = keySelector;
- _elementSelector = elementSelector;
- _durationSelector = durationSelector;
- _comparer = comparer;
- }
-
- private CompositeDisposable _groupDisposable;
- private RefCountDisposable _refCountDisposable;
-
- protected override IDisposable Run(IObserver<IGroupedObservable<TKey, TElement>> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- _groupDisposable = new CompositeDisposable();
- _refCountDisposable = new RefCountDisposable(_groupDisposable);
-
- var sink = new _(this, observer, cancel);
- setSink(sink);
- _groupDisposable.Add(_source.SubscribeSafe(sink));
-
- return _refCountDisposable;
- }
-
- class _ : Sink<IGroupedObservable<TKey, TElement>>, IObserver<TSource>
- {
- private readonly GroupByUntil<TSource, TKey, TElement, TDuration> _parent;
- private readonly Map<TKey, ISubject<TElement>> _map;
-
- public _(GroupByUntil<TSource, TKey, TElement, TDuration> parent, IObserver<IGroupedObservable<TKey, TElement>> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _parent = parent;
- _map = new Map<TKey, ISubject<TElement>>(_parent._comparer);
- }
-
- public void OnNext(TSource value)
- {
- var key = default(TKey);
- try
- {
- key = _parent._keySelector(value);
- }
- catch (Exception exception)
- {
- Error(exception);
- return;
- }
-
- var fireNewMapEntry = false;
- var writer = default(ISubject<TElement>);
- try
- {
- writer = _map.GetOrAdd(key, () => new Subject<TElement>(), out fireNewMapEntry);
- }
- catch (Exception exception)
- {
- Error(exception);
- return;
- }
-
- if (fireNewMapEntry)
- {
- var group = new GroupedObservable<TKey, TElement>(key, writer, _parent._refCountDisposable);
-
- var duration = default(IObservable<TDuration>);
-
- var durationGroup = new GroupedObservable<TKey, TElement>(key, writer);
- try
- {
- duration = _parent._durationSelector(durationGroup);
- }
- catch (Exception exception)
- {
- Error(exception);
- return;
- }
-
- lock (base._observer)
- base._observer.OnNext(group);
-
- var md = new SingleAssignmentDisposable();
- _parent._groupDisposable.Add(md);
- md.Disposable = duration.SubscribeSafe(new δ(this, key, writer, md));
- }
-
- var element = default(TElement);
- try
- {
- element = _parent._elementSelector(value);
- }
- catch (Exception exception)
- {
- Error(exception);
- return;
- }
-
- writer.OnNext(element);
- }
-
- class δ : IObserver<TDuration>
- {
- private readonly _ _parent;
- private readonly TKey _key;
- private readonly ISubject<TElement> _writer;
- private readonly IDisposable _self;
-
- public δ(_ parent, TKey key, ISubject<TElement> writer, IDisposable self)
- {
- _parent = parent;
- _key = key;
- _writer = writer;
- _self = self;
- }
-
- public void OnNext(TDuration value)
- {
- if (_parent._map.Remove(_key))
- _writer.OnCompleted();
-
- _parent._parent._groupDisposable.Remove(_self);
- }
-
- public void OnError(Exception error)
- {
- _parent.Error(error);
- _self.Dispose();
- }
-
- public void OnCompleted()
- {
- if (_parent._map.Remove(_key))
- _writer.OnCompleted();
-
- _parent._parent._groupDisposable.Remove(_self);
- }
- }
-
- public void OnError(Exception error)
- {
- Error(error);
- }
-
- public void OnCompleted()
- {
- foreach (var w in _map.Values)
- w.OnCompleted();
-
- lock (base._observer)
- base._observer.OnCompleted();
-
- base.Dispose();
- }
-
- private void Error(Exception exception)
- {
- foreach (var w in _map.Values)
- w.OnError(exception);
-
- lock (base._observer)
- base._observer.OnError(exception);
-
- base.Dispose();
- }
- }
- }
-
-#if !NO_CDS
- class Map<TKey, TValue>
- {
- private readonly System.Collections.Concurrent.ConcurrentDictionary<TKey, TValue> _map;
-
- public Map(IEqualityComparer<TKey> comparer)
- {
- _map = new System.Collections.Concurrent.ConcurrentDictionary<TKey, TValue>(comparer);
- }
-
- public TValue GetOrAdd(TKey key, Func<TValue> valueFactory, out bool added)
- {
- added = false;
-
- var value = default(TValue);
- var newValue = default(TValue);
- var hasNewValue = false;
- while (true)
- {
- if (_map.TryGetValue(key, out value))
- break;
-
- if (!hasNewValue)
- {
- newValue = valueFactory();
- hasNewValue = true;
- }
-
- if (_map.TryAdd(key, newValue))
- {
- added = true;
- value = newValue;
- break;
- }
- }
-
- return value;
- }
-
- public IEnumerable<TValue> Values
- {
- get
- {
- return _map.Values.ToArray();
- }
- }
-
- public bool Remove(TKey key)
- {
- var value = default(TValue);
- return _map.TryRemove(key, out value);
- }
- }
-#else
- class Map<TKey, TValue>
- {
- private readonly Dictionary<TKey, TValue> _map;
-
- public Map(IEqualityComparer<TKey> comparer)
- {
- _map = new Dictionary<TKey, TValue>(comparer);
- }
-
- public TValue GetOrAdd(TKey key, Func<TValue> valueFactory, out bool added)
- {
- lock (_map)
- {
- added = false;
-
- var value = default(TValue);
- if (!_map.TryGetValue(key, out value))
- {
- value = valueFactory();
- _map.Add(key, value);
- added = true;
- }
-
- return value;
- }
- }
-
- public IEnumerable<TValue> Values
- {
- get
- {
- lock (_map)
- {
- return _map.Values.ToArray();
- }
- }
- }
-
- public bool Remove(TKey key)
- {
- lock (_map)
- {
- return _map.Remove(key);
- }
- }
- }
-#endif
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/GroupJoin.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/GroupJoin.cs
deleted file mode 100644
index 66e49be..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/GroupJoin.cs
+++ /dev/null
@@ -1,302 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_PERF
-using System;
-using System.Collections.Generic;
-using System.Reactive.Disposables;
-using System.Reactive.Subjects;
-
-namespace System.Reactive.Linq.Observαble
-{
- class GroupJoin<TLeft, TRight, TLeftDuration, TRightDuration, TResult> : Producer<TResult>
- {
- private readonly IObservable<TLeft> _left;
- private readonly IObservable<TRight> _right;
- private readonly Func<TLeft, IObservable<TLeftDuration>> _leftDurationSelector;
- private readonly Func<TRight, IObservable<TRightDuration>> _rightDurationSelector;
- private readonly Func<TLeft, IObservable<TRight>, TResult> _resultSelector;
-
- public GroupJoin(IObservable<TLeft> left, IObservable<TRight> right, Func<TLeft, IObservable<TLeftDuration>> leftDurationSelector, Func<TRight, IObservable<TRightDuration>> rightDurationSelector, Func<TLeft, IObservable<TRight>, TResult> resultSelector)
- {
- _left = left;
- _right = right;
- _leftDurationSelector = leftDurationSelector;
- _rightDurationSelector = rightDurationSelector;
- _resultSelector = resultSelector;
- }
-
- protected override IDisposable Run(IObserver<TResult> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(this, observer, cancel);
- setSink(sink);
- return sink.Run();
- }
-
- class _ : Sink<TResult>
- {
- private readonly GroupJoin<TLeft, TRight, TLeftDuration, TRightDuration, TResult> _parent;
-
- public _(GroupJoin<TLeft, TRight, TLeftDuration, TRightDuration, TResult> parent, IObserver<TResult> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _parent = parent;
- }
-
- private object _gate;
- private CompositeDisposable _group;
- private RefCountDisposable _refCount;
-
- private int _leftID;
- private Dictionary<int, IObserver<TRight>> _leftMap;
-
- private int _rightID;
- private Dictionary<int, TRight> _rightMap;
-
- public IDisposable Run()
- {
- _gate = new object();
- _group = new CompositeDisposable();
- _refCount = new RefCountDisposable(_group);
-
- var leftSubscription = new SingleAssignmentDisposable();
- _group.Add(leftSubscription);
- _leftID = 0;
- _leftMap = new Dictionary<int, IObserver<TRight>>();
-
- var rightSubscription = new SingleAssignmentDisposable();
- _group.Add(rightSubscription);
- _rightID = 0;
- _rightMap = new Dictionary<int, TRight>();
-
- leftSubscription.Disposable = _parent._left.SubscribeSafe(new λ(this, leftSubscription));
- rightSubscription.Disposable = _parent._right.SubscribeSafe(new ρ(this, rightSubscription));
-
- return _refCount;
- }
-
- class λ : IObserver<TLeft>
- {
- private readonly _ _parent;
- private readonly IDisposable _self;
-
- public λ(_ parent, IDisposable self)
- {
- _parent = parent;
- _self = self;
- }
-
- private void Expire(int id, IObserver<TRight> group, IDisposable resource)
- {
- lock (_parent._gate)
- if (_parent._leftMap.Remove(id))
- group.OnCompleted();
-
- _parent._group.Remove(resource);
- }
-
- public void OnNext(TLeft value)
- {
- var s = new Subject<TRight>();
- var id = 0;
- lock (_parent._gate)
- {
- id = _parent._leftID++;
- _parent._leftMap.Add(id, s);
- }
-
- var window = new WindowObservable<TRight>(s, _parent._refCount);
-
- // BREAKING CHANGE v2 > v1.x - Order of evaluation or the _leftDurationSelector and _resultSelector now consistent with Join.
- var md = new SingleAssignmentDisposable();
- _parent._group.Add(md);
-
- var duration = default(IObservable<TLeftDuration>);
- try
- {
- duration = _parent._parent._leftDurationSelector(value);
- }
- catch (Exception exception)
- {
- OnError(exception);
- return;
- }
-
- // BREAKING CHANGE v2 > v1.x - The duration sequence is subscribed to before the result sequence is evaluated.
- md.Disposable = duration.SubscribeSafe(new δ(this, id, s, md));
-
- var result = default(TResult);
- try
- {
- result = _parent._parent._resultSelector(value, window);
- }
- catch (Exception exception)
- {
- OnError(exception);
- return;
- }
-
- lock (_parent._gate)
- {
- _parent._observer.OnNext(result);
-
- foreach (var rightValue in _parent._rightMap.Values)
- {
- s.OnNext(rightValue);
- }
- }
- }
-
- class δ : IObserver<TLeftDuration>
- {
- private readonly λ _parent;
- private readonly int _id;
- private readonly IObserver<TRight> _group;
- private readonly IDisposable _self;
-
- public δ(λ parent, int id, IObserver<TRight> group, IDisposable self)
- {
- _parent = parent;
- _id = id;
- _group = group;
- _self = self;
- }
-
- public void OnNext(TLeftDuration value)
- {
- _parent.Expire(_id, _group, _self);
- }
-
- public void OnError(Exception error)
- {
- _parent.OnError(error);
- }
-
- public void OnCompleted()
- {
- _parent.Expire(_id, _group, _self);
- }
- }
-
- public void OnError(Exception error)
- {
- lock (_parent._gate)
- {
- foreach (var o in _parent._leftMap.Values)
- o.OnError(error);
-
- _parent._observer.OnError(error);
- _parent.Dispose();
- }
- }
-
- public void OnCompleted()
- {
- lock (_parent._gate)
- {
- _parent._observer.OnCompleted();
- _parent.Dispose();
- }
-
- _self.Dispose();
- }
- }
-
- class ρ : IObserver<TRight>
- {
- private readonly _ _parent;
- private readonly IDisposable _self;
-
- public ρ(_ parent, IDisposable self)
- {
- _parent = parent;
- _self = self;
- }
-
- private void Expire(int id, IDisposable resource)
- {
- lock (_parent._gate)
- _parent._rightMap.Remove(id);
-
- _parent._group.Remove(resource);
- }
-
- public void OnNext(TRight value)
- {
- var id = 0;
- lock (_parent._gate)
- {
- id = _parent._rightID++;
- _parent._rightMap.Add(id, value);
- }
-
- var md = new SingleAssignmentDisposable();
- _parent._group.Add(md);
-
- var duration = default(IObservable<TRightDuration>);
- try
- {
- duration = _parent._parent._rightDurationSelector(value);
- }
- catch (Exception exception)
- {
- OnError(exception);
- return;
- }
- md.Disposable = duration.SubscribeSafe(new δ(this, id, md));
-
- lock (_parent._gate)
- {
- foreach (var o in _parent._leftMap.Values)
- o.OnNext(value);
- }
- }
-
- class δ : IObserver<TRightDuration>
- {
- private readonly ρ _parent;
- private readonly int _id;
- private readonly IDisposable _self;
-
- public δ(ρ parent, int id, IDisposable self)
- {
- _parent = parent;
- _id = id;
- _self = self;
- }
-
- public void OnNext(TRightDuration value)
- {
- _parent.Expire(_id, _self);
- }
-
- public void OnError(Exception error)
- {
- _parent.OnError(error);
- }
-
- public void OnCompleted()
- {
- _parent.Expire(_id, _self);
- }
- }
-
- public void OnError(Exception error)
- {
- lock (_parent._gate)
- {
- foreach (var o in _parent._leftMap.Values)
- o.OnError(error);
- _parent._observer.OnError(error);
- _parent.Dispose();
- }
- }
-
- public void OnCompleted()
- {
- _self.Dispose();
- }
- }
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/If.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/If.cs
deleted file mode 100644
index 8b1804a..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/If.cs
+++ /dev/null
@@ -1,81 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_PERF
-using System;
-using System.Collections.Generic;
-using System.Reactive.Disposables;
-
-namespace System.Reactive.Linq.Observαble
-{
- class If<TResult> : Producer<TResult>, IEvaluatableObservable<TResult>
- {
- private readonly Func<bool> _condition;
- private readonly IObservable<TResult> _thenSource;
- private readonly IObservable<TResult> _elseSource;
-
- public If(Func<bool> condition, IObservable<TResult> thenSource, IObservable<TResult> elseSource)
- {
- _condition = condition;
- _thenSource = thenSource;
- _elseSource = elseSource;
- }
-
- public IObservable<TResult> Eval()
- {
- return _condition() ? _thenSource : _elseSource;
- }
-
- protected override IDisposable Run(IObserver<TResult> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(this, observer, cancel);
- setSink(sink);
- return sink.Run();
- }
-
- class _ : Sink<TResult>, IObserver<TResult>
- {
- private readonly If<TResult> _parent;
-
- public _(If<TResult> parent, IObserver<TResult> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _parent = parent;
- }
-
- public IDisposable Run()
- {
- var result = default(IObservable<TResult>);
- try
- {
- result = _parent.Eval();
- }
- catch (Exception exception)
- {
- base._observer.OnError(exception);
- base.Dispose();
- return Disposable.Empty;
- }
-
- return result.SubscribeSafe(this);
- }
-
- public void OnNext(TResult value)
- {
- base._observer.OnNext(value);
- }
-
- public void OnError(Exception error)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
-
- public void OnCompleted()
- {
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
- }
-}
-#endif
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/IgnoreElements.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/IgnoreElements.cs
deleted file mode 100644
index 65441bd..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/IgnoreElements.cs
+++ /dev/null
@@ -1,54 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_PERF
-using System;
-
-namespace System.Reactive.Linq.Observαble
-{
- class IgnoreElements<TSource> : Producer<TSource>
- {
- private readonly IObservable<TSource> _source;
-
- public IgnoreElements(IObservable<TSource> source)
- {
- _source = source;
- }
-
- public IObservable<TSource> Ω()
- {
- return this;
- }
-
- protected override IDisposable Run(IObserver<TSource> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(observer, cancel);
- setSink(sink);
- return _source.SubscribeSafe(sink);
- }
-
- class _ : Sink<TSource>, IObserver<TSource>
- {
- public _(IObserver<TSource> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- }
-
- public void OnNext(TSource value)
- {
- }
-
- public void OnError(Exception error)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
-
- public void OnCompleted()
- {
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/IsEmpty.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/IsEmpty.cs
deleted file mode 100644
index 674c6f8..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/IsEmpty.cs
+++ /dev/null
@@ -1,53 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_PERF
-using System;
-
-namespace System.Reactive.Linq.Observαble
-{
- class IsEmpty<TSource> : Producer<bool>
- {
- private readonly IObservable<TSource> _source;
-
- public IsEmpty(IObservable<TSource> source)
- {
- _source = source;
- }
-
- protected override IDisposable Run(IObserver<bool> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(observer, cancel);
- setSink(sink);
- return _source.SubscribeSafe(sink);
- }
-
- class _ : Sink<bool>, IObserver<TSource>
- {
- public _(IObserver<bool> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- }
-
- public void OnNext(TSource value)
- {
- base._observer.OnNext(false);
- base._observer.OnCompleted();
- base.Dispose();
- }
-
- public void OnError(Exception error)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
-
- public void OnCompleted()
- {
- base._observer.OnNext(true);
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Join.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Join.cs
deleted file mode 100644
index 13e6ad2..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Join.cs
+++ /dev/null
@@ -1,336 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_PERF
-using System;
-using System.Collections.Generic;
-using System.Reactive.Disposables;
-
-namespace System.Reactive.Linq.Observαble
-{
- class Join<TLeft, TRight, TLeftDuration, TRightDuration, TResult> : Producer<TResult>
- {
- private readonly IObservable<TLeft> _left;
- private readonly IObservable<TRight> _right;
- private readonly Func<TLeft, IObservable<TLeftDuration>> _leftDurationSelector;
- private readonly Func<TRight, IObservable<TRightDuration>> _rightDurationSelector;
- private readonly Func<TLeft, TRight, TResult> _resultSelector;
-
- public Join(IObservable<TLeft> left, IObservable<TRight> right, Func<TLeft, IObservable<TLeftDuration>> leftDurationSelector, Func<TRight, IObservable<TRightDuration>> rightDurationSelector, Func<TLeft, TRight, TResult> resultSelector)
- {
- _left = left;
- _right = right;
- _leftDurationSelector = leftDurationSelector;
- _rightDurationSelector = rightDurationSelector;
- _resultSelector = resultSelector;
- }
-
- protected override IDisposable Run(IObserver<TResult> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(this, observer, cancel);
- setSink(sink);
- return sink.Run();
- }
-
- class _ : Sink<TResult>
- {
- private readonly Join<TLeft, TRight, TLeftDuration, TRightDuration, TResult> _parent;
-
- public _(Join<TLeft, TRight, TLeftDuration, TRightDuration, TResult> parent, IObserver<TResult> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _parent = parent;
- }
-
- private object _gate;
- private CompositeDisposable _group;
-
- private bool _leftDone;
- private int _leftID;
- private Dictionary<int, TLeft> _leftMap;
-
- private bool _rightDone;
- private int _rightID;
- private Dictionary<int, TRight> _rightMap;
-
- public IDisposable Run()
- {
- _gate = new object();
- _group = new CompositeDisposable();
-
- var leftSubscription = new SingleAssignmentDisposable();
- _group.Add(leftSubscription);
- _leftDone = false;
- _leftID = 0;
- _leftMap = new Dictionary<int, TLeft>();
-
- var rightSubscription = new SingleAssignmentDisposable();
- _group.Add(rightSubscription);
- _rightDone = false;
- _rightID = 0;
- _rightMap = new Dictionary<int, TRight>();
-
- leftSubscription.Disposable = _parent._left.SubscribeSafe(new λ(this, leftSubscription));
- rightSubscription.Disposable = _parent._right.SubscribeSafe(new ρ(this, rightSubscription));
-
- return _group;
- }
-
- class λ : IObserver<TLeft>
- {
- private readonly _ _parent;
- private readonly IDisposable _self;
-
- public λ(_ parent, IDisposable self)
- {
- _parent = parent;
- _self = self;
- }
-
- private void Expire(int id, IDisposable resource)
- {
- lock (_parent._gate)
- {
- if (_parent._leftMap.Remove(id) && _parent._leftMap.Count == 0 && _parent._leftDone)
- {
- _parent._observer.OnCompleted();
- _parent.Dispose();
- }
- }
-
- _parent._group.Remove(resource);
- }
-
- public void OnNext(TLeft value)
- {
- var id = 0;
- lock (_parent._gate)
- {
- id = _parent._leftID++;
- _parent._leftMap.Add(id, value);
- }
-
- var md = new SingleAssignmentDisposable();
- _parent._group.Add(md);
-
- var duration = default(IObservable<TLeftDuration>);
- try
- {
- duration = _parent._parent._leftDurationSelector(value);
- }
- catch (Exception exception)
- {
- _parent._observer.OnError(exception);
- _parent.Dispose();
- return;
- }
-
- md.Disposable = duration.SubscribeSafe(new δ(this, id, md));
-
- lock (_parent._gate)
- {
- foreach (var rightValue in _parent._rightMap.Values)
- {
- var result = default(TResult);
- try
- {
- result = _parent._parent._resultSelector(value, rightValue);
- }
- catch (Exception exception)
- {
- _parent._observer.OnError(exception);
- _parent.Dispose();
- return;
- }
-
- _parent._observer.OnNext(result);
- }
- }
- }
-
- class δ : IObserver<TLeftDuration>
- {
- private readonly λ _parent;
- private readonly int _id;
- private readonly IDisposable _self;
-
- public δ(λ parent, int id, IDisposable self)
- {
- _parent = parent;
- _id = id;
- _self = self;
- }
-
- public void OnNext(TLeftDuration value)
- {
- _parent.Expire(_id, _self);
- }
-
- public void OnError(Exception error)
- {
- _parent.OnError(error);
- }
-
- public void OnCompleted()
- {
- _parent.Expire(_id, _self);
- }
- }
-
- public void OnError(Exception error)
- {
- lock (_parent._gate)
- {
- _parent._observer.OnError(error);
- _parent.Dispose();
- }
- }
-
- public void OnCompleted()
- {
- lock (_parent._gate)
- {
- _parent._leftDone = true;
- if (_parent._rightDone || _parent._leftMap.Count == 0)
- {
- _parent._observer.OnCompleted();
- _parent.Dispose();
- }
- else
- {
- _self.Dispose();
- }
- }
- }
- }
-
- class ρ : IObserver<TRight>
- {
- private readonly _ _parent;
- private readonly IDisposable _self;
-
- public ρ(_ parent, IDisposable self)
- {
- _parent = parent;
- _self = self;
- }
-
- private void Expire(int id, IDisposable resource)
- {
- lock (_parent._gate)
- {
- if (_parent._rightMap.Remove(id) && _parent._rightMap.Count == 0 && _parent._rightDone)
- {
- _parent._observer.OnCompleted();
- _parent.Dispose();
- }
- }
-
- _parent._group.Remove(resource);
- }
-
- public void OnNext(TRight value)
- {
- var id = 0;
- lock (_parent._gate)
- {
- id = _parent._rightID++;
- _parent._rightMap.Add(id, value);
- }
-
- var md = new SingleAssignmentDisposable();
- _parent._group.Add(md);
-
- var duration = default(IObservable<TRightDuration>);
- try
- {
- duration = _parent._parent._rightDurationSelector(value);
- }
- catch (Exception exception)
- {
- _parent._observer.OnError(exception);
- _parent.Dispose();
- return;
- }
-
- md.Disposable = duration.SubscribeSafe(new δ(this, id, md));
-
- lock (_parent._gate)
- {
- foreach (var leftValue in _parent._leftMap.Values)
- {
- var result = default(TResult);
- try
- {
- result = _parent._parent._resultSelector(leftValue, value);
- }
- catch (Exception exception)
- {
- _parent._observer.OnError(exception);
- _parent.Dispose();
- return;
- }
-
- _parent._observer.OnNext(result);
- }
- }
- }
-
- class δ : IObserver<TRightDuration>
- {
- private readonly ρ _parent;
- private readonly int _id;
- private readonly IDisposable _self;
-
- public δ(ρ parent, int id, IDisposable self)
- {
- _parent = parent;
- _id = id;
- _self = self;
- }
-
- public void OnNext(TRightDuration value)
- {
- _parent.Expire(_id, _self);
- }
-
- public void OnError(Exception error)
- {
- _parent.OnError(error);
- }
-
- public void OnCompleted()
- {
- _parent.Expire(_id, _self);
- }
- }
-
- public void OnError(Exception error)
- {
- lock (_parent._gate)
- {
- _parent._observer.OnError(error);
- _parent.Dispose();
- }
- }
-
- public void OnCompleted()
- {
- lock (_parent._gate)
- {
- _parent._rightDone = true;
- if (_parent._leftDone || _parent._rightMap.Count == 0)
- {
- _parent._observer.OnCompleted();
- _parent.Dispose();
- }
- else
- {
- _self.Dispose();
- }
- }
- }
- }
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/LastAsync.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/LastAsync.cs
deleted file mode 100644
index 1ecd930..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/LastAsync.cs
+++ /dev/null
@@ -1,140 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_PERF
-using System;
-
-namespace System.Reactive.Linq.Observαble
-{
- class LastAsync<TSource> : Producer<TSource>
- {
- private readonly IObservable<TSource> _source;
- private readonly Func<TSource, bool> _predicate;
- private readonly bool _throwOnEmpty;
-
- public LastAsync(IObservable<TSource> source, Func<TSource, bool> predicate, bool throwOnEmpty)
- {
- _source = source;
- _predicate = predicate;
- _throwOnEmpty = throwOnEmpty;
- }
-
- protected override IDisposable Run(IObserver<TSource> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- if (_predicate != null)
- {
- var sink = new π(this, observer, cancel);
- setSink(sink);
- return _source.SubscribeSafe(sink);
- }
- else
- {
- var sink = new _(this, observer, cancel);
- setSink(sink);
- return _source.SubscribeSafe(sink);
- }
- }
-
- class _ : Sink<TSource>, IObserver<TSource>
- {
- private readonly LastAsync<TSource> _parent;
- private TSource _value;
- private bool _seenValue;
-
- public _(LastAsync<TSource> parent, IObserver<TSource> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _parent = parent;
-
- _value = default(TSource);
- _seenValue = false;
- }
-
- public void OnNext(TSource value)
- {
- _value = value;
- _seenValue = true;
- }
-
- public void OnError(Exception error)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
-
- public void OnCompleted()
- {
- if (!_seenValue && _parent._throwOnEmpty)
- {
- base._observer.OnError(new InvalidOperationException(Strings_Linq.NO_ELEMENTS));
- }
- else
- {
- base._observer.OnNext(_value);
- base._observer.OnCompleted();
- }
-
- base.Dispose();
- }
- }
-
- class π : Sink<TSource>, IObserver<TSource>
- {
- private readonly LastAsync<TSource> _parent;
- private TSource _value;
- private bool _seenValue;
-
- public π(LastAsync<TSource> parent, IObserver<TSource> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _parent = parent;
-
- _value = default(TSource);
- _seenValue = false;
- }
-
- public void OnNext(TSource value)
- {
- var b = false;
-
- try
- {
- b = _parent._predicate(value);
- }
- catch (Exception ex)
- {
- base._observer.OnError(ex);
- base.Dispose();
- return;
- }
-
- if (b)
- {
- _value = value;
- _seenValue = true;
- }
- }
-
- public void OnError(Exception error)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
-
- public void OnCompleted()
- {
- if (!_seenValue && _parent._throwOnEmpty)
- {
- base._observer.OnError(new InvalidOperationException(Strings_Linq.NO_MATCHING_ELEMENTS));
- }
- else
- {
- base._observer.OnNext(_value);
- base._observer.OnCompleted();
- }
-
- base.Dispose();
- }
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Latest.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Latest.cs
deleted file mode 100644
index 2699797..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Latest.cs
+++ /dev/null
@@ -1,145 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_PERF
-using System;
-using System.Collections.Generic;
-using System.Reactive.Threading;
-using System.Threading;
-
-namespace System.Reactive.Linq.Observαble
-{
- class Latest<TSource> : PushToPullAdapter<TSource, TSource>
- {
- public Latest(IObservable<TSource> source)
- : base(source)
- {
- }
-
- protected override PushToPullSink<TSource, TSource> Run(IDisposable subscription)
- {
- return new _(subscription);
- }
-
- class _ : PushToPullSink<TSource, TSource>
- {
- private readonly object _gate;
-
-#if !NO_CDS
- private readonly SemaphoreSlim _semaphore;
-#else
- private readonly Semaphore _semaphore;
-#endif
-
- public _(IDisposable subscription)
- : base(subscription)
- {
- _gate = new object();
-
-#if !NO_CDS
- _semaphore = new SemaphoreSlim(0, 1);
-#else
- _semaphore = new Semaphore(0, 1);
-#endif
- }
-
- private bool _notificationAvailable;
- private NotificationKind _kind;
- private TSource _value;
- private Exception _error;
-
- public override void OnNext(TSource value)
- {
- var lackedValue = false;
- lock (_gate)
- {
- lackedValue = !_notificationAvailable;
- _notificationAvailable = true;
- _kind = NotificationKind.OnNext;
- _value = value;
- }
-
- if (lackedValue)
- _semaphore.Release();
- }
-
- public override void OnError(Exception error)
- {
- base.Dispose();
-
- var lackedValue = false;
- lock (_gate)
- {
- lackedValue = !_notificationAvailable;
- _notificationAvailable = true;
- _kind = NotificationKind.OnError;
- _error = error;
- }
-
- if (lackedValue)
- _semaphore.Release();
- }
-
- public override void OnCompleted()
- {
- base.Dispose();
-
- var lackedValue = false;
- lock (_gate)
- {
- lackedValue = !_notificationAvailable;
- _notificationAvailable = true;
- _kind = NotificationKind.OnCompleted;
- }
-
- if (lackedValue)
- _semaphore.Release();
- }
-
- public override bool TryMoveNext(out TSource current)
- {
- var kind = default(NotificationKind);
- var value = default(TSource);
- var error = default(Exception);
-
-#if !NO_CDS
- _semaphore.Wait();
-#else
- _semaphore.WaitOne();
-#endif
-
- lock (_gate)
- {
- kind = _kind;
-
- switch (kind)
- {
- case NotificationKind.OnNext:
- value = _value;
- break;
- case NotificationKind.OnError:
- error = _error;
- break;
- }
-
- _notificationAvailable = false;
- }
-
- switch (kind)
- {
- case NotificationKind.OnNext:
- current = _value;
- return true;
- case NotificationKind.OnError:
- error.Throw();
- break;
- case NotificationKind.OnCompleted:
- break;
- }
-
- current = default(TSource);
- return false;
- }
- }
- }
-}
-#endif
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/LongCount.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/LongCount.cs
deleted file mode 100644
index 0108e18..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/LongCount.cs
+++ /dev/null
@@ -1,124 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_PERF
-using System;
-
-namespace System.Reactive.Linq.Observαble
-{
- class LongCount<TSource> : Producer<long>
- {
- private readonly IObservable<TSource> _source;
- private readonly Func<TSource, bool> _predicate;
-
- public LongCount(IObservable<TSource> source)
- {
- _source = source;
- }
-
- public LongCount(IObservable<TSource> source, Func<TSource, bool> predicate)
- {
- _source = source;
- _predicate = predicate;
- }
-
- protected override IDisposable Run(IObserver<long> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- if (_predicate == null)
- {
- var sink = new _(observer, cancel);
- setSink(sink);
- return _source.SubscribeSafe(sink);
- }
- else
- {
- var sink = new π(this, observer, cancel);
- setSink(sink);
- return _source.SubscribeSafe(sink);
- }
- }
-
- class _ : Sink<long>, IObserver<TSource>
- {
- private long _count;
-
- public _(IObserver<long> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _count = 0L;
- }
-
- public void OnNext(TSource value)
- {
- try
- {
- checked
- {
- _count++;
- }
- }
- catch (Exception ex)
- {
- base._observer.OnError(ex);
- base.Dispose();
- }
- }
-
- public void OnError(Exception error)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
-
- public void OnCompleted()
- {
- base._observer.OnNext(_count);
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
-
- class π : Sink<long>, IObserver<TSource>
- {
- private readonly LongCount<TSource> _parent;
- private long _count;
-
- public π(LongCount<TSource> parent, IObserver<long> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _parent = parent;
- _count = 0L;
- }
-
- public void OnNext(TSource value)
- {
- try
- {
- checked
- {
- if (_parent._predicate(value))
- _count++;
- }
- }
- catch (Exception ex)
- {
- base._observer.OnError(ex);
- base.Dispose();
- }
- }
-
- public void OnError(Exception error)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
-
- public void OnCompleted()
- {
- base._observer.OnNext(_count);
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Materialize.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Materialize.cs
deleted file mode 100644
index 102267d..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Materialize.cs
+++ /dev/null
@@ -1,57 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_PERF
-using System;
-
-namespace System.Reactive.Linq.Observαble
-{
- class Materialize<TSource> : Producer<Notification<TSource>>
- {
- private readonly IObservable<TSource> _source;
-
- public Materialize(IObservable<TSource> source)
- {
- _source = source;
- }
-
- public IObservable<TSource> Dematerialize()
- {
- return _source.AsObservable();
- }
-
- protected override IDisposable Run(IObserver<Notification<TSource>> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(observer, cancel);
- setSink(sink);
- return _source.SubscribeSafe(sink);
- }
-
- class _ : Sink<Notification<TSource>>, IObserver<TSource>
- {
- public _(IObserver<Notification<TSource>> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- }
-
- public void OnNext(TSource value)
- {
- base._observer.OnNext(Notification.CreateOnNext<TSource>(value));
- }
-
- public void OnError(Exception error)
- {
- base._observer.OnNext(Notification.CreateOnError<TSource>(error));
- base._observer.OnCompleted();
- base.Dispose();
- }
-
- public void OnCompleted()
- {
- base._observer.OnNext(Notification.CreateOnCompleted<TSource>());
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Max.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Max.cs
deleted file mode 100644
index da339da..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Max.cs
+++ /dev/null
@@ -1,792 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_PERF
-using System;
-using System.Collections.Generic;
-
-namespace System.Reactive.Linq.Observαble
-{
- class Max<TSource> : Producer<TSource>
- {
- private readonly IObservable<TSource> _source;
- private readonly IComparer<TSource> _comparer;
-
- public Max(IObservable<TSource> source, IComparer<TSource> comparer)
- {
- _source = source;
- _comparer = comparer;
- }
-
- protected override IDisposable Run(IObserver<TSource> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- // LINQ to Objects makes this distinction in order to make [Max|Max] of an empty collection of reference type objects equal to null.
- if (default(TSource) == null)
- {
- var sink = new _(this, observer, cancel);
- setSink(sink);
- return _source.SubscribeSafe(sink);
- }
- else
- {
- var sink = new δ(this, observer, cancel);
- setSink(sink);
- return _source.SubscribeSafe(sink);
- }
- }
-
- class δ : Sink<TSource>, IObserver<TSource>
- {
- private readonly Max<TSource> _parent;
- private bool _hasValue;
- private TSource _lastValue;
-
- public δ(Max<TSource> parent, IObserver<TSource> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _parent = parent;
-
- _hasValue = false;
- _lastValue = default(TSource);
- }
-
- public void OnNext(TSource value)
- {
- if (_hasValue)
- {
- var comparison = 0;
-
- try
- {
- comparison = _parent._comparer.Compare(value, _lastValue);
- }
- catch (Exception ex)
- {
- base._observer.OnError(ex);
- base.Dispose();
- return;
- }
-
- if (comparison > 0)
- {
- _lastValue = value;
- }
- }
- else
- {
- _hasValue = true;
- _lastValue = value;
- }
- }
-
- public void OnError(Exception error)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
-
- public void OnCompleted()
- {
- if (!_hasValue)
- {
- base._observer.OnError(new InvalidOperationException(Strings_Linq.NO_ELEMENTS));
- }
- else
- {
- base._observer.OnNext(_lastValue);
- base._observer.OnCompleted();
- }
-
- base.Dispose();
- }
- }
-
- class _ : Sink<TSource>, IObserver<TSource>
- {
- private readonly Max<TSource> _parent;
- private TSource _lastValue;
-
- public _(Max<TSource> parent, IObserver<TSource> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _parent = parent;
-
- _lastValue = default(TSource);
- }
-
- public void OnNext(TSource value)
- {
- if (value != null)
- {
- if (_lastValue == null)
- {
- _lastValue = value;
- }
- else
- {
- var comparison = 0;
-
- try
- {
- comparison = _parent._comparer.Compare(value, _lastValue);
- }
- catch (Exception ex)
- {
- base._observer.OnError(ex);
- base.Dispose();
- return;
- }
-
- if (comparison > 0)
- {
- _lastValue = value;
- }
- }
- }
- }
-
- public void OnError(Exception error)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
-
- public void OnCompleted()
- {
- base._observer.OnNext(_lastValue);
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
- }
-
- class MaxDouble : Producer<double>
- {
- private readonly IObservable<double> _source;
-
- public MaxDouble(IObservable<double> source)
- {
- _source = source;
- }
-
- protected override IDisposable Run(IObserver<double> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(observer, cancel);
- setSink(sink);
- return _source.SubscribeSafe(sink);
- }
-
- class _ : Sink<double>, IObserver<double>
- {
- private bool _hasValue;
- private double _lastValue;
-
- public _(IObserver<double> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _hasValue = false;
- _lastValue = default(double);
- }
-
- public void OnNext(double value)
- {
- if (_hasValue)
- {
- if (value > _lastValue || double.IsNaN(value))
- {
- _lastValue = value;
- }
- }
- else
- {
- _lastValue = value;
- _hasValue = true;
- }
- }
-
- public void OnError(Exception error)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
-
- public void OnCompleted()
- {
- if (!_hasValue)
- {
- base._observer.OnError(new InvalidOperationException(Strings_Linq.NO_ELEMENTS));
- }
- else
- {
- base._observer.OnNext(_lastValue);
- base._observer.OnCompleted();
- }
-
- base.Dispose();
- }
- }
- }
-
- class MaxSingle : Producer<float>
- {
- private readonly IObservable<float> _source;
-
- public MaxSingle(IObservable<float> source)
- {
- _source = source;
- }
-
- protected override IDisposable Run(IObserver<float> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(observer, cancel);
- setSink(sink);
- return _source.SubscribeSafe(sink);
- }
-
- class _ : Sink<float>, IObserver<float>
- {
- private bool _hasValue;
- private float _lastValue;
-
- public _(IObserver<float> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _hasValue = false;
- _lastValue = default(float);
- }
-
- public void OnNext(float value)
- {
- if (_hasValue)
- {
- if (value > _lastValue || float.IsNaN(value))
- {
- _lastValue = value;
- }
- }
- else
- {
- _lastValue = value;
- _hasValue = true;
- }
- }
-
- public void OnError(Exception error)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
-
- public void OnCompleted()
- {
- if (!_hasValue)
- {
- base._observer.OnError(new InvalidOperationException(Strings_Linq.NO_ELEMENTS));
- }
- else
- {
- base._observer.OnNext(_lastValue);
- base._observer.OnCompleted();
- }
-
- base.Dispose();
- }
- }
- }
-
- class MaxDecimal : Producer<decimal>
- {
- private readonly IObservable<decimal> _source;
-
- public MaxDecimal(IObservable<decimal> source)
- {
- _source = source;
- }
-
- protected override IDisposable Run(IObserver<decimal> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(observer, cancel);
- setSink(sink);
- return _source.SubscribeSafe(sink);
- }
-
- class _ : Sink<decimal>, IObserver<decimal>
- {
- private bool _hasValue;
- private decimal _lastValue;
-
- public _(IObserver<decimal> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _hasValue = false;
- _lastValue = default(decimal);
- }
-
- public void OnNext(decimal value)
- {
- if (_hasValue)
- {
- if (value > _lastValue)
- {
- _lastValue = value;
- }
- }
- else
- {
- _lastValue = value;
- _hasValue = true;
- }
- }
-
- public void OnError(Exception error)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
-
- public void OnCompleted()
- {
- if (!_hasValue)
- {
- base._observer.OnError(new InvalidOperationException(Strings_Linq.NO_ELEMENTS));
- }
- else
- {
- base._observer.OnNext(_lastValue);
- base._observer.OnCompleted();
- }
-
- base.Dispose();
- }
- }
- }
-
- class MaxInt32 : Producer<int>
- {
- private readonly IObservable<int> _source;
-
- public MaxInt32(IObservable<int> source)
- {
- _source = source;
- }
-
- protected override IDisposable Run(IObserver<int> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(observer, cancel);
- setSink(sink);
- return _source.SubscribeSafe(sink);
- }
-
- class _ : Sink<int>, IObserver<int>
- {
- private bool _hasValue;
- private int _lastValue;
-
- public _(IObserver<int> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _hasValue = false;
- _lastValue = default(int);
- }
-
- public void OnNext(int value)
- {
- if (_hasValue)
- {
- if (value > _lastValue)
- {
- _lastValue = value;
- }
- }
- else
- {
- _lastValue = value;
- _hasValue = true;
- }
- }
-
- public void OnError(Exception error)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
-
- public void OnCompleted()
- {
- if (!_hasValue)
- {
- base._observer.OnError(new InvalidOperationException(Strings_Linq.NO_ELEMENTS));
- }
- else
- {
- base._observer.OnNext(_lastValue);
- base._observer.OnCompleted();
- }
-
- base.Dispose();
- }
- }
- }
-
- class MaxInt64 : Producer<long>
- {
- private readonly IObservable<long> _source;
-
- public MaxInt64(IObservable<long> source)
- {
- _source = source;
- }
-
- protected override IDisposable Run(IObserver<long> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(observer, cancel);
- setSink(sink);
- return _source.SubscribeSafe(sink);
- }
-
- class _ : Sink<long>, IObserver<long>
- {
- private bool _hasValue;
- private long _lastValue;
-
- public _(IObserver<long> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _hasValue = false;
- _lastValue = default(long);
- }
-
- public void OnNext(long value)
- {
- if (_hasValue)
- {
- if (value > _lastValue)
- {
- _lastValue = value;
- }
- }
- else
- {
- _lastValue = value;
- _hasValue = true;
- }
- }
-
- public void OnError(Exception error)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
-
- public void OnCompleted()
- {
- if (!_hasValue)
- {
- base._observer.OnError(new InvalidOperationException(Strings_Linq.NO_ELEMENTS));
- }
- else
- {
- base._observer.OnNext(_lastValue);
- base._observer.OnCompleted();
- }
-
- base.Dispose();
- }
- }
- }
-
- class MaxDoubleNullable : Producer<double?>
- {
- private readonly IObservable<double?> _source;
-
- public MaxDoubleNullable(IObservable<double?> source)
- {
- _source = source;
- }
-
- protected override IDisposable Run(IObserver<double?> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(observer, cancel);
- setSink(sink);
- return _source.SubscribeSafe(sink);
- }
-
- class _ : Sink<double?>, IObserver<double?>
- {
- private double? _lastValue;
-
- public _(IObserver<double?> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _lastValue = default(double?);
- }
-
- public void OnNext(double? value)
- {
- if (!value.HasValue)
- return;
-
- if (_lastValue.HasValue)
- {
- if (value > _lastValue || double.IsNaN((double)value))
- {
- _lastValue = value;
- }
- }
- else
- {
- _lastValue = value;
- }
- }
-
- public void OnError(Exception error)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
-
- public void OnCompleted()
- {
- base._observer.OnNext(_lastValue);
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
- }
-
- class MaxSingleNullable : Producer<float?>
- {
- private readonly IObservable<float?> _source;
-
- public MaxSingleNullable(IObservable<float?> source)
- {
- _source = source;
- }
-
- protected override IDisposable Run(IObserver<float?> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(observer, cancel);
- setSink(sink);
- return _source.SubscribeSafe(sink);
- }
-
- class _ : Sink<float?>, IObserver<float?>
- {
- private float? _lastValue;
-
- public _(IObserver<float?> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _lastValue = default(float?);
- }
-
- public void OnNext(float? value)
- {
- if (!value.HasValue)
- return;
-
- if (_lastValue.HasValue)
- {
- if (value > _lastValue || float.IsNaN((float)value))
- {
- _lastValue = value;
- }
- }
- else
- {
- _lastValue = value;
- }
- }
-
- public void OnError(Exception error)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
-
- public void OnCompleted()
- {
- base._observer.OnNext(_lastValue);
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
- }
-
- class MaxDecimalNullable : Producer<decimal?>
- {
- private readonly IObservable<decimal?> _source;
-
- public MaxDecimalNullable(IObservable<decimal?> source)
- {
- _source = source;
- }
-
- protected override IDisposable Run(IObserver<decimal?> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(observer, cancel);
- setSink(sink);
- return _source.SubscribeSafe(sink);
- }
-
- class _ : Sink<decimal?>, IObserver<decimal?>
- {
- private decimal? _lastValue;
-
- public _(IObserver<decimal?> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _lastValue = default(decimal?);
- }
-
- public void OnNext(decimal? value)
- {
- if (!value.HasValue)
- return;
-
- if (_lastValue.HasValue)
- {
- if (value > _lastValue)
- {
- _lastValue = value;
- }
- }
- else
- {
- _lastValue = value;
- }
- }
-
- public void OnError(Exception error)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
-
- public void OnCompleted()
- {
- base._observer.OnNext(_lastValue);
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
- }
-
- class MaxInt32Nullable : Producer<int?>
- {
- private readonly IObservable<int?> _source;
-
- public MaxInt32Nullable(IObservable<int?> source)
- {
- _source = source;
- }
-
- protected override IDisposable Run(IObserver<int?> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(observer, cancel);
- setSink(sink);
- return _source.SubscribeSafe(sink);
- }
-
- class _ : Sink<int?>, IObserver<int?>
- {
- private int? _lastValue;
-
- public _(IObserver<int?> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _lastValue = default(int?);
- }
-
- public void OnNext(int? value)
- {
- if (!value.HasValue)
- return;
-
- if (_lastValue.HasValue)
- {
- if (value > _lastValue)
- {
- _lastValue = value;
- }
- }
- else
- {
- _lastValue = value;
- }
- }
-
- public void OnError(Exception error)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
-
- public void OnCompleted()
- {
- base._observer.OnNext(_lastValue);
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
- }
-
- class MaxInt64Nullable : Producer<long?>
- {
- private readonly IObservable<long?> _source;
-
- public MaxInt64Nullable(IObservable<long?> source)
- {
- _source = source;
- }
-
- protected override IDisposable Run(IObserver<long?> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(observer, cancel);
- setSink(sink);
- return _source.SubscribeSafe(sink);
- }
-
- class _ : Sink<long?>, IObserver<long?>
- {
- private long? _lastValue;
-
- public _(IObserver<long?> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _lastValue = default(long?);
- }
-
- public void OnNext(long? value)
- {
- if (!value.HasValue)
- return;
-
- if (_lastValue.HasValue)
- {
- if (value > _lastValue)
- {
- _lastValue = value;
- }
- }
- else
- {
- _lastValue = value;
- }
- }
-
- public void OnError(Exception error)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
-
- public void OnCompleted()
- {
- base._observer.OnNext(_lastValue);
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/MaxBy.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/MaxBy.cs
deleted file mode 100644
index 52a9a42..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/MaxBy.cs
+++ /dev/null
@@ -1,108 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_PERF
-using System;
-using System.Collections.Generic;
-
-namespace System.Reactive.Linq.Observαble
-{
- class MaxBy<TSource, TKey> : Producer<IList<TSource>>
- {
- private readonly IObservable<TSource> _source;
- private readonly Func<TSource, TKey> _keySelector;
- private readonly IComparer<TKey> _comparer;
-
- public MaxBy(IObservable<TSource> source, Func<TSource, TKey> keySelector, IComparer<TKey> comparer)
- {
- _source = source;
- _keySelector = keySelector;
- _comparer = comparer;
- }
-
- protected override IDisposable Run(IObserver<IList<TSource>> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(this, observer, cancel);
- setSink(sink);
- return _source.SubscribeSafe(sink);
- }
-
- class _ : Sink<IList<TSource>>, IObserver<TSource>
- {
- private readonly MaxBy<TSource, TKey> _parent;
- private bool _hasValue;
- private TKey _lastKey;
- private List<TSource> _list;
-
- public _(MaxBy<TSource, TKey> parent, IObserver<IList<TSource>> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _parent = parent;
-
- _hasValue = false;
- _lastKey = default(TKey);
- _list = new List<TSource>();
- }
-
- public void OnNext(TSource value)
- {
- var key = default(TKey);
- try
- {
- key = _parent._keySelector(value);
- }
- catch (Exception ex)
- {
- base._observer.OnError(ex);
- base.Dispose();
- return;
- }
-
- var comparison = 0;
-
- if (!_hasValue)
- {
- _hasValue = true;
- _lastKey = key;
- }
- else
- {
- try
- {
- comparison = _parent._comparer.Compare(key, _lastKey);
- }
- catch (Exception ex)
- {
- base._observer.OnError(ex);
- base.Dispose();
- return;
- }
- }
-
- if (comparison > 0)
- {
- _lastKey = key;
- _list.Clear();
- }
-
- if (comparison >= 0)
- {
- _list.Add(value);
- }
- }
-
- public void OnError(Exception error)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
-
- public void OnCompleted()
- {
- base._observer.OnNext(_list);
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Merge.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Merge.cs
deleted file mode 100644
index b051a4b..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Merge.cs
+++ /dev/null
@@ -1,288 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_PERF
-using System;
-using System.Collections.Generic;
-using System.Reactive.Disposables;
-
-namespace System.Reactive.Linq.Observαble
-{
- class Merge<TSource> : Producer<TSource>
- {
- private readonly IObservable<IObservable<TSource>> _sources;
- private readonly int _maxConcurrent;
-
- public Merge(IObservable<IObservable<TSource>> sources)
- {
- _sources = sources;
- }
-
- public Merge(IObservable<IObservable<TSource>> sources, int maxConcurrent)
- {
- _sources = sources;
- _maxConcurrent = maxConcurrent;
- }
-
- protected override IDisposable Run(IObserver<TSource> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- if (_maxConcurrent > 0)
- {
- var sink = new μ(this, observer, cancel);
- setSink(sink);
- return sink.Run();
- }
- else
- {
- var sink = new _(this, observer, cancel);
- setSink(sink);
- return sink.Run();
- }
- }
-
- class _ : Sink<TSource>, IObserver<IObservable<TSource>>
- {
- private readonly Merge<TSource> _parent;
-
- public _(Merge<TSource> parent, IObserver<TSource> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _parent = parent;
- }
-
- private object _gate;
- private bool _isStopped;
- private CompositeDisposable _group;
- private SingleAssignmentDisposable _sourceSubscription;
-
- public IDisposable Run()
- {
- _gate = new object();
- _isStopped = false;
- _group = new CompositeDisposable();
-
- _sourceSubscription = new SingleAssignmentDisposable();
- _group.Add(_sourceSubscription);
- _sourceSubscription.Disposable = _parent._sources.SubscribeSafe(this);
-
- return _group;
- }
-
- public void OnNext(IObservable<TSource> value)
- {
- var innerSubscription = new SingleAssignmentDisposable();
- _group.Add(innerSubscription);
- innerSubscription.Disposable = value.SubscribeSafe(new ι(this, innerSubscription));
- }
-
- public void OnError(Exception error)
- {
- lock (_gate)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
- }
-
- public void OnCompleted()
- {
- _isStopped = true;
- if (_group.Count == 1)
- {
- //
- // Notice there can be a race between OnCompleted of the source and any
- // of the inner sequences, where both see _group.Count == 1, and one is
- // waiting for the lock. There won't be a double OnCompleted observation
- // though, because the call to Dispose silences the observer by swapping
- // in a NopObserver<T>.
- //
- lock (_gate)
- {
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
- else
- {
- _sourceSubscription.Dispose();
- }
- }
-
- class ι : IObserver<TSource>
- {
- private readonly _ _parent;
- private readonly IDisposable _self;
-
- public ι(_ parent, IDisposable self)
- {
- _parent = parent;
- _self = self;
- }
-
- public void OnNext(TSource value)
- {
- lock (_parent._gate)
- _parent._observer.OnNext(value);
- }
-
- public void OnError(Exception error)
- {
- lock (_parent._gate)
- {
- _parent._observer.OnError(error);
- _parent.Dispose();
- }
- }
-
- public void OnCompleted()
- {
- _parent._group.Remove(_self);
- if (_parent._isStopped && _parent._group.Count == 1)
- {
- //
- // Notice there can be a race between OnCompleted of the source and any
- // of the inner sequences, where both see _group.Count == 1, and one is
- // waiting for the lock. There won't be a double OnCompleted observation
- // though, because the call to Dispose silences the observer by swapping
- // in a NopObserver<T>.
- //
- lock (_parent._gate)
- {
- _parent._observer.OnCompleted();
- _parent.Dispose();
- }
- }
- }
- }
- }
-
- class μ : Sink<TSource>, IObserver<IObservable<TSource>>
- {
- private readonly Merge<TSource> _parent;
-
- public μ(Merge<TSource> parent, IObserver<TSource> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _parent = parent;
- }
-
- private object _gate;
- private Queue<IObservable<TSource>> _q;
- private bool _isStopped;
- private SingleAssignmentDisposable _sourceSubscription;
- private CompositeDisposable _group;
- private int _activeCount = 0;
-
- public IDisposable Run()
- {
- _gate = new object();
- _q = new Queue<IObservable<TSource>>();
- _isStopped = false;
- _activeCount = 0;
-
- _group = new CompositeDisposable();
- _sourceSubscription = new SingleAssignmentDisposable();
- _sourceSubscription.Disposable = _parent._sources.SubscribeSafe(this);
- _group.Add(_sourceSubscription);
-
- return _group;
- }
-
- public void OnNext(IObservable<TSource> value)
- {
- lock (_gate)
- {
- if (_activeCount < _parent._maxConcurrent)
- {
- _activeCount++;
- Subscribe(value);
- }
- else
- _q.Enqueue(value);
- }
- }
-
- public void OnError(Exception error)
- {
- lock (_gate)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
- }
-
- public void OnCompleted()
- {
- lock (_gate)
- {
- _isStopped = true;
- if (_activeCount == 0)
- {
- base._observer.OnCompleted();
- base.Dispose();
- }
- else
- {
- _sourceSubscription.Dispose();
- }
- }
- }
-
- private void Subscribe(IObservable<TSource> innerSource)
- {
- var subscription = new SingleAssignmentDisposable();
- _group.Add(subscription);
- subscription.Disposable = innerSource.SubscribeSafe(new ι(this, subscription));
- }
-
- class ι : IObserver<TSource>
- {
- private readonly μ _parent;
- private readonly IDisposable _self;
-
- public ι(μ parent, IDisposable self)
- {
- _parent = parent;
- _self = self;
- }
-
- public void OnNext(TSource value)
- {
- lock (_parent._gate)
- _parent._observer.OnNext(value);
- }
-
- public void OnError(Exception error)
- {
- lock (_parent._gate)
- {
- _parent._observer.OnError(error);
- _parent.Dispose();
- }
- }
-
- public void OnCompleted()
- {
- _parent._group.Remove(_self);
- lock (_parent._gate)
- {
- if (_parent._q.Count > 0)
- {
- var s = _parent._q.Dequeue();
- _parent.Subscribe(s);
- }
- else
- {
- _parent._activeCount--;
- if (_parent._isStopped && _parent._activeCount == 0)
- {
- _parent._observer.OnCompleted();
- _parent.Dispose();
- }
- }
- }
- }
- }
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Min.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Min.cs
deleted file mode 100644
index f7b6197..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Min.cs
+++ /dev/null
@@ -1,792 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_PERF
-using System;
-using System.Collections.Generic;
-
-namespace System.Reactive.Linq.Observαble
-{
- class Min<TSource> : Producer<TSource>
- {
- private readonly IObservable<TSource> _source;
- private readonly IComparer<TSource> _comparer;
-
- public Min(IObservable<TSource> source, IComparer<TSource> comparer)
- {
- _source = source;
- _comparer = comparer;
- }
-
- protected override IDisposable Run(IObserver<TSource> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- // LINQ to Objects makes this distinction in order to make [Min|Max] of an empty collection of reference type objects equal to null.
- if (default(TSource) == null)
- {
- var sink = new _(this, observer, cancel);
- setSink(sink);
- return _source.SubscribeSafe(sink);
- }
- else
- {
- var sink = new δ(this, observer, cancel);
- setSink(sink);
- return _source.SubscribeSafe(sink);
- }
- }
-
- class δ : Sink<TSource>, IObserver<TSource>
- {
- private readonly Min<TSource> _parent;
- private bool _hasValue;
- private TSource _lastValue;
-
- public δ(Min<TSource> parent, IObserver<TSource> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _parent = parent;
-
- _hasValue = false;
- _lastValue = default(TSource);
- }
-
- public void OnNext(TSource value)
- {
- if (_hasValue)
- {
- var comparison = 0;
-
- try
- {
- comparison = _parent._comparer.Compare(value, _lastValue);
- }
- catch (Exception ex)
- {
- base._observer.OnError(ex);
- base.Dispose();
- return;
- }
-
- if (comparison < 0)
- {
- _lastValue = value;
- }
- }
- else
- {
- _hasValue = true;
- _lastValue = value;
- }
- }
-
- public void OnError(Exception error)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
-
- public void OnCompleted()
- {
- if (!_hasValue)
- {
- base._observer.OnError(new InvalidOperationException(Strings_Linq.NO_ELEMENTS));
- }
- else
- {
- base._observer.OnNext(_lastValue);
- base._observer.OnCompleted();
- }
-
- base.Dispose();
- }
- }
-
- class _ : Sink<TSource>, IObserver<TSource>
- {
- private readonly Min<TSource> _parent;
- private TSource _lastValue;
-
- public _(Min<TSource> parent, IObserver<TSource> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _parent = parent;
-
- _lastValue = default(TSource);
- }
-
- public void OnNext(TSource value)
- {
- if (value != null)
- {
- if (_lastValue == null)
- {
- _lastValue = value;
- }
- else
- {
- var comparison = 0;
-
- try
- {
- comparison = _parent._comparer.Compare(value, _lastValue);
- }
- catch (Exception ex)
- {
- base._observer.OnError(ex);
- base.Dispose();
- return;
- }
-
- if (comparison < 0)
- {
- _lastValue = value;
- }
- }
- }
- }
-
- public void OnError(Exception error)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
-
- public void OnCompleted()
- {
- base._observer.OnNext(_lastValue);
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
- }
-
- class MinDouble : Producer<double>
- {
- private readonly IObservable<double> _source;
-
- public MinDouble(IObservable<double> source)
- {
- _source = source;
- }
-
- protected override IDisposable Run(IObserver<double> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(observer, cancel);
- setSink(sink);
- return _source.SubscribeSafe(sink);
- }
-
- class _ : Sink<double>, IObserver<double>
- {
- private bool _hasValue;
- private double _lastValue;
-
- public _(IObserver<double> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _hasValue = false;
- _lastValue = default(double);
- }
-
- public void OnNext(double value)
- {
- if (_hasValue)
- {
- if (value < _lastValue || double.IsNaN(value))
- {
- _lastValue = value;
- }
- }
- else
- {
- _lastValue = value;
- _hasValue = true;
- }
- }
-
- public void OnError(Exception error)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
-
- public void OnCompleted()
- {
- if (!_hasValue)
- {
- base._observer.OnError(new InvalidOperationException(Strings_Linq.NO_ELEMENTS));
- }
- else
- {
- base._observer.OnNext(_lastValue);
- base._observer.OnCompleted();
- }
-
- base.Dispose();
- }
- }
- }
-
- class MinSingle : Producer<float>
- {
- private readonly IObservable<float> _source;
-
- public MinSingle(IObservable<float> source)
- {
- _source = source;
- }
-
- protected override IDisposable Run(IObserver<float> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(observer, cancel);
- setSink(sink);
- return _source.SubscribeSafe(sink);
- }
-
- class _ : Sink<float>, IObserver<float>
- {
- private bool _hasValue;
- private float _lastValue;
-
- public _(IObserver<float> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _hasValue = false;
- _lastValue = default(float);
- }
-
- public void OnNext(float value)
- {
- if (_hasValue)
- {
- if (value < _lastValue || float.IsNaN(value))
- {
- _lastValue = value;
- }
- }
- else
- {
- _lastValue = value;
- _hasValue = true;
- }
- }
-
- public void OnError(Exception error)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
-
- public void OnCompleted()
- {
- if (!_hasValue)
- {
- base._observer.OnError(new InvalidOperationException(Strings_Linq.NO_ELEMENTS));
- }
- else
- {
- base._observer.OnNext(_lastValue);
- base._observer.OnCompleted();
- }
-
- base.Dispose();
- }
- }
- }
-
- class MinDecimal : Producer<decimal>
- {
- private readonly IObservable<decimal> _source;
-
- public MinDecimal(IObservable<decimal> source)
- {
- _source = source;
- }
-
- protected override IDisposable Run(IObserver<decimal> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(observer, cancel);
- setSink(sink);
- return _source.SubscribeSafe(sink);
- }
-
- class _ : Sink<decimal>, IObserver<decimal>
- {
- private bool _hasValue;
- private decimal _lastValue;
-
- public _(IObserver<decimal> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _hasValue = false;
- _lastValue = default(decimal);
- }
-
- public void OnNext(decimal value)
- {
- if (_hasValue)
- {
- if (value < _lastValue)
- {
- _lastValue = value;
- }
- }
- else
- {
- _lastValue = value;
- _hasValue = true;
- }
- }
-
- public void OnError(Exception error)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
-
- public void OnCompleted()
- {
- if (!_hasValue)
- {
- base._observer.OnError(new InvalidOperationException(Strings_Linq.NO_ELEMENTS));
- }
- else
- {
- base._observer.OnNext(_lastValue);
- base._observer.OnCompleted();
- }
-
- base.Dispose();
- }
- }
- }
-
- class MinInt32 : Producer<int>
- {
- private readonly IObservable<int> _source;
-
- public MinInt32(IObservable<int> source)
- {
- _source = source;
- }
-
- protected override IDisposable Run(IObserver<int> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(observer, cancel);
- setSink(sink);
- return _source.SubscribeSafe(sink);
- }
-
- class _ : Sink<int>, IObserver<int>
- {
- private bool _hasValue;
- private int _lastValue;
-
- public _(IObserver<int> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _hasValue = false;
- _lastValue = default(int);
- }
-
- public void OnNext(int value)
- {
- if (_hasValue)
- {
- if (value < _lastValue)
- {
- _lastValue = value;
- }
- }
- else
- {
- _lastValue = value;
- _hasValue = true;
- }
- }
-
- public void OnError(Exception error)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
-
- public void OnCompleted()
- {
- if (!_hasValue)
- {
- base._observer.OnError(new InvalidOperationException(Strings_Linq.NO_ELEMENTS));
- }
- else
- {
- base._observer.OnNext(_lastValue);
- base._observer.OnCompleted();
- }
-
- base.Dispose();
- }
- }
- }
-
- class MinInt64 : Producer<long>
- {
- private readonly IObservable<long> _source;
-
- public MinInt64(IObservable<long> source)
- {
- _source = source;
- }
-
- protected override IDisposable Run(IObserver<long> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(observer, cancel);
- setSink(sink);
- return _source.SubscribeSafe(sink);
- }
-
- class _ : Sink<long>, IObserver<long>
- {
- private bool _hasValue;
- private long _lastValue;
-
- public _(IObserver<long> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _hasValue = false;
- _lastValue = default(long);
- }
-
- public void OnNext(long value)
- {
- if (_hasValue)
- {
- if (value < _lastValue)
- {
- _lastValue = value;
- }
- }
- else
- {
- _lastValue = value;
- _hasValue = true;
- }
- }
-
- public void OnError(Exception error)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
-
- public void OnCompleted()
- {
- if (!_hasValue)
- {
- base._observer.OnError(new InvalidOperationException(Strings_Linq.NO_ELEMENTS));
- }
- else
- {
- base._observer.OnNext(_lastValue);
- base._observer.OnCompleted();
- }
-
- base.Dispose();
- }
- }
- }
-
- class MinDoubleNullable : Producer<double?>
- {
- private readonly IObservable<double?> _source;
-
- public MinDoubleNullable(IObservable<double?> source)
- {
- _source = source;
- }
-
- protected override IDisposable Run(IObserver<double?> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(observer, cancel);
- setSink(sink);
- return _source.SubscribeSafe(sink);
- }
-
- class _ : Sink<double?>, IObserver<double?>
- {
- private double? _lastValue;
-
- public _(IObserver<double?> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _lastValue = default(double?);
- }
-
- public void OnNext(double? value)
- {
- if (!value.HasValue)
- return;
-
- if (_lastValue.HasValue)
- {
- if (value < _lastValue || double.IsNaN((double)value))
- {
- _lastValue = value;
- }
- }
- else
- {
- _lastValue = value;
- }
- }
-
- public void OnError(Exception error)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
-
- public void OnCompleted()
- {
- base._observer.OnNext(_lastValue);
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
- }
-
- class MinSingleNullable : Producer<float?>
- {
- private readonly IObservable<float?> _source;
-
- public MinSingleNullable(IObservable<float?> source)
- {
- _source = source;
- }
-
- protected override IDisposable Run(IObserver<float?> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(observer, cancel);
- setSink(sink);
- return _source.SubscribeSafe(sink);
- }
-
- class _ : Sink<float?>, IObserver<float?>
- {
- private float? _lastValue;
-
- public _(IObserver<float?> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _lastValue = default(float?);
- }
-
- public void OnNext(float? value)
- {
- if (!value.HasValue)
- return;
-
- if (_lastValue.HasValue)
- {
- if (value < _lastValue || float.IsNaN((float)value))
- {
- _lastValue = value;
- }
- }
- else
- {
- _lastValue = value;
- }
- }
-
- public void OnError(Exception error)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
-
- public void OnCompleted()
- {
- base._observer.OnNext(_lastValue);
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
- }
-
- class MinDecimalNullable : Producer<decimal?>
- {
- private readonly IObservable<decimal?> _source;
-
- public MinDecimalNullable(IObservable<decimal?> source)
- {
- _source = source;
- }
-
- protected override IDisposable Run(IObserver<decimal?> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(observer, cancel);
- setSink(sink);
- return _source.SubscribeSafe(sink);
- }
-
- class _ : Sink<decimal?>, IObserver<decimal?>
- {
- private decimal? _lastValue;
-
- public _(IObserver<decimal?> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _lastValue = default(decimal?);
- }
-
- public void OnNext(decimal? value)
- {
- if (!value.HasValue)
- return;
-
- if (_lastValue.HasValue)
- {
- if (value < _lastValue)
- {
- _lastValue = value;
- }
- }
- else
- {
- _lastValue = value;
- }
- }
-
- public void OnError(Exception error)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
-
- public void OnCompleted()
- {
- base._observer.OnNext(_lastValue);
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
- }
-
- class MinInt32Nullable : Producer<int?>
- {
- private readonly IObservable<int?> _source;
-
- public MinInt32Nullable(IObservable<int?> source)
- {
- _source = source;
- }
-
- protected override IDisposable Run(IObserver<int?> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(observer, cancel);
- setSink(sink);
- return _source.SubscribeSafe(sink);
- }
-
- class _ : Sink<int?>, IObserver<int?>
- {
- private int? _lastValue;
-
- public _(IObserver<int?> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _lastValue = default(int?);
- }
-
- public void OnNext(int? value)
- {
- if (!value.HasValue)
- return;
-
- if (_lastValue.HasValue)
- {
- if (value < _lastValue)
- {
- _lastValue = value;
- }
- }
- else
- {
- _lastValue = value;
- }
- }
-
- public void OnError(Exception error)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
-
- public void OnCompleted()
- {
- base._observer.OnNext(_lastValue);
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
- }
-
- class MinInt64Nullable : Producer<long?>
- {
- private readonly IObservable<long?> _source;
-
- public MinInt64Nullable(IObservable<long?> source)
- {
- _source = source;
- }
-
- protected override IDisposable Run(IObserver<long?> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(observer, cancel);
- setSink(sink);
- return _source.SubscribeSafe(sink);
- }
-
- class _ : Sink<long?>, IObserver<long?>
- {
- private long? _lastValue;
-
- public _(IObserver<long?> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _lastValue = default(long?);
- }
-
- public void OnNext(long? value)
- {
- if (!value.HasValue)
- return;
-
- if (_lastValue.HasValue)
- {
- if (value < _lastValue)
- {
- _lastValue = value;
- }
- }
- else
- {
- _lastValue = value;
- }
- }
-
- public void OnError(Exception error)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
-
- public void OnCompleted()
- {
- base._observer.OnNext(_lastValue);
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/MinBy.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/MinBy.cs
deleted file mode 100644
index a32bf92..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/MinBy.cs
+++ /dev/null
@@ -1,108 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_PERF
-using System;
-using System.Collections.Generic;
-
-namespace System.Reactive.Linq.Observαble
-{
- class MinBy<TSource, TKey> : Producer<IList<TSource>>
- {
- private readonly IObservable<TSource> _source;
- private readonly Func<TSource, TKey> _keySelector;
- private readonly IComparer<TKey> _comparer;
-
- public MinBy(IObservable<TSource> source, Func<TSource, TKey> keySelector, IComparer<TKey> comparer)
- {
- _source = source;
- _keySelector = keySelector;
- _comparer = comparer;
- }
-
- protected override IDisposable Run(IObserver<IList<TSource>> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(this, observer, cancel);
- setSink(sink);
- return _source.SubscribeSafe(sink);
- }
-
- class _ : Sink<IList<TSource>>, IObserver<TSource>
- {
- private readonly MinBy<TSource, TKey> _parent;
- private bool _hasValue;
- private TKey _lastKey;
- private List<TSource> _list;
-
- public _(MinBy<TSource, TKey> parent, IObserver<IList<TSource>> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _parent = parent;
-
- _hasValue = false;
- _lastKey = default(TKey);
- _list = new List<TSource>();
- }
-
- public void OnNext(TSource value)
- {
- var key = default(TKey);
- try
- {
- key = _parent._keySelector(value);
- }
- catch (Exception ex)
- {
- base._observer.OnError(ex);
- base.Dispose();
- return;
- }
-
- var comparison = 0;
-
- if (!_hasValue)
- {
- _hasValue = true;
- _lastKey = key;
- }
- else
- {
- try
- {
- comparison = _parent._comparer.Compare(key, _lastKey);
- }
- catch (Exception ex)
- {
- base._observer.OnError(ex);
- base.Dispose();
- return;
- }
- }
-
- if (comparison < 0)
- {
- _lastKey = key;
- _list.Clear();
- }
-
- if (comparison <= 0)
- {
- _list.Add(value);
- }
- }
-
- public void OnError(Exception error)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
-
- public void OnCompleted()
- {
- base._observer.OnNext(_list);
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/MostRecent.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/MostRecent.cs
deleted file mode 100644
index 937d811..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/MostRecent.cs
+++ /dev/null
@@ -1,85 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_PERF
-using System;
-using System.Collections.Generic;
-using System.Threading;
-
-namespace System.Reactive.Linq.Observαble
-{
- class MostRecent<TSource> : PushToPullAdapter<TSource, TSource>
- {
- private readonly TSource _initialValue;
-
- public MostRecent(IObservable<TSource> source, TSource initialValue)
- : base(source)
- {
- _initialValue = initialValue;
- }
-
- protected override PushToPullSink<TSource, TSource> Run(IDisposable subscription)
- {
- return new _(_initialValue, subscription);
- }
-
- class _ : PushToPullSink<TSource, TSource>
- {
- public _(TSource initialValue, IDisposable subscription)
- : base(subscription)
- {
- _kind = NotificationKind.OnNext;
- _value = initialValue;
- }
-
- private volatile NotificationKind _kind;
- private TSource _value;
- private Exception _error;
-
- public override void OnNext(TSource value)
- {
- _value = value;
- _kind = NotificationKind.OnNext; // Write last!
- }
-
- public override void OnError(Exception error)
- {
- base.Dispose();
-
- _error = error;
- _kind = NotificationKind.OnError; // Write last!
- }
-
- public override void OnCompleted()
- {
- base.Dispose();
-
- _kind = NotificationKind.OnCompleted; // Write last!
- }
-
- public override bool TryMoveNext(out TSource current)
- {
- //
- // Notice the _kind field is marked volatile and read before the other fields.
- //
- // In case of a concurrent change, we may read a stale OnNext value, which is
- // fine because this push-to-pull adapter is about sampling.
- //
- switch (_kind)
- {
- case NotificationKind.OnNext:
- current = _value;
- return true;
- case NotificationKind.OnError:
- _error.Throw();
- break;
- case NotificationKind.OnCompleted:
- break;
- }
-
- current = default(TSource);
- return false;
- }
- }
- }
-}
-#endif
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Multicast.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Multicast.cs
deleted file mode 100644
index 4a77300..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Multicast.cs
+++ /dev/null
@@ -1,82 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_PERF
-using System;
-using System.Reactive.Disposables;
-using System.Reactive.Subjects;
-
-namespace System.Reactive.Linq.Observαble
-{
- class Multicast<TSource, TIntermediate, TResult> : Producer<TResult>
- {
- private readonly IObservable<TSource> _source;
- private readonly Func<ISubject<TSource, TIntermediate>> _subjectSelector;
- private readonly Func<IObservable<TIntermediate>, IObservable<TResult>> _selector;
-
- public Multicast(IObservable<TSource> source, Func<ISubject<TSource, TIntermediate>> subjectSelector, Func<IObservable<TIntermediate>, IObservable<TResult>> selector)
- {
- _source = source;
- _subjectSelector = subjectSelector;
- _selector = selector;
- }
-
- protected override IDisposable Run(IObserver<TResult> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(this, observer, cancel);
- setSink(sink);
- return sink.Run();
- }
-
- class _ : Sink<TResult>, IObserver<TResult>
- {
- private readonly Multicast<TSource, TIntermediate, TResult> _parent;
-
- public _(Multicast<TSource, TIntermediate, TResult> parent, IObserver<TResult> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _parent = parent;
- }
-
- public IDisposable Run()
- {
- var observable = default(IObservable<TResult>);
- var connectable = default(IConnectableObservable<TIntermediate>);
- try
- {
- var subject = _parent._subjectSelector();
- connectable = new ConnectableObservable<TSource, TIntermediate>(_parent._source, subject);
- observable = _parent._selector(connectable);
- }
- catch (Exception exception)
- {
- base._observer.OnError(exception);
- base.Dispose();
- return Disposable.Empty;
- }
-
- var subscription = observable.SubscribeSafe(this);
- var connection = connectable.Connect();
-
- return new CompositeDisposable(subscription, connection);
- }
-
- public void OnNext(TResult value)
- {
- base._observer.OnNext(value);
- }
-
- public void OnError(Exception error)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
-
- public void OnCompleted()
- {
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
- }
-}
-#endif
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Never.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Never.cs
deleted file mode 100644
index a9adc52..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Never.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_PERF
-using System;
-using System.Reactive.Disposables;
-
-namespace System.Reactive.Linq.Observαble
-{
- class Never<TResult> : IObservable<TResult>
- {
- public IDisposable Subscribe(IObserver<TResult> observer)
- {
- if (observer == null)
- throw new ArgumentNullException("observer");
-
- return Disposable.Empty;
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Next.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Next.cs
deleted file mode 100644
index 2d4ec45..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Next.cs
+++ /dev/null
@@ -1,156 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_PERF
-using System;
-using System.Collections.Generic;
-using System.Reactive.Threading;
-using System.Threading;
-
-namespace System.Reactive.Linq.Observαble
-{
- class Next<TSource> : PushToPullAdapter<TSource, TSource>
- {
- public Next(IObservable<TSource> source)
- : base(source)
- {
- }
-
- protected override PushToPullSink<TSource, TSource> Run(IDisposable subscription)
- {
- return new _(subscription);
- }
-
- class _ : PushToPullSink<TSource, TSource>
- {
- private readonly object _gate;
-
-#if !NO_CDS
- private readonly SemaphoreSlim _semaphore;
-#else
- private readonly Semaphore _semaphore;
-#endif
-
- public _(IDisposable subscription)
- : base(subscription)
- {
- _gate = new object();
-
-#if !NO_CDS
- _semaphore = new SemaphoreSlim(0, 1);
-#else
- _semaphore = new Semaphore(0, 1);
-#endif
- }
-
- private bool _waiting;
- private NotificationKind _kind;
- private TSource _value;
- private Exception _error;
-
- public override void OnNext(TSource value)
- {
- lock (_gate)
- {
- if (_waiting)
- {
- _value = value;
- _kind = NotificationKind.OnNext;
- _semaphore.Release();
- }
-
- _waiting = false;
- }
- }
-
- public override void OnError(Exception error)
- {
- base.Dispose();
-
- lock (_gate)
- {
- //
- // BREAKING CHANGE v2 > v1.x - Next doesn't block indefinitely when it reaches the end.
- //
- _error = error;
- _kind = NotificationKind.OnError;
-
- if (_waiting)
- _semaphore.Release();
-
- _waiting = false;
- }
- }
-
- public override void OnCompleted()
- {
- base.Dispose();
-
- lock (_gate)
- {
- //
- // BREAKING CHANGE v2 > v1.x - Next doesn't block indefinitely when it reaches the end.
- //
- _kind = NotificationKind.OnCompleted;
-
- if (_waiting)
- _semaphore.Release();
-
- _waiting = false;
- }
- }
-
- public override bool TryMoveNext(out TSource current)
- {
- var done = false;
-
- lock (_gate)
- {
- _waiting = true;
-
- //
- // BREAKING CHANGE v2 > v1.x - Next doesn't block indefinitely when it reaches the end.
- //
- done = _kind != NotificationKind.OnNext;
- }
-
- if (!done)
- {
-#if !NO_CDS
- _semaphore.Wait();
-#else
- _semaphore.WaitOne();
-#endif
- }
-
- //
- // When we reach this point, we released the lock and got the next notification
- // from the observer. We assume no concurrent calls to the TryMoveNext method
- // are made (per general guidance on usage of IEnumerable<T>). If the observer
- // enters the lock again, it should have quit it first, causing _waiting to be
- // set to false, hence future accesses of the lock won't set the _kind, _value,
- // and _error fields, until TryMoveNext is entered again and _waiting is reset
- // to true. In conclusion, the fields are stable for read below.
- //
- // Notice we rely on memory barrier acquire/release behavior due to the use of
- // the semaphore, not the lock (we're still under the lock when we release the
- // semaphore in the On* methods!).
- //
- switch (_kind)
- {
- case NotificationKind.OnNext:
- current = _value;
- return true;
- case NotificationKind.OnError:
- _error.Throw();
- break;
- case NotificationKind.OnCompleted:
- break;
- }
-
- current = default(TSource);
- return false;
- }
- }
- }
-}
-#endif
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/ObserveOn.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/ObserveOn.cs
deleted file mode 100644
index 4fe94d3..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/ObserveOn.cs
+++ /dev/null
@@ -1,87 +0,0 @@
-#if !NO_PERF
-using System;
-using System.Reactive.Concurrency;
-using System.Threading;
-
-namespace System.Reactive.Linq.Observαble
-{
- class ObserveOn<TSource> : Producer<TSource>
- {
- private readonly IObservable<TSource> _source;
- private readonly IScheduler _scheduler;
-
- public ObserveOn(IObservable<TSource> source, IScheduler scheduler)
- {
- _source = source;
- _scheduler = scheduler;
- }
-
-#if !NO_SYNCCTX
- private readonly SynchronizationContext _context;
-
- public ObserveOn(IObservable<TSource> source, SynchronizationContext context)
- {
- _source = source;
- _context = context;
- }
-#endif
-
- protected override IDisposable Run(IObserver<TSource> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
-#if !NO_SYNCCTX
- if (_context != null)
- {
- var sink = new ς(this, observer, cancel);
- setSink(sink);
- return _source.Subscribe(sink);
- }
- else
-#endif
- {
- var sink = new ObserveOnObserver<TSource>(_scheduler, observer, cancel);
- setSink(sink);
- return _source.Subscribe(sink);
- }
- }
-
-#if !NO_SYNCCTX
- class ς : Sink<TSource>, IObserver<TSource>
- {
- private readonly ObserveOn<TSource> _parent;
-
- public ς(ObserveOn<TSource> parent, IObserver<TSource> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _parent = parent;
- }
-
- public void OnNext(TSource value)
- {
- _parent._context.PostWithStartComplete(() =>
- {
- base._observer.OnNext(value);
- });
- }
-
- public void OnError(Exception error)
- {
- _parent._context.PostWithStartComplete(() =>
- {
- base._observer.OnError(error);
- base.Dispose();
- });
- }
-
- public void OnCompleted()
- {
- _parent._context.PostWithStartComplete(() =>
- {
- base._observer.OnCompleted();
- base.Dispose();
- });
- }
- }
-#endif
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/OfType.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/OfType.cs
deleted file mode 100644
index 07e4515..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/OfType.cs
+++ /dev/null
@@ -1,53 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_PERF
-using System;
-
-namespace System.Reactive.Linq.Observαble
-{
- class OfType<TSource, TResult> : Producer<TResult>
- {
- private readonly IObservable<TSource> _source;
-
- public OfType(IObservable<TSource> source)
- {
- _source = source;
- }
-
- protected override IDisposable Run(IObserver<TResult> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(observer, cancel);
- setSink(sink);
- return _source.SubscribeSafe(sink);
- }
-
- class _ : Sink<TResult>, IObserver<TSource>
- {
- public _(IObserver<TResult> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- }
-
- public void OnNext(TSource value)
- {
- if (value is TResult)
- {
- base._observer.OnNext((TResult)(object)value);
- }
- }
-
- public void OnError(Exception error)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
-
- public void OnCompleted()
- {
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/OnErrorResumeNext.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/OnErrorResumeNext.cs
deleted file mode 100644
index 26dfd34..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/OnErrorResumeNext.cs
+++ /dev/null
@@ -1,60 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_PERF
-using System;
-using System.Collections.Generic;
-using System.Reactive.Concurrency;
-using System.Reactive.Disposables;
-
-namespace System.Reactive.Linq.Observαble
-{
- class OnErrorResumeNext<TSource> : Producer<TSource>
- {
- private readonly IEnumerable<IObservable<TSource>> _sources;
-
- public OnErrorResumeNext(IEnumerable<IObservable<TSource>> sources)
- {
- _sources = sources;
- }
-
- protected override IDisposable Run(IObserver<TSource> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(observer, cancel);
- setSink(sink);
- return sink.Run(_sources);
- }
-
- class _ : TailRecursiveSink<TSource>
- {
- public _(IObserver<TSource> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- }
-
- protected override IEnumerable<IObservable<TSource>> Extract(IObservable<TSource> source)
- {
- var oern = source as OnErrorResumeNext<TSource>;
- if (oern != null)
- return oern._sources;
-
- return null;
- }
-
- public override void OnNext(TSource value)
- {
- base._observer.OnNext(value);
- }
-
- public override void OnError(Exception error)
- {
- _recurse();
- }
-
- public override void OnCompleted()
- {
- _recurse();
- }
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/PushToPullAdapter.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/PushToPullAdapter.cs
deleted file mode 100644
index 916d12b..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/PushToPullAdapter.cs
+++ /dev/null
@@ -1,93 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.Reactive.Disposables;
-
-namespace System.Reactive.Linq.Observαble
-{
- abstract class PushToPullAdapter<TSource, TResult> : IEnumerable<TResult>
- {
- private readonly IObservable<TSource> _source;
-
- public PushToPullAdapter(IObservable<TSource> source)
- {
- _source = source;
- }
-
- IEnumerator IEnumerable.GetEnumerator()
- {
- return GetEnumerator();
- }
-
- public IEnumerator<TResult> GetEnumerator()
- {
- var d = new SingleAssignmentDisposable();
- var res = Run(d);
- d.Disposable = _source.SubscribeSafe(res);
- return res;
- }
-
- protected abstract PushToPullSink<TSource, TResult> Run(IDisposable subscription);
- }
-
- abstract class PushToPullSink<TSource, TResult> : IObserver<TSource>, IEnumerator<TResult>, IDisposable
- {
- private readonly IDisposable _subscription;
-
- public PushToPullSink(IDisposable subscription)
- {
- _subscription = subscription;
- }
-
- public abstract void OnNext(TSource value);
- public abstract void OnError(Exception error);
- public abstract void OnCompleted();
-
- public abstract bool TryMoveNext(out TResult current);
-
- private bool _done;
-
- public bool MoveNext()
- {
- if (!_done)
- {
- var current = default(TResult);
- if (TryMoveNext(out current))
- {
- Current = current;
- return true;
- }
- else
- {
- _done = true;
- _subscription.Dispose();
- }
- }
-
- return false;
- }
-
- public TResult Current
- {
- get;
- private set;
- }
-
- object IEnumerator.Current
- {
- get { return Current; }
- }
-
- public void Reset()
- {
- throw new NotSupportedException();
- }
-
- public void Dispose()
- {
- _subscription.Dispose();
- }
- }
-}
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Range.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Range.cs
deleted file mode 100644
index c58d94c..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Range.cs
+++ /dev/null
@@ -1,83 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_PERF
-using System;
-using System.Reactive.Concurrency;
-using System.Reactive.Disposables;
-
-namespace System.Reactive.Linq.Observαble
-{
- class Range : Producer<int>
- {
- private readonly int _start;
- private readonly int _count;
- private readonly IScheduler _scheduler;
-
- public Range(int start, int count, IScheduler scheduler)
- {
- _start = start;
- _count = count;
- _scheduler = scheduler;
- }
-
- protected override IDisposable Run(IObserver<int> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(this, observer, cancel);
- setSink(sink);
- return sink.Run();
- }
-
- class _ : Sink<int>
- {
- private readonly Range _parent;
-
- public _(Range parent, IObserver<int> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _parent = parent;
- }
-
- public IDisposable Run()
- {
- var longRunning = _parent._scheduler.AsLongRunning();
- if (longRunning != null)
- {
- return longRunning.ScheduleLongRunning(0, Loop);
- }
- else
- {
- return _parent._scheduler.Schedule(0, LoopRec);
- }
- }
-
- private void Loop(int i, ICancelable cancel)
- {
- while (!cancel.IsDisposed && i < _parent._count)
- {
- base._observer.OnNext(_parent._start + i);
- i++;
- }
-
- if (!cancel.IsDisposed)
- base._observer.OnCompleted();
-
- base.Dispose();
- }
-
- private void LoopRec(int i, Action<int> recurse)
- {
- if (i < _parent._count)
- {
- base._observer.OnNext(_parent._start + i);
- recurse(i + 1);
- }
- else
- {
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/RefCount.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/RefCount.cs
deleted file mode 100644
index 1762807..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/RefCount.cs
+++ /dev/null
@@ -1,88 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_PERF
-using System;
-using System.Reactive.Disposables;
-using System.Reactive.Subjects;
-
-namespace System.Reactive.Linq.Observαble
-{
- class RefCount<TSource> : Producer<TSource>
- {
- private readonly IConnectableObservable<TSource> _source;
-
- private readonly object _gate;
- private int _count;
- private IDisposable _connectableSubscription;
-
- public RefCount(IConnectableObservable<TSource> source)
- {
- _source = source;
- _gate = new object();
- _count = 0;
- _connectableSubscription = default(IDisposable);
- }
-
- protected override IDisposable Run(IObserver<TSource> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(this, observer, cancel);
- setSink(sink);
- return sink.Run();
- }
-
- class _ : Sink<TSource>, IObserver<TSource>
- {
- private readonly RefCount<TSource> _parent;
-
- public _(RefCount<TSource> parent, IObserver<TSource> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _parent = parent;
- }
-
- public IDisposable Run()
- {
- var subscription = _parent._source.SubscribeSafe(this);
-
- lock (_parent._gate)
- {
- if (++_parent._count == 1)
- {
- _parent._connectableSubscription = _parent._source.Connect();
- }
- }
-
- return Disposable.Create(() =>
- {
- subscription.Dispose();
-
- lock (_parent._gate)
- {
- if (--_parent._count == 0)
- {
- _parent._connectableSubscription.Dispose();
- }
- }
- });
- }
-
- public void OnNext(TSource value)
- {
- base._observer.OnNext(value);
- }
-
- public void OnError(Exception error)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
-
- public void OnCompleted()
- {
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
- }
-}
-#endif
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Repeat.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Repeat.cs
deleted file mode 100644
index fab0607..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Repeat.cs
+++ /dev/null
@@ -1,127 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_PERF
-using System;
-using System.Reactive.Concurrency;
-using System.Reactive.Disposables;
-
-namespace System.Reactive.Linq.Observαble
-{
- class Repeat<TResult> : Producer<TResult>
- {
- private readonly TResult _value;
- private readonly int? _repeatCount;
- private readonly IScheduler _scheduler;
-
- public Repeat(TResult value, int? repeatCount, IScheduler scheduler)
- {
- _value = value;
- _repeatCount = repeatCount;
- _scheduler = scheduler;
- }
-
- protected override IDisposable Run(IObserver<TResult> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(this, observer, cancel);
- setSink(sink);
- return sink.Run();
- }
-
- class _ : Sink<TResult>
- {
- private readonly Repeat<TResult> _parent;
-
- public _(Repeat<TResult> parent, IObserver<TResult> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _parent = parent;
- }
-
- public IDisposable Run()
- {
- var longRunning = _parent._scheduler.AsLongRunning();
- if (longRunning != null)
- {
- return Run(longRunning);
- }
- else
- {
- return Run(_parent._scheduler);
- }
- }
-
- private IDisposable Run(IScheduler scheduler)
- {
- if (_parent._repeatCount == null)
- {
- return scheduler.Schedule(LoopRecInf);
- }
- else
- {
- return scheduler.Schedule(_parent._repeatCount.Value, LoopRec);
- }
- }
-
- private void LoopRecInf(Action recurse)
- {
- base._observer.OnNext(_parent._value);
- recurse();
- }
-
- private void LoopRec(int n, Action<int> recurse)
- {
- if (n > 0)
- {
- base._observer.OnNext(_parent._value);
- n--;
- }
-
- if (n == 0)
- {
- base._observer.OnCompleted();
- base.Dispose();
- return;
- }
-
- recurse(n);
- }
-
- private IDisposable Run(ISchedulerLongRunning scheduler)
- {
- if (_parent._repeatCount == null)
- {
- return scheduler.ScheduleLongRunning(LoopInf);
- }
- else
- {
- return scheduler.ScheduleLongRunning(_parent._repeatCount.Value, Loop);
- }
- }
-
- private void LoopInf(ICancelable cancel)
- {
- var value = _parent._value;
- while (!cancel.IsDisposed)
- base._observer.OnNext(value);
-
- base.Dispose();
- }
-
- private void Loop(int n, ICancelable cancel)
- {
- var value = _parent._value;
- while (n > 0 && !cancel.IsDisposed)
- {
- base._observer.OnNext(value);
- n--;
- }
-
- if (!cancel.IsDisposed)
- base._observer.OnCompleted();
-
- base.Dispose();
- }
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Return.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Return.cs
deleted file mode 100644
index cd9ad02..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Return.cs
+++ /dev/null
@@ -1,51 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_PERF
-using System;
-using System.Reactive.Concurrency;
-
-namespace System.Reactive.Linq.Observαble
-{
- class Return<TResult> : Producer<TResult>
- {
- private readonly TResult _value;
- private readonly IScheduler _scheduler;
-
- public Return(TResult value, IScheduler scheduler)
- {
- _value = value;
- _scheduler = scheduler;
- }
-
- protected override IDisposable Run(IObserver<TResult> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(this, observer, cancel);
- setSink(sink);
- return sink.Run();
- }
-
- class _ : Sink<TResult>
- {
- private readonly Return<TResult> _parent;
-
- public _(Return<TResult> parent, IObserver<TResult> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _parent = parent;
- }
-
- public IDisposable Run()
- {
- return _parent._scheduler.Schedule(Invoke);
- }
-
- private void Invoke()
- {
- base._observer.OnNext(_parent._value);
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Sample.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Sample.cs
deleted file mode 100644
index 0d46c62..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Sample.cs
+++ /dev/null
@@ -1,243 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_PERF
-using System;
-using System.Reactive.Concurrency;
-using System.Reactive.Disposables;
-
-namespace System.Reactive.Linq.Observαble
-{
- class Sample<TSource, TSample> : Producer<TSource>
- {
- private readonly IObservable<TSource> _source;
- private readonly IObservable<TSample> _sampler;
-
- public Sample(IObservable<TSource> source, IObservable<TSample> sampler)
- {
- _source = source;
- _sampler = sampler;
- }
-
- protected override IDisposable Run(IObserver<TSource> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(this, observer, cancel);
- setSink(sink);
- return sink.Run();
- }
-
- class _ : Sink<TSource>, IObserver<TSource>
- {
- private readonly Sample<TSource, TSample> _parent;
-
- public _(Sample<TSource, TSample> parent, IObserver<TSource> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _parent = parent;
- }
-
- private object _gate;
-
- private IDisposable _sourceSubscription;
-
- private bool _hasValue;
- private TSource _value;
- private bool _atEnd;
-
- public IDisposable Run()
- {
- _gate = new object();
-
- var sourceSubscription = new SingleAssignmentDisposable();
- _sourceSubscription = sourceSubscription;
- sourceSubscription.Disposable = _parent._source.SubscribeSafe(this);
-
- var samplerSubscription = _parent._sampler.SubscribeSafe(new σ(this));
-
- return new CompositeDisposable(_sourceSubscription, samplerSubscription);
- }
-
- public void OnNext(TSource value)
- {
- lock (_gate)
- {
- _hasValue = true;
- _value = value;
- }
- }
-
- public void OnError(Exception error)
- {
- lock (_gate)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
- }
-
- public void OnCompleted()
- {
- lock (_gate)
- {
- _atEnd = true;
- _sourceSubscription.Dispose();
- }
- }
-
- class σ : IObserver<TSample>
- {
- private readonly _ _parent;
-
- public σ(_ parent)
- {
- _parent = parent;
- }
-
- public void OnNext(TSample value)
- {
- lock (_parent._gate)
- {
- if (_parent._hasValue)
- {
- _parent._hasValue = false;
- _parent._observer.OnNext(_parent._value);
- }
-
- if (_parent._atEnd)
- {
- _parent._observer.OnCompleted();
- _parent.Dispose();
- }
- }
- }
-
- public void OnError(Exception error)
- {
- // BREAKING CHANGE v2 > v1.x - This error used to be swallowed
- lock (_parent._gate)
- {
- _parent._observer.OnError(error);
- _parent.Dispose();
- }
- }
-
- public void OnCompleted()
- {
- lock (_parent._gate)
- {
- if (_parent._hasValue)
- {
- _parent._hasValue = false;
- _parent._observer.OnNext(_parent._value);
- }
-
- if (_parent._atEnd)
- {
- _parent._observer.OnCompleted();
- _parent.Dispose();
- }
- }
- }
- }
- }
- }
-
- class Sample<TSource> : Producer<TSource>
- {
- private readonly IObservable<TSource> _source;
- private readonly TimeSpan _interval;
- private readonly IScheduler _scheduler;
-
- public Sample(IObservable<TSource> source, TimeSpan interval, IScheduler scheduler)
- {
- _source = source;
- _interval = interval;
- _scheduler = scheduler;
- }
-
- protected override IDisposable Run(IObserver<TSource> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(this, observer, cancel);
- setSink(sink);
- return sink.Run();
- }
-
- class _ : Sink<TSource>, IObserver<TSource>
- {
- private readonly Sample<TSource> _parent;
-
- public _(Sample<TSource> parent, IObserver<TSource> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _parent = parent;
- }
-
- private object _gate;
-
- private IDisposable _sourceSubscription;
-
- private bool _hasValue;
- private TSource _value;
- private bool _atEnd;
-
- public IDisposable Run()
- {
- _gate = new object();
-
- var sourceSubscription = new SingleAssignmentDisposable();
- _sourceSubscription = sourceSubscription;
- sourceSubscription.Disposable = _parent._source.SubscribeSafe(this);
-
- return new CompositeDisposable(
- sourceSubscription,
- _parent._scheduler.SchedulePeriodic(_parent._interval, Tick)
- );
- }
-
- private void Tick()
- {
- lock (_gate)
- {
- if (_hasValue)
- {
- _hasValue = false;
- base._observer.OnNext(_value);
- }
-
- if (_atEnd)
- {
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
- }
-
- public void OnNext(TSource value)
- {
- lock (_gate)
- {
- _hasValue = true;
- _value = value;
- }
- }
-
- public void OnError(Exception error)
- {
- lock (_gate)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
- }
-
- public void OnCompleted()
- {
- lock (_gate)
- {
- _atEnd = true;
- _sourceSubscription.Dispose();
- }
- }
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Scan.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Scan.cs
deleted file mode 100644
index 6c8f2fe..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Scan.cs
+++ /dev/null
@@ -1,146 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_PERF
-using System;
-
-namespace System.Reactive.Linq.Observαble
-{
- class Scan<TSource, TAccumulate> : Producer<TAccumulate>
- {
- private readonly IObservable<TSource> _source;
- private readonly TAccumulate _seed;
- private readonly Func<TAccumulate, TSource, TAccumulate> _accumulator;
-
- public Scan(IObservable<TSource> source, TAccumulate seed, Func<TAccumulate, TSource, TAccumulate> accumulator)
- {
- _source = source;
- _seed = seed;
- _accumulator = accumulator;
- }
-
- protected override IDisposable Run(IObserver<TAccumulate> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(this, observer, cancel);
- setSink(sink);
- return _source.SubscribeSafe(sink);
- }
-
- class _ : Sink<TAccumulate>, IObserver<TSource>
- {
- private readonly Scan<TSource, TAccumulate> _parent;
- private TAccumulate _accumulation;
- private bool _hasAccumulation;
-
- public _(Scan<TSource, TAccumulate> parent, IObserver<TAccumulate> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _parent = parent;
- _accumulation = default(TAccumulate);
- _hasAccumulation = false;
- }
-
- public void OnNext(TSource value)
- {
- try
- {
- if (_hasAccumulation)
- _accumulation = _parent._accumulator(_accumulation, value);
- else
- {
- _accumulation = _parent._accumulator(_parent._seed, value);
- _hasAccumulation = true;
- }
- }
- catch (Exception exception)
- {
- base._observer.OnError(exception);
- base.Dispose();
- return;
- }
-
- base._observer.OnNext(_accumulation);
- }
-
- public void OnError(Exception error)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
-
- public void OnCompleted()
- {
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
- }
-
- class Scan<TSource> : Producer<TSource>
- {
- private readonly IObservable<TSource> _source;
- private readonly Func<TSource, TSource, TSource> _accumulator;
-
- public Scan(IObservable<TSource> source, Func<TSource, TSource, TSource> accumulator)
- {
- _source = source;
- _accumulator = accumulator;
- }
-
- protected override IDisposable Run(IObserver<TSource> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(this, observer, cancel);
- setSink(sink);
- return _source.SubscribeSafe(sink);
- }
-
- class _ : Sink<TSource>, IObserver<TSource>
- {
- private readonly Scan<TSource> _parent;
- private TSource _accumulation;
- private bool _hasAccumulation;
-
- public _(Scan<TSource> parent, IObserver<TSource> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _parent = parent;
- _accumulation = default(TSource);
- _hasAccumulation = false;
- }
-
- public void OnNext(TSource value)
- {
- try
- {
- if (_hasAccumulation)
- _accumulation = _parent._accumulator(_accumulation, value);
- else
- {
- _accumulation = value;
- _hasAccumulation = true;
- }
- }
- catch (Exception exception)
- {
- base._observer.OnError(exception);
- base.Dispose();
- return;
- }
-
- base._observer.OnNext(_accumulation);
- }
-
- public void OnError(Exception error)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
-
- public void OnCompleted()
- {
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Select.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Select.cs
deleted file mode 100644
index e853210..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Select.cs
+++ /dev/null
@@ -1,138 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_PERF
-using System;
-
-namespace System.Reactive.Linq.Observαble
-{
- abstract class Select<TResult> : Producer<TResult>
- {
- public abstract IObservable<TResult2> Ω<TResult2>(Func<TResult, TResult2> selector);
- }
-
- class Select<TSource, TResult> : Select<TResult>
- {
- private readonly IObservable<TSource> _source;
- private readonly Func<TSource, TResult> _selector;
- private readonly Func<TSource, int, TResult> _selectorI;
-
- public Select(IObservable<TSource> source, Func<TSource, TResult> selector)
- {
- _source = source;
- _selector = selector;
- }
-
- public Select(IObservable<TSource> source, Func<TSource, int, TResult> selector)
- {
- _source = source;
- _selectorI = selector;
- }
-
- public override IObservable<TResult2> Ω<TResult2>(Func<TResult, TResult2> selector)
- {
- if (_selector != null)
- return new Select<TSource, TResult2>(_source, x => selector(_selector(x)));
- else
- return new Select<TResult, TResult2>(this, selector);
- }
-
- protected override IDisposable Run(IObserver<TResult> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- if (_selector != null)
- {
- var sink = new _(this, observer, cancel);
- setSink(sink);
- return _source.SubscribeSafe(sink);
- }
- else
- {
- var sink = new τ(this, observer, cancel);
- setSink(sink);
- return _source.SubscribeSafe(sink);
- }
- }
-
- class _ : Sink<TResult>, IObserver<TSource>
- {
- private readonly Select<TSource, TResult> _parent;
-
- public _(Select<TSource, TResult> parent, IObserver<TResult> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _parent = parent;
- }
-
- public void OnNext(TSource value)
- {
- var result = default(TResult);
- try
- {
- result = _parent._selector(value);
- }
- catch (Exception exception)
- {
- base._observer.OnError(exception);
- base.Dispose();
- return;
- }
-
- base._observer.OnNext(result);
- }
-
- public void OnError(Exception error)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
-
- public void OnCompleted()
- {
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
-
- class τ : Sink<TResult>, IObserver<TSource>
- {
- private readonly Select<TSource, TResult> _parent;
- private int _index;
-
- public τ(Select<TSource, TResult> parent, IObserver<TResult> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _parent = parent;
- _index = 0;
- }
-
- public void OnNext(TSource value)
- {
- var result = default(TResult);
- try
- {
- result = _parent._selectorI(value, checked(_index++));
- }
- catch (Exception exception)
- {
- base._observer.OnError(exception);
- base.Dispose();
- return;
- }
-
- base._observer.OnNext(result);
- }
-
- public void OnError(Exception error)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
-
- public void OnCompleted()
- {
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/SelectMany.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/SelectMany.cs
deleted file mode 100644
index 1566816..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/SelectMany.cs
+++ /dev/null
@@ -1,593 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_PERF
-using System;
-using System.Collections.Generic;
-using System.Reactive;
-using System.Reactive.Disposables;
-
-namespace System.Reactive.Linq.Observαble
-{
- class SelectMany<TSource, TCollection, TResult> : Producer<TResult>
- {
- private readonly IObservable<TSource> _source;
- private readonly Func<TSource, IObservable<TCollection>> _collectionSelector;
- private readonly Func<TSource, IEnumerable<TCollection>> _collectionSelectorE;
- private readonly Func<TSource, TCollection, TResult> _resultSelector;
-
- public SelectMany(IObservable<TSource> source, Func<TSource, IObservable<TCollection>> collectionSelector, Func<TSource, TCollection, TResult> resultSelector)
- {
- _source = source;
- _collectionSelector = collectionSelector;
- _resultSelector = resultSelector;
- }
-
- public SelectMany(IObservable<TSource> source, Func<TSource, IEnumerable<TCollection>> collectionSelector, Func<TSource, TCollection, TResult> resultSelector)
- {
- _source = source;
- _collectionSelectorE = collectionSelector;
- _resultSelector = resultSelector;
- }
-
- protected override IDisposable Run(IObserver<TResult> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- if (_collectionSelector != null)
- {
- var sink = new _(this, observer, cancel);
- setSink(sink);
- return sink.Run();
- }
- else
- {
- var sink = new ε(this, observer, cancel);
- setSink(sink);
- return _source.SubscribeSafe(sink);
- }
- }
-
- class _ : Sink<TResult>, IObserver<TSource>
- {
- private readonly SelectMany<TSource, TCollection, TResult> _parent;
-
- public _(SelectMany<TSource, TCollection, TResult> parent, IObserver<TResult> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _parent = parent;
- }
-
- private object _gate;
- private bool _isStopped;
- private CompositeDisposable _group;
- private SingleAssignmentDisposable _sourceSubscription;
-
- public IDisposable Run()
- {
- _gate = new object();
- _isStopped = false;
- _group = new CompositeDisposable();
-
- _sourceSubscription = new SingleAssignmentDisposable();
- _group.Add(_sourceSubscription);
- _sourceSubscription.Disposable = _parent._source.SubscribeSafe(this);
-
- return _group;
- }
-
- public void OnNext(TSource value)
- {
- var collection = default(IObservable<TCollection>);
-
- try
- {
- collection = _parent._collectionSelector(value);
- }
- catch (Exception ex)
- {
- lock (_gate)
- {
- base._observer.OnError(ex);
- base.Dispose();
- }
- return;
- }
-
- var innerSubscription = new SingleAssignmentDisposable();
- _group.Add(innerSubscription);
- innerSubscription.Disposable = collection.SubscribeSafe(new ι(this, value, innerSubscription));
- }
-
- public void OnError(Exception error)
- {
- lock (_gate)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
- }
-
- public void OnCompleted()
- {
- _isStopped = true;
- if (_group.Count == 1)
- {
- //
- // Notice there can be a race between OnCompleted of the source and any
- // of the inner sequences, where both see _group.Count == 1, and one is
- // waiting for the lock. There won't be a double OnCompleted observation
- // though, because the call to Dispose silences the observer by swapping
- // in a NopObserver<T>.
- //
- lock (_gate)
- {
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
- else
- {
- _sourceSubscription.Dispose();
- }
- }
-
- class ι : IObserver<TCollection>
- {
- private readonly _ _parent;
- private readonly TSource _value;
- private readonly IDisposable _self;
-
- public ι(_ parent, TSource value, IDisposable self)
- {
- _parent = parent;
- _value = value;
- _self = self;
- }
-
- public void OnNext(TCollection value)
- {
- var res = default(TResult);
-
- try
- {
- res = _parent._parent._resultSelector(_value, value);
- }
- catch (Exception ex)
- {
- lock (_parent._gate)
- {
- _parent._observer.OnError(ex);
- _parent.Dispose();
- }
- return;
- }
-
- lock (_parent._gate)
- _parent._observer.OnNext(res);
- }
-
- public void OnError(Exception error)
- {
- lock (_parent._gate)
- {
- _parent._observer.OnError(error);
- _parent.Dispose();
- }
- }
-
- public void OnCompleted()
- {
- _parent._group.Remove(_self);
- if (_parent._isStopped && _parent._group.Count == 1)
- {
- //
- // Notice there can be a race between OnCompleted of the source and any
- // of the inner sequences, where both see _group.Count == 1, and one is
- // waiting for the lock. There won't be a double OnCompleted observation
- // though, because the call to Dispose silences the observer by swapping
- // in a NopObserver<T>.
- //
- lock (_parent._gate)
- {
- _parent._observer.OnCompleted();
- _parent.Dispose();
- }
- }
- }
- }
- }
-
- class ε : Sink<TResult>, IObserver<TSource>
- {
- private readonly SelectMany<TSource, TCollection, TResult> _parent;
-
- public ε(SelectMany<TSource, TCollection, TResult> parent, IObserver<TResult> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _parent = parent;
- }
-
- public void OnNext(TSource value)
- {
- var xs = default(IEnumerable<TCollection>);
- try
- {
- xs = _parent._collectionSelectorE(value);
- }
- catch (Exception exception)
- {
- base._observer.OnError(exception);
- base.Dispose();
- return;
- }
-
- var e = default(IEnumerator<TCollection>);
- try
- {
- e = xs.GetEnumerator();
- }
- catch (Exception exception)
- {
- base._observer.OnError(exception);
- base.Dispose();
- return;
- }
-
- try
- {
- var hasNext = true;
- while (hasNext)
- {
- hasNext = false;
- var current = default(TResult);
-
- try
- {
- hasNext = e.MoveNext();
- if (hasNext)
- current = _parent._resultSelector(value, e.Current);
- }
- catch (Exception exception)
- {
- base._observer.OnError(exception);
- base.Dispose();
- return;
- }
-
- if (hasNext)
- base._observer.OnNext(current);
- }
- }
- finally
- {
- if (e != null)
- e.Dispose();
- }
- }
-
- public void OnError(Exception error)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
-
- public void OnCompleted()
- {
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
- }
-
- class SelectMany<TSource, TResult> : Producer<TResult>
- {
- private readonly IObservable<TSource> _source;
- private readonly Func<TSource, IObservable<TResult>> _selector;
- private readonly Func<Exception, IObservable<TResult>> _selectorOnError;
- private readonly Func<IObservable<TResult>> _selectorOnCompleted;
- private readonly Func<TSource, IEnumerable<TResult>> _selectorE;
-
- public SelectMany(IObservable<TSource> source, Func<TSource, IObservable<TResult>> selector)
- {
- _source = source;
- _selector = selector;
- }
-
- public SelectMany(IObservable<TSource> source, Func<TSource, IObservable<TResult>> selector, Func<Exception, IObservable<TResult>> selectorOnError, Func<IObservable<TResult>> selectorOnCompleted)
- {
- _source = source;
- _selector = selector;
- _selectorOnError = selectorOnError;
- _selectorOnCompleted = selectorOnCompleted;
- }
-
- public SelectMany(IObservable<TSource> source, Func<TSource, IEnumerable<TResult>> selector)
- {
- _source = source;
- _selectorE = selector;
- }
-
- protected override IDisposable Run(IObserver<TResult> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- if (_selector != null)
- {
- var sink = new _(this, observer, cancel);
- setSink(sink);
- return sink.Run();
- }
- else
- {
- var sink = new ε(this, observer, cancel);
- setSink(sink);
- return _source.SubscribeSafe(sink);
- }
- }
-
- class _ : Sink<TResult>, IObserver<TSource>
- {
- private readonly SelectMany<TSource, TResult> _parent;
-
- public _(SelectMany<TSource, TResult> parent, IObserver<TResult> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _parent = parent;
- }
-
- private object _gate;
- private bool _isStopped;
- private CompositeDisposable _group;
- private SingleAssignmentDisposable _sourceSubscription;
-
- public IDisposable Run()
- {
- _gate = new object();
- _isStopped = false;
- _group = new CompositeDisposable();
-
- _sourceSubscription = new SingleAssignmentDisposable();
- _group.Add(_sourceSubscription);
- _sourceSubscription.Disposable = _parent._source.SubscribeSafe(this);
-
- return _group;
- }
-
- public void OnNext(TSource value)
- {
- var inner = default(IObservable<TResult>);
-
- try
- {
- inner = _parent._selector(value);
- }
- catch (Exception ex)
- {
- lock (_gate)
- {
- base._observer.OnError(ex);
- base.Dispose();
- }
- return;
- }
-
- SubscribeInner(inner);
- }
-
- public void OnError(Exception error)
- {
- if (_parent._selectorOnError != null)
- {
- var inner = default(IObservable<TResult>);
-
- try
- {
- inner = _parent._selectorOnError(error);
- }
- catch (Exception ex)
- {
- lock (_gate)
- {
- base._observer.OnError(ex);
- base.Dispose();
- }
- return;
- }
-
- SubscribeInner(inner);
-
- Final();
- }
- else
- {
- lock (_gate)
- base._observer.OnError(error);
-
- base.Dispose();
- }
- }
-
- public void OnCompleted()
- {
- if (_parent._selectorOnCompleted != null)
- {
- var inner = default(IObservable<TResult>);
-
- try
- {
- inner = _parent._selectorOnCompleted();
- }
- catch (Exception ex)
- {
- lock (_gate)
- {
- base._observer.OnError(ex);
- base.Dispose();
- }
- return;
- }
-
- SubscribeInner(inner);
- }
-
- Final();
- }
-
- private void Final()
- {
- _isStopped = true;
- if (_group.Count == 1)
- {
- //
- // Notice there can be a race between OnCompleted of the source and any
- // of the inner sequences, where both see _group.Count == 1, and one is
- // waiting for the lock. There won't be a double OnCompleted observation
- // though, because the call to Dispose silences the observer by swapping
- // in a NopObserver<T>.
- //
- lock (_gate)
- {
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
- else
- {
- _sourceSubscription.Dispose();
- }
- }
-
- private void SubscribeInner(IObservable<TResult> inner)
- {
- var innerSubscription = new SingleAssignmentDisposable();
- _group.Add(innerSubscription);
- innerSubscription.Disposable = inner.SubscribeSafe(new ι(this, innerSubscription));
- }
-
- class ι : IObserver<TResult>
- {
- private readonly _ _parent;
- private readonly IDisposable _self;
-
- public ι(_ parent, IDisposable self)
- {
- _parent = parent;
- _self = self;
- }
-
- public void OnNext(TResult value)
- {
- lock (_parent._gate)
- _parent._observer.OnNext(value);
- }
-
- public void OnError(Exception error)
- {
- lock (_parent._gate)
- {
- _parent._observer.OnError(error);
- _parent.Dispose();
- }
- }
-
- public void OnCompleted()
- {
- _parent._group.Remove(_self);
- if (_parent._isStopped && _parent._group.Count == 1)
- {
- //
- // Notice there can be a race between OnCompleted of the source and any
- // of the inner sequences, where both see _group.Count == 1, and one is
- // waiting for the lock. There won't be a double OnCompleted observation
- // though, because the call to Dispose silences the observer by swapping
- // in a NopObserver<T>.
- //
- lock (_parent._gate)
- {
- _parent._observer.OnCompleted();
- _parent.Dispose();
- }
- }
- }
- }
- }
-
- class ε : Sink<TResult>, IObserver<TSource>
- {
- private readonly SelectMany<TSource, TResult> _parent;
-
- public ε(SelectMany<TSource, TResult> parent, IObserver<TResult> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _parent = parent;
- }
-
- public void OnNext(TSource value)
- {
- var xs = default(IEnumerable<TResult>);
- try
- {
- xs = _parent._selectorE(value);
- }
- catch (Exception exception)
- {
- base._observer.OnError(exception);
- base.Dispose();
- return;
- }
-
- var e = default(IEnumerator<TResult>);
- try
- {
- e = xs.GetEnumerator();
- }
- catch (Exception exception)
- {
- base._observer.OnError(exception);
- base.Dispose();
- return;
- }
-
- try
- {
- var hasNext = true;
- while (hasNext)
- {
- hasNext = false;
- var current = default(TResult);
-
- try
- {
- hasNext = e.MoveNext();
- if (hasNext)
- current = e.Current;
- }
- catch (Exception exception)
- {
- base._observer.OnError(exception);
- base.Dispose();
- return;
- }
-
- if (hasNext)
- base._observer.OnNext(current);
- }
- }
- finally
- {
- if (e != null)
- e.Dispose();
- }
- }
-
- public void OnError(Exception error)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
-
- public void OnCompleted()
- {
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/SequenceEqual.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/SequenceEqual.cs
deleted file mode 100644
index 4661f82..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/SequenceEqual.cs
+++ /dev/null
@@ -1,322 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_PERF
-using System;
-using System.Collections.Generic;
-using System.Reactive.Disposables;
-
-namespace System.Reactive.Linq.Observαble
-{
- class SequenceEqual<TSource> : Producer<bool>
- {
- private readonly IObservable<TSource> _first;
- private readonly IObservable<TSource> _second;
- private readonly IEnumerable<TSource> _secondE;
- private readonly IEqualityComparer<TSource> _comparer;
-
- public SequenceEqual(IObservable<TSource> first, IObservable<TSource> second, IEqualityComparer<TSource> comparer)
- {
- _first = first;
- _second = second;
- _comparer = comparer;
- }
-
- public SequenceEqual(IObservable<TSource> first, IEnumerable<TSource> second, IEqualityComparer<TSource> comparer)
- {
- _first = first;
- _secondE = second;
- _comparer = comparer;
- }
-
- protected override IDisposable Run(IObserver<bool> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- if (_second != null)
- {
- var sink = new _(this, observer, cancel);
- setSink(sink);
- return sink.Run();
- }
- else
- {
- var sink = new ε(this, observer, cancel);
- setSink(sink);
- return sink.Run();
- }
- }
-
- class _ : Sink<bool>
- {
- private readonly SequenceEqual<TSource> _parent;
-
- public _(SequenceEqual<TSource> parent, IObserver<bool> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _parent = parent;
- }
-
- private object _gate;
- private bool _donel;
- private bool _doner;
- private Queue<TSource> _ql;
- private Queue<TSource> _qr;
-
- public IDisposable Run()
- {
- _gate = new object();
- _donel = false;
- _doner = false;
- _ql = new Queue<TSource>();
- _qr = new Queue<TSource>();
-
- return new CompositeDisposable
- {
- _parent._first.SubscribeSafe(new F(this)),
- _parent._second.SubscribeSafe(new S(this))
- };
- }
-
- class F : IObserver<TSource>
- {
- private readonly _ _parent;
-
- public F(_ parent)
- {
- _parent = parent;
- }
-
- public void OnNext(TSource value)
- {
- lock (_parent._gate)
- {
- if (_parent._qr.Count > 0)
- {
- var equal = false;
- var v = _parent._qr.Dequeue();
- try
- {
- equal = _parent._parent._comparer.Equals(value, v);
- }
- catch (Exception exception)
- {
- _parent._observer.OnError(exception);
- _parent.Dispose();
- return;
- }
- if (!equal)
- {
- _parent._observer.OnNext(false);
- _parent._observer.OnCompleted();
- _parent.Dispose();
- }
- }
- else if (_parent._doner)
- {
- _parent._observer.OnNext(false);
- _parent._observer.OnCompleted();
- _parent.Dispose();
- }
- else
- _parent._ql.Enqueue(value);
- }
- }
-
- public void OnError(Exception error)
- {
- _parent._observer.OnError(error);
- _parent.Dispose();
- }
-
- public void OnCompleted()
- {
- lock (_parent._gate)
- {
- _parent._donel = true;
- if (_parent._ql.Count == 0)
- {
- if (_parent._qr.Count > 0)
- {
- _parent._observer.OnNext(false);
- _parent._observer.OnCompleted();
- _parent.Dispose();
- }
- else if (_parent._doner)
- {
- _parent._observer.OnNext(true);
- _parent._observer.OnCompleted();
- _parent.Dispose();
- }
- }
- }
- }
- }
-
- class S : IObserver<TSource>
- {
- private readonly _ _parent;
-
- public S(_ parent)
- {
- _parent = parent;
- }
-
- public void OnNext(TSource value)
- {
- lock (_parent._gate)
- {
- if (_parent._ql.Count > 0)
- {
- var equal = false;
- var v = _parent._ql.Dequeue();
- try
- {
- equal = _parent._parent._comparer.Equals(v, value);
- }
- catch (Exception exception)
- {
- _parent._observer.OnError(exception);
- _parent.Dispose();
- return;
- }
- if (!equal)
- {
- _parent._observer.OnNext(false);
- _parent._observer.OnCompleted();
- _parent.Dispose();
- }
- }
- else if (_parent._donel)
- {
- _parent._observer.OnNext(false);
- _parent._observer.OnCompleted();
- _parent.Dispose();
- }
- else
- _parent._qr.Enqueue(value);
- }
- }
-
- public void OnError(Exception error)
- {
- _parent._observer.OnError(error);
- _parent.Dispose();
- }
-
- public void OnCompleted()
- {
- lock (_parent._gate)
- {
- _parent._doner = true;
- if (_parent._qr.Count == 0)
- {
- if (_parent._ql.Count > 0)
- {
- _parent._observer.OnNext(false);
- _parent._observer.OnCompleted();
- _parent.Dispose();
- }
- else if (_parent._donel)
- {
- _parent._observer.OnNext(true);
- _parent._observer.OnCompleted();
- _parent.Dispose();
- }
- }
- }
- }
- }
- }
-
- class ε : Sink<bool>, IObserver<TSource>
- {
- private readonly SequenceEqual<TSource> _parent;
-
- public ε(SequenceEqual<TSource> parent, IObserver<bool> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _parent = parent;
- }
-
- private IEnumerator<TSource> _enumerator;
-
- public IDisposable Run()
- {
- //
- // Notice the evaluation order of obtaining the enumerator and subscribing to the
- // observable sequence is reversed compared to the operator's signature. This is
- // required to make sure the enumerator is available as soon as the observer can
- // be called. Otherwise, we end up having a race for the initialization and use
- // of the _rightEnumerator field.
- //
- try
- {
- _enumerator = _parent._secondE.GetEnumerator();
- }
- catch (Exception exception)
- {
- base._observer.OnError(exception);
- base.Dispose();
- return Disposable.Empty;
- }
-
- return new CompositeDisposable(
- _parent._first.SubscribeSafe(this),
- _enumerator
- );
- }
-
- public void OnNext(TSource value)
- {
- var equal = false;
-
- try
- {
- if (_enumerator.MoveNext())
- {
- var current = _enumerator.Current;
- equal = _parent._comparer.Equals(value, current);
- }
- }
- catch (Exception exception)
- {
- base._observer.OnError(exception);
- base.Dispose();
- return;
- }
-
- if (!equal)
- {
- base._observer.OnNext(false);
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
-
- public void OnError(Exception error)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
-
- public void OnCompleted()
- {
- var hasNext = false;
-
- try
- {
- hasNext = _enumerator.MoveNext();
- }
- catch (Exception exception)
- {
- base._observer.OnError(exception);
- base.Dispose();
- return;
- }
-
- base._observer.OnNext(!hasNext);
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/SingleAsync.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/SingleAsync.cs
deleted file mode 100644
index 19c07e5..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/SingleAsync.cs
+++ /dev/null
@@ -1,154 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_PERF
-using System;
-
-namespace System.Reactive.Linq.Observαble
-{
- class SingleAsync<TSource> : Producer<TSource>
- {
- private readonly IObservable<TSource> _source;
- private readonly Func<TSource, bool> _predicate;
- private readonly bool _throwOnEmpty;
-
- public SingleAsync(IObservable<TSource> source, Func<TSource, bool> predicate, bool throwOnEmpty)
- {
- _source = source;
- _predicate = predicate;
- _throwOnEmpty = throwOnEmpty;
- }
-
- protected override IDisposable Run(IObserver<TSource> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- if (_predicate != null)
- {
- var sink = new π(this, observer, cancel);
- setSink(sink);
- return _source.SubscribeSafe(sink);
- }
- else
- {
- var sink = new _(this, observer, cancel);
- setSink(sink);
- return _source.SubscribeSafe(sink);
- }
- }
-
- class _ : Sink<TSource>, IObserver<TSource>
- {
- private readonly SingleAsync<TSource> _parent;
- private TSource _value;
- private bool _seenValue;
-
- public _(SingleAsync<TSource> parent, IObserver<TSource> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _parent = parent;
-
- _value = default(TSource);
- _seenValue = false;
- }
-
- public void OnNext(TSource value)
- {
- if (_seenValue)
- {
- base._observer.OnError(new InvalidOperationException(Strings_Linq.MORE_THAN_ONE_ELEMENT));
- base.Dispose();
- return;
- }
-
- _value = value;
- _seenValue = true;
- }
-
- public void OnError(Exception error)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
-
- public void OnCompleted()
- {
- if (!_seenValue && _parent._throwOnEmpty)
- {
- base._observer.OnError(new InvalidOperationException(Strings_Linq.NO_ELEMENTS));
- }
- else
- {
- base._observer.OnNext(_value);
- base._observer.OnCompleted();
- }
-
- base.Dispose();
- }
- }
-
- class π : Sink<TSource>, IObserver<TSource>
- {
- private readonly SingleAsync<TSource> _parent;
- private TSource _value;
- private bool _seenValue;
-
- public π(SingleAsync<TSource> parent, IObserver<TSource> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _parent = parent;
-
- _value = default(TSource);
- _seenValue = false;
- }
-
- public void OnNext(TSource value)
- {
- var b = false;
-
- try
- {
- b = _parent._predicate(value);
- }
- catch (Exception ex)
- {
- base._observer.OnError(ex);
- base.Dispose();
- return;
- }
-
- if (b)
- {
- if (_seenValue)
- {
- base._observer.OnError(new InvalidOperationException(Strings_Linq.MORE_THAN_ONE_MATCHING_ELEMENT));
- base.Dispose();
- return;
- }
-
- _value = value;
- _seenValue = true;
- }
- }
-
- public void OnError(Exception error)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
-
- public void OnCompleted()
- {
- if (!_seenValue && _parent._throwOnEmpty)
- {
- base._observer.OnError(new InvalidOperationException(Strings_Linq.NO_MATCHING_ELEMENTS));
- }
- else
- {
- base._observer.OnNext(_value);
- base._observer.OnCompleted();
- }
-
- base.Dispose();
- }
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Skip.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Skip.cs
deleted file mode 100644
index a092d99..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Skip.cs
+++ /dev/null
@@ -1,151 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_PERF
-using System;
-using System.Reactive.Concurrency;
-using System.Reactive.Disposables;
-
-namespace System.Reactive.Linq.Observαble
-{
- class Skip<TSource> : Producer<TSource>
- {
- private readonly IObservable<TSource> _source;
- private readonly int _count;
- private readonly TimeSpan _duration;
- internal readonly IScheduler _scheduler;
-
- public Skip(IObservable<TSource> source, int count)
- {
- _source = source;
- _count = count;
- }
-
- public Skip(IObservable<TSource> source, TimeSpan duration, IScheduler scheduler)
- {
- _source = source;
- _duration = duration;
- _scheduler = scheduler;
- }
-
- public IObservable<TSource> Ω(int count)
- {
- //
- // Sum semantics:
- //
- // xs --o--o--o--o--o--o--| xs --o--o--o--o--o--o--|
- // xs.Skip(2) --x--x--o--o--o--o--| xs.Skip(3) --x--x--x--o--o--o--|
- // xs.Skip(2).Skip(3) --------x--x--x--o--| xs.Skip(3).Skip(2) -----------x--x--o--|
- //
- return new Skip<TSource>(_source, _count + count);
- }
-
- public IObservable<TSource> Ω(TimeSpan duration)
- {
- //
- // Maximum semantics:
- //
- // t 0--1--2--3--4--5--6--7-> t 0--1--2--3--4--5--6--7->
- //
- // xs --o--o--o--o--o--o--| xs --o--o--o--o--o--o--|
- // xs.Skip(2s) xxxxxxx-o--o--o--o--| xs.Skip(3s) xxxxxxxxxx-o--o--o--|
- // xs.Skip(2s).Skip(3s) xxxxxxxxxx-o--o--o--| xs.Skip(3s).Skip(2s) xxxxxxx----o--o--o--|
- //
- if (duration <= _duration)
- return this;
- else
- return new Skip<TSource>(_source, duration, _scheduler);
- }
-
- protected override IDisposable Run(IObserver<TSource> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- if (_scheduler == null)
- {
- var sink = new _(this, observer, cancel);
- setSink(sink);
- return _source.SubscribeSafe(sink);
- }
- else
- {
- var sink = new τ(this, observer, cancel);
- setSink(sink);
- return sink.Run();
- }
- }
-
- class _ : Sink<TSource>, IObserver<TSource>
- {
- private readonly Skip<TSource> _parent;
- private int _remaining;
-
- public _(Skip<TSource> parent, IObserver<TSource> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _parent = parent;
- _remaining = _parent._count;
- }
-
- public void OnNext(TSource value)
- {
- if (_remaining <= 0)
- base._observer.OnNext(value);
- else
- _remaining--;
- }
-
- public void OnError(Exception error)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
-
- public void OnCompleted()
- {
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
-
- class τ : Sink<TSource>, IObserver<TSource>
- {
- private readonly Skip<TSource> _parent;
- private volatile bool _open;
-
- public τ(Skip<TSource> parent, IObserver<TSource> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _parent = parent;
- }
-
- public IDisposable Run()
- {
- var t = _parent._scheduler.Schedule(_parent._duration, Tick);
- var d = _parent._source.SubscribeSafe(this);
- return new CompositeDisposable(t, d);
- }
-
- private void Tick()
- {
- _open = true;
- }
-
- public void OnNext(TSource value)
- {
- if (_open)
- base._observer.OnNext(value);
- }
-
- public void OnError(Exception error)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
-
- public void OnCompleted()
- {
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/SkipLast.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/SkipLast.cs
deleted file mode 100644
index 596f183..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/SkipLast.cs
+++ /dev/null
@@ -1,125 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_PERF
-using System;
-using System.Collections.Generic;
-using System.Reactive.Concurrency;
-
-namespace System.Reactive.Linq.Observαble
-{
- class SkipLast<TSource> : Producer<TSource>
- {
- private readonly IObservable<TSource> _source;
- private readonly int _count;
- private readonly TimeSpan _duration;
- private readonly IScheduler _scheduler;
-
- public SkipLast(IObservable<TSource> source, int count)
- {
- _source = source;
- _count = count;
- }
-
- public SkipLast(IObservable<TSource> source, TimeSpan duration, IScheduler scheduler)
- {
- _source = source;
- _duration = duration;
- _scheduler = scheduler;
- }
-
- protected override IDisposable Run(IObserver<TSource> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- if (_scheduler == null)
- {
- var sink = new _(this, observer, cancel);
- setSink(sink);
- return _source.SubscribeSafe(sink);
- }
- else
- {
- var sink = new τ(this, observer, cancel);
- setSink(sink);
- return sink.Run();
- }
- }
-
- class _ : Sink<TSource>, IObserver<TSource>
- {
- private readonly SkipLast<TSource> _parent;
- private Queue<TSource> _queue;
-
- public _(SkipLast<TSource> parent, IObserver<TSource> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _parent = parent;
- _queue = new Queue<TSource>();
- }
-
- public void OnNext(TSource value)
- {
- _queue.Enqueue(value);
- if (_queue.Count > _parent._count)
- base._observer.OnNext(_queue.Dequeue());
- }
-
- public void OnError(Exception error)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
-
- public void OnCompleted()
- {
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
-
- class τ : Sink<TSource>, IObserver<TSource>
- {
- private readonly SkipLast<TSource> _parent;
- private Queue<System.Reactive.TimeInterval<TSource>> _queue;
-
- public τ(SkipLast<TSource> parent, IObserver<TSource> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _parent = parent;
- _queue = new Queue<System.Reactive.TimeInterval<TSource>>();
- }
-
- private IStopwatch _watch;
-
- public IDisposable Run()
- {
- _watch = _parent._scheduler.StartStopwatch();
-
- return _parent._source.SubscribeSafe(this);
- }
-
- public void OnNext(TSource value)
- {
- var now = _watch.Elapsed;
- _queue.Enqueue(new System.Reactive.TimeInterval<TSource>(value, now));
- while (_queue.Count > 0 && now - _queue.Peek().Interval >= _parent._duration)
- base._observer.OnNext(_queue.Dequeue().Value);
- }
-
- public void OnError(Exception error)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
-
- public void OnCompleted()
- {
- var now = _watch.Elapsed;
- while (_queue.Count > 0 && now - _queue.Peek().Interval >= _parent._duration)
- base._observer.OnNext(_queue.Dequeue().Value);
-
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/SkipUntil.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/SkipUntil.cs
deleted file mode 100644
index 8d4c7a9..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/SkipUntil.cs
+++ /dev/null
@@ -1,210 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_PERF
-using System;
-using System.Reactive.Concurrency;
-using System.Reactive.Disposables;
-using System.Threading;
-
-namespace System.Reactive.Linq.Observαble
-{
- class SkipUntil<TSource, TOther> : Producer<TSource>
- {
- private readonly IObservable<TSource> _source;
- private readonly IObservable<TOther> _other;
-
- public SkipUntil(IObservable<TSource> source, IObservable<TOther> other)
- {
- _source = source;
- _other = other;
- }
-
- protected override IDisposable Run(IObserver<TSource> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(this, observer, cancel);
- setSink(sink);
- return sink.Run();
- }
-
- class _ : Sink<TSource>
- {
- private readonly SkipUntil<TSource, TOther> _parent;
-
- public _(SkipUntil<TSource, TOther> parent, IObserver<TSource> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _parent = parent;
- }
-
- public IDisposable Run()
- {
- var sourceObserver = new T(this);
- var otherObserver = new O(this, sourceObserver);
-
- var sourceSubscription = _parent._source.SubscribeSafe(sourceObserver);
- var otherSubscription = _parent._other.SubscribeSafe(otherObserver);
-
- sourceObserver.Disposable = sourceSubscription;
- otherObserver.Disposable = otherSubscription;
-
- return new CompositeDisposable(
- sourceSubscription,
- otherSubscription
- );
- }
-
- class T : IObserver<TSource>
- {
- private readonly _ _parent;
- public volatile IObserver<TSource> _observer;
- private readonly SingleAssignmentDisposable _subscription;
-
- public T(_ parent)
- {
- _parent = parent;
- _observer = NopObserver<TSource>.Instance;
- _subscription = new SingleAssignmentDisposable();
- }
-
- public IDisposable Disposable
- {
- set { _subscription.Disposable = value; }
- }
-
- public void OnNext(TSource value)
- {
- _observer.OnNext(value);
- }
-
- public void OnError(Exception error)
- {
- _parent._observer.OnError(error);
- _parent.Dispose();
- }
-
- public void OnCompleted()
- {
- _observer.OnCompleted();
- _subscription.Dispose(); // We can't cancel the other stream yet, it may be on its way to dispatch an OnError message and we don't want to have a race.
- }
- }
-
- class O : IObserver<TOther>
- {
- private readonly _ _parent;
- private readonly T _sourceObserver;
- private readonly SingleAssignmentDisposable _subscription;
-
- public O(_ parent, T sourceObserver)
- {
- _parent = parent;
- _sourceObserver = sourceObserver;
- _subscription = new SingleAssignmentDisposable();
- }
-
- public IDisposable Disposable
- {
- set { _subscription.Disposable = value; }
- }
-
- public void OnNext(TOther value)
- {
- _sourceObserver._observer = _parent._observer;
- _subscription.Dispose();
- }
-
- public void OnError(Exception error)
- {
- _parent._observer.OnError(error);
- _parent.Dispose();
- }
-
- public void OnCompleted()
- {
- _subscription.Dispose();
- }
- }
- }
- }
-
- class SkipUntil<TSource> : Producer<TSource>
- {
- private readonly IObservable<TSource> _source;
- private readonly DateTimeOffset _startTime;
- internal readonly IScheduler _scheduler;
-
- public SkipUntil(IObservable<TSource> source, DateTimeOffset startTime, IScheduler scheduler)
- {
- _source = source;
- _startTime = startTime;
- _scheduler = scheduler;
- }
-
- public IObservable<TSource> Ω(DateTimeOffset startTime)
- {
- //
- // Maximum semantics:
- //
- // t 0--1--2--3--4--5--6--7-> t 0--1--2--3--4--5--6--7->
- //
- // xs --o--o--o--o--o--o--| xs --o--o--o--o--o--o--|
- // xs.SU(5AM) xxxxxxxxxxxxxxxx-o--| xs.SU(3AM) xxxxxxxxxx-o--o--o--|
- // xs.SU(5AM).SU(3AM) xxxxxxxxx--------o--| xs.SU(3AM).SU(5AM) xxxxxxxxxxxxxxxx-o--|
- //
- if (startTime <= _startTime)
- return this;
- else
- return new SkipUntil<TSource>(_source, startTime, _scheduler);
- }
-
- protected override IDisposable Run(IObserver<TSource> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(this, observer, cancel);
- setSink(sink);
- return sink.Run();
- }
-
- class _ : Sink<TSource>, IObserver<TSource>
- {
- private readonly SkipUntil<TSource> _parent;
- private volatile bool _open;
-
- public _(SkipUntil<TSource> parent, IObserver<TSource> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _parent = parent;
- }
-
- public IDisposable Run()
- {
- var t = _parent._scheduler.Schedule(_parent._startTime, Tick);
- var d = _parent._source.SubscribeSafe(this);
- return new CompositeDisposable(t, d);
- }
-
- private void Tick()
- {
- _open = true;
- }
-
- public void OnNext(TSource value)
- {
- if (_open)
- base._observer.OnNext(value);
- }
-
- public void OnError(Exception error)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
-
- public void OnCompleted()
- {
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/SkipWhile.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/SkipWhile.cs
deleted file mode 100644
index e6e379d..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/SkipWhile.cs
+++ /dev/null
@@ -1,139 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_PERF
-using System;
-
-namespace System.Reactive.Linq.Observαble
-{
- class SkipWhile<TSource> : Producer<TSource>
- {
- private readonly IObservable<TSource> _source;
- private readonly Func<TSource, bool> _predicate;
- private readonly Func<TSource, int, bool> _predicateI;
-
- public SkipWhile(IObservable<TSource> source, Func<TSource, bool> predicate)
- {
- _source = source;
- _predicate = predicate;
- }
-
- public SkipWhile(IObservable<TSource> source, Func<TSource, int, bool> predicate)
- {
- _source = source;
- _predicateI = predicate;
- }
-
- protected override IDisposable Run(IObserver<TSource> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- if (_predicate != null)
- {
- var sink = new _(this, observer, cancel);
- setSink(sink);
- return _source.SubscribeSafe(sink);
- }
- else
- {
- var sink = new τ(this, observer, cancel);
- setSink(sink);
- return _source.SubscribeSafe(sink);
- }
- }
-
- class _ : Sink<TSource>, IObserver<TSource>
- {
- private readonly SkipWhile<TSource> _parent;
- private bool _running;
-
- public _(SkipWhile<TSource> parent, IObserver<TSource> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _parent = parent;
- _running = false;
- }
-
- public void OnNext(TSource value)
- {
- if (!_running)
- {
- try
- {
- _running = !_parent._predicate(value);
- }
- catch (Exception exception)
- {
- base._observer.OnError(exception);
- base.Dispose();
- return;
- }
- }
-
- if (_running)
- {
- base._observer.OnNext(value);
- }
- }
-
- public void OnError(Exception error)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
-
- public void OnCompleted()
- {
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
-
- class τ : Sink<TSource>, IObserver<TSource>
- {
- private readonly SkipWhile<TSource> _parent;
- private bool _running;
- private int _index;
-
- public τ(SkipWhile<TSource> parent, IObserver<TSource> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _parent = parent;
- _running = false;
- _index = 0;
- }
-
- public void OnNext(TSource value)
- {
- if (!_running)
- {
- try
- {
- _running = !_parent._predicateI(value, checked(_index++));
- }
- catch (Exception exception)
- {
- base._observer.OnError(exception);
- base.Dispose();
- return;
- }
- }
-
- if (_running)
- {
- base._observer.OnNext(value);
- }
- }
-
- public void OnError(Exception error)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
-
- public void OnCompleted()
- {
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Sum.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Sum.cs
deleted file mode 100644
index 6d51153..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Sum.cs
+++ /dev/null
@@ -1,517 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_PERF
-using System;
-
-namespace System.Reactive.Linq.Observαble
-{
- class SumDouble : Producer<double>
- {
- private readonly IObservable<double> _source;
-
- public SumDouble(IObservable<double> source)
- {
- _source = source;
- }
-
- protected override IDisposable Run(IObserver<double> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(observer, cancel);
- setSink(sink);
- return _source.SubscribeSafe(sink);
- }
-
- class _ : Sink<double>, IObserver<double>
- {
- private double _sum;
-
- public _(IObserver<double> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _sum = 0.0;
- }
-
- public void OnNext(double value)
- {
- _sum += value;
- }
-
- public void OnError(Exception error)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
-
- public void OnCompleted()
- {
- base._observer.OnNext(_sum);
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
- }
-
- class SumSingle : Producer<float>
- {
- private readonly IObservable<float> _source;
-
- public SumSingle(IObservable<float> source)
- {
- _source = source;
- }
-
- protected override IDisposable Run(IObserver<float> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(observer, cancel);
- setSink(sink);
- return _source.SubscribeSafe(sink);
- }
-
- class _ : Sink<float>, IObserver<float>
- {
- private double _sum; // This is what LINQ to Objects does!
-
- public _(IObserver<float> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _sum = 0.0; // This is what LINQ to Objects does!
- }
-
- public void OnNext(float value)
- {
- _sum += value; // This is what LINQ to Objects does!
- }
-
- public void OnError(Exception error)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
-
- public void OnCompleted()
- {
- base._observer.OnNext((float)_sum); // This is what LINQ to Objects does!
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
- }
-
- class SumDecimal : Producer<decimal>
- {
- private readonly IObservable<decimal> _source;
-
- public SumDecimal(IObservable<decimal> source)
- {
- _source = source;
- }
-
- protected override IDisposable Run(IObserver<decimal> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(observer, cancel);
- setSink(sink);
- return _source.SubscribeSafe(sink);
- }
-
- class _ : Sink<decimal>, IObserver<decimal>
- {
- private decimal _sum;
-
- public _(IObserver<decimal> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _sum = 0M;
- }
-
- public void OnNext(decimal value)
- {
- _sum += value;
- }
-
- public void OnError(Exception error)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
-
- public void OnCompleted()
- {
- base._observer.OnNext(_sum);
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
- }
-
- class SumInt32 : Producer<int>
- {
- private readonly IObservable<int> _source;
-
- public SumInt32(IObservable<int> source)
- {
- _source = source;
- }
-
- protected override IDisposable Run(IObserver<int> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(observer, cancel);
- setSink(sink);
- return _source.SubscribeSafe(sink);
- }
-
- class _ : Sink<int>, IObserver<int>
- {
- private int _sum;
-
- public _(IObserver<int> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _sum = 0;
- }
-
- public void OnNext(int value)
- {
- try
- {
- checked
- {
- _sum += value;
- }
- }
- catch (Exception exception)
- {
- base._observer.OnError(exception);
- base.Dispose();
- }
- }
-
- public void OnError(Exception error)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
-
- public void OnCompleted()
- {
- base._observer.OnNext(_sum);
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
- }
-
- class SumInt64 : Producer<long>
- {
- private readonly IObservable<long> _source;
-
- public SumInt64(IObservable<long> source)
- {
- _source = source;
- }
-
- protected override IDisposable Run(IObserver<long> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(observer, cancel);
- setSink(sink);
- return _source.SubscribeSafe(sink);
- }
-
- class _ : Sink<long>, IObserver<long>
- {
- private long _sum;
-
- public _(IObserver<long> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _sum = 0L;
- }
-
- public void OnNext(long value)
- {
- try
- {
- checked
- {
- _sum += value;
- }
- }
- catch (Exception exception)
- {
- base._observer.OnError(exception);
- base.Dispose();
- }
- }
-
- public void OnError(Exception error)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
-
- public void OnCompleted()
- {
- base._observer.OnNext(_sum);
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
- }
-
- class SumDoubleNullable : Producer<double?>
- {
- private readonly IObservable<double?> _source;
-
- public SumDoubleNullable(IObservable<double?> source)
- {
- _source = source;
- }
-
- protected override IDisposable Run(IObserver<double?> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(observer, cancel);
- setSink(sink);
- return _source.SubscribeSafe(sink);
- }
-
- class _ : Sink<double?>, IObserver<double?>
- {
- private double _sum;
-
- public _(IObserver<double?> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _sum = 0.0;
- }
-
- public void OnNext(double? value)
- {
- if (value != null)
- _sum += value.Value;
- }
-
- public void OnError(Exception error)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
-
- public void OnCompleted()
- {
- base._observer.OnNext(_sum);
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
- }
-
- class SumSingleNullable : Producer<float?>
- {
- private readonly IObservable<float?> _source;
-
- public SumSingleNullable(IObservable<float?> source)
- {
- _source = source;
- }
-
- protected override IDisposable Run(IObserver<float?> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(observer, cancel);
- setSink(sink);
- return _source.SubscribeSafe(sink);
- }
-
- class _ : Sink<float?>, IObserver<float?>
- {
- private double _sum; // This is what LINQ to Objects does!
-
- public _(IObserver<float?> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _sum = 0.0; // This is what LINQ to Objects does!
- }
-
- public void OnNext(float? value)
- {
- if (value != null)
- _sum += value.Value; // This is what LINQ to Objects does!
- }
-
- public void OnError(Exception error)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
-
- public void OnCompleted()
- {
- base._observer.OnNext((float)_sum); // This is what LINQ to Objects does!
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
- }
-
- class SumDecimalNullable : Producer<decimal?>
- {
- private readonly IObservable<decimal?> _source;
-
- public SumDecimalNullable(IObservable<decimal?> source)
- {
- _source = source;
- }
-
- protected override IDisposable Run(IObserver<decimal?> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(observer, cancel);
- setSink(sink);
- return _source.SubscribeSafe(sink);
- }
-
- class _ : Sink<decimal?>, IObserver<decimal?>
- {
- private decimal _sum;
-
- public _(IObserver<decimal?> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _sum = 0M;
- }
-
- public void OnNext(decimal? value)
- {
- if (value != null)
- _sum += value.Value;
- }
-
- public void OnError(Exception error)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
-
- public void OnCompleted()
- {
- base._observer.OnNext(_sum);
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
- }
-
- class SumInt32Nullable : Producer<int?>
- {
- private readonly IObservable<int?> _source;
-
- public SumInt32Nullable(IObservable<int?> source)
- {
- _source = source;
- }
-
- protected override IDisposable Run(IObserver<int?> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(observer, cancel);
- setSink(sink);
- return _source.SubscribeSafe(sink);
- }
-
- class _ : Sink<int?>, IObserver<int?>
- {
- private int _sum;
-
- public _(IObserver<int?> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _sum = 0;
- }
-
- public void OnNext(int? value)
- {
- try
- {
- checked
- {
- if (value != null)
- _sum += value.Value;
- }
- }
- catch (Exception exception)
- {
- base._observer.OnError(exception);
- base.Dispose();
- }
- }
-
- public void OnError(Exception error)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
-
- public void OnCompleted()
- {
- base._observer.OnNext(_sum);
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
- }
-
- class SumInt64Nullable : Producer<long?>
- {
- private readonly IObservable<long?> _source;
-
- public SumInt64Nullable(IObservable<long?> source)
- {
- _source = source;
- }
-
- protected override IDisposable Run(IObserver<long?> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(observer, cancel);
- setSink(sink);
- return _source.SubscribeSafe(sink);
- }
-
- class _ : Sink<long?>, IObserver<long?>
- {
- private long _sum;
-
- public _(IObserver<long?> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _sum = 0L;
- }
-
- public void OnNext(long? value)
- {
- try
- {
- checked
- {
- if (value != null)
- _sum += value.Value;
- }
- }
- catch (Exception exception)
- {
- base._observer.OnError(exception);
- base.Dispose();
- }
- }
-
- public void OnError(Exception error)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
-
- public void OnCompleted()
- {
- base._observer.OnNext(_sum);
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Switch.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Switch.cs
deleted file mode 100644
index 794b0d4..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Switch.cs
+++ /dev/null
@@ -1,152 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_PERF
-using System;
-using System.Reactive.Disposables;
-
-namespace System.Reactive.Linq.Observαble
-{
- class Switch<TSource> : Producer<TSource>
- {
- private readonly IObservable<IObservable<TSource>> _sources;
-
- public Switch(IObservable<IObservable<TSource>> sources)
- {
- _sources = sources;
- }
-
- protected override IDisposable Run(IObserver<TSource> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(this, observer, cancel);
- setSink(sink);
- return sink.Run();
- }
-
- class _ : Sink<TSource>, IObserver<IObservable<TSource>>
- {
- private readonly Switch<TSource> _parent;
-
- public _(Switch<TSource> parent, IObserver<TSource> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _parent = parent;
- }
-
- private object _gate;
- private IDisposable _subscription;
- private SerialDisposable _innerSubscription;
- private bool _isStopped;
- private ulong _latest;
- private bool _hasLatest;
-
- public IDisposable Run()
- {
- _gate = new object();
- _innerSubscription = new SerialDisposable();
- _isStopped = false;
- _latest = 0UL;
- _hasLatest = false;
-
- var subscription = new SingleAssignmentDisposable();
- _subscription = subscription;
- subscription.Disposable = _parent._sources.SubscribeSafe(this);
-
- return new CompositeDisposable(_subscription, _innerSubscription);
- }
-
- public void OnNext(IObservable<TSource> value)
- {
- var id = default(ulong);
- lock (_gate)
- {
- id = unchecked(++_latest);
- _hasLatest = true;
- }
-
- var d = new SingleAssignmentDisposable();
- _innerSubscription.Disposable = d;
- d.Disposable = value.SubscribeSafe(new ι(this, id, d));
- }
-
- public void OnError(Exception error)
- {
- lock (_gate)
- base._observer.OnError(error);
-
- base.Dispose();
- }
-
- public void OnCompleted()
- {
- lock (_gate)
- {
- _subscription.Dispose();
-
- _isStopped = true;
- if (!_hasLatest)
- {
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
- }
-
- class ι : IObserver<TSource>
- {
- private readonly _ _parent;
- private readonly ulong _id;
- private readonly IDisposable _self;
-
- public ι(_ parent, ulong id, IDisposable self)
- {
- _parent = parent;
- _id = id;
- _self = self;
- }
-
- public void OnNext(TSource value)
- {
- lock (_parent._gate)
- {
- if (_parent._latest == _id)
- _parent._observer.OnNext(value);
- }
- }
-
- public void OnError(Exception error)
- {
- lock (_parent._gate)
- {
- _self.Dispose();
-
- if (_parent._latest == _id)
- {
- _parent._observer.OnError(error);
- _parent.Dispose();
- }
- }
- }
-
- public void OnCompleted()
- {
- lock (_parent._gate)
- {
- _self.Dispose();
-
- if (_parent._latest == _id)
- {
- _parent._hasLatest = false;
-
- if (_parent._isStopped)
- {
- _parent._observer.OnCompleted();
- _parent.Dispose();
- }
- }
- }
- }
- }
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Synchronize.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Synchronize.cs
deleted file mode 100644
index cb4e3d9..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Synchronize.cs
+++ /dev/null
@@ -1,69 +0,0 @@
-#if !NO_PERF
-using System;
-
-namespace System.Reactive.Linq.Observαble
-{
- class Synchronize<TSource> : Producer<TSource>
- {
- private readonly IObservable<TSource> _source;
- private readonly object _gate;
-
- public Synchronize(IObservable<TSource> source, object gate)
- {
- _source = source;
- _gate = gate;
- }
-
- public Synchronize(IObservable<TSource> source)
- {
- _source = source;
- }
-
- protected override IDisposable Run(IObserver<TSource> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(this, observer, cancel);
- setSink(sink);
- return _source.Subscribe(sink);
- }
-
- class _ : Sink<TSource>, IObserver<TSource>
- {
- private readonly Synchronize<TSource> _parent;
- private object _gate;
-
- public _(Synchronize<TSource> parent, IObserver<TSource> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _parent = parent;
- _gate = _parent._gate ?? new object();
- }
-
- public void OnNext(TSource value)
- {
- lock (_gate)
- {
- base._observer.OnNext(value);
- }
- }
-
- public void OnError(Exception error)
- {
- lock (_gate)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
- }
-
- public void OnCompleted()
- {
- lock (_gate)
- {
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Take.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Take.cs
deleted file mode 100644
index 738e7c0..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Take.cs
+++ /dev/null
@@ -1,176 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_PERF
-using System;
-using System.Reactive.Concurrency;
-using System.Reactive.Disposables;
-
-namespace System.Reactive.Linq.Observαble
-{
- class Take<TSource> : Producer<TSource>
- {
- private readonly IObservable<TSource> _source;
- private readonly int _count;
- private readonly TimeSpan _duration;
- internal readonly IScheduler _scheduler;
-
- public Take(IObservable<TSource> source, int count)
- {
- _source = source;
- _count = count;
- }
-
- public Take(IObservable<TSource> source, TimeSpan duration, IScheduler scheduler)
- {
- _source = source;
- _duration = duration;
- _scheduler = scheduler;
- }
-
- public IObservable<TSource> Ω(int count)
- {
- //
- // Minimum semantics:
- //
- // xs --o--o--o--o--o--o--| xs --o--o--o--o--o--o--|
- // xs.Take(5) --o--o--o--o--o| xs.Take(3) --o--o--o|
- // xs.Take(5).Take(3) --o--o--o| xs.Take(3).Take(5) --o--o--o|
- //
- if (_count <= count)
- return this;
- else
- return new Take<TSource>(_source, count);
- }
-
- public IObservable<TSource> Ω(TimeSpan duration)
- {
- //
- // Minimum semantics:
- //
- // t 0--1--2--3--4--5--6--7-> t 0--1--2--3--4--5--6--7->
- //
- // xs --o--o--o--o--o--o--| xs --o--o--o--o--o--o--|
- // xs.Take(5s) --o--o--o--o--o| xs.Take(3s) --o--o--o|
- // xs.Take(5s).Take(3s) --o--o--o| xs.Take(3s).Take(5s) --o--o--o|
- //
- if (_duration <= duration)
- return this;
- else
- return new Take<TSource>(_source, duration, _scheduler);
- }
-
- protected override IDisposable Run(IObserver<TSource> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- if (_scheduler == null)
- {
- var sink = new _(this, observer, cancel);
- setSink(sink);
- return _source.SubscribeSafe(sink);
- }
- else
- {
- var sink = new τ(this, observer, cancel);
- setSink(sink);
- return sink.Run();
- }
- }
-
- class _ : Sink<TSource>, IObserver<TSource>
- {
- private readonly Take<TSource> _parent;
- private int _remaining;
-
- public _(Take<TSource> parent, IObserver<TSource> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _parent = parent;
- _remaining = _parent._count;
- }
-
- public void OnNext(TSource value)
- {
- if (_remaining > 0)
- {
- --_remaining;
- base._observer.OnNext(value);
-
- if (_remaining == 0)
- {
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
- }
-
- public void OnError(Exception error)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
-
- public void OnCompleted()
- {
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
-
- class τ : Sink<TSource>, IObserver<TSource>
- {
- private readonly Take<TSource> _parent;
-
- public τ(Take<TSource> parent, IObserver<TSource> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _parent = parent;
- }
-
- private object _gate;
-
- public IDisposable Run()
- {
- _gate = new object();
-
- var t = _parent._scheduler.Schedule(_parent._duration, Tick);
- var d = _parent._source.SubscribeSafe(this);
- return new CompositeDisposable(t, d);
- }
-
- private void Tick()
- {
- lock (_gate)
- {
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
-
- public void OnNext(TSource value)
- {
- lock (_gate)
- {
- base._observer.OnNext(value);
- }
- }
-
- public void OnError(Exception error)
- {
- lock (_gate)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
- }
-
- public void OnCompleted()
- {
- lock (_gate)
- {
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/TakeLast.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/TakeLast.cs
deleted file mode 100644
index 98bf40e..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/TakeLast.cs
+++ /dev/null
@@ -1,230 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_PERF
-using System;
-using System.Collections.Generic;
-using System.Reactive.Concurrency;
-using System.Reactive.Disposables;
-
-namespace System.Reactive.Linq.Observαble
-{
- class TakeLast<TSource> : Producer<TSource>
- {
- private readonly IObservable<TSource> _source;
- private readonly int _count;
- private readonly TimeSpan _duration;
- private readonly IScheduler _scheduler;
- private readonly IScheduler _loopScheduler;
-
- public TakeLast(IObservable<TSource> source, int count, IScheduler loopScheduler)
- {
- _source = source;
- _count = count;
- _loopScheduler = loopScheduler;
- }
-
- public TakeLast(IObservable<TSource> source, TimeSpan duration, IScheduler scheduler, IScheduler loopScheduler)
- {
- _source = source;
- _duration = duration;
- _scheduler = scheduler;
- _loopScheduler = loopScheduler;
- }
-
- protected override IDisposable Run(IObserver<TSource> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- if (_scheduler == null)
- {
- var sink = new _(this, observer, cancel);
- setSink(sink);
- return sink.Run();
- }
- else
- {
- var sink = new τ(this, observer, cancel);
- setSink(sink);
- return sink.Run();
- }
- }
-
- class _ : Sink<TSource>, IObserver<TSource>
- {
- private readonly TakeLast<TSource> _parent;
- private Queue<TSource> _queue;
-
- public _(TakeLast<TSource> parent, IObserver<TSource> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _parent = parent;
- _queue = new Queue<TSource>();
- }
-
- private SingleAssignmentDisposable _subscription;
- private SingleAssignmentDisposable _loop;
-
- public IDisposable Run()
- {
- _subscription = new SingleAssignmentDisposable();
- _loop = new SingleAssignmentDisposable();
-
- _subscription.Disposable = _parent._source.SubscribeSafe(this);
-
- return new CompositeDisposable(_subscription, _loop);
- }
-
- public void OnNext(TSource value)
- {
- _queue.Enqueue(value);
- if (_queue.Count > _parent._count)
- _queue.Dequeue();
- }
-
- public void OnError(Exception error)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
-
- public void OnCompleted()
- {
- _subscription.Dispose();
-
- var longRunning = _parent._loopScheduler.AsLongRunning();
- if (longRunning != null)
- _loop.Disposable = longRunning.ScheduleLongRunning(Loop);
- else
- _loop.Disposable = _parent._loopScheduler.Schedule(LoopRec);
- }
-
- private void LoopRec(Action recurse)
- {
- if (_queue.Count > 0)
- {
- base._observer.OnNext(_queue.Dequeue());
- recurse();
- }
- else
- {
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
-
- private void Loop(ICancelable cancel)
- {
- var n = _queue.Count;
-
- while (!cancel.IsDisposed)
- {
- if (n == 0)
- {
- base._observer.OnCompleted();
- break;
- }
- else
- base._observer.OnNext(_queue.Dequeue());
-
- n--;
- }
-
- base.Dispose();
- }
- }
-
- class τ : Sink<TSource>, IObserver<TSource>
- {
- private readonly TakeLast<TSource> _parent;
- private Queue<System.Reactive.TimeInterval<TSource>> _queue;
-
- public τ(TakeLast<TSource> parent, IObserver<TSource> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _parent = parent;
- _queue = new Queue<System.Reactive.TimeInterval<TSource>>();
- }
-
- private SingleAssignmentDisposable _subscription;
- private SingleAssignmentDisposable _loop;
- private IStopwatch _watch;
-
- public IDisposable Run()
- {
- _subscription = new SingleAssignmentDisposable();
- _loop = new SingleAssignmentDisposable();
-
- _watch = _parent._scheduler.StartStopwatch();
- _subscription.Disposable = _parent._source.SubscribeSafe(this);
-
- return new CompositeDisposable(_subscription, _loop);
- }
-
- public void OnNext(TSource value)
- {
- var now = _watch.Elapsed;
- _queue.Enqueue(new System.Reactive.TimeInterval<TSource>(value, now));
- Trim(now);
- }
-
- public void OnError(Exception error)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
-
- public void OnCompleted()
- {
- _subscription.Dispose();
-
- var now = _watch.Elapsed;
- Trim(now);
-
- var longRunning = _parent._loopScheduler.AsLongRunning();
- if (longRunning != null)
- _loop.Disposable = longRunning.ScheduleLongRunning(Loop);
- else
- _loop.Disposable = _parent._loopScheduler.Schedule(LoopRec);
- }
-
- private void LoopRec(Action recurse)
- {
- if (_queue.Count > 0)
- {
- base._observer.OnNext(_queue.Dequeue().Value);
- recurse();
- }
- else
- {
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
-
- private void Loop(ICancelable cancel)
- {
- var n = _queue.Count;
-
- while (!cancel.IsDisposed)
- {
- if (n == 0)
- {
- base._observer.OnCompleted();
- break;
- }
- else
- base._observer.OnNext(_queue.Dequeue().Value);
-
- n--;
- }
-
- base.Dispose();
- }
-
- private void Trim(TimeSpan now)
- {
- while (_queue.Count > 0 && now - _queue.Peek().Interval >= _parent._duration)
- _queue.Dequeue();
- }
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/TakeLastBuffer.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/TakeLastBuffer.cs
deleted file mode 100644
index 71b36b0..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/TakeLastBuffer.cs
+++ /dev/null
@@ -1,141 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_PERF
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Reactive.Concurrency;
-using System.Reactive.Disposables;
-
-namespace System.Reactive.Linq.Observαble
-{
- class TakeLastBuffer<TSource> : Producer<IList<TSource>>
- {
- private readonly IObservable<TSource> _source;
- private readonly int _count;
- private readonly TimeSpan _duration;
- private readonly IScheduler _scheduler;
-
- public TakeLastBuffer(IObservable<TSource> source, int count)
- {
- _source = source;
- _count = count;
- }
-
- public TakeLastBuffer(IObservable<TSource> source, TimeSpan duration, IScheduler scheduler)
- {
- _source = source;
- _duration = duration;
- _scheduler = scheduler;
- }
-
- protected override IDisposable Run(IObserver<IList<TSource>> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- if (_scheduler == null)
- {
- var sink = new _(this, observer, cancel);
- setSink(sink);
- return _source.SubscribeSafe(sink);
- }
- else
- {
- var sink = new τ(this, observer, cancel);
- setSink(sink);
- return sink.Run();
- }
- }
-
- class _ : Sink<IList<TSource>>, IObserver<TSource>
- {
- private readonly TakeLastBuffer<TSource> _parent;
- private Queue<TSource> _queue;
-
- public _(TakeLastBuffer<TSource> parent, IObserver<IList<TSource>> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _parent = parent;
- _queue = new Queue<TSource>();
- }
-
- public void OnNext(TSource value)
- {
- _queue.Enqueue(value);
- if (_queue.Count > _parent._count)
- _queue.Dequeue();
- }
-
- public void OnError(Exception error)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
-
- public void OnCompleted()
- {
- var res = new List<TSource>(_queue.Count);
- while (_queue.Count > 0)
- res.Add(_queue.Dequeue());
-
- base._observer.OnNext(res);
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
-
- class τ : Sink<IList<TSource>>, IObserver<TSource>
- {
- private readonly TakeLastBuffer<TSource> _parent;
- private Queue<System.Reactive.TimeInterval<TSource>> _queue;
-
- public τ(TakeLastBuffer<TSource> parent, IObserver<IList<TSource>> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _parent = parent;
- _queue = new Queue<System.Reactive.TimeInterval<TSource>>();
- }
-
- private IStopwatch _watch;
-
- public IDisposable Run()
- {
- _watch = _parent._scheduler.StartStopwatch();
-
- return _parent._source.SubscribeSafe(this);
- }
-
- public void OnNext(TSource value)
- {
- var now = _watch.Elapsed;
- _queue.Enqueue(new System.Reactive.TimeInterval<TSource>(value, now));
- Trim(now);
- }
-
- public void OnError(Exception error)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
-
- public void OnCompleted()
- {
- var now = _watch.Elapsed;
- Trim(now);
-
- var res = new List<TSource>(_queue.Count);
- while (_queue.Count > 0)
- res.Add(_queue.Dequeue().Value);
-
- base._observer.OnNext(res);
- base._observer.OnCompleted();
- base.Dispose();
- }
-
- private void Trim(TimeSpan now)
- {
- while (_queue.Count > 0 && now - _queue.Peek().Interval >= _parent._duration)
- _queue.Dequeue();
- }
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/TakeUntil.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/TakeUntil.cs
deleted file mode 100644
index eccc222..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/TakeUntil.cs
+++ /dev/null
@@ -1,258 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_PERF
-using System;
-using System.Reactive.Concurrency;
-using System.Reactive.Disposables;
-using System.Threading;
-
-namespace System.Reactive.Linq.Observαble
-{
- class TakeUntil<TSource, TOther> : Producer<TSource>
- {
- private readonly IObservable<TSource> _source;
- private readonly IObservable<TOther> _other;
-
- public TakeUntil(IObservable<TSource> source, IObservable<TOther> other)
- {
- _source = source;
- _other = other;
- }
-
- protected override IDisposable Run(IObserver<TSource> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(this, observer, cancel);
- setSink(sink);
- return sink.Run();
- }
-
- class _ : Sink<TSource>
- {
- private readonly TakeUntil<TSource, TOther> _parent;
-
- public _(TakeUntil<TSource, TOther> parent, IObserver<TSource> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _parent = parent;
- }
-
- public IDisposable Run()
- {
- var sourceObserver = new T(this);
- var otherObserver = new O(this, sourceObserver);
-
- // COMPAT - Order of Subscribe calls per v1.0.10621
- var otherSubscription = _parent._other.SubscribeSafe(otherObserver);
- otherObserver.Disposable = otherSubscription;
-
- var sourceSubscription = _parent._source.SubscribeSafe(sourceObserver);
-
- return new CompositeDisposable(
- otherSubscription,
- sourceSubscription
- );
- }
-
- /*
- * We tried a more fine-grained synchronization scheme to make TakeUntil more efficient, but
- * this requires several CAS instructions, which quickly add up to being non-beneficial.
- *
- * Notice an approach where the "other" channel performs an Interlocked.Exchange operation on
- * the _parent._observer field to substitute it with a NopObserver<TSource> doesn't work,
- * because the "other" channel still need to send an OnCompleted message, which could happen
- * concurrently with another message when the "source" channel has already read from the
- * _parent._observer field between making the On* call.
- *
- * Fixing this issue requires an ownership transfer mechanism for channels to get exclusive
- * access to the outgoing observer while dispatching a message. Doing this more fine-grained
- * than using locks turns out to be tricky and doesn't reduce cost.
- */
- class T : IObserver<TSource>
- {
- private readonly _ _parent;
- public volatile bool _open;
-
- public T(_ parent)
- {
- _parent = parent;
- _open = false;
- }
-
- public void OnNext(TSource value)
- {
- if (_open)
- {
- _parent._observer.OnNext(value);
- }
- else
- {
- lock (_parent)
- {
- _parent._observer.OnNext(value);
- }
- }
- }
-
- public void OnError(Exception error)
- {
- lock (_parent)
- {
- _parent._observer.OnError(error);
- _parent.Dispose();
- }
- }
-
- public void OnCompleted()
- {
- lock (_parent)
- {
- _parent._observer.OnCompleted();
- _parent.Dispose();
- }
- }
- }
-
- class O : IObserver<TOther>
- {
- private readonly _ _parent;
- private readonly T _sourceObserver;
- private readonly SingleAssignmentDisposable _subscription;
-
- public O(_ parent, T sourceObserver)
- {
- _parent = parent;
- _sourceObserver = sourceObserver;
- _subscription = new SingleAssignmentDisposable();
- }
-
- public IDisposable Disposable
- {
- set { _subscription.Disposable = value; }
- }
-
- public void OnNext(TOther value)
- {
- lock (_parent)
- {
- _parent._observer.OnCompleted();
- _parent.Dispose();
- }
- }
-
- public void OnError(Exception error)
- {
- lock (_parent)
- {
- _parent._observer.OnError(error);
- _parent.Dispose();
- }
- }
-
- public void OnCompleted()
- {
- lock (_parent)
- {
- _sourceObserver._open = true;
- _subscription.Dispose();
- }
- }
- }
- }
- }
-
- class TakeUntil<TSource> : Producer<TSource>
- {
- private readonly IObservable<TSource> _source;
- private readonly DateTimeOffset _endTime;
- internal readonly IScheduler _scheduler;
-
- public TakeUntil(IObservable<TSource> source, DateTimeOffset endTime, IScheduler scheduler)
- {
- _source = source;
- _endTime = endTime;
- _scheduler = scheduler;
- }
-
- public IObservable<TSource> Ω(DateTimeOffset endTime)
- {
- //
- // Minimum semantics:
- //
- // t 0--1--2--3--4--5--6--7-> t 0--1--2--3--4--5--6--7->
- //
- // xs --o--o--o--o--o--o--| xs --o--o--o--o--o--o--|
- // xs.TU(5AM) --o--o--o--o--o| xs.TU(3AM) --o--o--o|
- // xs.TU(5AM).TU(3AM) --o--o--o| xs.TU(3AM).TU(5AM) --o--o--o|
- //
- if (_endTime <= endTime)
- return this;
- else
- return new TakeUntil<TSource>(_source, endTime, _scheduler);
- }
-
- protected override IDisposable Run(IObserver<TSource> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(this, observer, cancel);
- setSink(sink);
- return sink.Run();
- }
-
- class _ : Sink<TSource>, IObserver<TSource>
- {
- private readonly TakeUntil<TSource> _parent;
-
- public _(TakeUntil<TSource> parent, IObserver<TSource> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _parent = parent;
- }
-
- private object _gate;
-
- public IDisposable Run()
- {
- _gate = new object();
-
- var t = _parent._scheduler.Schedule(_parent._endTime, Tick);
- var d = _parent._source.SubscribeSafe(this);
- return new CompositeDisposable(t, d);
- }
-
- private void Tick()
- {
- lock (_gate)
- {
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
-
- public void OnNext(TSource value)
- {
- lock (_gate)
- {
- base._observer.OnNext(value);
- }
- }
-
- public void OnError(Exception error)
- {
- lock (_gate)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
- }
-
- public void OnCompleted()
- {
- lock (_gate)
- {
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/TakeWhile.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/TakeWhile.cs
deleted file mode 100644
index 30f63ca..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/TakeWhile.cs
+++ /dev/null
@@ -1,149 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_PERF
-using System;
-
-namespace System.Reactive.Linq.Observαble
-{
- class TakeWhile<TSource> : Producer<TSource>
- {
- private readonly IObservable<TSource> _source;
- private readonly Func<TSource, bool> _predicate;
- private readonly Func<TSource, int, bool> _predicateI;
-
- public TakeWhile(IObservable<TSource> source, Func<TSource, bool> predicate)
- {
- _source = source;
- _predicate = predicate;
- }
-
- public TakeWhile(IObservable<TSource> source, Func<TSource, int, bool> predicate)
- {
- _source = source;
- _predicateI = predicate;
- }
-
- protected override IDisposable Run(IObserver<TSource> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- if (_predicate != null)
- {
- var sink = new _(this, observer, cancel);
- setSink(sink);
- return _source.SubscribeSafe(sink);
- }
- else
- {
- var sink = new τ(this, observer, cancel);
- setSink(sink);
- return _source.SubscribeSafe(sink);
- }
- }
-
- class _ : Sink<TSource>, IObserver<TSource>
- {
- private readonly TakeWhile<TSource> _parent;
- private bool _running;
-
- public _(TakeWhile<TSource> parent, IObserver<TSource> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _parent = parent;
- _running = true;
- }
-
- public void OnNext(TSource value)
- {
- if (_running)
- {
- try
- {
- _running = _parent._predicate(value);
- }
- catch (Exception exception)
- {
- base._observer.OnError(exception);
- base.Dispose();
- return;
- }
-
- if (_running)
- {
- base._observer.OnNext(value);
- }
- else
- {
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
- }
-
- public void OnError(Exception error)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
-
- public void OnCompleted()
- {
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
-
- class τ : Sink<TSource>, IObserver<TSource>
- {
- private readonly TakeWhile<TSource> _parent;
- private bool _running;
- private int _index;
-
- public τ(TakeWhile<TSource> parent, IObserver<TSource> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _parent = parent;
- _running = true;
- _index = 0;
- }
-
- public void OnNext(TSource value)
- {
- if (_running)
- {
- try
- {
- _running = _parent._predicateI(value, checked(_index++));
- }
- catch (Exception exception)
- {
- base._observer.OnError(exception);
- base.Dispose();
- return;
- }
-
- if (_running)
- {
- base._observer.OnNext(value);
- }
- else
- {
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
- }
-
- public void OnError(Exception error)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
-
- public void OnCompleted()
- {
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Throttle.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Throttle.cs
deleted file mode 100644
index 7b7ad86..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Throttle.cs
+++ /dev/null
@@ -1,280 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_PERF
-using System;
-using System.Reactive.Concurrency;
-using System.Reactive.Disposables;
-
-namespace System.Reactive.Linq.Observαble
-{
- class Throttle<TSource> : Producer<TSource>
- {
- private readonly IObservable<TSource> _source;
- private readonly TimeSpan _dueTime;
- private readonly IScheduler _scheduler;
-
- public Throttle(IObservable<TSource> source, TimeSpan dueTime, IScheduler scheduler)
- {
- _source = source;
- _dueTime = dueTime;
- _scheduler = scheduler;
- }
-
- protected override IDisposable Run(IObserver<TSource> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(this, observer, cancel);
- setSink(sink);
- return sink.Run();
- }
-
- class _ : Sink<TSource>, IObserver<TSource>
- {
- private readonly Throttle<TSource> _parent;
-
- public _(Throttle<TSource> parent, IObserver<TSource> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _parent = parent;
- }
-
- private object _gate;
- private TSource _value;
- private bool _hasValue;
- private SerialDisposable _cancelable;
- private ulong _id;
-
- public IDisposable Run()
- {
- _gate = new object();
- _value = default(TSource);
- _hasValue = false;
- _cancelable = new SerialDisposable();
- _id = 0UL;
-
- var subscription = _parent._source.SubscribeSafe(this);
-
- return new CompositeDisposable(subscription, _cancelable);
- }
-
- public void OnNext(TSource value)
- {
- var currentid = default(ulong);
- lock (_gate)
- {
- _hasValue = true;
- _value = value;
- _id = unchecked(_id + 1);
- currentid = _id;
- }
- var d = new SingleAssignmentDisposable();
- _cancelable.Disposable = d;
- d.Disposable = _parent._scheduler.Schedule(currentid, _parent._dueTime, Propagate);
- }
-
- private IDisposable Propagate(IScheduler self, ulong currentid)
- {
- lock (_gate)
- {
- if (_hasValue && _id == currentid)
- base._observer.OnNext(_value);
- _hasValue = false;
- }
-
- return Disposable.Empty;
- }
-
- public void OnError(Exception error)
- {
- _cancelable.Dispose();
-
- lock (_gate)
- {
- base._observer.OnError(error);
- base.Dispose();
-
- _hasValue = false;
- _id = unchecked(_id + 1);
- }
- }
-
- public void OnCompleted()
- {
- _cancelable.Dispose();
-
- lock (_gate)
- {
- if (_hasValue)
- base._observer.OnNext(_value);
-
- base._observer.OnCompleted();
- base.Dispose();
-
- _hasValue = false;
- _id = unchecked(_id + 1);
- }
- }
- }
- }
-
- class Throttle<TSource, TThrottle> : Producer<TSource>
- {
- private readonly IObservable<TSource> _source;
- private readonly Func<TSource, IObservable<TThrottle>> _throttleSelector;
-
- public Throttle(IObservable<TSource> source, Func<TSource, IObservable<TThrottle>> throttleSelector)
- {
- _source = source;
- _throttleSelector = throttleSelector;
- }
-
- protected override IDisposable Run(IObserver<TSource> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(this, observer, cancel);
- setSink(sink);
- return sink.Run();
- }
-
- class _ : Sink<TSource>, IObserver<TSource>
- {
- private readonly Throttle<TSource, TThrottle> _parent;
-
- public _(Throttle<TSource, TThrottle> parent, IObserver<TSource> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _parent = parent;
- }
-
- private object _gate;
- private TSource _value;
- private bool _hasValue;
- private SerialDisposable _cancelable;
- private ulong _id;
-
- public IDisposable Run()
- {
- _gate = new object();
- _value = default(TSource);
- _hasValue = false;
- _cancelable = new SerialDisposable();
- _id = 0UL;
-
- var subscription = _parent._source.SubscribeSafe(this);
-
- return new CompositeDisposable(subscription, _cancelable);
- }
-
- public void OnNext(TSource value)
- {
- var throttle = default(IObservable<TThrottle>);
- try
- {
- throttle = _parent._throttleSelector(value);
- }
- catch (Exception error)
- {
- lock (_gate)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
-
- return;
- }
-
- ulong currentid;
- lock (_gate)
- {
- _hasValue = true;
- _value = value;
- _id = unchecked(_id + 1);
- currentid = _id;
- }
-
- var d = new SingleAssignmentDisposable();
- _cancelable.Disposable = d;
- d.Disposable = throttle.SubscribeSafe(new δ(this, value, currentid, d));
- }
-
- public void OnError(Exception error)
- {
- _cancelable.Dispose();
-
- lock (_gate)
- {
- base._observer.OnError(error);
- base.Dispose();
-
- _hasValue = false;
- _id = unchecked(_id + 1);
- }
- }
-
- public void OnCompleted()
- {
- _cancelable.Dispose();
-
- lock (_gate)
- {
- if (_hasValue)
- base._observer.OnNext(_value);
-
- base._observer.OnCompleted();
- base.Dispose();
-
- _hasValue = false;
- _id = unchecked(_id + 1);
- }
- }
-
- class δ : IObserver<TThrottle>
- {
- private readonly _ _parent;
- private readonly TSource _value;
- private readonly ulong _currentid;
- private readonly IDisposable _self;
-
- public δ(_ parent, TSource value, ulong currentid, IDisposable self)
- {
- _parent = parent;
- _value = value;
- _currentid = currentid;
- _self = self;
- }
-
- public void OnNext(TThrottle value)
- {
- lock (_parent._gate)
- {
- if (_parent._hasValue && _parent._id == _currentid)
- _parent._observer.OnNext(_value);
-
- _parent._hasValue = false;
- _self.Dispose();
- }
- }
-
- public void OnError(Exception error)
- {
- lock (_parent._gate)
- {
- _parent._observer.OnError(error);
- _parent.Dispose();
- }
- }
-
- public void OnCompleted()
- {
- lock (_parent._gate)
- {
- if (_parent._hasValue && _parent._id == _currentid)
- _parent._observer.OnNext(_value);
-
- _parent._hasValue = false;
- _self.Dispose();
- }
- }
- }
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Throw.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Throw.cs
deleted file mode 100644
index 3b10894..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Throw.cs
+++ /dev/null
@@ -1,50 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_PERF
-using System;
-using System.Reactive.Concurrency;
-
-namespace System.Reactive.Linq.Observαble
-{
- class Throw<TResult> : Producer<TResult>
- {
- private readonly Exception _exception;
- private readonly IScheduler _scheduler;
-
- public Throw(Exception exception, IScheduler scheduler)
- {
- _exception = exception;
- _scheduler = scheduler;
- }
-
- protected override IDisposable Run(IObserver<TResult> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(this, observer, cancel);
- setSink(sink);
- return sink.Run();
- }
-
- class _ : Sink<TResult>
- {
- private readonly Throw<TResult> _parent;
-
- public _(Throw<TResult> parent, IObserver<TResult> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _parent = parent;
- }
-
- public IDisposable Run()
- {
- return _parent._scheduler.Schedule(Invoke);
- }
-
- private void Invoke()
- {
- base._observer.OnError(_parent._exception);
- base.Dispose();
- }
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/TimeInterval.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/TimeInterval.cs
deleted file mode 100644
index dacfa03..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/TimeInterval.cs
+++ /dev/null
@@ -1,73 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_PERF
-using System;
-using System.Diagnostics;
-using System.Reactive.Concurrency;
-using System.Reactive.Disposables;
-using System.Threading;
-
-namespace System.Reactive.Linq.Observαble
-{
- class TimeInterval<TSource> : Producer<System.Reactive.TimeInterval<TSource>>
- {
- private readonly IObservable<TSource> _source;
- private readonly IScheduler _scheduler;
-
- public TimeInterval(IObservable<TSource> source, IScheduler scheduler)
- {
- _source = source;
- _scheduler = scheduler;
- }
-
- protected override IDisposable Run(IObserver<System.Reactive.TimeInterval<TSource>> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(this, observer, cancel);
- setSink(sink);
- return sink.Run();
- }
-
- class _ : Sink<System.Reactive.TimeInterval<TSource>>, IObserver<TSource>
- {
- private readonly TimeInterval<TSource> _parent;
-
- public _(TimeInterval<TSource> parent, IObserver<System.Reactive.TimeInterval<TSource>> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _parent = parent;
- }
-
- private IStopwatch _watch;
- private TimeSpan _last;
-
- public IDisposable Run()
- {
- _watch = _parent._scheduler.StartStopwatch();
- _last = TimeSpan.Zero;
-
- return _parent._source.Subscribe(this);
- }
-
- public void OnNext(TSource value)
- {
- var now = _watch.Elapsed;
- var span = now.Subtract(_last);
- _last = now;
- base._observer.OnNext(new System.Reactive.TimeInterval<TSource>(value, span));
- }
-
- public void OnError(Exception error)
- {
- base._observer.OnError(error);
- Dispose();
- }
-
- public void OnCompleted()
- {
- base._observer.OnCompleted();
- Dispose();
- }
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Timeout.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Timeout.cs
deleted file mode 100644
index 4896294..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Timeout.cs
+++ /dev/null
@@ -1,432 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_PERF
-using System;
-using System.Reactive.Concurrency;
-using System.Reactive.Disposables;
-
-namespace System.Reactive.Linq.Observαble
-{
- class Timeout<TSource> : Producer<TSource>
- {
- private readonly IObservable<TSource> _source;
- private readonly TimeSpan? _dueTimeR;
- private readonly DateTimeOffset? _dueTimeA;
- private readonly IObservable<TSource> _other;
- private readonly IScheduler _scheduler;
-
- public Timeout(IObservable<TSource> source, TimeSpan dueTime, IObservable<TSource> other, IScheduler scheduler)
- {
- _source = source;
- _dueTimeR = dueTime;
- _other = other;
- _scheduler = scheduler;
- }
-
- public Timeout(IObservable<TSource> source, DateTimeOffset dueTime, IObservable<TSource> other, IScheduler scheduler)
- {
- _source = source;
- _dueTimeA = dueTime;
- _other = other;
- _scheduler = scheduler;
- }
-
- protected override IDisposable Run(IObserver<TSource> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- if (_dueTimeA.HasValue)
- {
- var sink = new α(this, observer, cancel);
- setSink(sink);
- return sink.Run();
- }
- else
- {
- var sink = new ρ(this, observer, cancel);
- setSink(sink);
- return sink.Run();
- }
- }
-
- class α : Sink<TSource>, IObserver<TSource>
- {
- private readonly Timeout<TSource> _parent;
-
- public α(Timeout<TSource> parent, IObserver<TSource> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _parent = parent;
- }
-
- private SerialDisposable _subscription;
- private object _gate;
- private bool _switched;
-
- public IDisposable Run()
- {
- _subscription = new SerialDisposable();
- var original = new SingleAssignmentDisposable();
-
- _subscription.Disposable = original;
-
- _gate = new object();
- _switched = false;
-
- var timer = _parent._scheduler.Schedule(_parent._dueTimeA.Value, Timeout);
-
- original.Disposable = _parent._source.SubscribeSafe(this);
-
- return new CompositeDisposable(_subscription, timer);
- }
-
- private void Timeout()
- {
- var timerWins = false;
-
- lock (_gate)
- {
- timerWins = !_switched;
- _switched = true;
- }
-
- if (timerWins)
- _subscription.Disposable = _parent._other.SubscribeSafe(this.GetForwarder());
- }
-
- public void OnNext(TSource value)
- {
- lock (_gate)
- {
- if (!_switched)
- base._observer.OnNext(value);
- }
- }
-
- public void OnError(Exception error)
- {
- var onErrorWins = false;
-
- lock (_gate)
- {
- onErrorWins = !_switched;
- _switched = true;
- }
-
- if (onErrorWins)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
- }
-
- public void OnCompleted()
- {
- var onCompletedWins = false;
-
- lock (_gate)
- {
- onCompletedWins = !_switched;
- _switched = true;
- }
-
- if (onCompletedWins)
- {
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
- }
-
- class ρ : Sink<TSource>, IObserver<TSource>
- {
- private readonly Timeout<TSource> _parent;
-
- public ρ(Timeout<TSource> parent, IObserver<TSource> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _parent = parent;
- }
-
- private SerialDisposable _subscription;
- private SerialDisposable _timer;
-
- private object _gate;
- private ulong _id;
- private bool _switched;
-
- public IDisposable Run()
- {
- _subscription = new SerialDisposable();
- _timer = new SerialDisposable();
- var original = new SingleAssignmentDisposable();
-
- _subscription.Disposable = original;
-
- _gate = new object();
- _id = 0UL;
- _switched = false;
-
- CreateTimer();
-
- original.Disposable = _parent._source.SubscribeSafe(this);
-
- return new CompositeDisposable(_subscription, _timer);
- }
-
- private void CreateTimer()
- {
- _timer.Disposable = _parent._scheduler.Schedule(_id, _parent._dueTimeR.Value, Timeout);
- }
-
- private IDisposable Timeout(IScheduler _, ulong myid)
- {
- var timerWins = false;
-
- lock (_gate)
- {
- _switched = (_id == myid);
- timerWins = _switched;
- }
-
- if (timerWins)
- _subscription.Disposable = _parent._other.SubscribeSafe(this.GetForwarder());
-
- return Disposable.Empty;
- }
-
- public void OnNext(TSource value)
- {
- var onNextWins = false;
-
- lock (_gate)
- {
- onNextWins = !_switched;
- if (onNextWins)
- {
- _id = unchecked(_id + 1);
- }
- }
-
- if (onNextWins)
- {
- base._observer.OnNext(value);
- CreateTimer();
- }
- }
-
- public void OnError(Exception error)
- {
- var onErrorWins = false;
-
- lock (_gate)
- {
- onErrorWins = !_switched;
- if (onErrorWins)
- {
- _id = unchecked(_id + 1);
- }
- }
-
- if (onErrorWins)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
- }
-
- public void OnCompleted()
- {
- var onCompletedWins = false;
-
- lock (_gate)
- {
- onCompletedWins = !_switched;
- if (onCompletedWins)
- {
- _id = unchecked(_id + 1);
- }
- }
-
- if (onCompletedWins)
- {
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
- }
- }
-
- class Timeout<TSource, TTimeout> : Producer<TSource>
- {
- private readonly IObservable<TSource> _source;
- private readonly IObservable<TTimeout> _firstTimeout;
- private readonly Func<TSource, IObservable<TTimeout>> _timeoutSelector;
- private readonly IObservable<TSource> _other;
-
- public Timeout(IObservable<TSource> source, IObservable<TTimeout> firstTimeout, Func<TSource, IObservable<TTimeout>> timeoutSelector, IObservable<TSource> other)
- {
- _source = source;
- _firstTimeout = firstTimeout;
- _timeoutSelector = timeoutSelector;
- _other = other;
- }
-
- protected override IDisposable Run(IObserver<TSource> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(this, observer, cancel);
- setSink(sink);
- return sink.Run();
- }
-
- class _ : Sink<TSource>, IObserver<TSource>
- {
- private readonly Timeout<TSource, TTimeout> _parent;
-
- public _(Timeout<TSource, TTimeout> parent, IObserver<TSource> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _parent = parent;
- }
-
- private SerialDisposable _subscription;
- private SerialDisposable _timer;
- private object _gate;
- private ulong _id;
- private bool _switched;
-
- public IDisposable Run()
- {
- _subscription = new SerialDisposable();
- _timer = new SerialDisposable();
- var original = new SingleAssignmentDisposable();
-
- _subscription.Disposable = original;
-
- _gate = new object();
- _id = 0UL;
- _switched = false;
-
- SetTimer(_parent._firstTimeout);
-
- original.Disposable = _parent._source.SubscribeSafe(this);
-
- return new CompositeDisposable(_subscription, _timer);
- }
-
- public void OnNext(TSource value)
- {
- if (ObserverWins())
- {
- base._observer.OnNext(value);
-
- var timeout = default(IObservable<TTimeout>);
- try
- {
- timeout = _parent._timeoutSelector(value);
- }
- catch (Exception error)
- {
- base._observer.OnError(error);
- base.Dispose();
- return;
- }
-
- SetTimer(timeout);
- }
- }
-
- public void OnError(Exception error)
- {
- if (ObserverWins())
- {
- base._observer.OnError(error);
- base.Dispose();
- }
- }
-
- public void OnCompleted()
- {
- if (ObserverWins())
- {
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
-
- private void SetTimer(IObservable<TTimeout> timeout)
- {
- var myid = _id;
-
- var d = new SingleAssignmentDisposable();
- _timer.Disposable = d;
- d.Disposable = timeout.SubscribeSafe(new τ(this, myid, d));
- }
-
- class τ : IObserver<TTimeout>
- {
- private readonly _ _parent;
- private readonly ulong _id;
- private readonly IDisposable _self;
-
- public τ(_ parent, ulong id, IDisposable self)
- {
- _parent = parent;
- _id = id;
- _self = self;
- }
-
- public void OnNext(TTimeout value)
- {
- if (TimerWins())
- _parent._subscription.Disposable = _parent._parent._other.SubscribeSafe(_parent.GetForwarder());
-
- _self.Dispose();
- }
-
- public void OnError(Exception error)
- {
- if (TimerWins())
- {
- _parent._observer.OnError(error);
- _parent.Dispose();
- }
- }
-
- public void OnCompleted()
- {
- if (TimerWins())
- _parent._subscription.Disposable = _parent._parent._other.SubscribeSafe(_parent.GetForwarder());
- }
-
- private bool TimerWins()
- {
- var res = false;
-
- lock (_parent._gate)
- {
- _parent._switched = (_parent._id == _id);
- res = _parent._switched;
- }
-
- return res;
- }
- }
-
- private bool ObserverWins()
- {
- var res = false;
-
- lock (_gate)
- {
- res = !_switched;
- if (res)
- {
- _id = unchecked(_id + 1);
- }
- }
-
- return res;
- }
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Timer.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Timer.cs
deleted file mode 100644
index 22ee0df..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Timer.cs
+++ /dev/null
@@ -1,264 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_PERF
-using System;
-using System.Diagnostics;
-using System.Reactive.Concurrency;
-using System.Reactive.Disposables;
-using System.Threading;
-
-namespace System.Reactive.Linq.Observαble
-{
- class Timer : Producer<long>
- {
- private readonly DateTimeOffset? _dueTimeA;
- private readonly TimeSpan? _dueTimeR;
- private readonly TimeSpan? _period;
- private readonly IScheduler _scheduler;
-
- public Timer(DateTimeOffset dueTime, TimeSpan? period, IScheduler scheduler)
- {
- _dueTimeA = dueTime;
- _period = period;
- _scheduler = scheduler;
- }
-
- public Timer(TimeSpan dueTime, TimeSpan? period, IScheduler scheduler)
- {
- _dueTimeR = dueTime;
- _period = period;
- _scheduler = scheduler;
- }
-
- protected override IDisposable Run(IObserver<long> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- if (_period.HasValue)
- {
- var sink = new π(this, observer, cancel);
- setSink(sink);
- return sink.Run();
- }
- else
- {
- var sink = new _(this, observer, cancel);
- setSink(sink);
- return sink.Run();
- }
- }
-
- class _ : Sink<long>
- {
- private readonly Timer _parent;
-
- public _(Timer parent, IObserver<long> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _parent = parent;
- }
-
- public IDisposable Run()
- {
- if (_parent._dueTimeA.HasValue)
- {
- return _parent._scheduler.Schedule(_parent._dueTimeA.Value, Invoke);
- }
- else
- {
- return _parent._scheduler.Schedule(_parent._dueTimeR.Value, Invoke);
- }
- }
-
- private void Invoke()
- {
- base._observer.OnNext(0);
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
-
- class π : Sink<long>
- {
- private readonly Timer _parent;
- private readonly TimeSpan _period;
-
- public π(Timer parent, IObserver<long> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _parent = parent;
- _period = _parent._period.Value;
- }
-
- public IDisposable Run()
- {
- if (_parent._dueTimeA.HasValue)
- {
- var dueTime = _parent._dueTimeA.Value;
- return _parent._scheduler.Schedule(default(object), dueTime, InvokeStart);
- }
- else
- {
- var dueTime = _parent._dueTimeR.Value;
-
- //
- // Optimize for the case of Observable.Interval.
- //
- if (dueTime == _period)
- {
- return _parent._scheduler.SchedulePeriodic(0L, _period, (Func<long, long>)Tick);
- }
-
- return _parent._scheduler.Schedule(default(object), dueTime, InvokeStart);
- }
- }
-
- //
- // BREAKING CHANGE v2 > v1.x - No more correction for time drift based on absolute time. This
- // didn't work for large period values anyway; the fractional
- // error exceeded corrections. Also complicated dealing with system
- // clock change conditions and caused numerous bugs.
- //
- // - For more precise scheduling, use a custom scheduler that measures TimeSpan values in a
- // better way, e.g. spinning to make up for the last part of the period. Whether or not the
- // values of the TimeSpan period match NT time or wall clock time is up to the scheduler.
- //
- // - For more accurate scheduling wrt the system clock, use Generate with DateTimeOffset time
- // selectors. When the system clock changes, intervals will not be the same as diffs between
- // consecutive absolute time values. The precision will be low (1s range by default).
- //
- private long Tick(long count)
- {
- base._observer.OnNext(count);
- return unchecked(count + 1);
- }
-
- private int _pendingTickCount;
- private IDisposable _periodic;
-
- private IDisposable InvokeStart(IScheduler self, object state)
- {
- //
- // Notice the first call to OnNext will introduce skew if it takes significantly long when
- // using the following naive implementation:
- //
- // Code: base._observer.OnNext(0L);
- // return self.SchedulePeriodicEmulated(1L, _period, (Func<long, long>)Tick);
- //
- // What we're saying here is that Observable.Timer(dueTime, period) is pretty much the same
- // as writing Observable.Timer(dueTime).Concat(Observable.Interval(period)).
- //
- // Expected: dueTime
- // |
- // 0--period--1--period--2--period--3--period--4--...
- // |
- // +-OnNext(0L)-|
- //
- // Actual: dueTime
- // |
- // 0------------#--period--1--period--2--period--3--period--4--...
- // |
- // +-OnNext(0L)-|
- //
- // Different solutions for this behavior have different problems:
- //
- // 1. Scheduling the periodic job first and using an AsyncLock to serialize the OnNext calls
- // has the drawback that InvokeStart may never return. This happens when every callback
- // doesn't meet the period's deadline, hence the periodic job keeps queueing stuff up. In
- // this case, InvokeStart stays the owner of the AsyncLock and the call to Wait will never
- // return, thus not allowing any interleaving of work on this scheduler's logical thread.
- //
- // 2. Scheduling the periodic job first and using a (blocking) synchronization primitive to
- // signal completion of the OnNext(0L) call to the Tick call requires quite a bit of state
- // and careful handling of the case when OnNext(0L) throws. What's worse is the blocking
- // behavior inside Tick.
- //
- // In order to avoid blocking behavior, we need a scheme much like SchedulePeriodic emulation
- // where work to dispatch OnNext(n + 1) is delegated to a catch up loop in case OnNext(n) was
- // still running. Because SchedulePeriodic emulation exhibits such behavior in all cases, we
- // only need to deal with the overlap of OnNext(0L) with future periodic OnNext(n) dispatch
- // jobs. In the worst case where every callback takes longer than the deadline implied by the
- // period, the periodic job will just queue up work that's dispatched by the tail-recursive
- // catch up loop. In the best case, all work will be dispatched on the periodic scheduler.
- //
-
- //
- // We start with one tick pending because we're about to start doing OnNext(0L).
- //
- _pendingTickCount = 1;
-
- var d = new SingleAssignmentDisposable();
- _periodic = d;
- d.Disposable = self.SchedulePeriodic(1L, _period, (Func<long, long>)Tock);
-
- try
- {
- base._observer.OnNext(0L);
- }
- catch (Exception e)
- {
- d.Dispose();
- e.Throw();
- }
-
- //
- // If the periodic scheduling job already ran before we finished dispatching the OnNext(0L)
- // call, we'll find pendingTickCount to be > 1. In this case, we need to catch up by dispatching
- // subsequent calls to OnNext as fast as possible, but without running a loop in order to ensure
- // fair play with the scheduler. So, we run a tail-recursive loop in CatchUp instead.
- //
- if (Interlocked.Decrement(ref _pendingTickCount) > 0)
- {
- var c = new SingleAssignmentDisposable();
- c.Disposable = self.Schedule(1L, CatchUp);
-
- return new CompositeDisposable(2) { d, c };
- }
-
- return d;
- }
-
- private long Tock(long count)
- {
- //
- // Notice the handler for (emulated) periodic scheduling is non-reentrant.
- //
- // When there's no overlap with the OnNext(0L) call, the following code will cycle through
- // pendingTickCount 0 -> 1 -> 0 for the remainder of the timer's execution.
- //
- // If there's overlap with the OnNext(0L) call, pendingTickCount will increase to record
- // the number of catch up OnNext calls required, which will be dispatched by the recursive
- // scheduling loop in CatchUp (which quits when it reaches 0 pending ticks).
- //
- if (Interlocked.Increment(ref _pendingTickCount) == 1)
- {
- base._observer.OnNext(count);
- Interlocked.Decrement(ref _pendingTickCount);
- }
-
- return unchecked(count + 1);
- }
-
- private void CatchUp(long count, Action<long> recurse)
- {
- try
- {
- base._observer.OnNext(count);
- }
- catch (Exception e)
- {
- _periodic.Dispose();
- e.Throw();
- }
-
- //
- // We can simply bail out if we decreased the tick count to 0. In that case, the Tock
- // method will take over when it sees the 0 -> 1 transition.
- //
- if (Interlocked.Decrement(ref _pendingTickCount) > 0)
- {
- recurse(unchecked(count + 1));
- }
- }
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Timestamp.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Timestamp.cs
deleted file mode 100644
index ed54678..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Timestamp.cs
+++ /dev/null
@@ -1,56 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_PERF
-using System;
-using System.Reactive.Concurrency;
-
-namespace System.Reactive.Linq.Observαble
-{
- class Timestamp<TSource> : Producer<Timestamped<TSource>>
- {
- private readonly IObservable<TSource> _source;
- private readonly IScheduler _scheduler;
-
- public Timestamp(IObservable<TSource> source, IScheduler scheduler)
- {
- _source = source;
- _scheduler = scheduler;
- }
-
- protected override IDisposable Run(IObserver<Timestamped<TSource>> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(this, observer, cancel);
- setSink(sink);
- return _source.SubscribeSafe(sink);
- }
-
- class _ : Sink<Timestamped<TSource>>, IObserver<TSource>
- {
- private readonly Timestamp<TSource> _parent;
-
- public _(Timestamp<TSource> parent, IObserver<Timestamped<TSource>> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _parent = parent;
- }
-
- public void OnNext(TSource value)
- {
- base._observer.OnNext(new Timestamped<TSource>(value, _parent._scheduler.Now));
- }
-
- public void OnError(Exception error)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
-
- public void OnCompleted()
- {
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/ToArray.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/ToArray.cs
deleted file mode 100644
index ba039ae..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/ToArray.cs
+++ /dev/null
@@ -1,55 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_PERF
-using System;
-using System.Collections.Generic;
-
-namespace System.Reactive.Linq.Observαble
-{
- class ToArray<TSource> : Producer<TSource[]>
- {
- private readonly IObservable<TSource> _source;
-
- public ToArray(IObservable<TSource> source)
- {
- _source = source;
- }
-
- protected override IDisposable Run(IObserver<TSource[]> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(observer, cancel);
- setSink(sink);
- return _source.SubscribeSafe(sink);
- }
-
- class _ : Sink<TSource[]>, IObserver<TSource>
- {
- private List<TSource> _list;
-
- public _(IObserver<TSource[]> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _list = new List<TSource>();
- }
-
- public void OnNext(TSource value)
- {
- _list.Add(value);
- }
-
- public void OnError(Exception error)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
-
- public void OnCompleted()
- {
- base._observer.OnNext(_list.ToArray());
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/ToDictionary.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/ToDictionary.cs
deleted file mode 100644
index 919c1a1..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/ToDictionary.cs
+++ /dev/null
@@ -1,71 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_PERF
-using System;
-using System.Collections.Generic;
-
-namespace System.Reactive.Linq.Observαble
-{
- class ToDictionary<TSource, TKey, TElement> : Producer<IDictionary<TKey, TElement>>
- {
- private readonly IObservable<TSource> _source;
- private readonly Func<TSource, TKey> _keySelector;
- private readonly Func<TSource, TElement> _elementSelector;
- private readonly IEqualityComparer<TKey> _comparer;
-
- public ToDictionary(IObservable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector, IEqualityComparer<TKey> comparer)
- {
- _source = source;
- _keySelector = keySelector;
- _elementSelector = elementSelector;
- _comparer = comparer;
- }
-
- protected override IDisposable Run(IObserver<IDictionary<TKey, TElement>> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(this, observer, cancel);
- setSink(sink);
- return _source.SubscribeSafe(sink);
- }
-
- class _ : Sink<IDictionary<TKey, TElement>>, IObserver<TSource>
- {
- private readonly ToDictionary<TSource, TKey, TElement> _parent;
- private Dictionary<TKey, TElement> _dictionary;
-
- public _(ToDictionary<TSource, TKey, TElement> parent, IObserver<IDictionary<TKey, TElement>> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _parent = parent;
- _dictionary = new Dictionary<TKey, TElement>(_parent._comparer);
- }
-
- public void OnNext(TSource value)
- {
- try
- {
- _dictionary.Add(_parent._keySelector(value), _parent._elementSelector(value));
- }
- catch (Exception ex)
- {
- base._observer.OnError(ex);
- base.Dispose();
- }
- }
-
- public void OnError(Exception error)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
-
- public void OnCompleted()
- {
- base._observer.OnNext(_dictionary);
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/ToList.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/ToList.cs
deleted file mode 100644
index 34956d4..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/ToList.cs
+++ /dev/null
@@ -1,55 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_PERF
-using System;
-using System.Collections.Generic;
-
-namespace System.Reactive.Linq.Observαble
-{
- class ToList<TSource> : Producer<IList<TSource>>
- {
- private readonly IObservable<TSource> _source;
-
- public ToList(IObservable<TSource> source)
- {
- _source = source;
- }
-
- protected override IDisposable Run(IObserver<IList<TSource>> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(observer, cancel);
- setSink(sink);
- return _source.SubscribeSafe(sink);
- }
-
- class _ : Sink<IList<TSource>>, IObserver<TSource>
- {
- private List<TSource> _list;
-
- public _(IObserver<IList<TSource>> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _list = new List<TSource>();
- }
-
- public void OnNext(TSource value)
- {
- _list.Add(value);
- }
-
- public void OnError(Exception error)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
-
- public void OnCompleted()
- {
- base._observer.OnNext(_list);
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/ToLookup.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/ToLookup.cs
deleted file mode 100644
index 55ff7d3..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/ToLookup.cs
+++ /dev/null
@@ -1,72 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_PERF
-using System;
-using System.Collections.Generic;
-using System.Linq;
-
-namespace System.Reactive.Linq.Observαble
-{
- class ToLookup<TSource, TKey, TElement> : Producer<ILookup<TKey, TElement>>
- {
- private readonly IObservable<TSource> _source;
- private readonly Func<TSource, TKey> _keySelector;
- private readonly Func<TSource, TElement> _elementSelector;
- private readonly IEqualityComparer<TKey> _comparer;
-
- public ToLookup(IObservable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector, IEqualityComparer<TKey> comparer)
- {
- _source = source;
- _keySelector = keySelector;
- _elementSelector = elementSelector;
- _comparer = comparer;
- }
-
- protected override IDisposable Run(IObserver<ILookup<TKey, TElement>> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(this, observer, cancel);
- setSink(sink);
- return _source.SubscribeSafe(sink);
- }
-
- class _ : Sink<ILookup<TKey, TElement>>, IObserver<TSource>
- {
- private readonly ToLookup<TSource, TKey, TElement> _parent;
- private Lookup<TKey, TElement> _lookup;
-
- public _(ToLookup<TSource, TKey, TElement> parent, IObserver<ILookup<TKey, TElement>> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _parent = parent;
- _lookup = new Lookup<TKey, TElement>(_parent._comparer);
- }
-
- public void OnNext(TSource value)
- {
- try
- {
- _lookup.Add(_parent._keySelector(value), _parent._elementSelector(value));
- }
- catch (Exception ex)
- {
- base._observer.OnError(ex);
- base.Dispose();
- }
- }
-
- public void OnError(Exception error)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
-
- public void OnCompleted()
- {
- base._observer.OnNext(_lookup);
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/ToObservable.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/ToObservable.cs
deleted file mode 100644
index 795d54d..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/ToObservable.cs
+++ /dev/null
@@ -1,174 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_PERF
-using System;
-using System.Collections.Generic;
-using System.Reactive.Concurrency;
-using System.Reactive.Disposables;
-
-namespace System.Reactive.Linq.Observαble
-{
- class ToObservable<TSource> : Producer<TSource>
- {
- private readonly IEnumerable<TSource> _source;
- private readonly IScheduler _scheduler;
-
- public ToObservable(IEnumerable<TSource> source, IScheduler scheduler)
- {
- _source = source;
- _scheduler = scheduler;
- }
-
- protected override IDisposable Run(IObserver<TSource> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(this, observer, cancel);
- setSink(sink);
- return sink.Run();
- }
-
- class _ : Sink<TSource>
- {
- private readonly ToObservable<TSource> _parent;
-
- public _(ToObservable<TSource> parent, IObserver<TSource> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _parent = parent;
- }
-
- public IDisposable Run()
- {
- var e = default(IEnumerator<TSource>);
- try
- {
- e = _parent._source.GetEnumerator();
- }
- catch (Exception exception)
- {
- base._observer.OnError(exception);
- base.Dispose();
- return Disposable.Empty;
- }
-
- var longRunning = _parent._scheduler.AsLongRunning();
- if (longRunning != null)
- {
- //
- // Long-running schedulers have the contract they should *never* prevent
- // the work from starting, such that the scheduled work has the chance
- // to observe the cancellation and perform proper clean-up. In this case,
- // we're sure Loop will be entered, allowing us to dispose the enumerator.
- //
- return longRunning.ScheduleLongRunning(e, Loop);
- }
- else
- {
- //
- // We never allow the scheduled work to be cancelled. Instead, the flag
- // is used to have LoopRec bail out and perform proper clean-up of the
- // enumerator.
- //
- var flag = new BooleanDisposable();
- _parent._scheduler.Schedule(new State(flag, e), LoopRec);
- return flag;
- }
- }
-
- class State
- {
- public readonly ICancelable flag;
- public readonly IEnumerator<TSource> enumerator;
-
- public State(ICancelable flag, IEnumerator<TSource> enumerator)
- {
- this.flag = flag;
- this.enumerator = enumerator;
- }
- }
-
- private void LoopRec(State state, Action<State> recurse)
- {
- var hasNext = false;
- var ex = default(Exception);
- var current = default(TSource);
-
- if (state.flag.IsDisposed)
- {
- state.enumerator.Dispose();
- return;
- }
-
- try
- {
- hasNext = state.enumerator.MoveNext();
- if (hasNext)
- current = state.enumerator.Current;
- }
- catch (Exception exception)
- {
- ex = exception;
- }
-
- if (ex != null)
- {
- state.enumerator.Dispose();
-
- base._observer.OnError(ex);
- base.Dispose();
- return;
- }
-
- if (!hasNext)
- {
- state.enumerator.Dispose();
-
- base._observer.OnCompleted();
- base.Dispose();
- return;
- }
-
- base._observer.OnNext(current);
- recurse(state);
- }
-
- private void Loop(IEnumerator<TSource> enumerator, ICancelable cancel)
- {
- while (!cancel.IsDisposed)
- {
- var hasNext = false;
- var ex = default(Exception);
- var current = default(TSource);
-
- try
- {
- hasNext = enumerator.MoveNext();
- if (hasNext)
- current = enumerator.Current;
- }
- catch (Exception exception)
- {
- ex = exception;
- }
-
- if (ex != null)
- {
- base._observer.OnError(ex);
- break;
- }
-
- if (!hasNext)
- {
- base._observer.OnCompleted();
- break;
- }
-
- base._observer.OnNext(current);
- }
-
- enumerator.Dispose();
- base.Dispose();
- }
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Using.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Using.cs
deleted file mode 100644
index 996ee0e..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Using.cs
+++ /dev/null
@@ -1,76 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_PERF
-using System;
-using System.Reactive.Disposables;
-
-namespace System.Reactive.Linq.Observαble
-{
- class Using<TSource, TResource> : Producer<TSource>
- where TResource : IDisposable
- {
- private readonly Func<TResource> _resourceFactory;
- private readonly Func<TResource, IObservable<TSource>> _observableFactory;
-
- public Using(Func<TResource> resourceFactory, Func<TResource, IObservable<TSource>> observableFactory)
- {
- _resourceFactory = resourceFactory;
- _observableFactory = observableFactory;
- }
-
- protected override IDisposable Run(IObserver<TSource> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(this, observer, cancel);
- setSink(sink);
- return sink.Run();
- }
-
- class _ : Sink<TSource>, IObserver<TSource>
- {
- private readonly Using<TSource, TResource> _parent;
-
- public _(Using<TSource, TResource> parent, IObserver<TSource> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _parent = parent;
- }
-
- public IDisposable Run()
- {
- var source = default(IObservable<TSource>);
- var disposable = Disposable.Empty;
- try
- {
- var resource = _parent._resourceFactory();
- if (resource != null)
- disposable = resource;
- source = _parent._observableFactory(resource);
- }
- catch (Exception exception)
- {
- return new CompositeDisposable(Observable.Throw<TSource>(exception).SubscribeSafe(this), disposable);
- }
-
- return new CompositeDisposable(source.SubscribeSafe(this), disposable);
- }
-
- public void OnNext(TSource value)
- {
- base._observer.OnNext(value);
- }
-
- public void OnError(Exception error)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
-
- public void OnCompleted()
- {
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Where.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Where.cs
deleted file mode 100644
index a8eaa92..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Where.cs
+++ /dev/null
@@ -1,135 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_PERF
-using System;
-
-namespace System.Reactive.Linq.Observαble
-{
- class Where<TSource> : Producer<TSource>
- {
- private readonly IObservable<TSource> _source;
- private readonly Func<TSource, bool> _predicate;
- private readonly Func<TSource, int, bool> _predicateI;
-
- public Where(IObservable<TSource> source, Func<TSource, bool> predicate)
- {
- _source = source;
- _predicate = predicate;
- }
-
- public Where(IObservable<TSource> source, Func<TSource, int, bool> predicate)
- {
- _source = source;
- _predicateI = predicate;
- }
-
- public IObservable<TSource> Ω(Func<TSource, bool> predicate)
- {
- if (_predicate != null)
- return new Where<TSource>(_source, x => _predicate(x) && predicate(x));
- else
- return new Where<TSource>(this, predicate);
- }
-
- protected override IDisposable Run(IObserver<TSource> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- if (_predicate != null)
- {
- var sink = new _(this, observer, cancel);
- setSink(sink);
- return _source.SubscribeSafe(sink);
- }
- else
- {
- var sink = new τ(this, observer, cancel);
- setSink(sink);
- return _source.SubscribeSafe(sink);
- }
- }
-
- class _ : Sink<TSource>, IObserver<TSource>
- {
- private readonly Where<TSource> _parent;
-
- public _(Where<TSource> parent, IObserver<TSource> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _parent = parent;
- }
-
- public void OnNext(TSource value)
- {
- var shouldRun = default(bool);
- try
- {
- shouldRun = _parent._predicate(value);
- }
- catch (Exception exception)
- {
- base._observer.OnError(exception);
- base.Dispose();
- return;
- }
-
- if (shouldRun)
- base._observer.OnNext(value);
- }
-
- public void OnError(Exception error)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
-
- public void OnCompleted()
- {
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
-
- class τ : Sink<TSource>, IObserver<TSource>
- {
- private readonly Where<TSource> _parent;
- private int _index;
-
- public τ(Where<TSource> parent, IObserver<TSource> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _parent = parent;
- _index = 0;
- }
-
- public void OnNext(TSource value)
- {
- var shouldRun = default(bool);
- try
- {
- shouldRun = _parent._predicateI(value, checked(_index++));
- }
- catch (Exception exception)
- {
- base._observer.OnError(exception);
- base.Dispose();
- return;
- }
-
- if (shouldRun)
- base._observer.OnNext(value);
- }
-
- public void OnError(Exception error)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
-
- public void OnCompleted()
- {
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/While.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/While.cs
deleted file mode 100644
index 178e4c8..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/While.cs
+++ /dev/null
@@ -1,53 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_PERF
-using System;
-using System.Collections.Generic;
-
-namespace System.Reactive.Linq.Observαble
-{
- class While<TSource> : Producer<TSource>, IConcatenatable<TSource>
- {
- private readonly Func<bool> _condition;
- private readonly IObservable<TSource> _source;
-
- public While(Func<bool> condition, IObservable<TSource> source)
- {
- _condition = condition;
- _source = source;
- }
-
- protected override IDisposable Run(IObserver<TSource> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(observer, cancel);
- setSink(sink);
- return sink.Run(GetSources());
- }
-
- public IEnumerable<IObservable<TSource>> GetSources()
- {
- while (_condition())
- yield return _source;
- }
-
- class _ : ConcatSink<TSource>
- {
- public _(IObserver<TSource> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- }
-
- public override void OnNext(TSource value)
- {
- base._observer.OnNext(value);
- }
-
- public override void OnError(Exception error)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
- }
- }
-}
-#endif
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Window.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Window.cs
deleted file mode 100644
index 47059c7..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Window.cs
+++ /dev/null
@@ -1,758 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_PERF
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Reactive.Concurrency;
-using System.Reactive.Disposables;
-using System.Reactive.Subjects;
-using System.Threading;
-
-namespace System.Reactive.Linq.Observαble
-{
- class Window<TSource> : Producer<IObservable<TSource>>
- {
- private readonly IObservable<TSource> _source;
- private readonly int _count;
- private readonly int _skip;
-
- private readonly TimeSpan _timeSpan;
- private readonly TimeSpan _timeShift;
- private readonly IScheduler _scheduler;
-
- public Window(IObservable<TSource> source, int count, int skip)
- {
- _source = source;
- _count = count;
- _skip = skip;
- }
-
- public Window(IObservable<TSource> source, TimeSpan timeSpan, TimeSpan timeShift, IScheduler scheduler)
- {
- _source = source;
- _timeSpan = timeSpan;
- _timeShift = timeShift;
- _scheduler = scheduler;
- }
-
- public Window(IObservable<TSource> source, TimeSpan timeSpan, int count, IScheduler scheduler)
- {
- _source = source;
- _timeSpan = timeSpan;
- _count = count;
- _scheduler = scheduler;
- }
-
- protected override IDisposable Run(IObserver<IObservable<TSource>> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- if (_scheduler == null)
- {
- var sink = new _(this, observer, cancel);
- setSink(sink);
- return sink.Run();
- }
- else if (_count > 0)
- {
- var sink = new μ(this, observer, cancel);
- setSink(sink);
- return sink.Run();
- }
- else
- {
- if (_timeSpan == _timeShift)
- {
- var sink = new π(this, observer, cancel);
- setSink(sink);
- return sink.Run();
- }
- else
- {
- var sink = new τ(this, observer, cancel);
- setSink(sink);
- return sink.Run();
- }
- }
- }
-
- class _ : Sink<IObservable<TSource>>, IObserver<TSource>
- {
- private readonly Window<TSource> _parent;
-
- public _(Window<TSource> parent, IObserver<IObservable<TSource>> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _parent = parent;
- }
-
- private Queue<ISubject<TSource>> _queue;
- private int _n;
- private SingleAssignmentDisposable _m;
- private RefCountDisposable _refCountDisposable;
-
- public IDisposable Run()
- {
- _queue = new Queue<ISubject<TSource>>();
- _n = 0;
- _m = new SingleAssignmentDisposable();
- _refCountDisposable = new RefCountDisposable(_m);
-
- var firstWindow = CreateWindow();
- base._observer.OnNext(firstWindow);
-
- _m.Disposable = _parent._source.SubscribeSafe(this);
-
- return _refCountDisposable;
- }
-
- private IObservable<TSource> CreateWindow()
- {
- var s = new Subject<TSource>();
- _queue.Enqueue(s);
- return new WindowObservable<TSource>(s, _refCountDisposable);
- }
-
- public void OnNext(TSource value)
- {
- foreach (var s in _queue)
- s.OnNext(value);
-
- var c = _n - _parent._count + 1;
- if (c >= 0 && c % _parent._skip == 0)
- {
- var s = _queue.Dequeue();
- s.OnCompleted();
- }
-
- _n++;
- if (_n % _parent._skip == 0)
- {
- var newWindow = CreateWindow();
- base._observer.OnNext(newWindow);
- }
- }
-
- public void OnError(Exception error)
- {
- while (_queue.Count > 0)
- _queue.Dequeue().OnError(error);
-
- base._observer.OnError(error);
- base.Dispose();
- }
-
- public void OnCompleted()
- {
- while (_queue.Count > 0)
- _queue.Dequeue().OnCompleted();
-
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
-
- class τ : Sink<IObservable<TSource>>, IObserver<TSource>
- {
- private readonly Window<TSource> _parent;
-
- public τ(Window<TSource> parent, IObserver<IObservable<TSource>> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _parent = parent;
- }
-
- private TimeSpan _totalTime;
- private TimeSpan _nextShift;
- private TimeSpan _nextSpan;
-
- private object _gate;
- private Queue<ISubject<TSource>> _q;
-
- private SerialDisposable _timerD;
- private RefCountDisposable _refCountDisposable;
-
- public IDisposable Run()
- {
- _totalTime = TimeSpan.Zero;
- _nextShift = _parent._timeShift;
- _nextSpan = _parent._timeSpan;
-
- _gate = new object();
- _q = new Queue<ISubject<TSource>>();
-
- _timerD = new SerialDisposable();
-
- var groupDisposable = new CompositeDisposable(2) { _timerD };
- _refCountDisposable = new RefCountDisposable(groupDisposable);
-
- CreateWindow();
- CreateTimer();
-
- groupDisposable.Add(_parent._source.SubscribeSafe(this));
-
- return _refCountDisposable;
- }
-
- private void CreateWindow()
- {
- var s = new Subject<TSource>();
- _q.Enqueue(s);
- base._observer.OnNext(new WindowObservable<TSource>(s, _refCountDisposable));
- }
-
- private void CreateTimer()
- {
- var m = new SingleAssignmentDisposable();
- _timerD.Disposable = m;
-
- var isSpan = false;
- var isShift = false;
- if (_nextSpan == _nextShift)
- {
- isSpan = true;
- isShift = true;
- }
- else if (_nextSpan < _nextShift)
- isSpan = true;
- else
- isShift = true;
-
- var newTotalTime = isSpan ? _nextSpan : _nextShift;
- var ts = newTotalTime - _totalTime;
- _totalTime = newTotalTime;
-
- if (isSpan)
- _nextSpan += _parent._timeShift;
- if (isShift)
- _nextShift += _parent._timeShift;
-
- m.Disposable = _parent._scheduler.Schedule(new State { isSpan = isSpan, isShift = isShift }, ts, Tick);
- }
-
- struct State
- {
- public bool isSpan;
- public bool isShift;
- }
-
- private IDisposable Tick(IScheduler self, State state)
- {
- lock (_gate)
- {
- //
- // BREAKING CHANGE v2 > v1.x - Making behavior of sending OnCompleted to the window
- // before sending out a new window consistent across all
- // overloads of Window and Buffer. Before v2, the two
- // operations below were reversed.
- //
- if (state.isSpan)
- {
- var s = _q.Dequeue();
- s.OnCompleted();
- }
-
- if (state.isShift)
- {
- CreateWindow();
- }
- }
-
- CreateTimer();
-
- return Disposable.Empty;
- }
-
- public void OnNext(TSource value)
- {
- lock (_gate)
- {
- foreach (var s in _q)
- s.OnNext(value);
- }
- }
-
- public void OnError(Exception error)
- {
- lock (_gate)
- {
- foreach (var s in _q)
- s.OnError(error);
-
- base._observer.OnError(error);
- base.Dispose();
- }
- }
-
- public void OnCompleted()
- {
- lock (_gate)
- {
- foreach (var s in _q)
- s.OnCompleted();
-
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
- }
-
- class π : Sink<IObservable<TSource>>, IObserver<TSource>
- {
- private readonly Window<TSource> _parent;
-
- public π(Window<TSource> parent, IObserver<IObservable<TSource>> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _parent = parent;
- }
-
- private object _gate;
- private Subject<TSource> _subject;
- private RefCountDisposable _refCountDisposable;
-
- public IDisposable Run()
- {
- _gate = new object();
-
- var groupDisposable = new CompositeDisposable(2);
- _refCountDisposable = new RefCountDisposable(groupDisposable);
-
- CreateWindow();
-
- groupDisposable.Add(_parent._scheduler.SchedulePeriodic(_parent._timeSpan, Tick));
- groupDisposable.Add(_parent._source.SubscribeSafe(this));
-
- return _refCountDisposable;
- }
-
- private void Tick()
- {
- lock (_gate)
- {
- _subject.OnCompleted();
- CreateWindow();
- }
- }
-
- private void CreateWindow()
- {
- _subject = new Subject<TSource>();
- base._observer.OnNext(new WindowObservable<TSource>(_subject, _refCountDisposable));
- }
-
- public void OnNext(TSource value)
- {
- lock (_gate)
- {
- _subject.OnNext(value);
- }
- }
-
- public void OnError(Exception error)
- {
- lock (_gate)
- {
- _subject.OnError(error);
-
- base._observer.OnError(error);
- base.Dispose();
- }
- }
-
- public void OnCompleted()
- {
- lock (_gate)
- {
- _subject.OnCompleted();
-
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
- }
-
- class μ : Sink<IObservable<TSource>>, IObserver<TSource>
- {
- private readonly Window<TSource> _parent;
-
- public μ(Window<TSource> parent, IObserver<IObservable<TSource>> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _parent = parent;
- }
-
- private object _gate;
- private ISubject<TSource> _s;
- private int _n;
- private int _windowId;
-
- private SerialDisposable _timerD;
- private RefCountDisposable _refCountDisposable;
-
- public IDisposable Run()
- {
- _gate = new object();
- _s = default(ISubject<TSource>);
- _n = 0;
- _windowId = 0;
-
- _timerD = new SerialDisposable();
- var groupDisposable = new CompositeDisposable(2) { _timerD };
- _refCountDisposable = new RefCountDisposable(groupDisposable);
-
- _s = new Subject<TSource>();
- base._observer.OnNext(new WindowObservable<TSource>(_s, _refCountDisposable));
- CreateTimer(0);
-
- groupDisposable.Add(_parent._source.SubscribeSafe(this));
-
- return _refCountDisposable;
- }
-
- private void CreateTimer(int id)
- {
- var m = new SingleAssignmentDisposable();
- _timerD.Disposable = m;
-
- m.Disposable = _parent._scheduler.Schedule(id, _parent._timeSpan, Tick);
- }
-
- private IDisposable Tick(IScheduler self, int id)
- {
- var d = Disposable.Empty;
-
- var newId = 0;
- lock (_gate)
- {
- if (id != _windowId)
- return d;
-
- _n = 0;
- newId = ++_windowId;
-
- _s.OnCompleted();
- _s = new Subject<TSource>();
- base._observer.OnNext(new WindowObservable<TSource>(_s, _refCountDisposable));
- }
-
- CreateTimer(newId);
-
- return d;
- }
-
- public void OnNext(TSource value)
- {
- var newWindow = false;
- var newId = 0;
-
- lock (_gate)
- {
- _s.OnNext(value);
-
- _n++;
- if (_n == _parent._count)
- {
- newWindow = true;
- _n = 0;
- newId = ++_windowId;
-
- _s.OnCompleted();
- _s = new Subject<TSource>();
- base._observer.OnNext(new WindowObservable<TSource>(_s, _refCountDisposable));
- }
- }
-
- if (newWindow)
- CreateTimer(newId);
- }
-
- public void OnError(Exception error)
- {
- lock (_gate)
- {
- _s.OnError(error);
- base._observer.OnError(error);
- base.Dispose();
- }
- }
-
- public void OnCompleted()
- {
- lock (_gate)
- {
- _s.OnCompleted();
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
- }
- }
-
- class Window<TSource, TWindowClosing> : Producer<IObservable<TSource>>
- {
- private readonly IObservable<TSource> _source;
- private readonly Func<IObservable<TWindowClosing>> _windowClosingSelector;
- private readonly IObservable<TWindowClosing> _windowBoundaries;
-
- public Window(IObservable<TSource> source, Func<IObservable<TWindowClosing>> windowClosingSelector)
- {
- _source = source;
- _windowClosingSelector = windowClosingSelector;
- }
-
- public Window(IObservable<TSource> source, IObservable<TWindowClosing> windowBoundaries)
- {
- _source = source;
- _windowBoundaries = windowBoundaries;
- }
-
- protected override IDisposable Run(IObserver<IObservable<TSource>> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- if (_windowClosingSelector != null)
- {
- var sink = new _(this, observer, cancel);
- setSink(sink);
- return sink.Run();
- }
- else
- {
- var sink = new β(this, observer, cancel);
- setSink(sink);
- return sink.Run();
- }
- }
-
- class _ : Sink<IObservable<TSource>>, IObserver<TSource>
- {
- private readonly Window<TSource, TWindowClosing> _parent;
-
- public _(Window<TSource, TWindowClosing> parent, IObserver<IObservable<TSource>> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _parent = parent;
- }
-
- private ISubject<TSource> _window;
- private object _gate;
- private AsyncLock _windowGate;
-
- private SerialDisposable _m;
- private RefCountDisposable _refCountDisposable;
-
- public IDisposable Run()
- {
- _window = new Subject<TSource>();
- _gate = new object();
- _windowGate = new AsyncLock();
-
- _m = new SerialDisposable();
- var groupDisposable = new CompositeDisposable(2) { _m };
- _refCountDisposable = new RefCountDisposable(groupDisposable);
-
- var window = new WindowObservable<TSource>(_window, _refCountDisposable);
- base._observer.OnNext(window);
-
- groupDisposable.Add(_parent._source.SubscribeSafe(this));
-
- _windowGate.Wait(CreateWindowClose);
-
- return _refCountDisposable;
- }
-
- private void CreateWindowClose()
- {
- var windowClose = default(IObservable<TWindowClosing>);
- try
- {
- windowClose = _parent._windowClosingSelector();
- }
- catch (Exception exception)
- {
- lock (_gate)
- {
- base._observer.OnError(exception);
- base.Dispose();
- }
- return;
- }
-
- var closingSubscription = new SingleAssignmentDisposable();
- _m.Disposable = closingSubscription;
- closingSubscription.Disposable = windowClose.SubscribeSafe(new ω(this, closingSubscription));
- }
-
- private void CloseWindow(IDisposable closingSubscription)
- {
- closingSubscription.Dispose();
-
- lock (_gate)
- {
- _window.OnCompleted();
- _window = new Subject<TSource>();
-
- var window = new WindowObservable<TSource>(_window, _refCountDisposable);
- base._observer.OnNext(window);
- }
-
- _windowGate.Wait(CreateWindowClose);
- }
-
- class ω : IObserver<TWindowClosing>
- {
- private readonly _ _parent;
- private readonly IDisposable _self;
-
- public ω(_ parent, IDisposable self)
- {
- _parent = parent;
- _self = self;
- }
-
- public void OnNext(TWindowClosing value)
- {
- _parent.CloseWindow(_self);
- }
-
- public void OnError(Exception error)
- {
- _parent.OnError(error);
- }
-
- public void OnCompleted()
- {
- _parent.CloseWindow(_self);
- }
- }
-
- public void OnNext(TSource value)
- {
- lock (_gate)
- {
- _window.OnNext(value);
- }
- }
-
- public void OnError(Exception error)
- {
- lock (_gate)
- {
- _window.OnError(error);
- base._observer.OnError(error);
- base.Dispose();
- }
- }
-
- public void OnCompleted()
- {
- lock (_gate)
- {
- _window.OnCompleted();
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
- }
-
- class β : Sink<IObservable<TSource>>, IObserver<TSource>
- {
- private readonly Window<TSource, TWindowClosing> _parent;
-
- public β(Window<TSource, TWindowClosing> parent, IObserver<IObservable<TSource>> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _parent = parent;
- }
-
- private ISubject<TSource> _window;
- private object _gate;
-
- private RefCountDisposable _refCountDisposable;
-
- public IDisposable Run()
- {
- _window = new Subject<TSource>();
- _gate = new object();
-
- var d = new CompositeDisposable(2);
- _refCountDisposable = new RefCountDisposable(d);
-
- var window = new WindowObservable<TSource>(_window, _refCountDisposable);
- base._observer.OnNext(window);
-
- d.Add(_parent._source.SubscribeSafe(this));
- d.Add(_parent._windowBoundaries.SubscribeSafe(new ω(this)));
-
- return _refCountDisposable;
- }
-
- class ω : IObserver<TWindowClosing>
- {
- private readonly β _parent;
-
- public ω(β parent)
- {
- _parent = parent;
- }
-
- public void OnNext(TWindowClosing value)
- {
- lock (_parent._gate)
- {
- _parent._window.OnCompleted();
- _parent._window = new Subject<TSource>();
-
- var window = new WindowObservable<TSource>(_parent._window, _parent._refCountDisposable);
- _parent._observer.OnNext(window);
- }
- }
-
- public void OnError(Exception error)
- {
- _parent.OnError(error);
- }
-
- public void OnCompleted()
- {
- _parent.OnCompleted();
- }
- }
-
- public void OnNext(TSource value)
- {
- lock (_gate)
- {
- _window.OnNext(value);
- }
- }
-
- public void OnError(Exception error)
- {
- lock (_gate)
- {
- _window.OnError(error);
- base._observer.OnError(error);
- base.Dispose();
- }
- }
-
- public void OnCompleted()
- {
- lock (_gate)
- {
- _window.OnCompleted();
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
- }
- }
-
- class WindowObservable<TSource> : AddRef<TSource>
- {
- public WindowObservable(IObservable<TSource> source, RefCountDisposable refCount)
- : base(source, refCount)
- {
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Zip.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Zip.cs
deleted file mode 100644
index bde6e29..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Zip.cs
+++ /dev/null
@@ -1,2326 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_PERF
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.Linq;
-using System.Reactive.Disposables;
-
-namespace System.Reactive.Linq.Observαble
-{
- #region Binary
-
- class Zip<TFirst, TSecond, TResult> : Producer<TResult>
- {
- private readonly IObservable<TFirst> _first;
- private readonly IObservable<TSecond> _second;
- private readonly IEnumerable<TSecond> _secondE;
- private readonly Func<TFirst, TSecond, TResult> _resultSelector;
-
- public Zip(IObservable<TFirst> first, IObservable<TSecond> second, Func<TFirst, TSecond, TResult> resultSelector)
- {
- _first = first;
- _second = second;
- _resultSelector = resultSelector;
- }
-
- public Zip(IObservable<TFirst> first, IEnumerable<TSecond> second, Func<TFirst, TSecond, TResult> resultSelector)
- {
- _first = first;
- _secondE = second;
- _resultSelector = resultSelector;
- }
-
- protected override IDisposable Run(IObserver<TResult> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- if (_second != null)
- {
- var sink = new _(this, observer, cancel);
- setSink(sink);
- return sink.Run();
- }
- else
- {
- var sink = new ε(this, observer, cancel);
- setSink(sink);
- return sink.Run();
- }
- }
-
- class _ : Sink<TResult>
- {
- private readonly Zip<TFirst, TSecond, TResult> _parent;
-
- public _(Zip<TFirst, TSecond, TResult> parent, IObserver<TResult> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _parent = parent;
- }
-
- private object _gate;
-
- public IDisposable Run()
- {
- _gate = new object();
-
- var fstSubscription = new SingleAssignmentDisposable();
- var sndSubscription = new SingleAssignmentDisposable();
-
- var fstO = new F(this, fstSubscription);
- var sndO = new S(this, sndSubscription);
-
- fstO.Other = sndO;
- sndO.Other = fstO;
-
- fstSubscription.Disposable = _parent._first.SubscribeSafe(fstO);
- sndSubscription.Disposable = _parent._second.SubscribeSafe(sndO);
-
- return new CompositeDisposable(fstSubscription, sndSubscription, fstO, sndO);
- }
-
- class F : IObserver<TFirst>, IDisposable
- {
- private readonly _ _parent;
- private readonly IDisposable _self;
- private S _other;
- private Queue<TFirst> _queue;
-
- public F(_ parent, IDisposable self)
- {
- _parent = parent;
- _self = self;
- _queue = new Queue<TFirst>();
- }
-
- public S Other { set { _other = value; } }
-
- public Queue<TFirst> Queue { get { return _queue; } }
- public bool Done { get; private set; }
-
- public void OnNext(TFirst value)
- {
- lock (_parent._gate)
- {
- if (_other.Queue.Count > 0)
- {
- var r = _other.Queue.Dequeue();
-
- var res = default(TResult);
- try
- {
- res = _parent._parent._resultSelector(value, r);
- }
- catch (Exception ex)
- {
- _parent._observer.OnError(ex);
- _parent.Dispose();
- return;
- }
-
- _parent._observer.OnNext(res);
- }
- else
- {
- if (_other.Done)
- {
- _parent._observer.OnCompleted();
- _parent.Dispose();
- return;
- }
-
- _queue.Enqueue(value);
- }
- }
- }
-
- public void OnError(Exception error)
- {
- lock (_parent._gate)
- {
- _parent._observer.OnError(error);
- _parent.Dispose();
- }
- }
-
- public void OnCompleted()
- {
- lock (_parent._gate)
- {
- Done = true;
-
- if (_other.Done)
- {
- _parent._observer.OnCompleted();
- _parent.Dispose();
- return;
- }
- else
- {
- _self.Dispose();
- }
- }
- }
-
- public void Dispose()
- {
- _queue.Clear();
- }
- }
-
- class S : IObserver<TSecond>, IDisposable
- {
- private readonly _ _parent;
- private readonly IDisposable _self;
- private F _other;
- private Queue<TSecond> _queue;
-
- public S(_ parent, IDisposable self)
- {
- _parent = parent;
- _self = self;
- _queue = new Queue<TSecond>();
- }
-
- public F Other { set { _other = value; } }
-
- public Queue<TSecond> Queue { get { return _queue; } }
- public bool Done { get; private set; }
-
- public void OnNext(TSecond value)
- {
- lock (_parent._gate)
- {
- if (_other.Queue.Count > 0)
- {
- var l = _other.Queue.Dequeue();
-
- var res = default(TResult);
- try
- {
- res = _parent._parent._resultSelector(l, value);
- }
- catch (Exception ex)
- {
- _parent._observer.OnError(ex);
- _parent.Dispose();
- return;
- }
-
- _parent._observer.OnNext(res);
- }
- else
- {
- if (_other.Done)
- {
- _parent._observer.OnCompleted();
- _parent.Dispose();
- return;
- }
-
- _queue.Enqueue(value);
- }
- }
- }
-
- public void OnError(Exception error)
- {
- lock (_parent._gate)
- {
- _parent._observer.OnError(error);
- _parent.Dispose();
- }
- }
-
- public void OnCompleted()
- {
- lock (_parent._gate)
- {
- Done = true;
-
- if (_other.Done)
- {
- _parent._observer.OnCompleted();
- _parent.Dispose();
- return;
- }
- else
- {
- _self.Dispose();
- }
- }
- }
-
- public void Dispose()
- {
- _queue.Clear();
- }
- }
- }
-
- class ε : Sink<TResult>, IObserver<TFirst>
- {
- private readonly Zip<TFirst, TSecond, TResult> _parent;
-
- public ε(Zip<TFirst, TSecond, TResult> parent, IObserver<TResult> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _parent = parent;
- }
-
- private IEnumerator<TSecond> _rightEnumerator;
-
- public IDisposable Run()
- {
- //
- // Notice the evaluation order of obtaining the enumerator and subscribing to the
- // observable sequence is reversed compared to the operator's signature. This is
- // required to make sure the enumerator is available as soon as the observer can
- // be called. Otherwise, we end up having a race for the initialization and use
- // of the _rightEnumerator field.
- //
- try
- {
- _rightEnumerator = _parent._secondE.GetEnumerator();
- }
- catch (Exception exception)
- {
- base._observer.OnError(exception);
- base.Dispose();
- return Disposable.Empty;
- }
-
- var leftSubscription = _parent._first.SubscribeSafe(this);
-
- return new CompositeDisposable(leftSubscription, _rightEnumerator);
- }
-
- public void OnNext(TFirst value)
- {
- var hasNext = false;
- try
- {
- hasNext = _rightEnumerator.MoveNext();
- }
- catch (Exception ex)
- {
- base._observer.OnError(ex);
- base.Dispose();
- return;
- }
-
- if (hasNext)
- {
- var right = default(TSecond);
- try
- {
- right = _rightEnumerator.Current;
- }
- catch (Exception ex)
- {
- base._observer.OnError(ex);
- base.Dispose();
- return;
- }
-
- TResult result;
- try
- {
- result = _parent._resultSelector(value, right);
- }
- catch (Exception ex)
- {
- base._observer.OnError(ex);
- base.Dispose();
- return;
- }
-
- base._observer.OnNext(result);
- }
- else
- {
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
-
- public void OnError(Exception error)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
-
- public void OnCompleted()
- {
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
- }
-
- #endregion
-
- #region [3,16]-ary
-
- /* The following code is generated by a tool checked in to $/.../Source/Tools/CodeGenerators. */
-
- #region Zip auto-generated code (6/10/2012 8:13:21 PM)
-
- class Zip<T1, T2, T3, TResult> : Producer<TResult>
- {
- private readonly IObservable<T1> _source1;
- private readonly IObservable<T2> _source2;
- private readonly IObservable<T3> _source3;
- private readonly Func<T1, T2, T3, TResult> _resultSelector;
-
- public Zip(IObservable<T1> source1, IObservable<T2> source2, IObservable<T3> source3, Func<T1, T2, T3, TResult> resultSelector)
- {
- _source1 = source1;
- _source2 = source2;
- _source3 = source3;
- _resultSelector = resultSelector;
- }
-
- protected override IDisposable Run(IObserver<TResult> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(this, observer, cancel);
- setSink(sink);
- return sink.Run();
- }
-
- class _ : ZipSink<TResult>
- {
- private readonly Zip<T1, T2, T3, TResult> _parent;
-
- public _(Zip<T1, T2, T3, TResult> parent, IObserver<TResult> observer, IDisposable cancel)
- : base(3, observer, cancel)
- {
- _parent = parent;
- }
-
- private ZipObserver<T1> _observer1;
- private ZipObserver<T2> _observer2;
- private ZipObserver<T3> _observer3;
-
- public IDisposable Run()
- {
- var subscriptions = new SingleAssignmentDisposable[3];
- for (int i = 0; i < 3; i++)
- subscriptions[i] = new SingleAssignmentDisposable();
-
- _observer1 = new ZipObserver<T1>(_gate, this, 0, subscriptions[0]);
- _observer2 = new ZipObserver<T2>(_gate, this, 1, subscriptions[1]);
- _observer3 = new ZipObserver<T3>(_gate, this, 2, subscriptions[2]);
-
- base.Queues[0] = _observer1.Values;
- base.Queues[1] = _observer2.Values;
- base.Queues[2] = _observer3.Values;
-
- subscriptions[0].Disposable = _parent._source1.SubscribeSafe(_observer1);
- subscriptions[1].Disposable = _parent._source2.SubscribeSafe(_observer2);
- subscriptions[2].Disposable = _parent._source3.SubscribeSafe(_observer3);
-
- return new CompositeDisposable(subscriptions)
- {
- Disposable.Create(() =>
- {
- _observer1.Values.Clear();
- _observer2.Values.Clear();
- _observer3.Values.Clear();
- })
- };
- }
-
- protected override TResult GetResult()
- {
- return _parent._resultSelector(_observer1.Values.Dequeue(), _observer2.Values.Dequeue(), _observer3.Values.Dequeue());
- }
- }
- }
-
- class Zip<T1, T2, T3, T4, TResult> : Producer<TResult>
- {
- private readonly IObservable<T1> _source1;
- private readonly IObservable<T2> _source2;
- private readonly IObservable<T3> _source3;
- private readonly IObservable<T4> _source4;
- private readonly Func<T1, T2, T3, T4, TResult> _resultSelector;
-
- public Zip(IObservable<T1> source1, IObservable<T2> source2, IObservable<T3> source3, IObservable<T4> source4, Func<T1, T2, T3, T4, TResult> resultSelector)
- {
- _source1 = source1;
- _source2 = source2;
- _source3 = source3;
- _source4 = source4;
- _resultSelector = resultSelector;
- }
-
- protected override IDisposable Run(IObserver<TResult> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(this, observer, cancel);
- setSink(sink);
- return sink.Run();
- }
-
- class _ : ZipSink<TResult>
- {
- private readonly Zip<T1, T2, T3, T4, TResult> _parent;
-
- public _(Zip<T1, T2, T3, T4, TResult> parent, IObserver<TResult> observer, IDisposable cancel)
- : base(4, observer, cancel)
- {
- _parent = parent;
- }
-
- private ZipObserver<T1> _observer1;
- private ZipObserver<T2> _observer2;
- private ZipObserver<T3> _observer3;
- private ZipObserver<T4> _observer4;
-
- public IDisposable Run()
- {
- var subscriptions = new SingleAssignmentDisposable[4];
- for (int i = 0; i < 4; i++)
- subscriptions[i] = new SingleAssignmentDisposable();
-
- _observer1 = new ZipObserver<T1>(_gate, this, 0, subscriptions[0]);
- _observer2 = new ZipObserver<T2>(_gate, this, 1, subscriptions[1]);
- _observer3 = new ZipObserver<T3>(_gate, this, 2, subscriptions[2]);
- _observer4 = new ZipObserver<T4>(_gate, this, 3, subscriptions[3]);
-
- base.Queues[0] = _observer1.Values;
- base.Queues[1] = _observer2.Values;
- base.Queues[2] = _observer3.Values;
- base.Queues[3] = _observer4.Values;
-
- subscriptions[0].Disposable = _parent._source1.SubscribeSafe(_observer1);
- subscriptions[1].Disposable = _parent._source2.SubscribeSafe(_observer2);
- subscriptions[2].Disposable = _parent._source3.SubscribeSafe(_observer3);
- subscriptions[3].Disposable = _parent._source4.SubscribeSafe(_observer4);
-
- return new CompositeDisposable(subscriptions)
- {
- Disposable.Create(() =>
- {
- _observer1.Values.Clear();
- _observer2.Values.Clear();
- _observer3.Values.Clear();
- _observer4.Values.Clear();
- })
- };
- }
-
- protected override TResult GetResult()
- {
- return _parent._resultSelector(_observer1.Values.Dequeue(), _observer2.Values.Dequeue(), _observer3.Values.Dequeue(), _observer4.Values.Dequeue());
- }
- }
- }
-
-#if !NO_LARGEARITY
- class Zip<T1, T2, T3, T4, T5, TResult> : Producer<TResult>
- {
- private readonly IObservable<T1> _source1;
- private readonly IObservable<T2> _source2;
- private readonly IObservable<T3> _source3;
- private readonly IObservable<T4> _source4;
- private readonly IObservable<T5> _source5;
- private readonly Func<T1, T2, T3, T4, T5, TResult> _resultSelector;
-
- public Zip(IObservable<T1> source1, IObservable<T2> source2, IObservable<T3> source3, IObservable<T4> source4, IObservable<T5> source5, Func<T1, T2, T3, T4, T5, TResult> resultSelector)
- {
- _source1 = source1;
- _source2 = source2;
- _source3 = source3;
- _source4 = source4;
- _source5 = source5;
- _resultSelector = resultSelector;
- }
-
- protected override IDisposable Run(IObserver<TResult> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(this, observer, cancel);
- setSink(sink);
- return sink.Run();
- }
-
- class _ : ZipSink<TResult>
- {
- private readonly Zip<T1, T2, T3, T4, T5, TResult> _parent;
-
- public _(Zip<T1, T2, T3, T4, T5, TResult> parent, IObserver<TResult> observer, IDisposable cancel)
- : base(5, observer, cancel)
- {
- _parent = parent;
- }
-
- private ZipObserver<T1> _observer1;
- private ZipObserver<T2> _observer2;
- private ZipObserver<T3> _observer3;
- private ZipObserver<T4> _observer4;
- private ZipObserver<T5> _observer5;
-
- public IDisposable Run()
- {
- var subscriptions = new SingleAssignmentDisposable[5];
- for (int i = 0; i < 5; i++)
- subscriptions[i] = new SingleAssignmentDisposable();
-
- _observer1 = new ZipObserver<T1>(_gate, this, 0, subscriptions[0]);
- _observer2 = new ZipObserver<T2>(_gate, this, 1, subscriptions[1]);
- _observer3 = new ZipObserver<T3>(_gate, this, 2, subscriptions[2]);
- _observer4 = new ZipObserver<T4>(_gate, this, 3, subscriptions[3]);
- _observer5 = new ZipObserver<T5>(_gate, this, 4, subscriptions[4]);
-
- base.Queues[0] = _observer1.Values;
- base.Queues[1] = _observer2.Values;
- base.Queues[2] = _observer3.Values;
- base.Queues[3] = _observer4.Values;
- base.Queues[4] = _observer5.Values;
-
- subscriptions[0].Disposable = _parent._source1.SubscribeSafe(_observer1);
- subscriptions[1].Disposable = _parent._source2.SubscribeSafe(_observer2);
- subscriptions[2].Disposable = _parent._source3.SubscribeSafe(_observer3);
- subscriptions[3].Disposable = _parent._source4.SubscribeSafe(_observer4);
- subscriptions[4].Disposable = _parent._source5.SubscribeSafe(_observer5);
-
- return new CompositeDisposable(subscriptions)
- {
- Disposable.Create(() =>
- {
- _observer1.Values.Clear();
- _observer2.Values.Clear();
- _observer3.Values.Clear();
- _observer4.Values.Clear();
- _observer5.Values.Clear();
- })
- };
- }
-
- protected override TResult GetResult()
- {
- return _parent._resultSelector(_observer1.Values.Dequeue(), _observer2.Values.Dequeue(), _observer3.Values.Dequeue(), _observer4.Values.Dequeue(), _observer5.Values.Dequeue());
- }
- }
- }
-
- class Zip<T1, T2, T3, T4, T5, T6, TResult> : Producer<TResult>
- {
- private readonly IObservable<T1> _source1;
- private readonly IObservable<T2> _source2;
- private readonly IObservable<T3> _source3;
- private readonly IObservable<T4> _source4;
- private readonly IObservable<T5> _source5;
- private readonly IObservable<T6> _source6;
- private readonly Func<T1, T2, T3, T4, T5, T6, TResult> _resultSelector;
-
- public Zip(IObservable<T1> source1, IObservable<T2> source2, IObservable<T3> source3, IObservable<T4> source4, IObservable<T5> source5, IObservable<T6> source6, Func<T1, T2, T3, T4, T5, T6, TResult> resultSelector)
- {
- _source1 = source1;
- _source2 = source2;
- _source3 = source3;
- _source4 = source4;
- _source5 = source5;
- _source6 = source6;
- _resultSelector = resultSelector;
- }
-
- protected override IDisposable Run(IObserver<TResult> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(this, observer, cancel);
- setSink(sink);
- return sink.Run();
- }
-
- class _ : ZipSink<TResult>
- {
- private readonly Zip<T1, T2, T3, T4, T5, T6, TResult> _parent;
-
- public _(Zip<T1, T2, T3, T4, T5, T6, TResult> parent, IObserver<TResult> observer, IDisposable cancel)
- : base(6, observer, cancel)
- {
- _parent = parent;
- }
-
- private ZipObserver<T1> _observer1;
- private ZipObserver<T2> _observer2;
- private ZipObserver<T3> _observer3;
- private ZipObserver<T4> _observer4;
- private ZipObserver<T5> _observer5;
- private ZipObserver<T6> _observer6;
-
- public IDisposable Run()
- {
- var subscriptions = new SingleAssignmentDisposable[6];
- for (int i = 0; i < 6; i++)
- subscriptions[i] = new SingleAssignmentDisposable();
-
- _observer1 = new ZipObserver<T1>(_gate, this, 0, subscriptions[0]);
- _observer2 = new ZipObserver<T2>(_gate, this, 1, subscriptions[1]);
- _observer3 = new ZipObserver<T3>(_gate, this, 2, subscriptions[2]);
- _observer4 = new ZipObserver<T4>(_gate, this, 3, subscriptions[3]);
- _observer5 = new ZipObserver<T5>(_gate, this, 4, subscriptions[4]);
- _observer6 = new ZipObserver<T6>(_gate, this, 5, subscriptions[5]);
-
- base.Queues[0] = _observer1.Values;
- base.Queues[1] = _observer2.Values;
- base.Queues[2] = _observer3.Values;
- base.Queues[3] = _observer4.Values;
- base.Queues[4] = _observer5.Values;
- base.Queues[5] = _observer6.Values;
-
- subscriptions[0].Disposable = _parent._source1.SubscribeSafe(_observer1);
- subscriptions[1].Disposable = _parent._source2.SubscribeSafe(_observer2);
- subscriptions[2].Disposable = _parent._source3.SubscribeSafe(_observer3);
- subscriptions[3].Disposable = _parent._source4.SubscribeSafe(_observer4);
- subscriptions[4].Disposable = _parent._source5.SubscribeSafe(_observer5);
- subscriptions[5].Disposable = _parent._source6.SubscribeSafe(_observer6);
-
- return new CompositeDisposable(subscriptions)
- {
- Disposable.Create(() =>
- {
- _observer1.Values.Clear();
- _observer2.Values.Clear();
- _observer3.Values.Clear();
- _observer4.Values.Clear();
- _observer5.Values.Clear();
- _observer6.Values.Clear();
- })
- };
- }
-
- protected override TResult GetResult()
- {
- return _parent._resultSelector(_observer1.Values.Dequeue(), _observer2.Values.Dequeue(), _observer3.Values.Dequeue(), _observer4.Values.Dequeue(), _observer5.Values.Dequeue(), _observer6.Values.Dequeue());
- }
- }
- }
-
- class Zip<T1, T2, T3, T4, T5, T6, T7, TResult> : Producer<TResult>
- {
- private readonly IObservable<T1> _source1;
- private readonly IObservable<T2> _source2;
- private readonly IObservable<T3> _source3;
- private readonly IObservable<T4> _source4;
- private readonly IObservable<T5> _source5;
- private readonly IObservable<T6> _source6;
- private readonly IObservable<T7> _source7;
- private readonly Func<T1, T2, T3, T4, T5, T6, T7, TResult> _resultSelector;
-
- public Zip(IObservable<T1> source1, IObservable<T2> source2, IObservable<T3> source3, IObservable<T4> source4, IObservable<T5> source5, IObservable<T6> source6, IObservable<T7> source7, Func<T1, T2, T3, T4, T5, T6, T7, TResult> resultSelector)
- {
- _source1 = source1;
- _source2 = source2;
- _source3 = source3;
- _source4 = source4;
- _source5 = source5;
- _source6 = source6;
- _source7 = source7;
- _resultSelector = resultSelector;
- }
-
- protected override IDisposable Run(IObserver<TResult> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(this, observer, cancel);
- setSink(sink);
- return sink.Run();
- }
-
- class _ : ZipSink<TResult>
- {
- private readonly Zip<T1, T2, T3, T4, T5, T6, T7, TResult> _parent;
-
- public _(Zip<T1, T2, T3, T4, T5, T6, T7, TResult> parent, IObserver<TResult> observer, IDisposable cancel)
- : base(7, observer, cancel)
- {
- _parent = parent;
- }
-
- private ZipObserver<T1> _observer1;
- private ZipObserver<T2> _observer2;
- private ZipObserver<T3> _observer3;
- private ZipObserver<T4> _observer4;
- private ZipObserver<T5> _observer5;
- private ZipObserver<T6> _observer6;
- private ZipObserver<T7> _observer7;
-
- public IDisposable Run()
- {
- var subscriptions = new SingleAssignmentDisposable[7];
- for (int i = 0; i < 7; i++)
- subscriptions[i] = new SingleAssignmentDisposable();
-
- _observer1 = new ZipObserver<T1>(_gate, this, 0, subscriptions[0]);
- _observer2 = new ZipObserver<T2>(_gate, this, 1, subscriptions[1]);
- _observer3 = new ZipObserver<T3>(_gate, this, 2, subscriptions[2]);
- _observer4 = new ZipObserver<T4>(_gate, this, 3, subscriptions[3]);
- _observer5 = new ZipObserver<T5>(_gate, this, 4, subscriptions[4]);
- _observer6 = new ZipObserver<T6>(_gate, this, 5, subscriptions[5]);
- _observer7 = new ZipObserver<T7>(_gate, this, 6, subscriptions[6]);
-
- base.Queues[0] = _observer1.Values;
- base.Queues[1] = _observer2.Values;
- base.Queues[2] = _observer3.Values;
- base.Queues[3] = _observer4.Values;
- base.Queues[4] = _observer5.Values;
- base.Queues[5] = _observer6.Values;
- base.Queues[6] = _observer7.Values;
-
- subscriptions[0].Disposable = _parent._source1.SubscribeSafe(_observer1);
- subscriptions[1].Disposable = _parent._source2.SubscribeSafe(_observer2);
- subscriptions[2].Disposable = _parent._source3.SubscribeSafe(_observer3);
- subscriptions[3].Disposable = _parent._source4.SubscribeSafe(_observer4);
- subscriptions[4].Disposable = _parent._source5.SubscribeSafe(_observer5);
- subscriptions[5].Disposable = _parent._source6.SubscribeSafe(_observer6);
- subscriptions[6].Disposable = _parent._source7.SubscribeSafe(_observer7);
-
- return new CompositeDisposable(subscriptions)
- {
- Disposable.Create(() =>
- {
- _observer1.Values.Clear();
- _observer2.Values.Clear();
- _observer3.Values.Clear();
- _observer4.Values.Clear();
- _observer5.Values.Clear();
- _observer6.Values.Clear();
- _observer7.Values.Clear();
- })
- };
- }
-
- protected override TResult GetResult()
- {
- return _parent._resultSelector(_observer1.Values.Dequeue(), _observer2.Values.Dequeue(), _observer3.Values.Dequeue(), _observer4.Values.Dequeue(), _observer5.Values.Dequeue(), _observer6.Values.Dequeue(), _observer7.Values.Dequeue());
- }
- }
- }
-
- class Zip<T1, T2, T3, T4, T5, T6, T7, T8, TResult> : Producer<TResult>
- {
- private readonly IObservable<T1> _source1;
- private readonly IObservable<T2> _source2;
- private readonly IObservable<T3> _source3;
- private readonly IObservable<T4> _source4;
- private readonly IObservable<T5> _source5;
- private readonly IObservable<T6> _source6;
- private readonly IObservable<T7> _source7;
- private readonly IObservable<T8> _source8;
- private readonly Func<T1, T2, T3, T4, T5, T6, T7, T8, TResult> _resultSelector;
-
- public Zip(IObservable<T1> source1, IObservable<T2> source2, IObservable<T3> source3, IObservable<T4> source4, IObservable<T5> source5, IObservable<T6> source6, IObservable<T7> source7, IObservable<T8> source8, Func<T1, T2, T3, T4, T5, T6, T7, T8, TResult> resultSelector)
- {
- _source1 = source1;
- _source2 = source2;
- _source3 = source3;
- _source4 = source4;
- _source5 = source5;
- _source6 = source6;
- _source7 = source7;
- _source8 = source8;
- _resultSelector = resultSelector;
- }
-
- protected override IDisposable Run(IObserver<TResult> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(this, observer, cancel);
- setSink(sink);
- return sink.Run();
- }
-
- class _ : ZipSink<TResult>
- {
- private readonly Zip<T1, T2, T3, T4, T5, T6, T7, T8, TResult> _parent;
-
- public _(Zip<T1, T2, T3, T4, T5, T6, T7, T8, TResult> parent, IObserver<TResult> observer, IDisposable cancel)
- : base(8, observer, cancel)
- {
- _parent = parent;
- }
-
- private ZipObserver<T1> _observer1;
- private ZipObserver<T2> _observer2;
- private ZipObserver<T3> _observer3;
- private ZipObserver<T4> _observer4;
- private ZipObserver<T5> _observer5;
- private ZipObserver<T6> _observer6;
- private ZipObserver<T7> _observer7;
- private ZipObserver<T8> _observer8;
-
- public IDisposable Run()
- {
- var subscriptions = new SingleAssignmentDisposable[8];
- for (int i = 0; i < 8; i++)
- subscriptions[i] = new SingleAssignmentDisposable();
-
- _observer1 = new ZipObserver<T1>(_gate, this, 0, subscriptions[0]);
- _observer2 = new ZipObserver<T2>(_gate, this, 1, subscriptions[1]);
- _observer3 = new ZipObserver<T3>(_gate, this, 2, subscriptions[2]);
- _observer4 = new ZipObserver<T4>(_gate, this, 3, subscriptions[3]);
- _observer5 = new ZipObserver<T5>(_gate, this, 4, subscriptions[4]);
- _observer6 = new ZipObserver<T6>(_gate, this, 5, subscriptions[5]);
- _observer7 = new ZipObserver<T7>(_gate, this, 6, subscriptions[6]);
- _observer8 = new ZipObserver<T8>(_gate, this, 7, subscriptions[7]);
-
- base.Queues[0] = _observer1.Values;
- base.Queues[1] = _observer2.Values;
- base.Queues[2] = _observer3.Values;
- base.Queues[3] = _observer4.Values;
- base.Queues[4] = _observer5.Values;
- base.Queues[5] = _observer6.Values;
- base.Queues[6] = _observer7.Values;
- base.Queues[7] = _observer8.Values;
-
- subscriptions[0].Disposable = _parent._source1.SubscribeSafe(_observer1);
- subscriptions[1].Disposable = _parent._source2.SubscribeSafe(_observer2);
- subscriptions[2].Disposable = _parent._source3.SubscribeSafe(_observer3);
- subscriptions[3].Disposable = _parent._source4.SubscribeSafe(_observer4);
- subscriptions[4].Disposable = _parent._source5.SubscribeSafe(_observer5);
- subscriptions[5].Disposable = _parent._source6.SubscribeSafe(_observer6);
- subscriptions[6].Disposable = _parent._source7.SubscribeSafe(_observer7);
- subscriptions[7].Disposable = _parent._source8.SubscribeSafe(_observer8);
-
- return new CompositeDisposable(subscriptions)
- {
- Disposable.Create(() =>
- {
- _observer1.Values.Clear();
- _observer2.Values.Clear();
- _observer3.Values.Clear();
- _observer4.Values.Clear();
- _observer5.Values.Clear();
- _observer6.Values.Clear();
- _observer7.Values.Clear();
- _observer8.Values.Clear();
- })
- };
- }
-
- protected override TResult GetResult()
- {
- return _parent._resultSelector(_observer1.Values.Dequeue(), _observer2.Values.Dequeue(), _observer3.Values.Dequeue(), _observer4.Values.Dequeue(), _observer5.Values.Dequeue(), _observer6.Values.Dequeue(), _observer7.Values.Dequeue(), _observer8.Values.Dequeue());
- }
- }
- }
-
- class Zip<T1, T2, T3, T4, T5, T6, T7, T8, T9, TResult> : Producer<TResult>
- {
- private readonly IObservable<T1> _source1;
- private readonly IObservable<T2> _source2;
- private readonly IObservable<T3> _source3;
- private readonly IObservable<T4> _source4;
- private readonly IObservable<T5> _source5;
- private readonly IObservable<T6> _source6;
- private readonly IObservable<T7> _source7;
- private readonly IObservable<T8> _source8;
- private readonly IObservable<T9> _source9;
- private readonly Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, TResult> _resultSelector;
-
- public Zip(IObservable<T1> source1, IObservable<T2> source2, IObservable<T3> source3, IObservable<T4> source4, IObservable<T5> source5, IObservable<T6> source6, IObservable<T7> source7, IObservable<T8> source8, IObservable<T9> source9, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, TResult> resultSelector)
- {
- _source1 = source1;
- _source2 = source2;
- _source3 = source3;
- _source4 = source4;
- _source5 = source5;
- _source6 = source6;
- _source7 = source7;
- _source8 = source8;
- _source9 = source9;
- _resultSelector = resultSelector;
- }
-
- protected override IDisposable Run(IObserver<TResult> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(this, observer, cancel);
- setSink(sink);
- return sink.Run();
- }
-
- class _ : ZipSink<TResult>
- {
- private readonly Zip<T1, T2, T3, T4, T5, T6, T7, T8, T9, TResult> _parent;
-
- public _(Zip<T1, T2, T3, T4, T5, T6, T7, T8, T9, TResult> parent, IObserver<TResult> observer, IDisposable cancel)
- : base(9, observer, cancel)
- {
- _parent = parent;
- }
-
- private ZipObserver<T1> _observer1;
- private ZipObserver<T2> _observer2;
- private ZipObserver<T3> _observer3;
- private ZipObserver<T4> _observer4;
- private ZipObserver<T5> _observer5;
- private ZipObserver<T6> _observer6;
- private ZipObserver<T7> _observer7;
- private ZipObserver<T8> _observer8;
- private ZipObserver<T9> _observer9;
-
- public IDisposable Run()
- {
- var subscriptions = new SingleAssignmentDisposable[9];
- for (int i = 0; i < 9; i++)
- subscriptions[i] = new SingleAssignmentDisposable();
-
- _observer1 = new ZipObserver<T1>(_gate, this, 0, subscriptions[0]);
- _observer2 = new ZipObserver<T2>(_gate, this, 1, subscriptions[1]);
- _observer3 = new ZipObserver<T3>(_gate, this, 2, subscriptions[2]);
- _observer4 = new ZipObserver<T4>(_gate, this, 3, subscriptions[3]);
- _observer5 = new ZipObserver<T5>(_gate, this, 4, subscriptions[4]);
- _observer6 = new ZipObserver<T6>(_gate, this, 5, subscriptions[5]);
- _observer7 = new ZipObserver<T7>(_gate, this, 6, subscriptions[6]);
- _observer8 = new ZipObserver<T8>(_gate, this, 7, subscriptions[7]);
- _observer9 = new ZipObserver<T9>(_gate, this, 8, subscriptions[8]);
-
- base.Queues[0] = _observer1.Values;
- base.Queues[1] = _observer2.Values;
- base.Queues[2] = _observer3.Values;
- base.Queues[3] = _observer4.Values;
- base.Queues[4] = _observer5.Values;
- base.Queues[5] = _observer6.Values;
- base.Queues[6] = _observer7.Values;
- base.Queues[7] = _observer8.Values;
- base.Queues[8] = _observer9.Values;
-
- subscriptions[0].Disposable = _parent._source1.SubscribeSafe(_observer1);
- subscriptions[1].Disposable = _parent._source2.SubscribeSafe(_observer2);
- subscriptions[2].Disposable = _parent._source3.SubscribeSafe(_observer3);
- subscriptions[3].Disposable = _parent._source4.SubscribeSafe(_observer4);
- subscriptions[4].Disposable = _parent._source5.SubscribeSafe(_observer5);
- subscriptions[5].Disposable = _parent._source6.SubscribeSafe(_observer6);
- subscriptions[6].Disposable = _parent._source7.SubscribeSafe(_observer7);
- subscriptions[7].Disposable = _parent._source8.SubscribeSafe(_observer8);
- subscriptions[8].Disposable = _parent._source9.SubscribeSafe(_observer9);
-
- return new CompositeDisposable(subscriptions)
- {
- Disposable.Create(() =>
- {
- _observer1.Values.Clear();
- _observer2.Values.Clear();
- _observer3.Values.Clear();
- _observer4.Values.Clear();
- _observer5.Values.Clear();
- _observer6.Values.Clear();
- _observer7.Values.Clear();
- _observer8.Values.Clear();
- _observer9.Values.Clear();
- })
- };
- }
-
- protected override TResult GetResult()
- {
- return _parent._resultSelector(_observer1.Values.Dequeue(), _observer2.Values.Dequeue(), _observer3.Values.Dequeue(), _observer4.Values.Dequeue(), _observer5.Values.Dequeue(), _observer6.Values.Dequeue(), _observer7.Values.Dequeue(), _observer8.Values.Dequeue(), _observer9.Values.Dequeue());
- }
- }
- }
-
- class Zip<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, TResult> : Producer<TResult>
- {
- private readonly IObservable<T1> _source1;
- private readonly IObservable<T2> _source2;
- private readonly IObservable<T3> _source3;
- private readonly IObservable<T4> _source4;
- private readonly IObservable<T5> _source5;
- private readonly IObservable<T6> _source6;
- private readonly IObservable<T7> _source7;
- private readonly IObservable<T8> _source8;
- private readonly IObservable<T9> _source9;
- private readonly IObservable<T10> _source10;
- private readonly Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, TResult> _resultSelector;
-
- public Zip(IObservable<T1> source1, IObservable<T2> source2, IObservable<T3> source3, IObservable<T4> source4, IObservable<T5> source5, IObservable<T6> source6, IObservable<T7> source7, IObservable<T8> source8, IObservable<T9> source9, IObservable<T10> source10, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, TResult> resultSelector)
- {
- _source1 = source1;
- _source2 = source2;
- _source3 = source3;
- _source4 = source4;
- _source5 = source5;
- _source6 = source6;
- _source7 = source7;
- _source8 = source8;
- _source9 = source9;
- _source10 = source10;
- _resultSelector = resultSelector;
- }
-
- protected override IDisposable Run(IObserver<TResult> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(this, observer, cancel);
- setSink(sink);
- return sink.Run();
- }
-
- class _ : ZipSink<TResult>
- {
- private readonly Zip<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, TResult> _parent;
-
- public _(Zip<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, TResult> parent, IObserver<TResult> observer, IDisposable cancel)
- : base(10, observer, cancel)
- {
- _parent = parent;
- }
-
- private ZipObserver<T1> _observer1;
- private ZipObserver<T2> _observer2;
- private ZipObserver<T3> _observer3;
- private ZipObserver<T4> _observer4;
- private ZipObserver<T5> _observer5;
- private ZipObserver<T6> _observer6;
- private ZipObserver<T7> _observer7;
- private ZipObserver<T8> _observer8;
- private ZipObserver<T9> _observer9;
- private ZipObserver<T10> _observer10;
-
- public IDisposable Run()
- {
- var subscriptions = new SingleAssignmentDisposable[10];
- for (int i = 0; i < 10; i++)
- subscriptions[i] = new SingleAssignmentDisposable();
-
- _observer1 = new ZipObserver<T1>(_gate, this, 0, subscriptions[0]);
- _observer2 = new ZipObserver<T2>(_gate, this, 1, subscriptions[1]);
- _observer3 = new ZipObserver<T3>(_gate, this, 2, subscriptions[2]);
- _observer4 = new ZipObserver<T4>(_gate, this, 3, subscriptions[3]);
- _observer5 = new ZipObserver<T5>(_gate, this, 4, subscriptions[4]);
- _observer6 = new ZipObserver<T6>(_gate, this, 5, subscriptions[5]);
- _observer7 = new ZipObserver<T7>(_gate, this, 6, subscriptions[6]);
- _observer8 = new ZipObserver<T8>(_gate, this, 7, subscriptions[7]);
- _observer9 = new ZipObserver<T9>(_gate, this, 8, subscriptions[8]);
- _observer10 = new ZipObserver<T10>(_gate, this, 9, subscriptions[9]);
-
- base.Queues[0] = _observer1.Values;
- base.Queues[1] = _observer2.Values;
- base.Queues[2] = _observer3.Values;
- base.Queues[3] = _observer4.Values;
- base.Queues[4] = _observer5.Values;
- base.Queues[5] = _observer6.Values;
- base.Queues[6] = _observer7.Values;
- base.Queues[7] = _observer8.Values;
- base.Queues[8] = _observer9.Values;
- base.Queues[9] = _observer10.Values;
-
- subscriptions[0].Disposable = _parent._source1.SubscribeSafe(_observer1);
- subscriptions[1].Disposable = _parent._source2.SubscribeSafe(_observer2);
- subscriptions[2].Disposable = _parent._source3.SubscribeSafe(_observer3);
- subscriptions[3].Disposable = _parent._source4.SubscribeSafe(_observer4);
- subscriptions[4].Disposable = _parent._source5.SubscribeSafe(_observer5);
- subscriptions[5].Disposable = _parent._source6.SubscribeSafe(_observer6);
- subscriptions[6].Disposable = _parent._source7.SubscribeSafe(_observer7);
- subscriptions[7].Disposable = _parent._source8.SubscribeSafe(_observer8);
- subscriptions[8].Disposable = _parent._source9.SubscribeSafe(_observer9);
- subscriptions[9].Disposable = _parent._source10.SubscribeSafe(_observer10);
-
- return new CompositeDisposable(subscriptions)
- {
- Disposable.Create(() =>
- {
- _observer1.Values.Clear();
- _observer2.Values.Clear();
- _observer3.Values.Clear();
- _observer4.Values.Clear();
- _observer5.Values.Clear();
- _observer6.Values.Clear();
- _observer7.Values.Clear();
- _observer8.Values.Clear();
- _observer9.Values.Clear();
- _observer10.Values.Clear();
- })
- };
- }
-
- protected override TResult GetResult()
- {
- return _parent._resultSelector(_observer1.Values.Dequeue(), _observer2.Values.Dequeue(), _observer3.Values.Dequeue(), _observer4.Values.Dequeue(), _observer5.Values.Dequeue(), _observer6.Values.Dequeue(), _observer7.Values.Dequeue(), _observer8.Values.Dequeue(), _observer9.Values.Dequeue(), _observer10.Values.Dequeue());
- }
- }
- }
-
- class Zip<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, TResult> : Producer<TResult>
- {
- private readonly IObservable<T1> _source1;
- private readonly IObservable<T2> _source2;
- private readonly IObservable<T3> _source3;
- private readonly IObservable<T4> _source4;
- private readonly IObservable<T5> _source5;
- private readonly IObservable<T6> _source6;
- private readonly IObservable<T7> _source7;
- private readonly IObservable<T8> _source8;
- private readonly IObservable<T9> _source9;
- private readonly IObservable<T10> _source10;
- private readonly IObservable<T11> _source11;
- private readonly Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, TResult> _resultSelector;
-
- public Zip(IObservable<T1> source1, IObservable<T2> source2, IObservable<T3> source3, IObservable<T4> source4, IObservable<T5> source5, IObservable<T6> source6, IObservable<T7> source7, IObservable<T8> source8, IObservable<T9> source9, IObservable<T10> source10, IObservable<T11> source11, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, TResult> resultSelector)
- {
- _source1 = source1;
- _source2 = source2;
- _source3 = source3;
- _source4 = source4;
- _source5 = source5;
- _source6 = source6;
- _source7 = source7;
- _source8 = source8;
- _source9 = source9;
- _source10 = source10;
- _source11 = source11;
- _resultSelector = resultSelector;
- }
-
- protected override IDisposable Run(IObserver<TResult> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(this, observer, cancel);
- setSink(sink);
- return sink.Run();
- }
-
- class _ : ZipSink<TResult>
- {
- private readonly Zip<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, TResult> _parent;
-
- public _(Zip<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, TResult> parent, IObserver<TResult> observer, IDisposable cancel)
- : base(11, observer, cancel)
- {
- _parent = parent;
- }
-
- private ZipObserver<T1> _observer1;
- private ZipObserver<T2> _observer2;
- private ZipObserver<T3> _observer3;
- private ZipObserver<T4> _observer4;
- private ZipObserver<T5> _observer5;
- private ZipObserver<T6> _observer6;
- private ZipObserver<T7> _observer7;
- private ZipObserver<T8> _observer8;
- private ZipObserver<T9> _observer9;
- private ZipObserver<T10> _observer10;
- private ZipObserver<T11> _observer11;
-
- public IDisposable Run()
- {
- var subscriptions = new SingleAssignmentDisposable[11];
- for (int i = 0; i < 11; i++)
- subscriptions[i] = new SingleAssignmentDisposable();
-
- _observer1 = new ZipObserver<T1>(_gate, this, 0, subscriptions[0]);
- _observer2 = new ZipObserver<T2>(_gate, this, 1, subscriptions[1]);
- _observer3 = new ZipObserver<T3>(_gate, this, 2, subscriptions[2]);
- _observer4 = new ZipObserver<T4>(_gate, this, 3, subscriptions[3]);
- _observer5 = new ZipObserver<T5>(_gate, this, 4, subscriptions[4]);
- _observer6 = new ZipObserver<T6>(_gate, this, 5, subscriptions[5]);
- _observer7 = new ZipObserver<T7>(_gate, this, 6, subscriptions[6]);
- _observer8 = new ZipObserver<T8>(_gate, this, 7, subscriptions[7]);
- _observer9 = new ZipObserver<T9>(_gate, this, 8, subscriptions[8]);
- _observer10 = new ZipObserver<T10>(_gate, this, 9, subscriptions[9]);
- _observer11 = new ZipObserver<T11>(_gate, this, 10, subscriptions[10]);
-
- base.Queues[0] = _observer1.Values;
- base.Queues[1] = _observer2.Values;
- base.Queues[2] = _observer3.Values;
- base.Queues[3] = _observer4.Values;
- base.Queues[4] = _observer5.Values;
- base.Queues[5] = _observer6.Values;
- base.Queues[6] = _observer7.Values;
- base.Queues[7] = _observer8.Values;
- base.Queues[8] = _observer9.Values;
- base.Queues[9] = _observer10.Values;
- base.Queues[10] = _observer11.Values;
-
- subscriptions[0].Disposable = _parent._source1.SubscribeSafe(_observer1);
- subscriptions[1].Disposable = _parent._source2.SubscribeSafe(_observer2);
- subscriptions[2].Disposable = _parent._source3.SubscribeSafe(_observer3);
- subscriptions[3].Disposable = _parent._source4.SubscribeSafe(_observer4);
- subscriptions[4].Disposable = _parent._source5.SubscribeSafe(_observer5);
- subscriptions[5].Disposable = _parent._source6.SubscribeSafe(_observer6);
- subscriptions[6].Disposable = _parent._source7.SubscribeSafe(_observer7);
- subscriptions[7].Disposable = _parent._source8.SubscribeSafe(_observer8);
- subscriptions[8].Disposable = _parent._source9.SubscribeSafe(_observer9);
- subscriptions[9].Disposable = _parent._source10.SubscribeSafe(_observer10);
- subscriptions[10].Disposable = _parent._source11.SubscribeSafe(_observer11);
-
- return new CompositeDisposable(subscriptions)
- {
- Disposable.Create(() =>
- {
- _observer1.Values.Clear();
- _observer2.Values.Clear();
- _observer3.Values.Clear();
- _observer4.Values.Clear();
- _observer5.Values.Clear();
- _observer6.Values.Clear();
- _observer7.Values.Clear();
- _observer8.Values.Clear();
- _observer9.Values.Clear();
- _observer10.Values.Clear();
- _observer11.Values.Clear();
- })
- };
- }
-
- protected override TResult GetResult()
- {
- return _parent._resultSelector(_observer1.Values.Dequeue(), _observer2.Values.Dequeue(), _observer3.Values.Dequeue(), _observer4.Values.Dequeue(), _observer5.Values.Dequeue(), _observer6.Values.Dequeue(), _observer7.Values.Dequeue(), _observer8.Values.Dequeue(), _observer9.Values.Dequeue(), _observer10.Values.Dequeue(), _observer11.Values.Dequeue());
- }
- }
- }
-
- class Zip<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, TResult> : Producer<TResult>
- {
- private readonly IObservable<T1> _source1;
- private readonly IObservable<T2> _source2;
- private readonly IObservable<T3> _source3;
- private readonly IObservable<T4> _source4;
- private readonly IObservable<T5> _source5;
- private readonly IObservable<T6> _source6;
- private readonly IObservable<T7> _source7;
- private readonly IObservable<T8> _source8;
- private readonly IObservable<T9> _source9;
- private readonly IObservable<T10> _source10;
- private readonly IObservable<T11> _source11;
- private readonly IObservable<T12> _source12;
- private readonly Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, TResult> _resultSelector;
-
- public Zip(IObservable<T1> source1, IObservable<T2> source2, IObservable<T3> source3, IObservable<T4> source4, IObservable<T5> source5, IObservable<T6> source6, IObservable<T7> source7, IObservable<T8> source8, IObservable<T9> source9, IObservable<T10> source10, IObservable<T11> source11, IObservable<T12> source12, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, TResult> resultSelector)
- {
- _source1 = source1;
- _source2 = source2;
- _source3 = source3;
- _source4 = source4;
- _source5 = source5;
- _source6 = source6;
- _source7 = source7;
- _source8 = source8;
- _source9 = source9;
- _source10 = source10;
- _source11 = source11;
- _source12 = source12;
- _resultSelector = resultSelector;
- }
-
- protected override IDisposable Run(IObserver<TResult> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(this, observer, cancel);
- setSink(sink);
- return sink.Run();
- }
-
- class _ : ZipSink<TResult>
- {
- private readonly Zip<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, TResult> _parent;
-
- public _(Zip<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, TResult> parent, IObserver<TResult> observer, IDisposable cancel)
- : base(12, observer, cancel)
- {
- _parent = parent;
- }
-
- private ZipObserver<T1> _observer1;
- private ZipObserver<T2> _observer2;
- private ZipObserver<T3> _observer3;
- private ZipObserver<T4> _observer4;
- private ZipObserver<T5> _observer5;
- private ZipObserver<T6> _observer6;
- private ZipObserver<T7> _observer7;
- private ZipObserver<T8> _observer8;
- private ZipObserver<T9> _observer9;
- private ZipObserver<T10> _observer10;
- private ZipObserver<T11> _observer11;
- private ZipObserver<T12> _observer12;
-
- public IDisposable Run()
- {
- var subscriptions = new SingleAssignmentDisposable[12];
- for (int i = 0; i < 12; i++)
- subscriptions[i] = new SingleAssignmentDisposable();
-
- _observer1 = new ZipObserver<T1>(_gate, this, 0, subscriptions[0]);
- _observer2 = new ZipObserver<T2>(_gate, this, 1, subscriptions[1]);
- _observer3 = new ZipObserver<T3>(_gate, this, 2, subscriptions[2]);
- _observer4 = new ZipObserver<T4>(_gate, this, 3, subscriptions[3]);
- _observer5 = new ZipObserver<T5>(_gate, this, 4, subscriptions[4]);
- _observer6 = new ZipObserver<T6>(_gate, this, 5, subscriptions[5]);
- _observer7 = new ZipObserver<T7>(_gate, this, 6, subscriptions[6]);
- _observer8 = new ZipObserver<T8>(_gate, this, 7, subscriptions[7]);
- _observer9 = new ZipObserver<T9>(_gate, this, 8, subscriptions[8]);
- _observer10 = new ZipObserver<T10>(_gate, this, 9, subscriptions[9]);
- _observer11 = new ZipObserver<T11>(_gate, this, 10, subscriptions[10]);
- _observer12 = new ZipObserver<T12>(_gate, this, 11, subscriptions[11]);
-
- base.Queues[0] = _observer1.Values;
- base.Queues[1] = _observer2.Values;
- base.Queues[2] = _observer3.Values;
- base.Queues[3] = _observer4.Values;
- base.Queues[4] = _observer5.Values;
- base.Queues[5] = _observer6.Values;
- base.Queues[6] = _observer7.Values;
- base.Queues[7] = _observer8.Values;
- base.Queues[8] = _observer9.Values;
- base.Queues[9] = _observer10.Values;
- base.Queues[10] = _observer11.Values;
- base.Queues[11] = _observer12.Values;
-
- subscriptions[0].Disposable = _parent._source1.SubscribeSafe(_observer1);
- subscriptions[1].Disposable = _parent._source2.SubscribeSafe(_observer2);
- subscriptions[2].Disposable = _parent._source3.SubscribeSafe(_observer3);
- subscriptions[3].Disposable = _parent._source4.SubscribeSafe(_observer4);
- subscriptions[4].Disposable = _parent._source5.SubscribeSafe(_observer5);
- subscriptions[5].Disposable = _parent._source6.SubscribeSafe(_observer6);
- subscriptions[6].Disposable = _parent._source7.SubscribeSafe(_observer7);
- subscriptions[7].Disposable = _parent._source8.SubscribeSafe(_observer8);
- subscriptions[8].Disposable = _parent._source9.SubscribeSafe(_observer9);
- subscriptions[9].Disposable = _parent._source10.SubscribeSafe(_observer10);
- subscriptions[10].Disposable = _parent._source11.SubscribeSafe(_observer11);
- subscriptions[11].Disposable = _parent._source12.SubscribeSafe(_observer12);
-
- return new CompositeDisposable(subscriptions)
- {
- Disposable.Create(() =>
- {
- _observer1.Values.Clear();
- _observer2.Values.Clear();
- _observer3.Values.Clear();
- _observer4.Values.Clear();
- _observer5.Values.Clear();
- _observer6.Values.Clear();
- _observer7.Values.Clear();
- _observer8.Values.Clear();
- _observer9.Values.Clear();
- _observer10.Values.Clear();
- _observer11.Values.Clear();
- _observer12.Values.Clear();
- })
- };
- }
-
- protected override TResult GetResult()
- {
- return _parent._resultSelector(_observer1.Values.Dequeue(), _observer2.Values.Dequeue(), _observer3.Values.Dequeue(), _observer4.Values.Dequeue(), _observer5.Values.Dequeue(), _observer6.Values.Dequeue(), _observer7.Values.Dequeue(), _observer8.Values.Dequeue(), _observer9.Values.Dequeue(), _observer10.Values.Dequeue(), _observer11.Values.Dequeue(), _observer12.Values.Dequeue());
- }
- }
- }
-
- class Zip<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, TResult> : Producer<TResult>
- {
- private readonly IObservable<T1> _source1;
- private readonly IObservable<T2> _source2;
- private readonly IObservable<T3> _source3;
- private readonly IObservable<T4> _source4;
- private readonly IObservable<T5> _source5;
- private readonly IObservable<T6> _source6;
- private readonly IObservable<T7> _source7;
- private readonly IObservable<T8> _source8;
- private readonly IObservable<T9> _source9;
- private readonly IObservable<T10> _source10;
- private readonly IObservable<T11> _source11;
- private readonly IObservable<T12> _source12;
- private readonly IObservable<T13> _source13;
- private readonly Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, TResult> _resultSelector;
-
- public Zip(IObservable<T1> source1, IObservable<T2> source2, IObservable<T3> source3, IObservable<T4> source4, IObservable<T5> source5, IObservable<T6> source6, IObservable<T7> source7, IObservable<T8> source8, IObservable<T9> source9, IObservable<T10> source10, IObservable<T11> source11, IObservable<T12> source12, IObservable<T13> source13, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, TResult> resultSelector)
- {
- _source1 = source1;
- _source2 = source2;
- _source3 = source3;
- _source4 = source4;
- _source5 = source5;
- _source6 = source6;
- _source7 = source7;
- _source8 = source8;
- _source9 = source9;
- _source10 = source10;
- _source11 = source11;
- _source12 = source12;
- _source13 = source13;
- _resultSelector = resultSelector;
- }
-
- protected override IDisposable Run(IObserver<TResult> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(this, observer, cancel);
- setSink(sink);
- return sink.Run();
- }
-
- class _ : ZipSink<TResult>
- {
- private readonly Zip<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, TResult> _parent;
-
- public _(Zip<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, TResult> parent, IObserver<TResult> observer, IDisposable cancel)
- : base(13, observer, cancel)
- {
- _parent = parent;
- }
-
- private ZipObserver<T1> _observer1;
- private ZipObserver<T2> _observer2;
- private ZipObserver<T3> _observer3;
- private ZipObserver<T4> _observer4;
- private ZipObserver<T5> _observer5;
- private ZipObserver<T6> _observer6;
- private ZipObserver<T7> _observer7;
- private ZipObserver<T8> _observer8;
- private ZipObserver<T9> _observer9;
- private ZipObserver<T10> _observer10;
- private ZipObserver<T11> _observer11;
- private ZipObserver<T12> _observer12;
- private ZipObserver<T13> _observer13;
-
- public IDisposable Run()
- {
- var subscriptions = new SingleAssignmentDisposable[13];
- for (int i = 0; i < 13; i++)
- subscriptions[i] = new SingleAssignmentDisposable();
-
- _observer1 = new ZipObserver<T1>(_gate, this, 0, subscriptions[0]);
- _observer2 = new ZipObserver<T2>(_gate, this, 1, subscriptions[1]);
- _observer3 = new ZipObserver<T3>(_gate, this, 2, subscriptions[2]);
- _observer4 = new ZipObserver<T4>(_gate, this, 3, subscriptions[3]);
- _observer5 = new ZipObserver<T5>(_gate, this, 4, subscriptions[4]);
- _observer6 = new ZipObserver<T6>(_gate, this, 5, subscriptions[5]);
- _observer7 = new ZipObserver<T7>(_gate, this, 6, subscriptions[6]);
- _observer8 = new ZipObserver<T8>(_gate, this, 7, subscriptions[7]);
- _observer9 = new ZipObserver<T9>(_gate, this, 8, subscriptions[8]);
- _observer10 = new ZipObserver<T10>(_gate, this, 9, subscriptions[9]);
- _observer11 = new ZipObserver<T11>(_gate, this, 10, subscriptions[10]);
- _observer12 = new ZipObserver<T12>(_gate, this, 11, subscriptions[11]);
- _observer13 = new ZipObserver<T13>(_gate, this, 12, subscriptions[12]);
-
- base.Queues[0] = _observer1.Values;
- base.Queues[1] = _observer2.Values;
- base.Queues[2] = _observer3.Values;
- base.Queues[3] = _observer4.Values;
- base.Queues[4] = _observer5.Values;
- base.Queues[5] = _observer6.Values;
- base.Queues[6] = _observer7.Values;
- base.Queues[7] = _observer8.Values;
- base.Queues[8] = _observer9.Values;
- base.Queues[9] = _observer10.Values;
- base.Queues[10] = _observer11.Values;
- base.Queues[11] = _observer12.Values;
- base.Queues[12] = _observer13.Values;
-
- subscriptions[0].Disposable = _parent._source1.SubscribeSafe(_observer1);
- subscriptions[1].Disposable = _parent._source2.SubscribeSafe(_observer2);
- subscriptions[2].Disposable = _parent._source3.SubscribeSafe(_observer3);
- subscriptions[3].Disposable = _parent._source4.SubscribeSafe(_observer4);
- subscriptions[4].Disposable = _parent._source5.SubscribeSafe(_observer5);
- subscriptions[5].Disposable = _parent._source6.SubscribeSafe(_observer6);
- subscriptions[6].Disposable = _parent._source7.SubscribeSafe(_observer7);
- subscriptions[7].Disposable = _parent._source8.SubscribeSafe(_observer8);
- subscriptions[8].Disposable = _parent._source9.SubscribeSafe(_observer9);
- subscriptions[9].Disposable = _parent._source10.SubscribeSafe(_observer10);
- subscriptions[10].Disposable = _parent._source11.SubscribeSafe(_observer11);
- subscriptions[11].Disposable = _parent._source12.SubscribeSafe(_observer12);
- subscriptions[12].Disposable = _parent._source13.SubscribeSafe(_observer13);
-
- return new CompositeDisposable(subscriptions)
- {
- Disposable.Create(() =>
- {
- _observer1.Values.Clear();
- _observer2.Values.Clear();
- _observer3.Values.Clear();
- _observer4.Values.Clear();
- _observer5.Values.Clear();
- _observer6.Values.Clear();
- _observer7.Values.Clear();
- _observer8.Values.Clear();
- _observer9.Values.Clear();
- _observer10.Values.Clear();
- _observer11.Values.Clear();
- _observer12.Values.Clear();
- _observer13.Values.Clear();
- })
- };
- }
-
- protected override TResult GetResult()
- {
- return _parent._resultSelector(_observer1.Values.Dequeue(), _observer2.Values.Dequeue(), _observer3.Values.Dequeue(), _observer4.Values.Dequeue(), _observer5.Values.Dequeue(), _observer6.Values.Dequeue(), _observer7.Values.Dequeue(), _observer8.Values.Dequeue(), _observer9.Values.Dequeue(), _observer10.Values.Dequeue(), _observer11.Values.Dequeue(), _observer12.Values.Dequeue(), _observer13.Values.Dequeue());
- }
- }
- }
-
- class Zip<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, TResult> : Producer<TResult>
- {
- private readonly IObservable<T1> _source1;
- private readonly IObservable<T2> _source2;
- private readonly IObservable<T3> _source3;
- private readonly IObservable<T4> _source4;
- private readonly IObservable<T5> _source5;
- private readonly IObservable<T6> _source6;
- private readonly IObservable<T7> _source7;
- private readonly IObservable<T8> _source8;
- private readonly IObservable<T9> _source9;
- private readonly IObservable<T10> _source10;
- private readonly IObservable<T11> _source11;
- private readonly IObservable<T12> _source12;
- private readonly IObservable<T13> _source13;
- private readonly IObservable<T14> _source14;
- private readonly Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, TResult> _resultSelector;
-
- public Zip(IObservable<T1> source1, IObservable<T2> source2, IObservable<T3> source3, IObservable<T4> source4, IObservable<T5> source5, IObservable<T6> source6, IObservable<T7> source7, IObservable<T8> source8, IObservable<T9> source9, IObservable<T10> source10, IObservable<T11> source11, IObservable<T12> source12, IObservable<T13> source13, IObservable<T14> source14, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, TResult> resultSelector)
- {
- _source1 = source1;
- _source2 = source2;
- _source3 = source3;
- _source4 = source4;
- _source5 = source5;
- _source6 = source6;
- _source7 = source7;
- _source8 = source8;
- _source9 = source9;
- _source10 = source10;
- _source11 = source11;
- _source12 = source12;
- _source13 = source13;
- _source14 = source14;
- _resultSelector = resultSelector;
- }
-
- protected override IDisposable Run(IObserver<TResult> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(this, observer, cancel);
- setSink(sink);
- return sink.Run();
- }
-
- class _ : ZipSink<TResult>
- {
- private readonly Zip<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, TResult> _parent;
-
- public _(Zip<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, TResult> parent, IObserver<TResult> observer, IDisposable cancel)
- : base(14, observer, cancel)
- {
- _parent = parent;
- }
-
- private ZipObserver<T1> _observer1;
- private ZipObserver<T2> _observer2;
- private ZipObserver<T3> _observer3;
- private ZipObserver<T4> _observer4;
- private ZipObserver<T5> _observer5;
- private ZipObserver<T6> _observer6;
- private ZipObserver<T7> _observer7;
- private ZipObserver<T8> _observer8;
- private ZipObserver<T9> _observer9;
- private ZipObserver<T10> _observer10;
- private ZipObserver<T11> _observer11;
- private ZipObserver<T12> _observer12;
- private ZipObserver<T13> _observer13;
- private ZipObserver<T14> _observer14;
-
- public IDisposable Run()
- {
- var subscriptions = new SingleAssignmentDisposable[14];
- for (int i = 0; i < 14; i++)
- subscriptions[i] = new SingleAssignmentDisposable();
-
- _observer1 = new ZipObserver<T1>(_gate, this, 0, subscriptions[0]);
- _observer2 = new ZipObserver<T2>(_gate, this, 1, subscriptions[1]);
- _observer3 = new ZipObserver<T3>(_gate, this, 2, subscriptions[2]);
- _observer4 = new ZipObserver<T4>(_gate, this, 3, subscriptions[3]);
- _observer5 = new ZipObserver<T5>(_gate, this, 4, subscriptions[4]);
- _observer6 = new ZipObserver<T6>(_gate, this, 5, subscriptions[5]);
- _observer7 = new ZipObserver<T7>(_gate, this, 6, subscriptions[6]);
- _observer8 = new ZipObserver<T8>(_gate, this, 7, subscriptions[7]);
- _observer9 = new ZipObserver<T9>(_gate, this, 8, subscriptions[8]);
- _observer10 = new ZipObserver<T10>(_gate, this, 9, subscriptions[9]);
- _observer11 = new ZipObserver<T11>(_gate, this, 10, subscriptions[10]);
- _observer12 = new ZipObserver<T12>(_gate, this, 11, subscriptions[11]);
- _observer13 = new ZipObserver<T13>(_gate, this, 12, subscriptions[12]);
- _observer14 = new ZipObserver<T14>(_gate, this, 13, subscriptions[13]);
-
- base.Queues[0] = _observer1.Values;
- base.Queues[1] = _observer2.Values;
- base.Queues[2] = _observer3.Values;
- base.Queues[3] = _observer4.Values;
- base.Queues[4] = _observer5.Values;
- base.Queues[5] = _observer6.Values;
- base.Queues[6] = _observer7.Values;
- base.Queues[7] = _observer8.Values;
- base.Queues[8] = _observer9.Values;
- base.Queues[9] = _observer10.Values;
- base.Queues[10] = _observer11.Values;
- base.Queues[11] = _observer12.Values;
- base.Queues[12] = _observer13.Values;
- base.Queues[13] = _observer14.Values;
-
- subscriptions[0].Disposable = _parent._source1.SubscribeSafe(_observer1);
- subscriptions[1].Disposable = _parent._source2.SubscribeSafe(_observer2);
- subscriptions[2].Disposable = _parent._source3.SubscribeSafe(_observer3);
- subscriptions[3].Disposable = _parent._source4.SubscribeSafe(_observer4);
- subscriptions[4].Disposable = _parent._source5.SubscribeSafe(_observer5);
- subscriptions[5].Disposable = _parent._source6.SubscribeSafe(_observer6);
- subscriptions[6].Disposable = _parent._source7.SubscribeSafe(_observer7);
- subscriptions[7].Disposable = _parent._source8.SubscribeSafe(_observer8);
- subscriptions[8].Disposable = _parent._source9.SubscribeSafe(_observer9);
- subscriptions[9].Disposable = _parent._source10.SubscribeSafe(_observer10);
- subscriptions[10].Disposable = _parent._source11.SubscribeSafe(_observer11);
- subscriptions[11].Disposable = _parent._source12.SubscribeSafe(_observer12);
- subscriptions[12].Disposable = _parent._source13.SubscribeSafe(_observer13);
- subscriptions[13].Disposable = _parent._source14.SubscribeSafe(_observer14);
-
- return new CompositeDisposable(subscriptions)
- {
- Disposable.Create(() =>
- {
- _observer1.Values.Clear();
- _observer2.Values.Clear();
- _observer3.Values.Clear();
- _observer4.Values.Clear();
- _observer5.Values.Clear();
- _observer6.Values.Clear();
- _observer7.Values.Clear();
- _observer8.Values.Clear();
- _observer9.Values.Clear();
- _observer10.Values.Clear();
- _observer11.Values.Clear();
- _observer12.Values.Clear();
- _observer13.Values.Clear();
- _observer14.Values.Clear();
- })
- };
- }
-
- protected override TResult GetResult()
- {
- return _parent._resultSelector(_observer1.Values.Dequeue(), _observer2.Values.Dequeue(), _observer3.Values.Dequeue(), _observer4.Values.Dequeue(), _observer5.Values.Dequeue(), _observer6.Values.Dequeue(), _observer7.Values.Dequeue(), _observer8.Values.Dequeue(), _observer9.Values.Dequeue(), _observer10.Values.Dequeue(), _observer11.Values.Dequeue(), _observer12.Values.Dequeue(), _observer13.Values.Dequeue(), _observer14.Values.Dequeue());
- }
- }
- }
-
- class Zip<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, TResult> : Producer<TResult>
- {
- private readonly IObservable<T1> _source1;
- private readonly IObservable<T2> _source2;
- private readonly IObservable<T3> _source3;
- private readonly IObservable<T4> _source4;
- private readonly IObservable<T5> _source5;
- private readonly IObservable<T6> _source6;
- private readonly IObservable<T7> _source7;
- private readonly IObservable<T8> _source8;
- private readonly IObservable<T9> _source9;
- private readonly IObservable<T10> _source10;
- private readonly IObservable<T11> _source11;
- private readonly IObservable<T12> _source12;
- private readonly IObservable<T13> _source13;
- private readonly IObservable<T14> _source14;
- private readonly IObservable<T15> _source15;
- private readonly Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, TResult> _resultSelector;
-
- public Zip(IObservable<T1> source1, IObservable<T2> source2, IObservable<T3> source3, IObservable<T4> source4, IObservable<T5> source5, IObservable<T6> source6, IObservable<T7> source7, IObservable<T8> source8, IObservable<T9> source9, IObservable<T10> source10, IObservable<T11> source11, IObservable<T12> source12, IObservable<T13> source13, IObservable<T14> source14, IObservable<T15> source15, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, TResult> resultSelector)
- {
- _source1 = source1;
- _source2 = source2;
- _source3 = source3;
- _source4 = source4;
- _source5 = source5;
- _source6 = source6;
- _source7 = source7;
- _source8 = source8;
- _source9 = source9;
- _source10 = source10;
- _source11 = source11;
- _source12 = source12;
- _source13 = source13;
- _source14 = source14;
- _source15 = source15;
- _resultSelector = resultSelector;
- }
-
- protected override IDisposable Run(IObserver<TResult> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(this, observer, cancel);
- setSink(sink);
- return sink.Run();
- }
-
- class _ : ZipSink<TResult>
- {
- private readonly Zip<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, TResult> _parent;
-
- public _(Zip<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, TResult> parent, IObserver<TResult> observer, IDisposable cancel)
- : base(15, observer, cancel)
- {
- _parent = parent;
- }
-
- private ZipObserver<T1> _observer1;
- private ZipObserver<T2> _observer2;
- private ZipObserver<T3> _observer3;
- private ZipObserver<T4> _observer4;
- private ZipObserver<T5> _observer5;
- private ZipObserver<T6> _observer6;
- private ZipObserver<T7> _observer7;
- private ZipObserver<T8> _observer8;
- private ZipObserver<T9> _observer9;
- private ZipObserver<T10> _observer10;
- private ZipObserver<T11> _observer11;
- private ZipObserver<T12> _observer12;
- private ZipObserver<T13> _observer13;
- private ZipObserver<T14> _observer14;
- private ZipObserver<T15> _observer15;
-
- public IDisposable Run()
- {
- var subscriptions = new SingleAssignmentDisposable[15];
- for (int i = 0; i < 15; i++)
- subscriptions[i] = new SingleAssignmentDisposable();
-
- _observer1 = new ZipObserver<T1>(_gate, this, 0, subscriptions[0]);
- _observer2 = new ZipObserver<T2>(_gate, this, 1, subscriptions[1]);
- _observer3 = new ZipObserver<T3>(_gate, this, 2, subscriptions[2]);
- _observer4 = new ZipObserver<T4>(_gate, this, 3, subscriptions[3]);
- _observer5 = new ZipObserver<T5>(_gate, this, 4, subscriptions[4]);
- _observer6 = new ZipObserver<T6>(_gate, this, 5, subscriptions[5]);
- _observer7 = new ZipObserver<T7>(_gate, this, 6, subscriptions[6]);
- _observer8 = new ZipObserver<T8>(_gate, this, 7, subscriptions[7]);
- _observer9 = new ZipObserver<T9>(_gate, this, 8, subscriptions[8]);
- _observer10 = new ZipObserver<T10>(_gate, this, 9, subscriptions[9]);
- _observer11 = new ZipObserver<T11>(_gate, this, 10, subscriptions[10]);
- _observer12 = new ZipObserver<T12>(_gate, this, 11, subscriptions[11]);
- _observer13 = new ZipObserver<T13>(_gate, this, 12, subscriptions[12]);
- _observer14 = new ZipObserver<T14>(_gate, this, 13, subscriptions[13]);
- _observer15 = new ZipObserver<T15>(_gate, this, 14, subscriptions[14]);
-
- base.Queues[0] = _observer1.Values;
- base.Queues[1] = _observer2.Values;
- base.Queues[2] = _observer3.Values;
- base.Queues[3] = _observer4.Values;
- base.Queues[4] = _observer5.Values;
- base.Queues[5] = _observer6.Values;
- base.Queues[6] = _observer7.Values;
- base.Queues[7] = _observer8.Values;
- base.Queues[8] = _observer9.Values;
- base.Queues[9] = _observer10.Values;
- base.Queues[10] = _observer11.Values;
- base.Queues[11] = _observer12.Values;
- base.Queues[12] = _observer13.Values;
- base.Queues[13] = _observer14.Values;
- base.Queues[14] = _observer15.Values;
-
- subscriptions[0].Disposable = _parent._source1.SubscribeSafe(_observer1);
- subscriptions[1].Disposable = _parent._source2.SubscribeSafe(_observer2);
- subscriptions[2].Disposable = _parent._source3.SubscribeSafe(_observer3);
- subscriptions[3].Disposable = _parent._source4.SubscribeSafe(_observer4);
- subscriptions[4].Disposable = _parent._source5.SubscribeSafe(_observer5);
- subscriptions[5].Disposable = _parent._source6.SubscribeSafe(_observer6);
- subscriptions[6].Disposable = _parent._source7.SubscribeSafe(_observer7);
- subscriptions[7].Disposable = _parent._source8.SubscribeSafe(_observer8);
- subscriptions[8].Disposable = _parent._source9.SubscribeSafe(_observer9);
- subscriptions[9].Disposable = _parent._source10.SubscribeSafe(_observer10);
- subscriptions[10].Disposable = _parent._source11.SubscribeSafe(_observer11);
- subscriptions[11].Disposable = _parent._source12.SubscribeSafe(_observer12);
- subscriptions[12].Disposable = _parent._source13.SubscribeSafe(_observer13);
- subscriptions[13].Disposable = _parent._source14.SubscribeSafe(_observer14);
- subscriptions[14].Disposable = _parent._source15.SubscribeSafe(_observer15);
-
- return new CompositeDisposable(subscriptions)
- {
- Disposable.Create(() =>
- {
- _observer1.Values.Clear();
- _observer2.Values.Clear();
- _observer3.Values.Clear();
- _observer4.Values.Clear();
- _observer5.Values.Clear();
- _observer6.Values.Clear();
- _observer7.Values.Clear();
- _observer8.Values.Clear();
- _observer9.Values.Clear();
- _observer10.Values.Clear();
- _observer11.Values.Clear();
- _observer12.Values.Clear();
- _observer13.Values.Clear();
- _observer14.Values.Clear();
- _observer15.Values.Clear();
- })
- };
- }
-
- protected override TResult GetResult()
- {
- return _parent._resultSelector(_observer1.Values.Dequeue(), _observer2.Values.Dequeue(), _observer3.Values.Dequeue(), _observer4.Values.Dequeue(), _observer5.Values.Dequeue(), _observer6.Values.Dequeue(), _observer7.Values.Dequeue(), _observer8.Values.Dequeue(), _observer9.Values.Dequeue(), _observer10.Values.Dequeue(), _observer11.Values.Dequeue(), _observer12.Values.Dequeue(), _observer13.Values.Dequeue(), _observer14.Values.Dequeue(), _observer15.Values.Dequeue());
- }
- }
- }
-
- class Zip<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, TResult> : Producer<TResult>
- {
- private readonly IObservable<T1> _source1;
- private readonly IObservable<T2> _source2;
- private readonly IObservable<T3> _source3;
- private readonly IObservable<T4> _source4;
- private readonly IObservable<T5> _source5;
- private readonly IObservable<T6> _source6;
- private readonly IObservable<T7> _source7;
- private readonly IObservable<T8> _source8;
- private readonly IObservable<T9> _source9;
- private readonly IObservable<T10> _source10;
- private readonly IObservable<T11> _source11;
- private readonly IObservable<T12> _source12;
- private readonly IObservable<T13> _source13;
- private readonly IObservable<T14> _source14;
- private readonly IObservable<T15> _source15;
- private readonly IObservable<T16> _source16;
- private readonly Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, TResult> _resultSelector;
-
- public Zip(IObservable<T1> source1, IObservable<T2> source2, IObservable<T3> source3, IObservable<T4> source4, IObservable<T5> source5, IObservable<T6> source6, IObservable<T7> source7, IObservable<T8> source8, IObservable<T9> source9, IObservable<T10> source10, IObservable<T11> source11, IObservable<T12> source12, IObservable<T13> source13, IObservable<T14> source14, IObservable<T15> source15, IObservable<T16> source16, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, TResult> resultSelector)
- {
- _source1 = source1;
- _source2 = source2;
- _source3 = source3;
- _source4 = source4;
- _source5 = source5;
- _source6 = source6;
- _source7 = source7;
- _source8 = source8;
- _source9 = source9;
- _source10 = source10;
- _source11 = source11;
- _source12 = source12;
- _source13 = source13;
- _source14 = source14;
- _source15 = source15;
- _source16 = source16;
- _resultSelector = resultSelector;
- }
-
- protected override IDisposable Run(IObserver<TResult> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(this, observer, cancel);
- setSink(sink);
- return sink.Run();
- }
-
- class _ : ZipSink<TResult>
- {
- private readonly Zip<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, TResult> _parent;
-
- public _(Zip<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, TResult> parent, IObserver<TResult> observer, IDisposable cancel)
- : base(16, observer, cancel)
- {
- _parent = parent;
- }
-
- private ZipObserver<T1> _observer1;
- private ZipObserver<T2> _observer2;
- private ZipObserver<T3> _observer3;
- private ZipObserver<T4> _observer4;
- private ZipObserver<T5> _observer5;
- private ZipObserver<T6> _observer6;
- private ZipObserver<T7> _observer7;
- private ZipObserver<T8> _observer8;
- private ZipObserver<T9> _observer9;
- private ZipObserver<T10> _observer10;
- private ZipObserver<T11> _observer11;
- private ZipObserver<T12> _observer12;
- private ZipObserver<T13> _observer13;
- private ZipObserver<T14> _observer14;
- private ZipObserver<T15> _observer15;
- private ZipObserver<T16> _observer16;
-
- public IDisposable Run()
- {
- var subscriptions = new SingleAssignmentDisposable[16];
- for (int i = 0; i < 16; i++)
- subscriptions[i] = new SingleAssignmentDisposable();
-
- _observer1 = new ZipObserver<T1>(_gate, this, 0, subscriptions[0]);
- _observer2 = new ZipObserver<T2>(_gate, this, 1, subscriptions[1]);
- _observer3 = new ZipObserver<T3>(_gate, this, 2, subscriptions[2]);
- _observer4 = new ZipObserver<T4>(_gate, this, 3, subscriptions[3]);
- _observer5 = new ZipObserver<T5>(_gate, this, 4, subscriptions[4]);
- _observer6 = new ZipObserver<T6>(_gate, this, 5, subscriptions[5]);
- _observer7 = new ZipObserver<T7>(_gate, this, 6, subscriptions[6]);
- _observer8 = new ZipObserver<T8>(_gate, this, 7, subscriptions[7]);
- _observer9 = new ZipObserver<T9>(_gate, this, 8, subscriptions[8]);
- _observer10 = new ZipObserver<T10>(_gate, this, 9, subscriptions[9]);
- _observer11 = new ZipObserver<T11>(_gate, this, 10, subscriptions[10]);
- _observer12 = new ZipObserver<T12>(_gate, this, 11, subscriptions[11]);
- _observer13 = new ZipObserver<T13>(_gate, this, 12, subscriptions[12]);
- _observer14 = new ZipObserver<T14>(_gate, this, 13, subscriptions[13]);
- _observer15 = new ZipObserver<T15>(_gate, this, 14, subscriptions[14]);
- _observer16 = new ZipObserver<T16>(_gate, this, 15, subscriptions[15]);
-
- base.Queues[0] = _observer1.Values;
- base.Queues[1] = _observer2.Values;
- base.Queues[2] = _observer3.Values;
- base.Queues[3] = _observer4.Values;
- base.Queues[4] = _observer5.Values;
- base.Queues[5] = _observer6.Values;
- base.Queues[6] = _observer7.Values;
- base.Queues[7] = _observer8.Values;
- base.Queues[8] = _observer9.Values;
- base.Queues[9] = _observer10.Values;
- base.Queues[10] = _observer11.Values;
- base.Queues[11] = _observer12.Values;
- base.Queues[12] = _observer13.Values;
- base.Queues[13] = _observer14.Values;
- base.Queues[14] = _observer15.Values;
- base.Queues[15] = _observer16.Values;
-
- subscriptions[0].Disposable = _parent._source1.SubscribeSafe(_observer1);
- subscriptions[1].Disposable = _parent._source2.SubscribeSafe(_observer2);
- subscriptions[2].Disposable = _parent._source3.SubscribeSafe(_observer3);
- subscriptions[3].Disposable = _parent._source4.SubscribeSafe(_observer4);
- subscriptions[4].Disposable = _parent._source5.SubscribeSafe(_observer5);
- subscriptions[5].Disposable = _parent._source6.SubscribeSafe(_observer6);
- subscriptions[6].Disposable = _parent._source7.SubscribeSafe(_observer7);
- subscriptions[7].Disposable = _parent._source8.SubscribeSafe(_observer8);
- subscriptions[8].Disposable = _parent._source9.SubscribeSafe(_observer9);
- subscriptions[9].Disposable = _parent._source10.SubscribeSafe(_observer10);
- subscriptions[10].Disposable = _parent._source11.SubscribeSafe(_observer11);
- subscriptions[11].Disposable = _parent._source12.SubscribeSafe(_observer12);
- subscriptions[12].Disposable = _parent._source13.SubscribeSafe(_observer13);
- subscriptions[13].Disposable = _parent._source14.SubscribeSafe(_observer14);
- subscriptions[14].Disposable = _parent._source15.SubscribeSafe(_observer15);
- subscriptions[15].Disposable = _parent._source16.SubscribeSafe(_observer16);
-
- return new CompositeDisposable(subscriptions)
- {
- Disposable.Create(() =>
- {
- _observer1.Values.Clear();
- _observer2.Values.Clear();
- _observer3.Values.Clear();
- _observer4.Values.Clear();
- _observer5.Values.Clear();
- _observer6.Values.Clear();
- _observer7.Values.Clear();
- _observer8.Values.Clear();
- _observer9.Values.Clear();
- _observer10.Values.Clear();
- _observer11.Values.Clear();
- _observer12.Values.Clear();
- _observer13.Values.Clear();
- _observer14.Values.Clear();
- _observer15.Values.Clear();
- _observer16.Values.Clear();
- })
- };
- }
-
- protected override TResult GetResult()
- {
- return _parent._resultSelector(_observer1.Values.Dequeue(), _observer2.Values.Dequeue(), _observer3.Values.Dequeue(), _observer4.Values.Dequeue(), _observer5.Values.Dequeue(), _observer6.Values.Dequeue(), _observer7.Values.Dequeue(), _observer8.Values.Dequeue(), _observer9.Values.Dequeue(), _observer10.Values.Dequeue(), _observer11.Values.Dequeue(), _observer12.Values.Dequeue(), _observer13.Values.Dequeue(), _observer14.Values.Dequeue(), _observer15.Values.Dequeue(), _observer16.Values.Dequeue());
- }
- }
- }
-
-#endif
-
- #endregion
-
- #region Helpers for n-ary overloads
-
- interface IZip
- {
- void Next(int index);
- void Fail(Exception error);
- void Done(int index);
- }
-
- abstract class ZipSink<TResult> : Sink<TResult>, IZip
- {
- protected readonly object _gate;
-
- private readonly ICollection[] _queues;
- private readonly bool[] _isDone;
-
- public ZipSink(int arity, IObserver<TResult> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _gate = new object();
-
- _isDone = new bool[arity];
- _queues = new ICollection[arity];
- }
-
- public ICollection[] Queues
- {
- get { return _queues; }
- }
-
- public void Next(int index)
- {
- var hasValueAll = true;
- foreach (var queue in _queues)
- {
- if (queue.Count == 0)
- {
- hasValueAll = false;
- break;
- }
- }
-
- if (hasValueAll)
- {
- var res = default(TResult);
- try
- {
- res = GetResult();
- }
- catch (Exception ex)
- {
- base._observer.OnError(ex);
- base.Dispose();
- return;
- }
-
- base._observer.OnNext(res);
- }
- else
- {
- var allOthersDone = true;
- for (int i = 0; i < _isDone.Length; i++)
- {
- if (i != index && !_isDone[i])
- {
- allOthersDone = false;
- break;
- }
- }
-
- if (allOthersDone)
- {
- base._observer.OnCompleted();
- base.Dispose();
- }
- }
- }
-
- protected abstract TResult GetResult();
-
- public void Fail(Exception error)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
-
- public void Done(int index)
- {
- _isDone[index] = true;
-
- var allDone = true;
- foreach (var isDone in _isDone)
- {
- if (!isDone)
- {
- allDone = false;
- break;
- }
- }
-
- if (allDone)
- {
- base._observer.OnCompleted();
- base.Dispose();
- return;
- }
- }
- }
-
- class ZipObserver<T> : IObserver<T>
- {
- private readonly object _gate;
- private readonly IZip _parent;
- private readonly int _index;
- private readonly IDisposable _self;
- private readonly Queue<T> _values;
-
- public ZipObserver(object gate, IZip parent, int index, IDisposable self)
- {
- _gate = gate;
- _parent = parent;
- _index = index;
- _self = self;
- _values = new Queue<T>();
- }
-
- public Queue<T> Values
- {
- get { return _values; }
- }
-
- public void OnNext(T value)
- {
- lock (_gate)
- {
- _values.Enqueue(value);
- _parent.Next(_index);
- }
- }
-
- public void OnError(Exception error)
- {
- _self.Dispose();
-
- lock (_gate)
- {
- _parent.Fail(error);
- }
- }
-
- public void OnCompleted()
- {
- _self.Dispose();
-
- lock (_gate)
- {
- _parent.Done(_index);
- }
- }
- }
-
- #endregion
-
- #endregion
-
- #region N-ary
-
- class Zip<TSource> : Producer<IList<TSource>>
- {
- private readonly IEnumerable<IObservable<TSource>> _sources;
-
- public Zip(IEnumerable<IObservable<TSource>> sources)
- {
- _sources = sources;
- }
-
- protected override IDisposable Run(IObserver<IList<TSource>> observer, IDisposable cancel, Action<IDisposable> setSink)
- {
- var sink = new _(this, observer, cancel);
- setSink(sink);
- return sink.Run();
- }
-
- class _ : Sink<IList<TSource>>
- {
- private readonly Zip<TSource> _parent;
-
- public _(Zip<TSource> parent, IObserver<IList<TSource>> observer, IDisposable cancel)
- : base(observer, cancel)
- {
- _parent = parent;
- }
-
- private object _gate;
- private Queue<TSource>[] _queues;
- private bool[] _isDone;
- private IDisposable[] _subscriptions;
-
- public IDisposable Run()
- {
- var srcs = _parent._sources.ToArray();
-
- var N = srcs.Length;
-
- _queues = new Queue<TSource>[N];
- for (int i = 0; i < N; i++)
- _queues[i] = new Queue<TSource>();
-
- _isDone = new bool[N];
-
- _subscriptions = new SingleAssignmentDisposable[N];
-
- _gate = new object();
-
- for (int i = 0; i < N; i++)
- {
- var j = i;
-
- var d = new SingleAssignmentDisposable();
- _subscriptions[j] = d;
-
- var o = new O(this, j);
- d.Disposable = srcs[j].SubscribeSafe(o);
- }
-
- return new CompositeDisposable(_subscriptions) { Disposable.Create(() => { foreach (var q in _queues) q.Clear(); }) };
- }
-
- private void OnNext(int index, TSource value)
- {
- lock (_gate)
- {
- _queues[index].Enqueue(value);
-
- if (_queues.All(q => q.Count > 0))
- {
- var res = _queues.Select(q => q.Dequeue()).ToList();
- base._observer.OnNext(res);
- }
- else if (_isDone.Where((x, i) => i != index).All(Stubs<bool>.I))
- {
- base._observer.OnCompleted();
- base.Dispose();
- return;
- }
- }
- }
-
- private void OnError(Exception error)
- {
- lock (_gate)
- {
- base._observer.OnError(error);
- base.Dispose();
- }
- }
-
- private void OnCompleted(int index)
- {
- lock (_gate)
- {
- _isDone[index] = true;
-
- if (_isDone.All(Stubs<bool>.I))
- {
- base._observer.OnCompleted();
- base.Dispose();
- return;
- }
- else
- {
- _subscriptions[index].Dispose();
- }
- }
- }
-
- class O : IObserver<TSource>
- {
- private readonly _ _parent;
- private readonly int _index;
-
- public O(_ parent, int index)
- {
- _parent = parent;
- _index = index;
- }
-
- public void OnNext(TSource value)
- {
- _parent.OnNext(_index, value);
- }
-
- public void OnError(Exception error)
- {
- _parent.OnError(error);
- }
-
- public void OnCompleted()
- {
- _parent.OnCompleted(_index);
- }
- }
- }
- }
-
- #endregion
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/_.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/_.cs
deleted file mode 100644
index d4b0dbc..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/_.cs
+++ /dev/null
@@ -1,9 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_PERF
-using System;
-
-namespace System.Reactive.Linq.Observαble
-{
-}
-#endif
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/QueryLanguage.Aggregates.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/QueryLanguage.Aggregates.cs
deleted file mode 100644
index 739fc2d..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/QueryLanguage.Aggregates.cs
+++ /dev/null
@@ -1,1662 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System.Collections.Generic;
-using System.Linq;
-using System.Reactive.Disposables;
-
-namespace System.Reactive.Linq
-{
-#if !NO_PERF
- using Observαble;
-#endif
-
- internal partial class QueryLanguage
- {
- #region + Aggregate +
-
- public virtual IObservable<TAccumulate> Aggregate<TSource, TAccumulate>(IObservable<TSource> source, TAccumulate seed, Func<TAccumulate, TSource, TAccumulate> accumulator)
- {
-#if !NO_PERF
- return new Aggregate<TSource, TAccumulate, TAccumulate>(source, seed, accumulator, Stubs<TAccumulate>.I);
-#else
- return source.Scan(seed, accumulator).StartWith(seed).Final();
-#endif
- }
-
- public virtual IObservable<TResult> Aggregate<TSource, TAccumulate, TResult>(IObservable<TSource> source, TAccumulate seed, Func<TAccumulate, TSource, TAccumulate> accumulator, Func<TAccumulate, TResult> resultSelector)
- {
-#if !NO_PERF
- return new Aggregate<TSource, TAccumulate, TResult>(source, seed, accumulator, resultSelector);
-#else
- return Aggregate(source, seed, accumulator).Select(resultSelector);
-#endif
- }
-
- public virtual IObservable<TSource> Aggregate<TSource>(IObservable<TSource> source, Func<TSource, TSource, TSource> accumulator)
- {
-#if !NO_PERF
- return new Aggregate<TSource>(source, accumulator);
-#else
- return source.Scan(accumulator).Final();
-#endif
- }
-
- public virtual IObservable<double> Average<TSource>(IObservable<TSource> source, Func<TSource, double> selector)
- {
- return Average(Select(source, selector));
- }
-
- public virtual IObservable<float> Average<TSource>(IObservable<TSource> source, Func<TSource, float> selector)
- {
- return Average(Select(source, selector));
- }
-
- public virtual IObservable<decimal> Average<TSource>(IObservable<TSource> source, Func<TSource, decimal> selector)
- {
- return Average(Select(source, selector));
- }
-
- public virtual IObservable<double> Average<TSource>(IObservable<TSource> source, Func<TSource, int> selector)
- {
- return Average(Select(source, selector));
- }
-
- public virtual IObservable<double> Average<TSource>(IObservable<TSource> source, Func<TSource, long> selector)
- {
- return Average(Select(source, selector));
- }
-
- public virtual IObservable<double?> Average<TSource>(IObservable<TSource> source, Func<TSource, double?> selector)
- {
- return Average(Select(source, selector));
- }
-
- public virtual IObservable<float?> Average<TSource>(IObservable<TSource> source, Func<TSource, float?> selector)
- {
- return Average(Select(source, selector));
- }
-
- public virtual IObservable<decimal?> Average<TSource>(IObservable<TSource> source, Func<TSource, decimal?> selector)
- {
- return Average(Select(source, selector));
- }
-
- public virtual IObservable<double?> Average<TSource>(IObservable<TSource> source, Func<TSource, int?> selector)
- {
- return Average(Select(source, selector));
- }
-
- public virtual IObservable<double?> Average<TSource>(IObservable<TSource> source, Func<TSource, long?> selector)
- {
- return Average(Select(source, selector));
- }
-
- #endregion
-
- #region + All +
-
- public virtual IObservable<bool> All<TSource>(IObservable<TSource> source, Func<TSource, bool> predicate)
- {
-#if !NO_PERF
- return new All<TSource>(source, predicate);
-#else
- return source.Where(v => !(predicate(v))).Any().Select(b => !b);
-#endif
- }
-
- #endregion
-
- #region + Any +
-
- public virtual IObservable<bool> Any<TSource>(IObservable<TSource> source)
- {
-#if !NO_PERF
- return new Any<TSource>(source);
-#else
- return new AnonymousObservable<bool>(observer => source.Subscribe(
- _ =>
- {
- observer.OnNext(true);
- observer.OnCompleted();
- },
- observer.OnError,
- () =>
- {
- observer.OnNext(false);
- observer.OnCompleted();
- }));
-#endif
- }
-
- public virtual IObservable<bool> Any<TSource>(IObservable<TSource> source, Func<TSource, bool> predicate)
- {
-#if !NO_PERF
- return new Any<TSource>(source, predicate);
-#else
- return source.Where(predicate).Any();
-#endif
- }
-
- #endregion
-
- #region + Average +
-
- public virtual IObservable<double> Average(IObservable<double> source)
- {
-#if !NO_PERF
- return new AverageDouble(source);
-#else
- return source.Scan(new { sum = 0.0, count = 0L },
- (prev, cur) => new { sum = prev.sum + cur, count = checked(prev.count + 1) })
- .Final()
- .Select(s => s.sum / (double)s.count);
-#endif
- }
-
- public virtual IObservable<float> Average(IObservable<float> source)
- {
-#if !NO_PERF
- return new AverageSingle(source);
-#else
- return source.Scan(new { sum = 0F, count = 0L }, // NOTE: Uses a different accumulator type (float), *not* conform LINQ to Objects.
- (prev, cur) => new { sum = prev.sum + cur, count = checked(prev.count + 1) })
- .Final()
- .Select(s => s.sum / (float)s.count);
-#endif
- }
-
- public virtual IObservable<decimal> Average(IObservable<decimal> source)
- {
-#if !NO_PERF
- return new AverageDecimal(source);
-#else
- return source.Scan(new { sum = 0M, count = 0L },
- (prev, cur) => new { sum = prev.sum + cur, count = checked(prev.count + 1) })
- .Final()
- .Select(s => s.sum / (decimal)s.count);
-#endif
- }
-
- public virtual IObservable<double> Average(IObservable<int> source)
- {
-#if !NO_PERF
- return new AverageInt32(source);
-#else
- return source.Scan(new { sum = 0L, count = 0L },
- (prev, cur) => new { sum = checked(prev.sum + cur), count = checked(prev.count + 1) })
- .Final()
- .Select(s => (double)s.sum / (double)s.count);
-#endif
- }
-
- public virtual IObservable<double> Average(IObservable<long> source)
- {
-#if !NO_PERF
- return new AverageInt64(source);
-#else
- return source.Scan(new { sum = 0L, count = 0L },
- (prev, cur) => new { sum = checked(prev.sum + cur), count = checked(prev.count + 1) })
- .Final()
- .Select(s => (double)s.sum / (double)s.count);
-#endif
- }
-
- public virtual IObservable<double?> Average(IObservable<double?> source)
- {
-#if !NO_PERF
- return new AverageDoubleNullable(source);
-#else
- return source.Aggregate(new { sum = new double?(0.0), count = 0L },
- (prev, cur) => cur != null ? new { sum = prev.sum + cur.GetValueOrDefault(), count = checked(prev.count + 1) } : prev)
- .Select(s => s.count == 0 ? default(double?) : (double?)s.sum / (double)s.count);
-#endif
- }
-
- public virtual IObservable<float?> Average(IObservable<float?> source)
- {
-#if !NO_PERF
- return new AverageSingleNullable(source);
-#else
- return source.Aggregate(new { sum = new float?(0f), count = 0L }, // NOTE: Uses a different accumulator type (float), *not* conform LINQ to Objects.
- (prev, cur) => cur != null ? new { sum = prev.sum + cur.GetValueOrDefault(), count = checked(prev.count + 1) } : prev)
- .Select(s => s.count == 0 ? default(float?) : (float?)s.sum / (float)s.count);
-#endif
- }
-
- public virtual IObservable<decimal?> Average(IObservable<decimal?> source)
- {
-#if !NO_PERF
- return new AverageDecimalNullable(source);
-#else
- return source.Aggregate(new { sum = new decimal?(0M), count = 0L },
- (prev, cur) => cur != null ? new { sum = prev.sum + cur.GetValueOrDefault(), count = checked(prev.count + 1) } : prev)
- .Select(s => s.count == 0 ? default(decimal?) : (decimal?)s.sum / (decimal)s.count);
-#endif
- }
-
- public virtual IObservable<double?> Average(IObservable<int?> source)
- {
-#if !NO_PERF
- return new AverageInt32Nullable(source);
-#else
- return source.Aggregate(new { sum = new long?(0), count = 0L },
- (prev, cur) => cur != null ? new { sum = checked(prev.sum + cur.GetValueOrDefault()), count = checked(prev.count + 1) } : prev)
- .Select(s => s.count == 0 ? default(double?) : (double?)s.sum / s.count);
-#endif
- }
-
- public virtual IObservable<double?> Average(IObservable<long?> source)
- {
-#if !NO_PERF
- return new AverageInt64Nullable(source);
-#else
- return source.Aggregate(new { sum = new long?(0), count = 0L },
- (prev, cur) => cur != null ? new { sum = checked(prev.sum + cur.GetValueOrDefault()), count = checked(prev.count + 1) } : prev)
- .Select(s => s.count == 0 ? default(double?): (double?)s.sum / s.count);
-#endif
- }
-
- #endregion
-
- #region + Contains +
-
- public virtual IObservable<bool> Contains<TSource>(IObservable<TSource> source, TSource value)
- {
-#if !NO_PERF
- return new Contains<TSource>(source, value, EqualityComparer<TSource>.Default);
-#else
- return Contains_<TSource>(source, value, EqualityComparer<TSource>.Default);
-#endif
- }
-
- public virtual IObservable<bool> Contains<TSource>(IObservable<TSource> source, TSource value, IEqualityComparer<TSource> comparer)
- {
-#if !NO_PERF
- return new Contains<TSource>(source, value, comparer);
-#else
- return Contains_<TSource>(source, value, comparer);
-#endif
- }
-
-#if NO_PERF
- private static IObservable<bool> Contains_<TSource>(IObservable<TSource> source, TSource value, IEqualityComparer<TSource> comparer)
- {
- return source.Where(v => comparer.Equals(v, value)).Any();
- }
-#endif
-
- #endregion
-
- #region + Count +
-
- public virtual IObservable<int> Count<TSource>(IObservable<TSource> source)
- {
-#if !NO_PERF
- return new Count<TSource>(source);
-#else
- return source.Aggregate(0, (count, _) => checked(count + 1));
-#endif
- }
-
- public virtual IObservable<int> Count<TSource>(IObservable<TSource> source, Func<TSource, bool> predicate)
- {
-#if !NO_PERF
- return new Count<TSource>(source, predicate);
-#else
- return source.Where(predicate).Aggregate(0, (count, _) => checked(count + 1));
-#endif
- }
-
- #endregion
-
- #region + ElementAt +
-
- public virtual IObservable<TSource> ElementAt<TSource>(IObservable<TSource> source, int index)
- {
-#if !NO_PERF
- return new ElementAt<TSource>(source, index, true);
-#else
- return new AnonymousObservable<TSource>(observer =>
- {
- int i = index;
- return source.Subscribe(
- x =>
- {
- if (i == 0)
- {
- observer.OnNext(x);
- observer.OnCompleted();
- }
-
- i--;
- },
- observer.OnError,
- () => observer.OnError(new ArgumentOutOfRangeException("index"))
- );
- });
-#endif
- }
-
- #endregion
-
- #region + ElementAtOrDefault +
-
- public virtual IObservable<TSource> ElementAtOrDefault<TSource>(IObservable<TSource> source, int index)
- {
-#if !NO_PERF
- return new ElementAt<TSource>(source, index, false);
-#else
- return new AnonymousObservable<TSource>(observer =>
- {
- int i = index;
- return source.Subscribe(
- x =>
- {
- if (i == 0)
- {
- observer.OnNext(x);
- observer.OnCompleted();
- }
-
- i--;
- },
- observer.OnError,
- () =>
- {
- observer.OnNext(default(TSource));
- observer.OnCompleted();
- }
- );
- });
-#endif
- }
-
- #endregion
-
- #region + FirstAsync +
-
- public virtual IObservable<TSource> FirstAsync<TSource>(IObservable<TSource> source)
- {
-#if !NO_PERF
- return new FirstAsync<TSource>(source, null, true);
-#else
- return FirstOrDefaultAsync_(source, true);
-#endif
- }
-
- public virtual IObservable<TSource> FirstAsync<TSource>(IObservable<TSource> source, Func<TSource, bool> predicate)
- {
-#if !NO_PERF
- return new FirstAsync<TSource>(source, predicate, true);
-#else
- return source.Where(predicate).FirstAsync();
-#endif
- }
-
- #endregion
-
- #region + FirstAsyncOrDefaultAsync +
-
- public virtual IObservable<TSource> FirstOrDefaultAsync<TSource>(IObservable<TSource> source)
- {
-#if !NO_PERF
- return new FirstAsync<TSource>(source, null, false);
-#else
- return FirstOrDefaultAsync_(source, false);
-#endif
- }
-
- public virtual IObservable<TSource> FirstOrDefaultAsync<TSource>(IObservable<TSource> source, Func<TSource, bool> predicate)
- {
-#if !NO_PERF
- return new FirstAsync<TSource>(source, predicate, false);
-#else
- return source.Where(predicate).FirstOrDefaultAsync();
-#endif
- }
-
-#if NO_PERF
- private static IObservable<TSource> FirstOrDefaultAsync_<TSource>(IObservable<TSource> source, bool throwOnEmpty)
- {
- return new AnonymousObservable<TSource>(observer =>
- {
- return source.Subscribe(
- x =>
- {
- observer.OnNext(x);
- observer.OnCompleted();
- },
- observer.OnError,
- () =>
- {
- if (throwOnEmpty)
- {
- observer.OnError(new InvalidOperationException(Strings_Linq.NO_ELEMENTS));
- }
- else
- {
- observer.OnNext(default(TSource));
- observer.OnCompleted();
- }
- }
- );
- });
- }
-#endif
-
- #endregion
-
- #region + IsEmpty +
-
- public virtual IObservable<bool> IsEmpty<TSource>(IObservable<TSource> source)
- {
-#if !NO_PERF
- return new IsEmpty<TSource>(source);
-#else
- return source.Any().Select(b => !b);
-#endif
- }
-
- #endregion
-
- #region + LastAsync +
-
- public virtual IObservable<TSource> LastAsync<TSource>(IObservable<TSource> source)
- {
-#if !NO_PERF
- return new LastAsync<TSource>(source, null, true);
-#else
- return LastOrDefaultAsync_(source, true);
-#endif
- }
-
- public virtual IObservable<TSource> LastAsync<TSource>(IObservable<TSource> source, Func<TSource, bool> predicate)
- {
-#if !NO_PERF
- return new LastAsync<TSource>(source, predicate, true);
-#else
- return source.Where(predicate).LastAsync();
-#endif
- }
-
- #endregion
-
- #region + LastOrDefaultAsync +
-
- public virtual IObservable<TSource> LastOrDefaultAsync<TSource>(IObservable<TSource> source)
- {
-#if !NO_PERF
- return new LastAsync<TSource>(source, null, false);
-#else
- return LastOrDefaultAsync_(source, false);
-#endif
- }
-
- public virtual IObservable<TSource> LastOrDefaultAsync<TSource>(IObservable<TSource> source, Func<TSource, bool> predicate)
- {
-#if !NO_PERF
- return new LastAsync<TSource>(source, predicate, false);
-#else
- return source.Where(predicate).LastOrDefaultAsync();
-#endif
- }
-
-#if NO_PERF
- private static IObservable<TSource> LastOrDefaultAsync_<TSource>(IObservable<TSource> source, bool throwOnEmpty)
- {
- return new AnonymousObservable<TSource>(observer =>
- {
- var value = default(TSource);
- var seenValue = false;
-
- return source.Subscribe(
- x =>
- {
- value = x;
- seenValue = true;
- },
- observer.OnError,
- () =>
- {
- if (throwOnEmpty && !seenValue)
- {
- observer.OnError(new InvalidOperationException(Strings_Linq.NO_ELEMENTS));
- }
- else
- {
- observer.OnNext(value);
- observer.OnCompleted();
- }
- }
- );
- });
- }
-#endif
-
- #endregion
-
- #region + LongCount +
-
- public virtual IObservable<long> LongCount<TSource>(IObservable<TSource> source)
- {
-#if !NO_PERF
- return new LongCount<TSource>(source);
-#else
- return source.Aggregate(0L, (count, _) => checked(count + 1));
-#endif
- }
-
- public virtual IObservable<long> LongCount<TSource>(IObservable<TSource> source, Func<TSource, bool> predicate)
- {
-#if !NO_PERF
- return new LongCount<TSource>(source, predicate);
-#else
- return source.Where(predicate).Aggregate(0L, (count, _) => checked(count + 1));
-#endif
- }
-
- #endregion
-
- #region + Max +
-
- public virtual IObservable<TSource> Max<TSource>(IObservable<TSource> source)
- {
-#if !NO_PERF
- // BREAKING CHANGE v2 > v1.x - Behavior for reference types
- return new Max<TSource>(source, Comparer<TSource>.Default);
-#else
- return MaxBy(source, x => x).Select(x => x.First());
-#endif
- }
-
- public virtual IObservable<TSource> Max<TSource>(IObservable<TSource> source, IComparer<TSource> comparer)
- {
-#if !NO_PERF
- // BREAKING CHANGE v2 > v1.x - Behavior for reference types
- return new Max<TSource>(source, comparer);
-#else
- return MaxBy(source, x => x, comparer).Select(x => x.First());
-#endif
- }
-
- public virtual IObservable<double> Max(IObservable<double> source)
- {
-#if !NO_PERF
- return new MaxDouble(source);
-#else
- return source.Scan(double.MinValue, Math.Max).Final();
-#endif
- }
-
- public virtual IObservable<float> Max(IObservable<float> source)
- {
-#if !NO_PERF
- return new MaxSingle(source);
-#else
- return source.Scan(float.MinValue, Math.Max).Final();
-#endif
- }
-
- public virtual IObservable<decimal> Max(IObservable<decimal> source)
- {
-#if !NO_PERF
- return new MaxDecimal(source);
-#else
- return source.Scan(decimal.MinValue, Math.Max).Final();
-#endif
- }
-
- public virtual IObservable<int> Max(IObservable<int> source)
- {
-#if !NO_PERF
- return new MaxInt32(source);
-#else
- return source.Scan(int.MinValue, Math.Max).Final();
-#endif
- }
-
- public virtual IObservable<long> Max(IObservable<long> source)
- {
-#if !NO_PERF
- return new MaxInt64(source);
-#else
- return source.Scan(long.MinValue, Math.Max).Final();
-#endif
- }
-
- public virtual IObservable<double?> Max(IObservable<double?> source)
- {
-#if !NO_PERF
- return new MaxDoubleNullable(source);
-#else
- return source.Aggregate(new double?(), NullableMax);
-#endif
- }
-
- public virtual IObservable<float?> Max(IObservable<float?> source)
- {
-#if !NO_PERF
- return new MaxSingleNullable(source);
-#else
- return source.Aggregate(new float?(), NullableMax);
-#endif
- }
-
- public virtual IObservable<decimal?> Max(IObservable<decimal?> source)
- {
-#if !NO_PERF
- return new MaxDecimalNullable(source);
-#else
- return source.Aggregate(new decimal?(), NullableMax);
-#endif
- }
-
- public virtual IObservable<int?> Max(IObservable<int?> source)
- {
-#if !NO_PERF
- return new MaxInt32Nullable(source);
-#else
- return source.Aggregate(new int?(), NullableMax);
-#endif
- }
-
- public virtual IObservable<long?> Max(IObservable<long?> source)
- {
-#if !NO_PERF
- return new MaxInt64Nullable(source);
-#else
- return source.Aggregate(new long?(), NullableMax);
-#endif
- }
-
- public virtual IObservable<TResult> Max<TSource, TResult>(IObservable<TSource> source, Func<TSource, TResult> selector)
- {
- return Max(Select(source, selector));
- }
-
- public virtual IObservable<TResult> Max<TSource, TResult>(IObservable<TSource> source, Func<TSource, TResult> selector, IComparer<TResult> comparer)
- {
- return Max(Select(source, selector), comparer);
- }
-
- public virtual IObservable<double> Max<TSource>(IObservable<TSource> source, Func<TSource, double> selector)
- {
- return Max(Select(source, selector));
- }
-
- public virtual IObservable<float> Max<TSource>(IObservable<TSource> source, Func<TSource, float> selector)
- {
- return Max(Select(source, selector));
- }
-
- public virtual IObservable<decimal> Max<TSource>(IObservable<TSource> source, Func<TSource, decimal> selector)
- {
- return Max(Select(source, selector));
- }
-
- public virtual IObservable<int> Max<TSource>(IObservable<TSource> source, Func<TSource, int> selector)
- {
- return Max(Select(source, selector));
- }
-
- public virtual IObservable<long> Max<TSource>(IObservable<TSource> source, Func<TSource, long> selector)
- {
- return Max(Select(source, selector));
- }
-
- public virtual IObservable<double?> Max<TSource>(IObservable<TSource> source, Func<TSource, double?> selector)
- {
- return Max(Select(source, selector));
- }
-
- public virtual IObservable<float?> Max<TSource>(IObservable<TSource> source, Func<TSource, float?> selector)
- {
- return Max(Select(source, selector));
- }
-
- public virtual IObservable<decimal?> Max<TSource>(IObservable<TSource> source, Func<TSource, decimal?> selector)
- {
- return Max(Select(source, selector));
- }
-
- public virtual IObservable<int?> Max<TSource>(IObservable<TSource> source, Func<TSource, int?> selector)
- {
- return Max(Select(source, selector));
- }
-
- public virtual IObservable<long?> Max<TSource>(IObservable<TSource> source, Func<TSource, long?> selector)
- {
- return Max(Select(source, selector));
- }
-
- #endregion
-
- #region + MaxBy +
-
- public virtual IObservable<IList<TSource>> MaxBy<TSource, TKey>(IObservable<TSource> source, Func<TSource, TKey> keySelector)
- {
-#if !NO_PERF
- return new MaxBy<TSource, TKey>(source, keySelector, Comparer<TKey>.Default);
-#else
- return MaxBy(source, keySelector, Comparer<TKey>.Default);
-#endif
- }
-
- public virtual IObservable<IList<TSource>> MaxBy<TSource, TKey>(IObservable<TSource> source, Func<TSource, TKey> keySelector, IComparer<TKey> comparer)
- {
-#if !NO_PERF
- return new MaxBy<TSource, TKey>(source, keySelector, comparer);
-#else
- return ExtremaBy(source, keySelector, comparer);
-#endif
- }
-
- #endregion
-
- #region + Min +
-
- public virtual IObservable<TSource> Min<TSource>(IObservable<TSource> source)
- {
-#if !NO_PERF
- // BREAKING CHANGE v2 > v1.x - Behavior for reference types
- return new Min<TSource>(source, Comparer<TSource>.Default);
-#else
- return MinBy(source, x => x).Select(x => x.First());
-#endif
- }
-
- public virtual IObservable<TSource> Min<TSource>(IObservable<TSource> source, IComparer<TSource> comparer)
- {
-#if !NO_PERF
- // BREAKING CHANGE v2 > v1.x - Behavior for reference types
- return new Min<TSource>(source, comparer);
-#else
- return MinBy(source, x => x, comparer).Select(x => x.First());
-#endif
- }
-
- public virtual IObservable<double> Min(IObservable<double> source)
- {
-#if !NO_PERF
- return new MinDouble(source);
-#else
- return source.Scan(double.MaxValue, Math.Min).Final();
-#endif
- }
-
- public virtual IObservable<float> Min(IObservable<float> source)
- {
-#if !NO_PERF
- return new MinSingle(source);
-#else
- return source.Scan(float.MaxValue, Math.Min).Final();
-#endif
- }
-
- public virtual IObservable<decimal> Min(IObservable<decimal> source)
- {
-#if !NO_PERF
- return new MinDecimal(source);
-#else
- return source.Scan(decimal.MaxValue, Math.Min).Final();
-#endif
- }
-
- public virtual IObservable<int> Min(IObservable<int> source)
- {
-#if !NO_PERF
- return new MinInt32(source);
-#else
- return source.Scan(int.MaxValue, Math.Min).Final();
-#endif
- }
-
- public virtual IObservable<long> Min(IObservable<long> source)
- {
-#if !NO_PERF
- return new MinInt64(source);
-#else
- return source.Scan(long.MaxValue, Math.Min).Final();
-#endif
- }
-
- public virtual IObservable<double?> Min(IObservable<double?> source)
- {
-#if !NO_PERF
- return new MinDoubleNullable(source);
-#else
- return source.Aggregate(new double?(), NullableMin);
-#endif
- }
-
- public virtual IObservable<float?> Min(IObservable<float?> source)
- {
-#if !NO_PERF
- return new MinSingleNullable(source);
-#else
- return source.Aggregate(new float?(), NullableMin);
-#endif
- }
-
- public virtual IObservable<decimal?> Min(IObservable<decimal?> source)
- {
-#if !NO_PERF
- return new MinDecimalNullable(source);
-#else
- return source.Aggregate(new decimal?(), NullableMin);
-#endif
- }
-
- public virtual IObservable<int?> Min(IObservable<int?> source)
- {
-#if !NO_PERF
- return new MinInt32Nullable(source);
-#else
- return source.Aggregate(new int?(), NullableMin);
-#endif
- }
-
- public virtual IObservable<long?> Min(IObservable<long?> source)
- {
-#if !NO_PERF
- return new MinInt64Nullable(source);
-#else
- return source.Aggregate(new long?(), NullableMin);
-#endif
- }
-
- public virtual IObservable<TResult> Min<TSource, TResult>(IObservable<TSource> source, Func<TSource, TResult> selector)
- {
- return Min(Select(source, selector));
- }
-
- public virtual IObservable<TResult> Min<TSource, TResult>(IObservable<TSource> source, Func<TSource, TResult> selector, IComparer<TResult> comparer)
- {
- return Min(Select(source, selector), comparer);
- }
-
- public virtual IObservable<double> Min<TSource>(IObservable<TSource> source, Func<TSource, double> selector)
- {
- return Min(Select(source, selector));
- }
-
- public virtual IObservable<float> Min<TSource>(IObservable<TSource> source, Func<TSource, float> selector)
- {
- return Min(Select(source, selector));
- }
-
- public virtual IObservable<decimal> Min<TSource>(IObservable<TSource> source, Func<TSource, decimal> selector)
- {
- return Min(Select(source, selector));
- }
-
- public virtual IObservable<int> Min<TSource>(IObservable<TSource> source, Func<TSource, int> selector)
- {
- return Min(Select(source, selector));
- }
-
- public virtual IObservable<long> Min<TSource>(IObservable<TSource> source, Func<TSource, long> selector)
- {
- return Min(Select(source, selector));
- }
-
- public virtual IObservable<double?> Min<TSource>(IObservable<TSource> source, Func<TSource, double?> selector)
- {
- return Min(Select(source, selector));
- }
-
- public virtual IObservable<float?> Min<TSource>(IObservable<TSource> source, Func<TSource, float?> selector)
- {
- return Min(Select(source, selector));
- }
-
- public virtual IObservable<decimal?> Min<TSource>(IObservable<TSource> source, Func<TSource, decimal?> selector)
- {
- return Min(Select(source, selector));
- }
-
- public virtual IObservable<int?> Min<TSource>(IObservable<TSource> source, Func<TSource, int?> selector)
- {
- return Min(Select(source, selector));
- }
-
- public virtual IObservable<long?> Min<TSource>(IObservable<TSource> source, Func<TSource, long?> selector)
- {
- return Min(Select(source, selector));
- }
-
- #endregion
-
- #region + MinBy +
-
- public virtual IObservable<IList<TSource>> MinBy<TSource, TKey>(IObservable<TSource> source, Func<TSource, TKey> keySelector)
- {
-#if !NO_PERF
- return new MinBy<TSource, TKey>(source, keySelector, Comparer<TKey>.Default);
-#else
- return MinBy(source, keySelector, Comparer<TKey>.Default);
-#endif
- }
-
- public virtual IObservable<IList<TSource>> MinBy<TSource, TKey>(IObservable<TSource> source, Func<TSource, TKey> keySelector, IComparer<TKey> comparer)
- {
-#if !NO_PERF
- return new MinBy<TSource, TKey>(source, keySelector, comparer);
-#else
- return ExtremaBy(source, keySelector, new AnonymousComparer<TKey>((x, y) => comparer.Compare(x, y) * -1));
-#endif
- }
-
- #endregion
-
- #region + SequenceEqual +
-
- public virtual IObservable<bool> SequenceEqual<TSource>(IObservable<TSource> first, IObservable<TSource> second)
- {
-#if !NO_PERF
- return new SequenceEqual<TSource>(first, second, EqualityComparer<TSource>.Default);
-#else
- return first.SequenceEqual(second, EqualityComparer<TSource>.Default);
-#endif
- }
-
- public virtual IObservable<bool> SequenceEqual<TSource>(IObservable<TSource> first, IObservable<TSource> second, IEqualityComparer<TSource> comparer)
- {
-#if !NO_PERF
- return new SequenceEqual<TSource>(first, second, comparer);
-#else
- return new AnonymousObservable<bool>(observer =>
- {
- var gate = new object();
- var donel = false;
- var doner = false;
- var ql = new Queue<TSource>();
- var qr = new Queue<TSource>();
-
- var subscription1 = first.Subscribe(
- x =>
- {
- lock (gate)
- {
- if (qr.Count > 0)
- {
- var equal = false;
- var v = qr.Dequeue();
- try
- {
- equal = comparer.Equals(x, v);
- }
- catch (Exception exception)
- {
- observer.OnError(exception);
- return;
- }
- if (!equal)
- {
- observer.OnNext(false);
- observer.OnCompleted();
- }
- }
- else if (doner)
- {
- observer.OnNext(false);
- observer.OnCompleted();
- }
- else
- ql.Enqueue(x);
- }
- },
- observer.OnError,
- () =>
- {
- lock (gate)
- {
- donel = true;
- if (ql.Count == 0)
- {
- if (qr.Count > 0)
- {
- observer.OnNext(false);
- observer.OnCompleted();
- }
- else if (doner)
- {
- observer.OnNext(true);
- observer.OnCompleted();
- }
- }
- }
- });
-
- var subscription2 = second.Subscribe(
- x =>
- {
- lock (gate)
- {
- if (ql.Count > 0)
- {
- var equal = false;
- var v = ql.Dequeue();
- try
- {
- equal = comparer.Equals(v, x);
- }
- catch (Exception exception)
- {
- observer.OnError(exception);
- return;
- }
- if (!equal)
- {
- observer.OnNext(false);
- observer.OnCompleted();
- }
- }
- else if (donel)
- {
- observer.OnNext(false);
- observer.OnCompleted();
- }
- else
- qr.Enqueue(x);
- }
- },
- observer.OnError,
- () =>
- {
- lock (gate)
- {
- doner = true;
- if (qr.Count == 0)
- {
- if (ql.Count > 0)
- {
- observer.OnNext(false);
- observer.OnCompleted();
- }
- else if (donel)
- {
- observer.OnNext(true);
- observer.OnCompleted();
- }
- }
- }
- });
-
- return new CompositeDisposable(subscription1, subscription2);
- });
-#endif
- }
-
- public virtual IObservable<bool> SequenceEqual<TSource>(IObservable<TSource> first, IEnumerable<TSource> second)
- {
-#if !NO_PERF
- return new SequenceEqual<TSource>(first, second, EqualityComparer<TSource>.Default);
-#else
- return SequenceEqual<TSource>(first, second, EqualityComparer<TSource>.Default);
-#endif
- }
-
- public virtual IObservable<bool> SequenceEqual<TSource>(IObservable<TSource> first, IEnumerable<TSource> second, IEqualityComparer<TSource> comparer)
- {
-#if !NO_PERF
- return new SequenceEqual<TSource>(first, second, comparer);
-#else
- return new AnonymousObservable<bool>(observer =>
- {
- var e = default(IEnumerator<TSource>);
- try
- {
- e = second.GetEnumerator();
- }
- catch (Exception ex)
- {
- observer.OnError(ex);
- return Disposable.Empty;
- }
-
- return new CompositeDisposable(
- first.Subscribe(
- value =>
- {
- var equal = false;
- try
- {
- var hasNext = e.MoveNext();
- if (hasNext)
- {
- var current = e.Current;
- equal = comparer.Equals(value, current);
- }
- }
- catch (Exception ex)
- {
- observer.OnError(ex);
- return;
- }
-
- if (!equal)
- {
- observer.OnNext(false);
- observer.OnCompleted();
- }
- },
- observer.OnError,
- () =>
- {
- var hasNext = false;
-
- try
- {
- hasNext = e.MoveNext();
- }
- catch (Exception exception)
- {
- observer.OnError(exception);
- return;
- }
-
- observer.OnNext(!hasNext);
- observer.OnCompleted();
- }
- ),
- e
- );
- });
-#endif
- }
-
- #endregion
-
- #region + SingleAsync +
-
- public virtual IObservable<TSource> SingleAsync<TSource>(IObservable<TSource> source)
- {
-#if !NO_PERF
- return new SingleAsync<TSource>(source, null, true);
-#else
- return SingleOrDefaultAsync_(source, true);
-#endif
- }
-
- public virtual IObservable<TSource> SingleAsync<TSource>(IObservable<TSource> source, Func<TSource, bool> predicate)
- {
-#if !NO_PERF
- return new SingleAsync<TSource>(source, predicate, true);
-#else
- return source.Where(predicate).SingleAsync();
-#endif
- }
-
- #endregion
-
- #region + SingleOrDefaultAsync +
-
- public virtual IObservable<TSource> SingleOrDefaultAsync<TSource>(IObservable<TSource> source)
- {
-#if !NO_PERF
- return new SingleAsync<TSource>(source, null, false);
-#else
- return SingleOrDefaultAsync_(source, false);
-#endif
- }
-
- public virtual IObservable<TSource> SingleOrDefaultAsync<TSource>(IObservable<TSource> source, Func<TSource, bool> predicate)
- {
-#if !NO_PERF
- return new SingleAsync<TSource>(source, predicate, false);
-#else
- return source.Where(predicate).SingleOrDefaultAsync();
-#endif
- }
-
-#if NO_PERF
- private static IObservable<TSource> SingleOrDefaultAsync_<TSource>(IObservable<TSource> source, bool throwOnEmpty)
- {
- return new AnonymousObservable<TSource>(observer =>
- {
- var value = default(TSource);
- var seenValue = false;
-
- return source.Subscribe(
- x =>
- {
- if (seenValue)
- {
- observer.OnError(new InvalidOperationException(Strings_Linq.MORE_THAN_ONE_ELEMENT));
- }
- else
- {
- value = x;
- seenValue = true;
- }
- },
- observer.OnError,
- () =>
- {
- if (throwOnEmpty && !seenValue)
- {
- observer.OnError(new InvalidOperationException(Strings_Linq.NO_ELEMENTS));
- }
- else
- {
- observer.OnNext(value);
- observer.OnCompleted();
- }
- }
- );
- });
- }
-#endif
-
- #endregion
-
- #region + Sum +
-
- public virtual IObservable<double> Sum(IObservable<double> source)
- {
-#if !NO_PERF
- return new SumDouble(source);
-#else
- return source.Aggregate(0.0, (prev, curr) => prev + curr);
-#endif
- }
-
- public virtual IObservable<float> Sum(IObservable<float> source)
- {
-#if !NO_PERF
- return new SumSingle(source);
-#else
- return source.Aggregate(0f, (prev, curr) => prev + curr);
-#endif
- }
-
- public virtual IObservable<decimal> Sum(IObservable<decimal> source)
- {
-#if !NO_PERF
- return new SumDecimal(source);
-#else
- return source.Aggregate(0M, (prev, curr) => prev + curr);
-#endif
- }
-
- public virtual IObservable<int> Sum(IObservable<int> source)
- {
-#if !NO_PERF
- return new SumInt32(source);
-#else
- return source.Aggregate(0, (prev, curr) => checked(prev + curr));
-#endif
- }
-
- public virtual IObservable<long> Sum(IObservable<long> source)
- {
-#if !NO_PERF
- return new SumInt64(source);
-#else
- return source.Aggregate(0L, (prev, curr) => checked(prev + curr));
-#endif
- }
-
- public virtual IObservable<double?> Sum(IObservable<double?> source)
- {
-#if !NO_PERF
- return new SumDoubleNullable(source);
-#else
- return source.Aggregate(0.0, (prev, curr) => prev + curr.GetValueOrDefault()).Select(x => (double?)x);
-#endif
- }
-
- public virtual IObservable<float?> Sum(IObservable<float?> source)
- {
-#if !NO_PERF
- return new SumSingleNullable(source);
-#else
- return source.Aggregate(0f, (prev, curr) => prev + curr.GetValueOrDefault()).Select(x => (float?)x);
-#endif
- }
-
- public virtual IObservable<decimal?> Sum(IObservable<decimal?> source)
- {
-#if !NO_PERF
- return new SumDecimalNullable(source);
-#else
- return source.Aggregate(0M, (prev, curr) => prev + curr.GetValueOrDefault()).Select(x => (decimal?)x);
-#endif
- }
-
- public virtual IObservable<int?> Sum(IObservable<int?> source)
- {
-#if !NO_PERF
- return new SumInt32Nullable(source);
-#else
- return source.Aggregate(0, (prev, curr) => checked(prev + curr.GetValueOrDefault())).Select(x => (int?)x);
-#endif
- }
-
- public virtual IObservable<long?> Sum(IObservable<long?> source)
- {
-#if !NO_PERF
- return new SumInt64Nullable(source);
-#else
- return source.Aggregate(0L, (prev, curr) => checked(prev + curr.GetValueOrDefault())).Select(x => (long?)x);
-#endif
- }
-
- public virtual IObservable<double> Sum<TSource>(IObservable<TSource> source, Func<TSource, double> selector)
- {
- return Sum(Select(source, selector));
- }
-
- public virtual IObservable<float> Sum<TSource>(IObservable<TSource> source, Func<TSource, float> selector)
- {
- return Sum(Select(source, selector));
- }
-
- public virtual IObservable<decimal> Sum<TSource>(IObservable<TSource> source, Func<TSource, decimal> selector)
- {
- return Sum(Select(source, selector));
- }
-
- public virtual IObservable<int> Sum<TSource>(IObservable<TSource> source, Func<TSource, int> selector)
- {
- return Sum(Select(source, selector));
- }
-
- public virtual IObservable<long> Sum<TSource>(IObservable<TSource> source, Func<TSource, long> selector)
- {
- return Sum(Select(source, selector));
- }
-
- public virtual IObservable<double?> Sum<TSource>(IObservable<TSource> source, Func<TSource, double?> selector)
- {
- return Sum(Select(source, selector));
- }
-
- public virtual IObservable<float?> Sum<TSource>(IObservable<TSource> source, Func<TSource, float?> selector)
- {
- return Sum(Select(source, selector));
- }
-
- public virtual IObservable<decimal?> Sum<TSource>(IObservable<TSource> source, Func<TSource, decimal?> selector)
- {
- return Sum(Select(source, selector));
- }
-
- public virtual IObservable<int?> Sum<TSource>(IObservable<TSource> source, Func<TSource, int?> selector)
- {
- return Sum(Select(source, selector));
- }
-
- public virtual IObservable<long?> Sum<TSource>(IObservable<TSource> source, Func<TSource, long?> selector)
- {
- return Sum(Select(source, selector));
- }
-
- #endregion
-
- #region + ToArray +
-
- public virtual IObservable<TSource[]> ToArray<TSource>(IObservable<TSource> source)
- {
-#if !NO_PERF
- return new ToArray<TSource>(source);
-#else
- return source.ToList().Select(xs => xs.ToArray());
-#endif
- }
-
- #endregion
-
- #region + ToDictionary +
-
- public virtual IObservable<IDictionary<TKey, TElement>> ToDictionary<TSource, TKey, TElement>(IObservable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector, IEqualityComparer<TKey> comparer)
- {
-#if !NO_PERF
- return new ToDictionary<TSource, TKey, TElement>(source, keySelector, elementSelector, comparer);
-#else
- return source.Aggregate((IDictionary<TKey, TElement>)new Dictionary<TKey, TElement>(comparer), (dict, x) =>
- {
- dict.Add(keySelector(x), elementSelector(x));
- return dict;
- });
-#endif
- }
-
- public virtual IObservable<IDictionary<TKey, TElement>> ToDictionary<TSource, TKey, TElement>(IObservable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector)
- {
-#if !NO_PERF
- return new ToDictionary<TSource, TKey, TElement>(source, keySelector, elementSelector, EqualityComparer<TKey>.Default);
-#else
- return source.ToDictionary(keySelector, elementSelector, EqualityComparer<TKey>.Default);
-#endif
- }
-
- public virtual IObservable<IDictionary<TKey, TSource>> ToDictionary<TSource, TKey>(IObservable<TSource> source, Func<TSource, TKey> keySelector, IEqualityComparer<TKey> comparer)
- {
-#if !NO_PERF
- return new ToDictionary<TSource, TKey, TSource>(source, keySelector, x => x, comparer);
-#else
- return source.ToDictionary(keySelector, x => x, comparer);
-#endif
- }
-
- public virtual IObservable<IDictionary<TKey, TSource>> ToDictionary<TSource, TKey>(IObservable<TSource> source, Func<TSource, TKey> keySelector)
- {
-#if !NO_PERF
- return new ToDictionary<TSource, TKey, TSource>(source, keySelector, x => x, EqualityComparer<TKey>.Default);
-#else
- return source.ToDictionary(keySelector, x => x, EqualityComparer<TKey>.Default);
-#endif
- }
-
- #endregion
-
- #region + ToList +
-
- public virtual IObservable<IList<TSource>> ToList<TSource>(IObservable<TSource> source)
- {
-#if !NO_PERF
- return new ToList<TSource>(source);
-#else
- return source.Aggregate((IList<TSource>)new List<TSource>(), (list, x) =>
- {
- list.Add(x);
- return list;
- });
-#endif
- }
-
- #endregion
-
- #region + ToLookup +
-
- public virtual IObservable<ILookup<TKey, TElement>> ToLookup<TSource, TKey, TElement>(IObservable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector, IEqualityComparer<TKey> comparer)
- {
-#if !NO_PERF
- return new ToLookup<TSource, TKey, TElement>(source, keySelector, elementSelector, comparer);
-#else
- return source.Aggregate(new Lookup<TKey, TElement>(comparer), (lookup, x) =>
- {
- lookup.Add(keySelector(x), elementSelector(x));
- return lookup;
- }).Select(xs => (ILookup<TKey, TElement>)xs);
-#endif
- }
-
- public virtual IObservable<ILookup<TKey, TSource>> ToLookup<TSource, TKey>(IObservable<TSource> source, Func<TSource, TKey> keySelector, IEqualityComparer<TKey> comparer)
- {
-#if !NO_PERF
- return new ToLookup<TSource, TKey, TSource>(source, keySelector, x => x, comparer);
-#else
- return source.ToLookup(keySelector, x => x, comparer);
-#endif
- }
-
- public virtual IObservable<ILookup<TKey, TElement>> ToLookup<TSource, TKey, TElement>(IObservable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector)
- {
-#if !NO_PERF
- return new ToLookup<TSource, TKey, TElement>(source, keySelector, elementSelector, EqualityComparer<TKey>.Default);
-#else
- return source.ToLookup(keySelector, elementSelector, EqualityComparer<TKey>.Default);
-#endif
- }
-
- public virtual IObservable<ILookup<TKey, TSource>> ToLookup<TSource, TKey>(IObservable<TSource> source, Func<TSource, TKey> keySelector)
- {
-#if !NO_PERF
- return new ToLookup<TSource, TKey, TSource>(source, keySelector, x => x, EqualityComparer<TKey>.Default);
-#else
- return source.ToLookup(keySelector, x => x, EqualityComparer<TKey>.Default);
-#endif
- }
-
- #endregion
-
- #region |> Helpers <|
-
-#if NO_PERF
- private static T? NullableMin<T>(T? x, T? y)
- where T : struct, IComparable<T>
- {
- if (!x.HasValue)
- return y;
- if (!y.HasValue)
- return x;
- if (x.Value.CompareTo(y.Value) <= 0)
- return x;
- return y;
- }
-
- private static T? NullableMax<T>(T? x, T? y)
- where T : struct, IComparable<T>
- {
- if (!x.HasValue)
- return y;
- if (!y.HasValue)
- return x;
- if (x.Value.CompareTo(y.Value) >= 0)
- return x;
- return y;
- }
-
- private static IObservable<IList<TSource>> ExtremaBy<TSource, TKey>(IObservable<TSource> source, Func<TSource, TKey> keySelector, IComparer<TKey> comparer)
- {
- return new AnonymousObservable<IList<TSource>>(observer =>
- {
- var hasValue = false;
- var lastKey = default(TKey);
- var list = new List<TSource>();
- return source.Subscribe(
- x =>
- {
- var key = default(TKey);
- try
- {
- key = keySelector(x);
- }
- catch (Exception ex)
- {
- observer.OnError(ex);
- return;
- }
- var comparison = 0;
-
- if (!hasValue)
- {
- hasValue = true;
- lastKey = key;
- }
- else
- {
- try
- {
- comparison = comparer.Compare(key, lastKey);
- }
- catch (Exception ex)
- {
- observer.OnError(ex);
- return;
- }
- }
- if (comparison > 0)
- {
- lastKey = key;
- list.Clear();
- }
- if (comparison >= 0)
- {
- list.Add(x);
- }
- },
- observer.OnError,
- () =>
- {
- observer.OnNext(list);
- observer.OnCompleted();
- }
- );
- });
- }
-#endif
-
- #endregion
- }
-
- #region |> Helper types <|
-
-#if NO_PERF
- static class AggregateExtensions
- {
- public static IObservable<TSource> Final<TSource>(this IObservable<TSource> source)
- {
- return new AnonymousObservable<TSource>(observer =>
- {
- var value = default(TSource);
- var hasValue = false;
-
- return source.Subscribe(
- x =>
- {
- hasValue = true;
- value = x;
- },
- observer.OnError,
- () =>
- {
- if (!hasValue)
- observer.OnError(new InvalidOperationException(Strings_Linq.NO_ELEMENTS));
- else
- {
- observer.OnNext(value);
- observer.OnCompleted();
- }
- });
- });
- }
- }
-
- sealed class AnonymousComparer<T> : IComparer<T>
- {
- private readonly Func<T, T, int> comparer;
-
- /// <summary>
- /// Creates an instance of IComparer by providing a method that compares two objects.
- /// </summary>
- public AnonymousComparer(Func<T, T, int> comparer)
- {
- this.comparer = comparer;
- }
-
- /// <summary>
- /// Compares two objects and returns a value indicating whether one is less than, equal to, or greater than the other.
- /// </summary>
- public int Compare(T x, T y)
- {
- return comparer(x, y);
- }
- }
-#endif
-
- #endregion
-}
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/QueryLanguage.Async.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/QueryLanguage.Async.cs
deleted file mode 100644
index 21f36f4..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/QueryLanguage.Async.cs
+++ /dev/null
@@ -1,1796 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System.Reactive.Concurrency;
-using System.Reactive.Disposables;
-using System.Reactive.Subjects;
-
-#if !NO_TPL
-using System.Reactive.Threading.Tasks;
-using System.Threading;
-using System.Threading.Tasks;
-#endif
-
-namespace System.Reactive.Linq
-{
- internal partial class QueryLanguage
- {
- #region FromAsyncPattern
-
- #region Func
-
- public virtual Func<IObservable<TResult>> FromAsyncPattern<TResult>(Func<AsyncCallback, object, IAsyncResult> begin, Func<IAsyncResult, TResult> end)
- {
- return () =>
- {
- var subject = new AsyncSubject<TResult>();
- try
- {
- begin(iar =>
- {
- // Note: Even if the callback completes synchronously, outgoing On* calls
- // cannot throw in user code since there can't be any subscribers
- // to the AsyncSubject yet. Therefore, there is no need to protect
- // against exceptions that'd be caught below and sent (incorrectly)
- // into the Observable.Throw sequence being constructed.
- TResult result;
- try
- {
- result = end(iar);
- }
- catch (Exception exception)
- {
- subject.OnError(exception);
- return;
- }
- subject.OnNext(result);
- subject.OnCompleted();
- }, null);
- }
- catch (Exception exception)
- {
- return Observable.Throw<TResult>(exception, SchedulerDefaults.AsyncConversions);
- }
- return subject.AsObservable();
- };
- }
-
- public virtual Func<T1, IObservable<TResult>> FromAsyncPattern<T1, TResult>(Func<T1, AsyncCallback, object, IAsyncResult> begin, Func<IAsyncResult, TResult> end)
- {
- return x =>
- {
- var subject = new AsyncSubject<TResult>();
- try
- {
- begin(x, iar =>
- {
- // See remark on FromAsyncPattern<TResult>.
- TResult result;
- try
- {
- result = end(iar);
- }
- catch (Exception exception)
- {
- subject.OnError(exception);
- return;
- }
- subject.OnNext(result);
- subject.OnCompleted();
- }, null);
- }
- catch (Exception exception)
- {
- return Observable.Throw<TResult>(exception, SchedulerDefaults.AsyncConversions);
- }
- return subject.AsObservable();
- };
- }
-
- public virtual Func<T1, T2, IObservable<TResult>> FromAsyncPattern<T1, T2, TResult>(Func<T1, T2, AsyncCallback, object, IAsyncResult> begin, Func<IAsyncResult, TResult> end)
- {
- return (x, y) =>
- {
- var subject = new AsyncSubject<TResult>();
- try
- {
- begin(x, y, iar =>
- {
- // See remark on FromAsyncPattern<TResult>.
- TResult result;
- try
- {
- result = end(iar);
- }
- catch (Exception exception)
- {
- subject.OnError(exception);
- return;
- }
- subject.OnNext(result);
- subject.OnCompleted();
- }, null);
- }
- catch (Exception exception)
- {
- return Observable.Throw<TResult>(exception, SchedulerDefaults.AsyncConversions);
- }
- return subject.AsObservable();
- };
- }
-
-#if !NO_LARGEARITY
- public virtual Func<T1, T2, T3, IObservable<TResult>> FromAsyncPattern<T1, T2, T3, TResult>(Func<T1, T2, T3, AsyncCallback, object, IAsyncResult> begin, Func<IAsyncResult, TResult> end)
- {
- return (x, y, z) =>
- {
- var subject = new AsyncSubject<TResult>();
- try
- {
- begin(x, y, z, iar =>
- {
- // See remark on FromAsyncPattern<TResult>.
- TResult result;
- try
- {
- result = end(iar);
- }
- catch (Exception exception)
- {
- subject.OnError(exception);
- return;
- }
- subject.OnNext(result);
- subject.OnCompleted();
- }, null);
- }
- catch (Exception exception)
- {
- return Observable.Throw<TResult>(exception, SchedulerDefaults.AsyncConversions);
- }
- return subject.AsObservable();
- };
- }
-
- public virtual Func<T1, T2, T3, T4, IObservable<TResult>> FromAsyncPattern<T1, T2, T3, T4, TResult>(Func<T1, T2, T3, T4, AsyncCallback, object, IAsyncResult> begin, Func<IAsyncResult, TResult> end)
- {
- return (x, y, z, a) =>
- {
- var subject = new AsyncSubject<TResult>();
- try
- {
- begin(x, y, z, a, iar =>
- {
- // See remark on FromAsyncPattern<TResult>.
- TResult result;
- try
- {
- result = end(iar);
- }
- catch (Exception exception)
- {
- subject.OnError(exception);
- return;
- }
- subject.OnNext(result);
- subject.OnCompleted();
- }, null);
- }
- catch (Exception exception)
- {
- return Observable.Throw<TResult>(exception, SchedulerDefaults.AsyncConversions);
- }
- return subject.AsObservable();
- };
- }
-
- public virtual Func<T1, T2, T3, T4, T5, IObservable<TResult>> FromAsyncPattern<T1, T2, T3, T4, T5, TResult>(Func<T1, T2, T3, T4, T5, AsyncCallback, object, IAsyncResult> begin, Func<IAsyncResult, TResult> end)
- {
- return (x, y, z, a, b) =>
- {
- var subject = new AsyncSubject<TResult>();
- try
- {
- begin(x, y, z, a, b, iar =>
- {
- // See remark on FromAsyncPattern<TResult>.
- TResult result;
- try
- {
- result = end(iar);
- }
- catch (Exception exception)
- {
- subject.OnError(exception);
- return;
- }
- subject.OnNext(result);
- subject.OnCompleted();
- }, null);
- }
- catch (Exception exception)
- {
- return Observable.Throw<TResult>(exception, SchedulerDefaults.AsyncConversions);
- }
- return subject.AsObservable();
- };
- }
-
- public virtual Func<T1, T2, T3, T4, T5, T6, IObservable<TResult>> FromAsyncPattern<T1, T2, T3, T4, T5, T6, TResult>(Func<T1, T2, T3, T4, T5, T6, AsyncCallback, object, IAsyncResult> begin, Func<IAsyncResult, TResult> end)
- {
- return (x, y, z, a, b, c) =>
- {
- var subject = new AsyncSubject<TResult>();
- try
- {
- begin(x, y, z, a, b, c, iar =>
- {
- // See remark on FromAsyncPattern<TResult>.
- TResult result;
- try
- {
- result = end(iar);
- }
- catch (Exception exception)
- {
- subject.OnError(exception);
- return;
- }
- subject.OnNext(result);
- subject.OnCompleted();
- }, null);
- }
- catch (Exception exception)
- {
- return Observable.Throw<TResult>(exception, SchedulerDefaults.AsyncConversions);
- }
- return subject.AsObservable();
- };
- }
-
- public virtual Func<T1, T2, T3, T4, T5, T6, T7, IObservable<TResult>> FromAsyncPattern<T1, T2, T3, T4, T5, T6, T7, TResult>(Func<T1, T2, T3, T4, T5, T6, T7, AsyncCallback, object, IAsyncResult> begin, Func<IAsyncResult, TResult> end)
- {
- return (x, y, z, a, b, c, d) =>
- {
- var subject = new AsyncSubject<TResult>();
- try
- {
- begin(x, y, z, a, b, c, d, iar =>
- {
- // See remark on FromAsyncPattern<TResult>.
- TResult result;
- try
- {
- result = end(iar);
- }
- catch (Exception exception)
- {
- subject.OnError(exception);
- return;
- }
- subject.OnNext(result);
- subject.OnCompleted();
- }, null);
- }
- catch (Exception exception)
- {
- return Observable.Throw<TResult>(exception, SchedulerDefaults.AsyncConversions);
- }
- return subject.AsObservable();
- };
- }
-
- public virtual Func<T1, T2, T3, T4, T5, T6, T7, T8, IObservable<TResult>> FromAsyncPattern<T1, T2, T3, T4, T5, T6, T7, T8, TResult>(Func<T1, T2, T3, T4, T5, T6, T7, T8, AsyncCallback, object, IAsyncResult> begin, Func<IAsyncResult, TResult> end)
- {
- return (x, y, z, a, b, c, d, e) =>
- {
- var subject = new AsyncSubject<TResult>();
- try
- {
- begin(x, y, z, a, b, c, d, e, iar =>
- {
- // See remark on FromAsyncPattern<TResult>.
- TResult result;
- try
- {
- result = end(iar);
- }
- catch (Exception exception)
- {
- subject.OnError(exception);
- return;
- }
- subject.OnNext(result);
- subject.OnCompleted();
- }, null);
- }
- catch (Exception exception)
- {
- return Observable.Throw<TResult>(exception, SchedulerDefaults.AsyncConversions);
- }
- return subject.AsObservable();
- };
- }
-
- public virtual Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, IObservable<TResult>> FromAsyncPattern<T1, T2, T3, T4, T5, T6, T7, T8, T9, TResult>(Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, AsyncCallback, object, IAsyncResult> begin, Func<IAsyncResult, TResult> end)
- {
- return (x, y, z, a, b, c, d, e, f) =>
- {
- var subject = new AsyncSubject<TResult>();
- try
- {
- begin(x, y, z, a, b, c, d, e, f, iar =>
- {
- // See remark on FromAsyncPattern<TResult>.
- TResult result;
- try
- {
- result = end(iar);
- }
- catch (Exception exception)
- {
- subject.OnError(exception);
- return;
- }
- subject.OnNext(result);
- subject.OnCompleted();
- }, null);
- }
- catch (Exception exception)
- {
- return Observable.Throw<TResult>(exception, SchedulerDefaults.AsyncConversions);
- }
- return subject.AsObservable();
- };
- }
-
- public virtual Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, IObservable<TResult>> FromAsyncPattern<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, TResult>(Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, AsyncCallback, object, IAsyncResult> begin, Func<IAsyncResult, TResult> end)
- {
- return (x, y, z, a, b, c, d, e, f, g) =>
- {
- var subject = new AsyncSubject<TResult>();
- try
- {
- begin(x, y, z, a, b, c, d, e, f, g, iar =>
- {
- // See remark on FromAsyncPattern<TResult>.
- TResult result;
- try
- {
- result = end(iar);
- }
- catch (Exception exception)
- {
- subject.OnError(exception);
- return;
- }
- subject.OnNext(result);
- subject.OnCompleted();
- }, null);
- }
- catch (Exception exception)
- {
- return Observable.Throw<TResult>(exception, SchedulerDefaults.AsyncConversions);
- }
- return subject.AsObservable();
- };
- }
-
- public virtual Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, IObservable<TResult>> FromAsyncPattern<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, TResult>(Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, AsyncCallback, object, IAsyncResult> begin, Func<IAsyncResult, TResult> end)
- {
- return (x, y, z, a, b, c, d, e, f, g, h) =>
- {
- var subject = new AsyncSubject<TResult>();
- try
- {
- begin(x, y, z, a, b, c, d, e, f, g, h, iar =>
- {
- // See remark on FromAsyncPattern<TResult>.
- TResult result;
- try
- {
- result = end(iar);
- }
- catch (Exception exception)
- {
- subject.OnError(exception);
- return;
- }
- subject.OnNext(result);
- subject.OnCompleted();
- }, null);
- }
- catch (Exception exception)
- {
- return Observable.Throw<TResult>(exception, SchedulerDefaults.AsyncConversions);
- }
- return subject.AsObservable();
- };
- }
-
- public virtual Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, IObservable<TResult>> FromAsyncPattern<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, TResult>(Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, AsyncCallback, object, IAsyncResult> begin, Func<IAsyncResult, TResult> end)
- {
- return (x, y, z, a, b, c, d, e, f, g, h, i) =>
- {
- var subject = new AsyncSubject<TResult>();
- try
- {
- begin(x, y, z, a, b, c, d, e, f, g, h, i, iar =>
- {
- // See remark on FromAsyncPattern<TResult>.
- TResult result;
- try
- {
- result = end(iar);
- }
- catch (Exception exception)
- {
- subject.OnError(exception);
- return;
- }
- subject.OnNext(result);
- subject.OnCompleted();
- }, null);
- }
- catch (Exception exception)
- {
- return Observable.Throw<TResult>(exception, SchedulerDefaults.AsyncConversions);
- }
- return subject.AsObservable();
- };
- }
-
- public virtual Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, IObservable<TResult>> FromAsyncPattern<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, TResult>(Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, AsyncCallback, object, IAsyncResult> begin, Func<IAsyncResult, TResult> end)
- {
- return (x, y, z, a, b, c, d, e, f, g, h, i, j) =>
- {
- var subject = new AsyncSubject<TResult>();
- try
- {
- begin(x, y, z, a, b, c, d, e, f, g, h, i, j, iar =>
- {
- // See remark on FromAsyncPattern<TResult>.
- TResult result;
- try
- {
- result = end(iar);
- }
- catch (Exception exception)
- {
- subject.OnError(exception);
- return;
- }
- subject.OnNext(result);
- subject.OnCompleted();
- }, null);
- }
- catch (Exception exception)
- {
- return Observable.Throw<TResult>(exception, SchedulerDefaults.AsyncConversions);
- }
- return subject.AsObservable();
- };
- }
-
- public virtual Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, IObservable<TResult>> FromAsyncPattern<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, TResult>(Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, AsyncCallback, object, IAsyncResult> begin, Func<IAsyncResult, TResult> end)
- {
- return (x, y, z, a, b, c, d, e, f, g, h, i, j, k) =>
- {
- var subject = new AsyncSubject<TResult>();
- try
- {
- begin(x, y, z, a, b, c, d, e, f, g, h, i, j, k, iar =>
- {
- // See remark on FromAsyncPattern<TResult>.
- TResult result;
- try
- {
- result = end(iar);
- }
- catch (Exception exception)
- {
- subject.OnError(exception);
- return;
- }
- subject.OnNext(result);
- subject.OnCompleted();
- }, null);
- }
- catch (Exception exception)
- {
- return Observable.Throw<TResult>(exception, SchedulerDefaults.AsyncConversions);
- }
- return subject.AsObservable();
- };
- }
-#endif
-
- #endregion
-
- #region Action
-
- public virtual Func<IObservable<Unit>> FromAsyncPattern(Func<AsyncCallback, object, IAsyncResult> begin, Action<IAsyncResult> end)
- {
- return FromAsyncPattern(begin, iar =>
- {
- end(iar);
- return Unit.Default;
- });
- }
-
- public virtual Func<T1, IObservable<Unit>> FromAsyncPattern<T1>(Func<T1, AsyncCallback, object, IAsyncResult> begin, Action<IAsyncResult> end)
- {
- return FromAsyncPattern(begin, iar =>
- {
- end(iar);
- return Unit.Default;
- });
- }
-
- public virtual Func<T1, T2, IObservable<Unit>> FromAsyncPattern<T1, T2>(Func<T1, T2, AsyncCallback, object, IAsyncResult> begin, Action<IAsyncResult> end)
- {
- return FromAsyncPattern(begin, iar =>
- {
- end(iar);
- return Unit.Default;
- });
- }
-
-#if !NO_LARGEARITY
- public virtual Func<T1, T2, T3, IObservable<Unit>> FromAsyncPattern<T1, T2, T3>(Func<T1, T2, T3, AsyncCallback, object, IAsyncResult> begin, Action<IAsyncResult> end)
- {
- return FromAsyncPattern(begin, iar =>
- {
- end(iar);
- return Unit.Default;
- });
- }
-
- public virtual Func<T1, T2, T3, T4, IObservable<Unit>> FromAsyncPattern<T1, T2, T3, T4>(Func<T1, T2, T3, T4, AsyncCallback, object, IAsyncResult> begin, Action<IAsyncResult> end)
- {
- return FromAsyncPattern(begin, iar =>
- {
- end(iar);
- return Unit.Default;
- });
- }
-
- public virtual Func<T1, T2, T3, T4, T5, IObservable<Unit>> FromAsyncPattern<T1, T2, T3, T4, T5>(Func<T1, T2, T3, T4, T5, AsyncCallback, object, IAsyncResult> begin, Action<IAsyncResult> end)
- {
- return FromAsyncPattern(begin, iar =>
- {
- end(iar);
- return Unit.Default;
- });
- }
-
- public virtual Func<T1, T2, T3, T4, T5, T6, IObservable<Unit>> FromAsyncPattern<T1, T2, T3, T4, T5, T6>(Func<T1, T2, T3, T4, T5, T6, AsyncCallback, object, IAsyncResult> begin, Action<IAsyncResult> end)
- {
- return FromAsyncPattern(begin, iar =>
- {
- end(iar);
- return Unit.Default;
- });
- }
-
- public virtual Func<T1, T2, T3, T4, T5, T6, T7, IObservable<Unit>> FromAsyncPattern<T1, T2, T3, T4, T5, T6, T7>(Func<T1, T2, T3, T4, T5, T6, T7, AsyncCallback, object, IAsyncResult> begin, Action<IAsyncResult> end)
- {
- return FromAsyncPattern(begin, iar =>
- {
- end(iar);
- return Unit.Default;
- });
- }
-
- public virtual Func<T1, T2, T3, T4, T5, T6, T7, T8, IObservable<Unit>> FromAsyncPattern<T1, T2, T3, T4, T5, T6, T7, T8>(Func<T1, T2, T3, T4, T5, T6, T7, T8, AsyncCallback, object, IAsyncResult> begin, Action<IAsyncResult> end)
- {
- return FromAsyncPattern(begin, iar =>
- {
- end(iar);
- return Unit.Default;
- });
- }
-
- public virtual Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, IObservable<Unit>> FromAsyncPattern<T1, T2, T3, T4, T5, T6, T7, T8, T9>(Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, AsyncCallback, object, IAsyncResult> begin, Action<IAsyncResult> end)
- {
- return FromAsyncPattern(begin, iar =>
- {
- end(iar);
- return Unit.Default;
- });
- }
-
- public virtual Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, IObservable<Unit>> FromAsyncPattern<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, AsyncCallback, object, IAsyncResult> begin, Action<IAsyncResult> end)
- {
- return FromAsyncPattern(begin, iar =>
- {
- end(iar);
- return Unit.Default;
- });
- }
-
- public virtual Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, IObservable<Unit>> FromAsyncPattern<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>(Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, AsyncCallback, object, IAsyncResult> begin, Action<IAsyncResult> end)
- {
- return FromAsyncPattern(begin, iar =>
- {
- end(iar);
- return Unit.Default;
- });
- }
-
- public virtual Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, IObservable<Unit>> FromAsyncPattern<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>(Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, AsyncCallback, object, IAsyncResult> begin, Action<IAsyncResult> end)
- {
- return FromAsyncPattern(begin, iar =>
- {
- end(iar);
- return Unit.Default;
- });
- }
-
- public virtual Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, IObservable<Unit>> FromAsyncPattern<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>(Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, AsyncCallback, object, IAsyncResult> begin, Action<IAsyncResult> end)
- {
- return FromAsyncPattern(begin, iar =>
- {
- end(iar);
- return Unit.Default;
- });
- }
-
- public virtual Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, IObservable<Unit>> FromAsyncPattern<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>(Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, AsyncCallback, object, IAsyncResult> begin, Action<IAsyncResult> end)
- {
- return FromAsyncPattern(begin, iar =>
- {
- end(iar);
- return Unit.Default;
- });
- }
-#endif
-
- #endregion
-
- #endregion
-
- #region Start[Async]
-
- #region Func
-
- public virtual IObservable<TSource> Start<TSource>(Func<TSource> function)
- {
- return ToAsync(function)();
- }
-
- public virtual IObservable<TSource> Start<TSource>(Func<TSource> function, IScheduler scheduler)
- {
- return ToAsync(function, scheduler)();
- }
-
-#if !NO_TPL
- public virtual IObservable<TSource> StartAsync<TSource>(Func<Task<TSource>> functionAsync)
- {
- var task = default(Task<TSource>);
- try
- {
- task = functionAsync();
- }
- catch (Exception exception)
- {
- return Throw<TSource>(exception);
- }
-
- return task.ToObservable();
- }
-
- public virtual IObservable<TSource> StartAsync<TSource>(Func<CancellationToken, Task<TSource>> functionAsync)
- {
- var cancellable = new CancellationDisposable();
-
- var task = default(Task<TSource>);
- try
- {
- task = functionAsync(cancellable.Token);
- }
- catch (Exception exception)
- {
- return Throw<TSource>(exception);
- }
-
- var result = task.ToObservable();
-
- return new AnonymousObservable<TSource>(observer =>
- {
- //
- // [OK] Use of unsafe Subscribe: result is an AsyncSubject<TSource>.
- //
- var subscription = result.Subscribe/*Unsafe*/(observer);
- return new CompositeDisposable(cancellable, subscription);
- });
- }
-#endif
-
- #endregion
-
- #region Action
-
- public virtual IObservable<Unit> Start(Action action)
- {
- return ToAsync(action, SchedulerDefaults.AsyncConversions)();
- }
-
- public virtual IObservable<Unit> Start(Action action, IScheduler scheduler)
- {
- return ToAsync(action, scheduler)();
- }
-
-#if !NO_TPL
- public virtual IObservable<Unit> StartAsync(Func<Task> actionAsync)
- {
- var task = default(Task);
- try
- {
- task = actionAsync();
- }
- catch (Exception exception)
- {
- return Throw<Unit>(exception);
- }
-
- return task.ToObservable();
- }
-
- public virtual IObservable<Unit> StartAsync(Func<CancellationToken, Task> actionAsync)
- {
- var cancellable = new CancellationDisposable();
-
- var task = default(Task);
- try
- {
- task = actionAsync(cancellable.Token);
- }
- catch (Exception exception)
- {
- return Throw<Unit>(exception);
- }
-
- var result = task.ToObservable();
-
- return new AnonymousObservable<Unit>(observer =>
- {
- //
- // [OK] Use of unsafe Subscribe: result is an AsyncSubject<TSource>.
- //
- var subscription = result.Subscribe/*Unsafe*/(observer);
- return new CompositeDisposable(cancellable, subscription);
- });
- }
-#endif
-
- #endregion
-
- #endregion
-
- #region FromAsync
-
-#if !NO_TPL
-
- #region Func
-
- public virtual IObservable<TResult> FromAsync<TResult>(Func<Task<TResult>> functionAsync)
- {
- return Defer(() => StartAsync(functionAsync));
- }
-
- public virtual IObservable<TResult> FromAsync<TResult>(Func<CancellationToken, Task<TResult>> functionAsync)
- {
- return Defer(() => StartAsync(functionAsync));
- }
-
- #endregion
-
- #region Action
-
- public virtual IObservable<Unit> FromAsync(Func<Task> actionAsync)
- {
- return Defer(() => StartAsync(actionAsync));
- }
-
- public virtual IObservable<Unit> FromAsync(Func<CancellationToken, Task> actionAsync)
- {
- return Defer(() => StartAsync(actionAsync));
- }
-
- #endregion
-
-#endif
-
- #endregion
-
- #region ToAsync
-
- #region Func
-
- public virtual Func<IObservable<TResult>> ToAsync<TResult>(Func<TResult> function)
- {
- return ToAsync(function, SchedulerDefaults.AsyncConversions);
- }
-
- public virtual Func<IObservable<TResult>> ToAsync<TResult>(Func<TResult> function, IScheduler scheduler)
- {
- return () =>
- {
- var subject = new AsyncSubject<TResult>();
- scheduler.Schedule(() =>
- {
- var result = default(TResult);
- try
- {
- result = function();
- }
- catch (Exception exception)
- {
- subject.OnError(exception);
- return;
- }
- subject.OnNext(result);
- subject.OnCompleted();
- });
- return subject.AsObservable();
- };
- }
-
- public virtual Func<T, IObservable<TResult>> ToAsync<T, TResult>(Func<T, TResult> function)
- {
- return ToAsync(function, SchedulerDefaults.AsyncConversions);
- }
-
- public virtual Func<T, IObservable<TResult>> ToAsync<T, TResult>(Func<T, TResult> function, IScheduler scheduler)
- {
- return (first) =>
- {
- var subject = new AsyncSubject<TResult>();
- scheduler.Schedule(() =>
- {
- var result = default(TResult);
- try
- {
- result = function(first);
- }
- catch (Exception exception)
- {
- subject.OnError(exception);
- return;
- }
- subject.OnNext(result);
- subject.OnCompleted();
- });
- return subject.AsObservable();
- };
- }
-
- public virtual Func<T1, T2, IObservable<TResult>> ToAsync<T1, T2, TResult>(Func<T1, T2, TResult> function)
- {
- return ToAsync(function, SchedulerDefaults.AsyncConversions);
- }
-
- public virtual Func<T1, T2, IObservable<TResult>> ToAsync<T1, T2, TResult>(Func<T1, T2, TResult> function, IScheduler scheduler)
- {
- return (first, second) =>
- {
- var subject = new AsyncSubject<TResult>();
- scheduler.Schedule(() =>
- {
- var result = default(TResult);
- try
- {
- result = function(first, second);
- }
- catch (Exception exception)
- {
- subject.OnError(exception);
- return;
- }
- subject.OnNext(result);
- subject.OnCompleted();
- });
- return subject.AsObservable();
- };
- }
-
- public virtual Func<T1, T2, T3, IObservable<TResult>> ToAsync<T1, T2, T3, TResult>(Func<T1, T2, T3, TResult> function)
- {
- return ToAsync(function, SchedulerDefaults.AsyncConversions);
- }
-
- public virtual Func<T1, T2, T3, IObservable<TResult>> ToAsync<T1, T2, T3, TResult>(Func<T1, T2, T3, TResult> function, IScheduler scheduler)
- {
- return (first, second, third) =>
- {
- var subject = new AsyncSubject<TResult>();
- scheduler.Schedule(() =>
- {
- var result = default(TResult);
- try
- {
- result = function(first, second, third);
- }
- catch (Exception exception)
- {
- subject.OnError(exception);
- return;
- }
- subject.OnNext(result);
- subject.OnCompleted();
- });
- return subject.AsObservable();
- };
- }
-
- public virtual Func<T1, T2, T3, T4, IObservable<TResult>> ToAsync<T1, T2, T3, T4, TResult>(Func<T1, T2, T3, T4, TResult> function)
- {
- return ToAsync(function, SchedulerDefaults.AsyncConversions);
- }
-
- public virtual Func<T1, T2, T3, T4, IObservable<TResult>> ToAsync<T1, T2, T3, T4, TResult>(Func<T1, T2, T3, T4, TResult> function, IScheduler scheduler)
- {
- return (first, second, third, fourth) =>
- {
- var subject = new AsyncSubject<TResult>();
- scheduler.Schedule(() =>
- {
- var result = default(TResult);
- try
- {
- result = function(first, second, third, fourth);
- }
- catch (Exception exception)
- {
- subject.OnError(exception);
- return;
- }
- subject.OnNext(result);
- subject.OnCompleted();
- });
- return subject.AsObservable();
- };
- }
-
-#if !NO_LARGEARITY
-
- public virtual Func<T1, T2, T3, T4, T5, IObservable<TResult>> ToAsync<T1, T2, T3, T4, T5, TResult>(Func<T1, T2, T3, T4, T5, TResult> function)
- {
- return ToAsync(function, SchedulerDefaults.AsyncConversions);
- }
-
- public virtual Func<T1, T2, T3, T4, T5, IObservable<TResult>> ToAsync<T1, T2, T3, T4, T5, TResult>(Func<T1, T2, T3, T4, T5, TResult> function, IScheduler scheduler)
- {
- return (first, second, third, fourth, fifth) =>
- {
- var subject = new AsyncSubject<TResult>();
- scheduler.Schedule(() =>
- {
- var result = default(TResult);
- try
- {
- result = function(first, second, third, fourth, fifth);
- }
- catch (Exception exception)
- {
- subject.OnError(exception);
- return;
- }
- subject.OnNext(result);
- subject.OnCompleted();
- });
- return subject.AsObservable();
- };
- }
-
- public virtual Func<T1, T2, T3, T4, T5, T6, IObservable<TResult>> ToAsync<T1, T2, T3, T4, T5, T6, TResult>(Func<T1, T2, T3, T4, T5, T6, TResult> function)
- {
- return ToAsync(function, SchedulerDefaults.AsyncConversions);
- }
-
- public virtual Func<T1, T2, T3, T4, T5, T6, IObservable<TResult>> ToAsync<T1, T2, T3, T4, T5, T6, TResult>(Func<T1, T2, T3, T4, T5, T6, TResult> function, IScheduler scheduler)
- {
- return (first, second, third, fourth, fifth, sixth) =>
- {
- var subject = new AsyncSubject<TResult>();
- scheduler.Schedule(() =>
- {
- var result = default(TResult);
- try
- {
- result = function(first, second, third, fourth, fifth, sixth);
- }
- catch (Exception exception)
- {
- subject.OnError(exception);
- return;
- }
- subject.OnNext(result);
- subject.OnCompleted();
- });
- return subject.AsObservable();
- };
- }
-
- public virtual Func<T1, T2, T3, T4, T5, T6, T7, IObservable<TResult>> ToAsync<T1, T2, T3, T4, T5, T6, T7, TResult>(Func<T1, T2, T3, T4, T5, T6, T7, TResult> function)
- {
- return ToAsync(function, SchedulerDefaults.AsyncConversions);
- }
-
- public virtual Func<T1, T2, T3, T4, T5, T6, T7, IObservable<TResult>> ToAsync<T1, T2, T3, T4, T5, T6, T7, TResult>(Func<T1, T2, T3, T4, T5, T6, T7, TResult> function, IScheduler scheduler)
- {
- return (first, second, third, fourth, fifth, sixth, seventh) =>
- {
- var subject = new AsyncSubject<TResult>();
- scheduler.Schedule(() =>
- {
- var result = default(TResult);
- try
- {
- result = function(first, second, third, fourth, fifth, sixth, seventh);
- }
- catch (Exception exception)
- {
- subject.OnError(exception);
- return;
- }
- subject.OnNext(result);
- subject.OnCompleted();
- });
- return subject.AsObservable();
- };
- }
-
- public virtual Func<T1, T2, T3, T4, T5, T6, T7, T8, IObservable<TResult>> ToAsync<T1, T2, T3, T4, T5, T6, T7, T8, TResult>(Func<T1, T2, T3, T4, T5, T6, T7, T8, TResult> function)
- {
- return ToAsync(function, SchedulerDefaults.AsyncConversions);
- }
-
- public virtual Func<T1, T2, T3, T4, T5, T6, T7, T8, IObservable<TResult>> ToAsync<T1, T2, T3, T4, T5, T6, T7, T8, TResult>(Func<T1, T2, T3, T4, T5, T6, T7, T8, TResult> function, IScheduler scheduler)
- {
- return (first, second, third, fourth, fifth, sixth, seventh, eight) =>
- {
- var subject = new AsyncSubject<TResult>();
- scheduler.Schedule(() =>
- {
- var result = default(TResult);
- try
- {
- result = function(first, second, third, fourth, fifth, sixth, seventh, eight);
- }
- catch (Exception exception)
- {
- subject.OnError(exception);
- return;
- }
- subject.OnNext(result);
- subject.OnCompleted();
- });
- return subject.AsObservable();
- };
- }
-
- public virtual Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, IObservable<TResult>> ToAsync<T1, T2, T3, T4, T5, T6, T7, T8, T9, TResult>(Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, TResult> function)
- {
- return ToAsync(function, SchedulerDefaults.AsyncConversions);
- }
-
- public virtual Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, IObservable<TResult>> ToAsync<T1, T2, T3, T4, T5, T6, T7, T8, T9, TResult>(Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, TResult> function, IScheduler scheduler)
- {
- return (first, second, third, fourth, fifth, sixth, seventh, eight, ninth) =>
- {
- var subject = new AsyncSubject<TResult>();
- scheduler.Schedule(() =>
- {
- var result = default(TResult);
- try
- {
- result = function(first, second, third, fourth, fifth, sixth, seventh, eight, ninth);
- }
- catch (Exception exception)
- {
- subject.OnError(exception);
- return;
- }
- subject.OnNext(result);
- subject.OnCompleted();
- });
- return subject.AsObservable();
- };
- }
-
- public virtual Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, IObservable<TResult>> ToAsync<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, TResult>(Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, TResult> function)
- {
- return ToAsync(function, SchedulerDefaults.AsyncConversions);
- }
-
- public virtual Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, IObservable<TResult>> ToAsync<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, TResult>(Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, TResult> function, IScheduler scheduler)
- {
- return (first, second, third, fourth, fifth, sixth, seventh, eight, ninth, tenth) =>
- {
- var subject = new AsyncSubject<TResult>();
- scheduler.Schedule(() =>
- {
- var result = default(TResult);
- try
- {
- result = function(first, second, third, fourth, fifth, sixth, seventh, eight, ninth, tenth);
- }
- catch (Exception exception)
- {
- subject.OnError(exception);
- return;
- }
- subject.OnNext(result);
- subject.OnCompleted();
- });
- return subject.AsObservable();
- };
- }
-
- public virtual Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, IObservable<TResult>> ToAsync<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, TResult>(Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, TResult> function)
- {
- return ToAsync(function, SchedulerDefaults.AsyncConversions);
- }
-
- public virtual Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, IObservable<TResult>> ToAsync<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, TResult>(Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, TResult> function, IScheduler scheduler)
- {
- return (first, second, third, fourth, fifth, sixth, seventh, eight, ninth, tenth, eleventh) =>
- {
- var subject = new AsyncSubject<TResult>();
- scheduler.Schedule(() =>
- {
- var result = default(TResult);
- try
- {
- result = function(first, second, third, fourth, fifth, sixth, seventh, eight, ninth, tenth, eleventh);
- }
- catch (Exception exception)
- {
- subject.OnError(exception);
- return;
- }
- subject.OnNext(result);
- subject.OnCompleted();
- });
- return subject.AsObservable();
- };
- }
-
- public virtual Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, IObservable<TResult>> ToAsync<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, TResult>(Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, TResult> function)
- {
- return ToAsync(function, SchedulerDefaults.AsyncConversions);
- }
-
- public virtual Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, IObservable<TResult>> ToAsync<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, TResult>(Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, TResult> function, IScheduler scheduler)
- {
- return (first, second, third, fourth, fifth, sixth, seventh, eight, ninth, tenth, eleventh, twelfth) =>
- {
- var subject = new AsyncSubject<TResult>();
- scheduler.Schedule(() =>
- {
- var result = default(TResult);
- try
- {
- result = function(first, second, third, fourth, fifth, sixth, seventh, eight, ninth, tenth, eleventh, twelfth);
- }
- catch (Exception exception)
- {
- subject.OnError(exception);
- return;
- }
- subject.OnNext(result);
- subject.OnCompleted();
- });
- return subject.AsObservable();
- };
- }
-
- public virtual Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, IObservable<TResult>> ToAsync<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, TResult>(Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, TResult> function)
- {
- return ToAsync(function, SchedulerDefaults.AsyncConversions);
- }
-
- public virtual Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, IObservable<TResult>> ToAsync<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, TResult>(Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, TResult> function, IScheduler scheduler)
- {
- return (first, second, third, fourth, fifth, sixth, seventh, eight, ninth, tenth, eleventh, twelfth, thirteenth) =>
- {
- var subject = new AsyncSubject<TResult>();
- scheduler.Schedule(() =>
- {
- var result = default(TResult);
- try
- {
- result = function(first, second, third, fourth, fifth, sixth, seventh, eight, ninth, tenth, eleventh, twelfth, thirteenth);
- }
- catch (Exception exception)
- {
- subject.OnError(exception);
- return;
- }
- subject.OnNext(result);
- subject.OnCompleted();
- });
- return subject.AsObservable();
- };
- }
-
- public virtual Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, IObservable<TResult>> ToAsync<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, TResult>(Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, TResult> function)
- {
- return ToAsync(function, SchedulerDefaults.AsyncConversions);
- }
-
- public virtual Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, IObservable<TResult>> ToAsync<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, TResult>(Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, TResult> function, IScheduler scheduler)
- {
- return (first, second, third, fourth, fifth, sixth, seventh, eight, ninth, tenth, eleventh, twelfth, thirteenth, fourteenth) =>
- {
- var subject = new AsyncSubject<TResult>();
- scheduler.Schedule(() =>
- {
- var result = default(TResult);
- try
- {
- result = function(first, second, third, fourth, fifth, sixth, seventh, eight, ninth, tenth, eleventh, twelfth, thirteenth, fourteenth);
- }
- catch (Exception exception)
- {
- subject.OnError(exception);
- return;
- }
- subject.OnNext(result);
- subject.OnCompleted();
- });
- return subject.AsObservable();
- };
- }
-
- public virtual Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, IObservable<TResult>> ToAsync<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, TResult>(Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, TResult> function)
- {
- return ToAsync(function, SchedulerDefaults.AsyncConversions);
- }
-
- public virtual Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, IObservable<TResult>> ToAsync<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, TResult>(Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, TResult> function, IScheduler scheduler)
- {
- return (first, second, third, fourth, fifth, sixth, seventh, eight, ninth, tenth, eleventh, twelfth, thirteenth, fourteenth, fifteenth) =>
- {
- var subject = new AsyncSubject<TResult>();
- scheduler.Schedule(() =>
- {
- var result = default(TResult);
- try
- {
- result = function(first, second, third, fourth, fifth, sixth, seventh, eight, ninth, tenth, eleventh, twelfth, thirteenth, fourteenth, fifteenth);
- }
- catch (Exception exception)
- {
- subject.OnError(exception);
- return;
- }
- subject.OnNext(result);
- subject.OnCompleted();
- });
- return subject.AsObservable();
- };
- }
-
- public virtual Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, IObservable<TResult>> ToAsync<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, TResult>(Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, TResult> function)
- {
- return ToAsync(function, SchedulerDefaults.AsyncConversions);
- }
-
- public virtual Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, IObservable<TResult>> ToAsync<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, TResult>(Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, TResult> function, IScheduler scheduler)
- {
- return (first, second, third, fourth, fifth, sixth, seventh, eight, ninth, tenth, eleventh, twelfth, thirteenth, fourteenth, fifteenth, sixteenth) =>
- {
- var subject = new AsyncSubject<TResult>();
- scheduler.Schedule(() =>
- {
- var result = default(TResult);
- try
- {
- result = function(first, second, third, fourth, fifth, sixth, seventh, eight, ninth, tenth, eleventh, twelfth, thirteenth, fourteenth, fifteenth, sixteenth);
- }
- catch (Exception exception)
- {
- subject.OnError(exception);
- return;
- }
- subject.OnNext(result);
- subject.OnCompleted();
- });
- return subject.AsObservable();
- };
- }
-
-#endif
-
- #endregion
-
- #region Action
-
- public virtual Func<IObservable<Unit>> ToAsync(Action action)
- {
- return ToAsync(action, SchedulerDefaults.AsyncConversions);
- }
-
- public virtual Func<IObservable<Unit>> ToAsync(Action action, IScheduler scheduler)
- {
- return () =>
- {
- var subject = new AsyncSubject<Unit>();
- scheduler.Schedule(() =>
- {
- try
- {
- action();
- }
- catch (Exception exception)
- {
- subject.OnError(exception);
- return;
- }
- subject.OnNext(Unit.Default);
- subject.OnCompleted();
- });
-
- return subject.AsObservable();
- };
- }
-
- public virtual Func<TSource, IObservable<Unit>> ToAsync<TSource>(Action<TSource> action)
- {
- return ToAsync(action, SchedulerDefaults.AsyncConversions);
- }
-
- public virtual Func<TSource, IObservable<Unit>> ToAsync<TSource>(Action<TSource> action, IScheduler scheduler)
- {
- return (first) =>
- {
- var subject = new AsyncSubject<Unit>();
- scheduler.Schedule(() =>
- {
- try
- {
- action(first);
- }
- catch (Exception exception)
- {
- subject.OnError(exception);
- return;
- }
- subject.OnNext(Unit.Default);
- subject.OnCompleted();
- });
- return subject.AsObservable();
- };
- }
-
- public virtual Func<T1, T2, IObservable<Unit>> ToAsync<T1, T2>(Action<T1, T2> action)
- {
- return ToAsync(action, SchedulerDefaults.AsyncConversions);
- }
-
- public virtual Func<T1, T2, IObservable<Unit>> ToAsync<T1, T2>(Action<T1, T2> action, IScheduler scheduler)
- {
- return (first, second) =>
- {
- var subject = new AsyncSubject<Unit>();
- scheduler.Schedule(() =>
- {
- try
- {
- action(first, second);
- }
- catch (Exception exception)
- {
- subject.OnError(exception);
- return;
- }
- subject.OnNext(Unit.Default);
- subject.OnCompleted();
- });
- return subject.AsObservable();
- };
- }
-
- public virtual Func<T1, T2, T3, IObservable<Unit>> ToAsync<T1, T2, T3>(Action<T1, T2, T3> action)
- {
- return ToAsync(action, SchedulerDefaults.AsyncConversions);
- }
-
- public virtual Func<T1, T2, T3, IObservable<Unit>> ToAsync<T1, T2, T3>(Action<T1, T2, T3> action, IScheduler scheduler)
- {
- return (first, second, third) =>
- {
- var subject = new AsyncSubject<Unit>();
- scheduler.Schedule(() =>
- {
- try
- {
- action(first, second, third);
- }
- catch (Exception exception)
- {
- subject.OnError(exception);
- return;
- }
- subject.OnNext(Unit.Default);
- subject.OnCompleted();
- });
- return subject.AsObservable();
- };
- }
-
- public virtual Func<T1, T2, T3, T4, IObservable<Unit>> ToAsync<T1, T2, T3, T4>(Action<T1, T2, T3, T4> action)
- {
- return ToAsync(action, SchedulerDefaults.AsyncConversions);
- }
-
- public virtual Func<T1, T2, T3, T4, IObservable<Unit>> ToAsync<T1, T2, T3, T4>(Action<T1, T2, T3, T4> action, IScheduler scheduler)
- {
- return (first, second, third, fourth) =>
- {
- var subject = new AsyncSubject<Unit>();
- scheduler.Schedule(() =>
- {
- try
- {
- action(first, second, third, fourth);
- }
- catch (Exception exception)
- {
- subject.OnError(exception);
- return;
- }
- subject.OnNext(Unit.Default);
- subject.OnCompleted();
- });
- return subject.AsObservable();
- };
- }
-
-#if !NO_LARGEARITY
-
- public virtual Func<T1, T2, T3, T4, T5, IObservable<Unit>> ToAsync<T1, T2, T3, T4, T5>(Action<T1, T2, T3, T4, T5> action)
- {
- return ToAsync(action, SchedulerDefaults.AsyncConversions);
- }
-
- public virtual Func<T1, T2, T3, T4, T5, IObservable<Unit>> ToAsync<T1, T2, T3, T4, T5>(Action<T1, T2, T3, T4, T5> action, IScheduler scheduler)
- {
- return (first, second, third, fourth, fifth) =>
- {
- var subject = new AsyncSubject<Unit>();
- scheduler.Schedule(() =>
- {
- try
- {
- action(first, second, third, fourth, fifth);
- }
- catch (Exception exception)
- {
- subject.OnError(exception);
- return;
- }
- subject.OnNext(Unit.Default);
- subject.OnCompleted();
- });
- return subject.AsObservable();
- };
- }
-
- public virtual Func<T1, T2, T3, T4, T5, T6, IObservable<Unit>> ToAsync<T1, T2, T3, T4, T5, T6>(Action<T1, T2, T3, T4, T5, T6> action)
- {
- return ToAsync(action, SchedulerDefaults.AsyncConversions);
- }
-
- public virtual Func<T1, T2, T3, T4, T5, T6, IObservable<Unit>> ToAsync<T1, T2, T3, T4, T5, T6>(Action<T1, T2, T3, T4, T5, T6> action, IScheduler scheduler)
- {
- return (first, second, third, fourth, fifth, sixth) =>
- {
- var subject = new AsyncSubject<Unit>();
- scheduler.Schedule(() =>
- {
- try
- {
- action(first, second, third, fourth, fifth, sixth);
- }
- catch (Exception exception)
- {
- subject.OnError(exception);
- return;
- }
- subject.OnNext(Unit.Default);
- subject.OnCompleted();
- });
- return subject.AsObservable();
- };
- }
-
- public virtual Func<T1, T2, T3, T4, T5, T6, T7, IObservable<Unit>> ToAsync<T1, T2, T3, T4, T5, T6, T7>(Action<T1, T2, T3, T4, T5, T6, T7> action)
- {
- return ToAsync(action, SchedulerDefaults.AsyncConversions);
- }
-
- public virtual Func<T1, T2, T3, T4, T5, T6, T7, IObservable<Unit>> ToAsync<T1, T2, T3, T4, T5, T6, T7>(Action<T1, T2, T3, T4, T5, T6, T7> action, IScheduler scheduler)
- {
- return (first, second, third, fourth, fifth, sixth, seventh) =>
- {
- var subject = new AsyncSubject<Unit>();
- scheduler.Schedule(() =>
- {
- try
- {
- action(first, second, third, fourth, fifth, sixth, seventh);
- }
- catch (Exception exception)
- {
- subject.OnError(exception);
- return;
- }
- subject.OnNext(Unit.Default);
- subject.OnCompleted();
- });
- return subject.AsObservable();
- };
- }
-
- public virtual Func<T1, T2, T3, T4, T5, T6, T7, T8, IObservable<Unit>> ToAsync<T1, T2, T3, T4, T5, T6, T7, T8>(Action<T1, T2, T3, T4, T5, T6, T7, T8> action)
- {
- return ToAsync(action, SchedulerDefaults.AsyncConversions);
- }
-
- public virtual Func<T1, T2, T3, T4, T5, T6, T7, T8, IObservable<Unit>> ToAsync<T1, T2, T3, T4, T5, T6, T7, T8>(Action<T1, T2, T3, T4, T5, T6, T7, T8> action, IScheduler scheduler)
- {
- return (first, second, third, fourth, fifth, sixth, seventh, eight) =>
- {
- var subject = new AsyncSubject<Unit>();
- scheduler.Schedule(() =>
- {
- try
- {
- action(first, second, third, fourth, fifth, sixth, seventh, eight);
- }
- catch (Exception exception)
- {
- subject.OnError(exception);
- return;
- }
- subject.OnNext(Unit.Default);
- subject.OnCompleted();
- });
- return subject.AsObservable();
- };
- }
-
- public virtual Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, IObservable<Unit>> ToAsync<T1, T2, T3, T4, T5, T6, T7, T8, T9>(Action<T1, T2, T3, T4, T5, T6, T7, T8, T9> action)
- {
- return ToAsync(action, SchedulerDefaults.AsyncConversions);
- }
-
- public virtual Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, IObservable<Unit>> ToAsync<T1, T2, T3, T4, T5, T6, T7, T8, T9>(Action<T1, T2, T3, T4, T5, T6, T7, T8, T9> action, IScheduler scheduler)
- {
- return (first, second, third, fourth, fifth, sixth, seventh, eighth, ninth) =>
- {
- var subject = new AsyncSubject<Unit>();
- scheduler.Schedule(() =>
- {
- try
- {
- action(first, second, third, fourth, fifth, sixth, seventh, eighth, ninth);
- }
- catch (Exception exception)
- {
- subject.OnError(exception);
- return;
- }
- subject.OnNext(Unit.Default);
- subject.OnCompleted();
- });
- return subject.AsObservable();
- };
- }
-
- public virtual Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, IObservable<Unit>> ToAsync<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> action)
- {
- return ToAsync(action, SchedulerDefaults.AsyncConversions);
- }
-
- public virtual Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, IObservable<Unit>> ToAsync<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> action, IScheduler scheduler)
- {
- return (first, second, third, fourth, fifth, sixth, seventh, eighth, ninth, tenth) =>
- {
- var subject = new AsyncSubject<Unit>();
- scheduler.Schedule(() =>
- {
- try
- {
- action(first, second, third, fourth, fifth, sixth, seventh, eighth, ninth, tenth);
- }
- catch (Exception exception)
- {
- subject.OnError(exception);
- return;
- }
- subject.OnNext(Unit.Default);
- subject.OnCompleted();
- });
- return subject.AsObservable();
- };
- }
-
- public virtual Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, IObservable<Unit>> ToAsync<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>(Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> action)
- {
- return ToAsync(action, SchedulerDefaults.AsyncConversions);
- }
-
- public virtual Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, IObservable<Unit>> ToAsync<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>(Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> action, IScheduler scheduler)
- {
- return (first, second, third, fourth, fifth, sixth, seventh, eighth, ninth, tenth, eleventh) =>
- {
- var subject = new AsyncSubject<Unit>();
- scheduler.Schedule(() =>
- {
- try
- {
- action(first, second, third, fourth, fifth, sixth, seventh, eighth, ninth, tenth, eleventh);
- }
- catch (Exception exception)
- {
- subject.OnError(exception);
- return;
- }
- subject.OnNext(Unit.Default);
- subject.OnCompleted();
- });
- return subject.AsObservable();
- };
- }
-
- public virtual Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, IObservable<Unit>> ToAsync<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>(Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> action)
- {
- return ToAsync(action, SchedulerDefaults.AsyncConversions);
- }
-
- public virtual Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, IObservable<Unit>> ToAsync<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>(Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> action, IScheduler scheduler)
- {
- return (first, second, third, fourth, fifth, sixth, seventh, eighth, ninth, tenth, eleventh, twelfth) =>
- {
- var subject = new AsyncSubject<Unit>();
- scheduler.Schedule(() =>
- {
- try
- {
- action(first, second, third, fourth, fifth, sixth, seventh, eighth, ninth, tenth, eleventh, twelfth);
- }
- catch (Exception exception)
- {
- subject.OnError(exception);
- return;
- }
- subject.OnNext(Unit.Default);
- subject.OnCompleted();
- });
- return subject.AsObservable();
- };
- }
-
- public virtual Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, IObservable<Unit>> ToAsync<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>(Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> action)
- {
- return ToAsync(action, SchedulerDefaults.AsyncConversions);
- }
-
- public virtual Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, IObservable<Unit>> ToAsync<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>(Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> action, IScheduler scheduler)
- {
- return (first, second, third, fourth, fifth, sixth, seventh, eighth, ninth, tenth, eleventh, twelfth, thirteenth) =>
- {
- var subject = new AsyncSubject<Unit>();
- scheduler.Schedule(() =>
- {
- try
- {
- action(first, second, third, fourth, fifth, sixth, seventh, eighth, ninth, tenth, eleventh, twelfth, thirteenth);
- }
- catch (Exception exception)
- {
- subject.OnError(exception);
- return;
- }
- subject.OnNext(Unit.Default);
- subject.OnCompleted();
- });
- return subject.AsObservable();
- };
- }
-
- public virtual Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, IObservable<Unit>> ToAsync<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>(Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> action)
- {
- return ToAsync(action, SchedulerDefaults.AsyncConversions);
- }
-
- public virtual Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, IObservable<Unit>> ToAsync<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>(Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> action, IScheduler scheduler)
- {
- return (first, second, third, fourth, fifth, sixth, seventh, eighth, ninth, tenth, eleventh, twelfth, thirteenth, fourteenth) =>
- {
- var subject = new AsyncSubject<Unit>();
- scheduler.Schedule(() =>
- {
- try
- {
- action(first, second, third, fourth, fifth, sixth, seventh, eighth, ninth, tenth, eleventh, twelfth, thirteenth, fourteenth);
- }
- catch (Exception exception)
- {
- subject.OnError(exception);
- return;
- }
- subject.OnNext(Unit.Default);
- subject.OnCompleted();
- });
- return subject.AsObservable();
- };
- }
-
- public virtual Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, IObservable<Unit>> ToAsync<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>(Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> action)
- {
- return ToAsync(action, SchedulerDefaults.AsyncConversions);
- }
-
- public virtual Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, IObservable<Unit>> ToAsync<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>(Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> action, IScheduler scheduler)
- {
- return (first, second, third, fourth, fifth, sixth, seventh, eighth, ninth, tenth, eleventh, twelfth, thirteenth, fourteenth, fifteenth) =>
- {
- var subject = new AsyncSubject<Unit>();
- scheduler.Schedule(() =>
- {
- try
- {
- action(first, second, third, fourth, fifth, sixth, seventh, eighth, ninth, tenth, eleventh, twelfth, thirteenth, fourteenth, fifteenth);
- }
- catch (Exception exception)
- {
- subject.OnError(exception);
- return;
- }
- subject.OnNext(Unit.Default);
- subject.OnCompleted();
- });
- return subject.AsObservable();
- };
- }
-
- public virtual Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, IObservable<Unit>> ToAsync<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16>(Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16> action)
- {
- return ToAsync(action, SchedulerDefaults.AsyncConversions);
- }
-
- public virtual Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, IObservable<Unit>> ToAsync<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16>(Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16> action, IScheduler scheduler)
- {
- return (first, second, third, fourth, fifth, sixth, seventh, eighth, ninth, tenth, eleventh, twelfth, thirteenth, fourteenth, fifteenth, sixteenth) =>
- {
- var subject = new AsyncSubject<Unit>();
- scheduler.Schedule(() =>
- {
- try
- {
- action(first, second, third, fourth, fifth, sixth, seventh, eighth, ninth, tenth, eleventh, twelfth, thirteenth, fourteenth, fifteenth, sixteenth);
- }
- catch (Exception exception)
- {
- subject.OnError(exception);
- return;
- }
- subject.OnNext(Unit.Default);
- subject.OnCompleted();
- });
- return subject.AsObservable();
- };
- }
-
-#endif
-
- #endregion
-
- #endregion
- }
-}
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/QueryLanguage.Awaiter.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/QueryLanguage.Awaiter.cs
deleted file mode 100644
index 6a48bf0..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/QueryLanguage.Awaiter.cs
+++ /dev/null
@@ -1,64 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if HAS_AWAIT
-using System.Threading;
-using System.Reactive.Disposables;
-using System.Reactive.Subjects;
-
-namespace System.Reactive.Linq
-{
- internal partial class QueryLanguage
- {
- public virtual AsyncSubject<TSource> GetAwaiter<TSource>(IObservable<TSource> source)
- {
- var s = new AsyncSubject<TSource>();
- source.SubscribeSafe(s);
- return s;
- }
-
- public virtual AsyncSubject<TSource> GetAwaiter<TSource>(IConnectableObservable<TSource> source)
- {
- var s = new AsyncSubject<TSource>();
- source.SubscribeSafe(s);
- source.Connect();
- return s;
- }
-
- public virtual AsyncSubject<TSource> RunAsync<TSource>(IObservable<TSource> source, CancellationToken cancellationToken)
- {
- var s = new AsyncSubject<TSource>();
-
- var cancel = new Action(() => s.OnError(new OperationCanceledException()));
- if (cancellationToken.IsCancellationRequested)
- {
- cancel();
- return s;
- }
-
- var d = source.SubscribeSafe(s);
- cancellationToken.Register(d.Dispose);
- cancellationToken.Register(cancel);
-
- return s;
- }
-
- public virtual AsyncSubject<TSource> RunAsync<TSource>(IConnectableObservable<TSource> source, CancellationToken cancellationToken)
- {
- var s = new AsyncSubject<TSource>();
-
- var cancel = new Action(() => s.OnError(new OperationCanceledException()));
- if (cancellationToken.IsCancellationRequested)
- {
- cancel();
- return s;
- }
-
- var d = new CompositeDisposable(source.SubscribeSafe(s), source.Connect());
- cancellationToken.Register(d.Dispose);
- cancellationToken.Register(cancel);
-
- return s;
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/QueryLanguage.Binding.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/QueryLanguage.Binding.cs
deleted file mode 100644
index d9a96ba..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/QueryLanguage.Binding.cs
+++ /dev/null
@@ -1,158 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System.Reactive.Concurrency;
-using System.Reactive.Disposables;
-using System.Reactive.Subjects;
-
-namespace System.Reactive.Linq
-{
- using Observαble;
-
- internal partial class QueryLanguage
- {
- #region + Multicast +
-
- public virtual IConnectableObservable<TResult> Multicast<TSource, TResult>(IObservable<TSource> source, ISubject<TSource, TResult> subject)
- {
- return new ConnectableObservable<TSource, TResult>(source, subject);
- }
-
- public virtual IObservable<TResult> Multicast<TSource, TIntermediate, TResult>(IObservable<TSource> source, Func<ISubject<TSource, TIntermediate>> subjectSelector, Func<IObservable<TIntermediate>, IObservable<TResult>> selector)
- {
- return new Multicast<TSource, TIntermediate, TResult>(source, subjectSelector, selector);
- }
-
- #endregion
-
- #region + Publish +
-
- public virtual IConnectableObservable<TSource> Publish<TSource>(IObservable<TSource> source)
- {
- return source.Multicast(new Subject<TSource>());
- }
-
- public virtual IObservable<TResult> Publish<TSource, TResult>(IObservable<TSource> source, Func<IObservable<TSource>, IObservable<TResult>> selector)
- {
- return source.Multicast(() => new Subject<TSource>(), selector);
- }
-
- public virtual IConnectableObservable<TSource> Publish<TSource>(IObservable<TSource> source, TSource initialValue)
- {
- return source.Multicast(new BehaviorSubject<TSource>(initialValue));
- }
-
- public virtual IObservable<TResult> Publish<TSource, TResult>(IObservable<TSource> source, Func<IObservable<TSource>, IObservable<TResult>> selector, TSource initialValue)
- {
- return source.Multicast(() => new BehaviorSubject<TSource>(initialValue), selector);
- }
-
- #endregion
-
- #region + PublishLast +
-
- public virtual IConnectableObservable<TSource> PublishLast<TSource>(IObservable<TSource> source)
- {
- return source.Multicast(new AsyncSubject<TSource>());
- }
-
- public virtual IObservable<TResult> PublishLast<TSource, TResult>(IObservable<TSource> source, Func<IObservable<TSource>, IObservable<TResult>> selector)
- {
- return source.Multicast(() => new AsyncSubject<TSource>(), selector);
- }
-
- #endregion
-
- #region + RefCount +
-
- public virtual IObservable<TSource> RefCount<TSource>(IConnectableObservable<TSource> source)
- {
- return new RefCount<TSource>(source);
- }
-
- #endregion
-
- #region + Replay +
-
- public virtual IConnectableObservable<TSource> Replay<TSource>(IObservable<TSource> source)
- {
- return source.Multicast(new ReplaySubject<TSource>());
- }
-
- public virtual IConnectableObservable<TSource> Replay<TSource>(IObservable<TSource> source, IScheduler scheduler)
- {
- return source.Multicast(new ReplaySubject<TSource>(scheduler));
- }
-
- public virtual IObservable<TResult> Replay<TSource, TResult>(IObservable<TSource> source, Func<IObservable<TSource>, IObservable<TResult>> selector)
- {
- return source.Multicast(() => new ReplaySubject<TSource>(), selector);
- }
-
- public virtual IObservable<TResult> Replay<TSource, TResult>(IObservable<TSource> source, Func<IObservable<TSource>, IObservable<TResult>> selector, IScheduler scheduler)
- {
- return source.Multicast(() => new ReplaySubject<TSource>(scheduler), selector);
- }
-
- public virtual IConnectableObservable<TSource> Replay<TSource>(IObservable<TSource> source, TimeSpan window)
- {
- return source.Multicast(new ReplaySubject<TSource>(window));
- }
-
- public virtual IObservable<TResult> Replay<TSource, TResult>(IObservable<TSource> source, Func<IObservable<TSource>, IObservable<TResult>> selector, TimeSpan window)
- {
- return source.Multicast(() => new ReplaySubject<TSource>(window), selector);
- }
-
- public virtual IConnectableObservable<TSource> Replay<TSource>(IObservable<TSource> source, TimeSpan window, IScheduler scheduler)
- {
- return source.Multicast(new ReplaySubject<TSource>(window, scheduler));
- }
-
- public virtual IObservable<TResult> Replay<TSource, TResult>(IObservable<TSource> source, Func<IObservable<TSource>, IObservable<TResult>> selector, TimeSpan window, IScheduler scheduler)
- {
- return source.Multicast(() => new ReplaySubject<TSource>(window, scheduler), selector);
- }
-
- public virtual IConnectableObservable<TSource> Replay<TSource>(IObservable<TSource> source, int bufferSize, IScheduler scheduler)
- {
- return source.Multicast(new ReplaySubject<TSource>(bufferSize, scheduler));
- }
-
- public virtual IObservable<TResult> Replay<TSource, TResult>(IObservable<TSource> source, Func<IObservable<TSource>, IObservable<TResult>> selector, int bufferSize, IScheduler scheduler)
- {
- return source.Multicast(() => new ReplaySubject<TSource>(bufferSize, scheduler), selector);
- }
-
- public virtual IConnectableObservable<TSource> Replay<TSource>(IObservable<TSource> source, int bufferSize)
- {
- return source.Multicast(new ReplaySubject<TSource>(bufferSize));
- }
-
- public virtual IObservable<TResult> Replay<TSource, TResult>(IObservable<TSource> source, Func<IObservable<TSource>, IObservable<TResult>> selector, int bufferSize)
- {
- return source.Multicast(() => new ReplaySubject<TSource>(bufferSize), selector);
- }
-
- public virtual IConnectableObservable<TSource> Replay<TSource>(IObservable<TSource> source, int bufferSize, TimeSpan window)
- {
- return source.Multicast(new ReplaySubject<TSource>(bufferSize, window));
- }
-
- public virtual IObservable<TResult> Replay<TSource, TResult>(IObservable<TSource> source, Func<IObservable<TSource>, IObservable<TResult>> selector, int bufferSize, TimeSpan window)
- {
- return source.Multicast(() => new ReplaySubject<TSource>(bufferSize, window), selector);
- }
-
- public virtual IConnectableObservable<TSource> Replay<TSource>(IObservable<TSource> source, int bufferSize, TimeSpan window, IScheduler scheduler)
- {
- return source.Multicast(new ReplaySubject<TSource>(bufferSize, window, scheduler));
- }
-
- public virtual IObservable<TResult> Replay<TSource, TResult>(IObservable<TSource> source, Func<IObservable<TSource>, IObservable<TResult>> selector, int bufferSize, TimeSpan window, IScheduler scheduler)
- {
- return source.Multicast(() => new ReplaySubject<TSource>(bufferSize, window, scheduler), selector);
- }
-
- #endregion
- }
-}
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/QueryLanguage.Blocking.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/QueryLanguage.Blocking.cs
deleted file mode 100644
index 2b37006..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/QueryLanguage.Blocking.cs
+++ /dev/null
@@ -1,464 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System.Collections;
-using System.Collections.Generic;
-using System.Threading;
-using System.Reactive.Disposables;
-
-#if NO_SEMAPHORE
-using System.Reactive.Threading;
-#endif
-
-namespace System.Reactive.Linq
-{
-#if !NO_PERF
- using Observαble;
-#endif
-
- internal partial class QueryLanguage
- {
- #region - Chunkify -
-
- public virtual IEnumerable<IList<TSource>> Chunkify<TSource>(IObservable<TSource> source)
- {
- return source.Collect<TSource, IList<TSource>>(() => new List<TSource>(), (lst, x) => { lst.Add(x); return lst; }, _ => new List<TSource>());
- }
-
- #endregion
-
- #region + Collect +
-
- public virtual IEnumerable<TResult> Collect<TSource, TResult>(IObservable<TSource> source, Func<TResult> newCollector, Func<TResult, TSource, TResult> merge)
- {
- return Collect_<TSource, TResult>(source, newCollector, merge, _ => newCollector());
- }
-
- public virtual IEnumerable<TResult> Collect<TSource, TResult>(IObservable<TSource> source, Func<TResult> getInitialCollector, Func<TResult, TSource, TResult> merge, Func<TResult, TResult> getNewCollector)
- {
- return Collect_<TSource, TResult>(source, getInitialCollector, merge, getNewCollector);
- }
-
- private static IEnumerable<TResult> Collect_<TSource, TResult>(IObservable<TSource> source, Func<TResult> getInitialCollector, Func<TResult, TSource, TResult> merge, Func<TResult, TResult> getNewCollector)
- {
-#if !NO_PERF
- return new Collect<TSource, TResult>(source, getInitialCollector, merge, getNewCollector);
-#else
- return new AnonymousEnumerable<TResult>(() =>
- {
- var c = getInitialCollector();
- var f = default(Notification<TSource>);
- var o = new object();
- var done = false;
- return PushToPull<TSource, TResult>(
- source,
- x =>
- {
- lock (o)
- {
- if (x.HasValue)
- {
- try
- {
- c = merge(c, x.Value);
- }
- catch (Exception ex)
- {
- f = Notification.CreateOnError<TSource>(ex);
- }
- }
- else
- f = x;
- }
- },
- () =>
- {
- if (f != null)
- {
- if (f.Kind == NotificationKind.OnError)
- {
- return Notification.CreateOnError<TResult>(f.Exception);
- }
- else
- {
- if (done)
- return Notification.CreateOnCompleted<TResult>();
- else
- done = true;
- }
- }
-
- var l = default(TResult);
- lock (o)
- {
- l = c;
- c = getNewCollector(c);
- }
-
- return Notification.CreateOnNext(l);
- }
- );
- });
-#endif
- }
-
- #endregion
-
- #region First
-
- public virtual TSource First<TSource>(IObservable<TSource> source)
- {
- return FirstOrDefaultInternal(source, true);
- }
-
- public virtual TSource First<TSource>(IObservable<TSource> source, Func<TSource, bool> predicate)
- {
- return First(Where(source, predicate));
- }
-
- #endregion
-
- #region FirstOrDefault
-
- public virtual TSource FirstOrDefault<TSource>(IObservable<TSource> source)
- {
- return FirstOrDefaultInternal(source, false);
- }
-
- public virtual TSource FirstOrDefault<TSource>(IObservable<TSource> source, Func<TSource, bool> predicate)
- {
- return FirstOrDefault(Where(source, predicate));
- }
-
- private static TSource FirstOrDefaultInternal<TSource>(IObservable<TSource> source, bool throwOnEmpty)
- {
- var value = default(TSource);
- var seenValue = false;
- var ex = default(Exception);
- var evt = new ManualResetEvent(false);
-
- //
- // [OK] Use of unsafe Subscribe: fine to throw to our caller, behavior indistinguishable from going through the sink.
- //
- using (source.Subscribe/*Unsafe*/(new AnonymousObserver<TSource>(
- v =>
- {
- if (!seenValue)
- {
- value = v;
- }
- seenValue = true;
- evt.Set();
- },
- e =>
- {
- ex = e;
- evt.Set();
- },
- () =>
- {
- evt.Set();
- })))
- {
- evt.WaitOne();
- }
-
- ex.ThrowIfNotNull();
-
- if (throwOnEmpty && !seenValue)
- throw new InvalidOperationException(Strings_Linq.NO_ELEMENTS);
-
- return value;
- }
-
- #endregion
-
- #region + ForEach +
-
- public virtual void ForEach<TSource>(IObservable<TSource> source, Action<TSource> onNext)
- {
-#if !NO_PERF
- var evt = new ManualResetEvent(false);
- var sink = new ForEach<TSource>._(onNext, () => evt.Set());
-
- using (source.SubscribeSafe(sink))
- {
- evt.WaitOne();
- }
-
- sink.Error.ThrowIfNotNull();
-#else
- ForEach_(source, onNext);
-#endif
- }
-
- public virtual void ForEach<TSource>(IObservable<TSource> source, Action<TSource, int> onNext)
- {
-#if !NO_PERF
- var evt = new ManualResetEvent(false);
- var sink = new ForEach<TSource>.τ(onNext, () => evt.Set());
-
- using (source.SubscribeSafe(sink))
- {
- evt.WaitOne();
- }
-
- sink.Error.ThrowIfNotNull();
-#else
- var i = 0;
- ForEach_(source, x => onNext(x, checked(i++)));
-#endif
- }
-
-#if NO_PERF
- private static void ForEach_<TSource>(IObservable<TSource> source, Action<TSource> onNext)
- {
- var exception = default(Exception);
-
- var evt = new ManualResetEvent(false);
- using (source.Subscribe(
- x =>
- {
- try
- {
- onNext(x);
- }
- catch (Exception ex)
- {
- exception = ex;
- evt.Set();
- }
- },
- ex =>
- {
- exception = ex;
- evt.Set();
- },
- () => evt.Set()
- ))
- {
- evt.WaitOne();
- }
-
- if (exception != null)
- exception.Throw();
- }
-#endif
-
- #endregion
-
- #region + GetEnumerator +
-
- public virtual IEnumerator<TSource> GetEnumerator<TSource>(IObservable<TSource> source)
- {
-#if !NO_PERF && !NO_CDS
- var e = new GetEnumerator<TSource>();
- return e.Run(source);
-#else
- var q = new Queue<Notification<TSource>>();
- var s = new Semaphore(0, int.MaxValue);
- return PushToPull(
- source,
- x =>
- {
- lock (q)
- q.Enqueue(x);
- s.Release();
- },
- () =>
- {
- s.WaitOne();
- lock (q)
- return q.Dequeue();
- });
-#endif
- }
-
- #endregion
-
- #region Last
-
- public virtual TSource Last<TSource>(IObservable<TSource> source)
- {
- return LastOrDefaultInternal(source, true);
- }
-
- public virtual TSource Last<TSource>(IObservable<TSource> source, Func<TSource, bool> predicate)
- {
- return Last(Where(source, predicate));
- }
-
- #endregion
-
- #region LastOrDefault
-
- public virtual TSource LastOrDefault<TSource>(IObservable<TSource> source)
- {
- return LastOrDefaultInternal(source, false);
- }
-
- public virtual TSource LastOrDefault<TSource>(IObservable<TSource> source, Func<TSource, bool> predicate)
- {
- return LastOrDefault(Where(source, predicate));
- }
-
- private static TSource LastOrDefaultInternal<TSource>(IObservable<TSource> source, bool throwOnEmpty)
- {
- var value = default(TSource);
- var seenValue = false;
- var ex = default(Exception);
- var evt = new ManualResetEvent(false);
-
- //
- // [OK] Use of unsafe Subscribe: fine to throw to our caller, behavior indistinguishable from going through the sink.
- //
- using (source.Subscribe/*Unsafe*/(new AnonymousObserver<TSource>(
- v =>
- {
- seenValue = true;
- value = v;
- },
- e =>
- {
- ex = e;
- evt.Set();
- },
- () =>
- {
- evt.Set();
- })))
- {
- evt.WaitOne();
- }
-
- ex.ThrowIfNotNull();
-
- if (throwOnEmpty && !seenValue)
- throw new InvalidOperationException(Strings_Linq.NO_ELEMENTS);
-
- return value;
- }
-
- #endregion
-
- #region + Latest +
-
- public virtual IEnumerable<TSource> Latest<TSource>(IObservable<TSource> source)
- {
- return new Latest<TSource>(source);
- }
-
- #endregion
-
- #region + MostRecent +
-
- public virtual IEnumerable<TSource> MostRecent<TSource>(IObservable<TSource> source, TSource initialValue)
- {
- return new MostRecent<TSource>(source, initialValue);
- }
-
- #endregion
-
- #region + Next +
-
- public virtual IEnumerable<TSource> Next<TSource>(IObservable<TSource> source)
- {
- return new Next<TSource>(source);
- }
-
- #endregion
-
- #region Single
-
- public virtual TSource Single<TSource>(IObservable<TSource> source)
- {
- return SingleOrDefaultInternal(source, true);
- }
-
- public virtual TSource Single<TSource>(IObservable<TSource> source, Func<TSource, bool> predicate)
- {
- return Single(Where(source, predicate));
- }
-
- #endregion
-
- #region SingleOrDefault
-
- public virtual TSource SingleOrDefault<TSource>(IObservable<TSource> source)
- {
- return SingleOrDefaultInternal(source, false);
- }
-
- public virtual TSource SingleOrDefault<TSource>(IObservable<TSource> source, Func<TSource, bool> predicate)
- {
- return SingleOrDefault(Where(source, predicate));
- }
-
- private static TSource SingleOrDefaultInternal<TSource>(IObservable<TSource> source, bool throwOnEmpty)
- {
- var value = default(TSource);
- var seenValue = false;
- var ex = default(Exception);
- var evt = new ManualResetEvent(false);
-
- //
- // [OK] Use of unsafe Subscribe: fine to throw to our caller, behavior indistinguishable from going through the sink.
- //
- using (source.Subscribe/*Unsafe*/(new AnonymousObserver<TSource>(
- v =>
- {
- if (seenValue)
- {
- ex = new InvalidOperationException(Strings_Linq.MORE_THAN_ONE_ELEMENT);
- evt.Set();
- }
-
- value = v;
- seenValue = true;
- },
- e =>
- {
- ex = e;
- evt.Set();
- },
- () =>
- {
- evt.Set();
- })))
- {
- evt.WaitOne();
- }
-
- ex.ThrowIfNotNull();
-
- if (throwOnEmpty && !seenValue)
- throw new InvalidOperationException(Strings_Linq.NO_ELEMENTS);
-
- return value;
- }
-
- #endregion
-
- #region Wait
-
- public virtual TSource Wait<TSource>(IObservable<TSource> source)
- {
- return LastOrDefaultInternal(source, true);
- }
-
- #endregion
-
- #region |> Helpers <|
-
-#if NO_CDS || NO_PERF
- private static IEnumerator<TResult> PushToPull<TSource, TResult>(IObservable<TSource> source, Action<Notification<TSource>> push, Func<Notification<TResult>> pull)
- {
- var subscription = new SingleAssignmentDisposable();
- var adapter = new PushPullAdapter<TSource, TResult>(push, pull, subscription.Dispose);
- subscription.Disposable = source.SubscribeSafe(adapter);
- return adapter;
- }
-#endif
-
- #endregion
- }
-}
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/QueryLanguage.Concurrency.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/QueryLanguage.Concurrency.cs
deleted file mode 100644
index 58408b2..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/QueryLanguage.Concurrency.cs
+++ /dev/null
@@ -1,61 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System.Reactive.Concurrency;
-using System.Reactive.Disposables;
-using System.Threading;
-
-namespace System.Reactive.Linq
-{
-#if !NO_PERF
- using Observαble;
-#endif
-
- internal partial class QueryLanguage
- {
- #region + ObserveOn +
-
- public virtual IObservable<TSource> ObserveOn<TSource>(IObservable<TSource> source, IScheduler scheduler)
- {
- return Synchronization.ObserveOn<TSource>(source, scheduler);
- }
-
-#if !NO_SYNCCTX
- public virtual IObservable<TSource> ObserveOn<TSource>(IObservable<TSource> source, SynchronizationContext context)
- {
- return Synchronization.ObserveOn<TSource>(source, context);
- }
-#endif
-
- #endregion
-
- #region + SubscribeOn +
-
- public virtual IObservable<TSource> SubscribeOn<TSource>(IObservable<TSource> source, IScheduler scheduler)
- {
- return Synchronization.SubscribeOn<TSource>(source, scheduler);
- }
-
-#if !NO_SYNCCTX
- public virtual IObservable<TSource> SubscribeOn<TSource>(IObservable<TSource> source, SynchronizationContext context)
- {
- return Synchronization.SubscribeOn<TSource>(source, context);
- }
-#endif
-
- #endregion
-
- #region + Synchronize +
-
- public virtual IObservable<TSource> Synchronize<TSource>(IObservable<TSource> source)
- {
- return Synchronization.Synchronize(source);
- }
-
- public virtual IObservable<TSource> Synchronize<TSource>(IObservable<TSource> source, object gate)
- {
- return Synchronization.Synchronize(source, gate);
- }
-
- #endregion
- }
-}
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/QueryLanguage.Conversions.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/QueryLanguage.Conversions.cs
deleted file mode 100644
index c75b379..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/QueryLanguage.Conversions.cs
+++ /dev/null
@@ -1,159 +0,0 @@
-
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-using System.Collections.Generic;
-using System.Reactive.Concurrency;
-using System.Reactive.Disposables;
-
-namespace System.Reactive.Linq
-{
-#if !NO_PERF
- using Observαble;
-#endif
-
- internal partial class QueryLanguage
- {
- #region + Subscribe +
-
- public virtual IDisposable Subscribe<TSource>(IEnumerable<TSource> source, IObserver<TSource> observer)
- {
- return Subscribe_<TSource>(source, observer, SchedulerDefaults.Iteration);
- }
-
- public virtual IDisposable Subscribe<TSource>(IEnumerable<TSource> source, IObserver<TSource> observer, IScheduler scheduler)
- {
- return Subscribe_<TSource>(source, observer, scheduler);
- }
-
- private static IDisposable Subscribe_<TSource>(IEnumerable<TSource> source, IObserver<TSource> observer, IScheduler scheduler)
- {
-#if !NO_PERF
- //
- // [OK] Use of unsafe Subscribe: we're calling into a known producer implementation.
- //
- return new ToObservable<TSource>(source, scheduler).Subscribe/*Unsafe*/(observer);
-#else
- var e = source.GetEnumerator();
- var flag = new BooleanDisposable();
-
- scheduler.Schedule(self =>
- {
- var hasNext = false;
- var ex = default(Exception);
- var current = default(TSource);
-
- if (flag.IsDisposed)
- {
- e.Dispose();
- return;
- }
-
- try
- {
- hasNext = e.MoveNext();
- if (hasNext)
- current = e.Current;
- }
- catch (Exception exception)
- {
- ex = exception;
- }
-
- if (!hasNext || ex != null)
- {
- e.Dispose();
- }
-
- if (ex != null)
- {
- observer.OnError(ex);
- return;
- }
-
- if (!hasNext)
- {
- observer.OnCompleted();
- return;
- }
-
- observer.OnNext(current);
- self();
- });
-
- return flag;
-#endif
- }
-
- #endregion
-
- #region + ToEnumerable +
-
- public virtual IEnumerable<TSource> ToEnumerable<TSource>(IObservable<TSource> source)
- {
- return new AnonymousEnumerable<TSource>(() => source.GetEnumerator());
- }
-
- #endregion
-
- #region ToEvent
-
- public virtual IEventSource<Unit> ToEvent(IObservable<Unit> source)
- {
- return new EventSource<Unit>(source, (h, _) => h(Unit.Default));
- }
-
- public virtual IEventSource<TSource> ToEvent<TSource>(IObservable<TSource> source)
- {
- return new EventSource<TSource>(source, (h, value) => h(value));
- }
-
- #endregion
-
- #region ToEventPattern
-
- public virtual IEventPatternSource<TEventArgs> ToEventPattern<TEventArgs>(IObservable<EventPattern<TEventArgs>> source)
-#if !NO_EVENTARGS_CONSTRAINT
- where TEventArgs : EventArgs
-#endif
- {
- return new EventPatternSource<TEventArgs>(
-#if !NO_VARIANCE
- source,
-#else
- source.Select(x => (EventPattern<object, TEventArgs>)x),
-#endif
- (h, evt) => h(evt.Sender, evt.EventArgs)
- );
- }
-
- #endregion
-
- #region + ToObservable +
-
- public virtual IObservable<TSource> ToObservable<TSource>(IEnumerable<TSource> source)
- {
-#if !NO_PERF
- return new ToObservable<TSource>(source, SchedulerDefaults.Iteration);
-#else
- return ToObservable_(source, SchedulerDefaults.Iteration);
-#endif
- }
-
- public virtual IObservable<TSource> ToObservable<TSource>(IEnumerable<TSource> source, IScheduler scheduler)
- {
-#if !NO_PERF
- return new ToObservable<TSource>(source, scheduler);
-#else
- return ToObservable_(source, scheduler);
-#endif
- }
-
-#if NO_PERF
- private static IObservable<TSource> ToObservable_<TSource>(IEnumerable<TSource> source, IScheduler scheduler)
- {
- return new AnonymousObservable<TSource>(observer => source.Subscribe(observer, scheduler));
- }
-#endif
-
- #endregion
- }
-}
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/QueryLanguage.Creation.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/QueryLanguage.Creation.cs
deleted file mode 100644
index 4aa25b2..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/QueryLanguage.Creation.cs
+++ /dev/null
@@ -1,462 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System.Collections.Generic;
-using System.Reactive.Concurrency;
-using System.Reactive.Disposables;
-using System.Threading;
-using System.Linq;
-
-#if !NO_TPL
-using System.Reactive.Threading.Tasks;
-using System.Threading.Tasks;
-#endif
-
-namespace System.Reactive.Linq
-{
-#if !NO_PERF
- using Observαble;
-#endif
-
- internal partial class QueryLanguage
- {
- #region - Create -
-
- public virtual IObservable<TSource> Create<TSource>(Func<IObserver<TSource>, IDisposable> subscribe)
- {
- return new AnonymousObservable<TSource>(subscribe);
- }
-
- public virtual IObservable<TSource> Create<TSource>(Func<IObserver<TSource>, Action> subscribe)
- {
- return new AnonymousObservable<TSource>(o =>
- {
- var a = subscribe(o);
- return a != null ? Disposable.Create(a) : Disposable.Empty;
- });
- }
-
- #endregion
-
- #region - CreateAsync -
-
-#if !NO_TPL
- public virtual IObservable<TResult> Create<TResult>(Func<IObserver<TResult>, CancellationToken, Task> subscribeAsync)
- {
- return new AnonymousObservable<TResult>(observer =>
- {
- var cancellable = new CancellationDisposable();
-
- var taskObservable = subscribeAsync(observer, cancellable.Token).ToObservable();
- var taskCompletionObserver = new AnonymousObserver<Unit>(Stubs<Unit>.Ignore, observer.OnError, observer.OnCompleted);
- var subscription = taskObservable.Subscribe(taskCompletionObserver);
-
- return new CompositeDisposable(cancellable, subscription);
- });
- }
-
- public virtual IObservable<TResult> Create<TResult>(Func<IObserver<TResult>, Task> subscribeAsync)
- {
- return Create<TResult>((observer, token) => subscribeAsync(observer));
- }
-
- public virtual IObservable<TResult> Create<TResult>(Func<IObserver<TResult>, CancellationToken, Task<IDisposable>> subscribeAsync)
- {
- return new AnonymousObservable<TResult>(observer =>
- {
- var subscription = new SingleAssignmentDisposable();
- var cancellable = new CancellationDisposable();
-
- var taskObservable = subscribeAsync(observer, cancellable.Token).ToObservable();
- var taskCompletionObserver = new AnonymousObserver<IDisposable>(d => subscription.Disposable = d ?? Disposable.Empty, observer.OnError, Stubs.Nop);
-
- //
- // We don't cancel the subscription below *ever* and want to make sure the returned resource gets disposed eventually.
- // Notice because we're using the AnonymousObservable<T> type, we get auto-detach behavior for free.
- //
- taskObservable.Subscribe(taskCompletionObserver);
-
- return new CompositeDisposable(cancellable, subscription);
- });
- }
-
- public virtual IObservable<TResult> Create<TResult>(Func<IObserver<TResult>, Task<IDisposable>> subscribeAsync)
- {
- return Create<TResult>((observer, token) => subscribeAsync(observer));
- }
-
- public virtual IObservable<TResult> Create<TResult>(Func<IObserver<TResult>, CancellationToken, Task<Action>> subscribeAsync)
- {
- return new AnonymousObservable<TResult>(observer =>
- {
- var subscription = new SingleAssignmentDisposable();
- var cancellable = new CancellationDisposable();
-
- var taskObservable = subscribeAsync(observer, cancellable.Token).ToObservable();
- var taskCompletionObserver = new AnonymousObserver<Action>(a => subscription.Disposable = a != null ? Disposable.Create(a) : Disposable.Empty, observer.OnError, Stubs.Nop);
-
- //
- // We don't cancel the subscription below *ever* and want to make sure the returned resource eventually gets disposed.
- // Notice because we're using the AnonymousObservable<T> type, we get auto-detach behavior for free.
- //
- taskObservable.Subscribe(taskCompletionObserver);
-
- return new CompositeDisposable(cancellable, subscription);
- });
- }
-
- public virtual IObservable<TResult> Create<TResult>(Func<IObserver<TResult>, Task<Action>> subscribeAsync)
- {
- return Create<TResult>((observer, token) => subscribeAsync(observer));
- }
-#endif
-
- #endregion
-
- #region + Defer +
-
- public virtual IObservable<TValue> Defer<TValue>(Func<IObservable<TValue>> observableFactory)
- {
-#if !NO_PERF
- return new Defer<TValue>(observableFactory);
-#else
- return new AnonymousObservable<TValue>(observer =>
- {
- IObservable<TValue> result;
- try
- {
- result = observableFactory();
- }
- catch (Exception exception)
- {
- return Throw<TValue>(exception).Subscribe(observer);
- }
-
- return result.Subscribe(observer);
- });
-#endif
- }
-
- #endregion
-
- #region + DeferAsync +
-
-#if !NO_TPL
- public virtual IObservable<TValue> Defer<TValue>(Func<Task<IObservable<TValue>>> observableFactoryAsync)
- {
- return Defer(() => StartAsync(observableFactoryAsync).Merge());
- }
-
- public virtual IObservable<TValue> Defer<TValue>(Func<CancellationToken, Task<IObservable<TValue>>> observableFactoryAsync)
- {
- return Defer(() => StartAsync(observableFactoryAsync).Merge());
- }
-#endif
-
- #endregion
-
- #region + Empty +
-
- public virtual IObservable<TResult> Empty<TResult>()
- {
-#if !NO_PERF
- return new Empty<TResult>(SchedulerDefaults.ConstantTimeOperations);
-#else
- return Empty_<TResult>(SchedulerDefaults.ConstantTimeOperations);
-#endif
- }
-
- public virtual IObservable<TResult> Empty<TResult>(IScheduler scheduler)
- {
-#if !NO_PERF
- return new Empty<TResult>(scheduler);
-#else
- return Empty_<TResult>(scheduler);
-#endif
- }
-
-#if NO_PERF
- private static IObservable<TResult> Empty_<TResult>(IScheduler scheduler)
- {
- return new AnonymousObservable<TResult>(observer => scheduler.Schedule(observer.OnCompleted));
- }
-#endif
-
- #endregion
-
- #region + Generate +
-
- public virtual IObservable<TResult> Generate<TState, TResult>(TState initialState, Func<TState, bool> condition, Func<TState, TState> iterate, Func<TState, TResult> resultSelector)
- {
-#if !NO_PERF
- return new Generate<TState, TResult>(initialState, condition, iterate, resultSelector, SchedulerDefaults.Iteration);
-#else
- return Generate_<TState, TResult>(initialState, condition, iterate, resultSelector, SchedulerDefaults.Iteration);
-#endif
- }
-
- public virtual IObservable<TResult> Generate<TState, TResult>(TState initialState, Func<TState, bool> condition, Func<TState, TState> iterate, Func<TState, TResult> resultSelector, IScheduler scheduler)
- {
-#if !NO_PERF
- return new Generate<TState, TResult>(initialState, condition, iterate, resultSelector, scheduler);
-#else
- return Generate_<TState, TResult>(initialState, condition, iterate, resultSelector, scheduler);
-#endif
- }
-
-#if NO_PERF
- private static IObservable<TResult> Generate_<TState, TResult>(TState initialState, Func<TState, bool> condition, Func<TState, TState> iterate, Func<TState, TResult> resultSelector, IScheduler scheduler)
- {
- return new AnonymousObservable<TResult>(observer =>
- {
- var state = initialState;
- var first = true;
- return scheduler.Schedule(self =>
- {
- var hasResult = false;
- var result = default(TResult);
- try
- {
- if (first)
- first = false;
- else
- state = iterate(state);
- hasResult = condition(state);
- if (hasResult)
- result = resultSelector(state);
- }
- catch (Exception exception)
- {
- observer.OnError(exception);
- return;
- }
-
- if (hasResult)
- {
- observer.OnNext(result);
- self();
- }
- else
- observer.OnCompleted();
- });
- });
- }
-#endif
-
- #endregion
-
- #region + Never +
-
- public virtual IObservable<TResult> Never<TResult>()
- {
-#if !NO_PERF
- return new Never<TResult>();
-#else
- return new AnonymousObservable<TResult>(observer => Disposable.Empty);
-#endif
- }
-
- #endregion
-
- #region + Range +
-
- public virtual IObservable<int> Range(int start, int count)
- {
- return Range_(start, count, SchedulerDefaults.Iteration);
- }
-
- public virtual IObservable<int> Range(int start, int count, IScheduler scheduler)
- {
- return Range_(start, count, scheduler);
- }
-
- private static IObservable<int> Range_(int start, int count, IScheduler scheduler)
- {
-#if !NO_PERF
- return new Range(start, count, scheduler);
-#else
- return new AnonymousObservable<int>(observer =>
- {
- return scheduler.Schedule(0, (i, self) =>
- {
- if (i < count)
- {
- observer.OnNext(start + i);
- self(i + 1);
- }
- else
- observer.OnCompleted();
- });
- });
-#endif
- }
-
- #endregion
-
- #region + Repeat +
-
- public virtual IObservable<TResult> Repeat<TResult>(TResult value)
- {
-#if !NO_PERF
- return new Repeat<TResult>(value, null, SchedulerDefaults.Iteration);
-#else
- return Repeat_(value, SchedulerDefaults.Iteration);
-#endif
- }
-
- public virtual IObservable<TResult> Repeat<TResult>(TResult value, IScheduler scheduler)
- {
-#if !NO_PERF
- return new Repeat<TResult>(value, null, scheduler);
-#else
- return Repeat_<TResult>(value, scheduler);
-#endif
- }
-
-#if NO_PERF
- private IObservable<TResult> Repeat_<TResult>(TResult value, IScheduler scheduler)
- {
- return Return(value, scheduler).Repeat();
- }
-#endif
-
- public virtual IObservable<TResult> Repeat<TResult>(TResult value, int repeatCount)
- {
-#if !NO_PERF
- return new Repeat<TResult>(value, repeatCount, SchedulerDefaults.Iteration);
-#else
- return Repeat_(value, repeatCount, SchedulerDefaults.Iteration);
-#endif
- }
-
- public virtual IObservable<TResult> Repeat<TResult>(TResult value, int repeatCount, IScheduler scheduler)
- {
-#if !NO_PERF
- return new Repeat<TResult>(value, repeatCount, scheduler);
-#else
- return Repeat_(value, repeatCount, scheduler);
-#endif
- }
-
-#if NO_PERF
- private IObservable<TResult> Repeat_<TResult>(TResult value, int repeatCount, IScheduler scheduler)
- {
- return Return(value, scheduler).Repeat(repeatCount);
- }
-#endif
-
- #endregion
-
- #region + Return +
-
- public virtual IObservable<TResult> Return<TResult>(TResult value)
- {
-#if !NO_PERF
- return new Return<TResult>(value, SchedulerDefaults.ConstantTimeOperations);
-#else
- return Return_<TResult>(value, SchedulerDefaults.ConstantTimeOperations);
-#endif
- }
-
- public virtual IObservable<TResult> Return<TResult>(TResult value, IScheduler scheduler)
- {
-#if !NO_PERF
- return new Return<TResult>(value, scheduler);
-#else
- return Return_<TResult>(value, scheduler);
-#endif
- }
-
-#if NO_PERF
- private static IObservable<TResult> Return_<TResult>(TResult value, IScheduler scheduler)
- {
- return new AnonymousObservable<TResult>(observer =>
- scheduler.Schedule(() =>
- {
- observer.OnNext(value);
- observer.OnCompleted();
- })
- );
- }
-#endif
-
- #endregion
-
- #region + Throw +
-
- public virtual IObservable<TResult> Throw<TResult>(Exception exception)
- {
-#if !NO_PERF
- return new Throw<TResult>(exception, SchedulerDefaults.ConstantTimeOperations);
-#else
- return Throw_<TResult>(exception, SchedulerDefaults.ConstantTimeOperations);
-#endif
- }
-
- public virtual IObservable<TResult> Throw<TResult>(Exception exception, IScheduler scheduler)
- {
-#if !NO_PERF
- return new Throw<TResult>(exception, scheduler);
-#else
- return Throw_<TResult>(exception, scheduler);
-#endif
- }
-
-#if NO_PERF
- private static IObservable<TResult> Throw_<TResult>(Exception exception, IScheduler scheduler)
- {
- return new AnonymousObservable<TResult>(observer => scheduler.Schedule(() => observer.OnError(exception)));
- }
-#endif
-
- #endregion
-
- #region + Using +
-
- public virtual IObservable<TSource> Using<TSource, TResource>(Func<TResource> resourceFactory, Func<TResource, IObservable<TSource>> observableFactory) where TResource : IDisposable
- {
-#if !NO_PERF
- return new Using<TSource, TResource>(resourceFactory, observableFactory);
-#else
- return new AnonymousObservable<TSource>(observer =>
- {
- var source = default(IObservable<TSource>);
- var disposable = Disposable.Empty;
- try
- {
- var resource = resourceFactory();
- if (resource != null)
- disposable = resource;
- source = observableFactory(resource);
- }
- catch (Exception exception)
- {
- return new CompositeDisposable(Throw<TSource>(exception).Subscribe(observer), disposable);
- }
-
- return new CompositeDisposable(source.Subscribe(observer), disposable);
- });
-#endif
- }
-
- #endregion
-
- #region - UsingAsync -
-
-#if !NO_TPL
-
- public virtual IObservable<TSource> Using<TSource, TResource>(Func<CancellationToken, Task<TResource>> resourceFactoryAsync, Func<TResource, CancellationToken, Task<IObservable<TSource>>> observableFactoryAsync) where TResource : IDisposable
- {
- return Observable.FromAsync<TResource>(resourceFactoryAsync)
- .SelectMany(resource =>
- Observable.Using<TSource, TResource>(
- () => resource,
- resource_ => Observable.FromAsync<IObservable<TSource>>(ct => observableFactoryAsync(resource_, ct)).Merge()
- )
- );
- }
-
-#endif
-
- #endregion
- }
-}
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/QueryLanguage.Events.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/QueryLanguage.Events.cs
deleted file mode 100644
index 3b9f2bf..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/QueryLanguage.Events.cs
+++ /dev/null
@@ -1,653 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System.Globalization;
-using System.Reactive.Concurrency;
-using System.Reactive.Disposables;
-using System.Reflection;
-using System.Threading;
-
-#if HAS_WINRT
-using System.Runtime.InteropServices.WindowsRuntime;
-#endif
-
-namespace System.Reactive.Linq
-{
-#if !NO_PERF
- using Observαble;
-#endif
-
- //
- // BREAKING CHANGE v2 > v1.x - FromEvent[Pattern] now has an implicit SubscribeOn and Publish operation.
- //
- // See FromEvent.cs for more information.
- //
- internal partial class QueryLanguage
- {
- #region + FromEventPattern +
-
- #region Strongly typed
-
- #region Action<EventHandler>
-
-#if !NO_EVENTARGS_CONSTRAINT
- public virtual IObservable<EventPattern<EventArgs>> FromEventPattern(Action<EventHandler> addHandler, Action<EventHandler> removeHandler)
- {
- return FromEventPattern_(addHandler, removeHandler, GetSchedulerForCurrentContext());
- }
-
- public virtual IObservable<EventPattern<EventArgs>> FromEventPattern(Action<EventHandler> addHandler, Action<EventHandler> removeHandler, IScheduler scheduler)
- {
- return FromEventPattern_(addHandler, removeHandler, scheduler);
- }
-#else
- public virtual IObservable<EventPattern<object>> FromEventPattern(Action<EventHandler> addHandler, Action<EventHandler> removeHandler)
- {
- return FromEventPattern_(addHandler, removeHandler, GetSchedulerForCurrentContext());
- }
-
- public virtual IObservable<EventPattern<object>> FromEventPattern(Action<EventHandler> addHandler, Action<EventHandler> removeHandler, IScheduler scheduler)
- {
- return FromEventPattern_(addHandler, removeHandler, scheduler);
- }
-#endif
-
- #region Implementation
-
-#if !NO_EVENTARGS_CONSTRAINT
- private static IObservable<EventPattern<EventArgs>> FromEventPattern_(Action<EventHandler> addHandler, Action<EventHandler> removeHandler, IScheduler scheduler)
- {
-#if !NO_PERF
- return new FromEventPattern.τ<EventHandler, EventArgs>(e => new EventHandler(e), addHandler, removeHandler, scheduler);
-#else
- var res = Observable.FromEventPattern<EventHandler, EventArgs>(e => new EventHandler(e), addHandler, removeHandler);
- return SynchronizeEvents(res, scheduler);
-#endif
- }
-#else
- private static IObservable<EventPattern<object>> FromEventPattern_(Action<EventHandler> addHandler, Action<EventHandler> removeHandler, IScheduler scheduler)
- {
-#if !NO_PERF
- return new FromEventPattern.τ<EventHandler, object>(e => new EventHandler(e), addHandler, removeHandler, scheduler);
-#else
- var res = Observable.FromEventPattern<EventHandler, object>(e => new EventHandler(e), addHandler, removeHandler);
- return SynchronizeEvents(res, scheduler);
-#endif
- }
-#endif
-
- #endregion
-
- #endregion
-
- #region Action<TDelegate>
-
-#if !NO_EVENTARGS_CONSTRAINT
- public virtual IObservable<EventPattern<TEventArgs>> FromEventPattern<TDelegate, TEventArgs>(Action<TDelegate> addHandler, Action<TDelegate> removeHandler) where TEventArgs : EventArgs
-#else
- public virtual IObservable<EventPattern<TEventArgs>> FromEventPattern<TDelegate, TEventArgs>(Action<TDelegate> addHandler, Action<TDelegate> removeHandler)
-#endif
- {
- return FromEventPattern_<TDelegate, TEventArgs>(addHandler, removeHandler, GetSchedulerForCurrentContext());
- }
-
-#if !NO_EVENTARGS_CONSTRAINT
- public virtual IObservable<EventPattern<TEventArgs>> FromEventPattern<TDelegate, TEventArgs>(Action<TDelegate> addHandler, Action<TDelegate> removeHandler, IScheduler scheduler) where TEventArgs : EventArgs
-#else
- public virtual IObservable<EventPattern<TEventArgs>> FromEventPattern<TDelegate, TEventArgs>(Action<TDelegate> addHandler, Action<TDelegate> removeHandler, IScheduler scheduler)
-#endif
- {
- return FromEventPattern_<TDelegate, TEventArgs>(addHandler, removeHandler, scheduler);
- }
-
- #region Implementation
-
-#if !NO_EVENTARGS_CONSTRAINT
- private static IObservable<EventPattern<TEventArgs>> FromEventPattern_<TDelegate, TEventArgs>(Action<TDelegate> addHandler, Action<TDelegate> removeHandler, IScheduler scheduler) where TEventArgs : EventArgs
-#else
- private static IObservable<EventPattern<TEventArgs>> FromEventPattern_<TDelegate, TEventArgs>(Action<TDelegate> addHandler, Action<TDelegate> removeHandler, IScheduler scheduler)
-#endif
- {
-#if !NO_PERF
- return new FromEventPattern.τ<TDelegate, TEventArgs>(addHandler, removeHandler, scheduler);
-#else
- var res = new AnonymousObservable<EventPattern<TEventArgs>>(observer =>
- {
- Action<object, TEventArgs> handler = (sender, eventArgs) => observer.OnNext(new EventPattern<TEventArgs>(sender, eventArgs));
- var d = ReflectionUtils.CreateDelegate<TDelegate>(handler, typeof(Action<object, TEventArgs>).GetMethod("Invoke"));
- addHandler(d);
- return Disposable.Create(() => removeHandler(d));
- });
-
- return SynchronizeEvents(res, scheduler);
-#endif
- }
-
- #endregion
-
-#if !NO_EVENTARGS_CONSTRAINT
- public virtual IObservable<EventPattern<TEventArgs>> FromEventPattern<TDelegate, TEventArgs>(Func<EventHandler<TEventArgs>, TDelegate> conversion, Action<TDelegate> addHandler, Action<TDelegate> removeHandler) where TEventArgs : EventArgs
-#else
- public virtual IObservable<EventPattern<TEventArgs>> FromEventPattern<TDelegate, TEventArgs>(Func<EventHandler<TEventArgs>, TDelegate> conversion, Action<TDelegate> addHandler, Action<TDelegate> removeHandler)
-#endif
- {
- return FromEventPattern_<TDelegate, TEventArgs>(conversion, addHandler, removeHandler, GetSchedulerForCurrentContext());
- }
-
-#if !NO_EVENTARGS_CONSTRAINT
- public virtual IObservable<EventPattern<TEventArgs>> FromEventPattern<TDelegate, TEventArgs>(Func<EventHandler<TEventArgs>, TDelegate> conversion, Action<TDelegate> addHandler, Action<TDelegate> removeHandler, IScheduler scheduler) where TEventArgs : EventArgs
-#else
- public virtual IObservable<EventPattern<TEventArgs>> FromEventPattern<TDelegate, TEventArgs>(Func<EventHandler<TEventArgs>, TDelegate> conversion, Action<TDelegate> addHandler, Action<TDelegate> removeHandler, IScheduler scheduler)
-#endif
- {
- return FromEventPattern_<TDelegate, TEventArgs>(conversion, addHandler, removeHandler, scheduler);
- }
-
- #region Implementation
-
-#if !NO_EVENTARGS_CONSTRAINT
- private static IObservable<EventPattern<TEventArgs>> FromEventPattern_<TDelegate, TEventArgs>(Func<EventHandler<TEventArgs>, TDelegate> conversion, Action<TDelegate> addHandler, Action<TDelegate> removeHandler, IScheduler scheduler) where TEventArgs : EventArgs
-#else
- private static IObservable<EventPattern<TEventArgs>> FromEventPattern_<TDelegate, TEventArgs>(Func<EventHandler<TEventArgs>, TDelegate> conversion, Action<TDelegate> addHandler, Action<TDelegate> removeHandler, IScheduler scheduler)
-#endif
- {
-#if !NO_PERF
- return new FromEventPattern.τ<TDelegate, TEventArgs>(conversion, addHandler, removeHandler, scheduler);
-#else
- var res = new AnonymousObservable<EventPattern<TEventArgs>>(observer =>
- {
- var handler = conversion((sender, eventArgs) => observer.OnNext(new EventPattern<TEventArgs>(sender, eventArgs)));
- addHandler(handler);
- return Disposable.Create(() => removeHandler(handler));
- });
-
- return SynchronizeEvents(res, scheduler);
-#endif
- }
-
- #endregion
-
-#if !NO_EVENTARGS_CONSTRAINT
- public virtual IObservable<EventPattern<TSender, TEventArgs>> FromEventPattern<TDelegate, TSender, TEventArgs>(Action<TDelegate> addHandler, Action<TDelegate> removeHandler) where TEventArgs : EventArgs
-#else
- public virtual IObservable<EventPattern<TSender, TEventArgs>> FromEventPattern<TDelegate, TSender, TEventArgs>(Action<TDelegate> addHandler, Action<TDelegate> removeHandler)
-#endif
- {
- return FromEventPattern_<TDelegate, TSender, TEventArgs>(addHandler, removeHandler, GetSchedulerForCurrentContext());
- }
-
-#if !NO_EVENTARGS_CONSTRAINT
- public virtual IObservable<EventPattern<TSender, TEventArgs>> FromEventPattern<TDelegate, TSender, TEventArgs>(Action<TDelegate> addHandler, Action<TDelegate> removeHandler, IScheduler scheduler) where TEventArgs : EventArgs
-#else
- public virtual IObservable<EventPattern<TSender, TEventArgs>> FromEventPattern<TDelegate, TSender, TEventArgs>(Action<TDelegate> addHandler, Action<TDelegate> removeHandler, IScheduler scheduler)
-#endif
- {
- return FromEventPattern_<TDelegate, TSender, TEventArgs>(addHandler, removeHandler, scheduler);
- }
-
- #region Implementation
-
-#if !NO_EVENTARGS_CONSTRAINT
- private static IObservable<EventPattern<TSender, TEventArgs>> FromEventPattern_<TDelegate, TSender, TEventArgs>(Action<TDelegate> addHandler, Action<TDelegate> removeHandler, IScheduler scheduler) where TEventArgs : EventArgs
-#else
- private static IObservable<EventPattern<TSender, TEventArgs>> FromEventPattern_<TDelegate, TSender, TEventArgs>(Action<TDelegate> addHandler, Action<TDelegate> removeHandler, IScheduler scheduler)
-#endif
- {
-#if !NO_PERF
- return new FromEventPattern.τ<TDelegate, TSender, TEventArgs>(addHandler, removeHandler, scheduler);
-#else
- var res = new AnonymousObservable<EventPattern<TSender, TEventArgs>>(observer =>
- {
- Action<TSender, TEventArgs> handler = (sender, eventArgs) => observer.OnNext(new EventPattern<TSender, TEventArgs>(sender, eventArgs));
- var d = ReflectionUtils.CreateDelegate<TDelegate>(handler, typeof(Action<TSender, TEventArgs>).GetMethod("Invoke"));
- addHandler(d);
- return Disposable.Create(() => removeHandler(d));
- });
-
- return SynchronizeEvents(res, scheduler);
-#endif
- }
-
- #endregion
-
- #endregion
-
- #region Action<EventHandler<TEventArgs>>
-
-#if !NO_EVENTARGS_CONSTRAINT
- public virtual IObservable<EventPattern<TEventArgs>> FromEventPattern<TEventArgs>(Action<EventHandler<TEventArgs>> addHandler, Action<EventHandler<TEventArgs>> removeHandler) where TEventArgs : EventArgs
-#else
- public virtual IObservable<EventPattern<TEventArgs>> FromEventPattern<TEventArgs>(Action<EventHandler<TEventArgs>> addHandler, Action<EventHandler<TEventArgs>> removeHandler)
-#endif
- {
- return FromEventPattern_<TEventArgs>(addHandler, removeHandler, GetSchedulerForCurrentContext());
- }
-
- #if !NO_EVENTARGS_CONSTRAINT
- public virtual IObservable<EventPattern<TEventArgs>> FromEventPattern<TEventArgs>(Action<EventHandler<TEventArgs>> addHandler, Action<EventHandler<TEventArgs>> removeHandler, IScheduler scheduler) where TEventArgs : EventArgs
-#else
- public virtual IObservable<EventPattern<TEventArgs>> FromEventPattern<TEventArgs>(Action<EventHandler<TEventArgs>> addHandler, Action<EventHandler<TEventArgs>> removeHandler, IScheduler scheduler)
-#endif
- {
- return FromEventPattern_<TEventArgs>(addHandler, removeHandler, scheduler);
- }
-
- #region Implementation
-
-#if !NO_EVENTARGS_CONSTRAINT
- private static IObservable<EventPattern<TEventArgs>> FromEventPattern_<TEventArgs>(Action<EventHandler<TEventArgs>> addHandler, Action<EventHandler<TEventArgs>> removeHandler, IScheduler scheduler) where TEventArgs : EventArgs
-#else
- private static IObservable<EventPattern<TEventArgs>> FromEventPattern_<TEventArgs>(Action<EventHandler<TEventArgs>> addHandler, Action<EventHandler<TEventArgs>> removeHandler, IScheduler scheduler)
-#endif
- {
-#if !NO_PERF
- return new FromEventPattern.τ<EventHandler<TEventArgs>, TEventArgs>(handler => handler, addHandler, removeHandler, scheduler);
-#else
- var res = Observable.FromEventPattern<EventHandler<TEventArgs>, TEventArgs>(handler => handler, addHandler, removeHandler);
- return SynchronizeEvents(res, scheduler);
-#endif
- }
-
- #endregion
-
- #endregion
-
- #endregion
-
- #region Reflection
-
- #region Instance events
-
-#if !NO_EVENTARGS_CONSTRAINT
- public virtual IObservable<EventPattern<EventArgs>> FromEventPattern(object target, string eventName)
- {
- return FromEventPattern_(target, eventName, GetSchedulerForCurrentContext());
- }
-
- public virtual IObservable<EventPattern<EventArgs>> FromEventPattern(object target, string eventName, IScheduler scheduler)
- {
- return FromEventPattern_(target, eventName, scheduler);
- }
-#else
- public virtual IObservable<EventPattern<object>> FromEventPattern(object target, string eventName)
- {
- return FromEventPattern_(target, eventName, GetSchedulerForCurrentContext());
- }
-
- public virtual IObservable<EventPattern<object>> FromEventPattern(object target, string eventName, IScheduler scheduler)
- {
- return FromEventPattern_(target, eventName, scheduler);
- }
-#endif
-
- #region Implementation
-
-#if !NO_EVENTARGS_CONSTRAINT
- private static IObservable<EventPattern<EventArgs>> FromEventPattern_(object target, string eventName, IScheduler scheduler)
- {
- return FromEventPattern_<object, EventArgs, EventPattern<EventArgs>>(target.GetType(), target, eventName, (sender, args) => new EventPattern<EventArgs>(sender, args), scheduler);
- }
-#else
- private static IObservable<EventPattern<object>> FromEventPattern_(object target, string eventName, IScheduler scheduler)
- {
- return FromEventPattern_<object, object, EventPattern<object>>(target.GetType(), target, eventName, (sender, args) => new EventPattern<object>(sender, args), scheduler);
- }
-#endif
-
- #endregion
-
-#if !NO_EVENTARGS_CONSTRAINT
- public virtual IObservable<EventPattern<TEventArgs>> FromEventPattern<TEventArgs>(object target, string eventName) where TEventArgs : EventArgs
-#else
- public virtual IObservable<EventPattern<TEventArgs>> FromEventPattern<TEventArgs>(object target, string eventName)
-#endif
- {
- return FromEventPattern_<TEventArgs>(target, eventName, GetSchedulerForCurrentContext());
- }
-
-#if !NO_EVENTARGS_CONSTRAINT
- public virtual IObservable<EventPattern<TEventArgs>> FromEventPattern<TEventArgs>(object target, string eventName, IScheduler scheduler) where TEventArgs : EventArgs
-#else
- public virtual IObservable<EventPattern<TEventArgs>> FromEventPattern<TEventArgs>(object target, string eventName, IScheduler scheduler)
-#endif
- {
- return FromEventPattern_<TEventArgs>(target, eventName, scheduler);
- }
-
- #region Implementation
-
-#if !NO_EVENTARGS_CONSTRAINT
- private static IObservable<EventPattern<TEventArgs>> FromEventPattern_<TEventArgs>(object target, string eventName, IScheduler scheduler) where TEventArgs : EventArgs
-#else
- private static IObservable<EventPattern<TEventArgs>> FromEventPattern_<TEventArgs>(object target, string eventName, IScheduler scheduler)
-#endif
- {
- return FromEventPattern_<object, TEventArgs, EventPattern<TEventArgs>>(target.GetType(), target, eventName, (sender, args) => new EventPattern<TEventArgs>(sender, args), scheduler);
- }
-
- #endregion
-
-#if !NO_EVENTARGS_CONSTRAINT
- public virtual IObservable<EventPattern<TSender, TEventArgs>> FromEventPattern<TSender, TEventArgs>(object target, string eventName) where TEventArgs : EventArgs
-#else
- public virtual IObservable<EventPattern<TSender, TEventArgs>> FromEventPattern<TSender, TEventArgs>(object target, string eventName)
-#endif
- {
- return FromEventPattern_<TSender, TEventArgs>(target, eventName, GetSchedulerForCurrentContext());
- }
-
-#if !NO_EVENTARGS_CONSTRAINT
- public virtual IObservable<EventPattern<TSender, TEventArgs>> FromEventPattern<TSender, TEventArgs>(object target, string eventName, IScheduler scheduler) where TEventArgs : EventArgs
-#else
- public virtual IObservable<EventPattern<TSender, TEventArgs>> FromEventPattern<TSender, TEventArgs>(object target, string eventName, IScheduler scheduler)
-#endif
- {
- return FromEventPattern_<TSender, TEventArgs>(target, eventName, scheduler);
- }
-
- #region Implementation
-
-#if !NO_EVENTARGS_CONSTRAINT
- private static IObservable<EventPattern<TSender, TEventArgs>> FromEventPattern_<TSender, TEventArgs>(object target, string eventName, IScheduler scheduler) where TEventArgs : EventArgs
-#else
- private static IObservable<EventPattern<TSender, TEventArgs>> FromEventPattern_<TSender, TEventArgs>(object target, string eventName, IScheduler scheduler)
-#endif
- {
- return FromEventPattern_<TSender, TEventArgs, EventPattern<TSender, TEventArgs>>(target.GetType(), target, eventName, (sender, args) => new EventPattern<TSender, TEventArgs>(sender, args), scheduler);
- }
-
- #endregion
-
- #endregion
-
- #region Static events
-
-#if !NO_EVENTARGS_CONSTRAINT
- public virtual IObservable<EventPattern<EventArgs>> FromEventPattern(Type type, string eventName)
- {
- return FromEventPattern_(type, eventName, GetSchedulerForCurrentContext());
- }
-
- public virtual IObservable<EventPattern<EventArgs>> FromEventPattern(Type type, string eventName, IScheduler scheduler)
- {
- return FromEventPattern_(type, eventName, scheduler);
- }
-#else
- public virtual IObservable<EventPattern<object>> FromEventPattern(Type type, string eventName)
- {
- return FromEventPattern_(type, eventName, GetSchedulerForCurrentContext());
- }
-
- public virtual IObservable<EventPattern<object>> FromEventPattern(Type type, string eventName, IScheduler scheduler)
- {
- return FromEventPattern_(type, eventName, scheduler);
- }
-#endif
-
- #region Implementation
-
-#if !NO_EVENTARGS_CONSTRAINT
- private static IObservable<EventPattern<EventArgs>> FromEventPattern_(Type type, string eventName, IScheduler scheduler)
- {
- return FromEventPattern_<object, EventArgs, EventPattern<EventArgs>>(type, null, eventName, (sender, args) => new EventPattern<EventArgs>(sender, args), scheduler);
- }
-#else
- private static IObservable<EventPattern<object>> FromEventPattern_(Type type, string eventName, IScheduler scheduler)
- {
- return FromEventPattern_<object, object, EventPattern<object>>(type, null, eventName, (sender, args) => new EventPattern<object>(sender, args), scheduler);
- }
-#endif
-
- #endregion
-
-#if !NO_EVENTARGS_CONSTRAINT
- public virtual IObservable<EventPattern<TEventArgs>> FromEventPattern<TEventArgs>(Type type, string eventName) where TEventArgs : EventArgs
-#else
- public virtual IObservable<EventPattern<TEventArgs>> FromEventPattern<TEventArgs>(Type type, string eventName)
-#endif
- {
- return FromEventPattern_<TEventArgs>(type, eventName, GetSchedulerForCurrentContext());
- }
-
-#if !NO_EVENTARGS_CONSTRAINT
- public virtual IObservable<EventPattern<TEventArgs>> FromEventPattern<TEventArgs>(Type type, string eventName, IScheduler scheduler) where TEventArgs : EventArgs
-#else
- public virtual IObservable<EventPattern<TEventArgs>> FromEventPattern<TEventArgs>(Type type, string eventName, IScheduler scheduler)
-#endif
- {
- return FromEventPattern_<TEventArgs>(type, eventName, scheduler);
- }
-
- #region Implementation
-
-#if !NO_EVENTARGS_CONSTRAINT
- private static IObservable<EventPattern<TEventArgs>> FromEventPattern_<TEventArgs>(Type type, string eventName, IScheduler scheduler) where TEventArgs : EventArgs
-#else
- private static IObservable<EventPattern<TEventArgs>> FromEventPattern_<TEventArgs>(Type type, string eventName, IScheduler scheduler)
-#endif
- {
- return FromEventPattern_<object, TEventArgs, EventPattern<TEventArgs>>(type, null, eventName, (sender, args) => new EventPattern<TEventArgs>(sender, args), scheduler);
- }
-
- #endregion
-
-#if !NO_EVENTARGS_CONSTRAINT
- public virtual IObservable<EventPattern<TSender, TEventArgs>> FromEventPattern<TSender, TEventArgs>(Type type, string eventName) where TEventArgs : EventArgs
-#else
- public virtual IObservable<EventPattern<TSender, TEventArgs>> FromEventPattern<TSender, TEventArgs>(Type type, string eventName)
-#endif
- {
- return FromEventPattern_<TSender, TEventArgs>(type, eventName, GetSchedulerForCurrentContext());
- }
-
-#if !NO_EVENTARGS_CONSTRAINT
- public virtual IObservable<EventPattern<TSender, TEventArgs>> FromEventPattern<TSender, TEventArgs>(Type type, string eventName, IScheduler scheduler) where TEventArgs : EventArgs
-#else
- public virtual IObservable<EventPattern<TSender, TEventArgs>> FromEventPattern<TSender, TEventArgs>(Type type, string eventName, IScheduler scheduler)
-#endif
- {
- return FromEventPattern_<TSender, TEventArgs>(type, eventName, scheduler);
- }
-
- #region Implementation
-
-#if !NO_EVENTARGS_CONSTRAINT
- private static IObservable<EventPattern<TSender, TEventArgs>> FromEventPattern_<TSender, TEventArgs>(Type type, string eventName, IScheduler scheduler) where TEventArgs : EventArgs
-#else
- private static IObservable<EventPattern<TSender, TEventArgs>> FromEventPattern_<TSender, TEventArgs>(Type type, string eventName, IScheduler scheduler)
-#endif
- {
- return FromEventPattern_<TSender, TEventArgs, EventPattern<TSender, TEventArgs>>(type, null, eventName, (sender, args) => new EventPattern<TSender, TEventArgs>(sender, args), scheduler);
- }
-
- #endregion
-
- #endregion
-
- #region Helper methods
-
- private static IObservable<TResult> FromEventPattern_<TSender, TEventArgs, TResult>(Type targetType, object target, string eventName, Func<TSender, TEventArgs, TResult> getResult, IScheduler scheduler)
-#if !NO_EVENTARGS_CONSTRAINT
- where TEventArgs : EventArgs
-#endif
- {
- var addMethod = default(MethodInfo);
- var removeMethod = default(MethodInfo);
- var delegateType = default(Type);
- var isWinRT = default(bool);
- ReflectionUtils.GetEventMethods<TSender, TEventArgs>(targetType, target, eventName, out addMethod, out removeMethod, out delegateType, out isWinRT);
-
-#if HAS_WINRT
- if (isWinRT)
- {
-#if !NO_PERF
- return new FromEventPattern.ρ<TSender, TEventArgs, TResult>(target, delegateType, addMethod, removeMethod, getResult, true, scheduler);
-#else
- return new AnonymousObservable<TResult>(observer =>
- {
- Action<TSender, TEventArgs> handler = (sender, eventArgs) => observer.OnNext(getResult(sender, eventArgs));
- var d = ReflectionUtils.CreateDelegate(delegateType, handler, typeof(Action<TSender, TEventArgs>).GetMethod("Invoke"));
- var token = addMethod.Invoke(target, new object[] { d });
- return Disposable.Create(() => removeMethod.Invoke(target, new object[] { token }));
- });
-#endif
- }
-#endif
-
-#if !NO_PERF
- return new FromEventPattern.ρ<TSender, TEventArgs, TResult>(target, delegateType, addMethod, removeMethod, getResult, false, scheduler);
-#else
- var res = new AnonymousObservable<TResult>(observer =>
- {
- Action<TSender, TEventArgs> handler = (sender, eventArgs) => observer.OnNext(getResult(sender, eventArgs));
- var d = ReflectionUtils.CreateDelegate(delegateType, handler, typeof(Action<TSender, TEventArgs>).GetMethod("Invoke"));
- addMethod.Invoke(target, new object[] { d });
- return Disposable.Create(() => removeMethod.Invoke(target, new object[] { d }));
- });
-
- return SynchronizeEvents(res, scheduler);
-#endif
- }
-
- #endregion
-
- #endregion
-
- #endregion
-
- #region FromEvent
-
- public virtual IObservable<TEventArgs> FromEvent<TDelegate, TEventArgs>(Func<Action<TEventArgs>, TDelegate> conversion, Action<TDelegate> addHandler, Action<TDelegate> removeHandler)
- {
- return FromEvent_<TDelegate, TEventArgs>(conversion, addHandler, removeHandler, GetSchedulerForCurrentContext());
- }
-
- public virtual IObservable<TEventArgs> FromEvent<TDelegate, TEventArgs>(Func<Action<TEventArgs>, TDelegate> conversion, Action<TDelegate> addHandler, Action<TDelegate> removeHandler, IScheduler scheduler)
- {
- return FromEvent_<TDelegate, TEventArgs>(conversion, addHandler, removeHandler, scheduler);
- }
-
- #region Implementation
-
- private static IObservable<TEventArgs> FromEvent_<TDelegate, TEventArgs>(Func<Action<TEventArgs>, TDelegate> conversion, Action<TDelegate> addHandler, Action<TDelegate> removeHandler, IScheduler scheduler)
- {
-#if !NO_PERF
- return new FromEvent<TDelegate, TEventArgs>(conversion, addHandler, removeHandler, scheduler);
-#else
- var res = new AnonymousObservable<TEventArgs>(observer =>
- {
- var handler = conversion(observer.OnNext);
- addHandler(handler);
- return Disposable.Create(() => removeHandler(handler));
- });
-
- return SynchronizeEvents(res, scheduler);
-#endif
- }
-
- #endregion
-
- public virtual IObservable<TEventArgs> FromEvent<TDelegate, TEventArgs>(Action<TDelegate> addHandler, Action<TDelegate> removeHandler)
- {
- return FromEvent_<TDelegate, TEventArgs>(addHandler, removeHandler, GetSchedulerForCurrentContext());
- }
-
- public virtual IObservable<TEventArgs> FromEvent<TDelegate, TEventArgs>(Action<TDelegate> addHandler, Action<TDelegate> removeHandler, IScheduler scheduler)
- {
- return FromEvent_<TDelegate, TEventArgs>(addHandler, removeHandler, scheduler);
- }
-
- #region Implementation
-
- private static IObservable<TEventArgs> FromEvent_<TDelegate, TEventArgs>(Action<TDelegate> addHandler, Action<TDelegate> removeHandler, IScheduler scheduler)
- {
-#if !NO_PERF
- return new FromEvent<TDelegate, TEventArgs>(addHandler, removeHandler, scheduler);
-#else
- var res = new AnonymousObservable<TEventArgs>(observer =>
- {
- Action<TEventArgs> handler = observer.OnNext;
- var d = ReflectionUtils.CreateDelegate<TDelegate>(handler, typeof(Action<TEventArgs>).GetMethod("Invoke"));
- addHandler(d);
- return Disposable.Create(() => removeHandler(d));
- });
-
- return SynchronizeEvents(res, scheduler);
-#endif
- }
-
- #endregion
-
- public virtual IObservable<TEventArgs> FromEvent<TEventArgs>(Action<Action<TEventArgs>> addHandler, Action<Action<TEventArgs>> removeHandler)
- {
- return FromEvent_<TEventArgs>(addHandler, removeHandler, GetSchedulerForCurrentContext());
- }
-
- public virtual IObservable<TEventArgs> FromEvent<TEventArgs>(Action<Action<TEventArgs>> addHandler, Action<Action<TEventArgs>> removeHandler, IScheduler scheduler)
- {
- return FromEvent_<TEventArgs>(addHandler, removeHandler, scheduler);
- }
-
- #region Implementation
-
- private static IObservable<TEventArgs> FromEvent_<TEventArgs>(Action<Action<TEventArgs>> addHandler, Action<Action<TEventArgs>> removeHandler, IScheduler scheduler)
- {
-#if !NO_PERF
- return new FromEvent<Action<TEventArgs>, TEventArgs>(h => h, addHandler, removeHandler, scheduler);
-#else
- var res = Observable.FromEvent<Action<TEventArgs>, TEventArgs>(h => h, addHandler, removeHandler);
- return SynchronizeEvents(res, scheduler);
-#endif
- }
-
- #endregion
-
- public virtual IObservable<Unit> FromEvent(Action<Action> addHandler, Action<Action> removeHandler)
- {
- return FromEvent_(addHandler, removeHandler, GetSchedulerForCurrentContext());
- }
-
- public virtual IObservable<Unit> FromEvent(Action<Action> addHandler, Action<Action> removeHandler, IScheduler scheduler)
- {
- return FromEvent_(addHandler, removeHandler, scheduler);
- }
-
- #region Implementation
-
- private static IObservable<Unit> FromEvent_(Action<Action> addHandler, Action<Action> removeHandler, IScheduler scheduler)
- {
-#if !NO_PERF
- return new FromEvent<Action, Unit>(h => new Action(() => h(new Unit())), addHandler, removeHandler, scheduler);
-#else
- var res = Observable.FromEvent<Action, Unit>(h => new Action(() => h(new Unit())), addHandler, removeHandler);
- return SynchronizeEvents(res, scheduler);
-#endif
- }
-
- #endregion
-
- #endregion
-
- #region Helpers
-
- private static IScheduler GetSchedulerForCurrentContext()
- {
- var context = SynchronizationContext.Current;
-
- if (context != null)
- return new SynchronizationContextScheduler(context, false);
- else
- return SchedulerDefaults.ConstantTimeOperations;
- }
-
-#if NO_PERF
-
- private static IObservable<T> SynchronizeEvents<T>(IObservable<T> source, IScheduler scheduler)
- {
- return source.SubscribeOn(scheduler).Publish().RefCount();
- }
-
-#endif
-
- #endregion
- }
-}
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/QueryLanguage.Imperative.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/QueryLanguage.Imperative.cs
deleted file mode 100644
index ff4470b..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/QueryLanguage.Imperative.cs
+++ /dev/null
@@ -1,232 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System.Collections.Generic;
-using System.Reactive.Concurrency;
-using System.Reactive.Disposables;
-using System.Reactive.Subjects;
-using System.Threading;
-
-#if !NO_TPL
-using System.Threading.Tasks;
-#endif
-
-namespace System.Reactive.Linq
-{
-#if !NO_PERF
- using Observαble;
-#endif
-
- internal partial class QueryLanguage
- {
- #region ForEachAsync
-
-#if !NO_TPL
- public virtual Task ForEachAsync<TSource>(IObservable<TSource> source, Action<TSource> onNext)
- {
- return ForEachAsync_(source, onNext, CancellationToken.None);
- }
-
- public virtual Task ForEachAsync<TSource>(IObservable<TSource> source, Action<TSource> onNext, CancellationToken cancellationToken)
- {
- return ForEachAsync_(source, onNext, cancellationToken);
- }
-
- public virtual Task ForEachAsync<TSource>(IObservable<TSource> source, Action<TSource, int> onNext)
- {
- var i = 0;
- return ForEachAsync_(source, x => onNext(x, checked(i++)), CancellationToken.None);
- }
-
- public virtual Task ForEachAsync<TSource>(IObservable<TSource> source, Action<TSource, int> onNext, CancellationToken cancellationToken)
- {
- var i = 0;
- return ForEachAsync_(source, x => onNext(x, checked(i++)), cancellationToken);
- }
-
- private static Task ForEachAsync_<TSource>(IObservable<TSource> source, Action<TSource> onNext, CancellationToken cancellationToken)
- {
- var tcs = new TaskCompletionSource<object>();
- var subscription = new SingleAssignmentDisposable();
-
- cancellationToken.Register(() => tcs.TrySetCanceled());
- cancellationToken.Register(subscription.Dispose);
-
- if (!cancellationToken.IsCancellationRequested)
- {
- // Making sure we always complete, even if disposing throws.
- var dispose = new Action<Action>(action =>
- {
- try
- {
- subscription.Dispose();
- }
- catch (Exception ex)
- {
- tcs.TrySetException(ex);
- return;
- }
-
- action();
- });
-
- var taskCompletionObserver = new AnonymousObserver<TSource>(
- x =>
- {
- if (!subscription.IsDisposed)
- {
- try
- {
- onNext(x);
- }
- catch (Exception exception)
- {
- dispose(() => tcs.TrySetException(exception));
- }
- }
- },
- exception =>
- {
- dispose(() => tcs.TrySetException(exception));
- },
- () =>
- {
- dispose(() => tcs.TrySetResult(null));
- }
- );
-
- //
- // Subtle race condition: if the source completes before we reach the line below, the SingleAssigmentDisposable
- // will already have been disposed. Upon assignment, the disposable resource being set will be disposed on the
- // spot, which may throw an exception. (See TFS 487142)
- //
- try
- {
- //
- // [OK] Use of unsafe Subscribe: we're catching the exception here to set the TaskCompletionSource.
- //
- // Notice we could use a safe subscription to route errors through OnError, but we still need the
- // exception handling logic here for the reason explained above. We cannot afford to throw here
- // and as a result never set the TaskCompletionSource, so we tunnel everything through here.
- //
- subscription.Disposable = source.Subscribe/*Unsafe*/(taskCompletionObserver);
- }
- catch (Exception ex)
- {
- tcs.TrySetException(ex);
- }
- }
-
- return tcs.Task;
- }
-#endif
-
- #endregion
-
- #region + Case +
-
- public virtual IObservable<TResult> Case<TValue, TResult>(Func<TValue> selector, IDictionary<TValue, IObservable<TResult>> sources)
- {
- return Case(selector, sources, Empty<TResult>());
- }
-
- public virtual IObservable<TResult> Case<TValue, TResult>(Func<TValue> selector, IDictionary<TValue, IObservable<TResult>> sources, IScheduler scheduler)
- {
- return Case(selector, sources, Empty<TResult>(scheduler));
- }
-
- public virtual IObservable<TResult> Case<TValue, TResult>(Func<TValue> selector, IDictionary<TValue, IObservable<TResult>> sources, IObservable<TResult> defaultSource)
- {
-#if !NO_PERF
- return new Case<TValue, TResult>(selector, sources, defaultSource);
-#else
- return Observable.Defer(() =>
- {
- IObservable<TResult> result;
- if (!sources.TryGetValue(selector(), out result))
- result = defaultSource;
- return result;
- });
-#endif
- }
-
- #endregion
-
- #region + DoWhile +
-
- public virtual IObservable<TSource> DoWhile<TSource>(IObservable<TSource> source, Func<bool> condition)
- {
-#if !NO_PERF
- return new DoWhile<TSource>(source, condition);
-#else
- return source.Concat(While(condition, source));
-#endif
- }
-
- #endregion
-
- #region + For +
-
- public virtual IObservable<TResult> For<TSource, TResult>(IEnumerable<TSource> source, Func<TSource, IObservable<TResult>> resultSelector)
- {
-#if !NO_PERF
- return new For<TSource, TResult>(source, resultSelector);
-#else
- return ForCore(source, resultSelector).Concat();
-#endif
- }
-
-#if NO_PERF
- static IEnumerable<IObservable<TResult>> ForCore<TSource, TResult>(IEnumerable<TSource> source, Func<TSource, IObservable<TResult>> resultSelector)
- {
- foreach (var item in source)
- yield return resultSelector(item);
- }
-#endif
-
- #endregion
-
- #region + If +
-
- public virtual IObservable<TResult> If<TResult>(Func<bool> condition, IObservable<TResult> thenSource)
- {
- return If(condition, thenSource, Empty<TResult>());
- }
-
- public virtual IObservable<TResult> If<TResult>(Func<bool> condition, IObservable<TResult> thenSource, IScheduler scheduler)
- {
- return If(condition, thenSource, Empty<TResult>(scheduler));
- }
-
- public virtual IObservable<TResult> If<TResult>(Func<bool> condition, IObservable<TResult> thenSource, IObservable<TResult> elseSource)
- {
-#if !NO_PERF
- return new If<TResult>(condition, thenSource, elseSource);
-#else
- return Observable.Defer(() => condition() ? thenSource : elseSource);
-#endif
- }
-
- #endregion
-
- #region + While +
-
- public virtual IObservable<TSource> While<TSource>(Func<bool> condition, IObservable<TSource> source)
- {
-#if !NO_PERF
- return new While<TSource>(condition, source);
-#else
- return WhileCore(condition, source).Concat();
-#endif
- }
-
-#if NO_PERF
- static IEnumerable<IObservable<TSource>> WhileCore<TSource>(Func<bool> condition, IObservable<TSource> source)
- {
- while (condition())
- yield return source;
- }
-#endif
-
- #endregion
- }
-}
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/QueryLanguage.Joins.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/QueryLanguage.Joins.cs
deleted file mode 100644
index a5ddf27..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/QueryLanguage.Joins.cs
+++ /dev/null
@@ -1,84 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System.Collections.Generic;
-using System.Reactive.Disposables;
-using System.Reactive.Joins;
-
-namespace System.Reactive.Linq
-{
- internal partial class QueryLanguage
- {
- #region And
-
- public virtual Pattern<TLeft, TRight> And<TLeft, TRight>(IObservable<TLeft> left, IObservable<TRight> right)
- {
- return new Pattern<TLeft, TRight>(left, right);
- }
-
- #endregion
-
- #region Then
-
- public virtual Plan<TResult> Then<TSource, TResult>(IObservable<TSource> source, Func<TSource, TResult> selector)
- {
- return new Pattern<TSource>(source).Then(selector);
- }
-
- #endregion
-
- #region When
-
- public virtual IObservable<TResult> When<TResult>(params Plan<TResult>[] plans)
- {
- return When((IEnumerable<Plan<TResult>>)plans);
- }
-
- public virtual IObservable<TResult> When<TResult>(IEnumerable<Plan<TResult>> plans)
- {
- return new AnonymousObservable<TResult>(observer =>
- {
- var externalSubscriptions = new Dictionary<object, IJoinObserver>();
- var gate = new object();
- var activePlans = new List<ActivePlan>();
- var outObserver = Observer.Create<TResult>(observer.OnNext,
- exception =>
- {
- foreach (var po in externalSubscriptions.Values)
- {
- po.Dispose();
- }
- observer.OnError(exception);
- },
- observer.OnCompleted);
- try
- {
- foreach (var plan in plans)
- activePlans.Add(plan.Activate(externalSubscriptions, outObserver,
- activePlan =>
- {
- activePlans.Remove(activePlan);
- if (activePlans.Count == 0)
- outObserver.OnCompleted();
- }));
- }
- catch (Exception e)
- {
- //
- // [OK] Use of unsafe Subscribe: we're calling into a known producer implementation.
- //
- return Throw<TResult>(e).Subscribe/*Unsafe*/(observer);
- }
-
- var group = new CompositeDisposable(externalSubscriptions.Values.Count);
- foreach (var joinObserver in externalSubscriptions.Values)
- {
- joinObserver.Subscribe(gate);
- group.Add(joinObserver);
- }
- return group;
- });
- }
-
- #endregion
- }
-}
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/QueryLanguage.Multiple.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/QueryLanguage.Multiple.cs
deleted file mode 100644
index cd23a97..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/QueryLanguage.Multiple.cs
+++ /dev/null
@@ -1,1723 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System.Collections;
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-using System.Linq;
-using System.Reactive.Concurrency;
-using System.Reactive.Disposables;
-using System.Reactive.Subjects;
-
-#if !NO_TPL
-using System.Reactive.Threading.Tasks;
-using System.Threading.Tasks;
-#endif
-
-namespace System.Reactive.Linq
-{
-#if !NO_PERF
- using Observαble;
-#endif
-
- internal partial class QueryLanguage
- {
- #region + Amb +
-
- public virtual IObservable<TSource> Amb<TSource>(IObservable<TSource> first, IObservable<TSource> second)
- {
- return Amb_(first, second);
- }
-
- public virtual IObservable<TSource> Amb<TSource>(params IObservable<TSource>[] sources)
- {
- return Amb_(sources);
- }
-
- public virtual IObservable<TSource> Amb<TSource>(IEnumerable<IObservable<TSource>> sources)
- {
- return Amb_(sources);
- }
-
- private static IObservable<TSource> Amb_<TSource>(IEnumerable<IObservable<TSource>> sources)
- {
- return sources.Aggregate(Observable.Never<TSource>(), (previous, current) => previous.Amb(current));
- }
-
- private static IObservable<TSource> Amb_<TSource>(IObservable<TSource> leftSource, IObservable<TSource> rightSource)
- {
-#if !NO_PERF
- return new Amb<TSource>(leftSource, rightSource);
-#else
- return new AnonymousObservable<TSource>(observer =>
- {
- var leftSubscription = new SingleAssignmentDisposable();
- var rightSubscription = new SingleAssignmentDisposable();
-
- var choice = AmbState.Neither;
-
- var gate = new object();
-
- var left = new AmbObserver<TSource>();
- var right = new AmbObserver<TSource>();
-
- left.Observer = Observer.Synchronize(Observer.Create<TSource>(
- x =>
- {
- if (choice == AmbState.Neither)
- {
- choice = AmbState.Left;
- rightSubscription.Dispose();
- left.Observer = observer;
- }
-
- if (choice == AmbState.Left)
- observer.OnNext(x);
- },
- ex =>
- {
- if (choice == AmbState.Neither)
- {
- choice = AmbState.Left;
- rightSubscription.Dispose();
- left.Observer = observer;
- }
-
- if (choice == AmbState.Left)
- observer.OnError(ex);
- },
- () =>
- {
- if (choice == AmbState.Neither)
- {
- choice = AmbState.Left;
- rightSubscription.Dispose();
- left.Observer = observer;
- }
-
- if (choice == AmbState.Left)
- observer.OnCompleted();
- }
- ), gate);
-
- right.Observer = Observer.Synchronize(Observer.Create<TSource>(
- x =>
- {
- if (choice == AmbState.Neither)
- {
- choice = AmbState.Right;
- leftSubscription.Dispose();
- right.Observer = observer;
- }
-
- if (choice == AmbState.Right)
- observer.OnNext(x);
- },
- ex =>
- {
- if (choice == AmbState.Neither)
- {
- choice = AmbState.Right;
- leftSubscription.Dispose();
- right.Observer = observer;
- }
-
- if (choice == AmbState.Right)
- observer.OnError(ex);
- },
- () =>
- {
- if (choice == AmbState.Neither)
- {
- choice = AmbState.Right;
- leftSubscription.Dispose();
- right.Observer = observer;
- }
-
- if (choice == AmbState.Right)
- observer.OnCompleted();
- }
- ), gate);
-
- leftSubscription.Disposable = leftSource.Subscribe(left);
- rightSubscription.Disposable = rightSource.Subscribe(right);
-
- return new CompositeDisposable(leftSubscription, rightSubscription);
- });
-#endif
- }
-
-#if NO_PERF
- class AmbObserver<TSource> : IObserver<TSource>
- {
- public virtual IObserver<TSource> Observer { get; set; }
-
- public virtual void OnCompleted()
- {
- Observer.OnCompleted();
- }
-
- public virtual void OnError(Exception error)
- {
- Observer.OnError(error);
- }
-
- public virtual void OnNext(TSource value)
- {
- Observer.OnNext(value);
- }
- }
-
- enum AmbState
- {
- Left,
- Right,
- Neither
- }
-#endif
-
- #endregion
-
- #region + Buffer +
-
- public virtual IObservable<IList<TSource>> Buffer<TSource, TBufferClosing>(IObservable<TSource> source, Func<IObservable<TBufferClosing>> bufferClosingSelector)
- {
-#if !NO_PERF
- return new Buffer<TSource, TBufferClosing>(source, bufferClosingSelector);
-#else
- return source.Window(bufferClosingSelector).SelectMany(ToList);
-#endif
- }
-
- public virtual IObservable<IList<TSource>> Buffer<TSource, TBufferOpening, TBufferClosing>(IObservable<TSource> source, IObservable<TBufferOpening> bufferOpenings, Func<TBufferOpening, IObservable<TBufferClosing>> bufferClosingSelector)
- {
- return source.Window(bufferOpenings, bufferClosingSelector).SelectMany(ToList);
- }
-
- public virtual IObservable<IList<TSource>> Buffer<TSource, TBufferBoundary>(IObservable<TSource> source, IObservable<TBufferBoundary> bufferBoundaries)
- {
-#if !NO_PERF
- return new Buffer<TSource, TBufferBoundary>(source, bufferBoundaries);
-#else
- return source.Window(bufferBoundaries).SelectMany(ToList);
-#endif
- }
-
- #endregion
-
- #region + Catch +
-
- public virtual IObservable<TSource> Catch<TSource, TException>(IObservable<TSource> source, Func<TException, IObservable<TSource>> handler) where TException : Exception
- {
-#if !NO_PERF
- return new Catch<TSource, TException>(source, handler);
-#else
- return new AnonymousObservable<TSource>(observer =>
- {
- var subscription = new SerialDisposable();
-
- var d1 = new SingleAssignmentDisposable();
- subscription.Disposable = d1;
- d1.Disposable = source.Subscribe(observer.OnNext,
- exception =>
- {
- var e = exception as TException;
- if (e != null)
- {
- IObservable<TSource> result;
- try
- {
- result = handler(e);
- }
- catch (Exception ex)
- {
- observer.OnError(ex);
- return;
- }
-
- var d = new SingleAssignmentDisposable();
- subscription.Disposable = d;
- d.Disposable = result.Subscribe(observer);
- }
- else
- observer.OnError(exception);
- }, observer.OnCompleted);
-
- return subscription;
- });
-#endif
- }
-
- public virtual IObservable<TSource> Catch<TSource>(IObservable<TSource> first, IObservable<TSource> second)
- {
- return Catch_<TSource>(new[] { first, second });
- }
-
- public virtual IObservable<TSource> Catch<TSource>(params IObservable<TSource>[] sources)
- {
- return Catch_<TSource>(sources);
- }
-
- public virtual IObservable<TSource> Catch<TSource>(IEnumerable<IObservable<TSource>> sources)
- {
- return Catch_<TSource>(sources);
- }
-
- private static IObservable<TSource> Catch_<TSource>(IEnumerable<IObservable<TSource>> sources)
- {
-#if !NO_PERF
- return new Catch<TSource>(sources);
-#else
- return new AnonymousObservable<TSource>(observer =>
- {
- var gate = new AsyncLock();
- var isDisposed = false;
- var e = sources.GetEnumerator();
- var subscription = new SerialDisposable();
- var lastException = default(Exception);
-
- var cancelable = SchedulerDefaults.TailRecursion.Schedule(self => gate.Wait(() =>
- {
- var current = default(IObservable<TSource>);
- var hasNext = false;
- var ex = default(Exception);
-
- if (!isDisposed)
- {
- try
- {
- hasNext = e.MoveNext();
- if (hasNext)
- current = e.Current;
- else
- e.Dispose();
- }
- catch (Exception exception)
- {
- ex = exception;
- e.Dispose();
- }
- }
- else
- return;
-
- if (ex != null)
- {
- observer.OnError(ex);
- return;
- }
-
- if (!hasNext)
- {
- if (lastException != null)
- observer.OnError(lastException);
- else
- observer.OnCompleted();
- return;
- }
-
- var d = new SingleAssignmentDisposable();
- subscription.Disposable = d;
- d.Disposable = current.Subscribe(observer.OnNext, exception =>
- {
- lastException = exception;
- self();
- }, observer.OnCompleted);
- }));
-
- return new CompositeDisposable(subscription, cancelable, Disposable.Create(() => gate.Wait(() =>
- {
- e.Dispose();
- isDisposed = true;
- })));
- });
-#endif
- }
-
- #endregion
-
- #region + CombineLatest +
-
- public virtual IObservable<TResult> CombineLatest<TFirst, TSecond, TResult>(IObservable<TFirst> first, IObservable<TSecond> second, Func<TFirst, TSecond, TResult> resultSelector)
- {
-#if !NO_PERF
- return new CombineLatest<TFirst, TSecond, TResult>(first, second, resultSelector);
-#else
- return new AnonymousObservable<TResult>(observer =>
- {
- var hasLeft = false;
- var hasRight = false;
-
- var left = default(TFirst);
- var right = default(TSecond);
-
- var leftDone = false;
- var rightDone = false;
-
- var leftSubscription = new SingleAssignmentDisposable();
- var rightSubscription = new SingleAssignmentDisposable();
-
- var gate = new object();
-
- leftSubscription.Disposable = first.Synchronize(gate).Subscribe(
- l =>
- {
- hasLeft = true;
- left = l;
-
- if (hasRight)
- {
- var res = default(TResult);
- try
- {
- res = resultSelector(left, right);
- }
- catch (Exception ex)
- {
- observer.OnError(ex);
- return;
- }
-
- observer.OnNext(res);
- }
- else if (rightDone)
- {
- observer.OnCompleted();
- return;
- }
- },
- observer.OnError,
- () =>
- {
- leftDone = true;
-
- if (rightDone)
- {
- observer.OnCompleted();
- return;
- }
- }
- );
-
- rightSubscription.Disposable = second.Synchronize(gate).Subscribe(
- r =>
- {
- hasRight = true;
- right = r;
-
- if (hasLeft)
- {
- var res = default(TResult);
- try
- {
- res = resultSelector(left, right);
- }
- catch (Exception ex)
- {
- observer.OnError(ex);
- return;
- }
-
- observer.OnNext(res);
- }
- else if (leftDone)
- {
- observer.OnCompleted();
- return;
- }
- },
- observer.OnError,
- () =>
- {
- rightDone = true;
-
- if (leftDone)
- {
- observer.OnCompleted();
- return;
- }
- }
- );
-
- return new CompositeDisposable(leftSubscription, rightSubscription);
- });
-#endif
- }
-
-#if !NO_PERF
-
- /* The following code is generated by a tool checked in to $/.../Source/Tools/CodeGenerators. */
-
- #region CombineLatest auto-generated code (6/10/2012 7:25:03 PM)
-
- public virtual IObservable<TResult> CombineLatest<TSource1, TSource2, TSource3, TResult>(IObservable<TSource1> source1, IObservable<TSource2> source2, IObservable<TSource3> source3, Func<TSource1, TSource2, TSource3, TResult> resultSelector)
- {
- return new CombineLatest<TSource1, TSource2, TSource3, TResult>(source1, source2, source3, resultSelector);
- }
-
- public virtual IObservable<TResult> CombineLatest<TSource1, TSource2, TSource3, TSource4, TResult>(IObservable<TSource1> source1, IObservable<TSource2> source2, IObservable<TSource3> source3, IObservable<TSource4> source4, Func<TSource1, TSource2, TSource3, TSource4, TResult> resultSelector)
- {
- return new CombineLatest<TSource1, TSource2, TSource3, TSource4, TResult>(source1, source2, source3, source4, resultSelector);
- }
-
-#if !NO_LARGEARITY
- public virtual IObservable<TResult> CombineLatest<TSource1, TSource2, TSource3, TSource4, TSource5, TResult>(IObservable<TSource1> source1, IObservable<TSource2> source2, IObservable<TSource3> source3, IObservable<TSource4> source4, IObservable<TSource5> source5, Func<TSource1, TSource2, TSource3, TSource4, TSource5, TResult> resultSelector)
- {
- return new CombineLatest<TSource1, TSource2, TSource3, TSource4, TSource5, TResult>(source1, source2, source3, source4, source5, resultSelector);
- }
-
- public virtual IObservable<TResult> CombineLatest<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TResult>(IObservable<TSource1> source1, IObservable<TSource2> source2, IObservable<TSource3> source3, IObservable<TSource4> source4, IObservable<TSource5> source5, IObservable<TSource6> source6, Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TResult> resultSelector)
- {
- return new CombineLatest<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TResult>(source1, source2, source3, source4, source5, source6, resultSelector);
- }
-
- public virtual IObservable<TResult> CombineLatest<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TResult>(IObservable<TSource1> source1, IObservable<TSource2> source2, IObservable<TSource3> source3, IObservable<TSource4> source4, IObservable<TSource5> source5, IObservable<TSource6> source6, IObservable<TSource7> source7, Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TResult> resultSelector)
- {
- return new CombineLatest<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TResult>(source1, source2, source3, source4, source5, source6, source7, resultSelector);
- }
-
- public virtual IObservable<TResult> CombineLatest<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TResult>(IObservable<TSource1> source1, IObservable<TSource2> source2, IObservable<TSource3> source3, IObservable<TSource4> source4, IObservable<TSource5> source5, IObservable<TSource6> source6, IObservable<TSource7> source7, IObservable<TSource8> source8, Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TResult> resultSelector)
- {
- return new CombineLatest<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TResult>(source1, source2, source3, source4, source5, source6, source7, source8, resultSelector);
- }
-
- public virtual IObservable<TResult> CombineLatest<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TResult>(IObservable<TSource1> source1, IObservable<TSource2> source2, IObservable<TSource3> source3, IObservable<TSource4> source4, IObservable<TSource5> source5, IObservable<TSource6> source6, IObservable<TSource7> source7, IObservable<TSource8> source8, IObservable<TSource9> source9, Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TResult> resultSelector)
- {
- return new CombineLatest<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TResult>(source1, source2, source3, source4, source5, source6, source7, source8, source9, resultSelector);
- }
-
- public virtual IObservable<TResult> CombineLatest<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TResult>(IObservable<TSource1> source1, IObservable<TSource2> source2, IObservable<TSource3> source3, IObservable<TSource4> source4, IObservable<TSource5> source5, IObservable<TSource6> source6, IObservable<TSource7> source7, IObservable<TSource8> source8, IObservable<TSource9> source9, IObservable<TSource10> source10, Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TResult> resultSelector)
- {
- return new CombineLatest<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TResult>(source1, source2, source3, source4, source5, source6, source7, source8, source9, source10, resultSelector);
- }
-
- public virtual IObservable<TResult> CombineLatest<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TResult>(IObservable<TSource1> source1, IObservable<TSource2> source2, IObservable<TSource3> source3, IObservable<TSource4> source4, IObservable<TSource5> source5, IObservable<TSource6> source6, IObservable<TSource7> source7, IObservable<TSource8> source8, IObservable<TSource9> source9, IObservable<TSource10> source10, IObservable<TSource11> source11, Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TResult> resultSelector)
- {
- return new CombineLatest<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TResult>(source1, source2, source3, source4, source5, source6, source7, source8, source9, source10, source11, resultSelector);
- }
-
- public virtual IObservable<TResult> CombineLatest<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TResult>(IObservable<TSource1> source1, IObservable<TSource2> source2, IObservable<TSource3> source3, IObservable<TSource4> source4, IObservable<TSource5> source5, IObservable<TSource6> source6, IObservable<TSource7> source7, IObservable<TSource8> source8, IObservable<TSource9> source9, IObservable<TSource10> source10, IObservable<TSource11> source11, IObservable<TSource12> source12, Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TResult> resultSelector)
- {
- return new CombineLatest<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TResult>(source1, source2, source3, source4, source5, source6, source7, source8, source9, source10, source11, source12, resultSelector);
- }
-
- public virtual IObservable<TResult> CombineLatest<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TResult>(IObservable<TSource1> source1, IObservable<TSource2> source2, IObservable<TSource3> source3, IObservable<TSource4> source4, IObservable<TSource5> source5, IObservable<TSource6> source6, IObservable<TSource7> source7, IObservable<TSource8> source8, IObservable<TSource9> source9, IObservable<TSource10> source10, IObservable<TSource11> source11, IObservable<TSource12> source12, IObservable<TSource13> source13, Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TResult> resultSelector)
- {
- return new CombineLatest<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TResult>(source1, source2, source3, source4, source5, source6, source7, source8, source9, source10, source11, source12, source13, resultSelector);
- }
-
- public virtual IObservable<TResult> CombineLatest<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TSource14, TResult>(IObservable<TSource1> source1, IObservable<TSource2> source2, IObservable<TSource3> source3, IObservable<TSource4> source4, IObservable<TSource5> source5, IObservable<TSource6> source6, IObservable<TSource7> source7, IObservable<TSource8> source8, IObservable<TSource9> source9, IObservable<TSource10> source10, IObservable<TSource11> source11, IObservable<TSource12> source12, IObservable<TSource13> source13, IObservable<TSource14> source14, Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TSource14, TResult> resultSelector)
- {
- return new CombineLatest<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TSource14, TResult>(source1, source2, source3, source4, source5, source6, source7, source8, source9, source10, source11, source12, source13, source14, resultSelector);
- }
-
- public virtual IObservable<TResult> CombineLatest<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TSource14, TSource15, TResult>(IObservable<TSource1> source1, IObservable<TSource2> source2, IObservable<TSource3> source3, IObservable<TSource4> source4, IObservable<TSource5> source5, IObservable<TSource6> source6, IObservable<TSource7> source7, IObservable<TSource8> source8, IObservable<TSource9> source9, IObservable<TSource10> source10, IObservable<TSource11> source11, IObservable<TSource12> source12, IObservable<TSource13> source13, IObservable<TSource14> source14, IObservable<TSource15> source15, Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TSource14, TSource15, TResult> resultSelector)
- {
- return new CombineLatest<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TSource14, TSource15, TResult>(source1, source2, source3, source4, source5, source6, source7, source8, source9, source10, source11, source12, source13, source14, source15, resultSelector);
- }
-
- public virtual IObservable<TResult> CombineLatest<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TSource14, TSource15, TSource16, TResult>(IObservable<TSource1> source1, IObservable<TSource2> source2, IObservable<TSource3> source3, IObservable<TSource4> source4, IObservable<TSource5> source5, IObservable<TSource6> source6, IObservable<TSource7> source7, IObservable<TSource8> source8, IObservable<TSource9> source9, IObservable<TSource10> source10, IObservable<TSource11> source11, IObservable<TSource12> source12, IObservable<TSource13> source13, IObservable<TSource14> source14, IObservable<TSource15> source15, IObservable<TSource16> source16, Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TSource14, TSource15, TSource16, TResult> resultSelector)
- {
- return new CombineLatest<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TSource14, TSource15, TSource16, TResult>(source1, source2, source3, source4, source5, source6, source7, source8, source9, source10, source11, source12, source13, source14, source15, source16, resultSelector);
- }
-
-#endif
-
- #endregion
-
-#endif
-
- public virtual IObservable<TResult> CombineLatest<TSource, TResult>(IEnumerable<IObservable<TSource>> sources, Func<IList<TSource>, TResult> resultSelector)
- {
- return CombineLatest_<TSource, TResult>(sources, resultSelector);
- }
-
- public virtual IObservable<IList<TSource>> CombineLatest<TSource>(IEnumerable<IObservable<TSource>> sources)
- {
- return CombineLatest_<TSource, IList<TSource>>(sources, res => res.ToList());
- }
-
- public virtual IObservable<IList<TSource>> CombineLatest<TSource>(params IObservable<TSource>[] sources)
- {
- return CombineLatest_<TSource, IList<TSource>>(sources, res => res.ToList());
- }
-
- private static IObservable<TResult> CombineLatest_<TSource, TResult>(IEnumerable<IObservable<TSource>> sources, Func<IList<TSource>, TResult> resultSelector)
- {
-#if !NO_PERF
- return new CombineLatest<TSource, TResult>(sources, resultSelector);
-#else
- return new AnonymousObservable<TResult>(observer =>
- {
- var srcs = sources.ToArray();
-
- var N = srcs.Length;
-
- var hasValue = new bool[N];
- var hasValueAll = false;
-
- var values = new List<TSource>(N);
- for (int i = 0; i < N; i++)
- values.Add(default(TSource));
-
- var isDone = new bool[N];
-
- var next = new Action<int>(i =>
- {
- hasValue[i] = true;
-
- if (hasValueAll || (hasValueAll = hasValue.All(Stubs<bool>.I)))
- {
- var res = default(TResult);
- try
- {
- res = resultSelector(new ReadOnlyCollection<TSource>(values));
- }
- catch (Exception ex)
- {
- observer.OnError(ex);
- return;
- }
-
- observer.OnNext(res);
- }
- else if (isDone.Where((x, j) => j != i).All(Stubs<bool>.I))
- {
- observer.OnCompleted();
- return;
- }
- });
-
- var done = new Action<int>(i =>
- {
- isDone[i] = true;
-
- if (isDone.All(Stubs<bool>.I))
- {
- observer.OnCompleted();
- return;
- }
- });
-
- var subscriptions = new SingleAssignmentDisposable[N];
-
- var gate = new object();
-
- for (int i = 0; i < N; i++)
- {
- var j = i;
- subscriptions[j] = new SingleAssignmentDisposable
- {
- Disposable = srcs[j].Synchronize(gate).Subscribe(
- x =>
- {
- values[j] = x;
- next(j);
- },
- observer.OnError,
- () =>
- {
- done(j);
- }
- )
- };
- }
-
- return new CompositeDisposable(subscriptions);
- });
-#endif
- }
-
- #endregion
-
- #region + Concat +
-
- public virtual IObservable<TSource> Concat<TSource>(IObservable<TSource> first, IObservable<TSource> second)
- {
- return Concat_<TSource>(new[] { first, second });
- }
-
- public virtual IObservable<TSource> Concat<TSource>(params IObservable<TSource>[] sources)
- {
- return Concat_<TSource>(sources);
- }
-
- public virtual IObservable<TSource> Concat<TSource>(IEnumerable<IObservable<TSource>> sources)
- {
- return Concat_<TSource>(sources);
- }
-
- private static IObservable<TSource> Concat_<TSource>(IEnumerable<IObservable<TSource>> sources)
- {
-#if !NO_PERF
- return new Concat<TSource>(sources);
-#else
- return new AnonymousObservable<TSource>(observer =>
- {
- var isDisposed = false;
- var e = sources.GetEnumerator();
- var subscription = new SerialDisposable();
- var gate = new AsyncLock();
-
- var cancelable = SchedulerDefaults.TailRecursion.Schedule(self => gate.Wait(() =>
- {
- var current = default(IObservable<TSource>);
- var hasNext = false;
- var ex = default(Exception);
-
- if (!isDisposed)
- {
- try
- {
- hasNext = e.MoveNext();
- if (hasNext)
- current = e.Current;
- else
- e.Dispose();
- }
- catch (Exception exception)
- {
- ex = exception;
- e.Dispose();
- }
- }
- else
- return;
-
- if (ex != null)
- {
- observer.OnError(ex);
- return;
- }
-
- if (!hasNext)
- {
- observer.OnCompleted();
- return;
- }
-
- var d = new SingleAssignmentDisposable();
- subscription.Disposable = d;
- d.Disposable = current.Subscribe(observer.OnNext, observer.OnError, self);
- }));
-
- return new CompositeDisposable(subscription, cancelable, Disposable.Create(() => gate.Wait(() =>
- {
- e.Dispose();
- isDisposed = true;
- })));
- });
-#endif
- }
-
- public virtual IObservable<TSource> Concat<TSource>(IObservable<IObservable<TSource>> sources)
- {
- return Concat_<TSource>(sources);
- }
-
-#if !NO_TPL
- public virtual IObservable<TSource> Concat<TSource>(IObservable<Task<TSource>> sources)
- {
- return Concat_<TSource>(Select(sources, TaskObservableExtensions.ToObservable));
- }
-#endif
-
- private IObservable<TSource> Concat_<TSource>(IObservable<IObservable<TSource>> sources)
- {
- return Merge(sources, 1);
- }
-
- #endregion
-
- #region + Merge +
-
- public virtual IObservable<TSource> Merge<TSource>(IObservable<IObservable<TSource>> sources)
- {
- return Merge_<TSource>(sources);
- }
-
-#if !NO_TPL
- public virtual IObservable<TSource> Merge<TSource>(IObservable<Task<TSource>> sources)
- {
- return Merge_<TSource>(Select(sources, TaskObservableExtensions.ToObservable));
- }
-#endif
-
- public virtual IObservable<TSource> Merge<TSource>(IObservable<IObservable<TSource>> sources, int maxConcurrent)
- {
- return Merge_<TSource>(sources, maxConcurrent);
- }
-
- public virtual IObservable<TSource> Merge<TSource>(IEnumerable<IObservable<TSource>> sources, int maxConcurrent)
- {
- return Merge_<TSource>(sources.ToObservable(), maxConcurrent);
- }
-
- public virtual IObservable<TSource> Merge<TSource>(IEnumerable<IObservable<TSource>> sources, int maxConcurrent, IScheduler scheduler)
- {
- return Merge_<TSource>(sources.ToObservable(scheduler), maxConcurrent);
- }
-
- public virtual IObservable<TSource> Merge<TSource>(IObservable<TSource> first, IObservable<TSource> second)
- {
- return Merge_<TSource>(new[] { first, second }.ToObservable());
- }
-
- public virtual IObservable<TSource> Merge<TSource>(IObservable<TSource> first, IObservable<TSource> second, IScheduler scheduler)
- {
- return Merge_<TSource>(new[] { first, second }.ToObservable(scheduler));
- }
-
- public virtual IObservable<TSource> Merge<TSource>(params IObservable<TSource>[] sources)
- {
- return Merge_<TSource>(sources.ToObservable());
- }
-
- public virtual IObservable<TSource> Merge<TSource>(IScheduler scheduler, params IObservable<TSource>[] sources)
- {
- return Merge_<TSource>(sources.ToObservable(scheduler));
- }
-
- public virtual IObservable<TSource> Merge<TSource>(IEnumerable<IObservable<TSource>> sources)
- {
- return Merge_<TSource>(sources.ToObservable());
- }
-
- public virtual IObservable<TSource> Merge<TSource>(IEnumerable<IObservable<TSource>> sources, IScheduler scheduler)
- {
- return Merge_<TSource>(sources.ToObservable(scheduler));
- }
-
- private static IObservable<TSource> Merge_<TSource>(IObservable<IObservable<TSource>> sources)
- {
-#if !NO_PERF
- return new Merge<TSource>(sources);
-#else
- return new AnonymousObservable<TSource>(observer =>
- {
- var gate = new object();
- var isStopped = false;
- var m = new SingleAssignmentDisposable();
- var group = new CompositeDisposable() { m };
-
- m.Disposable = sources.Subscribe(
- innerSource =>
- {
- var innerSubscription = new SingleAssignmentDisposable();
- group.Add(innerSubscription);
- innerSubscription.Disposable = innerSource.Subscribe(
- x =>
- {
- lock (gate)
- observer.OnNext(x);
- },
- exception =>
- {
- lock (gate)
- observer.OnError(exception);
- },
- () =>
- {
- group.Remove(innerSubscription); // modification MUST occur before subsequent check
- if (isStopped && group.Count == 1) // isStopped must be checked before group Count to ensure outer is not creating more groups
- lock (gate)
- observer.OnCompleted();
- });
- },
- exception =>
- {
- lock (gate)
- observer.OnError(exception);
- },
- () =>
- {
- isStopped = true; // modification MUST occur before subsequent check
- if (group.Count == 1)
- lock (gate)
- observer.OnCompleted();
- });
-
- return group;
- });
-#endif
- }
-
- private static IObservable<TSource> Merge_<TSource>(IObservable<IObservable<TSource>> sources, int maxConcurrent)
- {
-#if !NO_PERF
- return new Merge<TSource>(sources, maxConcurrent);
-#else
- return new AnonymousObservable<TSource>(observer =>
- {
- var gate = new object();
- var q = new Queue<IObservable<TSource>>();
- var isStopped = false;
- var group = new CompositeDisposable();
- var activeCount = 0;
-
- var subscribe = default(Action<IObservable<TSource>>);
- subscribe = xs =>
- {
- var subscription = new SingleAssignmentDisposable();
- group.Add(subscription);
- subscription.Disposable = xs.Subscribe(
- x =>
- {
- lock (gate)
- observer.OnNext(x);
- },
- exception =>
- {
- lock (gate)
- observer.OnError(exception);
- },
- () =>
- {
- group.Remove(subscription);
- lock (gate)
- {
- if (q.Count > 0)
- {
- var s = q.Dequeue();
- subscribe(s);
- }
- else
- {
- activeCount--;
- if (isStopped && activeCount == 0)
- observer.OnCompleted();
- }
- }
- });
- };
-
- group.Add(sources.Subscribe(
- innerSource =>
- {
- lock (gate)
- {
- if (activeCount < maxConcurrent)
- {
- activeCount++;
- subscribe(innerSource);
- }
- else
- q.Enqueue(innerSource);
- }
- },
- exception =>
- {
- lock (gate)
- observer.OnError(exception);
- },
- () =>
- {
- lock (gate)
- {
- isStopped = true;
- if (activeCount == 0)
- observer.OnCompleted();
- }
- }));
-
- return group;
- });
-#endif
- }
-
- #endregion
-
- #region + OnErrorResumeNext +
-
- public virtual IObservable<TSource> OnErrorResumeNext<TSource>(IObservable<TSource> first, IObservable<TSource> second)
- {
- return OnErrorResumeNext_<TSource>(new[] { first, second });
- }
-
- public virtual IObservable<TSource> OnErrorResumeNext<TSource>(params IObservable<TSource>[] sources)
- {
- return OnErrorResumeNext_<TSource>(sources);
- }
-
- public virtual IObservable<TSource> OnErrorResumeNext<TSource>(IEnumerable<IObservable<TSource>> sources)
- {
- return OnErrorResumeNext_<TSource>(sources);
- }
-
- private static IObservable<TSource> OnErrorResumeNext_<TSource>(IEnumerable<IObservable<TSource>> sources)
- {
-#if !NO_PERF
- return new OnErrorResumeNext<TSource>(sources);
-#else
- return new AnonymousObservable<TSource>(observer =>
- {
- var gate = new AsyncLock();
- var isDisposed = false;
- var e = sources.GetEnumerator();
- var subscription = new SerialDisposable();
-
- var cancelable = SchedulerDefaults.TailRecursion.Schedule(self => gate.Wait(() =>
- {
- var current = default(IObservable<TSource>);
- var hasNext = false;
- var ex = default(Exception);
-
- if (!isDisposed)
- {
- try
- {
- hasNext = e.MoveNext();
- if (hasNext)
- current = e.Current;
- else
- e.Dispose();
- }
- catch (Exception exception)
- {
- ex = exception;
- e.Dispose();
- }
- }
- else
- return;
-
- if (ex != null)
- {
- observer.OnError(ex);
- return;
- }
-
- if (!hasNext)
- {
- observer.OnCompleted();
- return;
- }
-
- var d = new SingleAssignmentDisposable();
- subscription.Disposable = d;
- d.Disposable = current.Subscribe(observer.OnNext, exception => self(), self);
- }));
-
- return new CompositeDisposable(subscription, cancelable, Disposable.Create(() => gate.Wait(() =>
- {
- e.Dispose();
- isDisposed = true;
- })));
- });
-#endif
- }
-
- #endregion
-
- #region + SkipUntil +
-
- public virtual IObservable<TSource> SkipUntil<TSource, TOther>(IObservable<TSource> source, IObservable<TOther> other)
- {
-#if !NO_PERF
- return new SkipUntil<TSource, TOther>(source, other);
-#else
- return new AnonymousObservable<TSource>(observer =>
- {
- var sourceSubscription = new SingleAssignmentDisposable();
- var otherSubscription = new SingleAssignmentDisposable();
-
- var open = false;
-
- var gate = new object();
-
- sourceSubscription.Disposable = source.Synchronize(gate).Subscribe(
- x =>
- {
- if (open)
- observer.OnNext(x);
- },
- observer.OnError, // BREAKING CHANGE - Error propagation was guarded by "other" source in v1.0.10621 (due to materialization).
- () =>
- {
- if (open)
- observer.OnCompleted();
- }
- );
-
- otherSubscription.Disposable = other.Synchronize(gate).Subscribe(
- x =>
- {
- open = true;
- otherSubscription.Dispose();
- },
- observer.OnError
- );
-
- return new CompositeDisposable(sourceSubscription, otherSubscription);
- });
-#endif
- }
-
- #endregion
-
- #region + Switch +
-
- public virtual IObservable<TSource> Switch<TSource>(IObservable<IObservable<TSource>> sources)
- {
- return Switch_<TSource>(sources);
- }
-
-#if !NO_TPL
- public virtual IObservable<TSource> Switch<TSource>(IObservable<Task<TSource>> sources)
- {
- return Switch_<TSource>(Select(sources, TaskObservableExtensions.ToObservable));
- }
-#endif
-
- private IObservable<TSource> Switch_<TSource>(IObservable<IObservable<TSource>> sources)
- {
-#if !NO_PERF
- return new Switch<TSource>(sources);
-#else
- return new AnonymousObservable<TSource>(observer =>
- {
- var gate = new object();
- var innerSubscription = new SerialDisposable();
- var isStopped = false;
- var latest = 0UL;
- var hasLatest = false;
- var subscription = sources.Subscribe(
- innerSource =>
- {
- var id = default(ulong);
- lock (gate)
- {
- id = unchecked(++latest);
- hasLatest = true;
- }
-
- var d = new SingleAssignmentDisposable();
- innerSubscription.Disposable = d;
- d.Disposable = innerSource.Subscribe(
- x =>
- {
- lock (gate)
- {
- if (latest == id)
- observer.OnNext(x);
- }
- },
- exception =>
- {
- lock (gate)
- {
- if (latest == id)
- observer.OnError(exception);
- }
- },
- () =>
- {
- lock (gate)
- {
- if (latest == id)
- {
- hasLatest = false;
-
- if (isStopped)
- observer.OnCompleted();
- }
- }
- });
- },
- exception =>
- {
- lock (gate)
- observer.OnError(exception);
- },
- () =>
- {
- lock (gate)
- {
- isStopped = true;
- if (!hasLatest)
- observer.OnCompleted();
- }
- });
-
- return new CompositeDisposable(subscription, innerSubscription);
- });
-#endif
- }
-
- #endregion
-
- #region + TakeUntil +
-
- public virtual IObservable<TSource> TakeUntil<TSource, TOther>(IObservable<TSource> source, IObservable<TOther> other)
- {
-#if !NO_PERF
- return new TakeUntil<TSource, TOther>(source, other);
-#else
- return new AnonymousObservable<TSource>(observer =>
- {
- var sourceSubscription = new SingleAssignmentDisposable();
- var otherSubscription = new SingleAssignmentDisposable();
-
- var gate = new object();
-
- // COMPAT - Order of Subscribe calls per v1.0.10621
- otherSubscription.Disposable = other.Synchronize(gate).Subscribe(
- x =>
- {
- observer.OnCompleted();
- },
- observer.OnError
- );
-
- sourceSubscription.Disposable = source.Synchronize(gate).Finally(otherSubscription.Dispose).Subscribe(observer);
-
- return new CompositeDisposable(sourceSubscription, otherSubscription);
- });
-#endif
- }
-
- #endregion
-
- #region + Window +
-
- public virtual IObservable<IObservable<TSource>> Window<TSource, TWindowClosing>(IObservable<TSource> source, Func<IObservable<TWindowClosing>> windowClosingSelector)
- {
-#if !NO_PERF
- return new Window<TSource, TWindowClosing>(source, windowClosingSelector);
-#else
- return new AnonymousObservable<IObservable<TSource>>(observer =>
- {
- var window = new Subject<TSource>();
- var gate = new object();
-
- var m = new SerialDisposable();
- var d = new CompositeDisposable(2) { m };
- var r = new RefCountDisposable(d);
-
- observer.OnNext(window.AddRef(r));
- d.Add(source.SubscribeSafe(new AnonymousObserver<TSource>(
- x =>
- {
- lock (gate)
- {
- window.OnNext(x);
- }
- },
- ex =>
- {
- lock (gate)
- {
- window.OnError(ex);
- observer.OnError(ex);
- }
- },
- () =>
- {
- lock (gate)
- {
- window.OnCompleted();
- observer.OnCompleted();
- }
- })));
-
- var l = new AsyncLock();
-
- Action createWindowClose = null;
- createWindowClose = () =>
- {
- var windowClose = default(IObservable<TWindowClosing>);
- try
- {
- windowClose = windowClosingSelector();
- }
- catch (Exception exception)
- {
- lock (gate)
- {
- observer.OnError(exception);
- }
- return;
- }
-
- var m1 = new SingleAssignmentDisposable();
- m.Disposable = m1;
- m1.Disposable = windowClose.Take(1).SubscribeSafe(new AnonymousObserver<TWindowClosing>(
- Stubs<TWindowClosing>.Ignore,
- ex =>
- {
- lock (gate)
- {
- window.OnError(ex);
- observer.OnError(ex);
- }
- },
- () =>
- {
- lock (gate)
- {
- window.OnCompleted();
- window = new Subject<TSource>();
- observer.OnNext(window.AddRef(r));
- }
- l.Wait(createWindowClose);
- }));
- };
-
- l.Wait(createWindowClose);
-
- return r;
- });
-#endif
- }
-
- public virtual IObservable<IObservable<TSource>> Window<TSource, TWindowOpening, TWindowClosing>(IObservable<TSource> source, IObservable<TWindowOpening> windowOpenings, Func<TWindowOpening, IObservable<TWindowClosing>> windowClosingSelector)
- {
- return windowOpenings.GroupJoin(source, windowClosingSelector, _ => Observable.Empty<Unit>(), (_, window) => window);
- }
-
- public virtual IObservable<IObservable<TSource>> Window<TSource, TWindowBoundary>(IObservable<TSource> source, IObservable<TWindowBoundary> windowBoundaries)
- {
-#if !NO_PERF
- return new Window<TSource, TWindowBoundary>(source, windowBoundaries);
-#else
- return new AnonymousObservable<IObservable<TSource>>(observer =>
- {
- var window = new Subject<TSource>();
- var gate = new object();
-
- var d = new CompositeDisposable(2);
- var r = new RefCountDisposable(d);
-
- observer.OnNext(window.AddRef(r));
-
- d.Add(source.SubscribeSafe(new AnonymousObserver<TSource>(
- x =>
- {
- lock (gate)
- {
- window.OnNext(x);
- }
- },
- ex =>
- {
- lock (gate)
- {
- window.OnError(ex);
- observer.OnError(ex);
- }
- },
- () =>
- {
- lock (gate)
- {
- window.OnCompleted();
- observer.OnCompleted();
- }
- }
- )));
-
- d.Add(windowBoundaries.SubscribeSafe(new AnonymousObserver<TWindowBoundary>(
- w =>
- {
- lock (gate)
- {
- window.OnCompleted();
- window = new Subject<TSource>();
- observer.OnNext(window.AddRef(r));
- }
- },
- ex =>
- {
- lock (gate)
- {
- window.OnError(ex);
- observer.OnError(ex);
- }
- },
- () =>
- {
- lock (gate)
- {
- window.OnCompleted();
- observer.OnCompleted();
- }
- }
- )));
-
- return r;
- });
-#endif
- }
-
- #endregion
-
- #region + Zip +
-
- public virtual IObservable<TResult> Zip<TFirst, TSecond, TResult>(IObservable<TFirst> first, IObservable<TSecond> second, Func<TFirst, TSecond, TResult> resultSelector)
- {
-#if !NO_PERF
- return new Zip<TFirst, TSecond, TResult>(first, second, resultSelector);
-#else
- return new AnonymousObservable<TResult>(observer =>
- {
- var queueLeft = new Queue<TFirst>();
- var queueRight = new Queue<TSecond>();
-
- var leftDone = false;
- var rightDone = false;
-
- var leftSubscription = new SingleAssignmentDisposable();
- var rightSubscription = new SingleAssignmentDisposable();
-
- var gate = new object();
-
- leftSubscription.Disposable = first.Synchronize(gate).Subscribe(
- l =>
- {
- if (queueRight.Count > 0)
- {
- var r = queueRight.Dequeue();
-
- var res = default(TResult);
- try
- {
- res = resultSelector(l, r);
- }
- catch (Exception ex)
- {
- observer.OnError(ex);
- return;
- }
-
- observer.OnNext(res);
- }
- else
- {
- if (rightDone)
- {
- observer.OnCompleted();
- return;
- }
-
- queueLeft.Enqueue(l);
- }
- },
- observer.OnError,
- () =>
- {
- leftDone = true;
-
- if (rightDone)
- {
- observer.OnCompleted();
- return;
- }
- }
- );
-
- rightSubscription.Disposable = second.Synchronize(gate).Subscribe(
- r =>
- {
- if (queueLeft.Count > 0)
- {
- var l = queueLeft.Dequeue();
-
- var res = default(TResult);
- try
- {
- res = resultSelector(l, r);
- }
- catch (Exception ex)
- {
- observer.OnError(ex);
- return;
- }
-
- observer.OnNext(res);
- }
- else
- {
- if (leftDone)
- {
- observer.OnCompleted();
- return;
- }
-
- queueRight.Enqueue(r);
- }
- },
- observer.OnError,
- () =>
- {
- rightDone = true;
-
- if (leftDone)
- {
- observer.OnCompleted();
- return;
- }
- }
- );
-
- return new CompositeDisposable(leftSubscription, rightSubscription, Disposable.Create(() => { queueLeft.Clear(); queueRight.Clear(); }));
- });
-#endif
- }
-
- public virtual IObservable<TResult> Zip<TSource, TResult>(IEnumerable<IObservable<TSource>> sources, Func<IList<TSource>, TResult> resultSelector)
- {
- return Zip_<TSource>(sources).Select(resultSelector);
- }
-
- public virtual IObservable<IList<TSource>> Zip<TSource>(IEnumerable<IObservable<TSource>> sources)
- {
- return Zip_<TSource>(sources);
- }
-
- public virtual IObservable<IList<TSource>> Zip<TSource>(params IObservable<TSource>[] sources)
- {
- return Zip_<TSource>(sources);
- }
-
- private static IObservable<IList<TSource>> Zip_<TSource>(IEnumerable<IObservable<TSource>> sources)
- {
-#if !NO_PERF
- return new Zip<TSource>(sources);
-#else
- return new AnonymousObservable<IList<TSource>>(observer =>
- {
- var srcs = sources.ToArray();
-
- var N = srcs.Length;
-
- var queues = new Queue<TSource>[N];
- for (int i = 0; i < N; i++)
- queues[i] = new Queue<TSource>();
-
- var isDone = new bool[N];
-
- var next = new Action<int>(i =>
- {
- if (queues.All(q => q.Count > 0))
- {
- var res = queues.Select(q => q.Dequeue()).ToList();
- observer.OnNext(res);
- }
- else if (isDone.Where((x, j) => j != i).All(Stubs<bool>.I))
- {
- observer.OnCompleted();
- return;
- }
- });
-
- var done = new Action<int>(i =>
- {
- isDone[i] = true;
-
- if (isDone.All(Stubs<bool>.I))
- {
- observer.OnCompleted();
- return;
- }
- });
-
- var subscriptions = new SingleAssignmentDisposable[N];
-
- var gate = new object();
-
- for (int i = 0; i < N; i++)
- {
- var j = i;
- subscriptions[j] = new SingleAssignmentDisposable
- {
- Disposable = srcs[j].Synchronize(gate).Subscribe(
- x =>
- {
- queues[j].Enqueue(x);
- next(j);
- },
- observer.OnError,
- () =>
- {
- done(j);
- }
- )
- };
- }
-
- return new CompositeDisposable(subscriptions) { Disposable.Create(() => { foreach (var q in queues) q.Clear(); }) };
- });
-#endif
- }
-
-#if !NO_PERF
-
- /* The following code is generated by a tool checked in to $/.../Source/Tools/CodeGenerators. */
-
- #region Zip auto-generated code (6/10/2012 8:15:28 PM)
-
- public virtual IObservable<TResult> Zip<TSource1, TSource2, TSource3, TResult>(IObservable<TSource1> source1, IObservable<TSource2> source2, IObservable<TSource3> source3, Func<TSource1, TSource2, TSource3, TResult> resultSelector)
- {
- return new Zip<TSource1, TSource2, TSource3, TResult>(source1, source2, source3, resultSelector);
- }
-
- public virtual IObservable<TResult> Zip<TSource1, TSource2, TSource3, TSource4, TResult>(IObservable<TSource1> source1, IObservable<TSource2> source2, IObservable<TSource3> source3, IObservable<TSource4> source4, Func<TSource1, TSource2, TSource3, TSource4, TResult> resultSelector)
- {
- return new Zip<TSource1, TSource2, TSource3, TSource4, TResult>(source1, source2, source3, source4, resultSelector);
- }
-
-#if !NO_LARGEARITY
-
- public virtual IObservable<TResult> Zip<TSource1, TSource2, TSource3, TSource4, TSource5, TResult>(IObservable<TSource1> source1, IObservable<TSource2> source2, IObservable<TSource3> source3, IObservable<TSource4> source4, IObservable<TSource5> source5, Func<TSource1, TSource2, TSource3, TSource4, TSource5, TResult> resultSelector)
- {
- return new Zip<TSource1, TSource2, TSource3, TSource4, TSource5, TResult>(source1, source2, source3, source4, source5, resultSelector);
- }
-
- public virtual IObservable<TResult> Zip<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TResult>(IObservable<TSource1> source1, IObservable<TSource2> source2, IObservable<TSource3> source3, IObservable<TSource4> source4, IObservable<TSource5> source5, IObservable<TSource6> source6, Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TResult> resultSelector)
- {
- return new Zip<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TResult>(source1, source2, source3, source4, source5, source6, resultSelector);
- }
-
- public virtual IObservable<TResult> Zip<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TResult>(IObservable<TSource1> source1, IObservable<TSource2> source2, IObservable<TSource3> source3, IObservable<TSource4> source4, IObservable<TSource5> source5, IObservable<TSource6> source6, IObservable<TSource7> source7, Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TResult> resultSelector)
- {
- return new Zip<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TResult>(source1, source2, source3, source4, source5, source6, source7, resultSelector);
- }
-
- public virtual IObservable<TResult> Zip<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TResult>(IObservable<TSource1> source1, IObservable<TSource2> source2, IObservable<TSource3> source3, IObservable<TSource4> source4, IObservable<TSource5> source5, IObservable<TSource6> source6, IObservable<TSource7> source7, IObservable<TSource8> source8, Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TResult> resultSelector)
- {
- return new Zip<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TResult>(source1, source2, source3, source4, source5, source6, source7, source8, resultSelector);
- }
-
- public virtual IObservable<TResult> Zip<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TResult>(IObservable<TSource1> source1, IObservable<TSource2> source2, IObservable<TSource3> source3, IObservable<TSource4> source4, IObservable<TSource5> source5, IObservable<TSource6> source6, IObservable<TSource7> source7, IObservable<TSource8> source8, IObservable<TSource9> source9, Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TResult> resultSelector)
- {
- return new Zip<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TResult>(source1, source2, source3, source4, source5, source6, source7, source8, source9, resultSelector);
- }
-
- public virtual IObservable<TResult> Zip<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TResult>(IObservable<TSource1> source1, IObservable<TSource2> source2, IObservable<TSource3> source3, IObservable<TSource4> source4, IObservable<TSource5> source5, IObservable<TSource6> source6, IObservable<TSource7> source7, IObservable<TSource8> source8, IObservable<TSource9> source9, IObservable<TSource10> source10, Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TResult> resultSelector)
- {
- return new Zip<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TResult>(source1, source2, source3, source4, source5, source6, source7, source8, source9, source10, resultSelector);
- }
-
- public virtual IObservable<TResult> Zip<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TResult>(IObservable<TSource1> source1, IObservable<TSource2> source2, IObservable<TSource3> source3, IObservable<TSource4> source4, IObservable<TSource5> source5, IObservable<TSource6> source6, IObservable<TSource7> source7, IObservable<TSource8> source8, IObservable<TSource9> source9, IObservable<TSource10> source10, IObservable<TSource11> source11, Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TResult> resultSelector)
- {
- return new Zip<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TResult>(source1, source2, source3, source4, source5, source6, source7, source8, source9, source10, source11, resultSelector);
- }
-
- public virtual IObservable<TResult> Zip<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TResult>(IObservable<TSource1> source1, IObservable<TSource2> source2, IObservable<TSource3> source3, IObservable<TSource4> source4, IObservable<TSource5> source5, IObservable<TSource6> source6, IObservable<TSource7> source7, IObservable<TSource8> source8, IObservable<TSource9> source9, IObservable<TSource10> source10, IObservable<TSource11> source11, IObservable<TSource12> source12, Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TResult> resultSelector)
- {
- return new Zip<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TResult>(source1, source2, source3, source4, source5, source6, source7, source8, source9, source10, source11, source12, resultSelector);
- }
-
- public virtual IObservable<TResult> Zip<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TResult>(IObservable<TSource1> source1, IObservable<TSource2> source2, IObservable<TSource3> source3, IObservable<TSource4> source4, IObservable<TSource5> source5, IObservable<TSource6> source6, IObservable<TSource7> source7, IObservable<TSource8> source8, IObservable<TSource9> source9, IObservable<TSource10> source10, IObservable<TSource11> source11, IObservable<TSource12> source12, IObservable<TSource13> source13, Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TResult> resultSelector)
- {
- return new Zip<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TResult>(source1, source2, source3, source4, source5, source6, source7, source8, source9, source10, source11, source12, source13, resultSelector);
- }
-
- public virtual IObservable<TResult> Zip<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TSource14, TResult>(IObservable<TSource1> source1, IObservable<TSource2> source2, IObservable<TSource3> source3, IObservable<TSource4> source4, IObservable<TSource5> source5, IObservable<TSource6> source6, IObservable<TSource7> source7, IObservable<TSource8> source8, IObservable<TSource9> source9, IObservable<TSource10> source10, IObservable<TSource11> source11, IObservable<TSource12> source12, IObservable<TSource13> source13, IObservable<TSource14> source14, Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TSource14, TResult> resultSelector)
- {
- return new Zip<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TSource14, TResult>(source1, source2, source3, source4, source5, source6, source7, source8, source9, source10, source11, source12, source13, source14, resultSelector);
- }
-
- public virtual IObservable<TResult> Zip<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TSource14, TSource15, TResult>(IObservable<TSource1> source1, IObservable<TSource2> source2, IObservable<TSource3> source3, IObservable<TSource4> source4, IObservable<TSource5> source5, IObservable<TSource6> source6, IObservable<TSource7> source7, IObservable<TSource8> source8, IObservable<TSource9> source9, IObservable<TSource10> source10, IObservable<TSource11> source11, IObservable<TSource12> source12, IObservable<TSource13> source13, IObservable<TSource14> source14, IObservable<TSource15> source15, Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TSource14, TSource15, TResult> resultSelector)
- {
- return new Zip<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TSource14, TSource15, TResult>(source1, source2, source3, source4, source5, source6, source7, source8, source9, source10, source11, source12, source13, source14, source15, resultSelector);
- }
-
- public virtual IObservable<TResult> Zip<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TSource14, TSource15, TSource16, TResult>(IObservable<TSource1> source1, IObservable<TSource2> source2, IObservable<TSource3> source3, IObservable<TSource4> source4, IObservable<TSource5> source5, IObservable<TSource6> source6, IObservable<TSource7> source7, IObservable<TSource8> source8, IObservable<TSource9> source9, IObservable<TSource10> source10, IObservable<TSource11> source11, IObservable<TSource12> source12, IObservable<TSource13> source13, IObservable<TSource14> source14, IObservable<TSource15> source15, IObservable<TSource16> source16, Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TSource14, TSource15, TSource16, TResult> resultSelector)
- {
- return new Zip<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TSource14, TSource15, TSource16, TResult>(source1, source2, source3, source4, source5, source6, source7, source8, source9, source10, source11, source12, source13, source14, source15, source16, resultSelector);
- }
-
-#endif
-
- #endregion
-
-#endif
-
- public virtual IObservable<TResult> Zip<TFirst, TSecond, TResult>(IObservable<TFirst> first, IEnumerable<TSecond> second, Func<TFirst, TSecond, TResult> resultSelector)
- {
-#if !NO_PERF
- return new Zip<TFirst, TSecond, TResult>(first, second, resultSelector);
-#else
- return new AnonymousObservable<TResult>(observer =>
- {
- var rightEnumerator = second.GetEnumerator();
- var leftSubscription = first.Subscribe(left =>
- {
- var hasNext = false;
- try
- {
- hasNext = rightEnumerator.MoveNext();
- }
- catch (Exception ex)
- {
- observer.OnError(ex);
- return;
- }
-
- if (hasNext)
- {
- var right = default(TSecond);
- try
- {
- right = rightEnumerator.Current;
- }
- catch (Exception ex)
- {
- observer.OnError(ex);
- return;
- }
-
- TResult result;
- try
- {
- result = resultSelector(left, right);
- }
- catch (Exception ex)
- {
- observer.OnError(ex);
- return;
- }
- observer.OnNext(result);
- }
- else
- {
- observer.OnCompleted();
- }
- },
- observer.OnError,
- observer.OnCompleted
- );
-
- return new CompositeDisposable(leftSubscription, rightEnumerator);
- });
-#endif
- }
-
- #endregion
-
- #region |> Helpers <|
-
-#if NO_PERF
-
- private static IObservable<TResult> Combine<TLeft, TRight, TResult>(IObservable<TLeft> leftSource, IObservable<TRight> rightSource, Func<IObserver<TResult>, IDisposable, IDisposable, IObserver<Either<Notification<TLeft>, Notification<TRight>>>> combinerSelector)
- {
- return new AnonymousObservable<TResult>(observer =>
- {
- var leftSubscription = new SingleAssignmentDisposable();
- var rightSubscription = new SingleAssignmentDisposable();
-
- var combiner = combinerSelector(observer, leftSubscription, rightSubscription);
- var gate = new object();
-
- leftSubscription.Disposable = leftSource.Materialize().Select(x => Either<Notification<TLeft>, Notification<TRight>>.CreateLeft(x)).Synchronize(gate).Subscribe(combiner);
- rightSubscription.Disposable = rightSource.Materialize().Select(x => Either<Notification<TLeft>, Notification<TRight>>.CreateRight(x)).Synchronize(gate).Subscribe(combiner);
-
- return new CompositeDisposable(leftSubscription, rightSubscription);
- });
- }
-
-#endif
-
- #endregion
- }
-}
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/QueryLanguage.Single.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/QueryLanguage.Single.cs
deleted file mode 100644
index 09e2df4..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/QueryLanguage.Single.cs
+++ /dev/null
@@ -1,661 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System.Collections.Generic;
-using System.Linq;
-using System.Reactive.Concurrency;
-using System.Reactive.Disposables;
-using System.Reactive.Subjects;
-
-namespace System.Reactive.Linq
-{
-#if !NO_PERF
- using Observαble;
-#endif
-
- internal partial class QueryLanguage
- {
- #region + AsObservable +
-
- public virtual IObservable<TSource> AsObservable<TSource>(IObservable<TSource> source)
- {
-#if !NO_PERF
- var asObservable = source as AsObservable<TSource>;
- if (asObservable != null)
- return asObservable.Ω();
-
- return new AsObservable<TSource>(source);
-#else
- return new AnonymousObservable<TSource>(observer => source.Subscribe(observer));
-#endif
- }
-
- #endregion
-
- #region + Buffer +
-
- public virtual IObservable<IList<TSource>> Buffer<TSource>(IObservable<TSource> source, int count)
- {
- return Buffer_<TSource>(source, count, count);
- }
-
- public virtual IObservable<IList<TSource>> Buffer<TSource>(IObservable<TSource> source, int count, int skip)
- {
- return Buffer_<TSource>(source, count, skip);
- }
-
- private static IObservable<IList<TSource>> Buffer_<TSource>(IObservable<TSource> source, int count, int skip)
- {
-#if !NO_PERF
- return new Buffer<TSource>(source, count, skip);
-#else
- return Window_<TSource>(source, count, skip).SelectMany(Observable.ToList).Where(list => list.Count > 0);
-#endif
- }
-
- #endregion
-
- #region + Dematerialize +
-
- public virtual IObservable<TSource> Dematerialize<TSource>(IObservable<Notification<TSource>> source)
- {
-#if !NO_PERF
- var materialize = source as Materialize<TSource>;
- if (materialize != null)
- return materialize.Dematerialize();
-
- return new Dematerialize<TSource>(source);
-#else
- return new AnonymousObservable<TSource>(observer =>
- source.Subscribe(x => x.Accept(observer), observer.OnError, observer.OnCompleted));
-#endif
- }
-
- #endregion
-
- #region + DistinctUntilChanged +
-
- public virtual IObservable<TSource> DistinctUntilChanged<TSource>(IObservable<TSource> source)
- {
- return DistinctUntilChanged_(source, x => x, EqualityComparer<TSource>.Default);
- }
-
- public virtual IObservable<TSource> DistinctUntilChanged<TSource>(IObservable<TSource> source, IEqualityComparer<TSource> comparer)
- {
- return DistinctUntilChanged_(source, x => x, comparer);
- }
-
- public virtual IObservable<TSource> DistinctUntilChanged<TSource, TKey>(IObservable<TSource> source, Func<TSource, TKey> keySelector)
- {
- return DistinctUntilChanged_(source, keySelector, EqualityComparer<TKey>.Default);
- }
-
- public virtual IObservable<TSource> DistinctUntilChanged<TSource, TKey>(IObservable<TSource> source, Func<TSource, TKey> keySelector, IEqualityComparer<TKey> comparer)
- {
- return DistinctUntilChanged_(source, keySelector, comparer);
- }
-
- private static IObservable<TSource> DistinctUntilChanged_<TSource, TKey>(IObservable<TSource> source, Func<TSource, TKey> keySelector, IEqualityComparer<TKey> comparer)
- {
-#if !NO_PERF
- return new DistinctUntilChanged<TSource, TKey>(source, keySelector, comparer);
-#else
- return new AnonymousObservable<TSource>(observer =>
- {
- var currentKey = default(TKey);
- var hasCurrentKey = false;
- return source.Subscribe(
- value =>
- {
- var key = default(TKey);
- try
- {
- key = keySelector(value);
- }
- catch (Exception exception)
- {
- observer.OnError(exception);
- return;
- }
- var comparerEquals = false;
- if (hasCurrentKey)
- {
- try
- {
- comparerEquals = comparer.Equals(currentKey, key);
- }
- catch (Exception exception)
- {
- observer.OnError(exception);
- return;
- }
- }
- if (!hasCurrentKey || !comparerEquals)
- {
- hasCurrentKey = true;
- currentKey = key;
- observer.OnNext(value);
- }
- },
- observer.OnError,
- observer.OnCompleted);
- });
-#endif
- }
-
- #endregion
-
- #region + Do +
-
- public virtual IObservable<TSource> Do<TSource>(IObservable<TSource> source, Action<TSource> onNext)
- {
-#if !NO_PERF
- return Do_<TSource>(source, onNext, Stubs<Exception>.Ignore, Stubs.Nop);
-#else
- // PERFORMANCE - Use of Select allows for operator coalescing
- return source.Select(
- x =>
- {
- onNext(x);
- return x;
- }
- );
-#endif
- }
-
- public virtual IObservable<TSource> Do<TSource>(IObservable<TSource> source, Action<TSource> onNext, Action onCompleted)
- {
-#if !NO_PERF
- return Do_<TSource>(source, onNext, Stubs<Exception>.Ignore, onCompleted);
-#else
- return new AnonymousObservable<TSource>(obs =>
- {
- return source.Subscribe(
- x =>
- {
- try
- {
- onNext(x);
- }
- catch (Exception ex)
- {
- obs.OnError(ex);
- }
- obs.OnNext(x);
- },
- obs.OnError,
- () =>
- {
- try
- {
- onCompleted();
- }
- catch (Exception ex)
- {
- obs.OnError(ex);
- }
- obs.OnCompleted();
- });
- });
-#endif
- }
-
- public virtual IObservable<TSource> Do<TSource>(IObservable<TSource> source, Action<TSource> onNext, Action<Exception> onError)
- {
-#if !NO_PERF
- return Do_<TSource>(source, onNext, onError, Stubs.Nop);
-#else
- return new AnonymousObservable<TSource>(obs =>
- {
- return source.Subscribe(
- x =>
- {
- try
- {
- onNext(x);
- }
- catch (Exception ex)
- {
- obs.OnError(ex);
- }
- obs.OnNext(x);
- },
- ex =>
- {
- try
- {
- onError(ex);
- }
- catch (Exception ex2)
- {
- obs.OnError(ex2);
- }
- obs.OnError(ex);
- },
- obs.OnCompleted);
- });
-#endif
- }
-
- public virtual IObservable<TSource> Do<TSource>(IObservable<TSource> source, Action<TSource> onNext, Action<Exception> onError, Action onCompleted)
- {
- return Do_(source, onNext, onError, onCompleted);
- }
-
- public virtual IObservable<TSource> Do<TSource>(IObservable<TSource> source, IObserver<TSource> observer)
- {
- return Do_(source, observer.OnNext, observer.OnError, observer.OnCompleted);
- }
-
- private static IObservable<TSource> Do_<TSource>(IObservable<TSource> source, Action<TSource> onNext, Action<Exception> onError, Action onCompleted)
- {
-#if !NO_PERF
- return new Do<TSource>(source, onNext, onError, onCompleted);
-#else
- return new AnonymousObservable<TSource>(obs =>
- {
- return source.Subscribe(
- x =>
- {
- try
- {
- onNext(x);
- }
- catch (Exception ex)
- {
- obs.OnError(ex);
- }
- obs.OnNext(x);
- },
- ex =>
- {
- try
- {
- onError(ex);
- }
- catch (Exception ex2)
- {
- obs.OnError(ex2);
- }
- obs.OnError(ex);
- },
- () =>
- {
- try
- {
- onCompleted();
- }
- catch (Exception ex)
- {
- obs.OnError(ex);
- }
- obs.OnCompleted();
- });
- });
-#endif
- }
-
- #endregion
-
- #region + Finally +
-
- public virtual IObservable<TSource> Finally<TSource>(IObservable<TSource> source, Action finallyAction)
- {
-#if !NO_PERF
- return new Finally<TSource>(source, finallyAction);
-#else
- return new AnonymousObservable<TSource>(observer =>
- {
- var subscription = source.Subscribe(observer);
-
- return Disposable.Create(() =>
- {
- try
- {
- subscription.Dispose();
- }
- finally
- {
- finallyAction();
- }
- });
- });
-#endif
- }
-
- #endregion
-
- #region + IgnoreElements +
-
- public virtual IObservable<TSource> IgnoreElements<TSource>(IObservable<TSource> source)
- {
-#if !NO_PERF
- var ignoreElements = source as IgnoreElements<TSource>;
- if (ignoreElements != null)
- return ignoreElements.Ω();
-
- return new IgnoreElements<TSource>(source);
-#else
- return new AnonymousObservable<TSource>(observer => source.Subscribe(_ => { }, observer.OnError, observer.OnCompleted));
-#endif
- }
-
- #endregion
-
- #region + Materialize +
-
- public virtual IObservable<Notification<TSource>> Materialize<TSource>(IObservable<TSource> source)
- {
-#if !NO_PERF
- //
- // NOTE: Peephole optimization of xs.Dematerialize().Materialize() should not be performed. It's possible for xs to
- // contain multiple terminal notifications, which won't survive a Dematerialize().Materialize() chain. In case
- // a reduction to xs.AsObservable() would be performed, those notification elements would survive.
- //
-
- return new Materialize<TSource>(source);
-#else
- return new AnonymousObservable<Notification<TSource>>(observer =>
- source.Subscribe(
- value => observer.OnNext(Notification.CreateOnNext<TSource>(value)),
- exception =>
- {
- observer.OnNext(Notification.CreateOnError<TSource>(exception));
- observer.OnCompleted();
- },
- () =>
- {
- observer.OnNext(Notification.CreateOnCompleted<TSource>());
- observer.OnCompleted();
- }));
-#endif
- }
-
- #endregion
-
- #region - Repeat -
-
- public virtual IObservable<TSource> Repeat<TSource>(IObservable<TSource> source)
- {
- return RepeatInfinite(source).Concat();
- }
-
- private static IEnumerable<T> RepeatInfinite<T>(T value)
- {
- while (true)
- yield return value;
- }
-
- public virtual IObservable<TSource> Repeat<TSource>(IObservable<TSource> source, int repeatCount)
- {
- return Enumerable.Repeat(source, repeatCount).Concat();
- }
-
- #endregion
-
- #region - Retry -
-
- public virtual IObservable<TSource> Retry<TSource>(IObservable<TSource> source)
- {
- return RepeatInfinite(source).Catch();
- }
-
- public virtual IObservable<TSource> Retry<TSource>(IObservable<TSource> source, int retryCount)
- {
- return Enumerable.Repeat(source, retryCount).Catch();
- }
-
- #endregion
-
- #region + Scan +
-
- public virtual IObservable<TAccumulate> Scan<TSource, TAccumulate>(IObservable<TSource> source, TAccumulate seed, Func<TAccumulate, TSource, TAccumulate> accumulator)
- {
-#if !NO_PERF
- return new Scan<TSource, TAccumulate>(source, seed, accumulator);
-#else
- return Defer(() =>
- {
- var accumulation = default(TAccumulate);
- var hasAccumulation = false;
- return source.Select(x =>
- {
- if (hasAccumulation)
- accumulation = accumulator(accumulation, x);
- else
- {
- accumulation = accumulator(seed, x);
- hasAccumulation = true;
- }
- return accumulation;
- });
- });
-#endif
- }
-
- public virtual IObservable<TSource> Scan<TSource>(IObservable<TSource> source, Func<TSource, TSource, TSource> accumulator)
- {
-#if !NO_PERF
- return new Scan<TSource>(source, accumulator);
-#else
- return Defer(() =>
- {
- var accumulation = default(TSource);
- var hasAccumulation = false;
- return source.Select(x =>
- {
- if (hasAccumulation)
- accumulation = accumulator(accumulation, x);
- else
- {
- accumulation = x;
- hasAccumulation = true;
- }
- return accumulation;
- });
- });
-#endif
- }
-
- #endregion
-
- #region + SkipLast +
-
- public virtual IObservable<TSource> SkipLast<TSource>(IObservable<TSource> source, int count)
- {
-#if !NO_PERF
- return new SkipLast<TSource>(source, count);
-#else
- return new AnonymousObservable<TSource>(observer =>
- {
- var q = new Queue<TSource>();
-
- return source.Subscribe(
- x =>
- {
- q.Enqueue(x);
- if (q.Count > count)
- observer.OnNext(q.Dequeue());
- },
- observer.OnError,
- observer.OnCompleted);
- });
-#endif
- }
-
- #endregion
-
- #region - StartWith -
-
- public virtual IObservable<TSource> StartWith<TSource>(IObservable<TSource> source, params TSource[] values)
- {
- return StartWith_<TSource>(source, SchedulerDefaults.ConstantTimeOperations, values);
- }
-
- public virtual IObservable<TSource> StartWith<TSource>(IObservable<TSource> source, IScheduler scheduler, params TSource[] values)
- {
- return StartWith_<TSource>(source, scheduler, values);
- }
-
- private static IObservable<TSource> StartWith_<TSource>(IObservable<TSource> source, IScheduler scheduler, params TSource[] values)
- {
- return values.ToObservable(scheduler).Concat(source);
- }
-
- #endregion
-
- #region + TakeLast +
-
- public virtual IObservable<TSource> TakeLast<TSource>(IObservable<TSource> source, int count)
- {
- return TakeLast_(source, count, SchedulerDefaults.Iteration);
- }
-
- public virtual IObservable<TSource> TakeLast<TSource>(IObservable<TSource> source, int count, IScheduler scheduler)
- {
- return TakeLast_(source, count, scheduler);
- }
-
- private static IObservable<TSource> TakeLast_<TSource>(IObservable<TSource> source, int count, IScheduler scheduler)
- {
-#if !NO_PERF
- return new TakeLast<TSource>(source, count, scheduler);
-#else
- return new AnonymousObservable<TSource>(observer =>
- {
- var q = new Queue<TSource>();
-
- var g = new CompositeDisposable();
-
- g.Add(source.Subscribe(
- x =>
- {
- q.Enqueue(x);
- if (q.Count > count)
- q.Dequeue();
- },
- observer.OnError,
- () =>
- {
- g.Add(scheduler.Schedule(rec =>
- {
- if (q.Count > 0)
- {
- observer.OnNext(q.Dequeue());
- rec();
- }
- else
- {
- observer.OnCompleted();
- }
- }));
- }
- ));
-
- return g;
- });
-#endif
- }
-
- public virtual IObservable<IList<TSource>> TakeLastBuffer<TSource>(IObservable<TSource> source, int count)
- {
-#if !NO_PERF
- return new TakeLastBuffer<TSource>(source, count);
-#else
- return new AnonymousObservable<IList<TSource>>(observer =>
- {
- var q = new Queue<TSource>();
-
- return source.Subscribe(
- x =>
- {
- q.Enqueue(x);
- if (q.Count > count)
- q.Dequeue();
- },
- observer.OnError,
- () =>
- {
- observer.OnNext(q.ToList());
- observer.OnCompleted();
- });
- });
-#endif
- }
-
- #endregion
-
- #region + Window +
-
- public virtual IObservable<IObservable<TSource>> Window<TSource>(IObservable<TSource> source, int count, int skip)
- {
- return Window_<TSource>(source, count, skip);
- }
-
- public virtual IObservable<IObservable<TSource>> Window<TSource>(IObservable<TSource> source, int count)
- {
- return Window_<TSource>(source, count, count);
- }
-
- private static IObservable<IObservable<TSource>> Window_<TSource>(IObservable<TSource> source, int count, int skip)
- {
-#if !NO_PERF
- return new Window<TSource>(source, count, skip);
-#else
- return new AnonymousObservable<IObservable<TSource>>(observer =>
- {
- var q = new Queue<ISubject<TSource>>();
- var n = 0;
-
- var m = new SingleAssignmentDisposable();
- var refCountDisposable = new RefCountDisposable(m);
-
- Action createWindow = () =>
- {
- var s = new Subject<TSource>();
- q.Enqueue(s);
- observer.OnNext(s.AddRef(refCountDisposable));
- };
-
- createWindow();
-
- m.Disposable = source.Subscribe(
- x =>
- {
- foreach (var s in q)
- s.OnNext(x);
-
- var c = n - count + 1;
- if (c >= 0 && c % skip == 0)
- {
- var s = q.Dequeue();
- s.OnCompleted();
- }
-
- n++;
- if (n % skip == 0)
- createWindow();
- },
- exception =>
- {
- while (q.Count > 0)
- q.Dequeue().OnError(exception);
-
- observer.OnError(exception);
- },
- () =>
- {
- while (q.Count > 0)
- q.Dequeue().OnCompleted();
-
- observer.OnCompleted();
- }
- );
-
- return refCountDisposable;
- });
-#endif
- }
-
- #endregion
- }
-}
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/QueryLanguage.StandardSequenceOperators.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/QueryLanguage.StandardSequenceOperators.cs
deleted file mode 100644
index 30bbf70..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/QueryLanguage.StandardSequenceOperators.cs
+++ /dev/null
@@ -1,1265 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System.Collections.Generic;
-using System.Linq;
-using System.Reactive.Concurrency;
-using System.Reactive.Disposables;
-using System.Reactive.Subjects;
-
-#if !NO_TPL
-using System.Reactive.Threading.Tasks;
-using System.Threading;
-using System.Threading.Tasks;
-#endif
-
-namespace System.Reactive.Linq
-{
-#if !NO_PERF
- using Observαble;
-#endif
-
- internal partial class QueryLanguage
- {
- #region + Cast +
-
- public virtual IObservable<TResult> Cast<TResult>(IObservable<object> source)
- {
-#if !NO_PERF
- return new Cast<object, TResult>(source);
-#else
- return source.Select(x => (TResult)x);
-#endif
- }
-
- #endregion
-
- #region + DefaultIfEmpty +
-
- public virtual IObservable<TSource> DefaultIfEmpty<TSource>(IObservable<TSource> source)
- {
-#if !NO_PERF
- return new DefaultIfEmpty<TSource>(source, default(TSource));
-#else
- return DefaultIfEmpty_(source, default(TSource));
-#endif
- }
-
- public virtual IObservable<TSource> DefaultIfEmpty<TSource>(IObservable<TSource> source, TSource defaultValue)
- {
-#if !NO_PERF
- return new DefaultIfEmpty<TSource>(source, defaultValue);
-#else
- return DefaultIfEmpty_(source, defaultValue);
-#endif
- }
-
-#if NO_PERF
- private static IObservable<TSource> DefaultIfEmpty_<TSource>(IObservable<TSource> source, TSource defaultValue)
- {
- return new AnonymousObservable<TSource>(observer =>
- {
- var found = false;
- return source.Subscribe(
- x =>
- {
- found = true;
- observer.OnNext(x);
- },
- observer.OnError,
- () =>
- {
- if (!found)
- observer.OnNext(defaultValue);
- observer.OnCompleted();
- }
- );
- });
- }
-#endif
-
- #endregion
-
- #region + Distinct +
-
- public virtual IObservable<TSource> Distinct<TSource>(IObservable<TSource> source)
- {
-#if !NO_PERF
- return new Distinct<TSource, TSource>(source, x => x, EqualityComparer<TSource>.Default);
-#else
- return Distinct_(source, x => x, EqualityComparer<TSource>.Default);
-#endif
- }
-
- public virtual IObservable<TSource> Distinct<TSource>(IObservable<TSource> source, IEqualityComparer<TSource> comparer)
- {
-#if !NO_PERF
- return new Distinct<TSource, TSource>(source, x => x, comparer);
-#else
- return Distinct_(source, x => x, comparer);
-#endif
- }
-
- public virtual IObservable<TSource> Distinct<TSource, TKey>(IObservable<TSource> source, Func<TSource, TKey> keySelector)
- {
-#if !NO_PERF
- return new Distinct<TSource, TKey>(source, keySelector, EqualityComparer<TKey>.Default);
-#else
- return Distinct_(source, keySelector, EqualityComparer<TKey>.Default);
-#endif
- }
-
- public virtual IObservable<TSource> Distinct<TSource, TKey>(IObservable<TSource> source, Func<TSource, TKey> keySelector, IEqualityComparer<TKey> comparer)
- {
-#if !NO_PERF
- return new Distinct<TSource, TKey>(source, keySelector, comparer);
-#else
- return Distinct_(source, keySelector, comparer);
-#endif
- }
-
-#if NO_PERF
- private static IObservable<TSource> Distinct_<TSource, TKey>(IObservable<TSource> source, Func<TSource, TKey> keySelector, IEqualityComparer<TKey> comparer)
- {
- return new AnonymousObservable<TSource>(observer =>
- {
- var hashSet = new HashSet<TKey>(comparer);
- return source.Subscribe(
- x =>
- {
- var key = default(TKey);
- var hasAdded = false;
-
- try
- {
- key = keySelector(x);
- hasAdded = hashSet.Add(key);
- }
- catch (Exception exception)
- {
- observer.OnError(exception);
- return;
- }
-
- if (hasAdded)
- observer.OnNext(x);
- },
- observer.OnError,
- observer.OnCompleted
- );
- });
- }
-#endif
-
- #endregion
-
- #region + GroupBy +
-
- public virtual IObservable<IGroupedObservable<TKey, TElement>> GroupBy<TSource, TKey, TElement>(IObservable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector)
- {
- return GroupBy_<TSource, TKey, TElement>(source, keySelector, elementSelector, EqualityComparer<TKey>.Default);
- }
-
- public virtual IObservable<IGroupedObservable<TKey, TSource>> GroupBy<TSource, TKey>(IObservable<TSource> source, Func<TSource, TKey> keySelector, IEqualityComparer<TKey> comparer)
- {
- return GroupBy_<TSource, TKey, TSource>(source, keySelector, x => x, comparer);
- }
-
- public virtual IObservable<IGroupedObservable<TKey, TSource>> GroupBy<TSource, TKey>(IObservable<TSource> source, Func<TSource, TKey> keySelector)
- {
- return GroupBy_<TSource, TKey, TSource>(source, keySelector, x => x, EqualityComparer<TKey>.Default);
- }
-
- public virtual IObservable<IGroupedObservable<TKey, TElement>> GroupBy<TSource, TKey, TElement>(IObservable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector, IEqualityComparer<TKey> comparer)
- {
- return GroupBy_<TSource, TKey, TElement>(source, keySelector, elementSelector, comparer);
- }
-
- private static IObservable<IGroupedObservable<TKey, TElement>> GroupBy_<TSource, TKey, TElement>(IObservable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector, IEqualityComparer<TKey> comparer)
- {
-#if !NO_PERF
- return new GroupBy<TSource, TKey, TElement>(source, keySelector, elementSelector, comparer);
-#else
- return GroupByUntil_<TSource, TKey, TElement, Unit>(source, keySelector, elementSelector, _ => Observable.Never<Unit>(), comparer);
-#endif
- }
-
- #endregion
-
- #region + GroupByUntil +
-
- public virtual IObservable<IGroupedObservable<TKey, TElement>> GroupByUntil<TSource, TKey, TElement, TDuration>(IObservable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector, Func<IGroupedObservable<TKey, TElement>, IObservable<TDuration>> durationSelector, IEqualityComparer<TKey> comparer)
- {
- return GroupByUntil_<TSource, TKey, TElement, TDuration>(source, keySelector, elementSelector, durationSelector, comparer);
- }
-
- public virtual IObservable<IGroupedObservable<TKey, TElement>> GroupByUntil<TSource, TKey, TElement, TDuration>(IObservable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector, Func<IGroupedObservable<TKey, TElement>, IObservable<TDuration>> durationSelector)
- {
- return GroupByUntil_<TSource, TKey, TElement, TDuration>(source, keySelector, elementSelector, durationSelector, EqualityComparer<TKey>.Default);
- }
-
- public virtual IObservable<IGroupedObservable<TKey, TSource>> GroupByUntil<TSource, TKey, TDuration>(IObservable<TSource> source, Func<TSource, TKey> keySelector, Func<IGroupedObservable<TKey, TSource>, IObservable<TDuration>> durationSelector, IEqualityComparer<TKey> comparer)
- {
- return GroupByUntil_<TSource, TKey, TSource, TDuration>(source, keySelector, x => x, durationSelector, comparer);
- }
-
- public virtual IObservable<IGroupedObservable<TKey, TSource>> GroupByUntil<TSource, TKey, TDuration>(IObservable<TSource> source, Func<TSource, TKey> keySelector, Func<IGroupedObservable<TKey, TSource>, IObservable<TDuration>> durationSelector)
- {
- return GroupByUntil_<TSource, TKey, TSource, TDuration>(source, keySelector, x => x, durationSelector, EqualityComparer<TKey>.Default);
- }
-
- private static IObservable<IGroupedObservable<TKey, TElement>> GroupByUntil_<TSource, TKey, TElement, TDuration>(IObservable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector, Func<IGroupedObservable<TKey, TElement>, IObservable<TDuration>> durationSelector, IEqualityComparer<TKey> comparer)
- {
-#if !NO_PERF
- return new GroupByUntil<TSource, TKey, TElement, TDuration>(source, keySelector, elementSelector, durationSelector, comparer);
-#else
- return new AnonymousObservable<IGroupedObservable<TKey, TElement>>(observer =>
- {
- var map = new Dictionary<TKey, ISubject<TElement>>(comparer);
-
- var groupDisposable = new CompositeDisposable();
- var refCountDisposable = new RefCountDisposable(groupDisposable);
-
- groupDisposable.Add(source.Subscribe(x =>
- {
- var key = default(TKey);
- try
- {
- key = keySelector(x);
- }
- catch (Exception exception)
- {
- lock (map)
- foreach (var w in map.Values.ToArray())
- w.OnError(exception);
- observer.OnError(exception);
- return;
- }
-
- var fireNewMapEntry = false;
- var writer = default(ISubject<TElement>);
- try
- {
- lock (map)
- {
- if (!map.TryGetValue(key, out writer))
- {
- writer = new Subject<TElement>();
- map.Add(key, writer);
- fireNewMapEntry = true;
- }
- }
- }
- catch (Exception exception)
- {
- lock (map)
- {
- foreach (var w in map.Values.ToArray())
- w.OnError(exception);
- }
- observer.OnError(exception);
- return;
- }
-
- if (fireNewMapEntry)
- {
- var group = new GroupedObservable<TKey, TElement>(key, writer, refCountDisposable);
-
- var durationGroup = new GroupedObservable<TKey, TElement>(key, writer);
- var duration = default(IObservable<TDuration>);
- try
- {
- duration = durationSelector(durationGroup);
- }
- catch (Exception exception)
- {
- foreach (var w in map.Values.ToArray())
- w.OnError(exception);
- observer.OnError(exception);
- return;
- }
-
- observer.OnNext(group);
-
- var md = new SingleAssignmentDisposable();
- groupDisposable.Add(md);
-
- Action expire = () =>
- {
- lock (map)
- {
- if (map.Remove(key))
- writer.OnCompleted();
- }
-
- groupDisposable.Remove(md);
- };
-
- md.Disposable = duration.Take(1).Subscribe(
- _ => { },
- exception =>
- {
- lock (map)
- foreach (var o in map.Values.ToArray())
- o.OnError(exception);
- observer.OnError(exception);
- },
- expire);
- }
-
- var element = default(TElement);
- try
- {
- element = elementSelector(x);
- }
- catch (Exception exception)
- {
- lock (map)
- foreach (var w in map.Values.ToArray())
- w.OnError(exception);
- observer.OnError(exception);
- return;
- }
-
- writer.OnNext(element);
- },
- e =>
- {
- lock (map)
- foreach (var w in map.Values.ToArray())
- w.OnError(e);
- observer.OnError(e);
- },
- () =>
- {
- lock (map)
- foreach (var w in map.Values.ToArray())
- w.OnCompleted();
- observer.OnCompleted();
- }));
-
- return refCountDisposable;
- });
-#endif
- }
-
- #endregion
-
- #region + GroupJoin +
-
- public virtual IObservable<TResult> GroupJoin<TLeft, TRight, TLeftDuration, TRightDuration, TResult>(IObservable<TLeft> left, IObservable<TRight> right, Func<TLeft, IObservable<TLeftDuration>> leftDurationSelector, Func<TRight, IObservable<TRightDuration>> rightDurationSelector, Func<TLeft, IObservable<TRight>, TResult> resultSelector)
- {
- return GroupJoin_<TLeft, TRight, TLeftDuration, TRightDuration, TResult>(left, right, leftDurationSelector, rightDurationSelector, resultSelector);
- }
-
- private static IObservable<TResult> GroupJoin_<TLeft, TRight, TLeftDuration, TRightDuration, TResult>(IObservable<TLeft> left, IObservable<TRight> right, Func<TLeft, IObservable<TLeftDuration>> leftDurationSelector, Func<TRight, IObservable<TRightDuration>> rightDurationSelector, Func<TLeft, IObservable<TRight>, TResult> resultSelector)
- {
-#if !NO_PERF
- return new GroupJoin<TLeft, TRight, TLeftDuration, TRightDuration, TResult>(left, right, leftDurationSelector, rightDurationSelector, resultSelector);
-#else
- return new AnonymousObservable<TResult>(observer =>
- {
- var gate = new object();
- var group = new CompositeDisposable();
- var r = new RefCountDisposable(group);
- var leftMap = new Dictionary<int, IObserver<TRight>>();
- var rightMap = new Dictionary<int, TRight>();
- var leftID = 0;
- var rightID = 0;
-
- group.Add(left.Subscribe(
- value =>
- {
- var s = new Subject<TRight>();
- var id = 0;
- lock (gate)
- {
- id = leftID++;
- leftMap.Add(id, s);
- }
-
- lock (gate)
- {
- var result = default(TResult);
- try
- {
- result = resultSelector(value, s.AddRef(r));
- }
- catch (Exception exception)
- {
- foreach (var o in leftMap.Values.ToArray())
- o.OnError(exception);
- observer.OnError(exception);
- return;
- }
- observer.OnNext(result);
-
- foreach (var rightValue in rightMap.Values.ToArray())
- {
- s.OnNext(rightValue);
- }
- }
-
- var md = new SingleAssignmentDisposable();
- group.Add(md);
-
- Action expire = () =>
- {
- lock (gate)
- if (leftMap.Remove(id))
- s.OnCompleted();
-
- group.Remove(md);
- };
-
- var duration = default(IObservable<TLeftDuration>);
- try
- {
- duration = leftDurationSelector(value);
- }
- catch (Exception exception)
- {
- lock (gate)
- {
- foreach (var o in leftMap.Values.ToArray())
- o.OnError(exception);
- observer.OnError(exception);
- }
- return;
- }
-
- md.Disposable = duration.Take(1).Subscribe(
- _ => { },
- exception =>
- {
- lock (gate)
- {
- foreach (var o in leftMap.Values.ToArray())
- o.OnError(exception);
- observer.OnError(exception);
- }
- },
- expire);
- },
- exception =>
- {
- lock (gate)
- {
- foreach (var o in leftMap.Values.ToArray())
- o.OnError(exception);
- observer.OnError(exception);
- }
- },
- () =>
- {
- lock (gate)
- observer.OnCompleted();
- }));
-
- group.Add(right.Subscribe(
- value =>
- {
- var id = 0;
- lock (gate)
- {
- id = rightID++;
- rightMap.Add(id, value);
- }
-
- var md = new SingleAssignmentDisposable();
- group.Add(md);
-
- Action expire = () =>
- {
- lock (gate)
- rightMap.Remove(id);
-
- group.Remove(md);
- };
-
- var duration = default(IObservable<TRightDuration>);
- try
- {
- duration = rightDurationSelector(value);
- }
- catch (Exception exception)
- {
- lock (gate)
- {
- foreach (var o in leftMap.Values.ToArray())
- o.OnError(exception);
- observer.OnError(exception);
- }
- return;
- }
- md.Disposable = duration.Take(1).Subscribe(
- _ => { },
- exception =>
- {
- lock (gate)
- {
- foreach (var o in leftMap.Values.ToArray())
- o.OnError(exception);
- observer.OnError(exception);
- }
- },
- expire);
-
- lock (gate)
- {
- foreach (var o in leftMap.Values.ToArray())
- o.OnNext(value);
- }
- },
- exception =>
- {
- lock (gate)
- {
- foreach (var o in leftMap.Values.ToArray())
- o.OnError(exception);
- observer.OnError(exception);
- }
- }));
-
- return r;
- });
-#endif
- }
-
- #endregion
-
- #region + Join +
-
- public virtual IObservable<TResult> Join<TLeft, TRight, TLeftDuration, TRightDuration, TResult>(IObservable<TLeft> left, IObservable<TRight> right, Func<TLeft, IObservable<TLeftDuration>> leftDurationSelector, Func<TRight, IObservable<TRightDuration>> rightDurationSelector, Func<TLeft, TRight, TResult> resultSelector)
- {
- return Join_<TLeft, TRight, TLeftDuration, TRightDuration, TResult>(left, right, leftDurationSelector, rightDurationSelector, resultSelector);
- }
-
- private static IObservable<TResult> Join_<TLeft, TRight, TLeftDuration, TRightDuration, TResult>(IObservable<TLeft> left, IObservable<TRight> right, Func<TLeft, IObservable<TLeftDuration>> leftDurationSelector, Func<TRight, IObservable<TRightDuration>> rightDurationSelector, Func<TLeft, TRight, TResult> resultSelector)
- {
-#if !NO_PERF
- return new Join<TLeft, TRight, TLeftDuration, TRightDuration, TResult>(left, right, leftDurationSelector, rightDurationSelector, resultSelector);
-#else
- return new AnonymousObservable<TResult>(observer =>
- {
- var gate = new object();
- var leftDone = false;
- var rightDone = false;
- var group = new CompositeDisposable();
- var leftMap = new Dictionary<int, TLeft>();
- var rightMap = new Dictionary<int, TRight>();
- var leftID = 0;
- var rightID = 0;
-
- group.Add(left.Subscribe(
- value =>
- {
- var id = 0;
- lock (gate)
- {
- id = leftID++;
- leftMap.Add(id, value);
- }
-
- var md = new SingleAssignmentDisposable();
- group.Add(md);
-
- Action expire = () =>
- {
- lock (gate)
- {
- if (leftMap.Remove(id) && leftMap.Count == 0 && leftDone)
- observer.OnCompleted();
- }
-
- group.Remove(md);
- };
-
- var duration = default(IObservable<TLeftDuration>);
- try
- {
- duration = leftDurationSelector(value);
- }
- catch (Exception exception)
- {
- observer.OnError(exception);
- return;
- }
-
- md.Disposable = duration.Take(1).Subscribe(
- _ => { },
- error =>
- {
- lock (gate)
- observer.OnError(error);
- },
- expire);
-
- lock (gate)
- {
- foreach (var rightValue in rightMap.Values.ToArray())
- {
- var result = default(TResult);
- try
- {
- result = resultSelector(value, rightValue);
- }
- catch (Exception exception)
- {
- observer.OnError(exception);
- return;
- }
-
- observer.OnNext(result);
- }
- }
- },
- error =>
- {
- lock (gate)
- observer.OnError(error);
- },
- () =>
- {
- lock (gate)
- {
- leftDone = true;
- if (rightDone || leftMap.Count == 0)
- observer.OnCompleted();
- }
- }));
-
- group.Add(right.Subscribe(
- value =>
- {
- var id = 0;
- lock (gate)
- {
- id = rightID++;
- rightMap.Add(id, value);
- }
-
- var md = new SingleAssignmentDisposable();
- group.Add(md);
-
- Action expire = () =>
- {
- lock (gate)
- {
- if (rightMap.Remove(id) && rightMap.Count == 0 && rightDone)
- observer.OnCompleted();
- }
-
- group.Remove(md);
- };
-
- var duration = default(IObservable<TRightDuration>);
- try
- {
- duration = rightDurationSelector(value);
- }
- catch (Exception exception)
- {
- observer.OnError(exception);
- return;
- }
-
- md.Disposable = duration.Take(1).Subscribe(
- _ => { },
- error =>
- {
- lock (gate)
- observer.OnError(error);
- },
- expire);
-
- lock (gate)
- {
- foreach (var leftValue in leftMap.Values.ToArray())
- {
- var result = default(TResult);
- try
- {
- result = resultSelector(leftValue, value);
- }
- catch (Exception exception)
- {
- observer.OnError(exception);
- return;
- }
-
- observer.OnNext(result);
- }
- }
- },
- error =>
- {
- lock (gate)
- observer.OnError(error);
- },
- () =>
- {
- lock (gate)
- {
- rightDone = true;
- if (leftDone || rightMap.Count == 0)
- observer.OnCompleted();
- }
- }));
-
- return group;
- });
-#endif
- }
-
- #endregion
-
- #region + OfType +
-
- public virtual IObservable<TResult> OfType<TResult>(IObservable<object> source)
- {
-#if !NO_PERF
- return new OfType<object, TResult>(source);
-#else
- return source.Where(x => x is TResult).Cast<TResult>();
-#endif
- }
-
- #endregion
-
- #region + Select +
-
- public virtual IObservable<TResult> Select<TSource, TResult>(IObservable<TSource> source, Func<TSource, TResult> selector)
- {
-#if !NO_PERF
- var select = source as Select<TSource>;
- if (select != null)
- return select.Ω(selector);
-
- return new Select<TSource, TResult>(source, selector);
-#else
- var s = source as SelectObservable<TSource>;
- if (s != null)
- return s.Select(selector);
-
- return new SelectObservable<TSource, TResult>(source, selector);
-#endif
- }
-
-#if NO_PERF
- abstract class SelectObservable<TResult> : ObservableBase<TResult>
- {
- public abstract IObservable<TResult2> Select<TResult2>(Func<TResult, TResult2> selector);
- }
-
- class SelectObservable<TSource, TResult> : SelectObservable<TResult>
- {
- private readonly IObservable<TSource> _source;
- private readonly Func<TSource, TResult> _selector;
-
- public SelectObservable(IObservable<TSource> source, Func<TSource, TResult> selector)
- {
- _source = source;
- _selector = selector;
- }
-
- protected override IDisposable SubscribeCore(IObserver<TResult> observer)
- {
- return _source.Subscribe(new Observer(observer, _selector));
- }
-
- public override IObservable<TResult2> Select<TResult2>(Func<TResult, TResult2> selector)
- {
- return new SelectObservable<TSource, TResult2>(_source, x => selector(_selector(x)));
- }
-
- class Observer : ObserverBase<TSource>
- {
- private readonly IObserver<TResult> _observer;
- private readonly Func<TSource, TResult> _selector;
-
- public Observer(IObserver<TResult> observer, Func<TSource, TResult> selector)
- {
- _observer = observer;
- _selector = selector;
- }
-
- protected override void OnNextCore(TSource value)
- {
- TResult result;
- try
- {
- result = _selector(value);
- }
- catch (Exception exception)
- {
- _observer.OnError(exception);
- return;
- }
- _observer.OnNext(result);
- }
-
- protected override void OnErrorCore(Exception error)
- {
- _observer.OnError(error);
- }
-
- protected override void OnCompletedCore()
- {
- _observer.OnCompleted();
- }
- }
- }
-#endif
-
- public virtual IObservable<TResult> Select<TSource, TResult>(IObservable<TSource> source, Func<TSource, int, TResult> selector)
- {
-#if !NO_PERF
- return new Select<TSource, TResult>(source, selector);
-#else
- return Defer(() =>
- {
- var index = 0;
- return source.Select(x => selector(x, checked(index++)));
- });
-#endif
- }
-
- #endregion
-
- #region + SelectMany +
-
- public virtual IObservable<TOther> SelectMany<TSource, TOther>(IObservable<TSource> source, IObservable<TOther> other)
- {
- return SelectMany_<TSource, TOther>(source, _ => other);
- }
-
- public virtual IObservable<TResult> SelectMany<TSource, TResult>(IObservable<TSource> source, Func<TSource, IObservable<TResult>> selector)
- {
- return SelectMany_<TSource, TResult>(source, selector);
- }
-
-#if !NO_TPL
- public virtual IObservable<TResult> SelectMany<TSource, TResult>(IObservable<TSource> source, Func<TSource, Task<TResult>> selector)
- {
- return SelectMany_<TSource, TResult>(source, x => selector(x).ToObservable());
- }
-
- public virtual IObservable<TResult> SelectMany<TSource, TResult>(IObservable<TSource> source, Func<TSource, CancellationToken, Task<TResult>> selector)
- {
- return SelectMany_<TSource, TResult>(source, x => FromAsync(ct => selector(x, ct)));
- }
-#endif
-
- public virtual IObservable<TResult> SelectMany<TSource, TCollection, TResult>(IObservable<TSource> source, Func<TSource, IObservable<TCollection>> collectionSelector, Func<TSource, TCollection, TResult> resultSelector)
- {
- return SelectMany_<TSource, TCollection, TResult>(source, collectionSelector, resultSelector);
- }
-
-#if !NO_TPL
- public virtual IObservable<TResult> SelectMany<TSource, TTaskResult, TResult>(IObservable<TSource> source, Func<TSource, Task<TTaskResult>> taskSelector, Func<TSource, TTaskResult, TResult> resultSelector)
- {
- return SelectMany_<TSource, TTaskResult, TResult>(source, x => taskSelector(x).ToObservable(), resultSelector);
- }
-
- public virtual IObservable<TResult> SelectMany<TSource, TTaskResult, TResult>(IObservable<TSource> source, Func<TSource, CancellationToken, Task<TTaskResult>> taskSelector, Func<TSource, TTaskResult, TResult> resultSelector)
- {
- return SelectMany_<TSource, TTaskResult, TResult>(source, x => FromAsync(ct => taskSelector(x, ct)), resultSelector);
- }
-#endif
-
- private static IObservable<TResult> SelectMany_<TSource, TResult>(IObservable<TSource> source, Func<TSource, IObservable<TResult>> selector)
- {
-#if !NO_PERF
- return new SelectMany<TSource, TResult>(source, selector);
-#else
- return source.Select(selector).Merge();
-#endif
- }
-
- private static IObservable<TResult> SelectMany_<TSource, TCollection, TResult>(IObservable<TSource> source, Func<TSource, IObservable<TCollection>> collectionSelector, Func<TSource, TCollection, TResult> resultSelector)
- {
-#if !NO_PERF
- return new SelectMany<TSource, TCollection, TResult>(source, collectionSelector, resultSelector);
-#else
- return SelectMany_<TSource, TResult>(source, x => collectionSelector(x).Select(y => resultSelector(x, y)));
-#endif
- }
-
- public virtual IObservable<TResult> SelectMany<TSource, TResult>(IObservable<TSource> source, Func<TSource, IObservable<TResult>> onNext, Func<Exception, IObservable<TResult>> onError, Func<IObservable<TResult>> onCompleted)
- {
-#if !NO_PERF
- return new SelectMany<TSource, TResult>(source, onNext, onError, onCompleted);
-#else
- return source.Materialize().SelectMany(notification =>
- {
- if (notification.Kind == NotificationKind.OnNext)
- return onNext(notification.Value);
- else if (notification.Kind == NotificationKind.OnError)
- return onError(notification.Exception);
- else
- return onCompleted();
- });
-#endif
- }
-
- public virtual IObservable<TResult> SelectMany<TSource, TResult>(IObservable<TSource> source, Func<TSource, IEnumerable<TResult>> selector)
- {
-#if !NO_PERF
- return new SelectMany<TSource, TResult>(source, selector);
-#else
- return SelectMany_<TSource, TResult, TResult>(source, selector, (_, x) => x);
-#endif
- }
-
- public virtual IObservable<TResult> SelectMany<TSource, TCollection, TResult>(IObservable<TSource> source, Func<TSource, IEnumerable<TCollection>> collectionSelector, Func<TSource, TCollection, TResult> resultSelector)
- {
- return SelectMany_<TSource, TCollection, TResult>(source, collectionSelector, resultSelector);
- }
-
- private static IObservable<TResult> SelectMany_<TSource, TCollection, TResult>(IObservable<TSource> source, Func<TSource, IEnumerable<TCollection>> collectionSelector, Func<TSource, TCollection, TResult> resultSelector)
- {
-#if !NO_PERF
- return new SelectMany<TSource, TCollection, TResult>(source, collectionSelector, resultSelector);
-#else
- return new AnonymousObservable<TResult>(observer =>
- source.Subscribe(
- x =>
- {
- var xs = default(IEnumerable<TCollection>);
- try
- {
- xs = collectionSelector(x);
- }
- catch (Exception exception)
- {
- observer.OnError(exception);
- return;
- }
-
- var e = xs.GetEnumerator();
-
- try
- {
- var hasNext = true;
- while (hasNext)
- {
- hasNext = false;
- var current = default(TResult);
-
- try
- {
- hasNext = e.MoveNext();
- if (hasNext)
- current = resultSelector(x, e.Current);
- }
- catch (Exception exception)
- {
- observer.OnError(exception);
- return;
- }
-
- if (hasNext)
- observer.OnNext(current);
- }
- }
- finally
- {
- if (e != null)
- e.Dispose();
- }
- },
- observer.OnError,
- observer.OnCompleted
- )
- );
-#endif
- }
-
- #endregion
-
- #region + Skip +
-
- public virtual IObservable<TSource> Skip<TSource>(IObservable<TSource> source, int count)
- {
-#if !NO_PERF
- var skip = source as Skip<TSource>;
- if (skip != null && skip._scheduler == null)
- return skip.Ω(count);
-
- return new Skip<TSource>(source, count);
-#else
- return new AnonymousObservable<TSource>(observer =>
- {
- var remaining = count;
- return source.Subscribe(
- x =>
- {
- if (remaining <= 0)
- observer.OnNext(x);
- else
- remaining--;
- },
- observer.OnError,
- observer.OnCompleted);
- });
-#endif
- }
-
- #endregion
-
- #region + SkipWhile +
-
- public virtual IObservable<TSource> SkipWhile<TSource>(IObservable<TSource> source, Func<TSource, bool> predicate)
- {
-#if !NO_PERF
- return new SkipWhile<TSource>(source, predicate);
-#else
- return SkipWhile_(source, (x, i) => predicate(x));
-#endif
- }
-
- public virtual IObservable<TSource> SkipWhile<TSource>(IObservable<TSource> source, Func<TSource, int, bool> predicate)
- {
-#if !NO_PERF
- return new SkipWhile<TSource>(source, predicate);
-#else
- return SkipWhile_(source, predicate);
-#endif
- }
-
-#if NO_PERF
- private static IObservable<TSource> SkipWhile_<TSource>(IObservable<TSource> source, Func<TSource, int, bool> predicate)
- {
- return new AnonymousObservable<TSource>(observer =>
- {
- var running = false;
- var i = 0;
- return source.Subscribe(
- x =>
- {
- if (!running)
- try
- {
- running = !predicate(x, checked(i++));
- }
- catch (Exception exception)
- {
- observer.OnError(exception);
- return;
- }
- if (running)
- observer.OnNext(x);
- },
- observer.OnError,
- observer.OnCompleted);
- });
- }
-#endif
-
- #endregion
-
- #region + Take +
-
- public virtual IObservable<TSource> Take<TSource>(IObservable<TSource> source, int count)
- {
- if (count == 0)
- return Empty<TSource>();
-
- return Take_(source, count);
- }
-
- public virtual IObservable<TSource> Take<TSource>(IObservable<TSource> source, int count, IScheduler scheduler)
- {
- if (count == 0)
- return Empty<TSource>(scheduler);
-
- return Take_(source, count);
- }
-
-#if !NO_PERF
- private static IObservable<TSource> Take_<TSource>(IObservable<TSource> source, int count)
- {
- var take = source as Take<TSource>;
- if (take != null && take._scheduler == null)
- return take.Ω(count);
-
- return new Take<TSource>(source, count);
- }
-#else
- private static IObservable<TSource> Take_<TSource>(IObservable<TSource> source, int count)
- {
- return new AnonymousObservable<TSource>(observer =>
- {
- var remaining = count;
-
- return source.Subscribe(
- x =>
- {
- if (remaining > 0)
- {
- --remaining;
- observer.OnNext(x);
- if (remaining == 0)
- observer.OnCompleted();
- }
- },
- observer.OnError,
- observer.OnCompleted);
- });
- }
-#endif
-
- #endregion
-
- #region + TakeWhile +
-
- public virtual IObservable<TSource> TakeWhile<TSource>(IObservable<TSource> source, Func<TSource, bool> predicate)
- {
-#if !NO_PERF
- return new TakeWhile<TSource>(source, predicate);
-#else
- return TakeWhile_(source, (x, i) => predicate(x));
-#endif
- }
-
- public virtual IObservable<TSource> TakeWhile<TSource>(IObservable<TSource> source, Func<TSource, int, bool> predicate)
- {
-#if !NO_PERF
- return new TakeWhile<TSource>(source, predicate);
-#else
- return TakeWhile_(source, predicate);
-#endif
- }
-
-#if NO_PERF
- private static IObservable<TSource> TakeWhile_<TSource>(IObservable<TSource> source, Func<TSource, int, bool> predicate)
- {
- return new AnonymousObservable<TSource>(observer =>
- {
- var running = true;
- var i = 0;
- return source.Subscribe(
- x =>
- {
- if (running)
- {
- try
- {
- running = predicate(x, checked(i++));
- }
- catch (Exception exception)
- {
- observer.OnError(exception);
- return;
- }
- if (running)
- observer.OnNext(x);
- else
- observer.OnCompleted();
- }
- },
- observer.OnError,
- observer.OnCompleted);
- });
- }
-#endif
-
- #endregion
-
- #region + Where +
-
- public virtual IObservable<TSource> Where<TSource>(IObservable<TSource> source, Func<TSource, bool> predicate)
- {
-#if !NO_PERF
- var where = source as Where<TSource>;
- if (where != null)
- return where.Ω(predicate);
-
- return new Where<TSource>(source, predicate);
-#else
- var w = source as WhereObservable<TSource>;
- if (w != null)
- return w.Where(predicate);
-
- return new WhereObservable<TSource>(source, predicate);
-#endif
- }
-
-#if NO_PERF
- class WhereObservable<TSource> : ObservableBase<TSource>
- {
- private readonly IObservable<TSource> _source;
- private readonly Func<TSource, bool> _predicate;
-
- public WhereObservable(IObservable<TSource> source, Func<TSource, bool> predicate)
- {
- _source = source;
- _predicate = predicate;
- }
-
- protected override IDisposable SubscribeCore(IObserver<TSource> observer)
- {
- return _source.Subscribe(new Observer(observer, _predicate));
- }
-
- public IObservable<TSource> Where(Func<TSource, bool> predicate)
- {
- return new WhereObservable<TSource>(_source, x => _predicate(x) && predicate(x));
- }
-
- class Observer : ObserverBase<TSource>
- {
- private readonly IObserver<TSource> _observer;
- private readonly Func<TSource, bool> _predicate;
-
- public Observer(IObserver<TSource> observer, Func<TSource, bool> predicate)
- {
- _observer = observer;
- _predicate = predicate;
- }
-
- protected override void OnNextCore(TSource value)
- {
- bool shouldRun;
- try
- {
- shouldRun = _predicate(value);
- }
- catch (Exception exception)
- {
- _observer.OnError(exception);
- return;
- }
- if (shouldRun)
- _observer.OnNext(value);
- }
-
- protected override void OnErrorCore(Exception error)
- {
- _observer.OnError(error);
- }
-
- protected override void OnCompletedCore()
- {
- _observer.OnCompleted();
- }
- }
- }
-#endif
-
- public virtual IObservable<TSource> Where<TSource>(IObservable<TSource> source, Func<TSource, int, bool> predicate)
- {
-#if !NO_PERF
- return new Where<TSource>(source, predicate);
-#else
- return Defer(() =>
- {
- var index = 0;
- return source.Where(x => predicate(x, checked(index++)));
- });
-#endif
- }
-
- #endregion
- }
-}
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/QueryLanguage.Time.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/QueryLanguage.Time.cs
deleted file mode 100644
index 161e1c1..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/QueryLanguage.Time.cs
+++ /dev/null
@@ -1,1907 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System.Collections.Generic;
-using System.Reactive.Concurrency;
-using System.Reactive.Disposables;
-using System.Reactive.Subjects;
-
-namespace System.Reactive.Linq
-{
-#if !NO_PERF
- using Observαble;
-#endif
-
- internal partial class QueryLanguage
- {
- #region + Buffer +
-
- #region TimeSpan only
-
- public virtual IObservable<IList<TSource>> Buffer<TSource>(IObservable<TSource> source, TimeSpan timeSpan)
- {
- return Buffer_<TSource>(source, timeSpan, timeSpan, SchedulerDefaults.TimeBasedOperations);
- }
-
- public virtual IObservable<IList<TSource>> Buffer<TSource>(IObservable<TSource> source, TimeSpan timeSpan, IScheduler scheduler)
- {
- return Buffer_<TSource>(source, timeSpan, timeSpan, scheduler);
- }
-
- public virtual IObservable<IList<TSource>> Buffer<TSource>(IObservable<TSource> source, TimeSpan timeSpan, TimeSpan timeShift)
- {
- return Buffer_<TSource>(source, timeSpan, timeShift, SchedulerDefaults.TimeBasedOperations);
- }
-
- public virtual IObservable<IList<TSource>> Buffer<TSource>(IObservable<TSource> source, TimeSpan timeSpan, TimeSpan timeShift, IScheduler scheduler)
- {
- return Buffer_<TSource>(source, timeSpan, timeShift, scheduler);
- }
-
- private static IObservable<IList<TSource>> Buffer_<TSource>(IObservable<TSource> source, TimeSpan timeSpan, TimeSpan timeShift, IScheduler scheduler)
- {
-#if !NO_PERF
- return new Buffer<TSource>(source, timeSpan, timeShift, scheduler);
-#else
- return source.Window(timeSpan, timeShift, scheduler).SelectMany(Observable.ToList);
-#endif
- }
-
- #endregion
-
- #region TimeSpan + int
-
- public virtual IObservable<IList<TSource>> Buffer<TSource>(IObservable<TSource> source, TimeSpan timeSpan, int count)
- {
- return Buffer_<TSource>(source, timeSpan, count, SchedulerDefaults.TimeBasedOperations);
- }
-
- public virtual IObservable<IList<TSource>> Buffer<TSource>(IObservable<TSource> source, TimeSpan timeSpan, int count, IScheduler scheduler)
- {
- return Buffer_<TSource>(source, timeSpan, count, scheduler);
- }
-
- private static IObservable<IList<TSource>> Buffer_<TSource>(IObservable<TSource> source, TimeSpan timeSpan, int count, IScheduler scheduler)
- {
-#if !NO_PERF
- return new Buffer<TSource>(source, timeSpan, count, scheduler);
-#else
- return source.Window(timeSpan, count, scheduler).SelectMany(Observable.ToList);
-#endif
- }
-
- #endregion
-
- #endregion
-
- #region + Delay +
-
- #region TimeSpan
-
- public virtual IObservable<TSource> Delay<TSource>(IObservable<TSource> source, TimeSpan dueTime)
- {
- return Delay_<TSource>(source, dueTime, SchedulerDefaults.TimeBasedOperations);
- }
-
- public virtual IObservable<TSource> Delay<TSource>(IObservable<TSource> source, TimeSpan dueTime, IScheduler scheduler)
- {
- return Delay_<TSource>(source, dueTime, scheduler);
- }
-
- private static IObservable<TSource> Delay_<TSource>(IObservable<TSource> source, TimeSpan dueTime, IScheduler scheduler)
- {
-#if !NO_PERF
- return new Delay<TSource>(source, dueTime, scheduler);
-#else
- return new AnonymousObservable<TSource>(observer =>
- {
- var gate = new object();
- var q = new Queue<Timestamped<Notification<TSource>>>();
- var active = false;
- var running = false;
- var cancelable = new SerialDisposable();
- var exception = default(Exception);
-
- var subscription = source.Materialize().Timestamp(scheduler).Subscribe(notification =>
- {
- var shouldRun = false;
-
- lock (gate)
- {
- if (notification.Value.Kind == NotificationKind.OnError)
- {
- q.Clear();
- q.Enqueue(notification);
- exception = notification.Value.Exception;
- shouldRun = !running;
- }
- else
- {
- q.Enqueue(new Timestamped<Notification<TSource>>(notification.Value, notification.Timestamp.Add(dueTime)));
- shouldRun = !active;
- active = true;
- }
- }
-
- if (shouldRun)
- {
- if (exception != null)
- observer.OnError(exception);
- else
- {
- var d = new SingleAssignmentDisposable();
- cancelable.Disposable = d;
- d.Disposable = scheduler.Schedule(dueTime, self =>
- {
- lock (gate)
- {
- if (exception != null)
- return;
- running = true;
- }
- Notification<TSource> result;
-
- do
- {
- result = null;
- lock (gate)
- {
- if (q.Count > 0 && q.Peek().Timestamp.CompareTo(scheduler.Now) <= 0)
- result = q.Dequeue().Value;
- }
-
- if (result != null)
- result.Accept(observer);
- } while (result != null);
-
- var shouldRecurse = false;
- var recurseDueTime = TimeSpan.Zero;
- var e = default(Exception);
- lock (gate)
- {
- if (q.Count > 0)
- {
- shouldRecurse = true;
- recurseDueTime = TimeSpan.FromTicks(Math.Max(0, q.Peek().Timestamp.Subtract(scheduler.Now).Ticks));
- }
- else
- active = false;
- e = exception;
- running = false;
- }
- if (e != null)
- observer.OnError(e);
- else if (shouldRecurse)
- self(recurseDueTime);
- });
- }
- }
- });
-
- return new CompositeDisposable(subscription, cancelable);
- });
-#endif
- }
-
- #endregion
-
- #region DateTimeOffset
-
- public virtual IObservable<TSource> Delay<TSource>(IObservable<TSource> source, DateTimeOffset dueTime)
- {
- return Delay_<TSource>(source, dueTime, SchedulerDefaults.TimeBasedOperations);
- }
-
- public virtual IObservable<TSource> Delay<TSource>(IObservable<TSource> source, DateTimeOffset dueTime, IScheduler scheduler)
- {
- return Delay_<TSource>(source, dueTime, scheduler);
- }
-
- private static IObservable<TSource> Delay_<TSource>(IObservable<TSource> source, DateTimeOffset dueTime, IScheduler scheduler)
- {
-#if !NO_PERF
- return new Delay<TSource>(source, dueTime, scheduler);
-#else
- return Observable.Defer(() =>
- {
- var timeSpan = dueTime.Subtract(scheduler.Now);
- return Delay_<TSource>(source, timeSpan, scheduler);
- });
-#endif
- }
-
- #endregion
-
- #region Duration selector
-
- public virtual IObservable<TSource> Delay<TSource, TDelay>(IObservable<TSource> source, Func<TSource, IObservable<TDelay>> delayDurationSelector)
- {
- return Delay_<TSource, TDelay>(source, null, delayDurationSelector);
- }
-
- public virtual IObservable<TSource> Delay<TSource, TDelay>(IObservable<TSource> source, IObservable<TDelay> subscriptionDelay, Func<TSource, IObservable<TDelay>> delayDurationSelector)
- {
- return Delay_<TSource, TDelay>(source, subscriptionDelay, delayDurationSelector);
- }
-
- private static IObservable<TSource> Delay_<TSource, TDelay>(IObservable<TSource> source, IObservable<TDelay> subscriptionDelay, Func<TSource, IObservable<TDelay>> delayDurationSelector)
- {
-#if !NO_PERF
- return new Delay<TSource, TDelay>(source, subscriptionDelay, delayDurationSelector);
-#else
- return new AnonymousObservable<TSource>(observer =>
- {
- var delays = new CompositeDisposable();
-
- var gate = new object();
- var atEnd = false;
-
- var done = new Action(() =>
- {
- if (atEnd && delays.Count == 0)
- {
- observer.OnCompleted();
- }
- });
-
- var subscription = new SerialDisposable();
-
- var start = new Action(() =>
- {
- subscription.Disposable = source.Subscribe(
- x =>
- {
- var delay = default(IObservable<TDelay>);
- try
- {
- delay = delayDurationSelector(x);
- }
- catch (Exception error)
- {
- lock (gate)
- observer.OnError(error);
-
- return;
- }
-
- var d = new SingleAssignmentDisposable();
- delays.Add(d);
- d.Disposable = delay.Subscribe(
- _ =>
- {
- lock (gate)
- {
- observer.OnNext(x);
-
- delays.Remove(d);
- done();
- }
- },
- exception =>
- {
- lock (gate)
- observer.OnError(exception);
- },
- () =>
- {
- lock (gate)
- {
- observer.OnNext(x);
-
- delays.Remove(d);
- done();
- }
- }
- );
- },
- exception =>
- {
- lock (gate)
- {
- observer.OnError(exception);
- }
- },
- () =>
- {
- lock (gate)
- {
- atEnd = true;
- subscription.Dispose();
-
- done();
- }
- }
- );
- });
-
- if (subscriptionDelay == null)
- {
- start();
- }
- else
- {
- subscription.Disposable = subscriptionDelay.Subscribe(
- _ =>
- {
- start();
- },
- observer.OnError,
- start
- );
- }
-
- return new CompositeDisposable(subscription, delays);
- });
-#endif
- }
-
- #endregion
-
- #endregion
-
- #region + DelaySubscription +
-
- public virtual IObservable<TSource> DelaySubscription<TSource>(IObservable<TSource> source, TimeSpan dueTime)
- {
- return DelaySubscription_<TSource>(source, dueTime, SchedulerDefaults.TimeBasedOperations);
- }
-
- public virtual IObservable<TSource> DelaySubscription<TSource>(IObservable<TSource> source, TimeSpan dueTime, IScheduler scheduler)
- {
- return DelaySubscription_<TSource>(source, dueTime, scheduler);
- }
-
- private static IObservable<TSource> DelaySubscription_<TSource>(IObservable<TSource> source, TimeSpan dueTime, IScheduler scheduler)
- {
-#if !NO_PERF
- return new DelaySubscription<TSource>(source, dueTime, scheduler);
-#else
- return new AnonymousObservable<TSource>(observer =>
- {
- var d = new MultipleAssignmentDisposable();
-
- var dt = Normalize(dueTime);
-
- d.Disposable = scheduler.Schedule(dt, () =>
- {
- d.Disposable = source.Subscribe(observer);
- });
-
- return d;
- });
-#endif
- }
-
- public virtual IObservable<TSource> DelaySubscription<TSource>(IObservable<TSource> source, DateTimeOffset dueTime)
- {
- return DelaySubscription_<TSource>(source, dueTime, SchedulerDefaults.TimeBasedOperations);
- }
-
- public virtual IObservable<TSource> DelaySubscription<TSource>(IObservable<TSource> source, DateTimeOffset dueTime, IScheduler scheduler)
- {
- return DelaySubscription_<TSource>(source, dueTime, scheduler);
- }
-
- private static IObservable<TSource> DelaySubscription_<TSource>(IObservable<TSource> source, DateTimeOffset dueTime, IScheduler scheduler)
- {
-#if !NO_PERF
- return new DelaySubscription<TSource>(source, dueTime, scheduler);
-#else
- return new AnonymousObservable<TSource>(observer =>
- {
- var d = new MultipleAssignmentDisposable();
-
- d.Disposable = scheduler.Schedule(dueTime, () =>
- {
- d.Disposable = source.Subscribe(observer);
- });
-
- return d;
- });
-#endif
- }
-
- #endregion
-
- #region + Generate +
-
- public virtual IObservable<TResult> Generate<TState, TResult>(TState initialState, Func<TState, bool> condition, Func<TState, TState> iterate, Func<TState, TResult> resultSelector, Func<TState, TimeSpan> timeSelector)
- {
- return Generate_<TState, TResult>(initialState, condition, iterate, resultSelector, timeSelector, SchedulerDefaults.TimeBasedOperations);
- }
-
- public virtual IObservable<TResult> Generate<TState, TResult>(TState initialState, Func<TState, bool> condition, Func<TState, TState> iterate, Func<TState, TResult> resultSelector, Func<TState, TimeSpan> timeSelector, IScheduler scheduler)
- {
- return Generate_<TState, TResult>(initialState, condition, iterate, resultSelector, timeSelector, scheduler);
- }
-
- private static IObservable<TResult> Generate_<TState, TResult>(TState initialState, Func<TState, bool> condition, Func<TState, TState> iterate, Func<TState, TResult> resultSelector, Func<TState, TimeSpan> timeSelector, IScheduler scheduler)
- {
-#if !NO_PERF
- return new Generate<TState, TResult>(initialState, condition, iterate, resultSelector, timeSelector, scheduler);
-#else
- return new AnonymousObservable<TResult>(observer =>
- {
- var state = initialState;
- var first = true;
- var hasResult = false;
- var result = default(TResult);
- var time = default(TimeSpan);
- return scheduler.Schedule(TimeSpan.Zero, self =>
- {
- if (hasResult)
- observer.OnNext(result);
- try
- {
- if (first)
- first = false;
- else
- state = iterate(state);
- hasResult = condition(state);
- if (hasResult)
- {
- result = resultSelector(state);
- time = timeSelector(state);
- }
- }
- catch (Exception exception)
- {
- observer.OnError(exception);
- return;
- }
-
- if (hasResult)
- self(time);
- else
- observer.OnCompleted();
- });
- });
-#endif
- }
-
- public virtual IObservable<TResult> Generate<TState, TResult>(TState initialState, Func<TState, bool> condition, Func<TState, TState> iterate, Func<TState, TResult> resultSelector, Func<TState, DateTimeOffset> timeSelector)
- {
- return Generate_<TState, TResult>(initialState, condition, iterate, resultSelector, timeSelector, SchedulerDefaults.TimeBasedOperations);
- }
-
- public virtual IObservable<TResult> Generate<TState, TResult>(TState initialState, Func<TState, bool> condition, Func<TState, TState> iterate, Func<TState, TResult> resultSelector, Func<TState, DateTimeOffset> timeSelector, IScheduler scheduler)
- {
- return Generate_<TState, TResult>(initialState, condition, iterate, resultSelector, timeSelector, scheduler);
- }
-
- private static IObservable<TResult> Generate_<TState, TResult>(TState initialState, Func<TState, bool> condition, Func<TState, TState> iterate, Func<TState, TResult> resultSelector, Func<TState, DateTimeOffset> timeSelector, IScheduler scheduler)
- {
-#if !NO_PERF
- return new Generate<TState, TResult>(initialState, condition, iterate, resultSelector, timeSelector, scheduler);
-#else
- return new AnonymousObservable<TResult>(observer =>
- {
- var state = initialState;
- var first = true;
- var hasResult = false;
- var result = default(TResult);
- var time = default(DateTimeOffset);
- return scheduler.Schedule(scheduler.Now, self =>
- {
- if (hasResult)
- observer.OnNext(result);
- try
- {
- if (first)
- first = false;
- else
- state = iterate(state);
- hasResult = condition(state);
- if (hasResult)
- {
- result = resultSelector(state);
- time = timeSelector(state);
- }
- }
- catch (Exception exception)
- {
- observer.OnError(exception);
- return;
- }
-
- if (hasResult)
- self(time);
- else
- observer.OnCompleted();
- });
- });
-#endif
- }
-
- #endregion
-
- #region + Interval +
-
- public virtual IObservable<long> Interval(TimeSpan period)
- {
- return Timer_(period, period, SchedulerDefaults.TimeBasedOperations);
- }
-
- public virtual IObservable<long> Interval(TimeSpan period, IScheduler scheduler)
- {
- return Timer_(period, period, scheduler);
- }
-
- #endregion
-
- #region + Sample +
-
- public virtual IObservable<TSource> Sample<TSource>(IObservable<TSource> source, TimeSpan interval)
- {
- return Sample_<TSource>(source, interval, SchedulerDefaults.TimeBasedOperations);
- }
-
- public virtual IObservable<TSource> Sample<TSource>(IObservable<TSource> source, TimeSpan interval, IScheduler scheduler)
- {
- return Sample_<TSource>(source, interval, scheduler);
- }
-
- private static IObservable<TSource> Sample_<TSource>(IObservable<TSource> source, TimeSpan interval, IScheduler scheduler)
- {
-#if !NO_PERF
- return new Sample<TSource>(source, interval, scheduler);
-#else
- var sampler = Observable.Interval(interval, scheduler);
- return Sample_<TSource, long>(source, sampler);
-#endif
- }
-
- public virtual IObservable<TSource> Sample<TSource, TSample>(IObservable<TSource> source, IObservable<TSample> sampler)
- {
- return Sample_<TSource, TSample>(source, sampler);
- }
-
- private static IObservable<TSource> Sample_<TSource, TSample>(IObservable<TSource> source, IObservable<TSample> sampler)
- {
-#if !NO_PERF
- return new Sample<TSource, TSample>(source, sampler);
-#else
- return Combine(source, sampler, (IObserver<TSource> observer, IDisposable leftSubscription, IDisposable rightSubscription) =>
- {
- var value = default(Notification<TSource>);
- var atEnd = false;
- return new BinaryObserver<TSource, TSample>(
- newValue =>
- {
- switch (newValue.Kind)
- {
- case NotificationKind.OnNext:
- value = newValue;
- break;
- case NotificationKind.OnError:
- newValue.Accept(observer);
- break;
- case NotificationKind.OnCompleted:
- atEnd = true;
- break;
- }
- },
- _ =>
- {
- var myValue = value;
- value = null;
- if (myValue != null)
- myValue.Accept(observer);
- if (atEnd)
- observer.OnCompleted();
- });
- });
-#endif
- }
-
- #endregion
-
- #region + Skip +
-
- public virtual IObservable<TSource> Skip<TSource>(IObservable<TSource> source, TimeSpan duration)
- {
- return Skip_<TSource>(source, duration, SchedulerDefaults.TimeBasedOperations);
- }
-
- public virtual IObservable<TSource> Skip<TSource>(IObservable<TSource> source, TimeSpan duration, IScheduler scheduler)
- {
- return Skip_<TSource>(source, duration, scheduler);
- }
-
- private static IObservable<TSource> Skip_<TSource>(IObservable<TSource> source, TimeSpan duration, IScheduler scheduler)
- {
-#if !NO_PERF
- var skip = source as Skip<TSource>;
- if (skip != null && skip._scheduler == scheduler)
- return skip.Ω(duration);
-
- return new Skip<TSource>(source, duration, scheduler);
-#else
- return new AnonymousObservable<TSource>(observer =>
- {
- var open = false;
-
- var t = scheduler.Schedule(duration, () => open = true);
-
- var d = source.Subscribe(
- x =>
- {
- if (open)
- observer.OnNext(x);
- },
- observer.OnError,
- observer.OnCompleted
- );
-
- return new CompositeDisposable(t, d);
- });
-#endif
- }
-
- #endregion
-
- #region + SkipLast +
-
- public virtual IObservable<TSource> SkipLast<TSource>(IObservable<TSource> source, TimeSpan duration)
- {
- return SkipLast_<TSource>(source, duration, SchedulerDefaults.TimeBasedOperations);
- }
-
- public virtual IObservable<TSource> SkipLast<TSource>(IObservable<TSource> source, TimeSpan duration, IScheduler scheduler)
- {
- return SkipLast_<TSource>(source, duration, scheduler);
- }
-
- private static IObservable<TSource> SkipLast_<TSource>(IObservable<TSource> source, TimeSpan duration, IScheduler scheduler)
- {
-#if !NO_PERF
- return new SkipLast<TSource>(source, duration, scheduler);
-#else
- return new AnonymousObservable<TSource>(observer =>
- {
- var q = new Queue<System.Reactive.TimeInterval<TSource>>();
-
- var swp = scheduler.AsStopwatchProvider();
- var sw = swp != null ? swp.StartStopwatch() : new DefaultStopwatch();
-
- return source.Subscribe(
- x =>
- {
- var now = sw.Elapsed;
- q.Enqueue(new System.Reactive.TimeInterval<TSource>(x, now));
- while (q.Count > 0 && now - q.Peek().Interval >= duration)
- observer.OnNext(q.Dequeue().Value);
- },
- observer.OnError,
- () =>
- {
- var now = sw.Elapsed;
- while (q.Count > 0 && now - q.Peek().Interval >= duration)
- observer.OnNext(q.Dequeue().Value);
- observer.OnCompleted();
- }
- );
- });
-#endif
- }
-
- #endregion
-
- #region + SkipUntil +
-
- public virtual IObservable<TSource> SkipUntil<TSource>(IObservable<TSource> source, DateTimeOffset startTime)
- {
- return SkipUntil_<TSource>(source, startTime, SchedulerDefaults.TimeBasedOperations);
- }
-
- public virtual IObservable<TSource> SkipUntil<TSource>(IObservable<TSource> source, DateTimeOffset startTime, IScheduler scheduler)
- {
- return SkipUntil_<TSource>(source, startTime, scheduler);
- }
-
- private static IObservable<TSource> SkipUntil_<TSource>(IObservable<TSource> source, DateTimeOffset startTime, IScheduler scheduler)
- {
-#if !NO_PERF
- var skipUntil = source as SkipUntil<TSource>;
- if (skipUntil != null && skipUntil._scheduler == scheduler)
- return skipUntil.Ω(startTime);
-
- return new SkipUntil<TSource>(source, startTime, scheduler);
-#else
- return new AnonymousObservable<TSource>(observer =>
- {
- var open = false;
-
- var t = scheduler.Schedule(startTime, () => open = true);
-
- var d = source.Subscribe(
- x =>
- {
- if (open)
- observer.OnNext(x);
- },
- observer.OnError,
- observer.OnCompleted
- );
-
- return new CompositeDisposable(t, d);
- });
-#endif
- }
-
- #endregion
-
- #region + Take +
-
- public virtual IObservable<TSource> Take<TSource>(IObservable<TSource> source, TimeSpan duration)
- {
- return Take_<TSource>(source, duration, SchedulerDefaults.TimeBasedOperations);
- }
-
- public virtual IObservable<TSource> Take<TSource>(IObservable<TSource> source, TimeSpan duration, IScheduler scheduler)
- {
- return Take_<TSource>(source, duration, scheduler);
- }
-
- private static IObservable<TSource> Take_<TSource>(IObservable<TSource> source, TimeSpan duration, IScheduler scheduler)
- {
-#if !NO_PERF
- var take = source as Take<TSource>;
- if (take != null && take._scheduler == scheduler)
- return take.Ω(duration);
-
- return new Take<TSource>(source, duration, scheduler);
-#else
- return new AnonymousObservable<TSource>(observer =>
- {
- var gate = new object();
-
- var t = scheduler.Schedule(duration, () =>
- {
- lock (gate)
- {
- observer.OnCompleted();
- }
- });
-
- var d = source.Synchronize(gate).Subscribe(observer);
-
- return new CompositeDisposable(t, d);
- });
-#endif
- }
-
- #endregion
-
- #region + TakeLast +
-
- public virtual IObservable<TSource> TakeLast<TSource>(IObservable<TSource> source, TimeSpan duration)
- {
- return TakeLast_<TSource>(source, duration, SchedulerDefaults.TimeBasedOperations, SchedulerDefaults.Iteration);
- }
-
- public virtual IObservable<TSource> TakeLast<TSource>(IObservable<TSource> source, TimeSpan duration, IScheduler scheduler)
- {
- return TakeLast_<TSource>(source, duration, scheduler, SchedulerDefaults.Iteration);
- }
-
- public virtual IObservable<TSource> TakeLast<TSource>(IObservable<TSource> source, TimeSpan duration, IScheduler timerScheduler, IScheduler loopScheduler)
- {
- return TakeLast_<TSource>(source, duration, timerScheduler, loopScheduler);
- }
-
- private static IObservable<TSource> TakeLast_<TSource>(IObservable<TSource> source, TimeSpan duration, IScheduler timerScheduler, IScheduler loopScheduler)
- {
-#if !NO_PERF
- return new TakeLast<TSource>(source, duration, timerScheduler, loopScheduler);
-#else
- return new AnonymousObservable<TSource>(observer =>
- {
- var q = new Queue<System.Reactive.TimeInterval<TSource>>();
-
- var swp = timerScheduler.AsStopwatchProvider();
- var sw = swp != null ? swp.StartStopwatch() : new DefaultStopwatch();
-
- var trim = new Action<TimeSpan>(now =>
- {
- while (q.Count > 0 && now - q.Peek().Interval >= duration)
- q.Dequeue();
- });
-
- var g = new CompositeDisposable();
-
- g.Add(source.Subscribe(
- x =>
- {
- var now = sw.Elapsed;
-
- q.Enqueue(new System.Reactive.TimeInterval<TSource>(x, now));
- trim(now);
- },
- observer.OnError,
- () =>
- {
- var now = sw.Elapsed;
- trim(now);
-
- g.Add(loopScheduler.Schedule(rec =>
- {
- if (q.Count > 0)
- {
- observer.OnNext(q.Dequeue().Value);
- rec();
- }
- else
- {
- observer.OnCompleted();
- }
- }));
- }
- ));
-
- return g;
- });
-#endif
- }
-
- public virtual IObservable<IList<TSource>> TakeLastBuffer<TSource>(IObservable<TSource> source, TimeSpan duration)
- {
- return TakeLastBuffer_<TSource>(source, duration, SchedulerDefaults.TimeBasedOperations);
- }
-
- public virtual IObservable<IList<TSource>> TakeLastBuffer<TSource>(IObservable<TSource> source, TimeSpan duration, IScheduler scheduler)
- {
- return TakeLastBuffer_<TSource>(source, duration, scheduler);
- }
-
- private static IObservable<IList<TSource>> TakeLastBuffer_<TSource>(IObservable<TSource> source, TimeSpan duration, IScheduler scheduler)
- {
-#if !NO_PERF
- return new TakeLastBuffer<TSource>(source, duration, scheduler);
-#else
- return new AnonymousObservable<IList<TSource>>(observer =>
- {
- var q = new Queue<System.Reactive.TimeInterval<TSource>>();
-
- var swp = scheduler.AsStopwatchProvider();
- var sw = swp != null ? swp.StartStopwatch() : new DefaultStopwatch();
-
- return source.Subscribe(
- x =>
- {
- var now = sw.Elapsed;
-
- q.Enqueue(new System.Reactive.TimeInterval<TSource>(x, now));
- while (q.Count > 0 && now - q.Peek().Interval >= duration)
- q.Dequeue();
- },
- observer.OnError,
- () =>
- {
- var now = sw.Elapsed;
-
- var res = new List<TSource>();
- while (q.Count > 0)
- {
- var next = q.Dequeue();
- if (now - next.Interval <= duration)
- res.Add(next.Value);
- }
-
- observer.OnNext(res);
- observer.OnCompleted();
- }
- );
- });
-#endif
- }
-
- #endregion
-
- #region + TakeUntil +
-
- public virtual IObservable<TSource> TakeUntil<TSource>(IObservable<TSource> source, DateTimeOffset endTime)
- {
- return TakeUntil_<TSource>(source, endTime, SchedulerDefaults.TimeBasedOperations);
- }
-
- public virtual IObservable<TSource> TakeUntil<TSource>(IObservable<TSource> source, DateTimeOffset endTime, IScheduler scheduler)
- {
- return TakeUntil_<TSource>(source, endTime, scheduler);
- }
-
- private static IObservable<TSource> TakeUntil_<TSource>(IObservable<TSource> source, DateTimeOffset endTime, IScheduler scheduler)
- {
-#if !NO_PERF
- var takeUntil = source as TakeUntil<TSource>;
- if (takeUntil != null && takeUntil._scheduler == scheduler)
- return takeUntil.Ω(endTime);
-
- return new TakeUntil<TSource>(source, endTime, scheduler);
-#else
- return new AnonymousObservable<TSource>(observer =>
- {
- var gate = new object();
-
- var t = scheduler.Schedule(endTime, () =>
- {
- lock (gate)
- {
- observer.OnCompleted();
- }
- });
-
- var d = source.Synchronize(gate).Subscribe(observer);
-
- return new CompositeDisposable(t, d);
- });
-#endif
- }
-
- #endregion
-
- #region + Throttle +
-
- public virtual IObservable<TSource> Throttle<TSource>(IObservable<TSource> source, TimeSpan dueTime)
- {
- return Throttle_<TSource>(source, dueTime, SchedulerDefaults.TimeBasedOperations);
- }
-
- public virtual IObservable<TSource> Throttle<TSource>(IObservable<TSource> source, TimeSpan dueTime, IScheduler scheduler)
- {
- return Throttle_<TSource>(source, dueTime, scheduler);
- }
-
- private static IObservable<TSource> Throttle_<TSource>(IObservable<TSource> source, TimeSpan dueTime, IScheduler scheduler)
- {
-#if !NO_PERF
- return new Throttle<TSource>(source, dueTime, scheduler);
-#else
- return new AnonymousObservable<TSource>(observer =>
- {
- var gate = new object();
- var value = default(TSource);
- var hasValue = false;
- var cancelable = new SerialDisposable();
- var id = 0UL;
-
- var subscription = source.Subscribe(x =>
- {
- ulong currentid;
- lock (gate)
- {
- hasValue = true;
- value = x;
- id = unchecked(id + 1);
- currentid = id;
- }
- var d = new SingleAssignmentDisposable();
- cancelable.Disposable = d;
- d.Disposable = scheduler.Schedule(dueTime, () =>
- {
- lock (gate)
- {
- if (hasValue && id == currentid)
- observer.OnNext(value);
- hasValue = false;
- }
- });
- },
- exception =>
- {
- cancelable.Dispose();
-
- lock (gate)
- {
- observer.OnError(exception);
- hasValue = false;
- id = unchecked(id + 1);
- }
- },
- () =>
- {
- cancelable.Dispose();
-
- lock (gate)
- {
- if (hasValue)
- observer.OnNext(value);
- observer.OnCompleted();
- hasValue = false;
- id = unchecked(id + 1);
- }
- });
-
- return new CompositeDisposable(subscription, cancelable);
- });
-#endif
- }
-
- public virtual IObservable<TSource> Throttle<TSource, TThrottle>(IObservable<TSource> source, Func<TSource, IObservable<TThrottle>> throttleDurationSelector)
- {
-#if !NO_PERF
- return new Throttle<TSource, TThrottle>(source, throttleDurationSelector);
-#else
- return new AnonymousObservable<TSource>(observer =>
- {
- var gate = new object();
- var value = default(TSource);
- var hasValue = false;
- var cancelable = new SerialDisposable();
- var id = 0UL;
-
- var subscription = source.Subscribe(
- x =>
- {
- var throttle = default(IObservable<TThrottle>);
- try
- {
- throttle = throttleDurationSelector(x);
- }
- catch (Exception error)
- {
- lock (gate)
- observer.OnError(error);
-
- return;
- }
-
- ulong currentid;
- lock (gate)
- {
- hasValue = true;
- value = x;
- id = unchecked(id + 1);
- currentid = id;
- }
-
- var d = new SingleAssignmentDisposable();
- cancelable.Disposable = d;
- d.Disposable = throttle.Subscribe(
- _ =>
- {
- lock (gate)
- {
- if (hasValue && id == currentid)
- observer.OnNext(value);
-
- hasValue = false;
- d.Dispose();
- }
- },
- exception =>
- {
- lock (gate)
- {
- observer.OnError(exception);
- }
- },
- () =>
- {
- lock (gate)
- {
- if (hasValue && id == currentid)
- observer.OnNext(value);
-
- hasValue = false;
- d.Dispose();
- }
- }
- );
- },
- exception =>
- {
- cancelable.Dispose();
-
- lock (gate)
- {
- observer.OnError(exception);
- hasValue = false;
- id = unchecked(id + 1);
- }
- },
- () =>
- {
- cancelable.Dispose();
-
- lock (gate)
- {
- if (hasValue)
- observer.OnNext(value);
- observer.OnCompleted();
- hasValue = false;
- id = unchecked(id + 1);
- }
- });
-
- return new CompositeDisposable(subscription, cancelable);
- });
-#endif
- }
-
- #endregion
-
- #region + TimeInterval +
-
- public virtual IObservable<System.Reactive.TimeInterval<TSource>> TimeInterval<TSource>(IObservable<TSource> source)
- {
- return TimeInterval_<TSource>(source, SchedulerDefaults.TimeBasedOperations);
- }
-
- public virtual IObservable<System.Reactive.TimeInterval<TSource>> TimeInterval<TSource>(IObservable<TSource> source, IScheduler scheduler)
- {
- return TimeInterval_<TSource>(source, scheduler);
- }
-
-#if !NO_PERF
- private static IObservable<System.Reactive.TimeInterval<TSource>> TimeInterval_<TSource>(IObservable<TSource> source, IScheduler scheduler)
- {
- return new TimeInterval<TSource>(source, scheduler);
- }
-#else
- private IObservable<System.Reactive.TimeInterval<TSource>> TimeInterval_<TSource>(IObservable<TSource> source, IScheduler scheduler)
- {
- return Defer(() =>
- {
- var last = scheduler.Now;
- return source.Select(x =>
- {
- var now = scheduler.Now;
- var span = now.Subtract(last);
- last = now;
- return new System.Reactive.TimeInterval<TSource>(x, span);
- });
- });
- }
-#endif
-
- #endregion
-
- #region + Timeout +
-
- #region TimeSpan
-
- public virtual IObservable<TSource> Timeout<TSource>(IObservable<TSource> source, TimeSpan dueTime)
- {
- return Timeout_<TSource>(source, dueTime, Observable.Throw<TSource>(new TimeoutException()), SchedulerDefaults.TimeBasedOperations);
- }
-
- public virtual IObservable<TSource> Timeout<TSource>(IObservable<TSource> source, TimeSpan dueTime, IScheduler scheduler)
- {
- return Timeout_<TSource>(source, dueTime, Observable.Throw<TSource>(new TimeoutException()), scheduler);
- }
-
- public virtual IObservable<TSource> Timeout<TSource>(IObservable<TSource> source, TimeSpan dueTime, IObservable<TSource> other)
- {
- return Timeout_<TSource>(source, dueTime, other, SchedulerDefaults.TimeBasedOperations);
- }
-
- public virtual IObservable<TSource> Timeout<TSource>(IObservable<TSource> source, TimeSpan dueTime, IObservable<TSource> other, IScheduler scheduler)
- {
- return Timeout_<TSource>(source, dueTime, other, scheduler);
- }
-
- private static IObservable<TSource> Timeout_<TSource>(IObservable<TSource> source, TimeSpan dueTime, IObservable<TSource> other, IScheduler scheduler)
- {
-#if !NO_PERF
- return new Timeout<TSource>(source, dueTime, other, scheduler);
-#else
- return new AnonymousObservable<TSource>(observer =>
- {
- var subscription = new SerialDisposable();
- var timer = new SerialDisposable();
- var original = new SingleAssignmentDisposable();
-
- subscription.Disposable = original;
-
- var gate = new object();
- var id = 0UL;
- var switched = false;
-
- Action createTimer = () =>
- {
- var myid = id;
- timer.Disposable = scheduler.Schedule(dueTime, () =>
- {
- var timerWins = false;
-
- lock (gate)
- {
- switched = (id == myid);
- timerWins = switched;
- }
-
- if (timerWins)
- subscription.Disposable = other.Subscribe(observer);
- });
- };
-
- createTimer();
-
- original.Disposable = source.Subscribe(
- x =>
- {
- var onNextWins = false;
-
- lock (gate)
- {
- onNextWins = !switched;
- if (onNextWins)
- {
- id = unchecked(id + 1);
- }
- }
-
- if (onNextWins)
- {
- observer.OnNext(x);
- createTimer();
- }
- },
- exception =>
- {
- var onErrorWins = false;
-
- lock (gate)
- {
- onErrorWins = !switched;
- if (onErrorWins)
- {
- id = unchecked(id + 1);
- }
- }
-
- if (onErrorWins)
- observer.OnError(exception);
- },
- () =>
- {
- var onCompletedWins = false;
-
- lock (gate)
- {
- onCompletedWins = !switched;
- if (onCompletedWins)
- {
- id = unchecked(id + 1);
- }
- }
-
- if (onCompletedWins)
- observer.OnCompleted();
- });
-
- return new CompositeDisposable(subscription, timer);
- });
-#endif
- }
-
- #endregion
-
- #region DateTimeOffset
-
- public virtual IObservable<TSource> Timeout<TSource>(IObservable<TSource> source, DateTimeOffset dueTime)
- {
- return Timeout_<TSource>(source, dueTime, Observable.Throw<TSource>(new TimeoutException()), SchedulerDefaults.TimeBasedOperations);
- }
-
- public virtual IObservable<TSource> Timeout<TSource>(IObservable<TSource> source, DateTimeOffset dueTime, IScheduler scheduler)
- {
- return Timeout_<TSource>(source, dueTime, Observable.Throw<TSource>(new TimeoutException()), scheduler);
- }
-
- public virtual IObservable<TSource> Timeout<TSource>(IObservable<TSource> source, DateTimeOffset dueTime, IObservable<TSource> other)
- {
- return Timeout_<TSource>(source, dueTime, other, SchedulerDefaults.TimeBasedOperations);
- }
-
- public virtual IObservable<TSource> Timeout<TSource>(IObservable<TSource> source, DateTimeOffset dueTime, IObservable<TSource> other, IScheduler scheduler)
- {
- return Timeout_<TSource>(source, dueTime, other, scheduler);
- }
-
- private static IObservable<TSource> Timeout_<TSource>(IObservable<TSource> source, DateTimeOffset dueTime, IObservable<TSource> other, IScheduler scheduler)
- {
-#if !NO_PERF
- return new Timeout<TSource>(source, dueTime, other, scheduler);
-#else
- return new AnonymousObservable<TSource>(observer =>
- {
- var subscription = new SerialDisposable();
- var original = new SingleAssignmentDisposable();
-
- subscription.Disposable = original;
-
- var gate = new object();
- var switched = false;
-
- var timer = scheduler.Schedule(dueTime, () =>
- {
- var timerWins = false;
-
- lock (gate)
- {
- timerWins = !switched;
- switched = true;
- }
-
- if (timerWins)
- subscription.Disposable = other.Subscribe(observer);
- });
-
- original.Disposable = source.Subscribe(
- x =>
- {
- lock (gate)
- {
- if (!switched)
- observer.OnNext(x);
- }
- },
- exception =>
- {
- var onErrorWins = false;
-
- lock (gate)
- {
- onErrorWins = !switched;
- switched = true;
- }
-
- if (onErrorWins)
- observer.OnError(exception);
- },
- () =>
- {
- var onCompletedWins = false;
-
- lock (gate)
- {
- onCompletedWins = !switched;
- switched = true;
- }
-
- if (onCompletedWins)
- observer.OnCompleted();
- });
-
- return new CompositeDisposable(subscription, timer);
- });
-#endif
- }
-
- #endregion
-
- #region Duration selector
-
- public virtual IObservable<TSource> Timeout<TSource, TTimeout>(IObservable<TSource> source, Func<TSource, IObservable<TTimeout>> timeoutDurationSelector)
- {
- return Timeout_<TSource, TTimeout>(source, Observable.Never<TTimeout>(), timeoutDurationSelector, Observable.Throw<TSource>(new TimeoutException()));
- }
-
- public virtual IObservable<TSource> Timeout<TSource, TTimeout>(IObservable<TSource> source, Func<TSource, IObservable<TTimeout>> timeoutDurationSelector, IObservable<TSource> other)
- {
- return Timeout_<TSource, TTimeout>(source, Observable.Never<TTimeout>(), timeoutDurationSelector, other);
- }
-
- public virtual IObservable<TSource> Timeout<TSource, TTimeout>(IObservable<TSource> source, IObservable<TTimeout> firstTimeout, Func<TSource, IObservable<TTimeout>> timeoutDurationSelector)
- {
- return Timeout_<TSource, TTimeout>(source, firstTimeout, timeoutDurationSelector, Observable.Throw<TSource>(new TimeoutException()));
- }
-
- public virtual IObservable<TSource> Timeout<TSource, TTimeout>(IObservable<TSource> source, IObservable<TTimeout> firstTimeout, Func<TSource, IObservable<TTimeout>> timeoutDurationSelector, IObservable<TSource> other)
- {
- return Timeout_<TSource, TTimeout>(source, firstTimeout, timeoutDurationSelector, other);
- }
-
- private static IObservable<TSource> Timeout_<TSource, TTimeout>(IObservable<TSource> source, IObservable<TTimeout> firstTimeout, Func<TSource, IObservable<TTimeout>> timeoutDurationSelector, IObservable<TSource> other)
- {
-#if !NO_PERF
- return new Timeout<TSource, TTimeout>(source, firstTimeout, timeoutDurationSelector, other);
-#else
- return new AnonymousObservable<TSource>(observer =>
- {
- var subscription = new SerialDisposable();
- var timer = new SerialDisposable();
- var original = new SingleAssignmentDisposable();
-
- subscription.Disposable = original;
-
- var gate = new object();
- var id = 0UL;
- var switched = false;
-
- Action<IObservable<TTimeout>> setTimer = timeout =>
- {
- var myid = id;
-
- Func<bool> timerWins = () =>
- {
- var res = false;
-
- lock (gate)
- {
- switched = (id == myid);
- res = switched;
- }
-
- return res;
- };
-
- var d = new SingleAssignmentDisposable();
- timer.Disposable = d;
- d.Disposable = timeout.Subscribe(
- _ =>
- {
- if (timerWins())
- subscription.Disposable = other.Subscribe(observer);
-
- d.Dispose();
- },
- error =>
- {
- if (timerWins())
- observer.OnError(error);
- },
- () =>
- {
- if (timerWins())
- subscription.Disposable = other.Subscribe(observer);
- }
- );
- };
-
- setTimer(firstTimeout);
-
- Func<bool> observerWins = () =>
- {
- var res = false;
-
- lock (gate)
- {
- res = !switched;
- if (res)
- {
- id = unchecked(id + 1);
- }
- }
-
- return res;
- };
-
- original.Disposable = source.Subscribe(
- x =>
- {
- if (observerWins())
- {
- observer.OnNext(x);
-
- var timeout = default(IObservable<TTimeout>);
- try
- {
- timeout = timeoutDurationSelector(x);
- }
- catch (Exception error)
- {
- observer.OnError(error);
- return;
- }
-
- setTimer(timeout);
- }
- },
- exception =>
- {
- if (observerWins())
- observer.OnError(exception);
- },
- () =>
- {
- if (observerWins())
- observer.OnCompleted();
- }
- );
-
- return new CompositeDisposable(subscription, timer);
- });
-#endif
- }
-
- #endregion
-
- #endregion
-
- #region + Timer +
-
- public virtual IObservable<long> Timer(TimeSpan dueTime)
- {
- return Timer_(dueTime, SchedulerDefaults.TimeBasedOperations);
- }
-
- public virtual IObservable<long> Timer(DateTimeOffset dueTime)
- {
- return Timer_(dueTime, SchedulerDefaults.TimeBasedOperations);
- }
-
- public virtual IObservable<long> Timer(TimeSpan dueTime, TimeSpan period)
- {
- return Timer_(dueTime, period, SchedulerDefaults.TimeBasedOperations);
- }
-
- public virtual IObservable<long> Timer(DateTimeOffset dueTime, TimeSpan period)
- {
- return Timer_(dueTime, period, SchedulerDefaults.TimeBasedOperations);
- }
-
- public virtual IObservable<long> Timer(TimeSpan dueTime, IScheduler scheduler)
- {
- return Timer_(dueTime, scheduler);
- }
-
- public virtual IObservable<long> Timer(DateTimeOffset dueTime, IScheduler scheduler)
- {
- return Timer_(dueTime, scheduler);
- }
-
- public virtual IObservable<long> Timer(TimeSpan dueTime, TimeSpan period, IScheduler scheduler)
- {
- return Timer_(dueTime, period, scheduler);
- }
-
- public virtual IObservable<long> Timer(DateTimeOffset dueTime, TimeSpan period, IScheduler scheduler)
- {
- return Timer_(dueTime, period, scheduler);
- }
-
- private static IObservable<long> Timer_(TimeSpan dueTime, IScheduler scheduler)
- {
-#if !NO_PERF
- return new Timer(dueTime, null, scheduler);
-#else
- var d = Normalize(dueTime);
-
- return new AnonymousObservable<long>(observer =>
- scheduler.Schedule(d, () =>
- {
- observer.OnNext(0);
- observer.OnCompleted();
- }));
-#endif
- }
-
-#if !NO_PERF
- private static IObservable<long> Timer_(TimeSpan dueTime, TimeSpan period, IScheduler scheduler)
- {
- return new Timer(dueTime, period, scheduler);
- }
-#else
- private IObservable<long> Timer_(TimeSpan dueTime, TimeSpan period, IScheduler scheduler)
- {
- var p = Normalize(period);
-
- return Defer(() => Timer(scheduler.Now + dueTime, p, scheduler));
- }
-#endif
-
- private static IObservable<long> Timer_(DateTimeOffset dueTime, IScheduler scheduler)
- {
-#if !NO_PERF
- return new Timer(dueTime, null, scheduler);
-#else
- return new AnonymousObservable<long>(observer =>
- scheduler.Schedule(dueTime, () =>
- {
- observer.OnNext(0);
- observer.OnCompleted();
- }));
-#endif
- }
-
- private static IObservable<long> Timer_(DateTimeOffset dueTime, TimeSpan period, IScheduler scheduler)
- {
-#if !NO_PERF
- return new Timer(dueTime, period, scheduler);
-#else
- var p = Normalize(period);
-
- return new AnonymousObservable<long>(observer =>
- {
- var d = dueTime;
- var count = 0L;
-
- return scheduler.Schedule(d, self =>
- {
- if (p > TimeSpan.Zero)
- {
- var now = scheduler.Now;
- d = d + p;
- if (d <= now)
- d = now + p;
- }
-
- observer.OnNext(count);
- count = unchecked(count + 1);
- self(d);
- });
- });
-#endif
- }
-
- #endregion
-
- #region + Timestamp +
-
- public virtual IObservable<Timestamped<TSource>> Timestamp<TSource>(IObservable<TSource> source)
- {
- return Timestamp_<TSource>(source, SchedulerDefaults.TimeBasedOperations);
- }
-
- public virtual IObservable<Timestamped<TSource>> Timestamp<TSource>(IObservable<TSource> source, IScheduler scheduler)
- {
- return Timestamp_<TSource>(source, scheduler);
- }
-
- private static IObservable<Timestamped<TSource>> Timestamp_<TSource>(IObservable<TSource> source, IScheduler scheduler)
- {
-#if !NO_PERF
- return new Timestamp<TSource>(source, scheduler);
-#else
- return source.Select(x => new Timestamped<TSource>(x, scheduler.Now));
-#endif
- }
-
- #endregion
-
- #region + Window +
-
- #region TimeSpan only
-
- public virtual IObservable<IObservable<TSource>> Window<TSource>(IObservable<TSource> source, TimeSpan timeSpan)
- {
- return Window_<TSource>(source, timeSpan, timeSpan, SchedulerDefaults.TimeBasedOperations);
- }
-
- public virtual IObservable<IObservable<TSource>> Window<TSource>(IObservable<TSource> source, TimeSpan timeSpan, IScheduler scheduler)
- {
- return Window_<TSource>(source, timeSpan, timeSpan, scheduler);
- }
-
- public virtual IObservable<IObservable<TSource>> Window<TSource>(IObservable<TSource> source, TimeSpan timeSpan, TimeSpan timeShift)
- {
- return Window_<TSource>(source, timeSpan, timeShift, SchedulerDefaults.TimeBasedOperations);
- }
-
- public virtual IObservable<IObservable<TSource>> Window<TSource>(IObservable<TSource> source, TimeSpan timeSpan, TimeSpan timeShift, IScheduler scheduler)
- {
- return Window_<TSource>(source, timeSpan, timeShift, scheduler);
- }
-
- private static IObservable<IObservable<TSource>> Window_<TSource>(IObservable<TSource> source, TimeSpan timeSpan, TimeSpan timeShift, IScheduler scheduler)
- {
-#if !NO_PERF
- return new Window<TSource>(source, timeSpan, timeShift, scheduler);
-#else
- return new AnonymousObservable<IObservable<TSource>>(observer =>
- {
- var totalTime = TimeSpan.Zero;
- var nextShift = timeShift;
- var nextSpan = timeSpan;
-
- var gate = new object();
- var q = new Queue<ISubject<TSource>>();
-
- var timerD = new SerialDisposable();
- var groupDisposable = new CompositeDisposable(2) { timerD };
- var refCountDisposable = new RefCountDisposable(groupDisposable);
-
- var createTimer = default(Action);
- createTimer = () =>
- {
- var m = new SingleAssignmentDisposable();
- timerD.Disposable = m;
-
- var isSpan = false;
- var isShift = false;
- if (nextSpan == nextShift)
- {
- isSpan = true;
- isShift = true;
- }
- else if (nextSpan < nextShift)
- isSpan = true;
- else
- isShift = true;
-
- var newTotalTime = isSpan ? nextSpan : nextShift;
- var ts = newTotalTime - totalTime;
- totalTime = newTotalTime;
-
- if (isSpan)
- nextSpan += timeShift;
- if (isShift)
- nextShift += timeShift;
-
- m.Disposable = scheduler.Schedule(ts, () =>
- {
- lock (gate)
- {
- if (isShift)
- {
- var s = new Subject<TSource>();
- q.Enqueue(s);
- observer.OnNext(s.AddRef(refCountDisposable));
- }
- if (isSpan)
- {
- var s = q.Dequeue();
- s.OnCompleted();
- }
- }
-
- createTimer();
- });
- };
-
- q.Enqueue(new Subject<TSource>());
- observer.OnNext(q.Peek().AddRef(refCountDisposable));
- createTimer();
-
- groupDisposable.Add(source.Subscribe(
- x =>
- {
- lock (gate)
- {
- foreach (var s in q)
- s.OnNext(x);
- }
- },
- exception =>
- {
- lock (gate)
- {
- foreach (var s in q)
- s.OnError(exception);
- observer.OnError(exception);
- }
- },
- () =>
- {
- lock (gate)
- {
- foreach (var s in q)
- s.OnCompleted();
- observer.OnCompleted();
- }
- }
- ));
-
- return refCountDisposable;
- });
-#endif
- }
-
- #endregion
-
- #region TimeSpan + int
-
- public virtual IObservable<IObservable<TSource>> Window<TSource>(IObservable<TSource> source, TimeSpan timeSpan, int count)
- {
- return Window_<TSource>(source, timeSpan, count, SchedulerDefaults.TimeBasedOperations);
- }
-
- public virtual IObservable<IObservable<TSource>> Window<TSource>(IObservable<TSource> source, TimeSpan timeSpan, int count, IScheduler scheduler)
- {
- return Window_<TSource>(source, timeSpan, count, scheduler);
- }
-
- private static IObservable<IObservable<TSource>> Window_<TSource>(IObservable<TSource> source, TimeSpan timeSpan, int count, IScheduler scheduler)
- {
-#if !NO_PERF
- return new Window<TSource>(source, timeSpan, count, scheduler);
-#else
- return new AnonymousObservable<IObservable<TSource>>(observer =>
- {
- var gate = new object();
- var s = default(ISubject<TSource>);
- var n = 0;
- var windowId = 0;
-
- var timerD = new SerialDisposable();
- var groupDisposable = new CompositeDisposable(2) { timerD };
- var refCountDisposable = new RefCountDisposable(groupDisposable);
-
- var createTimer = default(Action<int>);
- createTimer = id =>
- {
- var m = new SingleAssignmentDisposable();
- timerD.Disposable = m;
-
- m.Disposable = scheduler.Schedule(timeSpan, () =>
- {
- var newId = 0;
- lock (gate)
- {
- if (id != windowId)
- return;
- n = 0;
- newId = ++windowId;
-
- s.OnCompleted();
- s = new Subject<TSource>();
- observer.OnNext(s.AddRef(refCountDisposable));
- }
-
- createTimer(newId);
- });
- };
-
- s = new Subject<TSource>();
- observer.OnNext(s.AddRef(refCountDisposable));
- createTimer(0);
-
- groupDisposable.Add(source.Subscribe(
- x =>
- {
- var newWindow = false;
- var newId = 0;
-
- lock (gate)
- {
- s.OnNext(x);
-
- n++;
- if (n == count)
- {
- newWindow = true;
- n = 0;
- newId = ++windowId;
-
- s.OnCompleted();
- s = new Subject<TSource>();
- observer.OnNext(s.AddRef(refCountDisposable));
- }
- }
-
- if (newWindow)
- createTimer(newId);
- },
- exception =>
- {
- lock (gate)
- {
- s.OnError(exception);
- observer.OnError(exception);
- }
- },
- () =>
- {
- lock (gate)
- {
- s.OnCompleted();
- observer.OnCompleted();
- }
- }
- ));
-
- return refCountDisposable;
- });
-#endif
- }
-
- #endregion
-
- #endregion
-
- #region |> Helpers <|
-
-#if NO_PERF
- private static TimeSpan Normalize(TimeSpan timeSpan)
- {
- if (timeSpan.CompareTo(TimeSpan.Zero) < 0)
- return TimeSpan.Zero;
- return timeSpan;
- }
-#endif
-
- #endregion
- }
-}
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Linq/QueryLanguage_.cs b/Rx.NET/System.Reactive.Linq/Reactive/Linq/QueryLanguage_.cs
deleted file mode 100644
index 5ea20e7..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Linq/QueryLanguage_.cs
+++ /dev/null
@@ -1,8 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-namespace System.Reactive.Linq
-{
- internal partial class QueryLanguage : IQueryLanguage
- {
- }
-}
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Observer.Extensions.cs b/Rx.NET/System.Reactive.Linq/Reactive/Observer.Extensions.cs
deleted file mode 100644
index 43c0aaf..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Observer.Extensions.cs
+++ /dev/null
@@ -1,239 +0,0 @@
-using System.Reactive.Concurrency;
-using System.Threading;
-
-namespace System.Reactive
-{
- /// <summary>
- /// Provides a set of static methods for creating observers.
- /// </summary>
- public static class Observer
- {
- /// <summary>
- /// Creates an observer from a notification callback.
- /// </summary>
- /// <param name="handler">Action that handles a notification.</param>
- /// <returns>The observer object that invokes the specified handler using a notification corresponding to each message it receives.</returns>
- public static IObserver<T> ToObserver<T>(this Action<Notification<T>> handler)
- {
- if (handler == null)
- throw new ArgumentNullException("handler");
-
- return new AnonymousObserver<T>(
- x => handler(Notification.CreateOnNext<T>(x)),
- exception => handler(Notification.CreateOnError<T>(exception)),
- () => handler(Notification.CreateOnCompleted<T>()));
- }
-
- /// <summary>
- /// Creates a notification callback from an observer.
- /// </summary>
- /// <param name="observer">Observer object.</param>
- /// <returns>The action that forwards its input notification to the underlying observer.</returns>
- public static Action<Notification<T>> ToNotifier<T>(this IObserver<T> observer)
- {
- if (observer == null)
- throw new ArgumentNullException("observer");
-
- return n => n.Accept(observer);
- }
-
- /// <summary>
- /// Creates an observer from the specified OnNext action.
- /// </summary>
- /// <param name="onNext">Observer's OnNext action implementation.</param>
- /// <returns>The observer object implemented using the given actions.</returns>
- public static IObserver<T> Create<T>(Action<T> onNext)
- {
- if (onNext == null)
- throw new ArgumentNullException("onNext");
-
- return new AnonymousObserver<T>(onNext);
- }
-
- /// <summary>
- /// Creates an observer from the specified OnNext and OnError actions.
- /// </summary>
- /// <param name="onNext">Observer's OnNext action implementation.</param>
- /// <param name="onError">Observer's OnError action implementation.</param>
- /// <returns>The observer object implemented using the given actions.</returns>
- public static IObserver<T> Create<T>(Action<T> onNext, Action<Exception> onError)
- {
- if (onNext == null)
- throw new ArgumentNullException("onNext");
- if (onError == null)
- throw new ArgumentNullException("onError");
-
- return new AnonymousObserver<T>(onNext, onError);
- }
-
- /// <summary>
- /// Creates an observer from the specified OnNext and OnCompleted actions.
- /// </summary>
- /// <param name="onNext">Observer's OnNext action implementation.</param>
- /// <param name="onCompleted">Observer's OnCompleted action implementation.</param>
- /// <returns>The observer object implemented using the given actions.</returns>
- public static IObserver<T> Create<T>(Action<T> onNext, Action onCompleted)
- {
- if (onNext == null)
- throw new ArgumentNullException("onNext");
- if (onCompleted == null)
- throw new ArgumentNullException("onCompleted");
-
- return new AnonymousObserver<T>(onNext, onCompleted);
- }
-
- /// <summary>
- /// Creates an observer from the specified OnNext, OnError, and OnCompleted actions.
- /// </summary>
- /// <param name="onNext">Observer's OnNext action implementation.</param>
- /// <param name="onError">Observer's OnError action implementation.</param>
- /// <param name="onCompleted">Observer's OnCompleted action implementation.</param>
- /// <returns>The observer object implemented using the given actions.</returns>
- public static IObserver<T> Create<T>(Action<T> onNext, Action<Exception> onError, Action onCompleted)
- {
- if (onNext == null)
- throw new ArgumentNullException("onNext");
- if (onError == null)
- throw new ArgumentNullException("onError");
- if (onCompleted == null)
- throw new ArgumentNullException("onCompleted");
-
- return new AnonymousObserver<T>(onNext, onError, onCompleted);
- }
-
- /// <summary>
- /// Hides the identity of an observer.
- /// </summary>
- /// <param name="observer">An observer whose identity to hide.</param>
- /// <returns>An observer that hides the identity of the specified observer.</returns>
- public static IObserver<T> AsObserver<T>(this IObserver<T> observer)
- {
- if (observer == null)
- throw new ArgumentNullException("observer");
-
- return new AnonymousObserver<T>(observer.OnNext, observer.OnError, observer.OnCompleted);
- }
-
- /// <summary>
- /// Synchronizes the observer messages.
- /// </summary>
- /// <param name="observer">The observer to synchronize.</param>
- /// <param name="gate">Gate object to synchronize each observer call on.</param>
- /// <returns>The observer whose messages are synchronized on the given gate object.</returns>
- public static IObserver<T> Synchronize<T>(IObserver<T> observer, object gate)
- {
- if (observer == null)
- throw new ArgumentNullException("observer");
- if (gate == null)
- throw new ArgumentNullException("gate");
-
- return new SynchronizedObserver<T>(observer, gate);
- }
-
- /// <summary>
- /// Synchronizes the observer messages.
- /// </summary>
- /// <param name="observer">The observer to synchronize.</param>
- /// <returns>The observer whose messages are synchronized.</returns>
- public static IObserver<T> Synchronize<T>(IObserver<T> observer)
- {
- if (observer == null)
- throw new ArgumentNullException("observer");
-
- return Synchronize(observer, new object());
- }
-
- /// <summary>
- /// Schedules the observer messages on the given scheduler.
- /// </summary>
- /// <param name="observer">The observer to schedule messages for.</param>
- /// <param name="scheduler">Scheduler to schedule observer messages on.</param>
- /// <returns>Observer whose messages are scheduled on the given scheduler.</returns>
- public static IObserver<T> NotifyOn<T>(this IObserver<T> observer, IScheduler scheduler)
- {
- if (observer == null)
- throw new ArgumentNullException("observer");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return new ObserveOnObserver<T>(scheduler, observer, null);
- }
-
-#if !NO_SYNCCTX
- /// <summary>
- /// Schedules the observer messages on the given synchonization context.
- /// </summary>
- /// <param name="observer">The observer to schedule messages for.</param>
- /// <param name="context">Synchonization context to schedule observer messages on.</param>
- /// <returns>Observer whose messages are scheduled on the given synchonization context.</returns>
- public static IObserver<T> NotifyOn<T>(this IObserver<T> observer, SynchronizationContext context)
- {
- if (observer == null)
- throw new ArgumentNullException("observer");
- if (context == null)
- throw new ArgumentNullException("context");
-
- return new ObserveOnObserver<T>(new SynchronizationContextScheduler(context), observer, null);
- }
-#endif
-
-#if HAS_PROGRESS
- /// <summary>
- /// Converts an observer to a progress object.
- /// </summary>
- /// <param name="observer">The observer to convert.</param>
- /// <returns>Progress object whose Report messages correspond to the observer's OnNext messages.</returns>
- public static IProgress<T> ToProgress<T>(this IObserver<T> observer)
- {
- if (observer == null)
- throw new ArgumentNullException("observer");
-
- return new AnonymousProgress<T>(observer.OnNext);
- }
-
- /// <summary>
- /// Converts an observer to a progress object.
- /// </summary>
- /// <param name="observer">The observer to convert.</param>
- /// <param name="scheduler">Scheduler to report progress on.</param>
- /// <returns>Progress object whose Report messages correspond to the observer's OnNext messages.</returns>
- public static IProgress<T> ToProgress<T>(this IObserver<T> observer, IScheduler scheduler)
- {
- if (observer == null)
- throw new ArgumentNullException("observer");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return new AnonymousProgress<T>(new ObserveOnObserver<T>(scheduler, observer, null).OnNext);
- }
-
- class AnonymousProgress<T> : IProgress<T>
- {
- private readonly Action<T> _progress;
-
- public AnonymousProgress(Action<T> progress)
- {
- _progress = progress;
- }
-
- public void Report(T value)
- {
- _progress(value);
- }
- }
-
- /// <summary>
- /// Converts a progress object to an observer.
- /// </summary>
- /// <param name="progress">The progress object to convert.</param>
- /// <returns>Observer whose OnNext messages correspond to the progress object's Report messages.</returns>
- public static IObserver<T> ToObserver<T>(this IProgress<T> progress)
- {
- if (progress == null)
- throw new ArgumentNullException("progress");
-
- return Create<T>(progress.Report);
- }
-#endif
- }
-}
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Subjects/AsyncSubject.cs b/Rx.NET/System.Reactive.Linq/Reactive/Subjects/AsyncSubject.cs
deleted file mode 100644
index 44bd05e..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Subjects/AsyncSubject.cs
+++ /dev/null
@@ -1,334 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System.Reactive.Disposables;
-using System.Threading;
-using System.Runtime.CompilerServices;
-using System.Reactive.Concurrency;
-
-namespace System.Reactive.Subjects
-{
- /// <summary>
- /// Represents the result of an asynchronous operation.
- /// The last value before the OnCompleted notification, or the error received through OnError, is sent to all subscribed observers.
- /// </summary>
- /// <typeparam name="T">The type of the elements processed by the subject.</typeparam>
- public sealed class AsyncSubject<T> : ISubject<T>, IDisposable
-#if HAS_AWAIT
- , INotifyCompletion
-#endif
- {
- private readonly object _gate = new object();
-
- private ImmutableList<IObserver<T>> _observers;
- private bool _isDisposed;
- private bool _isStopped;
- private T _value;
- private bool _hasValue;
- private Exception _exception;
-
- /// <summary>
- /// Creates a subject that can only receive one value and that value is cached for all future observations.
- /// </summary>
- public AsyncSubject()
- {
- _observers = new ImmutableList<IObserver<T>>();
- }
-
- /// <summary>
- /// Notifies all subscribed observers about the end of the sequence, also causing the last received value to be sent out (if any).
- /// </summary>
- public void OnCompleted()
- {
- var os = default(IObserver<T>[]);
-
- var v = default(T);
- var hv = false;
- lock (_gate)
- {
- CheckDisposed();
-
- if (!_isStopped)
- {
- os = _observers.Data;
- _observers = new ImmutableList<IObserver<T>>();
- _isStopped = true;
- v = _value;
- hv = _hasValue;
- }
- }
-
- if (os != null)
- {
- if (hv)
- {
- foreach (var o in os)
- {
- o.OnNext(v);
- o.OnCompleted();
- }
- }
- else
- foreach (var o in os)
- o.OnCompleted();
- }
- }
-
- /// <summary>
- /// Notifies all subscribed observers about the exception.
- /// </summary>
- /// <param name="error">The exception to send to all observers.</param>
- /// <exception cref="ArgumentNullException"><paramref name="error"/> is null.</exception>
- public void OnError(Exception error)
- {
- if (error == null)
- throw new ArgumentNullException("error");
-
- var os = default(IObserver<T>[]);
- lock (_gate)
- {
- CheckDisposed();
-
- if (!_isStopped)
- {
- os = _observers.Data;
- _observers = new ImmutableList<IObserver<T>>();
- _isStopped = true;
- _exception = error;
- }
- }
-
- if (os != null)
- foreach (var o in os)
- o.OnError(error);
- }
-
- /// <summary>
- /// Sends a value to the subject. The last value received before successful termination will be sent to all subscribed and future observers.
- /// </summary>
- /// <param name="value">The value to store in the subject.</param>
- public void OnNext(T value)
- {
- lock (_gate)
- {
- CheckDisposed();
-
- if (!_isStopped)
- {
- _value = value;
- _hasValue = true;
- }
- }
- }
-
- /// <summary>
- /// Subscribes an observer to the subject.
- /// </summary>
- /// <param name="observer">Observer to subscribe to the subject.</param>
- /// <returns>Disposable object that can be used to unsubscribe the observer from the subject.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="observer"/> is null.</exception>
- public IDisposable Subscribe(IObserver<T> observer)
- {
- if (observer == null)
- throw new ArgumentNullException("observer");
-
- var ex = default(Exception);
- var v = default(T);
- var hv = false;
-
- lock (_gate)
- {
- CheckDisposed();
-
- if (!_isStopped)
- {
- _observers = _observers.Add(observer);
- return new Subscription(this, observer);
- }
-
- ex = _exception;
- hv = _hasValue;
- v = _value;
- }
-
- if (ex != null)
- observer.OnError(ex);
- else if (hv)
- {
- observer.OnNext(v);
- observer.OnCompleted();
- }
- else
- observer.OnCompleted();
-
- return Disposable.Empty;
- }
-
- class Subscription : IDisposable
- {
- private readonly AsyncSubject<T> _subject;
- private IObserver<T> _observer;
-
- public Subscription(AsyncSubject<T> subject, IObserver<T> observer)
- {
- _subject = subject;
- _observer = observer;
- }
-
- public void Dispose()
- {
- if (_observer != null)
- {
- lock (_subject._gate)
- {
- if (!_subject._isDisposed && _observer != null)
- {
- _subject._observers = _subject._observers.Remove(_observer);
- _observer = null;
- }
- }
- }
- }
- }
-
- void CheckDisposed()
- {
- if (_isDisposed)
- throw new ObjectDisposedException(string.Empty);
- }
-
- /// <summary>
- /// Unsubscribe all observers and release resources.
- /// </summary>
- public void Dispose()
- {
- lock (_gate)
- {
- _isDisposed = true;
- _observers = null;
- _exception = null;
- _value = default(T);
- }
- }
-
-#if HAS_AWAIT
- /// <summary>
- /// Gets an awaitable object for the current AsyncSubject.
- /// </summary>
- /// <returns>Object that can be awaited.</returns>
- public AsyncSubject<T> GetAwaiter()
- {
- return this;
- }
-
- /// <summary>
- /// Specifies a callback action that will be invoked when the subject completes.
- /// </summary>
- /// <param name="continuation">Callback action that will be invoked when the subject completes.</param>
- /// <exception cref="ArgumentNullException"><paramref name="continuation"/> is null.</exception>
- public void OnCompleted(Action continuation)
- {
- if (continuation == null)
- throw new ArgumentNullException("continuation");
-
- OnCompleted(continuation, true);
- }
-#endif
-
- private void OnCompleted(Action continuation, bool originalContext)
- {
- //
- // [OK] Use of unsafe Subscribe: this type's Subscribe implementation is safe.
- //
- this.Subscribe/*Unsafe*/(new AwaitObserver(continuation, originalContext));
- }
-
- class AwaitObserver : IObserver<T>
- {
-#if HAS_AWAIT
- private readonly SynchronizationContext _context;
-#endif
- private readonly Action _callback;
-
- public AwaitObserver(Action callback, bool originalContext)
- {
-#if HAS_AWAIT
- if (originalContext)
- _context = SynchronizationContext.Current;
-#else
- System.Diagnostics.Debug.Assert(!originalContext);
-#endif
-
- _callback = callback;
- }
-
- public void OnCompleted()
- {
- InvokeOnOriginalContext();
- }
-
- public void OnError(Exception error)
- {
- InvokeOnOriginalContext();
- }
-
- public void OnNext(T value)
- {
- }
-
- private void InvokeOnOriginalContext()
- {
-#if HAS_AWAIT
- if (_context != null)
- {
- //
- // No need for OperationStarted and OperationCompleted calls here;
- // this code is invoked through await support and will have a way
- // to observe its start/complete behavior, either through returned
- // Task objects or the async method builder's interaction with the
- // SynchronizationContext object.
- //
- _context.Post(c => ((Action)c)(), _callback);
- }
- else
-#endif
- {
- _callback();
- }
- }
- }
-
- /// <summary>
- /// Gets whether the AsyncSubject has completed.
- /// </summary>
- public bool IsCompleted
- {
- get
- {
- return _isStopped;
- }
- }
-
- /// <summary>
- /// Gets the last element of the subject, potentially blocking until the subject completes successfully or exceptionally.
- /// </summary>
- /// <returns>The last element of the subject. Throws an InvalidOperationException if no element was received.</returns>
- /// <exception cref="InvalidOperationException">The source sequence is empty.</exception>
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate", Justification = "Await pattern for C# and VB compilers.")]
- public T GetResult()
- {
- if (!_isStopped)
- {
- var e = new ManualResetEvent(false);
- OnCompleted(() => e.Set(), false);
- e.WaitOne();
- }
-
- _exception.ThrowIfNotNull();
-
- if (!_hasValue)
- throw new InvalidOperationException(Strings_Linq.NO_ELEMENTS);
-
- return _value;
- }
- }
-}
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Subjects/BehaviorSubject.cs b/Rx.NET/System.Reactive.Linq/Reactive/Subjects/BehaviorSubject.cs
deleted file mode 100644
index ad77f93..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Subjects/BehaviorSubject.cs
+++ /dev/null
@@ -1,193 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System.Reactive.Disposables;
-
-namespace System.Reactive.Subjects
-{
- /// <summary>
- /// Represents a value that changes over time.
- /// Observers can subscribe to the subject to receive the last (or initial) value and all subsequent notifications.
- /// </summary>
- /// <typeparam name="T">The type of the elements processed by the subject.</typeparam>
- public sealed class BehaviorSubject<T> : ISubject<T>, IDisposable
- {
- private readonly object _gate = new object();
-
- private ImmutableList<IObserver<T>> _observers;
- private bool _isStopped;
- private T _value;
- private Exception _exception;
- private bool _isDisposed;
-
- /// <summary>
- /// Initializes a new instance of the <see cref="System.Reactive.Subjects.BehaviorSubject&lt;T&gt;"/> class which creates a subject that caches its last value and starts with the specified value.
- /// </summary>
- /// <param name="value">Initial value sent to observers when no other value has been received by the subject yet.</param>
- public BehaviorSubject(T value)
- {
- _value = value;
- _observers = new ImmutableList<IObserver<T>>();
- }
-
- /// <summary>
- /// Notifies all subscribed observers about the end of the sequence.
- /// </summary>
- public void OnCompleted()
- {
- var os = default(IObserver<T>[]);
- lock (_gate)
- {
- CheckDisposed();
-
- if (!_isStopped)
- {
- os = _observers.Data;
- _observers = new ImmutableList<IObserver<T>>();
- _isStopped = true;
- }
- }
-
- if (os != null)
- {
- foreach (var o in os)
- o.OnCompleted();
- }
- }
-
- /// <summary>
- /// Notifies all subscribed observers about the exception.
- /// </summary>
- /// <param name="error">The exception to send to all observers.</param>
- /// <exception cref="ArgumentNullException"><paramref name="error"/> is null.</exception>
- public void OnError(Exception error)
- {
- if (error == null)
- throw new ArgumentNullException("error");
-
- var os = default(IObserver<T>[]);
- lock (_gate)
- {
- CheckDisposed();
-
- if (!_isStopped)
- {
- os = _observers.Data;
- _observers = new ImmutableList<IObserver<T>>();
- _isStopped = true;
- _exception = error;
- }
- }
-
- if (os != null)
- foreach (var o in os)
- o.OnError(error);
- }
-
- /// <summary>
- /// Notifies all subscribed observers about the arrival of the specified element in the sequence.
- /// </summary>
- /// <param name="value">The value to send to all observers.</param>
- public void OnNext(T value)
- {
- var os = default(IObserver<T>[]);
- lock (_gate)
- {
- CheckDisposed();
-
- if (!_isStopped)
- {
- _value = value;
- os = _observers.Data;
- }
- }
-
- if (os != null)
- {
- foreach (var o in os)
- o.OnNext(value);
- }
- }
-
- /// <summary>
- /// Subscribes an observer to the subject.
- /// </summary>
- /// <param name="observer">Observer to subscribe to the subject.</param>
- /// <returns>Disposable object that can be used to unsubscribe the observer from the subject.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="observer"/> is null.</exception>
- public IDisposable Subscribe(IObserver<T> observer)
- {
- if (observer == null)
- throw new ArgumentNullException("observer");
-
- var ex = default(Exception);
-
- lock (_gate)
- {
- CheckDisposed();
-
- if (!_isStopped)
- {
- _observers = _observers.Add(observer);
- observer.OnNext(_value);
- return new Subscription(this, observer);
- }
-
- ex = _exception;
- }
-
- if (ex != null)
- observer.OnError(ex);
- else
- observer.OnCompleted();
-
- return Disposable.Empty;
- }
-
- class Subscription : IDisposable
- {
- private readonly BehaviorSubject<T> _subject;
- private IObserver<T> _observer;
-
- public Subscription(BehaviorSubject<T> subject, IObserver<T> observer)
- {
- _subject = subject;
- _observer = observer;
- }
-
- public void Dispose()
- {
- if (_observer != null)
- {
- lock (_subject._gate)
- {
- if (!_subject._isDisposed && _observer != null)
- {
- _subject._observers = _subject._observers.Remove(_observer);
- _observer = null;
- }
- }
- }
- }
- }
-
- void CheckDisposed()
- {
- if (_isDisposed)
- throw new ObjectDisposedException(string.Empty);
- }
-
- /// <summary>
- /// Unsubscribe all observers and release resources.
- /// </summary>
- public void Dispose()
- {
- lock (_gate)
- {
- _isDisposed = true;
- _observers = null;
- _value = default(T);
- _exception = null;
- }
- }
- }
-}
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Subjects/ConnectableObservable.cs b/Rx.NET/System.Reactive.Linq/Reactive/Subjects/ConnectableObservable.cs
deleted file mode 100644
index 1fe318e..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Subjects/ConnectableObservable.cs
+++ /dev/null
@@ -1,90 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System.Reactive.Disposables;
-using System.Reactive.Linq;
-
-namespace System.Reactive.Subjects
-{
- /// <summary>
- /// Represents an observable wrapper that can be connected and disconnected from its underlying observable sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the resulting sequence, after transformation through the subject.</typeparam>
- internal class ConnectableObservable<TSource, TResult> : IConnectableObservable<TResult>
- {
- private readonly ISubject<TSource, TResult> _subject;
- private readonly IObservable<TSource> _source;
- private readonly object _gate;
-
- private Connection _connection;
-
- /// <summary>
- /// Creates an observable that can be connected and disconnected from its source.
- /// </summary>
- /// <param name="source">Underlying observable source sequence that can be connected and disconnected from the wrapper.</param>
- /// <param name="subject">Subject exposed by the connectable observable, receiving data from the underlying source sequence upon connection.</param>
- public ConnectableObservable(IObservable<TSource> source, ISubject<TSource, TResult> subject)
- {
- _subject = subject;
- _source = source.AsObservable(); // This gets us auto-detach behavior; otherwise, we'd have to roll our own, including trampoline installation.
- _gate = new object();
- }
-
- /// <summary>
- /// Connects the observable wrapper to its source. All subscribed observers will receive values from the underlying observable sequence as long as the connection is established.
- /// </summary>
- /// <returns>Disposable object used to disconnect the observable wrapper from its source, causing subscribed observer to stop receiving values from the underlying observable sequence.</returns>
- public IDisposable Connect()
- {
- lock (_gate)
- {
- if (_connection == null)
- {
- var subscription = _source.SubscribeSafe(_subject);
- _connection = new Connection(this, subscription);
- }
-
- return _connection;
- }
- }
-
- class Connection : IDisposable
- {
- private readonly ConnectableObservable<TSource, TResult> _parent;
- private IDisposable _subscription;
-
- public Connection(ConnectableObservable<TSource, TResult> parent, IDisposable subscription)
- {
- _parent = parent;
- _subscription = subscription;
- }
-
- public void Dispose()
- {
- lock (_parent._gate)
- {
- if (_subscription != null)
- {
- _subscription.Dispose();
- _subscription = null;
-
- _parent._connection = null;
- }
- }
- }
- }
-
- /// <summary>
- /// Subscribes an observer to the observable sequence. No values from the underlying observable source will be received unless a connection was established through the Connect method.
- /// </summary>
- /// <param name="observer">Observer that will receive values from the underlying observable source when the current ConnectableObservable instance is connected through a call to Connect.</param>
- /// <returns>Disposable used to unsubscribe from the observable sequence.</returns>
- public IDisposable Subscribe(IObserver<TResult> observer)
- {
- if (observer == null)
- throw new ArgumentNullException("observer");
-
- return _subject.SubscribeSafe(observer);
- }
- }
-}
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Subjects/ReplaySubject.cs b/Rx.NET/System.Reactive.Linq/Reactive/Subjects/ReplaySubject.cs
deleted file mode 100644
index 4c14124..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Subjects/ReplaySubject.cs
+++ /dev/null
@@ -1,341 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System.Collections.Generic;
-using System.Reactive.Concurrency;
-
-namespace System.Reactive.Subjects
-{
- /// <summary>
- /// Represents an object that is both an observable sequence as well as an observer.
- /// Each notification is broadcasted to all subscribed and future observers, subject to buffer trimming policies.
- /// </summary>
- /// <typeparam name="T">The type of the elements processed by the subject.</typeparam>
- public sealed class ReplaySubject<T> : ISubject<T>, IDisposable
- {
- private const int InfiniteBufferSize = int.MaxValue;
-
- private readonly int _bufferSize;
- private readonly TimeSpan _window;
- private readonly IScheduler _scheduler;
- private readonly IStopwatch _stopwatch;
-
- private readonly Queue<TimeInterval<T>> _queue;
- private bool _isStopped;
- private Exception _error;
-
- private ImmutableList<ScheduledObserver<T>> _observers;
- private bool _isDisposed;
-
- private readonly object _gate = new object();
-
- /// <summary>
- /// Initializes a new instance of the <see cref="System.Reactive.Subjects.ReplaySubject&lt;T&gt;" /> class with the specified buffer size, window and scheduler.
- /// </summary>
- /// <param name="bufferSize">Maximum element count of the replay buffer.</param>
- /// <param name="window">Maximum time length of the replay buffer.</param>
- /// <param name="scheduler">Scheduler the observers are invoked on.</param>
- /// <exception cref="ArgumentOutOfRangeException"><paramref name="bufferSize"/> is less than zero. -or- <paramref name="window"/> is less than TimeSpan.Zero.</exception>
- /// <exception cref="ArgumentNullException"><paramref name="scheduler"/> is null.</exception>
- public ReplaySubject(int bufferSize, TimeSpan window, IScheduler scheduler)
- {
- if (bufferSize < 0)
- throw new ArgumentOutOfRangeException("bufferSize");
- if (window < TimeSpan.Zero)
- throw new ArgumentOutOfRangeException("window");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- _bufferSize = bufferSize;
- _window = window;
- _scheduler = scheduler;
-
- _stopwatch = _scheduler.StartStopwatch();
- _queue = new Queue<TimeInterval<T>>();
- _isStopped = false;
- _error = null;
-
- _observers = new ImmutableList<ScheduledObserver<T>>();
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="System.Reactive.Subjects.ReplaySubject&lt;T&gt;" /> class with the specified buffer size and window.
- /// </summary>
- /// <param name="bufferSize">Maximum element count of the replay buffer.</param>
- /// <param name="window">Maximum time length of the replay buffer.</param>
- /// <exception cref="ArgumentOutOfRangeException"><paramref name="bufferSize"/> is less than zero. -or- <paramref name="window"/> is less than TimeSpan.Zero.</exception>
- public ReplaySubject(int bufferSize, TimeSpan window)
- : this(bufferSize, window, SchedulerDefaults.Iteration)
- {
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="System.Reactive.Subjects.ReplaySubject&lt;T&gt;" /> class.
- /// </summary>
- public ReplaySubject()
- : this(InfiniteBufferSize, TimeSpan.MaxValue, SchedulerDefaults.Iteration)
- {
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="System.Reactive.Subjects.ReplaySubject&lt;T&gt;" /> class with the specified scheduler.
- /// </summary>
- /// <param name="scheduler">Scheduler the observers are invoked on.</param>
- /// <exception cref="ArgumentNullException"><paramref name="scheduler"/> is null.</exception>
- public ReplaySubject(IScheduler scheduler)
- : this(InfiniteBufferSize, TimeSpan.MaxValue, scheduler)
- {
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="System.Reactive.Subjects.ReplaySubject&lt;T&gt;" /> class with the specified buffer size and scheduler.
- /// </summary>
- /// <param name="bufferSize">Maximum element count of the replay buffer.</param>
- /// <param name="scheduler">Scheduler the observers are invoked on.</param>
- /// <exception cref="ArgumentNullException"><paramref name="scheduler"/> is null.</exception>
- /// <exception cref="ArgumentOutOfRangeException"><paramref name="bufferSize"/> is less than zero.</exception>
- public ReplaySubject(int bufferSize, IScheduler scheduler)
- : this(bufferSize, TimeSpan.MaxValue, scheduler)
- {
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="System.Reactive.Subjects.ReplaySubject&lt;T&gt;" /> class with the specified buffer size.
- /// </summary>
- /// <param name="bufferSize">Maximum element count of the replay buffer.</param>
- /// <exception cref="ArgumentOutOfRangeException"><paramref name="bufferSize"/> is less than zero.</exception>
- public ReplaySubject(int bufferSize)
- : this(bufferSize, TimeSpan.MaxValue, SchedulerDefaults.Iteration)
- {
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="System.Reactive.Subjects.ReplaySubject&lt;T&gt;" /> class with the specified window and scheduler.
- /// </summary>
- /// <param name="window">Maximum time length of the replay buffer.</param>
- /// <param name="scheduler">Scheduler the observers are invoked on.</param>
- /// <exception cref="ArgumentNullException"><paramref name="scheduler"/> is null.</exception>
- /// <exception cref="ArgumentOutOfRangeException"><paramref name="window"/> is less than TimeSpan.Zero.</exception>
- public ReplaySubject(TimeSpan window, IScheduler scheduler)
- : this(InfiniteBufferSize, window, scheduler)
- {
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="System.Reactive.Subjects.ReplaySubject&lt;T&gt;" /> class with the specified window.
- /// </summary>
- /// <param name="window">Maximum time length of the replay buffer.</param>
- /// <exception cref="ArgumentOutOfRangeException"><paramref name="window"/> is less than TimeSpan.Zero.</exception>
- public ReplaySubject(TimeSpan window)
- : this(InfiniteBufferSize, window, SchedulerDefaults.Iteration)
- {
- }
-
- void Trim(TimeSpan now)
- {
- while (_queue.Count > _bufferSize)
- _queue.Dequeue();
- while (_queue.Count > 0 && now.Subtract(_queue.Peek().Interval).CompareTo(_window) > 0)
- _queue.Dequeue();
- }
-
- /// <summary>
- /// Notifies all subscribed and future observers about the arrival of the specified element in the sequence.
- /// </summary>
- /// <param name="value">The value to send to all observers.</param>
- public void OnNext(T value)
- {
- var o = default(ScheduledObserver<T>[]);
- lock (_gate)
- {
- CheckDisposed();
-
- if (!_isStopped)
- {
- var now = _stopwatch.Elapsed;
- _queue.Enqueue(new TimeInterval<T>(value, now));
- Trim(now);
-
- o = _observers.Data;
- foreach (var observer in o)
- observer.OnNext(value);
- }
- }
-
- if (o != null)
- foreach (var observer in o)
- observer.EnsureActive();
- }
-
- /// <summary>
- /// Notifies all subscribed and future observers about the specified exception.
- /// </summary>
- /// <param name="error">The exception to send to all observers.</param>
- /// <exception cref="ArgumentNullException"><paramref name="error"/> is null.</exception>
- public void OnError(Exception error)
- {
- if (error == null)
- throw new ArgumentNullException("error");
-
- var o = default(ScheduledObserver<T>[]);
- lock (_gate)
- {
- CheckDisposed();
-
- if (!_isStopped)
- {
- var now = _stopwatch.Elapsed;
- _isStopped = true;
- _error = error;
- Trim(now);
-
- o = _observers.Data;
- foreach (var observer in o)
- observer.OnError(error);
-
- _observers = new ImmutableList<ScheduledObserver<T>>();
- }
- }
-
- if (o != null)
- foreach (var observer in o)
- observer.EnsureActive();
- }
-
- /// <summary>
- /// Notifies all subscribed and future observers about the end of the sequence.
- /// </summary>
- public void OnCompleted()
- {
- var o = default(ScheduledObserver<T>[]);
- lock (_gate)
- {
- CheckDisposed();
-
- if (!_isStopped)
- {
- var now = _stopwatch.Elapsed;
- _isStopped = true;
- Trim(now);
-
- o = _observers.Data;
- foreach (var observer in o)
- observer.OnCompleted();
-
- _observers = new ImmutableList<ScheduledObserver<T>>();
- }
- }
-
- if (o != null)
- foreach (var observer in o)
- observer.EnsureActive();
- }
-
- /// <summary>
- /// Subscribes an observer to the subject.
- /// </summary>
- /// <param name="observer">Observer to subscribe to the subject.</param>
- /// <returns>Disposable object that can be used to unsubscribe the observer from the subject.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="observer"/> is null.</exception>
- public IDisposable Subscribe(IObserver<T> observer)
- {
- if (observer == null)
- throw new ArgumentNullException("observer");
-
- var so = new ScheduledObserver<T>(_scheduler, observer);
-
- var n = 0;
-
- var subscription = new RemovableDisposable(this, so);
- lock (_gate)
- {
- CheckDisposed();
-
- //
- // Notice the v1.x behavior of always calling Trim is preserved here.
- //
- // This may be subject (pun intended) of debate: should this policy
- // only be applied while the sequence is active? With the current
- // behavior, a sequence will "die out" after it has terminated by
- // continue to drop OnNext notifications from the queue.
- //
- // In v1.x, this behavior was due to trimming based on the clock value
- // returned by scheduler.Now, applied to all but the terminal message
- // in the queue. Using the IStopwatch has the same effect. Either way,
- // we guarantee the final notification will be observed, but there's
- // no way to retain the buffer directly. One approach is to use the
- // time-based TakeLast operator and apply an unbounded ReplaySubject
- // to it.
- //
- // To conclude, we're keeping the behavior as-is for compatibility
- // reasons with v1.x.
- //
- Trim(_stopwatch.Elapsed);
- _observers = _observers.Add(so);
-
- n = _queue.Count;
- foreach (var item in _queue)
- so.OnNext(item.Value);
-
- if (_error != null)
- {
- n++;
- so.OnError(_error);
- }
- else if (_isStopped)
- {
- n++;
- so.OnCompleted();
- }
- }
-
- so.EnsureActive(n);
-
- return subscription;
- }
-
- void Unsubscribe(ScheduledObserver<T> observer)
- {
- lock (_gate)
- {
- if (!_isDisposed)
- _observers = _observers.Remove(observer);
- }
- }
-
- sealed class RemovableDisposable : IDisposable
- {
- private readonly ReplaySubject<T> _subject;
- private readonly ScheduledObserver<T> _observer;
-
- public RemovableDisposable(ReplaySubject<T> subject, ScheduledObserver<T> observer)
- {
- _subject = subject;
- _observer = observer;
- }
-
- public void Dispose()
- {
- _observer.Dispose();
- _subject.Unsubscribe(_observer);
- }
- }
-
- void CheckDisposed()
- {
- if (_isDisposed)
- throw new ObjectDisposedException(string.Empty);
- }
-
- /// <summary>
- /// Releases all resources used by the current instance of the <see cref="System.Reactive.Subjects.ReplaySubject&lt;T&gt;"/> class and unsubscribe all observers.
- /// </summary>
- public void Dispose()
- {
- lock (_gate)
- {
- _isDisposed = true;
- _observers = null;
- }
- }
- }
-}
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Subjects/Subject.Extensions.cs b/Rx.NET/System.Reactive.Linq/Reactive/Subjects/Subject.Extensions.cs
deleted file mode 100644
index 26920d5..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Subjects/Subject.Extensions.cs
+++ /dev/null
@@ -1,108 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System.Reactive.Concurrency;
-using System.Reactive.Linq;
-
-namespace System.Reactive.Subjects
-{
- /// <summary>
- /// Provides a set of static methods for creating subjects.
- /// </summary>
- public static class Subject
- {
- /// <summary>
- /// Creates a subject from the specified observer and observable.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements received by the observer.</typeparam>
- /// <typeparam name="TResult">The type of the elements produced by the observable sequence.</typeparam>
- /// <param name="observer">The observer used to send messages to the subject.</param>
- /// <param name="observable">The observable used to subscribe to messages sent from the subject.</param>
- /// <returns>Subject implemented using the given observer and observable.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="observer"/> or <paramref name="observable"/> is null.</exception>
- public static ISubject<TSource, TResult> Create<TSource, TResult>(IObserver<TSource> observer, IObservable<TResult> observable)
- {
- if (observer == null)
- throw new ArgumentNullException("observer");
- if (observable == null)
- throw new ArgumentNullException("observable");
-
- return new AnonymousSubject<TSource, TResult>(observer, observable);
- }
-
- /// <summary>
- /// Synchronizes the messages sent to the subject.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements received by the subject.</typeparam>
- /// <typeparam name="TResult">The type of the elements produced by the subject.</typeparam>
- /// <param name="subject">The subject to synchronize.</param>
- /// <returns>Subject whose messages are synchronized.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="subject"/> is null.</exception>
- public static ISubject<TSource, TResult> Synchronize<TSource, TResult>(ISubject<TSource, TResult> subject)
- {
- if (subject == null)
- throw new ArgumentNullException("subject");
-
- return new AnonymousSubject<TSource, TResult>(Observer.Synchronize(subject), subject);
- }
-
- /// <summary>
- /// Synchronizes the messages sent to the subject and notifies observers on the specified scheduler.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements received by the subject.</typeparam>
- /// <typeparam name="TResult">The type of the elements produced by the subject.</typeparam>
- /// <param name="subject">The subject to synchronize.</param>
- /// <param name="scheduler">Scheduler to notify observers on.</param>
- /// <returns>Subject whose messages are synchronized and whose observers are notified on the given scheduler.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="subject"/> or <paramref name="scheduler"/> is null.</exception>
- public static ISubject<TSource, TResult> Synchronize<TSource, TResult>(ISubject<TSource, TResult> subject, IScheduler scheduler)
- {
- if (subject == null)
- throw new ArgumentNullException("subject");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return new AnonymousSubject<TSource, TResult>(Observer.Synchronize(subject), subject.ObserveOn(scheduler));
- }
-
- class AnonymousSubject<T, U> : ISubject<T, U>
- {
- private readonly IObserver<T> _observer;
- private readonly IObservable<U> _observable;
-
- public AnonymousSubject(IObserver<T> observer, IObservable<U> observable)
- {
- _observer = observer;
- _observable = observable;
- }
-
- public void OnCompleted()
- {
- _observer.OnCompleted();
- }
-
- public void OnError(Exception error)
- {
- if (error == null)
- throw new ArgumentNullException("error");
-
- _observer.OnError(error);
- }
-
- public void OnNext(T value)
- {
- _observer.OnNext(value);
- }
-
- public IDisposable Subscribe(IObserver<U> observer)
- {
- if (observer == null)
- throw new ArgumentNullException("observer");
-
- //
- // [OK] Use of unsafe Subscribe: non-pretentious wrapping of an observable sequence.
- //
- return _observable.Subscribe/*Unsafe*/(observer);
- }
- }
- }
-}
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Subjects/Subject.cs b/Rx.NET/System.Reactive.Linq/Reactive/Subjects/Subject.cs
deleted file mode 100644
index 1ad90b8..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Subjects/Subject.cs
+++ /dev/null
@@ -1,385 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_PERF
-using System.Reactive.Disposables;
-using System.Threading;
-
-namespace System.Reactive.Subjects
-{
- /// <summary>
- /// Represents an object that is both an observable sequence as well as an observer.
- /// Each notification is broadcasted to all subscribed observers.
- /// </summary>
- /// <typeparam name="T">The type of the elements processed by the subject.</typeparam>
- public sealed class Subject<T> : ISubject<T>, IDisposable
- {
- private volatile IObserver<T> _observer;
-
- /// <summary>
- /// Creates a subject.
- /// </summary>
- public Subject()
- {
- _observer = NopObserver<T>.Instance;
- }
-
- /// <summary>
- /// Notifies all subscribed observers about the end of the sequence.
- /// </summary>
- public void OnCompleted()
- {
- var oldObserver = default(IObserver<T>);
- var newObserver = DoneObserver<T>.Completed;
-
- do
- {
- oldObserver = _observer;
-
- if (oldObserver == DisposedObserver<T>.Instance || oldObserver is DoneObserver<T>)
- break;
-#pragma warning disable 0420
- } while (Interlocked.CompareExchange(ref _observer, newObserver, oldObserver) != oldObserver);
-#pragma warning restore 0420
-
- oldObserver.OnCompleted();
- }
-
- /// <summary>
- /// Notifies all subscribed observers about the specified exception.
- /// </summary>
- /// <param name="error">The exception to send to all currently subscribed observers.</param>
- /// <exception cref="ArgumentNullException"><paramref name="error"/> is null.</exception>
- public void OnError(Exception error)
- {
- if (error == null)
- throw new ArgumentNullException("error");
-
- var oldObserver = default(IObserver<T>);
- var newObserver = new DoneObserver<T> { Exception = error };
-
- do
- {
- oldObserver = _observer;
-
- if (oldObserver == DisposedObserver<T>.Instance || oldObserver is DoneObserver<T>)
- break;
-#pragma warning disable 0420
- } while (Interlocked.CompareExchange(ref _observer, newObserver, oldObserver) != oldObserver);
-#pragma warning restore 0420
-
- oldObserver.OnError(error);
- }
-
- /// <summary>
- /// Notifies all subscribed observers about the arrival of the specified element in the sequence.
- /// </summary>
- /// <param name="value">The value to send to all currently subscribed observers.</param>
- public void OnNext(T value)
- {
- _observer.OnNext(value);
- }
-
- /// <summary>
- /// Subscribes an observer to the subject.
- /// </summary>
- /// <param name="observer">Observer to subscribe to the subject.</param>
- /// <returns>Disposable object that can be used to unsubscribe the observer from the subject.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="observer"/> is null.</exception>
- public IDisposable Subscribe(IObserver<T> observer)
- {
- if (observer == null)
- throw new ArgumentNullException("observer");
-
- var oldObserver = default(IObserver<T>);
- var newObserver = default(IObserver<T>);
-
- do
- {
- oldObserver = _observer;
-
- if (oldObserver == DisposedObserver<T>.Instance)
- {
- throw new ObjectDisposedException("");
- }
-
- if (oldObserver == DoneObserver<T>.Completed)
- {
- observer.OnCompleted();
- return Disposable.Empty;
- }
-
- var done = oldObserver as DoneObserver<T>;
- if (done != null)
- {
- observer.OnError(done.Exception);
- return Disposable.Empty;
- }
-
- if (oldObserver == NopObserver<T>.Instance)
- {
- newObserver = observer;
- }
- else
- {
- var obs = oldObserver as Observer<T>;
- if (obs != null)
- {
- newObserver = obs.Add(observer);
- }
- else
- {
- newObserver = new Observer<T>(new ImmutableList<IObserver<T>>(new[] { oldObserver, observer }));
- }
- }
-#pragma warning disable 0420
- } while (Interlocked.CompareExchange(ref _observer, newObserver, oldObserver) != oldObserver);
-#pragma warning restore 0420
-
- return new Subscription(this, observer);
- }
-
- class Subscription : IDisposable
- {
- private Subject<T> _subject;
- private IObserver<T> _observer;
-
- public Subscription(Subject<T> subject, IObserver<T> observer)
- {
- _subject = subject;
- _observer = observer;
- }
-
- public void Dispose()
- {
- var observer = Interlocked.Exchange(ref _observer, null);
- if (observer == null)
- return;
-
- _subject.Unsubscribe(observer);
- _subject = null;
- }
- }
-
- private void Unsubscribe(IObserver<T> observer)
- {
- var oldObserver = default(IObserver<T>);
- var newObserver = default(IObserver<T>);
-
- do
- {
- oldObserver = _observer;
-
- if (oldObserver == DisposedObserver<T>.Instance || oldObserver is DoneObserver<T>)
- return;
-
- var obs = oldObserver as Observer<T>;
- if (obs != null)
- {
- newObserver = obs.Remove(observer);
- }
- else
- {
- if (oldObserver != observer)
- return;
-
- newObserver = NopObserver<T>.Instance;
- }
-#pragma warning disable 0420
- } while (Interlocked.CompareExchange(ref _observer, newObserver, oldObserver) != oldObserver);
-#pragma warning restore 0420
- }
-
- /// <summary>
- /// Releases all resources used by the current instance of the <see cref="System.Reactive.Subjects.Subject&lt;T&gt;"/> class and unsubscribes all observers.
- /// </summary>
- public void Dispose()
- {
- _observer = DisposedObserver<T>.Instance;
- }
- }
-}
-#else
-using System.Reactive.Disposables;
-using System.Threading;
-
-namespace System.Reactive.Subjects
-{
- /// <summary>
- /// Represents an object that is both an observable sequence as well as an observer.
- /// Each notification is broadcasted to all subscribed observers.
- /// </summary>
- /// <typeparam name="T">The type of the elements processed by the subject.</typeparam>
- public sealed class Subject<T> : ISubject<T>, IDisposable
- {
- bool isDisposed;
- bool isStopped;
- ImmutableList<IObserver<T>> observers;
- object gate = new object();
- Exception exception;
-
- /// <summary>
- /// Creates a subject.
- /// </summary>
- public Subject()
- {
- observers = new ImmutableList<IObserver<T>>();
- }
-
- /// <summary>
- /// Notifies all subscribed observers about the end of the sequence.
- /// </summary>
- public void OnCompleted()
- {
- var os = default(IObserver<T>[]);
- lock (gate)
- {
- CheckDisposed();
-
- if (!isStopped)
- {
- os = observers.Data;
- observers = new ImmutableList<IObserver<T>>();
- isStopped = true;
- }
- }
-
- if (os != null)
- foreach (var o in os)
- o.OnCompleted();
- }
-
- /// <summary>
- /// Notifies all subscribed observers with the exception.
- /// </summary>
- /// <param name="error">The exception to send to all subscribed observers.</param>
- /// <exception cref="ArgumentNullException"><paramref name="error"/> is null.</exception>
- public void OnError(Exception error)
- {
- if (error == null)
- throw new ArgumentNullException("error");
-
- var os = default(IObserver<T>[]);
- lock (gate)
- {
- CheckDisposed();
-
- if (!isStopped)
- {
- os = observers.Data;
- observers = new ImmutableList<IObserver<T>>();
- isStopped = true;
- exception = error;
- }
- }
-
- if (os != null)
- foreach (var o in os)
- o.OnError(error);
- }
-
- /// <summary>
- /// Notifies all subscribed observers with the value.
- /// </summary>
- /// <param name="value">The value to send to all subscribed observers.</param>
- public void OnNext(T value)
- {
- var os = default(IObserver<T>[]);
- lock (gate)
- {
- CheckDisposed();
-
- if (!isStopped)
- {
- os = observers.Data;
- }
- }
-
- if (os != null)
- foreach (var o in os)
- o.OnNext(value);
- }
-
- /// <summary>
- /// Subscribes an observer to the subject.
- /// </summary>
- /// <param name="observer">Observer to subscribe to the subject.</param>
- /// <remarks>IDisposable object that can be used to unsubscribe the observer from the subject.</remarks>
- /// <exception cref="ArgumentNullException"><paramref name="observer"/> is null.</exception>
- public IDisposable Subscribe(IObserver<T> observer)
- {
- if (observer == null)
- throw new ArgumentNullException("observer");
-
- lock (gate)
- {
- CheckDisposed();
-
- if (!isStopped)
- {
- observers = observers.Add(observer);
- return new Subscription(this, observer);
- }
- else if (exception != null)
- {
- observer.OnError(exception);
- return Disposable.Empty;
- }
- else
- {
- observer.OnCompleted();
- return Disposable.Empty;
- }
- }
- }
-
- void Unsubscribe(IObserver<T> observer)
- {
- lock (gate)
- {
- if (observers != null)
- observers = observers.Remove(observer);
- }
- }
-
- class Subscription : IDisposable
- {
- Subject<T> subject;
- IObserver<T> observer;
-
- public Subscription(Subject<T> subject, IObserver<T> observer)
- {
- this.subject = subject;
- this.observer = observer;
- }
-
- public void Dispose()
- {
- var o = Interlocked.Exchange<IObserver<T>>(ref observer, null);
- if (o != null)
- {
- subject.Unsubscribe(o);
- subject = null;
- }
- }
- }
-
- void CheckDisposed()
- {
- if (isDisposed)
- throw new ObjectDisposedException(string.Empty);
- }
-
- /// <summary>
- /// Unsubscribe all observers and release resources.
- /// </summary>
- public void Dispose()
- {
- lock (gate)
- {
- isDisposed = true;
- observers = null;
- }
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Threading/Tasks/NamespaceDoc.cs b/Rx.NET/System.Reactive.Linq/Reactive/Threading/Tasks/NamespaceDoc.cs
deleted file mode 100644
index 71da9b5..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Threading/Tasks/NamespaceDoc.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-namespace System.Reactive.Threading.Tasks
-{
- /// <summary>
- /// The <b>System.Reactive.Threading.Tasks</b> namespace contains helpers for the conversion between tasks and observable sequences.
- /// </summary>
- [System.Runtime.CompilerServices.CompilerGeneratedAttribute]
- class NamespaceDoc
- {
- }
-}
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Threading/Tasks/TaskObservableExtensions.cs b/Rx.NET/System.Reactive.Linq/Reactive/Threading/Tasks/TaskObservableExtensions.cs
deleted file mode 100644
index c41c0d8..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Threading/Tasks/TaskObservableExtensions.cs
+++ /dev/null
@@ -1,236 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_TPL
-using System.Reactive.Disposables;
-using System.Threading.Tasks;
-using System.Threading;
-using System.Reactive.Linq;
-using System.Reactive.Subjects;
-
-namespace System.Reactive.Threading.Tasks
-{
- /// <summary>
- /// Provides a set of static methods for converting tasks to observable sequences.
- /// </summary>
- public static class TaskObservableExtensions
- {
- /// <summary>
- /// Returns an observable sequence that signals when the task completes.
- /// </summary>
- /// <param name="task">Task to convert to an observable sequence.</param>
- /// <returns>An observable sequence that produces a unit value when the task completes, or propagates the exception produced by the task.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="task"/> is null.</exception>
- /// <remarks>If the specified task object supports cancellation, consider using <see cref="Observable.FromAsync(Func{CancellationToken, Task})"/> instead.</remarks>
- public static IObservable<Unit> ToObservable(this Task task)
- {
- if (task == null)
- throw new ArgumentNullException("task");
-
- var subject = new AsyncSubject<Unit>();
-
- switch (task.Status)
- {
- case TaskStatus.RanToCompletion:
- subject.OnNext(Unit.Default);
- subject.OnCompleted();
- break;
- case TaskStatus.Faulted:
- subject.OnError(task.Exception.InnerException);
- break;
- case TaskStatus.Canceled:
- subject.OnError(new TaskCanceledException(task));
- break;
- default:
- task.ContinueWith(t =>
- {
- switch (t.Status)
- {
- case TaskStatus.RanToCompletion:
- subject.OnNext(Unit.Default);
- subject.OnCompleted();
- break;
- case TaskStatus.Faulted:
- subject.OnError(t.Exception.InnerException);
- break;
- case TaskStatus.Canceled:
- subject.OnError(new TaskCanceledException(t));
- break;
- }
- });
- break;
- }
-
- return subject.AsObservable();
- }
-
- /// <summary>
- /// Returns an observable sequence that propagates the result of the task.
- /// </summary>
- /// <typeparam name="TResult">The type of the result produced by the task.</typeparam>
- /// <param name="task">Task to convert to an observable sequence.</param>
- /// <returns>An observable sequence that produces the task's result, or propagates the exception produced by the task.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="task"/> is null.</exception>
- /// <remarks>If the specified task object supports cancellation, consider using <see cref="Observable.FromAsync{TResult}(Func{CancellationToken, Task{TResult}})"/> instead.</remarks>
- public static IObservable<TResult> ToObservable<TResult>(this Task<TResult> task)
- {
- if (task == null)
- throw new ArgumentNullException("task");
-
- var subject = new AsyncSubject<TResult>();
-
- switch (task.Status)
- {
- case TaskStatus.RanToCompletion:
- subject.OnNext(task.Result);
- subject.OnCompleted();
- break;
- case TaskStatus.Faulted:
- subject.OnError(task.Exception.InnerException);
- break;
- case TaskStatus.Canceled:
- subject.OnError(new TaskCanceledException(task));
- break;
- default:
- task.ContinueWith(t =>
- {
- switch (t.Status)
- {
- case TaskStatus.RanToCompletion:
- subject.OnNext(t.Result);
- subject.OnCompleted();
- break;
- case TaskStatus.Faulted:
- subject.OnError(t.Exception.InnerException);
- break;
- case TaskStatus.Canceled:
- subject.OnError(new TaskCanceledException(t));
- break;
- }
- });
- break;
- }
-
- return subject.AsObservable();
- }
-
- /// <summary>
- /// Returns a task that will receive the last value or the exception produced by the observable sequence.
- /// </summary>
- /// <typeparam name="TResult">The type of the elements in the source sequence.</typeparam>
- /// <param name="observable">Observable sequence to convert to a task.</param>
- /// <returns>A task that will receive the last element or the exception produced by the observable sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="observable"/> is null.</exception>
- public static Task<TResult> ToTask<TResult>(this IObservable<TResult> observable)
- {
- if (observable == null)
- throw new ArgumentNullException("observable");
-
- return observable.ToTask(new CancellationToken(), null);
- }
-
- /// <summary>
- /// Returns a task that will receive the last value or the exception produced by the observable sequence.
- /// </summary>
- /// <typeparam name="TResult">The type of the elements in the source sequence.</typeparam>
- /// <param name="observable">Observable sequence to convert to a task.</param>
- /// <param name="state">The state to use as the underlying task's AsyncState.</param>
- /// <returns>A task that will receive the last element or the exception produced by the observable sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="observable"/> is null.</exception>
- public static Task<TResult> ToTask<TResult>(this IObservable<TResult> observable, object state)
- {
- if (observable == null)
- throw new ArgumentNullException("observable");
-
- return observable.ToTask(new CancellationToken(), state);
- }
-
- /// <summary>
- /// Returns a task that will receive the last value or the exception produced by the observable sequence.
- /// </summary>
- /// <typeparam name="TResult">The type of the elements in the source sequence.</typeparam>
- /// <param name="observable">Observable sequence to convert to a task.</param>
- /// <param name="cancellationToken">Cancellation token that can be used to cancel the task, causing unsubscription from the observable sequence.</param>
- /// <returns>A task that will receive the last element or the exception produced by the observable sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="observable"/> is null.</exception>
- public static Task<TResult> ToTask<TResult>(this IObservable<TResult> observable, CancellationToken cancellationToken)
- {
- if (observable == null)
- throw new ArgumentNullException("observable");
-
- return observable.ToTask(cancellationToken, null);
- }
-
- /// <summary>
- /// Returns a task that will receive the last value or the exception produced by the observable sequence.
- /// </summary>
- /// <typeparam name="TResult">The type of the elements in the source sequence.</typeparam>
- /// <param name="observable">Observable sequence to convert to a task.</param>
- /// <param name="cancellationToken">Cancellation token that can be used to cancel the task, causing unsubscription from the observable sequence.</param>
- /// <param name="state">The state to use as the underlying task's AsyncState.</param>
- /// <returns>A task that will receive the last element or the exception produced by the observable sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="observable"/> is null.</exception>
- public static Task<TResult> ToTask<TResult>(this IObservable<TResult> observable, CancellationToken cancellationToken, object state)
- {
- if (observable == null)
- throw new ArgumentNullException("observable");
-
- var hasValue = false;
- var lastValue = default(TResult);
-
- var tcs = new TaskCompletionSource<TResult>(state);
-
- var disposable = new SingleAssignmentDisposable();
-
- cancellationToken.Register(() =>
- {
- disposable.Dispose();
- tcs.TrySetCanceled();
- });
-
- var taskCompletionObserver = new AnonymousObserver<TResult>(
- value =>
- {
- hasValue = true;
- lastValue = value;
- },
- ex =>
- {
- tcs.TrySetException(ex);
- disposable.Dispose();
- },
- () =>
- {
- if (hasValue)
- tcs.TrySetResult(lastValue);
- else
- tcs.TrySetException(new InvalidOperationException(Strings_Linq.NO_ELEMENTS));
- disposable.Dispose();
- }
- );
-
- //
- // Subtle race condition: if the source completes before we reach the line below, the SingleAssigmentDisposable
- // will already have been disposed. Upon assignment, the disposable resource being set will be disposed on the
- // spot, which may throw an exception. (Similar to TFS 487142)
- //
- try
- {
- //
- // [OK] Use of unsafe Subscribe: we're catching the exception here to set the TaskCompletionSource.
- //
- // Notice we could use a safe subscription to route errors through OnError, but we still need the
- // exception handling logic here for the reason explained above. We cannot afford to throw here
- // and as a result never set the TaskCompletionSource, so we tunnel everything through here.
- //
- disposable.Disposable = observable.Subscribe/*Unsafe*/(taskCompletionObserver);
- }
- catch (Exception ex)
- {
- tcs.TrySetException(ex);
- }
-
- return tcs.Task;
- }
- }
-}
-#endif
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/TimeInterval.cs b/Rx.NET/System.Reactive.Linq/Reactive/TimeInterval.cs
deleted file mode 100644
index 5dff853..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/TimeInterval.cs
+++ /dev/null
@@ -1,114 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System.Collections.Generic;
-using System.Globalization;
-
-namespace System.Reactive
-{
- /// <summary>
- /// Represents a value associated with time interval information.
- /// The time interval can represent the time it took to produce the value, the interval relative to a previous value, the value's delivery time relative to a base, etc.
- /// </summary>
- /// <typeparam name="T">The type of the value being annotated with time interval information.</typeparam>
-#if !NO_SERIALIZABLE
- [Serializable]
-#endif
- public struct TimeInterval<T> : IEquatable<TimeInterval<T>>
- {
- private readonly TimeSpan _interval;
- private readonly T _value;
-
- /// <summary>
- /// Constructs a time interval value.
- /// </summary>
- /// <param name="value">The value to be annotated with a time interval.</param>
- /// <param name="interval">Time interval associated with the value.</param>
- public TimeInterval(T value, TimeSpan interval)
- {
- _interval = interval;
- _value = value;
- }
-
- /// <summary>
- /// Gets the value.
- /// </summary>
- public T Value
- {
- get { return _value; }
- }
-
- /// <summary>
- /// Gets the interval.
- /// </summary>
- public TimeSpan Interval
- {
- get { return _interval; }
- }
-
- /// <summary>
- /// Determines whether the current TimeInterval&lt;T&gt; value has the same Value and Interval as a specified TimeInterval&lt;T&gt; value.
- /// </summary>
- /// <param name="other">An object to compare to the current TimeInterval&lt;T&gt; value.</param>
- /// <returns>true if both TimeInterval&lt;T&gt; values have the same Value and Interval; otherwise, false.</returns>
- public bool Equals(TimeInterval<T> other)
- {
- return other.Interval.Equals(Interval) && EqualityComparer<T>.Default.Equals(Value, other.Value);
- }
-
- /// <summary>
- /// Determines whether the two specified TimeInterval&lt;T&gt; values have the same Value and Interval.
- /// </summary>
- /// <param name="first">The first TimeInterval&lt;T&gt; value to compare.</param>
- /// <param name="second">The second TimeInterval&lt;T&gt; value to compare.</param>
- /// <returns>true if the first TimeInterval&lt;T&gt; value has the same Value and Interval as the second TimeInterval&lt;T&gt; value; otherwise, false.</returns>
- public static bool operator ==(TimeInterval<T> first, TimeInterval<T> second)
- {
- return first.Equals(second);
- }
-
- /// <summary>
- /// Determines whether the two specified TimeInterval&lt;T&gt; values don't have the same Value and Interval.
- /// </summary>
- /// <param name="first">The first TimeInterval&lt;T&gt; value to compare.</param>
- /// <param name="second">The second TimeInterval&lt;T&gt; value to compare.</param>
- /// <returns>true if the first TimeInterval&lt;T&gt; value has a different Value or Interval as the second TimeInterval&lt;T&gt; value; otherwise, false.</returns>
- public static bool operator !=(TimeInterval<T> first, TimeInterval<T> second)
- {
- return !first.Equals(second);
- }
-
- /// <summary>
- /// Determines whether the specified System.Object is equal to the current TimeInterval&lt;T&gt;.
- /// </summary>
- /// <param name="obj">The System.Object to compare with the current TimeInterval&lt;T&gt;.</param>
- /// <returns>true if the specified System.Object is equal to the current TimeInterval&lt;T&gt;; otherwise, false.</returns>
- public override bool Equals(object obj)
- {
- if (!(obj is TimeInterval<T>))
- return false;
-
- var other = (TimeInterval<T>)obj;
- return this.Equals(other);
- }
-
- /// <summary>
- /// Returns the hash code for the current TimeInterval&lt;T&gt; value.
- /// </summary>
- /// <returns>A hash code for the current TimeInterval&lt;T&gt; value.</returns>
- public override int GetHashCode()
- {
- var valueHashCode = Value == null ? 1963 : Value.GetHashCode();
-
- return Interval.GetHashCode() ^ valueHashCode;
- }
-
- /// <summary>
- /// Returns a string representation of the current TimeInterval&lt;T&gt; value.
- /// </summary>
- /// <returns>String representation of the current TimeInterval&lt;T&gt; value.</returns>
- public override string ToString()
- {
- return String.Format(CultureInfo.CurrentCulture, "{0}@{1}", Value, Interval);
- }
- }
-}
diff --git a/Rx.NET/System.Reactive.Linq/Reactive/Timestamped.cs b/Rx.NET/System.Reactive.Linq/Reactive/Timestamped.cs
deleted file mode 100644
index 896c451..0000000
--- a/Rx.NET/System.Reactive.Linq/Reactive/Timestamped.cs
+++ /dev/null
@@ -1,115 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System.Collections.Generic;
-using System.Globalization;
-
-namespace System.Reactive
-{
- /// <summary>
- /// Represents value with a timestamp on it.
- /// The timestamp typically represents the time the value was received, using an IScheduler's clock to obtain the current time.
- /// </summary>
- /// <typeparam name="T">The type of the value being timestamped.</typeparam>
-#if !NO_SERIALIZABLE
- [Serializable]
-#endif
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Timestamped", Justification = "Reviewed and agreed upon.")]
- public struct Timestamped<T> : IEquatable<Timestamped<T>>
- {
- private readonly DateTimeOffset _timestamp;
- private readonly T _value;
-
- /// <summary>
- /// Constructs a timestamped value.
- /// </summary>
- /// <param name="value">The value to be annotated with a timestamp.</param>
- /// <param name="timestamp">Timestamp associated with the value.</param>
- public Timestamped(T value, DateTimeOffset timestamp)
- {
- _timestamp = timestamp;
- _value = value;
- }
-
- /// <summary>
- /// Gets the value.
- /// </summary>
- public T Value
- {
- get { return _value; }
- }
-
- /// <summary>
- /// Gets the timestamp.
- /// </summary>
- public DateTimeOffset Timestamp
- {
- get { return _timestamp; }
- }
-
- /// <summary>
- /// Determines whether the current Timestamped&lt;T&gt; value has the same Value and Timestamp as a specified Timestamped&lt;T&gt; value.
- /// </summary>
- /// <param name="other">An object to compare to the current Timestamped&lt;T&gt; value.</param>
- /// <returns>true if both Timestamped&lt;T&gt; values have the same Value and Timestamp; otherwise, false.</returns>
- public bool Equals(Timestamped<T> other)
- {
- return other.Timestamp.Equals(Timestamp) && EqualityComparer<T>.Default.Equals(Value, other.Value);
- }
-
- /// <summary>
- /// Determines whether the two specified Timestamped&lt;T&gt; values have the same Value and Timestamp.
- /// </summary>
- /// <param name="first">The first Timestamped&lt;T&gt; value to compare.</param>
- /// <param name="second">The second Timestamped&lt;T&gt; value to compare.</param>
- /// <returns>true if the first Timestamped&lt;T&gt; value has the same Value and Timestamp as the second Timestamped&lt;T&gt; value; otherwise, false.</returns>
- public static bool operator ==(Timestamped<T> first, Timestamped<T> second)
- {
- return first.Equals(second);
- }
-
- /// <summary>
- /// Determines whether the two specified Timestamped&lt;T&gt; values don't have the same Value and Timestamp.
- /// </summary>
- /// <param name="first">The first Timestamped&lt;T&gt; value to compare.</param>
- /// <param name="second">The second Timestamped&lt;T&gt; value to compare.</param>
- /// <returns>true if the first Timestamped&lt;T&gt; value has a different Value or Timestamp as the second Timestamped&lt;T&gt; value; otherwise, false.</returns>
- public static bool operator !=(Timestamped<T> first, Timestamped<T> second)
- {
- return !first.Equals(second);
- }
-
- /// <summary>
- /// Determines whether the specified System.Object is equal to the current Timestamped&lt;T&gt;.
- /// </summary>
- /// <param name="obj">The System.Object to compare with the current Timestamped&lt;T&gt;.</param>
- /// <returns>true if the specified System.Object is equal to the current Timestamped&lt;T&gt;; otherwise, false.</returns>
- public override bool Equals(object obj)
- {
- if (!(obj is Timestamped<T>))
- return false;
-
- var other = (Timestamped<T>)obj;
- return this.Equals(other);
- }
-
- /// <summary>
- /// Returns the hash code for the current Timestamped&lt;T&gt; value.
- /// </summary>
- /// <returns>A hash code for the current Timestamped&lt;T&gt; value.</returns>
- public override int GetHashCode()
- {
- var valueHashCode = Value == null ? 1979 : Value.GetHashCode();
-
- return _timestamp.GetHashCode() ^ valueHashCode;
- }
-
- /// <summary>
- /// Returns a string representation of the current Timestamped&lt;T&gt; value.
- /// </summary>
- /// <returns>String representation of the current Timestamped&lt;T&gt; value.</returns>
- public override string ToString()
- {
- return String.Format(CultureInfo.CurrentCulture, "{0}@{1}", Value, Timestamp);
- }
- }
-}
diff --git a/Rx.NET/System.Reactive.Linq/Strings_Linq.Generated.cs b/Rx.NET/System.Reactive.Linq/Strings_Linq.Generated.cs
deleted file mode 100644
index 79f2dfb..0000000
--- a/Rx.NET/System.Reactive.Linq/Strings_Linq.Generated.cs
+++ /dev/null
@@ -1,260 +0,0 @@
-/*
- * This file is manually generated upon every change to the corresponding .resx file, using the built-in code generator.
- * However, we can't use auto-generated code because the output is different for .NET 4.5 for Metro and PLIB, due to
- * changes in the reflection APIs (search for CRIPPLED_REFLECTION in this file), and because regeneration doesn't happen
- * as part of build, but rather at design time in Visual Studio. While we likely could tweak MSBuild to force regeneration
- * using the right version of ResGen.exe, this approach turned out to be the easiest for the time being.
- *
- * Upon adding entries to the ResX file, regenerate this file, put this comment back, and make sure to add the #if checks
- * for conditional use of the right flavor of reflection (using the CRIPPLED_REFLECTION defined symbol).
- */
-
-// Required for the use of the GetTypeInfo extension method.
-#if CRIPPLED_REFLECTION
-using System.Reflection;
-#endif
-
-// GENERATED CODE starts here
-
-namespace System.Reactive
-{
- using System;
-
-
- /// <summary>
- /// A strongly-typed resource class, for looking up localized strings, etc.
- /// </summary>
- // This class was auto-generated by the StronglyTypedResourceBuilder
- // class via a tool like ResGen or Visual Studio.
- // To add or remove a member, edit your .ResX file then rerun ResGen
- // with the /str option, or rebuild your VS project.
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- internal class Strings_Linq
- {
-
- private static global::System.Resources.ResourceManager resourceMan;
-
- private static global::System.Globalization.CultureInfo resourceCulture;
-
- [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
- internal Strings_Linq()
- {
- }
-
- /// <summary>
- /// Returns the cached ResourceManager instance used by this class.
- /// </summary>
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Resources.ResourceManager ResourceManager
- {
- get
- {
- if (object.ReferenceEquals(resourceMan, null))
- {
-#if CRIPPLED_REFLECTION
- global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("System.Reactive.Strings_Linq", typeof(Strings_Linq).GetTypeInfo().Assembly);
-#else
- global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("System.Reactive.Strings_Linq", typeof(Strings_Linq).Assembly);
-#endif
- resourceMan = temp;
- }
- return resourceMan;
- }
- }
-
- /// <summary>
- /// Overrides the current thread's CurrentUICulture property for all
- /// resource lookups using this strongly typed resource class.
- /// </summary>
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Globalization.CultureInfo Culture
- {
- get
- {
- return resourceCulture;
- }
- set
- {
- resourceCulture = value;
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Could not find event &apos;{0}&apos; on object of type &apos;{1}&apos;..
- /// </summary>
- internal static string COULD_NOT_FIND_INSTANCE_EVENT
- {
- get
- {
- return ResourceManager.GetString("COULD_NOT_FIND_INSTANCE_EVENT", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Could not find event &apos;{0}&apos; on type &apos;{1}&apos;..
- /// </summary>
- internal static string COULD_NOT_FIND_STATIC_EVENT
- {
- get
- {
- return ResourceManager.GetString("COULD_NOT_FIND_STATIC_EVENT", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Add method should take 1 parameter..
- /// </summary>
- internal static string EVENT_ADD_METHOD_SHOULD_TAKE_ONE_PARAMETER
- {
- get
- {
- return ResourceManager.GetString("EVENT_ADD_METHOD_SHOULD_TAKE_ONE_PARAMETER", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to The second parameter of the event delegate must be assignable to &apos;{0}&apos;..
- /// </summary>
- internal static string EVENT_ARGS_NOT_ASSIGNABLE
- {
- get
- {
- return ResourceManager.GetString("EVENT_ARGS_NOT_ASSIGNABLE", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Event is missing the add method..
- /// </summary>
- internal static string EVENT_MISSING_ADD_METHOD
- {
- get
- {
- return ResourceManager.GetString("EVENT_MISSING_ADD_METHOD", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Event is missing the remove method..
- /// </summary>
- internal static string EVENT_MISSING_REMOVE_METHOD
- {
- get
- {
- return ResourceManager.GetString("EVENT_MISSING_REMOVE_METHOD", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to The event delegate must have a void return type..
- /// </summary>
- internal static string EVENT_MUST_RETURN_VOID
- {
- get
- {
- return ResourceManager.GetString("EVENT_MUST_RETURN_VOID", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to The event delegate must have exactly two parameters..
- /// </summary>
- internal static string EVENT_PATTERN_REQUIRES_TWO_PARAMETERS
- {
- get
- {
- return ResourceManager.GetString("EVENT_PATTERN_REQUIRES_TWO_PARAMETERS", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Remove method should take 1 parameter..
- /// </summary>
- internal static string EVENT_REMOVE_METHOD_SHOULD_TAKE_ONE_PARAMETER
- {
- get
- {
- return ResourceManager.GetString("EVENT_REMOVE_METHOD_SHOULD_TAKE_ONE_PARAMETER", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to The first parameter of the event delegate must be assignable to &apos;{0}&apos;..
- /// </summary>
- internal static string EVENT_SENDER_NOT_ASSIGNABLE
- {
- get
- {
- return ResourceManager.GetString("EVENT_SENDER_NOT_ASSIGNABLE", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Remove method of a WinRT event should take an EventRegistrationToken..
- /// </summary>
- internal static string EVENT_WINRT_REMOVE_METHOD_SHOULD_TAKE_ERT
- {
- get
- {
- return ResourceManager.GetString("EVENT_WINRT_REMOVE_METHOD_SHOULD_TAKE_ERT", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Sequence contains more than one element..
- /// </summary>
- internal static string MORE_THAN_ONE_ELEMENT
- {
- get
- {
- return ResourceManager.GetString("MORE_THAN_ONE_ELEMENT", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Sequence contains more than one matching element..
- /// </summary>
- internal static string MORE_THAN_ONE_MATCHING_ELEMENT
- {
- get
- {
- return ResourceManager.GetString("MORE_THAN_ONE_MATCHING_ELEMENT", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Sequence contains no elements..
- /// </summary>
- internal static string NO_ELEMENTS
- {
- get
- {
- return ResourceManager.GetString("NO_ELEMENTS", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Sequence contains no matching element..
- /// </summary>
- internal static string NO_MATCHING_ELEMENTS
- {
- get
- {
- return ResourceManager.GetString("NO_MATCHING_ELEMENTS", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to {0} cannot be called when the scheduler is already running. Try using Sleep instead..
- /// </summary>
- internal static string CANT_ADVANCE_WHILE_RUNNING
- {
- get
- {
- return ResourceManager.GetString("CANT_ADVANCE_WHILE_RUNNING", resourceCulture);
- }
- }
- }
-}
diff --git a/Rx.NET/System.Reactive.Linq/Strings_Linq.resx b/Rx.NET/System.Reactive.Linq/Strings_Linq.resx
deleted file mode 100644
index 8965ebb..0000000
--- a/Rx.NET/System.Reactive.Linq/Strings_Linq.resx
+++ /dev/null
@@ -1,169 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<root>
- <!--
- Microsoft ResX Schema
-
- Version 2.0
-
- The primary goals of this format is to allow a simple XML format
- that is mostly human readable. The generation and parsing of the
- various data types are done through the TypeConverter classes
- associated with the data types.
-
- Example:
-
- ... ado.net/XML headers & schema ...
- <resheader name="resmimetype">text/microsoft-resx</resheader>
- <resheader name="version">2.0</resheader>
- <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
- <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
- <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
- <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
- <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
- <value>[base64 mime encoded serialized .NET Framework object]</value>
- </data>
- <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
- <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
- <comment>This is a comment</comment>
- </data>
-
- There are any number of "resheader" rows that contain simple
- name/value pairs.
-
- Each data row contains a name, and value. The row also contains a
- type or mimetype. Type corresponds to a .NET class that support
- text/value conversion through the TypeConverter architecture.
- Classes that don't support this are serialized and stored with the
- mimetype set.
-
- The mimetype is used for serialized objects, and tells the
- ResXResourceReader how to depersist the object. This is currently not
- extensible. For a given mimetype the value must be set accordingly:
-
- Note - application/x-microsoft.net.object.binary.base64 is the format
- that the ResXResourceWriter will generate, however the reader can
- read any of the formats listed below.
-
- mimetype: application/x-microsoft.net.object.binary.base64
- value : The object must be serialized with
- : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
- : and then encoded with base64 encoding.
-
- mimetype: application/x-microsoft.net.object.soap.base64
- value : The object must be serialized with
- : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
- : and then encoded with base64 encoding.
-
- mimetype: application/x-microsoft.net.object.bytearray.base64
- value : The object must be serialized into a byte array
- : using a System.ComponentModel.TypeConverter
- : and then encoded with base64 encoding.
- -->
- <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
- <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
- <xsd:element name="root" msdata:IsDataSet="true">
- <xsd:complexType>
- <xsd:choice maxOccurs="unbounded">
- <xsd:element name="metadata">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="value" type="xsd:string" minOccurs="0" />
- </xsd:sequence>
- <xsd:attribute name="name" use="required" type="xsd:string" />
- <xsd:attribute name="type" type="xsd:string" />
- <xsd:attribute name="mimetype" type="xsd:string" />
- <xsd:attribute ref="xml:space" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="assembly">
- <xsd:complexType>
- <xsd:attribute name="alias" type="xsd:string" />
- <xsd:attribute name="name" type="xsd:string" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="data">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
- <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
- </xsd:sequence>
- <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
- <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
- <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
- <xsd:attribute ref="xml:space" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="resheader">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
- </xsd:sequence>
- <xsd:attribute name="name" type="xsd:string" use="required" />
- </xsd:complexType>
- </xsd:element>
- </xsd:choice>
- </xsd:complexType>
- </xsd:element>
- </xsd:schema>
- <resheader name="resmimetype">
- <value>text/microsoft-resx</value>
- </resheader>
- <resheader name="version">
- <value>2.0</value>
- </resheader>
- <resheader name="reader">
- <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
- </resheader>
- <resheader name="writer">
- <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
- </resheader>
- <data name="CANT_ADVANCE_WHILE_RUNNING" xml:space="preserve">
- <value>{0} cannot be called when the scheduler is already running. Try using Sleep instead.</value>
- </data>
- <data name="COULD_NOT_FIND_INSTANCE_EVENT" xml:space="preserve">
- <value>Could not find event '{0}' on object of type '{1}'.</value>
- </data>
- <data name="COULD_NOT_FIND_STATIC_EVENT" xml:space="preserve">
- <value>Could not find event '{0}' on type '{1}'.</value>
- </data>
- <data name="EVENT_ADD_METHOD_SHOULD_TAKE_ONE_PARAMETER" xml:space="preserve">
- <value>Add method should take 1 parameter.</value>
- </data>
- <data name="EVENT_ARGS_NOT_ASSIGNABLE" xml:space="preserve">
- <value>The second parameter of the event delegate must be assignable to '{0}'.</value>
- </data>
- <data name="EVENT_MISSING_ADD_METHOD" xml:space="preserve">
- <value>Event is missing the add method.</value>
- </data>
- <data name="EVENT_MISSING_REMOVE_METHOD" xml:space="preserve">
- <value>Event is missing the remove method.</value>
- </data>
- <data name="EVENT_MUST_RETURN_VOID" xml:space="preserve">
- <value>The event delegate must have a void return type.</value>
- </data>
- <data name="EVENT_PATTERN_REQUIRES_TWO_PARAMETERS" xml:space="preserve">
- <value>The event delegate must have exactly two parameters.</value>
- </data>
- <data name="EVENT_REMOVE_METHOD_SHOULD_TAKE_ONE_PARAMETER" xml:space="preserve">
- <value>Remove method should take 1 parameter.</value>
- </data>
- <data name="EVENT_SENDER_NOT_ASSIGNABLE" xml:space="preserve">
- <value>The first parameter of the event delegate must be assignable to '{0}'.</value>
- </data>
- <data name="EVENT_WINRT_REMOVE_METHOD_SHOULD_TAKE_ERT" xml:space="preserve">
- <value>Remove method of a WinRT event should take an EventRegistrationToken.</value>
- <comment>Only onn platforms supporting WinRT.</comment>
- </data>
- <data name="MORE_THAN_ONE_ELEMENT" xml:space="preserve">
- <value>Sequence contains more than one element.</value>
- </data>
- <data name="MORE_THAN_ONE_MATCHING_ELEMENT" xml:space="preserve">
- <value>Sequence contains more than one matching element.</value>
- </data>
- <data name="NO_ELEMENTS" xml:space="preserve">
- <value>Sequence contains no elements.</value>
- </data>
- <data name="NO_MATCHING_ELEMENTS" xml:space="preserve">
- <value>Sequence contains no matching element.</value>
- </data>
-</root> \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Linq/System.Reactive.Linq.csproj b/Rx.NET/System.Reactive.Linq/System.Reactive.Linq.csproj
deleted file mode 100644
index 71c75f6..0000000
--- a/Rx.NET/System.Reactive.Linq/System.Reactive.Linq.csproj
+++ /dev/null
@@ -1,223 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <ProductVersion>8.0.30703</ProductVersion>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{63252AE9-5186-45CA-BFCD-FA51C6B66A43}</ProjectGuid>
- <OutputType>Library</OutputType>
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <RootNamespace>System.Reactive</RootNamespace>
- <AssemblyName>System.Reactive.Linq</AssemblyName>
- <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
- <FileAlignment>512</FileAlignment>
- <ProductSignAssembly>true</ProductSignAssembly>
- <CodeAnalysisRuleSet>..\Rx.ruleset</CodeAnalysisRuleSet>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'ReleaseXBLV|AnyCPU'">
- <OutputPath>bin\ReleaseXBLV\</OutputPath>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'DebugXBLV|AnyCPU'">
- <OutputPath>bin\DebugXBLV\</OutputPath>
- </PropertyGroup>
- <Import Project="..\Common.targets" />
- <PropertyGroup>
- <DocumentationFile>$(OutputPath)\$(AssemblyName).XML</DocumentationFile>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)' == 'DebugPL' Or '$(Configuration)' == 'ReleasePL' ">
- <TargetFrameworkProfile>Profile7</TargetFrameworkProfile>
- </PropertyGroup>
- <ItemGroup>
- <Reference Include="mscorlib" Condition=" '$(BuildPlatform)' == 'SILVERLIGHT' Or '$(BuildPlatform)' == 'XNA' " />
- <Reference Include="System" />
- <Reference Include="System.Core" />
- <Reference Include="System.Observable" Condition=" '$(BuildFlavor)' == 'SILVERLIGHTM7' " />
- <Reference Include="Microsoft.Phone" Condition=" '$(BuildFlavor)' == 'SILVERLIGHTM7' " />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="GlobalSuppressions.cs" />
- <Compile Include="NamespaceDocs.cs" />
- <Compile Include="Reactive\Concurrency\VirtualTimeScheduler.Extensions.cs" />
- <Compile Include="Reactive\Internal\ConcatSink.cs" />
- <Compile Include="Reactive\Internal\Constants.cs" />
- <Compile Include="Reactive\Internal\Helpers.cs" />
- <Compile Include="Reactive\Internal\IConcatenatable.cs" />
- <Compile Include="Reactive\Internal\IEvaluatableObservable.cs" />
- <Compile Include="Reactive\Internal\QueryServices.cs" />
- <Compile Include="Reactive\Internal\ReflectionUtils.cs" />
- <Compile Include="Reactive\Internal\HashSet.cs" />
- <Compile Include="Reactive\Internal\Lookup.cs" />
- <Compile Include="Reactive\Linq\LocalQueryMethodImplementationTypeAttribute.cs" />
- <Compile Include="Reactive\Linq\Observαble\Case.cs" />
- <Compile Include="Reactive\Linq\Observαble\Collect.cs" />
- <Compile Include="Reactive\Linq\Observαble\If.cs" />
- <Compile Include="Reactive\Linq\Observαble\For.cs" />
- <Compile Include="Reactive\Linq\Observαble\DoWhile.cs" />
- <Compile Include="Reactive\Linq\Observαble\While.cs" />
- <Compile Include="Reactive\Linq\Observαble\TakeLastBuffer.cs" />
- <Compile Include="Reactive\Linq\Observαble\Next.cs" />
- <Compile Include="Reactive\Linq\Observαble\MostRecent.cs" />
- <Compile Include="Reactive\Linq\Observαble\Latest.cs" />
- <Compile Include="Reactive\Linq\Observαble\PushToPullAdapter.cs" />
- <Compile Include="Reactive\Linq\Observαble\RefCount.cs" />
- <Compile Include="Reactive\Linq\Observαble\Multicast.cs" />
- <Compile Include="Reactive\Linq\Observαble\GroupBy.cs" />
- <Compile Include="Reactive\Linq\Observable_.cs" />
- <Compile Include="Reactive\Linq\QueryLanguage_.cs" />
- <Compile Include="Reactive\Linq\QueryLanguage.Joins.cs" />
- <Compile Include="Reactive\Linq\QueryLanguage.Multiple.cs" />
- <Compile Include="Reactive\Linq\QueryLanguage.Single.cs" />
- <Compile Include="Reactive\Linq\QueryLanguage.StandardSequenceOperators.cs" />
- <Compile Include="Reactive\Linq\QueryLanguage.Time.cs" />
- <Compile Include="Reactive\Linq\QueryLanguage.Async.cs" />
- <Compile Include="Reactive\Linq\QueryLanguage.Awaiter.cs" />
- <Compile Include="Reactive\Linq\QueryLanguage.Binding.cs" />
- <Compile Include="Reactive\Linq\QueryLanguage.Blocking.cs" />
- <Compile Include="Reactive\Linq\QueryLanguage.Concurrency.cs" />
- <Compile Include="Reactive\Linq\QueryLanguage.Conversions.cs" />
- <Compile Include="Reactive\Linq\QueryLanguage.Creation.cs" />
- <Compile Include="Reactive\Linq\QueryLanguage.Events.cs" />
- <Compile Include="Reactive\Linq\QueryLanguage.Aggregates.cs" />
- <Compile Include="Reactive\Linq\QueryLanguage.Imperative.cs" />
- <Compile Include="Reactive\Linq\IQueryLanguage.cs" />
- <Compile Include="Reactive\Linq\Observable.Imperative.cs" />
- <Compile Include="Reactive\EventPatternSourceBase.cs" />
- <Compile Include="Reactive\EventPattern.cs" />
- <Compile Include="Reactive\EventPatternSource.cs" />
- <Compile Include="Reactive\EventSource.cs" />
- <Compile Include="InternalsVisibleTo.cs" />
- <Compile Include="Reactive\Linq\Observable.Async.cs" />
- <Compile Include="Reactive\Linq\Observable.Events.cs" />
- <Compile Include="Properties\AssemblyInfo.cs" />
- <Compile Include="Reactive\Concurrency\HistoricalScheduler.cs" />
- <Compile Include="Reactive\Concurrency\VirtualTimeScheduler.cs" />
- <Compile Include="Reactive\Internal\AnonymousEnumerable.cs" />
- <Compile Include="Reactive\Internal\BinaryObserver.cs" />
- <Compile Include="Reactive\Linq\Observαble\AddRef.cs" />
- <Compile Include="Reactive\Linq\Observαble\Aggregate.cs" />
- <Compile Include="Reactive\Linq\Observαble\All.cs" />
- <Compile Include="Reactive\Linq\Observαble\Amb.cs" />
- <Compile Include="Reactive\Linq\Observαble\Any.cs" />
- <Compile Include="Reactive\Linq\Observαble\AsObservable.cs" />
- <Compile Include="Reactive\Linq\Observαble\Average.cs" />
- <Compile Include="Reactive\Linq\Observαble\Buffer.cs" />
- <Compile Include="Reactive\Linq\Observαble\Catch.cs" />
- <Compile Include="Reactive\Linq\Observαble\Concat.cs" />
- <Compile Include="Reactive\Linq\Observαble\Contains.cs" />
- <Compile Include="Reactive\Linq\Observαble\Cast.cs" />
- <Compile Include="Reactive\Linq\Observαble\CombineLatest.cs" />
- <Compile Include="Reactive\Linq\Observαble\GetEnumerator.cs" />
- <Compile Include="Reactive\Linq\Observαble\GroupJoin.cs" />
- <Compile Include="Reactive\Linq\Observαble\Join.cs" />
- <Compile Include="Reactive\Linq\Observαble\SelectMany.cs" />
- <Compile Include="Reactive\Linq\Observαble\Zip.cs" />
- <Compile Include="Reactive\Linq\Observαble\OfType.cs" />
- <Compile Include="Reactive\Linq\Observαble\Count.cs" />
- <Compile Include="Reactive\Linq\Observαble\DefaultIfEmpty.cs" />
- <Compile Include="Reactive\Linq\Observαble\Defer.cs" />
- <Compile Include="Reactive\Linq\Observαble\Delay.cs" />
- <Compile Include="Reactive\Linq\Observαble\DelaySubscription.cs" />
- <Compile Include="Reactive\Linq\Observαble\Dematerialize.cs" />
- <Compile Include="Reactive\Linq\Observαble\Distinct.cs" />
- <Compile Include="Reactive\Linq\Observαble\DistinctUntilChanged.cs" />
- <Compile Include="Reactive\Linq\Observαble\Do.cs" />
- <Compile Include="Reactive\Linq\Observαble\ElementAt.cs" />
- <Compile Include="Reactive\Linq\Observαble\Empty.cs" />
- <Compile Include="Reactive\Linq\Observαble\Finally.cs" />
- <Compile Include="Reactive\Linq\Observαble\FirstAsync.cs" />
- <Compile Include="Reactive\Linq\Observαble\ForEach.cs" />
- <Compile Include="Reactive\Linq\Observαble\FromEvent.cs" />
- <Compile Include="Reactive\Linq\Observαble\FromEventPattern.cs" />
- <Compile Include="Reactive\Linq\Observαble\Generate.cs" />
- <Compile Include="Reactive\Linq\Observαble\GroupByUntil.cs" />
- <Compile Include="Reactive\Linq\Observαble\IgnoreElements.cs" />
- <Compile Include="Reactive\Linq\Observαble\IsEmpty.cs" />
- <Compile Include="Reactive\Linq\Observαble\LastAsync.cs" />
- <Compile Include="Reactive\Linq\Observαble\LongCount.cs" />
- <Compile Include="Reactive\Linq\Observαble\Materialize.cs" />
- <Compile Include="Reactive\Linq\Observαble\Max.cs" />
- <Compile Include="Reactive\Linq\Observαble\MaxBy.cs" />
- <Compile Include="Reactive\Linq\Observαble\Merge.cs" />
- <Compile Include="Reactive\Linq\Observαble\Min.cs" />
- <Compile Include="Reactive\Linq\Observαble\MinBy.cs" />
- <Compile Include="Reactive\Linq\Observαble\Never.cs" />
- <Compile Include="Reactive\Linq\Observαble\OnErrorResumeNext.cs" />
- <Compile Include="Reactive\Linq\Observαble\Range.cs" />
- <Compile Include="Reactive\Linq\Observαble\Repeat.cs" />
- <Compile Include="Reactive\Linq\Observαble\Return.cs" />
- <Compile Include="Reactive\Linq\Observαble\Sample.cs" />
- <Compile Include="Reactive\Linq\Observαble\Scan.cs" />
- <Compile Include="Reactive\Linq\Observαble\Select.cs" />
- <Compile Include="Reactive\Linq\Observαble\SequenceEqual.cs" />
- <Compile Include="Reactive\Linq\Observαble\SingleAsync.cs" />
- <Compile Include="Reactive\Linq\Observαble\Skip.cs" />
- <Compile Include="Reactive\Linq\Observαble\SkipLast.cs" />
- <Compile Include="Reactive\Linq\Observαble\SkipUntil.cs" />
- <Compile Include="Reactive\Linq\Observαble\SkipWhile.cs" />
- <Compile Include="Reactive\Linq\Observαble\Sum.cs" />
- <Compile Include="Reactive\Linq\Observαble\Switch.cs" />
- <Compile Include="Reactive\Internal\TailRecursiveSink.cs" />
- <Compile Include="Reactive\Linq\Observαble\Take.cs" />
- <Compile Include="Reactive\Linq\Observαble\TakeLast.cs" />
- <Compile Include="Reactive\Linq\Observαble\TakeUntil.cs" />
- <Compile Include="Reactive\Linq\Observαble\TakeWhile.cs" />
- <Compile Include="Reactive\Linq\Observαble\Throttle.cs" />
- <Compile Include="Reactive\Linq\Observαble\Throw.cs" />
- <Compile Include="Reactive\Linq\Observαble\TimeInterval.cs" />
- <Compile Include="Reactive\Linq\Observαble\Timeout.cs" />
- <Compile Include="Reactive\Linq\Observαble\Timer.cs" />
- <Compile Include="Reactive\Linq\Observαble\Timestamp.cs" />
- <Compile Include="Reactive\Linq\Observαble\ToArray.cs" />
- <Compile Include="Reactive\Linq\Observαble\ToDictionary.cs" />
- <Compile Include="Reactive\Linq\Observαble\ToList.cs" />
- <Compile Include="Reactive\Linq\Observαble\ToLookup.cs" />
- <Compile Include="Reactive\Linq\Observαble\ToObservable.cs" />
- <Compile Include="Reactive\Linq\Observαble\Using.cs" />
- <Compile Include="Reactive\Linq\Observαble\Where.cs" />
- <Compile Include="Reactive\Linq\Observαble\Window.cs" />
- <Compile Include="Reactive\Linq\Observαble\_.cs" />
- <Compile Include="Reactive\Subjects\ConnectableObservable.cs" />
- <Compile Include="Reactive\Subjects\Subject.Extensions.cs" />
- <Compile Include="Reactive\Internal\Either.Generic.cs" />
- <Compile Include="Reactive\Subjects\AsyncSubject.cs" />
- <Compile Include="Reactive\Subjects\BehaviorSubject.cs" />
- <Compile Include="Reactive\Subjects\Subject.cs" />
- <Compile Include="Reactive\Linq\GroupedObservable.cs" />
- <Compile Include="Reactive\Joins\ActivePlan.cs" />
- <Compile Include="Reactive\Joins\JoinObserver.cs" />
- <Compile Include="Reactive\Joins\Pattern.cs" />
- <Compile Include="Reactive\Joins\Plan.cs" />
- <Compile Include="Reactive\Linq\Observable.Aggregates.cs" />
- <Compile Include="Reactive\Linq\Observable.Awaiter.cs" />
- <Compile Include="Reactive\Linq\Observable.Binding.cs" />
- <Compile Include="Reactive\Linq\Observable.Blocking.cs" />
- <Compile Include="Reactive\Linq\Observable.Concurrency.cs" />
- <Compile Include="Reactive\Linq\Observable.Conversions.cs" />
- <Compile Include="Reactive\Linq\Observable.Creation.cs" />
- <Compile Include="Reactive\Linq\Observable.Joins.cs" />
- <Compile Include="Reactive\Linq\Observable.Multiple.cs" />
- <Compile Include="Reactive\Linq\Observable.Single.cs" />
- <Compile Include="Reactive\Linq\Observable.StandardSequenceOperators.cs" />
- <Compile Include="Reactive\Linq\Observable.Time.cs" />
- <Compile Include="Reactive\Internal\PushPullAdapter.cs" />
- <Compile Include="Reactive\Subjects\ReplaySubject.cs" />
- <Compile Include="Reactive\Threading\Tasks\NamespaceDoc.cs" />
- <Compile Include="Reactive\Threading\Tasks\TaskObservableExtensions.cs" />
- <Compile Include="Reactive\TimeInterval.cs" />
- <Compile Include="Reactive\Timestamped.cs" />
- <Compile Include="Strings_Linq.Generated.cs" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\System.Reactive.Core\System.Reactive.Core.csproj">
- <Project>{4E516F10-DA7A-4D43-963E-A93865ABEA5B}</Project>
- <Name>System.Reactive.Core</Name>
- </ProjectReference>
- <ProjectReference Include="..\System.Reactive.Interfaces\System.Reactive.Interfaces.csproj">
- <Project>{9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}</Project>
- <Name>System.Reactive.Interfaces</Name>
- </ProjectReference>
- </ItemGroup>
- <ItemGroup>
- <EmbeddedResource Include="Strings_Linq.resx" />
- </ItemGroup>
- <Import Project="..\Import.targets" />
-</Project> \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Linq/internals-visibleto-workaround.patch b/Rx.NET/System.Reactive.Linq/internals-visibleto-workaround.patch
deleted file mode 100644
index e8a91dd..0000000
--- a/Rx.NET/System.Reactive.Linq/internals-visibleto-workaround.patch
+++ /dev/null
@@ -1,91 +0,0 @@
-diff --git "a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observable/Catch.cs" "b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observable/Catch.cs"
-index 71e0037..21dd86c 100644
---- "a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observable/Catch.cs"
-+++ "b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observable/Catch.cs"
-@@ -56,7 +56,8 @@ public override void OnError(Exception error)
- public override void OnCompleted()
- {
- base._observer.OnCompleted();
-- base.Dispose();
-+ Sink<TSource> sink = this;
-+ sink.Dispose();
- }
-
- protected override void Done()
-@@ -66,7 +67,8 @@ protected override void Done()
- else
- base._observer.OnCompleted();
-
-- base.Dispose();
-+ Sink<TSource> sink = this;
-+ sink.Dispose();
- }
- }
- }
-@@ -180,4 +182,4 @@ public void OnCompleted()
- }
- }
- }
--#endif
-\ No newline at end of file
-+#endif
-diff --git "a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observable/Concat.cs" "b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observable/Concat.cs"
-index 5a9b2e4..62ea94b 100644
---- "a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observable/Concat.cs"
-+++ "b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observable/Concat.cs"
-@@ -44,9 +44,10 @@ public override void OnNext(TSource value)
- public override void OnError(Exception error)
- {
- base._observer.OnError(error);
-- base.Dispose();
-+ Sink<TSource> sink = this;
-+ sink.Dispose();
- }
- }
- }
- }
--#endif
-\ No newline at end of file
-+#endif
-diff --git "a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observable/DoWhile.cs" "b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observable/DoWhile.cs"
-index 3ef40eb..c7e0354 100644
---- "a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observable/DoWhile.cs"
-+++ "b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observable/DoWhile.cs"
-@@ -46,7 +46,8 @@ public override void OnNext(TSource value)
- public override void OnError(Exception error)
- {
- base._observer.OnError(error);
-- base.Dispose();
-+ Sink<TSource> sink = this;
-+ sink.Dispose();
- }
- }
- }
-diff --git "a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observable/For.cs" "b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observable/For.cs"
-index 85b9e03..79cd644 100644
---- "a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observable/For.cs"
-+++ "b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observable/For.cs"
-@@ -45,7 +45,8 @@ public override void OnNext(TResult value)
- public override void OnError(Exception error)
- {
- base._observer.OnError(error);
-- base.Dispose();
-+ Sink<TResult> sink = this;
-+ sink.Dispose();
- }
- }
- }
-diff --git "a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observable/While.cs" "b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observable/While.cs"
-index 178e4c8..c747e66 100644
---- "a/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observable/While.cs"
-+++ "b/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observable/While.cs"
-@@ -45,7 +45,8 @@ public override void OnNext(TSource value)
- public override void OnError(Exception error)
- {
- base._observer.OnError(error);
-- base.Dispose();
-+ Sink<TSource> sink = this;
-+ sink.Dispose();
- }
- }
- }
diff --git a/Rx.NET/System.Reactive.PlatformServices/GlobalSuppressions.cs b/Rx.NET/System.Reactive.PlatformServices/GlobalSuppressions.cs
deleted file mode 100644
index 75cf9ed..0000000
--- a/Rx.NET/System.Reactive.PlatformServices/GlobalSuppressions.cs
+++ /dev/null
@@ -1,16 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-// This file is used by Code Analysis to maintain SuppressMessage
-// attributes that are applied to this project.
-// Project-level suppressions either have no target or are given
-// a specific target and scoped to a namespace, type, member, etc.
-//
-// To add a suppression to this file, right-click the message in the
-// Error List, point to "Suppress Message(s)", and click
-// "In Project Suppression File".
-// You do not need to add suppressions to this file manually.
-
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes", Scope = "namespace", Target = "System.Reactive.Concurrency", Justification = "By design.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes", Scope = "namespace", Target = "System.Reactive.PlatformServices", Justification = "By design.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA2210:AssembliesShouldHaveValidStrongNames", Justification = "Taken care of by lab build.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1016:MarkAssembliesWithAssemblyVersion", Justification = "Taken care of by lab build.")]
diff --git a/Rx.NET/System.Reactive.PlatformServices/Properties/AssemblyInfo.cs b/Rx.NET/System.Reactive.PlatformServices/Properties/AssemblyInfo.cs
deleted file mode 100644
index b291538..0000000
--- a/Rx.NET/System.Reactive.PlatformServices/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,37 +0,0 @@
-using System;
-using System.Reflection;
-using System.Resources;
-using System.Runtime.InteropServices;
-using System.Security;
-
-[assembly: AssemblyTitle("System.Reactive.PlatformServices")]
-// Notice: same description as in the .nuspec files; see Source/Rx/Setup/NuGet
-[assembly: AssemblyDescription("Reactive Extensions Platform Services Library used to access platform-specific functionality and enlightenment services.")]
-#if DEBUG
-[assembly: AssemblyConfiguration("Debug")]
-#else
-[assembly: AssemblyConfiguration("Retail")]
-#endif
-[assembly: AssemblyCompany("Microsoft Corporation")]
-[assembly: AssemblyProduct("Reactive Extensions")]
-[assembly: AssemblyCopyright("\x00a9 Microsoft Corporation. All rights reserved.")]
-[assembly: NeutralResourcesLanguage("en-US")]
-
-#if !PLIB
-[assembly: ComVisible(false)]
-#endif
-
-[assembly: CLSCompliant(true)]
-
-#if HAS_APTCA && NO_CODECOVERAGE
-[assembly: AllowPartiallyTrustedCallers]
-#endif
-
-#if XBOX_LAKEVIEW
-[assembly: SecurityTransparent]
-#endif
-
-//
-// Note: Assembly (file) version numbers get inserted by the build system on the fly. Inspect the Team Build workflows
-// and the custom activity in Build/Source/Activities/AppendVersionInfo.cs for more information.
-//
diff --git a/Rx.NET/System.Reactive.PlatformServices/Reactive/Concurrency/ConcurrencyAbstractionLayerImpl.Windows.cs b/Rx.NET/System.Reactive.PlatformServices/Reactive/Concurrency/ConcurrencyAbstractionLayerImpl.Windows.cs
deleted file mode 100644
index 1d5c0ae..0000000
--- a/Rx.NET/System.Reactive.PlatformServices/Reactive/Concurrency/ConcurrencyAbstractionLayerImpl.Windows.cs
+++ /dev/null
@@ -1,101 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if NO_THREAD && WINDOWS
-using System;
-using System.Collections.Generic;
-using System.Reactive.Disposables;
-using System.Threading;
-
-namespace System.Reactive.Concurrency
-{
- internal class /*Default*/ConcurrencyAbstractionLayerImpl : IConcurrencyAbstractionLayer
- {
- public IDisposable StartTimer(Action<object> action, object state, TimeSpan dueTime)
- {
- var res = global::Windows.System.Threading.ThreadPoolTimer.CreateTimer(
- tpt =>
- {
- action(state);
- },
- Normalize(dueTime)
- );
-
- return Disposable.Create(res.Cancel);
- }
-
- public IDisposable StartPeriodicTimer(Action action, TimeSpan period)
- {
- //
- // The WinRT thread pool is based on the Win32 thread pool and cannot handle
- // sub-1ms resolution. When passing a lower period, we get single-shot
- // timer behavior instead. See MSDN documentation for CreatePeriodicTimer
- // for more information.
- //
- if (period < TimeSpan.FromMilliseconds(1))
- throw new ArgumentOutOfRangeException("period", Strings_PlatformServices.WINRT_NO_SUB1MS_TIMERS);
-
- var res = global::Windows.System.Threading.ThreadPoolTimer.CreatePeriodicTimer(
- tpt =>
- {
- action();
- },
- period
- );
-
- return Disposable.Create(res.Cancel);
- }
-
- public IDisposable QueueUserWorkItem(Action<object> action, object state)
- {
- var res = global::Windows.System.Threading.ThreadPool.RunAsync(iaa =>
- {
- action(state);
- });
-
- return Disposable.Create(res.Cancel);
- }
-
- public void Sleep(TimeSpan timeout)
- {
- var e = new ManualResetEventSlim();
-
- global::Windows.System.Threading.ThreadPoolTimer.CreateTimer(
- tpt =>
- {
- e.Set();
- },
- Normalize(timeout)
- );
-
- e.Wait();
- }
-
- public IStopwatch StartStopwatch()
- {
-#if !NO_STOPWATCH
- return new StopwatchImpl();
-#else
- return new DefaultStopwatch();
-#endif
- }
-
- public bool SupportsLongRunning
- {
- get { return false; }
- }
-
- public void StartThread(Action<object> action, object state)
- {
- throw new NotSupportedException();
- }
-
- private TimeSpan Normalize(TimeSpan dueTime)
- {
- if (dueTime < TimeSpan.Zero)
- return TimeSpan.Zero;
-
- return dueTime;
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.PlatformServices/Reactive/Concurrency/ConcurrencyAbstractionLayerImpl.cs b/Rx.NET/System.Reactive.PlatformServices/Reactive/Concurrency/ConcurrencyAbstractionLayerImpl.cs
deleted file mode 100644
index 2d86ea7..0000000
--- a/Rx.NET/System.Reactive.PlatformServices/Reactive/Concurrency/ConcurrencyAbstractionLayerImpl.cs
+++ /dev/null
@@ -1,215 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_THREAD
-using System;
-using System.Collections.Generic;
-using System.Reactive.Disposables;
-using System.Threading;
-
-namespace System.Reactive.Concurrency
-{
- //
- // WARNING: This code is kept *identically* in two places. One copy is kept in System.Reactive.Core for non-PLIB platforms.
- // Another copy is kept in System.Reactive.PlatformServices to enlighten the default lowest common denominator
- // behavior of Rx for PLIB when used on a more capable platform.
- //
- internal class /*Default*/ConcurrencyAbstractionLayerImpl : IConcurrencyAbstractionLayer
- {
- public IDisposable StartTimer(Action<object> action, object state, TimeSpan dueTime)
- {
- return new Timer(action, state, Normalize(dueTime));
- }
-
- public IDisposable StartPeriodicTimer(Action action, TimeSpan period)
- {
- //
- // MSDN documentation states the following:
- //
- // "If period is zero (0) or negative one (-1) milliseconds and dueTime is positive, callback is invoked once;
- // the periodic behavior of the timer is disabled, but can be re-enabled using the Change method."
- //
- if (period <= TimeSpan.Zero)
- throw new ArgumentOutOfRangeException("period");
-
- return new PeriodicTimer(action, period);
- }
-
- public IDisposable QueueUserWorkItem(Action<object> action, object state)
- {
- System.Threading.ThreadPool.QueueUserWorkItem(_ => action(_), state);
- return Disposable.Empty;
- }
-
-#if USE_SLEEP_MS
- public void Sleep(TimeSpan timeout)
- {
- System.Threading.Thread.Sleep((int)Normalize(timeout).TotalMilliseconds);
- }
-#else
- public void Sleep(TimeSpan timeout)
- {
- System.Threading.Thread.Sleep(Normalize(timeout));
- }
-#endif
-
- public IStopwatch StartStopwatch()
- {
-#if !NO_STOPWATCH
- return new StopwatchImpl();
-#else
- return new DefaultStopwatch();
-#endif
- }
-
- public bool SupportsLongRunning
- {
- get { return true; }
- }
-
- public void StartThread(Action<object> action, object state)
- {
- new Thread(() =>
- {
- action(state);
- }).Start();
- }
-
- private static TimeSpan Normalize(TimeSpan dueTime)
- {
- if (dueTime < TimeSpan.Zero)
- return TimeSpan.Zero;
-
- return dueTime;
- }
-
- class Timer : IDisposable
- {
- //
- // Note: the dictionary exists to "root" the timers so that they are not garbage collected and finalized while they are running.
- //
-#if !NO_HASHSET
- private static readonly HashSet<System.Threading.Timer> s_timers = new HashSet<System.Threading.Timer>();
-#else
- private static readonly Dictionary<System.Threading.Timer, object> s_timers = new Dictionary<System.Threading.Timer, object>();
-#endif
-
- private Action<object> _action;
- private System.Threading.Timer _timer;
-
- private bool _hasAdded;
- private bool _hasRemoved;
-
- public Timer(Action<object> action, object state, TimeSpan dueTime)
- {
- _action = action;
- _timer = new System.Threading.Timer(Tick, state, dueTime, TimeSpan.FromMilliseconds(System.Threading.Timeout.Infinite));
-
- lock (s_timers)
- {
- if (!_hasRemoved)
- {
-#if !NO_HASHSET
- s_timers.Add(_timer);
-#else
- s_timers.Add(_timer, null);
-#endif
-
- _hasAdded = true;
- }
- }
- }
-
- private void Tick(object state)
- {
- try
- {
- _action(state);
- }
- finally
- {
- Dispose();
- }
- }
-
- public void Dispose()
- {
- _action = Stubs<object>.Ignore;
-
- var timer = default(System.Threading.Timer);
-
- lock (s_timers)
- {
- if (!_hasRemoved)
- {
- timer = _timer;
- _timer = null;
-
- if (_hasAdded && timer != null)
- s_timers.Remove(timer);
-
- _hasRemoved = true;
- }
- }
-
- if (timer != null)
- timer.Dispose();
- }
- }
-
- class PeriodicTimer : IDisposable
- {
- //
- // Note: the dictionary exists to "root" the timers so that they are not garbage collected and finalized while they are running.
- //
-#if !NO_HASHSET
- private static readonly HashSet<System.Threading.Timer> s_timers = new HashSet<System.Threading.Timer>();
-#else
- private static readonly Dictionary<System.Threading.Timer, object> s_timers = new Dictionary<System.Threading.Timer, object>();
-#endif
-
- private Action _action;
- private System.Threading.Timer _timer;
-
- public PeriodicTimer(Action action, TimeSpan period)
- {
- _action = action;
- _timer = new System.Threading.Timer(Tick, null, period, period);
-
- lock (s_timers)
- {
-#if !NO_HASHSET
- s_timers.Add(_timer);
-#else
- s_timers.Add(_timer, null);
-#endif
- }
- }
-
- private void Tick(object state)
- {
- _action();
- }
-
- public void Dispose()
- {
- var timer = default(System.Threading.Timer);
-
- lock (s_timers)
- {
- timer = _timer;
- _timer = null;
-
- if (timer != null)
- s_timers.Remove(timer);
- }
-
- if (timer != null)
- {
- timer.Dispose();
- _action = Stubs.Nop;
- }
- }
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.PlatformServices/Reactive/Concurrency/EventLoopScheduler.cs b/Rx.NET/System.Reactive.PlatformServices/Reactive/Concurrency/EventLoopScheduler.cs
deleted file mode 100644
index 8739895..0000000
--- a/Rx.NET/System.Reactive.PlatformServices/Reactive/Concurrency/EventLoopScheduler.cs
+++ /dev/null
@@ -1,375 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System.Collections.Generic;
-using System.Reactive.Disposables;
-using System.Threading;
-
-#if NO_SEMAPHORE
-using System.Reactive.Threading;
-#endif
-
-namespace System.Reactive.Concurrency
-{
- /// <summary>
- /// Represents an object that schedules units of work on a designated thread.
- /// </summary>
- public sealed class EventLoopScheduler : LocalScheduler, ISchedulerPeriodic, IDisposable
- {
- #region Fields
-
- /// <summary>
- /// Counter for diagnostic purposes, to name the threads.
- /// </summary>
- private static int s_counter;
-
- /// <summary>
- /// Thread factory function.
- /// </summary>
- private readonly Func<ThreadStart, Thread> _threadFactory;
-
- /// <summary>
- /// Stopwatch for timing free of absolute time dependencies.
- /// </summary>
- private IStopwatch _stopwatch;
-
- /// <summary>
- /// Thread used by the event loop to run work items on. No work should be run on any other thread.
- /// If ExitIfEmpty is set, the thread can quit and a new thread will be created when new work is scheduled.
- /// </summary>
- private Thread _thread;
-
- /// <summary>
- /// Gate to protect data structures, including the work queue and the ready list.
- /// </summary>
- private readonly object _gate;
-
- /// <summary>
- /// Semaphore to count requests to re-evaluate the queue, from either Schedule requests or when a timer
- /// expires and moves on to the next item in the queue.
- /// </summary>
-#if !NO_CDS
- private readonly SemaphoreSlim _evt;
-#else
- private readonly Semaphore _evt;
-#endif
-
- /// <summary>
- /// Queue holding work items. Protected by the gate.
- /// </summary>
- private readonly SchedulerQueue<TimeSpan> _queue;
-
- /// <summary>
- /// Queue holding items that are ready to be run as soon as possible. Protected by the gate.
- /// </summary>
- private readonly Queue<ScheduledItem<TimeSpan>> _readyList;
-
- /// <summary>
- /// Work item that will be scheduled next. Used upon reevaluation of the queue to check whether the next
- /// item is still the same. If not, a new timer needs to be started (see below).
- /// </summary>
- private ScheduledItem<TimeSpan> _nextItem;
-
- /// <summary>
- /// Disposable that always holds the timer to dispatch the first element in the queue.
- /// </summary>
- private readonly SerialDisposable _nextTimer;
-
- /// <summary>
- /// Flag indicating whether the event loop should quit. When set, the event should be signaled as well to
- /// wake up the event loop thread, which will subsequently abandon all work.
- /// </summary>
- private bool _disposed;
-
- #endregion
-
- #region Constructors
-
- /// <summary>
- /// Creates an object that schedules units of work on a designated thread.
- /// </summary>
- public EventLoopScheduler()
- : this(a => new Thread(a) { Name = "Event Loop " + Interlocked.Increment(ref s_counter), IsBackground = true })
- {
- }
-
-#if !NO_THREAD
- /// <summary>
- /// Creates an object that schedules units of work on a designated thread, using the specified factory to control thread creation options.
- /// </summary>
- /// <param name="threadFactory">Factory function for thread creation.</param>
- /// <exception cref="ArgumentNullException"><paramref name="threadFactory"/> is null.</exception>
- public EventLoopScheduler(Func<ThreadStart, Thread> threadFactory)
- {
- if (threadFactory == null)
- throw new ArgumentNullException("threadFactory");
-#else
- internal EventLoopScheduler(Func<ThreadStart, Thread> threadFactory)
- {
-#endif
- _threadFactory = threadFactory;
- _stopwatch = ConcurrencyAbstractionLayer.Current.StartStopwatch();
-
- _gate = new object();
-
-#if !NO_CDS
- _evt = new SemaphoreSlim(0);
-#else
- _evt = new Semaphore(0, int.MaxValue);
-#endif
- _queue = new SchedulerQueue<TimeSpan>();
- _readyList = new Queue<ScheduledItem<TimeSpan>>();
-
- _nextTimer = new SerialDisposable();
-
- ExitIfEmpty = false;
- }
-
- #endregion
-
- #region Properties
-
- /// <summary>
- /// Indicates whether the event loop thread is allowed to quit when no work is left. If new work
- /// is scheduled afterwards, a new event loop thread is created. This property is used by the
- /// NewThreadScheduler which uses an event loop for its recursive invocations.
- /// </summary>
- internal bool ExitIfEmpty
- {
- get;
- set;
- }
-
- #endregion
-
- #region Public methods
-
- /// <summary>
- /// Schedules an action to be executed after dueTime.
- /// </summary>
- /// <typeparam name="TState">The type of the state passed to the scheduled action.</typeparam>
- /// <param name="state">State passed to the action to be executed.</param>
- /// <param name="action">Action to be executed.</param>
- /// <param name="dueTime">Relative time after which to execute the action.</param>
- /// <returns>The disposable object used to cancel the scheduled action (best effort).</returns>
- /// <exception cref="ArgumentNullException"><paramref name="action"/> is null.</exception>
- /// <exception cref="ObjectDisposedException">The scheduler has been disposed and doesn't accept new work.</exception>
- public override IDisposable Schedule<TState>(TState state, TimeSpan dueTime, Func<IScheduler, TState, IDisposable> action)
- {
- if (action == null)
- throw new ArgumentNullException("action");
-
- var due = _stopwatch.Elapsed + dueTime;
- var si = new ScheduledItem<TimeSpan, TState>(this, state, action, due);
-
- lock (_gate)
- {
- if (_disposed)
- throw new ObjectDisposedException("");
-
- if (dueTime <= TimeSpan.Zero)
- {
- _readyList.Enqueue(si);
- _evt.Release();
- }
- else
- {
- _queue.Enqueue(si);
- _evt.Release();
- }
-
- EnsureThread();
- }
-
- return Disposable.Create(si.Cancel);
- }
-
- /// <summary>
- /// Schedules a periodic piece of work on the designated thread.
- /// </summary>
- /// <typeparam name="TState">The type of the state passed to the scheduled action.</typeparam>
- /// <param name="state">Initial state passed to the action upon the first iteration.</param>
- /// <param name="period">Period for running the work periodically.</param>
- /// <param name="action">Action to be executed, potentially updating the state.</param>
- /// <returns>The disposable object used to cancel the scheduled recurring action (best effort).</returns>
- /// <exception cref="ArgumentNullException"><paramref name="action"/> is null.</exception>
- /// <exception cref="ArgumentOutOfRangeException"><paramref name="period"/> is less than TimeSpan.Zero.</exception>
- /// <exception cref="ObjectDisposedException">The scheduler has been disposed and doesn't accept new work.</exception>
- public IDisposable SchedulePeriodic<TState>(TState state, TimeSpan period, Func<TState, TState> action)
- {
- if (period < TimeSpan.Zero)
- throw new ArgumentOutOfRangeException("period");
- if (action == null)
- throw new ArgumentNullException("action");
-
- var start = _stopwatch.Elapsed;
- var next = start + period;
-
- var state1 = state;
-
- var d = new MultipleAssignmentDisposable();
- var gate = new AsyncLock();
-
- var tick = default(Func<IScheduler, object, IDisposable>);
- tick = (self_, _) =>
- {
- next += period;
-
- d.Disposable = self_.Schedule(null, next - _stopwatch.Elapsed, tick);
-
- gate.Wait(() =>
- {
- state1 = action(state1);
- });
-
- return Disposable.Empty;
- };
-
- d.Disposable = Schedule(null, next - _stopwatch.Elapsed, tick);
-
- return new CompositeDisposable(d, gate);
- }
-
-#if !NO_STOPWATCH
- /// <summary>
- /// Starts a new stopwatch object.
- /// </summary>
- /// <returns>New stopwatch object; started at the time of the request.</returns>
- public override IStopwatch StartStopwatch()
- {
- //
- // Strictly speaking, this explicit override is not necessary because the base implementation calls into
- // the enlightenment module to obtain the CAL, which would circle back to System.Reactive.PlatformServices
- // where we're currently running. This is merely a short-circuit to avoid the additional roundtrip.
- //
- return new StopwatchImpl();
- }
-#endif
-
- /// <summary>
- /// Ends the thread associated with this scheduler. All remaining work in the scheduler queue is abandoned.
- /// </summary>
- public void Dispose()
- {
- lock (_gate)
- {
- if (!_disposed)
- {
- _disposed = true;
- _nextTimer.Dispose();
- _evt.Release();
- }
- }
- }
-
- #endregion
-
- #region Private implementation
-
- /// <summary>
- /// Ensures there is an event loop thread running. Should be called under the gate.
- /// </summary>
- private void EnsureThread()
- {
- if (_thread == null)
- {
- _thread = _threadFactory(Run);
- _thread.Start();
- }
- }
-
- /// <summary>
- /// Event loop scheduled on the designated event loop thread. The loop is suspended/resumed using the event
- /// which gets set by calls to Schedule, the next item timer, or calls to Dispose.
- /// </summary>
- private void Run()
- {
- while (true)
- {
-#if !NO_CDS
- _evt.Wait();
-#else
- _evt.WaitOne();
-#endif
-
- var ready = default(ScheduledItem<TimeSpan>[]);
-
- lock (_gate)
- {
- //
- // The event could have been set by a call to Dispose. This takes priority over anything else. We quit the
- // loop immediately. Subsequent calls to Schedule won't ever create a new thread.
- //
- if (_disposed)
- {
- ((IDisposable)_evt).Dispose();
- return;
- }
-
- while (_queue.Count > 0 && _queue.Peek().DueTime <= _stopwatch.Elapsed)
- {
- var item = _queue.Dequeue();
- _readyList.Enqueue(item);
- }
-
- if (_queue.Count > 0)
- {
- var next = _queue.Peek();
- if (next != _nextItem)
- {
- _nextItem = next;
-
- var due = next.DueTime - _stopwatch.Elapsed;
- _nextTimer.Disposable = ConcurrencyAbstractionLayer.Current.StartTimer(Tick, next, due);
- }
- }
-
- if (_readyList.Count > 0)
- {
- ready = _readyList.ToArray();
- _readyList.Clear();
- }
- }
-
- if (ready != null)
- {
- foreach (var item in ready)
- {
- if (!item.IsCanceled)
- item.Invoke();
- }
- }
-
- if (ExitIfEmpty)
- {
- lock (_gate)
- {
- if (_readyList.Count == 0 && _queue.Count == 0)
- {
- _thread = null;
- return;
- }
- }
- }
- }
- }
-
- private void Tick(object state)
- {
- lock (_gate)
- {
- if (!_disposed)
- {
- var item = (ScheduledItem<TimeSpan>)state;
- if (_queue.Remove(item))
- {
- _readyList.Enqueue(item);
- }
-
- _evt.Release();
- }
- }
- }
-
- #endregion
- }
-} \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.PlatformServices/Reactive/Concurrency/NewThreadScheduler.cs b/Rx.NET/System.Reactive.PlatformServices/Reactive/Concurrency/NewThreadScheduler.cs
deleted file mode 100644
index b111554..0000000
--- a/Rx.NET/System.Reactive.PlatformServices/Reactive/Concurrency/NewThreadScheduler.cs
+++ /dev/null
@@ -1,194 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System.Reactive.Disposables;
-using System.Threading;
-
-namespace System.Reactive.Concurrency
-{
- /// <summary>
- /// Represents an object that schedules each unit of work on a separate thread.
- /// </summary>
- public sealed class NewThreadScheduler : LocalScheduler, ISchedulerLongRunning, ISchedulerPeriodic
- {
- internal static readonly NewThreadScheduler s_instance = new NewThreadScheduler();
-
- private readonly Func<ThreadStart, Thread> _threadFactory;
-
- /// <summary>
- /// Creates an object that schedules each unit of work on a separate thread.
- /// </summary>
- public NewThreadScheduler()
- : this(action => new Thread(action))
- {
- }
-
- /// <summary>
- /// Gets an instance of this scheduler that uses the default Thread constructor.
- /// </summary>
- public static NewThreadScheduler Default
- {
- get
- {
- return s_instance;
- }
- }
-
-#if !NO_THREAD
- /// <summary>
- /// Creates an object that schedules each unit of work on a separate thread.
- /// </summary>
- /// <param name="threadFactory">Factory function for thread creation.</param>
- /// <exception cref="ArgumentNullException"><paramref name="threadFactory"/> is null.</exception>
- public NewThreadScheduler(Func<ThreadStart, Thread> threadFactory)
- {
- if (threadFactory == null)
- throw new ArgumentNullException("threadFactory");
-#else
- private NewThreadScheduler(Func<ThreadStart, Thread> threadFactory)
- {
-#endif
- _threadFactory = threadFactory;
- }
-
- /// <summary>
- /// Schedules an action to be executed after dueTime.
- /// </summary>
- /// <typeparam name="TState">The type of the state passed to the scheduled action.</typeparam>
- /// <param name="state">State passed to the action to be executed.</param>
- /// <param name="action">Action to be executed.</param>
- /// <param name="dueTime">Relative time after which to execute the action.</param>
- /// <returns>The disposable object used to cancel the scheduled action (best effort).</returns>
- /// <exception cref="ArgumentNullException"><paramref name="action"/> is null.</exception>
- public override IDisposable Schedule<TState>(TState state, TimeSpan dueTime, Func<IScheduler, TState, IDisposable> action)
- {
- if (action == null)
- throw new ArgumentNullException("action");
-
- var scheduler = new EventLoopScheduler(_threadFactory);
- scheduler.ExitIfEmpty = true;
- return scheduler.Schedule(state, dueTime, action);
- }
-
- /// <summary>
- /// Schedules a long-running task by creating a new thread. Cancellation happens through polling.
- /// </summary>
- /// <typeparam name="TState">The type of the state passed to the scheduled action.</typeparam>
- /// <param name="state">State passed to the action to be executed.</param>
- /// <param name="action">Action to be executed.</param>
- /// <returns>The disposable object used to cancel the scheduled action (best effort).</returns>
- /// <exception cref="ArgumentNullException"><paramref name="action"/> is null.</exception>
- public IDisposable ScheduleLongRunning<TState>(TState state, Action<TState, ICancelable> action)
- {
- if (action == null)
- throw new ArgumentNullException("action");
-
- var d = new BooleanDisposable();
-
- var thread = _threadFactory(() =>
- {
- //
- // Notice we don't check d.IsDisposed. The contract for ISchedulerLongRunning
- // requires us to ensure the scheduled work gets an opportunity to observe
- // the cancellation request.
- //
- action(state, d);
- });
-
- thread.Start();
-
- return d;
- }
-
- /// <summary>
- /// Schedules a periodic piece of work by creating a new thread that goes to sleep when work has been dispatched and wakes up again at the next periodic due time.
- /// </summary>
- /// <typeparam name="TState">The type of the state passed to the scheduled action.</typeparam>
- /// <param name="state">Initial state passed to the action upon the first iteration.</param>
- /// <param name="period">Period for running the work periodically.</param>
- /// <param name="action">Action to be executed, potentially updating the state.</param>
- /// <returns>The disposable object used to cancel the scheduled recurring action (best effort).</returns>
- /// <exception cref="ArgumentNullException"><paramref name="action"/> is null.</exception>
- /// <exception cref="ArgumentOutOfRangeException"><paramref name="period"/> is less than TimeSpan.Zero.</exception>
- public IDisposable SchedulePeriodic<TState>(TState state, TimeSpan period, Func<TState, TState> action)
- {
- if (period < TimeSpan.Zero)
- throw new ArgumentOutOfRangeException("period");
- if (action == null)
- throw new ArgumentNullException("action");
-
- var periodic = new Periodic<TState>(state, period, action);
-
- var thread = _threadFactory(periodic.Run);
- thread.Start();
-
- return periodic;
- }
-
- class Periodic<TState> : IDisposable
- {
- private readonly IStopwatch _stopwatch;
- private readonly TimeSpan _period;
- private readonly Func<TState, TState> _action;
-
- private readonly object _cancel = new object();
- private volatile bool _done;
-
- private TState _state;
- private TimeSpan _next;
-
- public Periodic(TState state, TimeSpan period, Func<TState, TState> action)
- {
- _stopwatch = ConcurrencyAbstractionLayer.Current.StartStopwatch();
-
- _period = period;
- _action = action;
-
- _state = state;
- _next = period;
- }
-
- public void Run()
- {
- while (!_done)
- {
- var timeout = Scheduler.Normalize(_next - _stopwatch.Elapsed);
-
- lock (_cancel)
- {
- if (Monitor.Wait(_cancel, timeout))
- return;
- }
-
- _state = _action(_state);
- _next += _period;
- }
- }
-
- public void Dispose()
- {
- _done = true;
-
- lock (_cancel)
- {
- Monitor.Pulse(_cancel);
- }
- }
- }
-
-#if !NO_STOPWATCH
- /// <summary>
- /// Starts a new stopwatch object.
- /// </summary>
- /// <returns>New stopwatch object; started at the time of the request.</returns>
- public override IStopwatch StartStopwatch()
- {
- //
- // Strictly speaking, this explicit override is not necessary because the base implementation calls into
- // the enlightenment module to obtain the CAL, which would circle back to System.Reactive.PlatformServices
- // where we're currently running. This is merely a short-circuit to avoid the additional roundtrip.
- //
- return new StopwatchImpl();
- }
-#endif
- }
-} \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.PlatformServices/Reactive/Concurrency/TaskPoolScheduler.cs b/Rx.NET/System.Reactive.PlatformServices/Reactive/Concurrency/TaskPoolScheduler.cs
deleted file mode 100644
index a84588b..0000000
--- a/Rx.NET/System.Reactive.PlatformServices/Reactive/Concurrency/TaskPoolScheduler.cs
+++ /dev/null
@@ -1,230 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_TPL
-using System.Reactive.Disposables;
-using System.Threading;
-using System.Threading.Tasks;
-
-namespace System.Reactive.Concurrency
-{
- /// <summary>
- /// Represents an object that schedules units of work on the Task Parallel Library (TPL) task pool.
- /// </summary>
- /// <seealso cref="TaskPoolScheduler.Default">Instance of this type using the default TaskScheduler to schedule work on the TPL task pool.</seealso>
- public sealed class TaskPoolScheduler : LocalScheduler, ISchedulerLongRunning, ISchedulerPeriodic
- {
- private static readonly TaskPoolScheduler s_instance = new TaskPoolScheduler(new TaskFactory(TaskScheduler.Default));
- private readonly TaskFactory taskFactory;
-
- /// <summary>
- /// Creates an object that schedules units of work using the provided TaskFactory.
- /// </summary>
- /// <param name="taskFactory">Task factory used to create tasks to run units of work.</param>
- /// <exception cref="ArgumentNullException"><paramref name="taskFactory"/> is null.</exception>
- public TaskPoolScheduler(TaskFactory taskFactory)
- {
- if (taskFactory == null)
- throw new ArgumentNullException("taskFactory");
-
- this.taskFactory = taskFactory;
- }
-
- /// <summary>
- /// Gets an instance of this scheduler that uses the default TaskScheduler.
- /// </summary>
- public static TaskPoolScheduler Default
- {
- get
- {
- return s_instance;
- }
- }
-
- /// <summary>
- /// Schedules an action to be executed.
- /// </summary>
- /// <typeparam name="TState">The type of the state passed to the scheduled action.</typeparam>
- /// <param name="state">State passed to the action to be executed.</param>
- /// <param name="action">Action to be executed.</param>
- /// <returns>The disposable object used to cancel the scheduled action (best effort).</returns>
- /// <exception cref="ArgumentNullException"><paramref name="action"/> is null.</exception>
- public override IDisposable Schedule<TState>(TState state, Func<IScheduler, TState, IDisposable> action)
- {
- if (action == null)
- throw new ArgumentNullException("action");
-
- var d = new SerialDisposable();
- var cancelable = new CancellationDisposable();
- d.Disposable = cancelable;
- taskFactory.StartNew(() =>
- {
- //
- // BREAKING CHANGE v2.0 > v1.x - No longer escalating exceptions using a throwing
- // helper thread.
- //
- // Our manual escalation based on the creation of a throwing thread was merely to
- // expedite the process of throwing the exception that would otherwise occur on the
- // finalizer thread at a later point during the app's lifetime.
- //
- // However, it also prevented applications from observing the exception through
- // the TaskScheduler.UnobservedTaskException static event. Also, starting form .NET
- // 4.5, the default behavior of the task pool is not to take down the application
- // when an exception goes unobserved (done as part of the async/await work). It'd
- // be weird for Rx not to follow the platform defaults.
- //
- // General implementation guidelines for schedulers (in order of importance):
- //
- // 1. Always thunk through to the underlying infrastructure with a wrapper that's as tiny as possible.
- // 2. Global exception notification/handling mechanisms shouldn't be bypassed.
- // 3. Escalation behavior for exceptions is left to the underlying infrastructure.
- //
- // The Catch extension method for IScheduler (added earlier) allows to re-route
- // exceptions at stage 2. If the exception isn't handled at the Rx level, it
- // propagates by means of a rethrow, falling back to behavior in 3.
- //
- d.Disposable = action(this, state);
- }, cancelable.Token);
- return d;
- }
-
- /// <summary>
- /// Schedules an action to be executed after dueTime.
- /// </summary>
- /// <typeparam name="TState">The type of the state passed to the scheduled action.</typeparam>
- /// <param name="state">State passed to the action to be executed.</param>
- /// <param name="action">Action to be executed.</param>
- /// <param name="dueTime">Relative time after which to execute the action.</param>
- /// <returns>The disposable object used to cancel the scheduled action (best effort).</returns>
- /// <exception cref="ArgumentNullException"><paramref name="action"/> is null.</exception>
- public override IDisposable Schedule<TState>(TState state, TimeSpan dueTime, Func<IScheduler, TState, IDisposable> action)
- {
- if (action == null)
- throw new ArgumentNullException("action");
-
- var dt = Scheduler.Normalize(dueTime);
- if (dt.Ticks == 0)
- return Schedule(state, action);
-
-#if !NO_TASK_DELAY
- var d = new MultipleAssignmentDisposable();
-
- var ct = new CancellationDisposable();
- d.Disposable = ct;
-
- Task.Delay(dueTime, ct.Token).ContinueWith(_ =>
- {
- if (!d.IsDisposed)
- d.Disposable = action(this, state);
- }, CancellationToken.None, TaskContinuationOptions.ExecuteSynchronously | TaskContinuationOptions.OnlyOnRanToCompletion, taskFactory.Scheduler);
-
- return d;
-#else
- return DefaultScheduler.Instance.Schedule(state, dt, (_, state1) => Schedule(state1, action));
-#endif
- }
-
- /// <summary>
- /// Schedules a long-running task by creating a new task using TaskCreationOptions.LongRunning. Cancellation happens through polling.
- /// </summary>
- /// <typeparam name="TState">The type of the state passed to the scheduled action.</typeparam>
- /// <param name="state">State passed to the action to be executed.</param>
- /// <param name="action">Action to be executed.</param>
- /// <returns>The disposable object used to cancel the scheduled action (best effort).</returns>
- /// <exception cref="ArgumentNullException"><paramref name="action"/> is null.</exception>
- public IDisposable ScheduleLongRunning<TState>(TState state, Action<TState, ICancelable> action)
- {
- var d = new BooleanDisposable();
-
- taskFactory.StartNew(() =>
- {
- //
- // Notice we don't check d.IsDisposed. The contract for ISchedulerLongRunning
- // requires us to ensure the scheduled work gets an opportunity to observe
- // the cancellation request.
- //
- action(state, d);
- }, TaskCreationOptions.LongRunning);
-
- return d;
- }
-
-#if !NO_STOPWATCH
- /// <summary>
- /// Gets a new stopwatch ob ject.
- /// </summary>
- /// <returns>New stopwatch object; started at the time of the request.</returns>
- public override IStopwatch StartStopwatch()
- {
- //
- // Strictly speaking, this explicit override is not necessary because the base implementation calls into
- // the enlightenment module to obtain the CAL, which would circle back to System.Reactive.PlatformServices
- // where we're currently running. This is merely a short-circuit to avoid the additional roundtrip.
- //
- return new StopwatchImpl();
- }
-#endif
-
- /// <summary>
- /// Schedules a periodic piece of work by running a platform-specific timer to create tasks periodically.
- /// </summary>
- /// <typeparam name="TState">The type of the state passed to the scheduled action.</typeparam>
- /// <param name="state">Initial state passed to the action upon the first iteration.</param>
- /// <param name="period">Period for running the work periodically.</param>
- /// <param name="action">Action to be executed, potentially updating the state.</param>
- /// <returns>The disposable object used to cancel the scheduled recurring action (best effort).</returns>
- /// <exception cref="ArgumentNullException"><paramref name="action"/> is null.</exception>
- /// <exception cref="ArgumentOutOfRangeException"><paramref name="period"/> is less than TimeSpan.Zero.</exception>
- public IDisposable SchedulePeriodic<TState>(TState state, TimeSpan period, Func<TState, TState> action)
- {
- if (period < TimeSpan.Zero)
- throw new ArgumentOutOfRangeException("period");
- if (action == null)
- throw new ArgumentNullException("action");
-
-#if !NO_TASK_DELAY
- var cancel = new CancellationDisposable();
-
- var state1 = state;
- var gate = new AsyncLock();
-
- var moveNext = default(Action);
- moveNext = () =>
- {
- Task.Delay(period, cancel.Token).ContinueWith(
- _ =>
- {
- moveNext();
-
- gate.Wait(() =>
- {
- state1 = action(state1);
- });
- },
- CancellationToken.None, TaskContinuationOptions.ExecuteSynchronously | TaskContinuationOptions.OnlyOnRanToCompletion, taskFactory.Scheduler
- );
- };
-
- moveNext();
-
- return new CompositeDisposable(cancel, gate);
-#else
- var state1 = state;
- var gate = new AsyncLock();
-
- var timer = ConcurrencyAbstractionLayer.Current.StartPeriodicTimer(() =>
- {
- taskFactory.StartNew(() =>
- {
- gate.Wait(() =>
- {
- state1 = action(state1);
- });
- });
- }, period);
-
- return new CompositeDisposable(timer, gate);
-#endif
- }
- }
-}
-#endif
diff --git a/Rx.NET/System.Reactive.PlatformServices/Reactive/Concurrency/Thread.Stub.cs b/Rx.NET/System.Reactive.PlatformServices/Reactive/Concurrency/Thread.Stub.cs
deleted file mode 100644
index 691365b..0000000
--- a/Rx.NET/System.Reactive.PlatformServices/Reactive/Concurrency/Thread.Stub.cs
+++ /dev/null
@@ -1,34 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if NO_THREAD
-using System;
-using System.Threading;
-
-namespace System.Reactive.Concurrency
-{
- class Thread
- {
- private readonly ThreadStart _start;
-
- public Thread(ThreadStart start)
- {
- _start = start;
- }
-
- public string Name { get; set; }
- public bool IsBackground { get; set; }
-
- public void Start()
- {
- System.Threading.Tasks.Task.Factory.StartNew(Run, System.Threading.Tasks.TaskCreationOptions.LongRunning);
- }
-
- private void Run()
- {
- _start();
- }
- }
-
- delegate void ThreadStart();
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.PlatformServices/Reactive/Concurrency/ThreadPoolScheduler.Windows.cs b/Rx.NET/System.Reactive.PlatformServices/Reactive/Concurrency/ThreadPoolScheduler.Windows.cs
deleted file mode 100644
index 1b8579d..0000000
--- a/Rx.NET/System.Reactive.PlatformServices/Reactive/Concurrency/ThreadPoolScheduler.Windows.cs
+++ /dev/null
@@ -1,185 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if WINDOWS
-using System.Reactive.Concurrency;
-using System.Reactive.Disposables;
-using Windows.System.Threading;
-
-namespace System.Reactive.Concurrency
-{
- /// <summary>
- /// Represents an object that schedules units of work on the Windows Runtime thread pool.
- /// </summary>
- /// <seealso cref="ThreadPoolScheduler.Default">Singleton instance of this type exposed through this static property.</seealso>
- [CLSCompliant(false)]
- public sealed class ThreadPoolScheduler : LocalScheduler, ISchedulerPeriodic
- {
- private readonly WorkItemPriority _priority;
- private readonly WorkItemOptions _options;
- private static Lazy<ThreadPoolScheduler> s_default = new Lazy<ThreadPoolScheduler>(() => new ThreadPoolScheduler());
-
- /// <summary>
- /// Constructs a ThreadPoolScheduler that schedules units of work on the Windows ThreadPool.
- /// </summary>
- public ThreadPoolScheduler()
- {
- }
-
- /// <summary>
- /// Constructs a ThreadPoolScheduler that schedules units of work on the Windows ThreadPool with the given priority.
- /// </summary>
- /// <param name="priority">Priority for scheduled units of work.</param>
- public ThreadPoolScheduler(WorkItemPriority priority)
- {
- _priority = priority;
- _options = WorkItemOptions.None;
- }
-
- /// <summary>
- /// Constructs a ThreadPoolScheduler that schedules units of work on the Windows ThreadPool with the given priority.
- /// </summary>
- /// <param name="priority">Priority for scheduled units of work.</param>
- /// <param name="options">Options that configure how work is scheduled.</param>
- public ThreadPoolScheduler(WorkItemPriority priority, WorkItemOptions options)
- {
- _priority = priority;
- _options = options;
- }
-
- /// <summary>
- /// Gets the singleton instance of the Windows Runtime thread pool scheduler.
- /// </summary>
- public static ThreadPoolScheduler Default
- {
- get
- {
- return s_default.Value;
- }
- }
-
- /// <summary>
- /// Gets the priority at which work is scheduled.
- /// </summary>
- public WorkItemPriority Priority
- {
- get { return _priority; }
- }
-
- /// <summary>
- /// Gets the options that configure how work is scheduled.
- /// </summary>
- public WorkItemOptions Options
- {
- get { return _options; }
- }
-
- /// <summary>
- /// Schedules an action to be executed.
- /// </summary>
- /// <typeparam name="TState">The type of the state passed to the scheduled action.</typeparam>
- /// <param name="state">State passed to the action to be executed.</param>
- /// <param name="action">Action to be executed.</param>
- /// <returns>The disposable object used to cancel the scheduled action (best effort).</returns>
- /// <exception cref="ArgumentNullException"><paramref name="action"/> is null.</exception>
- public override IDisposable Schedule<TState>(TState state, Func<IScheduler, TState, IDisposable> action)
- {
- if (action == null)
- throw new ArgumentNullException("action");
-
- var d = new SingleAssignmentDisposable();
-
- var res = global::Windows.System.Threading.ThreadPool.RunAsync(iaa =>
- {
- if (!d.IsDisposed)
- d.Disposable = action(this, state);
- }, _priority, _options);
-
- return new CompositeDisposable(
- d,
- Disposable.Create(res.Cancel)
- );
- }
-
- /// <summary>
- /// Schedules an action to be executed after dueTime, using a Windows.System.Threading.ThreadPoolTimer object.
- /// </summary>
- /// <typeparam name="TState">The type of the state passed to the scheduled action.</typeparam>
- /// <param name="state">State passed to the action to be executed.</param>
- /// <param name="action">Action to be executed.</param>
- /// <param name="dueTime">Relative time after which to execute the action.</param>
- /// <returns>The disposable object used to cancel the scheduled action (best effort).</returns>
- /// <exception cref="ArgumentNullException"><paramref name="action"/> is null.</exception>
- public override IDisposable Schedule<TState>(TState state, TimeSpan dueTime, Func<IScheduler, TState, IDisposable> action)
- {
- if (action == null)
- throw new ArgumentNullException("action");
-
- var dt = Scheduler.Normalize(dueTime);
-
- if (dt.Ticks == 0)
- return Schedule(state, action);
-
- var d = new SingleAssignmentDisposable();
-
- var res = global::Windows.System.Threading.ThreadPoolTimer.CreateTimer(
- tpt =>
- {
- if (!d.IsDisposed)
- d.Disposable = action(this, state);
- },
- dt
- );
-
- return new CompositeDisposable(
- d,
- Disposable.Create(res.Cancel)
- );
- }
-
- /// <summary>
- /// Schedules a periodic piece of work, using a Windows.System.Threading.ThreadPoolTimer object.
- /// </summary>
- /// <typeparam name="TState">The type of the state passed to the scheduled action.</typeparam>
- /// <param name="state">Initial state passed to the action upon the first iteration.</param>
- /// <param name="period">Period for running the work periodically.</param>
- /// <param name="action">Action to be executed, potentially updating the state.</param>
- /// <returns>The disposable object used to cancel the scheduled recurring action (best effort).</returns>
- /// <exception cref="ArgumentNullException"><paramref name="action"/> is null.</exception>
- /// <exception cref="ArgumentOutOfRangeException"><paramref name="period"/> is less than one millisecond.</exception>
- public IDisposable SchedulePeriodic<TState>(TState state, TimeSpan period, Func<TState, TState> action)
- {
- //
- // The WinRT thread pool is based on the Win32 thread pool and cannot handle
- // sub-1ms resolution. When passing a lower period, we get single-shot
- // timer behavior instead. See MSDN documentation for CreatePeriodicTimer
- // for more information.
- //
- if (period < TimeSpan.FromMilliseconds(1))
- throw new ArgumentOutOfRangeException("period", Strings_PlatformServices.WINRT_NO_SUB1MS_TIMERS);
- if (action == null)
- throw new ArgumentNullException("action");
-
- var state1 = state;
- var gate = new AsyncLock();
-
- var res = global::Windows.System.Threading.ThreadPoolTimer.CreatePeriodicTimer(
- tpt =>
- {
- gate.Wait(() =>
- {
- state1 = action(state1);
- });
- },
- period
- );
-
- return Disposable.Create(() =>
- {
- res.Cancel();
- gate.Dispose();
- action = Stubs<TState>.I;
- });
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.PlatformServices/Reactive/Concurrency/ThreadPoolScheduler.cs b/Rx.NET/System.Reactive.PlatformServices/Reactive/Concurrency/ThreadPoolScheduler.cs
deleted file mode 100644
index cc2aa15..0000000
--- a/Rx.NET/System.Reactive.PlatformServices/Reactive/Concurrency/ThreadPoolScheduler.cs
+++ /dev/null
@@ -1,303 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !WINDOWS && !NO_THREAD
-using System.Collections.Generic;
-using System.Reactive.Disposables;
-using System.Threading;
-
-namespace System.Reactive.Concurrency
-{
- /// <summary>
- /// Represents an object that schedules units of work on the CLR thread pool.
- /// </summary>
- /// <seealso cref="ThreadPoolScheduler.Instance">Singleton instance of this type exposed through this static property.</seealso>
- public sealed class ThreadPoolScheduler : LocalScheduler, ISchedulerLongRunning, ISchedulerPeriodic
- {
- private static readonly ThreadPoolScheduler s_instance = new ThreadPoolScheduler();
-
- /// <summary>
- /// Gets the singleton instance of the CLR thread pool scheduler.
- /// </summary>
- public static ThreadPoolScheduler Instance
- {
- get
- {
- return s_instance;
- }
- }
-
- ThreadPoolScheduler()
- {
- }
-
- /// <summary>
- /// Schedules an action to be executed.
- /// </summary>
- /// <typeparam name="TState">The type of the state passed to the scheduled action.</typeparam>
- /// <param name="state">State passed to the action to be executed.</param>
- /// <param name="action">Action to be executed.</param>
- /// <returns>The disposable object used to cancel the scheduled action (best effort).</returns>
- /// <exception cref="ArgumentNullException"><paramref name="action"/> is null.</exception>
- public override IDisposable Schedule<TState>(TState state, Func<IScheduler, TState, IDisposable> action)
- {
- if (action == null)
- throw new ArgumentNullException("action");
-
- var d = new SingleAssignmentDisposable();
-
- ThreadPool.QueueUserWorkItem(_ =>
- {
- if (!d.IsDisposed)
- d.Disposable = action(this, state);
- }, null);
-
- return d;
- }
-
- /// <summary>
- /// Schedules an action to be executed after dueTime, using a System.Threading.Timer object.
- /// </summary>
- /// <typeparam name="TState">The type of the state passed to the scheduled action.</typeparam>
- /// <param name="state">State passed to the action to be executed.</param>
- /// <param name="action">Action to be executed.</param>
- /// <param name="dueTime">Relative time after which to execute the action.</param>
- /// <returns>The disposable object used to cancel the scheduled action (best effort).</returns>
- /// <exception cref="ArgumentNullException"><paramref name="action"/> is null.</exception>
- public override IDisposable Schedule<TState>(TState state, TimeSpan dueTime, Func<IScheduler, TState, IDisposable> action)
- {
- if (action == null)
- throw new ArgumentNullException("action");
-
- var dt = Scheduler.Normalize(dueTime);
- if (dt.Ticks == 0)
- return Schedule(state, action);
-
- return new Timer<TState>(this, state, dt, action);
- }
-
- /// <summary>
- /// Schedules a long-running task by creating a new thread. Cancellation happens through polling.
- /// </summary>
- /// <typeparam name="TState">The type of the state passed to the scheduled action.</typeparam>
- /// <param name="state">State passed to the action to be executed.</param>
- /// <param name="action">Action to be executed.</param>
- /// <returns>The disposable object used to cancel the scheduled action (best effort).</returns>
- /// <exception cref="ArgumentNullException"><paramref name="action"/> is null.</exception>
- public IDisposable ScheduleLongRunning<TState>(TState state, Action<TState, ICancelable> action)
- {
- if (action == null)
- throw new ArgumentNullException("action");
-
- return NewThreadScheduler.Default.ScheduleLongRunning(state, action);
- }
-
-#if !NO_STOPWATCH
- /// <summary>
- /// Starts a new stopwatch object.
- /// </summary>
- /// <returns>New stopwatch object; started at the time of the request.</returns>
- public override IStopwatch StartStopwatch()
- {
- //
- // Strictly speaking, this explicit override is not necessary because the base implementation calls into
- // the enlightenment module to obtain the CAL, which would circle back to System.Reactive.PlatformServices
- // where we're currently running. This is merely a short-circuit to avoid the additional roundtrip.
- //
- return new StopwatchImpl();
- }
-#endif
-
- /// <summary>
- /// Schedules a periodic piece of work, using a System.Threading.Timer object.
- /// </summary>
- /// <typeparam name="TState">The type of the state passed to the scheduled action.</typeparam>
- /// <param name="state">Initial state passed to the action upon the first iteration.</param>
- /// <param name="period">Period for running the work periodically.</param>
- /// <param name="action">Action to be executed, potentially updating the state.</param>
- /// <returns>The disposable object used to cancel the scheduled recurring action (best effort).</returns>
- /// <exception cref="ArgumentNullException"><paramref name="action"/> is null.</exception>
- /// <exception cref="ArgumentOutOfRangeException"><paramref name="period"/> is less than or equal to zero.</exception>
- public IDisposable SchedulePeriodic<TState>(TState state, TimeSpan period, Func<TState, TState> action)
- {
- //
- // MSDN documentation states the following:
- //
- // "If period is zero (0) or negative one (-1) milliseconds and dueTime is positive, callback is invoked once;
- // the periodic behavior of the timer is disabled, but can be re-enabled using the Change method."
- //
- if (period <= TimeSpan.Zero)
- throw new ArgumentOutOfRangeException("period");
- if (action == null)
- throw new ArgumentNullException("action");
-
- return new PeriodicTimer<TState>(state, period, action);
- }
-
- abstract class Timer
- {
- //
- // Note: the dictionary exists to "root" the timers so that they are not garbage collected and finalized while they are running.
- //
-#if !NO_HASHSET
- protected static readonly HashSet<System.Threading.Timer> s_timers = new HashSet<System.Threading.Timer>();
-#else
- protected static readonly Dictionary<System.Threading.Timer, object> s_timers = new Dictionary<System.Threading.Timer, object>();
-#endif
- }
-
- sealed class Timer<TState> : Timer, IDisposable
- {
- private readonly MultipleAssignmentDisposable _disposable;
-
- private readonly IScheduler _parent;
- private readonly TState _state;
-
- private Func<IScheduler, TState, IDisposable> _action;
- private System.Threading.Timer _timer;
-
- private bool _hasAdded;
- private bool _hasRemoved;
-
- public Timer(IScheduler parent, TState state, TimeSpan dueTime, Func<IScheduler, TState, IDisposable> action)
- {
- _disposable = new MultipleAssignmentDisposable();
- _disposable.Disposable = Disposable.Create(Unroot);
-
- _parent = parent;
- _state = state;
-
- _action = action;
- _timer = new System.Threading.Timer(Tick, null, dueTime, TimeSpan.FromMilliseconds(System.Threading.Timeout.Infinite));
-
- lock (s_timers)
- {
- if (!_hasRemoved)
- {
-#if !NO_HASHSET
- s_timers.Add(_timer);
-#else
- s_timers.Add(_timer, null);
-#endif
-
- _hasAdded = true;
- }
- }
- }
-
- private void Tick(object state)
- {
- try
- {
- _disposable.Disposable = _action(_parent, _state);
- }
- finally
- {
- Unroot();
- }
- }
-
- private void Unroot()
- {
- _action = Nop;
-
- var timer = default(System.Threading.Timer);
-
- lock (s_timers)
- {
- if (!_hasRemoved)
- {
- timer = _timer;
- _timer = null;
-
- if (_hasAdded && timer != null)
- s_timers.Remove(timer);
-
- _hasRemoved = true;
- }
- }
-
- if (timer != null)
- timer.Dispose();
- }
-
- private IDisposable Nop(IScheduler scheduler, TState state)
- {
- return Disposable.Empty;
- }
-
- public void Dispose()
- {
- _disposable.Dispose();
- }
- }
-
- abstract class PeriodicTimer
- {
- //
- // Note: the dictionary exists to "root" the timers so that they are not garbage collected and finalized while they are running.
- //
-#if !NO_HASHSET
- protected static readonly HashSet<System.Threading.Timer> s_timers = new HashSet<System.Threading.Timer>();
-#else
- protected static readonly Dictionary<System.Threading.Timer, object> s_timers = new Dictionary<System.Threading.Timer, object>();
-#endif
- }
-
- sealed class PeriodicTimer<TState> : PeriodicTimer, IDisposable
- {
- private readonly AsyncLock _gate;
-
- private TState _state;
- private Func<TState, TState> _action;
- private System.Threading.Timer _timer;
-
- public PeriodicTimer(TState state, TimeSpan period, Func<TState, TState> action)
- {
- _gate = new AsyncLock();
-
- _state = state;
- _action = action;
- _timer = new System.Threading.Timer(Tick, null, period, period);
-
- lock (s_timers)
- {
-#if !NO_HASHSET
- s_timers.Add(_timer);
-#else
- s_timers.Add(_timer, null);
-#endif
- }
- }
-
- private void Tick(object state)
- {
- _gate.Wait(() =>
- {
- _state = _action(_state);
- });
- }
-
- public void Dispose()
- {
- var timer = default(System.Threading.Timer);
-
- lock (s_timers)
- {
- timer = _timer;
- _timer = null;
-
- if (timer != null)
- s_timers.Remove(timer);
- }
-
- if (timer != null)
- {
- timer.Dispose();
- _gate.Dispose();
- _action = Stubs<TState>.I;
- }
- }
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.PlatformServices/Reactive/EnlightenmentProvider.cs b/Rx.NET/System.Reactive.PlatformServices/Reactive/EnlightenmentProvider.cs
deleted file mode 100644
index bdacdc7..0000000
--- a/Rx.NET/System.Reactive.PlatformServices/Reactive/EnlightenmentProvider.cs
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System.Reactive.Concurrency;
-
-namespace System.Reactive.PlatformServices
-{
- /// <summary>
- /// Provides access to the platform enlightenments used by other Rx libraries to improve system performance and
- /// runtime efficiency. While Rx can run without platform enlightenments loaded, it's recommended to deploy the
- /// System.Reactive.PlatformServices assembly with your application and call <see cref="EnlightenmentProvider.
- /// EnsureLoaded"/> during application startup to ensure enlightenments are properly loaded.
- /// </summary>
- public static class EnlightenmentProvider
- {
- /// <summary>
- /// Ensures that the calling assembly has a reference to the System.Reactive.PlatformServices assembly with
- /// platform enlightenments. If no reference is made from the user code, it's possible for the build process
- /// to drop the deployment of System.Reactive.PlatformServices, preventing its runtime discovery.
- /// </summary>
- /// <returns>
- /// true if the loaded enlightenment provider matches the provided defined in the current assembly; false
- /// otherwise. When a custom enlightenment provider is installed by the host, false will be returned.
- /// </returns>
- public static bool EnsureLoaded()
- {
- return PlatformEnlightenmentProvider.Current is CurrentPlatformEnlightenmentProvider;
- }
- }
-}
diff --git a/Rx.NET/System.Reactive.PlatformServices/Reactive/Internal/ExceptionServicesImpl.cs b/Rx.NET/System.Reactive.PlatformServices/Reactive/Internal/ExceptionServicesImpl.cs
deleted file mode 100644
index 6d14651..0000000
--- a/Rx.NET/System.Reactive.PlatformServices/Reactive/Internal/ExceptionServicesImpl.cs
+++ /dev/null
@@ -1,19 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if HAS_EDI
-namespace System.Reactive.PlatformServices
-{
- //
- // WARNING: This code is kept *identically* in two places. One copy is kept in System.Reactive.Core for non-PLIB platforms.
- // Another copy is kept in System.Reactive.PlatformServices to enlighten the default lowest common denominator
- // behavior of Rx for PLIB when used on a more capable platform.
- //
- internal class /*Default*/ExceptionServicesImpl : IExceptionServices
- {
- public void Rethrow(Exception exception)
- {
- System.Runtime.ExceptionServices.ExceptionDispatchInfo.Capture(exception).Throw();
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.PlatformServices/Reactive/Internal/HostLifecycleNotifications.Windows.cs b/Rx.NET/System.Reactive.PlatformServices/Reactive/Internal/HostLifecycleNotifications.Windows.cs
deleted file mode 100644
index c70bf17..0000000
--- a/Rx.NET/System.Reactive.PlatformServices/Reactive/Internal/HostLifecycleNotifications.Windows.cs
+++ /dev/null
@@ -1,43 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if WINDOWS
-using Windows.ApplicationModel;
-using Windows.ApplicationModel.Core;
-
-namespace System.Reactive.PlatformServices
-{
- internal class HostLifecycleNotifications : IHostLifecycleNotifications
- {
- private EventHandler<SuspendingEventArgs> _suspending;
- private EventHandler<object> _resuming;
-
- public event EventHandler<HostSuspendingEventArgs> Suspending
- {
- add
- {
- _suspending = (o, e) => value(o, new HostSuspendingEventArgs());
- CoreApplication.Suspending += _suspending;
- }
-
- remove
- {
- CoreApplication.Suspending -= _suspending;
- }
- }
-
- public event EventHandler<HostResumingEventArgs> Resuming
- {
- add
- {
- _resuming = (o, e) => value(o, new HostResumingEventArgs());
- CoreApplication.Resuming += _resuming;
- }
-
- remove
- {
- CoreApplication.Resuming -= _resuming;
- }
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.PlatformServices/Reactive/Internal/HostLifecycleNotifications.WindowsPhone.cs b/Rx.NET/System.Reactive.PlatformServices/Reactive/Internal/HostLifecycleNotifications.WindowsPhone.cs
deleted file mode 100644
index 30a32e7..0000000
--- a/Rx.NET/System.Reactive.PlatformServices/Reactive/Internal/HostLifecycleNotifications.WindowsPhone.cs
+++ /dev/null
@@ -1,63 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if WINDOWSPHONE7
-
-#if DEBUG_NO_AGENT_SUPPORT
-using Microsoft.Phone.Shell;
-#else
-using System.Reactive.PlatformServices.Phone.Shell;
-#endif
-
-namespace System.Reactive.PlatformServices
-{
- internal class HostLifecycleNotifications : IHostLifecycleNotifications
- {
- private EventHandler<ActivatedEventArgs> _activated;
- private EventHandler<DeactivatedEventArgs> _deactivated;
-
- public event EventHandler<HostSuspendingEventArgs> Suspending
- {
- add
- {
- _deactivated = (o, e) => value(o, new HostSuspendingEventArgs());
-
- var current = PhoneApplicationService.Current;
- if (current != null)
- current.Deactivated += _deactivated;
- }
-
- remove
- {
- var current = PhoneApplicationService.Current;
- if (current != null)
- current.Deactivated -= _deactivated;
- }
- }
-
- public event EventHandler<HostResumingEventArgs> Resuming
- {
- add
- {
- _activated = (o, e) =>
- {
- if (e.IsApplicationInstancePreserved)
- {
- value(o, new HostResumingEventArgs());
- }
- };
-
- var current = PhoneApplicationService.Current;
- if (current != null)
- current.Activated += _activated;
- }
-
- remove
- {
- var current = PhoneApplicationService.Current;
- if (current != null)
- current.Activated -= _activated;
- }
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.PlatformServices/Reactive/Internal/PhoneShellThunks.cs b/Rx.NET/System.Reactive.PlatformServices/Reactive/Internal/PhoneShellThunks.cs
deleted file mode 100644
index 3ce1b22..0000000
--- a/Rx.NET/System.Reactive.PlatformServices/Reactive/Internal/PhoneShellThunks.cs
+++ /dev/null
@@ -1,214 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if WINDOWSPHONE7
-#if !DEBUG_NO_AGENT_SUPPORT
-//
-// The Windows Phone Marketplace Test Kit disallows usage of types
-// in the Microsoft.Phone.Shell namespace, determined by static code
-// analysis, for background agents.
-//
-// However, with a null check for PhoneApplicationService.Current,
-// we can safely use this the lifecycle events for dormant state
-// transitions. In a background agent this property will be null;
-// trying to create an instance of PhoneApplicationService throws
-// a ComException and is required to set the Current property.
-//
-// In order to access the PhoneApplicationService functionality for
-// non-background agent assemblies, we build a late bound wrapper
-// around the APIs.
-//
-// See appplat\src\Frameworks\Microsoft\Phone\PhoneApplicationService.cs
-// for implementation details of the class we use.
-//
-namespace System.Reactive.PlatformServices.Phone.Shell
-{
- using System;
- using System.Collections.Generic;
- using System.Linq.Expressions;
- using System.Reflection;
- using Microsoft.Phone;
-
- class PhoneApplicationService
- {
- private static readonly object s_gate = new object();
- internal static readonly Assembly s_phshAsm;
- private static readonly Type s_pasType;
- private static readonly PropertyInfo s_curProp;
- private static readonly EventInfo s_actdEvt;
- private static readonly EventInfo s_deacEvt;
-
- private readonly object _target;
-
- static PhoneApplicationService()
- {
- s_phshAsm = typeof(BackgroundAgent).Assembly; // Has to be in Microsoft.Phone.dll.
- s_pasType = s_phshAsm.GetType("Microsoft.Phone.Shell.PhoneApplicationService");
- s_curProp = s_pasType.GetProperty("Current", BindingFlags.Public | BindingFlags.Static);
- s_actdEvt = s_curProp.PropertyType.GetEvent("Activated", BindingFlags.Public | BindingFlags.Instance);
- s_deacEvt = s_curProp.PropertyType.GetEvent("Deactivated", BindingFlags.Public | BindingFlags.Instance);
- }
-
- private PhoneApplicationService(object target)
- {
- _target = target;
- }
-
- private static PhoneApplicationService s_current;
-
- public static PhoneApplicationService Current
- {
- get
- {
- lock (s_gate)
- {
- if (s_current == null)
- {
- var current = s_curProp.GetValue(null, null);
- if (current == null)
- return null;
-
- //
- // Current provides a singleton. The constructor
- // of PhoneApplicationService guarantees this,
- // throwing an InvalidOperationException if more
- // than one instance is created.
- //
- s_current = new PhoneApplicationService(current);
- }
- }
-
- return s_current;
- }
- }
-
- private Dictionary<object, object> _actdHandlers = new Dictionary<object, object>();
-
- public event EventHandler<ActivatedEventArgs> Activated
- {
- add
- {
- AddHandler<ActivatedEventArgs>(s_actdEvt, _actdHandlers, value);
- }
-
- remove
- {
- RemoveHandler(s_actdEvt, _actdHandlers, value);
- }
- }
-
- private Dictionary<object, object> _deacHandlers = new Dictionary<object, object>();
-
- public event EventHandler<DeactivatedEventArgs> Deactivated
- {
- add
- {
- AddHandler<DeactivatedEventArgs>(s_deacEvt, _deacHandlers, value);
- }
-
- remove
- {
- RemoveHandler(s_deacEvt, _deacHandlers, value);
- }
- }
-
- private void AddHandler<TEventArgs>(EventInfo evt, Dictionary<object, object> map, object handler)
- where TEventArgs : EventArgs
- {
- var h = GetHandler<TEventArgs>(evt, handler);
- var add = evt.GetAddMethod();
-
- lock (s_gate)
- {
- map.Add(handler, h);
- add.Invoke(_target, new object[] { h });
- }
- }
-
- private void RemoveHandler(EventInfo evt, Dictionary<object, object> map, object handler)
- {
- var rem = evt.GetRemoveMethod();
-
- lock (s_gate)
- {
- var h = default(object);
- if (map.TryGetValue(handler, out h))
- {
- //
- // We assume only one handler will be attached to
- // the event, hence we shouldn't worry about having
- // multiple delegate instances with the same target
- // being attached. This guarantee is made by the
- // reference counting in HostLifecycleService.
- //
- // The use of a dictionary allows for reuse with
- // multiple distinct handlers going forward.
- //
- map.Remove(handler);
- rem.Invoke(_target, new object[] { h });
- }
- }
- }
-
- private static object GetHandler<TEventArgsThunk>(EventInfo evt, object call)
- where TEventArgsThunk : EventArgs
- {
- var ht = evt.EventHandlerType;
- var hp = ht.GetMethod("Invoke").GetParameters();
-
- var po = Expression.Parameter(hp[0].ParameterType, hp[0].Name);
- var pe = Expression.Parameter(hp[1].ParameterType, hp[1].Name);
-
- var h = Expression.Lambda(
- ht,
- Expression.Invoke(
- Expression.Constant(call),
- po,
- Expression.New(
- typeof(TEventArgsThunk).GetConstructor(new[] { typeof(object) }),
- pe
- )
- ),
- po,
- pe
- );
-
- return h.Compile();
- }
- }
-
- class ActivatedEventArgs : EventArgs
- {
- private static readonly Type s_aeaType;
- private static readonly PropertyInfo s_aipProp;
-
- private readonly object _target;
-
- static ActivatedEventArgs()
- {
- s_aeaType = PhoneApplicationService.s_phshAsm.GetType("Microsoft.Phone.Shell.ActivatedEventArgs");
- s_aipProp = s_aeaType.GetProperty("IsApplicationInstancePreserved", BindingFlags.Public | BindingFlags.Instance);
- }
-
- public ActivatedEventArgs(object target)
- {
- _target = target;
- }
-
- public bool IsApplicationInstancePreserved
- {
- get
- {
- return (bool)s_aipProp.GetValue(_target, null);
- }
- }
- }
-
- class DeactivatedEventArgs : EventArgs
- {
- public DeactivatedEventArgs(object target)
- {
- }
- }
-}
-#endif
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.PlatformServices/Reactive/Internal/PlatformEnlightenmentProvider.cs b/Rx.NET/System.Reactive.PlatformServices/Reactive/Internal/PlatformEnlightenmentProvider.cs
deleted file mode 100644
index 7bb597c..0000000
--- a/Rx.NET/System.Reactive.PlatformServices/Reactive/Internal/PlatformEnlightenmentProvider.cs
+++ /dev/null
@@ -1,109 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-//
-// WARNING: The full namespace-qualified type name should stay the same for the discovery in System.Reactive.Core to work!
-//
-using System.ComponentModel;
-using System.Diagnostics;
-using System.Reactive;
-using System.Reactive.Concurrency;
-using System.Reactive.Linq;
-using System.Reflection;
-
-namespace System.Reactive.PlatformServices
-{
- /// <summary>
- /// (Infrastructure) Provider for platform-specific framework enlightenments.
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public class CurrentPlatformEnlightenmentProvider : IPlatformEnlightenmentProvider
- {
- /// <summary>
- /// (Infastructure) Tries to gets the specified service.
- /// </summary>
- /// <typeparam name="T">Service type.</typeparam>
- /// <param name="args">Optional set of arguments.</param>
- /// <returns>Service instance or null if not found.</returns>
- public virtual T GetService<T>(object[] args) where T : class
- {
- var t = typeof(T);
-
-#if HAS_EDI
- if (t == typeof(IExceptionServices))
- {
- return (T)(object)new ExceptionServicesImpl();
- }
-#endif
-
-#if !NO_THREAD || WINDOWS
- if (t == typeof(IConcurrencyAbstractionLayer))
- {
- return (T)(object)new ConcurrencyAbstractionLayerImpl();
- }
-#endif
-
- if (t == typeof(IScheduler) && args != null)
- {
- switch ((string)args[0])
- {
-#if !WINDOWS && !NO_THREAD
- case "ThreadPool":
- return (T)(object)ThreadPoolScheduler.Instance;
-#elif WINDOWS
- case "ThreadPool":
- return (T)(object)ThreadPoolScheduler.Default;
-#endif
-#if !NO_TPL
- case "TaskPool":
- return (T)(object)TaskPoolScheduler.Default;
-#endif
- case "NewThread":
- return (T)(object)NewThreadScheduler.Default;
- }
- }
-
-#if WINDOWS || WINDOWSPHONE7
- if (t == typeof(IHostLifecycleNotifications))
- {
- return (T)(object)new HostLifecycleNotifications();
- }
-#endif
-
- if (t == typeof(IQueryServices))
- {
- //
- // We perform this Debugger.IsAttached check early rather than deferring
- // the decision to intercept query operator methods to the debugger
- // assembly that's dynamically discovered here. Also, it's a reasonable
- // expectation it'd be pretty hard to turn on interception dynamically
- // upon a debugger attach event, so we should make this check early.
- //
- // In the initial release of v2.0 (RTM), we won't have the corresponding
- // debugger assembly available yet, so the dynamic load would always
- // fail. We also don't want to take the price of (an attempt to) a dynamic
- // assembly load for the regular production case.
- //
- if (Debugger.IsAttached)
- {
-#if NETCF35
- var name = "System.Reactive.Linq.QueryDebugger, System.Reactive.Debugger";
-#else
-#if CRIPPLED_REFLECTION
- var ifType = t.GetTypeInfo();
-#else
- var ifType = t;
-#endif
- var asm = new AssemblyName(ifType.Assembly.FullName);
- asm.Name = "System.Reactive.Debugger";
- var name = "System.Reactive.Linq.QueryDebugger, " + asm.FullName;
-#endif
- var dbg = Type.GetType(name, false);
- if (dbg != null)
- return (T)(object)Activator.CreateInstance(dbg);
- }
- }
-
- return null;
- }
- }
-}
diff --git a/Rx.NET/System.Reactive.PlatformServices/Reactive/Internal/StopwatchImpl.cs b/Rx.NET/System.Reactive.PlatformServices/Reactive/Internal/StopwatchImpl.cs
deleted file mode 100644
index 04a4040..0000000
--- a/Rx.NET/System.Reactive.PlatformServices/Reactive/Internal/StopwatchImpl.cs
+++ /dev/null
@@ -1,28 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_STOPWATCH
-using System.Diagnostics;
-
-namespace System.Reactive.Concurrency
-{
- //
- // WARNING: This code is kept *identically* in two places. One copy is kept in System.Reactive.Core for non-PLIB platforms.
- // Another copy is kept in System.Reactive.PlatformServices to enlighten the default lowest common denominator
- // behavior of Rx for PLIB when used on a more capable platform.
- //
- internal class /*Default*/StopwatchImpl : IStopwatch
- {
- private readonly Stopwatch _sw;
-
- public StopwatchImpl()
- {
- _sw = Stopwatch.StartNew();
- }
-
- public TimeSpan Elapsed
- {
- get { return _sw.Elapsed; }
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.PlatformServices/Strings_PlatformServices.Designer.cs b/Rx.NET/System.Reactive.PlatformServices/Strings_PlatformServices.Designer.cs
deleted file mode 100644
index 547938f..0000000
--- a/Rx.NET/System.Reactive.PlatformServices/Strings_PlatformServices.Designer.cs
+++ /dev/null
@@ -1,72 +0,0 @@
-//------------------------------------------------------------------------------
-// <auto-generated>
-// This code was generated by a tool.
-// Runtime Version:4.0.30319.17626
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-// </auto-generated>
-//------------------------------------------------------------------------------
-
-namespace System.Reactive {
- using System;
-
-
- /// <summary>
- /// A strongly-typed resource class, for looking up localized strings, etc.
- /// </summary>
- // This class was auto-generated by the StronglyTypedResourceBuilder
- // class via a tool like ResGen or Visual Studio.
- // To add or remove a member, edit your .ResX file then rerun ResGen
- // with the /str option, or rebuild your VS project.
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- internal class Strings_PlatformServices {
-
- private static global::System.Resources.ResourceManager resourceMan;
-
- private static global::System.Globalization.CultureInfo resourceCulture;
-
- [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
- internal Strings_PlatformServices() {
- }
-
- /// <summary>
- /// Returns the cached ResourceManager instance used by this class.
- /// </summary>
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Resources.ResourceManager ResourceManager {
- get {
- if (object.ReferenceEquals(resourceMan, null)) {
- global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("System.Reactive.Strings_PlatformServices", typeof(Strings_PlatformServices).Assembly);
- resourceMan = temp;
- }
- return resourceMan;
- }
- }
-
- /// <summary>
- /// Overrides the current thread's CurrentUICulture property for all
- /// resource lookups using this strongly typed resource class.
- /// </summary>
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Globalization.CultureInfo Culture {
- get {
- return resourceCulture;
- }
- set {
- resourceCulture = value;
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to The WinRT thread pool doesn&apos;t support creating periodic timers with a period below 1 millisecond..
- /// </summary>
- internal static string WINRT_NO_SUB1MS_TIMERS {
- get {
- return ResourceManager.GetString("WINRT_NO_SUB1MS_TIMERS", resourceCulture);
- }
- }
- }
-}
diff --git a/Rx.NET/System.Reactive.PlatformServices/Strings_PlatformServices.Generated.cs b/Rx.NET/System.Reactive.PlatformServices/Strings_PlatformServices.Generated.cs
deleted file mode 100644
index b9330af..0000000
--- a/Rx.NET/System.Reactive.PlatformServices/Strings_PlatformServices.Generated.cs
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * This file is manually generated upon every change to the corresponding .resx file, using the built-in code generator.
- * However, we can't use auto-generated code because the output is different for .NET 4.5 for Metro and PLIB, due to
- * changes in the reflection APIs (search for CRIPPLED_REFLECTION in this file), and because regeneration doesn't happen
- * as part of build, but rather at design time in Visual Studio. While we likely could tweak MSBuild to force regeneration
- * using the right version of ResGen.exe, this approach turned out to be the easiest for the time being.
- *
- * Upon adding entries to the ResX file, regenerate this file, put this comment back, and make sure to add the #if checks
- * for conditional use of the right flavor of reflection (using the CRIPPLED_REFLECTION defined symbol).
- */
-
-// Required for the use of the GetTypeInfo extension method.
-#if CRIPPLED_REFLECTION
-using System.Reflection;
-#endif
-
-// GENERATED CODE starts here
-
-namespace System.Reactive
-{
- using System;
-
-
- /// <summary>
- /// A strongly-typed resource class, for looking up localized strings, etc.
- /// </summary>
- // This class was auto-generated by the StronglyTypedResourceBuilder
- // class via a tool like ResGen or Visual Studio.
- // To add or remove a member, edit your .ResX file then rerun ResGen
- // with the /str option, or rebuild your VS project.
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- internal class Strings_PlatformServices
- {
-
- private static global::System.Resources.ResourceManager resourceMan;
-
- private static global::System.Globalization.CultureInfo resourceCulture;
-
- [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
- internal Strings_PlatformServices()
- {
- }
-
- /// <summary>
- /// Returns the cached ResourceManager instance used by this class.
- /// </summary>
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Resources.ResourceManager ResourceManager
- {
- get
- {
- if (object.ReferenceEquals(resourceMan, null))
- {
-#if CRIPPLED_REFLECTION
- global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("System.Reactive.Strings_PlatformServices", typeof(Strings_PlatformServices).GetTypeInfo().Assembly);
-#else
- global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("System.Reactive.Strings_PlatformServices", typeof(Strings_PlatformServices).Assembly);
-#endif
- resourceMan = temp;
- }
- return resourceMan;
- }
- }
-
- /// <summary>
- /// Overrides the current thread's CurrentUICulture property for all
- /// resource lookups using this strongly typed resource class.
- /// </summary>
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Globalization.CultureInfo Culture
- {
- get
- {
- return resourceCulture;
- }
- set
- {
- resourceCulture = value;
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to The WinRT thread pool doesn&apos;t support creating periodic timers with a period below 1 millisecond..
- /// </summary>
- internal static string WINRT_NO_SUB1MS_TIMERS
- {
- get
- {
- return ResourceManager.GetString("WINRT_NO_SUB1MS_TIMERS", resourceCulture);
- }
- }
- }
-}
diff --git a/Rx.NET/System.Reactive.PlatformServices/Strings_PlatformServices.resx b/Rx.NET/System.Reactive.PlatformServices/Strings_PlatformServices.resx
deleted file mode 100644
index f796d0a..0000000
--- a/Rx.NET/System.Reactive.PlatformServices/Strings_PlatformServices.resx
+++ /dev/null
@@ -1,123 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<root>
- <!--
- Microsoft ResX Schema
-
- Version 2.0
-
- The primary goals of this format is to allow a simple XML format
- that is mostly human readable. The generation and parsing of the
- various data types are done through the TypeConverter classes
- associated with the data types.
-
- Example:
-
- ... ado.net/XML headers & schema ...
- <resheader name="resmimetype">text/microsoft-resx</resheader>
- <resheader name="version">2.0</resheader>
- <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
- <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
- <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
- <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
- <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
- <value>[base64 mime encoded serialized .NET Framework object]</value>
- </data>
- <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
- <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
- <comment>This is a comment</comment>
- </data>
-
- There are any number of "resheader" rows that contain simple
- name/value pairs.
-
- Each data row contains a name, and value. The row also contains a
- type or mimetype. Type corresponds to a .NET class that support
- text/value conversion through the TypeConverter architecture.
- Classes that don't support this are serialized and stored with the
- mimetype set.
-
- The mimetype is used for serialized objects, and tells the
- ResXResourceReader how to depersist the object. This is currently not
- extensible. For a given mimetype the value must be set accordingly:
-
- Note - application/x-microsoft.net.object.binary.base64 is the format
- that the ResXResourceWriter will generate, however the reader can
- read any of the formats listed below.
-
- mimetype: application/x-microsoft.net.object.binary.base64
- value : The object must be serialized with
- : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
- : and then encoded with base64 encoding.
-
- mimetype: application/x-microsoft.net.object.soap.base64
- value : The object must be serialized with
- : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
- : and then encoded with base64 encoding.
-
- mimetype: application/x-microsoft.net.object.bytearray.base64
- value : The object must be serialized into a byte array
- : using a System.ComponentModel.TypeConverter
- : and then encoded with base64 encoding.
- -->
- <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
- <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
- <xsd:element name="root" msdata:IsDataSet="true">
- <xsd:complexType>
- <xsd:choice maxOccurs="unbounded">
- <xsd:element name="metadata">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="value" type="xsd:string" minOccurs="0" />
- </xsd:sequence>
- <xsd:attribute name="name" use="required" type="xsd:string" />
- <xsd:attribute name="type" type="xsd:string" />
- <xsd:attribute name="mimetype" type="xsd:string" />
- <xsd:attribute ref="xml:space" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="assembly">
- <xsd:complexType>
- <xsd:attribute name="alias" type="xsd:string" />
- <xsd:attribute name="name" type="xsd:string" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="data">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
- <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
- </xsd:sequence>
- <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
- <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
- <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
- <xsd:attribute ref="xml:space" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="resheader">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
- </xsd:sequence>
- <xsd:attribute name="name" type="xsd:string" use="required" />
- </xsd:complexType>
- </xsd:element>
- </xsd:choice>
- </xsd:complexType>
- </xsd:element>
- </xsd:schema>
- <resheader name="resmimetype">
- <value>text/microsoft-resx</value>
- </resheader>
- <resheader name="version">
- <value>2.0</value>
- </resheader>
- <resheader name="reader">
- <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
- </resheader>
- <resheader name="writer">
- <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
- </resheader>
- <data name="WINRT_NO_SUB1MS_TIMERS" xml:space="preserve">
- <value>The WinRT thread pool doesn't support creating periodic timers with a period below 1 millisecond.</value>
- </data>
-</root> \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.PlatformServices/System.Reactive.PlatformServices.csproj b/Rx.NET/System.Reactive.PlatformServices/System.Reactive.PlatformServices.csproj
deleted file mode 100644
index 8a69c7f..0000000
--- a/Rx.NET/System.Reactive.PlatformServices/System.Reactive.PlatformServices.csproj
+++ /dev/null
@@ -1,74 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <ProductVersion>8.0.30703</ProductVersion>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{0CCCF009-763F-40D2-8655-7A94828023BF}</ProjectGuid>
- <OutputType>Library</OutputType>
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <RootNamespace>System.Reactive</RootNamespace>
- <AssemblyName>System.Reactive.PlatformServices</AssemblyName>
- <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
- <FileAlignment>512</FileAlignment>
- <ProductSignAssembly>true</ProductSignAssembly>
- <CodeAnalysisRuleSet>..\Rx.ruleset</CodeAnalysisRuleSet>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'ReleaseXBLV|AnyCPU'">
- <OutputPath>bin\ReleaseXBLV\</OutputPath>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'DebugXBLV|AnyCPU'">
- <OutputPath>bin\DebugXBLV\</OutputPath>
- </PropertyGroup>
- <Import Project="..\Common.targets" />
- <PropertyGroup>
- <DocumentationFile>$(OutputPath)\$(AssemblyName).XML</DocumentationFile>
- </PropertyGroup>
- <ItemGroup>
- <Reference Include="mscorlib" Condition=" '$(BuildPlatform)' == 'SILVERLIGHT' Or '$(BuildPlatform)' == 'XNA' " />
- <Reference Include="System" />
- <Reference Include="System.Core" />
- <Reference Include="System.Observable" Condition=" '$(BuildFlavor)' == 'SILVERLIGHTM7' " />
- <Reference Include="Microsoft.Phone" Condition=" '$(BuildFlavor)' == 'SILVERLIGHTM7' " />
- <Reference Include="System.Windows" Condition=" '$(BuildFlavor)' == 'SILVERLIGHTM7' " />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="GlobalSuppressions.cs" />
- <Compile Include="Properties\AssemblyInfo.cs" />
- <Compile Include="Reactive\Concurrency\ConcurrencyAbstractionLayerImpl.Windows.cs" />
- <Compile Include="Reactive\Concurrency\EventLoopScheduler.cs" />
- <Compile Include="Reactive\Concurrency\NewThreadScheduler.cs" />
- <Compile Include="Reactive\Concurrency\ConcurrencyAbstractionLayerImpl.cs" />
- <Compile Include="Reactive\Concurrency\Thread.Stub.cs" />
- <Compile Include="Reactive\Concurrency\ThreadPoolScheduler.Windows.cs" />
- <Compile Include="Reactive\EnlightenmentProvider.cs" />
- <Compile Include="Reactive\Internal\HostLifecycleNotifications.WindowsPhone.cs" />
- <Compile Include="Reactive\Internal\HostLifecycleNotifications.Windows.cs" />
- <Compile Include="Reactive\Internal\PhoneShellThunks.cs" />
- <Compile Include="Reactive\Internal\StopwatchImpl.cs" />
- <Compile Include="Reactive\Concurrency\TaskPoolScheduler.cs" />
- <Compile Include="Reactive\Concurrency\ThreadPoolScheduler.cs" />
- <Compile Include="Reactive\Internal\ExceptionServicesImpl.cs" />
- <Compile Include="Reactive\Internal\PlatformEnlightenmentProvider.cs" />
- <Compile Include="Strings_PlatformServices.Generated.cs" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\System.Reactive.Core\System.Reactive.Core.csproj">
- <Project>{4E516F10-DA7A-4D43-963E-A93865ABEA5B}</Project>
- <Name>System.Reactive.Core</Name>
- </ProjectReference>
- <ProjectReference Include="..\System.Reactive.Interfaces\System.Reactive.Interfaces.csproj">
- <Project>{9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}</Project>
- <Name>System.Reactive.Interfaces</Name>
- </ProjectReference>
- <ProjectReference Include="..\System.Reactive.Linq\System.Reactive.Linq.csproj">
- <Project>{63252AE9-5186-45CA-BFCD-FA51C6B66A43}</Project>
- <Name>System.Reactive.Linq</Name>
- </ProjectReference>
- </ItemGroup>
- <ItemGroup>
- <EmbeddedResource Include="Strings_PlatformServices.resx">
- <SubType>Designer</SubType>
- </EmbeddedResource>
- </ItemGroup>
- <Import Project="..\Import.targets" />
-</Project> \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Providers/GlobalSuppressions.cs b/Rx.NET/System.Reactive.Providers/GlobalSuppressions.cs
deleted file mode 100644
index bf74541..0000000
--- a/Rx.NET/System.Reactive.Providers/GlobalSuppressions.cs
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-// This file is used by Code Analysis to maintain SuppressMessage
-// attributes that are applied to this project.
-// Project-level suppressions either have no target or are given
-// a specific target and scoped to a namespace, type, member, etc.
-//
-// To add a suppression to this file, right-click the message in the
-// Error List, point to "Suppress Message(s)", and click
-// "In Project Suppression File".
-// You do not need to add suppressions to this file manually.
-
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes", Scope = "namespace", Target = "System.Reactive.Linq", Justification = "By design")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Qbservable", Scope = "type", Target = "System.Reactive.Linq.IQbservable", Justification = "It's homoiconic, dude!")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Qbservable", Scope = "type", Target = "System.Reactive.Linq.IQbservable`1", Justification = "It's homoiconic, dude!")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Qbservable", Scope = "type", Target = "System.Reactive.Linq.IQbservableProvider", Justification = "It's homoiconic, dude!")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Qbservable", Scope = "type", Target = "System.Reactive.Linq.Qbservable", Justification = "It's homoiconic, dude!")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Amb", Scope = "member", Target = "System.Reactive.Linq.Qbservable.#Amb`1(System.Reactive.Linq.IQbservable`1<!!0>,System.IObservable`1<!!0>)", Justification = "It's homoiconic, dude!")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Amb", Scope = "member", Target = "System.Reactive.Linq.Qbservable.#Amb`1(System.Reactive.Linq.IQbservableProvider,System.Collections.Generic.IEnumerable`1<System.IObservable`1<!!0>>)", Justification = "It's homoiconic, dude!")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Amb", Scope = "member", Target = "System.Reactive.Linq.Qbservable.#Amb`1(System.Reactive.Linq.IQbservableProvider,System.IObservable`1<!!0>[])", Justification = "It's homoiconic, dude!")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Qbservable", Scope = "member", Target = "System.Reactive.Linq.Qbservable.#AsQbservable`1(System.IObservable`1<!!0>)", Justification = "It's homoiconic, dude!")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Remotable", Scope = "member", Target = "System.Reactive.Linq.Qbservable.#Remotable`1(System.Reactive.Linq.IQbservable`1<!!0>)", Justification = "It's homoiconic, dude!")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Qbservable", Scope = "member", Target = "System.Reactive.Linq.Qbservable.#ToQbservable`1(System.Linq.IQueryable`1<!!0>)", Justification = "It's homoiconic, dude!")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1703:ResourceStringsShouldBeSpelledCorrectly", MessageId = "Qbservable", Scope = "resource", Target = "System.Reactive.Strings_Providers.resources", Justification = "It's homoiconic, dude!")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Qbservable", Scope = "member", Target = "System.Reactive.Linq.Qbservable.#ToQbservable`1(System.Linq.IQueryable`1<!!0>,System.Reactive.Concurrency.IScheduler)", Justification = "It's homoiconic, dude!")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0", Scope = "member", Target = "System.Reactive.ObservableQuery`1+ObservableRewriter.#VisitConstant(System.Linq.Expressions.ConstantExpression)", Justification = "Expression visitor should not pass in null references.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0", Scope = "member", Target = "System.Reactive.ObservableQuery`1+ObservableRewriter.#VisitMethodCall(System.Linq.Expressions.MethodCallExpression)", Justification = "Expression visitor should not pass in null references.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA2210:AssembliesShouldHaveValidStrongNames", Justification = "Taken care of by lab build.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1016:MarkAssembliesWithAssemblyVersion", Justification = "Taken care of by lab build.")]
diff --git a/Rx.NET/System.Reactive.Providers/Properties/AssemblyInfo.cs b/Rx.NET/System.Reactive.Providers/Properties/AssemblyInfo.cs
deleted file mode 100644
index eb6b672..0000000
--- a/Rx.NET/System.Reactive.Providers/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,33 +0,0 @@
-using System;
-using System.Reflection;
-using System.Resources;
-using System.Runtime.InteropServices;
-using System.Security;
-
-[assembly: AssemblyTitle("System.Reactive.Providers")]
-// Notice: same description as in the .nuspec files; see Source/Rx/Setup/NuGet
-[assembly: AssemblyDescription("Reactive Extensions Providers Library used to build query providers and express complex event processing queries over those.")]
-#if DEBUG
-[assembly: AssemblyConfiguration("Debug")]
-#else
-[assembly: AssemblyConfiguration("Retail")]
-#endif
-[assembly: AssemblyCompany("Microsoft Corporation")]
-[assembly: AssemblyProduct("Reactive Extensions")]
-[assembly: AssemblyCopyright("\x00a9 Microsoft Corporation. All rights reserved.")]
-[assembly: NeutralResourcesLanguage("en-US")]
-
-#if !PLIB
-[assembly: ComVisible(false)]
-#endif
-
-[assembly: CLSCompliant(true)]
-
-#if HAS_APTCA && NO_CODECOVERAGE
-[assembly: AllowPartiallyTrustedCallers]
-#endif
-
-//
-// Note: Assembly (file) version numbers get inserted by the build system on the fly. Inspect the Team Build workflows
-// and the custom activity in Build/Source/Activities/AppendVersionInfo.cs for more information.
-//
diff --git a/Rx.NET/System.Reactive.Providers/Reactive/Internal/Constants.cs b/Rx.NET/System.Reactive.Providers/Reactive/Internal/Constants.cs
deleted file mode 100644
index 3e6759b..0000000
--- a/Rx.NET/System.Reactive.Providers/Reactive/Internal/Constants.cs
+++ /dev/null
@@ -1,18 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-//
-// NOTE: Identical copies of this file are kept in System.Reactive.Linq and System.Reactive.Providers.
-//
-
-namespace System.Reactive
-{
- // We can't make those based on the Strings_*.resx file, because the ObsoleteAttribute needs a compile-time constant.
-
- class Constants_Linq
- {
-#if PREFER_ASYNC
- public const string USE_ASYNC = "This blocking operation is no longer supported. Instead, use the async version in combination with C# and Visual Basic async/await support. In case you need a blocking operation, use Wait or convert the resulting observable sequence to a Task object and block. See http://go.microsoft.com/fwlink/?LinkID=260866 for more information.";
- public const string USE_TASK_FROMASYNCPATTERN = "This conversion is no longer supported. Replace use of the Begin/End asynchronous method pair with a new Task-based async method, and convert the result using ToObservable. If no Task-based async method is available, use Task.Factory.FromAsync to obtain a Task object. See http://go.microsoft.com/fwlink/?LinkID=260866 for more information.";
-#endif
- }
-} \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Providers/Reactive/Joins/QueryablePattern.cs b/Rx.NET/System.Reactive.Providers/Reactive/Joins/QueryablePattern.cs
deleted file mode 100644
index 306f934..0000000
--- a/Rx.NET/System.Reactive.Providers/Reactive/Joins/QueryablePattern.cs
+++ /dev/null
@@ -1,1053 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#pragma warning disable 1591
-
-using System.Linq.Expressions;
-using System.Reactive.Linq;
-
-namespace System.Reactive.Joins
-{
- /// <summary>
- /// Abstract base class for join patterns represented by an expression tree.
- /// </summary>
- public abstract class QueryablePattern
- {
- /// <summary>
- /// Creates a new join pattern object using the specified expression tree represention.
- /// </summary>
- /// <param name="expression">Expression tree representing the join pattern.</param>
- protected QueryablePattern(Expression expression)
- {
- Expression = expression;
- }
-
- /// <summary>
- /// Gets the expression tree representing the join pattern.
- /// </summary>
- public Expression Expression { get; private set; }
- }
-
- /* The following code is generated by a tool checked in to $/.../Source/Tools/CodeGenerators. */
-
- #region Joins auto-generated code (8/4/2012 1:00:32 AM)
-
- /// <summary>
- /// Represents a join pattern over two observable sequences.
- /// </summary>
- /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
- /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
- public class QueryablePattern<TSource1, TSource2> : QueryablePattern
- {
- internal QueryablePattern(Expression expression)
- : base(expression)
- {
- }
-
- /// <summary>
- /// Creates a pattern that matches when all three observable sequences have an available element.
- /// </summary>
- /// <typeparam name="TSource3">The type of the elements in the third observable sequence.</typeparam>
- /// <param name="other">Observable sequence to match with the two previous sequences.</param>
- /// <returns>Pattern object that matches when all observable sequences have an available element.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="other"/> is null.</exception>
- public QueryablePattern<TSource1, TSource2, TSource3> And<TSource3>(IObservable<TSource3> other)
- {
- if (other == null)
- throw new ArgumentNullException("other");
-
- var t = typeof(QueryablePattern<TSource1, TSource2>);
- var m = t.GetMethod("And").MakeGenericMethod(typeof(TSource3));
- return new QueryablePattern<TSource1, TSource2, TSource3>(
- Expression.Call(
- Expression,
- m,
- Qbservable.GetSourceExpression(other)
- )
- );
-
- }
-
- /// <summary>
- /// Matches when all observable sequences have an available element and projects the elements by invoking the selector function.
- /// </summary>
- /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
- /// <param name="selector">Selector that will be invoked for elements in the source sequences.</param>
- /// <returns>Plan that produces the projected results, to be fed (with other plans) to the When operator.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="selector"/> is null.</exception>
- public QueryablePlan<TResult> Then<TResult>(Expression<Func<TSource1, TSource2, TResult>> selector)
- {
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- var t = typeof(QueryablePattern<TSource1, TSource2>);
- var m = t.GetMethod("Then").MakeGenericMethod(typeof(TResult));
- return new QueryablePlan<TResult>(
- Expression.Call(
- Expression,
- m,
- selector
- )
- );
-
- }
-
- }
-
- /// <summary>
- /// Represents a join pattern over three observable sequences.
- /// </summary>
- /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
- /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
- /// <typeparam name="TSource3">The type of the elements in the third source sequence.</typeparam>
- public class QueryablePattern<TSource1, TSource2, TSource3> : QueryablePattern
- {
- internal QueryablePattern(Expression expression)
- : base(expression)
- {
- }
-
- /// <summary>
- /// Creates a pattern that matches when all four observable sequences have an available element.
- /// </summary>
- /// <typeparam name="TSource4">The type of the elements in the fourth observable sequence.</typeparam>
- /// <param name="other">Observable sequence to match with the three previous sequences.</param>
- /// <returns>Pattern object that matches when all observable sequences have an available element.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="other"/> is null.</exception>
- public QueryablePattern<TSource1, TSource2, TSource3, TSource4> And<TSource4>(IObservable<TSource4> other)
- {
- if (other == null)
- throw new ArgumentNullException("other");
-
- var t = typeof(QueryablePattern<TSource1, TSource2, TSource3>);
- var m = t.GetMethod("And").MakeGenericMethod(typeof(TSource4));
- return new QueryablePattern<TSource1, TSource2, TSource3, TSource4>(
- Expression.Call(
- Expression,
- m,
- Qbservable.GetSourceExpression(other)
- )
- );
-
- }
-
- /// <summary>
- /// Matches when all observable sequences have an available element and projects the elements by invoking the selector function.
- /// </summary>
- /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
- /// <param name="selector">Selector that will be invoked for elements in the source sequences.</param>
- /// <returns>Plan that produces the projected results, to be fed (with other plans) to the When operator.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="selector"/> is null.</exception>
- public QueryablePlan<TResult> Then<TResult>(Expression<Func<TSource1, TSource2, TSource3, TResult>> selector)
- {
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- var t = typeof(QueryablePattern<TSource1, TSource2, TSource3>);
- var m = t.GetMethod("Then").MakeGenericMethod(typeof(TResult));
- return new QueryablePlan<TResult>(
- Expression.Call(
- Expression,
- m,
- selector
- )
- );
-
- }
-
- }
-
- /// <summary>
- /// Represents a join pattern over four observable sequences.
- /// </summary>
- /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
- /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
- /// <typeparam name="TSource3">The type of the elements in the third source sequence.</typeparam>
- /// <typeparam name="TSource4">The type of the elements in the fourth source sequence.</typeparam>
- public class QueryablePattern<TSource1, TSource2, TSource3, TSource4> : QueryablePattern
- {
- internal QueryablePattern(Expression expression)
- : base(expression)
- {
- }
-
-#if !NO_LARGEARITY
- /// <summary>
- /// Creates a pattern that matches when all five observable sequences have an available element.
- /// </summary>
- /// <typeparam name="TSource5">The type of the elements in the fifth observable sequence.</typeparam>
- /// <param name="other">Observable sequence to match with the four previous sequences.</param>
- /// <returns>Pattern object that matches when all observable sequences have an available element.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="other"/> is null.</exception>
- public QueryablePattern<TSource1, TSource2, TSource3, TSource4, TSource5> And<TSource5>(IObservable<TSource5> other)
- {
- if (other == null)
- throw new ArgumentNullException("other");
-
- var t = typeof(QueryablePattern<TSource1, TSource2, TSource3, TSource4>);
- var m = t.GetMethod("And").MakeGenericMethod(typeof(TSource5));
- return new QueryablePattern<TSource1, TSource2, TSource3, TSource4, TSource5>(
- Expression.Call(
- Expression,
- m,
- Qbservable.GetSourceExpression(other)
- )
- );
-
- }
-#endif
-
- /// <summary>
- /// Matches when all observable sequences have an available element and projects the elements by invoking the selector function.
- /// </summary>
- /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
- /// <param name="selector">Selector that will be invoked for elements in the source sequences.</param>
- /// <returns>Plan that produces the projected results, to be fed (with other plans) to the When operator.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="selector"/> is null.</exception>
- public QueryablePlan<TResult> Then<TResult>(Expression<Func<TSource1, TSource2, TSource3, TSource4, TResult>> selector)
- {
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- var t = typeof(QueryablePattern<TSource1, TSource2, TSource3, TSource4>);
- var m = t.GetMethod("Then").MakeGenericMethod(typeof(TResult));
- return new QueryablePlan<TResult>(
- Expression.Call(
- Expression,
- m,
- selector
- )
- );
-
- }
-
- }
-
-#if !NO_LARGEARITY
- /// <summary>
- /// Represents a join pattern over five observable sequences.
- /// </summary>
- /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
- /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
- /// <typeparam name="TSource3">The type of the elements in the third source sequence.</typeparam>
- /// <typeparam name="TSource4">The type of the elements in the fourth source sequence.</typeparam>
- /// <typeparam name="TSource5">The type of the elements in the fifth source sequence.</typeparam>
- public class QueryablePattern<TSource1, TSource2, TSource3, TSource4, TSource5> : QueryablePattern
- {
- internal QueryablePattern(Expression expression)
- : base(expression)
- {
- }
-
- /// <summary>
- /// Creates a pattern that matches when all six observable sequences have an available element.
- /// </summary>
- /// <typeparam name="TSource6">The type of the elements in the sixth observable sequence.</typeparam>
- /// <param name="other">Observable sequence to match with the five previous sequences.</param>
- /// <returns>Pattern object that matches when all observable sequences have an available element.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="other"/> is null.</exception>
- public QueryablePattern<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6> And<TSource6>(IObservable<TSource6> other)
- {
- if (other == null)
- throw new ArgumentNullException("other");
-
- var t = typeof(QueryablePattern<TSource1, TSource2, TSource3, TSource4, TSource5>);
- var m = t.GetMethod("And").MakeGenericMethod(typeof(TSource6));
- return new QueryablePattern<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6>(
- Expression.Call(
- Expression,
- m,
- Qbservable.GetSourceExpression(other)
- )
- );
-
- }
-
- /// <summary>
- /// Matches when all observable sequences have an available element and projects the elements by invoking the selector function.
- /// </summary>
- /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
- /// <param name="selector">Selector that will be invoked for elements in the source sequences.</param>
- /// <returns>Plan that produces the projected results, to be fed (with other plans) to the When operator.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="selector"/> is null.</exception>
- public QueryablePlan<TResult> Then<TResult>(Expression<Func<TSource1, TSource2, TSource3, TSource4, TSource5, TResult>> selector)
- {
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- var t = typeof(QueryablePattern<TSource1, TSource2, TSource3, TSource4, TSource5>);
- var m = t.GetMethod("Then").MakeGenericMethod(typeof(TResult));
- return new QueryablePlan<TResult>(
- Expression.Call(
- Expression,
- m,
- selector
- )
- );
-
- }
-
- }
-
- /// <summary>
- /// Represents a join pattern over six observable sequences.
- /// </summary>
- /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
- /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
- /// <typeparam name="TSource3">The type of the elements in the third source sequence.</typeparam>
- /// <typeparam name="TSource4">The type of the elements in the fourth source sequence.</typeparam>
- /// <typeparam name="TSource5">The type of the elements in the fifth source sequence.</typeparam>
- /// <typeparam name="TSource6">The type of the elements in the sixth source sequence.</typeparam>
- public class QueryablePattern<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6> : QueryablePattern
- {
- internal QueryablePattern(Expression expression)
- : base(expression)
- {
- }
-
- /// <summary>
- /// Creates a pattern that matches when all seven observable sequences have an available element.
- /// </summary>
- /// <typeparam name="TSource7">The type of the elements in the seventh observable sequence.</typeparam>
- /// <param name="other">Observable sequence to match with the six previous sequences.</param>
- /// <returns>Pattern object that matches when all observable sequences have an available element.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="other"/> is null.</exception>
- public QueryablePattern<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7> And<TSource7>(IObservable<TSource7> other)
- {
- if (other == null)
- throw new ArgumentNullException("other");
-
- var t = typeof(QueryablePattern<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6>);
- var m = t.GetMethod("And").MakeGenericMethod(typeof(TSource7));
- return new QueryablePattern<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7>(
- Expression.Call(
- Expression,
- m,
- Qbservable.GetSourceExpression(other)
- )
- );
-
- }
-
- /// <summary>
- /// Matches when all observable sequences have an available element and projects the elements by invoking the selector function.
- /// </summary>
- /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
- /// <param name="selector">Selector that will be invoked for elements in the source sequences.</param>
- /// <returns>Plan that produces the projected results, to be fed (with other plans) to the When operator.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="selector"/> is null.</exception>
- public QueryablePlan<TResult> Then<TResult>(Expression<Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TResult>> selector)
- {
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- var t = typeof(QueryablePattern<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6>);
- var m = t.GetMethod("Then").MakeGenericMethod(typeof(TResult));
- return new QueryablePlan<TResult>(
- Expression.Call(
- Expression,
- m,
- selector
- )
- );
-
- }
-
- }
-
- /// <summary>
- /// Represents a join pattern over seven observable sequences.
- /// </summary>
- /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
- /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
- /// <typeparam name="TSource3">The type of the elements in the third source sequence.</typeparam>
- /// <typeparam name="TSource4">The type of the elements in the fourth source sequence.</typeparam>
- /// <typeparam name="TSource5">The type of the elements in the fifth source sequence.</typeparam>
- /// <typeparam name="TSource6">The type of the elements in the sixth source sequence.</typeparam>
- /// <typeparam name="TSource7">The type of the elements in the seventh source sequence.</typeparam>
- public class QueryablePattern<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7> : QueryablePattern
- {
- internal QueryablePattern(Expression expression)
- : base(expression)
- {
- }
-
- /// <summary>
- /// Creates a pattern that matches when all eight observable sequences have an available element.
- /// </summary>
- /// <typeparam name="TSource8">The type of the elements in the eighth observable sequence.</typeparam>
- /// <param name="other">Observable sequence to match with the seven previous sequences.</param>
- /// <returns>Pattern object that matches when all observable sequences have an available element.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="other"/> is null.</exception>
- public QueryablePattern<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8> And<TSource8>(IObservable<TSource8> other)
- {
- if (other == null)
- throw new ArgumentNullException("other");
-
- var t = typeof(QueryablePattern<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7>);
- var m = t.GetMethod("And").MakeGenericMethod(typeof(TSource8));
- return new QueryablePattern<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8>(
- Expression.Call(
- Expression,
- m,
- Qbservable.GetSourceExpression(other)
- )
- );
-
- }
-
- /// <summary>
- /// Matches when all observable sequences have an available element and projects the elements by invoking the selector function.
- /// </summary>
- /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
- /// <param name="selector">Selector that will be invoked for elements in the source sequences.</param>
- /// <returns>Plan that produces the projected results, to be fed (with other plans) to the When operator.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="selector"/> is null.</exception>
- public QueryablePlan<TResult> Then<TResult>(Expression<Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TResult>> selector)
- {
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- var t = typeof(QueryablePattern<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7>);
- var m = t.GetMethod("Then").MakeGenericMethod(typeof(TResult));
- return new QueryablePlan<TResult>(
- Expression.Call(
- Expression,
- m,
- selector
- )
- );
-
- }
-
- }
-
- /// <summary>
- /// Represents a join pattern over eight observable sequences.
- /// </summary>
- /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
- /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
- /// <typeparam name="TSource3">The type of the elements in the third source sequence.</typeparam>
- /// <typeparam name="TSource4">The type of the elements in the fourth source sequence.</typeparam>
- /// <typeparam name="TSource5">The type of the elements in the fifth source sequence.</typeparam>
- /// <typeparam name="TSource6">The type of the elements in the sixth source sequence.</typeparam>
- /// <typeparam name="TSource7">The type of the elements in the seventh source sequence.</typeparam>
- /// <typeparam name="TSource8">The type of the elements in the eighth source sequence.</typeparam>
- public class QueryablePattern<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8> : QueryablePattern
- {
- internal QueryablePattern(Expression expression)
- : base(expression)
- {
- }
-
- /// <summary>
- /// Creates a pattern that matches when all nine observable sequences have an available element.
- /// </summary>
- /// <typeparam name="TSource9">The type of the elements in the ninth observable sequence.</typeparam>
- /// <param name="other">Observable sequence to match with the eight previous sequences.</param>
- /// <returns>Pattern object that matches when all observable sequences have an available element.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="other"/> is null.</exception>
- public QueryablePattern<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9> And<TSource9>(IObservable<TSource9> other)
- {
- if (other == null)
- throw new ArgumentNullException("other");
-
- var t = typeof(QueryablePattern<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8>);
- var m = t.GetMethod("And").MakeGenericMethod(typeof(TSource9));
- return new QueryablePattern<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9>(
- Expression.Call(
- Expression,
- m,
- Qbservable.GetSourceExpression(other)
- )
- );
-
- }
-
- /// <summary>
- /// Matches when all observable sequences have an available element and projects the elements by invoking the selector function.
- /// </summary>
- /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
- /// <param name="selector">Selector that will be invoked for elements in the source sequences.</param>
- /// <returns>Plan that produces the projected results, to be fed (with other plans) to the When operator.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="selector"/> is null.</exception>
- public QueryablePlan<TResult> Then<TResult>(Expression<Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TResult>> selector)
- {
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- var t = typeof(QueryablePattern<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8>);
- var m = t.GetMethod("Then").MakeGenericMethod(typeof(TResult));
- return new QueryablePlan<TResult>(
- Expression.Call(
- Expression,
- m,
- selector
- )
- );
-
- }
-
- }
-
- /// <summary>
- /// Represents a join pattern over nine observable sequences.
- /// </summary>
- /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
- /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
- /// <typeparam name="TSource3">The type of the elements in the third source sequence.</typeparam>
- /// <typeparam name="TSource4">The type of the elements in the fourth source sequence.</typeparam>
- /// <typeparam name="TSource5">The type of the elements in the fifth source sequence.</typeparam>
- /// <typeparam name="TSource6">The type of the elements in the sixth source sequence.</typeparam>
- /// <typeparam name="TSource7">The type of the elements in the seventh source sequence.</typeparam>
- /// <typeparam name="TSource8">The type of the elements in the eighth source sequence.</typeparam>
- /// <typeparam name="TSource9">The type of the elements in the ninth source sequence.</typeparam>
- public class QueryablePattern<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9> : QueryablePattern
- {
- internal QueryablePattern(Expression expression)
- : base(expression)
- {
- }
-
- /// <summary>
- /// Creates a pattern that matches when all ten observable sequences have an available element.
- /// </summary>
- /// <typeparam name="TSource10">The type of the elements in the tenth observable sequence.</typeparam>
- /// <param name="other">Observable sequence to match with the nine previous sequences.</param>
- /// <returns>Pattern object that matches when all observable sequences have an available element.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="other"/> is null.</exception>
- public QueryablePattern<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10> And<TSource10>(IObservable<TSource10> other)
- {
- if (other == null)
- throw new ArgumentNullException("other");
-
- var t = typeof(QueryablePattern<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9>);
- var m = t.GetMethod("And").MakeGenericMethod(typeof(TSource10));
- return new QueryablePattern<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10>(
- Expression.Call(
- Expression,
- m,
- Qbservable.GetSourceExpression(other)
- )
- );
-
- }
-
- /// <summary>
- /// Matches when all observable sequences have an available element and projects the elements by invoking the selector function.
- /// </summary>
- /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
- /// <param name="selector">Selector that will be invoked for elements in the source sequences.</param>
- /// <returns>Plan that produces the projected results, to be fed (with other plans) to the When operator.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="selector"/> is null.</exception>
- public QueryablePlan<TResult> Then<TResult>(Expression<Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TResult>> selector)
- {
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- var t = typeof(QueryablePattern<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9>);
- var m = t.GetMethod("Then").MakeGenericMethod(typeof(TResult));
- return new QueryablePlan<TResult>(
- Expression.Call(
- Expression,
- m,
- selector
- )
- );
-
- }
-
- }
-
- /// <summary>
- /// Represents a join pattern over ten observable sequences.
- /// </summary>
- /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
- /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
- /// <typeparam name="TSource3">The type of the elements in the third source sequence.</typeparam>
- /// <typeparam name="TSource4">The type of the elements in the fourth source sequence.</typeparam>
- /// <typeparam name="TSource5">The type of the elements in the fifth source sequence.</typeparam>
- /// <typeparam name="TSource6">The type of the elements in the sixth source sequence.</typeparam>
- /// <typeparam name="TSource7">The type of the elements in the seventh source sequence.</typeparam>
- /// <typeparam name="TSource8">The type of the elements in the eighth source sequence.</typeparam>
- /// <typeparam name="TSource9">The type of the elements in the ninth source sequence.</typeparam>
- /// <typeparam name="TSource10">The type of the elements in the tenth source sequence.</typeparam>
- public class QueryablePattern<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10> : QueryablePattern
- {
- internal QueryablePattern(Expression expression)
- : base(expression)
- {
- }
-
- /// <summary>
- /// Creates a pattern that matches when all eleven observable sequences have an available element.
- /// </summary>
- /// <typeparam name="TSource11">The type of the elements in the eleventh observable sequence.</typeparam>
- /// <param name="other">Observable sequence to match with the ten previous sequences.</param>
- /// <returns>Pattern object that matches when all observable sequences have an available element.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="other"/> is null.</exception>
- public QueryablePattern<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11> And<TSource11>(IObservable<TSource11> other)
- {
- if (other == null)
- throw new ArgumentNullException("other");
-
- var t = typeof(QueryablePattern<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10>);
- var m = t.GetMethod("And").MakeGenericMethod(typeof(TSource11));
- return new QueryablePattern<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11>(
- Expression.Call(
- Expression,
- m,
- Qbservable.GetSourceExpression(other)
- )
- );
-
- }
-
- /// <summary>
- /// Matches when all observable sequences have an available element and projects the elements by invoking the selector function.
- /// </summary>
- /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
- /// <param name="selector">Selector that will be invoked for elements in the source sequences.</param>
- /// <returns>Plan that produces the projected results, to be fed (with other plans) to the When operator.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="selector"/> is null.</exception>
- public QueryablePlan<TResult> Then<TResult>(Expression<Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TResult>> selector)
- {
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- var t = typeof(QueryablePattern<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10>);
- var m = t.GetMethod("Then").MakeGenericMethod(typeof(TResult));
- return new QueryablePlan<TResult>(
- Expression.Call(
- Expression,
- m,
- selector
- )
- );
-
- }
-
- }
-
- /// <summary>
- /// Represents a join pattern over eleven observable sequences.
- /// </summary>
- /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
- /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
- /// <typeparam name="TSource3">The type of the elements in the third source sequence.</typeparam>
- /// <typeparam name="TSource4">The type of the elements in the fourth source sequence.</typeparam>
- /// <typeparam name="TSource5">The type of the elements in the fifth source sequence.</typeparam>
- /// <typeparam name="TSource6">The type of the elements in the sixth source sequence.</typeparam>
- /// <typeparam name="TSource7">The type of the elements in the seventh source sequence.</typeparam>
- /// <typeparam name="TSource8">The type of the elements in the eighth source sequence.</typeparam>
- /// <typeparam name="TSource9">The type of the elements in the ninth source sequence.</typeparam>
- /// <typeparam name="TSource10">The type of the elements in the tenth source sequence.</typeparam>
- /// <typeparam name="TSource11">The type of the elements in the eleventh source sequence.</typeparam>
- public class QueryablePattern<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11> : QueryablePattern
- {
- internal QueryablePattern(Expression expression)
- : base(expression)
- {
- }
-
- /// <summary>
- /// Creates a pattern that matches when all twelve observable sequences have an available element.
- /// </summary>
- /// <typeparam name="TSource12">The type of the elements in the twelfth observable sequence.</typeparam>
- /// <param name="other">Observable sequence to match with the eleven previous sequences.</param>
- /// <returns>Pattern object that matches when all observable sequences have an available element.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="other"/> is null.</exception>
- public QueryablePattern<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12> And<TSource12>(IObservable<TSource12> other)
- {
- if (other == null)
- throw new ArgumentNullException("other");
-
- var t = typeof(QueryablePattern<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11>);
- var m = t.GetMethod("And").MakeGenericMethod(typeof(TSource12));
- return new QueryablePattern<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12>(
- Expression.Call(
- Expression,
- m,
- Qbservable.GetSourceExpression(other)
- )
- );
-
- }
-
- /// <summary>
- /// Matches when all observable sequences have an available element and projects the elements by invoking the selector function.
- /// </summary>
- /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
- /// <param name="selector">Selector that will be invoked for elements in the source sequences.</param>
- /// <returns>Plan that produces the projected results, to be fed (with other plans) to the When operator.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="selector"/> is null.</exception>
- public QueryablePlan<TResult> Then<TResult>(Expression<Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TResult>> selector)
- {
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- var t = typeof(QueryablePattern<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11>);
- var m = t.GetMethod("Then").MakeGenericMethod(typeof(TResult));
- return new QueryablePlan<TResult>(
- Expression.Call(
- Expression,
- m,
- selector
- )
- );
-
- }
-
- }
-
- /// <summary>
- /// Represents a join pattern over twelve observable sequences.
- /// </summary>
- /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
- /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
- /// <typeparam name="TSource3">The type of the elements in the third source sequence.</typeparam>
- /// <typeparam name="TSource4">The type of the elements in the fourth source sequence.</typeparam>
- /// <typeparam name="TSource5">The type of the elements in the fifth source sequence.</typeparam>
- /// <typeparam name="TSource6">The type of the elements in the sixth source sequence.</typeparam>
- /// <typeparam name="TSource7">The type of the elements in the seventh source sequence.</typeparam>
- /// <typeparam name="TSource8">The type of the elements in the eighth source sequence.</typeparam>
- /// <typeparam name="TSource9">The type of the elements in the ninth source sequence.</typeparam>
- /// <typeparam name="TSource10">The type of the elements in the tenth source sequence.</typeparam>
- /// <typeparam name="TSource11">The type of the elements in the eleventh source sequence.</typeparam>
- /// <typeparam name="TSource12">The type of the elements in the twelfth source sequence.</typeparam>
- public class QueryablePattern<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12> : QueryablePattern
- {
- internal QueryablePattern(Expression expression)
- : base(expression)
- {
- }
-
- /// <summary>
- /// Creates a pattern that matches when all thirteen observable sequences have an available element.
- /// </summary>
- /// <typeparam name="TSource13">The type of the elements in the thirteenth observable sequence.</typeparam>
- /// <param name="other">Observable sequence to match with the twelve previous sequences.</param>
- /// <returns>Pattern object that matches when all observable sequences have an available element.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="other"/> is null.</exception>
- public QueryablePattern<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13> And<TSource13>(IObservable<TSource13> other)
- {
- if (other == null)
- throw new ArgumentNullException("other");
-
- var t = typeof(QueryablePattern<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12>);
- var m = t.GetMethod("And").MakeGenericMethod(typeof(TSource13));
- return new QueryablePattern<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13>(
- Expression.Call(
- Expression,
- m,
- Qbservable.GetSourceExpression(other)
- )
- );
-
- }
-
- /// <summary>
- /// Matches when all observable sequences have an available element and projects the elements by invoking the selector function.
- /// </summary>
- /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
- /// <param name="selector">Selector that will be invoked for elements in the source sequences.</param>
- /// <returns>Plan that produces the projected results, to be fed (with other plans) to the When operator.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="selector"/> is null.</exception>
- public QueryablePlan<TResult> Then<TResult>(Expression<Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TResult>> selector)
- {
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- var t = typeof(QueryablePattern<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12>);
- var m = t.GetMethod("Then").MakeGenericMethod(typeof(TResult));
- return new QueryablePlan<TResult>(
- Expression.Call(
- Expression,
- m,
- selector
- )
- );
-
- }
-
- }
-
- /// <summary>
- /// Represents a join pattern over thirteen observable sequences.
- /// </summary>
- /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
- /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
- /// <typeparam name="TSource3">The type of the elements in the third source sequence.</typeparam>
- /// <typeparam name="TSource4">The type of the elements in the fourth source sequence.</typeparam>
- /// <typeparam name="TSource5">The type of the elements in the fifth source sequence.</typeparam>
- /// <typeparam name="TSource6">The type of the elements in the sixth source sequence.</typeparam>
- /// <typeparam name="TSource7">The type of the elements in the seventh source sequence.</typeparam>
- /// <typeparam name="TSource8">The type of the elements in the eighth source sequence.</typeparam>
- /// <typeparam name="TSource9">The type of the elements in the ninth source sequence.</typeparam>
- /// <typeparam name="TSource10">The type of the elements in the tenth source sequence.</typeparam>
- /// <typeparam name="TSource11">The type of the elements in the eleventh source sequence.</typeparam>
- /// <typeparam name="TSource12">The type of the elements in the twelfth source sequence.</typeparam>
- /// <typeparam name="TSource13">The type of the elements in the thirteenth source sequence.</typeparam>
- public class QueryablePattern<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13> : QueryablePattern
- {
- internal QueryablePattern(Expression expression)
- : base(expression)
- {
- }
-
- /// <summary>
- /// Creates a pattern that matches when all fourteen observable sequences have an available element.
- /// </summary>
- /// <typeparam name="TSource14">The type of the elements in the fourteenth observable sequence.</typeparam>
- /// <param name="other">Observable sequence to match with the thirteen previous sequences.</param>
- /// <returns>Pattern object that matches when all observable sequences have an available element.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="other"/> is null.</exception>
- public QueryablePattern<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TSource14> And<TSource14>(IObservable<TSource14> other)
- {
- if (other == null)
- throw new ArgumentNullException("other");
-
- var t = typeof(QueryablePattern<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13>);
- var m = t.GetMethod("And").MakeGenericMethod(typeof(TSource14));
- return new QueryablePattern<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TSource14>(
- Expression.Call(
- Expression,
- m,
- Qbservable.GetSourceExpression(other)
- )
- );
-
- }
-
- /// <summary>
- /// Matches when all observable sequences have an available element and projects the elements by invoking the selector function.
- /// </summary>
- /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
- /// <param name="selector">Selector that will be invoked for elements in the source sequences.</param>
- /// <returns>Plan that produces the projected results, to be fed (with other plans) to the When operator.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="selector"/> is null.</exception>
- public QueryablePlan<TResult> Then<TResult>(Expression<Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TResult>> selector)
- {
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- var t = typeof(QueryablePattern<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13>);
- var m = t.GetMethod("Then").MakeGenericMethod(typeof(TResult));
- return new QueryablePlan<TResult>(
- Expression.Call(
- Expression,
- m,
- selector
- )
- );
-
- }
-
- }
-
- /// <summary>
- /// Represents a join pattern over fourteen observable sequences.
- /// </summary>
- /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
- /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
- /// <typeparam name="TSource3">The type of the elements in the third source sequence.</typeparam>
- /// <typeparam name="TSource4">The type of the elements in the fourth source sequence.</typeparam>
- /// <typeparam name="TSource5">The type of the elements in the fifth source sequence.</typeparam>
- /// <typeparam name="TSource6">The type of the elements in the sixth source sequence.</typeparam>
- /// <typeparam name="TSource7">The type of the elements in the seventh source sequence.</typeparam>
- /// <typeparam name="TSource8">The type of the elements in the eighth source sequence.</typeparam>
- /// <typeparam name="TSource9">The type of the elements in the ninth source sequence.</typeparam>
- /// <typeparam name="TSource10">The type of the elements in the tenth source sequence.</typeparam>
- /// <typeparam name="TSource11">The type of the elements in the eleventh source sequence.</typeparam>
- /// <typeparam name="TSource12">The type of the elements in the twelfth source sequence.</typeparam>
- /// <typeparam name="TSource13">The type of the elements in the thirteenth source sequence.</typeparam>
- /// <typeparam name="TSource14">The type of the elements in the fourteenth source sequence.</typeparam>
- public class QueryablePattern<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TSource14> : QueryablePattern
- {
- internal QueryablePattern(Expression expression)
- : base(expression)
- {
- }
-
- /// <summary>
- /// Creates a pattern that matches when all fifteen observable sequences have an available element.
- /// </summary>
- /// <typeparam name="TSource15">The type of the elements in the fifteenth observable sequence.</typeparam>
- /// <param name="other">Observable sequence to match with the fourteen previous sequences.</param>
- /// <returns>Pattern object that matches when all observable sequences have an available element.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="other"/> is null.</exception>
- public QueryablePattern<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TSource14, TSource15> And<TSource15>(IObservable<TSource15> other)
- {
- if (other == null)
- throw new ArgumentNullException("other");
-
- var t = typeof(QueryablePattern<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TSource14>);
- var m = t.GetMethod("And").MakeGenericMethod(typeof(TSource15));
- return new QueryablePattern<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TSource14, TSource15>(
- Expression.Call(
- Expression,
- m,
- Qbservable.GetSourceExpression(other)
- )
- );
-
- }
-
- /// <summary>
- /// Matches when all observable sequences have an available element and projects the elements by invoking the selector function.
- /// </summary>
- /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
- /// <param name="selector">Selector that will be invoked for elements in the source sequences.</param>
- /// <returns>Plan that produces the projected results, to be fed (with other plans) to the When operator.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="selector"/> is null.</exception>
- public QueryablePlan<TResult> Then<TResult>(Expression<Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TSource14, TResult>> selector)
- {
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- var t = typeof(QueryablePattern<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TSource14>);
- var m = t.GetMethod("Then").MakeGenericMethod(typeof(TResult));
- return new QueryablePlan<TResult>(
- Expression.Call(
- Expression,
- m,
- selector
- )
- );
-
- }
-
- }
-
- /// <summary>
- /// Represents a join pattern over fifteen observable sequences.
- /// </summary>
- /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
- /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
- /// <typeparam name="TSource3">The type of the elements in the third source sequence.</typeparam>
- /// <typeparam name="TSource4">The type of the elements in the fourth source sequence.</typeparam>
- /// <typeparam name="TSource5">The type of the elements in the fifth source sequence.</typeparam>
- /// <typeparam name="TSource6">The type of the elements in the sixth source sequence.</typeparam>
- /// <typeparam name="TSource7">The type of the elements in the seventh source sequence.</typeparam>
- /// <typeparam name="TSource8">The type of the elements in the eighth source sequence.</typeparam>
- /// <typeparam name="TSource9">The type of the elements in the ninth source sequence.</typeparam>
- /// <typeparam name="TSource10">The type of the elements in the tenth source sequence.</typeparam>
- /// <typeparam name="TSource11">The type of the elements in the eleventh source sequence.</typeparam>
- /// <typeparam name="TSource12">The type of the elements in the twelfth source sequence.</typeparam>
- /// <typeparam name="TSource13">The type of the elements in the thirteenth source sequence.</typeparam>
- /// <typeparam name="TSource14">The type of the elements in the fourteenth source sequence.</typeparam>
- /// <typeparam name="TSource15">The type of the elements in the fifteenth source sequence.</typeparam>
- public class QueryablePattern<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TSource14, TSource15> : QueryablePattern
- {
- internal QueryablePattern(Expression expression)
- : base(expression)
- {
- }
-
- /// <summary>
- /// Creates a pattern that matches when all sixteen observable sequences have an available element.
- /// </summary>
- /// <typeparam name="TSource16">The type of the elements in the sixteenth observable sequence.</typeparam>
- /// <param name="other">Observable sequence to match with the fifteen previous sequences.</param>
- /// <returns>Pattern object that matches when all observable sequences have an available element.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="other"/> is null.</exception>
- public QueryablePattern<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TSource14, TSource15, TSource16> And<TSource16>(IObservable<TSource16> other)
- {
- if (other == null)
- throw new ArgumentNullException("other");
-
- var t = typeof(QueryablePattern<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TSource14, TSource15>);
- var m = t.GetMethod("And").MakeGenericMethod(typeof(TSource16));
- return new QueryablePattern<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TSource14, TSource15, TSource16>(
- Expression.Call(
- Expression,
- m,
- Qbservable.GetSourceExpression(other)
- )
- );
-
- }
-
- /// <summary>
- /// Matches when all observable sequences have an available element and projects the elements by invoking the selector function.
- /// </summary>
- /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
- /// <param name="selector">Selector that will be invoked for elements in the source sequences.</param>
- /// <returns>Plan that produces the projected results, to be fed (with other plans) to the When operator.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="selector"/> is null.</exception>
- public QueryablePlan<TResult> Then<TResult>(Expression<Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TSource14, TSource15, TResult>> selector)
- {
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- var t = typeof(QueryablePattern<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TSource14, TSource15>);
- var m = t.GetMethod("Then").MakeGenericMethod(typeof(TResult));
- return new QueryablePlan<TResult>(
- Expression.Call(
- Expression,
- m,
- selector
- )
- );
-
- }
-
- }
-
- /// <summary>
- /// Represents a join pattern over sixteen observable sequences.
- /// </summary>
- /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
- /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
- /// <typeparam name="TSource3">The type of the elements in the third source sequence.</typeparam>
- /// <typeparam name="TSource4">The type of the elements in the fourth source sequence.</typeparam>
- /// <typeparam name="TSource5">The type of the elements in the fifth source sequence.</typeparam>
- /// <typeparam name="TSource6">The type of the elements in the sixth source sequence.</typeparam>
- /// <typeparam name="TSource7">The type of the elements in the seventh source sequence.</typeparam>
- /// <typeparam name="TSource8">The type of the elements in the eighth source sequence.</typeparam>
- /// <typeparam name="TSource9">The type of the elements in the ninth source sequence.</typeparam>
- /// <typeparam name="TSource10">The type of the elements in the tenth source sequence.</typeparam>
- /// <typeparam name="TSource11">The type of the elements in the eleventh source sequence.</typeparam>
- /// <typeparam name="TSource12">The type of the elements in the twelfth source sequence.</typeparam>
- /// <typeparam name="TSource13">The type of the elements in the thirteenth source sequence.</typeparam>
- /// <typeparam name="TSource14">The type of the elements in the fourteenth source sequence.</typeparam>
- /// <typeparam name="TSource15">The type of the elements in the fifteenth source sequence.</typeparam>
- /// <typeparam name="TSource16">The type of the elements in the sixteenth source sequence.</typeparam>
- public class QueryablePattern<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TSource14, TSource15, TSource16> : QueryablePattern
- {
- internal QueryablePattern(Expression expression)
- : base(expression)
- {
- }
-
- /// <summary>
- /// Matches when all observable sequences have an available element and projects the elements by invoking the selector function.
- /// </summary>
- /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
- /// <param name="selector">Selector that will be invoked for elements in the source sequences.</param>
- /// <returns>Plan that produces the projected results, to be fed (with other plans) to the When operator.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="selector"/> is null.</exception>
- public QueryablePlan<TResult> Then<TResult>(Expression<Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TSource14, TSource15, TSource16, TResult>> selector)
- {
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- var t = typeof(QueryablePattern<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TSource14, TSource15, TSource16>);
- var m = t.GetMethod("Then").MakeGenericMethod(typeof(TResult));
- return new QueryablePlan<TResult>(
- Expression.Call(
- Expression,
- m,
- selector
- )
- );
-
- }
-
- }
-
-#endif
-
- #endregion
-}
-
-#pragma warning restore 1591 \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Providers/Reactive/Joins/QueryablePlan.cs b/Rx.NET/System.Reactive.Providers/Reactive/Joins/QueryablePlan.cs
deleted file mode 100644
index cb89983..0000000
--- a/Rx.NET/System.Reactive.Providers/Reactive/Joins/QueryablePlan.cs
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#pragma warning disable 1591
-
-using System.Linq.Expressions;
-
-namespace System.Reactive.Joins
-{
- /// <summary>
- /// Represents an execution plan for join patterns represented by an expression tree.
- /// </summary>
- /// <typeparam name="TResult">The type of the results produced by the plan.</typeparam>
- public class QueryablePlan<TResult>
- {
- internal QueryablePlan(Expression expression)
- {
- Expression = expression;
- }
-
- /// <summary>
- /// Gets the expression tree representing the join pattern execution plan.
- /// </summary>
- public Expression Expression { get; private set; }
- }
-}
-
-#pragma warning restore 1591 \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Providers/Reactive/Linq/ExpressionVisitor.cs b/Rx.NET/System.Reactive.Providers/Reactive/Linq/ExpressionVisitor.cs
deleted file mode 100644
index e3ef1e4..0000000
--- a/Rx.NET/System.Reactive.Providers/Reactive/Linq/ExpressionVisitor.cs
+++ /dev/null
@@ -1,373 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if NO_EXPRESSIONVISITOR
-
-using System;
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-using System.Reflection;
-using System.Linq.Expressions;
-
-namespace System.Reactive.Linq
-{
- internal abstract class ExpressionVisitor
- {
- internal ExpressionVisitor()
- {
- }
-
- public virtual Expression Visit(Expression exp)
- {
- if (exp == null)
- return exp;
- switch (exp.NodeType)
- {
- case ExpressionType.UnaryPlus:
- case ExpressionType.Negate:
- case ExpressionType.NegateChecked:
- case ExpressionType.Not:
- case ExpressionType.Convert:
- case ExpressionType.ConvertChecked:
- case ExpressionType.ArrayLength:
- case ExpressionType.Quote:
- case ExpressionType.TypeAs:
- return this.VisitUnary((UnaryExpression)exp);
- case ExpressionType.Add:
- case ExpressionType.AddChecked:
- case ExpressionType.Subtract:
- case ExpressionType.SubtractChecked:
- case ExpressionType.Multiply:
- case ExpressionType.MultiplyChecked:
- case ExpressionType.Divide:
- case ExpressionType.Modulo:
- case ExpressionType.Power:
- case ExpressionType.And:
- case ExpressionType.AndAlso:
- case ExpressionType.Or:
- case ExpressionType.OrElse:
- case ExpressionType.LessThan:
- case ExpressionType.LessThanOrEqual:
- case ExpressionType.GreaterThan:
- case ExpressionType.GreaterThanOrEqual:
- case ExpressionType.Equal:
- case ExpressionType.NotEqual:
- case ExpressionType.Coalesce:
- case ExpressionType.ArrayIndex:
- case ExpressionType.RightShift:
- case ExpressionType.LeftShift:
- case ExpressionType.ExclusiveOr:
- return this.VisitBinary((BinaryExpression)exp);
- case ExpressionType.TypeIs:
- return this.VisitTypeIs((TypeBinaryExpression)exp);
- case ExpressionType.Conditional:
- return this.VisitConditional((ConditionalExpression)exp);
- case ExpressionType.Constant:
- return this.VisitConstant((ConstantExpression)exp);
- case ExpressionType.Parameter:
- return this.VisitParameter((ParameterExpression)exp);
- case ExpressionType.MemberAccess:
- return this.VisitMemberAccess((MemberExpression)exp);
- case ExpressionType.Call:
- return this.VisitMethodCall((MethodCallExpression)exp);
- case ExpressionType.Lambda:
- return this.VisitLambda((LambdaExpression)exp);
- case ExpressionType.New:
- return this.VisitNew((NewExpression)exp);
- case ExpressionType.NewArrayInit:
- case ExpressionType.NewArrayBounds:
- return this.VisitNewArray((NewArrayExpression)exp);
- case ExpressionType.Invoke:
- return this.VisitInvocation((InvocationExpression)exp);
- case ExpressionType.MemberInit:
- return this.VisitMemberInit((MemberInitExpression)exp);
- case ExpressionType.ListInit:
- return this.VisitListInit((ListInitExpression)exp);
- default:
- throw new InvalidOperationException();
- }
- }
-
- protected virtual MemberBinding VisitBinding(MemberBinding binding)
- {
- switch (binding.BindingType)
- {
- case MemberBindingType.Assignment:
- return this.VisitMemberAssignment((MemberAssignment)binding);
- case MemberBindingType.MemberBinding:
- return this.VisitMemberMemberBinding((MemberMemberBinding)binding);
- case MemberBindingType.ListBinding:
- return this.VisitMemberListBinding((MemberListBinding)binding);
- default:
- throw new InvalidOperationException();
- }
- }
-
- protected virtual ElementInit VisitElementInitializer(ElementInit initializer)
- {
- ReadOnlyCollection<Expression> arguments = this.VisitExpressionList(initializer.Arguments);
- if (arguments != initializer.Arguments)
- {
- return Expression.ElementInit(initializer.AddMethod, arguments);
- }
- return initializer;
- }
-
- protected virtual Expression VisitUnary(UnaryExpression u)
- {
- Expression operand = this.Visit(u.Operand);
- if (operand != u.Operand)
- {
- return Expression.MakeUnary(u.NodeType, operand, u.Type, u.Method);
- }
- return u;
- }
-
- protected virtual Expression VisitBinary(BinaryExpression b)
- {
- Expression left = this.Visit(b.Left);
- Expression right = this.Visit(b.Right);
- Expression conversion = this.Visit(b.Conversion);
- if (left != b.Left || right != b.Right || conversion != b.Conversion)
- {
- if (b.NodeType == ExpressionType.Coalesce && b.Conversion != null)
- return Expression.Coalesce(left, right, conversion as LambdaExpression);
- else
- return Expression.MakeBinary(b.NodeType, left, right, b.IsLiftedToNull, b.Method);
- }
- return b;
- }
-
- protected virtual Expression VisitTypeIs(TypeBinaryExpression b)
- {
- Expression expr = this.Visit(b.Expression);
- if (expr != b.Expression)
- {
- return Expression.TypeIs(expr, b.TypeOperand);
- }
- return b;
- }
-
- protected virtual Expression VisitConstant(ConstantExpression c)
- {
- return c;
- }
-
- protected virtual Expression VisitConditional(ConditionalExpression c)
- {
- Expression test = this.Visit(c.Test);
- Expression ifTrue = this.Visit(c.IfTrue);
- Expression ifFalse = this.Visit(c.IfFalse);
- if (test != c.Test || ifTrue != c.IfTrue || ifFalse != c.IfFalse)
- {
- return Expression.Condition(test, ifTrue, ifFalse);
- }
- return c;
- }
-
- protected virtual Expression VisitParameter(ParameterExpression p)
- {
- return p;
- }
-
- protected virtual Expression VisitMemberAccess(MemberExpression m)
- {
- Expression exp = this.Visit(m.Expression);
- if (exp != m.Expression)
- {
- return Expression.MakeMemberAccess(exp, m.Member);
- }
- return m;
- }
-
- protected virtual Expression VisitMethodCall(MethodCallExpression m)
- {
- Expression obj = this.Visit(m.Object);
- IEnumerable<Expression> args = this.VisitExpressionList(m.Arguments);
- if (obj != m.Object || args != m.Arguments)
- {
- return Expression.Call(obj, m.Method, args);
- }
- return m;
- }
-
- protected virtual ReadOnlyCollection<Expression> VisitExpressionList(ReadOnlyCollection<Expression> original)
- {
- List<Expression> list = null;
- for (int i = 0, n = original.Count; i < n; i++)
- {
- Expression p = this.Visit(original[i]);
- if (list != null)
- {
- list.Add(p);
- }
- else if (p != original[i])
- {
- list = new List<Expression>(n);
- for (int j = 0; j < i; j++)
- {
- list.Add(original[j]);
- }
- list.Add(p);
- }
- }
- if (list != null)
- return new ReadOnlyCollection<Expression>(list);
- return original;
- }
-
- protected virtual MemberAssignment VisitMemberAssignment(MemberAssignment assignment)
- {
- Expression e = this.Visit(assignment.Expression);
- if (e != assignment.Expression)
- {
- return Expression.Bind(assignment.Member, e);
- }
- return assignment;
- }
-
- protected virtual MemberMemberBinding VisitMemberMemberBinding(MemberMemberBinding binding)
- {
- IEnumerable<MemberBinding> bindings = this.VisitBindingList(binding.Bindings);
- if (bindings != binding.Bindings)
- {
- return Expression.MemberBind(binding.Member, bindings);
- }
- return binding;
- }
-
- protected virtual MemberListBinding VisitMemberListBinding(MemberListBinding binding)
- {
- IEnumerable<ElementInit> initializers = this.VisitElementInitializerList(binding.Initializers);
- if (initializers != binding.Initializers)
- {
- return Expression.ListBind(binding.Member, initializers);
- }
- return binding;
- }
-
- protected virtual IEnumerable<MemberBinding> VisitBindingList(ReadOnlyCollection<MemberBinding> original)
- {
- List<MemberBinding> list = null;
- for (int i = 0, n = original.Count; i < n; i++)
- {
- MemberBinding b = this.VisitBinding(original[i]);
- if (list != null)
- {
- list.Add(b);
- }
- else if (b != original[i])
- {
- list = new List<MemberBinding>(n);
- for (int j = 0; j < i; j++)
- {
- list.Add(original[j]);
- }
- list.Add(b);
- }
- }
- if (list != null)
- return list;
- return original;
- }
-
- protected virtual IEnumerable<ElementInit> VisitElementInitializerList(ReadOnlyCollection<ElementInit> original)
- {
- List<ElementInit> list = null;
- for (int i = 0, n = original.Count; i < n; i++)
- {
- ElementInit init = this.VisitElementInitializer(original[i]);
- if (list != null)
- {
- list.Add(init);
- }
- else if (init != original[i])
- {
- list = new List<ElementInit>(n);
- for (int j = 0; j < i; j++)
- {
- list.Add(original[j]);
- }
- list.Add(init);
- }
- }
- if (list != null)
- return list;
- return original;
- }
-
- protected virtual Expression VisitLambda(LambdaExpression lambda)
- {
- Expression body = this.Visit(lambda.Body);
- if (body != lambda.Body)
- {
- return Expression.Lambda(lambda.Type, body, lambda.Parameters);
- }
- return lambda;
- }
-
- protected virtual NewExpression VisitNew(NewExpression nex)
- {
- IEnumerable<Expression> args = this.VisitExpressionList(nex.Arguments);
- if (args != nex.Arguments)
- {
- if (nex.Members != null)
- return Expression.New(nex.Constructor, args, nex.Members);
- else
- return Expression.New(nex.Constructor, args);
- }
- return nex;
- }
-
- protected virtual Expression VisitMemberInit(MemberInitExpression init)
- {
- NewExpression n = this.VisitNew(init.NewExpression);
- IEnumerable<MemberBinding> bindings = this.VisitBindingList(init.Bindings);
- if (n != init.NewExpression || bindings != init.Bindings)
- {
- return Expression.MemberInit(n, bindings);
- }
- return init;
- }
-
- protected virtual Expression VisitListInit(ListInitExpression init)
- {
- NewExpression n = this.VisitNew(init.NewExpression);
- IEnumerable<ElementInit> initializers = this.VisitElementInitializerList(init.Initializers);
- if (n != init.NewExpression || initializers != init.Initializers)
- {
- return Expression.ListInit(n, initializers);
- }
- return init;
- }
-
- protected virtual Expression VisitNewArray(NewArrayExpression na)
- {
- IEnumerable<Expression> exprs = this.VisitExpressionList(na.Expressions);
- if (exprs != na.Expressions)
- {
- if (na.NodeType == ExpressionType.NewArrayInit)
- {
- return Expression.NewArrayInit(na.Type.GetElementType(), exprs);
- }
- else
- {
- return Expression.NewArrayBounds(na.Type.GetElementType(), exprs);
- }
- }
- return na;
- }
-
- protected virtual Expression VisitInvocation(InvocationExpression iv)
- {
- IEnumerable<Expression> args = this.VisitExpressionList(iv.Arguments);
- Expression expr = this.Visit(iv.Expression);
- if (args != iv.Arguments || expr != iv.Expression)
- {
- return Expression.Invoke(expr, args);
- }
- return iv;
- }
- }
-}
-
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Providers/Reactive/Linq/Observable.Queryable.cs b/Rx.NET/System.Reactive.Providers/Reactive/Linq/Observable.Queryable.cs
deleted file mode 100644
index c0531e8..0000000
--- a/Rx.NET/System.Reactive.Providers/Reactive/Linq/Observable.Queryable.cs
+++ /dev/null
@@ -1,42 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#pragma warning disable 1591
-
-namespace System.Reactive.Linq
-{
- public static partial class Qbservable
- {
- private static IQbservableProvider s_provider;
-
- /// <summary>
- /// Gets the local query provider which will retarget Qbservable-based queries to the corresponding Observable-based query for in-memory execution upon subscription.
- /// </summary>
- public static IQbservableProvider Provider
- {
- get
- {
- if (s_provider == null)
- s_provider = new ObservableQueryProvider();
-
- return s_provider;
- }
- }
-
- /// <summary>
- /// Converts an in-memory observable sequence into an IQbservable&lt;T&gt; sequence with an expression tree representing the source sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence.</param>
- /// <returns>IQbservable&lt;T&gt; sequence representing the given observable source sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- public static IQbservable<TSource> AsQbservable<TSource>(this IObservable<TSource> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return new ObservableQuery<TSource>(source);
- }
- }
-}
-
-#pragma warning restore 1591 \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Providers/Reactive/Linq/Qbservable.Generated.cs b/Rx.NET/System.Reactive.Providers/Reactive/Linq/Qbservable.Generated.cs
deleted file mode 100644
index 2cf02e9..0000000
--- a/Rx.NET/System.Reactive.Providers/Reactive/Linq/Qbservable.Generated.cs
+++ /dev/null
@@ -1,22610 +0,0 @@
-/*
- * WARNING: Auto-generated file (8/14/2012 12:14:10 AM)
- */
-
-#pragma warning disable 1591
-
-#if !NO_EXPRESSIONS
-
-using System;
-using System.Reactive.Concurrency;
-using System.Collections.Generic;
-using System.Reactive.Joins;
-using System.Linq;
-using System.Linq.Expressions;
-using System.Reflection;
-using System.Threading;
-using System.Reactive;
-using System.Reactive.Subjects;
-#if !NO_TPL
-using System.Threading.Tasks;
-#endif
-#if !NO_REMOTING
-using System.Runtime.Remoting.Lifetime;
-#endif
-
-namespace System.Reactive.Linq
-{
- public static partial class Qbservable
- {
- /// <summary>
- /// Applies an accumulator function over an observable sequence, returning the result of the aggregation as a single element in the result sequence.
- /// For aggregation behavior with incremental intermediate results, see <see cref="M:System.Reactive.Linq.Observable.Scan``1(System.IObservable{``0},System.Func{``0,``0,``0})" />.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence and the result of the aggregation.</typeparam>
- /// <param name="source">An observable sequence to aggregate over.</param>
- /// <param name="accumulator">An accumulator function to be invoked on each element.</param>
- /// <returns>An observable sequence containing a single element with the final accumulator value.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="accumulator" /> is null.</exception>
- /// <exception cref="T:System.InvalidOperationException">(Asynchronous) The source sequence is empty.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IQbservable<TSource> Aggregate<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, TSource, TSource>> accumulator)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (accumulator == null)
- throw new ArgumentNullException("accumulator");
-
- return source.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Aggregate<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, TSource, TSource>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- accumulator
- )
- );
- }
-
- /// <summary>
- /// Applies an accumulator function over an observable sequence, returning the result of the aggregation as a single element in the result sequence. The specified seed value is used as the initial accumulator value.
- /// For aggregation behavior with incremental intermediate results, see <see cref="M:System.Reactive.Linq.Observable.Scan``2(System.IObservable{``0},``1,System.Func{``1,``0,``1})" />.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TAccumulate">The type of the result of the aggregation.</typeparam>
- /// <param name="source">An observable sequence to aggregate over.</param>
- /// <param name="seed">The initial accumulator value.</param>
- /// <param name="accumulator">An accumulator function to be invoked on each element.</param>
- /// <returns>An observable sequence containing a single element with the final accumulator value.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="accumulator" /> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IQbservable<TAccumulate> Aggregate<TSource, TAccumulate>(this IQbservable<TSource> source, TAccumulate seed, Expression<Func<TAccumulate, TSource, TAccumulate>> accumulator)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (accumulator == null)
- throw new ArgumentNullException("accumulator");
-
- return source.Provider.CreateQuery<TAccumulate>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Aggregate<TSource, TAccumulate>(default(IQbservable<TSource>), default(TAccumulate), default(Expression<Func<TAccumulate, TSource, TAccumulate>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TAccumulate)),
-#endif
- source.Expression,
- Expression.Constant(seed, typeof(TAccumulate)),
- accumulator
- )
- );
- }
-
- /// <summary>
- /// Applies an accumulator function over an observable sequence, returning the result of the aggregation as a single element in the result sequence. The specified seed value is used as the initial accumulator value,
- /// and the specified result selector function is used to select the result value.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TAccumulate">The type of the accumulator value.</typeparam>
- /// <typeparam name="TResult">The type of the resulting value.</typeparam>
- /// <param name="source">An observable sequence to aggregate over.</param>
- /// <param name="seed">The initial accumulator value.</param>
- /// <param name="accumulator">An accumulator function to be invoked on each element.</param>
- /// <param name="resultSelector">A function to transform the final accumulator value into the result value.</param>
- /// <returns>An observable sequence containing a single element with the final accumulator value.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="accumulator" /> or <paramref name="resultSelector" /> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IQbservable<TResult> Aggregate<TSource, TAccumulate, TResult>(this IQbservable<TSource> source, TAccumulate seed, Expression<Func<TAccumulate, TSource, TAccumulate>> accumulator, Expression<Func<TAccumulate, TResult>> resultSelector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (accumulator == null)
- throw new ArgumentNullException("accumulator");
- if (resultSelector == null)
- throw new ArgumentNullException("resultSelector");
-
- return source.Provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Aggregate<TSource, TAccumulate, TResult>(default(IQbservable<TSource>), default(TAccumulate), default(Expression<Func<TAccumulate, TSource, TAccumulate>>), default(Expression<Func<TAccumulate, TResult>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TAccumulate), typeof(TResult)),
-#endif
- source.Expression,
- Expression.Constant(seed, typeof(TAccumulate)),
- accumulator,
- resultSelector
- )
- );
- }
-
- /// <summary>
- /// Determines whether all elements of an observable sequence satisfy a condition.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">An observable sequence whose elements to apply the predicate to.</param>
- /// <param name="predicate">A function to test each element for a condition.</param>
- /// <returns>An observable sequence containing a single element determining whether all elements in the source sequence pass the test in the specified predicate.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="predicate" /> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IQbservable<bool> All<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, bool>> predicate)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (predicate == null)
- throw new ArgumentNullException("predicate");
-
- return source.Provider.CreateQuery<bool>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.All<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, bool>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- predicate
- )
- );
- }
-
- /// <summary>
- /// Propagates the observable sequence that reacts first.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequences.</typeparam>
- /// <param name="first">First observable sequence.</param>
- /// <param name="second">Second observable sequence.</param>
- /// <returns>An observable sequence that surfaces either of the given sequences, whichever reacted first.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="first" /> or <paramref name="second" /> is null.</exception>
- public static IQbservable<TSource> Amb<TSource>(this IQbservable<TSource> first, IObservable<TSource> second)
- {
- if (first == null)
- throw new ArgumentNullException("first");
- if (second == null)
- throw new ArgumentNullException("second");
-
- return first.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Amb<TSource>(default(IQbservable<TSource>), default(IObservable<TSource>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- first.Expression,
- GetSourceExpression(second)
- )
- );
- }
-
- /// <summary>
- /// Propagates the observable sequence that reacts first.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TSource">The type of the elements in the source sequences.</typeparam>
- /// <param name="sources">Observable sources competing to react first.</param>
- /// <returns>An observable sequence that surfaces any of the given sequences, whichever reacted first.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="sources" /> is null.</exception>
- public static IQbservable<TSource> Amb<TSource>(this IQbservableProvider provider, params IObservable<TSource>[] sources)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (sources == null)
- throw new ArgumentNullException("sources");
-
- return provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Amb<TSource>(default(IQbservableProvider), default(IObservable<TSource>[]))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- GetSourceExpression(sources)
- )
- );
- }
-
- /// <summary>
- /// Propagates the observable sequence that reacts first.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TSource">The type of the elements in the source sequences.</typeparam>
- /// <param name="sources">Observable sources competing to react first.</param>
- /// <returns>An observable sequence that surfaces any of the given sequences, whichever reacted first.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="sources" /> is null.</exception>
- public static IQbservable<TSource> Amb<TSource>(this IQbservableProvider provider, IEnumerable<IObservable<TSource>> sources)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (sources == null)
- throw new ArgumentNullException("sources");
-
- return provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Amb<TSource>(default(IQbservableProvider), default(IEnumerable<IObservable<TSource>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- GetSourceExpression(sources)
- )
- );
- }
-
- /// <summary>
- /// Determines whether an observable sequence contains any elements.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">An observable sequence to check for non-emptiness.</param>
- /// <returns>An observable sequence containing a single element determining whether the source sequence contains any elements.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IQbservable<bool> Any<TSource>(this IQbservable<TSource> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return source.Provider.CreateQuery<bool>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Any<TSource>(default(IQbservable<TSource>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression
- )
- );
- }
-
- /// <summary>
- /// Determines whether any element of an observable sequence satisfies a condition.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">An observable sequence whose elements to apply the predicate to.</param>
- /// <param name="predicate">A function to test each element for a condition.</param>
- /// <returns>An observable sequence containing a single element determining whether any elements in the source sequence pass the test in the specified predicate.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="predicate" /> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IQbservable<bool> Any<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, bool>> predicate)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (predicate == null)
- throw new ArgumentNullException("predicate");
-
- return source.Provider.CreateQuery<bool>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Any<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, bool>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- predicate
- )
- );
- }
-
- /// <summary>
- /// Computes the average of an observable sequence of <see cref="T:System.Decimal" /> values.
- /// </summary>
- /// <param name="source">A sequence of <see cref="T:System.Decimal" /> values to calculate the average of.</param>
- /// <returns>An observable sequence containing a single element with the average of the sequence of values.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> is null.</exception>
- /// <exception cref="T:System.InvalidOperationException">(Asynchronous) The source sequence is empty.</exception>
- /// <exception cref="T:System.OverflowException">(Asynchronous) The sum of the elements in the source sequence is larger than <see cref="M:System.Decimal.MaxValue" />.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IQbservable<decimal> Average(this IQbservable<decimal> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return source.Provider.CreateQuery<decimal>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Average(default(IQbservable<decimal>))),
-#else
- (MethodInfo)MethodInfo.GetCurrentMethod(),
-#endif
- source.Expression
- )
- );
- }
-
- /// <summary>
- /// Computes the average of an observable sequence of <see cref="T:System.Double" /> values.
- /// </summary>
- /// <param name="source">A sequence of <see cref="T:System.Double" /> values to calculate the average of.</param>
- /// <returns>An observable sequence containing a single element with the average of the sequence of values.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> is null.</exception>
- /// <exception cref="T:System.InvalidOperationException">(Asynchronous) The source sequence is empty.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IQbservable<double> Average(this IQbservable<double> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return source.Provider.CreateQuery<double>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Average(default(IQbservable<double>))),
-#else
- (MethodInfo)MethodInfo.GetCurrentMethod(),
-#endif
- source.Expression
- )
- );
- }
-
- /// <summary>
- /// Computes the average of an observable sequence of <see cref="T:System.Int32" /> values.
- /// </summary>
- /// <param name="source">A sequence of <see cref="T:System.Int32" /> values to calculate the average of.</param>
- /// <returns>An observable sequence containing a single element with the average of the sequence of values.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> is null.</exception>
- /// <exception cref="T:System.InvalidOperationException">(Asynchronous) The source sequence is empty.</exception>
- /// <exception cref="T:System.OverflowException">(Asynchronous) The sum of the elements in the source sequence is larger than <see cref="M:System.Int64.MaxValue" />.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IQbservable<double> Average(this IQbservable<int> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return source.Provider.CreateQuery<double>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Average(default(IQbservable<int>))),
-#else
- (MethodInfo)MethodInfo.GetCurrentMethod(),
-#endif
- source.Expression
- )
- );
- }
-
- /// <summary>
- /// Computes the average of an observable sequence of <see cref="T:System.Int64" /> values.
- /// </summary>
- /// <param name="source">A sequence of <see cref="T:System.Int64" /> values to calculate the average of.</param>
- /// <returns>An observable sequence containing a single element with the average of the sequence of values.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> is null.</exception>
- /// <exception cref="T:System.InvalidOperationException">(Asynchronous) The source sequence is empty.</exception>
- /// <exception cref="T:System.OverflowException">(Asynchronous) The sum of the elements in the source sequence is larger than <see cref="M:System.Int64.MaxValue" />.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IQbservable<double> Average(this IQbservable<long> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return source.Provider.CreateQuery<double>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Average(default(IQbservable<long>))),
-#else
- (MethodInfo)MethodInfo.GetCurrentMethod(),
-#endif
- source.Expression
- )
- );
- }
-
- /// <summary>
- /// Computes the average of an observable sequence of nullable <see cref="T:System.Decimal" /> values.
- /// </summary>
- /// <param name="source">A sequence of nullable <see cref="T:System.Decimal" /> values to calculate the average of.</param>
- /// <returns>An observable sequence containing a single element with the average of the sequence of values, or null if the source sequence is empty or contains only values that are null.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> is null.</exception>
- /// <exception cref="T:System.InvalidOperationException">(Asynchronous) The source sequence is empty.</exception>
- /// <exception cref="T:System.OverflowException">(Asynchronous) The sum of the elements in the source sequence is larger than <see cref="M:System.Decimal.MaxValue" />.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IQbservable<decimal?> Average(this IQbservable<decimal?> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return source.Provider.CreateQuery<decimal?>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Average(default(IQbservable<decimal?>))),
-#else
- (MethodInfo)MethodInfo.GetCurrentMethod(),
-#endif
- source.Expression
- )
- );
- }
-
- /// <summary>
- /// Computes the average of an observable sequence of nullable <see cref="T:System.Double" /> values.
- /// </summary>
- /// <param name="source">A sequence of nullable <see cref="T:System.Double" /> values to calculate the average of.</param>
- /// <returns>An observable sequence containing a single element with the average of the sequence of values, or null if the source sequence is empty or contains only values that are null.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> is null.</exception>
- /// <exception cref="T:System.InvalidOperationException">(Asynchronous) The source sequence is empty.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IQbservable<double?> Average(this IQbservable<double?> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return source.Provider.CreateQuery<double?>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Average(default(IQbservable<double?>))),
-#else
- (MethodInfo)MethodInfo.GetCurrentMethod(),
-#endif
- source.Expression
- )
- );
- }
-
- /// <summary>
- /// Computes the average of an observable sequence of nullable <see cref="T:System.Int32" /> values.
- /// </summary>
- /// <param name="source">A sequence of nullable <see cref="T:System.Int32" /> values to calculate the average of.</param>
- /// <returns>An observable sequence containing a single element with the average of the sequence of values, or null if the source sequence is empty or contains only values that are null.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> is null.</exception>
- /// <exception cref="T:System.InvalidOperationException">(Asynchronous) The source sequence is empty.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- /// <exception cref="T:System.OverflowException">(Asynchronous) The sum of the elements in the source sequence is larger than <see cref="M:System.Int64.MaxValue" />.</exception>
- public static IQbservable<double?> Average(this IQbservable<int?> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return source.Provider.CreateQuery<double?>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Average(default(IQbservable<int?>))),
-#else
- (MethodInfo)MethodInfo.GetCurrentMethod(),
-#endif
- source.Expression
- )
- );
- }
-
- /// <summary>
- /// Computes the average of an observable sequence of nullable <see cref="T:System.Int64" /> values.
- /// </summary>
- /// <param name="source">A sequence of nullable <see cref="T:System.Int64" /> values to calculate the average of.</param>
- /// <returns>An observable sequence containing a single element with the average of the sequence of values, or null if the source sequence is empty or contains only values that are null.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> is null.</exception>
- /// <exception cref="T:System.InvalidOperationException">(Asynchronous) The source sequence is empty.</exception>
- /// <exception cref="T:System.OverflowException">(Asynchronous) The sum of the elements in the source sequence is larger than <see cref="M:System.Int64.MaxValue" />.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IQbservable<double?> Average(this IQbservable<long?> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return source.Provider.CreateQuery<double?>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Average(default(IQbservable<long?>))),
-#else
- (MethodInfo)MethodInfo.GetCurrentMethod(),
-#endif
- source.Expression
- )
- );
- }
-
- /// <summary>
- /// Computes the average of an observable sequence of nullable <see cref="T:System.Single" /> values.
- /// </summary>
- /// <param name="source">A sequence of nullable <see cref="T:System.Single" /> values to calculate the average of.</param>
- /// <returns>An observable sequence containing a single element with the average of the sequence of values, or null if the source sequence is empty or contains only values that are null.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> is null.</exception>
- /// <exception cref="T:System.InvalidOperationException">(Asynchronous) The source sequence is empty.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IQbservable<float?> Average(this IQbservable<float?> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return source.Provider.CreateQuery<float?>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Average(default(IQbservable<float?>))),
-#else
- (MethodInfo)MethodInfo.GetCurrentMethod(),
-#endif
- source.Expression
- )
- );
- }
-
- /// <summary>
- /// Computes the average of an observable sequence of <see cref="T:System.Single" /> values.
- /// </summary>
- /// <param name="source">A sequence of <see cref="T:System.Single" /> values to calculate the average of.</param>
- /// <returns>An observable sequence containing a single element with the average of the sequence of values.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> is null.</exception>
- /// <exception cref="T:System.InvalidOperationException">(Asynchronous) The source sequence is empty.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IQbservable<float> Average(this IQbservable<float> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return source.Provider.CreateQuery<float>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Average(default(IQbservable<float>))),
-#else
- (MethodInfo)MethodInfo.GetCurrentMethod(),
-#endif
- source.Expression
- )
- );
- }
-
- /// <summary>
- /// Computes the average of an observable sequence of <see cref="T:System.Decimal" /> values that are obtained by invoking a transform function on each element of the input sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values to calculate the average of.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the average of the sequence of values.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
- /// <exception cref="T:System.InvalidOperationException">(Asynchronous) The source sequence is empty.</exception>
- /// <exception cref="T:System.OverflowException">(Asynchronous) The sum of the projected values for the elements in the source sequence is larger than <see cref="M:System.Decimal.MaxValue" />.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IQbservable<decimal> Average<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, decimal>> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return source.Provider.CreateQuery<decimal>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Average<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, decimal>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- selector
- )
- );
- }
-
- /// <summary>
- /// Computes the average of an observable sequence of <see cref="T:System.Double" /> values that are obtained by invoking a transform function on each element of the input sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values to calculate the average of.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the average of the sequence of values.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
- /// <exception cref="T:System.InvalidOperationException">(Asynchronous) The source sequence is empty.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IQbservable<double> Average<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, double>> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return source.Provider.CreateQuery<double>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Average<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, double>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- selector
- )
- );
- }
-
- /// <summary>
- /// Computes the average of an observable sequence of <see cref="T:System.Single" /> values that are obtained by invoking a transform function on each element of the input sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values to calculate the average of.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the average of the sequence of values.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
- /// <exception cref="T:System.InvalidOperationException">(Asynchronous) The source sequence is empty.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IQbservable<float> Average<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, float>> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return source.Provider.CreateQuery<float>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Average<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, float>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- selector
- )
- );
- }
-
- /// <summary>
- /// Computes the average of an observable sequence of <see cref="T:System.Int32" /> values that are obtained by invoking a transform function on each element of the input sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values to calculate the average of.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the average of the sequence of values.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
- /// <exception cref="T:System.InvalidOperationException">(Asynchronous) The source sequence is empty.</exception>
- /// <exception cref="T:System.OverflowException">(Asynchronous) The sum of the projected values for the elements in the source sequence is larger than <see cref="M:System.Int64.MaxValue" />.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IQbservable<double> Average<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, int>> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return source.Provider.CreateQuery<double>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Average<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, int>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- selector
- )
- );
- }
-
- /// <summary>
- /// Computes the average of an observable sequence of <see cref="T:System.Int64" /> values that are obtained by invoking a transform function on each element of the input sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values to calculate the average of.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the average of the sequence of values.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
- /// <exception cref="T:System.InvalidOperationException">(Asynchronous) The source sequence is empty.</exception>
- /// <exception cref="T:System.OverflowException">(Asynchronous) The sum of the projected values for the elements in the source sequence is larger than <see cref="M:System.Int64.MaxValue" />.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IQbservable<double> Average<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, long>> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return source.Provider.CreateQuery<double>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Average<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, long>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- selector
- )
- );
- }
-
- /// <summary>
- /// Computes the average of an observable sequence of nullable <see cref="T:System.Decimal" /> values that are obtained by invoking a transform function on each element of the input sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values to calculate the average of.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the average of the sequence of values, or null if the source sequence is empty or contains only values that are null.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
- /// <exception cref="T:System.InvalidOperationException">(Asynchronous) The source sequence is empty.</exception>
- /// <exception cref="T:System.OverflowException">(Asynchronous) The sum of the projected values for the elements in the source sequence is larger than <see cref="M:System.Decimal.MaxValue" />.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IQbservable<decimal?> Average<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, decimal?>> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return source.Provider.CreateQuery<decimal?>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Average<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, decimal?>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- selector
- )
- );
- }
-
- /// <summary>
- /// Computes the average of an observable sequence of nullable <see cref="T:System.Double" /> values that are obtained by invoking a transform function on each element of the input sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values to calculate the average of.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the average of the sequence of values, or null if the source sequence is empty or contains only values that are null.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
- /// <exception cref="T:System.InvalidOperationException">(Asynchronous) The source sequence is empty.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IQbservable<double?> Average<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, double?>> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return source.Provider.CreateQuery<double?>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Average<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, double?>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- selector
- )
- );
- }
-
- /// <summary>
- /// Computes the average of an observable sequence of nullable <see cref="T:System.Single" /> values that are obtained by invoking a transform function on each element of the input sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values to calculate the average of.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the average of the sequence of values, or null if the source sequence is empty or contains only values that are null.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
- /// <exception cref="T:System.InvalidOperationException">(Asynchronous) The source sequence is empty.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IQbservable<float?> Average<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, float?>> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return source.Provider.CreateQuery<float?>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Average<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, float?>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- selector
- )
- );
- }
-
- /// <summary>
- /// Computes the average of an observable sequence of nullable <see cref="T:System.Int32" /> values that are obtained by invoking a transform function on each element of the input sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values to calculate the average of.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the average of the sequence of values, or null if the source sequence is empty or contains only values that are null.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
- /// <exception cref="T:System.InvalidOperationException">(Asynchronous) The source sequence is empty.</exception>
- /// <exception cref="T:System.OverflowException">(Asynchronous) The sum of the projected values for the elements in the source sequence is larger than <see cref="M:System.Int64.MaxValue" />.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IQbservable<double?> Average<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, int?>> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return source.Provider.CreateQuery<double?>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Average<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, int?>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- selector
- )
- );
- }
-
- /// <summary>
- /// Computes the average of an observable sequence of nullable <see cref="T:System.Int64" /> values that are obtained by invoking a transform function on each element of the input sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values to calculate the average of.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the average of the sequence of values, or null if the source sequence is empty or contains only values that are null.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
- /// <exception cref="T:System.InvalidOperationException">(Asynchronous) The source sequence is empty.</exception>
- /// <exception cref="T:System.OverflowException">(Asynchronous) The sum of the projected values for the elements in the source sequence is larger than <see cref="M:System.Int64.MaxValue" />.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IQbservable<double?> Average<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, long?>> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return source.Provider.CreateQuery<double?>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Average<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, long?>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- selector
- )
- );
- }
-
- /// <summary>
- /// Projects each element of an observable sequence into consecutive non-overlapping buffers which are produced based on element count information.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence, and in the lists in the result sequence.</typeparam>
- /// <param name="source">Source sequence to produce buffers over.</param>
- /// <param name="count">Length of each buffer.</param>
- /// <returns>An observable sequence of buffers.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> is null.</exception>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// <paramref name="count" /> is less than or equal to zero.</exception>
- public static IQbservable<IList<TSource>> Buffer<TSource>(this IQbservable<TSource> source, int count)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return source.Provider.CreateQuery<IList<TSource>>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Buffer<TSource>(default(IQbservable<TSource>), default(int))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- Expression.Constant(count, typeof(int))
- )
- );
- }
-
- /// <summary>
- /// Projects each element of an observable sequence into zero or more buffers which are produced based on element count information.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence, and in the lists in the result sequence.</typeparam>
- /// <param name="source">Source sequence to produce buffers over.</param>
- /// <param name="count">Length of each buffer.</param>
- /// <param name="skip">Number of elements to skip between creation of consecutive buffers.</param>
- /// <returns>An observable sequence of buffers.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> is null.</exception>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// <paramref name="count" /> or <paramref name="skip" /> is less than or equal to zero.</exception>
- public static IQbservable<IList<TSource>> Buffer<TSource>(this IQbservable<TSource> source, int count, int skip)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return source.Provider.CreateQuery<IList<TSource>>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Buffer<TSource>(default(IQbservable<TSource>), default(int), default(int))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- Expression.Constant(count, typeof(int)),
- Expression.Constant(skip, typeof(int))
- )
- );
- }
-
- /// <summary>
- /// Projects each element of an observable sequence into consecutive non-overlapping buffers which are produced based on timing information.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence, and in the lists in the result sequence.</typeparam>
- /// <param name="source">Source sequence to produce buffers over.</param>
- /// <param name="timeSpan">Length of each buffer.</param>
- /// <returns>An observable sequence of buffers.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> is null.</exception>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// <paramref name="timeSpan" /> is less than TimeSpan.Zero.</exception>
- /// <remarks>
- /// Specifying a TimeSpan.Zero value for <paramref name="timeSpan" /> is not recommended but supported, causing the scheduler to create buffers as fast as it can.
- /// Because all source sequence elements end up in one of the buffers, some buffers won't have a zero time span. This is a side-effect of the asynchrony introduced
- /// by the scheduler, where the action to close the current buffer and to create a new buffer may not execute immediately, despite the TimeSpan.Zero due time.
- /// </remarks>
- public static IQbservable<IList<TSource>> Buffer<TSource>(this IQbservable<TSource> source, TimeSpan timeSpan)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return source.Provider.CreateQuery<IList<TSource>>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Buffer<TSource>(default(IQbservable<TSource>), default(TimeSpan))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- Expression.Constant(timeSpan, typeof(TimeSpan))
- )
- );
- }
-
- /// <summary>
- /// Projects each element of an observable sequence into a buffer that's sent out when either it's full or a given amount of time has elapsed.
- /// A useful real-world analogy of this overload is the behavior of a ferry leaving the dock when all seats are taken, or at the scheduled time of departure, whichever event occurs first.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence, and in the lists in the result sequence.</typeparam>
- /// <param name="source">Source sequence to produce buffers over.</param>
- /// <param name="timeSpan">Maximum time length of a window.</param>
- /// <param name="count">Maximum element count of a window.</param>
- /// <returns>An observable sequence of buffers.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> is null.</exception>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// <paramref name="timeSpan" /> is less than TimeSpan.Zero. -or- <paramref name="count" /> is less than or equal to zero.</exception>
- /// <remarks>
- /// Specifying a TimeSpan.Zero value for <paramref name="timeSpan" /> is not recommended but supported, causing the scheduler to create buffers as fast as it can.
- /// Because all source sequence elements end up in one of the buffers, some buffers won't have a zero time span. This is a side-effect of the asynchrony introduced
- /// by the scheduler, where the action to close the current buffer and to create a new buffer may not execute immediately, despite the TimeSpan.Zero due time.
- /// </remarks>
- public static IQbservable<IList<TSource>> Buffer<TSource>(this IQbservable<TSource> source, TimeSpan timeSpan, int count)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return source.Provider.CreateQuery<IList<TSource>>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Buffer<TSource>(default(IQbservable<TSource>), default(TimeSpan), default(int))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- Expression.Constant(timeSpan, typeof(TimeSpan)),
- Expression.Constant(count, typeof(int))
- )
- );
- }
-
- /// <summary>
- /// Projects each element of an observable sequence into a buffer that's sent out when either it's full or a given amount of time has elapsed, using the specified scheduler to run timers.
- /// A useful real-world analogy of this overload is the behavior of a ferry leaving the dock when all seats are taken, or at the scheduled time of departure, whichever event occurs first.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence, and in the lists in the result sequence.</typeparam>
- /// <param name="source">Source sequence to produce buffers over.</param>
- /// <param name="timeSpan">Maximum time length of a buffer.</param>
- /// <param name="count">Maximum element count of a buffer.</param>
- /// <param name="scheduler">Scheduler to run buffering timers on.</param>
- /// <returns>An observable sequence of buffers.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="scheduler" /> is null.</exception>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// <paramref name="timeSpan" /> is less than TimeSpan.Zero. -or- <paramref name="count" /> is less than or equal to zero.</exception>
- /// <remarks>
- /// Specifying a TimeSpan.Zero value for <paramref name="timeSpan" /> is not recommended but supported, causing the scheduler to create buffers as fast as it can.
- /// Because all source sequence elements end up in one of the buffers, some buffers won't have a zero time span. This is a side-effect of the asynchrony introduced
- /// by the scheduler, where the action to close the current buffer and to create a new buffer may not execute immediately, despite the TimeSpan.Zero due time.
- /// </remarks>
- public static IQbservable<IList<TSource>> Buffer<TSource>(this IQbservable<TSource> source, TimeSpan timeSpan, int count, IScheduler scheduler)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return source.Provider.CreateQuery<IList<TSource>>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Buffer<TSource>(default(IQbservable<TSource>), default(TimeSpan), default(int), default(IScheduler))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- Expression.Constant(timeSpan, typeof(TimeSpan)),
- Expression.Constant(count, typeof(int)),
- Expression.Constant(scheduler, typeof(IScheduler))
- )
- );
- }
-
- /// <summary>
- /// Projects each element of an observable sequence into consecutive non-overlapping buffers which are produced based on timing information, using the specified scheduler to run timers.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence, and in the lists in the result sequence.</typeparam>
- /// <param name="source">Source sequence to produce buffers over.</param>
- /// <param name="timeSpan">Length of each buffer.</param>
- /// <param name="scheduler">Scheduler to run buffering timers on.</param>
- /// <returns>An observable sequence of buffers.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="scheduler" /> is null.</exception>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// <paramref name="timeSpan" /> is less than TimeSpan.Zero.</exception>
- /// <remarks>
- /// Specifying a TimeSpan.Zero value for <paramref name="timeSpan" /> is not recommended but supported, causing the scheduler to create buffers as fast as it can.
- /// Because all source sequence elements end up in one of the buffers, some buffers won't have a zero time span. This is a side-effect of the asynchrony introduced
- /// by the scheduler, where the action to close the current buffer and to create a new buffer may not execute immediately, despite the TimeSpan.Zero due time.
- /// </remarks>
- public static IQbservable<IList<TSource>> Buffer<TSource>(this IQbservable<TSource> source, TimeSpan timeSpan, IScheduler scheduler)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return source.Provider.CreateQuery<IList<TSource>>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Buffer<TSource>(default(IQbservable<TSource>), default(TimeSpan), default(IScheduler))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- Expression.Constant(timeSpan, typeof(TimeSpan)),
- Expression.Constant(scheduler, typeof(IScheduler))
- )
- );
- }
-
- /// <summary>
- /// Projects each element of an observable sequence into zero or more buffers which are produced based on timing information.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence, and in the lists in the result sequence.</typeparam>
- /// <param name="source">Source sequence to produce buffers over.</param>
- /// <param name="timeSpan">Length of each buffer.</param>
- /// <param name="timeShift">Interval between creation of consecutive buffers.</param>
- /// <returns>An observable sequence of buffers.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> is null.</exception>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// <paramref name="timeSpan" /> or <paramref name="timeSpan" /> is less than TimeSpan.Zero.</exception>
- /// <remarks>
- /// <para>
- /// Specifying a TimeSpan.Zero value for <paramref name="timeSpan" /> is not recommended but supported, causing the scheduler to create buffers with minimum duration
- /// length. However, some buffers won't have a zero time span. This is a side-effect of the asynchrony introduced by the scheduler, where the action to close the
- /// current buffer may not execute immediately, despite the TimeSpan.Zero due time.
- /// </para>
- /// <para>
- /// Specifying a TimeSpan.Zero value for <paramref name="timeShift" /> is not recommended but supported, causing the scheduler to create buffers as fast as it can.
- /// However, this doesn't mean all buffers will start at the beginning of the source sequence. This is a side-effect of the asynchrony introduced by the scheduler,
- /// where the action to create a new buffer may not execute immediately, despite the TimeSpan.Zero due time.
- /// </para>
- /// </remarks>
- public static IQbservable<IList<TSource>> Buffer<TSource>(this IQbservable<TSource> source, TimeSpan timeSpan, TimeSpan timeShift)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return source.Provider.CreateQuery<IList<TSource>>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Buffer<TSource>(default(IQbservable<TSource>), default(TimeSpan), default(TimeSpan))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- Expression.Constant(timeSpan, typeof(TimeSpan)),
- Expression.Constant(timeShift, typeof(TimeSpan))
- )
- );
- }
-
- /// <summary>
- /// Projects each element of an observable sequence into zero or more buffers which are produced based on timing information, using the specified scheduler to run timers.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence, and in the lists in the result sequence.</typeparam>
- /// <param name="source">Source sequence to produce buffers over.</param>
- /// <param name="timeSpan">Length of each buffer.</param>
- /// <param name="timeShift">Interval between creation of consecutive buffers.</param>
- /// <param name="scheduler">Scheduler to run buffering timers on.</param>
- /// <returns>An observable sequence of buffers.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="scheduler" /> is null.</exception>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// <paramref name="timeSpan" /> or <paramref name="timeSpan" /> is less than TimeSpan.Zero.</exception>
- /// <remarks>
- /// <para>
- /// Specifying a TimeSpan.Zero value for <paramref name="timeSpan" /> is not recommended but supported, causing the scheduler to create buffers with minimum duration
- /// length. However, some buffers won't have a zero time span. This is a side-effect of the asynchrony introduced by the scheduler, where the action to close the
- /// current buffer may not execute immediately, despite the TimeSpan.Zero due time.
- /// </para>
- /// <para>
- /// Specifying a TimeSpan.Zero value for <paramref name="timeShift" /> is not recommended but supported, causing the scheduler to create buffers as fast as it can.
- /// However, this doesn't mean all buffers will start at the beginning of the source sequence. This is a side-effect of the asynchrony introduced by the scheduler,
- /// where the action to create a new buffer may not execute immediately, despite the TimeSpan.Zero due time.
- /// </para>
- /// </remarks>
- public static IQbservable<IList<TSource>> Buffer<TSource>(this IQbservable<TSource> source, TimeSpan timeSpan, TimeSpan timeShift, IScheduler scheduler)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return source.Provider.CreateQuery<IList<TSource>>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Buffer<TSource>(default(IQbservable<TSource>), default(TimeSpan), default(TimeSpan), default(IScheduler))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- Expression.Constant(timeSpan, typeof(TimeSpan)),
- Expression.Constant(timeShift, typeof(TimeSpan)),
- Expression.Constant(scheduler, typeof(IScheduler))
- )
- );
- }
-
- /// <summary>
- /// Projects each element of an observable sequence into consecutive non-overlapping buffers.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence, and in the lists in the result sequence.</typeparam>
- /// <typeparam name="TBufferBoundary">The type of the elements in the sequences indicating buffer boundary events.</typeparam>
- /// <param name="source">Source sequence to produce buffers over.</param>
- /// <param name="bufferBoundaries">Sequence of buffer boundary markers. The current buffer is closed and a new buffer is opened upon receiving a boundary marker.</param>
- /// <returns>An observable sequence of buffers.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="bufferBoundaries" /> is null.</exception>
- public static IQbservable<IList<TSource>> Buffer<TSource, TBufferBoundary>(this IQbservable<TSource> source, IObservable<TBufferBoundary> bufferBoundaries)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (bufferBoundaries == null)
- throw new ArgumentNullException("bufferBoundaries");
-
- return source.Provider.CreateQuery<IList<TSource>>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Buffer<TSource, TBufferBoundary>(default(IQbservable<TSource>), default(IObservable<TBufferBoundary>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TBufferBoundary)),
-#endif
- source.Expression,
- GetSourceExpression(bufferBoundaries)
- )
- );
- }
-
- /// <summary>
- /// Projects each element of an observable sequence into consecutive non-overlapping buffers.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence, and in the lists in the result sequence.</typeparam>
- /// <typeparam name="TBufferClosing">The type of the elements in the sequences indicating buffer closing events.</typeparam>
- /// <param name="source">Source sequence to produce buffers over.</param>
- /// <param name="bufferClosingSelector">A function invoked to define the boundaries of the produced buffers. A new buffer is started when the previous one is closed.</param>
- /// <returns>An observable sequence of buffers.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="bufferClosingSelector" /> is null.</exception>
- public static IQbservable<IList<TSource>> Buffer<TSource, TBufferClosing>(this IQbservable<TSource> source, Expression<Func<IObservable<TBufferClosing>>> bufferClosingSelector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (bufferClosingSelector == null)
- throw new ArgumentNullException("bufferClosingSelector");
-
- return source.Provider.CreateQuery<IList<TSource>>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Buffer<TSource, TBufferClosing>(default(IQbservable<TSource>), default(Expression<Func<IObservable<TBufferClosing>>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TBufferClosing)),
-#endif
- source.Expression,
- bufferClosingSelector
- )
- );
- }
-
- /// <summary>
- /// Projects each element of an observable sequence into zero or more buffers.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence, and in the lists in the result sequence.</typeparam>
- /// <typeparam name="TBufferOpening">The type of the elements in the sequence indicating buffer opening events, also passed to the closing selector to obtain a sequence of buffer closing events.</typeparam>
- /// <typeparam name="TBufferClosing">The type of the elements in the sequences indicating buffer closing events.</typeparam>
- /// <param name="source">Source sequence to produce buffers over.</param>
- /// <param name="bufferOpenings">Observable sequence whose elements denote the creation of new buffers.</param>
- /// <param name="bufferClosingSelector">A function invoked to define the closing of each produced buffer.</param>
- /// <returns>An observable sequence of buffers.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="bufferOpenings" /> or <paramref name="bufferClosingSelector" /> is null.</exception>
- public static IQbservable<IList<TSource>> Buffer<TSource, TBufferOpening, TBufferClosing>(this IQbservable<TSource> source, IObservable<TBufferOpening> bufferOpenings, Expression<Func<TBufferOpening, IObservable<TBufferClosing>>> bufferClosingSelector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (bufferOpenings == null)
- throw new ArgumentNullException("bufferOpenings");
- if (bufferClosingSelector == null)
- throw new ArgumentNullException("bufferClosingSelector");
-
- return source.Provider.CreateQuery<IList<TSource>>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Buffer<TSource, TBufferOpening, TBufferClosing>(default(IQbservable<TSource>), default(IObservable<TBufferOpening>), default(Expression<Func<TBufferOpening, IObservable<TBufferClosing>>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TBufferOpening), typeof(TBufferClosing)),
-#endif
- source.Expression,
- GetSourceExpression(bufferOpenings),
- bufferClosingSelector
- )
- );
- }
-
- /// <summary>
- /// Uses <paramref name="selector" /> to determine which source in <paramref name="sources" /> to return, choosing an empty sequence if no match is found.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TValue">The type of the value returned by the selector function, used to look up the resulting source.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence.</typeparam>
- /// <param name="selector">Selector function invoked to determine the source to lookup in the <paramref name="sources" /> dictionary.</param>
- /// <param name="sources">Dictionary of sources to select from based on the <paramref name="selector" /> invocation result.</param>
- /// <returns>The observable sequence retrieved from the <paramref name="sources" /> dictionary based on the <paramref name="selector" /> invocation result, or an empty sequence if no match is found.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="selector" /> or <paramref name="sources" /> is null.</exception>
- public static IQbservable<TResult> Case<TValue, TResult>(this IQbservableProvider provider, Expression<Func<TValue>> selector, IDictionary<TValue, IObservable<TResult>> sources)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (selector == null)
- throw new ArgumentNullException("selector");
- if (sources == null)
- throw new ArgumentNullException("sources");
-
- return provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Case<TValue, TResult>(default(IQbservableProvider), default(Expression<Func<TValue>>), default(IDictionary<TValue, IObservable<TResult>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TValue), typeof(TResult)),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- selector,
- Expression.Constant(sources, typeof(IDictionary<TValue, IObservable<TResult>>))
- )
- );
- }
-
- /// <summary>
- /// Uses <paramref name="selector" /> to determine which source in <paramref name="sources" /> to return, choosing <paramref name="defaultSource" /> if no match is found.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TValue">The type of the value returned by the selector function, used to look up the resulting source.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence.</typeparam>
- /// <param name="selector">Selector function invoked to determine the source to lookup in the <paramref name="sources" /> dictionary.</param>
- /// <param name="sources">Dictionary of sources to select from based on the <paramref name="selector" /> invocation result.</param>
- /// <param name="defaultSource">Default source to select in case no matching source in <paramref name="sources" /> is found.</param>
- /// <returns>The observable sequence retrieved from the <paramref name="sources" /> dictionary based on the <paramref name="selector" /> invocation result, or <paramref name="defaultSource" /> if no match is found.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="selector" /> or <paramref name="sources" /> or <paramref name="defaultSource" /> is null.</exception>
- public static IQbservable<TResult> Case<TValue, TResult>(this IQbservableProvider provider, Expression<Func<TValue>> selector, IDictionary<TValue, IObservable<TResult>> sources, IObservable<TResult> defaultSource)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (selector == null)
- throw new ArgumentNullException("selector");
- if (sources == null)
- throw new ArgumentNullException("sources");
- if (defaultSource == null)
- throw new ArgumentNullException("defaultSource");
-
- return provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Case<TValue, TResult>(default(IQbservableProvider), default(Expression<Func<TValue>>), default(IDictionary<TValue, IObservable<TResult>>), default(IObservable<TResult>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TValue), typeof(TResult)),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- selector,
- Expression.Constant(sources, typeof(IDictionary<TValue, IObservable<TResult>>)),
- GetSourceExpression(defaultSource)
- )
- );
- }
-
- /// <summary>
- /// Uses <paramref name="selector" /> to determine which source in <paramref name="sources" /> to return, choosing an empty sequence on the specified scheduler if no match is found.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TValue">The type of the value returned by the selector function, used to look up the resulting source.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence.</typeparam>
- /// <param name="selector">Selector function invoked to determine the source to lookup in the <paramref name="sources" /> dictionary.</param>
- /// <param name="sources">Dictionary of sources to select from based on the <paramref name="selector" /> invocation result.</param>
- /// <param name="scheduler">Scheduler to generate an empty sequence on in case no matching source in <paramref name="sources" /> is found.</param>
- /// <returns>The observable sequence retrieved from the <paramref name="sources" /> dictionary based on the <paramref name="selector" /> invocation result, or an empty sequence if no match is found.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="selector" /> or <paramref name="sources" /> or <paramref name="scheduler" /> is null.</exception>
- public static IQbservable<TResult> Case<TValue, TResult>(this IQbservableProvider provider, Expression<Func<TValue>> selector, IDictionary<TValue, IObservable<TResult>> sources, IScheduler scheduler)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (selector == null)
- throw new ArgumentNullException("selector");
- if (sources == null)
- throw new ArgumentNullException("sources");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Case<TValue, TResult>(default(IQbservableProvider), default(Expression<Func<TValue>>), default(IDictionary<TValue, IObservable<TResult>>), default(IScheduler))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TValue), typeof(TResult)),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- selector,
- Expression.Constant(sources, typeof(IDictionary<TValue, IObservable<TResult>>)),
- Expression.Constant(scheduler, typeof(IScheduler))
- )
- );
- }
-
- /// <summary>
- /// Converts the elements of an observable sequence to the specified type.
- /// </summary>
- /// <typeparam name="TResult">The type to convert the elements in the source sequence to.</typeparam>
- /// <param name="source">The observable sequence that contains the elements to be converted.</param>
- /// <returns>An observable sequence that contains each element of the source sequence converted to the specified type.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> is null.</exception>
- public static IQbservable<TResult> Cast<TResult>(this IQbservable<object> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return source.Provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Cast<TResult>(default(IQbservable<object>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TResult)),
-#endif
- source.Expression
- )
- );
- }
-
- /// <summary>
- /// Continues an observable sequence that is terminated by an exception with the next observable sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence and handler sequence.</typeparam>
- /// <param name="first">First observable sequence whose exception (if any) is caught.</param>
- /// <param name="second">Second observable sequence used to produce results when an error occurred in the first sequence.</param>
- /// <returns>An observable sequence containing the first sequence's elements, followed by the elements of the second sequence in case an exception occurred.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="first" /> or <paramref name="second" /> is null.</exception>
- public static IQbservable<TSource> Catch<TSource>(this IQbservable<TSource> first, IObservable<TSource> second)
- {
- if (first == null)
- throw new ArgumentNullException("first");
- if (second == null)
- throw new ArgumentNullException("second");
-
- return first.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Catch<TSource>(default(IQbservable<TSource>), default(IObservable<TSource>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- first.Expression,
- GetSourceExpression(second)
- )
- );
- }
-
- /// <summary>
- /// Continues an observable sequence that is terminated by an exception with the next observable sequence.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TSource">The type of the elements in the source and handler sequences.</typeparam>
- /// <param name="sources">Observable sequences to catch exceptions for.</param>
- /// <returns>An observable sequence containing elements from consecutive source sequences until a source sequence terminates successfully.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="sources" /> is null.</exception>
- public static IQbservable<TSource> Catch<TSource>(this IQbservableProvider provider, params IObservable<TSource>[] sources)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (sources == null)
- throw new ArgumentNullException("sources");
-
- return provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Catch<TSource>(default(IQbservableProvider), default(IObservable<TSource>[]))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- GetSourceExpression(sources)
- )
- );
- }
-
- /// <summary>
- /// Continues an observable sequence that is terminated by an exception with the next observable sequence.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TSource">The type of the elements in the source and handler sequences.</typeparam>
- /// <param name="sources">Observable sequences to catch exceptions for.</param>
- /// <returns>An observable sequence containing elements from consecutive source sequences until a source sequence terminates successfully.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="sources" /> is null.</exception>
- public static IQbservable<TSource> Catch<TSource>(this IQbservableProvider provider, IEnumerable<IObservable<TSource>> sources)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (sources == null)
- throw new ArgumentNullException("sources");
-
- return provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Catch<TSource>(default(IQbservableProvider), default(IEnumerable<IObservable<TSource>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- GetSourceExpression(sources)
- )
- );
- }
-
- /// <summary>
- /// Continues an observable sequence that is terminated by an exception of the specified type with the observable sequence produced by the handler.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence and sequences returned by the exception handler function.</typeparam>
- /// <typeparam name="TException">The type of the exception to catch and handle. Needs to derive from <see cref="T:System.Exception" />.</typeparam>
- /// <param name="source">Source sequence.</param>
- /// <param name="handler">Exception handler function, producing another observable sequence.</param>
- /// <returns>An observable sequence containing the source sequence's elements, followed by the elements produced by the handler's resulting observable sequence in case an exception occurred.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="handler" /> is null.</exception>
- public static IQbservable<TSource> Catch<TSource, TException>(this IQbservable<TSource> source, Expression<Func<TException, IObservable<TSource>>> handler)
- where TException : Exception
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (handler == null)
- throw new ArgumentNullException("handler");
-
- return source.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Catch<TSource, TException>(default(IQbservable<TSource>), default(Expression<Func<TException, IObservable<TSource>>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TException)),
-#endif
- source.Expression,
- handler
- )
- );
- }
-
- /// <summary>
- /// Produces an enumerable sequence of consecutive (possibly empty) chunks of the source sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source observable sequence.</param>
- /// <returns>The enumerable sequence that returns consecutive (possibly empty) chunks upon each iteration.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> is null.</exception>
- /// <remarks>This operator requires the source's <see cref="IQbservableProvider"/> object (see <see cref="IQbservable.Provider"/>) to implement <see cref="IQueryProvider"/>.</remarks>
- public static IQueryable<IList<TSource>> Chunkify<TSource>(this IQbservable<TSource> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return ((IQueryProvider)source.Provider).CreateQuery<IList<TSource>>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Chunkify<TSource>(default(IQbservable<TSource>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression
- )
- );
- }
-
- /// <summary>
- /// Produces an enumerable sequence that returns elements collected/aggregated from the source sequence between consecutive iterations.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the elements produced by the merge operation during collection.</typeparam>
- /// <param name="source">Source observable sequence.</param>
- /// <param name="getInitialCollector">Factory to create the initial collector object.</param>
- /// <param name="merge">Merges a sequence element with the current collector.</param>
- /// <param name="getNewCollector">Factory to replace the current collector by a new collector.</param>
- /// <returns>The enumerable sequence that returns collected/aggregated elements from the source sequence upon each iteration.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="getInitialCollector" /> or <paramref name="merge" /> or <paramref name="getNewCollector" /> is null.</exception>
- /// <remarks>This operator requires the source's <see cref="IQbservableProvider"/> object (see <see cref="IQbservable.Provider"/>) to implement <see cref="IQueryProvider"/>.</remarks>
- public static IQueryable<TResult> Collect<TSource, TResult>(this IQbservable<TSource> source, Expression<Func<TResult>> getInitialCollector, Expression<Func<TResult, TSource, TResult>> merge, Expression<Func<TResult, TResult>> getNewCollector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (getInitialCollector == null)
- throw new ArgumentNullException("getInitialCollector");
- if (merge == null)
- throw new ArgumentNullException("merge");
- if (getNewCollector == null)
- throw new ArgumentNullException("getNewCollector");
-
- return ((IQueryProvider)source.Provider).CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Collect<TSource, TResult>(default(IQbservable<TSource>), default(Expression<Func<TResult>>), default(Expression<Func<TResult, TSource, TResult>>), default(Expression<Func<TResult, TResult>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)),
-#endif
- source.Expression,
- getInitialCollector,
- merge,
- getNewCollector
- )
- );
- }
-
- /// <summary>
- /// Produces an enumerable sequence that returns elements collected/aggregated from the source sequence between consecutive iterations.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the elements produced by the merge operation during collection.</typeparam>
- /// <param name="source">Source observable sequence.</param>
- /// <param name="newCollector">Factory to create a new collector object.</param>
- /// <param name="merge">Merges a sequence element with the current collector.</param>
- /// <returns>The enumerable sequence that returns collected/aggregated elements from the source sequence upon each iteration.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="newCollector" /> or <paramref name="merge" /> is null.</exception>
- /// <remarks>This operator requires the source's <see cref="IQbservableProvider"/> object (see <see cref="IQbservable.Provider"/>) to implement <see cref="IQueryProvider"/>.</remarks>
- public static IQueryable<TResult> Collect<TSource, TResult>(this IQbservable<TSource> source, Expression<Func<TResult>> newCollector, Expression<Func<TResult, TSource, TResult>> merge)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (newCollector == null)
- throw new ArgumentNullException("newCollector");
- if (merge == null)
- throw new ArgumentNullException("merge");
-
- return ((IQueryProvider)source.Provider).CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Collect<TSource, TResult>(default(IQbservable<TSource>), default(Expression<Func<TResult>>), default(Expression<Func<TResult, TSource, TResult>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)),
-#endif
- source.Expression,
- newCollector,
- merge
- )
- );
- }
-
- /// <summary>
- /// Merges the specified observable sequences into one observable sequence by emitting a list with the latest source elements whenever any of the observable sequences produces an element.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TSource">The type of the elements in the source sequences, and in the lists in the result sequence.</typeparam>
- /// <param name="sources">Observable sources.</param>
- /// <returns>An observable sequence containing lists of the latest elements of the sources.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="sources" /> is null.</exception>
- public static IQbservable<IList<TSource>> CombineLatest<TSource>(this IQbservableProvider provider, IEnumerable<IObservable<TSource>> sources)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (sources == null)
- throw new ArgumentNullException("sources");
-
- return provider.CreateQuery<IList<TSource>>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.CombineLatest<TSource>(default(IQbservableProvider), default(IEnumerable<IObservable<TSource>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- GetSourceExpression(sources)
- )
- );
- }
-
- /// <summary>
- /// Merges the specified observable sequences into one observable sequence by emitting a list with the latest source elements whenever any of the observable sequences produces an element.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TSource">The type of the elements in the source sequences, and in the lists in the result sequence.</typeparam>
- /// <param name="sources">Observable sources.</param>
- /// <returns>An observable sequence containing lists of the latest elements of the sources.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="sources" /> is null.</exception>
- public static IQbservable<IList<TSource>> CombineLatest<TSource>(this IQbservableProvider provider, params IObservable<TSource>[] sources)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (sources == null)
- throw new ArgumentNullException("sources");
-
- return provider.CreateQuery<IList<TSource>>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.CombineLatest<TSource>(default(IQbservableProvider), default(IObservable<TSource>[]))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- GetSourceExpression(sources)
- )
- );
- }
-
- /// <summary>
- /// Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TSource">The type of the elements in the source sequences.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
- /// <param name="sources">Observable sources.</param>
- /// <param name="resultSelector">Function to invoke whenever any of the sources produces an element. For efficiency, the input list is reused after the selector returns. Either aggregate or copy the values during the function call.</param>
- /// <returns>An observable sequence containing the result of combining elements of the sources using the specified result selector function.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="sources" /> or <paramref name="resultSelector" /> is null.</exception>
- public static IQbservable<TResult> CombineLatest<TSource, TResult>(this IQbservableProvider provider, IEnumerable<IObservable<TSource>> sources, Expression<Func<IList<TSource>, TResult>> resultSelector)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (sources == null)
- throw new ArgumentNullException("sources");
- if (resultSelector == null)
- throw new ArgumentNullException("resultSelector");
-
- return provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.CombineLatest<TSource, TResult>(default(IQbservableProvider), default(IEnumerable<IObservable<TSource>>), default(Expression<Func<IList<TSource>, TResult>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- GetSourceExpression(sources),
- resultSelector
- )
- );
- }
-
- /// <summary>
- /// Merges two observable sequences into one observable sequence by using the selector function whenever one of the observable sequences produces an element.
- /// </summary>
- /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
- /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
- /// <param name="first">First observable source.</param>
- /// <param name="second">Second observable source.</param>
- /// <param name="resultSelector">Function to invoke whenever either of the sources produces an element.</param>
- /// <returns>An observable sequence containing the result of combining elements of both sources using the specified result selector function.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="first" /> or <paramref name="second" /> or <paramref name="resultSelector" /> is null.</exception>
- public static IQbservable<TResult> CombineLatest<TSource1, TSource2, TResult>(this IQbservable<TSource1> first, IObservable<TSource2> second, Expression<Func<TSource1, TSource2, TResult>> resultSelector)
- {
- if (first == null)
- throw new ArgumentNullException("first");
- if (second == null)
- throw new ArgumentNullException("second");
- if (resultSelector == null)
- throw new ArgumentNullException("resultSelector");
-
- return first.Provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.CombineLatest<TSource1, TSource2, TResult>(default(IQbservable<TSource1>), default(IObservable<TSource2>), default(Expression<Func<TSource1, TSource2, TResult>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource1), typeof(TSource2), typeof(TResult)),
-#endif
- first.Expression,
- GetSourceExpression(second),
- resultSelector
- )
- );
- }
-
- /// <summary>
- /// Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element.
- /// </summary>
- /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
- /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
- /// <typeparam name="TSource3">The type of the elements in the third source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
- /// <param name="source1">First observable source.</param>
- /// <param name="source2">Second observable source.</param>
- /// <param name="source3">Third observable source.</param>
- /// <param name="resultSelector">Function to invoke whenever any of the sources produces an element.</param>
- /// <returns>An observable sequence containing the result of combining elements of the sources using the specified result selector function.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source1" /> or <paramref name="source2" /> or <paramref name="source3" /> or <paramref name="resultSelector" /> is null.</exception>
- public static IQbservable<TResult> CombineLatest<TSource1, TSource2, TSource3, TResult>(this IQbservable<TSource1> source1, IObservable<TSource2> source2, IObservable<TSource3> source3, Expression<Func<TSource1, TSource2, TSource3, TResult>> resultSelector)
- {
- if (source1 == null)
- throw new ArgumentNullException("source1");
- if (source2 == null)
- throw new ArgumentNullException("source2");
- if (source3 == null)
- throw new ArgumentNullException("source3");
- if (resultSelector == null)
- throw new ArgumentNullException("resultSelector");
-
- return source1.Provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.CombineLatest<TSource1, TSource2, TSource3, TResult>(default(IQbservable<TSource1>), default(IObservable<TSource2>), default(IObservable<TSource3>), default(Expression<Func<TSource1, TSource2, TSource3, TResult>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource1), typeof(TSource2), typeof(TSource3), typeof(TResult)),
-#endif
- source1.Expression,
- GetSourceExpression(source2),
- GetSourceExpression(source3),
- resultSelector
- )
- );
- }
-
- /// <summary>
- /// Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element.
- /// </summary>
- /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
- /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
- /// <typeparam name="TSource3">The type of the elements in the third source sequence.</typeparam>
- /// <typeparam name="TSource4">The type of the elements in the fourth source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
- /// <param name="source1">First observable source.</param>
- /// <param name="source2">Second observable source.</param>
- /// <param name="source3">Third observable source.</param>
- /// <param name="source4">Fourth observable source.</param>
- /// <param name="resultSelector">Function to invoke whenever any of the sources produces an element.</param>
- /// <returns>An observable sequence containing the result of combining elements of the sources using the specified result selector function.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source1" /> or <paramref name="source2" /> or <paramref name="source3" /> or <paramref name="source4" /> or <paramref name="resultSelector" /> is null.</exception>
- public static IQbservable<TResult> CombineLatest<TSource1, TSource2, TSource3, TSource4, TResult>(this IQbservable<TSource1> source1, IObservable<TSource2> source2, IObservable<TSource3> source3, IObservable<TSource4> source4, Expression<Func<TSource1, TSource2, TSource3, TSource4, TResult>> resultSelector)
- {
- if (source1 == null)
- throw new ArgumentNullException("source1");
- if (source2 == null)
- throw new ArgumentNullException("source2");
- if (source3 == null)
- throw new ArgumentNullException("source3");
- if (source4 == null)
- throw new ArgumentNullException("source4");
- if (resultSelector == null)
- throw new ArgumentNullException("resultSelector");
-
- return source1.Provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.CombineLatest<TSource1, TSource2, TSource3, TSource4, TResult>(default(IQbservable<TSource1>), default(IObservable<TSource2>), default(IObservable<TSource3>), default(IObservable<TSource4>), default(Expression<Func<TSource1, TSource2, TSource3, TSource4, TResult>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource1), typeof(TSource2), typeof(TSource3), typeof(TSource4), typeof(TResult)),
-#endif
- source1.Expression,
- GetSourceExpression(source2),
- GetSourceExpression(source3),
- GetSourceExpression(source4),
- resultSelector
- )
- );
- }
-
-#if !NO_LARGEARITY
- /// <summary>
- /// Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element.
- /// </summary>
- /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
- /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
- /// <typeparam name="TSource3">The type of the elements in the third source sequence.</typeparam>
- /// <typeparam name="TSource4">The type of the elements in the fourth source sequence.</typeparam>
- /// <typeparam name="TSource5">The type of the elements in the fifth source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
- /// <param name="source1">First observable source.</param>
- /// <param name="source2">Second observable source.</param>
- /// <param name="source3">Third observable source.</param>
- /// <param name="source4">Fourth observable source.</param>
- /// <param name="source5">Fifth observable source.</param>
- /// <param name="resultSelector">Function to invoke whenever any of the sources produces an element.</param>
- /// <returns>An observable sequence containing the result of combining elements of the sources using the specified result selector function.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source1" /> or <paramref name="source2" /> or <paramref name="source3" /> or <paramref name="source4" /> or <paramref name="source5" /> or <paramref name="resultSelector" /> is null.</exception>
- public static IQbservable<TResult> CombineLatest<TSource1, TSource2, TSource3, TSource4, TSource5, TResult>(this IQbservable<TSource1> source1, IObservable<TSource2> source2, IObservable<TSource3> source3, IObservable<TSource4> source4, IObservable<TSource5> source5, Expression<Func<TSource1, TSource2, TSource3, TSource4, TSource5, TResult>> resultSelector)
- {
- if (source1 == null)
- throw new ArgumentNullException("source1");
- if (source2 == null)
- throw new ArgumentNullException("source2");
- if (source3 == null)
- throw new ArgumentNullException("source3");
- if (source4 == null)
- throw new ArgumentNullException("source4");
- if (source5 == null)
- throw new ArgumentNullException("source5");
- if (resultSelector == null)
- throw new ArgumentNullException("resultSelector");
-
- return source1.Provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.CombineLatest<TSource1, TSource2, TSource3, TSource4, TSource5, TResult>(default(IQbservable<TSource1>), default(IObservable<TSource2>), default(IObservable<TSource3>), default(IObservable<TSource4>), default(IObservable<TSource5>), default(Expression<Func<TSource1, TSource2, TSource3, TSource4, TSource5, TResult>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource1), typeof(TSource2), typeof(TSource3), typeof(TSource4), typeof(TSource5), typeof(TResult)),
-#endif
- source1.Expression,
- GetSourceExpression(source2),
- GetSourceExpression(source3),
- GetSourceExpression(source4),
- GetSourceExpression(source5),
- resultSelector
- )
- );
- }
-#endif
-
-#if !NO_LARGEARITY
- /// <summary>
- /// Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element.
- /// </summary>
- /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
- /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
- /// <typeparam name="TSource3">The type of the elements in the third source sequence.</typeparam>
- /// <typeparam name="TSource4">The type of the elements in the fourth source sequence.</typeparam>
- /// <typeparam name="TSource5">The type of the elements in the fifth source sequence.</typeparam>
- /// <typeparam name="TSource6">The type of the elements in the sixth source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
- /// <param name="source1">First observable source.</param>
- /// <param name="source2">Second observable source.</param>
- /// <param name="source3">Third observable source.</param>
- /// <param name="source4">Fourth observable source.</param>
- /// <param name="source5">Fifth observable source.</param>
- /// <param name="source6">Sixth observable source.</param>
- /// <param name="resultSelector">Function to invoke whenever any of the sources produces an element.</param>
- /// <returns>An observable sequence containing the result of combining elements of the sources using the specified result selector function.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source1" /> or <paramref name="source2" /> or <paramref name="source3" /> or <paramref name="source4" /> or <paramref name="source5" /> or <paramref name="source6" /> or <paramref name="resultSelector" /> is null.</exception>
- public static IQbservable<TResult> CombineLatest<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TResult>(this IQbservable<TSource1> source1, IObservable<TSource2> source2, IObservable<TSource3> source3, IObservable<TSource4> source4, IObservable<TSource5> source5, IObservable<TSource6> source6, Expression<Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TResult>> resultSelector)
- {
- if (source1 == null)
- throw new ArgumentNullException("source1");
- if (source2 == null)
- throw new ArgumentNullException("source2");
- if (source3 == null)
- throw new ArgumentNullException("source3");
- if (source4 == null)
- throw new ArgumentNullException("source4");
- if (source5 == null)
- throw new ArgumentNullException("source5");
- if (source6 == null)
- throw new ArgumentNullException("source6");
- if (resultSelector == null)
- throw new ArgumentNullException("resultSelector");
-
- return source1.Provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.CombineLatest<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TResult>(default(IQbservable<TSource1>), default(IObservable<TSource2>), default(IObservable<TSource3>), default(IObservable<TSource4>), default(IObservable<TSource5>), default(IObservable<TSource6>), default(Expression<Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TResult>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource1), typeof(TSource2), typeof(TSource3), typeof(TSource4), typeof(TSource5), typeof(TSource6), typeof(TResult)),
-#endif
- source1.Expression,
- GetSourceExpression(source2),
- GetSourceExpression(source3),
- GetSourceExpression(source4),
- GetSourceExpression(source5),
- GetSourceExpression(source6),
- resultSelector
- )
- );
- }
-#endif
-
-#if !NO_LARGEARITY
- /// <summary>
- /// Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element.
- /// </summary>
- /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
- /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
- /// <typeparam name="TSource3">The type of the elements in the third source sequence.</typeparam>
- /// <typeparam name="TSource4">The type of the elements in the fourth source sequence.</typeparam>
- /// <typeparam name="TSource5">The type of the elements in the fifth source sequence.</typeparam>
- /// <typeparam name="TSource6">The type of the elements in the sixth source sequence.</typeparam>
- /// <typeparam name="TSource7">The type of the elements in the seventh source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
- /// <param name="source1">First observable source.</param>
- /// <param name="source2">Second observable source.</param>
- /// <param name="source3">Third observable source.</param>
- /// <param name="source4">Fourth observable source.</param>
- /// <param name="source5">Fifth observable source.</param>
- /// <param name="source6">Sixth observable source.</param>
- /// <param name="source7">Seventh observable source.</param>
- /// <param name="resultSelector">Function to invoke whenever any of the sources produces an element.</param>
- /// <returns>An observable sequence containing the result of combining elements of the sources using the specified result selector function.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source1" /> or <paramref name="source2" /> or <paramref name="source3" /> or <paramref name="source4" /> or <paramref name="source5" /> or <paramref name="source6" /> or <paramref name="source7" /> or <paramref name="resultSelector" /> is null.</exception>
- public static IQbservable<TResult> CombineLatest<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TResult>(this IQbservable<TSource1> source1, IObservable<TSource2> source2, IObservable<TSource3> source3, IObservable<TSource4> source4, IObservable<TSource5> source5, IObservable<TSource6> source6, IObservable<TSource7> source7, Expression<Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TResult>> resultSelector)
- {
- if (source1 == null)
- throw new ArgumentNullException("source1");
- if (source2 == null)
- throw new ArgumentNullException("source2");
- if (source3 == null)
- throw new ArgumentNullException("source3");
- if (source4 == null)
- throw new ArgumentNullException("source4");
- if (source5 == null)
- throw new ArgumentNullException("source5");
- if (source6 == null)
- throw new ArgumentNullException("source6");
- if (source7 == null)
- throw new ArgumentNullException("source7");
- if (resultSelector == null)
- throw new ArgumentNullException("resultSelector");
-
- return source1.Provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.CombineLatest<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TResult>(default(IQbservable<TSource1>), default(IObservable<TSource2>), default(IObservable<TSource3>), default(IObservable<TSource4>), default(IObservable<TSource5>), default(IObservable<TSource6>), default(IObservable<TSource7>), default(Expression<Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TResult>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource1), typeof(TSource2), typeof(TSource3), typeof(TSource4), typeof(TSource5), typeof(TSource6), typeof(TSource7), typeof(TResult)),
-#endif
- source1.Expression,
- GetSourceExpression(source2),
- GetSourceExpression(source3),
- GetSourceExpression(source4),
- GetSourceExpression(source5),
- GetSourceExpression(source6),
- GetSourceExpression(source7),
- resultSelector
- )
- );
- }
-#endif
-
-#if !NO_LARGEARITY
- /// <summary>
- /// Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element.
- /// </summary>
- /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
- /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
- /// <typeparam name="TSource3">The type of the elements in the third source sequence.</typeparam>
- /// <typeparam name="TSource4">The type of the elements in the fourth source sequence.</typeparam>
- /// <typeparam name="TSource5">The type of the elements in the fifth source sequence.</typeparam>
- /// <typeparam name="TSource6">The type of the elements in the sixth source sequence.</typeparam>
- /// <typeparam name="TSource7">The type of the elements in the seventh source sequence.</typeparam>
- /// <typeparam name="TSource8">The type of the elements in the eighth source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
- /// <param name="source1">First observable source.</param>
- /// <param name="source2">Second observable source.</param>
- /// <param name="source3">Third observable source.</param>
- /// <param name="source4">Fourth observable source.</param>
- /// <param name="source5">Fifth observable source.</param>
- /// <param name="source6">Sixth observable source.</param>
- /// <param name="source7">Seventh observable source.</param>
- /// <param name="source8">Eighth observable source.</param>
- /// <param name="resultSelector">Function to invoke whenever any of the sources produces an element.</param>
- /// <returns>An observable sequence containing the result of combining elements of the sources using the specified result selector function.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source1" /> or <paramref name="source2" /> or <paramref name="source3" /> or <paramref name="source4" /> or <paramref name="source5" /> or <paramref name="source6" /> or <paramref name="source7" /> or <paramref name="source8" /> or <paramref name="resultSelector" /> is null.</exception>
- public static IQbservable<TResult> CombineLatest<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TResult>(this IQbservable<TSource1> source1, IObservable<TSource2> source2, IObservable<TSource3> source3, IObservable<TSource4> source4, IObservable<TSource5> source5, IObservable<TSource6> source6, IObservable<TSource7> source7, IObservable<TSource8> source8, Expression<Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TResult>> resultSelector)
- {
- if (source1 == null)
- throw new ArgumentNullException("source1");
- if (source2 == null)
- throw new ArgumentNullException("source2");
- if (source3 == null)
- throw new ArgumentNullException("source3");
- if (source4 == null)
- throw new ArgumentNullException("source4");
- if (source5 == null)
- throw new ArgumentNullException("source5");
- if (source6 == null)
- throw new ArgumentNullException("source6");
- if (source7 == null)
- throw new ArgumentNullException("source7");
- if (source8 == null)
- throw new ArgumentNullException("source8");
- if (resultSelector == null)
- throw new ArgumentNullException("resultSelector");
-
- return source1.Provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.CombineLatest<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TResult>(default(IQbservable<TSource1>), default(IObservable<TSource2>), default(IObservable<TSource3>), default(IObservable<TSource4>), default(IObservable<TSource5>), default(IObservable<TSource6>), default(IObservable<TSource7>), default(IObservable<TSource8>), default(Expression<Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TResult>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource1), typeof(TSource2), typeof(TSource3), typeof(TSource4), typeof(TSource5), typeof(TSource6), typeof(TSource7), typeof(TSource8), typeof(TResult)),
-#endif
- source1.Expression,
- GetSourceExpression(source2),
- GetSourceExpression(source3),
- GetSourceExpression(source4),
- GetSourceExpression(source5),
- GetSourceExpression(source6),
- GetSourceExpression(source7),
- GetSourceExpression(source8),
- resultSelector
- )
- );
- }
-#endif
-
-#if !NO_LARGEARITY
- /// <summary>
- /// Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element.
- /// </summary>
- /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
- /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
- /// <typeparam name="TSource3">The type of the elements in the third source sequence.</typeparam>
- /// <typeparam name="TSource4">The type of the elements in the fourth source sequence.</typeparam>
- /// <typeparam name="TSource5">The type of the elements in the fifth source sequence.</typeparam>
- /// <typeparam name="TSource6">The type of the elements in the sixth source sequence.</typeparam>
- /// <typeparam name="TSource7">The type of the elements in the seventh source sequence.</typeparam>
- /// <typeparam name="TSource8">The type of the elements in the eighth source sequence.</typeparam>
- /// <typeparam name="TSource9">The type of the elements in the ninth source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
- /// <param name="source1">First observable source.</param>
- /// <param name="source2">Second observable source.</param>
- /// <param name="source3">Third observable source.</param>
- /// <param name="source4">Fourth observable source.</param>
- /// <param name="source5">Fifth observable source.</param>
- /// <param name="source6">Sixth observable source.</param>
- /// <param name="source7">Seventh observable source.</param>
- /// <param name="source8">Eighth observable source.</param>
- /// <param name="source9">Ninth observable source.</param>
- /// <param name="resultSelector">Function to invoke whenever any of the sources produces an element.</param>
- /// <returns>An observable sequence containing the result of combining elements of the sources using the specified result selector function.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source1" /> or <paramref name="source2" /> or <paramref name="source3" /> or <paramref name="source4" /> or <paramref name="source5" /> or <paramref name="source6" /> or <paramref name="source7" /> or <paramref name="source8" /> or <paramref name="source9" /> or <paramref name="resultSelector" /> is null.</exception>
- public static IQbservable<TResult> CombineLatest<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TResult>(this IQbservable<TSource1> source1, IObservable<TSource2> source2, IObservable<TSource3> source3, IObservable<TSource4> source4, IObservable<TSource5> source5, IObservable<TSource6> source6, IObservable<TSource7> source7, IObservable<TSource8> source8, IObservable<TSource9> source9, Expression<Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TResult>> resultSelector)
- {
- if (source1 == null)
- throw new ArgumentNullException("source1");
- if (source2 == null)
- throw new ArgumentNullException("source2");
- if (source3 == null)
- throw new ArgumentNullException("source3");
- if (source4 == null)
- throw new ArgumentNullException("source4");
- if (source5 == null)
- throw new ArgumentNullException("source5");
- if (source6 == null)
- throw new ArgumentNullException("source6");
- if (source7 == null)
- throw new ArgumentNullException("source7");
- if (source8 == null)
- throw new ArgumentNullException("source8");
- if (source9 == null)
- throw new ArgumentNullException("source9");
- if (resultSelector == null)
- throw new ArgumentNullException("resultSelector");
-
- return source1.Provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.CombineLatest<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TResult>(default(IQbservable<TSource1>), default(IObservable<TSource2>), default(IObservable<TSource3>), default(IObservable<TSource4>), default(IObservable<TSource5>), default(IObservable<TSource6>), default(IObservable<TSource7>), default(IObservable<TSource8>), default(IObservable<TSource9>), default(Expression<Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TResult>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource1), typeof(TSource2), typeof(TSource3), typeof(TSource4), typeof(TSource5), typeof(TSource6), typeof(TSource7), typeof(TSource8), typeof(TSource9), typeof(TResult)),
-#endif
- source1.Expression,
- GetSourceExpression(source2),
- GetSourceExpression(source3),
- GetSourceExpression(source4),
- GetSourceExpression(source5),
- GetSourceExpression(source6),
- GetSourceExpression(source7),
- GetSourceExpression(source8),
- GetSourceExpression(source9),
- resultSelector
- )
- );
- }
-#endif
-
-#if !NO_LARGEARITY
- /// <summary>
- /// Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element.
- /// </summary>
- /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
- /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
- /// <typeparam name="TSource3">The type of the elements in the third source sequence.</typeparam>
- /// <typeparam name="TSource4">The type of the elements in the fourth source sequence.</typeparam>
- /// <typeparam name="TSource5">The type of the elements in the fifth source sequence.</typeparam>
- /// <typeparam name="TSource6">The type of the elements in the sixth source sequence.</typeparam>
- /// <typeparam name="TSource7">The type of the elements in the seventh source sequence.</typeparam>
- /// <typeparam name="TSource8">The type of the elements in the eighth source sequence.</typeparam>
- /// <typeparam name="TSource9">The type of the elements in the ninth source sequence.</typeparam>
- /// <typeparam name="TSource10">The type of the elements in the tenth source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
- /// <param name="source1">First observable source.</param>
- /// <param name="source2">Second observable source.</param>
- /// <param name="source3">Third observable source.</param>
- /// <param name="source4">Fourth observable source.</param>
- /// <param name="source5">Fifth observable source.</param>
- /// <param name="source6">Sixth observable source.</param>
- /// <param name="source7">Seventh observable source.</param>
- /// <param name="source8">Eighth observable source.</param>
- /// <param name="source9">Ninth observable source.</param>
- /// <param name="source10">Tenth observable source.</param>
- /// <param name="resultSelector">Function to invoke whenever any of the sources produces an element.</param>
- /// <returns>An observable sequence containing the result of combining elements of the sources using the specified result selector function.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source1" /> or <paramref name="source2" /> or <paramref name="source3" /> or <paramref name="source4" /> or <paramref name="source5" /> or <paramref name="source6" /> or <paramref name="source7" /> or <paramref name="source8" /> or <paramref name="source9" /> or <paramref name="source10" /> or <paramref name="resultSelector" /> is null.</exception>
- public static IQbservable<TResult> CombineLatest<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TResult>(this IQbservable<TSource1> source1, IObservable<TSource2> source2, IObservable<TSource3> source3, IObservable<TSource4> source4, IObservable<TSource5> source5, IObservable<TSource6> source6, IObservable<TSource7> source7, IObservable<TSource8> source8, IObservable<TSource9> source9, IObservable<TSource10> source10, Expression<Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TResult>> resultSelector)
- {
- if (source1 == null)
- throw new ArgumentNullException("source1");
- if (source2 == null)
- throw new ArgumentNullException("source2");
- if (source3 == null)
- throw new ArgumentNullException("source3");
- if (source4 == null)
- throw new ArgumentNullException("source4");
- if (source5 == null)
- throw new ArgumentNullException("source5");
- if (source6 == null)
- throw new ArgumentNullException("source6");
- if (source7 == null)
- throw new ArgumentNullException("source7");
- if (source8 == null)
- throw new ArgumentNullException("source8");
- if (source9 == null)
- throw new ArgumentNullException("source9");
- if (source10 == null)
- throw new ArgumentNullException("source10");
- if (resultSelector == null)
- throw new ArgumentNullException("resultSelector");
-
- return source1.Provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.CombineLatest<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TResult>(default(IQbservable<TSource1>), default(IObservable<TSource2>), default(IObservable<TSource3>), default(IObservable<TSource4>), default(IObservable<TSource5>), default(IObservable<TSource6>), default(IObservable<TSource7>), default(IObservable<TSource8>), default(IObservable<TSource9>), default(IObservable<TSource10>), default(Expression<Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TResult>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource1), typeof(TSource2), typeof(TSource3), typeof(TSource4), typeof(TSource5), typeof(TSource6), typeof(TSource7), typeof(TSource8), typeof(TSource9), typeof(TSource10), typeof(TResult)),
-#endif
- source1.Expression,
- GetSourceExpression(source2),
- GetSourceExpression(source3),
- GetSourceExpression(source4),
- GetSourceExpression(source5),
- GetSourceExpression(source6),
- GetSourceExpression(source7),
- GetSourceExpression(source8),
- GetSourceExpression(source9),
- GetSourceExpression(source10),
- resultSelector
- )
- );
- }
-#endif
-
-#if !NO_LARGEARITY
- /// <summary>
- /// Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element.
- /// </summary>
- /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
- /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
- /// <typeparam name="TSource3">The type of the elements in the third source sequence.</typeparam>
- /// <typeparam name="TSource4">The type of the elements in the fourth source sequence.</typeparam>
- /// <typeparam name="TSource5">The type of the elements in the fifth source sequence.</typeparam>
- /// <typeparam name="TSource6">The type of the elements in the sixth source sequence.</typeparam>
- /// <typeparam name="TSource7">The type of the elements in the seventh source sequence.</typeparam>
- /// <typeparam name="TSource8">The type of the elements in the eighth source sequence.</typeparam>
- /// <typeparam name="TSource9">The type of the elements in the ninth source sequence.</typeparam>
- /// <typeparam name="TSource10">The type of the elements in the tenth source sequence.</typeparam>
- /// <typeparam name="TSource11">The type of the elements in the eleventh source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
- /// <param name="source1">First observable source.</param>
- /// <param name="source2">Second observable source.</param>
- /// <param name="source3">Third observable source.</param>
- /// <param name="source4">Fourth observable source.</param>
- /// <param name="source5">Fifth observable source.</param>
- /// <param name="source6">Sixth observable source.</param>
- /// <param name="source7">Seventh observable source.</param>
- /// <param name="source8">Eighth observable source.</param>
- /// <param name="source9">Ninth observable source.</param>
- /// <param name="source10">Tenth observable source.</param>
- /// <param name="source11">Eleventh observable source.</param>
- /// <param name="resultSelector">Function to invoke whenever any of the sources produces an element.</param>
- /// <returns>An observable sequence containing the result of combining elements of the sources using the specified result selector function.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source1" /> or <paramref name="source2" /> or <paramref name="source3" /> or <paramref name="source4" /> or <paramref name="source5" /> or <paramref name="source6" /> or <paramref name="source7" /> or <paramref name="source8" /> or <paramref name="source9" /> or <paramref name="source10" /> or <paramref name="source11" /> or <paramref name="resultSelector" /> is null.</exception>
- public static IQbservable<TResult> CombineLatest<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TResult>(this IQbservable<TSource1> source1, IObservable<TSource2> source2, IObservable<TSource3> source3, IObservable<TSource4> source4, IObservable<TSource5> source5, IObservable<TSource6> source6, IObservable<TSource7> source7, IObservable<TSource8> source8, IObservable<TSource9> source9, IObservable<TSource10> source10, IObservable<TSource11> source11, Expression<Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TResult>> resultSelector)
- {
- if (source1 == null)
- throw new ArgumentNullException("source1");
- if (source2 == null)
- throw new ArgumentNullException("source2");
- if (source3 == null)
- throw new ArgumentNullException("source3");
- if (source4 == null)
- throw new ArgumentNullException("source4");
- if (source5 == null)
- throw new ArgumentNullException("source5");
- if (source6 == null)
- throw new ArgumentNullException("source6");
- if (source7 == null)
- throw new ArgumentNullException("source7");
- if (source8 == null)
- throw new ArgumentNullException("source8");
- if (source9 == null)
- throw new ArgumentNullException("source9");
- if (source10 == null)
- throw new ArgumentNullException("source10");
- if (source11 == null)
- throw new ArgumentNullException("source11");
- if (resultSelector == null)
- throw new ArgumentNullException("resultSelector");
-
- return source1.Provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.CombineLatest<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TResult>(default(IQbservable<TSource1>), default(IObservable<TSource2>), default(IObservable<TSource3>), default(IObservable<TSource4>), default(IObservable<TSource5>), default(IObservable<TSource6>), default(IObservable<TSource7>), default(IObservable<TSource8>), default(IObservable<TSource9>), default(IObservable<TSource10>), default(IObservable<TSource11>), default(Expression<Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TResult>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource1), typeof(TSource2), typeof(TSource3), typeof(TSource4), typeof(TSource5), typeof(TSource6), typeof(TSource7), typeof(TSource8), typeof(TSource9), typeof(TSource10), typeof(TSource11), typeof(TResult)),
-#endif
- source1.Expression,
- GetSourceExpression(source2),
- GetSourceExpression(source3),
- GetSourceExpression(source4),
- GetSourceExpression(source5),
- GetSourceExpression(source6),
- GetSourceExpression(source7),
- GetSourceExpression(source8),
- GetSourceExpression(source9),
- GetSourceExpression(source10),
- GetSourceExpression(source11),
- resultSelector
- )
- );
- }
-#endif
-
-#if !NO_LARGEARITY
- /// <summary>
- /// Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element.
- /// </summary>
- /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
- /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
- /// <typeparam name="TSource3">The type of the elements in the third source sequence.</typeparam>
- /// <typeparam name="TSource4">The type of the elements in the fourth source sequence.</typeparam>
- /// <typeparam name="TSource5">The type of the elements in the fifth source sequence.</typeparam>
- /// <typeparam name="TSource6">The type of the elements in the sixth source sequence.</typeparam>
- /// <typeparam name="TSource7">The type of the elements in the seventh source sequence.</typeparam>
- /// <typeparam name="TSource8">The type of the elements in the eighth source sequence.</typeparam>
- /// <typeparam name="TSource9">The type of the elements in the ninth source sequence.</typeparam>
- /// <typeparam name="TSource10">The type of the elements in the tenth source sequence.</typeparam>
- /// <typeparam name="TSource11">The type of the elements in the eleventh source sequence.</typeparam>
- /// <typeparam name="TSource12">The type of the elements in the twelfth source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
- /// <param name="source1">First observable source.</param>
- /// <param name="source2">Second observable source.</param>
- /// <param name="source3">Third observable source.</param>
- /// <param name="source4">Fourth observable source.</param>
- /// <param name="source5">Fifth observable source.</param>
- /// <param name="source6">Sixth observable source.</param>
- /// <param name="source7">Seventh observable source.</param>
- /// <param name="source8">Eighth observable source.</param>
- /// <param name="source9">Ninth observable source.</param>
- /// <param name="source10">Tenth observable source.</param>
- /// <param name="source11">Eleventh observable source.</param>
- /// <param name="source12">Twelfth observable source.</param>
- /// <param name="resultSelector">Function to invoke whenever any of the sources produces an element.</param>
- /// <returns>An observable sequence containing the result of combining elements of the sources using the specified result selector function.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source1" /> or <paramref name="source2" /> or <paramref name="source3" /> or <paramref name="source4" /> or <paramref name="source5" /> or <paramref name="source6" /> or <paramref name="source7" /> or <paramref name="source8" /> or <paramref name="source9" /> or <paramref name="source10" /> or <paramref name="source11" /> or <paramref name="source12" /> or <paramref name="resultSelector" /> is null.</exception>
- public static IQbservable<TResult> CombineLatest<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TResult>(this IQbservable<TSource1> source1, IObservable<TSource2> source2, IObservable<TSource3> source3, IObservable<TSource4> source4, IObservable<TSource5> source5, IObservable<TSource6> source6, IObservable<TSource7> source7, IObservable<TSource8> source8, IObservable<TSource9> source9, IObservable<TSource10> source10, IObservable<TSource11> source11, IObservable<TSource12> source12, Expression<Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TResult>> resultSelector)
- {
- if (source1 == null)
- throw new ArgumentNullException("source1");
- if (source2 == null)
- throw new ArgumentNullException("source2");
- if (source3 == null)
- throw new ArgumentNullException("source3");
- if (source4 == null)
- throw new ArgumentNullException("source4");
- if (source5 == null)
- throw new ArgumentNullException("source5");
- if (source6 == null)
- throw new ArgumentNullException("source6");
- if (source7 == null)
- throw new ArgumentNullException("source7");
- if (source8 == null)
- throw new ArgumentNullException("source8");
- if (source9 == null)
- throw new ArgumentNullException("source9");
- if (source10 == null)
- throw new ArgumentNullException("source10");
- if (source11 == null)
- throw new ArgumentNullException("source11");
- if (source12 == null)
- throw new ArgumentNullException("source12");
- if (resultSelector == null)
- throw new ArgumentNullException("resultSelector");
-
- return source1.Provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.CombineLatest<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TResult>(default(IQbservable<TSource1>), default(IObservable<TSource2>), default(IObservable<TSource3>), default(IObservable<TSource4>), default(IObservable<TSource5>), default(IObservable<TSource6>), default(IObservable<TSource7>), default(IObservable<TSource8>), default(IObservable<TSource9>), default(IObservable<TSource10>), default(IObservable<TSource11>), default(IObservable<TSource12>), default(Expression<Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TResult>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource1), typeof(TSource2), typeof(TSource3), typeof(TSource4), typeof(TSource5), typeof(TSource6), typeof(TSource7), typeof(TSource8), typeof(TSource9), typeof(TSource10), typeof(TSource11), typeof(TSource12), typeof(TResult)),
-#endif
- source1.Expression,
- GetSourceExpression(source2),
- GetSourceExpression(source3),
- GetSourceExpression(source4),
- GetSourceExpression(source5),
- GetSourceExpression(source6),
- GetSourceExpression(source7),
- GetSourceExpression(source8),
- GetSourceExpression(source9),
- GetSourceExpression(source10),
- GetSourceExpression(source11),
- GetSourceExpression(source12),
- resultSelector
- )
- );
- }
-#endif
-
-#if !NO_LARGEARITY
- /// <summary>
- /// Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element.
- /// </summary>
- /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
- /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
- /// <typeparam name="TSource3">The type of the elements in the third source sequence.</typeparam>
- /// <typeparam name="TSource4">The type of the elements in the fourth source sequence.</typeparam>
- /// <typeparam name="TSource5">The type of the elements in the fifth source sequence.</typeparam>
- /// <typeparam name="TSource6">The type of the elements in the sixth source sequence.</typeparam>
- /// <typeparam name="TSource7">The type of the elements in the seventh source sequence.</typeparam>
- /// <typeparam name="TSource8">The type of the elements in the eighth source sequence.</typeparam>
- /// <typeparam name="TSource9">The type of the elements in the ninth source sequence.</typeparam>
- /// <typeparam name="TSource10">The type of the elements in the tenth source sequence.</typeparam>
- /// <typeparam name="TSource11">The type of the elements in the eleventh source sequence.</typeparam>
- /// <typeparam name="TSource12">The type of the elements in the twelfth source sequence.</typeparam>
- /// <typeparam name="TSource13">The type of the elements in the thirteenth source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
- /// <param name="source1">First observable source.</param>
- /// <param name="source2">Second observable source.</param>
- /// <param name="source3">Third observable source.</param>
- /// <param name="source4">Fourth observable source.</param>
- /// <param name="source5">Fifth observable source.</param>
- /// <param name="source6">Sixth observable source.</param>
- /// <param name="source7">Seventh observable source.</param>
- /// <param name="source8">Eighth observable source.</param>
- /// <param name="source9">Ninth observable source.</param>
- /// <param name="source10">Tenth observable source.</param>
- /// <param name="source11">Eleventh observable source.</param>
- /// <param name="source12">Twelfth observable source.</param>
- /// <param name="source13">Thirteenth observable source.</param>
- /// <param name="resultSelector">Function to invoke whenever any of the sources produces an element.</param>
- /// <returns>An observable sequence containing the result of combining elements of the sources using the specified result selector function.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source1" /> or <paramref name="source2" /> or <paramref name="source3" /> or <paramref name="source4" /> or <paramref name="source5" /> or <paramref name="source6" /> or <paramref name="source7" /> or <paramref name="source8" /> or <paramref name="source9" /> or <paramref name="source10" /> or <paramref name="source11" /> or <paramref name="source12" /> or <paramref name="source13" /> or <paramref name="resultSelector" /> is null.</exception>
- public static IQbservable<TResult> CombineLatest<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TResult>(this IQbservable<TSource1> source1, IObservable<TSource2> source2, IObservable<TSource3> source3, IObservable<TSource4> source4, IObservable<TSource5> source5, IObservable<TSource6> source6, IObservable<TSource7> source7, IObservable<TSource8> source8, IObservable<TSource9> source9, IObservable<TSource10> source10, IObservable<TSource11> source11, IObservable<TSource12> source12, IObservable<TSource13> source13, Expression<Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TResult>> resultSelector)
- {
- if (source1 == null)
- throw new ArgumentNullException("source1");
- if (source2 == null)
- throw new ArgumentNullException("source2");
- if (source3 == null)
- throw new ArgumentNullException("source3");
- if (source4 == null)
- throw new ArgumentNullException("source4");
- if (source5 == null)
- throw new ArgumentNullException("source5");
- if (source6 == null)
- throw new ArgumentNullException("source6");
- if (source7 == null)
- throw new ArgumentNullException("source7");
- if (source8 == null)
- throw new ArgumentNullException("source8");
- if (source9 == null)
- throw new ArgumentNullException("source9");
- if (source10 == null)
- throw new ArgumentNullException("source10");
- if (source11 == null)
- throw new ArgumentNullException("source11");
- if (source12 == null)
- throw new ArgumentNullException("source12");
- if (source13 == null)
- throw new ArgumentNullException("source13");
- if (resultSelector == null)
- throw new ArgumentNullException("resultSelector");
-
- return source1.Provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.CombineLatest<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TResult>(default(IQbservable<TSource1>), default(IObservable<TSource2>), default(IObservable<TSource3>), default(IObservable<TSource4>), default(IObservable<TSource5>), default(IObservable<TSource6>), default(IObservable<TSource7>), default(IObservable<TSource8>), default(IObservable<TSource9>), default(IObservable<TSource10>), default(IObservable<TSource11>), default(IObservable<TSource12>), default(IObservable<TSource13>), default(Expression<Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TResult>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource1), typeof(TSource2), typeof(TSource3), typeof(TSource4), typeof(TSource5), typeof(TSource6), typeof(TSource7), typeof(TSource8), typeof(TSource9), typeof(TSource10), typeof(TSource11), typeof(TSource12), typeof(TSource13), typeof(TResult)),
-#endif
- source1.Expression,
- GetSourceExpression(source2),
- GetSourceExpression(source3),
- GetSourceExpression(source4),
- GetSourceExpression(source5),
- GetSourceExpression(source6),
- GetSourceExpression(source7),
- GetSourceExpression(source8),
- GetSourceExpression(source9),
- GetSourceExpression(source10),
- GetSourceExpression(source11),
- GetSourceExpression(source12),
- GetSourceExpression(source13),
- resultSelector
- )
- );
- }
-#endif
-
-#if !NO_LARGEARITY
- /// <summary>
- /// Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element.
- /// </summary>
- /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
- /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
- /// <typeparam name="TSource3">The type of the elements in the third source sequence.</typeparam>
- /// <typeparam name="TSource4">The type of the elements in the fourth source sequence.</typeparam>
- /// <typeparam name="TSource5">The type of the elements in the fifth source sequence.</typeparam>
- /// <typeparam name="TSource6">The type of the elements in the sixth source sequence.</typeparam>
- /// <typeparam name="TSource7">The type of the elements in the seventh source sequence.</typeparam>
- /// <typeparam name="TSource8">The type of the elements in the eighth source sequence.</typeparam>
- /// <typeparam name="TSource9">The type of the elements in the ninth source sequence.</typeparam>
- /// <typeparam name="TSource10">The type of the elements in the tenth source sequence.</typeparam>
- /// <typeparam name="TSource11">The type of the elements in the eleventh source sequence.</typeparam>
- /// <typeparam name="TSource12">The type of the elements in the twelfth source sequence.</typeparam>
- /// <typeparam name="TSource13">The type of the elements in the thirteenth source sequence.</typeparam>
- /// <typeparam name="TSource14">The type of the elements in the fourteenth source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
- /// <param name="source1">First observable source.</param>
- /// <param name="source2">Second observable source.</param>
- /// <param name="source3">Third observable source.</param>
- /// <param name="source4">Fourth observable source.</param>
- /// <param name="source5">Fifth observable source.</param>
- /// <param name="source6">Sixth observable source.</param>
- /// <param name="source7">Seventh observable source.</param>
- /// <param name="source8">Eighth observable source.</param>
- /// <param name="source9">Ninth observable source.</param>
- /// <param name="source10">Tenth observable source.</param>
- /// <param name="source11">Eleventh observable source.</param>
- /// <param name="source12">Twelfth observable source.</param>
- /// <param name="source13">Thirteenth observable source.</param>
- /// <param name="source14">Fourteenth observable source.</param>
- /// <param name="resultSelector">Function to invoke whenever any of the sources produces an element.</param>
- /// <returns>An observable sequence containing the result of combining elements of the sources using the specified result selector function.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source1" /> or <paramref name="source2" /> or <paramref name="source3" /> or <paramref name="source4" /> or <paramref name="source5" /> or <paramref name="source6" /> or <paramref name="source7" /> or <paramref name="source8" /> or <paramref name="source9" /> or <paramref name="source10" /> or <paramref name="source11" /> or <paramref name="source12" /> or <paramref name="source13" /> or <paramref name="source14" /> or <paramref name="resultSelector" /> is null.</exception>
- public static IQbservable<TResult> CombineLatest<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TSource14, TResult>(this IQbservable<TSource1> source1, IObservable<TSource2> source2, IObservable<TSource3> source3, IObservable<TSource4> source4, IObservable<TSource5> source5, IObservable<TSource6> source6, IObservable<TSource7> source7, IObservable<TSource8> source8, IObservable<TSource9> source9, IObservable<TSource10> source10, IObservable<TSource11> source11, IObservable<TSource12> source12, IObservable<TSource13> source13, IObservable<TSource14> source14, Expression<Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TSource14, TResult>> resultSelector)
- {
- if (source1 == null)
- throw new ArgumentNullException("source1");
- if (source2 == null)
- throw new ArgumentNullException("source2");
- if (source3 == null)
- throw new ArgumentNullException("source3");
- if (source4 == null)
- throw new ArgumentNullException("source4");
- if (source5 == null)
- throw new ArgumentNullException("source5");
- if (source6 == null)
- throw new ArgumentNullException("source6");
- if (source7 == null)
- throw new ArgumentNullException("source7");
- if (source8 == null)
- throw new ArgumentNullException("source8");
- if (source9 == null)
- throw new ArgumentNullException("source9");
- if (source10 == null)
- throw new ArgumentNullException("source10");
- if (source11 == null)
- throw new ArgumentNullException("source11");
- if (source12 == null)
- throw new ArgumentNullException("source12");
- if (source13 == null)
- throw new ArgumentNullException("source13");
- if (source14 == null)
- throw new ArgumentNullException("source14");
- if (resultSelector == null)
- throw new ArgumentNullException("resultSelector");
-
- return source1.Provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.CombineLatest<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TSource14, TResult>(default(IQbservable<TSource1>), default(IObservable<TSource2>), default(IObservable<TSource3>), default(IObservable<TSource4>), default(IObservable<TSource5>), default(IObservable<TSource6>), default(IObservable<TSource7>), default(IObservable<TSource8>), default(IObservable<TSource9>), default(IObservable<TSource10>), default(IObservable<TSource11>), default(IObservable<TSource12>), default(IObservable<TSource13>), default(IObservable<TSource14>), default(Expression<Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TSource14, TResult>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource1), typeof(TSource2), typeof(TSource3), typeof(TSource4), typeof(TSource5), typeof(TSource6), typeof(TSource7), typeof(TSource8), typeof(TSource9), typeof(TSource10), typeof(TSource11), typeof(TSource12), typeof(TSource13), typeof(TSource14), typeof(TResult)),
-#endif
- source1.Expression,
- GetSourceExpression(source2),
- GetSourceExpression(source3),
- GetSourceExpression(source4),
- GetSourceExpression(source5),
- GetSourceExpression(source6),
- GetSourceExpression(source7),
- GetSourceExpression(source8),
- GetSourceExpression(source9),
- GetSourceExpression(source10),
- GetSourceExpression(source11),
- GetSourceExpression(source12),
- GetSourceExpression(source13),
- GetSourceExpression(source14),
- resultSelector
- )
- );
- }
-#endif
-
-#if !NO_LARGEARITY
- /// <summary>
- /// Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element.
- /// </summary>
- /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
- /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
- /// <typeparam name="TSource3">The type of the elements in the third source sequence.</typeparam>
- /// <typeparam name="TSource4">The type of the elements in the fourth source sequence.</typeparam>
- /// <typeparam name="TSource5">The type of the elements in the fifth source sequence.</typeparam>
- /// <typeparam name="TSource6">The type of the elements in the sixth source sequence.</typeparam>
- /// <typeparam name="TSource7">The type of the elements in the seventh source sequence.</typeparam>
- /// <typeparam name="TSource8">The type of the elements in the eighth source sequence.</typeparam>
- /// <typeparam name="TSource9">The type of the elements in the ninth source sequence.</typeparam>
- /// <typeparam name="TSource10">The type of the elements in the tenth source sequence.</typeparam>
- /// <typeparam name="TSource11">The type of the elements in the eleventh source sequence.</typeparam>
- /// <typeparam name="TSource12">The type of the elements in the twelfth source sequence.</typeparam>
- /// <typeparam name="TSource13">The type of the elements in the thirteenth source sequence.</typeparam>
- /// <typeparam name="TSource14">The type of the elements in the fourteenth source sequence.</typeparam>
- /// <typeparam name="TSource15">The type of the elements in the fifteenth source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
- /// <param name="source1">First observable source.</param>
- /// <param name="source2">Second observable source.</param>
- /// <param name="source3">Third observable source.</param>
- /// <param name="source4">Fourth observable source.</param>
- /// <param name="source5">Fifth observable source.</param>
- /// <param name="source6">Sixth observable source.</param>
- /// <param name="source7">Seventh observable source.</param>
- /// <param name="source8">Eighth observable source.</param>
- /// <param name="source9">Ninth observable source.</param>
- /// <param name="source10">Tenth observable source.</param>
- /// <param name="source11">Eleventh observable source.</param>
- /// <param name="source12">Twelfth observable source.</param>
- /// <param name="source13">Thirteenth observable source.</param>
- /// <param name="source14">Fourteenth observable source.</param>
- /// <param name="source15">Fifteenth observable source.</param>
- /// <param name="resultSelector">Function to invoke whenever any of the sources produces an element.</param>
- /// <returns>An observable sequence containing the result of combining elements of the sources using the specified result selector function.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source1" /> or <paramref name="source2" /> or <paramref name="source3" /> or <paramref name="source4" /> or <paramref name="source5" /> or <paramref name="source6" /> or <paramref name="source7" /> or <paramref name="source8" /> or <paramref name="source9" /> or <paramref name="source10" /> or <paramref name="source11" /> or <paramref name="source12" /> or <paramref name="source13" /> or <paramref name="source14" /> or <paramref name="source15" /> or <paramref name="resultSelector" /> is null.</exception>
- public static IQbservable<TResult> CombineLatest<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TSource14, TSource15, TResult>(this IQbservable<TSource1> source1, IObservable<TSource2> source2, IObservable<TSource3> source3, IObservable<TSource4> source4, IObservable<TSource5> source5, IObservable<TSource6> source6, IObservable<TSource7> source7, IObservable<TSource8> source8, IObservable<TSource9> source9, IObservable<TSource10> source10, IObservable<TSource11> source11, IObservable<TSource12> source12, IObservable<TSource13> source13, IObservable<TSource14> source14, IObservable<TSource15> source15, Expression<Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TSource14, TSource15, TResult>> resultSelector)
- {
- if (source1 == null)
- throw new ArgumentNullException("source1");
- if (source2 == null)
- throw new ArgumentNullException("source2");
- if (source3 == null)
- throw new ArgumentNullException("source3");
- if (source4 == null)
- throw new ArgumentNullException("source4");
- if (source5 == null)
- throw new ArgumentNullException("source5");
- if (source6 == null)
- throw new ArgumentNullException("source6");
- if (source7 == null)
- throw new ArgumentNullException("source7");
- if (source8 == null)
- throw new ArgumentNullException("source8");
- if (source9 == null)
- throw new ArgumentNullException("source9");
- if (source10 == null)
- throw new ArgumentNullException("source10");
- if (source11 == null)
- throw new ArgumentNullException("source11");
- if (source12 == null)
- throw new ArgumentNullException("source12");
- if (source13 == null)
- throw new ArgumentNullException("source13");
- if (source14 == null)
- throw new ArgumentNullException("source14");
- if (source15 == null)
- throw new ArgumentNullException("source15");
- if (resultSelector == null)
- throw new ArgumentNullException("resultSelector");
-
- return source1.Provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.CombineLatest<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TSource14, TSource15, TResult>(default(IQbservable<TSource1>), default(IObservable<TSource2>), default(IObservable<TSource3>), default(IObservable<TSource4>), default(IObservable<TSource5>), default(IObservable<TSource6>), default(IObservable<TSource7>), default(IObservable<TSource8>), default(IObservable<TSource9>), default(IObservable<TSource10>), default(IObservable<TSource11>), default(IObservable<TSource12>), default(IObservable<TSource13>), default(IObservable<TSource14>), default(IObservable<TSource15>), default(Expression<Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TSource14, TSource15, TResult>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource1), typeof(TSource2), typeof(TSource3), typeof(TSource4), typeof(TSource5), typeof(TSource6), typeof(TSource7), typeof(TSource8), typeof(TSource9), typeof(TSource10), typeof(TSource11), typeof(TSource12), typeof(TSource13), typeof(TSource14), typeof(TSource15), typeof(TResult)),
-#endif
- source1.Expression,
- GetSourceExpression(source2),
- GetSourceExpression(source3),
- GetSourceExpression(source4),
- GetSourceExpression(source5),
- GetSourceExpression(source6),
- GetSourceExpression(source7),
- GetSourceExpression(source8),
- GetSourceExpression(source9),
- GetSourceExpression(source10),
- GetSourceExpression(source11),
- GetSourceExpression(source12),
- GetSourceExpression(source13),
- GetSourceExpression(source14),
- GetSourceExpression(source15),
- resultSelector
- )
- );
- }
-#endif
-
-#if !NO_LARGEARITY
- /// <summary>
- /// Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element.
- /// </summary>
- /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
- /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
- /// <typeparam name="TSource3">The type of the elements in the third source sequence.</typeparam>
- /// <typeparam name="TSource4">The type of the elements in the fourth source sequence.</typeparam>
- /// <typeparam name="TSource5">The type of the elements in the fifth source sequence.</typeparam>
- /// <typeparam name="TSource6">The type of the elements in the sixth source sequence.</typeparam>
- /// <typeparam name="TSource7">The type of the elements in the seventh source sequence.</typeparam>
- /// <typeparam name="TSource8">The type of the elements in the eighth source sequence.</typeparam>
- /// <typeparam name="TSource9">The type of the elements in the ninth source sequence.</typeparam>
- /// <typeparam name="TSource10">The type of the elements in the tenth source sequence.</typeparam>
- /// <typeparam name="TSource11">The type of the elements in the eleventh source sequence.</typeparam>
- /// <typeparam name="TSource12">The type of the elements in the twelfth source sequence.</typeparam>
- /// <typeparam name="TSource13">The type of the elements in the thirteenth source sequence.</typeparam>
- /// <typeparam name="TSource14">The type of the elements in the fourteenth source sequence.</typeparam>
- /// <typeparam name="TSource15">The type of the elements in the fifteenth source sequence.</typeparam>
- /// <typeparam name="TSource16">The type of the elements in the sixteenth source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
- /// <param name="source1">First observable source.</param>
- /// <param name="source2">Second observable source.</param>
- /// <param name="source3">Third observable source.</param>
- /// <param name="source4">Fourth observable source.</param>
- /// <param name="source5">Fifth observable source.</param>
- /// <param name="source6">Sixth observable source.</param>
- /// <param name="source7">Seventh observable source.</param>
- /// <param name="source8">Eighth observable source.</param>
- /// <param name="source9">Ninth observable source.</param>
- /// <param name="source10">Tenth observable source.</param>
- /// <param name="source11">Eleventh observable source.</param>
- /// <param name="source12">Twelfth observable source.</param>
- /// <param name="source13">Thirteenth observable source.</param>
- /// <param name="source14">Fourteenth observable source.</param>
- /// <param name="source15">Fifteenth observable source.</param>
- /// <param name="source16">Sixteenth observable source.</param>
- /// <param name="resultSelector">Function to invoke whenever any of the sources produces an element.</param>
- /// <returns>An observable sequence containing the result of combining elements of the sources using the specified result selector function.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source1" /> or <paramref name="source2" /> or <paramref name="source3" /> or <paramref name="source4" /> or <paramref name="source5" /> or <paramref name="source6" /> or <paramref name="source7" /> or <paramref name="source8" /> or <paramref name="source9" /> or <paramref name="source10" /> or <paramref name="source11" /> or <paramref name="source12" /> or <paramref name="source13" /> or <paramref name="source14" /> or <paramref name="source15" /> or <paramref name="source16" /> or <paramref name="resultSelector" /> is null.</exception>
- public static IQbservable<TResult> CombineLatest<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TSource14, TSource15, TSource16, TResult>(this IQbservable<TSource1> source1, IObservable<TSource2> source2, IObservable<TSource3> source3, IObservable<TSource4> source4, IObservable<TSource5> source5, IObservable<TSource6> source6, IObservable<TSource7> source7, IObservable<TSource8> source8, IObservable<TSource9> source9, IObservable<TSource10> source10, IObservable<TSource11> source11, IObservable<TSource12> source12, IObservable<TSource13> source13, IObservable<TSource14> source14, IObservable<TSource15> source15, IObservable<TSource16> source16, Expression<Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TSource14, TSource15, TSource16, TResult>> resultSelector)
- {
- if (source1 == null)
- throw new ArgumentNullException("source1");
- if (source2 == null)
- throw new ArgumentNullException("source2");
- if (source3 == null)
- throw new ArgumentNullException("source3");
- if (source4 == null)
- throw new ArgumentNullException("source4");
- if (source5 == null)
- throw new ArgumentNullException("source5");
- if (source6 == null)
- throw new ArgumentNullException("source6");
- if (source7 == null)
- throw new ArgumentNullException("source7");
- if (source8 == null)
- throw new ArgumentNullException("source8");
- if (source9 == null)
- throw new ArgumentNullException("source9");
- if (source10 == null)
- throw new ArgumentNullException("source10");
- if (source11 == null)
- throw new ArgumentNullException("source11");
- if (source12 == null)
- throw new ArgumentNullException("source12");
- if (source13 == null)
- throw new ArgumentNullException("source13");
- if (source14 == null)
- throw new ArgumentNullException("source14");
- if (source15 == null)
- throw new ArgumentNullException("source15");
- if (source16 == null)
- throw new ArgumentNullException("source16");
- if (resultSelector == null)
- throw new ArgumentNullException("resultSelector");
-
- return source1.Provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.CombineLatest<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TSource14, TSource15, TSource16, TResult>(default(IQbservable<TSource1>), default(IObservable<TSource2>), default(IObservable<TSource3>), default(IObservable<TSource4>), default(IObservable<TSource5>), default(IObservable<TSource6>), default(IObservable<TSource7>), default(IObservable<TSource8>), default(IObservable<TSource9>), default(IObservable<TSource10>), default(IObservable<TSource11>), default(IObservable<TSource12>), default(IObservable<TSource13>), default(IObservable<TSource14>), default(IObservable<TSource15>), default(IObservable<TSource16>), default(Expression<Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TSource14, TSource15, TSource16, TResult>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource1), typeof(TSource2), typeof(TSource3), typeof(TSource4), typeof(TSource5), typeof(TSource6), typeof(TSource7), typeof(TSource8), typeof(TSource9), typeof(TSource10), typeof(TSource11), typeof(TSource12), typeof(TSource13), typeof(TSource14), typeof(TSource15), typeof(TSource16), typeof(TResult)),
-#endif
- source1.Expression,
- GetSourceExpression(source2),
- GetSourceExpression(source3),
- GetSourceExpression(source4),
- GetSourceExpression(source5),
- GetSourceExpression(source6),
- GetSourceExpression(source7),
- GetSourceExpression(source8),
- GetSourceExpression(source9),
- GetSourceExpression(source10),
- GetSourceExpression(source11),
- GetSourceExpression(source12),
- GetSourceExpression(source13),
- GetSourceExpression(source14),
- GetSourceExpression(source15),
- GetSourceExpression(source16),
- resultSelector
- )
- );
- }
-#endif
-
- /// <summary>
- /// Concatenates the second observable sequence to the first observable sequence upon successful termination of the first.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequences.</typeparam>
- /// <param name="first">First observable sequence.</param>
- /// <param name="second">Second observable sequence.</param>
- /// <returns>An observable sequence that contains the elements of the first sequence, followed by those of the second the sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="first" /> or <paramref name="second" /> is null.</exception>
- public static IQbservable<TSource> Concat<TSource>(this IQbservable<TSource> first, IObservable<TSource> second)
- {
- if (first == null)
- throw new ArgumentNullException("first");
- if (second == null)
- throw new ArgumentNullException("second");
-
- return first.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Concat<TSource>(default(IQbservable<TSource>), default(IObservable<TSource>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- first.Expression,
- GetSourceExpression(second)
- )
- );
- }
-
- /// <summary>
- /// Concatenates all of the specified observable sequences, as long as the previous observable sequence terminated successfully.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TSource">The type of the elements in the source sequences.</typeparam>
- /// <param name="sources">Observable sequences to concatenate.</param>
- /// <returns>An observable sequence that contains the elements of each given sequence, in sequential order.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="sources" /> is null.</exception>
- public static IQbservable<TSource> Concat<TSource>(this IQbservableProvider provider, params IObservable<TSource>[] sources)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (sources == null)
- throw new ArgumentNullException("sources");
-
- return provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Concat<TSource>(default(IQbservableProvider), default(IObservable<TSource>[]))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- GetSourceExpression(sources)
- )
- );
- }
-
- /// <summary>
- /// Concatenates all observable sequences in the given enumerable sequence, as long as the previous observable sequence terminated successfully.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TSource">The type of the elements in the source sequences.</typeparam>
- /// <param name="sources">Observable sequences to concatenate.</param>
- /// <returns>An observable sequence that contains the elements of each given sequence, in sequential order.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="sources" /> is null.</exception>
- public static IQbservable<TSource> Concat<TSource>(this IQbservableProvider provider, IEnumerable<IObservable<TSource>> sources)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (sources == null)
- throw new ArgumentNullException("sources");
-
- return provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Concat<TSource>(default(IQbservableProvider), default(IEnumerable<IObservable<TSource>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- GetSourceExpression(sources)
- )
- );
- }
-
- /// <summary>
- /// Concatenates all inner observable sequences, as long as the previous observable sequence terminated successfully.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequences.</typeparam>
- /// <param name="sources">Observable sequence of inner observable sequences.</param>
- /// <returns>An observable sequence that contains the elements of each observed inner sequence, in sequential order.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="sources" /> is null.</exception>
- public static IQbservable<TSource> Concat<TSource>(this IQbservable<IObservable<TSource>> sources)
- {
- if (sources == null)
- throw new ArgumentNullException("sources");
-
- return sources.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Concat<TSource>(default(IQbservable<IObservable<TSource>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- sources.Expression
- )
- );
- }
-
-#if !NO_TPL
- /// <summary>
- /// Concatenates all task results, as long as the previous task terminated successfully.
- /// </summary>
- /// <typeparam name="TSource">The type of the results produced by the tasks.</typeparam>
- /// <param name="sources">Observable sequence of tasks.</param>
- /// <returns>An observable sequence that contains the results of each task, in sequential order.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="sources" /> is null.</exception>
- /// <remarks>If the tasks support cancellation, consider manual conversion of the tasks using <see cref="M:System.Reactive.Linq.Observable.FromAsync``1(System.Func{System.Threading.CancellationToken,System.Threading.Tasks.Task{``0}})" />, followed by a concatenation operation using <see cref="M:System.Reactive.Linq.Observable.Concat``1(System.IObservable{System.IObservable{``0}})" />.</remarks>
- public static IQbservable<TSource> Concat<TSource>(this IQbservable<Task<TSource>> sources)
- {
- if (sources == null)
- throw new ArgumentNullException("sources");
-
- return sources.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Concat<TSource>(default(IQbservable<Task<TSource>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- sources.Expression
- )
- );
- }
-#endif
-
- /// <summary>
- /// Determines whether an observable sequence contains a specified element by using the default equality comparer.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">An observable sequence in which to locate a value.</param>
- /// <param name="value">The value to locate in the source sequence.</param>
- /// <returns>An observable sequence containing a single element determining whether the source sequence contains an element that has the specified value.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IQbservable<bool> Contains<TSource>(this IQbservable<TSource> source, TSource value)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return source.Provider.CreateQuery<bool>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Contains<TSource>(default(IQbservable<TSource>), default(TSource))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- Expression.Constant(value, typeof(TSource))
- )
- );
- }
-
- /// <summary>
- /// Determines whether an observable sequence contains a specified element by using a specified System.Collections.Generic.IEqualityComparer&lt;T&gt;.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">An observable sequence in which to locate a value.</param>
- /// <param name="value">The value to locate in the source sequence.</param>
- /// <param name="comparer">An equality comparer to compare elements.</param>
- /// <returns>An observable sequence containing a single element determining whether the source sequence contains an element that has the specified value.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="comparer" /> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IQbservable<bool> Contains<TSource>(this IQbservable<TSource> source, TSource value, IEqualityComparer<TSource> comparer)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (comparer == null)
- throw new ArgumentNullException("comparer");
-
- return source.Provider.CreateQuery<bool>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Contains<TSource>(default(IQbservable<TSource>), default(TSource), default(IEqualityComparer<TSource>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- Expression.Constant(value, typeof(TSource)),
- Expression.Constant(comparer, typeof(IEqualityComparer<TSource>))
- )
- );
- }
-
- /// <summary>
- /// Returns an observable sequence containing an <see cref="T:System.Int32" /> that represents the total number of elements in an observable sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">An observable sequence that contains elements to be counted.</param>
- /// <returns>An observable sequence containing a single element with the number of elements in the input sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> is null.</exception>
- /// <exception cref="T:System.OverflowException">(Asynchronous) The number of elements in the source sequence is larger than <see cref="M:System.Int64.MaxValue" />.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IQbservable<int> Count<TSource>(this IQbservable<TSource> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return source.Provider.CreateQuery<int>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Count<TSource>(default(IQbservable<TSource>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression
- )
- );
- }
-
- /// <summary>
- /// Returns an observable sequence containing an <see cref="T:System.Int32" /> that represents how many elements in the specified observable sequence satisfy a condition.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">An observable sequence that contains elements to be counted.</param>
- /// <param name="predicate">A function to test each element for a condition.</param>
- /// <returns>An observable sequence containing a single element with a number that represents how many elements in the input sequence satisfy the condition in the predicate function.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="predicate" /> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IQbservable<int> Count<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, bool>> predicate)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (predicate == null)
- throw new ArgumentNullException("predicate");
-
- return source.Provider.CreateQuery<int>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Count<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, bool>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- predicate
- )
- );
- }
-
- /// <summary>
- /// Creates an observable sequence from a specified Subscribe method implementation.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TResult">The type of the elements in the produced sequence.</typeparam>
- /// <param name="subscribe">Implementation of the resulting observable sequence's Subscribe method.</param>
- /// <returns>The observable sequence with the specified implementation for the Subscribe method.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="subscribe" /> is null.</exception>
- /// <remarks>
- /// Use of this operator is preferred over manual implementation of the IObservable&lt;T&gt; interface. In case
- /// you need a type implementing IObservable&lt;T&gt; rather than an anonymous implementation, consider using
- /// the <see cref="T:System.Reactive.ObservableBase`1" /> abstract base class.
- /// </remarks>
- public static IQbservable<TResult> Create<TResult>(this IQbservableProvider provider, Expression<Func<IObserver<TResult>, IDisposable>> subscribe)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (subscribe == null)
- throw new ArgumentNullException("subscribe");
-
- return provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Create<TResult>(default(IQbservableProvider), default(Expression<Func<IObserver<TResult>, IDisposable>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TResult)),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- subscribe
- )
- );
- }
-
- /// <summary>
- /// Creates an observable sequence from a specified Subscribe method implementation.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TResult">The type of the elements in the produced sequence.</typeparam>
- /// <param name="subscribe">Implementation of the resulting observable sequence's Subscribe method, returning an Action delegate that will be wrapped in an IDisposable.</param>
- /// <returns>The observable sequence with the specified implementation for the Subscribe method.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="subscribe" /> is null.</exception>
- /// <remarks>
- /// Use of this operator is preferred over manual implementation of the IObservable&lt;T&gt; interface. In case
- /// you need a type implementing IObservable&lt;T&gt; rather than an anonymous implementation, consider using
- /// the <see cref="T:System.Reactive.ObservableBase`1" /> abstract base class.
- /// </remarks>
- public static IQbservable<TResult> Create<TResult>(this IQbservableProvider provider, Expression<Func<IObserver<TResult>, Action>> subscribe)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (subscribe == null)
- throw new ArgumentNullException("subscribe");
-
- return provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Create<TResult>(default(IQbservableProvider), default(Expression<Func<IObserver<TResult>, Action>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TResult)),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- subscribe
- )
- );
- }
-
-#if !NO_TPL
- /// <summary>
- /// Creates an observable sequence from a specified cancellable asynchronous Subscribe method.
- /// The CancellationToken passed to the asynchronous Subscribe method is tied to the returned disposable subscription, allowing best-effort cancellation.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TResult">The type of the elements in the produced sequence.</typeparam>
- /// <param name="subscribeAsync">Asynchronous method used to produce elements.</param>
- /// <returns>The observable sequence surfacing the elements produced by the asynchronous method.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="subscribeAsync" /> is null.</exception>
- /// <remarks>This operator is especially useful in conjunction with the asynchronous programming features introduced in C# 5.0 and Visual Basic 11.</remarks>
- /// <remarks>When a subscription to the resulting sequence is disposed, the CancellationToken that was fed to the asynchronous subscribe function will be signaled.</remarks>
- public static IQbservable<TResult> Create<TResult>(this IQbservableProvider provider, Expression<Func<IObserver<TResult>, CancellationToken, Task>> subscribeAsync)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (subscribeAsync == null)
- throw new ArgumentNullException("subscribeAsync");
-
- return provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Create<TResult>(default(IQbservableProvider), default(Expression<Func<IObserver<TResult>, CancellationToken, Task>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TResult)),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- subscribeAsync
- )
- );
- }
-#endif
-
-#if !NO_TPL
- /// <summary>
- /// Creates an observable sequence from a specified asynchronous Subscribe method.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TResult">The type of the elements in the produced sequence.</typeparam>
- /// <param name="subscribeAsync">Asynchronous method used to produce elements.</param>
- /// <returns>The observable sequence surfacing the elements produced by the asynchronous method.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="subscribeAsync" /> is null.</exception>
- /// <remarks>This operator is especially useful in conjunction with the asynchronous programming features introduced in C# 5.0 and Visual Basic 11.</remarks>
- public static IQbservable<TResult> Create<TResult>(this IQbservableProvider provider, Expression<Func<IObserver<TResult>, Task>> subscribeAsync)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (subscribeAsync == null)
- throw new ArgumentNullException("subscribeAsync");
-
- return provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Create<TResult>(default(IQbservableProvider), default(Expression<Func<IObserver<TResult>, Task>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TResult)),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- subscribeAsync
- )
- );
- }
-#endif
-
-#if !NO_TPL
- /// <summary>
- /// Creates an observable sequence from a specified cancellable asynchronous Subscribe method.
- /// The CancellationToken passed to the asynchronous Subscribe method is tied to the returned disposable subscription, allowing best-effort cancellation.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TResult">The type of the elements in the produced sequence.</typeparam>
- /// <param name="subscribeAsync">Asynchronous method used to implemented the resulting sequence's Subscribe method.</param>
- /// <returns>The observable sequence with the specified implementation for the Subscribe method.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="subscribeAsync" /> is null.</exception>
- /// <remarks>This operator is especially useful in conjunction with the asynchronous programming features introduced in C# 5.0 and Visual Basic 11.</remarks>
- /// <remarks>When a subscription to the resulting sequence is disposed, the CancellationToken that was fed to the asynchronous subscribe function will be signaled.</remarks>
- public static IQbservable<TResult> Create<TResult>(this IQbservableProvider provider, Expression<Func<IObserver<TResult>, CancellationToken, Task<IDisposable>>> subscribeAsync)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (subscribeAsync == null)
- throw new ArgumentNullException("subscribeAsync");
-
- return provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Create<TResult>(default(IQbservableProvider), default(Expression<Func<IObserver<TResult>, CancellationToken, Task<IDisposable>>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TResult)),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- subscribeAsync
- )
- );
- }
-#endif
-
-#if !NO_TPL
- /// <summary>
- /// Creates an observable sequence from a specified asynchronous Subscribe method.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TResult">The type of the elements in the produced sequence.</typeparam>
- /// <param name="subscribeAsync">Asynchronous method used to implemented the resulting sequence's Subscribe method.</param>
- /// <returns>The observable sequence with the specified implementation for the Subscribe method.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="subscribeAsync" /> is null.</exception>
- /// <remarks>This operator is especially useful in conjunction with the asynchronous programming features introduced in C# 5.0 and Visual Basic 11.</remarks>
- public static IQbservable<TResult> Create<TResult>(this IQbservableProvider provider, Expression<Func<IObserver<TResult>, Task<IDisposable>>> subscribeAsync)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (subscribeAsync == null)
- throw new ArgumentNullException("subscribeAsync");
-
- return provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Create<TResult>(default(IQbservableProvider), default(Expression<Func<IObserver<TResult>, Task<IDisposable>>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TResult)),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- subscribeAsync
- )
- );
- }
-#endif
-
-#if !NO_TPL
- /// <summary>
- /// Creates an observable sequence from a specified cancellable asynchronous Subscribe method.
- /// The CancellationToken passed to the asynchronous Subscribe method is tied to the returned disposable subscription, allowing best-effort cancellation.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TResult">The type of the elements in the produced sequence.</typeparam>
- /// <param name="subscribeAsync">Asynchronous method used to implemented the resulting sequence's Subscribe method, returning an Action delegate that will be wrapped in an IDisposable.</param>
- /// <returns>The observable sequence with the specified implementation for the Subscribe method.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="subscribeAsync" /> is null.</exception>
- /// <remarks>This operator is especially useful in conjunction with the asynchronous programming features introduced in C# 5.0 and Visual Basic 11.</remarks>
- /// <remarks>When a subscription to the resulting sequence is disposed, the CancellationToken that was fed to the asynchronous subscribe function will be signaled.</remarks>
- public static IQbservable<TResult> Create<TResult>(this IQbservableProvider provider, Expression<Func<IObserver<TResult>, CancellationToken, Task<Action>>> subscribeAsync)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (subscribeAsync == null)
- throw new ArgumentNullException("subscribeAsync");
-
- return provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Create<TResult>(default(IQbservableProvider), default(Expression<Func<IObserver<TResult>, CancellationToken, Task<Action>>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TResult)),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- subscribeAsync
- )
- );
- }
-#endif
-
-#if !NO_TPL
- /// <summary>
- /// Creates an observable sequence from a specified asynchronous Subscribe method.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TResult">The type of the elements in the produced sequence.</typeparam>
- /// <param name="subscribeAsync">Asynchronous method used to implemented the resulting sequence's Subscribe method, returning an Action delegate that will be wrapped in an IDisposable.</param>
- /// <returns>The observable sequence with the specified implementation for the Subscribe method.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="subscribeAsync" /> is null.</exception>
- /// <remarks>This operator is especially useful in conjunction with the asynchronous programming features introduced in C# 5.0 and Visual Basic 11.</remarks>
- public static IQbservable<TResult> Create<TResult>(this IQbservableProvider provider, Expression<Func<IObserver<TResult>, Task<Action>>> subscribeAsync)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (subscribeAsync == null)
- throw new ArgumentNullException("subscribeAsync");
-
- return provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Create<TResult>(default(IQbservableProvider), default(Expression<Func<IObserver<TResult>, Task<Action>>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TResult)),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- subscribeAsync
- )
- );
- }
-#endif
-
- /// <summary>
- /// Returns the elements of the specified sequence or the type parameter's default value in a singleton sequence if the sequence is empty.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence (if any), whose default value will be taken if the sequence is empty.</typeparam>
- /// <param name="source">The sequence to return a default value for if it is empty.</param>
- /// <returns>An observable sequence that contains the default value for the TSource type if the source is empty; otherwise, the elements of the source itself.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> is null.</exception>
- public static IQbservable<TSource> DefaultIfEmpty<TSource>(this IQbservable<TSource> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return source.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.DefaultIfEmpty<TSource>(default(IQbservable<TSource>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression
- )
- );
- }
-
- /// <summary>
- /// Returns the elements of the specified sequence or the specified value in a singleton sequence if the sequence is empty.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence (if any), and the specified default value which will be taken if the sequence is empty.</typeparam>
- /// <param name="source">The sequence to return the specified value for if it is empty.</param>
- /// <param name="defaultValue">The value to return if the sequence is empty.</param>
- /// <returns>An observable sequence that contains the specified default value if the source is empty; otherwise, the elements of the source itself.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> is null.</exception>
- public static IQbservable<TSource> DefaultIfEmpty<TSource>(this IQbservable<TSource> source, TSource defaultValue)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return source.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.DefaultIfEmpty<TSource>(default(IQbservable<TSource>), default(TSource))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- Expression.Constant(defaultValue, typeof(TSource))
- )
- );
- }
-
- /// <summary>
- /// Returns an observable sequence that invokes the specified factory function whenever a new observer subscribes.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TResult">The type of the elements in the sequence returned by the factory function, and in the resulting sequence.</typeparam>
- /// <param name="observableFactory">Observable factory function to invoke for each observer that subscribes to the resulting sequence.</param>
- /// <returns>An observable sequence whose observers trigger an invocation of the given observable factory function.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="observableFactory" /> is null.</exception>
- public static IQbservable<TResult> Defer<TResult>(this IQbservableProvider provider, Expression<Func<IObservable<TResult>>> observableFactory)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (observableFactory == null)
- throw new ArgumentNullException("observableFactory");
-
- return provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Defer<TResult>(default(IQbservableProvider), default(Expression<Func<IObservable<TResult>>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TResult)),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- observableFactory
- )
- );
- }
-
-#if !NO_TPL
- /// <summary>
- /// Returns an observable sequence that starts the specified asynchronous factory function whenever a new observer subscribes.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TResult">The type of the elements in the sequence returned by the factory function, and in the resulting sequence.</typeparam>
- /// <param name="observableFactoryAsync">Asynchronous factory function to start for each observer that subscribes to the resulting sequence.</param>
- /// <returns>An observable sequence whose observers trigger the given asynchronous observable factory function to be started.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="observableFactoryAsync" /> is null.</exception>
- /// <remarks>This operator is especially useful in conjunction with the asynchronous programming features introduced in C# 5.0 and Visual Basic 11.</remarks>
- public static IQbservable<TResult> Defer<TResult>(this IQbservableProvider provider, Expression<Func<Task<IObservable<TResult>>>> observableFactoryAsync)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (observableFactoryAsync == null)
- throw new ArgumentNullException("observableFactoryAsync");
-
- return provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Defer<TResult>(default(IQbservableProvider), default(Expression<Func<Task<IObservable<TResult>>>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TResult)),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- observableFactoryAsync
- )
- );
- }
-#endif
-
-#if !NO_TPL
- /// <summary>
- /// Returns an observable sequence that starts the specified cancellable asynchronous factory function whenever a new observer subscribes.
- /// The CancellationToken passed to the asynchronous factory function is tied to the returned disposable subscription, allowing best-effort cancellation.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TResult">The type of the elements in the sequence returned by the factory function, and in the resulting sequence.</typeparam>
- /// <param name="observableFactoryAsync">Asynchronous factory function to start for each observer that subscribes to the resulting sequence.</param>
- /// <returns>An observable sequence whose observers trigger the given asynchronous observable factory function to be started.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="observableFactoryAsync" /> is null.</exception>
- /// <remarks>This operator is especially useful in conjunction with the asynchronous programming features introduced in C# 5.0 and Visual Basic 11.</remarks>
- /// <remarks>When a subscription to the resulting sequence is disposed, the CancellationToken that was fed to the asynchronous observable factory function will be signaled.</remarks>
- public static IQbservable<TResult> DeferAsync<TResult>(this IQbservableProvider provider, Expression<Func<CancellationToken, Task<IObservable<TResult>>>> observableFactoryAsync)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (observableFactoryAsync == null)
- throw new ArgumentNullException("observableFactoryAsync");
-
- return provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.DeferAsync<TResult>(default(IQbservableProvider), default(Expression<Func<CancellationToken, Task<IObservable<TResult>>>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TResult)),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- observableFactoryAsync
- )
- );
- }
-#endif
-
- /// <summary>
- /// Time shifts the observable sequence to start propagating notifications at the specified absolute time.
- /// The relative time intervals between the values are preserved.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence to delay values for.</param>
- /// <param name="dueTime">Absolute time used to shift the observable sequence; the relative time shift gets computed upon subscription. If this value is less than or equal to DateTimeOffset.UtcNow, the scheduler will dispatch observer callbacks as soon as possible.</param>
- /// <returns>Time-shifted sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> is null.</exception>
- /// <remarks>
- /// <para>
- /// This operator is less efficient than <see cref="M:System.Reactive.Linq.Observable.DelaySubscription``1(System.IObservable{``0},System.DateTimeOffset)">DelaySubscription</see> because it records all notifications and time-delays those. This allows for immediate propagation of errors.
- /// </para>
- /// <para>
- /// Observer callbacks for the resulting sequence will be run on the default scheduler. This effect is similar to using ObserveOn.
- /// </para>
- /// <para>
- /// Exceptions signaled by the source sequence through an OnError callback are forwarded immediately to the result sequence. Any OnNext notifications that were in the queue at the point of the OnError callback will be dropped.
- /// In order to delay error propagation, consider using the <see cref="M:System.Reactive.Linq.Observable.Materialize``1(System.IObservable{``0})">Observable.Materialize</see> and <see cref="M:System.Reactive.Linq.Observable.Dematerialize``1(System.IObservable{System.Reactive.Notification{``0}})">Observable.Dematerialize</see> operators, or use <see cref="M:System.Reactive.Linq.Observable.DelaySubscription``1(System.IObservable{``0},System.DateTimeOffset)">DelaySubscription</see>.
- /// </para>
- /// </remarks>
- public static IQbservable<TSource> Delay<TSource>(this IQbservable<TSource> source, DateTimeOffset dueTime)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return source.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Delay<TSource>(default(IQbservable<TSource>), default(DateTimeOffset))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- Expression.Constant(dueTime, typeof(DateTimeOffset))
- )
- );
- }
-
- /// <summary>
- /// Time shifts the observable sequence to start propagating notifications at the specified absolute time, using the specified scheduler to run timers.
- /// The relative time intervals between the values are preserved.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence to delay values for.</param>
- /// <param name="dueTime">Absolute time used to shift the observable sequence; the relative time shift gets computed upon subscription. If this value is less than or equal to DateTimeOffset.UtcNow, the scheduler will dispatch observer callbacks as soon as possible.</param>
- /// <param name="scheduler">Scheduler to run the delay timers on.</param>
- /// <returns>Time-shifted sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="scheduler" /> is null.</exception>
- /// <remarks>
- /// <para>
- /// This operator is less efficient than <see cref="M:System.Reactive.Linq.Observable.DelaySubscription``1(System.IObservable{``0},System.DateTimeOffset,System.Reactive.Concurrency.IScheduler)">DelaySubscription</see> because it records all notifications and time-delays those. This allows for immediate propagation of errors.
- /// </para>
- /// <para>
- /// Observer callbacks for the resulting sequence will be run on the specified scheduler. This effect is similar to using ObserveOn.
- /// </para>
- /// <para>
- /// Exceptions signaled by the source sequence through an OnError callback are forwarded immediately to the result sequence. Any OnNext notifications that were in the queue at the point of the OnError callback will be dropped.
- /// In order to delay error propagation, consider using the <see cref="M:System.Reactive.Linq.Observable.Materialize``1(System.IObservable{``0})">Observable.Materialize</see> and <see cref="M:System.Reactive.Linq.Observable.Dematerialize``1(System.IObservable{System.Reactive.Notification{``0}})">Observable.Dematerialize</see> operators, or use <see cref="M:System.Reactive.Linq.Observable.DelaySubscription``1(System.IObservable{``0},System.DateTimeOffset,System.Reactive.Concurrency.IScheduler)">DelaySubscription</see>.
- /// </para>
- /// </remarks>
- public static IQbservable<TSource> Delay<TSource>(this IQbservable<TSource> source, DateTimeOffset dueTime, IScheduler scheduler)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return source.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Delay<TSource>(default(IQbservable<TSource>), default(DateTimeOffset), default(IScheduler))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- Expression.Constant(dueTime, typeof(DateTimeOffset)),
- Expression.Constant(scheduler, typeof(IScheduler))
- )
- );
- }
-
- /// <summary>
- /// Time shifts the observable sequence by the specified relative time duration.
- /// The relative time intervals between the values are preserved.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence to delay values for.</param>
- /// <param name="dueTime">Relative time by which to shift the observable sequence. If this value is equal to TimeSpan.Zero, the scheduler will dispatch observer callbacks as soon as possible.</param>
- /// <returns>Time-shifted sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> is null.</exception>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// <paramref name="dueTime" /> is less than TimeSpan.Zero.</exception>
- /// <remarks>
- /// <para>
- /// This operator is less efficient than <see cref="M:System.Reactive.Linq.Observable.DelaySubscription``1(System.IObservable{``0},System.TimeSpan)">DelaySubscription</see> because it records all notifications and time-delays those. This allows for immediate propagation of errors.
- /// </para>
- /// <para>
- /// Observer callbacks for the resulting sequence will be run on the default scheduler. This effect is similar to using ObserveOn.
- /// </para>
- /// <para>
- /// Exceptions signaled by the source sequence through an OnError callback are forwarded immediately to the result sequence. Any OnNext notifications that were in the queue at the point of the OnError callback will be dropped.
- /// In order to delay error propagation, consider using the <see cref="M:System.Reactive.Linq.Observable.Materialize``1(System.IObservable{``0})">Observable.Materialize</see> and <see cref="M:System.Reactive.Linq.Observable.Dematerialize``1(System.IObservable{System.Reactive.Notification{``0}})">Observable.Dematerialize</see> operators, or use <see cref="M:System.Reactive.Linq.Observable.DelaySubscription``1(System.IObservable{``0},System.TimeSpan)">DelaySubscription</see>.
- /// </para>
- /// </remarks>
- public static IQbservable<TSource> Delay<TSource>(this IQbservable<TSource> source, TimeSpan dueTime)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return source.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Delay<TSource>(default(IQbservable<TSource>), default(TimeSpan))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- Expression.Constant(dueTime, typeof(TimeSpan))
- )
- );
- }
-
- /// <summary>
- /// Time shifts the observable sequence by the specified relative time duration, using the specified scheduler to run timers.
- /// The relative time intervals between the values are preserved.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence to delay values for.</param>
- /// <param name="dueTime">Relative time by which to shift the observable sequence. If this value is equal to TimeSpan.Zero, the scheduler will dispatch observer callbacks as soon as possible.</param>
- /// <param name="scheduler">Scheduler to run the delay timers on.</param>
- /// <returns>Time-shifted sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="scheduler" /> is null.</exception>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// <paramref name="dueTime" /> is less than TimeSpan.Zero.</exception>
- /// <remarks>
- /// <para>
- /// This operator is less efficient than <see cref="M:System.Reactive.Linq.Observable.DelaySubscription``1(System.IObservable{``0},System.TimeSpan,System.Reactive.Concurrency.IScheduler)">DelaySubscription</see> because it records all notifications and time-delays those. This allows for immediate propagation of errors.
- /// </para>
- /// <para>
- /// Observer callbacks for the resulting sequence will be run on the specified scheduler. This effect is similar to using ObserveOn.
- /// </para>
- /// <para>
- /// Exceptions signaled by the source sequence through an OnError callback are forwarded immediately to the result sequence. Any OnNext notifications that were in the queue at the point of the OnError callback will be dropped.
- /// </para>
- /// <para>
- /// Exceptions signaled by the source sequence through an OnError callback are forwarded immediately to the result sequence. Any OnNext notifications that were in the queue at the point of the OnError callback will be dropped.
- /// In order to delay error propagation, consider using the <see cref="M:System.Reactive.Linq.Observable.Materialize``1(System.IObservable{``0})">Observable.Materialize</see> and <see cref="M:System.Reactive.Linq.Observable.Dematerialize``1(System.IObservable{System.Reactive.Notification{``0}})">Observable.Dematerialize</see> operators, or use <see cref="M:System.Reactive.Linq.Observable.DelaySubscription``1(System.IObservable{``0},System.TimeSpan,System.Reactive.Concurrency.IScheduler)">DelaySubscription</see>.
- /// </para>
- /// </remarks>
- public static IQbservable<TSource> Delay<TSource>(this IQbservable<TSource> source, TimeSpan dueTime, IScheduler scheduler)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return source.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Delay<TSource>(default(IQbservable<TSource>), default(TimeSpan), default(IScheduler))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- Expression.Constant(dueTime, typeof(TimeSpan)),
- Expression.Constant(scheduler, typeof(IScheduler))
- )
- );
- }
-
- /// <summary>
- /// Time shifts the observable sequence based on a delay selector function for each element.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TDelay">The type of the elements in the delay sequences used to denote the delay duration of each element in the source sequence.</typeparam>
- /// <param name="source">Source sequence to delay values for.</param>
- /// <param name="delayDurationSelector">Selector function to retrieve a sequence indicating the delay for each given element.</param>
- /// <returns>Time-shifted sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="delayDurationSelector" /> is null.</exception>
- public static IQbservable<TSource> Delay<TSource, TDelay>(this IQbservable<TSource> source, Expression<Func<TSource, IObservable<TDelay>>> delayDurationSelector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (delayDurationSelector == null)
- throw new ArgumentNullException("delayDurationSelector");
-
- return source.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Delay<TSource, TDelay>(default(IQbservable<TSource>), default(Expression<Func<TSource, IObservable<TDelay>>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TDelay)),
-#endif
- source.Expression,
- delayDurationSelector
- )
- );
- }
-
- /// <summary>
- /// Time shifts the observable sequence based on a subscription delay and a delay selector function for each element.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TDelay">The type of the elements in the delay sequences used to denote the delay duration of each element in the source sequence.</typeparam>
- /// <param name="source">Source sequence to delay values for.</param>
- /// <param name="subscriptionDelay">Sequence indicating the delay for the subscription to the source.</param>
- /// <param name="delayDurationSelector">Selector function to retrieve a sequence indicating the delay for each given element.</param>
- /// <returns>Time-shifted sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="subscriptionDelay" /> or <paramref name="delayDurationSelector" /> is null.</exception>
- public static IQbservable<TSource> Delay<TSource, TDelay>(this IQbservable<TSource> source, IObservable<TDelay> subscriptionDelay, Expression<Func<TSource, IObservable<TDelay>>> delayDurationSelector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (subscriptionDelay == null)
- throw new ArgumentNullException("subscriptionDelay");
- if (delayDurationSelector == null)
- throw new ArgumentNullException("delayDurationSelector");
-
- return source.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Delay<TSource, TDelay>(default(IQbservable<TSource>), default(IObservable<TDelay>), default(Expression<Func<TSource, IObservable<TDelay>>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TDelay)),
-#endif
- source.Expression,
- GetSourceExpression(subscriptionDelay),
- delayDurationSelector
- )
- );
- }
-
- /// <summary>
- /// Time shifts the observable sequence by delaying the subscription to the specified absolute time.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence to delay subscription for.</param>
- /// <param name="dueTime">Absolute time to perform the subscription at.</param>
- /// <returns>Time-shifted sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> is null.</exception>
- /// <remarks>
- /// <para>
- /// This operator is more efficient than <see cref="M:System.Reactive.Linq.Observable.Delay``1(System.IObservable{``0},System.DateTimeOffset)">Delay</see> but postpones all side-effects of subscription and affects error propagation timing.
- /// </para>
- /// <para>
- /// The side-effects of subscribing to the source sequence will be run on the default scheduler. Observer callbacks will not be affected.
- /// </para>
- /// </remarks>
- public static IQbservable<TSource> DelaySubscription<TSource>(this IQbservable<TSource> source, DateTimeOffset dueTime)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return source.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.DelaySubscription<TSource>(default(IQbservable<TSource>), default(DateTimeOffset))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- Expression.Constant(dueTime, typeof(DateTimeOffset))
- )
- );
- }
-
- /// <summary>
- /// Time shifts the observable sequence by delaying the subscription to the specified absolute time, using the specified scheduler to run timers.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence to delay subscription for.</param>
- /// <param name="dueTime">Absolute time to perform the subscription at.</param>
- /// <param name="scheduler">Scheduler to run the subscription delay timer on.</param>
- /// <returns>Time-shifted sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="scheduler" /> is null.</exception>
- /// <remarks>
- /// <para>
- /// This operator is more efficient than <see cref="M:System.Reactive.Linq.Observable.Delay``1(System.IObservable{``0},System.DateTimeOffset,System.Reactive.Concurrency.IScheduler)">Delay</see> but postpones all side-effects of subscription and affects error propagation timing.
- /// </para>
- /// <para>
- /// The side-effects of subscribing to the source sequence will be run on the specified scheduler. Observer callbacks will not be affected.
- /// </para>
- /// </remarks>
- public static IQbservable<TSource> DelaySubscription<TSource>(this IQbservable<TSource> source, DateTimeOffset dueTime, IScheduler scheduler)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return source.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.DelaySubscription<TSource>(default(IQbservable<TSource>), default(DateTimeOffset), default(IScheduler))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- Expression.Constant(dueTime, typeof(DateTimeOffset)),
- Expression.Constant(scheduler, typeof(IScheduler))
- )
- );
- }
-
- /// <summary>
- /// Time shifts the observable sequence by delaying the subscription with the specified relative time duration.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence to delay subscription for.</param>
- /// <param name="dueTime">Relative time shift of the subscription.</param>
- /// <returns>Time-shifted sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> is null.</exception>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// <paramref name="dueTime" /> is less than TimeSpan.Zero.</exception>
- /// <remarks>
- /// <para>
- /// This operator is more efficient than <see cref="M:System.Reactive.Linq.Observable.Delay``1(System.IObservable{``0},System.TimeSpan)">Delay</see> but postpones all side-effects of subscription and affects error propagation timing.
- /// </para>
- /// <para>
- /// The side-effects of subscribing to the source sequence will be run on the default scheduler. Observer callbacks will not be affected.
- /// </para>
- /// </remarks>
- public static IQbservable<TSource> DelaySubscription<TSource>(this IQbservable<TSource> source, TimeSpan dueTime)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return source.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.DelaySubscription<TSource>(default(IQbservable<TSource>), default(TimeSpan))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- Expression.Constant(dueTime, typeof(TimeSpan))
- )
- );
- }
-
- /// <summary>
- /// Time shifts the observable sequence by delaying the subscription with the specified relative time duration, using the specified scheduler to run timers.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence to delay subscription for.</param>
- /// <param name="dueTime">Relative time shift of the subscription.</param>
- /// <param name="scheduler">Scheduler to run the subscription delay timer on.</param>
- /// <returns>Time-shifted sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="scheduler" /> is null.</exception>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// <paramref name="dueTime" /> is less than TimeSpan.Zero.</exception>
- /// <remarks>
- /// <para>
- /// This operator is more efficient than <see cref="M:System.Reactive.Linq.Observable.Delay``1(System.IObservable{``0},System.TimeSpan,System.Reactive.Concurrency.IScheduler)">Delay</see> but postpones all side-effects of subscription and affects error propagation timing.
- /// </para>
- /// <para>
- /// The side-effects of subscribing to the source sequence will be run on the specified scheduler. Observer callbacks will not be affected.
- /// </para>
- /// </remarks>
- public static IQbservable<TSource> DelaySubscription<TSource>(this IQbservable<TSource> source, TimeSpan dueTime, IScheduler scheduler)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return source.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.DelaySubscription<TSource>(default(IQbservable<TSource>), default(TimeSpan), default(IScheduler))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- Expression.Constant(dueTime, typeof(TimeSpan)),
- Expression.Constant(scheduler, typeof(IScheduler))
- )
- );
- }
-
- /// <summary>
- /// Dematerializes the explicit notification values of an observable sequence as implicit notifications.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements materialized in the source sequence notification objects.</typeparam>
- /// <param name="source">An observable sequence containing explicit notification values which have to be turned into implicit notifications.</param>
- /// <returns>An observable sequence exhibiting the behavior corresponding to the source sequence's notification values.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> is null.</exception>
- public static IQbservable<TSource> Dematerialize<TSource>(this IQbservable<Notification<TSource>> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return source.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Dematerialize<TSource>(default(IQbservable<Notification<TSource>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression
- )
- );
- }
-
- /// <summary>
- /// Returns an observable sequence that contains only distinct elements.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">An observable sequence to retain distinct elements for.</param>
- /// <returns>An observable sequence only containing the distinct elements from the source sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> is null.</exception>
- /// <remarks>Usage of this operator should be considered carefully due to the maintenance of an internal lookup structure which can grow large.</remarks>
- public static IQbservable<TSource> Distinct<TSource>(this IQbservable<TSource> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return source.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Distinct<TSource>(default(IQbservable<TSource>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression
- )
- );
- }
-
- /// <summary>
- /// Returns an observable sequence that contains only distinct elements according to the comparer.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">An observable sequence to retain distinct elements for.</param>
- /// <param name="comparer">Equality comparer for source elements.</param>
- /// <returns>An observable sequence only containing the distinct elements from the source sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="comparer" /> is null.</exception>
- /// <remarks>Usage of this operator should be considered carefully due to the maintenance of an internal lookup structure which can grow large.</remarks>
- public static IQbservable<TSource> Distinct<TSource>(this IQbservable<TSource> source, IEqualityComparer<TSource> comparer)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (comparer == null)
- throw new ArgumentNullException("comparer");
-
- return source.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Distinct<TSource>(default(IQbservable<TSource>), default(IEqualityComparer<TSource>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- Expression.Constant(comparer, typeof(IEqualityComparer<TSource>))
- )
- );
- }
-
- /// <summary>
- /// Returns an observable sequence that contains only distinct elements according to the keySelector.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TKey">The type of the discriminator key computed for each element in the source sequence.</typeparam>
- /// <param name="source">An observable sequence to retain distinct elements for.</param>
- /// <param name="keySelector">A function to compute the comparison key for each element.</param>
- /// <returns>An observable sequence only containing the distinct elements, based on a computed key value, from the source sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="keySelector" /> is null.</exception>
- /// <remarks>Usage of this operator should be considered carefully due to the maintenance of an internal lookup structure which can grow large.</remarks>
- public static IQbservable<TSource> Distinct<TSource, TKey>(this IQbservable<TSource> source, Expression<Func<TSource, TKey>> keySelector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (keySelector == null)
- throw new ArgumentNullException("keySelector");
-
- return source.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Distinct<TSource, TKey>(default(IQbservable<TSource>), default(Expression<Func<TSource, TKey>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)),
-#endif
- source.Expression,
- keySelector
- )
- );
- }
-
- /// <summary>
- /// Returns an observable sequence that contains only distinct elements according to the keySelector and the comparer.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TKey">The type of the discriminator key computed for each element in the source sequence.</typeparam>
- /// <param name="source">An observable sequence to retain distinct elements for.</param>
- /// <param name="keySelector">A function to compute the comparison key for each element.</param>
- /// <param name="comparer">Equality comparer for source elements.</param>
- /// <returns>An observable sequence only containing the distinct elements, based on a computed key value, from the source sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="keySelector" /> or <paramref name="comparer" /> is null.</exception>
- /// <remarks>Usage of this operator should be considered carefully due to the maintenance of an internal lookup structure which can grow large.</remarks>
- public static IQbservable<TSource> Distinct<TSource, TKey>(this IQbservable<TSource> source, Expression<Func<TSource, TKey>> keySelector, IEqualityComparer<TKey> comparer)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (keySelector == null)
- throw new ArgumentNullException("keySelector");
- if (comparer == null)
- throw new ArgumentNullException("comparer");
-
- return source.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Distinct<TSource, TKey>(default(IQbservable<TSource>), default(Expression<Func<TSource, TKey>>), default(IEqualityComparer<TKey>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)),
-#endif
- source.Expression,
- keySelector,
- Expression.Constant(comparer, typeof(IEqualityComparer<TKey>))
- )
- );
- }
-
- /// <summary>
- /// Returns an observable sequence that contains only distinct contiguous elements.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">An observable sequence to retain distinct contiguous elements for.</param>
- /// <returns>An observable sequence only containing the distinct contiguous elements from the source sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> is null.</exception>
- public static IQbservable<TSource> DistinctUntilChanged<TSource>(this IQbservable<TSource> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return source.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.DistinctUntilChanged<TSource>(default(IQbservable<TSource>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression
- )
- );
- }
-
- /// <summary>
- /// Returns an observable sequence that contains only distinct contiguous elements according to the comparer.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">An observable sequence to retain distinct contiguous elements for.</param>
- /// <param name="comparer">Equality comparer for source elements.</param>
- /// <returns>An observable sequence only containing the distinct contiguous elements from the source sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="comparer" /> is null.</exception>
- public static IQbservable<TSource> DistinctUntilChanged<TSource>(this IQbservable<TSource> source, IEqualityComparer<TSource> comparer)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (comparer == null)
- throw new ArgumentNullException("comparer");
-
- return source.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.DistinctUntilChanged<TSource>(default(IQbservable<TSource>), default(IEqualityComparer<TSource>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- Expression.Constant(comparer, typeof(IEqualityComparer<TSource>))
- )
- );
- }
-
- /// <summary>
- /// Returns an observable sequence that contains only distinct contiguous elements according to the keySelector.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TKey">The type of the discriminator key computed for each element in the source sequence.</typeparam>
- /// <param name="source">An observable sequence to retain distinct contiguous elements for, based on a computed key value.</param>
- /// <param name="keySelector">A function to compute the comparison key for each element.</param>
- /// <returns>An observable sequence only containing the distinct contiguous elements, based on a computed key value, from the source sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="keySelector" /> is null.</exception>
- public static IQbservable<TSource> DistinctUntilChanged<TSource, TKey>(this IQbservable<TSource> source, Expression<Func<TSource, TKey>> keySelector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (keySelector == null)
- throw new ArgumentNullException("keySelector");
-
- return source.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.DistinctUntilChanged<TSource, TKey>(default(IQbservable<TSource>), default(Expression<Func<TSource, TKey>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)),
-#endif
- source.Expression,
- keySelector
- )
- );
- }
-
- /// <summary>
- /// Returns an observable sequence that contains only distinct contiguous elements according to the keySelector and the comparer.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TKey">The type of the discriminator key computed for each element in the source sequence.</typeparam>
- /// <param name="source">An observable sequence to retain distinct contiguous elements for, based on a computed key value.</param>
- /// <param name="keySelector">A function to compute the comparison key for each element.</param>
- /// <param name="comparer">Equality comparer for computed key values.</param>
- /// <returns>An observable sequence only containing the distinct contiguous elements, based on a computed key value, from the source sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="keySelector" /> or <paramref name="comparer" /> is null.</exception>
- public static IQbservable<TSource> DistinctUntilChanged<TSource, TKey>(this IQbservable<TSource> source, Expression<Func<TSource, TKey>> keySelector, IEqualityComparer<TKey> comparer)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (keySelector == null)
- throw new ArgumentNullException("keySelector");
- if (comparer == null)
- throw new ArgumentNullException("comparer");
-
- return source.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.DistinctUntilChanged<TSource, TKey>(default(IQbservable<TSource>), default(Expression<Func<TSource, TKey>>), default(IEqualityComparer<TKey>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)),
-#endif
- source.Expression,
- keySelector,
- Expression.Constant(comparer, typeof(IEqualityComparer<TKey>))
- )
- );
- }
-
- /// <summary>
- /// Invokes the observer's methods for each message in the source sequence.
- /// This method can be used for debugging, logging, etc. of query behavior by intercepting the message stream to run arbitrary actions for messages on the pipeline.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence.</param>
- /// <param name="observer">Observer whose methods to invoke as part of the source sequence's observation.</param>
- /// <returns>The source sequence with the side-effecting behavior applied.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="observer" /> is null.</exception>
- public static IQbservable<TSource> Do<TSource>(this IQbservable<TSource> source, IObserver<TSource> observer)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (observer == null)
- throw new ArgumentNullException("observer");
-
- return source.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Do<TSource>(default(IQbservable<TSource>), default(IObserver<TSource>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- Expression.Constant(observer, typeof(IObserver<TSource>))
- )
- );
- }
-
- /// <summary>
- /// Invokes an action for each element in the observable sequence, and propagates all observer messages through the result sequence.
- /// This method can be used for debugging, logging, etc. of query behavior by intercepting the message stream to run arbitrary actions for messages on the pipeline.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence.</param>
- /// <param name="onNext">Action to invoke for each element in the observable sequence.</param>
- /// <returns>The source sequence with the side-effecting behavior applied.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="onNext" /> is null.</exception>
- public static IQbservable<TSource> Do<TSource>(this IQbservable<TSource> source, Expression<Action<TSource>> onNext)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (onNext == null)
- throw new ArgumentNullException("onNext");
-
- return source.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Do<TSource>(default(IQbservable<TSource>), default(Expression<Action<TSource>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- onNext
- )
- );
- }
-
- /// <summary>
- /// Invokes an action for each element in the observable sequence and invokes an action upon graceful termination of the observable sequence.
- /// This method can be used for debugging, logging, etc. of query behavior by intercepting the message stream to run arbitrary actions for messages on the pipeline.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence.</param>
- /// <param name="onNext">Action to invoke for each element in the observable sequence.</param>
- /// <param name="onCompleted">Action to invoke upon graceful termination of the observable sequence.</param>
- /// <returns>The source sequence with the side-effecting behavior applied.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="onNext" /> or <paramref name="onCompleted" /> is null.</exception>
- public static IQbservable<TSource> Do<TSource>(this IQbservable<TSource> source, Expression<Action<TSource>> onNext, Expression<Action> onCompleted)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (onNext == null)
- throw new ArgumentNullException("onNext");
- if (onCompleted == null)
- throw new ArgumentNullException("onCompleted");
-
- return source.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Do<TSource>(default(IQbservable<TSource>), default(Expression<Action<TSource>>), default(Expression<Action>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- onNext,
- onCompleted
- )
- );
- }
-
- /// <summary>
- /// Invokes an action for each element in the observable sequence and invokes an action upon exceptional termination of the observable sequence.
- /// This method can be used for debugging, logging, etc. of query behavior by intercepting the message stream to run arbitrary actions for messages on the pipeline.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence.</param>
- /// <param name="onNext">Action to invoke for each element in the observable sequence.</param>
- /// <param name="onError">Action to invoke upon exceptional termination of the observable sequence.</param>
- /// <returns>The source sequence with the side-effecting behavior applied.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="onNext" /> or <paramref name="onError" /> is null.</exception>
- public static IQbservable<TSource> Do<TSource>(this IQbservable<TSource> source, Expression<Action<TSource>> onNext, Expression<Action<Exception>> onError)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (onNext == null)
- throw new ArgumentNullException("onNext");
- if (onError == null)
- throw new ArgumentNullException("onError");
-
- return source.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Do<TSource>(default(IQbservable<TSource>), default(Expression<Action<TSource>>), default(Expression<Action<Exception>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- onNext,
- onError
- )
- );
- }
-
- /// <summary>
- /// Invokes an action for each element in the observable sequence and invokes an action upon graceful or exceptional termination of the observable sequence.
- /// This method can be used for debugging, logging, etc. of query behavior by intercepting the message stream to run arbitrary actions for messages on the pipeline.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence.</param>
- /// <param name="onNext">Action to invoke for each element in the observable sequence.</param>
- /// <param name="onError">Action to invoke upon exceptional termination of the observable sequence.</param>
- /// <param name="onCompleted">Action to invoke upon graceful termination of the observable sequence.</param>
- /// <returns>The source sequence with the side-effecting behavior applied.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="onNext" /> or <paramref name="onError" /> or <paramref name="onCompleted" /> is null.</exception>
- public static IQbservable<TSource> Do<TSource>(this IQbservable<TSource> source, Expression<Action<TSource>> onNext, Expression<Action<Exception>> onError, Expression<Action> onCompleted)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (onNext == null)
- throw new ArgumentNullException("onNext");
- if (onError == null)
- throw new ArgumentNullException("onError");
- if (onCompleted == null)
- throw new ArgumentNullException("onCompleted");
-
- return source.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Do<TSource>(default(IQbservable<TSource>), default(Expression<Action<TSource>>), default(Expression<Action<Exception>>), default(Expression<Action>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- onNext,
- onError,
- onCompleted
- )
- );
- }
-
- /// <summary>
- /// Repeats the given <paramref name="source" /> as long as the specified <paramref name="condition" /> holds, where the <paramref name="condition" /> is evaluated after each repeated <paramref name="source" /> completed.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source to repeat as long as the <paramref name="condition" /> function evaluates to true.</param>
- /// <param name="condition">Condition that will be evaluated upon the completion of an iteration through the <paramref name="source" />, to determine whether repetition of the source is required.</param>
- /// <returns>The observable sequence obtained by concatenating the <paramref name="source" /> sequence as long as the <paramref name="condition" /> holds.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="condition" /> is null.</exception>
- public static IQbservable<TSource> DoWhile<TSource>(this IQbservable<TSource> source, Expression<Func<bool>> condition)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (condition == null)
- throw new ArgumentNullException("condition");
-
- return source.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.DoWhile<TSource>(default(IQbservable<TSource>), default(Expression<Func<bool>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- condition
- )
- );
- }
-
- /// <summary>
- /// Returns the element at a specified index in a sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Observable sequence to return the element from.</param>
- /// <param name="index">The zero-based index of the element to retrieve.</param>
- /// <returns>An observable sequence that produces the element at the specified position in the source sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> is null.</exception>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// <paramref name="index" /> is less than zero.</exception>
- /// <exception cref="T:System.ArgumentOutOfRangeException">(Asynchronous) <paramref name="index" /> is greater than or equal to the number of elements in the source sequence.</exception>
- public static IQbservable<TSource> ElementAt<TSource>(this IQbservable<TSource> source, int index)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return source.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.ElementAt<TSource>(default(IQbservable<TSource>), default(int))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- Expression.Constant(index, typeof(int))
- )
- );
- }
-
- /// <summary>
- /// Returns the element at a specified index in a sequence or a default value if the index is out of range.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Observable sequence to return the element from.</param>
- /// <param name="index">The zero-based index of the element to retrieve.</param>
- /// <returns>An observable sequence that produces the element at the specified position in the source sequence, or a default value if the index is outside the bounds of the source sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> is null.</exception>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// <paramref name="index" /> is less than zero.</exception>
- public static IQbservable<TSource> ElementAtOrDefault<TSource>(this IQbservable<TSource> source, int index)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return source.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.ElementAtOrDefault<TSource>(default(IQbservable<TSource>), default(int))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- Expression.Constant(index, typeof(int))
- )
- );
- }
-
- /// <summary>
- /// Returns an empty observable sequence.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TResult">The type used for the IObservable&lt;T&gt; type parameter of the resulting sequence.</typeparam>
- /// <returns>An observable sequence with no elements.</returns>
- public static IQbservable<TResult> Empty<TResult>(this IQbservableProvider provider)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
-
- return provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Empty<TResult>(default(IQbservableProvider))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TResult)),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider))
- )
- );
- }
-
- /// <summary>
- /// Returns an empty observable sequence, using the specified scheduler to send out the single OnCompleted message.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TResult">The type used for the IObservable&lt;T&gt; type parameter of the resulting sequence.</typeparam>
- /// <param name="scheduler">Scheduler to send the termination call on.</param>
- /// <returns>An observable sequence with no elements.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="scheduler" /> is null.</exception>
- public static IQbservable<TResult> Empty<TResult>(this IQbservableProvider provider, IScheduler scheduler)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Empty<TResult>(default(IQbservableProvider), default(IScheduler))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TResult)),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- Expression.Constant(scheduler, typeof(IScheduler))
- )
- );
- }
-
- /// <summary>
- /// Returns an empty observable sequence, using the specified scheduler to send out the single OnCompleted message.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TResult">The type used for the IObservable&lt;T&gt; type parameter of the resulting sequence.</typeparam>
- /// <param name="scheduler">Scheduler to send the termination call on.</param>
- /// <param name="witness">Object solely used to infer the type of the <typeparamref name="TResult" /> type parameter. This parameter is typically used when creating a sequence of anonymously typed elements.</param>
- /// <returns>An observable sequence with no elements.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="scheduler" /> is null.</exception>
- public static IQbservable<TResult> Empty<TResult>(this IQbservableProvider provider, IScheduler scheduler, TResult witness)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Empty<TResult>(default(IQbservableProvider), default(IScheduler), default(TResult))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TResult)),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- Expression.Constant(scheduler, typeof(IScheduler)),
- Expression.Constant(witness, typeof(TResult))
- )
- );
- }
-
- /// <summary>
- /// Returns an empty observable sequence.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TResult">The type used for the IObservable&lt;T&gt; type parameter of the resulting sequence.</typeparam>
- /// <param name="witness">Object solely used to infer the type of the <typeparamref name="TResult" /> type parameter. This parameter is typically used when creating a sequence of anonymously typed elements.</param>
- /// <returns>An observable sequence with no elements.</returns>
- public static IQbservable<TResult> Empty<TResult>(this IQbservableProvider provider, TResult witness)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
-
- return provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Empty<TResult>(default(IQbservableProvider), default(TResult))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TResult)),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- Expression.Constant(witness, typeof(TResult))
- )
- );
- }
-
- /// <summary>
- /// Invokes a specified action after the source observable sequence terminates gracefully or exceptionally.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence.</param>
- /// <param name="finallyAction">Action to invoke after the source observable sequence terminates.</param>
- /// <returns>Source sequence with the action-invoking termination behavior applied.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="finallyAction" /> is null.</exception>
- public static IQbservable<TSource> Finally<TSource>(this IQbservable<TSource> source, Expression<Action> finallyAction)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (finallyAction == null)
- throw new ArgumentNullException("finallyAction");
-
- return source.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Finally<TSource>(default(IQbservable<TSource>), default(Expression<Action>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- finallyAction
- )
- );
- }
-
- /// <summary>
- /// Returns the first element of an observable sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source observable sequence.</param>
- /// <returns>Sequence containing the first element in the observable sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> is null.</exception>
- /// <exception cref="T:System.InvalidOperationException">(Asynchronous) The source sequence is empty.</exception>
- public static IQbservable<TSource> FirstAsync<TSource>(this IQbservable<TSource> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return source.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.FirstAsync<TSource>(default(IQbservable<TSource>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression
- )
- );
- }
-
- /// <summary>
- /// Returns the first element of an observable sequence that satisfies the condition in the predicate.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source observable sequence.</param>
- /// <param name="predicate">A predicate function to evaluate for elements in the source sequence.</param>
- /// <returns>Sequence containing the first element in the observable sequence that satisfies the condition in the predicate.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="predicate" /> is null.</exception>
- /// <exception cref="T:System.InvalidOperationException">(Asynchronous) No element satisfies the condition in the predicate. -or- The source sequence is empty.</exception>
- public static IQbservable<TSource> FirstAsync<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, bool>> predicate)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (predicate == null)
- throw new ArgumentNullException("predicate");
-
- return source.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.FirstAsync<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, bool>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- predicate
- )
- );
- }
-
- /// <summary>
- /// Returns the first element of an observable sequence, or a default value if no such element exists.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source observable sequence.</param>
- /// <returns>Sequence containing the first element in the observable sequence, or a default value if no such element exists.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> is null.</exception>
- public static IQbservable<TSource> FirstOrDefaultAsync<TSource>(this IQbservable<TSource> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return source.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.FirstOrDefaultAsync<TSource>(default(IQbservable<TSource>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression
- )
- );
- }
-
- /// <summary>
- /// Returns the first element of an observable sequence that satisfies the condition in the predicate, or a default value if no such element exists.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source observable sequence.</param>
- /// <param name="predicate">A predicate function to evaluate for elements in the source sequence.</param>
- /// <returns>Sequence containing the first element in the observable sequence that satisfies the condition in the predicate, or a default value if no such element exists.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="predicate" /> is null.</exception>
- public static IQbservable<TSource> FirstOrDefaultAsync<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, bool>> predicate)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (predicate == null)
- throw new ArgumentNullException("predicate");
-
- return source.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.FirstOrDefaultAsync<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, bool>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- predicate
- )
- );
- }
-
- /// <summary>
- /// Concatenates the observable sequences obtained by running the <paramref name="resultSelector" /> for each element in the given enumerable <paramref name="source" />.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TSource">The type of the elements in the enumerable source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the observable result sequence.</typeparam>
- /// <param name="source">Enumerable source for which each element will be mapped onto an observable source that will be concatenated in the result sequence.</param>
- /// <param name="resultSelector">Function to select an observable source for each element in the <paramref name="source" />.</param>
- /// <returns>The observable sequence obtained by concatenating the sources returned by <paramref name="resultSelector" /> for each element in the <paramref name="source" />.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="resultSelector" /> is null.</exception>
- public static IQbservable<TResult> For<TSource, TResult>(this IQbservableProvider provider, IEnumerable<TSource> source, Expression<Func<TSource, IObservable<TResult>>> resultSelector)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (source == null)
- throw new ArgumentNullException("source");
- if (resultSelector == null)
- throw new ArgumentNullException("resultSelector");
-
- return provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.For<TSource, TResult>(default(IQbservableProvider), default(IEnumerable<TSource>), default(Expression<Func<TSource, IObservable<TResult>>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- GetSourceExpression(source),
- resultSelector
- )
- );
- }
-
-#if !NO_TPL
- /// <summary>
- /// Converts to asynchronous action into an observable sequence. Each subscription to the resulting sequence causes the action to be started.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <param name="actionAsync">Asynchronous action to convert.</param>
- /// <returns>An observable sequence exposing a Unit value upon completion of the action, or an exception.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="actionAsync" /> is null.</exception>
- public static IQbservable<Unit> FromAsync(this IQbservableProvider provider, Expression<Func<Task>> actionAsync)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (actionAsync == null)
- throw new ArgumentNullException("actionAsync");
-
- return provider.CreateQuery<Unit>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.FromAsync(default(IQbservableProvider), default(Expression<Func<Task>>))),
-#else
- (MethodInfo)MethodInfo.GetCurrentMethod(),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- actionAsync
- )
- );
- }
-#endif
-
-#if !NO_TPL
- /// <summary>
- /// Converts to asynchronous action into an observable sequence. Each subscription to the resulting sequence causes the action to be started.
- /// The CancellationToken passed to the asynchronous action is tied to the observable sequence's subscription that triggered the action's invocation and can be used for best-effort cancellation.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <param name="actionAsync">Asynchronous action to convert.</param>
- /// <returns>An observable sequence exposing a Unit value upon completion of the action, or an exception.</returns>
- /// <remarks>When a subscription to the resulting sequence is disposed, the CancellationToken that was fed to the asynchronous function will be signaled.</remarks>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="actionAsync" /> is null.</exception>
- public static IQbservable<Unit> FromAsync(this IQbservableProvider provider, Expression<Func<CancellationToken, Task>> actionAsync)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (actionAsync == null)
- throw new ArgumentNullException("actionAsync");
-
- return provider.CreateQuery<Unit>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.FromAsync(default(IQbservableProvider), default(Expression<Func<CancellationToken, Task>>))),
-#else
- (MethodInfo)MethodInfo.GetCurrentMethod(),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- actionAsync
- )
- );
- }
-#endif
-
-#if !NO_TPL
- /// <summary>
- /// Converts to asynchronous function into an observable sequence. Each subscription to the resulting sequence causes the function to be started.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TResult">The type of the result returned by the asynchronous function.</typeparam>
- /// <param name="functionAsync">Asynchronous function to convert.</param>
- /// <returns>An observable sequence exposing the result of invoking the function, or an exception.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="functionAsync" /> is null.</exception>
- public static IQbservable<TResult> FromAsync<TResult>(this IQbservableProvider provider, Expression<Func<Task<TResult>>> functionAsync)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (functionAsync == null)
- throw new ArgumentNullException("functionAsync");
-
- return provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.FromAsync<TResult>(default(IQbservableProvider), default(Expression<Func<Task<TResult>>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TResult)),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- functionAsync
- )
- );
- }
-#endif
-
-#if !NO_TPL
- /// <summary>
- /// Converts to asynchronous function into an observable sequence. Each subscription to the resulting sequence causes the function to be started.
- /// The CancellationToken passed to the asynchronous function is tied to the observable sequence's subscription that triggered the function's invocation and can be used for best-effort cancellation.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TResult">The type of the result returned by the asynchronous function.</typeparam>
- /// <param name="functionAsync">Asynchronous function to convert.</param>
- /// <returns>An observable sequence exposing the result of invoking the function, or an exception.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="functionAsync" /> is null.</exception>
- /// <remarks>When a subscription to the resulting sequence is disposed, the CancellationToken that was fed to the asynchronous function will be signaled.</remarks>
- public static IQbservable<TResult> FromAsync<TResult>(this IQbservableProvider provider, Expression<Func<CancellationToken, Task<TResult>>> functionAsync)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (functionAsync == null)
- throw new ArgumentNullException("functionAsync");
-
- return provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.FromAsync<TResult>(default(IQbservableProvider), default(Expression<Func<CancellationToken, Task<TResult>>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TResult)),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- functionAsync
- )
- );
- }
-#endif
-
- /// <summary>
- /// Converts an Action-based .NET event to an observable sequence. Each event invocation is surfaced through an OnNext message in the resulting sequence.
- /// For conversion of events conforming to the standard .NET event pattern, use any of the FromEventPattern overloads instead.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <param name="addHandler">Action that attaches the given event handler to the underlying .NET event.</param>
- /// <param name="removeHandler">Action that detaches the given event handler from the underlying .NET event.</param>
- /// <returns>The observable sequence that contains the event argument objects passed to the invocations of the underlying .NET event.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="addHandler" /> or <paramref name="removeHandler" /> is null.</exception>
- /// <remarks>
- /// <para>
- /// Add and remove handler invocations are made whenever the number of observers grows beyond zero.
- /// As such, an event handler may be shared by multiple simultaneously active observers, using a subject for multicasting.
- /// </para>
- /// <para>
- /// The current <see cref="T:System.Threading.SynchronizationContext" /> is captured during the call to FromEvent, and is used to post add and remove handler invocations.
- /// This behavior ensures add and remove handler operations for thread-affine events are accessed from the same context, as required by some UI frameworks.
- /// </para>
- /// <para>
- /// If no SynchronizationContext is present at the point of calling FromEvent, add and remove handler invocations are made synchronously on the thread
- /// making the Subscribe or Dispose call, respectively.
- /// </para>
- /// <para>
- /// It's recommended to lift FromEvent calls outside event stream query expressions due to the free-threaded nature of Reactive Extensions. Doing so
- /// makes the captured SynchronizationContext predictable. This best practice also reduces clutter of bridging code inside queries, making the query expressions
- /// more concise and easier to understand.
- /// </para>
- /// </remarks>
- /// <seealso cref="M:System.Reactive.Linq.Observable.ToEvent(System.IObservable{System.Reactive.Unit})" />
- public static IQbservable<Unit> FromEvent(this IQbservableProvider provider, Expression<Action<Action>> addHandler, Expression<Action<Action>> removeHandler)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (addHandler == null)
- throw new ArgumentNullException("addHandler");
- if (removeHandler == null)
- throw new ArgumentNullException("removeHandler");
-
- return provider.CreateQuery<Unit>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.FromEvent(default(IQbservableProvider), default(Expression<Action<Action>>), default(Expression<Action<Action>>))),
-#else
- (MethodInfo)MethodInfo.GetCurrentMethod(),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- addHandler,
- removeHandler
- )
- );
- }
-
- /// <summary>
- /// Converts an Action-based .NET event to an observable sequence. Each event invocation is surfaced through an OnNext message in the resulting sequence.
- /// For conversion of events conforming to the standard .NET event pattern, use any of the FromEventPattern overloads instead.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <param name="addHandler">Action that attaches the given event handler to the underlying .NET event.</param>
- /// <param name="removeHandler">Action that detaches the given event handler from the underlying .NET event.</param>
- /// <param name="scheduler">The scheduler to run the add and remove event handler logic on.</param>
- /// <returns>The observable sequence that contains the event argument objects passed to the invocations of the underlying .NET event.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="addHandler" /> or <paramref name="removeHandler" /> or <paramref name="scheduler" /> is null.</exception>
- /// <remarks>
- /// <para>
- /// Add and remove handler invocations are made whenever the number of observers grows beyond zero.
- /// As such, an event handler may be shared by multiple simultaneously active observers, using a subject for multicasting.
- /// </para>
- /// <para>
- /// Add and remove handler invocations are run on the specified scheduler. This behavior allows add and remove handler operations for thread-affine events to be
- /// accessed from the same context, as required by some UI frameworks.
- /// </para>
- /// <para>
- /// It's recommended to lift FromEvent calls outside event stream query expressions. This best practice reduces clutter of bridging code inside queries,
- /// making the query expressions more concise and easier to understand. This has additional benefits for overloads of FromEvent that omit the IScheduler
- /// parameter. For more information, see the remarks section on those overloads.
- /// </para>
- /// </remarks>
- /// <seealso cref="M:System.Reactive.Linq.Observable.ToEvent(System.IObservable{System.Reactive.Unit})" />
- public static IQbservable<Unit> FromEvent(this IQbservableProvider provider, Expression<Action<Action>> addHandler, Expression<Action<Action>> removeHandler, IScheduler scheduler)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (addHandler == null)
- throw new ArgumentNullException("addHandler");
- if (removeHandler == null)
- throw new ArgumentNullException("removeHandler");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return provider.CreateQuery<Unit>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.FromEvent(default(IQbservableProvider), default(Expression<Action<Action>>), default(Expression<Action<Action>>), default(IScheduler))),
-#else
- (MethodInfo)MethodInfo.GetCurrentMethod(),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- addHandler,
- removeHandler,
- Expression.Constant(scheduler, typeof(IScheduler))
- )
- );
- }
-
- /// <summary>
- /// Converts a .NET event to an observable sequence, using a supplied event delegate type. Each event invocation is surfaced through an OnNext message in the resulting sequence.
- /// For conversion of events conforming to the standard .NET event pattern, use any of the FromEventPattern overloads instead.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TDelegate">The delegate type of the event to be converted.</typeparam>
- /// <typeparam name="TEventArgs">The type of the event data generated by the event.</typeparam>
- /// <param name="addHandler">Action that attaches the given event handler to the underlying .NET event.</param>
- /// <param name="removeHandler">Action that detaches the given event handler from the underlying .NET event.</param>
- /// <returns>The observable sequence that contains the event argument objects passed to the invocations of the underlying .NET event.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="addHandler" /> or <paramref name="removeHandler" /> is null.</exception>
- /// <remarks>
- /// <para>
- /// Add and remove handler invocations are made whenever the number of observers grows beyond zero.
- /// As such, an event handler may be shared by multiple simultaneously active observers, using a subject for multicasting.
- /// </para>
- /// <para>
- /// The current <see cref="T:System.Threading.SynchronizationContext" /> is captured during the call to FromEvent, and is used to post add and remove handler invocations.
- /// This behavior ensures add and remove handler operations for thread-affine events are accessed from the same context, as required by some UI frameworks.
- /// </para>
- /// <para>
- /// If no SynchronizationContext is present at the point of calling FromEvent, add and remove handler invocations are made synchronously on the thread
- /// making the Subscribe or Dispose call, respectively.
- /// </para>
- /// <para>
- /// It's recommended to lift FromEvent calls outside event stream query expressions due to the free-threaded nature of Reactive Extensions. Doing so
- /// makes the captured SynchronizationContext predictable. This best practice also reduces clutter of bridging code inside queries, making the query expressions
- /// more concise and easier to understand.
- /// </para>
- /// </remarks>
- /// <seealso cref="M:System.Reactive.Linq.Observable.ToEvent(System.IObservable{System.Reactive.Unit})" />
- public static IQbservable<TEventArgs> FromEvent<TDelegate, TEventArgs>(this IQbservableProvider provider, Expression<Action<TDelegate>> addHandler, Expression<Action<TDelegate>> removeHandler)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (addHandler == null)
- throw new ArgumentNullException("addHandler");
- if (removeHandler == null)
- throw new ArgumentNullException("removeHandler");
-
- return provider.CreateQuery<TEventArgs>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.FromEvent<TDelegate, TEventArgs>(default(IQbservableProvider), default(Expression<Action<TDelegate>>), default(Expression<Action<TDelegate>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TDelegate), typeof(TEventArgs)),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- addHandler,
- removeHandler
- )
- );
- }
-
- /// <summary>
- /// Converts a .NET event to an observable sequence, using a supplied event delegate type. Each event invocation is surfaced through an OnNext message in the resulting sequence.
- /// For conversion of events conforming to the standard .NET event pattern, use any of the FromEventPattern overloads instead.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TDelegate">The delegate type of the event to be converted.</typeparam>
- /// <typeparam name="TEventArgs">The type of the event data generated by the event.</typeparam>
- /// <param name="addHandler">Action that attaches the given event handler to the underlying .NET event.</param>
- /// <param name="removeHandler">Action that detaches the given event handler from the underlying .NET event.</param>
- /// <param name="scheduler">The scheduler to run the add and remove event handler logic on.</param>
- /// <returns>The observable sequence that contains the event argument objects passed to the invocations of the underlying .NET event.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="addHandler" /> or <paramref name="removeHandler" /> or <paramref name="scheduler" /> is null.</exception>
- /// <remarks>
- /// <para>
- /// Add and remove handler invocations are made whenever the number of observers grows beyond zero.
- /// As such, an event handler may be shared by multiple simultaneously active observers, using a subject for multicasting.
- /// </para>
- /// <para>
- /// Add and remove handler invocations are run on the specified scheduler. This behavior allows add and remove handler operations for thread-affine events to be
- /// accessed from the same context, as required by some UI frameworks.
- /// </para>
- /// <para>
- /// It's recommended to lift FromEvent calls outside event stream query expressions. This best practice reduces clutter of bridging code inside queries,
- /// making the query expressions more concise and easier to understand. This has additional benefits for overloads of FromEvent that omit the IScheduler
- /// parameter. For more information, see the remarks section on those overloads.
- /// </para>
- /// </remarks>
- /// <seealso cref="M:System.Reactive.Linq.Observable.ToEvent(System.IObservable{System.Reactive.Unit})" />
- public static IQbservable<TEventArgs> FromEvent<TDelegate, TEventArgs>(this IQbservableProvider provider, Expression<Action<TDelegate>> addHandler, Expression<Action<TDelegate>> removeHandler, IScheduler scheduler)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (addHandler == null)
- throw new ArgumentNullException("addHandler");
- if (removeHandler == null)
- throw new ArgumentNullException("removeHandler");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return provider.CreateQuery<TEventArgs>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.FromEvent<TDelegate, TEventArgs>(default(IQbservableProvider), default(Expression<Action<TDelegate>>), default(Expression<Action<TDelegate>>), default(IScheduler))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TDelegate), typeof(TEventArgs)),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- addHandler,
- removeHandler,
- Expression.Constant(scheduler, typeof(IScheduler))
- )
- );
- }
-
- /// <summary>
- /// Converts a .NET event to an observable sequence, using a conversion function to obtain the event delegate. Each event invocation is surfaced through an OnNext message in the resulting sequence.
- /// For conversion of events conforming to the standard .NET event pattern, use any of the FromEventPattern overloads instead.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TDelegate">The delegate type of the event to be converted.</typeparam>
- /// <typeparam name="TEventArgs">The type of the event data generated by the event.</typeparam>
- /// <param name="conversion">A function used to convert the given event handler to a delegate compatible with the underlying .NET event. The resulting delegate is used in calls to the addHandler and removeHandler action parameters.</param>
- /// <param name="addHandler">Action that attaches the given event handler to the underlying .NET event.</param>
- /// <param name="removeHandler">Action that detaches the given event handler from the underlying .NET event.</param>
- /// <returns>The observable sequence that contains the event argument objects passed to the invocations of the underlying .NET event.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="conversion" /> or <paramref name="addHandler" /> or <paramref name="removeHandler" /> is null.</exception>
- /// <remarks>
- /// <para>
- /// Add and remove handler invocations are made whenever the number of observers grows beyond zero.
- /// As such, an event handler may be shared by multiple simultaneously active observers, using a subject for multicasting.
- /// </para>
- /// <para>
- /// The current <see cref="T:System.Threading.SynchronizationContext" /> is captured during the call to FromEvent, and is used to post add and remove handler invocations.
- /// This behavior ensures add and remove handler operations for thread-affine events are accessed from the same context, as required by some UI frameworks.
- /// </para>
- /// <para>
- /// If no SynchronizationContext is present at the point of calling FromEvent, add and remove handler invocations are made synchronously on the thread
- /// making the Subscribe or Dispose call, respectively.
- /// </para>
- /// <para>
- /// It's recommended to lift FromEvent calls outside event stream query expressions due to the free-threaded nature of Reactive Extensions. Doing so
- /// makes the captured SynchronizationContext predictable. This best practice also reduces clutter of bridging code inside queries, making the query expressions
- /// more concise and easier to understand.
- /// </para>
- /// </remarks>
- /// <seealso cref="M:System.Reactive.Linq.Observable.ToEvent(System.IObservable{System.Reactive.Unit})" />
- public static IQbservable<TEventArgs> FromEvent<TDelegate, TEventArgs>(this IQbservableProvider provider, Expression<Func<Action<TEventArgs>, TDelegate>> conversion, Expression<Action<TDelegate>> addHandler, Expression<Action<TDelegate>> removeHandler)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (conversion == null)
- throw new ArgumentNullException("conversion");
- if (addHandler == null)
- throw new ArgumentNullException("addHandler");
- if (removeHandler == null)
- throw new ArgumentNullException("removeHandler");
-
- return provider.CreateQuery<TEventArgs>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.FromEvent<TDelegate, TEventArgs>(default(IQbservableProvider), default(Expression<Func<Action<TEventArgs>, TDelegate>>), default(Expression<Action<TDelegate>>), default(Expression<Action<TDelegate>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TDelegate), typeof(TEventArgs)),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- conversion,
- addHandler,
- removeHandler
- )
- );
- }
-
- /// <summary>
- /// Converts a .NET event to an observable sequence, using a conversion function to obtain the event delegate. Each event invocation is surfaced through an OnNext message in the resulting sequence.
- /// For conversion of events conforming to the standard .NET event pattern, use any of the FromEventPattern overloads instead.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TDelegate">The delegate type of the event to be converted.</typeparam>
- /// <typeparam name="TEventArgs">The type of the event data generated by the event.</typeparam>
- /// <param name="conversion">A function used to convert the given event handler to a delegate compatible with the underlying .NET event. The resulting delegate is used in calls to the addHandler and removeHandler action parameters.</param>
- /// <param name="addHandler">Action that attaches the given event handler to the underlying .NET event.</param>
- /// <param name="removeHandler">Action that detaches the given event handler from the underlying .NET event.</param>
- /// <param name="scheduler">The scheduler to run the add and remove event handler logic on.</param>
- /// <returns>The observable sequence that contains the event argument objects passed to the invocations of the underlying .NET event.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="conversion" /> or <paramref name="addHandler" /> or <paramref name="removeHandler" /> or <paramref name="scheduler" /> is null.</exception>
- /// <remarks>
- /// <para>
- /// Add and remove handler invocations are made whenever the number of observers grows beyond zero.
- /// As such, an event handler may be shared by multiple simultaneously active observers, using a subject for multicasting.
- /// </para>
- /// <para>
- /// Add and remove handler invocations are run on the specified scheduler. This behavior allows add and remove handler operations for thread-affine events to be
- /// accessed from the same context, as required by some UI frameworks.
- /// </para>
- /// <para>
- /// It's recommended to lift FromEvent calls outside event stream query expressions. This best practice reduces clutter of bridging code inside queries,
- /// making the query expressions more concise and easier to understand. This has additional benefits for overloads of FromEvent that omit the IScheduler
- /// parameter. For more information, see the remarks section on those overloads.
- /// </para>
- /// </remarks>
- /// <seealso cref="M:System.Reactive.Linq.Observable.ToEvent(System.IObservable{System.Reactive.Unit})" />
- public static IQbservable<TEventArgs> FromEvent<TDelegate, TEventArgs>(this IQbservableProvider provider, Expression<Func<Action<TEventArgs>, TDelegate>> conversion, Expression<Action<TDelegate>> addHandler, Expression<Action<TDelegate>> removeHandler, IScheduler scheduler)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (conversion == null)
- throw new ArgumentNullException("conversion");
- if (addHandler == null)
- throw new ArgumentNullException("addHandler");
- if (removeHandler == null)
- throw new ArgumentNullException("removeHandler");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return provider.CreateQuery<TEventArgs>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.FromEvent<TDelegate, TEventArgs>(default(IQbservableProvider), default(Expression<Func<Action<TEventArgs>, TDelegate>>), default(Expression<Action<TDelegate>>), default(Expression<Action<TDelegate>>), default(IScheduler))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TDelegate), typeof(TEventArgs)),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- conversion,
- addHandler,
- removeHandler,
- Expression.Constant(scheduler, typeof(IScheduler))
- )
- );
- }
-
- /// <summary>
- /// Converts a generic Action-based .NET event to an observable sequence. Each event invocation is surfaced through an OnNext message in the resulting sequence.
- /// For conversion of events conforming to the standard .NET event pattern, use any of the FromEventPattern overloads instead.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TEventArgs">The type of the event data generated by the event.</typeparam>
- /// <param name="addHandler">Action that attaches the given event handler to the underlying .NET event.</param>
- /// <param name="removeHandler">Action that detaches the given event handler from the underlying .NET event.</param>
- /// <returns>The observable sequence that contains the event argument objects passed to the invocations of the underlying .NET event.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="addHandler" /> or <paramref name="removeHandler" /> is null.</exception>
- /// <remarks>
- /// <para>
- /// Add and remove handler invocations are made whenever the number of observers grows beyond zero.
- /// As such, an event handler may be shared by multiple simultaneously active observers, using a subject for multicasting.
- /// </para>
- /// <para>
- /// The current <see cref="T:System.Threading.SynchronizationContext" /> is captured during the call to FromEvent, and is used to post add and remove handler invocations.
- /// This behavior ensures add and remove handler operations for thread-affine events are accessed from the same context, as required by some UI frameworks.
- /// </para>
- /// <para>
- /// If no SynchronizationContext is present at the point of calling FromEvent, add and remove handler invocations are made synchronously on the thread
- /// making the Subscribe or Dispose call, respectively.
- /// </para>
- /// <para>
- /// It's recommended to lift FromEvent calls outside event stream query expressions due to the free-threaded nature of Reactive Extensions. Doing so
- /// makes the captured SynchronizationContext predictable. This best practice also reduces clutter of bridging code inside queries, making the query expressions
- /// more concise and easier to understand.
- /// </para>
- /// </remarks>
- /// <seealso cref="M:System.Reactive.Linq.Observable.ToEvent(System.IObservable{System.Reactive.Unit})" />
- public static IQbservable<TEventArgs> FromEvent<TEventArgs>(this IQbservableProvider provider, Expression<Action<Action<TEventArgs>>> addHandler, Expression<Action<Action<TEventArgs>>> removeHandler)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (addHandler == null)
- throw new ArgumentNullException("addHandler");
- if (removeHandler == null)
- throw new ArgumentNullException("removeHandler");
-
- return provider.CreateQuery<TEventArgs>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.FromEvent<TEventArgs>(default(IQbservableProvider), default(Expression<Action<Action<TEventArgs>>>), default(Expression<Action<Action<TEventArgs>>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TEventArgs)),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- addHandler,
- removeHandler
- )
- );
- }
-
- /// <summary>
- /// Converts a generic Action-based .NET event to an observable sequence. Each event invocation is surfaced through an OnNext message in the resulting sequence.
- /// For conversion of events conforming to the standard .NET event pattern, use any of the FromEventPattern overloads instead.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TEventArgs">The type of the event data generated by the event.</typeparam>
- /// <param name="addHandler">Action that attaches the given event handler to the underlying .NET event.</param>
- /// <param name="removeHandler">Action that detaches the given event handler from the underlying .NET event.</param>
- /// <param name="scheduler">The scheduler to run the add and remove event handler logic on.</param>
- /// <returns>The observable sequence that contains the event argument objects passed to the invocations of the underlying .NET event.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="addHandler" /> or <paramref name="removeHandler" /> or <paramref name="scheduler" /> is null.</exception>
- /// <remarks>
- /// <para>
- /// Add and remove handler invocations are made whenever the number of observers grows beyond zero.
- /// As such, an event handler may be shared by multiple simultaneously active observers, using a subject for multicasting.
- /// </para>
- /// <para>
- /// Add and remove handler invocations are run on the specified scheduler. This behavior allows add and remove handler operations for thread-affine events to be
- /// accessed from the same context, as required by some UI frameworks.
- /// </para>
- /// <para>
- /// It's recommended to lift FromEvent calls outside event stream query expressions. This best practice reduces clutter of bridging code inside queries,
- /// making the query expressions more concise and easier to understand. This has additional benefits for overloads of FromEvent that omit the IScheduler
- /// parameter. For more information, see the remarks section on those overloads.
- /// </para>
- /// </remarks>
- /// <seealso cref="M:System.Reactive.Linq.Observable.ToEvent(System.IObservable{System.Reactive.Unit})" />
- public static IQbservable<TEventArgs> FromEvent<TEventArgs>(this IQbservableProvider provider, Expression<Action<Action<TEventArgs>>> addHandler, Expression<Action<Action<TEventArgs>>> removeHandler, IScheduler scheduler)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (addHandler == null)
- throw new ArgumentNullException("addHandler");
- if (removeHandler == null)
- throw new ArgumentNullException("removeHandler");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return provider.CreateQuery<TEventArgs>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.FromEvent<TEventArgs>(default(IQbservableProvider), default(Expression<Action<Action<TEventArgs>>>), default(Expression<Action<Action<TEventArgs>>>), default(IScheduler))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TEventArgs)),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- addHandler,
- removeHandler,
- Expression.Constant(scheduler, typeof(IScheduler))
- )
- );
- }
-
-#if !NO_EVENTARGS_CONSTRAINT
- /// <summary>
- /// Converts a .NET event, conforming to the standard .NET event pattern based on <see cref="T:System.EventHandler" />, to an observable sequence.
- /// Each event invocation is surfaced through an OnNext message in the resulting sequence.
- /// For conversion of events that don't conform to the standard .NET event pattern, use any of the FromEvent overloads instead.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <param name="addHandler">Action that attaches the given event handler to the underlying .NET event.</param>
- /// <param name="removeHandler">Action that detaches the given event handler from the underlying .NET event.</param>
- /// <returns>The observable sequence that contains data representations of invocations of the underlying .NET event.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="addHandler" /> or <paramref name="removeHandler" /> is null.</exception>
- /// <remarks>
- /// <para>
- /// Add and remove handler invocations are made whenever the number of observers grows beyond zero.
- /// As such, an event handler may be shared by multiple simultaneously active observers, using a subject for multicasting.
- /// </para>
- /// <para>
- /// The current <see cref="T:System.Threading.SynchronizationContext" /> is captured during the call to FromEventPattern, and is used to post add and remove handler invocations.
- /// This behavior ensures add and remove handler operations for thread-affine events are accessed from the same context, as required by some UI frameworks.
- /// </para>
- /// <para>
- /// If no SynchronizationContext is present at the point of calling FromEventPattern, add and remove handler invocations are made synchronously on the thread
- /// making the Subscribe or Dispose call, respectively.
- /// </para>
- /// <para>
- /// It's recommended to lift FromEventPattern calls outside event stream query expressions due to the free-threaded nature of Reactive Extensions. Doing so
- /// makes the captured SynchronizationContext predictable. This best practice also reduces clutter of bridging code inside queries, making the query expressions
- /// more concise and easier to understand.
- /// </para>
- /// </remarks>
- /// <seealso cref="M:System.Reactive.Linq.Observable.ToEventPattern``1(System.IObservable{System.Reactive.EventPattern{``0}})" />
- public static IQbservable<EventPattern<EventArgs>> FromEventPattern(this IQbservableProvider provider, Expression<Action<EventHandler>> addHandler, Expression<Action<EventHandler>> removeHandler)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (addHandler == null)
- throw new ArgumentNullException("addHandler");
- if (removeHandler == null)
- throw new ArgumentNullException("removeHandler");
-
- return provider.CreateQuery<EventPattern<EventArgs>>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.FromEventPattern(default(IQbservableProvider), default(Expression<Action<EventHandler>>), default(Expression<Action<EventHandler>>))),
-#else
- (MethodInfo)MethodInfo.GetCurrentMethod(),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- addHandler,
- removeHandler
- )
- );
- }
-#else
- /// <summary>
- /// Converts a .NET event, conforming to the standard .NET event pattern based on <see cref="T:System.EventHandler" />, to an observable sequence.
- /// Each event invocation is surfaced through an OnNext message in the resulting sequence.
- /// For conversion of events that don't conform to the standard .NET event pattern, use any of the FromEvent overloads instead.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <param name="addHandler">Action that attaches the given event handler to the underlying .NET event.</param>
- /// <param name="removeHandler">Action that detaches the given event handler from the underlying .NET event.</param>
- /// <returns>The observable sequence that contains data representations of invocations of the underlying .NET event.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="addHandler" /> or <paramref name="removeHandler" /> is null.</exception>
- /// <remarks>
- /// <para>
- /// Add and remove handler invocations are made whenever the number of observers grows beyond zero.
- /// As such, an event handler may be shared by multiple simultaneously active observers, using a subject for multicasting.
- /// </para>
- /// <para>
- /// The current <see cref="T:System.Threading.SynchronizationContext" /> is captured during the call to FromEventPattern, and is used to post add and remove handler invocations.
- /// This behavior ensures add and remove handler operations for thread-affine events are accessed from the same context, as required by some UI frameworks.
- /// </para>
- /// <para>
- /// If no SynchronizationContext is present at the point of calling FromEventPattern, add and remove handler invocations are made synchronously on the thread
- /// making the Subscribe or Dispose call, respectively.
- /// </para>
- /// <para>
- /// It's recommended to lift FromEventPattern calls outside event stream query expressions due to the free-threaded nature of Reactive Extensions. Doing so
- /// makes the captured SynchronizationContext predictable. This best practice also reduces clutter of bridging code inside queries, making the query expressions
- /// more concise and easier to understand.
- /// </para>
- /// </remarks>
- /// <seealso cref="M:System.Reactive.Linq.Observable.ToEventPattern``1(System.IObservable{System.Reactive.EventPattern{``0}})" />
- public static IQbservable<EventPattern<object>> FromEventPattern(this IQbservableProvider provider, Expression<Action<EventHandler>> addHandler, Expression<Action<EventHandler>> removeHandler)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (addHandler == null)
- throw new ArgumentNullException("addHandler");
- if (removeHandler == null)
- throw new ArgumentNullException("removeHandler");
-
- return provider.CreateQuery<EventPattern<object>>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.FromEventPattern(default(IQbservableProvider), default(Expression<Action<EventHandler>>), default(Expression<Action<EventHandler>>))),
-#else
- (MethodInfo)MethodInfo.GetCurrentMethod(),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- addHandler,
- removeHandler
- )
- );
- }
-#endif
-
-#if !NO_EVENTARGS_CONSTRAINT
- /// <summary>
- /// Converts a .NET event, conforming to the standard .NET event pattern based on <see cref="T:System.EventHandler" />, to an observable sequence.
- /// Each event invocation is surfaced through an OnNext message in the resulting sequence.
- /// For conversion of events that don't conform to the standard .NET event pattern, use any of the FromEvent overloads instead.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <param name="addHandler">Action that attaches the given event handler to the underlying .NET event.</param>
- /// <param name="removeHandler">Action that detaches the given event handler from the underlying .NET event.</param>
- /// <param name="scheduler">The scheduler to run the add and remove event handler logic on.</param>
- /// <returns>The observable sequence that contains data representations of invocations of the underlying .NET event.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="addHandler" /> or <paramref name="removeHandler" /> or <paramref name="scheduler" /> is null.</exception>
- /// <remarks>
- /// <para>
- /// Add and remove handler invocations are made whenever the number of observers grows beyond zero.
- /// As such, an event handler may be shared by multiple simultaneously active observers, using a subject for multicasting.
- /// </para>
- /// <para>
- /// Add and remove handler invocations are run on the specified scheduler. This behavior allows add and remove handler operations for thread-affine events to be
- /// accessed from the same context, as required by some UI frameworks.
- /// </para>
- /// <para>
- /// It's recommended to lift FromEventPattern calls outside event stream query expressions. This best practice reduces clutter of bridging code inside queries,
- /// making the query expressions more concise and easier to understand. This has additional benefits for overloads of FromEventPattern that omit the IScheduler
- /// parameter. For more information, see the remarks section on those overloads.
- /// </para>
- /// </remarks>
- /// <seealso cref="M:System.Reactive.Linq.Observable.ToEventPattern``1(System.IObservable{System.Reactive.EventPattern{``0}})" />
- public static IQbservable<EventPattern<EventArgs>> FromEventPattern(this IQbservableProvider provider, Expression<Action<EventHandler>> addHandler, Expression<Action<EventHandler>> removeHandler, IScheduler scheduler)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (addHandler == null)
- throw new ArgumentNullException("addHandler");
- if (removeHandler == null)
- throw new ArgumentNullException("removeHandler");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return provider.CreateQuery<EventPattern<EventArgs>>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.FromEventPattern(default(IQbservableProvider), default(Expression<Action<EventHandler>>), default(Expression<Action<EventHandler>>), default(IScheduler))),
-#else
- (MethodInfo)MethodInfo.GetCurrentMethod(),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- addHandler,
- removeHandler,
- Expression.Constant(scheduler, typeof(IScheduler))
- )
- );
- }
-#else
- /// <summary>
- /// Converts a .NET event, conforming to the standard .NET event pattern based on <see cref="T:System.EventHandler" />, to an observable sequence.
- /// Each event invocation is surfaced through an OnNext message in the resulting sequence.
- /// For conversion of events that don't conform to the standard .NET event pattern, use any of the FromEvent overloads instead.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <param name="addHandler">Action that attaches the given event handler to the underlying .NET event.</param>
- /// <param name="removeHandler">Action that detaches the given event handler from the underlying .NET event.</param>
- /// <param name="scheduler">The scheduler to run the add and remove event handler logic on.</param>
- /// <returns>The observable sequence that contains data representations of invocations of the underlying .NET event.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="addHandler" /> or <paramref name="removeHandler" /> or <paramref name="scheduler" /> is null.</exception>
- /// <remarks>
- /// <para>
- /// Add and remove handler invocations are made whenever the number of observers grows beyond zero.
- /// As such, an event handler may be shared by multiple simultaneously active observers, using a subject for multicasting.
- /// </para>
- /// <para>
- /// Add and remove handler invocations are run on the specified scheduler. This behavior allows add and remove handler operations for thread-affine events to be
- /// accessed from the same context, as required by some UI frameworks.
- /// </para>
- /// <para>
- /// It's recommended to lift FromEventPattern calls outside event stream query expressions. This best practice reduces clutter of bridging code inside queries,
- /// making the query expressions more concise and easier to understand. This has additional benefits for overloads of FromEventPattern that omit the IScheduler
- /// parameter. For more information, see the remarks section on those overloads.
- /// </para>
- /// </remarks>
- /// <seealso cref="M:System.Reactive.Linq.Observable.ToEventPattern``1(System.IObservable{System.Reactive.EventPattern{``0}})" />
- public static IQbservable<EventPattern<object>> FromEventPattern(this IQbservableProvider provider, Expression<Action<EventHandler>> addHandler, Expression<Action<EventHandler>> removeHandler, IScheduler scheduler)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (addHandler == null)
- throw new ArgumentNullException("addHandler");
- if (removeHandler == null)
- throw new ArgumentNullException("removeHandler");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return provider.CreateQuery<EventPattern<object>>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.FromEventPattern(default(IQbservableProvider), default(Expression<Action<EventHandler>>), default(Expression<Action<EventHandler>>), default(IScheduler))),
-#else
- (MethodInfo)MethodInfo.GetCurrentMethod(),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- addHandler,
- removeHandler,
- Expression.Constant(scheduler, typeof(IScheduler))
- )
- );
- }
-#endif
-
-#if !NO_EVENTARGS_CONSTRAINT
- /// <summary>
- /// Converts an instance .NET event, conforming to the standard .NET event pattern with an <see cref="T:System.EventArgs" /> parameter, to an observable sequence.
- /// Each event invocation is surfaced through an OnNext message in the resulting sequence.
- /// Reflection is used to discover the event based on the target object type and the specified event name.
- /// For conversion of events that don't conform to the standard .NET event pattern, use any of the FromEvent overloads instead.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <param name="target">Object instance that exposes the event to convert.</param>
- /// <param name="eventName">Name of the event to convert.</param>
- /// <returns>The observable sequence that contains data representations of invocations of the underlying .NET event.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="target" /> or <paramref name="eventName" /> is null.</exception>
- /// <exception cref="T:System.InvalidOperationException">The event could not be found. -or- The event does not conform to the standard .NET event pattern.</exception>
- /// <remarks>
- /// <para>
- /// Add and remove handler invocations are made whenever the number of observers grows beyond zero.
- /// As such, an event handler may be shared by multiple simultaneously active observers, using a subject for multicasting.
- /// </para>
- /// <para>
- /// The current <see cref="T:System.Threading.SynchronizationContext" /> is captured during the call to FromEventPattern, and is used to post add and remove handler invocations.
- /// This behavior ensures add and remove handler operations for thread-affine events are accessed from the same context, as required by some UI frameworks.
- /// </para>
- /// <para>
- /// If no SynchronizationContext is present at the point of calling FromEventPattern, add and remove handler invocations are made synchronously on the thread
- /// making the Subscribe or Dispose call, respectively.
- /// </para>
- /// <para>
- /// It's recommended to lift FromEventPattern calls outside event stream query expressions due to the free-threaded nature of Reactive Extensions. Doing so
- /// makes the captured SynchronizationContext predictable. This best practice also reduces clutter of bridging code inside queries, making the query expressions
- /// more concise and easier to understand.
- /// </para>
- /// </remarks>
- /// <seealso cref="M:System.Reactive.Linq.Observable.ToEventPattern``1(System.IObservable{System.Reactive.EventPattern{``0}})" />
- public static IQbservable<EventPattern<EventArgs>> FromEventPattern(this IQbservableProvider provider, object target, string eventName)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (target == null)
- throw new ArgumentNullException("target");
- if (eventName == null)
- throw new ArgumentNullException("eventName");
-
- return provider.CreateQuery<EventPattern<EventArgs>>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.FromEventPattern(default(IQbservableProvider), default(object), default(string))),
-#else
- (MethodInfo)MethodInfo.GetCurrentMethod(),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- Expression.Constant(target, typeof(object)),
- Expression.Constant(eventName, typeof(string))
- )
- );
- }
-#else
- /// <summary>
- /// Converts an instance .NET event, conforming to the standard .NET event pattern with an <see cref="T:System.EventArgs" /> parameter, to an observable sequence.
- /// Each event invocation is surfaced through an OnNext message in the resulting sequence.
- /// Reflection is used to discover the event based on the target object type and the specified event name.
- /// For conversion of events that don't conform to the standard .NET event pattern, use any of the FromEvent overloads instead.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <param name="target">Object instance that exposes the event to convert.</param>
- /// <param name="eventName">Name of the event to convert.</param>
- /// <returns>The observable sequence that contains data representations of invocations of the underlying .NET event.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="target" /> or <paramref name="eventName" /> is null.</exception>
- /// <exception cref="T:System.InvalidOperationException">The event could not be found. -or- The event does not conform to the standard .NET event pattern.</exception>
- /// <remarks>
- /// <para>
- /// Add and remove handler invocations are made whenever the number of observers grows beyond zero.
- /// As such, an event handler may be shared by multiple simultaneously active observers, using a subject for multicasting.
- /// </para>
- /// <para>
- /// The current <see cref="T:System.Threading.SynchronizationContext" /> is captured during the call to FromEventPattern, and is used to post add and remove handler invocations.
- /// This behavior ensures add and remove handler operations for thread-affine events are accessed from the same context, as required by some UI frameworks.
- /// </para>
- /// <para>
- /// If no SynchronizationContext is present at the point of calling FromEventPattern, add and remove handler invocations are made synchronously on the thread
- /// making the Subscribe or Dispose call, respectively.
- /// </para>
- /// <para>
- /// It's recommended to lift FromEventPattern calls outside event stream query expressions due to the free-threaded nature of Reactive Extensions. Doing so
- /// makes the captured SynchronizationContext predictable. This best practice also reduces clutter of bridging code inside queries, making the query expressions
- /// more concise and easier to understand.
- /// </para>
- /// </remarks>
- /// <seealso cref="M:System.Reactive.Linq.Observable.ToEventPattern``1(System.IObservable{System.Reactive.EventPattern{``0}})" />
- public static IQbservable<EventPattern<object>> FromEventPattern(this IQbservableProvider provider, object target, string eventName)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (target == null)
- throw new ArgumentNullException("target");
- if (eventName == null)
- throw new ArgumentNullException("eventName");
-
- return provider.CreateQuery<EventPattern<object>>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.FromEventPattern(default(IQbservableProvider), default(object), default(string))),
-#else
- (MethodInfo)MethodInfo.GetCurrentMethod(),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- Expression.Constant(target, typeof(object)),
- Expression.Constant(eventName, typeof(string))
- )
- );
- }
-#endif
-
-#if !NO_EVENTARGS_CONSTRAINT
- /// <summary>
- /// Converts an instance .NET event, conforming to the standard .NET event pattern with an <see cref="T:System.EventArgs" /> parameter, to an observable sequence.
- /// Each event invocation is surfaced through an OnNext message in the resulting sequence.
- /// Reflection is used to discover the event based on the target object type and the specified event name.
- /// For conversion of events that don't conform to the standard .NET event pattern, use any of the FromEvent overloads instead.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <param name="target">Object instance that exposes the event to convert.</param>
- /// <param name="eventName">Name of the event to convert.</param>
- /// <param name="scheduler">The scheduler to run the add and remove event handler logic on.</param>
- /// <returns>The observable sequence that contains data representations of invocations of the underlying .NET event.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="target" /> or <paramref name="eventName" /> or <paramref name="scheduler" /> is null.</exception>
- /// <exception cref="T:System.InvalidOperationException">The event could not be found. -or- The event does not conform to the standard .NET event pattern.</exception>
- /// <remarks>
- /// <para>
- /// Add and remove handler invocations are made whenever the number of observers grows beyond zero.
- /// As such, an event handler may be shared by multiple simultaneously active observers, using a subject for multicasting.
- /// </para>
- /// <para>
- /// Add and remove handler invocations are run on the specified scheduler. This behavior allows add and remove handler operations for thread-affine events to be
- /// accessed from the same context, as required by some UI frameworks.
- /// </para>
- /// <para>
- /// It's recommended to lift FromEventPattern calls outside event stream query expressions. This best practice reduces clutter of bridging code inside queries,
- /// making the query expressions more concise and easier to understand. This has additional benefits for overloads of FromEventPattern that omit the IScheduler
- /// parameter. For more information, see the remarks section on those overloads.
- /// </para>
- /// </remarks>
- /// <seealso cref="M:System.Reactive.Linq.Observable.ToEventPattern``1(System.IObservable{System.Reactive.EventPattern{``0}})" />
- public static IQbservable<EventPattern<EventArgs>> FromEventPattern(this IQbservableProvider provider, object target, string eventName, IScheduler scheduler)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (target == null)
- throw new ArgumentNullException("target");
- if (eventName == null)
- throw new ArgumentNullException("eventName");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return provider.CreateQuery<EventPattern<EventArgs>>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.FromEventPattern(default(IQbservableProvider), default(object), default(string), default(IScheduler))),
-#else
- (MethodInfo)MethodInfo.GetCurrentMethod(),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- Expression.Constant(target, typeof(object)),
- Expression.Constant(eventName, typeof(string)),
- Expression.Constant(scheduler, typeof(IScheduler))
- )
- );
- }
-#else
- /// <summary>
- /// Converts an instance .NET event, conforming to the standard .NET event pattern with an <see cref="T:System.EventArgs" /> parameter, to an observable sequence.
- /// Each event invocation is surfaced through an OnNext message in the resulting sequence.
- /// Reflection is used to discover the event based on the target object type and the specified event name.
- /// For conversion of events that don't conform to the standard .NET event pattern, use any of the FromEvent overloads instead.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <param name="target">Object instance that exposes the event to convert.</param>
- /// <param name="eventName">Name of the event to convert.</param>
- /// <param name="scheduler">The scheduler to run the add and remove event handler logic on.</param>
- /// <returns>The observable sequence that contains data representations of invocations of the underlying .NET event.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="target" /> or <paramref name="eventName" /> or <paramref name="scheduler" /> is null.</exception>
- /// <exception cref="T:System.InvalidOperationException">The event could not be found. -or- The event does not conform to the standard .NET event pattern.</exception>
- /// <remarks>
- /// <para>
- /// Add and remove handler invocations are made whenever the number of observers grows beyond zero.
- /// As such, an event handler may be shared by multiple simultaneously active observers, using a subject for multicasting.
- /// </para>
- /// <para>
- /// Add and remove handler invocations are run on the specified scheduler. This behavior allows add and remove handler operations for thread-affine events to be
- /// accessed from the same context, as required by some UI frameworks.
- /// </para>
- /// <para>
- /// It's recommended to lift FromEventPattern calls outside event stream query expressions. This best practice reduces clutter of bridging code inside queries,
- /// making the query expressions more concise and easier to understand. This has additional benefits for overloads of FromEventPattern that omit the IScheduler
- /// parameter. For more information, see the remarks section on those overloads.
- /// </para>
- /// </remarks>
- /// <seealso cref="M:System.Reactive.Linq.Observable.ToEventPattern``1(System.IObservable{System.Reactive.EventPattern{``0}})" />
- public static IQbservable<EventPattern<object>> FromEventPattern(this IQbservableProvider provider, object target, string eventName, IScheduler scheduler)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (target == null)
- throw new ArgumentNullException("target");
- if (eventName == null)
- throw new ArgumentNullException("eventName");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return provider.CreateQuery<EventPattern<object>>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.FromEventPattern(default(IQbservableProvider), default(object), default(string), default(IScheduler))),
-#else
- (MethodInfo)MethodInfo.GetCurrentMethod(),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- Expression.Constant(target, typeof(object)),
- Expression.Constant(eventName, typeof(string)),
- Expression.Constant(scheduler, typeof(IScheduler))
- )
- );
- }
-#endif
-
-#if !NO_EVENTARGS_CONSTRAINT
- /// <summary>
- /// Converts a static .NET event, conforming to the standard .NET event pattern with an <see cref="T:System.EventArgs" /> parameter, to an observable sequence.
- /// Each event invocation is surfaced through an OnNext message in the resulting sequence.
- /// Reflection is used to discover the event based on the specified type and the specified event name.
- /// For conversion of events that don't conform to the standard .NET event pattern, use any of the FromEvent overloads instead.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <param name="type">Type that exposes the static event to convert.</param>
- /// <param name="eventName">Name of the event to convert.</param>
- /// <returns>The observable sequence that contains data representations of invocations of the underlying .NET event.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="type" /> or <paramref name="eventName" /> is null.</exception>
- /// <exception cref="T:System.InvalidOperationException">The event could not be found. -or- The event does not conform to the standard .NET event pattern.</exception>
- /// <remarks>
- /// <para>
- /// Add and remove handler invocations are made whenever the number of observers grows beyond zero.
- /// As such, an event handler may be shared by multiple simultaneously active observers, using a subject for multicasting.
- /// </para>
- /// <para>
- /// The current <see cref="T:System.Threading.SynchronizationContext" /> is captured during the call to FromEventPattern, and is used to post add and remove handler invocations.
- /// This behavior ensures add and remove handler operations for thread-affine events are accessed from the same context, as required by some UI frameworks.
- /// </para>
- /// <para>
- /// If no SynchronizationContext is present at the point of calling FromEventPattern, add and remove handler invocations are made synchronously on the thread
- /// making the Subscribe or Dispose call, respectively.
- /// </para>
- /// <para>
- /// It's recommended to lift FromEventPattern calls outside event stream query expressions due to the free-threaded nature of Reactive Extensions. Doing so
- /// makes the captured SynchronizationContext predictable. This best practice also reduces clutter of bridging code inside queries, making the query expressions
- /// more concise and easier to understand.
- /// </para>
- /// </remarks>
- /// <seealso cref="M:System.Reactive.Linq.Observable.ToEventPattern``1(System.IObservable{System.Reactive.EventPattern{``0}})" />
- public static IQbservable<EventPattern<EventArgs>> FromEventPattern(this IQbservableProvider provider, Type type, string eventName)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (type == null)
- throw new ArgumentNullException("type");
- if (eventName == null)
- throw new ArgumentNullException("eventName");
-
- return provider.CreateQuery<EventPattern<EventArgs>>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.FromEventPattern(default(IQbservableProvider), default(Type), default(string))),
-#else
- (MethodInfo)MethodInfo.GetCurrentMethod(),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- Expression.Constant(type, typeof(Type)),
- Expression.Constant(eventName, typeof(string))
- )
- );
- }
-#else
- /// <summary>
- /// Converts a static .NET event, conforming to the standard .NET event pattern with an <see cref="T:System.EventArgs" /> parameter, to an observable sequence.
- /// Each event invocation is surfaced through an OnNext message in the resulting sequence.
- /// Reflection is used to discover the event based on the specified type and the specified event name.
- /// For conversion of events that don't conform to the standard .NET event pattern, use any of the FromEvent overloads instead.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <param name="type">Type that exposes the static event to convert.</param>
- /// <param name="eventName">Name of the event to convert.</param>
- /// <returns>The observable sequence that contains data representations of invocations of the underlying .NET event.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="type" /> or <paramref name="eventName" /> is null.</exception>
- /// <exception cref="T:System.InvalidOperationException">The event could not be found. -or- The event does not conform to the standard .NET event pattern.</exception>
- /// <remarks>
- /// <para>
- /// Add and remove handler invocations are made whenever the number of observers grows beyond zero.
- /// As such, an event handler may be shared by multiple simultaneously active observers, using a subject for multicasting.
- /// </para>
- /// <para>
- /// The current <see cref="T:System.Threading.SynchronizationContext" /> is captured during the call to FromEventPattern, and is used to post add and remove handler invocations.
- /// This behavior ensures add and remove handler operations for thread-affine events are accessed from the same context, as required by some UI frameworks.
- /// </para>
- /// <para>
- /// If no SynchronizationContext is present at the point of calling FromEventPattern, add and remove handler invocations are made synchronously on the thread
- /// making the Subscribe or Dispose call, respectively.
- /// </para>
- /// <para>
- /// It's recommended to lift FromEventPattern calls outside event stream query expressions due to the free-threaded nature of Reactive Extensions. Doing so
- /// makes the captured SynchronizationContext predictable. This best practice also reduces clutter of bridging code inside queries, making the query expressions
- /// more concise and easier to understand.
- /// </para>
- /// </remarks>
- /// <seealso cref="M:System.Reactive.Linq.Observable.ToEventPattern``1(System.IObservable{System.Reactive.EventPattern{``0}})" />
- public static IQbservable<EventPattern<object>> FromEventPattern(this IQbservableProvider provider, Type type, string eventName)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (type == null)
- throw new ArgumentNullException("type");
- if (eventName == null)
- throw new ArgumentNullException("eventName");
-
- return provider.CreateQuery<EventPattern<object>>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.FromEventPattern(default(IQbservableProvider), default(Type), default(string))),
-#else
- (MethodInfo)MethodInfo.GetCurrentMethod(),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- Expression.Constant(type, typeof(Type)),
- Expression.Constant(eventName, typeof(string))
- )
- );
- }
-#endif
-
-#if !NO_EVENTARGS_CONSTRAINT
- /// <summary>
- /// Converts a static .NET event, conforming to the standard .NET event pattern with an <see cref="T:System.EventArgs" /> parameter, to an observable sequence.
- /// Each event invocation is surfaced through an OnNext message in the resulting sequence.
- /// Reflection is used to discover the event based on the specified type and the specified event name.
- /// For conversion of events that don't conform to the standard .NET event pattern, use any of the FromEvent overloads instead.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <param name="type">Type that exposes the static event to convert.</param>
- /// <param name="eventName">Name of the event to convert.</param>
- /// <param name="scheduler">The scheduler to run the add and remove event handler logic on.</param>
- /// <returns>The observable sequence that contains data representations of invocations of the underlying .NET event.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="type" /> or <paramref name="eventName" /> or <paramref name="scheduler" /> is null.</exception>
- /// <exception cref="T:System.InvalidOperationException">The event could not be found. -or- The event does not conform to the standard .NET event pattern.</exception>
- /// <remarks>
- /// <para>
- /// Add and remove handler invocations are made whenever the number of observers grows beyond zero.
- /// As such, an event handler may be shared by multiple simultaneously active observers, using a subject for multicasting.
- /// </para>
- /// <para>
- /// Add and remove handler invocations are run on the specified scheduler. This behavior allows add and remove handler operations for thread-affine events to be
- /// accessed from the same context, as required by some UI frameworks.
- /// </para>
- /// <para>
- /// It's recommended to lift FromEventPattern calls outside event stream query expressions. This best practice reduces clutter of bridging code inside queries,
- /// making the query expressions more concise and easier to understand. This has additional benefits for overloads of FromEventPattern that omit the IScheduler
- /// parameter. For more information, see the remarks section on those overloads.
- /// </para>
- /// </remarks>
- /// <seealso cref="M:System.Reactive.Linq.Observable.ToEventPattern``1(System.IObservable{System.Reactive.EventPattern{``0}})" />
- public static IQbservable<EventPattern<EventArgs>> FromEventPattern(this IQbservableProvider provider, Type type, string eventName, IScheduler scheduler)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (type == null)
- throw new ArgumentNullException("type");
- if (eventName == null)
- throw new ArgumentNullException("eventName");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return provider.CreateQuery<EventPattern<EventArgs>>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.FromEventPattern(default(IQbservableProvider), default(Type), default(string), default(IScheduler))),
-#else
- (MethodInfo)MethodInfo.GetCurrentMethod(),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- Expression.Constant(type, typeof(Type)),
- Expression.Constant(eventName, typeof(string)),
- Expression.Constant(scheduler, typeof(IScheduler))
- )
- );
- }
-#else
- /// <summary>
- /// Converts a static .NET event, conforming to the standard .NET event pattern with an <see cref="T:System.EventArgs" /> parameter, to an observable sequence.
- /// Each event invocation is surfaced through an OnNext message in the resulting sequence.
- /// Reflection is used to discover the event based on the specified type and the specified event name.
- /// For conversion of events that don't conform to the standard .NET event pattern, use any of the FromEvent overloads instead.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <param name="type">Type that exposes the static event to convert.</param>
- /// <param name="eventName">Name of the event to convert.</param>
- /// <param name="scheduler">The scheduler to run the add and remove event handler logic on.</param>
- /// <returns>The observable sequence that contains data representations of invocations of the underlying .NET event.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="type" /> or <paramref name="eventName" /> or <paramref name="scheduler" /> is null.</exception>
- /// <exception cref="T:System.InvalidOperationException">The event could not be found. -or- The event does not conform to the standard .NET event pattern.</exception>
- /// <remarks>
- /// <para>
- /// Add and remove handler invocations are made whenever the number of observers grows beyond zero.
- /// As such, an event handler may be shared by multiple simultaneously active observers, using a subject for multicasting.
- /// </para>
- /// <para>
- /// Add and remove handler invocations are run on the specified scheduler. This behavior allows add and remove handler operations for thread-affine events to be
- /// accessed from the same context, as required by some UI frameworks.
- /// </para>
- /// <para>
- /// It's recommended to lift FromEventPattern calls outside event stream query expressions. This best practice reduces clutter of bridging code inside queries,
- /// making the query expressions more concise and easier to understand. This has additional benefits for overloads of FromEventPattern that omit the IScheduler
- /// parameter. For more information, see the remarks section on those overloads.
- /// </para>
- /// </remarks>
- /// <seealso cref="M:System.Reactive.Linq.Observable.ToEventPattern``1(System.IObservable{System.Reactive.EventPattern{``0}})" />
- public static IQbservable<EventPattern<object>> FromEventPattern(this IQbservableProvider provider, Type type, string eventName, IScheduler scheduler)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (type == null)
- throw new ArgumentNullException("type");
- if (eventName == null)
- throw new ArgumentNullException("eventName");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return provider.CreateQuery<EventPattern<object>>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.FromEventPattern(default(IQbservableProvider), default(Type), default(string), default(IScheduler))),
-#else
- (MethodInfo)MethodInfo.GetCurrentMethod(),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- Expression.Constant(type, typeof(Type)),
- Expression.Constant(eventName, typeof(string)),
- Expression.Constant(scheduler, typeof(IScheduler))
- )
- );
- }
-#endif
-
- /// <summary>
- /// Converts a .NET event, conforming to the standard .NET event pattern based on a supplied event delegate type, to an observable sequence.
- /// Each event invocation is surfaced through an OnNext message in the resulting sequence.
- /// For conversion of events that don't conform to the standard .NET event pattern, use any of the FromEvent overloads instead.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TDelegate">The delegate type of the event to be converted.</typeparam>
- /// <typeparam name="TEventArgs">The type of the event data generated by the event.</typeparam>
- /// <param name="addHandler">Action that attaches the given event handler to the underlying .NET event.</param>
- /// <param name="removeHandler">Action that detaches the given event handler from the underlying .NET event.</param>
- /// <returns>The observable sequence that contains data representations of invocations of the underlying .NET event.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="addHandler" /> or <paramref name="removeHandler" /> is null.</exception>
- /// <remarks>
- /// <para>
- /// Add and remove handler invocations are made whenever the number of observers grows beyond zero.
- /// As such, an event handler may be shared by multiple simultaneously active observers, using a subject for multicasting.
- /// </para>
- /// <para>
- /// The current <see cref="T:System.Threading.SynchronizationContext" /> is captured during the call to FromEventPattern, and is used to post add and remove handler invocations.
- /// This behavior ensures add and remove handler operations for thread-affine events are accessed from the same context, as required by some UI frameworks.
- /// </para>
- /// <para>
- /// If no SynchronizationContext is present at the point of calling FromEventPattern, add and remove handler invocations are made synchronously on the thread
- /// making the Subscribe or Dispose call, respectively.
- /// </para>
- /// <para>
- /// It's recommended to lift FromEventPattern calls outside event stream query expressions due to the free-threaded nature of Reactive Extensions. Doing so
- /// makes the captured SynchronizationContext predictable. This best practice also reduces clutter of bridging code inside queries, making the query expressions
- /// more concise and easier to understand.
- /// </para>
- /// </remarks>
- /// <seealso cref="M:System.Reactive.Linq.Observable.ToEventPattern``1(System.IObservable{System.Reactive.EventPattern{``0}})" />
- public static IQbservable<EventPattern<TEventArgs>> FromEventPattern<TDelegate, TEventArgs>(this IQbservableProvider provider, Expression<Action<TDelegate>> addHandler, Expression<Action<TDelegate>> removeHandler)
-#if !NO_EVENTARGS_CONSTRAINT
- where TEventArgs : EventArgs
-#endif
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (addHandler == null)
- throw new ArgumentNullException("addHandler");
- if (removeHandler == null)
- throw new ArgumentNullException("removeHandler");
-
- return provider.CreateQuery<EventPattern<TEventArgs>>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.FromEventPattern<TDelegate, TEventArgs>(default(IQbservableProvider), default(Expression<Action<TDelegate>>), default(Expression<Action<TDelegate>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TDelegate), typeof(TEventArgs)),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- addHandler,
- removeHandler
- )
- );
- }
-
- /// <summary>
- /// Converts a .NET event, conforming to the standard .NET event pattern based on a supplied event delegate type, to an observable sequence.
- /// Each event invocation is surfaced through an OnNext message in the resulting sequence.
- /// For conversion of events that don't conform to the standard .NET event pattern, use any of the FromEvent overloads instead.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TDelegate">The delegate type of the event to be converted.</typeparam>
- /// <typeparam name="TEventArgs">The type of the event data generated by the event.</typeparam>
- /// <param name="addHandler">Action that attaches the given event handler to the underlying .NET event.</param>
- /// <param name="removeHandler">Action that detaches the given event handler from the underlying .NET event.</param>
- /// <param name="scheduler">The scheduler to run the add and remove event handler logic on.</param>
- /// <returns>The observable sequence that contains data representations of invocations of the underlying .NET event.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="addHandler" /> or <paramref name="removeHandler" /> or <paramref name="scheduler" /> is null.</exception>
- /// <remarks>
- /// <para>
- /// Add and remove handler invocations are made whenever the number of observers grows beyond zero.
- /// As such, an event handler may be shared by multiple simultaneously active observers, using a subject for multicasting.
- /// </para>
- /// <para>
- /// Add and remove handler invocations are run on the specified scheduler. This behavior allows add and remove handler operations for thread-affine events to be
- /// accessed from the same context, as required by some UI frameworks.
- /// </para>
- /// <para>
- /// It's recommended to lift FromEventPattern calls outside event stream query expressions. This best practice reduces clutter of bridging code inside queries,
- /// making the query expressions more concise and easier to understand. This has additional benefits for overloads of FromEventPattern that omit the IScheduler
- /// parameter. For more information, see the remarks section on those overloads.
- /// </para>
- /// </remarks>
- /// <seealso cref="M:System.Reactive.Linq.Observable.ToEventPattern``1(System.IObservable{System.Reactive.EventPattern{``0}})" />
- public static IQbservable<EventPattern<TEventArgs>> FromEventPattern<TDelegate, TEventArgs>(this IQbservableProvider provider, Expression<Action<TDelegate>> addHandler, Expression<Action<TDelegate>> removeHandler, IScheduler scheduler)
-#if !NO_EVENTARGS_CONSTRAINT
- where TEventArgs : EventArgs
-#endif
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (addHandler == null)
- throw new ArgumentNullException("addHandler");
- if (removeHandler == null)
- throw new ArgumentNullException("removeHandler");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return provider.CreateQuery<EventPattern<TEventArgs>>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.FromEventPattern<TDelegate, TEventArgs>(default(IQbservableProvider), default(Expression<Action<TDelegate>>), default(Expression<Action<TDelegate>>), default(IScheduler))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TDelegate), typeof(TEventArgs)),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- addHandler,
- removeHandler,
- Expression.Constant(scheduler, typeof(IScheduler))
- )
- );
- }
-
- /// <summary>
- /// Converts a .NET event, conforming to the standard .NET event pattern based on <see cref="T:System.EventHandler`1" />, to an observable sequence.
- /// Each event invocation is surfaced through an OnNext message in the resulting sequence.
- /// For conversion of events that don't conform to the standard .NET event pattern, use any of the FromEvent overloads instead.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TDelegate">The delegate type of the event to be converted.</typeparam>
- /// <typeparam name="TEventArgs">The type of the event data generated by the event.</typeparam>
- /// <param name="conversion">A function used to convert the given event handler to a delegate compatible with the underlying .NET event. The resulting delegate is used in calls to the addHandler and removeHandler action parameters.</param>
- /// <param name="addHandler">Action that attaches the given event handler to the underlying .NET event.</param>
- /// <param name="removeHandler">Action that detaches the given event handler from the underlying .NET event.</param>
- /// <returns>The observable sequence that contains data representations of invocations of the underlying .NET event.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="conversion" /> or <paramref name="addHandler" /> or <paramref name="removeHandler" /> is null.</exception>
- /// <remarks>
- /// <para>
- /// Add and remove handler invocations are made whenever the number of observers grows beyond zero.
- /// As such, an event handler may be shared by multiple simultaneously active observers, using a subject for multicasting.
- /// </para>
- /// <para>
- /// The current <see cref="T:System.Threading.SynchronizationContext" /> is captured during the call to FromEventPattern, and is used to post add and remove handler invocations.
- /// This behavior ensures add and remove handler operations for thread-affine events are accessed from the same context, as required by some UI frameworks.
- /// </para>
- /// <para>
- /// If no SynchronizationContext is present at the point of calling FromEventPattern, add and remove handler invocations are made synchronously on the thread
- /// making the Subscribe or Dispose call, respectively.
- /// </para>
- /// <para>
- /// It's recommended to lift FromEventPattern calls outside event stream query expressions due to the free-threaded nature of Reactive Extensions. Doing so
- /// makes the captured SynchronizationContext predictable. This best practice also reduces clutter of bridging code inside queries, making the query expressions
- /// more concise and easier to understand.
- /// </para>
- /// </remarks>
- /// <seealso cref="M:System.Reactive.Linq.Observable.ToEventPattern``1(System.IObservable{System.Reactive.EventPattern{``0}})" />
- public static IQbservable<EventPattern<TEventArgs>> FromEventPattern<TDelegate, TEventArgs>(this IQbservableProvider provider, Expression<Func<EventHandler<TEventArgs>, TDelegate>> conversion, Expression<Action<TDelegate>> addHandler, Expression<Action<TDelegate>> removeHandler)
-#if !NO_EVENTARGS_CONSTRAINT
- where TEventArgs : EventArgs
-#endif
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (conversion == null)
- throw new ArgumentNullException("conversion");
- if (addHandler == null)
- throw new ArgumentNullException("addHandler");
- if (removeHandler == null)
- throw new ArgumentNullException("removeHandler");
-
- return provider.CreateQuery<EventPattern<TEventArgs>>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.FromEventPattern<TDelegate, TEventArgs>(default(IQbservableProvider), default(Expression<Func<EventHandler<TEventArgs>, TDelegate>>), default(Expression<Action<TDelegate>>), default(Expression<Action<TDelegate>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TDelegate), typeof(TEventArgs)),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- conversion,
- addHandler,
- removeHandler
- )
- );
- }
-
- /// <summary>
- /// Converts a .NET event, conforming to the standard .NET event pattern based on <see cref="T:System.EventHandler`1" />, to an observable sequence.
- /// Each event invocation is surfaced through an OnNext message in the resulting sequence.
- /// For conversion of events that don't conform to the standard .NET event pattern, use any of the FromEvent overloads instead.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TDelegate">The delegate type of the event to be converted.</typeparam>
- /// <typeparam name="TEventArgs">The type of the event data generated by the event.</typeparam>
- /// <param name="conversion">A function used to convert the given event handler to a delegate compatible with the underlying .NET event. The resulting delegate is used in calls to the addHandler and removeHandler action parameters.</param>
- /// <param name="addHandler">Action that attaches the given event handler to the underlying .NET event.</param>
- /// <param name="removeHandler">Action that detaches the given event handler from the underlying .NET event.</param>
- /// <param name="scheduler">The scheduler to run the add and remove event handler logic on.</param>
- /// <returns>The observable sequence that contains data representations of invocations of the underlying .NET event.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="conversion" /> or <paramref name="addHandler" /> or <paramref name="removeHandler" /> or <paramref name="scheduler" /> is null.</exception>
- /// <remarks>
- /// <para>
- /// Add and remove handler invocations are made whenever the number of observers grows beyond zero.
- /// As such, an event handler may be shared by multiple simultaneously active observers, using a subject for multicasting.
- /// </para>
- /// <para>
- /// Add and remove handler invocations are run on the specified scheduler. This behavior allows add and remove handler operations for thread-affine events to be
- /// accessed from the same context, as required by some UI frameworks.
- /// </para>
- /// <para>
- /// It's recommended to lift FromEventPattern calls outside event stream query expressions. This best practice reduces clutter of bridging code inside queries,
- /// making the query expressions more concise and easier to understand. This has additional benefits for overloads of FromEventPattern that omit the IScheduler
- /// parameter. For more information, see the remarks section on those overloads.
- /// </para>
- /// </remarks>
- /// <seealso cref="M:System.Reactive.Linq.Observable.ToEventPattern``1(System.IObservable{System.Reactive.EventPattern{``0}})" />
- public static IQbservable<EventPattern<TEventArgs>> FromEventPattern<TDelegate, TEventArgs>(this IQbservableProvider provider, Expression<Func<EventHandler<TEventArgs>, TDelegate>> conversion, Expression<Action<TDelegate>> addHandler, Expression<Action<TDelegate>> removeHandler, IScheduler scheduler)
-#if !NO_EVENTARGS_CONSTRAINT
- where TEventArgs : EventArgs
-#endif
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (conversion == null)
- throw new ArgumentNullException("conversion");
- if (addHandler == null)
- throw new ArgumentNullException("addHandler");
- if (removeHandler == null)
- throw new ArgumentNullException("removeHandler");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return provider.CreateQuery<EventPattern<TEventArgs>>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.FromEventPattern<TDelegate, TEventArgs>(default(IQbservableProvider), default(Expression<Func<EventHandler<TEventArgs>, TDelegate>>), default(Expression<Action<TDelegate>>), default(Expression<Action<TDelegate>>), default(IScheduler))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TDelegate), typeof(TEventArgs)),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- conversion,
- addHandler,
- removeHandler,
- Expression.Constant(scheduler, typeof(IScheduler))
- )
- );
- }
-
- /// <summary>
- /// Converts a .NET event, conforming to the standard .NET event pattern based on a supplied event delegate type with a strongly typed sender parameter, to an observable sequence.
- /// Each event invocation is surfaced through an OnNext message in the resulting sequence.
- /// For conversion of events that don't conform to the standard .NET event pattern, use any of the FromEvent overloads instead.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TDelegate">The delegate type of the event to be converted.</typeparam>
- /// <typeparam name="TSender">The type of the sender that raises the event.</typeparam>
- /// <typeparam name="TEventArgs">The type of the event data generated by the event.</typeparam>
- /// <param name="addHandler">Action that attaches the given event handler to the underlying .NET event.</param>
- /// <param name="removeHandler">Action that detaches the given event handler from the underlying .NET event.</param>
- /// <returns>The observable sequence that contains data representations of invocations of the underlying .NET event.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="addHandler" /> or <paramref name="removeHandler" /> is null.</exception>
- /// <remarks>
- /// <para>
- /// Add and remove handler invocations are made whenever the number of observers grows beyond zero.
- /// As such, an event handler may be shared by multiple simultaneously active observers, using a subject for multicasting.
- /// </para>
- /// <para>
- /// The current <see cref="T:System.Threading.SynchronizationContext" /> is captured during the call to FromEventPattern, and is used to post add and remove handler invocations.
- /// This behavior ensures add and remove handler operations for thread-affine events are accessed from the same context, as required by some UI frameworks.
- /// </para>
- /// <para>
- /// If no SynchronizationContext is present at the point of calling FromEventPattern, add and remove handler invocations are made synchronously on the thread
- /// making the Subscribe or Dispose call, respectively.
- /// </para>
- /// <para>
- /// It's recommended to lift FromEventPattern calls outside event stream query expressions due to the free-threaded nature of Reactive Extensions. Doing so
- /// makes the captured SynchronizationContext predictable. This best practice also reduces clutter of bridging code inside queries, making the query expressions
- /// more concise and easier to understand.
- /// </para>
- /// </remarks>
- /// <seealso cref="M:System.Reactive.Linq.Observable.ToEventPattern``1(System.IObservable{System.Reactive.EventPattern{``0}})" />
- public static IQbservable<EventPattern<TSender, TEventArgs>> FromEventPattern<TDelegate, TSender, TEventArgs>(this IQbservableProvider provider, Expression<Action<TDelegate>> addHandler, Expression<Action<TDelegate>> removeHandler)
-#if !NO_EVENTARGS_CONSTRAINT
- where TEventArgs : EventArgs
-#endif
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (addHandler == null)
- throw new ArgumentNullException("addHandler");
- if (removeHandler == null)
- throw new ArgumentNullException("removeHandler");
-
- return provider.CreateQuery<EventPattern<TSender, TEventArgs>>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.FromEventPattern<TDelegate, TSender, TEventArgs>(default(IQbservableProvider), default(Expression<Action<TDelegate>>), default(Expression<Action<TDelegate>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TDelegate), typeof(TSender), typeof(TEventArgs)),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- addHandler,
- removeHandler
- )
- );
- }
-
- /// <summary>
- /// Converts a .NET event, conforming to the standard .NET event pattern based on a supplied event delegate type with a strongly typed sender parameter, to an observable sequence.
- /// Each event invocation is surfaced through an OnNext message in the resulting sequence.
- /// For conversion of events that don't conform to the standard .NET event pattern, use any of the FromEvent overloads instead.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TDelegate">The delegate type of the event to be converted.</typeparam>
- /// <typeparam name="TSender">The type of the sender that raises the event.</typeparam>
- /// <typeparam name="TEventArgs">The type of the event data generated by the event.</typeparam>
- /// <param name="addHandler">Action that attaches the given event handler to the underlying .NET event.</param>
- /// <param name="removeHandler">Action that detaches the given event handler from the underlying .NET event.</param>
- /// <param name="scheduler">The scheduler to run the add and remove event handler logic on.</param>
- /// <returns>The observable sequence that contains data representations of invocations of the underlying .NET event.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="addHandler" /> or <paramref name="removeHandler" /> or <paramref name="scheduler" /> is null.</exception>
- /// <remarks>
- /// <para>
- /// Add and remove handler invocations are made whenever the number of observers grows beyond zero.
- /// As such, an event handler may be shared by multiple simultaneously active observers, using a subject for multicasting.
- /// </para>
- /// <para>
- /// Add and remove handler invocations are run on the specified scheduler. This behavior allows add and remove handler operations for thread-affine events to be
- /// accessed from the same context, as required by some UI frameworks.
- /// </para>
- /// <para>
- /// It's recommended to lift FromEventPattern calls outside event stream query expressions. This best practice reduces clutter of bridging code inside queries,
- /// making the query expressions more concise and easier to understand. This has additional benefits for overloads of FromEventPattern that omit the IScheduler
- /// parameter. For more information, see the remarks section on those overloads.
- /// </para>
- /// </remarks>
- /// <seealso cref="M:System.Reactive.Linq.Observable.ToEventPattern``1(System.IObservable{System.Reactive.EventPattern{``0}})" />
- public static IQbservable<EventPattern<TSender, TEventArgs>> FromEventPattern<TDelegate, TSender, TEventArgs>(this IQbservableProvider provider, Expression<Action<TDelegate>> addHandler, Expression<Action<TDelegate>> removeHandler, IScheduler scheduler)
-#if !NO_EVENTARGS_CONSTRAINT
- where TEventArgs : EventArgs
-#endif
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (addHandler == null)
- throw new ArgumentNullException("addHandler");
- if (removeHandler == null)
- throw new ArgumentNullException("removeHandler");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return provider.CreateQuery<EventPattern<TSender, TEventArgs>>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.FromEventPattern<TDelegate, TSender, TEventArgs>(default(IQbservableProvider), default(Expression<Action<TDelegate>>), default(Expression<Action<TDelegate>>), default(IScheduler))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TDelegate), typeof(TSender), typeof(TEventArgs)),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- addHandler,
- removeHandler,
- Expression.Constant(scheduler, typeof(IScheduler))
- )
- );
- }
-
- /// <summary>
- /// Converts a .NET event, conforming to the standard .NET event pattern based on <see cref="T:System.EventHandler`1" />, to an observable sequence.
- /// Each event invocation is surfaced through an OnNext message in the resulting sequence.
- /// For conversion of events that don't conform to the standard .NET event pattern, use any of the FromEvent overloads instead.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TEventArgs">The type of the event data generated by the event.</typeparam>
- /// <param name="addHandler">Action that attaches the given event handler to the underlying .NET event.</param>
- /// <param name="removeHandler">Action that detaches the given event handler from the underlying .NET event.</param>
- /// <returns>The observable sequence that contains data representations of invocations of the underlying .NET event.</returns>
- /// <remarks>
- /// <para>
- /// Add and remove handler invocations are made whenever the number of observers grows beyond zero.
- /// As such, an event handler may be shared by multiple simultaneously active observers, using a subject for multicasting.
- /// </para>
- /// <para>
- /// The current <see cref="T:System.Threading.SynchronizationContext" /> is captured during the call to FromEventPattern, and is used to post add and remove handler invocations.
- /// This behavior ensures add and remove handler operations for thread-affine events are accessed from the same context, as required by some UI frameworks.
- /// </para>
- /// <para>
- /// If no SynchronizationContext is present at the point of calling FromEventPattern, add and remove handler invocations are made synchronously on the thread
- /// making the Subscribe or Dispose call, respectively.
- /// </para>
- /// <para>
- /// It's recommended to lift FromEventPattern calls outside event stream query expressions due to the free-threaded nature of Reactive Extensions. Doing so
- /// makes the captured SynchronizationContext predictable. This best practice also reduces clutter of bridging code inside queries, making the query expressions
- /// more concise and easier to understand.
- /// </para>
- /// </remarks>
- /// <seealso cref="M:System.Reactive.Linq.Observable.ToEventPattern``1(System.IObservable{System.Reactive.EventPattern{``0}})" />
- public static IQbservable<EventPattern<TEventArgs>> FromEventPattern<TEventArgs>(this IQbservableProvider provider, Expression<Action<EventHandler<TEventArgs>>> addHandler, Expression<Action<EventHandler<TEventArgs>>> removeHandler)
-#if !NO_EVENTARGS_CONSTRAINT
- where TEventArgs : EventArgs
-#endif
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (addHandler == null)
- throw new ArgumentNullException("addHandler");
- if (removeHandler == null)
- throw new ArgumentNullException("removeHandler");
-
- return provider.CreateQuery<EventPattern<TEventArgs>>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.FromEventPattern<TEventArgs>(default(IQbservableProvider), default(Expression<Action<EventHandler<TEventArgs>>>), default(Expression<Action<EventHandler<TEventArgs>>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TEventArgs)),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- addHandler,
- removeHandler
- )
- );
- }
-
- /// <summary>
- /// Converts a .NET event, conforming to the standard .NET event pattern based on <see cref="T:System.EventHandler`1" />, to an observable sequence.
- /// Each event invocation is surfaced through an OnNext message in the resulting sequence.
- /// For conversion of events that don't conform to the standard .NET event pattern, use any of the FromEvent overloads instead.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TEventArgs">The type of the event data generated by the event.</typeparam>
- /// <param name="addHandler">Action that attaches the given event handler to the underlying .NET event.</param>
- /// <param name="removeHandler">Action that detaches the given event handler from the underlying .NET event.</param>
- /// <param name="scheduler">The scheduler to run the add and remove event handler logic on.</param>
- /// <returns>The observable sequence that contains data representations of invocations of the underlying .NET event.</returns>
- /// <remarks>
- /// <para>
- /// Add and remove handler invocations are made whenever the number of observers grows beyond zero.
- /// As such, an event handler may be shared by multiple simultaneously active observers, using a subject for multicasting.
- /// </para>
- /// <para>
- /// Add and remove handler invocations are run on the specified scheduler. This behavior allows add and remove handler operations for thread-affine events to be
- /// accessed from the same context, as required by some UI frameworks.
- /// </para>
- /// <para>
- /// It's recommended to lift FromEventPattern calls outside event stream query expressions. This best practice reduces clutter of bridging code inside queries,
- /// making the query expressions more concise and easier to understand. This has additional benefits for overloads of FromEventPattern that omit the IScheduler
- /// parameter. For more information, see the remarks section on those overloads.
- /// </para>
- /// </remarks>
- /// <seealso cref="M:System.Reactive.Linq.Observable.ToEventPattern``1(System.IObservable{System.Reactive.EventPattern{``0}})" />
- public static IQbservable<EventPattern<TEventArgs>> FromEventPattern<TEventArgs>(this IQbservableProvider provider, Expression<Action<EventHandler<TEventArgs>>> addHandler, Expression<Action<EventHandler<TEventArgs>>> removeHandler, IScheduler scheduler)
-#if !NO_EVENTARGS_CONSTRAINT
- where TEventArgs : EventArgs
-#endif
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (addHandler == null)
- throw new ArgumentNullException("addHandler");
- if (removeHandler == null)
- throw new ArgumentNullException("removeHandler");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return provider.CreateQuery<EventPattern<TEventArgs>>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.FromEventPattern<TEventArgs>(default(IQbservableProvider), default(Expression<Action<EventHandler<TEventArgs>>>), default(Expression<Action<EventHandler<TEventArgs>>>), default(IScheduler))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TEventArgs)),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- addHandler,
- removeHandler,
- Expression.Constant(scheduler, typeof(IScheduler))
- )
- );
- }
-
- /// <summary>
- /// Converts an instance .NET event, conforming to the standard .NET event pattern with strongly typed event arguments, to an observable sequence.
- /// Each event invocation is surfaced through an OnNext message in the resulting sequence.
- /// Reflection is used to discover the event based on the target object type and the specified event name.
- /// For conversion of events that don't conform to the standard .NET event pattern, use any of the FromEvent overloads instead.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TEventArgs">The type of the event data generated by the event.</typeparam>
- /// <param name="target">Object instance that exposes the event to convert.</param>
- /// <param name="eventName">Name of the event to convert.</param>
- /// <returns>The observable sequence that contains data representations of invocations of the underlying .NET event.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="target" /> or <paramref name="eventName" /> is null.</exception>
- /// <exception cref="T:System.InvalidOperationException">The event could not be found. -or- The event does not conform to the standard .NET event pattern. -or- The event's second argument type is not assignable to TEventArgs.</exception>
- /// <remarks>
- /// <para>
- /// Add and remove handler invocations are made whenever the number of observers grows beyond zero.
- /// As such, an event handler may be shared by multiple simultaneously active observers, using a subject for multicasting.
- /// </para>
- /// <para>
- /// The current <see cref="T:System.Threading.SynchronizationContext" /> is captured during the call to FromEventPattern, and is used to post add and remove handler invocations.
- /// This behavior ensures add and remove handler operations for thread-affine events are accessed from the same context, as required by some UI frameworks.
- /// </para>
- /// <para>
- /// If no SynchronizationContext is present at the point of calling FromEventPattern, add and remove handler invocations are made synchronously on the thread
- /// making the Subscribe or Dispose call, respectively.
- /// </para>
- /// <para>
- /// It's recommended to lift FromEventPattern calls outside event stream query expressions due to the free-threaded nature of Reactive Extensions. Doing so
- /// makes the captured SynchronizationContext predictable. This best practice also reduces clutter of bridging code inside queries, making the query expressions
- /// more concise and easier to understand.
- /// </para>
- /// </remarks>
- /// <seealso cref="M:System.Reactive.Linq.Observable.ToEventPattern``1(System.IObservable{System.Reactive.EventPattern{``0}})" />
- public static IQbservable<EventPattern<TEventArgs>> FromEventPattern<TEventArgs>(this IQbservableProvider provider, object target, string eventName)
-#if !NO_EVENTARGS_CONSTRAINT
- where TEventArgs : EventArgs
-#endif
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (target == null)
- throw new ArgumentNullException("target");
- if (eventName == null)
- throw new ArgumentNullException("eventName");
-
- return provider.CreateQuery<EventPattern<TEventArgs>>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.FromEventPattern<TEventArgs>(default(IQbservableProvider), default(object), default(string))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TEventArgs)),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- Expression.Constant(target, typeof(object)),
- Expression.Constant(eventName, typeof(string))
- )
- );
- }
-
- /// <summary>
- /// Converts an instance .NET event, conforming to the standard .NET event pattern with strongly typed event arguments, to an observable sequence.
- /// Each event invocation is surfaced through an OnNext message in the resulting sequence.
- /// Reflection is used to discover the event based on the target object type and the specified event name.
- /// For conversion of events that don't conform to the standard .NET event pattern, use any of the FromEvent overloads instead.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TEventArgs">The type of the event data generated by the event.</typeparam>
- /// <param name="target">Object instance that exposes the event to convert.</param>
- /// <param name="eventName">Name of the event to convert.</param>
- /// <param name="scheduler">The scheduler to run the add and remove event handler logic on.</param>
- /// <returns>The observable sequence that contains data representations of invocations of the underlying .NET event.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="target" /> or <paramref name="eventName" /> or <paramref name="scheduler" /> is null.</exception>
- /// <exception cref="T:System.InvalidOperationException">The event could not be found. -or- The event does not conform to the standard .NET event pattern. -or- The event's second argument type is not assignable to TEventArgs.</exception>
- /// <remarks>
- /// <para>
- /// Add and remove handler invocations are made whenever the number of observers grows beyond zero.
- /// As such, an event handler may be shared by multiple simultaneously active observers, using a subject for multicasting.
- /// </para>
- /// <para>
- /// Add and remove handler invocations are run on the specified scheduler. This behavior allows add and remove handler operations for thread-affine events to be
- /// accessed from the same context, as required by some UI frameworks.
- /// </para>
- /// <para>
- /// It's recommended to lift FromEventPattern calls outside event stream query expressions. This best practice reduces clutter of bridging code inside queries,
- /// making the query expressions more concise and easier to understand. This has additional benefits for overloads of FromEventPattern that omit the IScheduler
- /// parameter. For more information, see the remarks section on those overloads.
- /// </para>
- /// </remarks>
- /// <seealso cref="M:System.Reactive.Linq.Observable.ToEventPattern``1(System.IObservable{System.Reactive.EventPattern{``0}})" />
- public static IQbservable<EventPattern<TEventArgs>> FromEventPattern<TEventArgs>(this IQbservableProvider provider, object target, string eventName, IScheduler scheduler)
-#if !NO_EVENTARGS_CONSTRAINT
- where TEventArgs : EventArgs
-#endif
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (target == null)
- throw new ArgumentNullException("target");
- if (eventName == null)
- throw new ArgumentNullException("eventName");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return provider.CreateQuery<EventPattern<TEventArgs>>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.FromEventPattern<TEventArgs>(default(IQbservableProvider), default(object), default(string), default(IScheduler))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TEventArgs)),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- Expression.Constant(target, typeof(object)),
- Expression.Constant(eventName, typeof(string)),
- Expression.Constant(scheduler, typeof(IScheduler))
- )
- );
- }
-
- /// <summary>
- /// Converts a static .NET event, conforming to the standard .NET event pattern with strongly typed event arguments, to an observable sequence.
- /// Each event invocation is surfaced through an OnNext message in the resulting sequence.
- /// Reflection is used to discover the event based on the specified type and the specified event name.
- /// For conversion of events that don't conform to the standard .NET event pattern, use any of the FromEvent overloads instead.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TEventArgs">The type of the event data generated by the event.</typeparam>
- /// <param name="type">Type that exposes the static event to convert.</param>
- /// <param name="eventName">Name of the event to convert.</param>
- /// <returns>The observable sequence that contains data representations of invocations of the underlying .NET event.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="type" /> or <paramref name="eventName" /> is null.</exception>
- /// <exception cref="T:System.InvalidOperationException">The event could not be found. -or- The event does not conform to the standard .NET event pattern. -or- The event's second argument type is not assignable to TEventArgs.</exception>
- /// <remarks>
- /// <para>
- /// Add and remove handler invocations are made whenever the number of observers grows beyond zero.
- /// As such, an event handler may be shared by multiple simultaneously active observers, using a subject for multicasting.
- /// </para>
- /// <para>
- /// The current <see cref="T:System.Threading.SynchronizationContext" /> is captured during the call to FromEventPattern, and is used to post add and remove handler invocations.
- /// This behavior ensures add and remove handler operations for thread-affine events are accessed from the same context, as required by some UI frameworks.
- /// </para>
- /// <para>
- /// If no SynchronizationContext is present at the point of calling FromEventPattern, add and remove handler invocations are made synchronously on the thread
- /// making the Subscribe or Dispose call, respectively.
- /// </para>
- /// <para>
- /// It's recommended to lift FromEventPattern calls outside event stream query expressions due to the free-threaded nature of Reactive Extensions. Doing so
- /// makes the captured SynchronizationContext predictable. This best practice also reduces clutter of bridging code inside queries, making the query expressions
- /// more concise and easier to understand.
- /// </para>
- /// </remarks>
- /// <seealso cref="M:System.Reactive.Linq.Observable.ToEventPattern``1(System.IObservable{System.Reactive.EventPattern{``0}})" />
- public static IQbservable<EventPattern<TEventArgs>> FromEventPattern<TEventArgs>(this IQbservableProvider provider, Type type, string eventName)
-#if !NO_EVENTARGS_CONSTRAINT
- where TEventArgs : EventArgs
-#endif
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (type == null)
- throw new ArgumentNullException("type");
- if (eventName == null)
- throw new ArgumentNullException("eventName");
-
- return provider.CreateQuery<EventPattern<TEventArgs>>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.FromEventPattern<TEventArgs>(default(IQbservableProvider), default(Type), default(string))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TEventArgs)),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- Expression.Constant(type, typeof(Type)),
- Expression.Constant(eventName, typeof(string))
- )
- );
- }
-
- /// <summary>
- /// Converts a static .NET event, conforming to the standard .NET event pattern with strongly typed event arguments, to an observable sequence.
- /// Each event invocation is surfaced through an OnNext message in the resulting sequence.
- /// Reflection is used to discover the event based on the specified type and the specified event name.
- /// For conversion of events that don't conform to the standard .NET event pattern, use any of the FromEvent overloads instead.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TEventArgs">The type of the event data generated by the event.</typeparam>
- /// <param name="type">Type that exposes the static event to convert.</param>
- /// <param name="eventName">Name of the event to convert.</param>
- /// <param name="scheduler">The scheduler to run the add and remove event handler logic on.</param>
- /// <returns>The observable sequence that contains data representations of invocations of the underlying .NET event.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="type" /> or <paramref name="eventName" /> or <paramref name="scheduler" /> is null.</exception>
- /// <exception cref="T:System.InvalidOperationException">The event could not be found. -or- The event does not conform to the standard .NET event pattern. -or- The event's second argument type is not assignable to TEventArgs.</exception>
- /// <remarks>
- /// <para>
- /// Add and remove handler invocations are made whenever the number of observers grows beyond zero.
- /// As such, an event handler may be shared by multiple simultaneously active observers, using a subject for multicasting.
- /// </para>
- /// <para>
- /// Add and remove handler invocations are run on the specified scheduler. This behavior allows add and remove handler operations for thread-affine events to be
- /// accessed from the same context, as required by some UI frameworks.
- /// </para>
- /// <para>
- /// It's recommended to lift FromEventPattern calls outside event stream query expressions. This best practice reduces clutter of bridging code inside queries,
- /// making the query expressions more concise and easier to understand. This has additional benefits for overloads of FromEventPattern that omit the IScheduler
- /// parameter. For more information, see the remarks section on those overloads.
- /// </para>
- /// </remarks>
- /// <seealso cref="M:System.Reactive.Linq.Observable.ToEventPattern``1(System.IObservable{System.Reactive.EventPattern{``0}})" />
- public static IQbservable<EventPattern<TEventArgs>> FromEventPattern<TEventArgs>(this IQbservableProvider provider, Type type, string eventName, IScheduler scheduler)
-#if !NO_EVENTARGS_CONSTRAINT
- where TEventArgs : EventArgs
-#endif
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (type == null)
- throw new ArgumentNullException("type");
- if (eventName == null)
- throw new ArgumentNullException("eventName");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return provider.CreateQuery<EventPattern<TEventArgs>>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.FromEventPattern<TEventArgs>(default(IQbservableProvider), default(Type), default(string), default(IScheduler))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TEventArgs)),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- Expression.Constant(type, typeof(Type)),
- Expression.Constant(eventName, typeof(string)),
- Expression.Constant(scheduler, typeof(IScheduler))
- )
- );
- }
-
- /// <summary>
- /// Converts an instance .NET event, conforming to the standard .NET event pattern with a strongly typed sender and strongly typed event arguments, to an observable sequence.
- /// Each event invocation is surfaced through an OnNext message in the resulting sequence.
- /// Reflection is used to discover the event based on the target object type and the specified event name.
- /// For conversion of events that don't conform to the standard .NET event pattern, use any of the FromEvent overloads instead.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TSender">The type of the sender that raises the event.</typeparam>
- /// <typeparam name="TEventArgs">The type of the event data generated by the event.</typeparam>
- /// <param name="target">Object instance that exposes the event to convert.</param>
- /// <param name="eventName">Name of the event to convert.</param>
- /// <returns>The observable sequence that contains data representations of invocations of the underlying .NET event.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="target" /> or <paramref name="eventName" /> is null.</exception>
- /// <exception cref="T:System.InvalidOperationException">The event could not be found. -or- The event does not conform to the standard .NET event pattern. -or- The event's first argument type is not assignable to TSender. -or- The event's second argument type is not assignable to TEventArgs.</exception>
- /// <remarks>
- /// <para>
- /// Add and remove handler invocations are made whenever the number of observers grows beyond zero.
- /// As such, an event handler may be shared by multiple simultaneously active observers, using a subject for multicasting.
- /// </para>
- /// <para>
- /// The current <see cref="T:System.Threading.SynchronizationContext" /> is captured during the call to FromEventPattern, and is used to post add and remove handler invocations.
- /// This behavior ensures add and remove handler operations for thread-affine events are accessed from the same context, as required by some UI frameworks.
- /// </para>
- /// <para>
- /// If no SynchronizationContext is present at the point of calling FromEventPattern, add and remove handler invocations are made synchronously on the thread
- /// making the Subscribe or Dispose call, respectively.
- /// </para>
- /// <para>
- /// It's recommended to lift FromEventPattern calls outside event stream query expressions due to the free-threaded nature of Reactive Extensions. Doing so
- /// makes the captured SynchronizationContext predictable. This best practice also reduces clutter of bridging code inside queries, making the query expressions
- /// more concise and easier to understand.
- /// </para>
- /// </remarks>
- /// <seealso cref="M:System.Reactive.Linq.Observable.ToEventPattern``1(System.IObservable{System.Reactive.EventPattern{``0}})" />
- public static IQbservable<EventPattern<TSender, TEventArgs>> FromEventPattern<TSender, TEventArgs>(this IQbservableProvider provider, object target, string eventName)
-#if !NO_EVENTARGS_CONSTRAINT
- where TEventArgs : EventArgs
-#endif
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (target == null)
- throw new ArgumentNullException("target");
- if (eventName == null)
- throw new ArgumentNullException("eventName");
-
- return provider.CreateQuery<EventPattern<TSender, TEventArgs>>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.FromEventPattern<TSender, TEventArgs>(default(IQbservableProvider), default(object), default(string))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSender), typeof(TEventArgs)),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- Expression.Constant(target, typeof(object)),
- Expression.Constant(eventName, typeof(string))
- )
- );
- }
-
- /// <summary>
- /// Converts an instance .NET event, conforming to the standard .NET event pattern with a strongly typed sender and strongly typed event arguments, to an observable sequence.
- /// Each event invocation is surfaced through an OnNext message in the resulting sequence.
- /// Reflection is used to discover the event based on the target object type and the specified event name.
- /// For conversion of events that don't conform to the standard .NET event pattern, use any of the FromEvent overloads instead.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TSender">The type of the sender that raises the event.</typeparam>
- /// <typeparam name="TEventArgs">The type of the event data generated by the event.</typeparam>
- /// <param name="target">Object instance that exposes the event to convert.</param>
- /// <param name="eventName">Name of the event to convert.</param>
- /// <param name="scheduler">The scheduler to run the add and remove event handler logic on.</param>
- /// <returns>The observable sequence that contains data representations of invocations of the underlying .NET event.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="target" /> or <paramref name="eventName" /> or <paramref name="scheduler" /> is null.</exception>
- /// <exception cref="T:System.InvalidOperationException">The event could not be found. -or- The event does not conform to the standard .NET event pattern. -or- The event's first argument type is not assignable to TSender. -or- The event's second argument type is not assignable to TEventArgs.</exception>
- /// <remarks>
- /// <para>
- /// Add and remove handler invocations are made whenever the number of observers grows beyond zero.
- /// As such, an event handler may be shared by multiple simultaneously active observers, using a subject for multicasting.
- /// </para>
- /// <para>
- /// Add and remove handler invocations are run on the specified scheduler. This behavior allows add and remove handler operations for thread-affine events to be
- /// accessed from the same context, as required by some UI frameworks.
- /// </para>
- /// <para>
- /// It's recommended to lift FromEventPattern calls outside event stream query expressions. This best practice reduces clutter of bridging code inside queries,
- /// making the query expressions more concise and easier to understand. This has additional benefits for overloads of FromEventPattern that omit the IScheduler
- /// parameter. For more information, see the remarks section on those overloads.
- /// </para>
- /// </remarks>
- /// <seealso cref="M:System.Reactive.Linq.Observable.ToEventPattern``1(System.IObservable{System.Reactive.EventPattern{``0}})" />
- public static IQbservable<EventPattern<TSender, TEventArgs>> FromEventPattern<TSender, TEventArgs>(this IQbservableProvider provider, object target, string eventName, IScheduler scheduler)
-#if !NO_EVENTARGS_CONSTRAINT
- where TEventArgs : EventArgs
-#endif
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (target == null)
- throw new ArgumentNullException("target");
- if (eventName == null)
- throw new ArgumentNullException("eventName");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return provider.CreateQuery<EventPattern<TSender, TEventArgs>>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.FromEventPattern<TSender, TEventArgs>(default(IQbservableProvider), default(object), default(string), default(IScheduler))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSender), typeof(TEventArgs)),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- Expression.Constant(target, typeof(object)),
- Expression.Constant(eventName, typeof(string)),
- Expression.Constant(scheduler, typeof(IScheduler))
- )
- );
- }
-
- /// <summary>
- /// Converts a static .NET event, conforming to the standard .NET event pattern with a strongly typed sender and strongly typed event arguments, to an observable sequence.
- /// Each event invocation is surfaced through an OnNext message in the resulting sequence.
- /// Reflection is used to discover the event based on the specified type and the specified event name.
- /// For conversion of events that don't conform to the standard .NET event pattern, use any of the FromEvent overloads instead.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TSender">The type of the sender that raises the event.</typeparam>
- /// <typeparam name="TEventArgs">The type of the event data generated by the event.</typeparam>
- /// <param name="type">Type that exposes the static event to convert.</param>
- /// <param name="eventName">Name of the event to convert.</param>
- /// <returns>The observable sequence that contains data representations of invocations of the underlying .NET event.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="type" /> or <paramref name="eventName" /> is null.</exception>
- /// <exception cref="T:System.InvalidOperationException">The event could not be found. -or- The event does not conform to the standard .NET event pattern. -or- The event's first argument type is not assignable to TSender. -or- The event's second argument type is not assignable to TEventArgs.</exception>
- /// <remarks>
- /// <para>
- /// Add and remove handler invocations are made whenever the number of observers grows beyond zero.
- /// As such, an event handler may be shared by multiple simultaneously active observers, using a subject for multicasting.
- /// </para>
- /// <para>
- /// The current <see cref="T:System.Threading.SynchronizationContext" /> is captured during the call to FromEventPattern, and is used to post add and remove handler invocations.
- /// This behavior ensures add and remove handler operations for thread-affine events are accessed from the same context, as required by some UI frameworks.
- /// </para>
- /// <para>
- /// If no SynchronizationContext is present at the point of calling FromEventPattern, add and remove handler invocations are made synchronously on the thread
- /// making the Subscribe or Dispose call, respectively.
- /// </para>
- /// <para>
- /// It's recommended to lift FromEventPattern calls outside event stream query expressions due to the free-threaded nature of Reactive Extensions. Doing so
- /// makes the captured SynchronizationContext predictable. This best practice also reduces clutter of bridging code inside queries, making the query expressions
- /// more concise and easier to understand.
- /// </para>
- /// </remarks>
- /// <seealso cref="M:System.Reactive.Linq.Observable.ToEventPattern``1(System.IObservable{System.Reactive.EventPattern{``0}})" />
- public static IQbservable<EventPattern<TSender, TEventArgs>> FromEventPattern<TSender, TEventArgs>(this IQbservableProvider provider, Type type, string eventName)
-#if !NO_EVENTARGS_CONSTRAINT
- where TEventArgs : EventArgs
-#endif
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (type == null)
- throw new ArgumentNullException("type");
- if (eventName == null)
- throw new ArgumentNullException("eventName");
-
- return provider.CreateQuery<EventPattern<TSender, TEventArgs>>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.FromEventPattern<TSender, TEventArgs>(default(IQbservableProvider), default(Type), default(string))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSender), typeof(TEventArgs)),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- Expression.Constant(type, typeof(Type)),
- Expression.Constant(eventName, typeof(string))
- )
- );
- }
-
- /// <summary>
- /// Converts a static .NET event, conforming to the standard .NET event pattern with a strongly typed sender and strongly typed event arguments, to an observable sequence.
- /// Each event invocation is surfaced through an OnNext message in the resulting sequence.
- /// Reflection is used to discover the event based on the specified type and the specified event name.
- /// For conversion of events that don't conform to the standard .NET event pattern, use any of the FromEvent overloads instead.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TSender">The type of the sender that raises the event.</typeparam>
- /// <typeparam name="TEventArgs">The type of the event data generated by the event.</typeparam>
- /// <param name="type">Type that exposes the static event to convert.</param>
- /// <param name="eventName">Name of the event to convert.</param>
- /// <param name="scheduler">The scheduler to run the add and remove event handler logic on.</param>
- /// <returns>The observable sequence that contains data representations of invocations of the underlying .NET event.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="type" /> or <paramref name="eventName" /> or <paramref name="scheduler" /> is null.</exception>
- /// <exception cref="T:System.InvalidOperationException">The event could not be found. -or- The event does not conform to the standard .NET event pattern. -or- The event's first argument type is not assignable to TSender. -or- The event's second argument type is not assignable to TEventArgs.</exception>
- /// <remarks>
- /// <para>
- /// Add and remove handler invocations are made whenever the number of observers grows beyond zero.
- /// As such, an event handler may be shared by multiple simultaneously active observers, using a subject for multicasting.
- /// </para>
- /// <para>
- /// Add and remove handler invocations are run on the specified scheduler. This behavior allows add and remove handler operations for thread-affine events to be
- /// accessed from the same context, as required by some UI frameworks.
- /// </para>
- /// <para>
- /// It's recommended to lift FromEventPattern calls outside event stream query expressions. This best practice reduces clutter of bridging code inside queries,
- /// making the query expressions more concise and easier to understand. This has additional benefits for overloads of FromEventPattern that omit the IScheduler
- /// parameter. For more information, see the remarks section on those overloads.
- /// </para>
- /// </remarks>
- /// <seealso cref="M:System.Reactive.Linq.Observable.ToEventPattern``1(System.IObservable{System.Reactive.EventPattern{``0}})" />
- public static IQbservable<EventPattern<TSender, TEventArgs>> FromEventPattern<TSender, TEventArgs>(this IQbservableProvider provider, Type type, string eventName, IScheduler scheduler)
-#if !NO_EVENTARGS_CONSTRAINT
- where TEventArgs : EventArgs
-#endif
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (type == null)
- throw new ArgumentNullException("type");
- if (eventName == null)
- throw new ArgumentNullException("eventName");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return provider.CreateQuery<EventPattern<TSender, TEventArgs>>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.FromEventPattern<TSender, TEventArgs>(default(IQbservableProvider), default(Type), default(string), default(IScheduler))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSender), typeof(TEventArgs)),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- Expression.Constant(type, typeof(Type)),
- Expression.Constant(eventName, typeof(string)),
- Expression.Constant(scheduler, typeof(IScheduler))
- )
- );
- }
-
- /// <summary>
- /// Generates an observable sequence by running a state-driven loop producing the sequence's elements.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TState">The type of the state used in the generator loop.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the produced sequence.</typeparam>
- /// <param name="initialState">Initial state.</param>
- /// <param name="condition">Condition to terminate generation (upon returning false).</param>
- /// <param name="iterate">Iteration step function.</param>
- /// <param name="resultSelector">Selector function for results produced in the sequence.</param>
- /// <returns>The generated sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="condition" /> or <paramref name="iterate" /> or <paramref name="resultSelector" /> is null.</exception>
- public static IQbservable<TResult> Generate<TState, TResult>(this IQbservableProvider provider, TState initialState, Expression<Func<TState, bool>> condition, Expression<Func<TState, TState>> iterate, Expression<Func<TState, TResult>> resultSelector)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (condition == null)
- throw new ArgumentNullException("condition");
- if (iterate == null)
- throw new ArgumentNullException("iterate");
- if (resultSelector == null)
- throw new ArgumentNullException("resultSelector");
-
- return provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Generate<TState, TResult>(default(IQbservableProvider), default(TState), default(Expression<Func<TState, bool>>), default(Expression<Func<TState, TState>>), default(Expression<Func<TState, TResult>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TState), typeof(TResult)),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- Expression.Constant(initialState, typeof(TState)),
- condition,
- iterate,
- resultSelector
- )
- );
- }
-
- /// <summary>
- /// Generates an observable sequence by running a state-driven loop producing the sequence's elements, using the specified scheduler to send out observer messages.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TState">The type of the state used in the generator loop.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the produced sequence.</typeparam>
- /// <param name="initialState">Initial state.</param>
- /// <param name="condition">Condition to terminate generation (upon returning false).</param>
- /// <param name="iterate">Iteration step function.</param>
- /// <param name="resultSelector">Selector function for results produced in the sequence.</param>
- /// <param name="scheduler">Scheduler on which to run the generator loop.</param>
- /// <returns>The generated sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="condition" /> or <paramref name="iterate" /> or <paramref name="resultSelector" /> or <paramref name="scheduler" /> is null.</exception>
- public static IQbservable<TResult> Generate<TState, TResult>(this IQbservableProvider provider, TState initialState, Expression<Func<TState, bool>> condition, Expression<Func<TState, TState>> iterate, Expression<Func<TState, TResult>> resultSelector, IScheduler scheduler)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (condition == null)
- throw new ArgumentNullException("condition");
- if (iterate == null)
- throw new ArgumentNullException("iterate");
- if (resultSelector == null)
- throw new ArgumentNullException("resultSelector");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Generate<TState, TResult>(default(IQbservableProvider), default(TState), default(Expression<Func<TState, bool>>), default(Expression<Func<TState, TState>>), default(Expression<Func<TState, TResult>>), default(IScheduler))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TState), typeof(TResult)),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- Expression.Constant(initialState, typeof(TState)),
- condition,
- iterate,
- resultSelector,
- Expression.Constant(scheduler, typeof(IScheduler))
- )
- );
- }
-
- /// <summary>
- /// Generates an observable sequence by running a state-driven and temporal loop producing the sequence's elements.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TState">The type of the state used in the generator loop.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the produced sequence.</typeparam>
- /// <param name="initialState">Initial state.</param>
- /// <param name="condition">Condition to terminate generation (upon returning false).</param>
- /// <param name="iterate">Iteration step function.</param>
- /// <param name="resultSelector">Selector function for results produced in the sequence.</param>
- /// <param name="timeSelector">Time selector function to control the speed of values being produced each iteration.</param>
- /// <returns>The generated sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="condition" /> or <paramref name="iterate" /> or <paramref name="resultSelector" /> or <paramref name="timeSelector" /> is null.</exception>
- public static IQbservable<TResult> Generate<TState, TResult>(this IQbservableProvider provider, TState initialState, Expression<Func<TState, bool>> condition, Expression<Func<TState, TState>> iterate, Expression<Func<TState, TResult>> resultSelector, Expression<Func<TState, TimeSpan>> timeSelector)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (condition == null)
- throw new ArgumentNullException("condition");
- if (iterate == null)
- throw new ArgumentNullException("iterate");
- if (resultSelector == null)
- throw new ArgumentNullException("resultSelector");
- if (timeSelector == null)
- throw new ArgumentNullException("timeSelector");
-
- return provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Generate<TState, TResult>(default(IQbservableProvider), default(TState), default(Expression<Func<TState, bool>>), default(Expression<Func<TState, TState>>), default(Expression<Func<TState, TResult>>), default(Expression<Func<TState, TimeSpan>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TState), typeof(TResult)),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- Expression.Constant(initialState, typeof(TState)),
- condition,
- iterate,
- resultSelector,
- timeSelector
- )
- );
- }
-
- /// <summary>
- /// Generates an observable sequence by running a state-driven and temporal loop producing the sequence's elements.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TState">The type of the state used in the generator loop.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the produced sequence.</typeparam>
- /// <param name="initialState">Initial state.</param>
- /// <param name="condition">Condition to terminate generation (upon returning false).</param>
- /// <param name="iterate">Iteration step function.</param>
- /// <param name="resultSelector">Selector function for results produced in the sequence.</param>
- /// <param name="timeSelector">Time selector function to control the speed of values being produced each iteration.</param>
- /// <returns>The generated sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="condition" /> or <paramref name="iterate" /> or <paramref name="resultSelector" /> or <paramref name="timeSelector" /> is null.</exception>
- public static IQbservable<TResult> Generate<TState, TResult>(this IQbservableProvider provider, TState initialState, Expression<Func<TState, bool>> condition, Expression<Func<TState, TState>> iterate, Expression<Func<TState, TResult>> resultSelector, Expression<Func<TState, DateTimeOffset>> timeSelector)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (condition == null)
- throw new ArgumentNullException("condition");
- if (iterate == null)
- throw new ArgumentNullException("iterate");
- if (resultSelector == null)
- throw new ArgumentNullException("resultSelector");
- if (timeSelector == null)
- throw new ArgumentNullException("timeSelector");
-
- return provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Generate<TState, TResult>(default(IQbservableProvider), default(TState), default(Expression<Func<TState, bool>>), default(Expression<Func<TState, TState>>), default(Expression<Func<TState, TResult>>), default(Expression<Func<TState, DateTimeOffset>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TState), typeof(TResult)),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- Expression.Constant(initialState, typeof(TState)),
- condition,
- iterate,
- resultSelector,
- timeSelector
- )
- );
- }
-
- /// <summary>
- /// Generates an observable sequence by running a state-driven and temporal loop producing the sequence's elements, using the specified scheduler to run timers and to send out observer messages.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TState">The type of the state used in the generator loop.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the produced sequence.</typeparam>
- /// <param name="initialState">Initial state.</param>
- /// <param name="condition">Condition to terminate generation (upon returning false).</param>
- /// <param name="iterate">Iteration step function.</param>
- /// <param name="resultSelector">Selector function for results produced in the sequence.</param>
- /// <param name="timeSelector">Time selector function to control the speed of values being produced each iteration.</param>
- /// <param name="scheduler">Scheduler on which to run the generator loop.</param>
- /// <returns>The generated sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="condition" /> or <paramref name="iterate" /> or <paramref name="resultSelector" /> or <paramref name="timeSelector" /> or <paramref name="scheduler" /> is null.</exception>
- public static IQbservable<TResult> Generate<TState, TResult>(this IQbservableProvider provider, TState initialState, Expression<Func<TState, bool>> condition, Expression<Func<TState, TState>> iterate, Expression<Func<TState, TResult>> resultSelector, Expression<Func<TState, TimeSpan>> timeSelector, IScheduler scheduler)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (condition == null)
- throw new ArgumentNullException("condition");
- if (iterate == null)
- throw new ArgumentNullException("iterate");
- if (resultSelector == null)
- throw new ArgumentNullException("resultSelector");
- if (timeSelector == null)
- throw new ArgumentNullException("timeSelector");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Generate<TState, TResult>(default(IQbservableProvider), default(TState), default(Expression<Func<TState, bool>>), default(Expression<Func<TState, TState>>), default(Expression<Func<TState, TResult>>), default(Expression<Func<TState, TimeSpan>>), default(IScheduler))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TState), typeof(TResult)),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- Expression.Constant(initialState, typeof(TState)),
- condition,
- iterate,
- resultSelector,
- timeSelector,
- Expression.Constant(scheduler, typeof(IScheduler))
- )
- );
- }
-
- /// <summary>
- /// Generates an observable sequence by running a state-driven and temporal loop producing the sequence's elements, using the specified scheduler to run timers and to send out observer messages.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TState">The type of the state used in the generator loop.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the produced sequence.</typeparam>
- /// <param name="initialState">Initial state.</param>
- /// <param name="condition">Condition to terminate generation (upon returning false).</param>
- /// <param name="iterate">Iteration step function.</param>
- /// <param name="resultSelector">Selector function for results produced in the sequence.</param>
- /// <param name="timeSelector">Time selector function to control the speed of values being produced each iteration.</param>
- /// <param name="scheduler">Scheduler on which to run the generator loop.</param>
- /// <returns>The generated sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="condition" /> or <paramref name="iterate" /> or <paramref name="resultSelector" /> or <paramref name="timeSelector" /> or <paramref name="scheduler" /> is null.</exception>
- public static IQbservable<TResult> Generate<TState, TResult>(this IQbservableProvider provider, TState initialState, Expression<Func<TState, bool>> condition, Expression<Func<TState, TState>> iterate, Expression<Func<TState, TResult>> resultSelector, Expression<Func<TState, DateTimeOffset>> timeSelector, IScheduler scheduler)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (condition == null)
- throw new ArgumentNullException("condition");
- if (iterate == null)
- throw new ArgumentNullException("iterate");
- if (resultSelector == null)
- throw new ArgumentNullException("resultSelector");
- if (timeSelector == null)
- throw new ArgumentNullException("timeSelector");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Generate<TState, TResult>(default(IQbservableProvider), default(TState), default(Expression<Func<TState, bool>>), default(Expression<Func<TState, TState>>), default(Expression<Func<TState, TResult>>), default(Expression<Func<TState, DateTimeOffset>>), default(IScheduler))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TState), typeof(TResult)),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- Expression.Constant(initialState, typeof(TState)),
- condition,
- iterate,
- resultSelector,
- timeSelector,
- Expression.Constant(scheduler, typeof(IScheduler))
- )
- );
- }
-
- /// <summary>
- /// Groups the elements of an observable sequence according to a specified key selector function.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TKey">The type of the grouping key computed for each element in the source sequence.</typeparam>
- /// <param name="source">An observable sequence whose elements to group.</param>
- /// <param name="keySelector">A function to extract the key for each element.</param>
- /// <returns>A sequence of observable groups, each of which corresponds to a unique key value, containing all elements that share that same key value.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="keySelector" /> is null.</exception>
- public static IQbservable<IGroupedObservable<TKey, TSource>> GroupBy<TSource, TKey>(this IQbservable<TSource> source, Expression<Func<TSource, TKey>> keySelector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (keySelector == null)
- throw new ArgumentNullException("keySelector");
-
- return source.Provider.CreateQuery<IGroupedObservable<TKey, TSource>>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.GroupBy<TSource, TKey>(default(IQbservable<TSource>), default(Expression<Func<TSource, TKey>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)),
-#endif
- source.Expression,
- keySelector
- )
- );
- }
-
- /// <summary>
- /// Groups the elements of an observable sequence according to a specified key selector function and comparer.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TKey">The type of the grouping key computed for each element in the source sequence.</typeparam>
- /// <param name="source">An observable sequence whose elements to group.</param>
- /// <param name="keySelector">A function to extract the key for each element.</param>
- /// <param name="comparer">An equality comparer to compare keys with.</param>
- /// <returns>A sequence of observable groups, each of which corresponds to a unique key value, containing all elements that share that same key value.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="keySelector" /> or <paramref name="comparer" /> is null.</exception>
- public static IQbservable<IGroupedObservable<TKey, TSource>> GroupBy<TSource, TKey>(this IQbservable<TSource> source, Expression<Func<TSource, TKey>> keySelector, IEqualityComparer<TKey> comparer)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (keySelector == null)
- throw new ArgumentNullException("keySelector");
- if (comparer == null)
- throw new ArgumentNullException("comparer");
-
- return source.Provider.CreateQuery<IGroupedObservable<TKey, TSource>>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.GroupBy<TSource, TKey>(default(IQbservable<TSource>), default(Expression<Func<TSource, TKey>>), default(IEqualityComparer<TKey>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)),
-#endif
- source.Expression,
- keySelector,
- Expression.Constant(comparer, typeof(IEqualityComparer<TKey>))
- )
- );
- }
-
- /// <summary>
- /// Groups the elements of an observable sequence and selects the resulting elements by using a specified function.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TKey">The type of the grouping key computed for each element in the source sequence.</typeparam>
- /// <typeparam name="TElement">The type of the elements within the groups computed for each element in the source sequence.</typeparam>
- /// <param name="source">An observable sequence whose elements to group.</param>
- /// <param name="keySelector">A function to extract the key for each element.</param>
- /// <param name="elementSelector">A function to map each source element to an element in an observable group.</param>
- /// <returns>A sequence of observable groups, each of which corresponds to a unique key value, containing all elements that share that same key value.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="keySelector" /> or <paramref name="elementSelector" /> is null.</exception>
- public static IQbservable<IGroupedObservable<TKey, TElement>> GroupBy<TSource, TKey, TElement>(this IQbservable<TSource> source, Expression<Func<TSource, TKey>> keySelector, Expression<Func<TSource, TElement>> elementSelector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (keySelector == null)
- throw new ArgumentNullException("keySelector");
- if (elementSelector == null)
- throw new ArgumentNullException("elementSelector");
-
- return source.Provider.CreateQuery<IGroupedObservable<TKey, TElement>>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.GroupBy<TSource, TKey, TElement>(default(IQbservable<TSource>), default(Expression<Func<TSource, TKey>>), default(Expression<Func<TSource, TElement>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey), typeof(TElement)),
-#endif
- source.Expression,
- keySelector,
- elementSelector
- )
- );
- }
-
- /// <summary>
- /// Groups the elements of an observable sequence according to a specified key selector function and comparer and selects the resulting elements by using a specified function.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TKey">The type of the grouping key computed for each element in the source sequence.</typeparam>
- /// <typeparam name="TElement">The type of the elements within the groups computed for each element in the source sequence.</typeparam>
- /// <param name="source">An observable sequence whose elements to group.</param>
- /// <param name="keySelector">A function to extract the key for each element.</param>
- /// <param name="elementSelector">A function to map each source element to an element in an observable group.</param>
- /// <param name="comparer">An equality comparer to compare keys with.</param>
- /// <returns>A sequence of observable groups, each of which corresponds to a unique key value, containing all elements that share that same key value.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="keySelector" /> or <paramref name="elementSelector" /> or <paramref name="comparer" /> is null.</exception>
- public static IQbservable<IGroupedObservable<TKey, TElement>> GroupBy<TSource, TKey, TElement>(this IQbservable<TSource> source, Expression<Func<TSource, TKey>> keySelector, Expression<Func<TSource, TElement>> elementSelector, IEqualityComparer<TKey> comparer)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (keySelector == null)
- throw new ArgumentNullException("keySelector");
- if (elementSelector == null)
- throw new ArgumentNullException("elementSelector");
- if (comparer == null)
- throw new ArgumentNullException("comparer");
-
- return source.Provider.CreateQuery<IGroupedObservable<TKey, TElement>>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.GroupBy<TSource, TKey, TElement>(default(IQbservable<TSource>), default(Expression<Func<TSource, TKey>>), default(Expression<Func<TSource, TElement>>), default(IEqualityComparer<TKey>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey), typeof(TElement)),
-#endif
- source.Expression,
- keySelector,
- elementSelector,
- Expression.Constant(comparer, typeof(IEqualityComparer<TKey>))
- )
- );
- }
-
- /// <summary>
- /// Groups the elements of an observable sequence according to a specified key selector function.
- /// A duration selector function is used to control the lifetime of groups. When a group expires, it receives an OnCompleted notification. When a new element with the same
- /// key value as a reclaimed group occurs, the group will be reborn with a new lifetime request.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TKey">The type of the grouping key computed for each element in the source sequence.</typeparam>
- /// <typeparam name="TDuration">The type of the elements in the duration sequences obtained for each group to denote its lifetime.</typeparam>
- /// <param name="source">An observable sequence whose elements to group.</param>
- /// <param name="keySelector">A function to extract the key for each element.</param>
- /// <param name="durationSelector">A function to signal the expiration of a group.</param>
- /// <returns>
- /// A sequence of observable groups, each of which corresponds to a unique key value, containing all elements that share that same key value.
- /// If a group's lifetime expires, a new group with the same key value can be created once an element with such a key value is encoutered.
- /// </returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="keySelector" /> or <paramref name="durationSelector" /> is null.</exception>
- public static IQbservable<IGroupedObservable<TKey, TSource>> GroupByUntil<TSource, TKey, TDuration>(this IQbservable<TSource> source, Expression<Func<TSource, TKey>> keySelector, Expression<Func<IGroupedObservable<TKey, TSource>, IObservable<TDuration>>> durationSelector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (keySelector == null)
- throw new ArgumentNullException("keySelector");
- if (durationSelector == null)
- throw new ArgumentNullException("durationSelector");
-
- return source.Provider.CreateQuery<IGroupedObservable<TKey, TSource>>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.GroupByUntil<TSource, TKey, TDuration>(default(IQbservable<TSource>), default(Expression<Func<TSource, TKey>>), default(Expression<Func<IGroupedObservable<TKey, TSource>, IObservable<TDuration>>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey), typeof(TDuration)),
-#endif
- source.Expression,
- keySelector,
- durationSelector
- )
- );
- }
-
- /// <summary>
- /// Groups the elements of an observable sequence according to a specified key selector function and comparer.
- /// A duration selector function is used to control the lifetime of groups. When a group expires, it receives an OnCompleted notification. When a new element with the same
- /// key value as a reclaimed group occurs, the group will be reborn with a new lifetime request.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TKey">The type of the grouping key computed for each element in the source sequence.</typeparam>
- /// <typeparam name="TDuration">The type of the elements in the duration sequences obtained for each group to denote its lifetime.</typeparam>
- /// <param name="source">An observable sequence whose elements to group.</param>
- /// <param name="keySelector">A function to extract the key for each element.</param>
- /// <param name="durationSelector">A function to signal the expiration of a group.</param>
- /// <param name="comparer">An equality comparer to compare keys with.</param>
- /// <returns>
- /// A sequence of observable groups, each of which corresponds to a unique key value, containing all elements that share that same key value.
- /// If a group's lifetime expires, a new group with the same key value can be created once an element with such a key value is encoutered.
- /// </returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="keySelector" /> or <paramref name="durationSelector" /> or <paramref name="comparer" /> is null.</exception>
- public static IQbservable<IGroupedObservable<TKey, TSource>> GroupByUntil<TSource, TKey, TDuration>(this IQbservable<TSource> source, Expression<Func<TSource, TKey>> keySelector, Expression<Func<IGroupedObservable<TKey, TSource>, IObservable<TDuration>>> durationSelector, IEqualityComparer<TKey> comparer)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (keySelector == null)
- throw new ArgumentNullException("keySelector");
- if (durationSelector == null)
- throw new ArgumentNullException("durationSelector");
- if (comparer == null)
- throw new ArgumentNullException("comparer");
-
- return source.Provider.CreateQuery<IGroupedObservable<TKey, TSource>>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.GroupByUntil<TSource, TKey, TDuration>(default(IQbservable<TSource>), default(Expression<Func<TSource, TKey>>), default(Expression<Func<IGroupedObservable<TKey, TSource>, IObservable<TDuration>>>), default(IEqualityComparer<TKey>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey), typeof(TDuration)),
-#endif
- source.Expression,
- keySelector,
- durationSelector,
- Expression.Constant(comparer, typeof(IEqualityComparer<TKey>))
- )
- );
- }
-
- /// <summary>
- /// Groups the elements of an observable sequence according to a specified key selector function and selects the resulting elements by using a specified function.
- /// A duration selector function is used to control the lifetime of groups. When a group expires, it receives an OnCompleted notification. When a new element with the same
- /// key value as a reclaimed group occurs, the group will be reborn with a new lifetime request.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TKey">The type of the grouping key computed for each element in the source sequence.</typeparam>
- /// <typeparam name="TElement">The type of the elements within the groups computed for each element in the source sequence.</typeparam>
- /// <typeparam name="TDuration">The type of the elements in the duration sequences obtained for each group to denote its lifetime.</typeparam>
- /// <param name="source">An observable sequence whose elements to group.</param>
- /// <param name="keySelector">A function to extract the key for each element.</param>
- /// <param name="elementSelector">A function to map each source element to an element in an observable group.</param>
- /// <param name="durationSelector">A function to signal the expiration of a group.</param>
- /// <returns>
- /// A sequence of observable groups, each of which corresponds to a unique key value, containing all elements that share that same key value.
- /// If a group's lifetime expires, a new group with the same key value can be created once an element with such a key value is encoutered.
- /// </returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="keySelector" /> or <paramref name="elementSelector" /> or <paramref name="durationSelector" /> is null.</exception>
- public static IQbservable<IGroupedObservable<TKey, TElement>> GroupByUntil<TSource, TKey, TElement, TDuration>(this IQbservable<TSource> source, Expression<Func<TSource, TKey>> keySelector, Expression<Func<TSource, TElement>> elementSelector, Expression<Func<IGroupedObservable<TKey, TElement>, IObservable<TDuration>>> durationSelector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (keySelector == null)
- throw new ArgumentNullException("keySelector");
- if (elementSelector == null)
- throw new ArgumentNullException("elementSelector");
- if (durationSelector == null)
- throw new ArgumentNullException("durationSelector");
-
- return source.Provider.CreateQuery<IGroupedObservable<TKey, TElement>>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.GroupByUntil<TSource, TKey, TElement, TDuration>(default(IQbservable<TSource>), default(Expression<Func<TSource, TKey>>), default(Expression<Func<TSource, TElement>>), default(Expression<Func<IGroupedObservable<TKey, TElement>, IObservable<TDuration>>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey), typeof(TElement), typeof(TDuration)),
-#endif
- source.Expression,
- keySelector,
- elementSelector,
- durationSelector
- )
- );
- }
-
- /// <summary>
- /// Groups the elements of an observable sequence according to a specified key selector function and comparer and selects the resulting elements by using a specified function.
- /// A duration selector function is used to control the lifetime of groups. When a group expires, it receives an OnCompleted notification. When a new element with the same
- /// key value as a reclaimed group occurs, the group will be reborn with a new lifetime request.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TKey">The type of the grouping key computed for each element in the source sequence.</typeparam>
- /// <typeparam name="TElement">The type of the elements within the groups computed for each element in the source sequence.</typeparam>
- /// <typeparam name="TDuration">The type of the elements in the duration sequences obtained for each group to denote its lifetime.</typeparam>
- /// <param name="source">An observable sequence whose elements to group.</param>
- /// <param name="keySelector">A function to extract the key for each element.</param>
- /// <param name="elementSelector">A function to map each source element to an element in an observable group.</param>
- /// <param name="durationSelector">A function to signal the expiration of a group.</param>
- /// <param name="comparer">An equality comparer to compare keys with.</param>
- /// <returns>
- /// A sequence of observable groups, each of which corresponds to a unique key value, containing all elements that share that same key value.
- /// If a group's lifetime expires, a new group with the same key value can be created once an element with such a key value is encountered.
- /// </returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="keySelector" /> or <paramref name="elementSelector" /> or <paramref name="durationSelector" /> or <paramref name="comparer" /> is null.</exception>
- public static IQbservable<IGroupedObservable<TKey, TElement>> GroupByUntil<TSource, TKey, TElement, TDuration>(this IQbservable<TSource> source, Expression<Func<TSource, TKey>> keySelector, Expression<Func<TSource, TElement>> elementSelector, Expression<Func<IGroupedObservable<TKey, TElement>, IObservable<TDuration>>> durationSelector, IEqualityComparer<TKey> comparer)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (keySelector == null)
- throw new ArgumentNullException("keySelector");
- if (elementSelector == null)
- throw new ArgumentNullException("elementSelector");
- if (durationSelector == null)
- throw new ArgumentNullException("durationSelector");
- if (comparer == null)
- throw new ArgumentNullException("comparer");
-
- return source.Provider.CreateQuery<IGroupedObservable<TKey, TElement>>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.GroupByUntil<TSource, TKey, TElement, TDuration>(default(IQbservable<TSource>), default(Expression<Func<TSource, TKey>>), default(Expression<Func<TSource, TElement>>), default(Expression<Func<IGroupedObservable<TKey, TElement>, IObservable<TDuration>>>), default(IEqualityComparer<TKey>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey), typeof(TElement), typeof(TDuration)),
-#endif
- source.Expression,
- keySelector,
- elementSelector,
- durationSelector,
- Expression.Constant(comparer, typeof(IEqualityComparer<TKey>))
- )
- );
- }
-
- /// <summary>
- /// Correlates the elements of two sequences based on overlapping durations, and groups the results.
- /// </summary>
- /// <typeparam name="TLeft">The type of the elements in the left source sequence.</typeparam>
- /// <typeparam name="TRight">The type of the elements in the right source sequence.</typeparam>
- /// <typeparam name="TLeftDuration">The type of the elements in the duration sequence denoting the computed duration of each element in the left source sequence.</typeparam>
- /// <typeparam name="TRightDuration">The type of the elements in the duration sequence denoting the computed duration of each element in the right source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence, obtained by invoking the result selector function for source elements with overlapping duration.</typeparam>
- /// <param name="left">The left observable sequence to join elements for.</param>
- /// <param name="right">The right observable sequence to join elements for.</param>
- /// <param name="leftDurationSelector">A function to select the duration of each element of the left observable sequence, used to determine overlap.</param>
- /// <param name="rightDurationSelector">A function to select the duration of each element of the right observable sequence, used to determine overlap.</param>
- /// <param name="resultSelector">A function invoked to compute a result element for any element of the left sequence with overlapping elements from the right observable sequence.</param>
- /// <returns>An observable sequence that contains result elements computed from source elements that have an overlapping duration.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="left" /> or <paramref name="right" /> or <paramref name="leftDurationSelector" /> or <paramref name="rightDurationSelector" /> or <paramref name="resultSelector" /> is null.</exception>
- public static IQbservable<TResult> GroupJoin<TLeft, TRight, TLeftDuration, TRightDuration, TResult>(this IQbservable<TLeft> left, IObservable<TRight> right, Expression<Func<TLeft, IObservable<TLeftDuration>>> leftDurationSelector, Expression<Func<TRight, IObservable<TRightDuration>>> rightDurationSelector, Expression<Func<TLeft, IObservable<TRight>, TResult>> resultSelector)
- {
- if (left == null)
- throw new ArgumentNullException("left");
- if (right == null)
- throw new ArgumentNullException("right");
- if (leftDurationSelector == null)
- throw new ArgumentNullException("leftDurationSelector");
- if (rightDurationSelector == null)
- throw new ArgumentNullException("rightDurationSelector");
- if (resultSelector == null)
- throw new ArgumentNullException("resultSelector");
-
- return left.Provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.GroupJoin<TLeft, TRight, TLeftDuration, TRightDuration, TResult>(default(IQbservable<TLeft>), default(IObservable<TRight>), default(Expression<Func<TLeft, IObservable<TLeftDuration>>>), default(Expression<Func<TRight, IObservable<TRightDuration>>>), default(Expression<Func<TLeft, IObservable<TRight>, TResult>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TLeft), typeof(TRight), typeof(TLeftDuration), typeof(TRightDuration), typeof(TResult)),
-#endif
- left.Expression,
- GetSourceExpression(right),
- leftDurationSelector,
- rightDurationSelector,
- resultSelector
- )
- );
- }
-
- /// <summary>
- /// If the specified <paramref name="condition" /> evaluates true, select the <paramref name="thenSource" /> sequence. Otherwise, return an empty sequence.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TResult">The type of the elements in the result sequence.</typeparam>
- /// <param name="condition">Condition evaluated to decide which sequence to return.</param>
- /// <param name="thenSource">Sequence returned in case <paramref name="condition" /> evaluates true.</param>
- /// <returns>
- /// <paramref name="thenSource" /> if <paramref name="condition" /> evaluates true; an empty sequence otherwise.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="condition" /> or <paramref name="thenSource" /> is null.</exception>
- public static IQbservable<TResult> If<TResult>(this IQbservableProvider provider, Expression<Func<bool>> condition, IObservable<TResult> thenSource)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (condition == null)
- throw new ArgumentNullException("condition");
- if (thenSource == null)
- throw new ArgumentNullException("thenSource");
-
- return provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.If<TResult>(default(IQbservableProvider), default(Expression<Func<bool>>), default(IObservable<TResult>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TResult)),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- condition,
- GetSourceExpression(thenSource)
- )
- );
- }
-
- /// <summary>
- /// If the specified <paramref name="condition" /> evaluates true, select the <paramref name="thenSource" /> sequence. Otherwise, select the <paramref name="elseSource" /> sequence.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TResult">The type of the elements in the result sequence.</typeparam>
- /// <param name="condition">Condition evaluated to decide which sequence to return.</param>
- /// <param name="thenSource">Sequence returned in case <paramref name="condition" /> evaluates true.</param>
- /// <param name="elseSource">Sequence returned in case <paramref name="condition" /> evaluates false.</param>
- /// <returns>
- /// <paramref name="thenSource" /> if <paramref name="condition" /> evaluates true; <paramref name="elseSource" /> otherwise.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="condition" /> or <paramref name="thenSource" /> or <paramref name="elseSource" /> is null.</exception>
- public static IQbservable<TResult> If<TResult>(this IQbservableProvider provider, Expression<Func<bool>> condition, IObservable<TResult> thenSource, IObservable<TResult> elseSource)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (condition == null)
- throw new ArgumentNullException("condition");
- if (thenSource == null)
- throw new ArgumentNullException("thenSource");
- if (elseSource == null)
- throw new ArgumentNullException("elseSource");
-
- return provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.If<TResult>(default(IQbservableProvider), default(Expression<Func<bool>>), default(IObservable<TResult>), default(IObservable<TResult>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TResult)),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- condition,
- GetSourceExpression(thenSource),
- GetSourceExpression(elseSource)
- )
- );
- }
-
- /// <summary>
- /// If the specified <paramref name="condition" /> evaluates true, select the <paramref name="thenSource" /> sequence. Otherwise, return an empty sequence generated on the specified scheduler.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TResult">The type of the elements in the result sequence.</typeparam>
- /// <param name="condition">Condition evaluated to decide which sequence to return.</param>
- /// <param name="thenSource">Sequence returned in case <paramref name="condition" /> evaluates true.</param>
- /// <param name="scheduler">Scheduler to generate an empty sequence on in case <paramref name="condition" /> evaluates false.</param>
- /// <returns>
- /// <paramref name="thenSource" /> if <paramref name="condition" /> evaluates true; an empty sequence otherwise.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="condition" /> or <paramref name="thenSource" /> or <paramref name="scheduler" /> is null.</exception>
- public static IQbservable<TResult> If<TResult>(this IQbservableProvider provider, Expression<Func<bool>> condition, IObservable<TResult> thenSource, IScheduler scheduler)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (condition == null)
- throw new ArgumentNullException("condition");
- if (thenSource == null)
- throw new ArgumentNullException("thenSource");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.If<TResult>(default(IQbservableProvider), default(Expression<Func<bool>>), default(IObservable<TResult>), default(IScheduler))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TResult)),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- condition,
- GetSourceExpression(thenSource),
- Expression.Constant(scheduler, typeof(IScheduler))
- )
- );
- }
-
- /// <summary>
- /// Ignores all elements in an observable sequence leaving only the termination messages.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence.</param>
- /// <returns>An empty observable sequence that signals termination, successful or exceptional, of the source sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> is null.</exception>
- public static IQbservable<TSource> IgnoreElements<TSource>(this IQbservable<TSource> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return source.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.IgnoreElements<TSource>(default(IQbservable<TSource>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression
- )
- );
- }
-
- /// <summary>
- /// Returns an observable sequence that produces a value after each period.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <param name="period">Period for producing the values in the resulting sequence. If this value is equal to TimeSpan.Zero, the timer will recur as fast as possible.</param>
- /// <returns>An observable sequence that produces a value after each period.</returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// <paramref name="period" /> is less than TimeSpan.Zero.</exception>
- /// <remarks>
- /// Intervals are measured between the start of subsequent notifications, not between the end of the previous and the start of the next notification.
- /// If the observer takes longer than the interval period to handle the message, the subsequent notification will be delivered immediately after the
- /// current one has been handled. In case you need to control the time between the end and the start of consecutive notifications, consider using the
- /// <see cref="M:System.Reactive.Linq.Observable.Generate``2(``0,System.Func{``0,System.Boolean},System.Func{``0,``0},System.Func{``0,``1},System.Func{``0,System.TimeSpan})" />
- /// operator instead.
- /// </remarks>
- public static IQbservable<long> Interval(this IQbservableProvider provider, TimeSpan period)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
-
- return provider.CreateQuery<long>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Interval(default(IQbservableProvider), default(TimeSpan))),
-#else
- (MethodInfo)MethodInfo.GetCurrentMethod(),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- Expression.Constant(period, typeof(TimeSpan))
- )
- );
- }
-
- /// <summary>
- /// Returns an observable sequence that produces a value after each period, using the specified scheduler to run timers and to send out observer messages.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <param name="period">Period for producing the values in the resulting sequence. If this value is equal to TimeSpan.Zero, the timer will recur as fast as possible.</param>
- /// <param name="scheduler">Scheduler to run the timer on.</param>
- /// <returns>An observable sequence that produces a value after each period.</returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// <paramref name="period" /> is less than TimeSpan.Zero.</exception>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="scheduler" /> is null.</exception>
- /// <remarks>
- /// Intervals are measured between the start of subsequent notifications, not between the end of the previous and the start of the next notification.
- /// If the observer takes longer than the interval period to handle the message, the subsequent notification will be delivered immediately after the
- /// current one has been handled. In case you need to control the time between the end and the start of consecutive notifications, consider using the
- /// <see cref="M:System.Reactive.Linq.Observable.Generate``2(``0,System.Func{``0,System.Boolean},System.Func{``0,``0},System.Func{``0,``1},System.Func{``0,System.TimeSpan},System.Reactive.Concurrency.IScheduler)" />
- /// operator instead.
- /// </remarks>
- public static IQbservable<long> Interval(this IQbservableProvider provider, TimeSpan period, IScheduler scheduler)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return provider.CreateQuery<long>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Interval(default(IQbservableProvider), default(TimeSpan), default(IScheduler))),
-#else
- (MethodInfo)MethodInfo.GetCurrentMethod(),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- Expression.Constant(period, typeof(TimeSpan)),
- Expression.Constant(scheduler, typeof(IScheduler))
- )
- );
- }
-
- /// <summary>
- /// Determines whether an observable sequence is empty.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">An observable sequence to check for emptiness.</param>
- /// <returns>An observable sequence containing a single element determining whether the source sequence is empty.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> is null.</exception>
- public static IQbservable<bool> IsEmpty<TSource>(this IQbservable<TSource> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return source.Provider.CreateQuery<bool>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.IsEmpty<TSource>(default(IQbservable<TSource>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression
- )
- );
- }
-
- /// <summary>
- /// Correlates the elements of two sequences based on overlapping durations.
- /// </summary>
- /// <typeparam name="TLeft">The type of the elements in the left source sequence.</typeparam>
- /// <typeparam name="TRight">The type of the elements in the right source sequence.</typeparam>
- /// <typeparam name="TLeftDuration">The type of the elements in the duration sequence denoting the computed duration of each element in the left source sequence.</typeparam>
- /// <typeparam name="TRightDuration">The type of the elements in the duration sequence denoting the computed duration of each element in the right source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence, obtained by invoking the result selector function for source elements with overlapping duration.</typeparam>
- /// <param name="left">The left observable sequence to join elements for.</param>
- /// <param name="right">The right observable sequence to join elements for.</param>
- /// <param name="leftDurationSelector">A function to select the duration of each element of the left observable sequence, used to determine overlap.</param>
- /// <param name="rightDurationSelector">A function to select the duration of each element of the right observable sequence, used to determine overlap.</param>
- /// <param name="resultSelector">A function invoked to compute a result element for any two overlapping elements of the left and right observable sequences.</param>
- /// <returns>An observable sequence that contains result elements computed from source elements that have an overlapping duration.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="left" /> or <paramref name="right" /> or <paramref name="leftDurationSelector" /> or <paramref name="rightDurationSelector" /> or <paramref name="resultSelector" /> is null.</exception>
- public static IQbservable<TResult> Join<TLeft, TRight, TLeftDuration, TRightDuration, TResult>(this IQbservable<TLeft> left, IObservable<TRight> right, Expression<Func<TLeft, IObservable<TLeftDuration>>> leftDurationSelector, Expression<Func<TRight, IObservable<TRightDuration>>> rightDurationSelector, Expression<Func<TLeft, TRight, TResult>> resultSelector)
- {
- if (left == null)
- throw new ArgumentNullException("left");
- if (right == null)
- throw new ArgumentNullException("right");
- if (leftDurationSelector == null)
- throw new ArgumentNullException("leftDurationSelector");
- if (rightDurationSelector == null)
- throw new ArgumentNullException("rightDurationSelector");
- if (resultSelector == null)
- throw new ArgumentNullException("resultSelector");
-
- return left.Provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Join<TLeft, TRight, TLeftDuration, TRightDuration, TResult>(default(IQbservable<TLeft>), default(IObservable<TRight>), default(Expression<Func<TLeft, IObservable<TLeftDuration>>>), default(Expression<Func<TRight, IObservable<TRightDuration>>>), default(Expression<Func<TLeft, TRight, TResult>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TLeft), typeof(TRight), typeof(TLeftDuration), typeof(TRightDuration), typeof(TResult)),
-#endif
- left.Expression,
- GetSourceExpression(right),
- leftDurationSelector,
- rightDurationSelector,
- resultSelector
- )
- );
- }
-
- /// <summary>
- /// Returns the last element of an observable sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source observable sequence.</param>
- /// <returns>Sequence containing the last element in the observable sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> is null.</exception>
- /// <exception cref="T:System.InvalidOperationException">(Asynchronous) The source sequence is empty.</exception>
- public static IQbservable<TSource> LastAsync<TSource>(this IQbservable<TSource> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return source.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.LastAsync<TSource>(default(IQbservable<TSource>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression
- )
- );
- }
-
- /// <summary>
- /// Returns the last element of an observable sequence that satisfies the condition in the predicate.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source observable sequence.</param>
- /// <param name="predicate">A predicate function to evaluate for elements in the source sequence.</param>
- /// <returns>Sequence containing the last element in the observable sequence that satisfies the condition in the predicate.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="predicate" /> is null.</exception>
- /// <exception cref="T:System.InvalidOperationException">(Asynchronous) No element satisfies the condition in the predicate. -or- The source sequence is empty.</exception>
- public static IQbservable<TSource> LastAsync<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, bool>> predicate)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (predicate == null)
- throw new ArgumentNullException("predicate");
-
- return source.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.LastAsync<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, bool>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- predicate
- )
- );
- }
-
- /// <summary>
- /// Returns the last element of an observable sequence, or a default value if no such element exists.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source observable sequence.</param>
- /// <returns>Sequence containing the last element in the observable sequence, or a default value if no such element exists.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> is null.</exception>
- public static IQbservable<TSource> LastOrDefaultAsync<TSource>(this IQbservable<TSource> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return source.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.LastOrDefaultAsync<TSource>(default(IQbservable<TSource>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression
- )
- );
- }
-
- /// <summary>
- /// Returns the last element of an observable sequence that satisfies the condition in the predicate, or a default value if no such element exists.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source observable sequence.</param>
- /// <param name="predicate">A predicate function to evaluate for elements in the source sequence.</param>
- /// <returns>Sequence containing the last element in the observable sequence that satisfies the condition in the predicate, or a default value if no such element exists.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="predicate" /> is null.</exception>
- public static IQbservable<TSource> LastOrDefaultAsync<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, bool>> predicate)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (predicate == null)
- throw new ArgumentNullException("predicate");
-
- return source.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.LastOrDefaultAsync<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, bool>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- predicate
- )
- );
- }
-
- /// <summary>
- /// Returns an enumerable sequence whose enumeration returns the latest observed element in the source observable sequence.
- /// Enumerators on the resulting sequence will never produce the same element repeatedly, and will block until the next element becomes available.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source observable sequence.</param>
- /// <returns>The enumerable sequence that returns the last sampled element upon each iteration and subsequently blocks until the next element in the observable source sequence becomes available.</returns>
- /// <remarks>This operator requires the source's <see cref="IQbservableProvider"/> object (see <see cref="IQbservable.Provider"/>) to implement <see cref="IQueryProvider"/>.</remarks>
- public static IQueryable<TSource> Latest<TSource>(this IQbservable<TSource> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return ((IQueryProvider)source.Provider).CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Latest<TSource>(default(IQbservable<TSource>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression
- )
- );
- }
-
- /// <summary>
- /// Returns an observable sequence containing an <see cref="T:System.Int64" /> that represents the total number of elements in an observable sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">An observable sequence that contains elements to be counted.</param>
- /// <returns>An observable sequence containing a single element with the number of elements in the input sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> is null.</exception>
- /// <exception cref="T:System.OverflowException">(Asynchronous) The number of elements in the source sequence is larger than <see cref="M:System.Int64.MaxValue" />.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IQbservable<long> LongCount<TSource>(this IQbservable<TSource> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return source.Provider.CreateQuery<long>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.LongCount<TSource>(default(IQbservable<TSource>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression
- )
- );
- }
-
- /// <summary>
- /// Returns an observable sequence containing an <see cref="T:System.Int64" /> that represents how many elements in the specified observable sequence satisfy a condition.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">An observable sequence that contains elements to be counted.</param>
- /// <param name="predicate">A function to test each element for a condition.</param>
- /// <returns>An observable sequence containing a single element with a number that represents how many elements in the input sequence satisfy the condition in the predicate function.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="predicate" /> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IQbservable<long> LongCount<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, bool>> predicate)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (predicate == null)
- throw new ArgumentNullException("predicate");
-
- return source.Provider.CreateQuery<long>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.LongCount<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, bool>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- predicate
- )
- );
- }
-
- /// <summary>
- /// Materializes the implicit notifications of an observable sequence as explicit notification values.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">An observable sequence to get notification values for.</param>
- /// <returns>An observable sequence containing the materialized notification values from the source sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> is null.</exception>
- public static IQbservable<Notification<TSource>> Materialize<TSource>(this IQbservable<TSource> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return source.Provider.CreateQuery<Notification<TSource>>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Materialize<TSource>(default(IQbservable<TSource>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression
- )
- );
- }
-
- /// <summary>
- /// Returns the maximum value in an observable sequence of <see cref="T:System.Decimal" /> values.
- /// </summary>
- /// <param name="source">A sequence of <see cref="T:System.Decimal" /> values to determine the maximum value of.</param>
- /// <returns>An observable sequence containing a single element with the maximum value in the source sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IQbservable<decimal> Max(this IQbservable<decimal> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return source.Provider.CreateQuery<decimal>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Max(default(IQbservable<decimal>))),
-#else
- (MethodInfo)MethodInfo.GetCurrentMethod(),
-#endif
- source.Expression
- )
- );
- }
-
- /// <summary>
- /// Returns the maximum value in an observable sequence of <see cref="T:System.Double" /> values.
- /// </summary>
- /// <param name="source">A sequence of <see cref="T:System.Double" /> values to determine the maximum value of.</param>
- /// <returns>An observable sequence containing a single element with the maximum value in the source sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IQbservable<double> Max(this IQbservable<double> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return source.Provider.CreateQuery<double>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Max(default(IQbservable<double>))),
-#else
- (MethodInfo)MethodInfo.GetCurrentMethod(),
-#endif
- source.Expression
- )
- );
- }
-
- /// <summary>
- /// Returns the maximum value in an observable sequence of <see cref="T:System.Int32" /> values.
- /// </summary>
- /// <param name="source">A sequence of <see cref="T:System.Int32" /> values to determine the maximum value of.</param>
- /// <returns>An observable sequence containing a single element with the maximum value in the source sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IQbservable<int> Max(this IQbservable<int> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return source.Provider.CreateQuery<int>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Max(default(IQbservable<int>))),
-#else
- (MethodInfo)MethodInfo.GetCurrentMethod(),
-#endif
- source.Expression
- )
- );
- }
-
- /// <summary>
- /// Returns the maximum value in an observable sequence of <see cref="T:System.Int64" /> values.
- /// </summary>
- /// <param name="source">A sequence of <see cref="T:System.Int64" /> values to determine the maximum value of.</param>
- /// <returns>An observable sequence containing a single element with the maximum value in the source sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IQbservable<long> Max(this IQbservable<long> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return source.Provider.CreateQuery<long>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Max(default(IQbservable<long>))),
-#else
- (MethodInfo)MethodInfo.GetCurrentMethod(),
-#endif
- source.Expression
- )
- );
- }
-
- /// <summary>
- /// Returns the maximum value in an observable sequence of nullable <see cref="T:System.Decimal" /> values.
- /// </summary>
- /// <param name="source">A sequence of nullable <see cref="T:System.Decimal" /> values to determine the maximum value of.</param>
- /// <returns>An observable sequence containing a single element with the maximum value in the source sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IQbservable<decimal?> Max(this IQbservable<decimal?> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return source.Provider.CreateQuery<decimal?>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Max(default(IQbservable<decimal?>))),
-#else
- (MethodInfo)MethodInfo.GetCurrentMethod(),
-#endif
- source.Expression
- )
- );
- }
-
- /// <summary>
- /// Returns the maximum value in an observable sequence of nullable <see cref="T:System.Double" /> values.
- /// </summary>
- /// <param name="source">A sequence of nullable <see cref="T:System.Double" /> values to determine the maximum value of.</param>
- /// <returns>An observable sequence containing a single element with the maximum value in the source sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IQbservable<double?> Max(this IQbservable<double?> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return source.Provider.CreateQuery<double?>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Max(default(IQbservable<double?>))),
-#else
- (MethodInfo)MethodInfo.GetCurrentMethod(),
-#endif
- source.Expression
- )
- );
- }
-
- /// <summary>
- /// Returns the maximum value in an observable sequence of nullable <see cref="T:System.Int32" /> values.
- /// </summary>
- /// <param name="source">A sequence of nullable <see cref="T:System.Int32" /> values to determine the maximum value of.</param>
- /// <returns>An observable sequence containing a single element with the maximum value in the source sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IQbservable<int?> Max(this IQbservable<int?> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return source.Provider.CreateQuery<int?>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Max(default(IQbservable<int?>))),
-#else
- (MethodInfo)MethodInfo.GetCurrentMethod(),
-#endif
- source.Expression
- )
- );
- }
-
- /// <summary>
- /// Returns the maximum value in an observable sequence of nullable <see cref="T:System.Int64" /> values.
- /// </summary>
- /// <param name="source">A sequence of nullable <see cref="T:System.Int64" /> values to determine the maximum value of.</param>
- /// <returns>An observable sequence containing a single element with the maximum value in the source sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IQbservable<long?> Max(this IQbservable<long?> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return source.Provider.CreateQuery<long?>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Max(default(IQbservable<long?>))),
-#else
- (MethodInfo)MethodInfo.GetCurrentMethod(),
-#endif
- source.Expression
- )
- );
- }
-
- /// <summary>
- /// Returns the maximum value in an observable sequence of nullable <see cref="T:System.Single" /> values.
- /// </summary>
- /// <param name="source">A sequence of nullable <see cref="T:System.Single" /> values to determine the maximum value of.</param>
- /// <returns>An observable sequence containing a single element with the maximum value in the source sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IQbservable<float?> Max(this IQbservable<float?> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return source.Provider.CreateQuery<float?>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Max(default(IQbservable<float?>))),
-#else
- (MethodInfo)MethodInfo.GetCurrentMethod(),
-#endif
- source.Expression
- )
- );
- }
-
- /// <summary>
- /// Returns the maximum value in an observable sequence of <see cref="T:System.Single" /> values.
- /// </summary>
- /// <param name="source">A sequence of <see cref="T:System.Single" /> values to determine the maximum value of.</param>
- /// <returns>An observable sequence containing a single element with the maximum value in the source sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IQbservable<float> Max(this IQbservable<float> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return source.Provider.CreateQuery<float>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Max(default(IQbservable<float>))),
-#else
- (MethodInfo)MethodInfo.GetCurrentMethod(),
-#endif
- source.Expression
- )
- );
- }
-
- /// <summary>
- /// Returns the maximum element in an observable sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">An observable sequence to determine the maximum element of.</param>
- /// <returns>An observable sequence containing a single element with the maximum element in the source sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IQbservable<TSource> Max<TSource>(this IQbservable<TSource> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return source.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Max<TSource>(default(IQbservable<TSource>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression
- )
- );
- }
-
- /// <summary>
- /// Returns the maximum value in an observable sequence according to the specified comparer.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">An observable sequence to determine the maximum element of.</param>
- /// <param name="comparer">Comparer used to compare elements.</param>
- /// <returns>An observable sequence containing a single element with the maximum element in the source sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="comparer" /> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IQbservable<TSource> Max<TSource>(this IQbservable<TSource> source, IComparer<TSource> comparer)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (comparer == null)
- throw new ArgumentNullException("comparer");
-
- return source.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Max<TSource>(default(IQbservable<TSource>), default(IComparer<TSource>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- Expression.Constant(comparer, typeof(IComparer<TSource>))
- )
- );
- }
-
- /// <summary>
- /// Invokes a transform function on each element of a sequence and returns the maximum <see cref="T:System.Decimal" /> value.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values to determine the maximum value of.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the value of type <see cref="T:System.Decimal" /> that corresponds to the maximum value in the source sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IQbservable<decimal> Max<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, decimal>> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return source.Provider.CreateQuery<decimal>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Max<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, decimal>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- selector
- )
- );
- }
-
- /// <summary>
- /// Invokes a transform function on each element of a sequence and returns the maximum <see cref="T:System.Int32" /> value.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values to determine the maximum value of.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the value of type <see cref="T:System.Int32" /> that corresponds to the maximum value in the source sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IQbservable<int> Max<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, int>> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return source.Provider.CreateQuery<int>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Max<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, int>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- selector
- )
- );
- }
-
- /// <summary>
- /// Invokes a transform function on each element of a sequence and returns the maximum <see cref="T:System.Int64" /> value.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values to determine the maximum value of.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the value of type <see cref="T:System.Int64" /> that corresponds to the maximum value in the source sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IQbservable<long> Max<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, long>> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return source.Provider.CreateQuery<long>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Max<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, long>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- selector
- )
- );
- }
-
- /// <summary>
- /// Invokes a transform function on each element of a sequence and returns the maximum nullable <see cref="T:System.Double" /> value.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values to determine the maximum value of.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the value of type <see cref="T:System.Nullable&lt;System.Double&gt;" /> that corresponds to the maximum value in the source sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IQbservable<double?> Max<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, double?>> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return source.Provider.CreateQuery<double?>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Max<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, double?>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- selector
- )
- );
- }
-
- /// <summary>
- /// Invokes a transform function on each element of a sequence and returns the maximum nullable <see cref="T:System.Single" /> value.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values to determine the maximum value of.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the value of type <see cref="T:System.Nullable&lt;System.Single&gt;" /> that corresponds to the maximum value in the source sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IQbservable<float?> Max<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, float?>> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return source.Provider.CreateQuery<float?>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Max<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, float?>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- selector
- )
- );
- }
-
- /// <summary>
- /// Invokes a transform function on each element of a sequence and returns the maximum nullable <see cref="T:System.Decimal" /> value.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values to determine the maximum value of.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the value of type <see cref="T:System.Nullable&lt;System.Decimal&gt;" /> that corresponds to the maximum value in the source sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IQbservable<decimal?> Max<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, decimal?>> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return source.Provider.CreateQuery<decimal?>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Max<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, decimal?>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- selector
- )
- );
- }
-
- /// <summary>
- /// Invokes a transform function on each element of a sequence and returns the maximum nullable <see cref="T:System.Int32" /> value.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values to determine the maximum value of.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the value of type <see cref="T:System.Nullable&lt;System.Int32&gt;" /> that corresponds to the maximum value in the source sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IQbservable<int?> Max<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, int?>> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return source.Provider.CreateQuery<int?>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Max<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, int?>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- selector
- )
- );
- }
-
- /// <summary>
- /// Invokes a transform function on each element of a sequence and returns the maximum nullable <see cref="T:System.Int64" /> value.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values to determine the maximum value of.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the value of type <see cref="T:System.Nullable&lt;System.Int64&gt;" /> that corresponds to the maximum value in the source sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IQbservable<long?> Max<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, long?>> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return source.Provider.CreateQuery<long?>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Max<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, long?>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- selector
- )
- );
- }
-
- /// <summary>
- /// Invokes a transform function on each element of a sequence and returns the maximum <see cref="T:System.Double" /> value.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values to determine the maximum value of.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the value of type <see cref="T:System.Double" /> that corresponds to the maximum value in the source sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IQbservable<double> Max<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, double>> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return source.Provider.CreateQuery<double>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Max<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, double>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- selector
- )
- );
- }
-
- /// <summary>
- /// Invokes a transform function on each element of a sequence and returns the maximum <see cref="T:System.Single" /> value.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values to determine the maximum value of.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the value of type <see cref="T:System.Single" /> that corresponds to the maximum value in the source sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IQbservable<float> Max<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, float>> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return source.Provider.CreateQuery<float>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Max<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, float>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- selector
- )
- );
- }
-
- /// <summary>
- /// Invokes a transform function on each element of a sequence and returns the maximum value.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the objects derived from the elements in the source sequence to determine the maximum of.</typeparam>
- /// <param name="source">An observable sequence to determine the mimimum element of.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the value that corresponds to the maximum element in the source sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IQbservable<TResult> Max<TSource, TResult>(this IQbservable<TSource> source, Expression<Func<TSource, TResult>> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return source.Provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Max<TSource, TResult>(default(IQbservable<TSource>), default(Expression<Func<TSource, TResult>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)),
-#endif
- source.Expression,
- selector
- )
- );
- }
-
- /// <summary>
- /// Invokes a transform function on each element of a sequence and returns the maximum value according to the specified comparer.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the objects derived from the elements in the source sequence to determine the maximum of.</typeparam>
- /// <param name="source">An observable sequence to determine the mimimum element of.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <param name="comparer">Comparer used to compare elements.</param>
- /// <returns>An observable sequence containing a single element with the value that corresponds to the maximum element in the source sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="selector" /> or <paramref name="comparer" /> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IQbservable<TResult> Max<TSource, TResult>(this IQbservable<TSource> source, Expression<Func<TSource, TResult>> selector, IComparer<TResult> comparer)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
- if (comparer == null)
- throw new ArgumentNullException("comparer");
-
- return source.Provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Max<TSource, TResult>(default(IQbservable<TSource>), default(Expression<Func<TSource, TResult>>), default(IComparer<TResult>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)),
-#endif
- source.Expression,
- selector,
- Expression.Constant(comparer, typeof(IComparer<TResult>))
- )
- );
- }
-
- /// <summary>
- /// Returns the elements in an observable sequence with the maximum key value.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TKey">The type of the key computed for each element in the source sequence.</typeparam>
- /// <param name="source">An observable sequence to get the maximum elements for.</param>
- /// <param name="keySelector">Key selector function.</param>
- /// <returns>An observable sequence containing a list of zero or more elements that have a maximum key value.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="keySelector" /> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IQbservable<IList<TSource>> MaxBy<TSource, TKey>(this IQbservable<TSource> source, Expression<Func<TSource, TKey>> keySelector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (keySelector == null)
- throw new ArgumentNullException("keySelector");
-
- return source.Provider.CreateQuery<IList<TSource>>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.MaxBy<TSource, TKey>(default(IQbservable<TSource>), default(Expression<Func<TSource, TKey>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)),
-#endif
- source.Expression,
- keySelector
- )
- );
- }
-
- /// <summary>
- /// Returns the elements in an observable sequence with the maximum key value according to the specified comparer.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TKey">The type of the key computed for each element in the source sequence.</typeparam>
- /// <param name="source">An observable sequence to get the maximum elements for.</param>
- /// <param name="keySelector">Key selector function.</param>
- /// <param name="comparer">Comparer used to compare key values.</param>
- /// <returns>An observable sequence containing a list of zero or more elements that have a maximum key value.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="keySelector" /> or <paramref name="comparer" /> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IQbservable<IList<TSource>> MaxBy<TSource, TKey>(this IQbservable<TSource> source, Expression<Func<TSource, TKey>> keySelector, IComparer<TKey> comparer)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (keySelector == null)
- throw new ArgumentNullException("keySelector");
- if (comparer == null)
- throw new ArgumentNullException("comparer");
-
- return source.Provider.CreateQuery<IList<TSource>>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.MaxBy<TSource, TKey>(default(IQbservable<TSource>), default(Expression<Func<TSource, TKey>>), default(IComparer<TKey>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)),
-#endif
- source.Expression,
- keySelector,
- Expression.Constant(comparer, typeof(IComparer<TKey>))
- )
- );
- }
-
- /// <summary>
- /// Merges elements from two observable sequences into a single observable sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequences.</typeparam>
- /// <param name="first">First observable sequence.</param>
- /// <param name="second">Second observable sequence.</param>
- /// <returns>The observable sequence that merges the elements of the given sequences.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="first" /> or <paramref name="second" /> is null.</exception>
- public static IQbservable<TSource> Merge<TSource>(this IQbservable<TSource> first, IObservable<TSource> second)
- {
- if (first == null)
- throw new ArgumentNullException("first");
- if (second == null)
- throw new ArgumentNullException("second");
-
- return first.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Merge<TSource>(default(IQbservable<TSource>), default(IObservable<TSource>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- first.Expression,
- GetSourceExpression(second)
- )
- );
- }
-
- /// <summary>
- /// Merges elements from two observable sequences into a single observable sequence, using the specified scheduler for enumeration of and subscription to the sources.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequences.</typeparam>
- /// <param name="first">First observable sequence.</param>
- /// <param name="second">Second observable sequence.</param>
- /// <param name="scheduler">Scheduler used to introduce concurrency for making subscriptions to the given sequences.</param>
- /// <returns>The observable sequence that merges the elements of the given sequences.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="first" /> or <paramref name="second" /> or <paramref name="scheduler" /> is null.</exception>
- public static IQbservable<TSource> Merge<TSource>(this IQbservable<TSource> first, IObservable<TSource> second, IScheduler scheduler)
- {
- if (first == null)
- throw new ArgumentNullException("first");
- if (second == null)
- throw new ArgumentNullException("second");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return first.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Merge<TSource>(default(IQbservable<TSource>), default(IObservable<TSource>), default(IScheduler))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- first.Expression,
- GetSourceExpression(second),
- Expression.Constant(scheduler, typeof(IScheduler))
- )
- );
- }
-
- /// <summary>
- /// Merges elements from all of the specified observable sequences into a single observable sequence, using the specified scheduler for enumeration of and subscription to the sources.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TSource">The type of the elements in the source sequences.</typeparam>
- /// <param name="sources">Observable sequences.</param>
- /// <param name="scheduler">Scheduler to run the enumeration of the sequence of sources on.</param>
- /// <returns>The observable sequence that merges the elements of the observable sequences.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="scheduler" /> or <paramref name="sources" /> is null.</exception>
- public static IQbservable<TSource> Merge<TSource>(this IQbservableProvider provider, IScheduler scheduler, params IObservable<TSource>[] sources)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
- if (sources == null)
- throw new ArgumentNullException("sources");
-
- return provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Merge<TSource>(default(IQbservableProvider), default(IScheduler), default(IObservable<TSource>[]))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- Expression.Constant(scheduler, typeof(IScheduler)),
- GetSourceExpression(sources)
- )
- );
- }
-
- /// <summary>
- /// Merges elements from all inner observable sequences into a single observable sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequences.</typeparam>
- /// <param name="sources">Observable sequence of inner observable sequences.</param>
- /// <returns>The observable sequence that merges the elements of the inner sequences.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="sources" /> is null.</exception>
- public static IQbservable<TSource> Merge<TSource>(this IQbservable<IObservable<TSource>> sources)
- {
- if (sources == null)
- throw new ArgumentNullException("sources");
-
- return sources.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Merge<TSource>(default(IQbservable<IObservable<TSource>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- sources.Expression
- )
- );
- }
-
-#if !NO_TPL
- /// <summary>
- /// Merges results from all source tasks into a single observable sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the results produced by the source tasks.</typeparam>
- /// <param name="sources">Observable sequence of tasks.</param>
- /// <returns>The observable sequence that merges the results of the source tasks.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="sources" /> is null.</exception>
- /// <remarks>If the tasks support cancellation, consider manual conversion of the tasks using <see cref="M:System.Reactive.Linq.Observable.FromAsync``1(System.Func{System.Threading.CancellationToken,System.Threading.Tasks.Task{``0}})" />, followed by a merge operation using <see cref="M:System.Reactive.Linq.Observable.Merge``1(System.IObservable{System.IObservable{``0}})" />.</remarks>
- public static IQbservable<TSource> Merge<TSource>(this IQbservable<Task<TSource>> sources)
- {
- if (sources == null)
- throw new ArgumentNullException("sources");
-
- return sources.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Merge<TSource>(default(IQbservable<Task<TSource>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- sources.Expression
- )
- );
- }
-#endif
-
- /// <summary>
- /// Merges elements from all of the specified observable sequences into a single observable sequence.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TSource">The type of the elements in the source sequences.</typeparam>
- /// <param name="sources">Observable sequences.</param>
- /// <returns>The observable sequence that merges the elements of the observable sequences.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="sources" /> is null.</exception>
- public static IQbservable<TSource> Merge<TSource>(this IQbservableProvider provider, params IObservable<TSource>[] sources)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (sources == null)
- throw new ArgumentNullException("sources");
-
- return provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Merge<TSource>(default(IQbservableProvider), default(IObservable<TSource>[]))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- GetSourceExpression(sources)
- )
- );
- }
-
- /// <summary>
- /// Merges elements from all observable sequences in the given enumerable sequence into a single observable sequence.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TSource">The type of the elements in the source sequences.</typeparam>
- /// <param name="sources">Enumerable sequence of observable sequences.</param>
- /// <returns>The observable sequence that merges the elements of the observable sequences.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="sources" /> is null.</exception>
- public static IQbservable<TSource> Merge<TSource>(this IQbservableProvider provider, IEnumerable<IObservable<TSource>> sources)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (sources == null)
- throw new ArgumentNullException("sources");
-
- return provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Merge<TSource>(default(IQbservableProvider), default(IEnumerable<IObservable<TSource>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- GetSourceExpression(sources)
- )
- );
- }
-
- /// <summary>
- /// Merges elements from all inner observable sequences into a single observable sequence, limiting the number of concurrent subscriptions to inner sequences.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequences.</typeparam>
- /// <param name="sources">Observable sequence of inner observable sequences.</param>
- /// <param name="maxConcurrent">Maximum number of inner observable sequences being subscribed to concurrently.</param>
- /// <returns>The observable sequence that merges the elements of the inner sequences.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="sources" /> is null.</exception>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// <paramref name="maxConcurrent" /> is less than or equal to zero.</exception>
- public static IQbservable<TSource> Merge<TSource>(this IQbservable<IObservable<TSource>> sources, int maxConcurrent)
- {
- if (sources == null)
- throw new ArgumentNullException("sources");
-
- return sources.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Merge<TSource>(default(IQbservable<IObservable<TSource>>), default(int))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- sources.Expression,
- Expression.Constant(maxConcurrent, typeof(int))
- )
- );
- }
-
- /// <summary>
- /// Merges elements from all observable sequences in the given enumerable sequence into a single observable sequence, limiting the number of concurrent subscriptions to inner sequences.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TSource">The type of the elements in the source sequences.</typeparam>
- /// <param name="sources">Enumerable sequence of observable sequences.</param>
- /// <param name="maxConcurrent">Maximum number of observable sequences being subscribed to concurrently.</param>
- /// <returns>The observable sequence that merges the elements of the observable sequences.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="sources" /> is null.</exception>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// <paramref name="maxConcurrent" /> is less than or equal to zero.</exception>
- public static IQbservable<TSource> Merge<TSource>(this IQbservableProvider provider, IEnumerable<IObservable<TSource>> sources, int maxConcurrent)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (sources == null)
- throw new ArgumentNullException("sources");
-
- return provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Merge<TSource>(default(IQbservableProvider), default(IEnumerable<IObservable<TSource>>), default(int))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- GetSourceExpression(sources),
- Expression.Constant(maxConcurrent, typeof(int))
- )
- );
- }
-
- /// <summary>
- /// Merges elements from all observable sequences in the given enumerable sequence into a single observable sequence, limiting the number of concurrent subscriptions to inner sequences, and using the specified scheduler for enumeration of and subscription to the sources.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TSource">The type of the elements in the source sequences.</typeparam>
- /// <param name="sources">Enumerable sequence of observable sequences.</param>
- /// <param name="maxConcurrent">Maximum number of observable sequences being subscribed to concurrently.</param>
- /// <param name="scheduler">Scheduler to run the enumeration of the sequence of sources on.</param>
- /// <returns>The observable sequence that merges the elements of the observable sequences.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="sources" /> or <paramref name="scheduler" /> is null.</exception>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// <paramref name="maxConcurrent" /> is less than or equal to zero.</exception>
- public static IQbservable<TSource> Merge<TSource>(this IQbservableProvider provider, IEnumerable<IObservable<TSource>> sources, int maxConcurrent, IScheduler scheduler)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (sources == null)
- throw new ArgumentNullException("sources");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Merge<TSource>(default(IQbservableProvider), default(IEnumerable<IObservable<TSource>>), default(int), default(IScheduler))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- GetSourceExpression(sources),
- Expression.Constant(maxConcurrent, typeof(int)),
- Expression.Constant(scheduler, typeof(IScheduler))
- )
- );
- }
-
- /// <summary>
- /// Merges elements from all observable sequences in the given enumerable sequence into a single observable sequence, using the specified scheduler for enumeration of and subscription to the sources.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TSource">The type of the elements in the source sequences.</typeparam>
- /// <param name="sources">Enumerable sequence of observable sequences.</param>
- /// <param name="scheduler">Scheduler to run the enumeration of the sequence of sources on.</param>
- /// <returns>The observable sequence that merges the elements of the observable sequences.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="sources" /> or <paramref name="scheduler" /> is null.</exception>
- public static IQbservable<TSource> Merge<TSource>(this IQbservableProvider provider, IEnumerable<IObservable<TSource>> sources, IScheduler scheduler)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (sources == null)
- throw new ArgumentNullException("sources");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Merge<TSource>(default(IQbservableProvider), default(IEnumerable<IObservable<TSource>>), default(IScheduler))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- GetSourceExpression(sources),
- Expression.Constant(scheduler, typeof(IScheduler))
- )
- );
- }
-
- /// <summary>
- /// Returns the minimum value in an observable sequence of <see cref="T:System.Decimal" /> values.
- /// </summary>
- /// <param name="source">A sequence of <see cref="T:System.Decimal" /> values to determine the minimum value of.</param>
- /// <returns>An observable sequence containing a single element with the minimum value in the source sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IQbservable<decimal> Min(this IQbservable<decimal> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return source.Provider.CreateQuery<decimal>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Min(default(IQbservable<decimal>))),
-#else
- (MethodInfo)MethodInfo.GetCurrentMethod(),
-#endif
- source.Expression
- )
- );
- }
-
- /// <summary>
- /// Returns the minimum value in an observable sequence of <see cref="T:System.Double" /> values.
- /// </summary>
- /// <param name="source">A sequence of <see cref="T:System.Double" /> values to determine the minimum value of.</param>
- /// <returns>An observable sequence containing a single element with the minimum value in the source sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IQbservable<double> Min(this IQbservable<double> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return source.Provider.CreateQuery<double>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Min(default(IQbservable<double>))),
-#else
- (MethodInfo)MethodInfo.GetCurrentMethod(),
-#endif
- source.Expression
- )
- );
- }
-
- /// <summary>
- /// Returns the minimum value in an observable sequence of <see cref="T:System.Int32" /> values.
- /// </summary>
- /// <param name="source">A sequence of <see cref="T:System.Int32" /> values to determine the minimum value of.</param>
- /// <returns>An observable sequence containing a single element with the minimum value in the source sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IQbservable<int> Min(this IQbservable<int> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return source.Provider.CreateQuery<int>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Min(default(IQbservable<int>))),
-#else
- (MethodInfo)MethodInfo.GetCurrentMethod(),
-#endif
- source.Expression
- )
- );
- }
-
- /// <summary>
- /// Returns the minimum value in an observable sequence of <see cref="T:System.Int64" /> values.
- /// </summary>
- /// <param name="source">A sequence of <see cref="T:System.Int64" /> values to determine the minimum value of.</param>
- /// <returns>An observable sequence containing a single element with the minimum value in the source sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IQbservable<long> Min(this IQbservable<long> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return source.Provider.CreateQuery<long>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Min(default(IQbservable<long>))),
-#else
- (MethodInfo)MethodInfo.GetCurrentMethod(),
-#endif
- source.Expression
- )
- );
- }
-
- /// <summary>
- /// Returns the minimum value in an observable sequence of nullable <see cref="T:System.Decimal" /> values.
- /// </summary>
- /// <param name="source">A sequence of nullable <see cref="T:System.Decimal" /> values to determine the minimum value of.</param>
- /// <returns>An observable sequence containing a single element with the minimum value in the source sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IQbservable<decimal?> Min(this IQbservable<decimal?> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return source.Provider.CreateQuery<decimal?>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Min(default(IQbservable<decimal?>))),
-#else
- (MethodInfo)MethodInfo.GetCurrentMethod(),
-#endif
- source.Expression
- )
- );
- }
-
- /// <summary>
- /// Returns the minimum value in an observable sequence of nullable <see cref="T:System.Double" /> values.
- /// </summary>
- /// <param name="source">A sequence of nullable <see cref="T:System.Double" /> values to determine the minimum value of.</param>
- /// <returns>An observable sequence containing a single element with the minimum value in the source sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IQbservable<double?> Min(this IQbservable<double?> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return source.Provider.CreateQuery<double?>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Min(default(IQbservable<double?>))),
-#else
- (MethodInfo)MethodInfo.GetCurrentMethod(),
-#endif
- source.Expression
- )
- );
- }
-
- /// <summary>
- /// Returns the minimum value in an observable sequence of nullable <see cref="T:System.Int32" /> values.
- /// </summary>
- /// <param name="source">A sequence of nullable <see cref="T:System.Int32" /> values to determine the minimum value of.</param>
- /// <returns>An observable sequence containing a single element with the minimum value in the source sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IQbservable<int?> Min(this IQbservable<int?> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return source.Provider.CreateQuery<int?>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Min(default(IQbservable<int?>))),
-#else
- (MethodInfo)MethodInfo.GetCurrentMethod(),
-#endif
- source.Expression
- )
- );
- }
-
- /// <summary>
- /// Returns the minimum value in an observable sequence of nullable <see cref="T:System.Int64" /> values.
- /// </summary>
- /// <param name="source">A sequence of nullable <see cref="T:System.Int64" /> values to determine the minimum value of.</param>
- /// <returns>An observable sequence containing a single element with the minimum value in the source sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IQbservable<long?> Min(this IQbservable<long?> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return source.Provider.CreateQuery<long?>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Min(default(IQbservable<long?>))),
-#else
- (MethodInfo)MethodInfo.GetCurrentMethod(),
-#endif
- source.Expression
- )
- );
- }
-
- /// <summary>
- /// Returns the minimum value in an observable sequence of nullable <see cref="T:System.Single" /> values.
- /// </summary>
- /// <param name="source">A sequence of nullable <see cref="T:System.Single" /> values to determine the minimum value of.</param>
- /// <returns>An observable sequence containing a single element with the minimum value in the source sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IQbservable<float?> Min(this IQbservable<float?> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return source.Provider.CreateQuery<float?>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Min(default(IQbservable<float?>))),
-#else
- (MethodInfo)MethodInfo.GetCurrentMethod(),
-#endif
- source.Expression
- )
- );
- }
-
- /// <summary>
- /// Returns the minimum value in an observable sequence of <see cref="T:System.Single" /> values.
- /// </summary>
- /// <param name="source">A sequence of <see cref="T:System.Single" /> values to determine the minimum value of.</param>
- /// <returns>An observable sequence containing a single element with the minimum value in the source sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IQbservable<float> Min(this IQbservable<float> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return source.Provider.CreateQuery<float>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Min(default(IQbservable<float>))),
-#else
- (MethodInfo)MethodInfo.GetCurrentMethod(),
-#endif
- source.Expression
- )
- );
- }
-
- /// <summary>
- /// Returns the minimum element in an observable sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">An observable sequence to determine the mimimum element of.</param>
- /// <returns>An observable sequence containing a single element with the minimum element in the source sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IQbservable<TSource> Min<TSource>(this IQbservable<TSource> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return source.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Min<TSource>(default(IQbservable<TSource>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression
- )
- );
- }
-
- /// <summary>
- /// Returns the minimum element in an observable sequence according to the specified comparer.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">An observable sequence to determine the mimimum element of.</param>
- /// <param name="comparer">Comparer used to compare elements.</param>
- /// <returns>An observable sequence containing a single element with the minimum element in the source sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="comparer" /> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IQbservable<TSource> Min<TSource>(this IQbservable<TSource> source, IComparer<TSource> comparer)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (comparer == null)
- throw new ArgumentNullException("comparer");
-
- return source.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Min<TSource>(default(IQbservable<TSource>), default(IComparer<TSource>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- Expression.Constant(comparer, typeof(IComparer<TSource>))
- )
- );
- }
-
- /// <summary>
- /// Invokes a transform function on each element of a sequence and returns the minimum <see cref="T:System.Double" /> value.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values to determine the minimum value of.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the value of type <see cref="T:System.Double" /> that corresponds to the minimum value in the source sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IQbservable<double> Min<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, double>> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return source.Provider.CreateQuery<double>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Min<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, double>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- selector
- )
- );
- }
-
- /// <summary>
- /// Invokes a transform function on each element of a sequence and returns the minimum <see cref="T:System.Single" /> value.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values to determine the minimum value of.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the value of type <see cref="T:System.Single" /> that corresponds to the minimum value in the source sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IQbservable<float> Min<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, float>> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return source.Provider.CreateQuery<float>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Min<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, float>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- selector
- )
- );
- }
-
- /// <summary>
- /// Invokes a transform function on each element of a sequence and returns the minimum <see cref="T:System.Decimal" /> value.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values to determine the minimum value of.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the value of type <see cref="T:System.Decimal" /> that corresponds to the minimum value in the source sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IQbservable<decimal> Min<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, decimal>> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return source.Provider.CreateQuery<decimal>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Min<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, decimal>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- selector
- )
- );
- }
-
- /// <summary>
- /// Invokes a transform function on each element of a sequence and returns the minimum <see cref="T:System.Int32" /> value.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values to determine the minimum value of.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the value of type <see cref="T:System.Int32" /> that corresponds to the minimum value in the source sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IQbservable<int> Min<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, int>> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return source.Provider.CreateQuery<int>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Min<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, int>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- selector
- )
- );
- }
-
- /// <summary>
- /// Invokes a transform function on each element of a sequence and returns the minimum <see cref="T:System.Int64" /> value.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values to determine the minimum value of.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the value of type <see cref="T:System.Int64" /> that corresponds to the minimum value in the source sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IQbservable<long> Min<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, long>> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return source.Provider.CreateQuery<long>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Min<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, long>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- selector
- )
- );
- }
-
- /// <summary>
- /// Invokes a transform function on each element of a sequence and returns the minimum nullable <see cref="T:System.Double" /> value.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values to determine the minimum value of.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the value of type <see cref="T:System.Nullable&lt;System.Double&gt;" /> that corresponds to the minimum value in the source sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IQbservable<double?> Min<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, double?>> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return source.Provider.CreateQuery<double?>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Min<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, double?>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- selector
- )
- );
- }
-
- /// <summary>
- /// Invokes a transform function on each element of a sequence and returns the minimum nullable <see cref="T:System.Single" /> value.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values to determine the minimum value of.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the value of type <see cref="T:System.Nullable&lt;System.Single&gt;" /> that corresponds to the minimum value in the source sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IQbservable<float?> Min<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, float?>> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return source.Provider.CreateQuery<float?>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Min<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, float?>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- selector
- )
- );
- }
-
- /// <summary>
- /// Invokes a transform function on each element of a sequence and returns the minimum nullable <see cref="T:System.Decimal" /> value.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values to determine the minimum value of.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the value of type <see cref="T:System.Nullable&lt;System.Decimal&gt;" /> that corresponds to the minimum value in the source sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IQbservable<decimal?> Min<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, decimal?>> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return source.Provider.CreateQuery<decimal?>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Min<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, decimal?>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- selector
- )
- );
- }
-
- /// <summary>
- /// Invokes a transform function on each element of a sequence and returns the minimum nullable <see cref="T:System.Int32" /> value.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values to determine the minimum value of.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the value of type <see cref="T:System.Nullable&lt;System.Int32&gt;" /> that corresponds to the minimum value in the source sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IQbservable<int?> Min<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, int?>> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return source.Provider.CreateQuery<int?>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Min<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, int?>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- selector
- )
- );
- }
-
- /// <summary>
- /// Invokes a transform function on each element of a sequence and returns the minimum nullable <see cref="T:System.Int64" /> value.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values to determine the minimum value of.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the value of type <see cref="T:System.Nullable&lt;System.Int64&gt;" /> that corresponds to the minimum value in the source sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IQbservable<long?> Min<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, long?>> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return source.Provider.CreateQuery<long?>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Min<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, long?>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- selector
- )
- );
- }
-
- /// <summary>
- /// Invokes a transform function on each element of a sequence and returns the minimum value.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the objects derived from the elements in the source sequence to determine the minimum of.</typeparam>
- /// <param name="source">An observable sequence to determine the mimimum element of.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the value that corresponds to the minimum element in the source sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IQbservable<TResult> Min<TSource, TResult>(this IQbservable<TSource> source, Expression<Func<TSource, TResult>> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return source.Provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Min<TSource, TResult>(default(IQbservable<TSource>), default(Expression<Func<TSource, TResult>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)),
-#endif
- source.Expression,
- selector
- )
- );
- }
-
- /// <summary>
- /// Invokes a transform function on each element of a sequence and returns the minimum value according to the specified comparer.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the objects derived from the elements in the source sequence to determine the minimum of.</typeparam>
- /// <param name="source">An observable sequence to determine the mimimum element of.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <param name="comparer">Comparer used to compare elements.</param>
- /// <returns>An observable sequence containing a single element with the value that corresponds to the minimum element in the source sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="selector" /> or <paramref name="comparer" /> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IQbservable<TResult> Min<TSource, TResult>(this IQbservable<TSource> source, Expression<Func<TSource, TResult>> selector, IComparer<TResult> comparer)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
- if (comparer == null)
- throw new ArgumentNullException("comparer");
-
- return source.Provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Min<TSource, TResult>(default(IQbservable<TSource>), default(Expression<Func<TSource, TResult>>), default(IComparer<TResult>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)),
-#endif
- source.Expression,
- selector,
- Expression.Constant(comparer, typeof(IComparer<TResult>))
- )
- );
- }
-
- /// <summary>
- /// Returns the elements in an observable sequence with the minimum key value.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TKey">The type of the key computed for each element in the source sequence.</typeparam>
- /// <param name="source">An observable sequence to get the minimum elements for.</param>
- /// <param name="keySelector">Key selector function.</param>
- /// <returns>An observable sequence containing a list of zero or more elements that have a minimum key value.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="keySelector" /> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IQbservable<IList<TSource>> MinBy<TSource, TKey>(this IQbservable<TSource> source, Expression<Func<TSource, TKey>> keySelector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (keySelector == null)
- throw new ArgumentNullException("keySelector");
-
- return source.Provider.CreateQuery<IList<TSource>>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.MinBy<TSource, TKey>(default(IQbservable<TSource>), default(Expression<Func<TSource, TKey>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)),
-#endif
- source.Expression,
- keySelector
- )
- );
- }
-
- /// <summary>
- /// Returns the elements in an observable sequence with the minimum key value according to the specified comparer.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TKey">The type of the key computed for each element in the source sequence.</typeparam>
- /// <param name="source">An observable sequence to get the minimum elements for.</param>
- /// <param name="keySelector">Key selector function.</param>
- /// <param name="comparer">Comparer used to compare key values.</param>
- /// <returns>An observable sequence containing a list of zero or more elements that have a minimum key value.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="keySelector" /> or <paramref name="comparer" /> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IQbservable<IList<TSource>> MinBy<TSource, TKey>(this IQbservable<TSource> source, Expression<Func<TSource, TKey>> keySelector, IComparer<TKey> comparer)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (keySelector == null)
- throw new ArgumentNullException("keySelector");
- if (comparer == null)
- throw new ArgumentNullException("comparer");
-
- return source.Provider.CreateQuery<IList<TSource>>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.MinBy<TSource, TKey>(default(IQbservable<TSource>), default(Expression<Func<TSource, TKey>>), default(IComparer<TKey>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)),
-#endif
- source.Expression,
- keySelector,
- Expression.Constant(comparer, typeof(IComparer<TKey>))
- )
- );
- }
-
- /// <summary>
- /// Returns an enumerable sequence whose enumeration returns the most recently observed element in the source observable sequence, using the specified initial value in case no element has been sampled yet.
- /// Enumerators on the resulting sequence never block and can produce the same element repeatedly.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source observable sequence.</param>
- /// <param name="initialValue">Initial value that will be yielded by the enumerable sequence if no element has been sampled yet.</param>
- /// <returns>The enumerable sequence that returns the last sampled element upon each iteration.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> is null.</exception>
- /// <remarks>This operator requires the source's <see cref="IQbservableProvider"/> object (see <see cref="IQbservable.Provider"/>) to implement <see cref="IQueryProvider"/>.</remarks>
- public static IQueryable<TSource> MostRecent<TSource>(this IQbservable<TSource> source, TSource initialValue)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return ((IQueryProvider)source.Provider).CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.MostRecent<TSource>(default(IQbservable<TSource>), default(TSource))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- Expression.Constant(initialValue, typeof(TSource))
- )
- );
- }
-
- /// <summary>
- /// Multicasts the source sequence notifications through an instantiated subject into all uses of the sequence within a selector function. Each
- /// subscription to the resulting sequence causes a separate multicast invocation, exposing the sequence resulting from the selector function's
- /// invocation. For specializations with fixed subject types, see Publish, PublishLast, and Replay.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TIntermediate">The type of the elements produced by the intermediate subject.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence.</typeparam>
- /// <param name="source">Source sequence which will be multicasted in the specified selector function.</param>
- /// <param name="subjectSelector">Factory function to create an intermediate subject through which the source sequence's elements will be multicast to the selector function.</param>
- /// <param name="selector">Selector function which can use the multicasted source sequence subject to the policies enforced by the created subject.</param>
- /// <returns>An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="subjectSelector" /> or <paramref name="selector" /> is null.</exception>
- public static IQbservable<TResult> Multicast<TSource, TIntermediate, TResult>(this IQbservable<TSource> source, Expression<Func<ISubject<TSource, TIntermediate>>> subjectSelector, Expression<Func<IObservable<TIntermediate>, IObservable<TResult>>> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (subjectSelector == null)
- throw new ArgumentNullException("subjectSelector");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return source.Provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Multicast<TSource, TIntermediate, TResult>(default(IQbservable<TSource>), default(Expression<Func<ISubject<TSource, TIntermediate>>>), default(Expression<Func<IObservable<TIntermediate>, IObservable<TResult>>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TIntermediate), typeof(TResult)),
-#endif
- source.Expression,
- subjectSelector,
- selector
- )
- );
- }
-
- /// <summary>
- /// Returns a non-terminating observable sequence, which can be used to denote an infinite duration (e.g. when using reactive joins).
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TResult">The type used for the IObservable&lt;T&gt; type parameter of the resulting sequence.</typeparam>
- /// <returns>An observable sequence whose observers will never get called.</returns>
- public static IQbservable<TResult> Never<TResult>(this IQbservableProvider provider)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
-
- return provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Never<TResult>(default(IQbservableProvider))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TResult)),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider))
- )
- );
- }
-
- /// <summary>
- /// Returns a non-terminating observable sequence, which can be used to denote an infinite duration (e.g. when using reactive joins).
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TResult">The type used for the IObservable&lt;T&gt; type parameter of the resulting sequence.</typeparam>
- /// <param name="witness">Object solely used to infer the type of the <typeparamref name="TResult" /> type parameter. This parameter is typically used when creating a sequence of anonymously typed elements.</param>
- /// <returns>An observable sequence whose observers will never get called.</returns>
- public static IQbservable<TResult> Never<TResult>(this IQbservableProvider provider, TResult witness)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
-
- return provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Never<TResult>(default(IQbservableProvider), default(TResult))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TResult)),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- Expression.Constant(witness, typeof(TResult))
- )
- );
- }
-
- /// <summary>
- /// Returns an enumerable sequence whose enumeration blocks until the next element in the source observable sequence becomes available.
- /// Enumerators on the resulting sequence will block until the next element becomes available.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source observable sequence.</param>
- /// <returns>The enumerable sequence that blocks upon each iteration until the next element in the observable source sequence becomes available.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> is null.</exception>
- /// <remarks>This operator requires the source's <see cref="IQbservableProvider"/> object (see <see cref="IQbservable.Provider"/>) to implement <see cref="IQueryProvider"/>.</remarks>
- public static IQueryable<TSource> Next<TSource>(this IQbservable<TSource> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return ((IQueryProvider)source.Provider).CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Next<TSource>(default(IQbservable<TSource>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression
- )
- );
- }
-
- /// <summary>
- /// Wraps the source sequence in order to run its observer callbacks on the specified synchronization context.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence.</param>
- /// <param name="context">Synchronization context to notify observers on.</param>
- /// <returns>The source sequence whose observations happen on the specified synchronization context.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="context" /> is null.</exception>
- /// <remarks>
- /// This only invokes observer callbacks on a synchronization context. In case the subscription and/or unsubscription actions have side-effects
- /// that require to be run on a synchronization context, use <see cref="M:System.Reactive.Linq.Observable.SubscribeOn``1(System.IObservable{``0},System.Threading.SynchronizationContext)" />.
- /// </remarks>
- public static IQbservable<TSource> ObserveOn<TSource>(this IQbservable<TSource> source, SynchronizationContext context)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (context == null)
- throw new ArgumentNullException("context");
-
- return source.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.ObserveOn<TSource>(default(IQbservable<TSource>), default(SynchronizationContext))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- Expression.Constant(context, typeof(SynchronizationContext))
- )
- );
- }
-
- /// <summary>
- /// Wraps the source sequence in order to run its observer callbacks on the specified scheduler.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence.</param>
- /// <param name="scheduler">Scheduler to notify observers on.</param>
- /// <returns>The source sequence whose observations happen on the specified scheduler.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="scheduler" /> is null.</exception>
- /// <remarks>
- /// This only invokes observer callbacks on a scheduler. In case the subscription and/or unsubscription actions have side-effects
- /// that require to be run on a scheduler, use <see cref="M:System.Reactive.Linq.Observable.SubscribeOn``1(System.IObservable{``0},System.Reactive.Concurrency.IScheduler)" />.
- /// </remarks>
- public static IQbservable<TSource> ObserveOn<TSource>(this IQbservable<TSource> source, IScheduler scheduler)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return source.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.ObserveOn<TSource>(default(IQbservable<TSource>), default(IScheduler))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- Expression.Constant(scheduler, typeof(IScheduler))
- )
- );
- }
-
- /// <summary>
- /// Filters the elements of an observable sequence based on the specified type.
- /// </summary>
- /// <typeparam name="TResult">The type to filter the elements in the source sequence on.</typeparam>
- /// <param name="source">The observable sequence that contains the elements to be filtered.</param>
- /// <returns>An observable sequence that contains elements from the input sequence of type TResult.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> is null.</exception>
- public static IQbservable<TResult> OfType<TResult>(this IQbservable<object> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return source.Provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.OfType<TResult>(default(IQbservable<object>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TResult)),
-#endif
- source.Expression
- )
- );
- }
-
- /// <summary>
- /// Concatenates the second observable sequence to the first observable sequence upon successful or exceptional termination of the first.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequences.</typeparam>
- /// <param name="first">First observable sequence whose exception (if any) is caught.</param>
- /// <param name="second">Second observable sequence used to produce results after the first sequence terminates.</param>
- /// <returns>An observable sequence that concatenates the first and second sequence, even if the first sequence terminates exceptionally.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="first" /> or <paramref name="second" /> is null.</exception>
- public static IQbservable<TSource> OnErrorResumeNext<TSource>(this IQbservable<TSource> first, IObservable<TSource> second)
- {
- if (first == null)
- throw new ArgumentNullException("first");
- if (second == null)
- throw new ArgumentNullException("second");
-
- return first.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.OnErrorResumeNext<TSource>(default(IQbservable<TSource>), default(IObservable<TSource>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- first.Expression,
- GetSourceExpression(second)
- )
- );
- }
-
- /// <summary>
- /// Concatenates all of the specified observable sequences, even if the previous observable sequence terminated exceptionally.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TSource">The type of the elements in the source sequences.</typeparam>
- /// <param name="sources">Observable sequences to concatenate.</param>
- /// <returns>An observable sequence that concatenates the source sequences, even if a sequence terminates exceptionally.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="sources" /> is null.</exception>
- public static IQbservable<TSource> OnErrorResumeNext<TSource>(this IQbservableProvider provider, params IObservable<TSource>[] sources)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (sources == null)
- throw new ArgumentNullException("sources");
-
- return provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.OnErrorResumeNext<TSource>(default(IQbservableProvider), default(IObservable<TSource>[]))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- GetSourceExpression(sources)
- )
- );
- }
-
- /// <summary>
- /// Concatenates all observable sequences in the given enumerable sequence, even if the previous observable sequence terminated exceptionally.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TSource">The type of the elements in the source sequences.</typeparam>
- /// <param name="sources">Observable sequences to concatenate.</param>
- /// <returns>An observable sequence that concatenates the source sequences, even if a sequence terminates exceptionally.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="sources" /> is null.</exception>
- public static IQbservable<TSource> OnErrorResumeNext<TSource>(this IQbservableProvider provider, IEnumerable<IObservable<TSource>> sources)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (sources == null)
- throw new ArgumentNullException("sources");
-
- return provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.OnErrorResumeNext<TSource>(default(IQbservableProvider), default(IEnumerable<IObservable<TSource>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- GetSourceExpression(sources)
- )
- );
- }
-
- /// <summary>
- /// Returns an observable sequence that is the result of invoking the selector on a connectable observable sequence that shares a single subscription to the underlying sequence.
- /// This operator is a specialization of Multicast using a regular <see cref="T:System.Reactive.Subjects.Subject`1" />.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence.</typeparam>
- /// <param name="source">Source sequence whose elements will be multicasted through a single shared subscription.</param>
- /// <param name="selector">Selector function which can use the multicasted source sequence as many times as needed, without causing multiple subscriptions to the source sequence. Subscribers to the given source will receive all notifications of the source from the time of the subscription on.</param>
- /// <returns>An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
- /// <seealso cref="T:System.Reactive.Subjects.Subject`1" />
- public static IQbservable<TResult> Publish<TSource, TResult>(this IQbservable<TSource> source, Expression<Func<IObservable<TSource>, IObservable<TResult>>> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return source.Provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Publish<TSource, TResult>(default(IQbservable<TSource>), default(Expression<Func<IObservable<TSource>, IObservable<TResult>>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)),
-#endif
- source.Expression,
- selector
- )
- );
- }
-
- /// <summary>
- /// Returns an observable sequence that is the result of invoking the selector on a connectable observable sequence that shares a single subscription to the underlying sequence and starts with initialValue.
- /// This operator is a specialization of Multicast using a <see cref="T:System.Reactive.Subjects.BehaviorSubject`1" />.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence.</typeparam>
- /// <param name="source">Source sequence whose elements will be multicasted through a single shared subscription.</param>
- /// <param name="selector">Selector function which can use the multicasted source sequence as many times as needed, without causing multiple subscriptions to the source sequence. Subscribers to the given source will receive immediately receive the initial value, followed by all notifications of the source from the time of the subscription on.</param>
- /// <param name="initialValue">Initial value received by observers upon subscription.</param>
- /// <returns>An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
- /// <seealso cref="T:System.Reactive.Subjects.BehaviorSubject`1" />
- public static IQbservable<TResult> Publish<TSource, TResult>(this IQbservable<TSource> source, Expression<Func<IObservable<TSource>, IObservable<TResult>>> selector, TSource initialValue)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return source.Provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Publish<TSource, TResult>(default(IQbservable<TSource>), default(Expression<Func<IObservable<TSource>, IObservable<TResult>>>), default(TSource))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)),
-#endif
- source.Expression,
- selector,
- Expression.Constant(initialValue, typeof(TSource))
- )
- );
- }
-
- /// <summary>
- /// Returns an observable sequence that is the result of invoking the selector on a connectable observable sequence that shares a single subscription to the underlying sequence containing only the last notification.
- /// This operator is a specialization of Multicast using a <see cref="T:System.Reactive.Subjects.AsyncSubject`1" />.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence.</typeparam>
- /// <param name="source">Source sequence whose elements will be multicasted through a single shared subscription.</param>
- /// <param name="selector">Selector function which can use the multicasted source sequence as many times as needed, without causing multiple subscriptions to the source sequence. Subscribers to the given source will only receive the last notification of the source.</param>
- /// <returns>An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
- /// <seealso cref="T:System.Reactive.Subjects.AsyncSubject`1" />
- public static IQbservable<TResult> PublishLast<TSource, TResult>(this IQbservable<TSource> source, Expression<Func<IObservable<TSource>, IObservable<TResult>>> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return source.Provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.PublishLast<TSource, TResult>(default(IQbservable<TSource>), default(Expression<Func<IObservable<TSource>, IObservable<TResult>>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)),
-#endif
- source.Expression,
- selector
- )
- );
- }
-
- /// <summary>
- /// Generates an observable sequence of integral numbers within a specified range.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <param name="start">The value of the first integer in the sequence.</param>
- /// <param name="count">The number of sequential integers to generate.</param>
- /// <returns>An observable sequence that contains a range of sequential integral numbers.</returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// <paramref name="count" /> is less than zero. -or- <paramref name="start" /> + <paramref name="count" /> - 1 is larger than <see cref="M:System.Int32.MaxValue" />.</exception>
- public static IQbservable<int> Range(this IQbservableProvider provider, int start, int count)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
-
- return provider.CreateQuery<int>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Range(default(IQbservableProvider), default(int), default(int))),
-#else
- (MethodInfo)MethodInfo.GetCurrentMethod(),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- Expression.Constant(start, typeof(int)),
- Expression.Constant(count, typeof(int))
- )
- );
- }
-
- /// <summary>
- /// Generates an observable sequence of integral numbers within a specified range, using the specified scheduler to send out observer messages.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <param name="start">The value of the first integer in the sequence.</param>
- /// <param name="count">The number of sequential integers to generate.</param>
- /// <param name="scheduler">Scheduler to run the generator loop on.</param>
- /// <returns>An observable sequence that contains a range of sequential integral numbers.</returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// <paramref name="count" /> is less than zero. -or- <paramref name="start" /> + <paramref name="count" /> - 1 is larger than <see cref="M:System.Int32.MaxValue" />.</exception>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="scheduler" /> is null.</exception>
- public static IQbservable<int> Range(this IQbservableProvider provider, int start, int count, IScheduler scheduler)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return provider.CreateQuery<int>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Range(default(IQbservableProvider), default(int), default(int), default(IScheduler))),
-#else
- (MethodInfo)MethodInfo.GetCurrentMethod(),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- Expression.Constant(start, typeof(int)),
- Expression.Constant(count, typeof(int)),
- Expression.Constant(scheduler, typeof(IScheduler))
- )
- );
- }
-
- /// <summary>
- /// Returns an observable sequence that stays connected to the source as long as there is at least one subscription to the observable sequence.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Connectable observable sequence.</param>
- /// <returns>An observable sequence that stays connected to the source as long as there is at least one subscription to the observable sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> is null.</exception>
- public static IQbservable<TSource> RefCount<TSource>(this IQbservableProvider provider, IConnectableObservable<TSource> source)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (source == null)
- throw new ArgumentNullException("source");
-
- return provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.RefCount<TSource>(default(IQbservableProvider), default(IConnectableObservable<TSource>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- Expression.Constant(source, typeof(IConnectableObservable<TSource>))
- )
- );
- }
-
- /// <summary>
- /// Generates an observable sequence that repeats the given element infinitely.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TResult">The type of the element that will be repeated in the produced sequence.</typeparam>
- /// <param name="value">Element to repeat.</param>
- /// <returns>An observable sequence that repeats the given element infinitely.</returns>
- public static IQbservable<TResult> Repeat<TResult>(this IQbservableProvider provider, TResult value)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
-
- return provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Repeat<TResult>(default(IQbservableProvider), default(TResult))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TResult)),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- Expression.Constant(value, typeof(TResult))
- )
- );
- }
-
- /// <summary>
- /// Generates an observable sequence that repeats the given element the specified number of times.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TResult">The type of the element that will be repeated in the produced sequence.</typeparam>
- /// <param name="value">Element to repeat.</param>
- /// <param name="repeatCount">Number of times to repeat the element.</param>
- /// <returns>An observable sequence that repeats the given element the specified number of times.</returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// <paramref name="repeatCount" /> is less than zero.</exception>
- public static IQbservable<TResult> Repeat<TResult>(this IQbservableProvider provider, TResult value, int repeatCount)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
-
- return provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Repeat<TResult>(default(IQbservableProvider), default(TResult), default(int))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TResult)),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- Expression.Constant(value, typeof(TResult)),
- Expression.Constant(repeatCount, typeof(int))
- )
- );
- }
-
- /// <summary>
- /// Generates an observable sequence that repeats the given element the specified number of times, using the specified scheduler to send out observer messages.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TResult">The type of the element that will be repeated in the produced sequence.</typeparam>
- /// <param name="value">Element to repeat.</param>
- /// <param name="repeatCount">Number of times to repeat the element.</param>
- /// <param name="scheduler">Scheduler to run the producer loop on.</param>
- /// <returns>An observable sequence that repeats the given element the specified number of times.</returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// <paramref name="repeatCount" /> is less than zero.</exception>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="scheduler" /> is null.</exception>
- public static IQbservable<TResult> Repeat<TResult>(this IQbservableProvider provider, TResult value, int repeatCount, IScheduler scheduler)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Repeat<TResult>(default(IQbservableProvider), default(TResult), default(int), default(IScheduler))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TResult)),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- Expression.Constant(value, typeof(TResult)),
- Expression.Constant(repeatCount, typeof(int)),
- Expression.Constant(scheduler, typeof(IScheduler))
- )
- );
- }
-
- /// <summary>
- /// Generates an observable sequence that repeats the given element infinitely, using the specified scheduler to send out observer messages.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TResult">The type of the element that will be repeated in the produced sequence.</typeparam>
- /// <param name="value">Element to repeat.</param>
- /// <param name="scheduler">Scheduler to run the producer loop on.</param>
- /// <returns>An observable sequence that repeats the given element infinitely.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="scheduler" /> is null.</exception>
- public static IQbservable<TResult> Repeat<TResult>(this IQbservableProvider provider, TResult value, IScheduler scheduler)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Repeat<TResult>(default(IQbservableProvider), default(TResult), default(IScheduler))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TResult)),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- Expression.Constant(value, typeof(TResult)),
- Expression.Constant(scheduler, typeof(IScheduler))
- )
- );
- }
-
- /// <summary>
- /// Repeats the observable sequence indefinitely.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Observable sequence to repeat.</param>
- /// <returns>The observable sequence producing the elements of the given sequence repeatedly and sequentially.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> is null.</exception>
- public static IQbservable<TSource> Repeat<TSource>(this IQbservable<TSource> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return source.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Repeat<TSource>(default(IQbservable<TSource>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression
- )
- );
- }
-
- /// <summary>
- /// Repeats the observable sequence a specified number of times.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Observable sequence to repeat.</param>
- /// <param name="repeatCount">Number of times to repeat the sequence.</param>
- /// <returns>The observable sequence producing the elements of the given sequence repeatedly.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> is null.</exception>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// <paramref name="repeatCount" /> is less than zero.</exception>
- public static IQbservable<TSource> Repeat<TSource>(this IQbservable<TSource> source, int repeatCount)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return source.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Repeat<TSource>(default(IQbservable<TSource>), default(int))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- Expression.Constant(repeatCount, typeof(int))
- )
- );
- }
-
- /// <summary>
- /// Returns an observable sequence that is the result of invoking the selector on a connectable observable sequence that shares a single subscription to the underlying sequence replaying all notifications.
- /// This operator is a specialization of Multicast using a <see cref="T:System.Reactive.Subjects.ReplaySubject`1" />.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence.</typeparam>
- /// <param name="source">Source sequence whose elements will be multicasted through a single shared subscription.</param>
- /// <param name="selector">Selector function which can use the multicasted source sequence as many times as needed, without causing multiple subscriptions to the source sequence. Subscribers to the given source will receive all the notifications of the source.</param>
- /// <returns>An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
- /// <seealso cref="T:System.Reactive.Subjects.ReplaySubject`1" />
- public static IQbservable<TResult> Replay<TSource, TResult>(this IQbservable<TSource> source, Expression<Func<IObservable<TSource>, IObservable<TResult>>> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return source.Provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Replay<TSource, TResult>(default(IQbservable<TSource>), default(Expression<Func<IObservable<TSource>, IObservable<TResult>>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)),
-#endif
- source.Expression,
- selector
- )
- );
- }
-
- /// <summary>
- /// Returns an observable sequence that is the result of invoking the selector on a connectable observable sequence that shares a single subscription to the underlying sequence replaying notifications subject to a maximum element count for the replay buffer.
- /// This operator is a specialization of Multicast using a <see cref="T:System.Reactive.Subjects.ReplaySubject`1" />.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence.</typeparam>
- /// <param name="source">Source sequence whose elements will be multicasted through a single shared subscription.</param>
- /// <param name="selector">Selector function which can use the multicasted source sequence as many times as needed, without causing multiple subscriptions to the source sequence. Subscribers to the given source will receive all the notifications of the source subject to the specified replay buffer trimming policy.</param>
- /// <param name="bufferSize">Maximum element count of the replay buffer.</param>
- /// <returns>An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// <paramref name="bufferSize" /> is less than zero.</exception>
- /// <seealso cref="T:System.Reactive.Subjects.ReplaySubject`1" />
- public static IQbservable<TResult> Replay<TSource, TResult>(this IQbservable<TSource> source, Expression<Func<IObservable<TSource>, IObservable<TResult>>> selector, int bufferSize)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return source.Provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Replay<TSource, TResult>(default(IQbservable<TSource>), default(Expression<Func<IObservable<TSource>, IObservable<TResult>>>), default(int))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)),
-#endif
- source.Expression,
- selector,
- Expression.Constant(bufferSize, typeof(int))
- )
- );
- }
-
- /// <summary>
- /// Returns an observable sequence that is the result of invoking the selector on a connectable observable sequence that shares a single subscription to the underlying sequence replaying notifications subject to a maximum element count for the replay buffer.
- /// This operator is a specialization of Multicast using a <see cref="T:System.Reactive.Subjects.ReplaySubject`1" />.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence.</typeparam>
- /// <param name="source">Source sequence whose elements will be multicasted through a single shared subscription.</param>
- /// <param name="selector">Selector function which can use the multicasted source sequence as many times as needed, without causing multiple subscriptions to the source sequence. Subscribers to the given source will receive all the notifications of the source subject to the specified replay buffer trimming policy.</param>
- /// <param name="bufferSize">Maximum element count of the replay buffer.</param>
- /// <param name="scheduler">Scheduler where connected observers within the selector function will be invoked on.</param>
- /// <returns>An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="selector" /> or <paramref name="scheduler" /> is null.</exception>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// <paramref name="bufferSize" /> is less than zero.</exception>
- /// <seealso cref="T:System.Reactive.Subjects.ReplaySubject`1" />
- public static IQbservable<TResult> Replay<TSource, TResult>(this IQbservable<TSource> source, Expression<Func<IObservable<TSource>, IObservable<TResult>>> selector, int bufferSize, IScheduler scheduler)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return source.Provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Replay<TSource, TResult>(default(IQbservable<TSource>), default(Expression<Func<IObservable<TSource>, IObservable<TResult>>>), default(int), default(IScheduler))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)),
-#endif
- source.Expression,
- selector,
- Expression.Constant(bufferSize, typeof(int)),
- Expression.Constant(scheduler, typeof(IScheduler))
- )
- );
- }
-
- /// <summary>
- /// Returns an observable sequence that is the result of invoking the selector on a connectable observable sequence that shares a single subscription to the underlying sequence replaying notifications subject to a maximum time length and element count for the replay buffer.
- /// This operator is a specialization of Multicast using a <see cref="T:System.Reactive.Subjects.ReplaySubject`1" />.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence.</typeparam>
- /// <param name="source">Source sequence whose elements will be multicasted through a single shared subscription.</param>
- /// <param name="selector">Selector function which can use the multicasted source sequence as many times as needed, without causing multiple subscriptions to the source sequence. Subscribers to the given source will receive all the notifications of the source subject to the specified replay buffer trimming policy.</param>
- /// <param name="bufferSize">Maximum element count of the replay buffer.</param>
- /// <param name="window">Maximum time length of the replay buffer.</param>
- /// <returns>An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// <paramref name="bufferSize" /> is less than zero.</exception>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// <paramref name="window" /> is less than TimeSpan.Zero.</exception>
- /// <seealso cref="T:System.Reactive.Subjects.ReplaySubject`1" />
- public static IQbservable<TResult> Replay<TSource, TResult>(this IQbservable<TSource> source, Expression<Func<IObservable<TSource>, IObservable<TResult>>> selector, int bufferSize, TimeSpan window)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return source.Provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Replay<TSource, TResult>(default(IQbservable<TSource>), default(Expression<Func<IObservable<TSource>, IObservable<TResult>>>), default(int), default(TimeSpan))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)),
-#endif
- source.Expression,
- selector,
- Expression.Constant(bufferSize, typeof(int)),
- Expression.Constant(window, typeof(TimeSpan))
- )
- );
- }
-
- /// <summary>
- /// Returns an observable sequence that is the result of invoking the selector on a connectable observable sequence that shares a single subscription to the underlying sequence replaying notifications subject to a maximum time length and element count for the replay buffer.
- /// This operator is a specialization of Multicast using a <see cref="T:System.Reactive.Subjects.ReplaySubject`1" />.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence.</typeparam>
- /// <param name="source">Source sequence whose elements will be multicasted through a single shared subscription.</param>
- /// <param name="selector">Selector function which can use the multicasted source sequence as many times as needed, without causing multiple subscriptions to the source sequence. Subscribers to the given source will receive all the notifications of the source subject to the specified replay buffer trimming policy.</param>
- /// <param name="bufferSize">Maximum element count of the replay buffer.</param>
- /// <param name="window">Maximum time length of the replay buffer.</param>
- /// <param name="scheduler">Scheduler where connected observers within the selector function will be invoked on.</param>
- /// <returns>An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="selector" /> or <paramref name="scheduler" /> is null.</exception>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// <paramref name="bufferSize" /> is less than zero.</exception>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// <paramref name="window" /> is less than TimeSpan.Zero.</exception>
- /// <seealso cref="T:System.Reactive.Subjects.ReplaySubject`1" />
- public static IQbservable<TResult> Replay<TSource, TResult>(this IQbservable<TSource> source, Expression<Func<IObservable<TSource>, IObservable<TResult>>> selector, int bufferSize, TimeSpan window, IScheduler scheduler)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return source.Provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Replay<TSource, TResult>(default(IQbservable<TSource>), default(Expression<Func<IObservable<TSource>, IObservable<TResult>>>), default(int), default(TimeSpan), default(IScheduler))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)),
-#endif
- source.Expression,
- selector,
- Expression.Constant(bufferSize, typeof(int)),
- Expression.Constant(window, typeof(TimeSpan)),
- Expression.Constant(scheduler, typeof(IScheduler))
- )
- );
- }
-
- /// <summary>
- /// Returns an observable sequence that is the result of invoking the selector on a connectable observable sequence that shares a single subscription to the underlying sequence replaying all notifications.
- /// This operator is a specialization of Multicast using a <see cref="T:System.Reactive.Subjects.ReplaySubject`1" />.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence.</typeparam>
- /// <param name="source">Source sequence whose elements will be multicasted through a single shared subscription.</param>
- /// <param name="selector">Selector function which can use the multicasted source sequence as many times as needed, without causing multiple subscriptions to the source sequence. Subscribers to the given source will receive all the notifications of the source.</param>
- /// <param name="scheduler">Scheduler where connected observers within the selector function will be invoked on.</param>
- /// <returns>An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="selector" /> or <paramref name="scheduler" /> is null.</exception>
- /// <seealso cref="T:System.Reactive.Subjects.ReplaySubject`1" />
- public static IQbservable<TResult> Replay<TSource, TResult>(this IQbservable<TSource> source, Expression<Func<IObservable<TSource>, IObservable<TResult>>> selector, IScheduler scheduler)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return source.Provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Replay<TSource, TResult>(default(IQbservable<TSource>), default(Expression<Func<IObservable<TSource>, IObservable<TResult>>>), default(IScheduler))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)),
-#endif
- source.Expression,
- selector,
- Expression.Constant(scheduler, typeof(IScheduler))
- )
- );
- }
-
- /// <summary>
- /// Returns an observable sequence that is the result of invoking the selector on a connectable observable sequence that shares a single subscription to the underlying sequence replaying notifications subject to a maximum time length for the replay buffer.
- /// This operator is a specialization of Multicast using a <see cref="T:System.Reactive.Subjects.ReplaySubject`1" />.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence.</typeparam>
- /// <param name="source">Source sequence whose elements will be multicasted through a single shared subscription.</param>
- /// <param name="selector">Selector function which can use the multicasted source sequence as many times as needed, without causing multiple subscriptions to the source sequence. Subscribers to the given source will receive all the notifications of the source subject to the specified replay buffer trimming policy.</param>
- /// <param name="window">Maximum time length of the replay buffer.</param>
- /// <returns>An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// <paramref name="window" /> is less than TimeSpan.Zero.</exception>
- /// <seealso cref="T:System.Reactive.Subjects.ReplaySubject`1" />
- public static IQbservable<TResult> Replay<TSource, TResult>(this IQbservable<TSource> source, Expression<Func<IObservable<TSource>, IObservable<TResult>>> selector, TimeSpan window)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return source.Provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Replay<TSource, TResult>(default(IQbservable<TSource>), default(Expression<Func<IObservable<TSource>, IObservable<TResult>>>), default(TimeSpan))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)),
-#endif
- source.Expression,
- selector,
- Expression.Constant(window, typeof(TimeSpan))
- )
- );
- }
-
- /// <summary>
- /// Returns an observable sequence that is the result of invoking the selector on a connectable observable sequence that shares a single subscription to the underlying sequence replaying notifications subject to a maximum time length for the replay buffer.
- /// This operator is a specialization of Multicast using a <see cref="T:System.Reactive.Subjects.ReplaySubject`1" />.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence.</typeparam>
- /// <param name="source">Source sequence whose elements will be multicasted through a single shared subscription.</param>
- /// <param name="selector">Selector function which can use the multicasted source sequence as many times as needed, without causing multiple subscriptions to the source sequence. Subscribers to the given source will receive all the notifications of the source subject to the specified replay buffer trimming policy.</param>
- /// <param name="window">Maximum time length of the replay buffer.</param>
- /// <param name="scheduler">Scheduler where connected observers within the selector function will be invoked on.</param>
- /// <returns>An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="selector" /> or <paramref name="scheduler" /> is null.</exception>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// <paramref name="window" /> is less than TimeSpan.Zero.</exception>
- /// <seealso cref="T:System.Reactive.Subjects.ReplaySubject`1" />
- public static IQbservable<TResult> Replay<TSource, TResult>(this IQbservable<TSource> source, Expression<Func<IObservable<TSource>, IObservable<TResult>>> selector, TimeSpan window, IScheduler scheduler)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return source.Provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Replay<TSource, TResult>(default(IQbservable<TSource>), default(Expression<Func<IObservable<TSource>, IObservable<TResult>>>), default(TimeSpan), default(IScheduler))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)),
-#endif
- source.Expression,
- selector,
- Expression.Constant(window, typeof(TimeSpan)),
- Expression.Constant(scheduler, typeof(IScheduler))
- )
- );
- }
-
- /// <summary>
- /// Repeats the source observable sequence until it successfully terminates.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Observable sequence to repeat until it successfully terminates.</param>
- /// <returns>An observable sequence producing the elements of the given sequence repeatedly until it terminates successfully.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> is null.</exception>
- public static IQbservable<TSource> Retry<TSource>(this IQbservable<TSource> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return source.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Retry<TSource>(default(IQbservable<TSource>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression
- )
- );
- }
-
- /// <summary>
- /// Repeats the source observable sequence the specified number of times or until it successfully terminates.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Observable sequence to repeat until it successfully terminates.</param>
- /// <param name="retryCount">Number of times to repeat the sequence.</param>
- /// <returns>An observable sequence producing the elements of the given sequence repeatedly until it terminates successfully.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> is null.</exception>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// <paramref name="retryCount" /> is less than zero.</exception>
- public static IQbservable<TSource> Retry<TSource>(this IQbservable<TSource> source, int retryCount)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return source.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Retry<TSource>(default(IQbservable<TSource>), default(int))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- Expression.Constant(retryCount, typeof(int))
- )
- );
- }
-
- /// <summary>
- /// Returns an observable sequence that contains a single element.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TResult">The type of the element that will be returned in the produced sequence.</typeparam>
- /// <param name="value">Single element in the resulting observable sequence.</param>
- /// <returns>An observable sequence containing the single specified element.</returns>
- public static IQbservable<TResult> Return<TResult>(this IQbservableProvider provider, TResult value)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
-
- return provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Return<TResult>(default(IQbservableProvider), default(TResult))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TResult)),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- Expression.Constant(value, typeof(TResult))
- )
- );
- }
-
- /// <summary>
- /// Returns an observable sequence that contains a single element, using the specified scheduler to send out observer messages.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TResult">The type of the element that will be returned in the produced sequence.</typeparam>
- /// <param name="value">Single element in the resulting observable sequence.</param>
- /// <param name="scheduler">Scheduler to send the single element on.</param>
- /// <returns>An observable sequence containing the single specified element.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="scheduler" /> is null.</exception>
- public static IQbservable<TResult> Return<TResult>(this IQbservableProvider provider, TResult value, IScheduler scheduler)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Return<TResult>(default(IQbservableProvider), default(TResult), default(IScheduler))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TResult)),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- Expression.Constant(value, typeof(TResult)),
- Expression.Constant(scheduler, typeof(IScheduler))
- )
- );
- }
-
- /// <summary>
- /// Samples the observable sequence at each interval.
- /// Upon each sampling tick, the latest element (if any) in the source sequence during the last sampling interval is sent to the resulting sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence to sample.</param>
- /// <param name="interval">Interval at which to sample. If this value is equal to TimeSpan.Zero, the scheduler will continuously sample the stream.</param>
- /// <returns>Sampled observable sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> is null.</exception>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// <paramref name="interval" /> is less than TimeSpan.Zero.</exception>
- /// <remarks>
- /// Specifying a TimeSpan.Zero value for <paramref name="interval" /> doesn't guarantee all source sequence elements will be preserved. This is a side-effect
- /// of the asynchrony introduced by the scheduler, where the sampling action may not execute immediately, despite the TimeSpan.Zero due time.
- /// </remarks>
- public static IQbservable<TSource> Sample<TSource>(this IQbservable<TSource> source, TimeSpan interval)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return source.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Sample<TSource>(default(IQbservable<TSource>), default(TimeSpan))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- Expression.Constant(interval, typeof(TimeSpan))
- )
- );
- }
-
- /// <summary>
- /// Samples the observable sequence at each interval, using the specified scheduler to run sampling timers.
- /// Upon each sampling tick, the latest element (if any) in the source sequence during the last sampling interval is sent to the resulting sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence to sample.</param>
- /// <param name="interval">Interval at which to sample. If this value is equal to TimeSpan.Zero, the scheduler will continuously sample the stream.</param>
- /// <param name="scheduler">Scheduler to run the sampling timer on.</param>
- /// <returns>Sampled observable sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="scheduler" /> is null.</exception>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// <paramref name="interval" /> is less than TimeSpan.Zero.</exception>
- /// <remarks>
- /// Specifying a TimeSpan.Zero value for <paramref name="interval" /> doesn't guarantee all source sequence elements will be preserved. This is a side-effect
- /// of the asynchrony introduced by the scheduler, where the sampling action may not execute immediately, despite the TimeSpan.Zero due time.
- /// </remarks>
- public static IQbservable<TSource> Sample<TSource>(this IQbservable<TSource> source, TimeSpan interval, IScheduler scheduler)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return source.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Sample<TSource>(default(IQbservable<TSource>), default(TimeSpan), default(IScheduler))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- Expression.Constant(interval, typeof(TimeSpan)),
- Expression.Constant(scheduler, typeof(IScheduler))
- )
- );
- }
-
- /// <summary>
- /// Samples the source observable sequence using a samper observable sequence producing sampling ticks.
- /// Upon each sampling tick, the latest element (if any) in the source sequence during the last sampling interval is sent to the resulting sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TSample">The type of the elements in the sampling sequence.</typeparam>
- /// <param name="source">Source sequence to sample.</param>
- /// <param name="sampler">Sampling tick sequence.</param>
- /// <returns>Sampled observable sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="sampler" /> is null.</exception>
- public static IQbservable<TSource> Sample<TSource, TSample>(this IQbservable<TSource> source, IObservable<TSample> sampler)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (sampler == null)
- throw new ArgumentNullException("sampler");
-
- return source.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Sample<TSource, TSample>(default(IQbservable<TSource>), default(IObservable<TSample>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TSample)),
-#endif
- source.Expression,
- GetSourceExpression(sampler)
- )
- );
- }
-
- /// <summary>
- /// Applies an accumulator function over an observable sequence and returns each intermediate result.
- /// For aggregation behavior with no intermediate results, see <see cref="M:System.Reactive.Linq.Observable.Aggregate``1(System.IObservable{``0},System.Func{``0,``0,``0})" />.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence and the result of the aggregation.</typeparam>
- /// <param name="source">An observable sequence to accumulate over.</param>
- /// <param name="accumulator">An accumulator function to be invoked on each element.</param>
- /// <returns>An observable sequence containing the accumulated values.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="accumulator" /> is null.</exception>
- public static IQbservable<TSource> Scan<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, TSource, TSource>> accumulator)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (accumulator == null)
- throw new ArgumentNullException("accumulator");
-
- return source.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Scan<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, TSource, TSource>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- accumulator
- )
- );
- }
-
- /// <summary>
- /// Applies an accumulator function over an observable sequence and returns each intermediate result. The specified seed value is used as the initial accumulator value.
- /// For aggregation behavior with no intermediate results, see <see cref="M:System.Reactive.Linq.Observable.Aggregate``2(System.IObservable{``0},``1,System.Func{``1,``0,``1})" />.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TAccumulate">The type of the result of the aggregation.</typeparam>
- /// <param name="source">An observable sequence to accumulate over.</param>
- /// <param name="seed">The initial accumulator value.</param>
- /// <param name="accumulator">An accumulator function to be invoked on each element.</param>
- /// <returns>An observable sequence containing the accumulated values.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="accumulator" /> is null.</exception>
- public static IQbservable<TAccumulate> Scan<TSource, TAccumulate>(this IQbservable<TSource> source, TAccumulate seed, Expression<Func<TAccumulate, TSource, TAccumulate>> accumulator)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (accumulator == null)
- throw new ArgumentNullException("accumulator");
-
- return source.Provider.CreateQuery<TAccumulate>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Scan<TSource, TAccumulate>(default(IQbservable<TSource>), default(TAccumulate), default(Expression<Func<TAccumulate, TSource, TAccumulate>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TAccumulate)),
-#endif
- source.Expression,
- Expression.Constant(seed, typeof(TAccumulate)),
- accumulator
- )
- );
- }
-
- /// <summary>
- /// Projects each element of an observable sequence into a new form.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence, obtained by running the selector function for each element in the source sequence.</typeparam>
- /// <param name="source">A sequence of elements to invoke a transform function on.</param>
- /// <param name="selector">A transform function to apply to each source element.</param>
- /// <returns>An observable sequence whose elements are the result of invoking the transform function on each element of source.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
- public static IQbservable<TResult> Select<TSource, TResult>(this IQbservable<TSource> source, Expression<Func<TSource, TResult>> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return source.Provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Select<TSource, TResult>(default(IQbservable<TSource>), default(Expression<Func<TSource, TResult>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)),
-#endif
- source.Expression,
- selector
- )
- );
- }
-
- /// <summary>
- /// Projects each element of an observable sequence into a new form by incorporating the element's index.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence, obtained by running the selector function for each element in the source sequence.</typeparam>
- /// <param name="source">A sequence of elements to invoke a transform function on.</param>
- /// <param name="selector">A transform function to apply to each source element; the second parameter of the function represents the index of the source element.</param>
- /// <returns>An observable sequence whose elements are the result of invoking the transform function on each element of source.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
- public static IQbservable<TResult> Select<TSource, TResult>(this IQbservable<TSource> source, Expression<Func<TSource, int, TResult>> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return source.Provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Select<TSource, TResult>(default(IQbservable<TSource>), default(Expression<Func<TSource, int, TResult>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)),
-#endif
- source.Expression,
- selector
- )
- );
- }
-
- /// <summary>
- /// Projects each element of an observable sequence to an observable sequence, invokes the result selector for the source element and each of the corresponding inner sequence's elements, and merges the results into one observable sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TCollection">The type of the elements in the projected intermediate sequences.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence, obtained by using the selector to combine source sequence elements with their corresponding intermediate sequence elements.</typeparam>
- /// <param name="source">An observable sequence of elements to project.</param>
- /// <param name="collectionSelector">A transform function to apply to each element.</param>
- /// <param name="resultSelector">A transform function to apply to each element of the intermediate sequence.</param>
- /// <returns>An observable sequence whose elements are the result of invoking the one-to-many transform function collectionSelector on each element of the input sequence and then mapping each of those sequence elements and their corresponding source element to a result element.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="collectionSelector" /> or <paramref name="resultSelector" /> is null.</exception>
- public static IQbservable<TResult> SelectMany<TSource, TCollection, TResult>(this IQbservable<TSource> source, Expression<Func<TSource, IObservable<TCollection>>> collectionSelector, Expression<Func<TSource, TCollection, TResult>> resultSelector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (collectionSelector == null)
- throw new ArgumentNullException("collectionSelector");
- if (resultSelector == null)
- throw new ArgumentNullException("resultSelector");
-
- return source.Provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.SelectMany<TSource, TCollection, TResult>(default(IQbservable<TSource>), default(Expression<Func<TSource, IObservable<TCollection>>>), default(Expression<Func<TSource, TCollection, TResult>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TCollection), typeof(TResult)),
-#endif
- source.Expression,
- collectionSelector,
- resultSelector
- )
- );
- }
-
- /// <summary>
- /// Projects each element of an observable sequence to an enumerable sequence, invokes the result selector for the source element and each of the corresponding inner sequence's elements, and merges the results into one observable sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TCollection">The type of the elements in the projected intermediate enumerable sequences.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence, obtained by using the selector to combine source sequence elements with their corresponding intermediate sequence elements.</typeparam>
- /// <param name="source">An observable sequence of elements to project.</param>
- /// <param name="collectionSelector">A transform function to apply to each element.</param>
- /// <param name="resultSelector">A transform function to apply to each element of the intermediate sequence.</param>
- /// <returns>An observable sequence whose elements are the result of invoking the one-to-many transform function collectionSelector on each element of the input sequence and then mapping each of those sequence elements and their corresponding source element to a result element.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="collectionSelector" /> or <paramref name="resultSelector" /> is null.</exception>
- /// <remarks>The projected sequences are enumerated synchonously within the OnNext call of the source sequence. In order to do a concurrent, non-blocking merge, change the selector to return an observable sequence obtained using the <see cref="M:System.Reactive.Linq.Observable.ToObservable``1(System.Collections.Generic.IEnumerable{``0})" /> conversion.</remarks>
- public static IQbservable<TResult> SelectMany<TSource, TCollection, TResult>(this IQbservable<TSource> source, Expression<Func<TSource, IEnumerable<TCollection>>> collectionSelector, Expression<Func<TSource, TCollection, TResult>> resultSelector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (collectionSelector == null)
- throw new ArgumentNullException("collectionSelector");
- if (resultSelector == null)
- throw new ArgumentNullException("resultSelector");
-
- return source.Provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.SelectMany<TSource, TCollection, TResult>(default(IQbservable<TSource>), default(Expression<Func<TSource, IEnumerable<TCollection>>>), default(Expression<Func<TSource, TCollection, TResult>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TCollection), typeof(TResult)),
-#endif
- source.Expression,
- collectionSelector,
- resultSelector
- )
- );
- }
-
- /// <summary>
- /// Projects each element of the source observable sequence to the other observable sequence and merges the resulting observable sequences into one observable sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TOther">The type of the elements in the other sequence and the elements in the result sequence.</typeparam>
- /// <param name="source">An observable sequence of elements to project.</param>
- /// <param name="other">An observable sequence to project each element from the source sequence onto.</param>
- /// <returns>An observable sequence whose elements are the result of projecting each source element onto the other sequence and merging all the resulting sequences together.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="other" /> is null.</exception>
- public static IQbservable<TOther> SelectMany<TSource, TOther>(this IQbservable<TSource> source, IObservable<TOther> other)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (other == null)
- throw new ArgumentNullException("other");
-
- return source.Provider.CreateQuery<TOther>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.SelectMany<TSource, TOther>(default(IQbservable<TSource>), default(IObservable<TOther>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TOther)),
-#endif
- source.Expression,
- GetSourceExpression(other)
- )
- );
- }
-
- /// <summary>
- /// Projects each notification of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the projected inner sequences and the elements in the merged result sequence.</typeparam>
- /// <param name="source">An observable sequence of notifications to project.</param>
- /// <param name="onNext">A transform function to apply to each element.</param>
- /// <param name="onError">A transform function to apply when an error occurs in the source sequence.</param>
- /// <param name="onCompleted">A transform function to apply when the end of the source sequence is reached.</param>
- /// <returns>An observable sequence whose elements are the result of invoking the one-to-many transform function corresponding to each notification in the input sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="onNext" /> or <paramref name="onError" /> or <paramref name="onCompleted" /> is null.</exception>
- public static IQbservable<TResult> SelectMany<TSource, TResult>(this IQbservable<TSource> source, Expression<Func<TSource, IObservable<TResult>>> onNext, Expression<Func<Exception, IObservable<TResult>>> onError, Expression<Func<IObservable<TResult>>> onCompleted)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (onNext == null)
- throw new ArgumentNullException("onNext");
- if (onError == null)
- throw new ArgumentNullException("onError");
- if (onCompleted == null)
- throw new ArgumentNullException("onCompleted");
-
- return source.Provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.SelectMany<TSource, TResult>(default(IQbservable<TSource>), default(Expression<Func<TSource, IObservable<TResult>>>), default(Expression<Func<Exception, IObservable<TResult>>>), default(Expression<Func<IObservable<TResult>>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)),
-#endif
- source.Expression,
- onNext,
- onError,
- onCompleted
- )
- );
- }
-
- /// <summary>
- /// Projects each element of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the projected inner sequences and the elements in the merged result sequence.</typeparam>
- /// <param name="source">An observable sequence of elements to project.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence whose elements are the result of invoking the one-to-many transform function on each element of the input sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
- public static IQbservable<TResult> SelectMany<TSource, TResult>(this IQbservable<TSource> source, Expression<Func<TSource, IObservable<TResult>>> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return source.Provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.SelectMany<TSource, TResult>(default(IQbservable<TSource>), default(Expression<Func<TSource, IObservable<TResult>>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)),
-#endif
- source.Expression,
- selector
- )
- );
- }
-
-#if !NO_TPL
- /// <summary>
- /// Projects each element of an observable sequence to a task and merges all of the task results into one observable sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the result produced by the projected tasks and the elements in the merged result sequence.</typeparam>
- /// <param name="source">An observable sequence of elements to project.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence whose elements are the result of the tasks executed for each element of the input sequence.</returns>
- /// <remarks>This overload supports composition of observable sequences and tasks, without requiring manual conversion of the tasks to observable sequences using <see cref="M:System.Reactive.Threading.Tasks.TaskObservableExtensions.ToObservable``1(System.Threading.Tasks.Task{``0})" />.</remarks>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
- public static IQbservable<TResult> SelectMany<TSource, TResult>(this IQbservable<TSource> source, Expression<Func<TSource, Task<TResult>>> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return source.Provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.SelectMany<TSource, TResult>(default(IQbservable<TSource>), default(Expression<Func<TSource, Task<TResult>>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)),
-#endif
- source.Expression,
- selector
- )
- );
- }
-#endif
-
-#if !NO_TPL
- /// <summary>
- /// Projects each element of an observable sequence to a task with cancellation support and merges all of the task results into one observable sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the result produced by the projected tasks and the elements in the merged result sequence.</typeparam>
- /// <param name="source">An observable sequence of elements to project.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence whose elements are the result of the tasks executed for each element of the input sequence.</returns>
- /// <remarks>This overload supports composition of observable sequences and tasks, without requiring manual conversion of the tasks to observable sequences using <see cref="M:System.Reactive.Threading.Tasks.TaskObservableExtensions.ToObservable``1(System.Threading.Tasks.Task{``0})" />.</remarks>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
- public static IQbservable<TResult> SelectMany<TSource, TResult>(this IQbservable<TSource> source, Expression<Func<TSource, CancellationToken, Task<TResult>>> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return source.Provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.SelectMany<TSource, TResult>(default(IQbservable<TSource>), default(Expression<Func<TSource, CancellationToken, Task<TResult>>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)),
-#endif
- source.Expression,
- selector
- )
- );
- }
-#endif
-
- /// <summary>
- /// Projects each element of an observable sequence to an enumerable sequence and concatenates the resulting enumerable sequences into one observable sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the projected inner enumerable sequences and the elements in the merged result sequence.</typeparam>
- /// <param name="source">An observable sequence of elements to project.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence whose elements are the result of invoking the one-to-many transform function on each element of the input sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
- /// <remarks>The projected sequences are enumerated synchonously within the OnNext call of the source sequence. In order to do a concurrent, non-blocking merge, change the selector to return an observable sequence obtained using the <see cref="M:System.Reactive.Linq.Observable.ToObservable``1(System.Collections.Generic.IEnumerable{``0})" /> conversion.</remarks>
- public static IQbservable<TResult> SelectMany<TSource, TResult>(this IQbservable<TSource> source, Expression<Func<TSource, IEnumerable<TResult>>> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return source.Provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.SelectMany<TSource, TResult>(default(IQbservable<TSource>), default(Expression<Func<TSource, IEnumerable<TResult>>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)),
-#endif
- source.Expression,
- selector
- )
- );
- }
-
-#if !NO_TPL
- /// <summary>
- /// Projects each element of an observable sequence to a task, invokes the result selector for the source element and the task result, and merges the results into one observable sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TTaskResult">The type of the results produced by the projected intermediate tasks.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence, obtained by using the selector to combine source sequence elements with their corresponding intermediate task results.</typeparam>
- /// <param name="source">An observable sequence of elements to project.</param>
- /// <param name="taskSelector">A transform function to apply to each element.</param>
- /// <param name="resultSelector">A transform function to apply to each element of the intermediate sequence.</param>
- /// <returns>An observable sequence whose elements are the result of obtaining a task for each element of the input sequence and then mapping the task's result and its corresponding source element to a result element.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="taskSelector" /> or <paramref name="resultSelector" /> is null.</exception>
- /// <remarks>This overload supports using LINQ query comprehension syntax in C# and Visual Basic to compose observable sequences and tasks, without requiring manual conversion of the tasks to observable sequences using <see cref="M:System.Reactive.Threading.Tasks.TaskObservableExtensions.ToObservable``1(System.Threading.Tasks.Task{``0})" />.</remarks>
- public static IQbservable<TResult> SelectMany<TSource, TTaskResult, TResult>(this IQbservable<TSource> source, Expression<Func<TSource, Task<TTaskResult>>> taskSelector, Expression<Func<TSource, TTaskResult, TResult>> resultSelector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (taskSelector == null)
- throw new ArgumentNullException("taskSelector");
- if (resultSelector == null)
- throw new ArgumentNullException("resultSelector");
-
- return source.Provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.SelectMany<TSource, TTaskResult, TResult>(default(IQbservable<TSource>), default(Expression<Func<TSource, Task<TTaskResult>>>), default(Expression<Func<TSource, TTaskResult, TResult>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TTaskResult), typeof(TResult)),
-#endif
- source.Expression,
- taskSelector,
- resultSelector
- )
- );
- }
-#endif
-
-#if !NO_TPL
- /// <summary>
- /// Projects each element of an observable sequence to a task with cancellation support, invokes the result selector for the source element and the task result, and merges the results into one observable sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TTaskResult">The type of the results produced by the projected intermediate tasks.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence, obtained by using the selector to combine source sequence elements with their corresponding intermediate task results.</typeparam>
- /// <param name="source">An observable sequence of elements to project.</param>
- /// <param name="taskSelector">A transform function to apply to each element.</param>
- /// <param name="resultSelector">A transform function to apply to each element of the intermediate sequence.</param>
- /// <returns>An observable sequence whose elements are the result of obtaining a task for each element of the input sequence and then mapping the task's result and its corresponding source element to a result element.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="taskSelector" /> or <paramref name="resultSelector" /> is null.</exception>
- /// <remarks>This overload supports using LINQ query comprehension syntax in C# and Visual Basic to compose observable sequences and tasks, without requiring manual conversion of the tasks to observable sequences using <see cref="M:System.Reactive.Threading.Tasks.TaskObservableExtensions.ToObservable``1(System.Threading.Tasks.Task{``0})" />.</remarks>
- public static IQbservable<TResult> SelectMany<TSource, TTaskResult, TResult>(this IQbservable<TSource> source, Expression<Func<TSource, CancellationToken, Task<TTaskResult>>> taskSelector, Expression<Func<TSource, TTaskResult, TResult>> resultSelector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (taskSelector == null)
- throw new ArgumentNullException("taskSelector");
- if (resultSelector == null)
- throw new ArgumentNullException("resultSelector");
-
- return source.Provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.SelectMany<TSource, TTaskResult, TResult>(default(IQbservable<TSource>), default(Expression<Func<TSource, CancellationToken, Task<TTaskResult>>>), default(Expression<Func<TSource, TTaskResult, TResult>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TTaskResult), typeof(TResult)),
-#endif
- source.Expression,
- taskSelector,
- resultSelector
- )
- );
- }
-#endif
-
- /// <summary>
- /// Determines whether two sequences are equal by comparing the elements pairwise.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="first">First observable sequence to compare.</param>
- /// <param name="second">Second observable sequence to compare.</param>
- /// <returns>An observable sequence that contains a single element which indicates whether both sequences are of equal length and their corresponding elements are equal according to the default equality comparer for their type.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="first" /> or <paramref name="second" /> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IQbservable<bool> SequenceEqual<TSource>(this IQbservable<TSource> first, IObservable<TSource> second)
- {
- if (first == null)
- throw new ArgumentNullException("first");
- if (second == null)
- throw new ArgumentNullException("second");
-
- return first.Provider.CreateQuery<bool>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.SequenceEqual<TSource>(default(IQbservable<TSource>), default(IObservable<TSource>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- first.Expression,
- GetSourceExpression(second)
- )
- );
- }
-
- /// <summary>
- /// Determines whether an observable and enumerable sequence are equal by comparing the elements pairwise.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="first">First observable sequence to compare.</param>
- /// <param name="second">Second observable sequence to compare.</param>
- /// <returns>An observable sequence that contains a single element which indicates whether both sequences are of equal length and their corresponding elements are equal according to the default equality comparer for their type.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="first" /> or <paramref name="second" /> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IQbservable<bool> SequenceEqual<TSource>(this IQbservable<TSource> first, IEnumerable<TSource> second)
- {
- if (first == null)
- throw new ArgumentNullException("first");
- if (second == null)
- throw new ArgumentNullException("second");
-
- return first.Provider.CreateQuery<bool>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.SequenceEqual<TSource>(default(IQbservable<TSource>), default(IEnumerable<TSource>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- first.Expression,
- GetSourceExpression(second)
- )
- );
- }
-
- /// <summary>
- /// Determines whether two sequences are equal by comparing the elements pairwise using a specified equality comparer.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="first">First observable sequence to compare.</param>
- /// <param name="second">Second observable sequence to compare.</param>
- /// <param name="comparer">Comparer used to compare elements of both sequences.</param>
- /// <returns>An observable sequence that contains a single element which indicates whether both sequences are of equal length and their corresponding elements are equal according to the specified equality comparer.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="first" /> or <paramref name="second" /> or <paramref name="comparer" /> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IQbservable<bool> SequenceEqual<TSource>(this IQbservable<TSource> first, IObservable<TSource> second, IEqualityComparer<TSource> comparer)
- {
- if (first == null)
- throw new ArgumentNullException("first");
- if (second == null)
- throw new ArgumentNullException("second");
- if (comparer == null)
- throw new ArgumentNullException("comparer");
-
- return first.Provider.CreateQuery<bool>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.SequenceEqual<TSource>(default(IQbservable<TSource>), default(IObservable<TSource>), default(IEqualityComparer<TSource>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- first.Expression,
- GetSourceExpression(second),
- Expression.Constant(comparer, typeof(IEqualityComparer<TSource>))
- )
- );
- }
-
- /// <summary>
- /// Determines whether an observable and enumerable sequence are equal by comparing the elements pairwise using a specified equality comparer.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="first">First observable sequence to compare.</param>
- /// <param name="second">Second observable sequence to compare.</param>
- /// <param name="comparer">Comparer used to compare elements of both sequences.</param>
- /// <returns>An observable sequence that contains a single element which indicates whether both sequences are of equal length and their corresponding elements are equal according to the specified equality comparer.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="first" /> or <paramref name="second" /> or <paramref name="comparer" /> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IQbservable<bool> SequenceEqual<TSource>(this IQbservable<TSource> first, IEnumerable<TSource> second, IEqualityComparer<TSource> comparer)
- {
- if (first == null)
- throw new ArgumentNullException("first");
- if (second == null)
- throw new ArgumentNullException("second");
- if (comparer == null)
- throw new ArgumentNullException("comparer");
-
- return first.Provider.CreateQuery<bool>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.SequenceEqual<TSource>(default(IQbservable<TSource>), default(IEnumerable<TSource>), default(IEqualityComparer<TSource>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- first.Expression,
- GetSourceExpression(second),
- Expression.Constant(comparer, typeof(IEqualityComparer<TSource>))
- )
- );
- }
-
- /// <summary>
- /// Returns the only element of an observable sequence, and reports an exception if there is not exactly one element in the observable sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source observable sequence.</param>
- /// <returns>Sequence containing the single element in the observable sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> is null.</exception>
- /// <exception cref="T:System.InvalidOperationException">(Asynchronous) The source sequence contains more than one element. -or- The source sequence is empty.</exception>
- public static IQbservable<TSource> SingleAsync<TSource>(this IQbservable<TSource> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return source.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.SingleAsync<TSource>(default(IQbservable<TSource>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression
- )
- );
- }
-
- /// <summary>
- /// Returns the only element of an observable sequence that satisfies the condition in the predicate, and reports an exception if there is not exactly one element in the observable sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source observable sequence.</param>
- /// <param name="predicate">A predicate function to evaluate for elements in the source sequence.</param>
- /// <returns>Sequence containing the single element in the observable sequence that satisfies the condition in the predicate.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="predicate" /> is null.</exception>
- /// <exception cref="T:System.InvalidOperationException">(Asynchronous) No element satisfies the condition in the predicate. -or- More than one element satisfies the condition in the predicate. -or- The source sequence is empty.</exception>
- public static IQbservable<TSource> SingleAsync<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, bool>> predicate)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (predicate == null)
- throw new ArgumentNullException("predicate");
-
- return source.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.SingleAsync<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, bool>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- predicate
- )
- );
- }
-
- /// <summary>
- /// Returns the only element of an observable sequence, or a default value if the observable sequence is empty; this method reports an exception if there is more than one element in the observable sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source observable sequence.</param>
- /// <returns>Sequence containing the single element in the observable sequence, or a default value if no such element exists.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> is null.</exception>
- /// <exception cref="T:System.InvalidOperationException">(Asynchronous) The source sequence contains more than one element.</exception>
- public static IQbservable<TSource> SingleOrDefaultAsync<TSource>(this IQbservable<TSource> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return source.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.SingleOrDefaultAsync<TSource>(default(IQbservable<TSource>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression
- )
- );
- }
-
- /// <summary>
- /// Returns the only element of an observable sequence that matches the predicate, or a default value if no such element exists; this method reports an exception if there is more than one element in the observable sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source observable sequence.</param>
- /// <param name="predicate">A predicate function to evaluate for elements in the source sequence.</param>
- /// <returns>Sequence containing the single element in the observable sequence that satisfies the condition in the predicate, or a default value if no such element exists.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="predicate" /> is null.</exception>
- /// <exception cref="T:System.InvalidOperationException">(Asynchronous) The sequence contains more than one element that satisfies the condition in the predicate.</exception>
- public static IQbservable<TSource> SingleOrDefaultAsync<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, bool>> predicate)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (predicate == null)
- throw new ArgumentNullException("predicate");
-
- return source.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.SingleOrDefaultAsync<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, bool>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- predicate
- )
- );
- }
-
- /// <summary>
- /// Bypasses a specified number of elements in an observable sequence and then returns the remaining elements.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">The sequence to take elements from.</param>
- /// <param name="count">The number of elements to skip before returning the remaining elements.</param>
- /// <returns>An observable sequence that contains the elements that occur after the specified index in the input sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> is null.</exception>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// <paramref name="count" /> is less than zero.</exception>
- public static IQbservable<TSource> Skip<TSource>(this IQbservable<TSource> source, int count)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return source.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Skip<TSource>(default(IQbservable<TSource>), default(int))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- Expression.Constant(count, typeof(int))
- )
- );
- }
-
- /// <summary>
- /// Skips elements for the specified duration from the start of the observable source sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence to skip elements for.</param>
- /// <param name="duration">Duration for skipping elements from the start of the sequence.</param>
- /// <returns>An observable sequence with the elements skipped during the specified duration from the start of the source sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> is null.</exception>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// <paramref name="duration" /> is less than TimeSpan.Zero.</exception>
- /// <remarks>
- /// <para>
- /// Specifying a TimeSpan.Zero value for <paramref name="duration" /> doesn't guarantee no elements will be dropped from the start of the source sequence.
- /// This is a side-effect of the asynchrony introduced by the scheduler, where the action that causes callbacks from the source sequence to be forwarded
- /// may not execute immediately, despite the TimeSpan.Zero due time.
- /// </para>
- /// <para>
- /// Errors produced by the source sequence are always forwarded to the result sequence, even if the error occurs before the <paramref name="duration" />.
- /// </para>
- /// </remarks>
- public static IQbservable<TSource> Skip<TSource>(this IQbservable<TSource> source, TimeSpan duration)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return source.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Skip<TSource>(default(IQbservable<TSource>), default(TimeSpan))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- Expression.Constant(duration, typeof(TimeSpan))
- )
- );
- }
-
- /// <summary>
- /// Skips elements for the specified duration from the start of the observable source sequence, using the specified scheduler to run timers.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence to skip elements for.</param>
- /// <param name="duration">Duration for skipping elements from the start of the sequence.</param>
- /// <param name="scheduler">Scheduler to run the timer on.</param>
- /// <returns>An observable sequence with the elements skipped during the specified duration from the start of the source sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="scheduler" /> is null.</exception>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// <paramref name="duration" /> is less than TimeSpan.Zero.</exception>
- /// <remarks>
- /// <para>
- /// Specifying a TimeSpan.Zero value for <paramref name="duration" /> doesn't guarantee no elements will be dropped from the start of the source sequence.
- /// This is a side-effect of the asynchrony introduced by the scheduler, where the action that causes callbacks from the source sequence to be forwarded
- /// may not execute immediately, despite the TimeSpan.Zero due time.
- /// </para>
- /// <para>
- /// Errors produced by the source sequence are always forwarded to the result sequence, even if the error occurs before the <paramref name="duration" />.
- /// </para>
- /// </remarks>
- public static IQbservable<TSource> Skip<TSource>(this IQbservable<TSource> source, TimeSpan duration, IScheduler scheduler)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return source.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Skip<TSource>(default(IQbservable<TSource>), default(TimeSpan), default(IScheduler))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- Expression.Constant(duration, typeof(TimeSpan)),
- Expression.Constant(scheduler, typeof(IScheduler))
- )
- );
- }
-
- /// <summary>
- /// Bypasses a specified number of elements at the end of an observable sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence.</param>
- /// <param name="count">Number of elements to bypass at the end of the source sequence.</param>
- /// <returns>An observable sequence containing the source sequence elements except for the bypassed ones at the end.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> is null.</exception>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// <paramref name="count" /> is less than zero.</exception>
- /// <remarks>
- /// This operator accumulates a queue with a length enough to store the first <paramref name="count" /> elements. As more elements are
- /// received, elements are taken from the front of the queue and produced on the result sequence. This causes elements to be delayed.
- /// </remarks>
- public static IQbservable<TSource> SkipLast<TSource>(this IQbservable<TSource> source, int count)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return source.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.SkipLast<TSource>(default(IQbservable<TSource>), default(int))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- Expression.Constant(count, typeof(int))
- )
- );
- }
-
- /// <summary>
- /// Skips elements for the specified duration from the end of the observable source sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence to skip elements for.</param>
- /// <param name="duration">Duration for skipping elements from the end of the sequence.</param>
- /// <returns>An observable sequence with the elements skipped during the specified duration from the end of the source sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> is null.</exception>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// <paramref name="duration" /> is less than TimeSpan.Zero.</exception>
- /// <remarks>
- /// This operator accumulates a queue with a length enough to store elements received during the initial <paramref name="duration" /> window.
- /// As more elements are received, elements older than the specified <paramref name="duration" /> are taken from the queue and produced on the
- /// result sequence. This causes elements to be delayed with <paramref name="duration" />.
- /// </remarks>
- public static IQbservable<TSource> SkipLast<TSource>(this IQbservable<TSource> source, TimeSpan duration)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return source.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.SkipLast<TSource>(default(IQbservable<TSource>), default(TimeSpan))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- Expression.Constant(duration, typeof(TimeSpan))
- )
- );
- }
-
- /// <summary>
- /// Skips elements for the specified duration from the end of the observable source sequence, using the specified scheduler to run timers.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence to skip elements for.</param>
- /// <param name="duration">Duration for skipping elements from the end of the sequence.</param>
- /// <param name="scheduler">Scheduler to run the timer on.</param>
- /// <returns>An observable sequence with the elements skipped during the specified duration from the end of the source sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="scheduler" /> is null.</exception>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// <paramref name="duration" /> is less than TimeSpan.Zero.</exception>
- /// <remarks>
- /// This operator accumulates a queue with a length enough to store elements received during the initial <paramref name="duration" /> window.
- /// As more elements are received, elements older than the specified <paramref name="duration" /> are taken from the queue and produced on the
- /// result sequence. This causes elements to be delayed with <paramref name="duration" />.
- /// </remarks>
- public static IQbservable<TSource> SkipLast<TSource>(this IQbservable<TSource> source, TimeSpan duration, IScheduler scheduler)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return source.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.SkipLast<TSource>(default(IQbservable<TSource>), default(TimeSpan), default(IScheduler))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- Expression.Constant(duration, typeof(TimeSpan)),
- Expression.Constant(scheduler, typeof(IScheduler))
- )
- );
- }
-
- /// <summary>
- /// Skips elements from the observable source sequence until the specified start time.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence to skip elements for.</param>
- /// <param name="startTime">Time to start taking elements from the source sequence. If this value is less than or equal to DateTimeOffset.UtcNow, no elements will be skipped.</param>
- /// <returns>An observable sequence with the elements skipped until the specified start time.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> is null.</exception>
- /// <remarks>
- /// Errors produced by the source sequence are always forwarded to the result sequence, even if the error occurs before the <paramref name="startTime" />.
- /// </remarks>
- public static IQbservable<TSource> SkipUntil<TSource>(this IQbservable<TSource> source, DateTimeOffset startTime)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return source.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.SkipUntil<TSource>(default(IQbservable<TSource>), default(DateTimeOffset))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- Expression.Constant(startTime, typeof(DateTimeOffset))
- )
- );
- }
-
- /// <summary>
- /// Skips elements from the observable source sequence until the specified start time, using the specified scheduler to run timers.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence to skip elements for.</param>
- /// <param name="startTime">Time to start taking elements from the source sequence. If this value is less than or equal to DateTimeOffset.UtcNow, no elements will be skipped.</param>
- /// <param name="scheduler">Scheduler to run the timer on.</param>
- /// <returns>An observable sequence with the elements skipped until the specified start time.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="scheduler" /> is null.</exception>
- /// <remarks>
- /// Errors produced by the source sequence are always forwarded to the result sequence, even if the error occurs before the <paramref name="startTime" />.
- /// </remarks>
- public static IQbservable<TSource> SkipUntil<TSource>(this IQbservable<TSource> source, DateTimeOffset startTime, IScheduler scheduler)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return source.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.SkipUntil<TSource>(default(IQbservable<TSource>), default(DateTimeOffset), default(IScheduler))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- Expression.Constant(startTime, typeof(DateTimeOffset)),
- Expression.Constant(scheduler, typeof(IScheduler))
- )
- );
- }
-
- /// <summary>
- /// Returns the elements from the source observable sequence only after the other observable sequence produces an element.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TOther">The type of the elements in the other sequence that indicates the end of skip behavior.</typeparam>
- /// <param name="source">Source sequence to propagate elements for.</param>
- /// <param name="other">Observable sequence that triggers propagation of elements of the source sequence.</param>
- /// <returns>An observable sequence containing the elements of the source sequence starting from the point the other sequence triggered propagation.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="other" /> is null.</exception>
- public static IQbservable<TSource> SkipUntil<TSource, TOther>(this IQbservable<TSource> source, IObservable<TOther> other)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (other == null)
- throw new ArgumentNullException("other");
-
- return source.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.SkipUntil<TSource, TOther>(default(IQbservable<TSource>), default(IObservable<TOther>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TOther)),
-#endif
- source.Expression,
- GetSourceExpression(other)
- )
- );
- }
-
- /// <summary>
- /// Bypasses elements in an observable sequence as long as a specified condition is true and then returns the remaining elements.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">An observable sequence to return elements from.</param>
- /// <param name="predicate">A function to test each element for a condition.</param>
- /// <returns>An observable sequence that contains the elements from the input sequence starting at the first element in the linear series that does not pass the test specified by predicate.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="predicate" /> is null.</exception>
- public static IQbservable<TSource> SkipWhile<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, bool>> predicate)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (predicate == null)
- throw new ArgumentNullException("predicate");
-
- return source.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.SkipWhile<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, bool>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- predicate
- )
- );
- }
-
- /// <summary>
- /// Bypasses elements in an observable sequence as long as a specified condition is true and then returns the remaining elements.
- /// The element's index is used in the logic of the predicate function.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">An observable sequence to return elements from.</param>
- /// <param name="predicate">A function to test each element for a condition; the second parameter of the function represents the index of the source element.</param>
- /// <returns>An observable sequence that contains the elements from the input sequence starting at the first element in the linear series that does not pass the test specified by predicate.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="predicate" /> is null.</exception>
- public static IQbservable<TSource> SkipWhile<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, int, bool>> predicate)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (predicate == null)
- throw new ArgumentNullException("predicate");
-
- return source.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.SkipWhile<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, int, bool>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- predicate
- )
- );
- }
-
- /// <summary>
- /// Invokes the action asynchronously, surfacing the result through an observable sequence.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <param name="action">Action to run asynchronously.</param>
- /// <returns>An observable sequence exposing a Unit value upon completion of the action, or an exception.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="action" /> is null.</exception>
- /// <remarks>
- /// <list type="bullet">
- /// <item>
- /// <description>The action is called immediately, not during the subscription of the resulting sequence.</description>
- /// </item>
- /// <item>
- /// <description>Multiple subscriptions to the resulting sequence can observe the action's outcome.</description>
- /// </item>
- /// </list>
- /// </remarks>
- public static IQbservable<Unit> Start(this IQbservableProvider provider, Expression<Action> action)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (action == null)
- throw new ArgumentNullException("action");
-
- return provider.CreateQuery<Unit>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Start(default(IQbservableProvider), default(Expression<Action>))),
-#else
- (MethodInfo)MethodInfo.GetCurrentMethod(),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- action
- )
- );
- }
-
- /// <summary>
- /// Invokes the action asynchronously on the specified scheduler, surfacing the result through an observable sequence.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <param name="action">Action to run asynchronously.</param>
- /// <param name="scheduler">Scheduler to run the action on.</param>
- /// <returns>An observable sequence exposing a Unit value upon completion of the action, or an exception.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="action" /> or <paramref name="scheduler" /> is null.</exception>
- /// <remarks>
- /// <list type="bullet">
- /// <item>
- /// <description>The action is called immediately, not during the subscription of the resulting sequence.</description>
- /// </item>
- /// <item>
- /// <description>Multiple subscriptions to the resulting sequence can observe the action's outcome.</description>
- /// </item>
- /// </list>
- /// </remarks>
- public static IQbservable<Unit> Start(this IQbservableProvider provider, Expression<Action> action, IScheduler scheduler)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (action == null)
- throw new ArgumentNullException("action");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return provider.CreateQuery<Unit>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Start(default(IQbservableProvider), default(Expression<Action>), default(IScheduler))),
-#else
- (MethodInfo)MethodInfo.GetCurrentMethod(),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- action,
- Expression.Constant(scheduler, typeof(IScheduler))
- )
- );
- }
-
- /// <summary>
- /// Invokes the specified function asynchronously, surfacing the result through an observable sequence.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
- /// <param name="function">Function to run asynchronously.</param>
- /// <returns>An observable sequence exposing the function's result value, or an exception.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="function" /> is null.</exception>
- /// <remarks>
- /// <list type="bullet">
- /// <item>
- /// <description>The function is called immediately, not during the subscription of the resulting sequence.</description>
- /// </item>
- /// <item>
- /// <description>Multiple subscriptions to the resulting sequence can observe the function's result.</description>
- /// </item>
- /// </list>
- /// </remarks>
- public static IQbservable<TResult> Start<TResult>(this IQbservableProvider provider, Expression<Func<TResult>> function)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (function == null)
- throw new ArgumentNullException("function");
-
- return provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Start<TResult>(default(IQbservableProvider), default(Expression<Func<TResult>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TResult)),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- function
- )
- );
- }
-
- /// <summary>
- /// Invokes the specified function asynchronously on the specified scheduler, surfacing the result through an observable sequence
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
- /// <param name="function">Function to run asynchronously.</param>
- /// <param name="scheduler">Scheduler to run the function on.</param>
- /// <returns>An observable sequence exposing the function's result value, or an exception.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="function" /> or <paramref name="scheduler" /> is null.</exception>
- /// <remarks>
- /// <list type="bullet">
- /// <item>
- /// <description>The function is called immediately, not during the subscription of the resulting sequence.</description>
- /// </item>
- /// <item>
- /// <description>Multiple subscriptions to the resulting sequence can observe the function's result.</description>
- /// </item>
- /// </list>
- /// </remarks>
- public static IQbservable<TResult> Start<TResult>(this IQbservableProvider provider, Expression<Func<TResult>> function, IScheduler scheduler)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (function == null)
- throw new ArgumentNullException("function");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Start<TResult>(default(IQbservableProvider), default(Expression<Func<TResult>>), default(IScheduler))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TResult)),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- function,
- Expression.Constant(scheduler, typeof(IScheduler))
- )
- );
- }
-
-#if !NO_TPL
- /// <summary>
- /// Invokes the asynchronous action, surfacing the result through an observable sequence.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <param name="actionAsync">Asynchronous action to run.</param>
- /// <returns>An observable sequence exposing a Unit value upon completion of the action, or an exception.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="actionAsync" /> is null.</exception>
- /// <remarks>
- /// <list type="bullet">
- /// <item>
- /// <description>The action is started immediately, not during the subscription of the resulting sequence.</description>
- /// </item>
- /// <item>
- /// <description>Multiple subscriptions to the resulting sequence can observe the action's outcome.</description>
- /// </item>
- /// </list>
- /// </remarks>
- public static IQbservable<Unit> StartAsync(this IQbservableProvider provider, Expression<Func<Task>> actionAsync)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (actionAsync == null)
- throw new ArgumentNullException("actionAsync");
-
- return provider.CreateQuery<Unit>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.StartAsync(default(IQbservableProvider), default(Expression<Func<Task>>))),
-#else
- (MethodInfo)MethodInfo.GetCurrentMethod(),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- actionAsync
- )
- );
- }
-#endif
-
-#if !NO_TPL
- /// <summary>
- /// Invokes the asynchronous action, surfacing the result through an observable sequence.
- /// The CancellationToken is shared by all subscriptions on the resulting observable sequence. See the remarks section for more information.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <param name="actionAsync">Asynchronous action to run.</param>
- /// <returns>An observable sequence exposing a Unit value upon completion of the action, or an exception.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="actionAsync" /> is null.</exception>
- /// <remarks>
- /// <list type="bullet">
- /// <item>
- /// <description>The action is started immediately, not during the subscription of the resulting sequence.</description>
- /// </item>
- /// <item>
- /// <description>Multiple subscriptions to the resulting sequence can observe the action's outcome.</description>
- /// </item>
- /// <item>
- /// <description>
- /// If any subscription to the resulting sequence is disposed, the CancellationToken is set. The observer associated to the disposed
- /// subscription won't see the TaskCanceledException, but other observers will. You can protect against this using the Catch operator.
- /// Be careful when handing out the resulting sequence because of this behavior. The most common use is to have a single subscription
- /// to the resulting sequence, which controls the CancellationToken state. Alternatively, you can control subscription behavior using
- /// multicast operators.
- /// </description>
- /// </item>
- /// </list>
- /// </remarks>
- public static IQbservable<Unit> StartAsync(this IQbservableProvider provider, Expression<Func<CancellationToken, Task>> actionAsync)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (actionAsync == null)
- throw new ArgumentNullException("actionAsync");
-
- return provider.CreateQuery<Unit>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.StartAsync(default(IQbservableProvider), default(Expression<Func<CancellationToken, Task>>))),
-#else
- (MethodInfo)MethodInfo.GetCurrentMethod(),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- actionAsync
- )
- );
- }
-#endif
-
-#if !NO_TPL
- /// <summary>
- /// Invokes the asynchronous function, surfacing the result through an observable sequence.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TResult">The type of the result returned by the asynchronous function.</typeparam>
- /// <param name="functionAsync">Asynchronous function to run.</param>
- /// <returns>An observable sequence exposing the function's result value, or an exception.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="functionAsync" /> is null.</exception>
- /// <remarks>
- /// <list type="bullet">
- /// <item>
- /// <description>The function is started immediately, not during the subscription of the resulting sequence.</description>
- /// </item>
- /// <item>
- /// <description>Multiple subscriptions to the resulting sequence can observe the function's result.</description>
- /// </item>
- /// </list>
- /// </remarks>
- public static IQbservable<TResult> StartAsync<TResult>(this IQbservableProvider provider, Expression<Func<Task<TResult>>> functionAsync)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (functionAsync == null)
- throw new ArgumentNullException("functionAsync");
-
- return provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.StartAsync<TResult>(default(IQbservableProvider), default(Expression<Func<Task<TResult>>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TResult)),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- functionAsync
- )
- );
- }
-#endif
-
-#if !NO_TPL
- /// <summary>
- /// Invokes the asynchronous function, surfacing the result through an observable sequence.
- /// The CancellationToken is shared by all subscriptions on the resulting observable sequence. See the remarks section for more information.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TResult">The type of the result returned by the asynchronous function.</typeparam>
- /// <param name="functionAsync">Asynchronous function to run.</param>
- /// <returns>An observable sequence exposing the function's result value, or an exception.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="functionAsync" /> is null.</exception>
- /// <remarks>
- /// <list type="bullet">
- /// <item>
- /// <description>The function is started immediately, not during the subscription of the resulting sequence.</description>
- /// </item>
- /// <item>
- /// <description>Multiple subscriptions to the resulting sequence can observe the function's result.</description>
- /// </item>
- /// <item>
- /// <description>
- /// If any subscription to the resulting sequence is disposed, the CancellationToken is set. The observer associated to the disposed
- /// subscription won't see the TaskCanceledException, but other observers will. You can protect against this using the Catch operator.
- /// Be careful when handing out the resulting sequence because of this behavior. The most common use is to have a single subscription
- /// to the resulting sequence, which controls the CancellationToken state. Alternatively, you can control subscription behavior using
- /// multicast operators.
- /// </description>
- /// </item>
- /// </list>
- /// </remarks>
- public static IQbservable<TResult> StartAsync<TResult>(this IQbservableProvider provider, Expression<Func<CancellationToken, Task<TResult>>> functionAsync)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (functionAsync == null)
- throw new ArgumentNullException("functionAsync");
-
- return provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.StartAsync<TResult>(default(IQbservableProvider), default(Expression<Func<CancellationToken, Task<TResult>>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TResult)),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- functionAsync
- )
- );
- }
-#endif
-
- /// <summary>
- /// Prepends a sequence of values to an observable sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence to prepend values to.</param>
- /// <param name="scheduler">Scheduler to emit the prepended values on.</param>
- /// <param name="values">Values to prepend to the specified sequence.</param>
- /// <returns>The source sequence prepended with the specified values.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="scheduler" /> or <paramref name="values" /> is null.</exception>
- public static IQbservable<TSource> StartWith<TSource>(this IQbservable<TSource> source, IScheduler scheduler, params TSource[] values)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
- if (values == null)
- throw new ArgumentNullException("values");
-
- return source.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.StartWith<TSource>(default(IQbservable<TSource>), default(IScheduler), default(TSource[]))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- Expression.Constant(scheduler, typeof(IScheduler)),
- Expression.Constant(values, typeof(TSource[]))
- )
- );
- }
-
- /// <summary>
- /// Prepends a sequence of values to an observable sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence to prepend values to.</param>
- /// <param name="values">Values to prepend to the specified sequence.</param>
- /// <returns>The source sequence prepended with the specified values.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="values" /> is null.</exception>
- public static IQbservable<TSource> StartWith<TSource>(this IQbservable<TSource> source, params TSource[] values)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (values == null)
- throw new ArgumentNullException("values");
-
- return source.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.StartWith<TSource>(default(IQbservable<TSource>), default(TSource[]))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- Expression.Constant(values, typeof(TSource[]))
- )
- );
- }
-
- /// <summary>
- /// Wraps the source sequence in order to run its subscription and unsubscription logic on the specified synchronization context. This operation is not commonly used;
- /// see the remarks section for more information on the distinction between SubscribeOn and ObserveOn.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence.</param>
- /// <param name="context">Synchronization context to perform subscription and unsubscription actions on.</param>
- /// <returns>The source sequence whose subscriptions and unsubscriptions happen on the specified synchronization context.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="context" /> is null.</exception>
- /// <remarks>
- /// This only performs the side-effects of subscription and unsubscription on the specified synchronization context. In order to invoke observer
- /// callbacks on a synchronization context, use <see cref="M:System.Reactive.Linq.Observable.ObserveOn``1(System.IObservable{``0},System.Threading.SynchronizationContext)" />.
- /// </remarks>
- public static IQbservable<TSource> SubscribeOn<TSource>(this IQbservable<TSource> source, SynchronizationContext context)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (context == null)
- throw new ArgumentNullException("context");
-
- return source.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.SubscribeOn<TSource>(default(IQbservable<TSource>), default(SynchronizationContext))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- Expression.Constant(context, typeof(SynchronizationContext))
- )
- );
- }
-
- /// <summary>
- /// Wraps the source sequence in order to run its subscription and unsubscription logic on the specified scheduler. This operation is not commonly used;
- /// see the remarks section for more information on the distinction between SubscribeOn and ObserveOn.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence.</param>
- /// <param name="scheduler">Scheduler to perform subscription and unsubscription actions on.</param>
- /// <returns>The source sequence whose subscriptions and unsubscriptions happen on the specified scheduler.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="scheduler" /> is null.</exception>
- /// <remarks>
- /// This only performs the side-effects of subscription and unsubscription on the specified scheduler. In order to invoke observer
- /// callbacks on a scheduler, use <see cref="M:System.Reactive.Linq.Observable.ObserveOn``1(System.IObservable{``0},System.Reactive.Concurrency.IScheduler)" />.
- /// </remarks>
- public static IQbservable<TSource> SubscribeOn<TSource>(this IQbservable<TSource> source, IScheduler scheduler)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return source.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.SubscribeOn<TSource>(default(IQbservable<TSource>), default(IScheduler))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- Expression.Constant(scheduler, typeof(IScheduler))
- )
- );
- }
-
- /// <summary>
- /// Computes the sum of a sequence of <see cref="T:System.Decimal" /> values.
- /// </summary>
- /// <param name="source">A sequence of <see cref="T:System.Decimal" /> values to calculate the sum of.</param>
- /// <returns>An observable sequence containing a single element with the sum of the values in the source sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> is null.</exception>
- /// <exception cref="T:System.OverflowException">(Asynchronous) The sum of the elements in the source sequence is larger than <see cref="M:System.Decimal.MaxValue" />.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IQbservable<decimal> Sum(this IQbservable<decimal> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return source.Provider.CreateQuery<decimal>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Sum(default(IQbservable<decimal>))),
-#else
- (MethodInfo)MethodInfo.GetCurrentMethod(),
-#endif
- source.Expression
- )
- );
- }
-
- /// <summary>
- /// Computes the sum of a sequence of <see cref="T:System.Double" /> values.
- /// </summary>
- /// <param name="source">A sequence of <see cref="T:System.Double" /> values to calculate the sum of.</param>
- /// <returns>An observable sequence containing a single element with the sum of the values in the source sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IQbservable<double> Sum(this IQbservable<double> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return source.Provider.CreateQuery<double>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Sum(default(IQbservable<double>))),
-#else
- (MethodInfo)MethodInfo.GetCurrentMethod(),
-#endif
- source.Expression
- )
- );
- }
-
- /// <summary>
- /// Computes the sum of a sequence of <see cref="T:System.Int32" /> values.
- /// </summary>
- /// <param name="source">A sequence of <see cref="T:System.Int32" /> values to calculate the sum of.</param>
- /// <returns>An observable sequence containing a single element with the sum of the values in the source sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> is null.</exception>
- /// <exception cref="T:System.OverflowException">(Asynchronous) The sum of the elements in the source sequence is larger than <see cref="M:System.Int32.MaxValue" />.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IQbservable<int> Sum(this IQbservable<int> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return source.Provider.CreateQuery<int>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Sum(default(IQbservable<int>))),
-#else
- (MethodInfo)MethodInfo.GetCurrentMethod(),
-#endif
- source.Expression
- )
- );
- }
-
- /// <summary>
- /// Computes the sum of a sequence of <see cref="T:System.Int64" /> values.
- /// </summary>
- /// <param name="source">A sequence of <see cref="T:System.Int64" /> values to calculate the sum of.</param>
- /// <returns>An observable sequence containing a single element with the sum of the values in the source sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> is null.</exception>
- /// <exception cref="T:System.OverflowException">(Asynchronous) The sum of the elements in the source sequence is larger than <see cref="M:System.Int64.MaxValue" />.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IQbservable<long> Sum(this IQbservable<long> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return source.Provider.CreateQuery<long>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Sum(default(IQbservable<long>))),
-#else
- (MethodInfo)MethodInfo.GetCurrentMethod(),
-#endif
- source.Expression
- )
- );
- }
-
- /// <summary>
- /// Computes the sum of a sequence of nullable <see cref="T:System.Decimal" /> values.
- /// </summary>
- /// <param name="source">A sequence of nullable <see cref="T:System.Decimal" /> values to calculate the sum of.</param>
- /// <returns>An observable sequence containing a single element with the sum of the values in the source sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> is null.</exception>
- /// <exception cref="T:System.OverflowException">(Asynchronous) The sum of the elements in the source sequence is larger than <see cref="M:System.Decimal.MaxValue" />.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IQbservable<decimal?> Sum(this IQbservable<decimal?> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return source.Provider.CreateQuery<decimal?>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Sum(default(IQbservable<decimal?>))),
-#else
- (MethodInfo)MethodInfo.GetCurrentMethod(),
-#endif
- source.Expression
- )
- );
- }
-
- /// <summary>
- /// Computes the sum of a sequence of nullable <see cref="T:System.Double" /> values.
- /// </summary>
- /// <param name="source">A sequence of nullable <see cref="T:System.Double" /> values to calculate the sum of.</param>
- /// <returns>An observable sequence containing a single element with the sum of the values in the source sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IQbservable<double?> Sum(this IQbservable<double?> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return source.Provider.CreateQuery<double?>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Sum(default(IQbservable<double?>))),
-#else
- (MethodInfo)MethodInfo.GetCurrentMethod(),
-#endif
- source.Expression
- )
- );
- }
-
- /// <summary>
- /// Computes the sum of a sequence of nullable <see cref="T:System.Int32" /> values.
- /// </summary>
- /// <param name="source">A sequence of nullable <see cref="T:System.Int32" /> values to calculate the sum of.</param>
- /// <returns>An observable sequence containing a single element with the sum of the values in the source sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> is null.</exception>
- /// <exception cref="T:System.OverflowException">(Asynchronous) The sum of the elements in the source sequence is larger than <see cref="M:System.Int32.MaxValue" />.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IQbservable<int?> Sum(this IQbservable<int?> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return source.Provider.CreateQuery<int?>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Sum(default(IQbservable<int?>))),
-#else
- (MethodInfo)MethodInfo.GetCurrentMethod(),
-#endif
- source.Expression
- )
- );
- }
-
- /// <summary>
- /// Computes the sum of a sequence of nullable <see cref="T:System.Int64" /> values.
- /// </summary>
- /// <param name="source">A sequence of nullable <see cref="T:System.Int64" /> values to calculate the sum of.</param>
- /// <returns>An observable sequence containing a single element with the sum of the values in the source sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> is null.</exception>
- /// <exception cref="T:System.OverflowException">(Asynchronous) The sum of the elements in the source sequence is larger than <see cref="M:System.Int64.MaxValue" />.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IQbservable<long?> Sum(this IQbservable<long?> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return source.Provider.CreateQuery<long?>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Sum(default(IQbservable<long?>))),
-#else
- (MethodInfo)MethodInfo.GetCurrentMethod(),
-#endif
- source.Expression
- )
- );
- }
-
- /// <summary>
- /// Computes the sum of a sequence of nullable <see cref="T:System.Single" /> values.
- /// </summary>
- /// <param name="source">A sequence of nullable <see cref="T:System.Single" /> values to calculate the sum of.</param>
- /// <returns>An observable sequence containing a single element with the sum of the values in the source sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IQbservable<float?> Sum(this IQbservable<float?> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return source.Provider.CreateQuery<float?>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Sum(default(IQbservable<float?>))),
-#else
- (MethodInfo)MethodInfo.GetCurrentMethod(),
-#endif
- source.Expression
- )
- );
- }
-
- /// <summary>
- /// Computes the sum of a sequence of <see cref="T:System.Single" /> values.
- /// </summary>
- /// <param name="source">A sequence of <see cref="T:System.Single" /> values to calculate the sum of.</param>
- /// <returns>An observable sequence containing a single element with the sum of the values in the source sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IQbservable<float> Sum(this IQbservable<float> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return source.Provider.CreateQuery<float>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Sum(default(IQbservable<float>))),
-#else
- (MethodInfo)MethodInfo.GetCurrentMethod(),
-#endif
- source.Expression
- )
- );
- }
-
- /// <summary>
- /// Computes the sum of a sequence of nullable <see cref="T:System.Double" /> values that are obtained by invoking a transform function on each element of the input sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values that are used to calculate a sum.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the sum of the values in the source sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IQbservable<double?> Sum<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, double?>> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return source.Provider.CreateQuery<double?>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Sum<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, double?>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- selector
- )
- );
- }
-
- /// <summary>
- /// Computes the sum of a sequence of nullable <see cref="T:System.Single" /> values that are obtained by invoking a transform function on each element of the input sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values that are used to calculate a sum.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the sum of the values in the source sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IQbservable<float?> Sum<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, float?>> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return source.Provider.CreateQuery<float?>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Sum<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, float?>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- selector
- )
- );
- }
-
- /// <summary>
- /// Computes the sum of a sequence of nullable <see cref="T:System.Decimal" /> values that are obtained by invoking a transform function on each element of the input sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values that are used to calculate a sum.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the sum of the values in the source sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
- /// <exception cref="T:System.OverflowException">(Asynchronous) The sum of the projected values for the elements in the source sequence is larger than <see cref="M:System.Decimal.MaxValue" />.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IQbservable<decimal?> Sum<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, decimal?>> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return source.Provider.CreateQuery<decimal?>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Sum<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, decimal?>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- selector
- )
- );
- }
-
- /// <summary>
- /// Computes the sum of a sequence of nullable <see cref="T:System.Int32" /> values that are obtained by invoking a transform function on each element of the input sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values that are used to calculate a sum.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the sum of the values in the source sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
- /// <exception cref="T:System.OverflowException">(Asynchronous) The sum of the projected values for the elements in the source sequence is larger than <see cref="M:System.Int32.MaxValue" />.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IQbservable<int?> Sum<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, int?>> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return source.Provider.CreateQuery<int?>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Sum<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, int?>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- selector
- )
- );
- }
-
- /// <summary>
- /// Computes the sum of a sequence of nullable <see cref="T:System.Int64" /> values that are obtained by invoking a transform function on each element of the input sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values that are used to calculate a sum.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the sum of the values in the source sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
- /// <exception cref="T:System.OverflowException">(Asynchronous) The sum of the projected values for the elements in the source sequence is larger than <see cref="M:System.Int64.MaxValue" />.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IQbservable<long?> Sum<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, long?>> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return source.Provider.CreateQuery<long?>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Sum<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, long?>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- selector
- )
- );
- }
-
- /// <summary>
- /// Computes the sum of a sequence of <see cref="T:System.Double" /> values that are obtained by invoking a transform function on each element of the input sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values that are used to calculate a sum.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the sum of the values in the source sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IQbservable<double> Sum<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, double>> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return source.Provider.CreateQuery<double>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Sum<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, double>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- selector
- )
- );
- }
-
- /// <summary>
- /// Computes the sum of a sequence of <see cref="T:System.Single" /> values that are obtained by invoking a transform function on each element of the input sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values that are used to calculate a sum.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the sum of the values in the source sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IQbservable<float> Sum<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, float>> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return source.Provider.CreateQuery<float>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Sum<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, float>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- selector
- )
- );
- }
-
- /// <summary>
- /// Computes the sum of a sequence of <see cref="T:System.Decimal" /> values that are obtained by invoking a transform function on each element of the input sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values that are used to calculate a sum.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the sum of the values in the source sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
- /// <exception cref="T:System.OverflowException">(Asynchronous) The sum of the projected values for the elements in the source sequence is larger than <see cref="M:System.Decimal.MaxValue" />.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IQbservable<decimal> Sum<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, decimal>> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return source.Provider.CreateQuery<decimal>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Sum<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, decimal>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- selector
- )
- );
- }
-
- /// <summary>
- /// Computes the sum of a sequence of <see cref="T:System.Int32" /> values that are obtained by invoking a transform function on each element of the input sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values that are used to calculate a sum.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the sum of the values in the source sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
- /// <exception cref="T:System.OverflowException">(Asynchronous) The sum of the projected values for the elements in the source sequence is larger than <see cref="M:System.Int32.MaxValue" />.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IQbservable<int> Sum<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, int>> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return source.Provider.CreateQuery<int>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Sum<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, int>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- selector
- )
- );
- }
-
- /// <summary>
- /// Computes the sum of a sequence of <see cref="T:System.Int64" /> values that are obtained by invoking a transform function on each element of the input sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence of values that are used to calculate a sum.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence containing a single element with the sum of the values in the source sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
- /// <exception cref="T:System.OverflowException">(Asynchronous) The sum of the projected values for the elements in the source sequence is larger than <see cref="M:System.Int64.MaxValue" />.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IQbservable<long> Sum<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, long>> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return source.Provider.CreateQuery<long>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Sum<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, long>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- selector
- )
- );
- }
-
- /// <summary>
- /// Switches between the inner observable sequences such that the resulting sequence always produces elements from the most recently received inner observable sequence.
- /// Each time a new inner observable sequence is received, the previous inner observable sequence is unsubscribed from.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequences.</typeparam>
- /// <param name="sources">Observable sequence of inner observable sequences.</param>
- /// <returns>The observable sequence that at any point in time produces the elements of the most recent inner observable sequence that has been received.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="sources" /> is null.</exception>
- public static IQbservable<TSource> Switch<TSource>(this IQbservable<IObservable<TSource>> sources)
- {
- if (sources == null)
- throw new ArgumentNullException("sources");
-
- return sources.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Switch<TSource>(default(IQbservable<IObservable<TSource>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- sources.Expression
- )
- );
- }
-
-#if !NO_TPL
- /// <summary>
- /// Switches between the tasks such that the resulting sequence always produces results from the most recently received task.
- /// Each time a new task is received, the previous task's result is ignored.
- /// </summary>
- /// <typeparam name="TSource">The type of the results produced by the source tasks.</typeparam>
- /// <param name="sources">Observable sequence of tasks.</param>
- /// <returns>The observable sequence that at any point in time produces the result of the most recent task that has been received.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="sources" /> is null.</exception>
- /// <remarks>If the tasks support cancellation, consider manual conversion of the tasks using <see cref="M:System.Reactive.Linq.Observable.FromAsync``1(System.Func{System.Threading.CancellationToken,System.Threading.Tasks.Task{``0}})" />, followed by a switch operation using <see cref="M:System.Reactive.Linq.Observable.Switch``1(System.IObservable{System.IObservable{``0}})" />.</remarks>
- public static IQbservable<TSource> Switch<TSource>(this IQbservable<Task<TSource>> sources)
- {
- if (sources == null)
- throw new ArgumentNullException("sources");
-
- return sources.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Switch<TSource>(default(IQbservable<Task<TSource>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- sources.Expression
- )
- );
- }
-#endif
-
- /// <summary>
- /// Synchronizes the observable sequence such that observer notifications cannot be delivered concurrently.
- /// This overload is useful to "fix" an observable sequence that exhibits concurrent callbacks on individual observers, which is invalid behavior for the query processor.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence.</param>
- /// <returns>The source sequence whose outgoing calls to observers are synchronized.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> is null.</exception>
- /// <remarks>
- /// It's invalid behavior - according to the observer grammar - for a sequence to exhibit concurrent callbacks on a given observer.
- /// This operator can be used to "fix" a source that doesn't conform to this rule.
- /// </remarks>
- public static IQbservable<TSource> Synchronize<TSource>(this IQbservable<TSource> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return source.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Synchronize<TSource>(default(IQbservable<TSource>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression
- )
- );
- }
-
- /// <summary>
- /// Synchronizes the observable sequence such that observer notifications cannot be delivered concurrently, using the specified gate object.
- /// This overload is useful when writing n-ary query operators, in order to prevent concurrent callbacks from different sources by synchronizing on a common gate object.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence.</param>
- /// <param name="gate">Gate object to synchronize each observer call on.</param>
- /// <returns>The source sequence whose outgoing calls to observers are synchronized on the given gate object.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="gate" /> is null.</exception>
- public static IQbservable<TSource> Synchronize<TSource>(this IQbservable<TSource> source, object gate)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (gate == null)
- throw new ArgumentNullException("gate");
-
- return source.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Synchronize<TSource>(default(IQbservable<TSource>), default(object))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- Expression.Constant(gate, typeof(object))
- )
- );
- }
-
- /// <summary>
- /// Returns a specified number of contiguous elements from the start of an observable sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">The sequence to take elements from.</param>
- /// <param name="count">The number of elements to return.</param>
- /// <returns>An observable sequence that contains the specified number of elements from the start of the input sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> is null.</exception>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// <paramref name="count" /> is less than zero.</exception>
- public static IQbservable<TSource> Take<TSource>(this IQbservable<TSource> source, int count)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return source.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Take<TSource>(default(IQbservable<TSource>), default(int))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- Expression.Constant(count, typeof(int))
- )
- );
- }
-
- /// <summary>
- /// Returns a specified number of contiguous elements from the start of an observable sequence, using the specified scheduler for the edge case of Take(0).
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">The sequence to take elements from.</param>
- /// <param name="count">The number of elements to return.</param>
- /// <param name="scheduler">Scheduler used to produce an OnCompleted message in case <paramref name="count">count</paramref> is set to 0.</param>
- /// <returns>An observable sequence that contains the specified number of elements from the start of the input sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="scheduler" /> is null.</exception>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// <paramref name="count" /> is less than zero.</exception>
- public static IQbservable<TSource> Take<TSource>(this IQbservable<TSource> source, int count, IScheduler scheduler)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return source.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Take<TSource>(default(IQbservable<TSource>), default(int), default(IScheduler))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- Expression.Constant(count, typeof(int)),
- Expression.Constant(scheduler, typeof(IScheduler))
- )
- );
- }
-
- /// <summary>
- /// Takes elements for the specified duration from the start of the observable source sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence to take elements from.</param>
- /// <param name="duration">Duration for taking elements from the start of the sequence.</param>
- /// <returns>An observable sequence with the elements taken during the specified duration from the start of the source sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> is null.</exception>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// <paramref name="duration" /> is less than TimeSpan.Zero.</exception>
- /// <remarks>
- /// Specifying a TimeSpan.Zero value for <paramref name="duration" /> doesn't guarantee an empty sequence will be returned. This is a side-effect
- /// of the asynchrony introduced by the scheduler, where the action that stops forwarding callbacks from the source sequence may not execute
- /// immediately, despite the TimeSpan.Zero due time.
- /// </remarks>
- public static IQbservable<TSource> Take<TSource>(this IQbservable<TSource> source, TimeSpan duration)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return source.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Take<TSource>(default(IQbservable<TSource>), default(TimeSpan))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- Expression.Constant(duration, typeof(TimeSpan))
- )
- );
- }
-
- /// <summary>
- /// Takes elements for the specified duration from the start of the observable source sequence, using the specified scheduler to run timers.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence to take elements from.</param>
- /// <param name="duration">Duration for taking elements from the start of the sequence.</param>
- /// <param name="scheduler">Scheduler to run the timer on.</param>
- /// <returns>An observable sequence with the elements taken during the specified duration from the start of the source sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="scheduler" /> is null.</exception>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// <paramref name="duration" /> is less than TimeSpan.Zero.</exception>
- /// <remarks>
- /// Specifying a TimeSpan.Zero value for <paramref name="duration" /> doesn't guarantee an empty sequence will be returned. This is a side-effect
- /// of the asynchrony introduced by the scheduler, where the action that stops forwarding callbacks from the source sequence may not execute
- /// immediately, despite the TimeSpan.Zero due time.
- /// </remarks>
- public static IQbservable<TSource> Take<TSource>(this IQbservable<TSource> source, TimeSpan duration, IScheduler scheduler)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return source.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Take<TSource>(default(IQbservable<TSource>), default(TimeSpan), default(IScheduler))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- Expression.Constant(duration, typeof(TimeSpan)),
- Expression.Constant(scheduler, typeof(IScheduler))
- )
- );
- }
-
- /// <summary>
- /// Returns a specified number of contiguous elements from the end of an observable sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence.</param>
- /// <param name="count">Number of elements to take from the end of the source sequence.</param>
- /// <returns>An observable sequence containing the specified number of elements from the end of the source sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> is null.</exception>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// <paramref name="count" /> is less than zero.</exception>
- /// <remarks>
- /// This operator accumulates a buffer with a length enough to store elements <paramref name="count" /> elements. Upon completion of
- /// the source sequence, this buffer is drained on the result sequence. This causes the elements to be delayed.
- /// </remarks>
- public static IQbservable<TSource> TakeLast<TSource>(this IQbservable<TSource> source, int count)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return source.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.TakeLast<TSource>(default(IQbservable<TSource>), default(int))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- Expression.Constant(count, typeof(int))
- )
- );
- }
-
- /// <summary>
- /// Returns a specified number of contiguous elements from the end of an observable sequence, using the specified scheduler to drain the queue.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence.</param>
- /// <param name="count">Number of elements to take from the end of the source sequence.</param>
- /// <param name="scheduler">Scheduler used to drain the queue upon completion of the source sequence.</param>
- /// <returns>An observable sequence containing the specified number of elements from the end of the source sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="scheduler" /> is null.</exception>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// <paramref name="count" /> is less than zero.</exception>
- /// <remarks>
- /// This operator accumulates a buffer with a length enough to store elements <paramref name="count" /> elements. Upon completion of
- /// the source sequence, this buffer is drained on the result sequence. This causes the elements to be delayed.
- /// </remarks>
- public static IQbservable<TSource> TakeLast<TSource>(this IQbservable<TSource> source, int count, IScheduler scheduler)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return source.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.TakeLast<TSource>(default(IQbservable<TSource>), default(int), default(IScheduler))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- Expression.Constant(count, typeof(int)),
- Expression.Constant(scheduler, typeof(IScheduler))
- )
- );
- }
-
- /// <summary>
- /// Returns elements within the specified duration from the end of the observable source sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence to take elements from.</param>
- /// <param name="duration">Duration for taking elements from the end of the sequence.</param>
- /// <returns>An observable sequence with the elements taken during the specified duration from the end of the source sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> is null.</exception>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// <paramref name="duration" /> is less than TimeSpan.Zero.</exception>
- /// <remarks>
- /// This operator accumulates a buffer with a length enough to store elements for any <paramref name="duration" /> window during the lifetime of
- /// the source sequence. Upon completion of the source sequence, this buffer is drained on the result sequence. This causes the result elements
- /// to be delayed with <paramref name="duration" />.
- /// </remarks>
- public static IQbservable<TSource> TakeLast<TSource>(this IQbservable<TSource> source, TimeSpan duration)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return source.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.TakeLast<TSource>(default(IQbservable<TSource>), default(TimeSpan))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- Expression.Constant(duration, typeof(TimeSpan))
- )
- );
- }
-
- /// <summary>
- /// Returns elements within the specified duration from the end of the observable source sequence, using the specified scheduler to run timers.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence to take elements from.</param>
- /// <param name="duration">Duration for taking elements from the end of the sequence.</param>
- /// <param name="scheduler">Scheduler to run the timer on.</param>
- /// <returns>An observable sequence with the elements taken during the specified duration from the end of the source sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="scheduler" /> is null.</exception>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// <paramref name="duration" /> is less than TimeSpan.Zero.</exception>
- /// <remarks>
- /// This operator accumulates a buffer with a length enough to store elements for any <paramref name="duration" /> window during the lifetime of
- /// the source sequence. Upon completion of the source sequence, this buffer is drained on the result sequence. This causes the result elements
- /// to be delayed with <paramref name="duration" />.
- /// </remarks>
- public static IQbservable<TSource> TakeLast<TSource>(this IQbservable<TSource> source, TimeSpan duration, IScheduler scheduler)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return source.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.TakeLast<TSource>(default(IQbservable<TSource>), default(TimeSpan), default(IScheduler))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- Expression.Constant(duration, typeof(TimeSpan)),
- Expression.Constant(scheduler, typeof(IScheduler))
- )
- );
- }
-
- /// <summary>
- /// Returns elements within the specified duration from the end of the observable source sequence, using the specified schedulers to run timers and to drain the collected elements.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence to take elements from.</param>
- /// <param name="duration">Duration for taking elements from the end of the sequence.</param>
- /// <param name="timerScheduler">Scheduler to run the timer on.</param>
- /// <param name="loopScheduler">Scheduler to drain the collected elements.</param>
- /// <returns>An observable sequence with the elements taken during the specified duration from the end of the source sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="timerScheduler" /> or <paramref name="loopScheduler" /> is null.</exception>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// <paramref name="duration" /> is less than TimeSpan.Zero.</exception>
- /// <remarks>
- /// This operator accumulates a buffer with a length enough to store elements for any <paramref name="duration" /> window during the lifetime of
- /// the source sequence. Upon completion of the source sequence, this buffer is drained on the result sequence. This causes the result elements
- /// to be delayed with <paramref name="duration" />.
- /// </remarks>
- public static IQbservable<TSource> TakeLast<TSource>(this IQbservable<TSource> source, TimeSpan duration, IScheduler timerScheduler, IScheduler loopScheduler)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (timerScheduler == null)
- throw new ArgumentNullException("timerScheduler");
- if (loopScheduler == null)
- throw new ArgumentNullException("loopScheduler");
-
- return source.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.TakeLast<TSource>(default(IQbservable<TSource>), default(TimeSpan), default(IScheduler), default(IScheduler))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- Expression.Constant(duration, typeof(TimeSpan)),
- Expression.Constant(timerScheduler, typeof(IScheduler)),
- Expression.Constant(loopScheduler, typeof(IScheduler))
- )
- );
- }
-
- /// <summary>
- /// Returns a list with the specified number of contiguous elements from the end of an observable sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence.</param>
- /// <param name="count">Number of elements to take from the end of the source sequence.</param>
- /// <returns>An observable sequence containing a single list with the specified number of elements from the end of the source sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> is null.</exception>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// <paramref name="count" /> is less than zero.</exception>
- /// <remarks>
- /// This operator accumulates a buffer with a length enough to store <paramref name="count" /> elements. Upon completion of the
- /// source sequence, this buffer is produced on the result sequence.
- /// </remarks>
- public static IQbservable<IList<TSource>> TakeLastBuffer<TSource>(this IQbservable<TSource> source, int count)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return source.Provider.CreateQuery<IList<TSource>>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.TakeLastBuffer<TSource>(default(IQbservable<TSource>), default(int))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- Expression.Constant(count, typeof(int))
- )
- );
- }
-
- /// <summary>
- /// Returns a list with the elements within the specified duration from the end of the observable source sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence to take elements from.</param>
- /// <param name="duration">Duration for taking elements from the end of the sequence.</param>
- /// <returns>An observable sequence containing a single list with the elements taken during the specified duration from the end of the source sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> is null.</exception>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// <paramref name="duration" /> is less than TimeSpan.Zero.</exception>
- /// <remarks>
- /// This operator accumulates a buffer with a length enough to store elements for any <paramref name="duration" /> window during the lifetime of
- /// the source sequence. Upon completion of the source sequence, this buffer is produced on the result sequence.
- /// </remarks>
- public static IQbservable<IList<TSource>> TakeLastBuffer<TSource>(this IQbservable<TSource> source, TimeSpan duration)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return source.Provider.CreateQuery<IList<TSource>>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.TakeLastBuffer<TSource>(default(IQbservable<TSource>), default(TimeSpan))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- Expression.Constant(duration, typeof(TimeSpan))
- )
- );
- }
-
- /// <summary>
- /// Returns a list with the elements within the specified duration from the end of the observable source sequence, using the specified scheduler to run timers.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence to take elements from.</param>
- /// <param name="duration">Duration for taking elements from the end of the sequence.</param>
- /// <param name="scheduler">Scheduler to run the timer on.</param>
- /// <returns>An observable sequence containing a single list with the elements taken during the specified duration from the end of the source sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="scheduler" /> is null.</exception>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// <paramref name="duration" /> is less than TimeSpan.Zero.</exception>
- /// <remarks>
- /// This operator accumulates a buffer with a length enough to store elements for any <paramref name="duration" /> window during the lifetime of
- /// the source sequence. Upon completion of the source sequence, this buffer is produced on the result sequence.
- /// </remarks>
- public static IQbservable<IList<TSource>> TakeLastBuffer<TSource>(this IQbservable<TSource> source, TimeSpan duration, IScheduler scheduler)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return source.Provider.CreateQuery<IList<TSource>>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.TakeLastBuffer<TSource>(default(IQbservable<TSource>), default(TimeSpan), default(IScheduler))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- Expression.Constant(duration, typeof(TimeSpan)),
- Expression.Constant(scheduler, typeof(IScheduler))
- )
- );
- }
-
- /// <summary>
- /// Takes elements for the specified duration until the specified end time.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence to take elements from.</param>
- /// <param name="endTime">Time to stop taking elements from the source sequence. If this value is less than or equal to DateTimeOffset.UtcNow, the result stream will complete immediately.</param>
- /// <returns>An observable sequence with the elements taken until the specified end time.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> is null.</exception>
- public static IQbservable<TSource> TakeUntil<TSource>(this IQbservable<TSource> source, DateTimeOffset endTime)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return source.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.TakeUntil<TSource>(default(IQbservable<TSource>), default(DateTimeOffset))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- Expression.Constant(endTime, typeof(DateTimeOffset))
- )
- );
- }
-
- /// <summary>
- /// Takes elements for the specified duration until the specified end time, using the specified scheduler to run timers.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence to take elements from.</param>
- /// <param name="endTime">Time to stop taking elements from the source sequence. If this value is less than or equal to DateTimeOffset.UtcNow, the result stream will complete immediately.</param>
- /// <param name="scheduler">Scheduler to run the timer on.</param>
- /// <returns>An observable sequence with the elements taken until the specified end time.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="scheduler" /> is null.</exception>
- public static IQbservable<TSource> TakeUntil<TSource>(this IQbservable<TSource> source, DateTimeOffset endTime, IScheduler scheduler)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return source.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.TakeUntil<TSource>(default(IQbservable<TSource>), default(DateTimeOffset), default(IScheduler))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- Expression.Constant(endTime, typeof(DateTimeOffset)),
- Expression.Constant(scheduler, typeof(IScheduler))
- )
- );
- }
-
- /// <summary>
- /// Returns the elements from the source observable sequence until the other observable sequence produces an element.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TOther">The type of the elements in the other sequence that indicates the end of take behavior.</typeparam>
- /// <param name="source">Source sequence to propagate elements for.</param>
- /// <param name="other">Observable sequence that terminates propagation of elements of the source sequence.</param>
- /// <returns>An observable sequence containing the elements of the source sequence up to the point the other sequence interrupted further propagation.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="other" /> is null.</exception>
- public static IQbservable<TSource> TakeUntil<TSource, TOther>(this IQbservable<TSource> source, IObservable<TOther> other)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (other == null)
- throw new ArgumentNullException("other");
-
- return source.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.TakeUntil<TSource, TOther>(default(IQbservable<TSource>), default(IObservable<TOther>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TOther)),
-#endif
- source.Expression,
- GetSourceExpression(other)
- )
- );
- }
-
- /// <summary>
- /// Returns elements from an observable sequence as long as a specified condition is true.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence to return elements from.</param>
- /// <param name="predicate">A function to test each element for a condition.</param>
- /// <returns>An observable sequence that contains the elements from the input sequence that occur before the element at which the test no longer passes.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="predicate" /> is null.</exception>
- public static IQbservable<TSource> TakeWhile<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, bool>> predicate)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (predicate == null)
- throw new ArgumentNullException("predicate");
-
- return source.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.TakeWhile<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, bool>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- predicate
- )
- );
- }
-
- /// <summary>
- /// Returns elements from an observable sequence as long as a specified condition is true.
- /// The element's index is used in the logic of the predicate function.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">A sequence to return elements from.</param>
- /// <param name="predicate">A function to test each element for a condition; the second parameter of the function represents the index of the source element.</param>
- /// <returns>An observable sequence that contains the elements from the input sequence that occur before the element at which the test no longer passes.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="predicate" /> is null.</exception>
- public static IQbservable<TSource> TakeWhile<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, int, bool>> predicate)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (predicate == null)
- throw new ArgumentNullException("predicate");
-
- return source.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.TakeWhile<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, int, bool>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- predicate
- )
- );
- }
-
- /// <summary>
- /// Ignores elements from an observable sequence which are followed by another element within a specified relative time duration.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence to throttle.</param>
- /// <param name="dueTime">Throttling duration for each element.</param>
- /// <returns>The throttled sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> is null.</exception>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// <paramref name="dueTime" /> is less than TimeSpan.Zero.</exception>
- /// <remarks>
- /// <para>
- /// This operator throttles the source sequence by holding on to each element for the duration specified in <paramref name="dueTime" />. If another
- /// element is produced within this time window, the element is dropped and a new timer is started for the current element, repeating this whole
- /// process. For streams that never have gaps larger than or equal to <paramref name="dueTime" /> between elements, the resulting stream won't
- /// produce any elements. In order to reduce the volume of a stream whilst guaranteeing the periodic production of elements, consider using the
- /// Observable.Sample set of operators.
- /// </para>
- /// <para>
- /// Specifying a TimeSpan.Zero value for <paramref name="dueTime" /> is not recommended but supported, causing throttling timers to be scheduled
- /// that are due immediately. However, this doesn't guarantee all elements will be retained in the result sequence. This is a side-effect of the
- /// asynchrony introduced by the scheduler, where the action to forward the current element may not execute immediately, despite the TimeSpan.Zero
- /// due time. In such cases, the next element may arrive before the scheduler gets a chance to run the throttling action.
- /// </para>
- /// </remarks>
- public static IQbservable<TSource> Throttle<TSource>(this IQbservable<TSource> source, TimeSpan dueTime)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return source.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Throttle<TSource>(default(IQbservable<TSource>), default(TimeSpan))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- Expression.Constant(dueTime, typeof(TimeSpan))
- )
- );
- }
-
- /// <summary>
- /// Ignores elements from an observable sequence which are followed by another element within a specified relative time duration, using the specified scheduler to run throttling timers.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence to throttle.</param>
- /// <param name="dueTime">Throttling duration for each element.</param>
- /// <param name="scheduler">Scheduler to run the throttle timers on.</param>
- /// <returns>The throttled sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="scheduler" /> is null.</exception>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// <paramref name="dueTime" /> is less than TimeSpan.Zero.</exception>
- /// <remarks>
- /// <para>
- /// This operator throttles the source sequence by holding on to each element for the duration specified in <paramref name="dueTime" />. If another
- /// element is produced within this time window, the element is dropped and a new timer is started for the current element, repeating this whole
- /// process. For streams that never have gaps larger than or equal to <paramref name="dueTime" /> between elements, the resulting stream won't
- /// produce any elements. In order to reduce the volume of a stream whilst guaranteeing the periodic production of elements, consider using the
- /// Observable.Sample set of operators.
- /// </para>
- /// <para>
- /// Specifying a TimeSpan.Zero value for <paramref name="dueTime" /> is not recommended but supported, causing throttling timers to be scheduled
- /// that are due immediately. However, this doesn't guarantee all elements will be retained in the result sequence. This is a side-effect of the
- /// asynchrony introduced by the scheduler, where the action to forward the current element may not execute immediately, despite the TimeSpan.Zero
- /// due time. In such cases, the next element may arrive before the scheduler gets a chance to run the throttling action.
- /// </para>
- /// </remarks>
- public static IQbservable<TSource> Throttle<TSource>(this IQbservable<TSource> source, TimeSpan dueTime, IScheduler scheduler)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return source.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Throttle<TSource>(default(IQbservable<TSource>), default(TimeSpan), default(IScheduler))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- Expression.Constant(dueTime, typeof(TimeSpan)),
- Expression.Constant(scheduler, typeof(IScheduler))
- )
- );
- }
-
- /// <summary>
- /// Ignores elements from an observable sequence which are followed by another value within a computed throttle duration.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TThrottle">The type of the elements in the throttle sequences selected for each element in the source sequence.</typeparam>
- /// <param name="source">Source sequence to throttle.</param>
- /// <param name="throttleDurationSelector">Selector function to retrieve a sequence indicating the throttle duration for each given element.</param>
- /// <returns>The throttled sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="throttleDurationSelector" /> is null.</exception>
- /// <remarks>
- /// This operator throttles the source sequence by holding on to each element for the duration denoted by <paramref name="throttleDurationSelector" />.
- /// If another element is produced within this time window, the element is dropped and a new timer is started for the current element, repeating this
- /// whole process. For streams where the duration computed by applying the <paramref name="throttleDurationSelector" /> to each element overlaps with
- /// the occurrence of the successor element, the resulting stream won't produce any elements. In order to reduce the volume of a stream whilst
- /// guaranteeing the periodic production of elements, consider using the Observable.Sample set of operators.
- /// </remarks>
- public static IQbservable<TSource> Throttle<TSource, TThrottle>(this IQbservable<TSource> source, Expression<Func<TSource, IObservable<TThrottle>>> throttleDurationSelector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (throttleDurationSelector == null)
- throw new ArgumentNullException("throttleDurationSelector");
-
- return source.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Throttle<TSource, TThrottle>(default(IQbservable<TSource>), default(Expression<Func<TSource, IObservable<TThrottle>>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TThrottle)),
-#endif
- source.Expression,
- throttleDurationSelector
- )
- );
- }
-
- /// <summary>
- /// Returns an observable sequence that terminates with an exception.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TResult">The type used for the IObservable&lt;T&gt; type parameter of the resulting sequence.</typeparam>
- /// <param name="exception">Exception object used for the sequence's termination.</param>
- /// <returns>The observable sequence that terminates exceptionally with the specified exception object.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="exception" /> is null.</exception>
- public static IQbservable<TResult> Throw<TResult>(this IQbservableProvider provider, Exception exception)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (exception == null)
- throw new ArgumentNullException("exception");
-
- return provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Throw<TResult>(default(IQbservableProvider), default(Exception))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TResult)),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- Expression.Constant(exception, typeof(Exception))
- )
- );
- }
-
- /// <summary>
- /// Returns an observable sequence that terminates with an exception, using the specified scheduler to send out the single OnError message.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TResult">The type used for the IObservable&lt;T&gt; type parameter of the resulting sequence.</typeparam>
- /// <param name="exception">Exception object used for the sequence's termination.</param>
- /// <param name="scheduler">Scheduler to send the exceptional termination call on.</param>
- /// <returns>The observable sequence that terminates exceptionally with the specified exception object.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="exception" /> or <paramref name="scheduler" /> is null.</exception>
- public static IQbservable<TResult> Throw<TResult>(this IQbservableProvider provider, Exception exception, IScheduler scheduler)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (exception == null)
- throw new ArgumentNullException("exception");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Throw<TResult>(default(IQbservableProvider), default(Exception), default(IScheduler))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TResult)),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- Expression.Constant(exception, typeof(Exception)),
- Expression.Constant(scheduler, typeof(IScheduler))
- )
- );
- }
-
- /// <summary>
- /// Returns an observable sequence that terminates with an exception, using the specified scheduler to send out the single OnError message.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TResult">The type used for the IObservable&lt;T&gt; type parameter of the resulting sequence.</typeparam>
- /// <param name="exception">Exception object used for the sequence's termination.</param>
- /// <param name="scheduler">Scheduler to send the exceptional termination call on.</param>
- /// <param name="witness">Object solely used to infer the type of the <typeparamref name="TResult" /> type parameter. This parameter is typically used when creating a sequence of anonymously typed elements.</param>
- /// <returns>The observable sequence that terminates exceptionally with the specified exception object.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="exception" /> or <paramref name="scheduler" /> is null.</exception>
- public static IQbservable<TResult> Throw<TResult>(this IQbservableProvider provider, Exception exception, IScheduler scheduler, TResult witness)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (exception == null)
- throw new ArgumentNullException("exception");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Throw<TResult>(default(IQbservableProvider), default(Exception), default(IScheduler), default(TResult))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TResult)),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- Expression.Constant(exception, typeof(Exception)),
- Expression.Constant(scheduler, typeof(IScheduler)),
- Expression.Constant(witness, typeof(TResult))
- )
- );
- }
-
- /// <summary>
- /// Returns an observable sequence that terminates with an exception.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TResult">The type used for the IObservable&lt;T&gt; type parameter of the resulting sequence.</typeparam>
- /// <param name="exception">Exception object used for the sequence's termination.</param>
- /// <param name="witness">Object solely used to infer the type of the <typeparamref name="TResult" /> type parameter. This parameter is typically used when creating a sequence of anonymously typed elements.</param>
- /// <returns>The observable sequence that terminates exceptionally with the specified exception object.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="exception" /> is null.</exception>
- public static IQbservable<TResult> Throw<TResult>(this IQbservableProvider provider, Exception exception, TResult witness)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (exception == null)
- throw new ArgumentNullException("exception");
-
- return provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Throw<TResult>(default(IQbservableProvider), default(Exception), default(TResult))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TResult)),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- Expression.Constant(exception, typeof(Exception)),
- Expression.Constant(witness, typeof(TResult))
- )
- );
- }
-
- /// <summary>
- /// Records the time interval between consecutive elements in an observable sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence to record time intervals for.</param>
- /// <returns>An observable sequence with time interval information on elements.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> is null.</exception>
- public static IQbservable<TimeInterval<TSource>> TimeInterval<TSource>(this IQbservable<TSource> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return source.Provider.CreateQuery<TimeInterval<TSource>>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.TimeInterval<TSource>(default(IQbservable<TSource>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression
- )
- );
- }
-
- /// <summary>
- /// Records the time interval between consecutive elements in an observable sequence, using the specified scheduler to compute time intervals.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence to record time intervals for.</param>
- /// <param name="scheduler">Scheduler used to compute time intervals.</param>
- /// <returns>An observable sequence with time interval information on elements.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="scheduler" /> is null.</exception>
- public static IQbservable<TimeInterval<TSource>> TimeInterval<TSource>(this IQbservable<TSource> source, IScheduler scheduler)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return source.Provider.CreateQuery<TimeInterval<TSource>>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.TimeInterval<TSource>(default(IQbservable<TSource>), default(IScheduler))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- Expression.Constant(scheduler, typeof(IScheduler))
- )
- );
- }
-
- /// <summary>
- /// Applies a timeout policy to the observable sequence based on an absolute time.
- /// If the sequence doesn't terminate before the specified absolute due time, a TimeoutException is propagated to the observer.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence to perform a timeout for.</param>
- /// <param name="dueTime">Time when a timeout occurs. If this value is less than or equal to DateTimeOffset.UtcNow, the timeout occurs immediately.</param>
- /// <returns>The source sequence with a TimeoutException in case of a timeout.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> is null.</exception>
- /// <exception cref="T:System.TimeoutException">(Asynchronous) If the sequence hasn't terminated before <paramref name="dueTime" />.</exception>
- /// <remarks>
- /// In case you only want to timeout on the first element, consider using the <see cref="M:System.Reactive.Linq.Observable.Amb``1(System.IObservable{``0},System.IObservable{``0})" />
- /// operator applied to the source sequence and a delayed <see cref="M:System.Reactive.Linq.Observable.Throw``1(System.Exception)" /> sequence. Alternatively, the general-purpose overload
- /// of Timeout, <see cref="M:System.Reactive.Linq.Observable.Timeout``2(System.IObservable{``0},System.IObservable{``1},System.Func{``0,System.IObservable{``1}})" /> can be used.
- /// </remarks>
- public static IQbservable<TSource> Timeout<TSource>(this IQbservable<TSource> source, DateTimeOffset dueTime)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return source.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Timeout<TSource>(default(IQbservable<TSource>), default(DateTimeOffset))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- Expression.Constant(dueTime, typeof(DateTimeOffset))
- )
- );
- }
-
- /// <summary>
- /// Applies a timeout policy to the observable sequence based on an absolute time.
- /// If the sequence doesn't terminate before the specified absolute due time, the other observable sequence is used to produce future messages from that point on.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence and the other sequence used upon a timeout.</typeparam>
- /// <param name="source">Source sequence to perform a timeout for.</param>
- /// <param name="dueTime">Time when a timeout occurs. If this value is less than or equal to DateTimeOffset.UtcNow, the timeout occurs immediately.</param>
- /// <param name="other">Sequence to return in case of a timeout.</param>
- /// <returns>The source sequence switching to the other sequence in case of a timeout.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="other" /> is null.</exception>
- /// <remarks>
- /// In case you only want to timeout on the first element, consider using the <see cref="M:System.Reactive.Linq.Observable.Amb``1(System.IObservable{``0},System.IObservable{``0})" />
- /// operator applied to the source sequence and a delayed <see cref="M:System.Reactive.Linq.Observable.Throw``1(System.Exception)" /> sequence. Alternatively, the general-purpose overload
- /// of Timeout, <see cref="M:System.Reactive.Linq.Observable.Timeout``2(System.IObservable{``0},System.IObservable{``1},System.Func{``0,System.IObservable{``1}})" /> can be used.
- /// </remarks>
- public static IQbservable<TSource> Timeout<TSource>(this IQbservable<TSource> source, DateTimeOffset dueTime, IObservable<TSource> other)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (other == null)
- throw new ArgumentNullException("other");
-
- return source.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Timeout<TSource>(default(IQbservable<TSource>), default(DateTimeOffset), default(IObservable<TSource>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- Expression.Constant(dueTime, typeof(DateTimeOffset)),
- GetSourceExpression(other)
- )
- );
- }
-
- /// <summary>
- /// Applies a timeout policy to the observable sequence based on an absolute time, using the specified scheduler to run timeout timers.
- /// If the sequence doesn't terminate before the specified absolute due time, the other observable sequence is used to produce future messages from that point on.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence and the other sequence used upon a timeout.</typeparam>
- /// <param name="source">Source sequence to perform a timeout for.</param>
- /// <param name="dueTime">Time when a timeout occurs. If this value is less than or equal to DateTimeOffset.UtcNow, the timeout occurs immediately.</param>
- /// <param name="other">Sequence to return in case of a timeout.</param>
- /// <param name="scheduler">Scheduler to run the timeout timers on.</param>
- /// <returns>The source sequence switching to the other sequence in case of a timeout.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="other" /> or <paramref name="scheduler" /> is null.</exception>
- /// <remarks>
- /// In case you only want to timeout on the first element, consider using the <see cref="M:System.Reactive.Linq.Observable.Amb``1(System.IObservable{``0},System.IObservable{``0})" />
- /// operator applied to the source sequence and a delayed <see cref="M:System.Reactive.Linq.Observable.Throw``1(System.Exception)" /> sequence. Alternatively, the general-purpose overload
- /// of Timeout, <see cref="M:System.Reactive.Linq.Observable.Timeout``2(System.IObservable{``0},System.IObservable{``1},System.Func{``0,System.IObservable{``1}})" /> can be used.
- /// </remarks>
- public static IQbservable<TSource> Timeout<TSource>(this IQbservable<TSource> source, DateTimeOffset dueTime, IObservable<TSource> other, IScheduler scheduler)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (other == null)
- throw new ArgumentNullException("other");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return source.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Timeout<TSource>(default(IQbservable<TSource>), default(DateTimeOffset), default(IObservable<TSource>), default(IScheduler))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- Expression.Constant(dueTime, typeof(DateTimeOffset)),
- GetSourceExpression(other),
- Expression.Constant(scheduler, typeof(IScheduler))
- )
- );
- }
-
- /// <summary>
- /// Applies a timeout policy to the observable sequence based on an absolute time, using the specified scheduler to run timeout timers.
- /// If the sequence doesn't terminate before the specified absolute due time, a TimeoutException is propagated to the observer.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence to perform a timeout for.</param>
- /// <param name="dueTime">Time when a timeout occurs. If this value is less than or equal to DateTimeOffset.UtcNow, the timeout occurs immediately.</param>
- /// <param name="scheduler">Scheduler to run the timeout timers on.</param>
- /// <returns>The source sequence with a TimeoutException in case of a timeout.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="scheduler" /> is null.</exception>
- /// <exception cref="T:System.TimeoutException">(Asynchronous) If the sequence hasn't terminated before <paramref name="dueTime" />.</exception>
- /// <remarks>
- /// In case you only want to timeout on the first element, consider using the <see cref="M:System.Reactive.Linq.Observable.Amb``1(System.IObservable{``0},System.IObservable{``0})" />
- /// operator applied to the source sequence and a delayed <see cref="M:System.Reactive.Linq.Observable.Throw``1(System.Exception)" /> sequence. Alternatively, the general-purpose overload
- /// of Timeout, <see cref="M:System.Reactive.Linq.Observable.Timeout``2(System.IObservable{``0},System.IObservable{``1},System.Func{``0,System.IObservable{``1}})" /> can be used.
- /// </remarks>
- public static IQbservable<TSource> Timeout<TSource>(this IQbservable<TSource> source, DateTimeOffset dueTime, IScheduler scheduler)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return source.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Timeout<TSource>(default(IQbservable<TSource>), default(DateTimeOffset), default(IScheduler))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- Expression.Constant(dueTime, typeof(DateTimeOffset)),
- Expression.Constant(scheduler, typeof(IScheduler))
- )
- );
- }
-
- /// <summary>
- /// Applies a timeout policy for each element in the observable sequence.
- /// If the next element isn't received within the specified timeout duration starting from its predecessor, a TimeoutException is propagated to the observer.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence to perform a timeout for.</param>
- /// <param name="dueTime">Maximum duration between values before a timeout occurs.</param>
- /// <returns>The source sequence with a TimeoutException in case of a timeout.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> is null.</exception>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// <paramref name="dueTime" /> is less than TimeSpan.Zero.</exception>
- /// <exception cref="T:System.TimeoutException">(Asynchronous) If no element is produced within <paramref name="dueTime" /> from the previous element.</exception>
- /// <remarks>
- /// <para>
- /// In case you only want to timeout on the first element, consider using the <see cref="M:System.Reactive.Linq.Observable.Amb``1(System.IObservable{``0},System.IObservable{``0})" />
- /// operator applied to the source sequence and a delayed <see cref="M:System.Reactive.Linq.Observable.Throw``1(System.Exception)" /> sequence. Alternatively, the general-purpose overload
- /// of Timeout, <see cref="M:System.Reactive.Linq.Observable.Timeout``2(System.IObservable{``0},System.IObservable{``1},System.Func{``0,System.IObservable{``1}})" /> can be used.
- /// </para>
- /// <para>
- /// Specifying a TimeSpan.Zero value for <paramref name="dueTime" /> is not recommended but supported, causing timeout timers to be scheduled that are due
- /// immediately. However, this doesn't guarantee a timeout will occur, even for the first element. This is a side-effect of the asynchrony introduced by the
- /// scheduler, where the action to propagate a timeout may not execute immediately, despite the TimeSpan.Zero due time. In such cases, the next element may
- /// arrive before the scheduler gets a chance to run the timeout action.
- /// </para>
- /// </remarks>
- public static IQbservable<TSource> Timeout<TSource>(this IQbservable<TSource> source, TimeSpan dueTime)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return source.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Timeout<TSource>(default(IQbservable<TSource>), default(TimeSpan))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- Expression.Constant(dueTime, typeof(TimeSpan))
- )
- );
- }
-
- /// <summary>
- /// Applies a timeout policy for each element in the observable sequence.
- /// If the next element isn't received within the specified timeout duration starting from its predecessor, the other observable sequence is used to produce future messages from that point on.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence and the other sequence used upon a timeout.</typeparam>
- /// <param name="source">Source sequence to perform a timeout for.</param>
- /// <param name="dueTime">Maximum duration between values before a timeout occurs.</param>
- /// <param name="other">Sequence to return in case of a timeout.</param>
- /// <returns>The source sequence switching to the other sequence in case of a timeout.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="other" /> is null.</exception>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// <paramref name="dueTime" /> is less than TimeSpan.Zero.</exception>
- /// <remarks>
- /// <para>
- /// In case you only want to timeout on the first element, consider using the <see cref="M:System.Reactive.Linq.Observable.Amb``1(System.IObservable{``0},System.IObservable{``0})" />
- /// operator applied to the source sequence and a delayed <see cref="M:System.Reactive.Linq.Observable.Throw``1(System.Exception)" /> sequence. Alternatively, the general-purpose overload
- /// of Timeout, <see cref="M:System.Reactive.Linq.Observable.Timeout``2(System.IObservable{``0},System.IObservable{``1},System.Func{``0,System.IObservable{``1}})" /> can be used.
- /// </para>
- /// <para>
- /// Specifying a TimeSpan.Zero value for <paramref name="dueTime" /> is not recommended but supported, causing timeout timers to be scheduled that are due
- /// immediately. However, this doesn't guarantee a timeout will occur, even for the first element. This is a side-effect of the asynchrony introduced by the
- /// scheduler, where the action to propagate a timeout may not execute immediately, despite the TimeSpan.Zero due time. In such cases, the next element may
- /// arrive before the scheduler gets a chance to run the timeout action.
- /// </para>
- /// </remarks>
- public static IQbservable<TSource> Timeout<TSource>(this IQbservable<TSource> source, TimeSpan dueTime, IObservable<TSource> other)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (other == null)
- throw new ArgumentNullException("other");
-
- return source.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Timeout<TSource>(default(IQbservable<TSource>), default(TimeSpan), default(IObservable<TSource>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- Expression.Constant(dueTime, typeof(TimeSpan)),
- GetSourceExpression(other)
- )
- );
- }
-
- /// <summary>
- /// Applies a timeout policy for each element in the observable sequence, using the specified scheduler to run timeout timers.
- /// If the next element isn't received within the specified timeout duration starting from its predecessor, the other observable sequence is used to produce future messages from that point on.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence and the other sequence used upon a timeout.</typeparam>
- /// <param name="source">Source sequence to perform a timeout for.</param>
- /// <param name="dueTime">Maximum duration between values before a timeout occurs.</param>
- /// <param name="other">Sequence to return in case of a timeout.</param>
- /// <param name="scheduler">Scheduler to run the timeout timers on.</param>
- /// <returns>The source sequence switching to the other sequence in case of a timeout.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="other" /> or <paramref name="scheduler" /> is null.</exception>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// <paramref name="dueTime" /> is less than TimeSpan.Zero.</exception>
- /// <remarks>
- /// <para>
- /// In case you only want to timeout on the first element, consider using the <see cref="M:System.Reactive.Linq.Observable.Amb``1(System.IObservable{``0},System.IObservable{``0})" />
- /// operator applied to the source sequence and a delayed <see cref="M:System.Reactive.Linq.Observable.Throw``1(System.Exception)" /> sequence. Alternatively, the general-purpose overload
- /// of Timeout, <see cref="M:System.Reactive.Linq.Observable.Timeout``2(System.IObservable{``0},System.IObservable{``1},System.Func{``0,System.IObservable{``1}})" /> can be used.
- /// </para>
- /// <para>
- /// Specifying a TimeSpan.Zero value for <paramref name="dueTime" /> is not recommended but supported, causing timeout timers to be scheduled that are due
- /// immediately. However, this doesn't guarantee a timeout will occur, even for the first element. This is a side-effect of the asynchrony introduced by the
- /// scheduler, where the action to propagate a timeout may not execute immediately, despite the TimeSpan.Zero due time. In such cases, the next element may
- /// arrive before the scheduler gets a chance to run the timeout action.
- /// </para>
- /// </remarks>
- public static IQbservable<TSource> Timeout<TSource>(this IQbservable<TSource> source, TimeSpan dueTime, IObservable<TSource> other, IScheduler scheduler)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (other == null)
- throw new ArgumentNullException("other");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return source.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Timeout<TSource>(default(IQbservable<TSource>), default(TimeSpan), default(IObservable<TSource>), default(IScheduler))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- Expression.Constant(dueTime, typeof(TimeSpan)),
- GetSourceExpression(other),
- Expression.Constant(scheduler, typeof(IScheduler))
- )
- );
- }
-
- /// <summary>
- /// Applies a timeout policy for each element in the observable sequence, using the specified scheduler to run timeout timers.
- /// If the next element isn't received within the specified timeout duration starting from its predecessor, a TimeoutException is propagated to the observer.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence to perform a timeout for.</param>
- /// <param name="dueTime">Maximum duration between values before a timeout occurs.</param>
- /// <param name="scheduler">Scheduler to run the timeout timers on.</param>
- /// <returns>The source sequence with a TimeoutException in case of a timeout.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="scheduler" /> is null.</exception>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// <paramref name="dueTime" /> is less than TimeSpan.Zero.</exception>
- /// <exception cref="T:System.TimeoutException">(Asynchronous) If no element is produced within <paramref name="dueTime" /> from the previous element.</exception>
- /// <remarks>
- /// <para>
- /// In case you only want to timeout on the first element, consider using the <see cref="M:System.Reactive.Linq.Observable.Amb``1(System.IObservable{``0},System.IObservable{``0})" />
- /// operator applied to the source sequence and a delayed <see cref="M:System.Reactive.Linq.Observable.Throw``1(System.Exception)" /> sequence. Alternatively, the general-purpose overload
- /// of Timeout, <see cref="M:System.Reactive.Linq.Observable.Timeout``2(System.IObservable{``0},System.IObservable{``1},System.Func{``0,System.IObservable{``1}})" /> can be used.
- /// </para>
- /// <para>
- /// Specifying a TimeSpan.Zero value for <paramref name="dueTime" /> is not recommended but supported, causing timeout timers to be scheduled that are due
- /// immediately. However, this doesn't guarantee a timeout will occur, even for the first element. This is a side-effect of the asynchrony introduced by the
- /// scheduler, where the action to propagate a timeout may not execute immediately, despite the TimeSpan.Zero due time. In such cases, the next element may
- /// arrive before the scheduler gets a chance to run the timeout action.
- /// </para>
- /// </remarks>
- public static IQbservable<TSource> Timeout<TSource>(this IQbservable<TSource> source, TimeSpan dueTime, IScheduler scheduler)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return source.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Timeout<TSource>(default(IQbservable<TSource>), default(TimeSpan), default(IScheduler))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- Expression.Constant(dueTime, typeof(TimeSpan)),
- Expression.Constant(scheduler, typeof(IScheduler))
- )
- );
- }
-
- /// <summary>
- /// Applies a timeout policy to the observable sequence based on an initial timeout duration for the first element, and a timeout duration computed for each subsequent element.
- /// If the next element isn't received within the computed duration starting from its predecessor, a TimeoutException is propagated to the observer.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TTimeout">The type of the elements in the timeout sequences used to indicate the timeout duration for each element in the source sequence.</typeparam>
- /// <param name="source">Source sequence to perform a timeout for.</param>
- /// <param name="firstTimeout">Observable sequence that represents the timeout for the first element.</param>
- /// <param name="timeoutDurationSelector">Selector to retrieve an observable sequence that represents the timeout between the current element and the next element.</param>
- /// <returns>The source sequence with a TimeoutException in case of a timeout.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="firstTimeout" /> or <paramref name="timeoutDurationSelector" /> is null.</exception>
- public static IQbservable<TSource> Timeout<TSource, TTimeout>(this IQbservable<TSource> source, IObservable<TTimeout> firstTimeout, Expression<Func<TSource, IObservable<TTimeout>>> timeoutDurationSelector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (firstTimeout == null)
- throw new ArgumentNullException("firstTimeout");
- if (timeoutDurationSelector == null)
- throw new ArgumentNullException("timeoutDurationSelector");
-
- return source.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Timeout<TSource, TTimeout>(default(IQbservable<TSource>), default(IObservable<TTimeout>), default(Expression<Func<TSource, IObservable<TTimeout>>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TTimeout)),
-#endif
- source.Expression,
- GetSourceExpression(firstTimeout),
- timeoutDurationSelector
- )
- );
- }
-
- /// <summary>
- /// Applies a timeout policy to the observable sequence based on an initial timeout duration for the first element, and a timeout duration computed for each subsequent element.
- /// If the next element isn't received within the computed duration starting from its predecessor, the other observable sequence is used to produce future messages from that point on.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence and the other sequence used upon a timeout.</typeparam>
- /// <typeparam name="TTimeout">The type of the elements in the timeout sequences used to indicate the timeout duration for each element in the source sequence.</typeparam>
- /// <param name="source">Source sequence to perform a timeout for.</param>
- /// <param name="firstTimeout">Observable sequence that represents the timeout for the first element.</param>
- /// <param name="timeoutDurationSelector">Selector to retrieve an observable sequence that represents the timeout between the current element and the next element.</param>
- /// <param name="other">Sequence to return in case of a timeout.</param>
- /// <returns>The source sequence switching to the other sequence in case of a timeout.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="firstTimeout" /> or <paramref name="timeoutDurationSelector" /> or <paramref name="other" /> is null.</exception>
- public static IQbservable<TSource> Timeout<TSource, TTimeout>(this IQbservable<TSource> source, IObservable<TTimeout> firstTimeout, Expression<Func<TSource, IObservable<TTimeout>>> timeoutDurationSelector, IObservable<TSource> other)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (firstTimeout == null)
- throw new ArgumentNullException("firstTimeout");
- if (timeoutDurationSelector == null)
- throw new ArgumentNullException("timeoutDurationSelector");
- if (other == null)
- throw new ArgumentNullException("other");
-
- return source.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Timeout<TSource, TTimeout>(default(IQbservable<TSource>), default(IObservable<TTimeout>), default(Expression<Func<TSource, IObservable<TTimeout>>>), default(IObservable<TSource>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TTimeout)),
-#endif
- source.Expression,
- GetSourceExpression(firstTimeout),
- timeoutDurationSelector,
- GetSourceExpression(other)
- )
- );
- }
-
- /// <summary>
- /// Applies a timeout policy to the observable sequence based on a timeout duration computed for each element.
- /// If the next element isn't received within the computed duration starting from its predecessor, a TimeoutException is propagated to the observer.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TTimeout">The type of the elements in the timeout sequences used to indicate the timeout duration for each element in the source sequence.</typeparam>
- /// <param name="source">Source sequence to perform a timeout for.</param>
- /// <param name="timeoutDurationSelector">Selector to retrieve an observable sequence that represents the timeout between the current element and the next element.</param>
- /// <returns>The source sequence with a TimeoutException in case of a timeout.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="timeoutDurationSelector" /> is null.</exception>
- public static IQbservable<TSource> Timeout<TSource, TTimeout>(this IQbservable<TSource> source, Expression<Func<TSource, IObservable<TTimeout>>> timeoutDurationSelector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (timeoutDurationSelector == null)
- throw new ArgumentNullException("timeoutDurationSelector");
-
- return source.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Timeout<TSource, TTimeout>(default(IQbservable<TSource>), default(Expression<Func<TSource, IObservable<TTimeout>>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TTimeout)),
-#endif
- source.Expression,
- timeoutDurationSelector
- )
- );
- }
-
- /// <summary>
- /// Applies a timeout policy to the observable sequence based on a timeout duration computed for each element.
- /// If the next element isn't received within the computed duration starting from its predecessor, the other observable sequence is used to produce future messages from that point on.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence and the other sequence used upon a timeout.</typeparam>
- /// <typeparam name="TTimeout">The type of the elements in the timeout sequences used to indicate the timeout duration for each element in the source sequence.</typeparam>
- /// <param name="source">Source sequence to perform a timeout for.</param>
- /// <param name="timeoutDurationSelector">Selector to retrieve an observable sequence that represents the timeout between the current element and the next element.</param>
- /// <param name="other">Sequence to return in case of a timeout.</param>
- /// <returns>The source sequence switching to the other sequence in case of a timeout.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="timeoutDurationSelector" /> or <paramref name="other" /> is null.</exception>
- public static IQbservable<TSource> Timeout<TSource, TTimeout>(this IQbservable<TSource> source, Expression<Func<TSource, IObservable<TTimeout>>> timeoutDurationSelector, IObservable<TSource> other)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (timeoutDurationSelector == null)
- throw new ArgumentNullException("timeoutDurationSelector");
- if (other == null)
- throw new ArgumentNullException("other");
-
- return source.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Timeout<TSource, TTimeout>(default(IQbservable<TSource>), default(Expression<Func<TSource, IObservable<TTimeout>>>), default(IObservable<TSource>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TTimeout)),
-#endif
- source.Expression,
- timeoutDurationSelector,
- GetSourceExpression(other)
- )
- );
- }
-
- /// <summary>
- /// Returns an observable sequence that produces a single value at the specified absolute due time.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <param name="dueTime">Absolute time at which to produce the value. If this value is less than or equal to DateTimeOffset.UtcNow, the timer will fire as soon as possible.</param>
- /// <returns>An observable sequence that produces a value at due time.</returns>
- public static IQbservable<long> Timer(this IQbservableProvider provider, DateTimeOffset dueTime)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
-
- return provider.CreateQuery<long>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Timer(default(IQbservableProvider), default(DateTimeOffset))),
-#else
- (MethodInfo)MethodInfo.GetCurrentMethod(),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- Expression.Constant(dueTime, typeof(DateTimeOffset))
- )
- );
- }
-
- /// <summary>
- /// Returns an observable sequence that periodically produces a value starting at the specified initial absolute due time.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <param name="dueTime">Absolute time at which to produce the first value. If this value is less than or equal to DateTimeOffset.UtcNow, the timer will fire as soon as possible.</param>
- /// <param name="period">Period to produce subsequent values. If this value is equal to TimeSpan.Zero, the timer will recur as fast as possible.</param>
- /// <returns>An observable sequence that produces a value at due time and then after each period.</returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// <paramref name="period" /> is less than TimeSpan.Zero.</exception>
- public static IQbservable<long> Timer(this IQbservableProvider provider, DateTimeOffset dueTime, TimeSpan period)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
-
- return provider.CreateQuery<long>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Timer(default(IQbservableProvider), default(DateTimeOffset), default(TimeSpan))),
-#else
- (MethodInfo)MethodInfo.GetCurrentMethod(),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- Expression.Constant(dueTime, typeof(DateTimeOffset)),
- Expression.Constant(period, typeof(TimeSpan))
- )
- );
- }
-
- /// <summary>
- /// Returns an observable sequence that periodically produces a value starting at the specified initial absolute due time, using the specified scheduler to run timers.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <param name="dueTime">Absolute time at which to produce the first value. If this value is less than or equal to DateTimeOffset.UtcNow, the timer will fire as soon as possible.</param>
- /// <param name="period">Period to produce subsequent values. If this value is equal to TimeSpan.Zero, the timer will recur as fast as possible.</param>
- /// <param name="scheduler">Scheduler to run timers on.</param>
- /// <returns>An observable sequence that produces a value at due time and then after each period.</returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// <paramref name="period" /> is less than TimeSpan.Zero.</exception>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="scheduler" /> is null.</exception>
- public static IQbservable<long> Timer(this IQbservableProvider provider, DateTimeOffset dueTime, TimeSpan period, IScheduler scheduler)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return provider.CreateQuery<long>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Timer(default(IQbservableProvider), default(DateTimeOffset), default(TimeSpan), default(IScheduler))),
-#else
- (MethodInfo)MethodInfo.GetCurrentMethod(),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- Expression.Constant(dueTime, typeof(DateTimeOffset)),
- Expression.Constant(period, typeof(TimeSpan)),
- Expression.Constant(scheduler, typeof(IScheduler))
- )
- );
- }
-
- /// <summary>
- /// Returns an observable sequence that produces a single value at the specified absolute due time, using the specified scheduler to run the timer.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <param name="dueTime">Absolute time at which to produce the value. If this value is less than or equal to DateTimeOffset.UtcNow, the timer will fire as soon as possible.</param>
- /// <param name="scheduler">Scheduler to run the timer on.</param>
- /// <returns>An observable sequence that produces a value at due time.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="scheduler" /> is null.</exception>
- public static IQbservable<long> Timer(this IQbservableProvider provider, DateTimeOffset dueTime, IScheduler scheduler)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return provider.CreateQuery<long>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Timer(default(IQbservableProvider), default(DateTimeOffset), default(IScheduler))),
-#else
- (MethodInfo)MethodInfo.GetCurrentMethod(),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- Expression.Constant(dueTime, typeof(DateTimeOffset)),
- Expression.Constant(scheduler, typeof(IScheduler))
- )
- );
- }
-
- /// <summary>
- /// Returns an observable sequence that produces a single value after the specified relative due time has elapsed.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <param name="dueTime">Relative time at which to produce the value. If this value is less than or equal to TimeSpan.Zero, the timer will fire as soon as possible.</param>
- /// <returns>An observable sequence that produces a value after the due time has elapsed.</returns>
- public static IQbservable<long> Timer(this IQbservableProvider provider, TimeSpan dueTime)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
-
- return provider.CreateQuery<long>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Timer(default(IQbservableProvider), default(TimeSpan))),
-#else
- (MethodInfo)MethodInfo.GetCurrentMethod(),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- Expression.Constant(dueTime, typeof(TimeSpan))
- )
- );
- }
-
- /// <summary>
- /// Returns an observable sequence that periodically produces a value after the specified initial relative due time has elapsed.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <param name="dueTime">Relative time at which to produce the first value. If this value is less than or equal to TimeSpan.Zero, the timer will fire as soon as possible.</param>
- /// <param name="period">Period to produce subsequent values. If this value is equal to TimeSpan.Zero, the timer will recur as fast as possible.</param>
- /// <returns>An observable sequence that produces a value after due time has elapsed and then after each period.</returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// <paramref name="period" /> is less than TimeSpan.Zero.</exception>
- public static IQbservable<long> Timer(this IQbservableProvider provider, TimeSpan dueTime, TimeSpan period)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
-
- return provider.CreateQuery<long>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Timer(default(IQbservableProvider), default(TimeSpan), default(TimeSpan))),
-#else
- (MethodInfo)MethodInfo.GetCurrentMethod(),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- Expression.Constant(dueTime, typeof(TimeSpan)),
- Expression.Constant(period, typeof(TimeSpan))
- )
- );
- }
-
- /// <summary>
- /// Returns an observable sequence that periodically produces a value after the specified initial relative due time has elapsed, using the specified scheduler to run timers.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <param name="dueTime">Relative time at which to produce the first value. If this value is less than or equal to TimeSpan.Zero, the timer will fire as soon as possible.</param>
- /// <param name="period">Period to produce subsequent values. If this value is equal to TimeSpan.Zero, the timer will recur as fast as possible.</param>
- /// <param name="scheduler">Scheduler to run timers on.</param>
- /// <returns>An observable sequence that produces a value after due time has elapsed and then each period.</returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// <paramref name="period" /> is less than TimeSpan.Zero.</exception>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="scheduler" /> is null.</exception>
- public static IQbservable<long> Timer(this IQbservableProvider provider, TimeSpan dueTime, TimeSpan period, IScheduler scheduler)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return provider.CreateQuery<long>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Timer(default(IQbservableProvider), default(TimeSpan), default(TimeSpan), default(IScheduler))),
-#else
- (MethodInfo)MethodInfo.GetCurrentMethod(),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- Expression.Constant(dueTime, typeof(TimeSpan)),
- Expression.Constant(period, typeof(TimeSpan)),
- Expression.Constant(scheduler, typeof(IScheduler))
- )
- );
- }
-
- /// <summary>
- /// Returns an observable sequence that produces a single value after the specified relative due time has elapsed, using the specified scheduler to run the timer.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <param name="dueTime">Relative time at which to produce the value. If this value is less than or equal to TimeSpan.Zero, the timer will fire as soon as possible.</param>
- /// <param name="scheduler">Scheduler to run the timer on.</param>
- /// <returns>An observable sequence that produces a value after the due time has elapsed.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="scheduler" /> is null.</exception>
- public static IQbservable<long> Timer(this IQbservableProvider provider, TimeSpan dueTime, IScheduler scheduler)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return provider.CreateQuery<long>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Timer(default(IQbservableProvider), default(TimeSpan), default(IScheduler))),
-#else
- (MethodInfo)MethodInfo.GetCurrentMethod(),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- Expression.Constant(dueTime, typeof(TimeSpan)),
- Expression.Constant(scheduler, typeof(IScheduler))
- )
- );
- }
-
- /// <summary>
- /// Timestamps each element in an observable sequence using the local system clock.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence to timestamp elements for.</param>
- /// <returns>An observable sequence with timestamp information on elements.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> is null.</exception>
- public static IQbservable<Timestamped<TSource>> Timestamp<TSource>(this IQbservable<TSource> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return source.Provider.CreateQuery<Timestamped<TSource>>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Timestamp<TSource>(default(IQbservable<TSource>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression
- )
- );
- }
-
- /// <summary>
- /// Timestamp each element in an observable sequence using the clock of the specified scheduler.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence to timestamp elements for.</param>
- /// <param name="scheduler">Scheduler used to compute timestamps.</param>
- /// <returns>An observable sequence with timestamp information on elements.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="scheduler" /> is null.</exception>
- public static IQbservable<Timestamped<TSource>> Timestamp<TSource>(this IQbservable<TSource> source, IScheduler scheduler)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return source.Provider.CreateQuery<Timestamped<TSource>>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Timestamp<TSource>(default(IQbservable<TSource>), default(IScheduler))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- Expression.Constant(scheduler, typeof(IScheduler))
- )
- );
- }
-
- /// <summary>
- /// Creates an array from an observable sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">The source observable sequence to get an array of elements for.</param>
- /// <returns>An observable sequence containing a single element with an array containing all the elements of the source sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IQbservable<TSource[]> ToArray<TSource>(this IQbservable<TSource> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return source.Provider.CreateQuery<TSource[]>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.ToArray<TSource>(default(IQbservable<TSource>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression
- )
- );
- }
-
- /// <summary>
- /// Creates a dictionary from an observable sequence according to a specified key selector function.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TKey">The type of the dictionary key computed for each element in the source sequence.</typeparam>
- /// <param name="source">An observable sequence to create a dictionary for.</param>
- /// <param name="keySelector">A function to extract a key from each element.</param>
- /// <returns>An observable sequence containing a single element with a dictionary mapping unique key values onto the corresponding source sequence's element.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="keySelector" /> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IQbservable<IDictionary<TKey, TSource>> ToDictionary<TSource, TKey>(this IQbservable<TSource> source, Expression<Func<TSource, TKey>> keySelector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (keySelector == null)
- throw new ArgumentNullException("keySelector");
-
- return source.Provider.CreateQuery<IDictionary<TKey, TSource>>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.ToDictionary<TSource, TKey>(default(IQbservable<TSource>), default(Expression<Func<TSource, TKey>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)),
-#endif
- source.Expression,
- keySelector
- )
- );
- }
-
- /// <summary>
- /// Creates a dictionary from an observable sequence according to a specified key selector function, and a comparer.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TKey">The type of the dictionary key computed for each element in the source sequence.</typeparam>
- /// <param name="source">An observable sequence to create a dictionary for.</param>
- /// <param name="keySelector">A function to extract a key from each element.</param>
- /// <param name="comparer">An equality comparer to compare keys.</param>
- /// <returns>An observable sequence containing a single element with a dictionary mapping unique key values onto the corresponding source sequence's element.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="keySelector" /> or <paramref name="comparer" /> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IQbservable<IDictionary<TKey, TSource>> ToDictionary<TSource, TKey>(this IQbservable<TSource> source, Expression<Func<TSource, TKey>> keySelector, IEqualityComparer<TKey> comparer)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (keySelector == null)
- throw new ArgumentNullException("keySelector");
- if (comparer == null)
- throw new ArgumentNullException("comparer");
-
- return source.Provider.CreateQuery<IDictionary<TKey, TSource>>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.ToDictionary<TSource, TKey>(default(IQbservable<TSource>), default(Expression<Func<TSource, TKey>>), default(IEqualityComparer<TKey>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)),
-#endif
- source.Expression,
- keySelector,
- Expression.Constant(comparer, typeof(IEqualityComparer<TKey>))
- )
- );
- }
-
- /// <summary>
- /// Creates a dictionary from an observable sequence according to a specified key selector function, and an element selector function.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TKey">The type of the dictionary key computed for each element in the source sequence.</typeparam>
- /// <typeparam name="TElement">The type of the dictionary value computed for each element in the source sequence.</typeparam>
- /// <param name="source">An observable sequence to create a dictionary for.</param>
- /// <param name="keySelector">A function to extract a key from each element.</param>
- /// <param name="elementSelector">A transform function to produce a result element value from each element.</param>
- /// <returns>An observable sequence containing a single element with a dictionary mapping unique key values onto the corresponding source sequence's element.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="keySelector" /> or <paramref name="elementSelector" /> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IQbservable<IDictionary<TKey, TElement>> ToDictionary<TSource, TKey, TElement>(this IQbservable<TSource> source, Expression<Func<TSource, TKey>> keySelector, Expression<Func<TSource, TElement>> elementSelector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (keySelector == null)
- throw new ArgumentNullException("keySelector");
- if (elementSelector == null)
- throw new ArgumentNullException("elementSelector");
-
- return source.Provider.CreateQuery<IDictionary<TKey, TElement>>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.ToDictionary<TSource, TKey, TElement>(default(IQbservable<TSource>), default(Expression<Func<TSource, TKey>>), default(Expression<Func<TSource, TElement>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey), typeof(TElement)),
-#endif
- source.Expression,
- keySelector,
- elementSelector
- )
- );
- }
-
- /// <summary>
- /// Creates a dictionary from an observable sequence according to a specified key selector function, a comparer, and an element selector function.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TKey">The type of the dictionary key computed for each element in the source sequence.</typeparam>
- /// <typeparam name="TElement">The type of the dictionary value computed for each element in the source sequence.</typeparam>
- /// <param name="source">An observable sequence to create a dictionary for.</param>
- /// <param name="keySelector">A function to extract a key from each element.</param>
- /// <param name="elementSelector">A transform function to produce a result element value from each element.</param>
- /// <param name="comparer">An equality comparer to compare keys.</param>
- /// <returns>An observable sequence containing a single element with a dictionary mapping unique key values onto the corresponding source sequence's element.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="keySelector" /> or <paramref name="elementSelector" /> or <paramref name="comparer" /> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IQbservable<IDictionary<TKey, TElement>> ToDictionary<TSource, TKey, TElement>(this IQbservable<TSource> source, Expression<Func<TSource, TKey>> keySelector, Expression<Func<TSource, TElement>> elementSelector, IEqualityComparer<TKey> comparer)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (keySelector == null)
- throw new ArgumentNullException("keySelector");
- if (elementSelector == null)
- throw new ArgumentNullException("elementSelector");
- if (comparer == null)
- throw new ArgumentNullException("comparer");
-
- return source.Provider.CreateQuery<IDictionary<TKey, TElement>>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.ToDictionary<TSource, TKey, TElement>(default(IQbservable<TSource>), default(Expression<Func<TSource, TKey>>), default(Expression<Func<TSource, TElement>>), default(IEqualityComparer<TKey>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey), typeof(TElement)),
-#endif
- source.Expression,
- keySelector,
- elementSelector,
- Expression.Constant(comparer, typeof(IEqualityComparer<TKey>))
- )
- );
- }
-
- /// <summary>
- /// Converts an observable sequence to an enumerable sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">An observable sequence to convert to an enumerable sequence.</param>
- /// <returns>The enumerable sequence containing the elements in the observable sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> is null.</exception>
- /// <remarks>This operator requires the source's <see cref="IQbservableProvider"/> object (see <see cref="IQbservable.Provider"/>) to implement <see cref="IQueryProvider"/>.</remarks>
- public static IQueryable<TSource> ToQueryable<TSource>(this IQbservable<TSource> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return ((IQueryProvider)source.Provider).CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.ToQueryable<TSource>(default(IQbservable<TSource>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression
- )
- );
- }
-
- /// <summary>
- /// Creates a list from an observable sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">The source observable sequence to get a list of elements for.</param>
- /// <returns>An observable sequence containing a single element with a list containing all the elements of the source sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IQbservable<IList<TSource>> ToList<TSource>(this IQbservable<TSource> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return source.Provider.CreateQuery<IList<TSource>>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.ToList<TSource>(default(IQbservable<TSource>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression
- )
- );
- }
-
- /// <summary>
- /// Creates a lookup from an observable sequence according to a specified key selector function.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TKey">The type of the lookup key computed for each element in the source sequence.</typeparam>
- /// <param name="source">An observable sequence to create a lookup for.</param>
- /// <param name="keySelector">A function to extract a key from each element.</param>
- /// <returns>An observable sequence containing a single element with a lookup mapping unique key values onto the corresponding source sequence's elements.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="keySelector" /> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IQbservable<ILookup<TKey, TSource>> ToLookup<TSource, TKey>(this IQbservable<TSource> source, Expression<Func<TSource, TKey>> keySelector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (keySelector == null)
- throw new ArgumentNullException("keySelector");
-
- return source.Provider.CreateQuery<ILookup<TKey, TSource>>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.ToLookup<TSource, TKey>(default(IQbservable<TSource>), default(Expression<Func<TSource, TKey>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)),
-#endif
- source.Expression,
- keySelector
- )
- );
- }
-
- /// <summary>
- /// Creates a lookup from an observable sequence according to a specified key selector function, and a comparer.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TKey">The type of the lookup key computed for each element in the source sequence.</typeparam>
- /// <param name="source">An observable sequence to create a lookup for.</param>
- /// <param name="keySelector">A function to extract a key from each element.</param>
- /// <param name="comparer">An equality comparer to compare keys.</param>
- /// <returns>An observable sequence containing a single element with a lookup mapping unique key values onto the corresponding source sequence's elements.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="keySelector" /> or <paramref name="comparer" /> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IQbservable<ILookup<TKey, TSource>> ToLookup<TSource, TKey>(this IQbservable<TSource> source, Expression<Func<TSource, TKey>> keySelector, IEqualityComparer<TKey> comparer)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (keySelector == null)
- throw new ArgumentNullException("keySelector");
- if (comparer == null)
- throw new ArgumentNullException("comparer");
-
- return source.Provider.CreateQuery<ILookup<TKey, TSource>>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.ToLookup<TSource, TKey>(default(IQbservable<TSource>), default(Expression<Func<TSource, TKey>>), default(IEqualityComparer<TKey>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)),
-#endif
- source.Expression,
- keySelector,
- Expression.Constant(comparer, typeof(IEqualityComparer<TKey>))
- )
- );
- }
-
- /// <summary>
- /// Creates a lookup from an observable sequence according to a specified key selector function, and an element selector function.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TKey">The type of the lookup key computed for each element in the source sequence.</typeparam>
- /// <typeparam name="TElement">The type of the lookup value computed for each element in the source sequence.</typeparam>
- /// <param name="source">An observable sequence to create a lookup for.</param>
- /// <param name="keySelector">A function to extract a key from each element.</param>
- /// <param name="elementSelector">A transform function to produce a result element value from each element.</param>
- /// <returns>An observable sequence containing a single element with a lookup mapping unique key values onto the corresponding source sequence's elements.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="keySelector" /> or <paramref name="elementSelector" /> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IQbservable<ILookup<TKey, TElement>> ToLookup<TSource, TKey, TElement>(this IQbservable<TSource> source, Expression<Func<TSource, TKey>> keySelector, Expression<Func<TSource, TElement>> elementSelector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (keySelector == null)
- throw new ArgumentNullException("keySelector");
- if (elementSelector == null)
- throw new ArgumentNullException("elementSelector");
-
- return source.Provider.CreateQuery<ILookup<TKey, TElement>>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.ToLookup<TSource, TKey, TElement>(default(IQbservable<TSource>), default(Expression<Func<TSource, TKey>>), default(Expression<Func<TSource, TElement>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey), typeof(TElement)),
-#endif
- source.Expression,
- keySelector,
- elementSelector
- )
- );
- }
-
- /// <summary>
- /// Creates a lookup from an observable sequence according to a specified key selector function, a comparer, and an element selector function.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TKey">The type of the lookup key computed for each element in the source sequence.</typeparam>
- /// <typeparam name="TElement">The type of the lookup value computed for each element in the source sequence.</typeparam>
- /// <param name="source">An observable sequence to create a lookup for.</param>
- /// <param name="keySelector">A function to extract a key from each element.</param>
- /// <param name="elementSelector">A transform function to produce a result element value from each element.</param>
- /// <param name="comparer">An equality comparer to compare keys.</param>
- /// <returns>An observable sequence containing a single element with a lookup mapping unique key values onto the corresponding source sequence's elements.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="keySelector" /> or <paramref name="elementSelector" /> or <paramref name="comparer" /> is null.</exception>
- /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
- public static IQbservable<ILookup<TKey, TElement>> ToLookup<TSource, TKey, TElement>(this IQbservable<TSource> source, Expression<Func<TSource, TKey>> keySelector, Expression<Func<TSource, TElement>> elementSelector, IEqualityComparer<TKey> comparer)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (keySelector == null)
- throw new ArgumentNullException("keySelector");
- if (elementSelector == null)
- throw new ArgumentNullException("elementSelector");
- if (comparer == null)
- throw new ArgumentNullException("comparer");
-
- return source.Provider.CreateQuery<ILookup<TKey, TElement>>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.ToLookup<TSource, TKey, TElement>(default(IQbservable<TSource>), default(Expression<Func<TSource, TKey>>), default(Expression<Func<TSource, TElement>>), default(IEqualityComparer<TKey>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey), typeof(TElement)),
-#endif
- source.Expression,
- keySelector,
- elementSelector,
- Expression.Constant(comparer, typeof(IEqualityComparer<TKey>))
- )
- );
- }
-
- /// <summary>
- /// Converts an enumerable sequence to an observable sequence.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Enumerable sequence to convert to an observable sequence.</param>
- /// <returns>The observable sequence whose elements are pulled from the given enumerable sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> is null.</exception>
- public static IQbservable<TSource> ToObservable<TSource>(this IQbservableProvider provider, IEnumerable<TSource> source)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (source == null)
- throw new ArgumentNullException("source");
-
- return provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.ToObservable<TSource>(default(IQbservableProvider), default(IEnumerable<TSource>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- GetSourceExpression(source)
- )
- );
- }
-
- /// <summary>
- /// Converts an enumerable sequence to an observable sequence, using the specified scheduler to run the enumeration loop.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Enumerable sequence to convert to an observable sequence.</param>
- /// <param name="scheduler">Scheduler to run the enumeration of the input sequence on.</param>
- /// <returns>The observable sequence whose elements are pulled from the given enumerable sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="scheduler" /> is null.</exception>
- public static IQbservable<TSource> ToObservable<TSource>(this IQbservableProvider provider, IEnumerable<TSource> source, IScheduler scheduler)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (source == null)
- throw new ArgumentNullException("source");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.ToObservable<TSource>(default(IQbservableProvider), default(IEnumerable<TSource>), default(IScheduler))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- GetSourceExpression(source),
- Expression.Constant(scheduler, typeof(IScheduler))
- )
- );
- }
-
- /// <summary>
- /// Constructs an observable sequence that depends on a resource object, whose lifetime is tied to the resulting observable sequence's lifetime.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TResult">The type of the elements in the produced sequence.</typeparam>
- /// <typeparam name="TResource">The type of the resource used during the generation of the resulting sequence. Needs to implement <see cref="T:System.IDisposable" />.</typeparam>
- /// <param name="resourceFactory">Factory function to obtain a resource object.</param>
- /// <param name="observableFactory">Factory function to obtain an observable sequence that depends on the obtained resource.</param>
- /// <returns>An observable sequence whose lifetime controls the lifetime of the dependent resource object.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="resourceFactory" /> or <paramref name="observableFactory" /> is null.</exception>
- public static IQbservable<TResult> Using<TResult, TResource>(this IQbservableProvider provider, Expression<Func<TResource>> resourceFactory, Expression<Func<TResource, IObservable<TResult>>> observableFactory)
- where TResource : IDisposable
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (resourceFactory == null)
- throw new ArgumentNullException("resourceFactory");
- if (observableFactory == null)
- throw new ArgumentNullException("observableFactory");
-
- return provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Using<TResult, TResource>(default(IQbservableProvider), default(Expression<Func<TResource>>), default(Expression<Func<TResource, IObservable<TResult>>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TResult), typeof(TResource)),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- resourceFactory,
- observableFactory
- )
- );
- }
-
-#if !NO_TPL
- /// <summary>
- /// Constructs an observable sequence that depends on a resource object, whose lifetime is tied to the resulting observable sequence's lifetime. The resource is obtained and used through asynchronous methods.
- /// The CancellationToken passed to the asynchronous methods is tied to the returned disposable subscription, allowing best-effort cancellation at any stage of the resource acquisition or usage.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TResult">The type of the elements in the produced sequence.</typeparam>
- /// <typeparam name="TResource">The type of the resource used during the generation of the resulting sequence. Needs to implement <see cref="T:System.IDisposable" />.</typeparam>
- /// <param name="resourceFactoryAsync">Asynchronous factory function to obtain a resource object.</param>
- /// <param name="observableFactoryAsync">Asynchronous factory function to obtain an observable sequence that depends on the obtained resource.</param>
- /// <returns>An observable sequence whose lifetime controls the lifetime of the dependent resource object.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="resourceFactoryAsync" /> or <paramref name="observableFactoryAsync" /> is null.</exception>
- /// <remarks>This operator is especially useful in conjunction with the asynchronous programming features introduced in C# 5.0 and Visual Basic 11.</remarks>
- /// <remarks>When a subscription to the resulting sequence is disposed, the CancellationToken that was fed to the asynchronous resource factory and observable factory functions will be signaled.</remarks>
- public static IQbservable<TResult> Using<TResult, TResource>(this IQbservableProvider provider, Expression<Func<CancellationToken, Task<TResource>>> resourceFactoryAsync, Expression<Func<TResource, CancellationToken, Task<IObservable<TResult>>>> observableFactoryAsync)
- where TResource : IDisposable
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (resourceFactoryAsync == null)
- throw new ArgumentNullException("resourceFactoryAsync");
- if (observableFactoryAsync == null)
- throw new ArgumentNullException("observableFactoryAsync");
-
- return provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Using<TResult, TResource>(default(IQbservableProvider), default(Expression<Func<CancellationToken, Task<TResource>>>), default(Expression<Func<TResource, CancellationToken, Task<IObservable<TResult>>>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TResult), typeof(TResource)),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- resourceFactoryAsync,
- observableFactoryAsync
- )
- );
- }
-#endif
-
- /// <summary>
- /// Filters the elements of an observable sequence based on a predicate.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">An observable sequence whose elements to filter.</param>
- /// <param name="predicate">A function to test each source element for a condition.</param>
- /// <returns>An observable sequence that contains elements from the input sequence that satisfy the condition.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="predicate" /> is null.</exception>
- public static IQbservable<TSource> Where<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, bool>> predicate)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (predicate == null)
- throw new ArgumentNullException("predicate");
-
- return source.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Where<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, bool>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- predicate
- )
- );
- }
-
- /// <summary>
- /// Filters the elements of an observable sequence based on a predicate by incorporating the element's index.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">An observable sequence whose elements to filter.</param>
- /// <param name="predicate">A function to test each source element for a conditio; the second parameter of the function represents the index of the source element.</param>
- /// <returns>An observable sequence that contains elements from the input sequence that satisfy the condition.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="predicate" /> is null.</exception>
- public static IQbservable<TSource> Where<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, int, bool>> predicate)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (predicate == null)
- throw new ArgumentNullException("predicate");
-
- return source.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Where<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, int, bool>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- predicate
- )
- );
- }
-
- /// <summary>
- /// Repeats the given <paramref name="source" /> as long as the specified <paramref name="condition" /> holds, where the <paramref name="condition" /> is evaluated before each repeated <paramref name="source" /> is subscribed to.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source to repeat as long as the <paramref name="condition" /> function evaluates to true.</param>
- /// <param name="condition">Condition that will be evaluated before subscription to the <paramref name="source" />, to determine whether repetition of the source is required.</param>
- /// <returns>The observable sequence obtained by concatenating the <paramref name="source" /> sequence as long as the <paramref name="condition" /> holds.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="condition" /> or <paramref name="source" /> is null.</exception>
- public static IQbservable<TSource> While<TSource>(this IQbservableProvider provider, Expression<Func<bool>> condition, IObservable<TSource> source)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (condition == null)
- throw new ArgumentNullException("condition");
- if (source == null)
- throw new ArgumentNullException("source");
-
- return provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.While<TSource>(default(IQbservableProvider), default(Expression<Func<bool>>), default(IObservable<TSource>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- condition,
- GetSourceExpression(source)
- )
- );
- }
-
- /// <summary>
- /// Projects each element of an observable sequence into consecutive non-overlapping windows which are produced based on element count information.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence, and in the windows in the result sequence.</typeparam>
- /// <param name="source">Source sequence to produce windows over.</param>
- /// <param name="count">Length of each window.</param>
- /// <returns>An observable sequence of windows.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> is null.</exception>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// <paramref name="count" /> is less than or equal to zero.</exception>
- public static IQbservable<IObservable<TSource>> Window<TSource>(this IQbservable<TSource> source, int count)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return source.Provider.CreateQuery<IObservable<TSource>>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Window<TSource>(default(IQbservable<TSource>), default(int))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- Expression.Constant(count, typeof(int))
- )
- );
- }
-
- /// <summary>
- /// Projects each element of an observable sequence into zero or more windows which are produced based on element count information.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence, and in the windows in the result sequence.</typeparam>
- /// <param name="source">Source sequence to produce windows over.</param>
- /// <param name="count">Length of each window.</param>
- /// <param name="skip">Number of elements to skip between creation of consecutive windows.</param>
- /// <returns>An observable sequence of windows.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> is null.</exception>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// <paramref name="count" /> or <paramref name="skip" /> is less than or equal to zero.</exception>
- public static IQbservable<IObservable<TSource>> Window<TSource>(this IQbservable<TSource> source, int count, int skip)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return source.Provider.CreateQuery<IObservable<TSource>>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Window<TSource>(default(IQbservable<TSource>), default(int), default(int))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- Expression.Constant(count, typeof(int)),
- Expression.Constant(skip, typeof(int))
- )
- );
- }
-
- /// <summary>
- /// Projects each element of an observable sequence into consecutive non-overlapping windows which are produced based on timing information.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence, and in the windows in the result sequence.</typeparam>
- /// <param name="source">Source sequence to produce windows over.</param>
- /// <param name="timeSpan">Length of each window.</param>
- /// <returns>The sequence of windows.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> is null.</exception>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// <paramref name="timeSpan" /> is less than TimeSpan.Zero.</exception>
- /// <remarks>
- /// Specifying a TimeSpan.Zero value for <paramref name="timeSpan" /> is not recommended but supported, causing the scheduler to create windows as fast as it can.
- /// Because all source sequence elements end up in one of the windows, some windows won't have a zero time span. This is a side-effect of the asynchrony introduced
- /// by the scheduler, where the action to close the current window and to create a new window may not execute immediately, despite the TimeSpan.Zero due time.
- /// </remarks>
- public static IQbservable<IObservable<TSource>> Window<TSource>(this IQbservable<TSource> source, TimeSpan timeSpan)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return source.Provider.CreateQuery<IObservable<TSource>>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Window<TSource>(default(IQbservable<TSource>), default(TimeSpan))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- Expression.Constant(timeSpan, typeof(TimeSpan))
- )
- );
- }
-
- /// <summary>
- /// Projects each element of an observable sequence into a window that is completed when either it's full or a given amount of time has elapsed.
- /// A useful real-world analogy of this overload is the behavior of a ferry leaving the dock when all seats are taken, or at the scheduled time of departure, whichever event occurs first.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence, and in the windows in the result sequence.</typeparam>
- /// <param name="source">Source sequence to produce windows over.</param>
- /// <param name="timeSpan">Maximum time length of a window.</param>
- /// <param name="count">Maximum element count of a window.</param>
- /// <returns>An observable sequence of windows.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> is null.</exception>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// <paramref name="timeSpan" /> is less than TimeSpan.Zero. -or- <paramref name="count" /> is less than or equal to zero.</exception>
- /// <remarks>
- /// Specifying a TimeSpan.Zero value for <paramref name="timeSpan" /> is not recommended but supported, causing the scheduler to create windows as fast as it can.
- /// Because all source sequence elements end up in one of the windows, some windows won't have a zero time span. This is a side-effect of the asynchrony introduced
- /// by the scheduler, where the action to close the current window and to create a new window may not execute immediately, despite the TimeSpan.Zero due time.
- /// </remarks>
- public static IQbservable<IObservable<TSource>> Window<TSource>(this IQbservable<TSource> source, TimeSpan timeSpan, int count)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return source.Provider.CreateQuery<IObservable<TSource>>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Window<TSource>(default(IQbservable<TSource>), default(TimeSpan), default(int))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- Expression.Constant(timeSpan, typeof(TimeSpan)),
- Expression.Constant(count, typeof(int))
- )
- );
- }
-
- /// <summary>
- /// Projects each element of an observable sequence into a window that is completed when either it's full or a given amount of time has elapsed, using the specified scheduler to run timers.
- /// A useful real-world analogy of this overload is the behavior of a ferry leaving the dock when all seats are taken, or at the scheduled time of departure, whichever event occurs first.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence, and in the windows in the result sequence.</typeparam>
- /// <param name="source">Source sequence to produce windows over.</param>
- /// <param name="timeSpan">Maximum time length of a window.</param>
- /// <param name="count">Maximum element count of a window.</param>
- /// <param name="scheduler">Scheduler to run windowing timers on.</param>
- /// <returns>An observable sequence of windows.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="scheduler" /> is null.</exception>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// <paramref name="timeSpan" /> is less than TimeSpan.Zero. -or- <paramref name="count" /> is less than or equal to zero.</exception>
- /// <remarks>
- /// Specifying a TimeSpan.Zero value for <paramref name="timeSpan" /> is not recommended but supported, causing the scheduler to create windows as fast as it can.
- /// Because all source sequence elements end up in one of the windows, some windows won't have a zero time span. This is a side-effect of the asynchrony introduced
- /// by the scheduler, where the action to close the current window and to create a new window may not execute immediately, despite the TimeSpan.Zero due time.
- /// </remarks>
- public static IQbservable<IObservable<TSource>> Window<TSource>(this IQbservable<TSource> source, TimeSpan timeSpan, int count, IScheduler scheduler)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return source.Provider.CreateQuery<IObservable<TSource>>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Window<TSource>(default(IQbservable<TSource>), default(TimeSpan), default(int), default(IScheduler))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- Expression.Constant(timeSpan, typeof(TimeSpan)),
- Expression.Constant(count, typeof(int)),
- Expression.Constant(scheduler, typeof(IScheduler))
- )
- );
- }
-
- /// <summary>
- /// Projects each element of an observable sequence into consecutive non-overlapping windows which are produced based on timing information, using the specified scheduler to run timers.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence, and in the windows in the result sequence.</typeparam>
- /// <param name="source">Source sequence to produce windows over.</param>
- /// <param name="timeSpan">Length of each window.</param>
- /// <param name="scheduler">Scheduler to run windowing timers on.</param>
- /// <returns>An observable sequence of windows.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="scheduler" /> is null.</exception>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// <paramref name="timeSpan" /> is less than TimeSpan.Zero.</exception>
- /// <remarks>
- /// Specifying a TimeSpan.Zero value for <paramref name="timeSpan" /> is not recommended but supported, causing the scheduler to create windows as fast as it can.
- /// Because all source sequence elements end up in one of the windows, some windows won't have a zero time span. This is a side-effect of the asynchrony introduced
- /// by the scheduler, where the action to close the current window and to create a new window may not execute immediately, despite the TimeSpan.Zero due time.
- /// </remarks>
- public static IQbservable<IObservable<TSource>> Window<TSource>(this IQbservable<TSource> source, TimeSpan timeSpan, IScheduler scheduler)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return source.Provider.CreateQuery<IObservable<TSource>>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Window<TSource>(default(IQbservable<TSource>), default(TimeSpan), default(IScheduler))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- Expression.Constant(timeSpan, typeof(TimeSpan)),
- Expression.Constant(scheduler, typeof(IScheduler))
- )
- );
- }
-
- /// <summary>
- /// Projects each element of an observable sequence into zero or more windows which are produced based on timing information.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence, and in the windows in the result sequence.</typeparam>
- /// <param name="source">Source sequence to produce windows over.</param>
- /// <param name="timeSpan">Length of each window.</param>
- /// <param name="timeShift">Interval between creation of consecutive windows.</param>
- /// <returns>An observable sequence of windows.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> is null.</exception>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// <paramref name="timeSpan" /> or <paramref name="timeSpan" /> is less than TimeSpan.Zero.</exception>
- /// <remarks>
- /// <para>
- /// Specifying a TimeSpan.Zero value for <paramref name="timeSpan" /> is not recommended but supported, causing the scheduler to create windows with minimum duration
- /// length. However, some windows won't have a zero time span. This is a side-effect of the asynchrony introduced by the scheduler, where the action to close the
- /// current window may not execute immediately, despite the TimeSpan.Zero due time.
- /// </para>
- /// <para>
- /// Specifying a TimeSpan.Zero value for <paramref name="timeShift" /> is not recommended but supported, causing the scheduler to create windows as fast as it can.
- /// However, this doesn't mean all windows will start at the beginning of the source sequence. This is a side-effect of the asynchrony introduced by the scheduler,
- /// where the action to create a new window may not execute immediately, despite the TimeSpan.Zero due time.
- /// </para>
- /// </remarks>
- public static IQbservable<IObservable<TSource>> Window<TSource>(this IQbservable<TSource> source, TimeSpan timeSpan, TimeSpan timeShift)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return source.Provider.CreateQuery<IObservable<TSource>>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Window<TSource>(default(IQbservable<TSource>), default(TimeSpan), default(TimeSpan))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- Expression.Constant(timeSpan, typeof(TimeSpan)),
- Expression.Constant(timeShift, typeof(TimeSpan))
- )
- );
- }
-
- /// <summary>
- /// Projects each element of an observable sequence into zero or more windows which are produced based on timing information, using the specified scheduler to run timers.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence, and in the windows in the result sequence.</typeparam>
- /// <param name="source">Source sequence to produce windows over.</param>
- /// <param name="timeSpan">Length of each window.</param>
- /// <param name="timeShift">Interval between creation of consecutive windows.</param>
- /// <param name="scheduler">Scheduler to run windowing timers on.</param>
- /// <returns>An observable sequence of windows.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="scheduler" /> is null.</exception>
- /// <exception cref="T:System.ArgumentOutOfRangeException">
- /// <paramref name="timeSpan" /> or <paramref name="timeSpan" /> is less than TimeSpan.Zero.</exception>
- /// <remarks>
- /// <para>
- /// Specifying a TimeSpan.Zero value for <paramref name="timeSpan" /> is not recommended but supported, causing the scheduler to create windows with minimum duration
- /// length. However, some windows won't have a zero time span. This is a side-effect of the asynchrony introduced by the scheduler, where the action to close the
- /// current window may not execute immediately, despite the TimeSpan.Zero due time.
- /// </para>
- /// <para>
- /// Specifying a TimeSpan.Zero value for <paramref name="timeShift" /> is not recommended but supported, causing the scheduler to create windows as fast as it can.
- /// However, this doesn't mean all windows will start at the beginning of the source sequence. This is a side-effect of the asynchrony introduced by the scheduler,
- /// where the action to create a new window may not execute immediately, despite the TimeSpan.Zero due time.
- /// </para>
- /// </remarks>
- public static IQbservable<IObservable<TSource>> Window<TSource>(this IQbservable<TSource> source, TimeSpan timeSpan, TimeSpan timeShift, IScheduler scheduler)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return source.Provider.CreateQuery<IObservable<TSource>>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Window<TSource>(default(IQbservable<TSource>), default(TimeSpan), default(TimeSpan), default(IScheduler))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- Expression.Constant(timeSpan, typeof(TimeSpan)),
- Expression.Constant(timeShift, typeof(TimeSpan)),
- Expression.Constant(scheduler, typeof(IScheduler))
- )
- );
- }
-
- /// <summary>
- /// Projects each element of an observable sequence into consecutive non-overlapping windows.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence, and in the windows in the result sequence.</typeparam>
- /// <typeparam name="TWindowBoundary">The type of the elements in the sequences indicating window boundary events.</typeparam>
- /// <param name="source">Source sequence to produce windows over.</param>
- /// <param name="windowBoundaries">Sequence of window boundary markers. The current window is closed and a new window is opened upon receiving a boundary marker.</param>
- /// <returns>An observable sequence of windows.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="windowBoundaries" /> is null.</exception>
- public static IQbservable<IObservable<TSource>> Window<TSource, TWindowBoundary>(this IQbservable<TSource> source, IObservable<TWindowBoundary> windowBoundaries)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (windowBoundaries == null)
- throw new ArgumentNullException("windowBoundaries");
-
- return source.Provider.CreateQuery<IObservable<TSource>>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Window<TSource, TWindowBoundary>(default(IQbservable<TSource>), default(IObservable<TWindowBoundary>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TWindowBoundary)),
-#endif
- source.Expression,
- GetSourceExpression(windowBoundaries)
- )
- );
- }
-
- /// <summary>
- /// Projects each element of an observable sequence into consecutive non-overlapping windows.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence, and in the windows in the result sequence.</typeparam>
- /// <typeparam name="TWindowClosing">The type of the elements in the sequences indicating window closing events.</typeparam>
- /// <param name="source">Source sequence to produce windows over.</param>
- /// <param name="windowClosingSelector">A function invoked to define the boundaries of the produced windows. A new window is started when the previous one is closed.</param>
- /// <returns>An observable sequence of windows.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="windowClosingSelector" /> is null.</exception>
- public static IQbservable<IObservable<TSource>> Window<TSource, TWindowClosing>(this IQbservable<TSource> source, Expression<Func<IObservable<TWindowClosing>>> windowClosingSelector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (windowClosingSelector == null)
- throw new ArgumentNullException("windowClosingSelector");
-
- return source.Provider.CreateQuery<IObservable<TSource>>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Window<TSource, TWindowClosing>(default(IQbservable<TSource>), default(Expression<Func<IObservable<TWindowClosing>>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TWindowClosing)),
-#endif
- source.Expression,
- windowClosingSelector
- )
- );
- }
-
- /// <summary>
- /// Projects each element of an observable sequence into zero or more windows.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence, and in the windows in the result sequence.</typeparam>
- /// <typeparam name="TWindowOpening">The type of the elements in the sequence indicating window opening events, also passed to the closing selector to obtain a sequence of window closing events.</typeparam>
- /// <typeparam name="TWindowClosing">The type of the elements in the sequences indicating window closing events.</typeparam>
- /// <param name="source">Source sequence to produce windows over.</param>
- /// <param name="windowOpenings">Observable sequence whose elements denote the creation of new windows.</param>
- /// <param name="windowClosingSelector">A function invoked to define the closing of each produced window.</param>
- /// <returns>An observable sequence of windows.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source" /> or <paramref name="windowOpenings" /> or <paramref name="windowClosingSelector" /> is null.</exception>
- public static IQbservable<IObservable<TSource>> Window<TSource, TWindowOpening, TWindowClosing>(this IQbservable<TSource> source, IObservable<TWindowOpening> windowOpenings, Expression<Func<TWindowOpening, IObservable<TWindowClosing>>> windowClosingSelector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (windowOpenings == null)
- throw new ArgumentNullException("windowOpenings");
- if (windowClosingSelector == null)
- throw new ArgumentNullException("windowClosingSelector");
-
- return source.Provider.CreateQuery<IObservable<TSource>>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Window<TSource, TWindowOpening, TWindowClosing>(default(IQbservable<TSource>), default(IObservable<TWindowOpening>), default(Expression<Func<TWindowOpening, IObservable<TWindowClosing>>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TWindowOpening), typeof(TWindowClosing)),
-#endif
- source.Expression,
- GetSourceExpression(windowOpenings),
- windowClosingSelector
- )
- );
- }
-
- /// <summary>
- /// Merges the specified observable sequences into one observable sequence by emitting a list with the elements of the observable sequences at corresponding indexes.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TSource">The type of the elements in the source sequences, and in the lists in the result sequence.</typeparam>
- /// <param name="sources">Observable sources.</param>
- /// <returns>An observable sequence containing lists of elements at corresponding indexes.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="sources" /> is null.</exception>
- public static IQbservable<IList<TSource>> Zip<TSource>(this IQbservableProvider provider, IEnumerable<IObservable<TSource>> sources)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (sources == null)
- throw new ArgumentNullException("sources");
-
- return provider.CreateQuery<IList<TSource>>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Zip<TSource>(default(IQbservableProvider), default(IEnumerable<IObservable<TSource>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- GetSourceExpression(sources)
- )
- );
- }
-
- /// <summary>
- /// Merges the specified observable sequences into one observable sequence by emitting a list with the elements of the observable sequences at corresponding indexes.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TSource">The type of the elements in the source sequences, and in the lists in the result sequence.</typeparam>
- /// <param name="sources">Observable sources.</param>
- /// <returns>An observable sequence containing lists of elements at corresponding indexes.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="sources" /> is null.</exception>
- public static IQbservable<IList<TSource>> Zip<TSource>(this IQbservableProvider provider, params IObservable<TSource>[] sources)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (sources == null)
- throw new ArgumentNullException("sources");
-
- return provider.CreateQuery<IList<TSource>>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Zip<TSource>(default(IQbservableProvider), default(IObservable<TSource>[]))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- GetSourceExpression(sources)
- )
- );
- }
-
- /// <summary>
- /// Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TSource">The type of the elements in the source sequences.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
- /// <param name="sources">Observable sources.</param>
- /// <param name="resultSelector">Function to invoke for each series of elements at corresponding indexes in the sources.</param>
- /// <returns>An observable sequence containing the result of combining elements of the sources using the specified result selector function.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="sources" /> or <paramref name="resultSelector" /> is null.</exception>
- public static IQbservable<TResult> Zip<TSource, TResult>(this IQbservableProvider provider, IEnumerable<IObservable<TSource>> sources, Expression<Func<IList<TSource>, TResult>> resultSelector)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (sources == null)
- throw new ArgumentNullException("sources");
- if (resultSelector == null)
- throw new ArgumentNullException("resultSelector");
-
- return provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Zip<TSource, TResult>(default(IQbservableProvider), default(IEnumerable<IObservable<TSource>>), default(Expression<Func<IList<TSource>, TResult>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- GetSourceExpression(sources),
- resultSelector
- )
- );
- }
-
- /// <summary>
- /// Merges two observable sequences into one observable sequence by combining their elements in a pairwise fashion.
- /// </summary>
- /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
- /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
- /// <param name="first">First observable source.</param>
- /// <param name="second">Second observable source.</param>
- /// <param name="resultSelector">Function to invoke for each consecutive pair of elements from the first and second source.</param>
- /// <returns>An observable sequence containing the result of pairwise combining the elements of the first and second source using the specified result selector function.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="first" /> or <paramref name="second" /> or <paramref name="resultSelector" /> is null.</exception>
- public static IQbservable<TResult> Zip<TSource1, TSource2, TResult>(this IQbservable<TSource1> first, IObservable<TSource2> second, Expression<Func<TSource1, TSource2, TResult>> resultSelector)
- {
- if (first == null)
- throw new ArgumentNullException("first");
- if (second == null)
- throw new ArgumentNullException("second");
- if (resultSelector == null)
- throw new ArgumentNullException("resultSelector");
-
- return first.Provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Zip<TSource1, TSource2, TResult>(default(IQbservable<TSource1>), default(IObservable<TSource2>), default(Expression<Func<TSource1, TSource2, TResult>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource1), typeof(TSource2), typeof(TResult)),
-#endif
- first.Expression,
- GetSourceExpression(second),
- resultSelector
- )
- );
- }
-
- /// <summary>
- /// Merges an observable sequence and an enumerable sequence into one observable sequence by using the selector function.
- /// </summary>
- /// <typeparam name="TSource1">The type of the elements in the first observable source sequence.</typeparam>
- /// <typeparam name="TSource2">The type of the elements in the second enumerable source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
- /// <param name="first">First observable source.</param>
- /// <param name="second">Second enumerable source.</param>
- /// <param name="resultSelector">Function to invoke for each consecutive pair of elements from the first and second source.</param>
- /// <returns>An observable sequence containing the result of pairwise combining the elements of the first and second source using the specified result selector function.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="first" /> or <paramref name="second" /> or <paramref name="resultSelector" /> is null.</exception>
- public static IQbservable<TResult> Zip<TSource1, TSource2, TResult>(this IQbservable<TSource1> first, IEnumerable<TSource2> second, Expression<Func<TSource1, TSource2, TResult>> resultSelector)
- {
- if (first == null)
- throw new ArgumentNullException("first");
- if (second == null)
- throw new ArgumentNullException("second");
- if (resultSelector == null)
- throw new ArgumentNullException("resultSelector");
-
- return first.Provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Zip<TSource1, TSource2, TResult>(default(IQbservable<TSource1>), default(IEnumerable<TSource2>), default(Expression<Func<TSource1, TSource2, TResult>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource1), typeof(TSource2), typeof(TResult)),
-#endif
- first.Expression,
- GetSourceExpression(second),
- resultSelector
- )
- );
- }
-
- /// <summary>
- /// Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index.
- /// </summary>
- /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
- /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
- /// <typeparam name="TSource3">The type of the elements in the third source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
- /// <param name="source1">First observable source.</param>
- /// <param name="source2">Second observable source.</param>
- /// <param name="source3">Third observable source.</param>
- /// <param name="resultSelector">Function to invoke for each series of elements at corresponding indexes in the sources.</param>
- /// <returns>An observable sequence containing the result of combining elements of the sources using the specified result selector function.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source1" /> or <paramref name="source2" /> or <paramref name="source3" /> or <paramref name="resultSelector" /> is null.</exception>
- public static IQbservable<TResult> Zip<TSource1, TSource2, TSource3, TResult>(this IQbservable<TSource1> source1, IObservable<TSource2> source2, IObservable<TSource3> source3, Expression<Func<TSource1, TSource2, TSource3, TResult>> resultSelector)
- {
- if (source1 == null)
- throw new ArgumentNullException("source1");
- if (source2 == null)
- throw new ArgumentNullException("source2");
- if (source3 == null)
- throw new ArgumentNullException("source3");
- if (resultSelector == null)
- throw new ArgumentNullException("resultSelector");
-
- return source1.Provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Zip<TSource1, TSource2, TSource3, TResult>(default(IQbservable<TSource1>), default(IObservable<TSource2>), default(IObservable<TSource3>), default(Expression<Func<TSource1, TSource2, TSource3, TResult>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource1), typeof(TSource2), typeof(TSource3), typeof(TResult)),
-#endif
- source1.Expression,
- GetSourceExpression(source2),
- GetSourceExpression(source3),
- resultSelector
- )
- );
- }
-
- /// <summary>
- /// Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index.
- /// </summary>
- /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
- /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
- /// <typeparam name="TSource3">The type of the elements in the third source sequence.</typeparam>
- /// <typeparam name="TSource4">The type of the elements in the fourth source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
- /// <param name="source1">First observable source.</param>
- /// <param name="source2">Second observable source.</param>
- /// <param name="source3">Third observable source.</param>
- /// <param name="source4">Fourth observable source.</param>
- /// <param name="resultSelector">Function to invoke for each series of elements at corresponding indexes in the sources.</param>
- /// <returns>An observable sequence containing the result of combining elements of the sources using the specified result selector function.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source1" /> or <paramref name="source2" /> or <paramref name="source3" /> or <paramref name="source4" /> or <paramref name="resultSelector" /> is null.</exception>
- public static IQbservable<TResult> Zip<TSource1, TSource2, TSource3, TSource4, TResult>(this IQbservable<TSource1> source1, IObservable<TSource2> source2, IObservable<TSource3> source3, IObservable<TSource4> source4, Expression<Func<TSource1, TSource2, TSource3, TSource4, TResult>> resultSelector)
- {
- if (source1 == null)
- throw new ArgumentNullException("source1");
- if (source2 == null)
- throw new ArgumentNullException("source2");
- if (source3 == null)
- throw new ArgumentNullException("source3");
- if (source4 == null)
- throw new ArgumentNullException("source4");
- if (resultSelector == null)
- throw new ArgumentNullException("resultSelector");
-
- return source1.Provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Zip<TSource1, TSource2, TSource3, TSource4, TResult>(default(IQbservable<TSource1>), default(IObservable<TSource2>), default(IObservable<TSource3>), default(IObservable<TSource4>), default(Expression<Func<TSource1, TSource2, TSource3, TSource4, TResult>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource1), typeof(TSource2), typeof(TSource3), typeof(TSource4), typeof(TResult)),
-#endif
- source1.Expression,
- GetSourceExpression(source2),
- GetSourceExpression(source3),
- GetSourceExpression(source4),
- resultSelector
- )
- );
- }
-
-#if !NO_LARGEARITY
- /// <summary>
- /// Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index.
- /// </summary>
- /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
- /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
- /// <typeparam name="TSource3">The type of the elements in the third source sequence.</typeparam>
- /// <typeparam name="TSource4">The type of the elements in the fourth source sequence.</typeparam>
- /// <typeparam name="TSource5">The type of the elements in the fifth source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
- /// <param name="source1">First observable source.</param>
- /// <param name="source2">Second observable source.</param>
- /// <param name="source3">Third observable source.</param>
- /// <param name="source4">Fourth observable source.</param>
- /// <param name="source5">Fifth observable source.</param>
- /// <param name="resultSelector">Function to invoke for each series of elements at corresponding indexes in the sources.</param>
- /// <returns>An observable sequence containing the result of combining elements of the sources using the specified result selector function.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source1" /> or <paramref name="source2" /> or <paramref name="source3" /> or <paramref name="source4" /> or <paramref name="source5" /> or <paramref name="resultSelector" /> is null.</exception>
- public static IQbservable<TResult> Zip<TSource1, TSource2, TSource3, TSource4, TSource5, TResult>(this IQbservable<TSource1> source1, IObservable<TSource2> source2, IObservable<TSource3> source3, IObservable<TSource4> source4, IObservable<TSource5> source5, Expression<Func<TSource1, TSource2, TSource3, TSource4, TSource5, TResult>> resultSelector)
- {
- if (source1 == null)
- throw new ArgumentNullException("source1");
- if (source2 == null)
- throw new ArgumentNullException("source2");
- if (source3 == null)
- throw new ArgumentNullException("source3");
- if (source4 == null)
- throw new ArgumentNullException("source4");
- if (source5 == null)
- throw new ArgumentNullException("source5");
- if (resultSelector == null)
- throw new ArgumentNullException("resultSelector");
-
- return source1.Provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Zip<TSource1, TSource2, TSource3, TSource4, TSource5, TResult>(default(IQbservable<TSource1>), default(IObservable<TSource2>), default(IObservable<TSource3>), default(IObservable<TSource4>), default(IObservable<TSource5>), default(Expression<Func<TSource1, TSource2, TSource3, TSource4, TSource5, TResult>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource1), typeof(TSource2), typeof(TSource3), typeof(TSource4), typeof(TSource5), typeof(TResult)),
-#endif
- source1.Expression,
- GetSourceExpression(source2),
- GetSourceExpression(source3),
- GetSourceExpression(source4),
- GetSourceExpression(source5),
- resultSelector
- )
- );
- }
-#endif
-
-#if !NO_LARGEARITY
- /// <summary>
- /// Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index.
- /// </summary>
- /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
- /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
- /// <typeparam name="TSource3">The type of the elements in the third source sequence.</typeparam>
- /// <typeparam name="TSource4">The type of the elements in the fourth source sequence.</typeparam>
- /// <typeparam name="TSource5">The type of the elements in the fifth source sequence.</typeparam>
- /// <typeparam name="TSource6">The type of the elements in the sixth source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
- /// <param name="source1">First observable source.</param>
- /// <param name="source2">Second observable source.</param>
- /// <param name="source3">Third observable source.</param>
- /// <param name="source4">Fourth observable source.</param>
- /// <param name="source5">Fifth observable source.</param>
- /// <param name="source6">Sixth observable source.</param>
- /// <param name="resultSelector">Function to invoke for each series of elements at corresponding indexes in the sources.</param>
- /// <returns>An observable sequence containing the result of combining elements of the sources using the specified result selector function.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source1" /> or <paramref name="source2" /> or <paramref name="source3" /> or <paramref name="source4" /> or <paramref name="source5" /> or <paramref name="source6" /> or <paramref name="resultSelector" /> is null.</exception>
- public static IQbservable<TResult> Zip<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TResult>(this IQbservable<TSource1> source1, IObservable<TSource2> source2, IObservable<TSource3> source3, IObservable<TSource4> source4, IObservable<TSource5> source5, IObservable<TSource6> source6, Expression<Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TResult>> resultSelector)
- {
- if (source1 == null)
- throw new ArgumentNullException("source1");
- if (source2 == null)
- throw new ArgumentNullException("source2");
- if (source3 == null)
- throw new ArgumentNullException("source3");
- if (source4 == null)
- throw new ArgumentNullException("source4");
- if (source5 == null)
- throw new ArgumentNullException("source5");
- if (source6 == null)
- throw new ArgumentNullException("source6");
- if (resultSelector == null)
- throw new ArgumentNullException("resultSelector");
-
- return source1.Provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Zip<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TResult>(default(IQbservable<TSource1>), default(IObservable<TSource2>), default(IObservable<TSource3>), default(IObservable<TSource4>), default(IObservable<TSource5>), default(IObservable<TSource6>), default(Expression<Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TResult>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource1), typeof(TSource2), typeof(TSource3), typeof(TSource4), typeof(TSource5), typeof(TSource6), typeof(TResult)),
-#endif
- source1.Expression,
- GetSourceExpression(source2),
- GetSourceExpression(source3),
- GetSourceExpression(source4),
- GetSourceExpression(source5),
- GetSourceExpression(source6),
- resultSelector
- )
- );
- }
-#endif
-
-#if !NO_LARGEARITY
- /// <summary>
- /// Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index.
- /// </summary>
- /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
- /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
- /// <typeparam name="TSource3">The type of the elements in the third source sequence.</typeparam>
- /// <typeparam name="TSource4">The type of the elements in the fourth source sequence.</typeparam>
- /// <typeparam name="TSource5">The type of the elements in the fifth source sequence.</typeparam>
- /// <typeparam name="TSource6">The type of the elements in the sixth source sequence.</typeparam>
- /// <typeparam name="TSource7">The type of the elements in the seventh source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
- /// <param name="source1">First observable source.</param>
- /// <param name="source2">Second observable source.</param>
- /// <param name="source3">Third observable source.</param>
- /// <param name="source4">Fourth observable source.</param>
- /// <param name="source5">Fifth observable source.</param>
- /// <param name="source6">Sixth observable source.</param>
- /// <param name="source7">Seventh observable source.</param>
- /// <param name="resultSelector">Function to invoke for each series of elements at corresponding indexes in the sources.</param>
- /// <returns>An observable sequence containing the result of combining elements of the sources using the specified result selector function.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source1" /> or <paramref name="source2" /> or <paramref name="source3" /> or <paramref name="source4" /> or <paramref name="source5" /> or <paramref name="source6" /> or <paramref name="source7" /> or <paramref name="resultSelector" /> is null.</exception>
- public static IQbservable<TResult> Zip<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TResult>(this IQbservable<TSource1> source1, IObservable<TSource2> source2, IObservable<TSource3> source3, IObservable<TSource4> source4, IObservable<TSource5> source5, IObservable<TSource6> source6, IObservable<TSource7> source7, Expression<Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TResult>> resultSelector)
- {
- if (source1 == null)
- throw new ArgumentNullException("source1");
- if (source2 == null)
- throw new ArgumentNullException("source2");
- if (source3 == null)
- throw new ArgumentNullException("source3");
- if (source4 == null)
- throw new ArgumentNullException("source4");
- if (source5 == null)
- throw new ArgumentNullException("source5");
- if (source6 == null)
- throw new ArgumentNullException("source6");
- if (source7 == null)
- throw new ArgumentNullException("source7");
- if (resultSelector == null)
- throw new ArgumentNullException("resultSelector");
-
- return source1.Provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Zip<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TResult>(default(IQbservable<TSource1>), default(IObservable<TSource2>), default(IObservable<TSource3>), default(IObservable<TSource4>), default(IObservable<TSource5>), default(IObservable<TSource6>), default(IObservable<TSource7>), default(Expression<Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TResult>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource1), typeof(TSource2), typeof(TSource3), typeof(TSource4), typeof(TSource5), typeof(TSource6), typeof(TSource7), typeof(TResult)),
-#endif
- source1.Expression,
- GetSourceExpression(source2),
- GetSourceExpression(source3),
- GetSourceExpression(source4),
- GetSourceExpression(source5),
- GetSourceExpression(source6),
- GetSourceExpression(source7),
- resultSelector
- )
- );
- }
-#endif
-
-#if !NO_LARGEARITY
- /// <summary>
- /// Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index.
- /// </summary>
- /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
- /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
- /// <typeparam name="TSource3">The type of the elements in the third source sequence.</typeparam>
- /// <typeparam name="TSource4">The type of the elements in the fourth source sequence.</typeparam>
- /// <typeparam name="TSource5">The type of the elements in the fifth source sequence.</typeparam>
- /// <typeparam name="TSource6">The type of the elements in the sixth source sequence.</typeparam>
- /// <typeparam name="TSource7">The type of the elements in the seventh source sequence.</typeparam>
- /// <typeparam name="TSource8">The type of the elements in the eighth source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
- /// <param name="source1">First observable source.</param>
- /// <param name="source2">Second observable source.</param>
- /// <param name="source3">Third observable source.</param>
- /// <param name="source4">Fourth observable source.</param>
- /// <param name="source5">Fifth observable source.</param>
- /// <param name="source6">Sixth observable source.</param>
- /// <param name="source7">Seventh observable source.</param>
- /// <param name="source8">Eighth observable source.</param>
- /// <param name="resultSelector">Function to invoke for each series of elements at corresponding indexes in the sources.</param>
- /// <returns>An observable sequence containing the result of combining elements of the sources using the specified result selector function.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source1" /> or <paramref name="source2" /> or <paramref name="source3" /> or <paramref name="source4" /> or <paramref name="source5" /> or <paramref name="source6" /> or <paramref name="source7" /> or <paramref name="source8" /> or <paramref name="resultSelector" /> is null.</exception>
- public static IQbservable<TResult> Zip<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TResult>(this IQbservable<TSource1> source1, IObservable<TSource2> source2, IObservable<TSource3> source3, IObservable<TSource4> source4, IObservable<TSource5> source5, IObservable<TSource6> source6, IObservable<TSource7> source7, IObservable<TSource8> source8, Expression<Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TResult>> resultSelector)
- {
- if (source1 == null)
- throw new ArgumentNullException("source1");
- if (source2 == null)
- throw new ArgumentNullException("source2");
- if (source3 == null)
- throw new ArgumentNullException("source3");
- if (source4 == null)
- throw new ArgumentNullException("source4");
- if (source5 == null)
- throw new ArgumentNullException("source5");
- if (source6 == null)
- throw new ArgumentNullException("source6");
- if (source7 == null)
- throw new ArgumentNullException("source7");
- if (source8 == null)
- throw new ArgumentNullException("source8");
- if (resultSelector == null)
- throw new ArgumentNullException("resultSelector");
-
- return source1.Provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Zip<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TResult>(default(IQbservable<TSource1>), default(IObservable<TSource2>), default(IObservable<TSource3>), default(IObservable<TSource4>), default(IObservable<TSource5>), default(IObservable<TSource6>), default(IObservable<TSource7>), default(IObservable<TSource8>), default(Expression<Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TResult>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource1), typeof(TSource2), typeof(TSource3), typeof(TSource4), typeof(TSource5), typeof(TSource6), typeof(TSource7), typeof(TSource8), typeof(TResult)),
-#endif
- source1.Expression,
- GetSourceExpression(source2),
- GetSourceExpression(source3),
- GetSourceExpression(source4),
- GetSourceExpression(source5),
- GetSourceExpression(source6),
- GetSourceExpression(source7),
- GetSourceExpression(source8),
- resultSelector
- )
- );
- }
-#endif
-
-#if !NO_LARGEARITY
- /// <summary>
- /// Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index.
- /// </summary>
- /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
- /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
- /// <typeparam name="TSource3">The type of the elements in the third source sequence.</typeparam>
- /// <typeparam name="TSource4">The type of the elements in the fourth source sequence.</typeparam>
- /// <typeparam name="TSource5">The type of the elements in the fifth source sequence.</typeparam>
- /// <typeparam name="TSource6">The type of the elements in the sixth source sequence.</typeparam>
- /// <typeparam name="TSource7">The type of the elements in the seventh source sequence.</typeparam>
- /// <typeparam name="TSource8">The type of the elements in the eighth source sequence.</typeparam>
- /// <typeparam name="TSource9">The type of the elements in the ninth source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
- /// <param name="source1">First observable source.</param>
- /// <param name="source2">Second observable source.</param>
- /// <param name="source3">Third observable source.</param>
- /// <param name="source4">Fourth observable source.</param>
- /// <param name="source5">Fifth observable source.</param>
- /// <param name="source6">Sixth observable source.</param>
- /// <param name="source7">Seventh observable source.</param>
- /// <param name="source8">Eighth observable source.</param>
- /// <param name="source9">Ninth observable source.</param>
- /// <param name="resultSelector">Function to invoke for each series of elements at corresponding indexes in the sources.</param>
- /// <returns>An observable sequence containing the result of combining elements of the sources using the specified result selector function.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source1" /> or <paramref name="source2" /> or <paramref name="source3" /> or <paramref name="source4" /> or <paramref name="source5" /> or <paramref name="source6" /> or <paramref name="source7" /> or <paramref name="source8" /> or <paramref name="source9" /> or <paramref name="resultSelector" /> is null.</exception>
- public static IQbservable<TResult> Zip<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TResult>(this IQbservable<TSource1> source1, IObservable<TSource2> source2, IObservable<TSource3> source3, IObservable<TSource4> source4, IObservable<TSource5> source5, IObservable<TSource6> source6, IObservable<TSource7> source7, IObservable<TSource8> source8, IObservable<TSource9> source9, Expression<Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TResult>> resultSelector)
- {
- if (source1 == null)
- throw new ArgumentNullException("source1");
- if (source2 == null)
- throw new ArgumentNullException("source2");
- if (source3 == null)
- throw new ArgumentNullException("source3");
- if (source4 == null)
- throw new ArgumentNullException("source4");
- if (source5 == null)
- throw new ArgumentNullException("source5");
- if (source6 == null)
- throw new ArgumentNullException("source6");
- if (source7 == null)
- throw new ArgumentNullException("source7");
- if (source8 == null)
- throw new ArgumentNullException("source8");
- if (source9 == null)
- throw new ArgumentNullException("source9");
- if (resultSelector == null)
- throw new ArgumentNullException("resultSelector");
-
- return source1.Provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Zip<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TResult>(default(IQbservable<TSource1>), default(IObservable<TSource2>), default(IObservable<TSource3>), default(IObservable<TSource4>), default(IObservable<TSource5>), default(IObservable<TSource6>), default(IObservable<TSource7>), default(IObservable<TSource8>), default(IObservable<TSource9>), default(Expression<Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TResult>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource1), typeof(TSource2), typeof(TSource3), typeof(TSource4), typeof(TSource5), typeof(TSource6), typeof(TSource7), typeof(TSource8), typeof(TSource9), typeof(TResult)),
-#endif
- source1.Expression,
- GetSourceExpression(source2),
- GetSourceExpression(source3),
- GetSourceExpression(source4),
- GetSourceExpression(source5),
- GetSourceExpression(source6),
- GetSourceExpression(source7),
- GetSourceExpression(source8),
- GetSourceExpression(source9),
- resultSelector
- )
- );
- }
-#endif
-
-#if !NO_LARGEARITY
- /// <summary>
- /// Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index.
- /// </summary>
- /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
- /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
- /// <typeparam name="TSource3">The type of the elements in the third source sequence.</typeparam>
- /// <typeparam name="TSource4">The type of the elements in the fourth source sequence.</typeparam>
- /// <typeparam name="TSource5">The type of the elements in the fifth source sequence.</typeparam>
- /// <typeparam name="TSource6">The type of the elements in the sixth source sequence.</typeparam>
- /// <typeparam name="TSource7">The type of the elements in the seventh source sequence.</typeparam>
- /// <typeparam name="TSource8">The type of the elements in the eighth source sequence.</typeparam>
- /// <typeparam name="TSource9">The type of the elements in the ninth source sequence.</typeparam>
- /// <typeparam name="TSource10">The type of the elements in the tenth source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
- /// <param name="source1">First observable source.</param>
- /// <param name="source2">Second observable source.</param>
- /// <param name="source3">Third observable source.</param>
- /// <param name="source4">Fourth observable source.</param>
- /// <param name="source5">Fifth observable source.</param>
- /// <param name="source6">Sixth observable source.</param>
- /// <param name="source7">Seventh observable source.</param>
- /// <param name="source8">Eighth observable source.</param>
- /// <param name="source9">Ninth observable source.</param>
- /// <param name="source10">Tenth observable source.</param>
- /// <param name="resultSelector">Function to invoke for each series of elements at corresponding indexes in the sources.</param>
- /// <returns>An observable sequence containing the result of combining elements of the sources using the specified result selector function.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source1" /> or <paramref name="source2" /> or <paramref name="source3" /> or <paramref name="source4" /> or <paramref name="source5" /> or <paramref name="source6" /> or <paramref name="source7" /> or <paramref name="source8" /> or <paramref name="source9" /> or <paramref name="source10" /> or <paramref name="resultSelector" /> is null.</exception>
- public static IQbservable<TResult> Zip<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TResult>(this IQbservable<TSource1> source1, IObservable<TSource2> source2, IObservable<TSource3> source3, IObservable<TSource4> source4, IObservable<TSource5> source5, IObservable<TSource6> source6, IObservable<TSource7> source7, IObservable<TSource8> source8, IObservable<TSource9> source9, IObservable<TSource10> source10, Expression<Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TResult>> resultSelector)
- {
- if (source1 == null)
- throw new ArgumentNullException("source1");
- if (source2 == null)
- throw new ArgumentNullException("source2");
- if (source3 == null)
- throw new ArgumentNullException("source3");
- if (source4 == null)
- throw new ArgumentNullException("source4");
- if (source5 == null)
- throw new ArgumentNullException("source5");
- if (source6 == null)
- throw new ArgumentNullException("source6");
- if (source7 == null)
- throw new ArgumentNullException("source7");
- if (source8 == null)
- throw new ArgumentNullException("source8");
- if (source9 == null)
- throw new ArgumentNullException("source9");
- if (source10 == null)
- throw new ArgumentNullException("source10");
- if (resultSelector == null)
- throw new ArgumentNullException("resultSelector");
-
- return source1.Provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Zip<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TResult>(default(IQbservable<TSource1>), default(IObservable<TSource2>), default(IObservable<TSource3>), default(IObservable<TSource4>), default(IObservable<TSource5>), default(IObservable<TSource6>), default(IObservable<TSource7>), default(IObservable<TSource8>), default(IObservable<TSource9>), default(IObservable<TSource10>), default(Expression<Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TResult>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource1), typeof(TSource2), typeof(TSource3), typeof(TSource4), typeof(TSource5), typeof(TSource6), typeof(TSource7), typeof(TSource8), typeof(TSource9), typeof(TSource10), typeof(TResult)),
-#endif
- source1.Expression,
- GetSourceExpression(source2),
- GetSourceExpression(source3),
- GetSourceExpression(source4),
- GetSourceExpression(source5),
- GetSourceExpression(source6),
- GetSourceExpression(source7),
- GetSourceExpression(source8),
- GetSourceExpression(source9),
- GetSourceExpression(source10),
- resultSelector
- )
- );
- }
-#endif
-
-#if !NO_LARGEARITY
- /// <summary>
- /// Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index.
- /// </summary>
- /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
- /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
- /// <typeparam name="TSource3">The type of the elements in the third source sequence.</typeparam>
- /// <typeparam name="TSource4">The type of the elements in the fourth source sequence.</typeparam>
- /// <typeparam name="TSource5">The type of the elements in the fifth source sequence.</typeparam>
- /// <typeparam name="TSource6">The type of the elements in the sixth source sequence.</typeparam>
- /// <typeparam name="TSource7">The type of the elements in the seventh source sequence.</typeparam>
- /// <typeparam name="TSource8">The type of the elements in the eighth source sequence.</typeparam>
- /// <typeparam name="TSource9">The type of the elements in the ninth source sequence.</typeparam>
- /// <typeparam name="TSource10">The type of the elements in the tenth source sequence.</typeparam>
- /// <typeparam name="TSource11">The type of the elements in the eleventh source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
- /// <param name="source1">First observable source.</param>
- /// <param name="source2">Second observable source.</param>
- /// <param name="source3">Third observable source.</param>
- /// <param name="source4">Fourth observable source.</param>
- /// <param name="source5">Fifth observable source.</param>
- /// <param name="source6">Sixth observable source.</param>
- /// <param name="source7">Seventh observable source.</param>
- /// <param name="source8">Eighth observable source.</param>
- /// <param name="source9">Ninth observable source.</param>
- /// <param name="source10">Tenth observable source.</param>
- /// <param name="source11">Eleventh observable source.</param>
- /// <param name="resultSelector">Function to invoke for each series of elements at corresponding indexes in the sources.</param>
- /// <returns>An observable sequence containing the result of combining elements of the sources using the specified result selector function.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source1" /> or <paramref name="source2" /> or <paramref name="source3" /> or <paramref name="source4" /> or <paramref name="source5" /> or <paramref name="source6" /> or <paramref name="source7" /> or <paramref name="source8" /> or <paramref name="source9" /> or <paramref name="source10" /> or <paramref name="source11" /> or <paramref name="resultSelector" /> is null.</exception>
- public static IQbservable<TResult> Zip<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TResult>(this IQbservable<TSource1> source1, IObservable<TSource2> source2, IObservable<TSource3> source3, IObservable<TSource4> source4, IObservable<TSource5> source5, IObservable<TSource6> source6, IObservable<TSource7> source7, IObservable<TSource8> source8, IObservable<TSource9> source9, IObservable<TSource10> source10, IObservable<TSource11> source11, Expression<Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TResult>> resultSelector)
- {
- if (source1 == null)
- throw new ArgumentNullException("source1");
- if (source2 == null)
- throw new ArgumentNullException("source2");
- if (source3 == null)
- throw new ArgumentNullException("source3");
- if (source4 == null)
- throw new ArgumentNullException("source4");
- if (source5 == null)
- throw new ArgumentNullException("source5");
- if (source6 == null)
- throw new ArgumentNullException("source6");
- if (source7 == null)
- throw new ArgumentNullException("source7");
- if (source8 == null)
- throw new ArgumentNullException("source8");
- if (source9 == null)
- throw new ArgumentNullException("source9");
- if (source10 == null)
- throw new ArgumentNullException("source10");
- if (source11 == null)
- throw new ArgumentNullException("source11");
- if (resultSelector == null)
- throw new ArgumentNullException("resultSelector");
-
- return source1.Provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Zip<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TResult>(default(IQbservable<TSource1>), default(IObservable<TSource2>), default(IObservable<TSource3>), default(IObservable<TSource4>), default(IObservable<TSource5>), default(IObservable<TSource6>), default(IObservable<TSource7>), default(IObservable<TSource8>), default(IObservable<TSource9>), default(IObservable<TSource10>), default(IObservable<TSource11>), default(Expression<Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TResult>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource1), typeof(TSource2), typeof(TSource3), typeof(TSource4), typeof(TSource5), typeof(TSource6), typeof(TSource7), typeof(TSource8), typeof(TSource9), typeof(TSource10), typeof(TSource11), typeof(TResult)),
-#endif
- source1.Expression,
- GetSourceExpression(source2),
- GetSourceExpression(source3),
- GetSourceExpression(source4),
- GetSourceExpression(source5),
- GetSourceExpression(source6),
- GetSourceExpression(source7),
- GetSourceExpression(source8),
- GetSourceExpression(source9),
- GetSourceExpression(source10),
- GetSourceExpression(source11),
- resultSelector
- )
- );
- }
-#endif
-
-#if !NO_LARGEARITY
- /// <summary>
- /// Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index.
- /// </summary>
- /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
- /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
- /// <typeparam name="TSource3">The type of the elements in the third source sequence.</typeparam>
- /// <typeparam name="TSource4">The type of the elements in the fourth source sequence.</typeparam>
- /// <typeparam name="TSource5">The type of the elements in the fifth source sequence.</typeparam>
- /// <typeparam name="TSource6">The type of the elements in the sixth source sequence.</typeparam>
- /// <typeparam name="TSource7">The type of the elements in the seventh source sequence.</typeparam>
- /// <typeparam name="TSource8">The type of the elements in the eighth source sequence.</typeparam>
- /// <typeparam name="TSource9">The type of the elements in the ninth source sequence.</typeparam>
- /// <typeparam name="TSource10">The type of the elements in the tenth source sequence.</typeparam>
- /// <typeparam name="TSource11">The type of the elements in the eleventh source sequence.</typeparam>
- /// <typeparam name="TSource12">The type of the elements in the twelfth source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
- /// <param name="source1">First observable source.</param>
- /// <param name="source2">Second observable source.</param>
- /// <param name="source3">Third observable source.</param>
- /// <param name="source4">Fourth observable source.</param>
- /// <param name="source5">Fifth observable source.</param>
- /// <param name="source6">Sixth observable source.</param>
- /// <param name="source7">Seventh observable source.</param>
- /// <param name="source8">Eighth observable source.</param>
- /// <param name="source9">Ninth observable source.</param>
- /// <param name="source10">Tenth observable source.</param>
- /// <param name="source11">Eleventh observable source.</param>
- /// <param name="source12">Twelfth observable source.</param>
- /// <param name="resultSelector">Function to invoke for each series of elements at corresponding indexes in the sources.</param>
- /// <returns>An observable sequence containing the result of combining elements of the sources using the specified result selector function.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source1" /> or <paramref name="source2" /> or <paramref name="source3" /> or <paramref name="source4" /> or <paramref name="source5" /> or <paramref name="source6" /> or <paramref name="source7" /> or <paramref name="source8" /> or <paramref name="source9" /> or <paramref name="source10" /> or <paramref name="source11" /> or <paramref name="source12" /> or <paramref name="resultSelector" /> is null.</exception>
- public static IQbservable<TResult> Zip<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TResult>(this IQbservable<TSource1> source1, IObservable<TSource2> source2, IObservable<TSource3> source3, IObservable<TSource4> source4, IObservable<TSource5> source5, IObservable<TSource6> source6, IObservable<TSource7> source7, IObservable<TSource8> source8, IObservable<TSource9> source9, IObservable<TSource10> source10, IObservable<TSource11> source11, IObservable<TSource12> source12, Expression<Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TResult>> resultSelector)
- {
- if (source1 == null)
- throw new ArgumentNullException("source1");
- if (source2 == null)
- throw new ArgumentNullException("source2");
- if (source3 == null)
- throw new ArgumentNullException("source3");
- if (source4 == null)
- throw new ArgumentNullException("source4");
- if (source5 == null)
- throw new ArgumentNullException("source5");
- if (source6 == null)
- throw new ArgumentNullException("source6");
- if (source7 == null)
- throw new ArgumentNullException("source7");
- if (source8 == null)
- throw new ArgumentNullException("source8");
- if (source9 == null)
- throw new ArgumentNullException("source9");
- if (source10 == null)
- throw new ArgumentNullException("source10");
- if (source11 == null)
- throw new ArgumentNullException("source11");
- if (source12 == null)
- throw new ArgumentNullException("source12");
- if (resultSelector == null)
- throw new ArgumentNullException("resultSelector");
-
- return source1.Provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Zip<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TResult>(default(IQbservable<TSource1>), default(IObservable<TSource2>), default(IObservable<TSource3>), default(IObservable<TSource4>), default(IObservable<TSource5>), default(IObservable<TSource6>), default(IObservable<TSource7>), default(IObservable<TSource8>), default(IObservable<TSource9>), default(IObservable<TSource10>), default(IObservable<TSource11>), default(IObservable<TSource12>), default(Expression<Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TResult>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource1), typeof(TSource2), typeof(TSource3), typeof(TSource4), typeof(TSource5), typeof(TSource6), typeof(TSource7), typeof(TSource8), typeof(TSource9), typeof(TSource10), typeof(TSource11), typeof(TSource12), typeof(TResult)),
-#endif
- source1.Expression,
- GetSourceExpression(source2),
- GetSourceExpression(source3),
- GetSourceExpression(source4),
- GetSourceExpression(source5),
- GetSourceExpression(source6),
- GetSourceExpression(source7),
- GetSourceExpression(source8),
- GetSourceExpression(source9),
- GetSourceExpression(source10),
- GetSourceExpression(source11),
- GetSourceExpression(source12),
- resultSelector
- )
- );
- }
-#endif
-
-#if !NO_LARGEARITY
- /// <summary>
- /// Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index.
- /// </summary>
- /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
- /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
- /// <typeparam name="TSource3">The type of the elements in the third source sequence.</typeparam>
- /// <typeparam name="TSource4">The type of the elements in the fourth source sequence.</typeparam>
- /// <typeparam name="TSource5">The type of the elements in the fifth source sequence.</typeparam>
- /// <typeparam name="TSource6">The type of the elements in the sixth source sequence.</typeparam>
- /// <typeparam name="TSource7">The type of the elements in the seventh source sequence.</typeparam>
- /// <typeparam name="TSource8">The type of the elements in the eighth source sequence.</typeparam>
- /// <typeparam name="TSource9">The type of the elements in the ninth source sequence.</typeparam>
- /// <typeparam name="TSource10">The type of the elements in the tenth source sequence.</typeparam>
- /// <typeparam name="TSource11">The type of the elements in the eleventh source sequence.</typeparam>
- /// <typeparam name="TSource12">The type of the elements in the twelfth source sequence.</typeparam>
- /// <typeparam name="TSource13">The type of the elements in the thirteenth source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
- /// <param name="source1">First observable source.</param>
- /// <param name="source2">Second observable source.</param>
- /// <param name="source3">Third observable source.</param>
- /// <param name="source4">Fourth observable source.</param>
- /// <param name="source5">Fifth observable source.</param>
- /// <param name="source6">Sixth observable source.</param>
- /// <param name="source7">Seventh observable source.</param>
- /// <param name="source8">Eighth observable source.</param>
- /// <param name="source9">Ninth observable source.</param>
- /// <param name="source10">Tenth observable source.</param>
- /// <param name="source11">Eleventh observable source.</param>
- /// <param name="source12">Twelfth observable source.</param>
- /// <param name="source13">Thirteenth observable source.</param>
- /// <param name="resultSelector">Function to invoke for each series of elements at corresponding indexes in the sources.</param>
- /// <returns>An observable sequence containing the result of combining elements of the sources using the specified result selector function.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source1" /> or <paramref name="source2" /> or <paramref name="source3" /> or <paramref name="source4" /> or <paramref name="source5" /> or <paramref name="source6" /> or <paramref name="source7" /> or <paramref name="source8" /> or <paramref name="source9" /> or <paramref name="source10" /> or <paramref name="source11" /> or <paramref name="source12" /> or <paramref name="source13" /> or <paramref name="resultSelector" /> is null.</exception>
- public static IQbservable<TResult> Zip<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TResult>(this IQbservable<TSource1> source1, IObservable<TSource2> source2, IObservable<TSource3> source3, IObservable<TSource4> source4, IObservable<TSource5> source5, IObservable<TSource6> source6, IObservable<TSource7> source7, IObservable<TSource8> source8, IObservable<TSource9> source9, IObservable<TSource10> source10, IObservable<TSource11> source11, IObservable<TSource12> source12, IObservable<TSource13> source13, Expression<Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TResult>> resultSelector)
- {
- if (source1 == null)
- throw new ArgumentNullException("source1");
- if (source2 == null)
- throw new ArgumentNullException("source2");
- if (source3 == null)
- throw new ArgumentNullException("source3");
- if (source4 == null)
- throw new ArgumentNullException("source4");
- if (source5 == null)
- throw new ArgumentNullException("source5");
- if (source6 == null)
- throw new ArgumentNullException("source6");
- if (source7 == null)
- throw new ArgumentNullException("source7");
- if (source8 == null)
- throw new ArgumentNullException("source8");
- if (source9 == null)
- throw new ArgumentNullException("source9");
- if (source10 == null)
- throw new ArgumentNullException("source10");
- if (source11 == null)
- throw new ArgumentNullException("source11");
- if (source12 == null)
- throw new ArgumentNullException("source12");
- if (source13 == null)
- throw new ArgumentNullException("source13");
- if (resultSelector == null)
- throw new ArgumentNullException("resultSelector");
-
- return source1.Provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Zip<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TResult>(default(IQbservable<TSource1>), default(IObservable<TSource2>), default(IObservable<TSource3>), default(IObservable<TSource4>), default(IObservable<TSource5>), default(IObservable<TSource6>), default(IObservable<TSource7>), default(IObservable<TSource8>), default(IObservable<TSource9>), default(IObservable<TSource10>), default(IObservable<TSource11>), default(IObservable<TSource12>), default(IObservable<TSource13>), default(Expression<Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TResult>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource1), typeof(TSource2), typeof(TSource3), typeof(TSource4), typeof(TSource5), typeof(TSource6), typeof(TSource7), typeof(TSource8), typeof(TSource9), typeof(TSource10), typeof(TSource11), typeof(TSource12), typeof(TSource13), typeof(TResult)),
-#endif
- source1.Expression,
- GetSourceExpression(source2),
- GetSourceExpression(source3),
- GetSourceExpression(source4),
- GetSourceExpression(source5),
- GetSourceExpression(source6),
- GetSourceExpression(source7),
- GetSourceExpression(source8),
- GetSourceExpression(source9),
- GetSourceExpression(source10),
- GetSourceExpression(source11),
- GetSourceExpression(source12),
- GetSourceExpression(source13),
- resultSelector
- )
- );
- }
-#endif
-
-#if !NO_LARGEARITY
- /// <summary>
- /// Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index.
- /// </summary>
- /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
- /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
- /// <typeparam name="TSource3">The type of the elements in the third source sequence.</typeparam>
- /// <typeparam name="TSource4">The type of the elements in the fourth source sequence.</typeparam>
- /// <typeparam name="TSource5">The type of the elements in the fifth source sequence.</typeparam>
- /// <typeparam name="TSource6">The type of the elements in the sixth source sequence.</typeparam>
- /// <typeparam name="TSource7">The type of the elements in the seventh source sequence.</typeparam>
- /// <typeparam name="TSource8">The type of the elements in the eighth source sequence.</typeparam>
- /// <typeparam name="TSource9">The type of the elements in the ninth source sequence.</typeparam>
- /// <typeparam name="TSource10">The type of the elements in the tenth source sequence.</typeparam>
- /// <typeparam name="TSource11">The type of the elements in the eleventh source sequence.</typeparam>
- /// <typeparam name="TSource12">The type of the elements in the twelfth source sequence.</typeparam>
- /// <typeparam name="TSource13">The type of the elements in the thirteenth source sequence.</typeparam>
- /// <typeparam name="TSource14">The type of the elements in the fourteenth source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
- /// <param name="source1">First observable source.</param>
- /// <param name="source2">Second observable source.</param>
- /// <param name="source3">Third observable source.</param>
- /// <param name="source4">Fourth observable source.</param>
- /// <param name="source5">Fifth observable source.</param>
- /// <param name="source6">Sixth observable source.</param>
- /// <param name="source7">Seventh observable source.</param>
- /// <param name="source8">Eighth observable source.</param>
- /// <param name="source9">Ninth observable source.</param>
- /// <param name="source10">Tenth observable source.</param>
- /// <param name="source11">Eleventh observable source.</param>
- /// <param name="source12">Twelfth observable source.</param>
- /// <param name="source13">Thirteenth observable source.</param>
- /// <param name="source14">Fourteenth observable source.</param>
- /// <param name="resultSelector">Function to invoke for each series of elements at corresponding indexes in the sources.</param>
- /// <returns>An observable sequence containing the result of combining elements of the sources using the specified result selector function.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source1" /> or <paramref name="source2" /> or <paramref name="source3" /> or <paramref name="source4" /> or <paramref name="source5" /> or <paramref name="source6" /> or <paramref name="source7" /> or <paramref name="source8" /> or <paramref name="source9" /> or <paramref name="source10" /> or <paramref name="source11" /> or <paramref name="source12" /> or <paramref name="source13" /> or <paramref name="source14" /> or <paramref name="resultSelector" /> is null.</exception>
- public static IQbservable<TResult> Zip<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TSource14, TResult>(this IQbservable<TSource1> source1, IObservable<TSource2> source2, IObservable<TSource3> source3, IObservable<TSource4> source4, IObservable<TSource5> source5, IObservable<TSource6> source6, IObservable<TSource7> source7, IObservable<TSource8> source8, IObservable<TSource9> source9, IObservable<TSource10> source10, IObservable<TSource11> source11, IObservable<TSource12> source12, IObservable<TSource13> source13, IObservable<TSource14> source14, Expression<Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TSource14, TResult>> resultSelector)
- {
- if (source1 == null)
- throw new ArgumentNullException("source1");
- if (source2 == null)
- throw new ArgumentNullException("source2");
- if (source3 == null)
- throw new ArgumentNullException("source3");
- if (source4 == null)
- throw new ArgumentNullException("source4");
- if (source5 == null)
- throw new ArgumentNullException("source5");
- if (source6 == null)
- throw new ArgumentNullException("source6");
- if (source7 == null)
- throw new ArgumentNullException("source7");
- if (source8 == null)
- throw new ArgumentNullException("source8");
- if (source9 == null)
- throw new ArgumentNullException("source9");
- if (source10 == null)
- throw new ArgumentNullException("source10");
- if (source11 == null)
- throw new ArgumentNullException("source11");
- if (source12 == null)
- throw new ArgumentNullException("source12");
- if (source13 == null)
- throw new ArgumentNullException("source13");
- if (source14 == null)
- throw new ArgumentNullException("source14");
- if (resultSelector == null)
- throw new ArgumentNullException("resultSelector");
-
- return source1.Provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Zip<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TSource14, TResult>(default(IQbservable<TSource1>), default(IObservable<TSource2>), default(IObservable<TSource3>), default(IObservable<TSource4>), default(IObservable<TSource5>), default(IObservable<TSource6>), default(IObservable<TSource7>), default(IObservable<TSource8>), default(IObservable<TSource9>), default(IObservable<TSource10>), default(IObservable<TSource11>), default(IObservable<TSource12>), default(IObservable<TSource13>), default(IObservable<TSource14>), default(Expression<Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TSource14, TResult>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource1), typeof(TSource2), typeof(TSource3), typeof(TSource4), typeof(TSource5), typeof(TSource6), typeof(TSource7), typeof(TSource8), typeof(TSource9), typeof(TSource10), typeof(TSource11), typeof(TSource12), typeof(TSource13), typeof(TSource14), typeof(TResult)),
-#endif
- source1.Expression,
- GetSourceExpression(source2),
- GetSourceExpression(source3),
- GetSourceExpression(source4),
- GetSourceExpression(source5),
- GetSourceExpression(source6),
- GetSourceExpression(source7),
- GetSourceExpression(source8),
- GetSourceExpression(source9),
- GetSourceExpression(source10),
- GetSourceExpression(source11),
- GetSourceExpression(source12),
- GetSourceExpression(source13),
- GetSourceExpression(source14),
- resultSelector
- )
- );
- }
-#endif
-
-#if !NO_LARGEARITY
- /// <summary>
- /// Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index.
- /// </summary>
- /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
- /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
- /// <typeparam name="TSource3">The type of the elements in the third source sequence.</typeparam>
- /// <typeparam name="TSource4">The type of the elements in the fourth source sequence.</typeparam>
- /// <typeparam name="TSource5">The type of the elements in the fifth source sequence.</typeparam>
- /// <typeparam name="TSource6">The type of the elements in the sixth source sequence.</typeparam>
- /// <typeparam name="TSource7">The type of the elements in the seventh source sequence.</typeparam>
- /// <typeparam name="TSource8">The type of the elements in the eighth source sequence.</typeparam>
- /// <typeparam name="TSource9">The type of the elements in the ninth source sequence.</typeparam>
- /// <typeparam name="TSource10">The type of the elements in the tenth source sequence.</typeparam>
- /// <typeparam name="TSource11">The type of the elements in the eleventh source sequence.</typeparam>
- /// <typeparam name="TSource12">The type of the elements in the twelfth source sequence.</typeparam>
- /// <typeparam name="TSource13">The type of the elements in the thirteenth source sequence.</typeparam>
- /// <typeparam name="TSource14">The type of the elements in the fourteenth source sequence.</typeparam>
- /// <typeparam name="TSource15">The type of the elements in the fifteenth source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
- /// <param name="source1">First observable source.</param>
- /// <param name="source2">Second observable source.</param>
- /// <param name="source3">Third observable source.</param>
- /// <param name="source4">Fourth observable source.</param>
- /// <param name="source5">Fifth observable source.</param>
- /// <param name="source6">Sixth observable source.</param>
- /// <param name="source7">Seventh observable source.</param>
- /// <param name="source8">Eighth observable source.</param>
- /// <param name="source9">Ninth observable source.</param>
- /// <param name="source10">Tenth observable source.</param>
- /// <param name="source11">Eleventh observable source.</param>
- /// <param name="source12">Twelfth observable source.</param>
- /// <param name="source13">Thirteenth observable source.</param>
- /// <param name="source14">Fourteenth observable source.</param>
- /// <param name="source15">Fifteenth observable source.</param>
- /// <param name="resultSelector">Function to invoke for each series of elements at corresponding indexes in the sources.</param>
- /// <returns>An observable sequence containing the result of combining elements of the sources using the specified result selector function.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source1" /> or <paramref name="source2" /> or <paramref name="source3" /> or <paramref name="source4" /> or <paramref name="source5" /> or <paramref name="source6" /> or <paramref name="source7" /> or <paramref name="source8" /> or <paramref name="source9" /> or <paramref name="source10" /> or <paramref name="source11" /> or <paramref name="source12" /> or <paramref name="source13" /> or <paramref name="source14" /> or <paramref name="source15" /> or <paramref name="resultSelector" /> is null.</exception>
- public static IQbservable<TResult> Zip<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TSource14, TSource15, TResult>(this IQbservable<TSource1> source1, IObservable<TSource2> source2, IObservable<TSource3> source3, IObservable<TSource4> source4, IObservable<TSource5> source5, IObservable<TSource6> source6, IObservable<TSource7> source7, IObservable<TSource8> source8, IObservable<TSource9> source9, IObservable<TSource10> source10, IObservable<TSource11> source11, IObservable<TSource12> source12, IObservable<TSource13> source13, IObservable<TSource14> source14, IObservable<TSource15> source15, Expression<Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TSource14, TSource15, TResult>> resultSelector)
- {
- if (source1 == null)
- throw new ArgumentNullException("source1");
- if (source2 == null)
- throw new ArgumentNullException("source2");
- if (source3 == null)
- throw new ArgumentNullException("source3");
- if (source4 == null)
- throw new ArgumentNullException("source4");
- if (source5 == null)
- throw new ArgumentNullException("source5");
- if (source6 == null)
- throw new ArgumentNullException("source6");
- if (source7 == null)
- throw new ArgumentNullException("source7");
- if (source8 == null)
- throw new ArgumentNullException("source8");
- if (source9 == null)
- throw new ArgumentNullException("source9");
- if (source10 == null)
- throw new ArgumentNullException("source10");
- if (source11 == null)
- throw new ArgumentNullException("source11");
- if (source12 == null)
- throw new ArgumentNullException("source12");
- if (source13 == null)
- throw new ArgumentNullException("source13");
- if (source14 == null)
- throw new ArgumentNullException("source14");
- if (source15 == null)
- throw new ArgumentNullException("source15");
- if (resultSelector == null)
- throw new ArgumentNullException("resultSelector");
-
- return source1.Provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Zip<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TSource14, TSource15, TResult>(default(IQbservable<TSource1>), default(IObservable<TSource2>), default(IObservable<TSource3>), default(IObservable<TSource4>), default(IObservable<TSource5>), default(IObservable<TSource6>), default(IObservable<TSource7>), default(IObservable<TSource8>), default(IObservable<TSource9>), default(IObservable<TSource10>), default(IObservable<TSource11>), default(IObservable<TSource12>), default(IObservable<TSource13>), default(IObservable<TSource14>), default(IObservable<TSource15>), default(Expression<Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TSource14, TSource15, TResult>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource1), typeof(TSource2), typeof(TSource3), typeof(TSource4), typeof(TSource5), typeof(TSource6), typeof(TSource7), typeof(TSource8), typeof(TSource9), typeof(TSource10), typeof(TSource11), typeof(TSource12), typeof(TSource13), typeof(TSource14), typeof(TSource15), typeof(TResult)),
-#endif
- source1.Expression,
- GetSourceExpression(source2),
- GetSourceExpression(source3),
- GetSourceExpression(source4),
- GetSourceExpression(source5),
- GetSourceExpression(source6),
- GetSourceExpression(source7),
- GetSourceExpression(source8),
- GetSourceExpression(source9),
- GetSourceExpression(source10),
- GetSourceExpression(source11),
- GetSourceExpression(source12),
- GetSourceExpression(source13),
- GetSourceExpression(source14),
- GetSourceExpression(source15),
- resultSelector
- )
- );
- }
-#endif
-
-#if !NO_LARGEARITY
- /// <summary>
- /// Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index.
- /// </summary>
- /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
- /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
- /// <typeparam name="TSource3">The type of the elements in the third source sequence.</typeparam>
- /// <typeparam name="TSource4">The type of the elements in the fourth source sequence.</typeparam>
- /// <typeparam name="TSource5">The type of the elements in the fifth source sequence.</typeparam>
- /// <typeparam name="TSource6">The type of the elements in the sixth source sequence.</typeparam>
- /// <typeparam name="TSource7">The type of the elements in the seventh source sequence.</typeparam>
- /// <typeparam name="TSource8">The type of the elements in the eighth source sequence.</typeparam>
- /// <typeparam name="TSource9">The type of the elements in the ninth source sequence.</typeparam>
- /// <typeparam name="TSource10">The type of the elements in the tenth source sequence.</typeparam>
- /// <typeparam name="TSource11">The type of the elements in the eleventh source sequence.</typeparam>
- /// <typeparam name="TSource12">The type of the elements in the twelfth source sequence.</typeparam>
- /// <typeparam name="TSource13">The type of the elements in the thirteenth source sequence.</typeparam>
- /// <typeparam name="TSource14">The type of the elements in the fourteenth source sequence.</typeparam>
- /// <typeparam name="TSource15">The type of the elements in the fifteenth source sequence.</typeparam>
- /// <typeparam name="TSource16">The type of the elements in the sixteenth source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
- /// <param name="source1">First observable source.</param>
- /// <param name="source2">Second observable source.</param>
- /// <param name="source3">Third observable source.</param>
- /// <param name="source4">Fourth observable source.</param>
- /// <param name="source5">Fifth observable source.</param>
- /// <param name="source6">Sixth observable source.</param>
- /// <param name="source7">Seventh observable source.</param>
- /// <param name="source8">Eighth observable source.</param>
- /// <param name="source9">Ninth observable source.</param>
- /// <param name="source10">Tenth observable source.</param>
- /// <param name="source11">Eleventh observable source.</param>
- /// <param name="source12">Twelfth observable source.</param>
- /// <param name="source13">Thirteenth observable source.</param>
- /// <param name="source14">Fourteenth observable source.</param>
- /// <param name="source15">Fifteenth observable source.</param>
- /// <param name="source16">Sixteenth observable source.</param>
- /// <param name="resultSelector">Function to invoke for each series of elements at corresponding indexes in the sources.</param>
- /// <returns>An observable sequence containing the result of combining elements of the sources using the specified result selector function.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="source1" /> or <paramref name="source2" /> or <paramref name="source3" /> or <paramref name="source4" /> or <paramref name="source5" /> or <paramref name="source6" /> or <paramref name="source7" /> or <paramref name="source8" /> or <paramref name="source9" /> or <paramref name="source10" /> or <paramref name="source11" /> or <paramref name="source12" /> or <paramref name="source13" /> or <paramref name="source14" /> or <paramref name="source15" /> or <paramref name="source16" /> or <paramref name="resultSelector" /> is null.</exception>
- public static IQbservable<TResult> Zip<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TSource14, TSource15, TSource16, TResult>(this IQbservable<TSource1> source1, IObservable<TSource2> source2, IObservable<TSource3> source3, IObservable<TSource4> source4, IObservable<TSource5> source5, IObservable<TSource6> source6, IObservable<TSource7> source7, IObservable<TSource8> source8, IObservable<TSource9> source9, IObservable<TSource10> source10, IObservable<TSource11> source11, IObservable<TSource12> source12, IObservable<TSource13> source13, IObservable<TSource14> source14, IObservable<TSource15> source15, IObservable<TSource16> source16, Expression<Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TSource14, TSource15, TSource16, TResult>> resultSelector)
- {
- if (source1 == null)
- throw new ArgumentNullException("source1");
- if (source2 == null)
- throw new ArgumentNullException("source2");
- if (source3 == null)
- throw new ArgumentNullException("source3");
- if (source4 == null)
- throw new ArgumentNullException("source4");
- if (source5 == null)
- throw new ArgumentNullException("source5");
- if (source6 == null)
- throw new ArgumentNullException("source6");
- if (source7 == null)
- throw new ArgumentNullException("source7");
- if (source8 == null)
- throw new ArgumentNullException("source8");
- if (source9 == null)
- throw new ArgumentNullException("source9");
- if (source10 == null)
- throw new ArgumentNullException("source10");
- if (source11 == null)
- throw new ArgumentNullException("source11");
- if (source12 == null)
- throw new ArgumentNullException("source12");
- if (source13 == null)
- throw new ArgumentNullException("source13");
- if (source14 == null)
- throw new ArgumentNullException("source14");
- if (source15 == null)
- throw new ArgumentNullException("source15");
- if (source16 == null)
- throw new ArgumentNullException("source16");
- if (resultSelector == null)
- throw new ArgumentNullException("resultSelector");
-
- return source1.Provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Zip<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TSource14, TSource15, TSource16, TResult>(default(IQbservable<TSource1>), default(IObservable<TSource2>), default(IObservable<TSource3>), default(IObservable<TSource4>), default(IObservable<TSource5>), default(IObservable<TSource6>), default(IObservable<TSource7>), default(IObservable<TSource8>), default(IObservable<TSource9>), default(IObservable<TSource10>), default(IObservable<TSource11>), default(IObservable<TSource12>), default(IObservable<TSource13>), default(IObservable<TSource14>), default(IObservable<TSource15>), default(IObservable<TSource16>), default(Expression<Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TSource14, TSource15, TSource16, TResult>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource1), typeof(TSource2), typeof(TSource3), typeof(TSource4), typeof(TSource5), typeof(TSource6), typeof(TSource7), typeof(TSource8), typeof(TSource9), typeof(TSource10), typeof(TSource11), typeof(TSource12), typeof(TSource13), typeof(TSource14), typeof(TSource15), typeof(TSource16), typeof(TResult)),
-#endif
- source1.Expression,
- GetSourceExpression(source2),
- GetSourceExpression(source3),
- GetSourceExpression(source4),
- GetSourceExpression(source5),
- GetSourceExpression(source6),
- GetSourceExpression(source7),
- GetSourceExpression(source8),
- GetSourceExpression(source9),
- GetSourceExpression(source10),
- GetSourceExpression(source11),
- GetSourceExpression(source12),
- GetSourceExpression(source13),
- GetSourceExpression(source14),
- GetSourceExpression(source15),
- GetSourceExpression(source16),
- resultSelector
- )
- );
- }
-#endif
-
- /// <summary>
- /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the specified scheduler.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <param name="action">Action to convert to an asynchronous action.</param>
- /// <returns>Asynchronous action.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="action" /> is null.</exception>
- public static Func<IQbservable<Unit>> ToAsync(this IQbservableProvider provider, Expression<Action> action)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (action == null)
- throw new ArgumentNullException("action");
-
-#if CRIPPLED_REFLECTION
- var m = InfoOf(() => Qbservable.ToAsync(default(IQbservableProvider), default(Expression<Action>)));
-#else
- var m = (MethodInfo)MethodInfo.GetCurrentMethod();
-#endif
- return () => provider.CreateQuery<Unit>(
- Expression.Invoke(
- Expression.Call(
- null,
- m,
- Expression.Constant(provider, typeof(IQbservableProvider)),
- action
- )
- )
- );
- }
-
- /// <summary>
- /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the specified scheduler.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <param name="action">Action to convert to an asynchronous action.</param>
- /// <param name="scheduler">Scheduler to invoke the original action on.</param>
- /// <returns>Asynchronous action.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="action" /> or <paramref name="scheduler" /> is null.</exception>
- public static Func<IQbservable<Unit>> ToAsync(this IQbservableProvider provider, Expression<Action> action, IScheduler scheduler)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (action == null)
- throw new ArgumentNullException("action");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
-#if CRIPPLED_REFLECTION
- var m = InfoOf(() => Qbservable.ToAsync(default(IQbservableProvider), default(Expression<Action>), default(IScheduler)));
-#else
- var m = (MethodInfo)MethodInfo.GetCurrentMethod();
-#endif
- return () => provider.CreateQuery<Unit>(
- Expression.Invoke(
- Expression.Call(
- null,
- m,
- Expression.Constant(provider, typeof(IQbservableProvider)),
- action,
- Expression.Constant(scheduler, typeof(IScheduler))
- )
- )
- );
- }
-
- /// <summary>
- /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the default scheduler.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
- /// <param name="action">Action to convert to an asynchronous action.</param>
- /// <returns>Asynchronous action.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="action" /> is null.</exception>
- public static Func<TArg1, IQbservable<Unit>> ToAsync<TArg1>(this IQbservableProvider provider, Expression<Action<TArg1>> action)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (action == null)
- throw new ArgumentNullException("action");
-
-#if CRIPPLED_REFLECTION
- var m = InfoOf(() => Qbservable.ToAsync<TArg1>(default(IQbservableProvider), default(Expression<Action<TArg1>>)));
-#else
- var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1));
-#endif
- return (t1) => provider.CreateQuery<Unit>(
- Expression.Invoke(
- Expression.Call(
- null,
- m,
- Expression.Constant(provider, typeof(IQbservableProvider)),
- action
- ),
- Expression.Constant(t1, typeof(TArg1))
- )
- );
- }
-
- /// <summary>
- /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the specified scheduler.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
- /// <param name="action">Action to convert to an asynchronous action.</param>
- /// <param name="scheduler">Scheduler to invoke the original action on.</param>
- /// <returns>Asynchronous action.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="action" /> or <paramref name="scheduler" /> is null.</exception>
- public static Func<TArg1, IQbservable<Unit>> ToAsync<TArg1>(this IQbservableProvider provider, Expression<Action<TArg1>> action, IScheduler scheduler)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (action == null)
- throw new ArgumentNullException("action");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
-#if CRIPPLED_REFLECTION
- var m = InfoOf(() => Qbservable.ToAsync<TArg1>(default(IQbservableProvider), default(Expression<Action<TArg1>>), default(IScheduler)));
-#else
- var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1));
-#endif
- return (t1) => provider.CreateQuery<Unit>(
- Expression.Invoke(
- Expression.Call(
- null,
- m,
- Expression.Constant(provider, typeof(IQbservableProvider)),
- action,
- Expression.Constant(scheduler, typeof(IScheduler))
- ),
- Expression.Constant(t1, typeof(TArg1))
- )
- );
- }
-
- /// <summary>
- /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the default scheduler.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
- /// <param name="action">Action to convert to an asynchronous action.</param>
- /// <returns>Asynchronous action.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="action" /> is null.</exception>
- public static Func<TArg1, TArg2, IQbservable<Unit>> ToAsync<TArg1, TArg2>(this IQbservableProvider provider, Expression<Action<TArg1, TArg2>> action)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (action == null)
- throw new ArgumentNullException("action");
-
-#if CRIPPLED_REFLECTION
- var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2>(default(IQbservableProvider), default(Expression<Action<TArg1, TArg2>>)));
-#else
- var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2));
-#endif
- return (t1, t2) => provider.CreateQuery<Unit>(
- Expression.Invoke(
- Expression.Call(
- null,
- m,
- Expression.Constant(provider, typeof(IQbservableProvider)),
- action
- ),
- Expression.Constant(t1, typeof(TArg1)),
- Expression.Constant(t2, typeof(TArg2))
- )
- );
- }
-
- /// <summary>
- /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the specified scheduler.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
- /// <param name="action">Action to convert to an asynchronous action.</param>
- /// <param name="scheduler">Scheduler to invoke the original action on.</param>
- /// <returns>Asynchronous action.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="action" /> or <paramref name="scheduler" /> is null.</exception>
- public static Func<TArg1, TArg2, IQbservable<Unit>> ToAsync<TArg1, TArg2>(this IQbservableProvider provider, Expression<Action<TArg1, TArg2>> action, IScheduler scheduler)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (action == null)
- throw new ArgumentNullException("action");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
-#if CRIPPLED_REFLECTION
- var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2>(default(IQbservableProvider), default(Expression<Action<TArg1, TArg2>>), default(IScheduler)));
-#else
- var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2));
-#endif
- return (t1, t2) => provider.CreateQuery<Unit>(
- Expression.Invoke(
- Expression.Call(
- null,
- m,
- Expression.Constant(provider, typeof(IQbservableProvider)),
- action,
- Expression.Constant(scheduler, typeof(IScheduler))
- ),
- Expression.Constant(t1, typeof(TArg1)),
- Expression.Constant(t2, typeof(TArg2))
- )
- );
- }
-
- /// <summary>
- /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the default scheduler.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the action.</typeparam>
- /// <param name="action">Action to convert to an asynchronous action.</param>
- /// <returns>Asynchronous action.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="action" /> is null.</exception>
- public static Func<TArg1, TArg2, TArg3, IQbservable<Unit>> ToAsync<TArg1, TArg2, TArg3>(this IQbservableProvider provider, Expression<Action<TArg1, TArg2, TArg3>> action)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (action == null)
- throw new ArgumentNullException("action");
-
-#if CRIPPLED_REFLECTION
- var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2, TArg3>(default(IQbservableProvider), default(Expression<Action<TArg1, TArg2, TArg3>>)));
-#else
- var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3));
-#endif
- return (t1, t2, t3) => provider.CreateQuery<Unit>(
- Expression.Invoke(
- Expression.Call(
- null,
- m,
- Expression.Constant(provider, typeof(IQbservableProvider)),
- action
- ),
- Expression.Constant(t1, typeof(TArg1)),
- Expression.Constant(t2, typeof(TArg2)),
- Expression.Constant(t3, typeof(TArg3))
- )
- );
- }
-
- /// <summary>
- /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the specified scheduler.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the action.</typeparam>
- /// <param name="action">Action to convert to an asynchronous action.</param>
- /// <param name="scheduler">Scheduler to invoke the original action on.</param>
- /// <returns>Asynchronous action.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="action" /> or <paramref name="scheduler" /> is null.</exception>
- public static Func<TArg1, TArg2, TArg3, IQbservable<Unit>> ToAsync<TArg1, TArg2, TArg3>(this IQbservableProvider provider, Expression<Action<TArg1, TArg2, TArg3>> action, IScheduler scheduler)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (action == null)
- throw new ArgumentNullException("action");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
-#if CRIPPLED_REFLECTION
- var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2, TArg3>(default(IQbservableProvider), default(Expression<Action<TArg1, TArg2, TArg3>>), default(IScheduler)));
-#else
- var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3));
-#endif
- return (t1, t2, t3) => provider.CreateQuery<Unit>(
- Expression.Invoke(
- Expression.Call(
- null,
- m,
- Expression.Constant(provider, typeof(IQbservableProvider)),
- action,
- Expression.Constant(scheduler, typeof(IScheduler))
- ),
- Expression.Constant(t1, typeof(TArg1)),
- Expression.Constant(t2, typeof(TArg2)),
- Expression.Constant(t3, typeof(TArg3))
- )
- );
- }
-
- /// <summary>
- /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the default scheduler.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the action.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the action.</typeparam>
- /// <param name="action">Action to convert to an asynchronous action.</param>
- /// <returns>Asynchronous action.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="action" /> is null.</exception>
- public static Func<TArg1, TArg2, TArg3, TArg4, IQbservable<Unit>> ToAsync<TArg1, TArg2, TArg3, TArg4>(this IQbservableProvider provider, Expression<Action<TArg1, TArg2, TArg3, TArg4>> action)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (action == null)
- throw new ArgumentNullException("action");
-
-#if CRIPPLED_REFLECTION
- var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2, TArg3, TArg4>(default(IQbservableProvider), default(Expression<Action<TArg1, TArg2, TArg3, TArg4>>)));
-#else
- var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4));
-#endif
- return (t1, t2, t3, t4) => provider.CreateQuery<Unit>(
- Expression.Invoke(
- Expression.Call(
- null,
- m,
- Expression.Constant(provider, typeof(IQbservableProvider)),
- action
- ),
- Expression.Constant(t1, typeof(TArg1)),
- Expression.Constant(t2, typeof(TArg2)),
- Expression.Constant(t3, typeof(TArg3)),
- Expression.Constant(t4, typeof(TArg4))
- )
- );
- }
-
- /// <summary>
- /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the specified scheduler.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the action.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the action.</typeparam>
- /// <param name="action">Action to convert to an asynchronous action.</param>
- /// <param name="scheduler">Scheduler to invoke the original action on.</param>
- /// <returns>Asynchronous action.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="action" /> or <paramref name="scheduler" /> is null.</exception>
- public static Func<TArg1, TArg2, TArg3, TArg4, IQbservable<Unit>> ToAsync<TArg1, TArg2, TArg3, TArg4>(this IQbservableProvider provider, Expression<Action<TArg1, TArg2, TArg3, TArg4>> action, IScheduler scheduler)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (action == null)
- throw new ArgumentNullException("action");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
-#if CRIPPLED_REFLECTION
- var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2, TArg3, TArg4>(default(IQbservableProvider), default(Expression<Action<TArg1, TArg2, TArg3, TArg4>>), default(IScheduler)));
-#else
- var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4));
-#endif
- return (t1, t2, t3, t4) => provider.CreateQuery<Unit>(
- Expression.Invoke(
- Expression.Call(
- null,
- m,
- Expression.Constant(provider, typeof(IQbservableProvider)),
- action,
- Expression.Constant(scheduler, typeof(IScheduler))
- ),
- Expression.Constant(t1, typeof(TArg1)),
- Expression.Constant(t2, typeof(TArg2)),
- Expression.Constant(t3, typeof(TArg3)),
- Expression.Constant(t4, typeof(TArg4))
- )
- );
- }
-
-#if !NO_LARGEARITY
- /// <summary>
- /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the default scheduler.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the action.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the action.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the action.</typeparam>
- /// <param name="action">Action to convert to an asynchronous action.</param>
- /// <returns>Asynchronous action.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="action" /> is null.</exception>
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, IQbservable<Unit>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5>(this IQbservableProvider provider, Expression<Action<TArg1, TArg2, TArg3, TArg4, TArg5>> action)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (action == null)
- throw new ArgumentNullException("action");
-
-#if CRIPPLED_REFLECTION
- var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5>(default(IQbservableProvider), default(Expression<Action<TArg1, TArg2, TArg3, TArg4, TArg5>>)));
-#else
- var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5));
-#endif
- return (t1, t2, t3, t4, t5) => provider.CreateQuery<Unit>(
- Expression.Invoke(
- Expression.Call(
- null,
- m,
- Expression.Constant(provider, typeof(IQbservableProvider)),
- action
- ),
- Expression.Constant(t1, typeof(TArg1)),
- Expression.Constant(t2, typeof(TArg2)),
- Expression.Constant(t3, typeof(TArg3)),
- Expression.Constant(t4, typeof(TArg4)),
- Expression.Constant(t5, typeof(TArg5))
- )
- );
- }
-
- /// <summary>
- /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the specified scheduler.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the action.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the action.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the action.</typeparam>
- /// <param name="action">Action to convert to an asynchronous action.</param>
- /// <param name="scheduler">Scheduler to invoke the original action on.</param>
- /// <returns>Asynchronous action.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="action" /> or <paramref name="scheduler" /> is null.</exception>
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, IQbservable<Unit>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5>(this IQbservableProvider provider, Expression<Action<TArg1, TArg2, TArg3, TArg4, TArg5>> action, IScheduler scheduler)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (action == null)
- throw new ArgumentNullException("action");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
-#if CRIPPLED_REFLECTION
- var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5>(default(IQbservableProvider), default(Expression<Action<TArg1, TArg2, TArg3, TArg4, TArg5>>), default(IScheduler)));
-#else
- var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5));
-#endif
- return (t1, t2, t3, t4, t5) => provider.CreateQuery<Unit>(
- Expression.Invoke(
- Expression.Call(
- null,
- m,
- Expression.Constant(provider, typeof(IQbservableProvider)),
- action,
- Expression.Constant(scheduler, typeof(IScheduler))
- ),
- Expression.Constant(t1, typeof(TArg1)),
- Expression.Constant(t2, typeof(TArg2)),
- Expression.Constant(t3, typeof(TArg3)),
- Expression.Constant(t4, typeof(TArg4)),
- Expression.Constant(t5, typeof(TArg5))
- )
- );
- }
-
- /// <summary>
- /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the default scheduler.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the action.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the action.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the action.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the action.</typeparam>
- /// <param name="action">Action to convert to an asynchronous action.</param>
- /// <returns>Asynchronous action.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="action" /> is null.</exception>
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, IQbservable<Unit>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6>(this IQbservableProvider provider, Expression<Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6>> action)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (action == null)
- throw new ArgumentNullException("action");
-
-#if CRIPPLED_REFLECTION
- var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6>(default(IQbservableProvider), default(Expression<Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6>>)));
-#else
- var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6));
-#endif
- return (t1, t2, t3, t4, t5, t6) => provider.CreateQuery<Unit>(
- Expression.Invoke(
- Expression.Call(
- null,
- m,
- Expression.Constant(provider, typeof(IQbservableProvider)),
- action
- ),
- Expression.Constant(t1, typeof(TArg1)),
- Expression.Constant(t2, typeof(TArg2)),
- Expression.Constant(t3, typeof(TArg3)),
- Expression.Constant(t4, typeof(TArg4)),
- Expression.Constant(t5, typeof(TArg5)),
- Expression.Constant(t6, typeof(TArg6))
- )
- );
- }
-
- /// <summary>
- /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the specified scheduler.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the action.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the action.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the action.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the action.</typeparam>
- /// <param name="action">Action to convert to an asynchronous action.</param>
- /// <param name="scheduler">Scheduler to invoke the original action on.</param>
- /// <returns>Asynchronous action.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="action" /> or <paramref name="scheduler" /> is null.</exception>
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, IQbservable<Unit>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6>(this IQbservableProvider provider, Expression<Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6>> action, IScheduler scheduler)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (action == null)
- throw new ArgumentNullException("action");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
-#if CRIPPLED_REFLECTION
- var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6>(default(IQbservableProvider), default(Expression<Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6>>), default(IScheduler)));
-#else
- var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6));
-#endif
- return (t1, t2, t3, t4, t5, t6) => provider.CreateQuery<Unit>(
- Expression.Invoke(
- Expression.Call(
- null,
- m,
- Expression.Constant(provider, typeof(IQbservableProvider)),
- action,
- Expression.Constant(scheduler, typeof(IScheduler))
- ),
- Expression.Constant(t1, typeof(TArg1)),
- Expression.Constant(t2, typeof(TArg2)),
- Expression.Constant(t3, typeof(TArg3)),
- Expression.Constant(t4, typeof(TArg4)),
- Expression.Constant(t5, typeof(TArg5)),
- Expression.Constant(t6, typeof(TArg6))
- )
- );
- }
-
- /// <summary>
- /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the default scheduler.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the action.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the action.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the action.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the action.</typeparam>
- /// <typeparam name="TArg7">The type of the seventh argument passed to the action.</typeparam>
- /// <param name="action">Action to convert to an asynchronous action.</param>
- /// <returns>Asynchronous action.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="action" /> is null.</exception>
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, IQbservable<Unit>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7>(this IQbservableProvider provider, Expression<Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7>> action)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (action == null)
- throw new ArgumentNullException("action");
-
-#if CRIPPLED_REFLECTION
- var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7>(default(IQbservableProvider), default(Expression<Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7>>)));
-#else
- var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7));
-#endif
- return (t1, t2, t3, t4, t5, t6, t7) => provider.CreateQuery<Unit>(
- Expression.Invoke(
- Expression.Call(
- null,
- m,
- Expression.Constant(provider, typeof(IQbservableProvider)),
- action
- ),
- Expression.Constant(t1, typeof(TArg1)),
- Expression.Constant(t2, typeof(TArg2)),
- Expression.Constant(t3, typeof(TArg3)),
- Expression.Constant(t4, typeof(TArg4)),
- Expression.Constant(t5, typeof(TArg5)),
- Expression.Constant(t6, typeof(TArg6)),
- Expression.Constant(t7, typeof(TArg7))
- )
- );
- }
-
- /// <summary>
- /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the specified scheduler.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the action.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the action.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the action.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the action.</typeparam>
- /// <typeparam name="TArg7">The type of the seventh argument passed to the action.</typeparam>
- /// <param name="action">Action to convert to an asynchronous action.</param>
- /// <param name="scheduler">Scheduler to invoke the original action on.</param>
- /// <returns>Asynchronous action.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="action" /> or <paramref name="scheduler" /> is null.</exception>
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, IQbservable<Unit>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7>(this IQbservableProvider provider, Expression<Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7>> action, IScheduler scheduler)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (action == null)
- throw new ArgumentNullException("action");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
-#if CRIPPLED_REFLECTION
- var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7>(default(IQbservableProvider), default(Expression<Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7>>), default(IScheduler)));
-#else
- var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7));
-#endif
- return (t1, t2, t3, t4, t5, t6, t7) => provider.CreateQuery<Unit>(
- Expression.Invoke(
- Expression.Call(
- null,
- m,
- Expression.Constant(provider, typeof(IQbservableProvider)),
- action,
- Expression.Constant(scheduler, typeof(IScheduler))
- ),
- Expression.Constant(t1, typeof(TArg1)),
- Expression.Constant(t2, typeof(TArg2)),
- Expression.Constant(t3, typeof(TArg3)),
- Expression.Constant(t4, typeof(TArg4)),
- Expression.Constant(t5, typeof(TArg5)),
- Expression.Constant(t6, typeof(TArg6)),
- Expression.Constant(t7, typeof(TArg7))
- )
- );
- }
-
- /// <summary>
- /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the default scheduler.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the action.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the action.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the action.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the action.</typeparam>
- /// <typeparam name="TArg7">The type of the seventh argument passed to the action.</typeparam>
- /// <typeparam name="TArg8">The type of the eighth argument passed to the action.</typeparam>
- /// <param name="action">Action to convert to an asynchronous action.</param>
- /// <returns>Asynchronous action.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="action" /> is null.</exception>
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, IQbservable<Unit>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8>(this IQbservableProvider provider, Expression<Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8>> action)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (action == null)
- throw new ArgumentNullException("action");
-
-#if CRIPPLED_REFLECTION
- var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8>(default(IQbservableProvider), default(Expression<Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8>>)));
-#else
- var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7), typeof(TArg8));
-#endif
- return (t1, t2, t3, t4, t5, t6, t7, t8) => provider.CreateQuery<Unit>(
- Expression.Invoke(
- Expression.Call(
- null,
- m,
- Expression.Constant(provider, typeof(IQbservableProvider)),
- action
- ),
- Expression.Constant(t1, typeof(TArg1)),
- Expression.Constant(t2, typeof(TArg2)),
- Expression.Constant(t3, typeof(TArg3)),
- Expression.Constant(t4, typeof(TArg4)),
- Expression.Constant(t5, typeof(TArg5)),
- Expression.Constant(t6, typeof(TArg6)),
- Expression.Constant(t7, typeof(TArg7)),
- Expression.Constant(t8, typeof(TArg8))
- )
- );
- }
-
- /// <summary>
- /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the specified scheduler.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the action.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the action.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the action.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the action.</typeparam>
- /// <typeparam name="TArg7">The type of the seventh argument passed to the action.</typeparam>
- /// <typeparam name="TArg8">The type of the eighth argument passed to the action.</typeparam>
- /// <param name="action">Action to convert to an asynchronous action.</param>
- /// <param name="scheduler">Scheduler to invoke the original action on.</param>
- /// <returns>Asynchronous action.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="action" /> or <paramref name="scheduler" /> is null.</exception>
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, IQbservable<Unit>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8>(this IQbservableProvider provider, Expression<Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8>> action, IScheduler scheduler)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (action == null)
- throw new ArgumentNullException("action");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
-#if CRIPPLED_REFLECTION
- var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8>(default(IQbservableProvider), default(Expression<Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8>>), default(IScheduler)));
-#else
- var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7), typeof(TArg8));
-#endif
- return (t1, t2, t3, t4, t5, t6, t7, t8) => provider.CreateQuery<Unit>(
- Expression.Invoke(
- Expression.Call(
- null,
- m,
- Expression.Constant(provider, typeof(IQbservableProvider)),
- action,
- Expression.Constant(scheduler, typeof(IScheduler))
- ),
- Expression.Constant(t1, typeof(TArg1)),
- Expression.Constant(t2, typeof(TArg2)),
- Expression.Constant(t3, typeof(TArg3)),
- Expression.Constant(t4, typeof(TArg4)),
- Expression.Constant(t5, typeof(TArg5)),
- Expression.Constant(t6, typeof(TArg6)),
- Expression.Constant(t7, typeof(TArg7)),
- Expression.Constant(t8, typeof(TArg8))
- )
- );
- }
-
- /// <summary>
- /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the default scheduler.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the action.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the action.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the action.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the action.</typeparam>
- /// <typeparam name="TArg7">The type of the seventh argument passed to the action.</typeparam>
- /// <typeparam name="TArg8">The type of the eighth argument passed to the action.</typeparam>
- /// <typeparam name="TArg9">The type of the ninth argument passed to the action.</typeparam>
- /// <param name="action">Action to convert to an asynchronous action.</param>
- /// <returns>Asynchronous action.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="action" /> is null.</exception>
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, IQbservable<Unit>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9>(this IQbservableProvider provider, Expression<Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9>> action)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (action == null)
- throw new ArgumentNullException("action");
-
-#if CRIPPLED_REFLECTION
- var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9>(default(IQbservableProvider), default(Expression<Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9>>)));
-#else
- var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7), typeof(TArg8), typeof(TArg9));
-#endif
- return (t1, t2, t3, t4, t5, t6, t7, t8, t9) => provider.CreateQuery<Unit>(
- Expression.Invoke(
- Expression.Call(
- null,
- m,
- Expression.Constant(provider, typeof(IQbservableProvider)),
- action
- ),
- Expression.Constant(t1, typeof(TArg1)),
- Expression.Constant(t2, typeof(TArg2)),
- Expression.Constant(t3, typeof(TArg3)),
- Expression.Constant(t4, typeof(TArg4)),
- Expression.Constant(t5, typeof(TArg5)),
- Expression.Constant(t6, typeof(TArg6)),
- Expression.Constant(t7, typeof(TArg7)),
- Expression.Constant(t8, typeof(TArg8)),
- Expression.Constant(t9, typeof(TArg9))
- )
- );
- }
-
- /// <summary>
- /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the specified scheduler.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the action.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the action.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the action.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the action.</typeparam>
- /// <typeparam name="TArg7">The type of the seventh argument passed to the action.</typeparam>
- /// <typeparam name="TArg8">The type of the eighth argument passed to the action.</typeparam>
- /// <typeparam name="TArg9">The type of the ninth argument passed to the action.</typeparam>
- /// <param name="action">Action to convert to an asynchronous action.</param>
- /// <param name="scheduler">Scheduler to invoke the original action on.</param>
- /// <returns>Asynchronous action.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="action" /> or <paramref name="scheduler" /> is null.</exception>
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, IQbservable<Unit>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9>(this IQbservableProvider provider, Expression<Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9>> action, IScheduler scheduler)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (action == null)
- throw new ArgumentNullException("action");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
-#if CRIPPLED_REFLECTION
- var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9>(default(IQbservableProvider), default(Expression<Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9>>), default(IScheduler)));
-#else
- var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7), typeof(TArg8), typeof(TArg9));
-#endif
- return (t1, t2, t3, t4, t5, t6, t7, t8, t9) => provider.CreateQuery<Unit>(
- Expression.Invoke(
- Expression.Call(
- null,
- m,
- Expression.Constant(provider, typeof(IQbservableProvider)),
- action,
- Expression.Constant(scheduler, typeof(IScheduler))
- ),
- Expression.Constant(t1, typeof(TArg1)),
- Expression.Constant(t2, typeof(TArg2)),
- Expression.Constant(t3, typeof(TArg3)),
- Expression.Constant(t4, typeof(TArg4)),
- Expression.Constant(t5, typeof(TArg5)),
- Expression.Constant(t6, typeof(TArg6)),
- Expression.Constant(t7, typeof(TArg7)),
- Expression.Constant(t8, typeof(TArg8)),
- Expression.Constant(t9, typeof(TArg9))
- )
- );
- }
-
- /// <summary>
- /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the default scheduler.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the action.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the action.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the action.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the action.</typeparam>
- /// <typeparam name="TArg7">The type of the seventh argument passed to the action.</typeparam>
- /// <typeparam name="TArg8">The type of the eighth argument passed to the action.</typeparam>
- /// <typeparam name="TArg9">The type of the ninth argument passed to the action.</typeparam>
- /// <typeparam name="TArg10">The type of the tenth argument passed to the action.</typeparam>
- /// <param name="action">Action to convert to an asynchronous action.</param>
- /// <returns>Asynchronous action.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="action" /> is null.</exception>
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, IQbservable<Unit>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10>(this IQbservableProvider provider, Expression<Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10>> action)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (action == null)
- throw new ArgumentNullException("action");
-
-#if CRIPPLED_REFLECTION
- var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10>(default(IQbservableProvider), default(Expression<Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10>>)));
-#else
- var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7), typeof(TArg8), typeof(TArg9), typeof(TArg10));
-#endif
- return (t1, t2, t3, t4, t5, t6, t7, t8, t9, t10) => provider.CreateQuery<Unit>(
- Expression.Invoke(
- Expression.Call(
- null,
- m,
- Expression.Constant(provider, typeof(IQbservableProvider)),
- action
- ),
- Expression.Constant(t1, typeof(TArg1)),
- Expression.Constant(t2, typeof(TArg2)),
- Expression.Constant(t3, typeof(TArg3)),
- Expression.Constant(t4, typeof(TArg4)),
- Expression.Constant(t5, typeof(TArg5)),
- Expression.Constant(t6, typeof(TArg6)),
- Expression.Constant(t7, typeof(TArg7)),
- Expression.Constant(t8, typeof(TArg8)),
- Expression.Constant(t9, typeof(TArg9)),
- Expression.Constant(t10, typeof(TArg10))
- )
- );
- }
-
- /// <summary>
- /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the specified scheduler.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the action.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the action.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the action.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the action.</typeparam>
- /// <typeparam name="TArg7">The type of the seventh argument passed to the action.</typeparam>
- /// <typeparam name="TArg8">The type of the eighth argument passed to the action.</typeparam>
- /// <typeparam name="TArg9">The type of the ninth argument passed to the action.</typeparam>
- /// <typeparam name="TArg10">The type of the tenth argument passed to the action.</typeparam>
- /// <param name="action">Action to convert to an asynchronous action.</param>
- /// <param name="scheduler">Scheduler to invoke the original action on.</param>
- /// <returns>Asynchronous action.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="action" /> or <paramref name="scheduler" /> is null.</exception>
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, IQbservable<Unit>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10>(this IQbservableProvider provider, Expression<Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10>> action, IScheduler scheduler)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (action == null)
- throw new ArgumentNullException("action");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
-#if CRIPPLED_REFLECTION
- var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10>(default(IQbservableProvider), default(Expression<Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10>>), default(IScheduler)));
-#else
- var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7), typeof(TArg8), typeof(TArg9), typeof(TArg10));
-#endif
- return (t1, t2, t3, t4, t5, t6, t7, t8, t9, t10) => provider.CreateQuery<Unit>(
- Expression.Invoke(
- Expression.Call(
- null,
- m,
- Expression.Constant(provider, typeof(IQbservableProvider)),
- action,
- Expression.Constant(scheduler, typeof(IScheduler))
- ),
- Expression.Constant(t1, typeof(TArg1)),
- Expression.Constant(t2, typeof(TArg2)),
- Expression.Constant(t3, typeof(TArg3)),
- Expression.Constant(t4, typeof(TArg4)),
- Expression.Constant(t5, typeof(TArg5)),
- Expression.Constant(t6, typeof(TArg6)),
- Expression.Constant(t7, typeof(TArg7)),
- Expression.Constant(t8, typeof(TArg8)),
- Expression.Constant(t9, typeof(TArg9)),
- Expression.Constant(t10, typeof(TArg10))
- )
- );
- }
-
- /// <summary>
- /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the default scheduler.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the action.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the action.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the action.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the action.</typeparam>
- /// <typeparam name="TArg7">The type of the seventh argument passed to the action.</typeparam>
- /// <typeparam name="TArg8">The type of the eighth argument passed to the action.</typeparam>
- /// <typeparam name="TArg9">The type of the ninth argument passed to the action.</typeparam>
- /// <typeparam name="TArg10">The type of the tenth argument passed to the action.</typeparam>
- /// <typeparam name="TArg11">The type of the eleventh argument passed to the action.</typeparam>
- /// <param name="action">Action to convert to an asynchronous action.</param>
- /// <returns>Asynchronous action.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="action" /> is null.</exception>
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, IQbservable<Unit>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11>(this IQbservableProvider provider, Expression<Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11>> action)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (action == null)
- throw new ArgumentNullException("action");
-
-#if CRIPPLED_REFLECTION
- var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11>(default(IQbservableProvider), default(Expression<Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11>>)));
-#else
- var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7), typeof(TArg8), typeof(TArg9), typeof(TArg10), typeof(TArg11));
-#endif
- return (t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11) => provider.CreateQuery<Unit>(
- Expression.Invoke(
- Expression.Call(
- null,
- m,
- Expression.Constant(provider, typeof(IQbservableProvider)),
- action
- ),
- Expression.Constant(t1, typeof(TArg1)),
- Expression.Constant(t2, typeof(TArg2)),
- Expression.Constant(t3, typeof(TArg3)),
- Expression.Constant(t4, typeof(TArg4)),
- Expression.Constant(t5, typeof(TArg5)),
- Expression.Constant(t6, typeof(TArg6)),
- Expression.Constant(t7, typeof(TArg7)),
- Expression.Constant(t8, typeof(TArg8)),
- Expression.Constant(t9, typeof(TArg9)),
- Expression.Constant(t10, typeof(TArg10)),
- Expression.Constant(t11, typeof(TArg11))
- )
- );
- }
-
- /// <summary>
- /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the specified scheduler.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the action.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the action.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the action.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the action.</typeparam>
- /// <typeparam name="TArg7">The type of the seventh argument passed to the action.</typeparam>
- /// <typeparam name="TArg8">The type of the eighth argument passed to the action.</typeparam>
- /// <typeparam name="TArg9">The type of the ninth argument passed to the action.</typeparam>
- /// <typeparam name="TArg10">The type of the tenth argument passed to the action.</typeparam>
- /// <typeparam name="TArg11">The type of the eleventh argument passed to the action.</typeparam>
- /// <param name="action">Action to convert to an asynchronous action.</param>
- /// <param name="scheduler">Scheduler to invoke the original action on.</param>
- /// <returns>Asynchronous action.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="action" /> or <paramref name="scheduler" /> is null.</exception>
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, IQbservable<Unit>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11>(this IQbservableProvider provider, Expression<Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11>> action, IScheduler scheduler)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (action == null)
- throw new ArgumentNullException("action");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
-#if CRIPPLED_REFLECTION
- var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11>(default(IQbservableProvider), default(Expression<Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11>>), default(IScheduler)));
-#else
- var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7), typeof(TArg8), typeof(TArg9), typeof(TArg10), typeof(TArg11));
-#endif
- return (t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11) => provider.CreateQuery<Unit>(
- Expression.Invoke(
- Expression.Call(
- null,
- m,
- Expression.Constant(provider, typeof(IQbservableProvider)),
- action,
- Expression.Constant(scheduler, typeof(IScheduler))
- ),
- Expression.Constant(t1, typeof(TArg1)),
- Expression.Constant(t2, typeof(TArg2)),
- Expression.Constant(t3, typeof(TArg3)),
- Expression.Constant(t4, typeof(TArg4)),
- Expression.Constant(t5, typeof(TArg5)),
- Expression.Constant(t6, typeof(TArg6)),
- Expression.Constant(t7, typeof(TArg7)),
- Expression.Constant(t8, typeof(TArg8)),
- Expression.Constant(t9, typeof(TArg9)),
- Expression.Constant(t10, typeof(TArg10)),
- Expression.Constant(t11, typeof(TArg11))
- )
- );
- }
-
- /// <summary>
- /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the default scheduler.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the action.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the action.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the action.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the action.</typeparam>
- /// <typeparam name="TArg7">The type of the seventh argument passed to the action.</typeparam>
- /// <typeparam name="TArg8">The type of the eighth argument passed to the action.</typeparam>
- /// <typeparam name="TArg9">The type of the ninth argument passed to the action.</typeparam>
- /// <typeparam name="TArg10">The type of the tenth argument passed to the action.</typeparam>
- /// <typeparam name="TArg11">The type of the eleventh argument passed to the action.</typeparam>
- /// <typeparam name="TArg12">The type of the twelfth argument passed to the action.</typeparam>
- /// <param name="action">Action to convert to an asynchronous action.</param>
- /// <returns>Asynchronous action.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="action" /> is null.</exception>
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, IQbservable<Unit>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12>(this IQbservableProvider provider, Expression<Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12>> action)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (action == null)
- throw new ArgumentNullException("action");
-
-#if CRIPPLED_REFLECTION
- var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12>(default(IQbservableProvider), default(Expression<Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12>>)));
-#else
- var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7), typeof(TArg8), typeof(TArg9), typeof(TArg10), typeof(TArg11), typeof(TArg12));
-#endif
- return (t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12) => provider.CreateQuery<Unit>(
- Expression.Invoke(
- Expression.Call(
- null,
- m,
- Expression.Constant(provider, typeof(IQbservableProvider)),
- action
- ),
- Expression.Constant(t1, typeof(TArg1)),
- Expression.Constant(t2, typeof(TArg2)),
- Expression.Constant(t3, typeof(TArg3)),
- Expression.Constant(t4, typeof(TArg4)),
- Expression.Constant(t5, typeof(TArg5)),
- Expression.Constant(t6, typeof(TArg6)),
- Expression.Constant(t7, typeof(TArg7)),
- Expression.Constant(t8, typeof(TArg8)),
- Expression.Constant(t9, typeof(TArg9)),
- Expression.Constant(t10, typeof(TArg10)),
- Expression.Constant(t11, typeof(TArg11)),
- Expression.Constant(t12, typeof(TArg12))
- )
- );
- }
-
- /// <summary>
- /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the specified scheduler.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the action.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the action.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the action.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the action.</typeparam>
- /// <typeparam name="TArg7">The type of the seventh argument passed to the action.</typeparam>
- /// <typeparam name="TArg8">The type of the eighth argument passed to the action.</typeparam>
- /// <typeparam name="TArg9">The type of the ninth argument passed to the action.</typeparam>
- /// <typeparam name="TArg10">The type of the tenth argument passed to the action.</typeparam>
- /// <typeparam name="TArg11">The type of the eleventh argument passed to the action.</typeparam>
- /// <typeparam name="TArg12">The type of the twelfth argument passed to the action.</typeparam>
- /// <param name="action">Action to convert to an asynchronous action.</param>
- /// <param name="scheduler">Scheduler to invoke the original action on.</param>
- /// <returns>Asynchronous action.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="action" /> or <paramref name="scheduler" /> is null.</exception>
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, IQbservable<Unit>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12>(this IQbservableProvider provider, Expression<Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12>> action, IScheduler scheduler)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (action == null)
- throw new ArgumentNullException("action");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
-#if CRIPPLED_REFLECTION
- var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12>(default(IQbservableProvider), default(Expression<Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12>>), default(IScheduler)));
-#else
- var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7), typeof(TArg8), typeof(TArg9), typeof(TArg10), typeof(TArg11), typeof(TArg12));
-#endif
- return (t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12) => provider.CreateQuery<Unit>(
- Expression.Invoke(
- Expression.Call(
- null,
- m,
- Expression.Constant(provider, typeof(IQbservableProvider)),
- action,
- Expression.Constant(scheduler, typeof(IScheduler))
- ),
- Expression.Constant(t1, typeof(TArg1)),
- Expression.Constant(t2, typeof(TArg2)),
- Expression.Constant(t3, typeof(TArg3)),
- Expression.Constant(t4, typeof(TArg4)),
- Expression.Constant(t5, typeof(TArg5)),
- Expression.Constant(t6, typeof(TArg6)),
- Expression.Constant(t7, typeof(TArg7)),
- Expression.Constant(t8, typeof(TArg8)),
- Expression.Constant(t9, typeof(TArg9)),
- Expression.Constant(t10, typeof(TArg10)),
- Expression.Constant(t11, typeof(TArg11)),
- Expression.Constant(t12, typeof(TArg12))
- )
- );
- }
-
- /// <summary>
- /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the default scheduler.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the action.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the action.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the action.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the action.</typeparam>
- /// <typeparam name="TArg7">The type of the seventh argument passed to the action.</typeparam>
- /// <typeparam name="TArg8">The type of the eighth argument passed to the action.</typeparam>
- /// <typeparam name="TArg9">The type of the ninth argument passed to the action.</typeparam>
- /// <typeparam name="TArg10">The type of the tenth argument passed to the action.</typeparam>
- /// <typeparam name="TArg11">The type of the eleventh argument passed to the action.</typeparam>
- /// <typeparam name="TArg12">The type of the twelfth argument passed to the action.</typeparam>
- /// <typeparam name="TArg13">The type of the thirteenth argument passed to the action.</typeparam>
- /// <param name="action">Action to convert to an asynchronous action.</param>
- /// <returns>Asynchronous action.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="action" /> is null.</exception>
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, IQbservable<Unit>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13>(this IQbservableProvider provider, Expression<Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13>> action)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (action == null)
- throw new ArgumentNullException("action");
-
-#if CRIPPLED_REFLECTION
- var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13>(default(IQbservableProvider), default(Expression<Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13>>)));
-#else
- var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7), typeof(TArg8), typeof(TArg9), typeof(TArg10), typeof(TArg11), typeof(TArg12), typeof(TArg13));
-#endif
- return (t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13) => provider.CreateQuery<Unit>(
- Expression.Invoke(
- Expression.Call(
- null,
- m,
- Expression.Constant(provider, typeof(IQbservableProvider)),
- action
- ),
- Expression.Constant(t1, typeof(TArg1)),
- Expression.Constant(t2, typeof(TArg2)),
- Expression.Constant(t3, typeof(TArg3)),
- Expression.Constant(t4, typeof(TArg4)),
- Expression.Constant(t5, typeof(TArg5)),
- Expression.Constant(t6, typeof(TArg6)),
- Expression.Constant(t7, typeof(TArg7)),
- Expression.Constant(t8, typeof(TArg8)),
- Expression.Constant(t9, typeof(TArg9)),
- Expression.Constant(t10, typeof(TArg10)),
- Expression.Constant(t11, typeof(TArg11)),
- Expression.Constant(t12, typeof(TArg12)),
- Expression.Constant(t13, typeof(TArg13))
- )
- );
- }
-
- /// <summary>
- /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the specified scheduler.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the action.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the action.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the action.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the action.</typeparam>
- /// <typeparam name="TArg7">The type of the seventh argument passed to the action.</typeparam>
- /// <typeparam name="TArg8">The type of the eighth argument passed to the action.</typeparam>
- /// <typeparam name="TArg9">The type of the ninth argument passed to the action.</typeparam>
- /// <typeparam name="TArg10">The type of the tenth argument passed to the action.</typeparam>
- /// <typeparam name="TArg11">The type of the eleventh argument passed to the action.</typeparam>
- /// <typeparam name="TArg12">The type of the twelfth argument passed to the action.</typeparam>
- /// <typeparam name="TArg13">The type of the thirteenth argument passed to the action.</typeparam>
- /// <param name="action">Action to convert to an asynchronous action.</param>
- /// <param name="scheduler">Scheduler to invoke the original action on.</param>
- /// <returns>Asynchronous action.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="action" /> or <paramref name="scheduler" /> is null.</exception>
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, IQbservable<Unit>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13>(this IQbservableProvider provider, Expression<Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13>> action, IScheduler scheduler)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (action == null)
- throw new ArgumentNullException("action");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
-#if CRIPPLED_REFLECTION
- var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13>(default(IQbservableProvider), default(Expression<Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13>>), default(IScheduler)));
-#else
- var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7), typeof(TArg8), typeof(TArg9), typeof(TArg10), typeof(TArg11), typeof(TArg12), typeof(TArg13));
-#endif
- return (t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13) => provider.CreateQuery<Unit>(
- Expression.Invoke(
- Expression.Call(
- null,
- m,
- Expression.Constant(provider, typeof(IQbservableProvider)),
- action,
- Expression.Constant(scheduler, typeof(IScheduler))
- ),
- Expression.Constant(t1, typeof(TArg1)),
- Expression.Constant(t2, typeof(TArg2)),
- Expression.Constant(t3, typeof(TArg3)),
- Expression.Constant(t4, typeof(TArg4)),
- Expression.Constant(t5, typeof(TArg5)),
- Expression.Constant(t6, typeof(TArg6)),
- Expression.Constant(t7, typeof(TArg7)),
- Expression.Constant(t8, typeof(TArg8)),
- Expression.Constant(t9, typeof(TArg9)),
- Expression.Constant(t10, typeof(TArg10)),
- Expression.Constant(t11, typeof(TArg11)),
- Expression.Constant(t12, typeof(TArg12)),
- Expression.Constant(t13, typeof(TArg13))
- )
- );
- }
-
- /// <summary>
- /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the default scheduler.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the action.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the action.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the action.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the action.</typeparam>
- /// <typeparam name="TArg7">The type of the seventh argument passed to the action.</typeparam>
- /// <typeparam name="TArg8">The type of the eighth argument passed to the action.</typeparam>
- /// <typeparam name="TArg9">The type of the ninth argument passed to the action.</typeparam>
- /// <typeparam name="TArg10">The type of the tenth argument passed to the action.</typeparam>
- /// <typeparam name="TArg11">The type of the eleventh argument passed to the action.</typeparam>
- /// <typeparam name="TArg12">The type of the twelfth argument passed to the action.</typeparam>
- /// <typeparam name="TArg13">The type of the thirteenth argument passed to the action.</typeparam>
- /// <typeparam name="TArg14">The type of the fourteenth argument passed to the action.</typeparam>
- /// <param name="action">Action to convert to an asynchronous action.</param>
- /// <returns>Asynchronous action.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="action" /> is null.</exception>
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, IQbservable<Unit>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14>(this IQbservableProvider provider, Expression<Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14>> action)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (action == null)
- throw new ArgumentNullException("action");
-
-#if CRIPPLED_REFLECTION
- var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14>(default(IQbservableProvider), default(Expression<Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14>>)));
-#else
- var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7), typeof(TArg8), typeof(TArg9), typeof(TArg10), typeof(TArg11), typeof(TArg12), typeof(TArg13), typeof(TArg14));
-#endif
- return (t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14) => provider.CreateQuery<Unit>(
- Expression.Invoke(
- Expression.Call(
- null,
- m,
- Expression.Constant(provider, typeof(IQbservableProvider)),
- action
- ),
- Expression.Constant(t1, typeof(TArg1)),
- Expression.Constant(t2, typeof(TArg2)),
- Expression.Constant(t3, typeof(TArg3)),
- Expression.Constant(t4, typeof(TArg4)),
- Expression.Constant(t5, typeof(TArg5)),
- Expression.Constant(t6, typeof(TArg6)),
- Expression.Constant(t7, typeof(TArg7)),
- Expression.Constant(t8, typeof(TArg8)),
- Expression.Constant(t9, typeof(TArg9)),
- Expression.Constant(t10, typeof(TArg10)),
- Expression.Constant(t11, typeof(TArg11)),
- Expression.Constant(t12, typeof(TArg12)),
- Expression.Constant(t13, typeof(TArg13)),
- Expression.Constant(t14, typeof(TArg14))
- )
- );
- }
-
- /// <summary>
- /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the specified scheduler.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the action.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the action.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the action.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the action.</typeparam>
- /// <typeparam name="TArg7">The type of the seventh argument passed to the action.</typeparam>
- /// <typeparam name="TArg8">The type of the eighth argument passed to the action.</typeparam>
- /// <typeparam name="TArg9">The type of the ninth argument passed to the action.</typeparam>
- /// <typeparam name="TArg10">The type of the tenth argument passed to the action.</typeparam>
- /// <typeparam name="TArg11">The type of the eleventh argument passed to the action.</typeparam>
- /// <typeparam name="TArg12">The type of the twelfth argument passed to the action.</typeparam>
- /// <typeparam name="TArg13">The type of the thirteenth argument passed to the action.</typeparam>
- /// <typeparam name="TArg14">The type of the fourteenth argument passed to the action.</typeparam>
- /// <param name="action">Action to convert to an asynchronous action.</param>
- /// <param name="scheduler">Scheduler to invoke the original action on.</param>
- /// <returns>Asynchronous action.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="action" /> or <paramref name="scheduler" /> is null.</exception>
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, IQbservable<Unit>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14>(this IQbservableProvider provider, Expression<Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14>> action, IScheduler scheduler)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (action == null)
- throw new ArgumentNullException("action");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
-#if CRIPPLED_REFLECTION
- var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14>(default(IQbservableProvider), default(Expression<Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14>>), default(IScheduler)));
-#else
- var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7), typeof(TArg8), typeof(TArg9), typeof(TArg10), typeof(TArg11), typeof(TArg12), typeof(TArg13), typeof(TArg14));
-#endif
- return (t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14) => provider.CreateQuery<Unit>(
- Expression.Invoke(
- Expression.Call(
- null,
- m,
- Expression.Constant(provider, typeof(IQbservableProvider)),
- action,
- Expression.Constant(scheduler, typeof(IScheduler))
- ),
- Expression.Constant(t1, typeof(TArg1)),
- Expression.Constant(t2, typeof(TArg2)),
- Expression.Constant(t3, typeof(TArg3)),
- Expression.Constant(t4, typeof(TArg4)),
- Expression.Constant(t5, typeof(TArg5)),
- Expression.Constant(t6, typeof(TArg6)),
- Expression.Constant(t7, typeof(TArg7)),
- Expression.Constant(t8, typeof(TArg8)),
- Expression.Constant(t9, typeof(TArg9)),
- Expression.Constant(t10, typeof(TArg10)),
- Expression.Constant(t11, typeof(TArg11)),
- Expression.Constant(t12, typeof(TArg12)),
- Expression.Constant(t13, typeof(TArg13)),
- Expression.Constant(t14, typeof(TArg14))
- )
- );
- }
-
- /// <summary>
- /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the default scheduler.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the action.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the action.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the action.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the action.</typeparam>
- /// <typeparam name="TArg7">The type of the seventh argument passed to the action.</typeparam>
- /// <typeparam name="TArg8">The type of the eighth argument passed to the action.</typeparam>
- /// <typeparam name="TArg9">The type of the ninth argument passed to the action.</typeparam>
- /// <typeparam name="TArg10">The type of the tenth argument passed to the action.</typeparam>
- /// <typeparam name="TArg11">The type of the eleventh argument passed to the action.</typeparam>
- /// <typeparam name="TArg12">The type of the twelfth argument passed to the action.</typeparam>
- /// <typeparam name="TArg13">The type of the thirteenth argument passed to the action.</typeparam>
- /// <typeparam name="TArg14">The type of the fourteenth argument passed to the action.</typeparam>
- /// <typeparam name="TArg15">The type of the fifteenth argument passed to the action.</typeparam>
- /// <param name="action">Action to convert to an asynchronous action.</param>
- /// <returns>Asynchronous action.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="action" /> is null.</exception>
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, IQbservable<Unit>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15>(this IQbservableProvider provider, Expression<Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15>> action)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (action == null)
- throw new ArgumentNullException("action");
-
-#if CRIPPLED_REFLECTION
- var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15>(default(IQbservableProvider), default(Expression<Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15>>)));
-#else
- var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7), typeof(TArg8), typeof(TArg9), typeof(TArg10), typeof(TArg11), typeof(TArg12), typeof(TArg13), typeof(TArg14), typeof(TArg15));
-#endif
- return (t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15) => provider.CreateQuery<Unit>(
- Expression.Invoke(
- Expression.Call(
- null,
- m,
- Expression.Constant(provider, typeof(IQbservableProvider)),
- action
- ),
- Expression.Constant(t1, typeof(TArg1)),
- Expression.Constant(t2, typeof(TArg2)),
- Expression.Constant(t3, typeof(TArg3)),
- Expression.Constant(t4, typeof(TArg4)),
- Expression.Constant(t5, typeof(TArg5)),
- Expression.Constant(t6, typeof(TArg6)),
- Expression.Constant(t7, typeof(TArg7)),
- Expression.Constant(t8, typeof(TArg8)),
- Expression.Constant(t9, typeof(TArg9)),
- Expression.Constant(t10, typeof(TArg10)),
- Expression.Constant(t11, typeof(TArg11)),
- Expression.Constant(t12, typeof(TArg12)),
- Expression.Constant(t13, typeof(TArg13)),
- Expression.Constant(t14, typeof(TArg14)),
- Expression.Constant(t15, typeof(TArg15))
- )
- );
- }
-
- /// <summary>
- /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the specified scheduler.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the action.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the action.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the action.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the action.</typeparam>
- /// <typeparam name="TArg7">The type of the seventh argument passed to the action.</typeparam>
- /// <typeparam name="TArg8">The type of the eighth argument passed to the action.</typeparam>
- /// <typeparam name="TArg9">The type of the ninth argument passed to the action.</typeparam>
- /// <typeparam name="TArg10">The type of the tenth argument passed to the action.</typeparam>
- /// <typeparam name="TArg11">The type of the eleventh argument passed to the action.</typeparam>
- /// <typeparam name="TArg12">The type of the twelfth argument passed to the action.</typeparam>
- /// <typeparam name="TArg13">The type of the thirteenth argument passed to the action.</typeparam>
- /// <typeparam name="TArg14">The type of the fourteenth argument passed to the action.</typeparam>
- /// <typeparam name="TArg15">The type of the fifteenth argument passed to the action.</typeparam>
- /// <param name="action">Action to convert to an asynchronous action.</param>
- /// <param name="scheduler">Scheduler to invoke the original action on.</param>
- /// <returns>Asynchronous action.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="action" /> or <paramref name="scheduler" /> is null.</exception>
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, IQbservable<Unit>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15>(this IQbservableProvider provider, Expression<Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15>> action, IScheduler scheduler)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (action == null)
- throw new ArgumentNullException("action");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
-#if CRIPPLED_REFLECTION
- var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15>(default(IQbservableProvider), default(Expression<Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15>>), default(IScheduler)));
-#else
- var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7), typeof(TArg8), typeof(TArg9), typeof(TArg10), typeof(TArg11), typeof(TArg12), typeof(TArg13), typeof(TArg14), typeof(TArg15));
-#endif
- return (t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15) => provider.CreateQuery<Unit>(
- Expression.Invoke(
- Expression.Call(
- null,
- m,
- Expression.Constant(provider, typeof(IQbservableProvider)),
- action,
- Expression.Constant(scheduler, typeof(IScheduler))
- ),
- Expression.Constant(t1, typeof(TArg1)),
- Expression.Constant(t2, typeof(TArg2)),
- Expression.Constant(t3, typeof(TArg3)),
- Expression.Constant(t4, typeof(TArg4)),
- Expression.Constant(t5, typeof(TArg5)),
- Expression.Constant(t6, typeof(TArg6)),
- Expression.Constant(t7, typeof(TArg7)),
- Expression.Constant(t8, typeof(TArg8)),
- Expression.Constant(t9, typeof(TArg9)),
- Expression.Constant(t10, typeof(TArg10)),
- Expression.Constant(t11, typeof(TArg11)),
- Expression.Constant(t12, typeof(TArg12)),
- Expression.Constant(t13, typeof(TArg13)),
- Expression.Constant(t14, typeof(TArg14)),
- Expression.Constant(t15, typeof(TArg15))
- )
- );
- }
-
- /// <summary>
- /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the default scheduler.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the action.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the action.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the action.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the action.</typeparam>
- /// <typeparam name="TArg7">The type of the seventh argument passed to the action.</typeparam>
- /// <typeparam name="TArg8">The type of the eighth argument passed to the action.</typeparam>
- /// <typeparam name="TArg9">The type of the ninth argument passed to the action.</typeparam>
- /// <typeparam name="TArg10">The type of the tenth argument passed to the action.</typeparam>
- /// <typeparam name="TArg11">The type of the eleventh argument passed to the action.</typeparam>
- /// <typeparam name="TArg12">The type of the twelfth argument passed to the action.</typeparam>
- /// <typeparam name="TArg13">The type of the thirteenth argument passed to the action.</typeparam>
- /// <typeparam name="TArg14">The type of the fourteenth argument passed to the action.</typeparam>
- /// <typeparam name="TArg15">The type of the fifteenth argument passed to the action.</typeparam>
- /// <typeparam name="TArg16">The type of the sixteenth argument passed to the action.</typeparam>
- /// <param name="action">Action to convert to an asynchronous action.</param>
- /// <returns>Asynchronous action.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="action" /> is null.</exception>
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, TArg16, IQbservable<Unit>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, TArg16>(this IQbservableProvider provider, Expression<Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, TArg16>> action)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (action == null)
- throw new ArgumentNullException("action");
-
-#if CRIPPLED_REFLECTION
- var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, TArg16>(default(IQbservableProvider), default(Expression<Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, TArg16>>)));
-#else
- var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7), typeof(TArg8), typeof(TArg9), typeof(TArg10), typeof(TArg11), typeof(TArg12), typeof(TArg13), typeof(TArg14), typeof(TArg15), typeof(TArg16));
-#endif
- return (t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15, t16) => provider.CreateQuery<Unit>(
- Expression.Invoke(
- Expression.Call(
- null,
- m,
- Expression.Constant(provider, typeof(IQbservableProvider)),
- action
- ),
- Expression.Constant(t1, typeof(TArg1)),
- Expression.Constant(t2, typeof(TArg2)),
- Expression.Constant(t3, typeof(TArg3)),
- Expression.Constant(t4, typeof(TArg4)),
- Expression.Constant(t5, typeof(TArg5)),
- Expression.Constant(t6, typeof(TArg6)),
- Expression.Constant(t7, typeof(TArg7)),
- Expression.Constant(t8, typeof(TArg8)),
- Expression.Constant(t9, typeof(TArg9)),
- Expression.Constant(t10, typeof(TArg10)),
- Expression.Constant(t11, typeof(TArg11)),
- Expression.Constant(t12, typeof(TArg12)),
- Expression.Constant(t13, typeof(TArg13)),
- Expression.Constant(t14, typeof(TArg14)),
- Expression.Constant(t15, typeof(TArg15)),
- Expression.Constant(t16, typeof(TArg16))
- )
- );
- }
-
- /// <summary>
- /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the specified scheduler.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the action.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the action.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the action.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the action.</typeparam>
- /// <typeparam name="TArg7">The type of the seventh argument passed to the action.</typeparam>
- /// <typeparam name="TArg8">The type of the eighth argument passed to the action.</typeparam>
- /// <typeparam name="TArg9">The type of the ninth argument passed to the action.</typeparam>
- /// <typeparam name="TArg10">The type of the tenth argument passed to the action.</typeparam>
- /// <typeparam name="TArg11">The type of the eleventh argument passed to the action.</typeparam>
- /// <typeparam name="TArg12">The type of the twelfth argument passed to the action.</typeparam>
- /// <typeparam name="TArg13">The type of the thirteenth argument passed to the action.</typeparam>
- /// <typeparam name="TArg14">The type of the fourteenth argument passed to the action.</typeparam>
- /// <typeparam name="TArg15">The type of the fifteenth argument passed to the action.</typeparam>
- /// <typeparam name="TArg16">The type of the sixteenth argument passed to the action.</typeparam>
- /// <param name="action">Action to convert to an asynchronous action.</param>
- /// <param name="scheduler">Scheduler to invoke the original action on.</param>
- /// <returns>Asynchronous action.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="action" /> or <paramref name="scheduler" /> is null.</exception>
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, TArg16, IQbservable<Unit>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, TArg16>(this IQbservableProvider provider, Expression<Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, TArg16>> action, IScheduler scheduler)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (action == null)
- throw new ArgumentNullException("action");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
-#if CRIPPLED_REFLECTION
- var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, TArg16>(default(IQbservableProvider), default(Expression<Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, TArg16>>), default(IScheduler)));
-#else
- var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7), typeof(TArg8), typeof(TArg9), typeof(TArg10), typeof(TArg11), typeof(TArg12), typeof(TArg13), typeof(TArg14), typeof(TArg15), typeof(TArg16));
-#endif
- return (t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15, t16) => provider.CreateQuery<Unit>(
- Expression.Invoke(
- Expression.Call(
- null,
- m,
- Expression.Constant(provider, typeof(IQbservableProvider)),
- action,
- Expression.Constant(scheduler, typeof(IScheduler))
- ),
- Expression.Constant(t1, typeof(TArg1)),
- Expression.Constant(t2, typeof(TArg2)),
- Expression.Constant(t3, typeof(TArg3)),
- Expression.Constant(t4, typeof(TArg4)),
- Expression.Constant(t5, typeof(TArg5)),
- Expression.Constant(t6, typeof(TArg6)),
- Expression.Constant(t7, typeof(TArg7)),
- Expression.Constant(t8, typeof(TArg8)),
- Expression.Constant(t9, typeof(TArg9)),
- Expression.Constant(t10, typeof(TArg10)),
- Expression.Constant(t11, typeof(TArg11)),
- Expression.Constant(t12, typeof(TArg12)),
- Expression.Constant(t13, typeof(TArg13)),
- Expression.Constant(t14, typeof(TArg14)),
- Expression.Constant(t15, typeof(TArg15)),
- Expression.Constant(t16, typeof(TArg16))
- )
- );
- }
-
-#endif
- /// <summary>
- /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
- /// <param name="function">Function to convert to an asynchronous function.</param>
- /// <returns>Asynchronous function.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="function" /> is null.</exception>
- public static Func<IQbservable<TResult>> ToAsync<TResult>(this IQbservableProvider provider, Expression<Func<TResult>> function)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (function == null)
- throw new ArgumentNullException("function");
-
-#if CRIPPLED_REFLECTION
- var m = InfoOf(() => Qbservable.ToAsync<TResult>(default(IQbservableProvider), default(Expression<Func<TResult>>)));
-#else
- var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TResult));
-#endif
- return () => provider.CreateQuery<TResult>(
- Expression.Invoke(
- Expression.Call(
- null,
- m,
- Expression.Constant(provider, typeof(IQbservableProvider)),
- function
- )
- )
- );
- }
-
- /// <summary>
- /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function on the specified scheduler.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
- /// <param name="function">Function to convert to an asynchronous function.</param>
- /// <param name="scheduler">Scheduler to invoke the original function on.</param>
- /// <returns>Asynchronous function.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="function" /> or <paramref name="scheduler" /> is null.</exception>
- public static Func<IQbservable<TResult>> ToAsync<TResult>(this IQbservableProvider provider, Expression<Func<TResult>> function, IScheduler scheduler)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (function == null)
- throw new ArgumentNullException("function");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
-#if CRIPPLED_REFLECTION
- var m = InfoOf(() => Qbservable.ToAsync<TResult>(default(IQbservableProvider), default(Expression<Func<TResult>>), default(IScheduler)));
-#else
- var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TResult));
-#endif
- return () => provider.CreateQuery<TResult>(
- Expression.Invoke(
- Expression.Call(
- null,
- m,
- Expression.Constant(provider, typeof(IQbservableProvider)),
- function,
- Expression.Constant(scheduler, typeof(IScheduler))
- )
- )
- );
- }
-
- /// <summary>
- /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
- /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
- /// <param name="function">Function to convert to an asynchronous function.</param>
- /// <returns>Asynchronous function.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="function" /> is null.</exception>
- public static Func<TArg1, IQbservable<TResult>> ToAsync<TArg1, TResult>(this IQbservableProvider provider, Expression<Func<TArg1, TResult>> function)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (function == null)
- throw new ArgumentNullException("function");
-
-#if CRIPPLED_REFLECTION
- var m = InfoOf(() => Qbservable.ToAsync<TArg1, TResult>(default(IQbservableProvider), default(Expression<Func<TArg1, TResult>>)));
-#else
- var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TResult));
-#endif
- return (t1) => provider.CreateQuery<TResult>(
- Expression.Invoke(
- Expression.Call(
- null,
- m,
- Expression.Constant(provider, typeof(IQbservableProvider)),
- function
- ),
- Expression.Constant(t1, typeof(TArg1))
- )
- );
- }
-
- /// <summary>
- /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function on the specified scheduler.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
- /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
- /// <param name="function">Function to convert to an asynchronous function.</param>
- /// <param name="scheduler">Scheduler to invoke the original function on.</param>
- /// <returns>Asynchronous function.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="function" /> or <paramref name="scheduler" /> is null.</exception>
- public static Func<TArg1, IQbservable<TResult>> ToAsync<TArg1, TResult>(this IQbservableProvider provider, Expression<Func<TArg1, TResult>> function, IScheduler scheduler)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (function == null)
- throw new ArgumentNullException("function");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
-#if CRIPPLED_REFLECTION
- var m = InfoOf(() => Qbservable.ToAsync<TArg1, TResult>(default(IQbservableProvider), default(Expression<Func<TArg1, TResult>>), default(IScheduler)));
-#else
- var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TResult));
-#endif
- return (t1) => provider.CreateQuery<TResult>(
- Expression.Invoke(
- Expression.Call(
- null,
- m,
- Expression.Constant(provider, typeof(IQbservableProvider)),
- function,
- Expression.Constant(scheduler, typeof(IScheduler))
- ),
- Expression.Constant(t1, typeof(TArg1))
- )
- );
- }
-
- /// <summary>
- /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
- /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
- /// <param name="function">Function to convert to an asynchronous function.</param>
- /// <returns>Asynchronous function.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="function" /> is null.</exception>
- public static Func<TArg1, TArg2, IQbservable<TResult>> ToAsync<TArg1, TArg2, TResult>(this IQbservableProvider provider, Expression<Func<TArg1, TArg2, TResult>> function)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (function == null)
- throw new ArgumentNullException("function");
-
-#if CRIPPLED_REFLECTION
- var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2, TResult>(default(IQbservableProvider), default(Expression<Func<TArg1, TArg2, TResult>>)));
-#else
- var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TResult));
-#endif
- return (t1, t2) => provider.CreateQuery<TResult>(
- Expression.Invoke(
- Expression.Call(
- null,
- m,
- Expression.Constant(provider, typeof(IQbservableProvider)),
- function
- ),
- Expression.Constant(t1, typeof(TArg1)),
- Expression.Constant(t2, typeof(TArg2))
- )
- );
- }
-
- /// <summary>
- /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function on the specified scheduler.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
- /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
- /// <param name="function">Function to convert to an asynchronous function.</param>
- /// <param name="scheduler">Scheduler to invoke the original function on.</param>
- /// <returns>Asynchronous function.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="function" /> or <paramref name="scheduler" /> is null.</exception>
- public static Func<TArg1, TArg2, IQbservable<TResult>> ToAsync<TArg1, TArg2, TResult>(this IQbservableProvider provider, Expression<Func<TArg1, TArg2, TResult>> function, IScheduler scheduler)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (function == null)
- throw new ArgumentNullException("function");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
-#if CRIPPLED_REFLECTION
- var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2, TResult>(default(IQbservableProvider), default(Expression<Func<TArg1, TArg2, TResult>>), default(IScheduler)));
-#else
- var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TResult));
-#endif
- return (t1, t2) => provider.CreateQuery<TResult>(
- Expression.Invoke(
- Expression.Call(
- null,
- m,
- Expression.Constant(provider, typeof(IQbservableProvider)),
- function,
- Expression.Constant(scheduler, typeof(IScheduler))
- ),
- Expression.Constant(t1, typeof(TArg1)),
- Expression.Constant(t2, typeof(TArg2))
- )
- );
- }
-
- /// <summary>
- /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the function.</typeparam>
- /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
- /// <param name="function">Function to convert to an asynchronous function.</param>
- /// <returns>Asynchronous function.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="function" /> is null.</exception>
- public static Func<TArg1, TArg2, TArg3, IQbservable<TResult>> ToAsync<TArg1, TArg2, TArg3, TResult>(this IQbservableProvider provider, Expression<Func<TArg1, TArg2, TArg3, TResult>> function)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (function == null)
- throw new ArgumentNullException("function");
-
-#if CRIPPLED_REFLECTION
- var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2, TArg3, TResult>(default(IQbservableProvider), default(Expression<Func<TArg1, TArg2, TArg3, TResult>>)));
-#else
- var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TResult));
-#endif
- return (t1, t2, t3) => provider.CreateQuery<TResult>(
- Expression.Invoke(
- Expression.Call(
- null,
- m,
- Expression.Constant(provider, typeof(IQbservableProvider)),
- function
- ),
- Expression.Constant(t1, typeof(TArg1)),
- Expression.Constant(t2, typeof(TArg2)),
- Expression.Constant(t3, typeof(TArg3))
- )
- );
- }
-
- /// <summary>
- /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function on the specified scheduler.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the function.</typeparam>
- /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
- /// <param name="function">Function to convert to an asynchronous function.</param>
- /// <param name="scheduler">Scheduler to invoke the original function on.</param>
- /// <returns>Asynchronous function.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="function" /> or <paramref name="scheduler" /> is null.</exception>
- public static Func<TArg1, TArg2, TArg3, IQbservable<TResult>> ToAsync<TArg1, TArg2, TArg3, TResult>(this IQbservableProvider provider, Expression<Func<TArg1, TArg2, TArg3, TResult>> function, IScheduler scheduler)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (function == null)
- throw new ArgumentNullException("function");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
-#if CRIPPLED_REFLECTION
- var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2, TArg3, TResult>(default(IQbservableProvider), default(Expression<Func<TArg1, TArg2, TArg3, TResult>>), default(IScheduler)));
-#else
- var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TResult));
-#endif
- return (t1, t2, t3) => provider.CreateQuery<TResult>(
- Expression.Invoke(
- Expression.Call(
- null,
- m,
- Expression.Constant(provider, typeof(IQbservableProvider)),
- function,
- Expression.Constant(scheduler, typeof(IScheduler))
- ),
- Expression.Constant(t1, typeof(TArg1)),
- Expression.Constant(t2, typeof(TArg2)),
- Expression.Constant(t3, typeof(TArg3))
- )
- );
- }
-
- /// <summary>
- /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the function.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the function.</typeparam>
- /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
- /// <param name="function">Function to convert to an asynchronous function.</param>
- /// <returns>Asynchronous function.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="function" /> is null.</exception>
- public static Func<TArg1, TArg2, TArg3, TArg4, IQbservable<TResult>> ToAsync<TArg1, TArg2, TArg3, TArg4, TResult>(this IQbservableProvider provider, Expression<Func<TArg1, TArg2, TArg3, TArg4, TResult>> function)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (function == null)
- throw new ArgumentNullException("function");
-
-#if CRIPPLED_REFLECTION
- var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2, TArg3, TArg4, TResult>(default(IQbservableProvider), default(Expression<Func<TArg1, TArg2, TArg3, TArg4, TResult>>)));
-#else
- var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TResult));
-#endif
- return (t1, t2, t3, t4) => provider.CreateQuery<TResult>(
- Expression.Invoke(
- Expression.Call(
- null,
- m,
- Expression.Constant(provider, typeof(IQbservableProvider)),
- function
- ),
- Expression.Constant(t1, typeof(TArg1)),
- Expression.Constant(t2, typeof(TArg2)),
- Expression.Constant(t3, typeof(TArg3)),
- Expression.Constant(t4, typeof(TArg4))
- )
- );
- }
-
- /// <summary>
- /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function on the specified scheduler.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the function.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the function.</typeparam>
- /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
- /// <param name="function">Function to convert to an asynchronous function.</param>
- /// <param name="scheduler">Scheduler to invoke the original function on.</param>
- /// <returns>Asynchronous function.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="function" /> or <paramref name="scheduler" /> is null.</exception>
- public static Func<TArg1, TArg2, TArg3, TArg4, IQbservable<TResult>> ToAsync<TArg1, TArg2, TArg3, TArg4, TResult>(this IQbservableProvider provider, Expression<Func<TArg1, TArg2, TArg3, TArg4, TResult>> function, IScheduler scheduler)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (function == null)
- throw new ArgumentNullException("function");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
-#if CRIPPLED_REFLECTION
- var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2, TArg3, TArg4, TResult>(default(IQbservableProvider), default(Expression<Func<TArg1, TArg2, TArg3, TArg4, TResult>>), default(IScheduler)));
-#else
- var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TResult));
-#endif
- return (t1, t2, t3, t4) => provider.CreateQuery<TResult>(
- Expression.Invoke(
- Expression.Call(
- null,
- m,
- Expression.Constant(provider, typeof(IQbservableProvider)),
- function,
- Expression.Constant(scheduler, typeof(IScheduler))
- ),
- Expression.Constant(t1, typeof(TArg1)),
- Expression.Constant(t2, typeof(TArg2)),
- Expression.Constant(t3, typeof(TArg3)),
- Expression.Constant(t4, typeof(TArg4))
- )
- );
- }
-
-#if !NO_LARGEARITY
- /// <summary>
- /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the function.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the function.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the function.</typeparam>
- /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
- /// <param name="function">Function to convert to an asynchronous function.</param>
- /// <returns>Asynchronous function.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="function" /> is null.</exception>
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, IQbservable<TResult>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TResult>(this IQbservableProvider provider, Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TResult>> function)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (function == null)
- throw new ArgumentNullException("function");
-
-#if CRIPPLED_REFLECTION
- var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TResult>(default(IQbservableProvider), default(Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TResult>>)));
-#else
- var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TResult));
-#endif
- return (t1, t2, t3, t4, t5) => provider.CreateQuery<TResult>(
- Expression.Invoke(
- Expression.Call(
- null,
- m,
- Expression.Constant(provider, typeof(IQbservableProvider)),
- function
- ),
- Expression.Constant(t1, typeof(TArg1)),
- Expression.Constant(t2, typeof(TArg2)),
- Expression.Constant(t3, typeof(TArg3)),
- Expression.Constant(t4, typeof(TArg4)),
- Expression.Constant(t5, typeof(TArg5))
- )
- );
- }
-
- /// <summary>
- /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function on the specified scheduler.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the function.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the function.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the function.</typeparam>
- /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
- /// <param name="function">Function to convert to an asynchronous function.</param>
- /// <param name="scheduler">Scheduler to invoke the original function on.</param>
- /// <returns>Asynchronous function.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="function" /> or <paramref name="scheduler" /> is null.</exception>
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, IQbservable<TResult>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TResult>(this IQbservableProvider provider, Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TResult>> function, IScheduler scheduler)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (function == null)
- throw new ArgumentNullException("function");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
-#if CRIPPLED_REFLECTION
- var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TResult>(default(IQbservableProvider), default(Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TResult>>), default(IScheduler)));
-#else
- var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TResult));
-#endif
- return (t1, t2, t3, t4, t5) => provider.CreateQuery<TResult>(
- Expression.Invoke(
- Expression.Call(
- null,
- m,
- Expression.Constant(provider, typeof(IQbservableProvider)),
- function,
- Expression.Constant(scheduler, typeof(IScheduler))
- ),
- Expression.Constant(t1, typeof(TArg1)),
- Expression.Constant(t2, typeof(TArg2)),
- Expression.Constant(t3, typeof(TArg3)),
- Expression.Constant(t4, typeof(TArg4)),
- Expression.Constant(t5, typeof(TArg5))
- )
- );
- }
-
- /// <summary>
- /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the function.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the function.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the function.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the function.</typeparam>
- /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
- /// <param name="function">Function to convert to an asynchronous function.</param>
- /// <returns>Asynchronous function.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="function" /> is null.</exception>
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, IQbservable<TResult>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TResult>(this IQbservableProvider provider, Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TResult>> function)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (function == null)
- throw new ArgumentNullException("function");
-
-#if CRIPPLED_REFLECTION
- var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TResult>(default(IQbservableProvider), default(Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TResult>>)));
-#else
- var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TResult));
-#endif
- return (t1, t2, t3, t4, t5, t6) => provider.CreateQuery<TResult>(
- Expression.Invoke(
- Expression.Call(
- null,
- m,
- Expression.Constant(provider, typeof(IQbservableProvider)),
- function
- ),
- Expression.Constant(t1, typeof(TArg1)),
- Expression.Constant(t2, typeof(TArg2)),
- Expression.Constant(t3, typeof(TArg3)),
- Expression.Constant(t4, typeof(TArg4)),
- Expression.Constant(t5, typeof(TArg5)),
- Expression.Constant(t6, typeof(TArg6))
- )
- );
- }
-
- /// <summary>
- /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function on the specified scheduler.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the function.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the function.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the function.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the function.</typeparam>
- /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
- /// <param name="function">Function to convert to an asynchronous function.</param>
- /// <param name="scheduler">Scheduler to invoke the original function on.</param>
- /// <returns>Asynchronous function.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="function" /> or <paramref name="scheduler" /> is null.</exception>
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, IQbservable<TResult>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TResult>(this IQbservableProvider provider, Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TResult>> function, IScheduler scheduler)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (function == null)
- throw new ArgumentNullException("function");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
-#if CRIPPLED_REFLECTION
- var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TResult>(default(IQbservableProvider), default(Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TResult>>), default(IScheduler)));
-#else
- var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TResult));
-#endif
- return (t1, t2, t3, t4, t5, t6) => provider.CreateQuery<TResult>(
- Expression.Invoke(
- Expression.Call(
- null,
- m,
- Expression.Constant(provider, typeof(IQbservableProvider)),
- function,
- Expression.Constant(scheduler, typeof(IScheduler))
- ),
- Expression.Constant(t1, typeof(TArg1)),
- Expression.Constant(t2, typeof(TArg2)),
- Expression.Constant(t3, typeof(TArg3)),
- Expression.Constant(t4, typeof(TArg4)),
- Expression.Constant(t5, typeof(TArg5)),
- Expression.Constant(t6, typeof(TArg6))
- )
- );
- }
-
- /// <summary>
- /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the function.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the function.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the function.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the function.</typeparam>
- /// <typeparam name="TArg7">The type of the seventh argument passed to the function.</typeparam>
- /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
- /// <param name="function">Function to convert to an asynchronous function.</param>
- /// <returns>Asynchronous function.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="function" /> is null.</exception>
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, IQbservable<TResult>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TResult>(this IQbservableProvider provider, Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TResult>> function)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (function == null)
- throw new ArgumentNullException("function");
-
-#if CRIPPLED_REFLECTION
- var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TResult>(default(IQbservableProvider), default(Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TResult>>)));
-#else
- var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7), typeof(TResult));
-#endif
- return (t1, t2, t3, t4, t5, t6, t7) => provider.CreateQuery<TResult>(
- Expression.Invoke(
- Expression.Call(
- null,
- m,
- Expression.Constant(provider, typeof(IQbservableProvider)),
- function
- ),
- Expression.Constant(t1, typeof(TArg1)),
- Expression.Constant(t2, typeof(TArg2)),
- Expression.Constant(t3, typeof(TArg3)),
- Expression.Constant(t4, typeof(TArg4)),
- Expression.Constant(t5, typeof(TArg5)),
- Expression.Constant(t6, typeof(TArg6)),
- Expression.Constant(t7, typeof(TArg7))
- )
- );
- }
-
- /// <summary>
- /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function on the specified scheduler.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the function.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the function.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the function.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the function.</typeparam>
- /// <typeparam name="TArg7">The type of the seventh argument passed to the function.</typeparam>
- /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
- /// <param name="function">Function to convert to an asynchronous function.</param>
- /// <param name="scheduler">Scheduler to invoke the original function on.</param>
- /// <returns>Asynchronous function.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="function" /> or <paramref name="scheduler" /> is null.</exception>
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, IQbservable<TResult>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TResult>(this IQbservableProvider provider, Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TResult>> function, IScheduler scheduler)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (function == null)
- throw new ArgumentNullException("function");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
-#if CRIPPLED_REFLECTION
- var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TResult>(default(IQbservableProvider), default(Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TResult>>), default(IScheduler)));
-#else
- var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7), typeof(TResult));
-#endif
- return (t1, t2, t3, t4, t5, t6, t7) => provider.CreateQuery<TResult>(
- Expression.Invoke(
- Expression.Call(
- null,
- m,
- Expression.Constant(provider, typeof(IQbservableProvider)),
- function,
- Expression.Constant(scheduler, typeof(IScheduler))
- ),
- Expression.Constant(t1, typeof(TArg1)),
- Expression.Constant(t2, typeof(TArg2)),
- Expression.Constant(t3, typeof(TArg3)),
- Expression.Constant(t4, typeof(TArg4)),
- Expression.Constant(t5, typeof(TArg5)),
- Expression.Constant(t6, typeof(TArg6)),
- Expression.Constant(t7, typeof(TArg7))
- )
- );
- }
-
- /// <summary>
- /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the function.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the function.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the function.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the function.</typeparam>
- /// <typeparam name="TArg7">The type of the seventh argument passed to the function.</typeparam>
- /// <typeparam name="TArg8">The type of the eighth argument passed to the function.</typeparam>
- /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
- /// <param name="function">Function to convert to an asynchronous function.</param>
- /// <returns>Asynchronous function.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="function" /> is null.</exception>
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, IQbservable<TResult>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TResult>(this IQbservableProvider provider, Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TResult>> function)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (function == null)
- throw new ArgumentNullException("function");
-
-#if CRIPPLED_REFLECTION
- var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TResult>(default(IQbservableProvider), default(Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TResult>>)));
-#else
- var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7), typeof(TArg8), typeof(TResult));
-#endif
- return (t1, t2, t3, t4, t5, t6, t7, t8) => provider.CreateQuery<TResult>(
- Expression.Invoke(
- Expression.Call(
- null,
- m,
- Expression.Constant(provider, typeof(IQbservableProvider)),
- function
- ),
- Expression.Constant(t1, typeof(TArg1)),
- Expression.Constant(t2, typeof(TArg2)),
- Expression.Constant(t3, typeof(TArg3)),
- Expression.Constant(t4, typeof(TArg4)),
- Expression.Constant(t5, typeof(TArg5)),
- Expression.Constant(t6, typeof(TArg6)),
- Expression.Constant(t7, typeof(TArg7)),
- Expression.Constant(t8, typeof(TArg8))
- )
- );
- }
-
- /// <summary>
- /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function on the specified scheduler.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the function.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the function.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the function.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the function.</typeparam>
- /// <typeparam name="TArg7">The type of the seventh argument passed to the function.</typeparam>
- /// <typeparam name="TArg8">The type of the eighth argument passed to the function.</typeparam>
- /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
- /// <param name="function">Function to convert to an asynchronous function.</param>
- /// <param name="scheduler">Scheduler to invoke the original function on.</param>
- /// <returns>Asynchronous function.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="function" /> or <paramref name="scheduler" /> is null.</exception>
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, IQbservable<TResult>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TResult>(this IQbservableProvider provider, Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TResult>> function, IScheduler scheduler)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (function == null)
- throw new ArgumentNullException("function");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
-#if CRIPPLED_REFLECTION
- var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TResult>(default(IQbservableProvider), default(Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TResult>>), default(IScheduler)));
-#else
- var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7), typeof(TArg8), typeof(TResult));
-#endif
- return (t1, t2, t3, t4, t5, t6, t7, t8) => provider.CreateQuery<TResult>(
- Expression.Invoke(
- Expression.Call(
- null,
- m,
- Expression.Constant(provider, typeof(IQbservableProvider)),
- function,
- Expression.Constant(scheduler, typeof(IScheduler))
- ),
- Expression.Constant(t1, typeof(TArg1)),
- Expression.Constant(t2, typeof(TArg2)),
- Expression.Constant(t3, typeof(TArg3)),
- Expression.Constant(t4, typeof(TArg4)),
- Expression.Constant(t5, typeof(TArg5)),
- Expression.Constant(t6, typeof(TArg6)),
- Expression.Constant(t7, typeof(TArg7)),
- Expression.Constant(t8, typeof(TArg8))
- )
- );
- }
-
- /// <summary>
- /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the function.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the function.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the function.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the function.</typeparam>
- /// <typeparam name="TArg7">The type of the seventh argument passed to the function.</typeparam>
- /// <typeparam name="TArg8">The type of the eighth argument passed to the function.</typeparam>
- /// <typeparam name="TArg9">The type of the ninth argument passed to the function.</typeparam>
- /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
- /// <param name="function">Function to convert to an asynchronous function.</param>
- /// <returns>Asynchronous function.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="function" /> is null.</exception>
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, IQbservable<TResult>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TResult>(this IQbservableProvider provider, Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TResult>> function)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (function == null)
- throw new ArgumentNullException("function");
-
-#if CRIPPLED_REFLECTION
- var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TResult>(default(IQbservableProvider), default(Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TResult>>)));
-#else
- var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7), typeof(TArg8), typeof(TArg9), typeof(TResult));
-#endif
- return (t1, t2, t3, t4, t5, t6, t7, t8, t9) => provider.CreateQuery<TResult>(
- Expression.Invoke(
- Expression.Call(
- null,
- m,
- Expression.Constant(provider, typeof(IQbservableProvider)),
- function
- ),
- Expression.Constant(t1, typeof(TArg1)),
- Expression.Constant(t2, typeof(TArg2)),
- Expression.Constant(t3, typeof(TArg3)),
- Expression.Constant(t4, typeof(TArg4)),
- Expression.Constant(t5, typeof(TArg5)),
- Expression.Constant(t6, typeof(TArg6)),
- Expression.Constant(t7, typeof(TArg7)),
- Expression.Constant(t8, typeof(TArg8)),
- Expression.Constant(t9, typeof(TArg9))
- )
- );
- }
-
- /// <summary>
- /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function on the specified scheduler.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the function.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the function.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the function.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the function.</typeparam>
- /// <typeparam name="TArg7">The type of the seventh argument passed to the function.</typeparam>
- /// <typeparam name="TArg8">The type of the eighth argument passed to the function.</typeparam>
- /// <typeparam name="TArg9">The type of the ninth argument passed to the function.</typeparam>
- /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
- /// <param name="function">Function to convert to an asynchronous function.</param>
- /// <param name="scheduler">Scheduler to invoke the original function on.</param>
- /// <returns>Asynchronous function.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="function" /> or <paramref name="scheduler" /> is null.</exception>
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, IQbservable<TResult>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TResult>(this IQbservableProvider provider, Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TResult>> function, IScheduler scheduler)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (function == null)
- throw new ArgumentNullException("function");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
-#if CRIPPLED_REFLECTION
- var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TResult>(default(IQbservableProvider), default(Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TResult>>), default(IScheduler)));
-#else
- var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7), typeof(TArg8), typeof(TArg9), typeof(TResult));
-#endif
- return (t1, t2, t3, t4, t5, t6, t7, t8, t9) => provider.CreateQuery<TResult>(
- Expression.Invoke(
- Expression.Call(
- null,
- m,
- Expression.Constant(provider, typeof(IQbservableProvider)),
- function,
- Expression.Constant(scheduler, typeof(IScheduler))
- ),
- Expression.Constant(t1, typeof(TArg1)),
- Expression.Constant(t2, typeof(TArg2)),
- Expression.Constant(t3, typeof(TArg3)),
- Expression.Constant(t4, typeof(TArg4)),
- Expression.Constant(t5, typeof(TArg5)),
- Expression.Constant(t6, typeof(TArg6)),
- Expression.Constant(t7, typeof(TArg7)),
- Expression.Constant(t8, typeof(TArg8)),
- Expression.Constant(t9, typeof(TArg9))
- )
- );
- }
-
- /// <summary>
- /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the function.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the function.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the function.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the function.</typeparam>
- /// <typeparam name="TArg7">The type of the seventh argument passed to the function.</typeparam>
- /// <typeparam name="TArg8">The type of the eighth argument passed to the function.</typeparam>
- /// <typeparam name="TArg9">The type of the ninth argument passed to the function.</typeparam>
- /// <typeparam name="TArg10">The type of the tenth argument passed to the function.</typeparam>
- /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
- /// <param name="function">Function to convert to an asynchronous function.</param>
- /// <returns>Asynchronous function.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="function" /> is null.</exception>
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, IQbservable<TResult>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TResult>(this IQbservableProvider provider, Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TResult>> function)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (function == null)
- throw new ArgumentNullException("function");
-
-#if CRIPPLED_REFLECTION
- var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TResult>(default(IQbservableProvider), default(Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TResult>>)));
-#else
- var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7), typeof(TArg8), typeof(TArg9), typeof(TArg10), typeof(TResult));
-#endif
- return (t1, t2, t3, t4, t5, t6, t7, t8, t9, t10) => provider.CreateQuery<TResult>(
- Expression.Invoke(
- Expression.Call(
- null,
- m,
- Expression.Constant(provider, typeof(IQbservableProvider)),
- function
- ),
- Expression.Constant(t1, typeof(TArg1)),
- Expression.Constant(t2, typeof(TArg2)),
- Expression.Constant(t3, typeof(TArg3)),
- Expression.Constant(t4, typeof(TArg4)),
- Expression.Constant(t5, typeof(TArg5)),
- Expression.Constant(t6, typeof(TArg6)),
- Expression.Constant(t7, typeof(TArg7)),
- Expression.Constant(t8, typeof(TArg8)),
- Expression.Constant(t9, typeof(TArg9)),
- Expression.Constant(t10, typeof(TArg10))
- )
- );
- }
-
- /// <summary>
- /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function on the specified scheduler.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the function.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the function.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the function.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the function.</typeparam>
- /// <typeparam name="TArg7">The type of the seventh argument passed to the function.</typeparam>
- /// <typeparam name="TArg8">The type of the eighth argument passed to the function.</typeparam>
- /// <typeparam name="TArg9">The type of the ninth argument passed to the function.</typeparam>
- /// <typeparam name="TArg10">The type of the tenth argument passed to the function.</typeparam>
- /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
- /// <param name="function">Function to convert to an asynchronous function.</param>
- /// <param name="scheduler">Scheduler to invoke the original function on.</param>
- /// <returns>Asynchronous function.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="function" /> or <paramref name="scheduler" /> is null.</exception>
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, IQbservable<TResult>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TResult>(this IQbservableProvider provider, Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TResult>> function, IScheduler scheduler)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (function == null)
- throw new ArgumentNullException("function");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
-#if CRIPPLED_REFLECTION
- var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TResult>(default(IQbservableProvider), default(Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TResult>>), default(IScheduler)));
-#else
- var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7), typeof(TArg8), typeof(TArg9), typeof(TArg10), typeof(TResult));
-#endif
- return (t1, t2, t3, t4, t5, t6, t7, t8, t9, t10) => provider.CreateQuery<TResult>(
- Expression.Invoke(
- Expression.Call(
- null,
- m,
- Expression.Constant(provider, typeof(IQbservableProvider)),
- function,
- Expression.Constant(scheduler, typeof(IScheduler))
- ),
- Expression.Constant(t1, typeof(TArg1)),
- Expression.Constant(t2, typeof(TArg2)),
- Expression.Constant(t3, typeof(TArg3)),
- Expression.Constant(t4, typeof(TArg4)),
- Expression.Constant(t5, typeof(TArg5)),
- Expression.Constant(t6, typeof(TArg6)),
- Expression.Constant(t7, typeof(TArg7)),
- Expression.Constant(t8, typeof(TArg8)),
- Expression.Constant(t9, typeof(TArg9)),
- Expression.Constant(t10, typeof(TArg10))
- )
- );
- }
-
- /// <summary>
- /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the function.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the function.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the function.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the function.</typeparam>
- /// <typeparam name="TArg7">The type of the seventh argument passed to the function.</typeparam>
- /// <typeparam name="TArg8">The type of the eighth argument passed to the function.</typeparam>
- /// <typeparam name="TArg9">The type of the ninth argument passed to the function.</typeparam>
- /// <typeparam name="TArg10">The type of the tenth argument passed to the function.</typeparam>
- /// <typeparam name="TArg11">The type of the eleventh argument passed to the function.</typeparam>
- /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
- /// <param name="function">Function to convert to an asynchronous function.</param>
- /// <returns>Asynchronous function.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="function" /> is null.</exception>
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, IQbservable<TResult>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TResult>(this IQbservableProvider provider, Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TResult>> function)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (function == null)
- throw new ArgumentNullException("function");
-
-#if CRIPPLED_REFLECTION
- var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TResult>(default(IQbservableProvider), default(Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TResult>>)));
-#else
- var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7), typeof(TArg8), typeof(TArg9), typeof(TArg10), typeof(TArg11), typeof(TResult));
-#endif
- return (t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11) => provider.CreateQuery<TResult>(
- Expression.Invoke(
- Expression.Call(
- null,
- m,
- Expression.Constant(provider, typeof(IQbservableProvider)),
- function
- ),
- Expression.Constant(t1, typeof(TArg1)),
- Expression.Constant(t2, typeof(TArg2)),
- Expression.Constant(t3, typeof(TArg3)),
- Expression.Constant(t4, typeof(TArg4)),
- Expression.Constant(t5, typeof(TArg5)),
- Expression.Constant(t6, typeof(TArg6)),
- Expression.Constant(t7, typeof(TArg7)),
- Expression.Constant(t8, typeof(TArg8)),
- Expression.Constant(t9, typeof(TArg9)),
- Expression.Constant(t10, typeof(TArg10)),
- Expression.Constant(t11, typeof(TArg11))
- )
- );
- }
-
- /// <summary>
- /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function on the specified scheduler.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the function.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the function.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the function.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the function.</typeparam>
- /// <typeparam name="TArg7">The type of the seventh argument passed to the function.</typeparam>
- /// <typeparam name="TArg8">The type of the eighth argument passed to the function.</typeparam>
- /// <typeparam name="TArg9">The type of the ninth argument passed to the function.</typeparam>
- /// <typeparam name="TArg10">The type of the tenth argument passed to the function.</typeparam>
- /// <typeparam name="TArg11">The type of the eleventh argument passed to the function.</typeparam>
- /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
- /// <param name="function">Function to convert to an asynchronous function.</param>
- /// <param name="scheduler">Scheduler to invoke the original function on.</param>
- /// <returns>Asynchronous function.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="function" /> or <paramref name="scheduler" /> is null.</exception>
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, IQbservable<TResult>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TResult>(this IQbservableProvider provider, Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TResult>> function, IScheduler scheduler)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (function == null)
- throw new ArgumentNullException("function");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
-#if CRIPPLED_REFLECTION
- var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TResult>(default(IQbservableProvider), default(Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TResult>>), default(IScheduler)));
-#else
- var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7), typeof(TArg8), typeof(TArg9), typeof(TArg10), typeof(TArg11), typeof(TResult));
-#endif
- return (t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11) => provider.CreateQuery<TResult>(
- Expression.Invoke(
- Expression.Call(
- null,
- m,
- Expression.Constant(provider, typeof(IQbservableProvider)),
- function,
- Expression.Constant(scheduler, typeof(IScheduler))
- ),
- Expression.Constant(t1, typeof(TArg1)),
- Expression.Constant(t2, typeof(TArg2)),
- Expression.Constant(t3, typeof(TArg3)),
- Expression.Constant(t4, typeof(TArg4)),
- Expression.Constant(t5, typeof(TArg5)),
- Expression.Constant(t6, typeof(TArg6)),
- Expression.Constant(t7, typeof(TArg7)),
- Expression.Constant(t8, typeof(TArg8)),
- Expression.Constant(t9, typeof(TArg9)),
- Expression.Constant(t10, typeof(TArg10)),
- Expression.Constant(t11, typeof(TArg11))
- )
- );
- }
-
- /// <summary>
- /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the function.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the function.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the function.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the function.</typeparam>
- /// <typeparam name="TArg7">The type of the seventh argument passed to the function.</typeparam>
- /// <typeparam name="TArg8">The type of the eighth argument passed to the function.</typeparam>
- /// <typeparam name="TArg9">The type of the ninth argument passed to the function.</typeparam>
- /// <typeparam name="TArg10">The type of the tenth argument passed to the function.</typeparam>
- /// <typeparam name="TArg11">The type of the eleventh argument passed to the function.</typeparam>
- /// <typeparam name="TArg12">The type of the twelfth argument passed to the function.</typeparam>
- /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
- /// <param name="function">Function to convert to an asynchronous function.</param>
- /// <returns>Asynchronous function.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="function" /> is null.</exception>
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, IQbservable<TResult>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TResult>(this IQbservableProvider provider, Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TResult>> function)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (function == null)
- throw new ArgumentNullException("function");
-
-#if CRIPPLED_REFLECTION
- var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TResult>(default(IQbservableProvider), default(Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TResult>>)));
-#else
- var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7), typeof(TArg8), typeof(TArg9), typeof(TArg10), typeof(TArg11), typeof(TArg12), typeof(TResult));
-#endif
- return (t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12) => provider.CreateQuery<TResult>(
- Expression.Invoke(
- Expression.Call(
- null,
- m,
- Expression.Constant(provider, typeof(IQbservableProvider)),
- function
- ),
- Expression.Constant(t1, typeof(TArg1)),
- Expression.Constant(t2, typeof(TArg2)),
- Expression.Constant(t3, typeof(TArg3)),
- Expression.Constant(t4, typeof(TArg4)),
- Expression.Constant(t5, typeof(TArg5)),
- Expression.Constant(t6, typeof(TArg6)),
- Expression.Constant(t7, typeof(TArg7)),
- Expression.Constant(t8, typeof(TArg8)),
- Expression.Constant(t9, typeof(TArg9)),
- Expression.Constant(t10, typeof(TArg10)),
- Expression.Constant(t11, typeof(TArg11)),
- Expression.Constant(t12, typeof(TArg12))
- )
- );
- }
-
- /// <summary>
- /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function on the specified scheduler.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the function.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the function.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the function.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the function.</typeparam>
- /// <typeparam name="TArg7">The type of the seventh argument passed to the function.</typeparam>
- /// <typeparam name="TArg8">The type of the eighth argument passed to the function.</typeparam>
- /// <typeparam name="TArg9">The type of the ninth argument passed to the function.</typeparam>
- /// <typeparam name="TArg10">The type of the tenth argument passed to the function.</typeparam>
- /// <typeparam name="TArg11">The type of the eleventh argument passed to the function.</typeparam>
- /// <typeparam name="TArg12">The type of the twelfth argument passed to the function.</typeparam>
- /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
- /// <param name="function">Function to convert to an asynchronous function.</param>
- /// <param name="scheduler">Scheduler to invoke the original function on.</param>
- /// <returns>Asynchronous function.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="function" /> or <paramref name="scheduler" /> is null.</exception>
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, IQbservable<TResult>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TResult>(this IQbservableProvider provider, Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TResult>> function, IScheduler scheduler)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (function == null)
- throw new ArgumentNullException("function");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
-#if CRIPPLED_REFLECTION
- var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TResult>(default(IQbservableProvider), default(Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TResult>>), default(IScheduler)));
-#else
- var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7), typeof(TArg8), typeof(TArg9), typeof(TArg10), typeof(TArg11), typeof(TArg12), typeof(TResult));
-#endif
- return (t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12) => provider.CreateQuery<TResult>(
- Expression.Invoke(
- Expression.Call(
- null,
- m,
- Expression.Constant(provider, typeof(IQbservableProvider)),
- function,
- Expression.Constant(scheduler, typeof(IScheduler))
- ),
- Expression.Constant(t1, typeof(TArg1)),
- Expression.Constant(t2, typeof(TArg2)),
- Expression.Constant(t3, typeof(TArg3)),
- Expression.Constant(t4, typeof(TArg4)),
- Expression.Constant(t5, typeof(TArg5)),
- Expression.Constant(t6, typeof(TArg6)),
- Expression.Constant(t7, typeof(TArg7)),
- Expression.Constant(t8, typeof(TArg8)),
- Expression.Constant(t9, typeof(TArg9)),
- Expression.Constant(t10, typeof(TArg10)),
- Expression.Constant(t11, typeof(TArg11)),
- Expression.Constant(t12, typeof(TArg12))
- )
- );
- }
-
- /// <summary>
- /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the function.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the function.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the function.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the function.</typeparam>
- /// <typeparam name="TArg7">The type of the seventh argument passed to the function.</typeparam>
- /// <typeparam name="TArg8">The type of the eighth argument passed to the function.</typeparam>
- /// <typeparam name="TArg9">The type of the ninth argument passed to the function.</typeparam>
- /// <typeparam name="TArg10">The type of the tenth argument passed to the function.</typeparam>
- /// <typeparam name="TArg11">The type of the eleventh argument passed to the function.</typeparam>
- /// <typeparam name="TArg12">The type of the twelfth argument passed to the function.</typeparam>
- /// <typeparam name="TArg13">The type of the thirteenth argument passed to the function.</typeparam>
- /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
- /// <param name="function">Function to convert to an asynchronous function.</param>
- /// <returns>Asynchronous function.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="function" /> is null.</exception>
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, IQbservable<TResult>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TResult>(this IQbservableProvider provider, Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TResult>> function)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (function == null)
- throw new ArgumentNullException("function");
-
-#if CRIPPLED_REFLECTION
- var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TResult>(default(IQbservableProvider), default(Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TResult>>)));
-#else
- var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7), typeof(TArg8), typeof(TArg9), typeof(TArg10), typeof(TArg11), typeof(TArg12), typeof(TArg13), typeof(TResult));
-#endif
- return (t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13) => provider.CreateQuery<TResult>(
- Expression.Invoke(
- Expression.Call(
- null,
- m,
- Expression.Constant(provider, typeof(IQbservableProvider)),
- function
- ),
- Expression.Constant(t1, typeof(TArg1)),
- Expression.Constant(t2, typeof(TArg2)),
- Expression.Constant(t3, typeof(TArg3)),
- Expression.Constant(t4, typeof(TArg4)),
- Expression.Constant(t5, typeof(TArg5)),
- Expression.Constant(t6, typeof(TArg6)),
- Expression.Constant(t7, typeof(TArg7)),
- Expression.Constant(t8, typeof(TArg8)),
- Expression.Constant(t9, typeof(TArg9)),
- Expression.Constant(t10, typeof(TArg10)),
- Expression.Constant(t11, typeof(TArg11)),
- Expression.Constant(t12, typeof(TArg12)),
- Expression.Constant(t13, typeof(TArg13))
- )
- );
- }
-
- /// <summary>
- /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function on the specified scheduler.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the function.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the function.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the function.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the function.</typeparam>
- /// <typeparam name="TArg7">The type of the seventh argument passed to the function.</typeparam>
- /// <typeparam name="TArg8">The type of the eighth argument passed to the function.</typeparam>
- /// <typeparam name="TArg9">The type of the ninth argument passed to the function.</typeparam>
- /// <typeparam name="TArg10">The type of the tenth argument passed to the function.</typeparam>
- /// <typeparam name="TArg11">The type of the eleventh argument passed to the function.</typeparam>
- /// <typeparam name="TArg12">The type of the twelfth argument passed to the function.</typeparam>
- /// <typeparam name="TArg13">The type of the thirteenth argument passed to the function.</typeparam>
- /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
- /// <param name="function">Function to convert to an asynchronous function.</param>
- /// <param name="scheduler">Scheduler to invoke the original function on.</param>
- /// <returns>Asynchronous function.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="function" /> or <paramref name="scheduler" /> is null.</exception>
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, IQbservable<TResult>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TResult>(this IQbservableProvider provider, Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TResult>> function, IScheduler scheduler)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (function == null)
- throw new ArgumentNullException("function");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
-#if CRIPPLED_REFLECTION
- var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TResult>(default(IQbservableProvider), default(Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TResult>>), default(IScheduler)));
-#else
- var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7), typeof(TArg8), typeof(TArg9), typeof(TArg10), typeof(TArg11), typeof(TArg12), typeof(TArg13), typeof(TResult));
-#endif
- return (t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13) => provider.CreateQuery<TResult>(
- Expression.Invoke(
- Expression.Call(
- null,
- m,
- Expression.Constant(provider, typeof(IQbservableProvider)),
- function,
- Expression.Constant(scheduler, typeof(IScheduler))
- ),
- Expression.Constant(t1, typeof(TArg1)),
- Expression.Constant(t2, typeof(TArg2)),
- Expression.Constant(t3, typeof(TArg3)),
- Expression.Constant(t4, typeof(TArg4)),
- Expression.Constant(t5, typeof(TArg5)),
- Expression.Constant(t6, typeof(TArg6)),
- Expression.Constant(t7, typeof(TArg7)),
- Expression.Constant(t8, typeof(TArg8)),
- Expression.Constant(t9, typeof(TArg9)),
- Expression.Constant(t10, typeof(TArg10)),
- Expression.Constant(t11, typeof(TArg11)),
- Expression.Constant(t12, typeof(TArg12)),
- Expression.Constant(t13, typeof(TArg13))
- )
- );
- }
-
- /// <summary>
- /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the function.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the function.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the function.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the function.</typeparam>
- /// <typeparam name="TArg7">The type of the seventh argument passed to the function.</typeparam>
- /// <typeparam name="TArg8">The type of the eighth argument passed to the function.</typeparam>
- /// <typeparam name="TArg9">The type of the ninth argument passed to the function.</typeparam>
- /// <typeparam name="TArg10">The type of the tenth argument passed to the function.</typeparam>
- /// <typeparam name="TArg11">The type of the eleventh argument passed to the function.</typeparam>
- /// <typeparam name="TArg12">The type of the twelfth argument passed to the function.</typeparam>
- /// <typeparam name="TArg13">The type of the thirteenth argument passed to the function.</typeparam>
- /// <typeparam name="TArg14">The type of the fourteenth argument passed to the function.</typeparam>
- /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
- /// <param name="function">Function to convert to an asynchronous function.</param>
- /// <returns>Asynchronous function.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="function" /> is null.</exception>
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, IQbservable<TResult>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TResult>(this IQbservableProvider provider, Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TResult>> function)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (function == null)
- throw new ArgumentNullException("function");
-
-#if CRIPPLED_REFLECTION
- var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TResult>(default(IQbservableProvider), default(Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TResult>>)));
-#else
- var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7), typeof(TArg8), typeof(TArg9), typeof(TArg10), typeof(TArg11), typeof(TArg12), typeof(TArg13), typeof(TArg14), typeof(TResult));
-#endif
- return (t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14) => provider.CreateQuery<TResult>(
- Expression.Invoke(
- Expression.Call(
- null,
- m,
- Expression.Constant(provider, typeof(IQbservableProvider)),
- function
- ),
- Expression.Constant(t1, typeof(TArg1)),
- Expression.Constant(t2, typeof(TArg2)),
- Expression.Constant(t3, typeof(TArg3)),
- Expression.Constant(t4, typeof(TArg4)),
- Expression.Constant(t5, typeof(TArg5)),
- Expression.Constant(t6, typeof(TArg6)),
- Expression.Constant(t7, typeof(TArg7)),
- Expression.Constant(t8, typeof(TArg8)),
- Expression.Constant(t9, typeof(TArg9)),
- Expression.Constant(t10, typeof(TArg10)),
- Expression.Constant(t11, typeof(TArg11)),
- Expression.Constant(t12, typeof(TArg12)),
- Expression.Constant(t13, typeof(TArg13)),
- Expression.Constant(t14, typeof(TArg14))
- )
- );
- }
-
- /// <summary>
- /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function on the specified scheduler.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the function.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the function.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the function.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the function.</typeparam>
- /// <typeparam name="TArg7">The type of the seventh argument passed to the function.</typeparam>
- /// <typeparam name="TArg8">The type of the eighth argument passed to the function.</typeparam>
- /// <typeparam name="TArg9">The type of the ninth argument passed to the function.</typeparam>
- /// <typeparam name="TArg10">The type of the tenth argument passed to the function.</typeparam>
- /// <typeparam name="TArg11">The type of the eleventh argument passed to the function.</typeparam>
- /// <typeparam name="TArg12">The type of the twelfth argument passed to the function.</typeparam>
- /// <typeparam name="TArg13">The type of the thirteenth argument passed to the function.</typeparam>
- /// <typeparam name="TArg14">The type of the fourteenth argument passed to the function.</typeparam>
- /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
- /// <param name="function">Function to convert to an asynchronous function.</param>
- /// <param name="scheduler">Scheduler to invoke the original function on.</param>
- /// <returns>Asynchronous function.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="function" /> or <paramref name="scheduler" /> is null.</exception>
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, IQbservable<TResult>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TResult>(this IQbservableProvider provider, Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TResult>> function, IScheduler scheduler)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (function == null)
- throw new ArgumentNullException("function");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
-#if CRIPPLED_REFLECTION
- var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TResult>(default(IQbservableProvider), default(Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TResult>>), default(IScheduler)));
-#else
- var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7), typeof(TArg8), typeof(TArg9), typeof(TArg10), typeof(TArg11), typeof(TArg12), typeof(TArg13), typeof(TArg14), typeof(TResult));
-#endif
- return (t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14) => provider.CreateQuery<TResult>(
- Expression.Invoke(
- Expression.Call(
- null,
- m,
- Expression.Constant(provider, typeof(IQbservableProvider)),
- function,
- Expression.Constant(scheduler, typeof(IScheduler))
- ),
- Expression.Constant(t1, typeof(TArg1)),
- Expression.Constant(t2, typeof(TArg2)),
- Expression.Constant(t3, typeof(TArg3)),
- Expression.Constant(t4, typeof(TArg4)),
- Expression.Constant(t5, typeof(TArg5)),
- Expression.Constant(t6, typeof(TArg6)),
- Expression.Constant(t7, typeof(TArg7)),
- Expression.Constant(t8, typeof(TArg8)),
- Expression.Constant(t9, typeof(TArg9)),
- Expression.Constant(t10, typeof(TArg10)),
- Expression.Constant(t11, typeof(TArg11)),
- Expression.Constant(t12, typeof(TArg12)),
- Expression.Constant(t13, typeof(TArg13)),
- Expression.Constant(t14, typeof(TArg14))
- )
- );
- }
-
- /// <summary>
- /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the function.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the function.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the function.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the function.</typeparam>
- /// <typeparam name="TArg7">The type of the seventh argument passed to the function.</typeparam>
- /// <typeparam name="TArg8">The type of the eighth argument passed to the function.</typeparam>
- /// <typeparam name="TArg9">The type of the ninth argument passed to the function.</typeparam>
- /// <typeparam name="TArg10">The type of the tenth argument passed to the function.</typeparam>
- /// <typeparam name="TArg11">The type of the eleventh argument passed to the function.</typeparam>
- /// <typeparam name="TArg12">The type of the twelfth argument passed to the function.</typeparam>
- /// <typeparam name="TArg13">The type of the thirteenth argument passed to the function.</typeparam>
- /// <typeparam name="TArg14">The type of the fourteenth argument passed to the function.</typeparam>
- /// <typeparam name="TArg15">The type of the fifteenth argument passed to the function.</typeparam>
- /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
- /// <param name="function">Function to convert to an asynchronous function.</param>
- /// <returns>Asynchronous function.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="function" /> is null.</exception>
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, IQbservable<TResult>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, TResult>(this IQbservableProvider provider, Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, TResult>> function)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (function == null)
- throw new ArgumentNullException("function");
-
-#if CRIPPLED_REFLECTION
- var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, TResult>(default(IQbservableProvider), default(Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, TResult>>)));
-#else
- var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7), typeof(TArg8), typeof(TArg9), typeof(TArg10), typeof(TArg11), typeof(TArg12), typeof(TArg13), typeof(TArg14), typeof(TArg15), typeof(TResult));
-#endif
- return (t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15) => provider.CreateQuery<TResult>(
- Expression.Invoke(
- Expression.Call(
- null,
- m,
- Expression.Constant(provider, typeof(IQbservableProvider)),
- function
- ),
- Expression.Constant(t1, typeof(TArg1)),
- Expression.Constant(t2, typeof(TArg2)),
- Expression.Constant(t3, typeof(TArg3)),
- Expression.Constant(t4, typeof(TArg4)),
- Expression.Constant(t5, typeof(TArg5)),
- Expression.Constant(t6, typeof(TArg6)),
- Expression.Constant(t7, typeof(TArg7)),
- Expression.Constant(t8, typeof(TArg8)),
- Expression.Constant(t9, typeof(TArg9)),
- Expression.Constant(t10, typeof(TArg10)),
- Expression.Constant(t11, typeof(TArg11)),
- Expression.Constant(t12, typeof(TArg12)),
- Expression.Constant(t13, typeof(TArg13)),
- Expression.Constant(t14, typeof(TArg14)),
- Expression.Constant(t15, typeof(TArg15))
- )
- );
- }
-
- /// <summary>
- /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function on the specified scheduler.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the function.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the function.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the function.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the function.</typeparam>
- /// <typeparam name="TArg7">The type of the seventh argument passed to the function.</typeparam>
- /// <typeparam name="TArg8">The type of the eighth argument passed to the function.</typeparam>
- /// <typeparam name="TArg9">The type of the ninth argument passed to the function.</typeparam>
- /// <typeparam name="TArg10">The type of the tenth argument passed to the function.</typeparam>
- /// <typeparam name="TArg11">The type of the eleventh argument passed to the function.</typeparam>
- /// <typeparam name="TArg12">The type of the twelfth argument passed to the function.</typeparam>
- /// <typeparam name="TArg13">The type of the thirteenth argument passed to the function.</typeparam>
- /// <typeparam name="TArg14">The type of the fourteenth argument passed to the function.</typeparam>
- /// <typeparam name="TArg15">The type of the fifteenth argument passed to the function.</typeparam>
- /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
- /// <param name="function">Function to convert to an asynchronous function.</param>
- /// <param name="scheduler">Scheduler to invoke the original function on.</param>
- /// <returns>Asynchronous function.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="function" /> or <paramref name="scheduler" /> is null.</exception>
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, IQbservable<TResult>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, TResult>(this IQbservableProvider provider, Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, TResult>> function, IScheduler scheduler)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (function == null)
- throw new ArgumentNullException("function");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
-#if CRIPPLED_REFLECTION
- var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, TResult>(default(IQbservableProvider), default(Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, TResult>>), default(IScheduler)));
-#else
- var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7), typeof(TArg8), typeof(TArg9), typeof(TArg10), typeof(TArg11), typeof(TArg12), typeof(TArg13), typeof(TArg14), typeof(TArg15), typeof(TResult));
-#endif
- return (t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15) => provider.CreateQuery<TResult>(
- Expression.Invoke(
- Expression.Call(
- null,
- m,
- Expression.Constant(provider, typeof(IQbservableProvider)),
- function,
- Expression.Constant(scheduler, typeof(IScheduler))
- ),
- Expression.Constant(t1, typeof(TArg1)),
- Expression.Constant(t2, typeof(TArg2)),
- Expression.Constant(t3, typeof(TArg3)),
- Expression.Constant(t4, typeof(TArg4)),
- Expression.Constant(t5, typeof(TArg5)),
- Expression.Constant(t6, typeof(TArg6)),
- Expression.Constant(t7, typeof(TArg7)),
- Expression.Constant(t8, typeof(TArg8)),
- Expression.Constant(t9, typeof(TArg9)),
- Expression.Constant(t10, typeof(TArg10)),
- Expression.Constant(t11, typeof(TArg11)),
- Expression.Constant(t12, typeof(TArg12)),
- Expression.Constant(t13, typeof(TArg13)),
- Expression.Constant(t14, typeof(TArg14)),
- Expression.Constant(t15, typeof(TArg15))
- )
- );
- }
-
- /// <summary>
- /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the function.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the function.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the function.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the function.</typeparam>
- /// <typeparam name="TArg7">The type of the seventh argument passed to the function.</typeparam>
- /// <typeparam name="TArg8">The type of the eighth argument passed to the function.</typeparam>
- /// <typeparam name="TArg9">The type of the ninth argument passed to the function.</typeparam>
- /// <typeparam name="TArg10">The type of the tenth argument passed to the function.</typeparam>
- /// <typeparam name="TArg11">The type of the eleventh argument passed to the function.</typeparam>
- /// <typeparam name="TArg12">The type of the twelfth argument passed to the function.</typeparam>
- /// <typeparam name="TArg13">The type of the thirteenth argument passed to the function.</typeparam>
- /// <typeparam name="TArg14">The type of the fourteenth argument passed to the function.</typeparam>
- /// <typeparam name="TArg15">The type of the fifteenth argument passed to the function.</typeparam>
- /// <typeparam name="TArg16">The type of the sixteenth argument passed to the function.</typeparam>
- /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
- /// <param name="function">Function to convert to an asynchronous function.</param>
- /// <returns>Asynchronous function.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="function" /> is null.</exception>
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, TArg16, IQbservable<TResult>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, TArg16, TResult>(this IQbservableProvider provider, Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, TArg16, TResult>> function)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (function == null)
- throw new ArgumentNullException("function");
-
-#if CRIPPLED_REFLECTION
- var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, TArg16, TResult>(default(IQbservableProvider), default(Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, TArg16, TResult>>)));
-#else
- var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7), typeof(TArg8), typeof(TArg9), typeof(TArg10), typeof(TArg11), typeof(TArg12), typeof(TArg13), typeof(TArg14), typeof(TArg15), typeof(TArg16), typeof(TResult));
-#endif
- return (t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15, t16) => provider.CreateQuery<TResult>(
- Expression.Invoke(
- Expression.Call(
- null,
- m,
- Expression.Constant(provider, typeof(IQbservableProvider)),
- function
- ),
- Expression.Constant(t1, typeof(TArg1)),
- Expression.Constant(t2, typeof(TArg2)),
- Expression.Constant(t3, typeof(TArg3)),
- Expression.Constant(t4, typeof(TArg4)),
- Expression.Constant(t5, typeof(TArg5)),
- Expression.Constant(t6, typeof(TArg6)),
- Expression.Constant(t7, typeof(TArg7)),
- Expression.Constant(t8, typeof(TArg8)),
- Expression.Constant(t9, typeof(TArg9)),
- Expression.Constant(t10, typeof(TArg10)),
- Expression.Constant(t11, typeof(TArg11)),
- Expression.Constant(t12, typeof(TArg12)),
- Expression.Constant(t13, typeof(TArg13)),
- Expression.Constant(t14, typeof(TArg14)),
- Expression.Constant(t15, typeof(TArg15)),
- Expression.Constant(t16, typeof(TArg16))
- )
- );
- }
-
- /// <summary>
- /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function on the specified scheduler.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the function.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the function.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the function.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the function.</typeparam>
- /// <typeparam name="TArg7">The type of the seventh argument passed to the function.</typeparam>
- /// <typeparam name="TArg8">The type of the eighth argument passed to the function.</typeparam>
- /// <typeparam name="TArg9">The type of the ninth argument passed to the function.</typeparam>
- /// <typeparam name="TArg10">The type of the tenth argument passed to the function.</typeparam>
- /// <typeparam name="TArg11">The type of the eleventh argument passed to the function.</typeparam>
- /// <typeparam name="TArg12">The type of the twelfth argument passed to the function.</typeparam>
- /// <typeparam name="TArg13">The type of the thirteenth argument passed to the function.</typeparam>
- /// <typeparam name="TArg14">The type of the fourteenth argument passed to the function.</typeparam>
- /// <typeparam name="TArg15">The type of the fifteenth argument passed to the function.</typeparam>
- /// <typeparam name="TArg16">The type of the sixteenth argument passed to the function.</typeparam>
- /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
- /// <param name="function">Function to convert to an asynchronous function.</param>
- /// <param name="scheduler">Scheduler to invoke the original function on.</param>
- /// <returns>Asynchronous function.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="function" /> or <paramref name="scheduler" /> is null.</exception>
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, TArg16, IQbservable<TResult>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, TArg16, TResult>(this IQbservableProvider provider, Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, TArg16, TResult>> function, IScheduler scheduler)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (function == null)
- throw new ArgumentNullException("function");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
-#if CRIPPLED_REFLECTION
- var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, TArg16, TResult>(default(IQbservableProvider), default(Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, TArg16, TResult>>), default(IScheduler)));
-#else
- var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7), typeof(TArg8), typeof(TArg9), typeof(TArg10), typeof(TArg11), typeof(TArg12), typeof(TArg13), typeof(TArg14), typeof(TArg15), typeof(TArg16), typeof(TResult));
-#endif
- return (t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15, t16) => provider.CreateQuery<TResult>(
- Expression.Invoke(
- Expression.Call(
- null,
- m,
- Expression.Constant(provider, typeof(IQbservableProvider)),
- function,
- Expression.Constant(scheduler, typeof(IScheduler))
- ),
- Expression.Constant(t1, typeof(TArg1)),
- Expression.Constant(t2, typeof(TArg2)),
- Expression.Constant(t3, typeof(TArg3)),
- Expression.Constant(t4, typeof(TArg4)),
- Expression.Constant(t5, typeof(TArg5)),
- Expression.Constant(t6, typeof(TArg6)),
- Expression.Constant(t7, typeof(TArg7)),
- Expression.Constant(t8, typeof(TArg8)),
- Expression.Constant(t9, typeof(TArg9)),
- Expression.Constant(t10, typeof(TArg10)),
- Expression.Constant(t11, typeof(TArg11)),
- Expression.Constant(t12, typeof(TArg12)),
- Expression.Constant(t13, typeof(TArg13)),
- Expression.Constant(t14, typeof(TArg14)),
- Expression.Constant(t15, typeof(TArg15)),
- Expression.Constant(t16, typeof(TArg16))
- )
- );
- }
-
-#endif
-
- /// <summary>
- /// Converts a Begin/End invoke function pair into an asynchronous function.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <param name="begin">The delegate that begins the asynchronous operation.</param>
- /// <param name="end">The delegate that ends the asynchronous operation.</param>
- /// <returns>Function that can be used to start the asynchronous operation and retrieve the result (represented as a Unit value) as an observable sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="begin" /> or <paramref name="end" /> is null.</exception>
- /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
-#if PREFERASYNC
- [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
-#endif
- public static Func<IQbservable<Unit>> FromAsyncPattern(this IQbservableProvider provider, Expression<Func<AsyncCallback, object, IAsyncResult>> begin, Expression<Action<IAsyncResult>>end)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (begin == null)
- throw new ArgumentNullException("begin");
- if (end == null)
- throw new ArgumentNullException("end");
-
-#if CRIPPLED_REFLECTION
- var m = InfoOf(() => Qbservable.FromAsyncPattern(default(IQbservableProvider), default(Expression<Func<AsyncCallback, object, IAsyncResult>>), default(Expression<Action<IAsyncResult>>)));
-#else
- var m = (MethodInfo)MethodInfo.GetCurrentMethod();
-#endif
- return () => provider.CreateQuery<Unit>(
- Expression.Invoke(
- Expression.Call(
- null,
- m,
- Expression.Constant(provider, typeof(IQbservableProvider)),
- begin,
- end
- )
- )
- );
- }
-
- /// <summary>
- /// Converts a Begin/End invoke function pair into an asynchronous function.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TArg1">The type of the first argument passed to the begin delegate.</typeparam>
- /// <param name="begin">The delegate that begins the asynchronous operation.</param>
- /// <param name="end">The delegate that ends the asynchronous operation.</param>
- /// <returns>Function that can be used to start the asynchronous operation and retrieve the result (represented as a Unit value) as an observable sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="begin" /> or <paramref name="end" /> is null.</exception>
- /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
-#if PREFERASYNC
- [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
-#endif
- public static Func<TArg1, IQbservable<Unit>> FromAsyncPattern<TArg1>(this IQbservableProvider provider, Expression<Func<TArg1, AsyncCallback, object, IAsyncResult>> begin, Expression<Action<IAsyncResult>>end)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (begin == null)
- throw new ArgumentNullException("begin");
- if (end == null)
- throw new ArgumentNullException("end");
-
-#if CRIPPLED_REFLECTION
- var m = InfoOf(() => Qbservable.FromAsyncPattern<TArg1>(default(IQbservableProvider), default(Expression<Func<TArg1, AsyncCallback, object, IAsyncResult>>), default(Expression<Action<IAsyncResult>>)));
-#else
- var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1));
-#endif
- return (t1) => provider.CreateQuery<Unit>(
- Expression.Invoke(
- Expression.Call(
- null,
- m,
- Expression.Constant(provider, typeof(IQbservableProvider)),
- begin,
- end
- ),
- Expression.Constant(t1, typeof(TArg1))
- )
- );
- }
-
- /// <summary>
- /// Converts a Begin/End invoke function pair into an asynchronous function.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TArg1">The type of the first argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the begin delegate.</typeparam>
- /// <param name="begin">The delegate that begins the asynchronous operation.</param>
- /// <param name="end">The delegate that ends the asynchronous operation.</param>
- /// <returns>Function that can be used to start the asynchronous operation and retrieve the result (represented as a Unit value) as an observable sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="begin" /> or <paramref name="end" /> is null.</exception>
- /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
-#if PREFERASYNC
- [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
-#endif
- public static Func<TArg1, TArg2, IQbservable<Unit>> FromAsyncPattern<TArg1, TArg2>(this IQbservableProvider provider, Expression<Func<TArg1, TArg2, AsyncCallback, object, IAsyncResult>> begin, Expression<Action<IAsyncResult>>end)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (begin == null)
- throw new ArgumentNullException("begin");
- if (end == null)
- throw new ArgumentNullException("end");
-
-#if CRIPPLED_REFLECTION
- var m = InfoOf(() => Qbservable.FromAsyncPattern<TArg1, TArg2>(default(IQbservableProvider), default(Expression<Func<TArg1, TArg2, AsyncCallback, object, IAsyncResult>>), default(Expression<Action<IAsyncResult>>)));
-#else
- var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2));
-#endif
- return (t1, t2) => provider.CreateQuery<Unit>(
- Expression.Invoke(
- Expression.Call(
- null,
- m,
- Expression.Constant(provider, typeof(IQbservableProvider)),
- begin,
- end
- ),
- Expression.Constant(t1, typeof(TArg1)),
- Expression.Constant(t2, typeof(TArg2))
- )
- );
- }
-
-#if !NO_LARGEARITY
- /// <summary>
- /// Converts a Begin/End invoke function pair into an asynchronous function.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TArg1">The type of the first argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the begin delegate.</typeparam>
- /// <param name="begin">The delegate that begins the asynchronous operation.</param>
- /// <param name="end">The delegate that ends the asynchronous operation.</param>
- /// <returns>Function that can be used to start the asynchronous operation and retrieve the result (represented as a Unit value) as an observable sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="begin" /> or <paramref name="end" /> is null.</exception>
- /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
-#if PREFERASYNC
- [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
-#endif
- public static Func<TArg1, TArg2, TArg3, IQbservable<Unit>> FromAsyncPattern<TArg1, TArg2, TArg3>(this IQbservableProvider provider, Expression<Func<TArg1, TArg2, TArg3, AsyncCallback, object, IAsyncResult>> begin, Expression<Action<IAsyncResult>>end)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (begin == null)
- throw new ArgumentNullException("begin");
- if (end == null)
- throw new ArgumentNullException("end");
-
-#if CRIPPLED_REFLECTION
- var m = InfoOf(() => Qbservable.FromAsyncPattern<TArg1, TArg2, TArg3>(default(IQbservableProvider), default(Expression<Func<TArg1, TArg2, TArg3, AsyncCallback, object, IAsyncResult>>), default(Expression<Action<IAsyncResult>>)));
-#else
- var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3));
-#endif
- return (t1, t2, t3) => provider.CreateQuery<Unit>(
- Expression.Invoke(
- Expression.Call(
- null,
- m,
- Expression.Constant(provider, typeof(IQbservableProvider)),
- begin,
- end
- ),
- Expression.Constant(t1, typeof(TArg1)),
- Expression.Constant(t2, typeof(TArg2)),
- Expression.Constant(t3, typeof(TArg3))
- )
- );
- }
-
- /// <summary>
- /// Converts a Begin/End invoke function pair into an asynchronous function.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TArg1">The type of the first argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the begin delegate.</typeparam>
- /// <param name="begin">The delegate that begins the asynchronous operation.</param>
- /// <param name="end">The delegate that ends the asynchronous operation.</param>
- /// <returns>Function that can be used to start the asynchronous operation and retrieve the result (represented as a Unit value) as an observable sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="begin" /> or <paramref name="end" /> is null.</exception>
- /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
-#if PREFERASYNC
- [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
-#endif
- public static Func<TArg1, TArg2, TArg3, TArg4, IQbservable<Unit>> FromAsyncPattern<TArg1, TArg2, TArg3, TArg4>(this IQbservableProvider provider, Expression<Func<TArg1, TArg2, TArg3, TArg4, AsyncCallback, object, IAsyncResult>> begin, Expression<Action<IAsyncResult>>end)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (begin == null)
- throw new ArgumentNullException("begin");
- if (end == null)
- throw new ArgumentNullException("end");
-
-#if CRIPPLED_REFLECTION
- var m = InfoOf(() => Qbservable.FromAsyncPattern<TArg1, TArg2, TArg3, TArg4>(default(IQbservableProvider), default(Expression<Func<TArg1, TArg2, TArg3, TArg4, AsyncCallback, object, IAsyncResult>>), default(Expression<Action<IAsyncResult>>)));
-#else
- var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4));
-#endif
- return (t1, t2, t3, t4) => provider.CreateQuery<Unit>(
- Expression.Invoke(
- Expression.Call(
- null,
- m,
- Expression.Constant(provider, typeof(IQbservableProvider)),
- begin,
- end
- ),
- Expression.Constant(t1, typeof(TArg1)),
- Expression.Constant(t2, typeof(TArg2)),
- Expression.Constant(t3, typeof(TArg3)),
- Expression.Constant(t4, typeof(TArg4))
- )
- );
- }
-
- /// <summary>
- /// Converts a Begin/End invoke function pair into an asynchronous function.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TArg1">The type of the first argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the begin delegate.</typeparam>
- /// <param name="begin">The delegate that begins the asynchronous operation.</param>
- /// <param name="end">The delegate that ends the asynchronous operation.</param>
- /// <returns>Function that can be used to start the asynchronous operation and retrieve the result (represented as a Unit value) as an observable sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="begin" /> or <paramref name="end" /> is null.</exception>
- /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
-#if PREFERASYNC
- [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
-#endif
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, IQbservable<Unit>> FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5>(this IQbservableProvider provider, Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, AsyncCallback, object, IAsyncResult>> begin, Expression<Action<IAsyncResult>>end)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (begin == null)
- throw new ArgumentNullException("begin");
- if (end == null)
- throw new ArgumentNullException("end");
-
-#if CRIPPLED_REFLECTION
- var m = InfoOf(() => Qbservable.FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5>(default(IQbservableProvider), default(Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, AsyncCallback, object, IAsyncResult>>), default(Expression<Action<IAsyncResult>>)));
-#else
- var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5));
-#endif
- return (t1, t2, t3, t4, t5) => provider.CreateQuery<Unit>(
- Expression.Invoke(
- Expression.Call(
- null,
- m,
- Expression.Constant(provider, typeof(IQbservableProvider)),
- begin,
- end
- ),
- Expression.Constant(t1, typeof(TArg1)),
- Expression.Constant(t2, typeof(TArg2)),
- Expression.Constant(t3, typeof(TArg3)),
- Expression.Constant(t4, typeof(TArg4)),
- Expression.Constant(t5, typeof(TArg5))
- )
- );
- }
-
- /// <summary>
- /// Converts a Begin/End invoke function pair into an asynchronous function.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TArg1">The type of the first argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the begin delegate.</typeparam>
- /// <param name="begin">The delegate that begins the asynchronous operation.</param>
- /// <param name="end">The delegate that ends the asynchronous operation.</param>
- /// <returns>Function that can be used to start the asynchronous operation and retrieve the result (represented as a Unit value) as an observable sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="begin" /> or <paramref name="end" /> is null.</exception>
- /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
-#if PREFERASYNC
- [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
-#endif
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, IQbservable<Unit>> FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6>(this IQbservableProvider provider, Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, AsyncCallback, object, IAsyncResult>> begin, Expression<Action<IAsyncResult>>end)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (begin == null)
- throw new ArgumentNullException("begin");
- if (end == null)
- throw new ArgumentNullException("end");
-
-#if CRIPPLED_REFLECTION
- var m = InfoOf(() => Qbservable.FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6>(default(IQbservableProvider), default(Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, AsyncCallback, object, IAsyncResult>>), default(Expression<Action<IAsyncResult>>)));
-#else
- var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6));
-#endif
- return (t1, t2, t3, t4, t5, t6) => provider.CreateQuery<Unit>(
- Expression.Invoke(
- Expression.Call(
- null,
- m,
- Expression.Constant(provider, typeof(IQbservableProvider)),
- begin,
- end
- ),
- Expression.Constant(t1, typeof(TArg1)),
- Expression.Constant(t2, typeof(TArg2)),
- Expression.Constant(t3, typeof(TArg3)),
- Expression.Constant(t4, typeof(TArg4)),
- Expression.Constant(t5, typeof(TArg5)),
- Expression.Constant(t6, typeof(TArg6))
- )
- );
- }
-
- /// <summary>
- /// Converts a Begin/End invoke function pair into an asynchronous function.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TArg1">The type of the first argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg7">The type of the seventh argument passed to the begin delegate.</typeparam>
- /// <param name="begin">The delegate that begins the asynchronous operation.</param>
- /// <param name="end">The delegate that ends the asynchronous operation.</param>
- /// <returns>Function that can be used to start the asynchronous operation and retrieve the result (represented as a Unit value) as an observable sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="begin" /> or <paramref name="end" /> is null.</exception>
- /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
-#if PREFERASYNC
- [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
-#endif
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, IQbservable<Unit>> FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7>(this IQbservableProvider provider, Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, AsyncCallback, object, IAsyncResult>> begin, Expression<Action<IAsyncResult>>end)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (begin == null)
- throw new ArgumentNullException("begin");
- if (end == null)
- throw new ArgumentNullException("end");
-
-#if CRIPPLED_REFLECTION
- var m = InfoOf(() => Qbservable.FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7>(default(IQbservableProvider), default(Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, AsyncCallback, object, IAsyncResult>>), default(Expression<Action<IAsyncResult>>)));
-#else
- var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7));
-#endif
- return (t1, t2, t3, t4, t5, t6, t7) => provider.CreateQuery<Unit>(
- Expression.Invoke(
- Expression.Call(
- null,
- m,
- Expression.Constant(provider, typeof(IQbservableProvider)),
- begin,
- end
- ),
- Expression.Constant(t1, typeof(TArg1)),
- Expression.Constant(t2, typeof(TArg2)),
- Expression.Constant(t3, typeof(TArg3)),
- Expression.Constant(t4, typeof(TArg4)),
- Expression.Constant(t5, typeof(TArg5)),
- Expression.Constant(t6, typeof(TArg6)),
- Expression.Constant(t7, typeof(TArg7))
- )
- );
- }
-
- /// <summary>
- /// Converts a Begin/End invoke function pair into an asynchronous function.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TArg1">The type of the first argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg7">The type of the seventh argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg8">The type of the eighth argument passed to the begin delegate.</typeparam>
- /// <param name="begin">The delegate that begins the asynchronous operation.</param>
- /// <param name="end">The delegate that ends the asynchronous operation.</param>
- /// <returns>Function that can be used to start the asynchronous operation and retrieve the result (represented as a Unit value) as an observable sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="begin" /> or <paramref name="end" /> is null.</exception>
- /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
-#if PREFERASYNC
- [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
-#endif
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, IQbservable<Unit>> FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8>(this IQbservableProvider provider, Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, AsyncCallback, object, IAsyncResult>> begin, Expression<Action<IAsyncResult>>end)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (begin == null)
- throw new ArgumentNullException("begin");
- if (end == null)
- throw new ArgumentNullException("end");
-
-#if CRIPPLED_REFLECTION
- var m = InfoOf(() => Qbservable.FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8>(default(IQbservableProvider), default(Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, AsyncCallback, object, IAsyncResult>>), default(Expression<Action<IAsyncResult>>)));
-#else
- var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7), typeof(TArg8));
-#endif
- return (t1, t2, t3, t4, t5, t6, t7, t8) => provider.CreateQuery<Unit>(
- Expression.Invoke(
- Expression.Call(
- null,
- m,
- Expression.Constant(provider, typeof(IQbservableProvider)),
- begin,
- end
- ),
- Expression.Constant(t1, typeof(TArg1)),
- Expression.Constant(t2, typeof(TArg2)),
- Expression.Constant(t3, typeof(TArg3)),
- Expression.Constant(t4, typeof(TArg4)),
- Expression.Constant(t5, typeof(TArg5)),
- Expression.Constant(t6, typeof(TArg6)),
- Expression.Constant(t7, typeof(TArg7)),
- Expression.Constant(t8, typeof(TArg8))
- )
- );
- }
-
- /// <summary>
- /// Converts a Begin/End invoke function pair into an asynchronous function.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TArg1">The type of the first argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg7">The type of the seventh argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg8">The type of the eighth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg9">The type of the ninth argument passed to the begin delegate.</typeparam>
- /// <param name="begin">The delegate that begins the asynchronous operation.</param>
- /// <param name="end">The delegate that ends the asynchronous operation.</param>
- /// <returns>Function that can be used to start the asynchronous operation and retrieve the result (represented as a Unit value) as an observable sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="begin" /> or <paramref name="end" /> is null.</exception>
- /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
-#if PREFERASYNC
- [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
-#endif
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, IQbservable<Unit>> FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9>(this IQbservableProvider provider, Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, AsyncCallback, object, IAsyncResult>> begin, Expression<Action<IAsyncResult>>end)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (begin == null)
- throw new ArgumentNullException("begin");
- if (end == null)
- throw new ArgumentNullException("end");
-
-#if CRIPPLED_REFLECTION
- var m = InfoOf(() => Qbservable.FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9>(default(IQbservableProvider), default(Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, AsyncCallback, object, IAsyncResult>>), default(Expression<Action<IAsyncResult>>)));
-#else
- var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7), typeof(TArg8), typeof(TArg9));
-#endif
- return (t1, t2, t3, t4, t5, t6, t7, t8, t9) => provider.CreateQuery<Unit>(
- Expression.Invoke(
- Expression.Call(
- null,
- m,
- Expression.Constant(provider, typeof(IQbservableProvider)),
- begin,
- end
- ),
- Expression.Constant(t1, typeof(TArg1)),
- Expression.Constant(t2, typeof(TArg2)),
- Expression.Constant(t3, typeof(TArg3)),
- Expression.Constant(t4, typeof(TArg4)),
- Expression.Constant(t5, typeof(TArg5)),
- Expression.Constant(t6, typeof(TArg6)),
- Expression.Constant(t7, typeof(TArg7)),
- Expression.Constant(t8, typeof(TArg8)),
- Expression.Constant(t9, typeof(TArg9))
- )
- );
- }
-
- /// <summary>
- /// Converts a Begin/End invoke function pair into an asynchronous function.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TArg1">The type of the first argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg7">The type of the seventh argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg8">The type of the eighth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg9">The type of the ninth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg10">The type of the tenth argument passed to the begin delegate.</typeparam>
- /// <param name="begin">The delegate that begins the asynchronous operation.</param>
- /// <param name="end">The delegate that ends the asynchronous operation.</param>
- /// <returns>Function that can be used to start the asynchronous operation and retrieve the result (represented as a Unit value) as an observable sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="begin" /> or <paramref name="end" /> is null.</exception>
- /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
-#if PREFERASYNC
- [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
-#endif
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, IQbservable<Unit>> FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10>(this IQbservableProvider provider, Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, AsyncCallback, object, IAsyncResult>> begin, Expression<Action<IAsyncResult>>end)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (begin == null)
- throw new ArgumentNullException("begin");
- if (end == null)
- throw new ArgumentNullException("end");
-
-#if CRIPPLED_REFLECTION
- var m = InfoOf(() => Qbservable.FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10>(default(IQbservableProvider), default(Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, AsyncCallback, object, IAsyncResult>>), default(Expression<Action<IAsyncResult>>)));
-#else
- var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7), typeof(TArg8), typeof(TArg9), typeof(TArg10));
-#endif
- return (t1, t2, t3, t4, t5, t6, t7, t8, t9, t10) => provider.CreateQuery<Unit>(
- Expression.Invoke(
- Expression.Call(
- null,
- m,
- Expression.Constant(provider, typeof(IQbservableProvider)),
- begin,
- end
- ),
- Expression.Constant(t1, typeof(TArg1)),
- Expression.Constant(t2, typeof(TArg2)),
- Expression.Constant(t3, typeof(TArg3)),
- Expression.Constant(t4, typeof(TArg4)),
- Expression.Constant(t5, typeof(TArg5)),
- Expression.Constant(t6, typeof(TArg6)),
- Expression.Constant(t7, typeof(TArg7)),
- Expression.Constant(t8, typeof(TArg8)),
- Expression.Constant(t9, typeof(TArg9)),
- Expression.Constant(t10, typeof(TArg10))
- )
- );
- }
-
- /// <summary>
- /// Converts a Begin/End invoke function pair into an asynchronous function.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TArg1">The type of the first argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg7">The type of the seventh argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg8">The type of the eighth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg9">The type of the ninth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg10">The type of the tenth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg11">The type of the eleventh argument passed to the begin delegate.</typeparam>
- /// <param name="begin">The delegate that begins the asynchronous operation.</param>
- /// <param name="end">The delegate that ends the asynchronous operation.</param>
- /// <returns>Function that can be used to start the asynchronous operation and retrieve the result (represented as a Unit value) as an observable sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="begin" /> or <paramref name="end" /> is null.</exception>
- /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
-#if PREFERASYNC
- [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
-#endif
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, IQbservable<Unit>> FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11>(this IQbservableProvider provider, Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, AsyncCallback, object, IAsyncResult>> begin, Expression<Action<IAsyncResult>>end)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (begin == null)
- throw new ArgumentNullException("begin");
- if (end == null)
- throw new ArgumentNullException("end");
-
-#if CRIPPLED_REFLECTION
- var m = InfoOf(() => Qbservable.FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11>(default(IQbservableProvider), default(Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, AsyncCallback, object, IAsyncResult>>), default(Expression<Action<IAsyncResult>>)));
-#else
- var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7), typeof(TArg8), typeof(TArg9), typeof(TArg10), typeof(TArg11));
-#endif
- return (t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11) => provider.CreateQuery<Unit>(
- Expression.Invoke(
- Expression.Call(
- null,
- m,
- Expression.Constant(provider, typeof(IQbservableProvider)),
- begin,
- end
- ),
- Expression.Constant(t1, typeof(TArg1)),
- Expression.Constant(t2, typeof(TArg2)),
- Expression.Constant(t3, typeof(TArg3)),
- Expression.Constant(t4, typeof(TArg4)),
- Expression.Constant(t5, typeof(TArg5)),
- Expression.Constant(t6, typeof(TArg6)),
- Expression.Constant(t7, typeof(TArg7)),
- Expression.Constant(t8, typeof(TArg8)),
- Expression.Constant(t9, typeof(TArg9)),
- Expression.Constant(t10, typeof(TArg10)),
- Expression.Constant(t11, typeof(TArg11))
- )
- );
- }
-
- /// <summary>
- /// Converts a Begin/End invoke function pair into an asynchronous function.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TArg1">The type of the first argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg7">The type of the seventh argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg8">The type of the eighth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg9">The type of the ninth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg10">The type of the tenth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg11">The type of the eleventh argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg12">The type of the twelfth argument passed to the begin delegate.</typeparam>
- /// <param name="begin">The delegate that begins the asynchronous operation.</param>
- /// <param name="end">The delegate that ends the asynchronous operation.</param>
- /// <returns>Function that can be used to start the asynchronous operation and retrieve the result (represented as a Unit value) as an observable sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="begin" /> or <paramref name="end" /> is null.</exception>
- /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
-#if PREFERASYNC
- [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
-#endif
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, IQbservable<Unit>> FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12>(this IQbservableProvider provider, Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, AsyncCallback, object, IAsyncResult>> begin, Expression<Action<IAsyncResult>>end)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (begin == null)
- throw new ArgumentNullException("begin");
- if (end == null)
- throw new ArgumentNullException("end");
-
-#if CRIPPLED_REFLECTION
- var m = InfoOf(() => Qbservable.FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12>(default(IQbservableProvider), default(Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, AsyncCallback, object, IAsyncResult>>), default(Expression<Action<IAsyncResult>>)));
-#else
- var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7), typeof(TArg8), typeof(TArg9), typeof(TArg10), typeof(TArg11), typeof(TArg12));
-#endif
- return (t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12) => provider.CreateQuery<Unit>(
- Expression.Invoke(
- Expression.Call(
- null,
- m,
- Expression.Constant(provider, typeof(IQbservableProvider)),
- begin,
- end
- ),
- Expression.Constant(t1, typeof(TArg1)),
- Expression.Constant(t2, typeof(TArg2)),
- Expression.Constant(t3, typeof(TArg3)),
- Expression.Constant(t4, typeof(TArg4)),
- Expression.Constant(t5, typeof(TArg5)),
- Expression.Constant(t6, typeof(TArg6)),
- Expression.Constant(t7, typeof(TArg7)),
- Expression.Constant(t8, typeof(TArg8)),
- Expression.Constant(t9, typeof(TArg9)),
- Expression.Constant(t10, typeof(TArg10)),
- Expression.Constant(t11, typeof(TArg11)),
- Expression.Constant(t12, typeof(TArg12))
- )
- );
- }
-
- /// <summary>
- /// Converts a Begin/End invoke function pair into an asynchronous function.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TArg1">The type of the first argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg7">The type of the seventh argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg8">The type of the eighth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg9">The type of the ninth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg10">The type of the tenth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg11">The type of the eleventh argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg12">The type of the twelfth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg13">The type of the thirteenth argument passed to the begin delegate.</typeparam>
- /// <param name="begin">The delegate that begins the asynchronous operation.</param>
- /// <param name="end">The delegate that ends the asynchronous operation.</param>
- /// <returns>Function that can be used to start the asynchronous operation and retrieve the result (represented as a Unit value) as an observable sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="begin" /> or <paramref name="end" /> is null.</exception>
- /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
-#if PREFERASYNC
- [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
-#endif
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, IQbservable<Unit>> FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13>(this IQbservableProvider provider, Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, AsyncCallback, object, IAsyncResult>> begin, Expression<Action<IAsyncResult>>end)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (begin == null)
- throw new ArgumentNullException("begin");
- if (end == null)
- throw new ArgumentNullException("end");
-
-#if CRIPPLED_REFLECTION
- var m = InfoOf(() => Qbservable.FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13>(default(IQbservableProvider), default(Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, AsyncCallback, object, IAsyncResult>>), default(Expression<Action<IAsyncResult>>)));
-#else
- var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7), typeof(TArg8), typeof(TArg9), typeof(TArg10), typeof(TArg11), typeof(TArg12), typeof(TArg13));
-#endif
- return (t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13) => provider.CreateQuery<Unit>(
- Expression.Invoke(
- Expression.Call(
- null,
- m,
- Expression.Constant(provider, typeof(IQbservableProvider)),
- begin,
- end
- ),
- Expression.Constant(t1, typeof(TArg1)),
- Expression.Constant(t2, typeof(TArg2)),
- Expression.Constant(t3, typeof(TArg3)),
- Expression.Constant(t4, typeof(TArg4)),
- Expression.Constant(t5, typeof(TArg5)),
- Expression.Constant(t6, typeof(TArg6)),
- Expression.Constant(t7, typeof(TArg7)),
- Expression.Constant(t8, typeof(TArg8)),
- Expression.Constant(t9, typeof(TArg9)),
- Expression.Constant(t10, typeof(TArg10)),
- Expression.Constant(t11, typeof(TArg11)),
- Expression.Constant(t12, typeof(TArg12)),
- Expression.Constant(t13, typeof(TArg13))
- )
- );
- }
-
- /// <summary>
- /// Converts a Begin/End invoke function pair into an asynchronous function.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TArg1">The type of the first argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg7">The type of the seventh argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg8">The type of the eighth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg9">The type of the ninth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg10">The type of the tenth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg11">The type of the eleventh argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg12">The type of the twelfth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg13">The type of the thirteenth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg14">The type of the fourteenth argument passed to the begin delegate.</typeparam>
- /// <param name="begin">The delegate that begins the asynchronous operation.</param>
- /// <param name="end">The delegate that ends the asynchronous operation.</param>
- /// <returns>Function that can be used to start the asynchronous operation and retrieve the result (represented as a Unit value) as an observable sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="begin" /> or <paramref name="end" /> is null.</exception>
- /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
-#if PREFERASYNC
- [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
-#endif
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, IQbservable<Unit>> FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14>(this IQbservableProvider provider, Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, AsyncCallback, object, IAsyncResult>> begin, Expression<Action<IAsyncResult>>end)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (begin == null)
- throw new ArgumentNullException("begin");
- if (end == null)
- throw new ArgumentNullException("end");
-
-#if CRIPPLED_REFLECTION
- var m = InfoOf(() => Qbservable.FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14>(default(IQbservableProvider), default(Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, AsyncCallback, object, IAsyncResult>>), default(Expression<Action<IAsyncResult>>)));
-#else
- var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7), typeof(TArg8), typeof(TArg9), typeof(TArg10), typeof(TArg11), typeof(TArg12), typeof(TArg13), typeof(TArg14));
-#endif
- return (t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14) => provider.CreateQuery<Unit>(
- Expression.Invoke(
- Expression.Call(
- null,
- m,
- Expression.Constant(provider, typeof(IQbservableProvider)),
- begin,
- end
- ),
- Expression.Constant(t1, typeof(TArg1)),
- Expression.Constant(t2, typeof(TArg2)),
- Expression.Constant(t3, typeof(TArg3)),
- Expression.Constant(t4, typeof(TArg4)),
- Expression.Constant(t5, typeof(TArg5)),
- Expression.Constant(t6, typeof(TArg6)),
- Expression.Constant(t7, typeof(TArg7)),
- Expression.Constant(t8, typeof(TArg8)),
- Expression.Constant(t9, typeof(TArg9)),
- Expression.Constant(t10, typeof(TArg10)),
- Expression.Constant(t11, typeof(TArg11)),
- Expression.Constant(t12, typeof(TArg12)),
- Expression.Constant(t13, typeof(TArg13)),
- Expression.Constant(t14, typeof(TArg14))
- )
- );
- }
-
-#endif
- /// <summary>
- /// Converts a Begin/End invoke function pair into an asynchronous function.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TResult">The type of the result returned by the end delegate.</typeparam>
- /// <param name="begin">The delegate that begins the asynchronous operation.</param>
- /// <param name="end">The delegate that ends the asynchronous operation.</param>
- /// <returns>Function that can be used to start the asynchronous operation and retrieve the result as an observable sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="begin" /> or <paramref name="end" /> is null.</exception>
- /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
-#if PREFERASYNC
- [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
-#endif
- public static Func<IQbservable<TResult>> FromAsyncPattern<TResult>(this IQbservableProvider provider, Expression<Func<AsyncCallback, object, IAsyncResult>> begin, Expression<Func<IAsyncResult, TResult>>end)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (begin == null)
- throw new ArgumentNullException("begin");
- if (end == null)
- throw new ArgumentNullException("end");
-
-#if CRIPPLED_REFLECTION
- var m = InfoOf(() => Qbservable.FromAsyncPattern<TResult>(default(IQbservableProvider), default(Expression<Func<AsyncCallback, object, IAsyncResult>>), default(Expression<Func<IAsyncResult, TResult>>)));
-#else
- var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TResult));
-#endif
- return () => provider.CreateQuery<TResult>(
- Expression.Invoke(
- Expression.Call(
- null,
- m,
- Expression.Constant(provider, typeof(IQbservableProvider)),
- begin,
- end
- )
- )
- );
- }
-
- /// <summary>
- /// Converts a Begin/End invoke function pair into an asynchronous function.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TArg1">The type of the first argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TResult">The type of the result returned by the end delegate.</typeparam>
- /// <param name="begin">The delegate that begins the asynchronous operation.</param>
- /// <param name="end">The delegate that ends the asynchronous operation.</param>
- /// <returns>Function that can be used to start the asynchronous operation and retrieve the result as an observable sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="begin" /> or <paramref name="end" /> is null.</exception>
- /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
-#if PREFERASYNC
- [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
-#endif
- public static Func<TArg1, IQbservable<TResult>> FromAsyncPattern<TArg1, TResult>(this IQbservableProvider provider, Expression<Func<TArg1, AsyncCallback, object, IAsyncResult>> begin, Expression<Func<IAsyncResult, TResult>>end)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (begin == null)
- throw new ArgumentNullException("begin");
- if (end == null)
- throw new ArgumentNullException("end");
-
-#if CRIPPLED_REFLECTION
- var m = InfoOf(() => Qbservable.FromAsyncPattern<TArg1, TResult>(default(IQbservableProvider), default(Expression<Func<TArg1, AsyncCallback, object, IAsyncResult>>), default(Expression<Func<IAsyncResult, TResult>>)));
-#else
- var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TResult));
-#endif
- return (t1) => provider.CreateQuery<TResult>(
- Expression.Invoke(
- Expression.Call(
- null,
- m,
- Expression.Constant(provider, typeof(IQbservableProvider)),
- begin,
- end
- ),
- Expression.Constant(t1, typeof(TArg1))
- )
- );
- }
-
- /// <summary>
- /// Converts a Begin/End invoke function pair into an asynchronous function.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TArg1">The type of the first argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TResult">The type of the result returned by the end delegate.</typeparam>
- /// <param name="begin">The delegate that begins the asynchronous operation.</param>
- /// <param name="end">The delegate that ends the asynchronous operation.</param>
- /// <returns>Function that can be used to start the asynchronous operation and retrieve the result as an observable sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="begin" /> or <paramref name="end" /> is null.</exception>
- /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
-#if PREFERASYNC
- [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
-#endif
- public static Func<TArg1, TArg2, IQbservable<TResult>> FromAsyncPattern<TArg1, TArg2, TResult>(this IQbservableProvider provider, Expression<Func<TArg1, TArg2, AsyncCallback, object, IAsyncResult>> begin, Expression<Func<IAsyncResult, TResult>>end)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (begin == null)
- throw new ArgumentNullException("begin");
- if (end == null)
- throw new ArgumentNullException("end");
-
-#if CRIPPLED_REFLECTION
- var m = InfoOf(() => Qbservable.FromAsyncPattern<TArg1, TArg2, TResult>(default(IQbservableProvider), default(Expression<Func<TArg1, TArg2, AsyncCallback, object, IAsyncResult>>), default(Expression<Func<IAsyncResult, TResult>>)));
-#else
- var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TResult));
-#endif
- return (t1, t2) => provider.CreateQuery<TResult>(
- Expression.Invoke(
- Expression.Call(
- null,
- m,
- Expression.Constant(provider, typeof(IQbservableProvider)),
- begin,
- end
- ),
- Expression.Constant(t1, typeof(TArg1)),
- Expression.Constant(t2, typeof(TArg2))
- )
- );
- }
-
-#if !NO_LARGEARITY
- /// <summary>
- /// Converts a Begin/End invoke function pair into an asynchronous function.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TArg1">The type of the first argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TResult">The type of the result returned by the end delegate.</typeparam>
- /// <param name="begin">The delegate that begins the asynchronous operation.</param>
- /// <param name="end">The delegate that ends the asynchronous operation.</param>
- /// <returns>Function that can be used to start the asynchronous operation and retrieve the result as an observable sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="begin" /> or <paramref name="end" /> is null.</exception>
- /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
-#if PREFERASYNC
- [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
-#endif
- public static Func<TArg1, TArg2, TArg3, IQbservable<TResult>> FromAsyncPattern<TArg1, TArg2, TArg3, TResult>(this IQbservableProvider provider, Expression<Func<TArg1, TArg2, TArg3, AsyncCallback, object, IAsyncResult>> begin, Expression<Func<IAsyncResult, TResult>>end)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (begin == null)
- throw new ArgumentNullException("begin");
- if (end == null)
- throw new ArgumentNullException("end");
-
-#if CRIPPLED_REFLECTION
- var m = InfoOf(() => Qbservable.FromAsyncPattern<TArg1, TArg2, TArg3, TResult>(default(IQbservableProvider), default(Expression<Func<TArg1, TArg2, TArg3, AsyncCallback, object, IAsyncResult>>), default(Expression<Func<IAsyncResult, TResult>>)));
-#else
- var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TResult));
-#endif
- return (t1, t2, t3) => provider.CreateQuery<TResult>(
- Expression.Invoke(
- Expression.Call(
- null,
- m,
- Expression.Constant(provider, typeof(IQbservableProvider)),
- begin,
- end
- ),
- Expression.Constant(t1, typeof(TArg1)),
- Expression.Constant(t2, typeof(TArg2)),
- Expression.Constant(t3, typeof(TArg3))
- )
- );
- }
-
- /// <summary>
- /// Converts a Begin/End invoke function pair into an asynchronous function.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TArg1">The type of the first argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TResult">The type of the result returned by the end delegate.</typeparam>
- /// <param name="begin">The delegate that begins the asynchronous operation.</param>
- /// <param name="end">The delegate that ends the asynchronous operation.</param>
- /// <returns>Function that can be used to start the asynchronous operation and retrieve the result as an observable sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="begin" /> or <paramref name="end" /> is null.</exception>
- /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
-#if PREFERASYNC
- [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
-#endif
- public static Func<TArg1, TArg2, TArg3, TArg4, IQbservable<TResult>> FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TResult>(this IQbservableProvider provider, Expression<Func<TArg1, TArg2, TArg3, TArg4, AsyncCallback, object, IAsyncResult>> begin, Expression<Func<IAsyncResult, TResult>>end)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (begin == null)
- throw new ArgumentNullException("begin");
- if (end == null)
- throw new ArgumentNullException("end");
-
-#if CRIPPLED_REFLECTION
- var m = InfoOf(() => Qbservable.FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TResult>(default(IQbservableProvider), default(Expression<Func<TArg1, TArg2, TArg3, TArg4, AsyncCallback, object, IAsyncResult>>), default(Expression<Func<IAsyncResult, TResult>>)));
-#else
- var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TResult));
-#endif
- return (t1, t2, t3, t4) => provider.CreateQuery<TResult>(
- Expression.Invoke(
- Expression.Call(
- null,
- m,
- Expression.Constant(provider, typeof(IQbservableProvider)),
- begin,
- end
- ),
- Expression.Constant(t1, typeof(TArg1)),
- Expression.Constant(t2, typeof(TArg2)),
- Expression.Constant(t3, typeof(TArg3)),
- Expression.Constant(t4, typeof(TArg4))
- )
- );
- }
-
- /// <summary>
- /// Converts a Begin/End invoke function pair into an asynchronous function.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TArg1">The type of the first argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TResult">The type of the result returned by the end delegate.</typeparam>
- /// <param name="begin">The delegate that begins the asynchronous operation.</param>
- /// <param name="end">The delegate that ends the asynchronous operation.</param>
- /// <returns>Function that can be used to start the asynchronous operation and retrieve the result as an observable sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="begin" /> or <paramref name="end" /> is null.</exception>
- /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
-#if PREFERASYNC
- [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
-#endif
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, IQbservable<TResult>> FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TResult>(this IQbservableProvider provider, Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, AsyncCallback, object, IAsyncResult>> begin, Expression<Func<IAsyncResult, TResult>>end)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (begin == null)
- throw new ArgumentNullException("begin");
- if (end == null)
- throw new ArgumentNullException("end");
-
-#if CRIPPLED_REFLECTION
- var m = InfoOf(() => Qbservable.FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TResult>(default(IQbservableProvider), default(Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, AsyncCallback, object, IAsyncResult>>), default(Expression<Func<IAsyncResult, TResult>>)));
-#else
- var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TResult));
-#endif
- return (t1, t2, t3, t4, t5) => provider.CreateQuery<TResult>(
- Expression.Invoke(
- Expression.Call(
- null,
- m,
- Expression.Constant(provider, typeof(IQbservableProvider)),
- begin,
- end
- ),
- Expression.Constant(t1, typeof(TArg1)),
- Expression.Constant(t2, typeof(TArg2)),
- Expression.Constant(t3, typeof(TArg3)),
- Expression.Constant(t4, typeof(TArg4)),
- Expression.Constant(t5, typeof(TArg5))
- )
- );
- }
-
- /// <summary>
- /// Converts a Begin/End invoke function pair into an asynchronous function.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TArg1">The type of the first argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TResult">The type of the result returned by the end delegate.</typeparam>
- /// <param name="begin">The delegate that begins the asynchronous operation.</param>
- /// <param name="end">The delegate that ends the asynchronous operation.</param>
- /// <returns>Function that can be used to start the asynchronous operation and retrieve the result as an observable sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="begin" /> or <paramref name="end" /> is null.</exception>
- /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
-#if PREFERASYNC
- [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
-#endif
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, IQbservable<TResult>> FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TResult>(this IQbservableProvider provider, Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, AsyncCallback, object, IAsyncResult>> begin, Expression<Func<IAsyncResult, TResult>>end)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (begin == null)
- throw new ArgumentNullException("begin");
- if (end == null)
- throw new ArgumentNullException("end");
-
-#if CRIPPLED_REFLECTION
- var m = InfoOf(() => Qbservable.FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TResult>(default(IQbservableProvider), default(Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, AsyncCallback, object, IAsyncResult>>), default(Expression<Func<IAsyncResult, TResult>>)));
-#else
- var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TResult));
-#endif
- return (t1, t2, t3, t4, t5, t6) => provider.CreateQuery<TResult>(
- Expression.Invoke(
- Expression.Call(
- null,
- m,
- Expression.Constant(provider, typeof(IQbservableProvider)),
- begin,
- end
- ),
- Expression.Constant(t1, typeof(TArg1)),
- Expression.Constant(t2, typeof(TArg2)),
- Expression.Constant(t3, typeof(TArg3)),
- Expression.Constant(t4, typeof(TArg4)),
- Expression.Constant(t5, typeof(TArg5)),
- Expression.Constant(t6, typeof(TArg6))
- )
- );
- }
-
- /// <summary>
- /// Converts a Begin/End invoke function pair into an asynchronous function.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TArg1">The type of the first argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg7">The type of the seventh argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TResult">The type of the result returned by the end delegate.</typeparam>
- /// <param name="begin">The delegate that begins the asynchronous operation.</param>
- /// <param name="end">The delegate that ends the asynchronous operation.</param>
- /// <returns>Function that can be used to start the asynchronous operation and retrieve the result as an observable sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="begin" /> or <paramref name="end" /> is null.</exception>
- /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
-#if PREFERASYNC
- [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
-#endif
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, IQbservable<TResult>> FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TResult>(this IQbservableProvider provider, Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, AsyncCallback, object, IAsyncResult>> begin, Expression<Func<IAsyncResult, TResult>>end)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (begin == null)
- throw new ArgumentNullException("begin");
- if (end == null)
- throw new ArgumentNullException("end");
-
-#if CRIPPLED_REFLECTION
- var m = InfoOf(() => Qbservable.FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TResult>(default(IQbservableProvider), default(Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, AsyncCallback, object, IAsyncResult>>), default(Expression<Func<IAsyncResult, TResult>>)));
-#else
- var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7), typeof(TResult));
-#endif
- return (t1, t2, t3, t4, t5, t6, t7) => provider.CreateQuery<TResult>(
- Expression.Invoke(
- Expression.Call(
- null,
- m,
- Expression.Constant(provider, typeof(IQbservableProvider)),
- begin,
- end
- ),
- Expression.Constant(t1, typeof(TArg1)),
- Expression.Constant(t2, typeof(TArg2)),
- Expression.Constant(t3, typeof(TArg3)),
- Expression.Constant(t4, typeof(TArg4)),
- Expression.Constant(t5, typeof(TArg5)),
- Expression.Constant(t6, typeof(TArg6)),
- Expression.Constant(t7, typeof(TArg7))
- )
- );
- }
-
- /// <summary>
- /// Converts a Begin/End invoke function pair into an asynchronous function.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TArg1">The type of the first argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg7">The type of the seventh argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg8">The type of the eighth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TResult">The type of the result returned by the end delegate.</typeparam>
- /// <param name="begin">The delegate that begins the asynchronous operation.</param>
- /// <param name="end">The delegate that ends the asynchronous operation.</param>
- /// <returns>Function that can be used to start the asynchronous operation and retrieve the result as an observable sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="begin" /> or <paramref name="end" /> is null.</exception>
- /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
-#if PREFERASYNC
- [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
-#endif
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, IQbservable<TResult>> FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TResult>(this IQbservableProvider provider, Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, AsyncCallback, object, IAsyncResult>> begin, Expression<Func<IAsyncResult, TResult>>end)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (begin == null)
- throw new ArgumentNullException("begin");
- if (end == null)
- throw new ArgumentNullException("end");
-
-#if CRIPPLED_REFLECTION
- var m = InfoOf(() => Qbservable.FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TResult>(default(IQbservableProvider), default(Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, AsyncCallback, object, IAsyncResult>>), default(Expression<Func<IAsyncResult, TResult>>)));
-#else
- var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7), typeof(TArg8), typeof(TResult));
-#endif
- return (t1, t2, t3, t4, t5, t6, t7, t8) => provider.CreateQuery<TResult>(
- Expression.Invoke(
- Expression.Call(
- null,
- m,
- Expression.Constant(provider, typeof(IQbservableProvider)),
- begin,
- end
- ),
- Expression.Constant(t1, typeof(TArg1)),
- Expression.Constant(t2, typeof(TArg2)),
- Expression.Constant(t3, typeof(TArg3)),
- Expression.Constant(t4, typeof(TArg4)),
- Expression.Constant(t5, typeof(TArg5)),
- Expression.Constant(t6, typeof(TArg6)),
- Expression.Constant(t7, typeof(TArg7)),
- Expression.Constant(t8, typeof(TArg8))
- )
- );
- }
-
- /// <summary>
- /// Converts a Begin/End invoke function pair into an asynchronous function.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TArg1">The type of the first argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg7">The type of the seventh argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg8">The type of the eighth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg9">The type of the ninth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TResult">The type of the result returned by the end delegate.</typeparam>
- /// <param name="begin">The delegate that begins the asynchronous operation.</param>
- /// <param name="end">The delegate that ends the asynchronous operation.</param>
- /// <returns>Function that can be used to start the asynchronous operation and retrieve the result as an observable sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="begin" /> or <paramref name="end" /> is null.</exception>
- /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
-#if PREFERASYNC
- [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
-#endif
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, IQbservable<TResult>> FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TResult>(this IQbservableProvider provider, Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, AsyncCallback, object, IAsyncResult>> begin, Expression<Func<IAsyncResult, TResult>>end)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (begin == null)
- throw new ArgumentNullException("begin");
- if (end == null)
- throw new ArgumentNullException("end");
-
-#if CRIPPLED_REFLECTION
- var m = InfoOf(() => Qbservable.FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TResult>(default(IQbservableProvider), default(Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, AsyncCallback, object, IAsyncResult>>), default(Expression<Func<IAsyncResult, TResult>>)));
-#else
- var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7), typeof(TArg8), typeof(TArg9), typeof(TResult));
-#endif
- return (t1, t2, t3, t4, t5, t6, t7, t8, t9) => provider.CreateQuery<TResult>(
- Expression.Invoke(
- Expression.Call(
- null,
- m,
- Expression.Constant(provider, typeof(IQbservableProvider)),
- begin,
- end
- ),
- Expression.Constant(t1, typeof(TArg1)),
- Expression.Constant(t2, typeof(TArg2)),
- Expression.Constant(t3, typeof(TArg3)),
- Expression.Constant(t4, typeof(TArg4)),
- Expression.Constant(t5, typeof(TArg5)),
- Expression.Constant(t6, typeof(TArg6)),
- Expression.Constant(t7, typeof(TArg7)),
- Expression.Constant(t8, typeof(TArg8)),
- Expression.Constant(t9, typeof(TArg9))
- )
- );
- }
-
- /// <summary>
- /// Converts a Begin/End invoke function pair into an asynchronous function.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TArg1">The type of the first argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg7">The type of the seventh argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg8">The type of the eighth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg9">The type of the ninth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg10">The type of the tenth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TResult">The type of the result returned by the end delegate.</typeparam>
- /// <param name="begin">The delegate that begins the asynchronous operation.</param>
- /// <param name="end">The delegate that ends the asynchronous operation.</param>
- /// <returns>Function that can be used to start the asynchronous operation and retrieve the result as an observable sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="begin" /> or <paramref name="end" /> is null.</exception>
- /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
-#if PREFERASYNC
- [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
-#endif
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, IQbservable<TResult>> FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TResult>(this IQbservableProvider provider, Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, AsyncCallback, object, IAsyncResult>> begin, Expression<Func<IAsyncResult, TResult>>end)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (begin == null)
- throw new ArgumentNullException("begin");
- if (end == null)
- throw new ArgumentNullException("end");
-
-#if CRIPPLED_REFLECTION
- var m = InfoOf(() => Qbservable.FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TResult>(default(IQbservableProvider), default(Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, AsyncCallback, object, IAsyncResult>>), default(Expression<Func<IAsyncResult, TResult>>)));
-#else
- var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7), typeof(TArg8), typeof(TArg9), typeof(TArg10), typeof(TResult));
-#endif
- return (t1, t2, t3, t4, t5, t6, t7, t8, t9, t10) => provider.CreateQuery<TResult>(
- Expression.Invoke(
- Expression.Call(
- null,
- m,
- Expression.Constant(provider, typeof(IQbservableProvider)),
- begin,
- end
- ),
- Expression.Constant(t1, typeof(TArg1)),
- Expression.Constant(t2, typeof(TArg2)),
- Expression.Constant(t3, typeof(TArg3)),
- Expression.Constant(t4, typeof(TArg4)),
- Expression.Constant(t5, typeof(TArg5)),
- Expression.Constant(t6, typeof(TArg6)),
- Expression.Constant(t7, typeof(TArg7)),
- Expression.Constant(t8, typeof(TArg8)),
- Expression.Constant(t9, typeof(TArg9)),
- Expression.Constant(t10, typeof(TArg10))
- )
- );
- }
-
- /// <summary>
- /// Converts a Begin/End invoke function pair into an asynchronous function.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TArg1">The type of the first argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg7">The type of the seventh argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg8">The type of the eighth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg9">The type of the ninth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg10">The type of the tenth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg11">The type of the eleventh argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TResult">The type of the result returned by the end delegate.</typeparam>
- /// <param name="begin">The delegate that begins the asynchronous operation.</param>
- /// <param name="end">The delegate that ends the asynchronous operation.</param>
- /// <returns>Function that can be used to start the asynchronous operation and retrieve the result as an observable sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="begin" /> or <paramref name="end" /> is null.</exception>
- /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
-#if PREFERASYNC
- [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
-#endif
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, IQbservable<TResult>> FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TResult>(this IQbservableProvider provider, Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, AsyncCallback, object, IAsyncResult>> begin, Expression<Func<IAsyncResult, TResult>>end)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (begin == null)
- throw new ArgumentNullException("begin");
- if (end == null)
- throw new ArgumentNullException("end");
-
-#if CRIPPLED_REFLECTION
- var m = InfoOf(() => Qbservable.FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TResult>(default(IQbservableProvider), default(Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, AsyncCallback, object, IAsyncResult>>), default(Expression<Func<IAsyncResult, TResult>>)));
-#else
- var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7), typeof(TArg8), typeof(TArg9), typeof(TArg10), typeof(TArg11), typeof(TResult));
-#endif
- return (t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11) => provider.CreateQuery<TResult>(
- Expression.Invoke(
- Expression.Call(
- null,
- m,
- Expression.Constant(provider, typeof(IQbservableProvider)),
- begin,
- end
- ),
- Expression.Constant(t1, typeof(TArg1)),
- Expression.Constant(t2, typeof(TArg2)),
- Expression.Constant(t3, typeof(TArg3)),
- Expression.Constant(t4, typeof(TArg4)),
- Expression.Constant(t5, typeof(TArg5)),
- Expression.Constant(t6, typeof(TArg6)),
- Expression.Constant(t7, typeof(TArg7)),
- Expression.Constant(t8, typeof(TArg8)),
- Expression.Constant(t9, typeof(TArg9)),
- Expression.Constant(t10, typeof(TArg10)),
- Expression.Constant(t11, typeof(TArg11))
- )
- );
- }
-
- /// <summary>
- /// Converts a Begin/End invoke function pair into an asynchronous function.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TArg1">The type of the first argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg7">The type of the seventh argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg8">The type of the eighth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg9">The type of the ninth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg10">The type of the tenth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg11">The type of the eleventh argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg12">The type of the twelfth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TResult">The type of the result returned by the end delegate.</typeparam>
- /// <param name="begin">The delegate that begins the asynchronous operation.</param>
- /// <param name="end">The delegate that ends the asynchronous operation.</param>
- /// <returns>Function that can be used to start the asynchronous operation and retrieve the result as an observable sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="begin" /> or <paramref name="end" /> is null.</exception>
- /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
-#if PREFERASYNC
- [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
-#endif
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, IQbservable<TResult>> FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TResult>(this IQbservableProvider provider, Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, AsyncCallback, object, IAsyncResult>> begin, Expression<Func<IAsyncResult, TResult>>end)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (begin == null)
- throw new ArgumentNullException("begin");
- if (end == null)
- throw new ArgumentNullException("end");
-
-#if CRIPPLED_REFLECTION
- var m = InfoOf(() => Qbservable.FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TResult>(default(IQbservableProvider), default(Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, AsyncCallback, object, IAsyncResult>>), default(Expression<Func<IAsyncResult, TResult>>)));
-#else
- var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7), typeof(TArg8), typeof(TArg9), typeof(TArg10), typeof(TArg11), typeof(TArg12), typeof(TResult));
-#endif
- return (t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12) => provider.CreateQuery<TResult>(
- Expression.Invoke(
- Expression.Call(
- null,
- m,
- Expression.Constant(provider, typeof(IQbservableProvider)),
- begin,
- end
- ),
- Expression.Constant(t1, typeof(TArg1)),
- Expression.Constant(t2, typeof(TArg2)),
- Expression.Constant(t3, typeof(TArg3)),
- Expression.Constant(t4, typeof(TArg4)),
- Expression.Constant(t5, typeof(TArg5)),
- Expression.Constant(t6, typeof(TArg6)),
- Expression.Constant(t7, typeof(TArg7)),
- Expression.Constant(t8, typeof(TArg8)),
- Expression.Constant(t9, typeof(TArg9)),
- Expression.Constant(t10, typeof(TArg10)),
- Expression.Constant(t11, typeof(TArg11)),
- Expression.Constant(t12, typeof(TArg12))
- )
- );
- }
-
- /// <summary>
- /// Converts a Begin/End invoke function pair into an asynchronous function.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TArg1">The type of the first argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg7">The type of the seventh argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg8">The type of the eighth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg9">The type of the ninth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg10">The type of the tenth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg11">The type of the eleventh argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg12">The type of the twelfth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg13">The type of the thirteenth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TResult">The type of the result returned by the end delegate.</typeparam>
- /// <param name="begin">The delegate that begins the asynchronous operation.</param>
- /// <param name="end">The delegate that ends the asynchronous operation.</param>
- /// <returns>Function that can be used to start the asynchronous operation and retrieve the result as an observable sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="begin" /> or <paramref name="end" /> is null.</exception>
- /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
-#if PREFERASYNC
- [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
-#endif
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, IQbservable<TResult>> FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TResult>(this IQbservableProvider provider, Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, AsyncCallback, object, IAsyncResult>> begin, Expression<Func<IAsyncResult, TResult>>end)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (begin == null)
- throw new ArgumentNullException("begin");
- if (end == null)
- throw new ArgumentNullException("end");
-
-#if CRIPPLED_REFLECTION
- var m = InfoOf(() => Qbservable.FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TResult>(default(IQbservableProvider), default(Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, AsyncCallback, object, IAsyncResult>>), default(Expression<Func<IAsyncResult, TResult>>)));
-#else
- var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7), typeof(TArg8), typeof(TArg9), typeof(TArg10), typeof(TArg11), typeof(TArg12), typeof(TArg13), typeof(TResult));
-#endif
- return (t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13) => provider.CreateQuery<TResult>(
- Expression.Invoke(
- Expression.Call(
- null,
- m,
- Expression.Constant(provider, typeof(IQbservableProvider)),
- begin,
- end
- ),
- Expression.Constant(t1, typeof(TArg1)),
- Expression.Constant(t2, typeof(TArg2)),
- Expression.Constant(t3, typeof(TArg3)),
- Expression.Constant(t4, typeof(TArg4)),
- Expression.Constant(t5, typeof(TArg5)),
- Expression.Constant(t6, typeof(TArg6)),
- Expression.Constant(t7, typeof(TArg7)),
- Expression.Constant(t8, typeof(TArg8)),
- Expression.Constant(t9, typeof(TArg9)),
- Expression.Constant(t10, typeof(TArg10)),
- Expression.Constant(t11, typeof(TArg11)),
- Expression.Constant(t12, typeof(TArg12)),
- Expression.Constant(t13, typeof(TArg13))
- )
- );
- }
-
- /// <summary>
- /// Converts a Begin/End invoke function pair into an asynchronous function.
- /// </summary>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <typeparam name="TArg1">The type of the first argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg2">The type of the second argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg3">The type of the third argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg4">The type of the fourth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg5">The type of the fifth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg6">The type of the sixth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg7">The type of the seventh argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg8">The type of the eighth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg9">The type of the ninth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg10">The type of the tenth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg11">The type of the eleventh argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg12">The type of the twelfth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg13">The type of the thirteenth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TArg14">The type of the fourteenth argument passed to the begin delegate.</typeparam>
- /// <typeparam name="TResult">The type of the result returned by the end delegate.</typeparam>
- /// <param name="begin">The delegate that begins the asynchronous operation.</param>
- /// <param name="end">The delegate that ends the asynchronous operation.</param>
- /// <returns>Function that can be used to start the asynchronous operation and retrieve the result as an observable sequence.</returns>
- /// <exception cref="T:System.ArgumentNullException">
- /// <paramref name="begin" /> or <paramref name="end" /> is null.</exception>
- /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
-#if PREFERASYNC
- [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
-#endif
- public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, IQbservable<TResult>> FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TResult>(this IQbservableProvider provider, Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, AsyncCallback, object, IAsyncResult>> begin, Expression<Func<IAsyncResult, TResult>>end)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (begin == null)
- throw new ArgumentNullException("begin");
- if (end == null)
- throw new ArgumentNullException("end");
-
-#if CRIPPLED_REFLECTION
- var m = InfoOf(() => Qbservable.FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TResult>(default(IQbservableProvider), default(Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, AsyncCallback, object, IAsyncResult>>), default(Expression<Func<IAsyncResult, TResult>>)));
-#else
- var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7), typeof(TArg8), typeof(TArg9), typeof(TArg10), typeof(TArg11), typeof(TArg12), typeof(TArg13), typeof(TArg14), typeof(TResult));
-#endif
- return (t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14) => provider.CreateQuery<TResult>(
- Expression.Invoke(
- Expression.Call(
- null,
- m,
- Expression.Constant(provider, typeof(IQbservableProvider)),
- begin,
- end
- ),
- Expression.Constant(t1, typeof(TArg1)),
- Expression.Constant(t2, typeof(TArg2)),
- Expression.Constant(t3, typeof(TArg3)),
- Expression.Constant(t4, typeof(TArg4)),
- Expression.Constant(t5, typeof(TArg5)),
- Expression.Constant(t6, typeof(TArg6)),
- Expression.Constant(t7, typeof(TArg7)),
- Expression.Constant(t8, typeof(TArg8)),
- Expression.Constant(t9, typeof(TArg9)),
- Expression.Constant(t10, typeof(TArg10)),
- Expression.Constant(t11, typeof(TArg11)),
- Expression.Constant(t12, typeof(TArg12)),
- Expression.Constant(t13, typeof(TArg13)),
- Expression.Constant(t14, typeof(TArg14))
- )
- );
- }
-
-#endif
- }
-}
-
-#endif
-
-#pragma warning restore 1591
-
diff --git a/Rx.NET/System.Reactive.Providers/Reactive/Linq/Qbservable.Joins.cs b/Rx.NET/System.Reactive.Providers/Reactive/Linq/Qbservable.Joins.cs
deleted file mode 100644
index a3dcf90..0000000
--- a/Rx.NET/System.Reactive.Providers/Reactive/Linq/Qbservable.Joins.cs
+++ /dev/null
@@ -1,140 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#pragma warning disable 1591
-
-using System.Collections.Generic;
-using System.Reactive.Joins;
-using System.Linq.Expressions;
-using System.Reflection;
-using System.Linq;
-
-namespace System.Reactive.Linq
-{
- public static partial class Qbservable
- {
- /* NOTE: Keep XML docs consistent with the corresponding Observable methods (modulo the IQbservableProvider parameters of course). */
-
- /// <summary>
- /// Creates a pattern that matches when both observable sequences have an available element.
- /// </summary>
- /// <typeparam name="TLeft">The type of the elements in the left sequence.</typeparam>
- /// <typeparam name="TRight">The type of the elements in the right sequence.</typeparam>
- /// <param name="left">Observable sequence to match with the right sequence.</param>
- /// <param name="right">Observable sequence to match with the left sequence.</param>
- /// <returns>Pattern object that matches when both observable sequences have an available element.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="left"/> or <paramref name="right"/> is null.</exception>
- public static QueryablePattern<TLeft, TRight> And<TLeft, TRight>(this IQbservable<TLeft> left, IObservable<TRight> right)
- {
- if (left == null)
- throw new ArgumentNullException("left");
- if (right == null)
- throw new ArgumentNullException("right");
-
- return new QueryablePattern<TLeft, TRight>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.And<TLeft, TRight>(default(IQbservable<TLeft>), default(IObservable<TRight>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TLeft), typeof(TRight)),
-#endif
- left.Expression,
- GetSourceExpression(right)
- )
- );
- }
-
- /// <summary>
- /// Matches when the observable sequence has an available element and projects the element by invoking the selector function.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
- /// <param name="source">Observable sequence to apply the selector on.</param>
- /// <param name="selector">Selector that will be invoked for elements in the source sequence.</param>
- /// <returns>Plan that produces the projected results, to be fed (with other plans) to the When operator.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> is null.</exception>
- public static QueryablePlan<TResult> Then<TSource, TResult>(this IQbservable<TSource> source, Expression<Func<TSource, TResult>> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return new QueryablePlan<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.Then<TSource, TResult>(default(IQbservable<TSource>), default(Expression<Func<TSource, TResult>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)),
-#endif
- source.Expression,
- selector
- )
- );
- }
-
- /// <summary>
- /// Joins together the results from several patterns.
- /// </summary>
- /// <typeparam name="TResult">The type of the elements in the result sequence, obtained from the specified patterns.</typeparam>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <param name="plans">A series of plans created by use of the Then operator on patterns.</param>
- /// <returns>An observable sequence with the results from matching several patterns.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="provider"/> or <paramref name="plans"/> is null.</exception>
- public static IQbservable<TResult> When<TResult>(this IQbservableProvider provider, params QueryablePlan<TResult>[] plans)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (plans == null)
- throw new ArgumentNullException("plans");
-
- return provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.When<TResult>(default(IQbservableProvider), default(QueryablePlan<TResult>[]))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TResult)),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- Expression.NewArrayInit(
- typeof(QueryablePlan<TResult>),
- plans.Select(p => p.Expression)
- )
- )
- );
- }
-
- /// <summary>
- /// Joins together the results from several patterns.
- /// </summary>
- /// <typeparam name="TResult">The type of the elements in the result sequence, obtained from the specified patterns.</typeparam>
- /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
- /// <param name="plans">A series of plans created by use of the Then operator on patterns.</param>
- /// <returns>An observable sequence with the results form matching several patterns.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="provider"/> or <paramref name="plans"/> is null.</exception>
- public static IQbservable<TResult> When<TResult>(this IQbservableProvider provider, IEnumerable<QueryablePlan<TResult>> plans)
- {
- if (provider == null)
- throw new ArgumentNullException("provider");
- if (plans == null)
- throw new ArgumentNullException("plans");
-
- return provider.CreateQuery<TResult>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.When<TResult>(default(IQbservableProvider), default(IEnumerable<QueryablePlan<TResult>>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TResult)),
-#endif
- Expression.Constant(provider, typeof(IQbservableProvider)),
- Expression.Constant(plans, typeof(IEnumerable<QueryablePlan<TResult>>))
- )
- );
- }
- }
-}
-
-#pragma warning restore 1591 \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Providers/Reactive/Linq/Qbservable.cs b/Rx.NET/System.Reactive.Providers/Reactive/Linq/Qbservable.cs
deleted file mode 100644
index 18de43e..0000000
--- a/Rx.NET/System.Reactive.Providers/Reactive/Linq/Qbservable.cs
+++ /dev/null
@@ -1,135 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_EXPRESSIONS
-
-#pragma warning disable 1591
-
-using System.Collections.Generic;
-using System.Linq;
-using System.Linq.Expressions;
-using System.Reflection;
-using System.Reactive.Concurrency;
-
-namespace System.Reactive.Linq
-{
- /// <summary>
- /// Provides a set of static methods for writing queries over observable sequences, allowing translation to a target query language.
- /// </summary>
- public static partial class Qbservable
- {
- /// <summary>
- /// Returns the input typed as an IObservable&lt;TSource&gt;.
- /// This operator is used to separate the part of the query that's captured as an expression tree from the part that's executed locally.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">An IQbservable&lt;TSource&gt; sequence to convert to an IObservable&lt;TSource&gt; sequence.</param>
- /// <returns>The original source object, but typed as an IObservable&lt;TSource&gt;.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- public static IObservable<TSource> AsObservable<TSource>(this IQbservable<TSource> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return source;
- }
-
- /// <summary>
- /// Converts an enumerable sequence to an observable sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Enumerable sequence to convert to an observable sequence.</param>
- /// <returns>The observable sequence whose elements are pulled from the given enumerable sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <remarks>This operator requires the source's <see cref="IQueryProvider"/> object (see <see cref="IQueryable.Provider"/>) to implement <see cref="IQbservableProvider"/>.</remarks>
- public static IQbservable<TSource> ToQbservable<TSource>(this IQueryable<TSource> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return ((IQbservableProvider)source.Provider).CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.ToQbservable<TSource>(default(IQueryable<TSource>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression
- )
- );
- }
-
- /// <summary>
- /// Converts an enumerable sequence to an observable sequence, using the specified scheduler to run the enumeration loop.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Enumerable sequence to convert to an observable sequence.</param>
- /// <param name="scheduler">Scheduler to run the enumeration of the input sequence on.</param>
- /// <returns>The observable sequence whose elements are pulled from the given enumerable sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="scheduler"/> is null.</exception>
- /// <remarks>This operator requires the source's <see cref="IQueryProvider"/> object (see <see cref="IQueryable.Provider"/>) to implement <see cref="IQbservableProvider"/>.</remarks>
- public static IQbservable<TSource> ToQbservable<TSource>(this IQueryable<TSource> source, IScheduler scheduler)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- return ((IQbservableProvider)source.Provider).CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => Qbservable.ToQbservable<TSource>(default(IQueryable<TSource>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- Expression.Constant(scheduler)
- )
- );
- }
-
- internal static Expression GetSourceExpression<TSource>(IObservable<TSource> source)
- {
- var q = source as IQbservable<TSource>;
- if (q != null)
- return q.Expression;
-
- return Expression.Constant(source, typeof(IObservable<TSource>));
- }
-
- internal static Expression GetSourceExpression<TSource>(IEnumerable<TSource> source)
- {
- var q = source as IQueryable<TSource>;
- if (q != null)
- return q.Expression;
-
- return Expression.Constant(source, typeof(IEnumerable<TSource>));
- }
-
- internal static Expression GetSourceExpression<TSource>(IObservable<TSource>[] sources)
- {
- return Expression.NewArrayInit(
- typeof(IObservable<TSource>),
- sources.Select(source => GetSourceExpression(source))
- );
- }
-
- internal static Expression GetSourceExpression<TSource>(IEnumerable<TSource>[] sources)
- {
- return Expression.NewArrayInit(
- typeof(IEnumerable<TSource>),
- sources.Select(source => GetSourceExpression(source))
- );
- }
-
- internal static MethodInfo InfoOf<R>(Expression<Func<R>> f)
- {
- return ((MethodCallExpression)f.Body).Method;
- }
- }
-}
-
-#pragma warning restore 1591
-
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Providers/Reactive/ObservableQuery.cs b/Rx.NET/System.Reactive.Providers/Reactive/ObservableQuery.cs
deleted file mode 100644
index 383b75f..0000000
--- a/Rx.NET/System.Reactive.Providers/Reactive/ObservableQuery.cs
+++ /dev/null
@@ -1,509 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System.Collections.Generic;
-using System.Globalization;
-using System.Linq;
-using System.Linq.Expressions;
-using System.Reactive.Joins;
-using System.Reactive.Linq;
-using System.Reflection;
-
-namespace System.Reactive
-{
- internal class ObservableQueryProvider : IQbservableProvider, IQueryProvider
- {
- public IQbservable<TResult> CreateQuery<TResult>(Expression expression)
- {
- if (expression == null)
- throw new ArgumentNullException("expression");
- if (!typeof(IObservable<TResult>).IsAssignableFrom(expression.Type))
- throw new ArgumentException(Strings_Providers.INVALID_TREE_TYPE, "expression");
-
- return new ObservableQuery<TResult>(expression);
- }
-
- IQueryable<TElement> IQueryProvider.CreateQuery<TElement>(Expression expression)
- {
- //
- // Here we're on the edge between IQbservable and IQueryable for the local
- // execution case. E.g.:
- //
- // observable.AsQbservable().<operators>.ToQueryable()
- //
- // This should be turned into a local execution, with the push-to-pull
- // adapter in the middle, so we rewrite to:
- //
- // observable.AsQbservable().<operators>.ToEnumerable().AsQueryable()
- //
- var call = expression as MethodCallExpression;
- if (call == null || call.Method.DeclaringType != typeof(Qbservable) || call.Method.Name != "ToQueryable")
- throw new ArgumentException(Strings_Providers.EXPECTED_TOQUERYABLE_METHODCALL, "expression");
-
- //
- // This is the IQbservable<T> object corresponding to the lhs. Now wrap
- // it in two calls to get the local queryable.
- //
- var arg0 = call.Arguments[0];
- var res =
- Expression.Call(
- AsQueryable.MakeGenericMethod(typeof(TElement)),
- Expression.Call(
- typeof(Observable).GetMethod("ToEnumerable").MakeGenericMethod(typeof(TElement)),
- arg0
- )
- );
-
- //
- // Queryable operator calls should be taken care of by the provider for
- // LINQ to Objects. So we compile and get the resulting IQueryable<T>
- // back to hand it out.
- //
- return Expression.Lambda<Func<IQueryable<TElement>>>(res).Compile()();
- }
-
- private static MethodInfo s_AsQueryable;
-
- private static MethodInfo AsQueryable
- {
- get
- {
- if (s_AsQueryable == null)
- s_AsQueryable = Qbservable.InfoOf<object>(() => Queryable.AsQueryable<object>(null)).GetGenericMethodDefinition();
-
- return s_AsQueryable;
- }
- }
-
- IQueryable IQueryProvider.CreateQuery(Expression expression)
- {
- throw new NotImplementedException();
- }
-
- TResult IQueryProvider.Execute<TResult>(Expression expression)
- {
- throw new NotImplementedException();
- }
-
- object IQueryProvider.Execute(Expression expression)
- {
- throw new NotImplementedException();
- }
- }
-
- internal class ObservableQuery
- {
- protected object _source;
- protected Expression _expression;
-
- public object Source
- {
- get { return _source; }
- }
-
- public Expression Expression
- {
- get { return _expression; }
- }
- }
-
- internal class ObservableQuery<TSource> : ObservableQuery, IQbservable<TSource>
- {
- internal ObservableQuery(IObservable<TSource> source)
- {
- _source = source;
- _expression = Expression.Constant(this);
- }
-
- internal ObservableQuery(Expression expression)
- {
- _expression = expression;
- }
-
- public Type ElementType
- {
- get { return typeof(TSource); }
- }
-
- public IQbservableProvider Provider
- {
- get { return Qbservable.Provider; }
- }
-
- public IDisposable Subscribe(IObserver<TSource> observer)
- {
- if (_source == null)
- {
- var rewriter = new ObservableRewriter();
- var body = rewriter.Visit(_expression);
- var f = Expression.Lambda<Func<IObservable<TSource>>>(body);
- _source = f.Compile()();
- }
-
- //
- // [OK] Use of unsafe Subscribe: non-pretentious mapping to IObservable<T> behavior equivalent to the expression tree.
- //
- return ((IObservable<TSource>)_source).Subscribe/*Unsafe*/(observer);
- }
-
- public override string ToString()
- {
- var c = _expression as ConstantExpression;
- if (c != null && c.Value == this)
- {
- if (_source != null)
- return _source.ToString();
-
- return "null";
- }
-
- return _expression.ToString();
- }
-
- class ObservableRewriter : ExpressionVisitor
- {
- protected override Expression VisitConstant(ConstantExpression/*!*/ node)
- {
- var query = node.Value as ObservableQuery;
- if (query != null)
- {
- var source = query.Source;
- if (source != null)
- {
- return Expression.Constant(source);
- }
- else
- {
- return Visit(query.Expression);
- }
- }
-
- return node;
- }
-
- protected override Expression VisitMethodCall(MethodCallExpression/*!*/ node)
- {
- var method = node.Method;
- var declaringType = method.DeclaringType;
-#if CRIPPLED_REFLECTION
- var baseType = declaringType.GetTypeInfo().BaseType;
-#else
- var baseType = declaringType.BaseType;
-#endif
- if (baseType == typeof(QueryablePattern))
- {
- if (method.Name == "Then")
- {
- //
- // Retarget Then to the corresponding pattern. Recursive visit of the lhs will rewrite
- // the chain of And operators.
- //
- var pattern = Visit(node.Object);
- var arguments = node.Arguments.Select(arg => Unquote(Visit(arg))).ToArray();
- var then = Expression.Call(pattern, "Then", method.GetGenericArguments(), arguments);
- return then;
- }
- else if (method.Name == "And")
- {
- //
- // Retarget And to the corresponding pattern.
- //
- var lhs = Visit(node.Object);
- var arguments = node.Arguments.Select(arg => Visit(arg)).ToArray();
- var and = Expression.Call(lhs, "And", method.GetGenericArguments(), arguments);
- return and;
- }
- }
- else
- {
- var arguments = node.Arguments.AsEnumerable();
-
- //
- // Checking for an IQbservable operator, being either:
- // - an extension method on IQbservableProvider
- // - an extension method on IQbservable<T>
- //
- var isOperator = false;
-
- var firstParameter = method.GetParameters().FirstOrDefault();
- if (firstParameter != null)
- {
- var firstParameterType = firstParameter.ParameterType;
-
- //
- // Operators like Qbservable.Amb have an n-ary form that take in an IQbservableProvider
- // as the first argument. In such a case we need to make sure that the given provider is
- // the one targeting regular Observable. If not, we keep the subtree as-is and let that
- // provider handle the execution.
- //
- if (firstParameterType == typeof(IQbservableProvider))
- {
- isOperator = true;
-
- //
- // Since we could be inside a lambda expression where one tries to obtain a query
- // provider, or that provider could be stored in an outer variable, we need to
- // evaluate the expression to obtain an IQbservableProvider object.
- //
- var provider = Expression.Lambda<Func<IQbservableProvider>>(Visit(node.Arguments[0])).Compile()();
-
- //
- // Let's see whether the ObservableQuery provider is targeted. This one always goes
- // to local execution. E.g.:
- //
- // var xs = Observable.Return(1).AsQbservable();
- // var ys = Observable.Return(2).AsQbservable();
- // var zs = Observable.Return(3).AsQbservable();
- //
- // var res = Qbservable.Provider.Amb(xs, ys, zs);
- // ^^^^^^^^^^^^^^^^^^^
- //
- if (provider is ObservableQueryProvider)
- {
- //
- // For further rewrite, simply ignore the query provider argument now to match
- // up with the Observable signature. E.g.:
- //
- // var res = Qbservable.Provider.Amb(xs, ys, zs);
- // = Qbservable.Amb(Qbservable.Provider, xs, ys, zs)'
- // ^^^^^^^^^^^^^^^^^^^
- // ->
- // var res = Observable.Amb(xs, ys, zs);
- //
- arguments = arguments.Skip(1);
- }
- else
- {
- //
- // We've hit an unknown provider and will defer further execution to it. Upon
- // calling Subscribe to the node's output, that provider will take care of it.
- //
- return node;
- }
- }
- else if (typeof(IQbservable).IsAssignableFrom(firstParameterType))
- {
- isOperator = true;
- }
- }
-
- if (isOperator)
- {
- var args = VisitQbservableOperatorArguments(method, arguments);
- return FindObservableMethod(method, args);
- }
- }
-
- return base.VisitMethodCall(node);
- }
-
- private IList<Expression> VisitQbservableOperatorArguments(MethodInfo method, IEnumerable<Expression> arguments)
- {
- //
- // Recognize the Qbservable.When<TResult>(IQbservableProvider, QueryablePlan<TResult>[])
- // overload in order to substitute the array with a Plan<TResult>[].
- //
- if (method.Name == "When")
- {
- var lastArgument = arguments.Last();
- if (lastArgument.NodeType == ExpressionType.NewArrayInit)
- {
- var paramsArray = (NewArrayExpression)lastArgument;
- return new List<Expression>
- {
- Expression.NewArrayInit(
- typeof(Plan<>).MakeGenericType(method.GetGenericArguments()[0]),
- paramsArray.Expressions.Select(param => Visit(param))
- )
- };
- }
- }
-
- return arguments.Select(arg => Visit(arg)).ToList();
- }
-
- class Lazy<T>
- {
- private readonly Func<T> _factory;
- private T _value;
- private bool _initialized;
-
- public Lazy(Func<T> factory)
- {
- _factory = factory;
- }
-
- public T Value
- {
- get
- {
- lock (_factory)
- {
- if (!_initialized)
- {
- _value = _factory();
- _initialized = true;
- }
- }
-
- return _value;
- }
- }
- }
-
- private static Lazy<ILookup<string, MethodInfo>> _observableMethods = new Lazy<ILookup<string, MethodInfo>>(() => GetMethods(typeof(Observable)));
-
- private static MethodCallExpression FindObservableMethod(MethodInfo method, IList<Expression> arguments)
- {
- //
- // Where to look for the matching operator?
- //
- var targetType = default(Type);
- var methods = default(ILookup<string, MethodInfo>);
- if (method.DeclaringType == typeof(Qbservable))
- {
- targetType = typeof(Observable);
- methods = _observableMethods.Value;
- }
- else
- {
- targetType = method.DeclaringType;
-
-#if CRIPPLED_REFLECTION
- var typeInfo = targetType.GetTypeInfo();
- if (typeInfo.IsDefined(typeof(LocalQueryMethodImplementationTypeAttribute), false))
- {
- var mapping = (LocalQueryMethodImplementationTypeAttribute)typeInfo.GetCustomAttributes(typeof(LocalQueryMethodImplementationTypeAttribute), false).Single();
- targetType = mapping.TargetType;
- }
-#else
- if (targetType.IsDefined(typeof(LocalQueryMethodImplementationTypeAttribute), false))
- {
- var mapping = (LocalQueryMethodImplementationTypeAttribute)targetType.GetCustomAttributes(typeof(LocalQueryMethodImplementationTypeAttribute), false)[0];
- targetType = mapping.TargetType;
- }
-#endif
-
- methods = GetMethods(targetType);
- }
-
- //
- // From all the operators with the method's name, find the one that matches all arguments.
- //
- var typeArgs = method.IsGenericMethod ? method.GetGenericArguments() : null;
- var targetMethod = methods[method.Name].FirstOrDefault(candidateMethod => ArgsMatch(candidateMethod, arguments, typeArgs));
- if (targetMethod == null)
- throw new InvalidOperationException(string.Format(CultureInfo.CurrentCulture, Strings_Providers.NO_MATCHING_METHOD_FOUND, method.Name, targetType.Name));
-
- //
- // Restore generic arguments.
- //
- if (typeArgs != null)
- targetMethod = targetMethod.MakeGenericMethod(typeArgs);
-
- //
- // Finally, we need to deal with mismatches on Expression<Func<...>> versus Func<...>.
- //
- var parameters = targetMethod.GetParameters();
- for (int i = 0, n = parameters.Length; i < n; i++)
- {
- arguments[i] = Unquote(arguments[i]);
- }
-
- //
- // Emit a new call to the discovered target method.
- //
- return Expression.Call(null, targetMethod, arguments);
- }
-
- private static ILookup<string, MethodInfo> GetMethods(Type type)
- {
-#if !CRIPPLED_REFLECTION
- return type.GetMethods(BindingFlags.Static | BindingFlags.Public).ToLookup(m => m.Name);
-#else
- return type.GetTypeInfo().DeclaredMethods.Where(m => m.IsStatic && m.IsPublic).ToLookup(m => m.Name);
-#endif
- }
-
- private static bool ArgsMatch(MethodInfo method, IList<Expression> arguments, Type[] typeArgs)
- {
- //
- // Number of parameters should match. Notice we've sanitized IQbservableProvider "this"
- // parameters first (see VisitMethodCall).
- //
- var parameters = method.GetParameters();
- if (parameters.Length != arguments.Count)
- return false;
-
- //
- // Genericity should match too.
- //
- if (!method.IsGenericMethod && typeArgs != null && typeArgs.Length > 0)
- return false;
-
- //
- // Reconstruct the generic method if needed.
- //
- if (method.IsGenericMethodDefinition)
- {
- if (typeArgs == null)
- return false;
-
- if (method.GetGenericArguments().Length != typeArgs.Length)
- return false;
-
- var result = method.MakeGenericMethod(typeArgs);
- parameters = result.GetParameters();
- }
-
- //
- // Check compatibility for the parameter types.
- //
- for (int i = 0, n = arguments.Count; i < n; i++)
- {
- var parameterType = parameters[i].ParameterType;
- var argument = arguments[i];
-
- //
- // For operators that take a function (like Where, Select), we'll be faced
- // with a quoted argument and a discrepancy between Expression<Func<...>>
- // and the underlying Func<...>.
- //
- if (!parameterType.IsAssignableFrom(argument.Type))
- {
- argument = Unquote(argument);
- if (!parameterType.IsAssignableFrom(argument.Type))
- return false;
- }
- }
-
- return true;
- }
-
- private static Expression Unquote(Expression expression)
- {
- //
- // Get rid of all outer quotes around an expression.
- //
- while (expression.NodeType == ExpressionType.Quote)
- expression = ((UnaryExpression)expression).Operand;
-
- return expression;
- }
- }
- }
-
-#if CRIPPLED_REFLECTION
- static class Helpers
- {
- public static MethodInfo GetMethod(this Type type, string name)
- {
- return type.GetTypeInfo().GetDeclaredMethod(name);
- }
-
- public static bool IsAssignableFrom(this Type type1, Type type2)
- {
- return type1.GetTypeInfo().IsAssignableFrom(type2.GetTypeInfo());
- }
- }
-#endif
-} \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Providers/Strings_Providers.Generated.cs b/Rx.NET/System.Reactive.Providers/Strings_Providers.Generated.cs
deleted file mode 100644
index df6e798..0000000
--- a/Rx.NET/System.Reactive.Providers/Strings_Providers.Generated.cs
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * This file is manually generated upon every change to the corresponding .resx file, using the built-in code generator.
- * However, we can't use auto-generated code because the output is different for .NET 4.5 for Metro and PLIB, due to
- * changes in the reflection APIs (search for CRIPPLED_REFLECTION in this file), and because regeneration doesn't happen
- * as part of build, but rather at design time in Visual Studio. While we likely could tweak MSBuild to force regeneration
- * using the right version of ResGen.exe, this approach turned out to be the easiest for the time being.
- *
- * Upon adding entries to the ResX file, regenerate this file, put this comment back, and make sure to add the #if checks
- * for conditional use of the right flavor of reflection (using the CRIPPLED_REFLECTION defined symbol).
- */
-
-// Required for the use of the GetTypeInfo extension method.
-#if CRIPPLED_REFLECTION
-using System.Reflection;
-#endif
-
-// GENERATED CODE starts here
-
-namespace System.Reactive
-{
- using System;
-
-
- /// <summary>
- /// A strongly-typed resource class, for looking up localized strings, etc.
- /// </summary>
- // This class was auto-generated by the StronglyTypedResourceBuilder
- // class via a tool like ResGen or Visual Studio.
- // To add or remove a member, edit your .ResX file then rerun ResGen
- // with the /str option, or rebuild your VS project.
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- internal class Strings_Providers
- {
-
- private static global::System.Resources.ResourceManager resourceMan;
-
- private static global::System.Globalization.CultureInfo resourceCulture;
-
- [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
- internal Strings_Providers()
- {
- }
-
- /// <summary>
- /// Returns the cached ResourceManager instance used by this class.
- /// </summary>
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Resources.ResourceManager ResourceManager
- {
- get
- {
- if (object.ReferenceEquals(resourceMan, null))
- {
-#if CRIPPLED_REFLECTION
- global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("System.Reactive.Strings_Providers", typeof(Strings_Providers).GetTypeInfo().Assembly);
-#else
- global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("System.Reactive.Strings_Providers", typeof(Strings_Providers).Assembly);
-#endif
- resourceMan = temp;
- }
- return resourceMan;
- }
- }
-
- /// <summary>
- /// Overrides the current thread's CurrentUICulture property for all
- /// resource lookups using this strongly typed resource class.
- /// </summary>
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Globalization.CultureInfo Culture
- {
- get
- {
- return resourceCulture;
- }
- set
- {
- resourceCulture = value;
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Expected Qbservable.ToQueryable..
- /// </summary>
- internal static string EXPECTED_TOQUERYABLE_METHODCALL
- {
- get
- {
- return ResourceManager.GetString("EXPECTED_TOQUERYABLE_METHODCALL", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Invalid expression tree type..
- /// </summary>
- internal static string INVALID_TREE_TYPE
- {
- get
- {
- return ResourceManager.GetString("INVALID_TREE_TYPE", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to There is no method &apos;{0}&apos; on type &apos;{1}&apos; that matches the specified arguments..
- /// </summary>
- internal static string NO_MATCHING_METHOD_FOUND
- {
- get
- {
- return ResourceManager.GetString("NO_MATCHING_METHOD_FOUND", resourceCulture);
- }
- }
- }
-}
diff --git a/Rx.NET/System.Reactive.Providers/Strings_Providers.resx b/Rx.NET/System.Reactive.Providers/Strings_Providers.resx
deleted file mode 100644
index aba90dd..0000000
--- a/Rx.NET/System.Reactive.Providers/Strings_Providers.resx
+++ /dev/null
@@ -1,129 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<root>
- <!--
- Microsoft ResX Schema
-
- Version 2.0
-
- The primary goals of this format is to allow a simple XML format
- that is mostly human readable. The generation and parsing of the
- various data types are done through the TypeConverter classes
- associated with the data types.
-
- Example:
-
- ... ado.net/XML headers & schema ...
- <resheader name="resmimetype">text/microsoft-resx</resheader>
- <resheader name="version">2.0</resheader>
- <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
- <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
- <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
- <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
- <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
- <value>[base64 mime encoded serialized .NET Framework object]</value>
- </data>
- <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
- <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
- <comment>This is a comment</comment>
- </data>
-
- There are any number of "resheader" rows that contain simple
- name/value pairs.
-
- Each data row contains a name, and value. The row also contains a
- type or mimetype. Type corresponds to a .NET class that support
- text/value conversion through the TypeConverter architecture.
- Classes that don't support this are serialized and stored with the
- mimetype set.
-
- The mimetype is used for serialized objects, and tells the
- ResXResourceReader how to depersist the object. This is currently not
- extensible. For a given mimetype the value must be set accordingly:
-
- Note - application/x-microsoft.net.object.binary.base64 is the format
- that the ResXResourceWriter will generate, however the reader can
- read any of the formats listed below.
-
- mimetype: application/x-microsoft.net.object.binary.base64
- value : The object must be serialized with
- : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
- : and then encoded with base64 encoding.
-
- mimetype: application/x-microsoft.net.object.soap.base64
- value : The object must be serialized with
- : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
- : and then encoded with base64 encoding.
-
- mimetype: application/x-microsoft.net.object.bytearray.base64
- value : The object must be serialized into a byte array
- : using a System.ComponentModel.TypeConverter
- : and then encoded with base64 encoding.
- -->
- <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
- <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
- <xsd:element name="root" msdata:IsDataSet="true">
- <xsd:complexType>
- <xsd:choice maxOccurs="unbounded">
- <xsd:element name="metadata">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="value" type="xsd:string" minOccurs="0" />
- </xsd:sequence>
- <xsd:attribute name="name" use="required" type="xsd:string" />
- <xsd:attribute name="type" type="xsd:string" />
- <xsd:attribute name="mimetype" type="xsd:string" />
- <xsd:attribute ref="xml:space" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="assembly">
- <xsd:complexType>
- <xsd:attribute name="alias" type="xsd:string" />
- <xsd:attribute name="name" type="xsd:string" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="data">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
- <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
- </xsd:sequence>
- <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
- <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
- <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
- <xsd:attribute ref="xml:space" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="resheader">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
- </xsd:sequence>
- <xsd:attribute name="name" type="xsd:string" use="required" />
- </xsd:complexType>
- </xsd:element>
- </xsd:choice>
- </xsd:complexType>
- </xsd:element>
- </xsd:schema>
- <resheader name="resmimetype">
- <value>text/microsoft-resx</value>
- </resheader>
- <resheader name="version">
- <value>2.0</value>
- </resheader>
- <resheader name="reader">
- <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
- </resheader>
- <resheader name="writer">
- <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
- </resheader>
- <data name="EXPECTED_TOQUERYABLE_METHODCALL" xml:space="preserve">
- <value>Expected Qbservable.ToQueryable.</value>
- </data>
- <data name="INVALID_TREE_TYPE" xml:space="preserve">
- <value>Invalid expression tree type.</value>
- </data>
- <data name="NO_MATCHING_METHOD_FOUND" xml:space="preserve">
- <value>There is no method '{0}' on type '{1}' that matches the specified arguments.</value>
- </data>
-</root> \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Providers/System.Reactive.Providers.csproj b/Rx.NET/System.Reactive.Providers/System.Reactive.Providers.csproj
deleted file mode 100644
index f527d07..0000000
--- a/Rx.NET/System.Reactive.Providers/System.Reactive.Providers.csproj
+++ /dev/null
@@ -1,80 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <!-- Not used (yet).
- <UsingTask TaskName="BuildTasks.HomoIcon" AssemblyFile="$(ProjectDir)\..\..\Tools\BuildTasks.dll" />
- -->
- <PropertyGroup>
- <ProductVersion>8.0.30703</ProductVersion>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{C7B9D7BE-F47F-466B-A6B0-E46F1069B171}</ProjectGuid>
- <OutputType>Library</OutputType>
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <RootNamespace>System.Reactive</RootNamespace>
- <AssemblyName>System.Reactive.Providers</AssemblyName>
- <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
- <FileAlignment>512</FileAlignment>
- <ProductSignAssembly>true</ProductSignAssembly>
- <CodeAnalysisRuleSet>..\Rx.ruleset</CodeAnalysisRuleSet>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'ReleaseXBLV|AnyCPU'">
- <OutputPath>bin\ReleaseXBLV\</OutputPath>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'DebugXBLV|AnyCPU'">
- <OutputPath>bin\DebugXBLV\</OutputPath>
- </PropertyGroup>
- <Import Project="..\Common.targets" />
- <PropertyGroup>
- <DocumentationFile>$(OutputPath)\$(AssemblyName).XML</DocumentationFile>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)' == 'DebugPL' Or '$(Configuration)' == 'ReleasePL' ">
- <TargetFrameworkProfile>Profile7</TargetFrameworkProfile>
- </PropertyGroup>
- <ItemGroup>
- <Reference Include="mscorlib" Condition=" '$(BuildPlatform)' == 'SILVERLIGHT' " />
- <Reference Include="System" />
- <Reference Include="System.Core" />
- <Reference Include="System.Observable" Condition=" '$(BuildFlavor)' == 'SILVERLIGHTM7' " />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="GlobalSuppressions.cs" />
- <Compile Include="Properties\AssemblyInfo.cs" />
- <Compile Include="Reactive\Internal\Constants.cs" />
- <Compile Include="Reactive\Joins\QueryablePattern.cs" />
- <Compile Include="Reactive\Joins\QueryablePlan.cs" />
- <Compile Include="Reactive\Linq\ExpressionVisitor.cs" />
- <Compile Include="Reactive\Linq\Observable.Queryable.cs" />
- <Compile Include="Reactive\Linq\Qbservable.cs" />
- <Compile Include="Reactive\Linq\Qbservable.Generated.cs" />
- <Compile Include="Reactive\Linq\Qbservable.Joins.cs" />
- <Compile Include="Reactive\ObservableQuery.cs" />
- <Compile Include="Strings_Providers.Generated.cs" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\System.Reactive.Core\System.Reactive.Core.csproj">
- <Project>{4E516F10-DA7A-4D43-963E-A93865ABEA5B}</Project>
- <Name>System.Reactive.Core</Name>
- </ProjectReference>
- <ProjectReference Include="..\System.Reactive.Interfaces\System.Reactive.Interfaces.csproj">
- <Project>{9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}</Project>
- <Name>System.Reactive.Interfaces</Name>
- </ProjectReference>
- <ProjectReference Include="..\System.Reactive.Linq\System.Reactive.Linq.csproj">
- <Project>{63252AE9-5186-45CA-BFCD-FA51C6B66A43}</Project>
- <Name>System.Reactive.Linq</Name>
- </ProjectReference>
- </ItemGroup>
- <ItemGroup>
- <EmbeddedResource Include="Strings_Providers.resx" />
- </ItemGroup>
- <Import Project="..\Import.targets" />
- <!-- HomoIconizer build task configuration (disabled for now)
- <PropertyGroup>
- <HomoIconIntermediateOutputPath>obj\$(Configuration)\HomoIcon</HomoIconIntermediateOutputPath>
- </PropertyGroup>
- <Target Name="BeforeCompile">
- <HomoIcon InputBinary="@(_ResolvedProjectReferencePaths)" IntermediateOutputPath="$(HomoIconIntermediateOutputPath)">
- <Output TaskParameter="OutputFile" ItemName="Compile" />
- </HomoIcon>
- </Target>
- -->
-</Project> \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Runtime.Remoting/GlobalSuppressions.cs b/Rx.NET/System.Reactive.Runtime.Remoting/GlobalSuppressions.cs
deleted file mode 100644
index 77d45bc..0000000
--- a/Rx.NET/System.Reactive.Runtime.Remoting/GlobalSuppressions.cs
+++ /dev/null
@@ -1,14 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-// This file is used by Code Analysis to maintain SuppressMessage
-// attributes that are applied to this project.
-// Project-level suppressions either have no target or are given
-// a specific target and scoped to a namespace, type, member, etc.
-//
-// To add a suppression to this file, right-click the message in the
-// Error List, point to "Suppress Message(s)", and click
-// "In Project Suppression File".
-// You do not need to add suppressions to this file manually.
-
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA2210:AssembliesShouldHaveValidStrongNames", Justification = "Taken care of by lab build.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1016:MarkAssembliesWithAssemblyVersion", Justification = "Taken care of by lab build.")]
diff --git a/Rx.NET/System.Reactive.Runtime.Remoting/Properties/AssemblyInfo.cs b/Rx.NET/System.Reactive.Runtime.Remoting/Properties/AssemblyInfo.cs
deleted file mode 100644
index abcd3d3..0000000
--- a/Rx.NET/System.Reactive.Runtime.Remoting/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,33 +0,0 @@
-using System;
-using System.Reflection;
-using System.Resources;
-using System.Runtime.InteropServices;
-using System.Security;
-
-[assembly: AssemblyTitle("System.Reactive.Runtime.Remoting")]
-// Notice: same description as in the .nuspec files; see Source/Rx/Setup/NuGet
-[assembly: AssemblyDescription("Reactive Extensions Remoting Library used to expose observable sequences through .NET Remoting.")]
-#if DEBUG
-[assembly: AssemblyConfiguration("Debug")]
-#else
-[assembly: AssemblyConfiguration("Retail")]
-#endif
-[assembly: AssemblyCompany("Microsoft Corporation")]
-[assembly: AssemblyProduct("Reactive Extensions")]
-[assembly: AssemblyCopyright("\x00a9 Microsoft Corporation. All rights reserved.")]
-[assembly: NeutralResourcesLanguage("en-US")]
-
-#if !PLIB
-[assembly: ComVisible(false)]
-#endif
-
-[assembly: CLSCompliant(true)]
-
-#if HAS_APTCA && NO_CODECOVERAGE
-[assembly: AllowPartiallyTrustedCallers]
-#endif
-
-//
-// Note: Assembly (file) version numbers get inserted by the build system on the fly. Inspect the Team Build workflows
-// and the custom activity in Build/Source/Activities/AppendVersionInfo.cs for more information.
-//
diff --git a/Rx.NET/System.Reactive.Runtime.Remoting/Reactive/Linq/Observable.Remoting.cs b/Rx.NET/System.Reactive.Runtime.Remoting/Reactive/Linq/Observable.Remoting.cs
deleted file mode 100644
index e220189..0000000
--- a/Rx.NET/System.Reactive.Runtime.Remoting/Reactive/Linq/Observable.Remoting.cs
+++ /dev/null
@@ -1,114 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_REMOTING
-using System.Linq.Expressions;
-using System.Reflection;
-using System.Runtime.Remoting.Lifetime;
-
-namespace System.Reactive.Linq
-{
- /// <summary>
- /// Provides a set of static methods for exposing observable sequences through .NET Remoting.
- /// </summary>
- public static partial class RemotingObservable
- {
- #region Remotable
-
- /// <summary>
- /// Makes an observable sequence remotable, using an infinite lease for the <see cref="MarshalByRefObject"/> wrapping the source.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence.</param>
- /// <returns>The observable sequence that supports remote subscriptions.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Remotable", Justification = "In honor of the .NET Remoting heroes.")]
- public static IObservable<TSource> Remotable<TSource>(this IObservable<TSource> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return Remotable_<TSource>(source);
- }
-
- /// <summary>
- /// Makes an observable sequence remotable, using a controllable lease for the <see cref="MarshalByRefObject"/> wrapping the source.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence.</param>
- /// <param name="lease">Lease object to control lifetime of the remotable sequence. Notice null is a supported value.</param>
- /// <returns>The observable sequence that supports remote subscriptions.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Remotable", Justification = "In honor of the .NET Remoting heroes.")]
- public static IObservable<TSource> Remotable<TSource>(this IObservable<TSource> source, ILease lease)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return Remotable_<TSource>(source, lease);
- }
-
- /// <summary>
- /// Makes an observable sequence remotable, using an infinite lease for the <see cref="MarshalByRefObject"/> wrapping the source.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence.</param>
- /// <returns>The observable sequence that supports remote subscriptions.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Remotable", Justification = "In honor of the .NET Remoting heroes.")]
- public static IQbservable<TSource> Remotable<TSource>(this IQbservable<TSource> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return source.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => RemotingObservable.Remotable<TSource>(default(IQbservable<TSource>))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression
- )
- );
- }
-
- /// <summary>
- /// Makes an observable sequence remotable, using a controllable lease for the <see cref="MarshalByRefObject"/> wrapping the source.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence.</param>
- /// <param name="lease">Lease object to control lifetime of the remotable sequence. Notice null is a supported value.</param>
- /// <returns>The observable sequence that supports remote subscriptions.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Remotable", Justification = "In honor of the .NET Remoting heroes.")]
- public static IQbservable<TSource> Remotable<TSource>(this IQbservable<TSource> source, ILease lease)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return source.Provider.CreateQuery<TSource>(
- Expression.Call(
- null,
-#if CRIPPLED_REFLECTION
- InfoOf(() => RemotingObservable.Remotable<TSource>(default(IQbservable<TSource>), default(ILease))),
-#else
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
-#endif
- source.Expression,
- Expression.Constant(lease, typeof(ILease))
- )
- );
- }
-
-#if CRIPPLED_REFLECTION
- internal static MethodInfo InfoOf<R>(Expression<Func<R>> f)
- {
- return ((MethodCallExpression)f.Body).Method;
- }
-#endif
-
- #endregion
- }
-}
-#endif
diff --git a/Rx.NET/System.Reactive.Runtime.Remoting/Reactive/Linq/QueryLanguage.Remoting.cs b/Rx.NET/System.Reactive.Runtime.Remoting/Reactive/Linq/QueryLanguage.Remoting.cs
deleted file mode 100644
index 9d85a41..0000000
--- a/Rx.NET/System.Reactive.Runtime.Remoting/Reactive/Linq/QueryLanguage.Remoting.cs
+++ /dev/null
@@ -1,255 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_REMOTING
-using System.Reactive.Disposables;
-using System.Runtime.Remoting;
-using System.Runtime.Remoting.Lifetime;
-using System.Security;
-using System.Threading;
-
-//
-// DESIGN: The MarshalByRefObject (MBRO) implementations for RemotableObserver and RemotableSubscription act as
-// self-sponsoring objects controlling their lease times in order to tie those to the lifetime of the
-// underlying observable sequence (ended by OnError or OnCompleted) or the user-controlled subscription
-// lifetime. If we were to implement InitializeLifetimeService to return null, we'd end up with leases
-// that are infinite, so we need a more fine-grained lease scheme. The default configuration would time
-// out after 5 minutes, causing clients to fail while they're still observing the sequence. To solve
-// this, those MBROs also implement ISponsor with a Renewal method that continues to renew the lease
-// upon every call. When the sequence comes to an end or the subscription is disposed, the sponsor gets
-// unregistered, allowing the objects to be reclaimed eventually by the Remoting infrastructure.
-//
-// SECURITY: Registration and unregistration of sponsors is protected by SecurityCritical annotations. The
-// implementation of ISponsor is known (i.e. no foreign implementation can be passed in) at the call
-// sites of the Register and Unregister methods. The call to Register happens in the SecurityCritical
-// InitializeLifetimeService method and is called by trusted Remoting infrastructure. The Renewal
-// method is also marked as SecurityCritical and called by Remoting. The Unregister method is wrapped
-// in a ***SecurityTreatAsSafe*** private method which only gets called by the observer's OnError and
-// OnCompleted notifications, or the subscription's Dispose method. In the former case, the sequence
-// indicates it has reached the end, and hence resources can be reclaimed. Clients will no longer be
-// connected to the source due to auto-detach behavior enforced in the SerializableObservable client-
-// side implementation. In the latter case of disposing the subscription, the client is in control
-// and will cause the underlying remote subscription to be disposed as well, allowing resources to be
-// reclaimed. Rogue messages on either the data or the subscription channel can cause a DoS of the
-// client-server communication but this is subject to the security of the Remoting channels used. In
-// no case an untrusted party can cause _extension_ of the lease time.
-//
-//
-// Notice this assembly is marked as APTCA in official builds, causing methods to be treated as transparent,
-// thus requiring the ***SecurityTreatAsSafe*** annotation on the security boundaries described above. When not
-// applied, the following exception would occur at runtime:
-//
-// System.MethodAccessException:
-//
-// Attempt by security transparent method 'System.Reactive.Linq.QueryLanguage+RemotableObservable`1+
-// RemotableSubscription<T>.Unregister()' to access security critical method 'System.Runtime.Remoting.Lifetime.
-// ILease.Unregister(System.Runtime.Remoting.Lifetime.ISponsor)' failed.
-//
-// Assembly 'System.Reactive.Linq, Version=2.0.ymmdd.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
-// is marked with the AllowPartiallyTrustedCallersAttribute, and uses the level 2 security transparency model.
-// Level 2 transparency causes all methods in AllowPartiallyTrustedCallers assemblies to become security
-// transparent by default, which may be the cause of this exception.
-//
-//
-// The two CodeAnalysis suppressions below are explained by the Justification property (scroll to the right):
-//
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2136:TransparencyAnnotationsShouldNotConflictFxCopRule", Scope = "member", Target = "System.Reactive.Linq.QueryLanguage+RemotableObserver`1.#Unregister()", Justification = "This error only occurs while running FxCop on local builds that don't have NO_CODECOVERAGE set, causing the assembly not to be marked with APTCA (see AssemblyInfo.cs). When APTCA is enabled in official builds, this SecurityTreatAsSafe annotation is required.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2136:TransparencyAnnotationsShouldNotConflictFxCopRule", Scope = "member", Target = "System.Reactive.Linq.QueryLanguage+RemotableObservable`1+RemotableSubscription.#Unregister()", Justification = "This error only occurs while running FxCop on local builds that don't have NO_CODECOVERAGE set, causing the assembly not to be marked with APTCA (see AssemblyInfo.cs). When APTCA is enabled in official builds, this SecurityTreatAsSafe annotation is required.")]
-
-namespace System.Reactive.Linq
-{
- public static partial class RemotingObservable
- {
- #region Remotable
-
- private static IObservable<TSource> Remotable_<TSource>(IObservable<TSource> source)
- {
- return new SerializableObservable<TSource>(new RemotableObservable<TSource>(source, null));
- }
-
- private static IObservable<TSource> Remotable_<TSource>(IObservable<TSource> source, ILease lease)
- {
- return new SerializableObservable<TSource>(new RemotableObservable<TSource>(source, lease));
- }
-
- [Serializable]
- class SerializableObservable<T> : IObservable<T>
- {
- readonly RemotableObservable<T> remotableObservable;
-
- public SerializableObservable(RemotableObservable<T> remotableObservable)
- {
- this.remotableObservable = remotableObservable;
- }
-
- public IDisposable Subscribe(IObserver<T> observer)
- {
- var d = new SingleAssignmentDisposable();
-
- var o = Observer.Create<T>(
- observer.OnNext,
- ex =>
- {
- //
- // Make call to the remote subscription, causing lease renewal to be stopped.
- //
- using (d)
- {
- observer.OnError(ex);
- }
- },
- () =>
- {
- //
- // Make call to the remote subscription, causing lease renewal to be stopped.
- //
- using (d)
- {
- observer.OnCompleted();
- }
- }
- );
-
- //
- // [OK] Use of unsafe Subscribe: non-pretentious transparent wrapping through remoting; exception coming from the remote object is not re-routed.
- //
- d.Disposable = remotableObservable.Subscribe/*Unsafe*/(new RemotableObserver<T>(o));
-
- return d;
- }
- }
-
- class RemotableObserver<T> : MarshalByRefObject, IObserver<T>, ISponsor
- {
- readonly IObserver<T> underlyingObserver;
-
- public RemotableObserver(IObserver<T> underlyingObserver)
- {
- this.underlyingObserver = underlyingObserver;
- }
-
- public void OnNext(T value)
- {
- underlyingObserver.OnNext(value);
- }
-
- public void OnError(Exception exception)
- {
- try
- {
- underlyingObserver.OnError(exception);
- }
- finally
- {
- Unregister();
- }
- }
-
- public void OnCompleted()
- {
- try
- {
- underlyingObserver.OnCompleted();
- }
- finally
- {
- Unregister();
- }
- }
-
- [SecuritySafeCritical] // See remarks at the top of the file.
- private void Unregister()
- {
- var lease = (ILease)RemotingServices.GetLifetimeService(this);
- if (lease != null)
- lease.Unregister(this);
- }
-
- [SecurityCritical]
- public override object InitializeLifetimeService()
- {
- var lease = (ILease)base.InitializeLifetimeService();
- lease.Register(this);
- return lease;
- }
-
- [SecurityCritical]
- TimeSpan ISponsor.Renewal(ILease lease)
- {
- return lease.InitialLeaseTime;
- }
- }
-
- [Serializable]
- sealed class RemotableObservable<T> : MarshalByRefObject, IObservable<T>
- {
- readonly IObservable<T> underlyingObservable;
- readonly ILease lease;
-
- public RemotableObservable(IObservable<T> underlyingObservable, ILease lease)
- {
- this.underlyingObservable = underlyingObservable;
- this.lease = lease;
- }
-
- public IDisposable Subscribe(IObserver<T> observer)
- {
- //
- // [OK] Use of unsafe Subscribe: non-pretentious transparent wrapping through remoting; throwing across remoting boundaries is fine.
- //
- return new RemotableSubscription(underlyingObservable.Subscribe/*Unsafe*/(observer));
- }
-
- [SecurityCritical]
- public override object InitializeLifetimeService()
- {
- return lease;
- }
-
- sealed class RemotableSubscription : MarshalByRefObject, IDisposable, ISponsor
- {
- private IDisposable underlyingSubscription;
-
- public RemotableSubscription(IDisposable underlyingSubscription)
- {
- this.underlyingSubscription = underlyingSubscription;
- }
-
- public void Dispose()
- {
- //
- // Avoiding double-dispose and dropping the reference upon disposal.
- //
- using (Interlocked.Exchange(ref underlyingSubscription, Disposable.Empty))
- {
- Unregister();
- }
- }
-
- [SecuritySafeCritical] // See remarks at the top of the file.
- private void Unregister()
- {
- var lease = (ILease)RemotingServices.GetLifetimeService(this);
- if (lease != null)
- lease.Unregister(this);
- }
-
- [SecurityCritical]
- public override object InitializeLifetimeService()
- {
- var lease = (ILease)base.InitializeLifetimeService();
- lease.Register(this);
- return lease;
- }
-
- [SecurityCritical]
- TimeSpan ISponsor.Renewal(ILease lease)
- {
- return lease.InitialLeaseTime;
- }
- }
- }
-
- #endregion
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Runtime.Remoting/System.Reactive.Runtime.Remoting.csproj b/Rx.NET/System.Reactive.Runtime.Remoting/System.Reactive.Runtime.Remoting.csproj
deleted file mode 100644
index a83651c..0000000
--- a/Rx.NET/System.Reactive.Runtime.Remoting/System.Reactive.Runtime.Remoting.csproj
+++ /dev/null
@@ -1,46 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <ProductVersion>8.0.30703</ProductVersion>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{7A6EF49E-7946-4101-9C89-407B9C53A173}</ProjectGuid>
- <OutputType>Library</OutputType>
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <RootNamespace>System.Reactive</RootNamespace>
- <AssemblyName>System.Reactive.Runtime.Remoting</AssemblyName>
- <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
- <FileAlignment>512</FileAlignment>
- <ProductSignAssembly>true</ProductSignAssembly>
- <CodeAnalysisRuleSet>..\Rx.ruleset</CodeAnalysisRuleSet>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'ReleaseXBLV|AnyCPU'">
- <OutputPath>bin\ReleaseXBLV\</OutputPath>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'DebugXBLV|AnyCPU'">
- <OutputPath>bin\DebugXBLV\</OutputPath>
- </PropertyGroup>
- <Import Project="..\Common.targets" />
- <PropertyGroup>
- <DocumentationFile>$(OutputPath)\$(AssemblyName).XML</DocumentationFile>
- </PropertyGroup>
- <ItemGroup>
- <Reference Include="System" />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="GlobalSuppressions.cs" />
- <Compile Include="Properties\AssemblyInfo.cs" />
- <Compile Include="Reactive\Linq\Observable.Remoting.cs" />
- <Compile Include="Reactive\Linq\QueryLanguage.Remoting.cs" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\System.Reactive.Core\System.Reactive.Core.csproj">
- <Project>{4E516F10-DA7A-4D43-963E-A93865ABEA5B}</Project>
- <Name>System.Reactive.Core</Name>
- </ProjectReference>
- <ProjectReference Include="..\System.Reactive.Interfaces\System.Reactive.Interfaces.csproj">
- <Project>{9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}</Project>
- <Name>System.Reactive.Interfaces</Name>
- </ProjectReference>
- </ItemGroup>
- <Import Project="..\Import.targets" />
-</Project> \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Windows.Forms/GlobalSuppressions.cs b/Rx.NET/System.Reactive.Windows.Forms/GlobalSuppressions.cs
deleted file mode 100644
index 77d45bc..0000000
--- a/Rx.NET/System.Reactive.Windows.Forms/GlobalSuppressions.cs
+++ /dev/null
@@ -1,14 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-// This file is used by Code Analysis to maintain SuppressMessage
-// attributes that are applied to this project.
-// Project-level suppressions either have no target or are given
-// a specific target and scoped to a namespace, type, member, etc.
-//
-// To add a suppression to this file, right-click the message in the
-// Error List, point to "Suppress Message(s)", and click
-// "In Project Suppression File".
-// You do not need to add suppressions to this file manually.
-
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA2210:AssembliesShouldHaveValidStrongNames", Justification = "Taken care of by lab build.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1016:MarkAssembliesWithAssemblyVersion", Justification = "Taken care of by lab build.")]
diff --git a/Rx.NET/System.Reactive.Windows.Forms/Properties/AssemblyInfo.cs b/Rx.NET/System.Reactive.Windows.Forms/Properties/AssemblyInfo.cs
deleted file mode 100644
index 5c2fbb7..0000000
--- a/Rx.NET/System.Reactive.Windows.Forms/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,33 +0,0 @@
-using System;
-using System.Reflection;
-using System.Resources;
-using System.Runtime.InteropServices;
-using System.Security;
-
-[assembly: AssemblyTitle("System.Reactive.Windows.Forms")]
-// Notice: same description as in the .nuspec files; see Source/Rx/Setup/NuGet
-[assembly: AssemblyDescription("Windows Forms extensions library for Rx. Contains scheduler functionality for the Windows Forms UI loop.")]
-#if DEBUG
-[assembly: AssemblyConfiguration("Debug")]
-#else
-[assembly: AssemblyConfiguration("Retail")]
-#endif
-[assembly: AssemblyCompany("Microsoft Corporation")]
-[assembly: AssemblyProduct("Reactive Extensions")]
-[assembly: AssemblyCopyright("\x00a9 Microsoft Corporation. All rights reserved.")]
-[assembly: NeutralResourcesLanguage("en-US")]
-
-#if !PLIB
-[assembly: ComVisible(false)]
-#endif
-
-[assembly: CLSCompliant(true)]
-
-#if HAS_APTCA && NO_CODECOVERAGE
-[assembly: AllowPartiallyTrustedCallers]
-#endif
-
-//
-// Note: Assembly (file) version numbers get inserted by the build system on the fly. Inspect the Team Build workflows
-// and the custom activity in Build/Source/Activities/AppendVersionInfo.cs for more information.
-//
diff --git a/Rx.NET/System.Reactive.Windows.Forms/Reactive/Concurrency/ControlScheduler.cs b/Rx.NET/System.Reactive.Windows.Forms/Reactive/Concurrency/ControlScheduler.cs
deleted file mode 100644
index 0403381..0000000
--- a/Rx.NET/System.Reactive.Windows.Forms/Reactive/Concurrency/ControlScheduler.cs
+++ /dev/null
@@ -1,184 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System.Reactive.Disposables;
-using System.Threading;
-using System.Windows.Forms;
-
-namespace System.Reactive.Concurrency
-{
- /// <summary>
- /// Represents an object that schedules units of work on the message loop associated with a Windows Forms control.
- /// </summary>
- public class ControlScheduler : LocalScheduler, ISchedulerPeriodic
- {
- private readonly Control _control;
-
- /// <summary>
- /// Constructs a ControlScheduler that schedules units of work on the message loop associated with the specified Windows Forms control.
- /// </summary>
- /// <param name="control">Windows Forms control to get the message loop from.</param>
- /// <exception cref="ArgumentNullException"><paramref name="control"/> is null.</exception>
- /// <remarks>
- /// This scheduler type is typically used indirectly through the <see cref="System.Reactive.Linq.ControlObservable.ObserveOn&lt;TSource&gt;"/> and <see cref="System.Reactive.Linq.ControlObservable.SubscribeOn&lt;TSource&gt;"/> method overloads that take a Windows Forms control.
- /// </remarks>
- public ControlScheduler(Control control)
- {
- if (control == null)
- throw new ArgumentNullException("control");
-
- _control = control;
- }
-
- /// <summary>
- /// Gets the control associated with the ControlScheduler.
- /// </summary>
- public Control Control
- {
- get { return _control; }
- }
-
- /// <summary>
- /// Schedules an action to be executed on the message loop associated with the control.
- /// </summary>
- /// <typeparam name="TState">The type of the state passed to the scheduled action.</typeparam>
- /// <param name="state">State passed to the action to be executed.</param>
- /// <param name="action">Action to be executed.</param>
- /// <returns>The disposable object used to cancel the scheduled action (best effort).</returns>
- /// <exception cref="ArgumentNullException"><paramref name="action"/> is null.</exception>
- public override IDisposable Schedule<TState>(TState state, Func<IScheduler, TState, IDisposable> action)
- {
- if (action == null)
- throw new ArgumentNullException("action");
-
- var d = new SingleAssignmentDisposable();
-
- _control.BeginInvoke(new Action(() =>
- {
- if (!d.IsDisposed)
- d.Disposable = action(this, state);
- }));
-
- return d;
- }
-
- /// <summary>
- /// Schedules an action to be executed after dueTime on the message loop associated with the control, using a Windows Forms Timer object.
- /// </summary>
- /// <typeparam name="TState">The type of the state passed to the scheduled action.</typeparam>
- /// <param name="state">State passed to the action to be executed.</param>
- /// <param name="action">Action to be executed.</param>
- /// <param name="dueTime">Relative time after which to execute the action.</param>
- /// <returns>The disposable object used to cancel the scheduled action (best effort).</returns>
- /// <exception cref="ArgumentNullException"><paramref name="action"/> is null.</exception>
- public override IDisposable Schedule<TState>(TState state, TimeSpan dueTime, Func<IScheduler, TState, IDisposable> action)
- {
- if (action == null)
- throw new ArgumentNullException("action");
-
- var dt = Scheduler.Normalize(dueTime);
- if (dt.Ticks == 0)
- return Schedule(state, action);
-
- var createTimer = new Func<IScheduler, TState, IDisposable>((scheduler1, state1) =>
- {
- var d = new MultipleAssignmentDisposable();
-
- var timer = new System.Windows.Forms.Timer();
-
- timer.Tick += (s, e) =>
- {
- var t = Interlocked.Exchange(ref timer, null);
- if (t != null)
- {
- try
- {
- d.Disposable = action(scheduler1, state1);
- }
- finally
- {
- t.Stop();
- action = null;
- }
- }
- };
-
- timer.Interval = (int)dt.TotalMilliseconds;
- timer.Start();
-
- d.Disposable = Disposable.Create(() =>
- {
- var t = Interlocked.Exchange(ref timer, null);
- if (t != null)
- {
- t.Stop();
- action = (_, __) => Disposable.Empty;
- }
- });
-
- return d;
- });
-
- //
- // This check is critical. When creating and enabling a Timer object on another thread than
- // the UI thread, it won't fire.
- //
- if (_control.InvokeRequired)
- return Schedule(state, createTimer);
- else
- return createTimer(this, state);
- }
-
- /// <summary>
- /// Schedules a periodic piece of work on the message loop associated with the control, using a Windows Forms Timer object.
- /// </summary>
- /// <typeparam name="TState">The type of the state passed to the scheduled action.</typeparam>
- /// <param name="state">Initial state passed to the action upon the first iteration.</param>
- /// <param name="period">Period for running the work periodically.</param>
- /// <param name="action">Action to be executed, potentially updating the state.</param>
- /// <returns>The disposable object used to cancel the scheduled recurring action (best effort).</returns>
- /// <exception cref="ArgumentNullException"><paramref name="action"/> is null.</exception>
- /// <exception cref="ArgumentOutOfRangeException"><paramref name="period"/> is less than one millisecond.</exception>
- public IDisposable SchedulePeriodic<TState>(TState state, TimeSpan period, Func<TState, TState> action)
- {
- //
- // Threshold derived from Interval property setter in ndp\fx\src\winforms\managed\system\winforms\Timer.cs.
- //
- if (period.TotalMilliseconds < 1)
- throw new ArgumentOutOfRangeException("period");
- if (action == null)
- throw new ArgumentNullException("action");
-
- var createTimer = new Func<IScheduler, TState, IDisposable>((scheduler1, state1) =>
- {
- var timer = new System.Windows.Forms.Timer();
-
- timer.Tick += (s, e) =>
- {
- state1 = action(state1);
- };
-
- timer.Interval = (int)period.TotalMilliseconds;
- timer.Start();
-
- return Disposable.Create(() =>
- {
- var t = Interlocked.Exchange(ref timer, null);
- if (t != null)
- {
- t.Stop();
- action = _ => _;
- }
- });
- });
-
- //
- // This check is critical. When creating and enabling a Timer object on another thread than
- // the UI thread, it won't fire.
- //
- if (_control.InvokeRequired)
- return Schedule(state, createTimer);
- else
- return createTimer(this, state);
- }
- }
-}
diff --git a/Rx.NET/System.Reactive.Windows.Forms/Reactive/Linq/ControlObservable.cs b/Rx.NET/System.Reactive.Windows.Forms/Reactive/Linq/ControlObservable.cs
deleted file mode 100644
index cb26796..0000000
--- a/Rx.NET/System.Reactive.Windows.Forms/Reactive/Linq/ControlObservable.cs
+++ /dev/null
@@ -1,53 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System.Reactive.Concurrency;
-using System.Windows.Forms;
-
-namespace System.Reactive.Linq
-{
- /// <summary>
- /// Provides a set of static methods for subscribing to IObservables using Windows Forms controls.
- /// </summary>
- public static class ControlObservable
- {
- /// <summary>
- /// Wraps the source sequence in order to run its subscription and unsubscription logic on the Windows Forms message loop associated with the specified control.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence.</param>
- /// <param name="control">Windows Forms control whose associated message loop is used to to perform subscription and unsubscription actions on.</param>
- /// <returns>The source sequence whose subscriptions and unsubscriptions happen on the Windows Forms message loop associated with the specified control.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="control"/> is null.</exception>
- /// <remarks>
- /// Only the side-effects of subscribing to the source sequence and disposing subscriptions to the source sequence are run on the specified control.
- /// In order to invoke observer callbacks on the specified control, e.g. to render results in a control, use <see cref="ControlObservable.ObserveOn"/>.
- /// </remarks>
- public static IObservable<TSource> SubscribeOn<TSource>(this IObservable<TSource> source, Control control)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (control == null)
- throw new ArgumentNullException("control");
-
- return Synchronization.SubscribeOn(source, new ControlScheduler(control));
- }
-
- /// <summary>
- /// Wraps the source sequence in order to run its observer callbacks on the Windows Forms message loop associated with the specified control.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence.</param>
- /// <param name="control">Windows Forms control whose associated message loop is used to to notify observers on.</param>
- /// <returns>The source sequence whose observations happen on the Windows Forms message loop associated with the specified control.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="control"/> is null.</exception>
- public static IObservable<TSource> ObserveOn<TSource>(this IObservable<TSource> source, Control control)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (control == null)
- throw new ArgumentNullException("control");
-
- return Synchronization.ObserveOn(source, new ControlScheduler(control));
- }
- }
-}
diff --git a/Rx.NET/System.Reactive.Windows.Forms/System.Reactive.Windows.Forms.csproj b/Rx.NET/System.Reactive.Windows.Forms/System.Reactive.Windows.Forms.csproj
deleted file mode 100644
index 50064ea..0000000
--- a/Rx.NET/System.Reactive.Windows.Forms/System.Reactive.Windows.Forms.csproj
+++ /dev/null
@@ -1,51 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <ProductVersion>8.0.30703</ProductVersion>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{E32328A1-1F5B-45F9-B005-02EF5CC2CF0D}</ProjectGuid>
- <OutputType>Library</OutputType>
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <RootNamespace>System.Reactive</RootNamespace>
- <AssemblyName>System.Reactive.Windows.Forms</AssemblyName>
- <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
- <FileAlignment>512</FileAlignment>
- <ProductSignAssembly>true</ProductSignAssembly>
- <CodeAnalysisRuleSet>..\Rx.ruleset</CodeAnalysisRuleSet>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'ReleaseXBLV|AnyCPU'">
- <OutputPath>bin\ReleaseXBLV\</OutputPath>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'DebugXBLV|AnyCPU'">
- <OutputPath>bin\DebugXBLV\</OutputPath>
- </PropertyGroup>
- <Import Project="..\Common.targets" />
- <PropertyGroup>
- <DocumentationFile>$(OutputPath)\$(AssemblyName).XML</DocumentationFile>
- </PropertyGroup>
- <ItemGroup>
- <Reference Include="System" />
- <Reference Include="System.Core" />
- <Reference Include="System.Windows.Forms" />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="GlobalSuppressions.cs" />
- <Compile Include="Reactive\Linq\ControlObservable.cs" />
- <Compile Include="Reactive\Concurrency\ControlScheduler.cs" />
- <Compile Include="Properties\AssemblyInfo.cs" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\System.Reactive.Core\System.Reactive.Core.csproj">
- <Project>{4E516F10-DA7A-4D43-963E-A93865ABEA5B}</Project>
- <Name>System.Reactive.Core</Name>
- </ProjectReference>
- <ProjectReference Include="..\System.Reactive.Interfaces\System.Reactive.Interfaces.csproj">
- <Project>{9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}</Project>
- <Name>System.Reactive.Interfaces</Name>
- </ProjectReference>
- </ItemGroup>
- <ItemGroup />
- <Import Project="..\Import.targets" />
-</Project> \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Windows.Threading/GlobalSuppressions.cs b/Rx.NET/System.Reactive.Windows.Threading/GlobalSuppressions.cs
deleted file mode 100644
index 951372c..0000000
--- a/Rx.NET/System.Reactive.Windows.Threading/GlobalSuppressions.cs
+++ /dev/null
@@ -1,14 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-// This file is used by Code Analysis to maintain SuppressMessage
-// attributes that are applied to this project.
-// Project-level suppressions either have no target or are given
-// a specific target and scoped to a namespace, type, member, etc.
-//
-// To add a suppression to this file, right-click the message in the
-// Error List, point to "Suppress Message(s)", and click
-// "In Project Suppression File".
-// You do not need to add suppressions to this file manually.
-
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1016:MarkAssembliesWithAssemblyVersion", Justification = "Taken care of by lab build.")]
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA2210:AssembliesShouldHaveValidStrongNames", Justification = "Taken care of by lab build.")]
diff --git a/Rx.NET/System.Reactive.Windows.Threading/Properties/AssemblyInfo.cs b/Rx.NET/System.Reactive.Windows.Threading/Properties/AssemblyInfo.cs
deleted file mode 100644
index 6a70d94..0000000
--- a/Rx.NET/System.Reactive.Windows.Threading/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,44 +0,0 @@
-using System;
-using System.Reflection;
-using System.Resources;
-using System.Runtime.InteropServices;
-using System.Security;
-
-[assembly: AssemblyTitle("System.Reactive.Windows.Threading")]
-#if !USE_SL_DISPATCHER
-// Notice: same description as in the .nuspec files; see Source/Rx/Setup/NuGet
-[assembly: AssemblyDescription("Windows Presentation Foundation extensions library for Rx. Contains scheduler functionality for the WPF Dispatcher.")]
-#else
-// Notice: same description as in the .nuspec files; see Source/Rx/Setup/NuGet
-[assembly: AssemblyDescription("Silverlight extensions library for Rx. Contains scheduler functionality for the Silverlight Dispatcher.")]
-#endif
-#if DEBUG
-[assembly: AssemblyConfiguration("Debug")]
-#else
-[assembly: AssemblyConfiguration("Retail")]
-#endif
-[assembly: AssemblyCompany("Microsoft Corporation")]
-[assembly: AssemblyProduct("Reactive Extensions")]
-[assembly: AssemblyCopyright("\x00a9 Microsoft Corporation. All rights reserved.")]
-[assembly: NeutralResourcesLanguage("en-US")]
-
-#if !PLIB
-[assembly: ComVisible(false)]
-#endif
-
-#if !WINDOWS
-[assembly: CLSCompliant(true)]
-#endif
-
-#if HAS_APTCA && NO_CODECOVERAGE
-[assembly: AllowPartiallyTrustedCallers]
-#endif
-
-#if XBOX_LAKEVIEW
-[assembly: SecurityTransparent]
-#endif
-
-//
-// Note: Assembly (file) version numbers get inserted by the build system on the fly. Inspect the Team Build workflows
-// and the custom activity in Build/Source/Activities/AppendVersionInfo.cs for more information.
-//
diff --git a/Rx.NET/System.Reactive.Windows.Threading/Reactive/Concurrency/CoreDispatcherScheduler.cs b/Rx.NET/System.Reactive.Windows.Threading/Reactive/Concurrency/CoreDispatcherScheduler.cs
deleted file mode 100644
index 098e2d1..0000000
--- a/Rx.NET/System.Reactive.Windows.Threading/Reactive/Concurrency/CoreDispatcherScheduler.cs
+++ /dev/null
@@ -1,239 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if WINDOWS
-using System.Reactive.Concurrency;
-using System.Reactive.Disposables;
-using System.Runtime.ExceptionServices;
-using System.Threading;
-using Windows.UI.Core;
-using Windows.UI.Xaml;
-
-namespace System.Reactive.Concurrency
-{
- /// <summary>
- /// Represents an object that schedules units of work on a Windows.UI.Core.CoreDispatcher.
- /// </summary>
- /// <remarks>
- /// This scheduler type is typically used indirectly through the <see cref="System.Reactive.Linq.DispatcherObservable.ObserveOnDispatcher&lt;TSource&gt;(IObservable&lt;TSource&gt;)"/> and <see cref="System.Reactive.Linq.DispatcherObservable.SubscribeOnDispatcher&lt;TSource&gt;(IObservable&lt;TSource&gt;)"/> methods that use the current Dispatcher.
- /// </remarks>
- public sealed class CoreDispatcherScheduler : LocalScheduler, ISchedulerPeriodic
- {
- private readonly CoreDispatcher _dispatcher;
- private readonly CoreDispatcherPriority _priority;
-
- /// <summary>
- /// Constructs a CoreDispatcherScheduler that schedules units of work on the given Windows.UI.Core.CoreDispatcher.
- /// </summary>
- /// <param name="dispatcher">Dispatcher to schedule work on.</param>
- /// <exception cref="ArgumentNullException"><paramref name="dispatcher"/> is null.</exception>
- public CoreDispatcherScheduler(CoreDispatcher dispatcher)
- {
- if (dispatcher == null)
- throw new ArgumentNullException("dispatcher");
-
- _dispatcher = dispatcher;
- _priority = CoreDispatcherPriority.Normal;
- }
-
- /// <summary>
- /// Constructs a CoreDispatcherScheduler that schedules units of work on the given Windows.UI.Core.CoreDispatcher with the given priority.
- /// </summary>
- /// <param name="dispatcher">Dispatcher to schedule work on.</param>
- /// <param name="priority">Priority for scheduled units of work.</param>
- /// <exception cref="ArgumentNullException"><paramref name="dispatcher"/> is null.</exception>
- public CoreDispatcherScheduler(CoreDispatcher dispatcher, CoreDispatcherPriority priority)
- {
- if (dispatcher == null)
- throw new ArgumentNullException("dispatcher");
-
- _dispatcher = dispatcher;
- _priority = priority;
- }
-
- /// <summary>
- /// Gets the scheduler that schedules work on the Windows.UI.Core.CoreDispatcher associated with the current Window.
- /// </summary>
- public static CoreDispatcherScheduler Current
- {
- get
- {
- var window = Window.Current;
- if (window == null)
- throw new InvalidOperationException(Strings_WindowsThreading.NO_WINDOW_CURRENT);
-
- return new CoreDispatcherScheduler(window.Dispatcher);
- }
- }
-
- /// <summary>
- /// Gets the Windows.UI.Core.CoreDispatcher associated with the CoreDispatcherScheduler.
- /// </summary>
- public CoreDispatcher Dispatcher
- {
- get { return _dispatcher; }
- }
-
- /// <summary>
- /// Gets the priority at which work is scheduled.
- /// </summary>
- public CoreDispatcherPriority Priority
- {
- get { return _priority; }
- }
-
- /// <summary>
- /// Schedules an action to be executed on the dispatcher.
- /// </summary>
- /// <typeparam name="TState">The type of the state passed to the scheduled action.</typeparam>
- /// <param name="state">State passed to the action to be executed.</param>
- /// <param name="action">Action to be executed.</param>
- /// <returns>The disposable object used to cancel the scheduled action (best effort).</returns>
- /// <exception cref="ArgumentNullException"><paramref name="action"/> is null.</exception>
- public override IDisposable Schedule<TState>(TState state, Func<IScheduler, TState, IDisposable> action)
- {
- if (action == null)
- throw new ArgumentNullException("action");
-
- var d = new SingleAssignmentDisposable();
-
- var res = _dispatcher.RunAsync(_priority, () =>
- {
- if (!d.IsDisposed)
- {
- try
- {
- d.Disposable = action(this, state);
- }
- catch (Exception ex)
- {
- //
- // Work-around for the behavior of throwing from RunAsync not propagating
- // the exception to the Application.UnhandledException event (as of W8RP)
- // as our users have come to expect from previous XAML stacks using Rx.
- //
- // If we wouldn't do this, there'd be an observable behavioral difference
- // between scheduling with TimeSpan.Zero or using this overload.
- //
- // For scheduler implementation guidance rules, see TaskPoolScheduler.cs
- // in System.Reactive.PlatformServices\Reactive\Concurrency.
- //
- var timer = new DispatcherTimer();
- timer.Interval = TimeSpan.Zero;
- timer.Tick += (o, e) =>
- {
- timer.Stop();
- ExceptionDispatchInfo.Capture(ex).Throw();
- };
-
- timer.Start();
- }
- }
- });
-
- return new CompositeDisposable(
- d,
- Disposable.Create(res.Cancel)
- );
- }
-
- /// <summary>
- /// Schedules an action to be executed after dueTime on the dispatcher, using a Windows.UI.Xaml.DispatcherTimer object.
- /// </summary>
- /// <typeparam name="TState">The type of the state passed to the scheduled action.</typeparam>
- /// <param name="state">State passed to the action to be executed.</param>
- /// <param name="action">Action to be executed.</param>
- /// <param name="dueTime">Relative time after which to execute the action.</param>
- /// <returns>The disposable object used to cancel the scheduled action (best effort).</returns>
- /// <exception cref="ArgumentNullException"><paramref name="action"/> is null.</exception>
- public override IDisposable Schedule<TState>(TState state, TimeSpan dueTime, Func<IScheduler, TState, IDisposable> action)
- {
- if (action == null)
- throw new ArgumentNullException("action");
-
- var dt = Scheduler.Normalize(dueTime);
- if (dt.Ticks == 0)
- return Schedule(state, action);
-
- var d = new MultipleAssignmentDisposable();
-
- var timer = new DispatcherTimer();
-
- timer.Tick += (o, e) =>
- {
- var t = Interlocked.Exchange(ref timer, null);
- if (t != null)
- {
- try
- {
- d.Disposable = action(this, state);
- }
- finally
- {
- t.Stop();
- action = null;
- }
- }
- };
-
- timer.Interval = dt;
- timer.Start();
-
- d.Disposable = Disposable.Create(() =>
- {
- var t = Interlocked.Exchange(ref timer, null);
- if (t != null)
- {
- t.Stop();
- action = (_, __) => Disposable.Empty;
- }
- });
-
- return d;
- }
-
- /// <summary>
- /// Schedules a periodic piece of work on the dispatcher, using a Windows.UI.Xaml.DispatcherTimer object.
- /// </summary>
- /// <typeparam name="TState">The type of the state passed to the scheduled action.</typeparam>
- /// <param name="state">Initial state passed to the action upon the first iteration.</param>
- /// <param name="period">Period for running the work periodically.</param>
- /// <param name="action">Action to be executed, potentially updating the state.</param>
- /// <returns>The disposable object used to cancel the scheduled recurring action (best effort).</returns>
- /// <exception cref="ArgumentNullException"><paramref name="action"/> is null.</exception>
- /// <exception cref="ArgumentOutOfRangeException"><paramref name="period"/> is less than TimeSpan.Zero.</exception>
- public IDisposable SchedulePeriodic<TState>(TState state, TimeSpan period, Func<TState, TState> action)
- {
- //
- // According to MSDN documentation, the default is TimeSpan.Zero, so that's definitely valid.
- // Empirical observation - negative values seem to be normalized to TimeSpan.Zero, but let's not go there.
- //
- if (period < TimeSpan.Zero)
- throw new ArgumentOutOfRangeException("period");
- if (action == null)
- throw new ArgumentNullException("action");
-
- var timer = new DispatcherTimer();
-
- var state1 = state;
-
- timer.Tick += (o, e) =>
- {
- state1 = action(state1);
- };
-
- timer.Interval = period;
- timer.Start();
-
- return Disposable.Create(() =>
- {
- var t = Interlocked.Exchange(ref timer, null);
- if (t != null)
- {
- t.Stop();
- action = _ => _;
- }
- });
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Windows.Threading/Reactive/Concurrency/DispatcherScheduler.cs b/Rx.NET/System.Reactive.Windows.Threading/Reactive/Concurrency/DispatcherScheduler.cs
deleted file mode 100644
index 847aaf6..0000000
--- a/Rx.NET/System.Reactive.Windows.Threading/Reactive/Concurrency/DispatcherScheduler.cs
+++ /dev/null
@@ -1,248 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !WINDOWS
-using System.Reactive.Disposables;
-using System.Threading;
-
-namespace System.Reactive.Concurrency
-{
- /// <summary>
- /// Represents an object that schedules units of work on a <see cref="System.Windows.Threading.Dispatcher"/>.
- /// </summary>
- /// <remarks>
- /// This scheduler type is typically used indirectly through the <see cref="System.Reactive.Linq.DispatcherObservable.ObserveOnDispatcher&lt;TSource&gt;(IObservable&lt;TSource&gt;)"/> and <see cref="System.Reactive.Linq.DispatcherObservable.SubscribeOnDispatcher&lt;TSource&gt;(IObservable&lt;TSource&gt;)"/> methods that use the Dispatcher on the calling thread.
- /// </remarks>
- public class DispatcherScheduler : LocalScheduler, ISchedulerPeriodic
- {
- /// <summary>
- /// Gets the scheduler that schedules work on the current <see cref="System.Windows.Threading.Dispatcher"/>.
- /// </summary>
- [Obsolete(Constants_WindowsThreading.OBSOLETE_INSTANCE_PROPERTY)]
- public static DispatcherScheduler Instance
- {
- get
- {
- return new DispatcherScheduler(
-#if USE_SL_DISPATCHER
- System.Windows.Deployment.Current.Dispatcher
-#else
- System.Windows.Threading.Dispatcher.CurrentDispatcher
-#endif
- );
- }
- }
-
- /// <summary>
- /// Gets the scheduler that schedules work on the <see cref="System.Windows.Threading.Dispatcher"/> for the current thread.
- /// </summary>
- public static DispatcherScheduler Current
- {
- get
- {
-#if USE_SL_DISPATCHER
- return new DispatcherScheduler(System.Windows.Deployment.Current.Dispatcher);
-#else
- var dispatcher = System.Windows.Threading.Dispatcher.FromThread(Thread.CurrentThread);
- if (dispatcher == null)
- throw new InvalidOperationException(Strings_WindowsThreading.NO_DISPATCHER_CURRENT_THREAD);
-
- return new DispatcherScheduler(dispatcher);
-#endif
- }
- }
-
- System.Windows.Threading.Dispatcher _dispatcher;
-
-#if HAS_DISPATCHER_PRIORITY
- System.Windows.Threading.DispatcherPriority _priority;
-#endif
-
- /// <summary>
- /// Constructs a DispatcherScheduler that schedules units of work on the given <see cref="System.Windows.Threading.Dispatcher"/>.
- /// </summary>
- /// <param name="dispatcher">Dispatcher to schedule work on.</param>
- /// <exception cref="ArgumentNullException"><paramref name="dispatcher"/> is null.</exception>
- public DispatcherScheduler(System.Windows.Threading.Dispatcher dispatcher)
- {
- if (dispatcher == null)
- throw new ArgumentNullException("dispatcher");
-
- _dispatcher = dispatcher;
-#if HAS_DISPATCHER_PRIORITY
- _priority = Windows.Threading.DispatcherPriority.Normal;
-#endif
- }
-
-#if HAS_DISPATCHER_PRIORITY
- /// <summary>
- /// Constructs a DispatcherScheduler that schedules units of work on the given <see cref="System.Windows.Threading.Dispatcher"/> at the given priority.
- /// </summary>
- /// <param name="dispatcher">Dispatcher to schedule work on.</param>
- /// <param name="priority">Priority at which units of work are scheduled.</param>
- /// <exception cref="ArgumentNullException"><paramref name="dispatcher"/> is null.</exception>
- public DispatcherScheduler(System.Windows.Threading.Dispatcher dispatcher, System.Windows.Threading.DispatcherPriority priority)
- {
- if (dispatcher == null)
- throw new ArgumentNullException("dispatcher");
-
- _dispatcher = dispatcher;
- _priority = priority;
- }
-#endif
-
- /// <summary>
- /// Gets the <see cref="System.Windows.Threading.Dispatcher"/> associated with the DispatcherScheduler.
- /// </summary>
- public System.Windows.Threading.Dispatcher Dispatcher
- {
- get { return _dispatcher; }
- }
-
-#if HAS_DISPATCHER_PRIORITY
- /// <summary>
- /// Gets the priority at which work items will be dispatched.
- /// </summary>
- public System.Windows.Threading.DispatcherPriority Priority
- {
- get { return _priority; }
- }
-#endif
-
- /// <summary>
- /// Schedules an action to be executed on the dispatcher.
- /// </summary>
- /// <typeparam name="TState">The type of the state passed to the scheduled action.</typeparam>
- /// <param name="state">State passed to the action to be executed.</param>
- /// <param name="action">Action to be executed.</param>
- /// <returns>The disposable object used to cancel the scheduled action (best effort).</returns>
- /// <exception cref="ArgumentNullException"><paramref name="action"/> is null.</exception>
- public override IDisposable Schedule<TState>(TState state, Func<IScheduler, TState, IDisposable> action)
- {
- if (action == null)
- throw new ArgumentNullException("action");
-
- var d = new SingleAssignmentDisposable();
-
- _dispatcher.BeginInvoke(
- new Action(() =>
- {
- if (!d.IsDisposed)
- d.Disposable = action(this, state);
- })
-#if HAS_DISPATCHER_PRIORITY
- , _priority
-#endif
- );
-
- return d;
- }
-
- /// <summary>
- /// Schedules an action to be executed after dueTime on the dispatcher, using a <see cref="System.Windows.Threading.DispatcherTimer"/> object.
- /// </summary>
- /// <typeparam name="TState">The type of the state passed to the scheduled action.</typeparam>
- /// <param name="state">State passed to the action to be executed.</param>
- /// <param name="action">Action to be executed.</param>
- /// <param name="dueTime">Relative time after which to execute the action.</param>
- /// <returns>The disposable object used to cancel the scheduled action (best effort).</returns>
- /// <exception cref="ArgumentNullException"><paramref name="action"/> is null.</exception>
- public override IDisposable Schedule<TState>(TState state, TimeSpan dueTime, Func<IScheduler, TState, IDisposable> action)
- {
- if (action == null)
- throw new ArgumentNullException("action");
-
- var dt = Scheduler.Normalize(dueTime);
- if (dt.Ticks == 0)
- return Schedule(state, action);
-
- var d = new MultipleAssignmentDisposable();
-
- var timer = new System.Windows.Threading.DispatcherTimer(
-#if HAS_DISPATCHER_PRIORITY
- _priority, _dispatcher
-#elif DESKTOPCLR40 // BACKWARDS COMPATIBILITY with v1.x
- System.Windows.Threading.DispatcherPriority.Background, _dispatcher
-#endif
- );
-
- timer.Tick += (s, e) =>
- {
- var t = Interlocked.Exchange(ref timer, null);
- if (t != null)
- {
- try
- {
- d.Disposable = action(this, state);
- }
- finally
- {
- t.Stop();
- action = null;
- }
- }
- };
-
- timer.Interval = dt;
- timer.Start();
-
- d.Disposable = Disposable.Create(() =>
- {
- var t = Interlocked.Exchange(ref timer, null);
- if (t != null)
- {
- t.Stop();
- action = (_, __) => Disposable.Empty;
- }
- });
-
- return d;
- }
-
- /// <summary>
- /// Schedules a periodic piece of work on the dispatcher, using a <see cref="System.Windows.Threading.DispatcherTimer"/> object.
- /// </summary>
- /// <typeparam name="TState">The type of the state passed to the scheduled action.</typeparam>
- /// <param name="state">Initial state passed to the action upon the first iteration.</param>
- /// <param name="period">Period for running the work periodically.</param>
- /// <param name="action">Action to be executed, potentially updating the state.</param>
- /// <returns>The disposable object used to cancel the scheduled recurring action (best effort).</returns>
- /// <exception cref="ArgumentNullException"><paramref name="action"/> is null.</exception>
- /// <exception cref="ArgumentOutOfRangeException"><paramref name="period"/> is less than TimeSpan.Zero.</exception>
- public IDisposable SchedulePeriodic<TState>(TState state, TimeSpan period, Func<TState, TState> action)
- {
- if (period < TimeSpan.Zero)
- throw new ArgumentOutOfRangeException("period");
- if (action == null)
- throw new ArgumentNullException("action");
-
- var timer = new System.Windows.Threading.DispatcherTimer(
-#if HAS_DISPATCHER_PRIORITY
- _priority, _dispatcher
-#elif DESKTOPCLR40 // BACKWARDS COMPATIBILITY with v1.x
- System.Windows.Threading.DispatcherPriority.Background, _dispatcher
-#endif
- );
-
- var state1 = state;
-
- timer.Tick += (s, e) =>
- {
- state1 = action(state1);
- };
-
- timer.Interval = period;
- timer.Start();
-
- return Disposable.Create(() =>
- {
- var t = Interlocked.Exchange(ref timer, null);
- if (t != null)
- {
- t.Stop();
- action = _ => _;
- }
- });
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Windows.Threading/Reactive/Internal/Constants.cs b/Rx.NET/System.Reactive.Windows.Threading/Reactive/Internal/Constants.cs
deleted file mode 100644
index 4d22eba..0000000
--- a/Rx.NET/System.Reactive.Windows.Threading/Reactive/Internal/Constants.cs
+++ /dev/null
@@ -1,13 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-namespace System.Reactive
-{
- // We can't make those based on the Strings_WindowsThreading.resx file, because the ObsoleteAttribute needs a compile-time constant.
-
- static class Constants_WindowsThreading
- {
-#if !WINDOWS
- public const string OBSOLETE_INSTANCE_PROPERTY = "Use the Current property to retrieve the DispatcherScheduler instance for the current thread's Dispatcher object. See http://go.microsoft.com/fwlink/?LinkID=260866 for more information.";
-#endif
- }
-}
diff --git a/Rx.NET/System.Reactive.Windows.Threading/Reactive/Linq/CoreDispatcherObservable.cs b/Rx.NET/System.Reactive.Windows.Threading/Reactive/Linq/CoreDispatcherObservable.cs
deleted file mode 100644
index d68039c..0000000
--- a/Rx.NET/System.Reactive.Windows.Threading/Reactive/Linq/CoreDispatcherObservable.cs
+++ /dev/null
@@ -1,258 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if WINDOWS
-using System.Reactive.Concurrency;
-using Windows.UI.Core;
-using Windows.UI.Xaml;
-
-namespace System.Reactive.Linq
-{
- /// <summary>
- /// Provides a set of extension methods for scheduling actions performed through observable sequences on UI dispatchers.
- /// </summary>
- public static class DispatcherObservable
- {
- #region ObserveOn[Dispatcher]
-
- /// <summary>
- /// Wraps the source sequence in order to run its observer callbacks on the specified dispatcher.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence.</param>
- /// <param name="dispatcher">Dispatcher whose associated message loop is used to notify observers on.</param>
- /// <returns>The source sequence whose observations happen on the specified dispatcher.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="dispatcher"/> is null.</exception>
- public static IObservable<TSource> ObserveOn<TSource>(this IObservable<TSource> source, CoreDispatcher dispatcher)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (dispatcher == null)
- throw new ArgumentNullException("dispatcher");
-
- return Synchronization.ObserveOn(source, new CoreDispatcherScheduler(dispatcher));
- }
-
- /// <summary>
- /// Wraps the source sequence in order to run its observer callbacks on the specified dispatcher.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence.</param>
- /// <param name="dispatcher">Dispatcher whose associated message loop is used to notify observers on.</param>
- /// <param name="priority">Priority to schedule work items at.</param>
- /// <returns>The source sequence whose observations happen on the specified dispatcher.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="dispatcher"/> is null.</exception>
- public static IObservable<TSource> ObserveOn<TSource>(this IObservable<TSource> source, CoreDispatcher dispatcher, CoreDispatcherPriority priority)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (dispatcher == null)
- throw new ArgumentNullException("dispatcher");
-
- return Synchronization.ObserveOn(source, new CoreDispatcherScheduler(dispatcher, priority));
- }
-
- /// <summary>
- /// Wraps the source sequence in order to run its observer callbacks on the dispatcher associated with the specified object.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence.</param>
- /// <param name="dependencyObject">Object to get the dispatcher from.</param>
- /// <returns>The source sequence whose observations happen on the specified object's dispatcher.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="dependencyObject"/> is null.</exception>
- public static IObservable<TSource> ObserveOn<TSource>(this IObservable<TSource> source, DependencyObject dependencyObject)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (dependencyObject == null)
- throw new ArgumentNullException("dependencyObject");
-
- return Synchronization.ObserveOn(source, new CoreDispatcherScheduler(dependencyObject.Dispatcher));
- }
-
- /// <summary>
- /// Wraps the source sequence in order to run its observer callbacks on the dispatcher associated with the specified object.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence.</param>
- /// <param name="dependencyObject">Object to get the dispatcher from.</param>
- /// <param name="priority">Priority to schedule work items at.</param>
- /// <returns>The source sequence whose observations happen on the specified object's dispatcher.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="dependencyObject"/> is null.</exception>
- public static IObservable<TSource> ObserveOn<TSource>(this IObservable<TSource> source, DependencyObject dependencyObject, CoreDispatcherPriority priority)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (dependencyObject == null)
- throw new ArgumentNullException("dependencyObject");
-
- return Synchronization.ObserveOn(source, new CoreDispatcherScheduler(dependencyObject.Dispatcher, priority));
- }
-
- /// <summary>
- /// Wraps the source sequence in order to run its observer callbacks on the dispatcher associated with the current window.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence.</param>
- /// <returns>The source sequence whose observations happen on the current window's dispatcher.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- public static IObservable<TSource> ObserveOnDispatcher<TSource>(this IObservable<TSource> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return Synchronization.ObserveOn(source, CoreDispatcherScheduler.Current);
- }
-
- /// <summary>
- /// Wraps the source sequence in order to run its observer callbacks on the dispatcher associated with the current window.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence.</param>
- /// <param name="priority">Priority to schedule work items at.</param>
- /// <returns>The source sequence whose observations happen on the current window's dispatcher.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- public static IObservable<TSource> ObserveOnDispatcher<TSource>(this IObservable<TSource> source, CoreDispatcherPriority priority)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return Synchronization.ObserveOn(source, new CoreDispatcherScheduler(CoreDispatcherScheduler.Current.Dispatcher, priority));
- }
-
- #endregion
-
- #region SubscribeOn[Dispatcher]
-
- /// <summary>
- /// Wraps the source sequence in order to run its subscription and unsubscription logic on the specified dispatcher.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence.</param>
- /// <param name="dispatcher">Dispatcher whose associated message loop is used to perform subscription and unsubscription actions on.</param>
- /// <returns>The source sequence whose subscriptions and unsubscriptions happen on the specified dispatcher.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="dispatcher"/> is null.</exception>
- /// <remarks>
- /// Only the side-effects of subscribing to the source sequence and disposing subscriptions to the source sequence are run on the specified dispatcher.
- /// In order to invoke observer callbacks on the specified dispatcher, e.g. to render results in a control, use <see cref="DispatcherObservable.ObserveOn{TSource}(IObservable{TSource}, CoreDispatcher)"/>.
- /// </remarks>
- public static IObservable<TSource> SubscribeOn<TSource>(this IObservable<TSource> source, CoreDispatcher dispatcher)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (dispatcher == null)
- throw new ArgumentNullException("dispatcher");
-
- return Synchronization.SubscribeOn(source, new CoreDispatcherScheduler(dispatcher));
- }
-
- /// <summary>
- /// Wraps the source sequence in order to run its subscription and unsubscription logic on the specified dispatcher.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence.</param>
- /// <param name="dispatcher">Dispatcher whose associated message loop is used to perform subscription and unsubscription actions on.</param>
- /// <param name="priority">Priority to schedule work items at.</param>
- /// <returns>The source sequence whose subscriptions and unsubscriptions happen on the specified dispatcher.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="dispatcher"/> is null.</exception>
- /// <remarks>
- /// Only the side-effects of subscribing to the source sequence and disposing subscriptions to the source sequence are run on the specified dispatcher.
- /// In order to invoke observer callbacks on the specified dispatcher, e.g. to render results in a control, use <see cref="DispatcherObservable.ObserveOn{TSource}(IObservable{TSource}, CoreDispatcher, CoreDispatcherPriority)"/>.
- /// </remarks>
- public static IObservable<TSource> SubscribeOn<TSource>(this IObservable<TSource> source, CoreDispatcher dispatcher, CoreDispatcherPriority priority)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (dispatcher == null)
- throw new ArgumentNullException("dispatcher");
-
- return Synchronization.SubscribeOn(source, new CoreDispatcherScheduler(dispatcher, priority));
- }
-
- /// <summary>
- /// Wraps the source sequence in order to run its subscription and unsubscription logic on the dispatcher associated with the specified object.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence.</param>
- /// <param name="dependencyObject">Object to get the dispatcher from.</param>
- /// <returns>The source sequence whose subscriptions and unsubscriptions happen on the specified object's dispatcher.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="dependencyObject"/> is null.</exception>
- /// <remarks>
- /// Only the side-effects of subscribing to the source sequence and disposing subscriptions to the source sequence are run on the dispatcher associated with the specified object.
- /// In order to invoke observer callbacks on the dispatcher associated with the specified object, e.g. to render results in a control, use <see cref="DispatcherObservable.ObserveOn{TSource}(IObservable{TSource}, DependencyObject)"/>.
- /// </remarks>
- public static IObservable<TSource> SubscribeOn<TSource>(this IObservable<TSource> source, DependencyObject dependencyObject)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (dependencyObject == null)
- throw new ArgumentNullException("dependencyObject");
-
- return Synchronization.SubscribeOn(source, new CoreDispatcherScheduler(dependencyObject.Dispatcher));
- }
-
- /// <summary>
- /// Wraps the source sequence in order to run its subscription and unsubscription logic on the dispatcher associated with the specified object.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence.</param>
- /// <param name="dependencyObject">Object to get the dispatcher from.</param>
- /// <param name="priority">Priority to schedule work items at.</param>
- /// <returns>The source sequence whose subscriptions and unsubscriptions happen on the specified object's dispatcher.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="dependencyObject"/> is null.</exception>
- /// <remarks>
- /// Only the side-effects of subscribing to the source sequence and disposing subscriptions to the source sequence are run on the dispatcher associated with the specified object.
- /// In order to invoke observer callbacks on the dispatcher associated with the specified object, e.g. to render results in a control, use <see cref="DispatcherObservable.ObserveOn{TSource}(IObservable{TSource}, DependencyObject, CoreDispatcherPriority)"/>.
- /// </remarks>
- public static IObservable<TSource> SubscribeOn<TSource>(this IObservable<TSource> source, DependencyObject dependencyObject, CoreDispatcherPriority priority)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (dependencyObject == null)
- throw new ArgumentNullException("dependencyObject");
-
- return Synchronization.SubscribeOn(source, new CoreDispatcherScheduler(dependencyObject.Dispatcher, priority));
- }
-
- /// <summary>
- /// Wraps the source sequence in order to run its subscription and unsubscription logic on the dispatcher associated with the current window.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence.</param>
- /// <returns>The source sequence whose subscriptions and unsubscriptions happen on the current window's dispatcher.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <remarks>
- /// Only the side-effects of subscribing to the source sequence and disposing subscriptions to the source sequence are run on the dispatcher associated with the current window.
- /// In order to invoke observer callbacks on the dispatcher associated with the current window, e.g. to render results in a control, use <see cref="DispatcherObservable.ObserveOnDispatcher{TSource}(IObservable{TSource})"/>.
- /// </remarks>
- public static IObservable<TSource> SubscribeOnDispatcher<TSource>(this IObservable<TSource> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return Synchronization.SubscribeOn(source, CoreDispatcherScheduler.Current);
- }
-
- /// <summary>
- /// Wraps the source sequence in order to run its subscription and unsubscription logic on the dispatcher associated with the current window.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence.</param>
- /// <param name="priority">Priority to schedule work items at.</param>
- /// <returns>The source sequence whose subscriptions and unsubscriptions happen on the current window's dispatcher.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <remarks>
- /// Only the side-effects of subscribing to the source sequence and disposing subscriptions to the source sequence are run on the dispatcher associated with the current window.
- /// In order to invoke observer callbacks on the dispatcher associated with the current window, e.g. to render results in a control, use <see cref="DispatcherObservable.ObserveOnDispatcher{TSource}(IObservable{TSource}, CoreDispatcherPriority)"/>.
- /// </remarks>
- public static IObservable<TSource> SubscribeOnDispatcher<TSource>(this IObservable<TSource> source, CoreDispatcherPriority priority)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return Synchronization.SubscribeOn(source, new CoreDispatcherScheduler(CoreDispatcherScheduler.Current.Dispatcher, priority));
- }
-
- #endregion
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Windows.Threading/Reactive/Linq/DispatcherObservable.cs b/Rx.NET/System.Reactive.Windows.Threading/Reactive/Linq/DispatcherObservable.cs
deleted file mode 100644
index 8510179..0000000
--- a/Rx.NET/System.Reactive.Windows.Threading/Reactive/Linq/DispatcherObservable.cs
+++ /dev/null
@@ -1,390 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !WINDOWS
-using System.Reactive.Concurrency;
-using System.Windows;
-using System.Windows.Threading;
-
-namespace System.Reactive.Linq
-{
- /// <summary>
- /// Provides a set of extension methods for scheduling actions performed through observable sequences on UI dispatchers.
- /// </summary>
- public static class DispatcherObservable
- {
- #region ObserveOn[Dispatcher]
-
- /// <summary>
- /// Wraps the source sequence in order to run its observer callbacks on the specified dispatcher.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence.</param>
- /// <param name="dispatcher">Dispatcher whose associated message loop is used to to notify observers on.</param>
- /// <returns>The source sequence whose observations happen on the specified dispatcher.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="dispatcher"/> is null.</exception>
- public static IObservable<TSource> ObserveOn<TSource>(this IObservable<TSource> source, Dispatcher dispatcher)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (dispatcher == null)
- throw new ArgumentNullException("dispatcher");
-
- return ObserveOn_<TSource>(source, dispatcher);
- }
-
-#if HAS_DISPATCHER_PRIORITY
- /// <summary>
- /// Wraps the source sequence in order to run its observer callbacks on the specified dispatcher.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence.</param>
- /// <param name="dispatcher">Dispatcher whose associated message loop is used to to notify observers on.</param>
- /// <param name="priority">Priority to schedule work items at.</param>
- /// <returns>The source sequence whose observations happen on the specified dispatcher.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="dispatcher"/> is null.</exception>
- public static IObservable<TSource> ObserveOn<TSource>(this IObservable<TSource> source, Dispatcher dispatcher, DispatcherPriority priority)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (dispatcher == null)
- throw new ArgumentNullException("dispatcher");
-
- return ObserveOn_<TSource>(source, dispatcher, priority);
- }
-#endif
-
- /// <summary>
- /// Wraps the source sequence in order to run its observer callbacks on the specified dispatcher scheduler.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence.</param>
- /// <param name="scheduler">Dispatcher scheduler to notify observers on.</param>
- /// <returns>The source sequence whose observations happen on the specified dispatcher scheduler.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="scheduler"/> is null.</exception>
- public static IObservable<TSource> ObserveOn<TSource>(this IObservable<TSource> source, DispatcherScheduler scheduler)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
-#if HAS_DISPATCHER_PRIORITY
- return ObserveOn_<TSource>(source, scheduler.Dispatcher, scheduler.Priority);
-#else
- return ObserveOn_<TSource>(source, scheduler.Dispatcher);
-#endif
- }
-
-#if USE_SL_DISPATCHER
- /// <summary>
- /// Wraps the source sequence in order to run its observer callbacks on the dispatcher associated with the specified object.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence.</param>
- /// <param name="dependencyObject">Object to get the dispatcher from.</param>
- /// <returns>The source sequence whose observations happen on the specified object's dispatcher.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="dependencyObject"/> is null.</exception>
- public static IObservable<TSource> ObserveOn<TSource>(this IObservable<TSource> source, DependencyObject dependencyObject)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (dependencyObject == null)
- throw new ArgumentNullException("dependencyObject");
-
- return ObserveOn_<TSource>(source, dependencyObject.Dispatcher);
- }
-#else
- /// <summary>
- /// Wraps the source sequence in order to run its observer callbacks on the dispatcher associated with the specified object.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence.</param>
- /// <param name="dispatcherObject">Object to get the dispatcher from.</param>
- /// <returns>The source sequence whose observations happen on the specified object's dispatcher.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="dispatcherObject"/> is null.</exception>
- public static IObservable<TSource> ObserveOn<TSource>(this IObservable<TSource> source, DispatcherObject dispatcherObject)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (dispatcherObject == null)
- throw new ArgumentNullException("dispatcherObject");
-
- return ObserveOn_<TSource>(source, dispatcherObject.Dispatcher);
- }
-#endif
-
-#if HAS_DISPATCHER_PRIORITY
- /// <summary>
- /// Wraps the source sequence in order to run its observer callbacks on the dispatcher associated with the specified object.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence.</param>
- /// <param name="dispatcherObject">Object to get the dispatcher from.</param>
- /// <param name="priority">Priority to schedule work items at.</param>
- /// <returns>The source sequence whose observations happen on the specified object's dispatcher.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="dispatcherObject"/> is null.</exception>
- public static IObservable<TSource> ObserveOn<TSource>(this IObservable<TSource> source, DispatcherObject dispatcherObject, DispatcherPriority priority)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (dispatcherObject == null)
- throw new ArgumentNullException("dispatcherObject");
-
- return ObserveOn_<TSource>(source, dispatcherObject.Dispatcher, priority);
- }
-#endif
-
- /// <summary>
- /// Wraps the source sequence in order to run its observer callbacks on the dispatcher associated with the current thread.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence.</param>
- /// <returns>The source sequence whose observations happen on the current thread's dispatcher.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- public static IObservable<TSource> ObserveOnDispatcher<TSource>(this IObservable<TSource> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
-#if USE_SL_DISPATCHER
- return ObserveOn_<TSource>(source, System.Windows.Deployment.Current.Dispatcher);
-#else
- return ObserveOn_<TSource>(source, DispatcherScheduler.Current.Dispatcher);
-#endif
- }
-
-#if HAS_DISPATCHER_PRIORITY
- /// <summary>
- /// Wraps the source sequence in order to run its observer callbacks on the dispatcher associated with the current thread.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence.</param>
- /// <param name="priority">Priority to schedule work items at.</param>
- /// <returns>The source sequence whose observations happen on the current thread's dispatcher.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- public static IObservable<TSource> ObserveOnDispatcher<TSource>(this IObservable<TSource> source, DispatcherPriority priority)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return ObserveOn_<TSource>(source, DispatcherScheduler.Current.Dispatcher, priority);
- }
-
- private static IObservable<TSource> ObserveOn_<TSource>(IObservable<TSource> source, Dispatcher dispatcher, DispatcherPriority priority)
- {
- return Synchronization.ObserveOn(source, new DispatcherSynchronizationContext(dispatcher, priority));
- }
-#endif
-
- private static IObservable<TSource> ObserveOn_<TSource>(IObservable<TSource> source, Dispatcher dispatcher)
- {
- return Synchronization.ObserveOn(source, new DispatcherSynchronizationContext(dispatcher));
- }
-
- #endregion
-
- #region SubscribeOn[Dispatcher]
-
- /// <summary>
- /// Wraps the source sequence in order to run its subscription and unsubscription logic on the specified dispatcher.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence.</param>
- /// <param name="dispatcher">Dispatcher whose associated message loop is used to to perform subscription and unsubscription actions on.</param>
- /// <returns>The source sequence whose subscriptions and unsubscriptions happen on the specified dispatcher.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="dispatcher"/> is null.</exception>
- /// <remarks>
- /// Only the side-effects of subscribing to the source sequence and disposing subscriptions to the source sequence are run on the specified dispatcher.
- /// In order to invoke observer callbacks on the specified dispatcher, e.g. to render results in a control, use <see cref="DispatcherObservable.ObserveOn{TSource}(IObservable{TSource}, Dispatcher)"/>.
- /// </remarks>
- public static IObservable<TSource> SubscribeOn<TSource>(this IObservable<TSource> source, Dispatcher dispatcher)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (dispatcher == null)
- throw new ArgumentNullException("dispatcher");
-
- return SubscribeOn_<TSource>(source, dispatcher);
- }
-
-#if HAS_DISPATCHER_PRIORITY
- /// <summary>
- /// Wraps the source sequence in order to run its subscription and unsubscription logic on the specified dispatcher.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence.</param>
- /// <param name="dispatcher">Dispatcher whose associated message loop is used to to perform subscription and unsubscription actions on.</param>
- /// <param name="priority">Priority to schedule work items at.</param>
- /// <returns>The source sequence whose subscriptions and unsubscriptions happen on the specified dispatcher.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="dispatcher"/> is null.</exception>
- /// <remarks>
- /// Only the side-effects of subscribing to the source sequence and disposing subscriptions to the source sequence are run on the specified dispatcher.
- /// In order to invoke observer callbacks on the specified dispatcher, e.g. to render results in a control, use <see cref="DispatcherObservable.ObserveOn{TSource}(IObservable{TSource}, Dispatcher, DispatcherPriority)"/>.
- /// </remarks>
- public static IObservable<TSource> SubscribeOn<TSource>(this IObservable<TSource> source, Dispatcher dispatcher, DispatcherPriority priority)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (dispatcher == null)
- throw new ArgumentNullException("dispatcher");
-
- return SubscribeOn_<TSource>(source, dispatcher, priority);
- }
-#endif
-
- /// <summary>
- /// Wraps the source sequence in order to run its subscription and unsubscription logic on the specified dispatcher scheduler.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence.</param>
- /// <param name="scheduler">Dispatcher scheduler to perform subscription and unsubscription actions on.</param>
- /// <returns>The source sequence whose subscriptions and unsubscriptions happen on the specified dispatcher scheduler.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="scheduler"/> is null.</exception>
- /// <remarks>
- /// Only the side-effects of subscribing to the source sequence and disposing subscriptions to the source sequence are run on the specified scheduler.
- /// In order to invoke observer callbacks on the specified scheduler, e.g. to render results in a control, use <see cref="DispatcherObservable.ObserveOn{TSource}(IObservable{TSource}, DispatcherScheduler)"/>.
- /// </remarks>
- public static IObservable<TSource> SubscribeOn<TSource>(this IObservable<TSource> source, DispatcherScheduler scheduler)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
-#if HAS_DISPATCHER_PRIORITY
- return SubscribeOn_<TSource>(source, scheduler.Dispatcher, scheduler.Priority);
-#else
- return SubscribeOn_<TSource>(source, scheduler.Dispatcher);
-#endif
- }
-
-#if USE_SL_DISPATCHER
- /// <summary>
- /// Wraps the source sequence in order to run its subscription and unsubscription logic on the dispatcher associated with the specified object.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence.</param>
- /// <param name="dependencyObject">Object to get the dispatcher from.</param>
- /// <returns>The source sequence whose subscriptions and unsubscriptions happen on the specified object's dispatcher.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="dependencyObject"/> is null.</exception>
- /// <remarks>
- /// Only the side-effects of subscribing to the source sequence and disposing subscriptions to the source sequence are run on the dispatcher associated with the specified object.
- /// In order to invoke observer callbacks on the dispatcher associated with the specified object, e.g. to render results in a control, use <see cref="DispatcherObservable.ObserveOn{TSource}(IObservable{TSource}, DependencyObject)"/>.
- /// </remarks>
- public static IObservable<TSource> SubscribeOn<TSource>(this IObservable<TSource> source, DependencyObject dependencyObject)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (dependencyObject == null)
- throw new ArgumentNullException("dependencyObject");
-
- return SubscribeOn_<TSource>(source, dependencyObject.Dispatcher);
- }
-#else
- /// <summary>
- /// Wraps the source sequence in order to run its subscription and unsubscription logic on the dispatcher associated with the specified object.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence.</param>
- /// <param name="dispatcherObject">Object to get the dispatcher from.</param>
- /// <returns>The source sequence whose subscriptions and unsubscriptions happen on the specified object's dispatcher.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="dispatcherObject"/> is null.</exception>
- /// <remarks>
- /// Only the side-effects of subscribing to the source sequence and disposing subscriptions to the source sequence are run on the dispatcher associated with the specified object.
- /// In order to invoke observer callbacks on the dispatcher associated with the specified object, e.g. to render results in a control, use <see cref="DispatcherObservable.ObserveOn{TSource}(IObservable{TSource}, DispatcherObject)"/>.
- /// </remarks>
- public static IObservable<TSource> SubscribeOn<TSource>(this IObservable<TSource> source, DispatcherObject dispatcherObject)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (dispatcherObject == null)
- throw new ArgumentNullException("dispatcherObject");
-
- return SubscribeOn_<TSource>(source, dispatcherObject.Dispatcher);
- }
-#endif
-
-#if HAS_DISPATCHER_PRIORITY
- /// <summary>
- /// Wraps the source sequence in order to run its subscription and unsubscription logic on the dispatcher associated with the specified object.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence.</param>
- /// <param name="dispatcherObject">Object to get the dispatcher from.</param>
- /// <param name="priority">Priority to schedule work items at.</param>
- /// <returns>The source sequence whose subscriptions and unsubscriptions happen on the specified object's dispatcher.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="dispatcherObject"/> is null.</exception>
- /// <remarks>
- /// Only the side-effects of subscribing to the source sequence and disposing subscriptions to the source sequence are run on the dispatcher associated with the specified object.
- /// In order to invoke observer callbacks on the dispatcher associated with the specified object, e.g. to render results in a control, use <see cref="DispatcherObservable.ObserveOn{TSource}(IObservable{TSource}, DispatcherObject, DispatcherPriority)"/>.
- /// </remarks>
- public static IObservable<TSource> SubscribeOn<TSource>(this IObservable<TSource> source, DispatcherObject dispatcherObject, DispatcherPriority priority)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (dispatcherObject == null)
- throw new ArgumentNullException("dispatcherObject");
-
- return SubscribeOn_<TSource>(source, dispatcherObject.Dispatcher, priority);
- }
-#endif
-
- /// <summary>
- /// Wraps the source sequence in order to run its subscription and unsubscription logic on the dispatcher associated with the current thread.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence.</param>
- /// <returns>The source sequence whose subscriptions and unsubscriptions happen on the current thread's dispatcher.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <remarks>
- /// Only the side-effects of subscribing to the source sequence and disposing subscriptions to the source sequence are run on the dispatcher associated with the current thread.
- /// In order to invoke observer callbacks on the dispatcher associated with the current thread, e.g. to render results in a control, use <see cref="DispatcherObservable.ObserveOnDispatcher{TSource}(IObservable{TSource})"/>.
- /// </remarks>
- public static IObservable<TSource> SubscribeOnDispatcher<TSource>(this IObservable<TSource> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
-#if USE_SL_DISPATCHER
- return SubscribeOn_<TSource>(source, System.Windows.Deployment.Current.Dispatcher);
-#else
- return SubscribeOn_<TSource>(source, DispatcherScheduler.Current.Dispatcher);
-#endif
- }
-
-#if HAS_DISPATCHER_PRIORITY
- /// <summary>
- /// Wraps the source sequence in order to run its subscription and unsubscription logic on the dispatcher associated with the current thread.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence.</param>
- /// <param name="priority">Priority to schedule work items at.</param>
- /// <returns>The source sequence whose observations happen on the current thread's dispatcher.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- /// <remarks>
- /// Only the side-effects of subscribing to the source sequence and disposing subscriptions to the source sequence are run on the dispatcher associated with the current thread.
- /// In order to invoke observer callbacks on the dispatcher associated with the current thread, e.g. to render results in a control, use <see cref="DispatcherObservable.ObserveOnDispatcher{TSource}(IObservable{TSource}, DispatcherPriority)"/>.
- /// </remarks>
- public static IObservable<TSource> SubscribeOnDispatcher<TSource>(this IObservable<TSource> source, DispatcherPriority priority)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return SubscribeOn_<TSource>(source, DispatcherScheduler.Current.Dispatcher, priority);
- }
-
- private static IObservable<TSource> SubscribeOn_<TSource>(IObservable<TSource> source, Dispatcher dispatcher, DispatcherPriority priority)
- {
- return Synchronization.SubscribeOn(source, new DispatcherSynchronizationContext(dispatcher, priority));
- }
-#endif
-
- private static IObservable<TSource> SubscribeOn_<TSource>(IObservable<TSource> source, Dispatcher dispatcher)
- {
- return Synchronization.SubscribeOn(source, new DispatcherSynchronizationContext(dispatcher));
- }
-
- #endregion
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Windows.Threading/Strings_WindowsThreading.Generated.cs b/Rx.NET/System.Reactive.Windows.Threading/Strings_WindowsThreading.Generated.cs
deleted file mode 100644
index 0ba08cc..0000000
--- a/Rx.NET/System.Reactive.Windows.Threading/Strings_WindowsThreading.Generated.cs
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * This file is manually generated upon every change to the corresponding .resx file, using the built-in code generator.
- * However, we can't use auto-generated code because the output is different for .NET 4.5 for Metro and PLIB, due to
- * changes in the reflection APIs (search for CRIPPLED_REFLECTION in this file), and because regeneration doesn't happen
- * as part of build, but rather at design time in Visual Studio. While we likely could tweak MSBuild to force regeneration
- * using the right version of ResGen.exe, this approach turned out to be the easiest for the time being.
- *
- * Upon adding entries to the ResX file, regenerate this file, put this comment back, and make sure to add the #if checks
- * for conditional use of the right flavor of reflection (using the CRIPPLED_REFLECTION defined symbol).
- */
-
-// Required for the use of the GetTypeInfo extension method.
-#if CRIPPLED_REFLECTION
-using System.Reflection;
-#endif
-
-// GENERATED CODE starts here
-
-namespace System.Reactive
-{
- using System;
-
-
- /// <summary>
- /// A strongly-typed resource class, for looking up localized strings, etc.
- /// </summary>
- // This class was auto-generated by the StronglyTypedResourceBuilder
- // class via a tool like ResGen or Visual Studio.
- // To add or remove a member, edit your .ResX file then rerun ResGen
- // with the /str option, or rebuild your VS project.
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- internal class Strings_WindowsThreading
- {
-
- private static global::System.Resources.ResourceManager resourceMan;
-
- private static global::System.Globalization.CultureInfo resourceCulture;
-
- [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
- internal Strings_WindowsThreading()
- {
- }
-
- /// <summary>
- /// Returns the cached ResourceManager instance used by this class.
- /// </summary>
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Resources.ResourceManager ResourceManager
- {
- get
- {
- if (object.ReferenceEquals(resourceMan, null))
- {
-#if CRIPPLED_REFLECTION
- global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("System.Reactive.Strings_WindowsThreading", typeof(Strings_WindowsThreading).GetTypeInfo().Assembly);
-#else
- global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("System.Reactive.Strings_WindowsThreading", typeof(Strings_WindowsThreading).Assembly);
-#endif
- resourceMan = temp;
- }
- return resourceMan;
- }
- }
-
- /// <summary>
- /// Overrides the current thread's CurrentUICulture property for all
- /// resource lookups using this strongly typed resource class.
- /// </summary>
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Globalization.CultureInfo Culture
- {
- get
- {
- return resourceCulture;
- }
- set
- {
- resourceCulture = value;
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to The current thread has no Dispatcher associated with it..
- /// </summary>
- internal static string NO_DISPATCHER_CURRENT_THREAD
- {
- get
- {
- return ResourceManager.GetString("NO_DISPATCHER_CURRENT_THREAD", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to No current Window object found to obtain a CoreDispatcher from..
- /// </summary>
- internal static string NO_WINDOW_CURRENT
- {
- get
- {
- return ResourceManager.GetString("NO_WINDOW_CURRENT", resourceCulture);
- }
- }
- }
-}
diff --git a/Rx.NET/System.Reactive.Windows.Threading/Strings_WindowsThreading.resx b/Rx.NET/System.Reactive.Windows.Threading/Strings_WindowsThreading.resx
deleted file mode 100644
index 85f5101..0000000
--- a/Rx.NET/System.Reactive.Windows.Threading/Strings_WindowsThreading.resx
+++ /dev/null
@@ -1,128 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<root>
- <!--
- Microsoft ResX Schema
-
- Version 2.0
-
- The primary goals of this format is to allow a simple XML format
- that is mostly human readable. The generation and parsing of the
- various data types are done through the TypeConverter classes
- associated with the data types.
-
- Example:
-
- ... ado.net/XML headers & schema ...
- <resheader name="resmimetype">text/microsoft-resx</resheader>
- <resheader name="version">2.0</resheader>
- <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
- <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
- <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
- <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
- <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
- <value>[base64 mime encoded serialized .NET Framework object]</value>
- </data>
- <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
- <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
- <comment>This is a comment</comment>
- </data>
-
- There are any number of "resheader" rows that contain simple
- name/value pairs.
-
- Each data row contains a name, and value. The row also contains a
- type or mimetype. Type corresponds to a .NET class that support
- text/value conversion through the TypeConverter architecture.
- Classes that don't support this are serialized and stored with the
- mimetype set.
-
- The mimetype is used for serialized objects, and tells the
- ResXResourceReader how to depersist the object. This is currently not
- extensible. For a given mimetype the value must be set accordingly:
-
- Note - application/x-microsoft.net.object.binary.base64 is the format
- that the ResXResourceWriter will generate, however the reader can
- read any of the formats listed below.
-
- mimetype: application/x-microsoft.net.object.binary.base64
- value : The object must be serialized with
- : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
- : and then encoded with base64 encoding.
-
- mimetype: application/x-microsoft.net.object.soap.base64
- value : The object must be serialized with
- : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
- : and then encoded with base64 encoding.
-
- mimetype: application/x-microsoft.net.object.bytearray.base64
- value : The object must be serialized into a byte array
- : using a System.ComponentModel.TypeConverter
- : and then encoded with base64 encoding.
- -->
- <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
- <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
- <xsd:element name="root" msdata:IsDataSet="true">
- <xsd:complexType>
- <xsd:choice maxOccurs="unbounded">
- <xsd:element name="metadata">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="value" type="xsd:string" minOccurs="0" />
- </xsd:sequence>
- <xsd:attribute name="name" use="required" type="xsd:string" />
- <xsd:attribute name="type" type="xsd:string" />
- <xsd:attribute name="mimetype" type="xsd:string" />
- <xsd:attribute ref="xml:space" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="assembly">
- <xsd:complexType>
- <xsd:attribute name="alias" type="xsd:string" />
- <xsd:attribute name="name" type="xsd:string" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="data">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
- <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
- </xsd:sequence>
- <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
- <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
- <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
- <xsd:attribute ref="xml:space" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="resheader">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
- </xsd:sequence>
- <xsd:attribute name="name" type="xsd:string" use="required" />
- </xsd:complexType>
- </xsd:element>
- </xsd:choice>
- </xsd:complexType>
- </xsd:element>
- </xsd:schema>
- <resheader name="resmimetype">
- <value>text/microsoft-resx</value>
- </resheader>
- <resheader name="version">
- <value>2.0</value>
- </resheader>
- <resheader name="reader">
- <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
- </resheader>
- <resheader name="writer">
- <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
- </resheader>
- <data name="NO_DISPATCHER_CURRENT_THREAD" xml:space="preserve">
- <value>The current thread has no Dispatcher associated with it.</value>
- <comment>Only on WPF/SL.</comment>
- </data>
- <data name="NO_WINDOW_CURRENT" xml:space="preserve">
- <value>No current Window object found to obtain a CoreDispatcher from.</value>
- <comment>Only on Jupiter.</comment>
- </data>
-</root> \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.Windows.Threading/System.Reactive.Windows.Threading.csproj b/Rx.NET/System.Reactive.Windows.Threading/System.Reactive.Windows.Threading.csproj
deleted file mode 100644
index def5e4b..0000000
--- a/Rx.NET/System.Reactive.Windows.Threading/System.Reactive.Windows.Threading.csproj
+++ /dev/null
@@ -1,60 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <ProductVersion>8.0.30703</ProductVersion>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}</ProjectGuid>
- <OutputType>Library</OutputType>
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <RootNamespace>System.Reactive</RootNamespace>
- <AssemblyName>System.Reactive.Windows.Threading</AssemblyName>
- <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
- <FileAlignment>512</FileAlignment>
- <ProductSignAssembly>true</ProductSignAssembly>
- <CodeAnalysisRuleSet>..\Rx.ruleset</CodeAnalysisRuleSet>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'ReleaseXBLV|AnyCPU'">
- <OutputPath>bin\ReleaseXBLV\</OutputPath>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'DebugXBLV|AnyCPU'">
- <OutputPath>bin\DebugXBLV\</OutputPath>
- </PropertyGroup>
- <Import Project="..\Common.targets" />
- <PropertyGroup>
- <DocumentationFile>$(OutputPath)\$(AssemblyName).XML</DocumentationFile>
- </PropertyGroup>
- <ItemGroup>
- <Reference Include="mscorlib" Condition=" '$(BuildPlatform)' == 'SILVERLIGHT' " />
- <Reference Include="System" />
- <Reference Include="System.Core" />
- <Reference Include="System.Windows" Condition=" '$(BuildPlatform)' == 'SILVERLIGHT' " />
- <Reference Include="WindowsBase" Condition=" '$(BuildPlatform)' == 'DESKTOPCLR' " />
- <Reference Include="System.Observable" Condition=" '$(BuildFlavor)' == 'SILVERLIGHTM7' " />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="GlobalSuppressions.cs" />
- <Compile Include="Reactive\Concurrency\CoreDispatcherScheduler.cs" />
- <Compile Include="Reactive\Internal\Constants.cs" />
- <Compile Include="Reactive\Linq\CoreDispatcherObservable.cs" />
- <Compile Include="Reactive\Linq\DispatcherObservable.cs" />
- <Compile Include="Reactive\Concurrency\DispatcherScheduler.cs" />
- <Compile Include="Properties\AssemblyInfo.cs" />
- <Compile Include="Strings_WindowsThreading.Generated.cs" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\System.Reactive.Core\System.Reactive.Core.csproj">
- <Project>{4E516F10-DA7A-4D43-963E-A93865ABEA5B}</Project>
- <Name>System.Reactive.Core</Name>
- </ProjectReference>
- <ProjectReference Include="..\System.Reactive.Interfaces\System.Reactive.Interfaces.csproj">
- <Project>{9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}</Project>
- <Name>System.Reactive.Interfaces</Name>
- </ProjectReference>
- </ItemGroup>
- <ItemGroup>
- <EmbeddedResource Include="Strings_WindowsThreading.resx" />
- </ItemGroup>
- <Import Project="..\Import.targets" />
-</Project> \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.WindowsRuntime/EventPatternSource.cs b/Rx.NET/System.Reactive.WindowsRuntime/EventPatternSource.cs
deleted file mode 100644
index 76dd72a..0000000
--- a/Rx.NET/System.Reactive.WindowsRuntime/EventPatternSource.cs
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if HAS_WINRT
-using Windows.Foundation;
-
-namespace System.Reactive
-{
- class EventPatternSource<TSender, TEventArgs> : EventPatternSourceBase<TSender, TEventArgs>, IEventPatternSource<TSender, TEventArgs>
- {
- public EventPatternSource(IObservable<EventPattern<TSender, TEventArgs>> source, Action<Action<TSender, TEventArgs>, /*object,*/ EventPattern<TSender, TEventArgs>> invokeHandler)
- : base(source, invokeHandler)
- {
- }
-
- event TypedEventHandler<TSender, TEventArgs> IEventPatternSource<TSender, TEventArgs>.OnNext
- {
- add
- {
- Add(value, (o, e) => value(o, e));
- }
-
- remove
- {
- Remove(value);
- }
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.WindowsRuntime/Foundation/AsyncInfoExtensions.cs b/Rx.NET/System.Reactive.WindowsRuntime/Foundation/AsyncInfoExtensions.cs
deleted file mode 100644
index 087cce0..0000000
--- a/Rx.NET/System.Reactive.WindowsRuntime/Foundation/AsyncInfoExtensions.cs
+++ /dev/null
@@ -1,249 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if HAS_WINRT
-using System.Reactive.Disposables;
-using System.Reactive.Linq;
-using System.Reactive.Subjects;
-using System.Threading;
-using Windows.Foundation;
-
-namespace System.Reactive.Windows.Foundation
-{
- /// <summary>
- /// Provides conversions from Windows Runtime asynchronous actions and operations to observable sequences.
- /// </summary>
- public static class AsyncInfoObservableExtensions
- {
- #region IAsyncAction and IAsyncActionWithProgress
-
- /// <summary>
- /// Converts a Windows Runtime asynchronous action to an observable sequence.
- /// Each observer subscribed to the resulting observable sequence will be notified about the action's successful or exceptional completion.
- /// </summary>
- /// <param name="source">Asynchronous action to convert.</param>
- /// <returns>An observable sequence that produces a unit value when the asynchronous action completes, or propagates the exception produced by the asynchronous action.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- public static IObservable<Unit> ToObservable(this IAsyncAction source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return new AsyncInfoToObservableBridge<Unit, Unit>(
- source,
- (iai, a) => ((IAsyncAction)iai).Completed += new AsyncActionCompletedHandler((iaa, status) => a(iaa, status)),
- iai => Unit.Default,
- onProgress: null,
- progress: null,
- multiValue: false
- );
- }
-
- /// <summary>
- /// Converts a Windows Runtime asynchronous action to an observable sequence, ignoring its progress notifications.
- /// Each observer subscribed to the resulting observable sequence will be notified about the action's successful or exceptional completion.
- /// </summary>
- /// <typeparam name="TProgress">The type of the reported progress objects, which get ignored by this conversion.</typeparam>
- /// <param name="source">Asynchronous action to convert.</param>
- /// <returns>An observable sequence that produces a unit value when the asynchronous action completes, or propagates the exception produced by the asynchronous action.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- public static IObservable<Unit> ToObservable<TProgress>(this IAsyncActionWithProgress<TProgress> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return source.ToObservable_(null);
- }
-
- /// <summary>
- /// Converts a Windows Runtime asynchronous action to an observable sequence, reporting its progress through the supplied progress object.
- /// Each observer subscribed to the resulting observable sequence will be notified about the action's successful or exceptional completion.
- /// </summary>
- /// <typeparam name="TProgress">The type of the reported progress objects.</typeparam>
- /// <param name="source">Asynchronous action to convert.</param>
- /// <param name="progress">Progress object to receive progress notifications on.</param>
- /// <returns>An observable sequence that produces a unit value when the asynchronous action completes, or propagates the exception produced by the asynchronous action.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="progress"/> is null.</exception>
- public static IObservable<Unit> ToObservable<TProgress>(this IAsyncActionWithProgress<TProgress> source, IProgress<TProgress> progress)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (progress == null)
- throw new ArgumentNullException("progress");
-
- return source.ToObservable_(progress);
- }
-
- /// <summary>
- /// Converts a Windows Runtime asynchronous action to an observable sequence reporting its progress.
- /// Each observer subscribed to the resulting observable sequence will be notified about the action's succesful or exceptional completion.
- /// </summary>
- /// <typeparam name="TProgress">The type of the reported progress objects.</typeparam>
- /// <param name="source">Asynchronous action to convert.</param>
- /// <returns>An observable sequence that produces progress values from the asynchronous action and notifies observers about the action's completion.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- public static IObservable<TProgress> ToObservableProgress<TProgress>(this IAsyncActionWithProgress<TProgress> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return Observable.Create<TProgress>(observer =>
- {
- var progress = observer.ToProgress();
- var src = source.ToObservable_(progress);
- return src.Subscribe(_ => { }, observer.OnError, observer.OnCompleted);
- });
- }
-
- private static IObservable<Unit> ToObservable_<TProgress>(this IAsyncActionWithProgress<TProgress> source, IProgress<TProgress> progress)
- {
- return new AsyncInfoToObservableBridge<Unit, TProgress>(
- source,
- (iai, a) => ((IAsyncActionWithProgress<TProgress>)iai).Completed += new AsyncActionWithProgressCompletedHandler<TProgress>((iaa, status) => a(iaa, status)),
- iai => Unit.Default,
- (iai, a) => ((IAsyncActionWithProgress<TProgress>)iai).Progress += new AsyncActionProgressHandler<TProgress>((iap, p) => a(iap, p)),
- progress,
- multiValue: false
- );
- }
-
- #endregion
-
- #region IAsyncOperation and IAsyncOperationWithProgress
-
- /// <summary>
- /// Converts a Windows Runtime asynchronous operation to an observable sequence reporting its result.
- /// Each observer subscribed to the resulting observable sequence will be notified about the operation's single result and its successful exceptional completion.
- /// </summary>
- /// <typeparam name="TResult">The type of the asynchronous operation's result.</typeparam>
- /// <param name="source">Asynchronous operation to convert.</param>
- /// <returns>An observable sequence that notifies observers about the asynchronous operation's result value and completion.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- public static IObservable<TResult> ToObservable<TResult>(this IAsyncOperation<TResult> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return new AsyncInfoToObservableBridge<TResult, Unit>(
- source,
- (iai, a) => ((IAsyncOperation<TResult>)iai).Completed += new AsyncOperationCompletedHandler<TResult>((iao, status) => a(iao, status)),
- iai => ((IAsyncOperation<TResult>)iai).GetResults(),
- onProgress: null,
- progress: null,
- multiValue: false
- );
- }
-
- /// <summary>
- /// Converts a Windows Runtime asynchronous operation to an observable sequence reporting its result but ignoring its progress notifications.
- /// Each observer subscribed to the resulting observable sequence will be notified about the operations's single result and its successful or exceptional completion.
- /// </summary>
- /// <typeparam name="TResult">The type of the asynchronous operation's result.</typeparam>
- /// <typeparam name="TProgress">The type of the reported progress objects, which get ignored by this conversion.</typeparam>
- /// <param name="source">Asynchronous action to convert.</param>
- /// <returns>An observable sequence that notifies observers about the asynchronous operation's result value and completion.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- public static IObservable<TResult> ToObservable<TResult, TProgress>(this IAsyncOperationWithProgress<TResult, TProgress> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return source.ToObservable_(null, false);
- }
-
- /// <summary>
- /// Converts a Windows Runtime asynchronous operation to an observable sequence reporting its result and reporting its progress through the supplied progress object.
- /// Each observer subscribed to the resulting observable sequence will be notified about the operations's single result and its successful or exceptional completion.
- /// </summary>
- /// <typeparam name="TResult">The type of the asynchronous operation's result.</typeparam>
- /// <typeparam name="TProgress">The type of the reported progress objects.</typeparam>
- /// <param name="source">Asynchronous action to convert.</param>
- /// <param name="progress">Progress object to receive progress notifications on.</param>
- /// <returns>An observable sequence that notifies observers about the asynchronous operation's result value and completion.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="progress"/> is null.</exception>
- public static IObservable<TResult> ToObservable<TResult, TProgress>(this IAsyncOperationWithProgress<TResult, TProgress> source, IProgress<TProgress> progress)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (progress == null)
- throw new ArgumentNullException("progress");
-
- return source.ToObservable_(progress, false);
- }
-
- /// <summary>
- /// Converts a Windows Runtime asynchronous operation to an observable sequence reporting its progress but ignoring its result value.
- /// Each observer subscribed to the resulting observable sequence will be notified about the action's succesful or exceptional completion.
- /// </summary>
- /// <typeparam name="TResult">The type of the asynchronous operation's result, which gets ignored by this conversion.</typeparam>
- /// <typeparam name="TProgress">The type of the reported progress objects.</typeparam>
- /// <param name="source">Asynchronous action to convert.</param>
- /// <returns>An observable sequence that produces progress values from the asynchronous operatin and notifies observers about the operations's completion.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- public static IObservable<TProgress> ToObservableProgress<TResult, TProgress>(this IAsyncOperationWithProgress<TResult, TProgress> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return Observable.Create<TProgress>(observer =>
- {
- var progress = observer.ToProgress();
- var src = source.ToObservable_(progress, false);
- return src.Subscribe(_ => { }, observer.OnError, observer.OnCompleted);
- });
- }
-
- /// <summary>
- /// Converts a Windows Runtime asynchronous operation to an observable sequence by retrieving the operation's results whenever progress is reported and when the operation completes.
- /// Each observer subscribed to the resulting observable sequence will be notified about the action's succesful or exceptional completion.
- /// </summary>
- /// <typeparam name="TResult">The type of the asynchronous operation's result.</typeparam>
- /// <typeparam name="TProgress">The type of the reported progress objects, which are used internally in the conversion but aren't exposed.</typeparam>
- /// <param name="source">Asynchronous operation to convert.</param>
- /// <returns>An observable sequence that notifies observers about the asynchronous operation's (incremental) result value(s) and completion.</returns>
- /// <remarks>This conversion can be used with Windows Runtime APIs that support incremental retrieval of results during an asynchronous operation's execution.</remarks>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- public static IObservable<TResult> ToObservableMultiple<TResult, TProgress>(this IAsyncOperationWithProgress<TResult, TProgress> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return source.ToObservable_(null, true);
- }
-
- /// <summary>
- /// Converts a Windows Runtime asynchronous operation to an observable sequence by retrieving the operation's results whenever progress is reported and when the operation completes. The operation's progress is reported through the supplied progress object.
- /// Each observer subscribed to the resulting observable sequence will be notified about the action's succesful or exceptional completion.
- /// </summary>
- /// <typeparam name="TResult">The type of the asynchronous operation's result.</typeparam>
- /// <typeparam name="TProgress">The type of the reported progress objects.</typeparam>
- /// <param name="source">Asynchronous operation to convert.</param>
- /// <param name="progress">Progress object to receive progress notifications on.</param>
- /// <returns>An observable sequence that notifies observers about the asynchronous operation's (incremental) result value(s) and completion.</returns>
- /// <remarks>This conversion can be used with Windows Runtime APIs that support incremental retrieval of results during an asynchronous operation's execution.</remarks>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="progress"/> is null.</exception>
- public static IObservable<TResult> ToObservableMultiple<TResult, TProgress>(this IAsyncOperationWithProgress<TResult, TProgress> source, IProgress<TProgress> progress)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (progress == null)
- throw new ArgumentNullException("progress");
-
- return source.ToObservable_(progress, true);
- }
-
- private static IObservable<TResult> ToObservable_<TResult, TProgress>(this IAsyncOperationWithProgress<TResult, TProgress> source, IProgress<TProgress> progress, bool supportsMultiple)
- {
- return new AsyncInfoToObservableBridge<TResult, TProgress>(
- source,
- (iai, a) => ((IAsyncOperationWithProgress<TResult, TProgress>)iai).Completed += new AsyncOperationWithProgressCompletedHandler<TResult, TProgress>((iao, status) => a(iao, status)),
- iai => ((IAsyncOperationWithProgress<TResult, TProgress>)iai).GetResults(),
- (iai, a) => ((IAsyncOperationWithProgress<TResult, TProgress>)iai).Progress += new AsyncOperationProgressHandler<TResult, TProgress>((iap, p) => a(iap, p)),
- progress,
- supportsMultiple
- );
- }
-
- #endregion
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.WindowsRuntime/Foundation/AsyncInfoToObservableBridge.cs b/Rx.NET/System.Reactive.WindowsRuntime/Foundation/AsyncInfoToObservableBridge.cs
deleted file mode 100644
index 3475817..0000000
--- a/Rx.NET/System.Reactive.WindowsRuntime/Foundation/AsyncInfoToObservableBridge.cs
+++ /dev/null
@@ -1,101 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if HAS_WINRT
-using System.Reactive.Disposables;
-using System.Reactive.Subjects;
-using Windows.Foundation;
-
-namespace System.Reactive.Windows.Foundation
-{
- class AsyncInfoToObservableBridge<TResult, TProgress> : ObservableBase<TResult>
- {
- private readonly Action<IAsyncInfo, Action<IAsyncInfo, AsyncStatus>> _onCompleted;
- private readonly Func<IAsyncInfo, TResult> _getResult;
- private readonly AsyncSubject<TResult> _subject;
-
- public AsyncInfoToObservableBridge(IAsyncInfo info, Action<IAsyncInfo, Action<IAsyncInfo, AsyncStatus>> onCompleted, Func<IAsyncInfo, TResult> getResult, Action<IAsyncInfo, Action<IAsyncInfo, TProgress>> onProgress, IProgress<TProgress> progress, bool multiValue)
- {
- _onCompleted = onCompleted;
- _getResult = getResult;
-
- _subject = new AsyncSubject<TResult>();
-
- if (onProgress != null)
- {
- onProgress(info, (iai, p) =>
- {
- if (multiValue && getResult != null)
- _subject.OnNext(getResult(iai));
-
- if (progress != null)
- progress.Report(p);
- });
- }
-
- Done(info, info.Status, true);
- }
-
- private void Done(IAsyncInfo info, AsyncStatus status, bool initial)
- {
- var error = default(Exception);
- var result = default(TResult);
-
- //
- // Initial interactions with the IAsyncInfo object. Those could fail, which indicates
- // a rogue implementation. Failure is just propagated out.
- //
- switch (status)
- {
- case AsyncStatus.Error:
- error = info.ErrorCode;
- if (error == null)
- throw new InvalidOperationException("The asynchronous operation failed with a null error code.");
- break;
- case AsyncStatus.Canceled:
- error = new OperationCanceledException();
- break;
- case AsyncStatus.Completed:
- if (_getResult != null)
- result = _getResult(info);
- break;
- default:
- if (!initial)
- throw new InvalidOperationException("The asynchronous operation completed unexpectedly.");
-
- _onCompleted(info, (iai, s) => Done(iai, s, false));
- return;
- }
-
- //
- // Close as early as possible, before running continuations which could fail. In case of
- // failure above, we don't close out the object in order to allow for debugging of the
- // rogue implementation without losing state prematurely. Notice _getResults is merely
- // an indirect call to the appropriate GetResults method, which is not supposed to throw.
- // Instead, an Error status should be returned.
- //
- info.Close();
-
- //
- // Now we run the continuations, which could take a long time. Failure here is catastrophic
- // and under control of the upstream subscriber.
- //
- if (error != null)
- {
- _subject.OnError(error);
- }
- else
- {
- if (_getResult != null)
- _subject.OnNext(result);
-
- _subject.OnCompleted();
- }
- }
-
- protected override IDisposable SubscribeCore(IObserver<TResult> observer)
- {
- return _subject.Subscribe(observer);
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.WindowsRuntime/IEventPatternSource.cs b/Rx.NET/System.Reactive.WindowsRuntime/IEventPatternSource.cs
deleted file mode 100644
index c4e5dd1..0000000
--- a/Rx.NET/System.Reactive.WindowsRuntime/IEventPatternSource.cs
+++ /dev/null
@@ -1,21 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if HAS_WINRT
-using Windows.Foundation;
-
-namespace System.Reactive
-{
- /// <summary>
- /// Represents a data stream signaling its elements by means of an event.
- /// </summary>
- /// <typeparam name="TSender">Sender type.</typeparam>
- /// <typeparam name="TEventArgs">Event arguments type.</typeparam>
- public interface IEventPatternSource<TSender, TEventArgs>
- {
- /// <summary>
- /// Event signaling the next element in the data stream.
- /// </summary>
- event TypedEventHandler<TSender, TEventArgs> OnNext;
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.WindowsRuntime/Linq/AsyncInfoObservable.cs b/Rx.NET/System.Reactive.WindowsRuntime/Linq/AsyncInfoObservable.cs
deleted file mode 100644
index 570483e..0000000
--- a/Rx.NET/System.Reactive.WindowsRuntime/Linq/AsyncInfoObservable.cs
+++ /dev/null
@@ -1,204 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if HAS_WINRT
-using System.Reactive.Disposables;
-using System.Reactive.Linq;
-using System.Reactive.Subjects;
-using System.Reactive.Threading.Tasks;
-using System.Runtime.InteropServices.WindowsRuntime;
-using System.Threading.Tasks;
-using Windows.Foundation;
-
-namespace System.Reactive.Linq
-{
- /// <summary>
- /// Provides a set of extension methods to expose observable sequences as Windows Runtime asynchronous actions and operations.
- /// </summary>
- public static class AsyncInfoObservable
- {
- #region IAsyncAction
-
- /// <summary>
- /// Creates a Windows Runtime asynchronous action that represents the completion of the observable sequence.
- /// Upon cancellation of the asynchronous action, the subscription to the source sequence will be disposed.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence to expose as an asynchronous action.</param>
- /// <returns>Windows Runtime asynchronous action object representing the completion of the observable sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- public static IAsyncAction ToAsyncAction<TSource>(this IObservable<TSource> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return AsyncInfo.Run(ct => (Task)source.DefaultIfEmpty().ToTask(ct));
- }
-
- #region Progress
-
- /// <summary>
- /// Creates a Windows Runtime asynchronous action that represents the completion of the observable sequence, reporting incremental progress for each element produced by the sequence.
- /// Upon cancellation of the asynchronous action, the subscription to the source sequence will be disposed.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence to expose as an asynchronous action.</param>
- /// <returns>Windows Runtime asynchronous action object representing the completion of the observable sequence, reporting incremental progress for each source sequence element.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- public static IAsyncActionWithProgress<int> ToAsyncActionWithProgress<TSource>(this IObservable<TSource> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return AsyncInfo.Run<int>((ct, progress) =>
- {
- var i = 0;
- return (Task)source.Do(_ => progress.Report(i++)).DefaultIfEmpty().ToTask(ct);
- });
- }
-
- /// <summary>
- /// Creates a Windows Runtime asynchronous action that represents the completion of the observable sequence, using a selector function to map the source sequence on a progress reporting sequence.
- /// Upon cancellation of the asynchronous action, the subscription to the source sequence will be disposed.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TProgress">The type of the elements in the progress sequence.</typeparam>
- /// <param name="source">Source sequence to expose as an asynchronous action and to compute a progress sequence that gets reported through the asynchronous action.</param>
- /// <param name="progressSelector">Selector function to map the source sequence on a progress reporting sequence.</param>
- /// <returns>Windows Runtime asynchronous action object representing the completion of the result sequence, reporting progress computed through the progress sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="progressSelector"/> is null.</exception>
- public static IAsyncActionWithProgress<TProgress> ToAsyncActionWithProgress<TSource, TProgress>(this IObservable<TSource> source, Func<IObservable<TSource>, IObservable<TProgress>> progressSelector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (progressSelector == null)
- throw new ArgumentNullException("progressSelector");
-
- return AsyncInfo.Run<TProgress>((ct, progress) =>
- {
- return (Task)Observable.Create<TSource>(observer =>
- {
- var obs = Observer.Synchronize(observer);
-
- var data = source.Publish();
-
- var progressSubscription = progressSelector(data).Subscribe(progress.Report, obs.OnError);
- var dataSubscription = data.DefaultIfEmpty().Subscribe(obs);
- var connection = data.Connect();
-
- return new CompositeDisposable(progressSubscription, dataSubscription, connection);
- }).ToTask(ct);
- });
- }
-
- #endregion
-
- #endregion
-
- #region IAsyncOperation<T>
-
- /// <summary>
- /// Creates a Windows Runtime asynchronous operation that returns the last element of the observable sequence.
- /// Upon cancellation of the asynchronous operation, the subscription to the source sequence will be disposed.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence to expose as an asynchronous operation.</param>
- /// <returns>Windows Runtime asynchronous operation object that returns the last element of the observable sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- public static IAsyncOperation<TSource> ToAsyncOperation<TSource>(this IObservable<TSource> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return AsyncInfo.Run(ct => source.ToTask(ct));
- }
-
- /// <summary>
- /// Creates a Windows Runtime asynchronous operation that returns the last element of the observable sequence, reporting incremental progress for each element produced by the sequence.
- /// Upon cancellation of the asynchronous operation, the subscription to the source sequence will be disposed.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <param name="source">Source sequence to expose as an asynchronous operation.</param>
- /// <returns>Windows Runtime asynchronous operation object that returns the last element of the observable sequence, reporting incremental progress for each source sequence element.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- public static IAsyncOperationWithProgress<TSource, int> ToAsyncOperationWithProgress<TSource>(this IObservable<TSource> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return AsyncInfo.Run<TSource, int>((ct, progress) =>
- {
- var i = 0;
- return source.Do(_ => progress.Report(i++)).ToTask(ct);
- });
- }
-
- #region Progress
-
- /// <summary>
- /// Creates a Windows Runtime asynchronous operation that returns the last element of the result sequence, reporting incremental progress for each element produced by the source sequence.
- /// Upon cancellation of the asynchronous operation, the subscription to the source sequence will be disposed.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence.</typeparam>
- /// <param name="source">Source sequence to compute a result sequence that gets exposed as an asynchronous operation.</param>
- /// <param name="resultSelector">Selector function to map the source sequence on a result sequence.</param>
- /// <returns>Windows Runtime asynchronous operation object that returns the last element of the result sequence, reporting incremental progress for each source sequence element.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="resultSelector"/> is null.</exception>
- public static IAsyncOperationWithProgress<TResult, int> ToAsyncOperationWithProgress<TSource, TResult>(this IObservable<TSource> source, Func<IObservable<TSource>, IObservable<TResult>> resultSelector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (resultSelector == null)
- throw new ArgumentNullException("resultSelector");
-
- return AsyncInfo.Run<TResult, int>((ct, progress) =>
- {
- var i = 0;
- return resultSelector(source.Do(_ => progress.Report(i++))).ToTask(ct);
- });
- }
-
- /// <summary>
- /// Creates a Windows Runtime asynchronous operation that returns the last element of the result sequence, using a selector function to map the source sequence on a progress reporting sequence.
- /// Upon cancellation of the asynchronous operation, the subscription to the source sequence will be disposed.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence.</typeparam>
- /// <typeparam name="TProgress">The type of the elements in the progress sequence.</typeparam>
- /// <param name="source">Source sequence to compute a result sequence that gets exposed as an asynchronous operation and a progress sequence that gets reported through the asynchronous operation.</param>
- /// <param name="resultSelector">Selector function to map the source sequence on a result sequence.</param>
- /// <param name="progressSelector">Selector function to map the source sequence on a progress reporting sequence.</param>
- /// <returns>Windows Runtime asynchronous operation object that returns the last element of the result sequence, reporting progress computed through the progress sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="resultSelector"/> or <paramref name="progressSelector"/> is null.</exception>
- public static IAsyncOperationWithProgress<TResult, TProgress> ToAsyncOperationWithProgress<TSource, TResult, TProgress>(this IObservable<TSource> source, Func<IObservable<TSource>, IObservable<TResult>> resultSelector, Func<IObservable<TSource>, IObservable<TProgress>> progressSelector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (resultSelector == null)
- throw new ArgumentNullException("resultSelector");
- if (progressSelector == null)
- throw new ArgumentNullException("progressSelector");
-
- return AsyncInfo.Run<TResult, TProgress>((ct, progress) =>
- {
- return Observable.Create<TResult>(observer =>
- {
- var obs = Observer.Synchronize(observer);
-
- var data = source.Publish();
-
- var progressSubscription = progressSelector(data).Subscribe(progress.Report, obs.OnError);
- var dataSubscription = resultSelector(data).Subscribe(obs);
- var connection = data.Connect();
-
- return new CompositeDisposable(progressSubscription, dataSubscription, connection);
- }).ToTask(ct);
- });
- }
-
- #endregion
-
- #endregion
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.WindowsRuntime/Linq/WindowsObservable.Events.cs b/Rx.NET/System.Reactive.WindowsRuntime/Linq/WindowsObservable.Events.cs
deleted file mode 100644
index a2b7dc5..0000000
--- a/Rx.NET/System.Reactive.WindowsRuntime/Linq/WindowsObservable.Events.cs
+++ /dev/null
@@ -1,101 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if HAS_WINRT
-using System.Threading;
-using Windows.Foundation;
-
-namespace System.Reactive.Linq
-{
- /// <summary>
- /// Provides a set of static methods for importing typed events from Windows Runtime APIs.
- /// </summary>
- public static partial class WindowsObservable
- {
- /// <summary>
- /// Converts a typed event, conforming to the standard event pattern, to an observable sequence.
- /// </summary>
- /// <typeparam name="TSender">The type of the sender that raises the event.</typeparam>
- /// <typeparam name="TResult">The type of the event data generated by the event.</typeparam>
- /// <param name="addHandler">Action that attaches the given event handler to the underlying .NET event.</param>
- /// <param name="removeHandler">Action that detaches the given event handler from the underlying .NET event.</param>
- /// <returns>The observable sequence that contains data representations of invocations of the underlying typed event.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="addHandler"/> or <paramref name="removeHandler"/> is null.</exception>
- /// <seealso cref="WindowsObservable.ToEventPattern"/>
- public static IObservable<EventPattern<TSender, TResult>> FromEventPattern<TSender, TResult>(Action<TypedEventHandler<TSender, TResult>> addHandler, Action<TypedEventHandler<TSender, TResult>> removeHandler)
- {
- if (addHandler == null)
- throw new ArgumentNullException("addHandler");
- if (removeHandler == null)
- throw new ArgumentNullException("removeHandler");
-
- return Observable.Create<EventPattern<TSender, TResult>>(observer =>
- {
- var h = new TypedEventHandler<TSender, TResult>((sender, args) =>
- {
- observer.OnNext(new EventPattern<TSender, TResult>(sender, args));
- });
-
- addHandler(h);
-
- return () =>
- {
- removeHandler(h);
- };
- });
- }
-
- /// <summary>
- /// Converts a typed event, conforming to the standard event pattern, to an observable sequence.
- /// </summary>
- /// <typeparam name="TDelegate">The delegate type of the event to be converted.</typeparam>
- /// <typeparam name="TSender">The type of the sender that raises the event.</typeparam>
- /// <typeparam name="TResult">The type of the event data generated by the event.</typeparam>
- /// <param name="conversion">A function used to convert the given event handler to a delegate compatible with the underlying typed event. The resulting delegate is used in calls to the addHandler and removeHandler action parameters.</param>
- /// <param name="addHandler">Action that attaches the given event handler to the underlying .NET event.</param>
- /// <param name="removeHandler">Action that detaches the given event handler from the underlying .NET event.</param>
- /// <returns>The observable sequence that contains data representations of invocations of the underlying typed event.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="conversion"/> or <paramref name="addHandler"/> or <paramref name="removeHandler"/> is null.</exception>
- /// <seealso cref="WindowsObservable.ToEventPattern"/>
- public static IObservable<EventPattern<TSender, TResult>> FromEventPattern<TDelegate, TSender, TResult>(Func<TypedEventHandler<TSender, TResult>, TDelegate> conversion, Action<TDelegate> addHandler, Action<TDelegate> removeHandler)
- {
- if (conversion == null)
- throw new ArgumentNullException("conversion");
- if (addHandler == null)
- throw new ArgumentNullException("addHandler");
- if (removeHandler == null)
- throw new ArgumentNullException("removeHandler");
-
- return Observable.Create<EventPattern<TSender, TResult>>(observer =>
- {
- var h = conversion(new TypedEventHandler<TSender, TResult>((sender, args) =>
- {
- observer.OnNext(new EventPattern<TSender, TResult>(sender, args));
- }));
-
- addHandler(h);
-
- return () =>
- {
- removeHandler(h);
- };
- });
- }
-
- /// <summary>
- /// Exposes an observable sequence as an object with a typed event.
- /// </summary>
- /// <typeparam name="TSender">The type of the sender that raises the event.</typeparam>
- /// <typeparam name="TEventArgs">The type of the event data generated by the event.</typeparam>
- /// <param name="source">Observable source sequence.</param>
- /// <returns>The event source object.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
- public static IEventPatternSource<TSender, TEventArgs> ToEventPattern<TSender, TEventArgs>(this IObservable<EventPattern<TSender, TEventArgs>> source)
- {
- if (source == null)
- throw new ArgumentNullException("source");
-
- return new EventPatternSource<TSender, TEventArgs>(source, (h, evt) => h(evt.Sender, evt.EventArgs));
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.WindowsRuntime/Linq/WindowsObservable.StandardSequenceOperators.cs b/Rx.NET/System.Reactive.WindowsRuntime/Linq/WindowsObservable.StandardSequenceOperators.cs
deleted file mode 100644
index 047933e..0000000
--- a/Rx.NET/System.Reactive.WindowsRuntime/Linq/WindowsObservable.StandardSequenceOperators.cs
+++ /dev/null
@@ -1,103 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if HAS_WINRT
-using System.Reactive.Windows.Foundation;
-using System.Threading;
-using Windows.Foundation;
-
-namespace System.Reactive.Linq
-{
- public static partial class WindowsObservable
- {
- /// <summary>
- /// Projects each element of an observable sequence to a Windows Runtime asynchronous operation and merges all of the asynchronous operation results into one observable sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the result produced by the projected asynchronous operations and the elements in the merged result sequence.</typeparam>
- /// <param name="source">An observable sequence of elements to project.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence whose elements are the result of the asynchronous operations executed for each element of the input sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> is null.</exception>
- /// <remarks>This overload supports composition of observable sequences and Windows Runtime asynchronous operations, without requiring manual conversion of the asynchronous operations to observable sequences using <see cref="AsyncInfoObservableExtensions.ToObservable&lt;TResult&gt;(IAsyncOperation&lt;TResult&gt;)"/>.</remarks>
- public static IObservable<TResult> SelectMany<TSource, TResult>(this IObservable<TSource> source, Func<TSource, IAsyncOperation<TResult>> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return source.SelectMany(x => selector(x).ToObservable());
- }
-
- /// <summary>
- /// Projects each element of an observable sequence to a Windows Runtime asynchronous operation and merges all of the asynchronous operation results into one observable sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TResult">The type of the result produced by the projected asynchronous operations and the elements in the merged result sequence.</typeparam>
- /// <typeparam name="TProgress">The type of the reported progress objects, which get ignored by this query operator.</typeparam>
- /// <param name="source">An observable sequence of elements to project.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>An observable sequence whose elements are the result of the asynchronous operations executed for each element of the input sequence.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> is null.</exception>
- /// <remarks>This overload supports composition of observable sequences and Windows Runtime asynchronous operations, without requiring manual conversion of the asynchronous operations to observable sequences using <see cref="AsyncInfoObservableExtensions.ToObservable&lt;TResult&gt;(IAsyncOperation&lt;TResult&gt;)"/>.</remarks>
- public static IObservable<TResult> SelectMany<TSource, TResult, TProgress>(this IObservable<TSource> source, Func<TSource, IAsyncOperationWithProgress<TResult, TProgress>> selector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (selector == null)
- throw new ArgumentNullException("selector");
-
- return source.SelectMany(x => selector(x).ToObservable());
- }
-
- /// <summary>
- /// Projects each element of an observable sequence to a Windows Runtime asynchronous operation, invokes the result selector for the source element and the asynchronous operation result, and merges the results into one observable sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TAsyncOperationResult">The type of the results produced by the projected asynchronous operations.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence, obtained by using the selector to combine source sequence elements with their corresponding intermediate asynchronous operation results.</typeparam>
- /// <param name="source">An observable sequence of elements to project.</param>
- /// <param name="asyncOperationSelector">A transform function to apply to each element.</param>
- /// <param name="resultSelector">A transform function to apply to each element of the intermediate sequence.</param>
- /// <returns>An observable sequence whose elements are the result of obtaining an asynchronous operation for each element of the input sequence and then mapping the asynchronous operation's result and its corresponding source element to a result element.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="asyncOperationSelector"/> or <paramref name="resultSelector"/> is null.</exception>
- /// <remarks>This overload supports using LINQ query comprehension syntax in C# and Visual Basic to compose observable sequences and Windows Runtime asynchronous operations, without requiring manual conversion of the asynchronous operations to observable sequences using <see cref="AsyncInfoObservableExtensions.ToObservable&lt;TResult&gt;(IAsyncOperation&lt;TResult&gt;)"/>.</remarks>
- public static IObservable<TResult> SelectMany<TSource, TAsyncOperationResult, TResult>(this IObservable<TSource> source, Func<TSource, IAsyncOperation<TAsyncOperationResult>> asyncOperationSelector, Func<TSource, TAsyncOperationResult, TResult> resultSelector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (asyncOperationSelector == null)
- throw new ArgumentNullException("asyncOperationSelector");
- if (resultSelector == null)
- throw new ArgumentNullException("resultSelector");
-
- return source.SelectMany(x => asyncOperationSelector(x).ToObservable(), resultSelector);
- }
-
- /// <summary>
- /// Projects each element of an observable sequence to a Windows Runtime asynchronous operation, invokes the result selector for the source element and the asynchronous operation result, and merges the results into one observable sequence.
- /// </summary>
- /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
- /// <typeparam name="TAsyncOperationResult">The type of the results produced by the projected asynchronous operations.</typeparam>
- /// <typeparam name="TAsyncOperationProgress">The type of the reported progress objects, which get ignored by this query operator.</typeparam>
- /// <typeparam name="TResult">The type of the elements in the result sequence, obtained by using the selector to combine source sequence elements with their corresponding intermediate asynchronous operation results.</typeparam>
- /// <param name="source">An observable sequence of elements to project.</param>
- /// <param name="asyncOperationSelector">A transform function to apply to each element.</param>
- /// <param name="resultSelector">A transform function to apply to each element of the intermediate sequence.</param>
- /// <returns>An observable sequence whose elements are the result of obtaining an asynchronous operation for each element of the input sequence and then mapping the asynchronous operation's result and its corresponding source element to a result element.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="asyncOperationSelector"/> or <paramref name="resultSelector"/> is null.</exception>
- /// <remarks>This overload supports using LINQ query comprehension syntax in C# and Visual Basic to compose observable sequences and Windows Runtime asynchronous operations, without requiring manual conversion of the asynchronous operations to observable sequences using <see cref="AsyncInfoObservableExtensions.ToObservable&lt;TResult&gt;(IAsyncOperation&lt;TResult&gt;)"/>.</remarks>
- public static IObservable<TResult> SelectMany<TSource, TAsyncOperationResult, TAsyncOperationProgress, TResult>(this IObservable<TSource> source, Func<TSource, IAsyncOperationWithProgress<TAsyncOperationResult, TAsyncOperationProgress>> asyncOperationSelector, Func<TSource, TAsyncOperationResult, TResult> resultSelector)
- {
- if (source == null)
- throw new ArgumentNullException("source");
- if (asyncOperationSelector == null)
- throw new ArgumentNullException("asyncOperationSelector");
- if (resultSelector == null)
- throw new ArgumentNullException("resultSelector");
-
- return source.SelectMany(x => asyncOperationSelector(x).ToObservable(), resultSelector);
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/System.Reactive.WindowsRuntime/Properties/AssemblyInfo.cs b/Rx.NET/System.Reactive.WindowsRuntime/Properties/AssemblyInfo.cs
deleted file mode 100644
index be08605..0000000
--- a/Rx.NET/System.Reactive.WindowsRuntime/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,31 +0,0 @@
-using System;
-using System.Reflection;
-using System.Resources;
-using System.Runtime.InteropServices;
-using System.Security;
-
-[assembly: AssemblyTitle("System.Reactive.WindowsRuntime")]
-// Notice: same description as in the .nuspec files; see Source/Rx/Setup/NuGet
-[assembly: AssemblyDescription("Windows Runtime extensions library for Rx. Contains scheduler functionality and various bridges for the Windows Runtime.")]
-#if DEBUG
-[assembly: AssemblyConfiguration("Debug")]
-#else
-[assembly: AssemblyConfiguration("Retail")]
-#endif
-[assembly: AssemblyCompany("Microsoft Corporation")]
-[assembly: AssemblyProduct("Reactive Extensions")]
-[assembly: AssemblyCopyright("\x00a9 Microsoft Corporation. All rights reserved.")]
-[assembly: NeutralResourcesLanguage("en-US")]
-
-#if !PLIB
-[assembly: ComVisible(false)]
-#endif
-
-#if HAS_APTCA && NO_CODECOVERAGE
-[assembly: AllowPartiallyTrustedCallers]
-#endif
-
-//
-// Note: Assembly (file) version numbers get inserted by the build system on the fly. Inspect the Team Build workflows
-// and the custom activity in Build/Source/Activities/AppendVersionInfo.cs for more information.
-//
diff --git a/Rx.NET/System.Reactive.WindowsRuntime/System.Reactive.WindowsRuntime.csproj b/Rx.NET/System.Reactive.WindowsRuntime/System.Reactive.WindowsRuntime.csproj
deleted file mode 100644
index 8021af8..0000000
--- a/Rx.NET/System.Reactive.WindowsRuntime/System.Reactive.WindowsRuntime.csproj
+++ /dev/null
@@ -1,57 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <ProductVersion>8.0.30703</ProductVersion>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{EE655A70-A899-4B38-84D3-FB9F63A8C661}</ProjectGuid>
- <OutputType>Library</OutputType>
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <RootNamespace>System.Reactive</RootNamespace>
- <AssemblyName>System.Reactive.WindowsRuntime</AssemblyName>
- <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
- <FileAlignment>512</FileAlignment>
- <ProductSignAssembly>true</ProductSignAssembly>
- <CodeAnalysisRuleSet>..\Rx.ruleset</CodeAnalysisRuleSet>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'ReleaseXBLV|AnyCPU'">
- <OutputPath>bin\ReleaseXBLV\</OutputPath>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'DebugXBLV|AnyCPU'">
- <OutputPath>bin\DebugXBLV\</OutputPath>
- </PropertyGroup>
- <Import Project="..\Common.targets" />
- <PropertyGroup>
- <DocumentationFile>$(OutputPath)\$(AssemblyName).XML</DocumentationFile>
- </PropertyGroup>
- <ItemGroup>
- <Reference Include="System" />
- <Reference Include="System.Core" />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="EventPatternSource.cs" />
- <Compile Include="Foundation\AsyncInfoExtensions.cs" />
- <Compile Include="Linq\AsyncInfoObservable.cs" />
- <Compile Include="Foundation\AsyncInfoToObservableBridge.cs" />
- <Compile Include="IEventPatternSource.cs" />
- <Compile Include="Linq\WindowsObservable.StandardSequenceOperators.cs" />
- <Compile Include="Linq\WindowsObservable.Events.cs" />
- <Compile Include="Properties\AssemblyInfo.cs" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\System.Reactive.Core\System.Reactive.Core.csproj">
- <Project>{4E516F10-DA7A-4D43-963E-A93865ABEA5B}</Project>
- <Name>System.Reactive.Core</Name>
- </ProjectReference>
- <ProjectReference Include="..\System.Reactive.Interfaces\System.Reactive.Interfaces.csproj">
- <Project>{9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}</Project>
- <Name>System.Reactive.Interfaces</Name>
- </ProjectReference>
- <ProjectReference Include="..\System.Reactive.Linq\System.Reactive.Linq.csproj">
- <Project>{63252ae9-5186-45ca-bfcd-fa51c6b66a43}</Project>
- <Name>System.Reactive.Linq</Name>
- </ProjectReference>
- </ItemGroup>
- <Import Project="..\Import.targets" />
-</Project> \ No newline at end of file
diff --git a/Rx.NET/Test.ruleset b/Rx.NET/Test.ruleset
deleted file mode 100644
index 0761dee..0000000
--- a/Rx.NET/Test.ruleset
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<RuleSet Name="New Rule Set" Description=" " ToolsVersion="10.0">
- <Rules AnalyzerId="Microsoft.Analyzers.ManagedCodeAnalysis" RuleNamespace="Microsoft.Rules.Managed">
- <Rule Id="CA2212" Action="Warning" />
- </Rules>
-</RuleSet> \ No newline at end of file
diff --git a/Rx.NET/Tests.System.Reactive/App.cs b/Rx.NET/Tests.System.Reactive/App.cs
deleted file mode 100644
index 4ed3c16..0000000
--- a/Rx.NET/Tests.System.Reactive/App.cs
+++ /dev/null
@@ -1,48 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if SILVERLIGHT && !SILVERLIGHTM7
-using System;
-using System.Diagnostics;
-using System.Windows;
-using System.Windows.Browser;
-using Microsoft.Silverlight.Testing;
-
-namespace ReactiveTests
-{
- public class App : Application
- {
- public App()
- {
- this.Startup += (o, e) =>
- {
- // TODO: Investigate UnitTestSettings configuration of TestService and LogProviders.
- // var settings = new UnitTestSettings { StartRunImmediately = true };
- RootVisual = UnitTestSystem.CreateTestPage(/* settings */);
- };
-
- this.UnhandledException += (o, e) =>
- {
- if (!Debugger.IsAttached)
- {
- e.Handled = true;
- Deployment.Current.Dispatcher.BeginInvoke(delegate { ReportErrorToDOM(e); });
- }
- };
- }
-
- private void ReportErrorToDOM(ApplicationUnhandledExceptionEventArgs e)
- {
- try
- {
- string errorMsg = e.ExceptionObject.Message + e.ExceptionObject.StackTrace;
- errorMsg = errorMsg.Replace('"', '\'').Replace("\r\n", @"\n");
-
- HtmlPage.Window.Eval("throw new Error(\"Unhandled Error in Silverlight Application " + errorMsg + "\");");
- }
- catch (Exception)
- {
- }
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/Tests.System.Reactive/DispatcherHelpers.cs b/Rx.NET/Tests.System.Reactive/DispatcherHelpers.cs
deleted file mode 100644
index 2eefed5..0000000
--- a/Rx.NET/Tests.System.Reactive/DispatcherHelpers.cs
+++ /dev/null
@@ -1,68 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System;
-using System.Threading;
-using System.Windows.Threading;
-
-namespace ReactiveTests
-{
- static class DispatcherHelpers
- {
- public static DispatcherWrapper EnsureDispatcher()
- {
-#if DESKTOPCLR
- var dispatcher = new Thread(Dispatcher.Run);
- dispatcher.IsBackground = true;
- dispatcher.Start();
-
- while (Dispatcher.FromThread(dispatcher) == null)
- Thread.Sleep(10);
-
- var d = Dispatcher.FromThread(dispatcher);
-
- while (d.BeginInvoke(new Action(() => { })).Status == DispatcherOperationStatus.Aborted) ;
-
- return new DispatcherWrapper(d);
-#else
- return new DispatcherWrapper(System.Windows.Deployment.Current.Dispatcher);
-#endif
- }
- }
-
- class DispatcherWrapper
- {
- private Dispatcher _dispatcher;
-
- public DispatcherWrapper(Dispatcher dispatcher)
- {
- _dispatcher = dispatcher;
- }
-
- public Dispatcher Dispatcher { get { return _dispatcher; } }
-
- public void InvokeShutdown()
- {
-#if !USE_SL_DISPATCHER
- _dispatcher.InvokeShutdown();
-#endif
- }
-
- public static implicit operator Dispatcher(DispatcherWrapper wrapper)
- {
- return wrapper._dispatcher;
- }
-
-#if !USE_SL_DISPATCHER
- public event DispatcherUnhandledExceptionEventHandler UnhandledException
- {
- add { _dispatcher.UnhandledException += value; }
- remove { _dispatcher.UnhandledException -= value; }
- }
-#endif
-
- public void BeginInvoke(Action action)
- {
- _dispatcher.BeginInvoke(action);
- }
- }
-}
diff --git a/Rx.NET/Tests.System.Reactive/Dummies/DummyDisposable.cs b/Rx.NET/Tests.System.Reactive/Dummies/DummyDisposable.cs
deleted file mode 100644
index 335bf43..0000000
--- a/Rx.NET/Tests.System.Reactive/Dummies/DummyDisposable.cs
+++ /dev/null
@@ -1,16 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System;
-
-namespace ReactiveTests.Dummies
-{
- class DummyDisposable : IDisposable
- {
- public static readonly DummyDisposable Instance = new DummyDisposable();
-
- public void Dispose()
- {
- throw new NotImplementedException();
- }
- }
-}
diff --git a/Rx.NET/Tests.System.Reactive/Dummies/DummyEnumerable.cs b/Rx.NET/Tests.System.Reactive/Dummies/DummyEnumerable.cs
deleted file mode 100644
index 0abcbd6..0000000
--- a/Rx.NET/Tests.System.Reactive/Dummies/DummyEnumerable.cs
+++ /dev/null
@@ -1,45 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System;
-using System.Collections.Generic;
-
-namespace ReactiveTests.Dummies
-{
- class DummyEnumerable<T> : IEnumerable<T>
- {
- public static readonly DummyEnumerable<T> Instance = new DummyEnumerable<T>();
-
- private DummyEnumerable()
- {
- }
-
- public IEnumerator<T> GetEnumerator()
- {
- throw new NotImplementedException();
- }
-
- System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
- {
- throw new NotImplementedException();
- }
- }
-
- class NullEnumeratorEnumerable<T> : IEnumerable<T>
- {
- public static readonly NullEnumeratorEnumerable<T> Instance = new NullEnumeratorEnumerable<T>();
-
- private NullEnumeratorEnumerable()
- {
- }
-
- public IEnumerator<T> GetEnumerator()
- {
- return null;
- }
-
- System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
- {
- return GetEnumerator();
- }
- }
-}
diff --git a/Rx.NET/Tests.System.Reactive/Dummies/DummyFunc.cs b/Rx.NET/Tests.System.Reactive/Dummies/DummyFunc.cs
deleted file mode 100644
index c0d3dc2..0000000
--- a/Rx.NET/Tests.System.Reactive/Dummies/DummyFunc.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System;
-
-namespace ReactiveTests.Dummies
-{
- static class DummyFunc<T>
- {
- public static readonly Func<T> Instance = () => { throw new NotImplementedException(); };
- }
-
- static class DummyFunc<T, U>
- {
- public static readonly Func<T, U> Instance = t => { throw new NotImplementedException(); };
- }
-
- static class DummyFunc<T, U, V>
- {
- public static readonly Func<T, U, V> Instance = (t, u) => { throw new NotImplementedException(); };
- }
-
- static class DummyAction
- {
- public static readonly Action Instance = () => { throw new NotImplementedException(); };
- }
-
- static class DummyAction<T>
- {
- public static readonly Action<T> Instance = t => { throw new NotImplementedException(); };
- }
-
- static class DummyAction<T, U>
- {
- public static readonly Action<T, U> Instance = (t, u) => { throw new NotImplementedException(); };
- }
-}
diff --git a/Rx.NET/Tests.System.Reactive/Dummies/DummyObservable.cs b/Rx.NET/Tests.System.Reactive/Dummies/DummyObservable.cs
deleted file mode 100644
index 53ef9a8..0000000
--- a/Rx.NET/Tests.System.Reactive/Dummies/DummyObservable.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System;
-
-namespace ReactiveTests.Dummies
-{
- class DummyObservable<T> : IObservable<T>
- {
- public static readonly DummyObservable<T> Instance = new DummyObservable<T>();
-
- DummyObservable()
- {
- }
-
- public IDisposable Subscribe(IObserver<T> observer)
- {
- throw new NotImplementedException();
- }
- }
-}
diff --git a/Rx.NET/Tests.System.Reactive/Dummies/DummyObserver.cs b/Rx.NET/Tests.System.Reactive/Dummies/DummyObserver.cs
deleted file mode 100644
index 2a909f8..0000000
--- a/Rx.NET/Tests.System.Reactive/Dummies/DummyObserver.cs
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System;
-
-namespace ReactiveTests.Dummies
-{
- class DummyObserver<T> : IObserver<T>
- {
- public static readonly DummyObserver<T> Instance = new DummyObserver<T>();
-
- DummyObserver()
- {
- }
-
- public void OnNext(T value)
- {
- throw new NotImplementedException();
- }
-
- public void OnError(Exception exception)
- {
- throw new NotImplementedException();
- }
-
- public void OnCompleted()
- {
- throw new NotImplementedException();
- }
- }
-}
diff --git a/Rx.NET/Tests.System.Reactive/Dummies/DummyScheduler.cs b/Rx.NET/Tests.System.Reactive/Dummies/DummyScheduler.cs
deleted file mode 100644
index ae269a9..0000000
--- a/Rx.NET/Tests.System.Reactive/Dummies/DummyScheduler.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System;
-using System.Reactive.Concurrency;
-
-namespace ReactiveTests.Dummies
-{
- class DummyScheduler : IScheduler
- {
- public static readonly DummyScheduler Instance = new DummyScheduler();
-
- DummyScheduler()
- {
- }
-
- public DateTimeOffset Now
- {
- get { return DateTimeOffset.MinValue; }
- }
-
- public IDisposable Schedule<TState>(TState state, Func<IScheduler, TState, IDisposable> action)
- {
- throw new NotImplementedException();
- }
-
- public IDisposable Schedule<TState>(TState state, TimeSpan dueTime, Func<IScheduler, TState, IDisposable> action)
- {
- throw new NotImplementedException();
- }
-
- public IDisposable Schedule<TState>(TState state, DateTimeOffset dueTime, Func<IScheduler, TState, IDisposable> action)
- {
- throw new NotImplementedException();
- }
- }
-}
diff --git a/Rx.NET/Tests.System.Reactive/Extensions.cs b/Rx.NET/Tests.System.Reactive/Extensions.cs
deleted file mode 100644
index 9ed942b..0000000
--- a/Rx.NET/Tests.System.Reactive/Extensions.cs
+++ /dev/null
@@ -1,39 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System;
-using System.Collections.Generic;
-using System.Reactive.Concurrency;
-using System.Reactive.Disposables;
-using Microsoft.Reactive.Testing;
-
-namespace ReactiveTests
-{
- public static class Extensions
- {
- //public static IDisposable ScheduleAbsolute(this TestScheduler scheduler, long time, Action action)
- //{
- // return scheduler.ScheduleAbsolute(default(object), time, (scheduler1, state1) => { action(); return Disposable.Empty; });
- //}
-
- //public static IDisposable ScheduleRelative(this TestScheduler scheduler, long time, Action action)
- //{
- // return scheduler.ScheduleRelative(default(object), time, (scheduler1, state1) => { action(); return Disposable.Empty; });
- //}
-
- public static void EnsureTrampoline(this CurrentThreadScheduler scheduler, Action action)
- {
- if (scheduler.ScheduleRequired)
- scheduler.Schedule(action);
- else
- action();
- }
-
- public static IEnumerable<R> Zip<T1, T2, R>(this IEnumerable<T1> source1, IEnumerable<T2> source2, Func<T1, T2, R> f)
- {
- using (var e1 = source1.GetEnumerator())
- using (var e2 = source2.GetEnumerator())
- while (e1.MoveNext() && e2.MoveNext())
- yield return f(e1.Current, e2.Current);
- }
- }
-}
diff --git a/Rx.NET/Tests.System.Reactive/MockDisposable.cs b/Rx.NET/Tests.System.Reactive/MockDisposable.cs
deleted file mode 100644
index c068ff4..0000000
--- a/Rx.NET/Tests.System.Reactive/MockDisposable.cs
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using Microsoft.Reactive.Testing;
-
-namespace ReactiveTests
-{
- public class MockDisposable : List<long>, IDisposable
- {
- TestScheduler scheduler;
-
- public MockDisposable(TestScheduler scheduler)
- {
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
-
- this.scheduler = scheduler;
- Add(scheduler.Clock);
- }
-
- public void Dispose()
- {
- Add(scheduler.Clock);
- }
- }
-}
diff --git a/Rx.NET/Tests.System.Reactive/MockEnumerable.cs b/Rx.NET/Tests.System.Reactive/MockEnumerable.cs
deleted file mode 100644
index 7d91052..0000000
--- a/Rx.NET/Tests.System.Reactive/MockEnumerable.cs
+++ /dev/null
@@ -1,97 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System.Collections.Generic;
-using System.Reactive.Concurrency;
-using Microsoft.Reactive.Testing;
-using System;
-
-namespace ReactiveTests
-{
- public class MockEnumerable<T> : IEnumerable<T>
- {
- public readonly TestScheduler Scheduler;
- public readonly List<Subscription> Subscriptions = new List<Subscription>();
-
- IEnumerable<T> underlyingEnumerable;
-
- public MockEnumerable(TestScheduler scheduler, IEnumerable<T> underlyingEnumerable)
- {
- if (scheduler == null)
- throw new ArgumentNullException("scheduler");
- if (underlyingEnumerable == null)
- throw new ArgumentNullException("underlyingEnumerable");
-
- this.Scheduler = scheduler;
- this.underlyingEnumerable = underlyingEnumerable;
- }
-
- public IEnumerator<T> GetEnumerator()
- {
- return new MockEnumerator(Scheduler, Subscriptions, underlyingEnumerable.GetEnumerator());
- }
-
- System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
- {
- return GetEnumerator();
- }
-
- class MockEnumerator : IEnumerator<T>
- {
- List<Subscription> subscriptions;
- IEnumerator<T> enumerator;
- TestScheduler scheduler;
- int index;
- bool disposed = false;
-
- public MockEnumerator(TestScheduler scheduler, List<Subscription> subscriptions, IEnumerator<T> enumerator)
- {
- this.subscriptions = subscriptions;
- this.enumerator = enumerator;
- this.scheduler = scheduler;
-
- index = subscriptions.Count;
- subscriptions.Add(new Subscription(scheduler.Clock));
- }
-
- public T Current
- {
- get
- {
- if (disposed)
- throw new ObjectDisposedException("this");
- return enumerator.Current;
- }
- }
-
- public void Dispose()
- {
- if (!disposed)
- {
- disposed = true;
- enumerator.Dispose();
- subscriptions[index] = new Subscription(subscriptions[index].Subscribe, scheduler.Clock);
- }
- }
-
- object System.Collections.IEnumerator.Current
- {
- get { return Current; }
- }
-
- public bool MoveNext()
- {
- if (disposed)
- throw new ObjectDisposedException("this");
- return enumerator.MoveNext();
- }
-
- public void Reset()
- {
- if (disposed)
- throw new ObjectDisposedException("this");
- enumerator.Reset();
- }
- }
-
- }
-}
diff --git a/Rx.NET/Tests.System.Reactive/NullErrorObservable.cs b/Rx.NET/Tests.System.Reactive/NullErrorObservable.cs
deleted file mode 100644
index 401d636..0000000
--- a/Rx.NET/Tests.System.Reactive/NullErrorObservable.cs
+++ /dev/null
@@ -1,25 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System.Reactive.Disposables;
-using System;
-
-namespace ReactiveTests
-{
- public class NullErrorObservable<T> : IObservable<T>
- {
- public static NullErrorObservable<T> Instance = new NullErrorObservable<T>();
-
- private NullErrorObservable()
- {
- }
-
- public IDisposable Subscribe(IObserver<T> observer)
- {
- if (observer == null)
- throw new ArgumentNullException("observer");
-
- observer.OnError(null);
- return Disposable.Empty;
- }
- }
-}
diff --git a/Rx.NET/Tests.System.Reactive/Properties/AppManifest.xml b/Rx.NET/Tests.System.Reactive/Properties/AppManifest.xml
deleted file mode 100644
index 71b66f8..0000000
--- a/Rx.NET/Tests.System.Reactive/Properties/AppManifest.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-<Deployment xmlns="http://schemas.microsoft.com/client/2007/deployment"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
->
- <Deployment.Parts>
- </Deployment.Parts>
-
-</Deployment>
diff --git a/Rx.NET/Tests.System.Reactive/Properties/AssemblyInfo.cs b/Rx.NET/Tests.System.Reactive/Properties/AssemblyInfo.cs
deleted file mode 100644
index 42157e7..0000000
--- a/Rx.NET/Tests.System.Reactive/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,23 +0,0 @@
-using System;
-using System.Reflection;
-using System.Resources;
-using System.Runtime.InteropServices;
-
-[assembly: AssemblyTitle("Tests.System.Reactive")]
-[assembly: AssemblyDescription("Unit tests for Reactive Extensions product assemblies.")]
-#if DEBUG
-[assembly: AssemblyConfiguration("Debug")]
-#else
-[assembly: AssemblyConfiguration("Retail")]
-#endif
-[assembly: AssemblyCompany("Microsoft Corporation")]
-[assembly: AssemblyProduct("Reactive Extensions")]
-[assembly: AssemblyCopyright("\x00a9 Microsoft Corporation. All rights reserved.")]
-[assembly: NeutralResourcesLanguage("en-US")]
-
-[assembly: ComVisible(false)]
-
-//
-// Note: Assembly (file) version numbers get inserted by the build system on the fly. Inspect the Team Build workflows
-// and the custom activity in Source/Build/Activities/AppendVersionInfo.cs for more information.
-//
diff --git a/Rx.NET/Tests.System.Reactive/Semaphore.cs b/Rx.NET/Tests.System.Reactive/Semaphore.cs
deleted file mode 100644
index 471672c..0000000
--- a/Rx.NET/Tests.System.Reactive/Semaphore.cs
+++ /dev/null
@@ -1,116 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if SILVERLIGHT
-using System;
-
-namespace System.Threading
-{
- //Monitor based implementation of Semaphore
- //that mimicks the .NET Semaphore class (System.Threading.Semaphore)
-
- internal sealed class Semaphore : IDisposable
- {
- private int m_currentCount;
- private int m_maximumCount;
- private object m_lockObject;
- private bool m_disposed;
-
- public Semaphore(int initialCount, int maximumCount)
- {
- if (initialCount < 0)
- {
- throw new ArgumentOutOfRangeException("initialCount", "Non-negative number required.");
- }
- if (maximumCount < 1)
- {
- throw new ArgumentOutOfRangeException("maximumCount", "Positive number required.");
- }
- if (initialCount > maximumCount)
- {
- throw new ArgumentException("Initial count must be smaller than maximum");
- }
-
- m_currentCount = initialCount;
- m_maximumCount = maximumCount;
- m_lockObject = new object();
- }
-
- public int Release()
- {
- return this.Release(1);
- }
-
- public int Release(int releaseCount)
- {
- if (releaseCount < 1)
- {
- throw new ArgumentOutOfRangeException("releaseCount", "Positive number required.");
- }
- if (m_disposed)
- {
- throw new ObjectDisposedException("Semaphore");
- }
-
- var oldCount = default(int);
- lock (m_lockObject)
- {
- oldCount = m_currentCount;
- if (releaseCount + m_currentCount > m_maximumCount)
- {
- throw new ArgumentOutOfRangeException("releaseCount", "Amount of releases would overflow maximum");
- }
- m_currentCount += releaseCount;
- //PulseAll makes sure all waiting threads get queued for acquiring the lock
- //Pulse would only queue one thread.
-
- Monitor.PulseAll(m_lockObject);
- }
- return oldCount;
- }
-
- public bool WaitOne()
- {
- return WaitOne(Timeout.Infinite);
- }
-
- public bool WaitOne(int millisecondsTimeout)
- {
- if (m_disposed)
- {
- throw new ObjectDisposedException("Semaphore");
- }
-
- lock (m_lockObject)
- {
- while (m_currentCount == 0)
- {
- if (!Monitor.Wait(m_lockObject, millisecondsTimeout))
- {
- return false;
- }
- }
- m_currentCount--;
- return true;
- }
- }
-
- public bool WaitOne(TimeSpan timeout)
- {
- return WaitOne((int)timeout.TotalMilliseconds);
- }
-
- public void Close()
- {
- Dispose();
- }
-
- public void Dispose()
- {
- //the .NET CLR semaphore does not release waits upon dispose
- //so we don't do that either.
- m_disposed = true;
- m_lockObject = null;
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/Tests.System.Reactive/Stress/Core/Disposables/Composite.cs b/Rx.NET/Tests.System.Reactive/Stress/Core/Disposables/Composite.cs
deleted file mode 100644
index eccb08f..0000000
--- a/Rx.NET/Tests.System.Reactive/Stress/Core/Disposables/Composite.cs
+++ /dev/null
@@ -1,159 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if STRESS
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Reactive.Disposables;
-using System.Reflection;
-using System.Threading;
-
-namespace ReactiveTests.Stress.Disposables
-{
- public class Composite
- {
- /// <summary>
- /// Allocates a CompositeDisposable and performs random Add and Remove operations. Checks that all contained disposables get properly disposed.
- /// The CompositeDisposable is disposed either at the start, at the end, or at a random time.
- /// </summary>
- public static void Potpourri()
- {
- Console.Title = MethodInfo.GetCurrentMethod().Name + " - 0% complete";
-
- for (int i = 1; i <= 100; i++)
- {
- for (int j = 0; j < 10; j++)
- {
- DisposeBeforeAddRemove();
- DisposeDuringAddRemove();
- DisposeDuringAddRemove();
- DisposeDuringAddRemove();
- DisposeAfterAddRemove();
- }
-
- Console.Title = MethodInfo.GetCurrentMethod().Name + " - " + i + "% complete";
- }
- }
-
- /// <summary>
- /// Allocates a CompositeDisposable and performs random Add and Remove operations. Checks that all contained disposables get properly disposed.
- /// The CompositeDisposable is disposed at the start.
- /// </summary>
- public static void DisposeBeforeAddRemove()
- {
- Impl(0);
- }
-
- /// <summary>
- /// Allocates a CompositeDisposable and performs random Add and Remove operations. Checks that all contained disposables get properly disposed.
- /// The CompositeDisposable is disposed at a random time.
- /// </summary>
- public static void DisposeDuringAddRemove()
- {
- Impl(1);
- }
-
- /// <summary>
- /// Allocates a CompositeDisposable and performs random Add and Remove operations. Checks that all contained disposables get properly disposed.
- /// The CompositeDisposable is disposed at the end.
- /// </summary>
- public static void DisposeAfterAddRemove()
- {
- Impl(2);
- }
-
- static void Impl(int disposeAt)
- {
- var rand = new Random();
-
- var g = new CompositeDisposable();
-
- Console.Write("Dispose @ = {0} - ", disposeAt);
-
- if (disposeAt == 0)
- {
- g.Dispose();
- Console.Write("{GD} ");
- }
-
- if (disposeAt == 1)
- {
- var sleep = rand.Next(0, 5) > 1 /* 60% chance */ ? rand.Next(2, 1000) : 0;
-
- ThreadPool.QueueUserWorkItem(_ =>
- {
- Helpers.SleepOrSpin(sleep);
- g.Dispose();
- Console.Write("{GD} ");
- });
- }
-
- var n = rand.Next(0, 1000);
- var cd = new CountdownEvent(n);
-
- var ds = Enumerable.Range(0, n).Select(_ => Disposable.Create(() => cd.Signal())).ToArray();
-
- var m = rand.Next(1, 100);
- var jobs = ds.GroupBy(_ => rand.Next() % m).Select(Enumerable.ToList).ToList();
-
- Console.Write("N = {0}, M = {1} - ", n, m);
-
- var done = new CountdownEvent(jobs.Count);
-
- foreach (var job in jobs)
- {
- var sleep = rand.Next(0, 10) == 0 /* 10% chance */ ? rand.Next(2, 100) : 0;
- var sleepAt = Enumerable.Range(0, rand.Next(0, job.Count) / rand.Next(1, 100)).ToArray();
- var sleeps = sleepAt.Select(_ => rand.Next(0, 50)).ToArray();
-
- var rem = rand.Next(0, 3) == 0; /* 33% chance */
- var remAt = rand.Next(0, 10) == 0 /* 10% chance */ ? rand.Next(2, 100) : 0;
-
- var mine = job;
- ThreadPool.QueueUserWorkItem(_ =>
- {
- Helpers.SleepOrSpin(sleep);
-
- var j = 0;
- foreach (var d in mine)
- {
- var dd = d;
-
- if (sleepAt.Contains(j))
- Helpers.SleepOrSpin(sleeps[j]);
-
- g.Add(dd);
- Console.Write("+");
-
- if (rem)
- {
- ThreadPool.QueueUserWorkItem(__ =>
- {
- Helpers.SleepOrSpin(remAt);
- g.Remove(dd);
- Console.Write("-");
- });
- }
-
- j++;
- }
-
- done.Signal();
- });
- }
-
- done.Wait();
-
- if (disposeAt == 2)
- {
- g.Dispose();
- Console.Write("{GD} ");
- }
-
- cd.Wait();
-
- Console.WriteLine(".");
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/Tests.System.Reactive/Stress/Core/Disposables/RefCount.cs b/Rx.NET/Tests.System.Reactive/Stress/Core/Disposables/RefCount.cs
deleted file mode 100644
index f2364a8..0000000
--- a/Rx.NET/Tests.System.Reactive/Stress/Core/Disposables/RefCount.cs
+++ /dev/null
@@ -1,160 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if STRESS
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Linq;
-using System.Reactive.Disposables;
-using System.Reflection;
-using System.Threading;
-
-namespace ReactiveTests.Stress.Disposables
-{
- public class RefCount
- {
- /// <summary>
- /// Disposes the primary disposable first, allocates a number of dependents on different threads, and disposes them on different threads.
- /// Ref count should reach zero, and the inner disposable should be called.
- /// </summary>
- public static void PrimaryFirst_DependentsTrigger()
- {
- Console.Title = MethodInfo.GetCurrentMethod().Name + " - 0% complete";
-
- var rnd = new Random();
-
- for (int i = 1; i <= 100; i++)
- {
- Impl(true, false, new[] { 0, 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024 });
- Impl(true, false, new[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 });
- Impl(true, false, Enumerable.Range(0, 10).Select(_ => rnd.Next(0, 1000)));
-
- Console.Title = MethodInfo.GetCurrentMethod().Name + " - " + i + "% complete";
- }
- }
-
- /// <summary>
- /// Allocates a number of dependents on different threads, disposes them on different threads, and disposes the primary disposable last.
- /// Ref count should reach zero, and the inner disposable should be called.
- /// </summary>
- public static void DependentsFirst_PrimaryTrigger()
- {
- Console.Title = MethodInfo.GetCurrentMethod().Name + " - 0% complete";
-
- var rnd = new Random();
-
- for (int i = 1; i <= 100; i++)
- {
- Impl(false, false, new[] { 0, 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024 });
- Impl(false, false, new[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 });
- Impl(false, false, Enumerable.Range(0, 10).Select(_ => rnd.Next(0, 1000)));
-
- Console.Title = MethodInfo.GetCurrentMethod().Name + " - " + i + "% complete";
- }
- }
-
- /// <summary>
- /// Allocates a number of dependents on different threads, disposes them on different threads, and disposes the primary disposable at a random time.
- /// Ref count should reach zero, and the inner disposable should be called.
- /// </summary>
- public static void DependentsFirst_PrimaryRandom()
- {
- Console.Title = MethodInfo.GetCurrentMethod().Name + " - 0% complete";
-
- var rnd = new Random();
-
- for (int i = 1; i <= 100; i++)
- {
- Impl(false, true, new[] { 0, 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024 });
- Impl(false, true, new[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 });
- Impl(false, true, Enumerable.Range(0, 10).Select(_ => rnd.Next(0, 1000)));
-
- Console.Title = MethodInfo.GetCurrentMethod().Name + " - " + i + "% complete";
- }
- }
-
- private static void Impl(bool primaryFirst, bool primaryRandom, IEnumerable<int> nDependents)
- {
- var rand = new Random();
-
- foreach (var n in nDependents)
- {
- var e = new ManualResetEvent(false);
- var hasDependent = new ManualResetEvent(false);
- var r = new RefCountDisposable(Disposable.Create(() => { e.Set(); }));
-
- var d = default(IDisposable);
- if (primaryFirst)
- {
- d = r.GetDisposable();
- r.Dispose();
- }
- else if (primaryRandom)
- {
- var sleep = rand.Next(0, 10) == 0 /* 10% chance */ ? rand.Next(2, 100) : 0;
-
- ThreadPool.QueueUserWorkItem(_ =>
- {
- hasDependent.WaitOne();
- Helpers.SleepOrSpin(sleep);
- r.Dispose();
- });
-
- if (n == 0)
- hasDependent.Set();
- }
-
- Console.Write(n + " - ");
-
- var cd = new CountdownEvent(n * 2);
- for (int i = 0; i < n; i++)
- {
- var j = i;
-
- var sleep1 = rand.Next(0, 10) == 0 /* 10% chance */ ? rand.Next(2, 100) : 0;
- var sleep2 = rand.Next(0, 10) == 0 /* 10% chance */ ? rand.Next(2, 100) : 0;
- var sleep3 = rand.Next(0, 10) == 0 /* 10% chance */ ? rand.Next(2, 100) : 0;
-
- ThreadPool.QueueUserWorkItem(_ =>
- {
- Helpers.SleepOrSpin(sleep1);
-
- Console.Write("+");
-
- var f = r.GetDisposable();
-
- if (j == 0)
- hasDependent.Set();
-
- Helpers.SleepOrSpin(sleep2);
-
- ThreadPool.QueueUserWorkItem(__ =>
- {
- Helpers.SleepOrSpin(sleep3);
-
- f.Dispose();
-
- Console.Write("-");
-
- cd.Signal();
- });
-
- cd.Signal();
- });
- }
-
- cd.Wait();
-
- if (primaryFirst)
- d.Dispose();
- else if (!primaryRandom)
- r.Dispose();
-
- e.WaitOne();
-
- Console.WriteLine(".");
- }
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/Tests.System.Reactive/Stress/Core/Disposables/Serial.cs b/Rx.NET/Tests.System.Reactive/Stress/Core/Disposables/Serial.cs
deleted file mode 100644
index a9b87d1..0000000
--- a/Rx.NET/Tests.System.Reactive/Stress/Core/Disposables/Serial.cs
+++ /dev/null
@@ -1,147 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if STRESS
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Reactive.Disposables;
-using System.Reflection;
-using System.Threading;
-
-namespace ReactiveTests.Stress.Disposables
-{
- public class Serial
- {
- /// <summary>
- /// Allocates a SerialDisposable and performs random assignment operations. Checks that all contained disposables get properly disposed.
- /// The SerialDisposable is disposed either at the start, at the end, or at a random time.
- /// </summary>
- public static void RandomAssignAndDispose()
- {
- Console.Title = MethodInfo.GetCurrentMethod().Name + " - 0% complete";
-
- for (int i = 1; i <= 100; i++)
- {
- for (int j = 0; j < 10; j++)
- {
- DisposeBeforeAssign();
- DisposeDuringAssign();
- DisposeDuringAssign();
- DisposeDuringAssign();
- DisposeAfterAssign();
- }
-
- Console.Title = MethodInfo.GetCurrentMethod().Name + " - " + i + "% complete";
- }
- }
-
- /// <summary>
- /// Allocates a SerialDisposable and performs random assignment operations. Checks that all contained disposables get properly disposed.
- /// The SerialDisposable is disposed at the start.
- /// </summary>
- public static void DisposeBeforeAssign()
- {
- Impl(0);
- }
-
- /// <summary>
- /// Allocates a SerialDisposable and performs random assignment operations. Checks that all contained disposables get properly disposed.
- /// The SerialDisposable is disposed at a random time.
- /// </summary>
- public static void DisposeDuringAssign()
- {
- Impl(1);
- }
-
- /// <summary>
- /// Allocates a SerialDisposable and performs random assignment operations. Checks that all contained disposables get properly disposed.
- /// The SerialDisposable is disposed at the end.
- /// </summary>
- public static void DisposeAfterAssign()
- {
- Impl(2);
- }
-
- static void Impl(int disposeAt)
- {
- var rand = new Random();
-
- var s = new SerialDisposable();
-
- Console.Write("Dispose @ = {0} - ", disposeAt);
-
- if (disposeAt == 0)
- {
- s.Dispose();
- Console.Write("{SD} ");
- }
-
- if (disposeAt == 1)
- {
- var sleep = rand.Next(0, 5) > 1 /* 60% chance */ ? rand.Next(2, 1000) : 0;
-
- ThreadPool.QueueUserWorkItem(_ =>
- {
- Helpers.SleepOrSpin(sleep);
- s.Dispose();
- Console.Write("{SD} ");
- });
- }
-
- var n = rand.Next(0, 1000);
- var cd = new CountdownEvent(n);
-
- var ds = Enumerable.Range(0, n).Select(_ => Disposable.Create(() => cd.Signal())).ToArray();
-
- var m = rand.Next(1, 100);
- var jobs = ds.GroupBy(_ => rand.Next() % m).Select(Enumerable.ToList).ToList();
-
- Console.Write("N = {0}, M = {1} - ", n, m);
-
- var done = new CountdownEvent(jobs.Count);
-
- foreach (var job in jobs)
- {
- var sleep = rand.Next(0, 10) == 0 /* 10% chance */ ? rand.Next(2, 100) : 0;
- var sleepAt = Enumerable.Range(0, rand.Next(0, job.Count) / rand.Next(1, 100)).ToArray();
- var sleeps = sleepAt.Select(_ => rand.Next(0, 50)).ToArray();
-
- var rem = rand.Next(0, 3) == 0; /* 33% chance */
- var remAt = rand.Next(0, 10) == 0 /* 10% chance */ ? rand.Next(2, 100) : 0;
-
- var mine = job;
- ThreadPool.QueueUserWorkItem(_ =>
- {
- Helpers.SleepOrSpin(sleep);
-
- var j = 0;
- foreach (var d in mine)
- {
- if (sleepAt.Contains(j))
- Helpers.SleepOrSpin(sleeps[j]);
-
- s.Disposable = d;
- Console.Write("+");
-
- j++;
- }
-
- done.Signal();
- });
- }
-
- done.Wait();
-
- if (disposeAt == 2)
- {
- s.Dispose();
- Console.Write("{SD} ");
- }
-
- cd.Wait();
-
- Console.WriteLine(".");
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/Tests.System.Reactive/Stress/Core/Disposables/SingleAssignment.cs b/Rx.NET/Tests.System.Reactive/Stress/Core/Disposables/SingleAssignment.cs
deleted file mode 100644
index b558a98..0000000
--- a/Rx.NET/Tests.System.Reactive/Stress/Core/Disposables/SingleAssignment.cs
+++ /dev/null
@@ -1,75 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if STRESS
-using System;
-using System.Reactive.Disposables;
-using System.Reflection;
-using System.Threading;
-
-namespace ReactiveTests.Stress.Disposables
-{
- public class SingleAssignment
- {
- /// <summary>
- /// Allocates a SingleAssignmentDisposable and assigns a disposable object at a random time. Also disposes the container at a random time.
- /// Expected behavior is to see the assigned disposable getting disposed no matter what.
- /// </summary>
- public static void RandomAssignAndDispose()
- {
- Console.Title = MethodInfo.GetCurrentMethod().Name + " - 0% complete";
-
- for (int i = 1; i <= 100; i++)
- {
- for (int j = 0; j < 10; j++)
- {
- Impl();
- }
-
- Console.Title = MethodInfo.GetCurrentMethod().Name + " - " + i + "% complete";
- }
- }
-
- private static void Impl()
- {
- var rand = new Random();
-
- for (int i = 0; i < 1000; i++)
- {
- var d = new SingleAssignmentDisposable();
- var e = new ManualResetEvent(false);
- var cd = new CountdownEvent(2);
-
- var sleep1 = rand.Next(0, 1) == 0 ? 0 : rand.Next(2, 100);
- var sleep2 = rand.Next(0, 1) == 0 ? 0 : rand.Next(2, 100);
-
- ThreadPool.QueueUserWorkItem(_ =>
- {
- Helpers.SleepOrSpin(sleep1);
-
- Console.Write("{DB} ");
- d.Dispose();
- Console.Write("{DE} ");
-
- cd.Signal();
- });
-
- ThreadPool.QueueUserWorkItem(_ =>
- {
- Helpers.SleepOrSpin(sleep2);
-
- Console.Write("{AB} ");
- d.Disposable = Disposable.Create(() => e.Set());
- Console.Write("{AE} ");
-
- cd.Signal();
- });
-
- e.WaitOne();
- cd.Wait();
-
- Console.WriteLine(".");
- }
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/Tests.System.Reactive/Stress/Helpers.cs b/Rx.NET/Tests.System.Reactive/Stress/Helpers.cs
deleted file mode 100644
index 9ec5bbb..0000000
--- a/Rx.NET/Tests.System.Reactive/Stress/Helpers.cs
+++ /dev/null
@@ -1,216 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if STRESS
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Threading;
-using System.Linq;
-
-namespace ReactiveTests.Stress
-{
- public static class Helpers
- {
- public static void RunWithMemoryPressure(int minBytes, int maxBytes, double activePercent, Action a)
- {
- var started = new ManualResetEvent(false);
- var stopped = 0;
-
- var avg = (minBytes + maxBytes) / 2;
- var MIN = avg / 1000;
- var MAX = avg / 10;
-
- var allocator = new Thread(() =>
- {
- var rand = new Random();
- var roots = new List<byte[]>();
- var bytes = 0;
-
- while (bytes < avg)
- {
- var n = rand.Next(MIN, MAX);
- bytes += n;
- roots.Add(new byte[n]);
- }
-
- started.Set();
-
- long avgSum = 0;
- long count = 0;
-
- const int DEC = 0;
- const int INC = 1;
-
- var trendPhase = 0;
- var trendLength = 0;
-
- while (Thread.VolatileRead(ref stopped) == 0)
- {
- if (trendLength-- == 0)
- {
- trendPhase = rand.Next(0, 1000) % 2;
- trendLength = rand.Next(1, 10);
- }
-
- var mem = TimeSpan.Zero;
-
- var sw = Stopwatch.StartNew();
-
- var busy = new Stopwatch();
-
- while (Thread.VolatileRead(ref stopped) == 0 && (double)mem.Ticks / (double)sw.ElapsedTicks < activePercent)
- {
- busy.Restart();
-
- var runFor = rand.Next(10, 100);
- while (busy.ElapsedMilliseconds < runFor)
- {
- if (trendPhase == INC)
- {
- if (bytes < maxBytes)
- {
- var n = rand.Next(MIN, MAX);
- bytes += n;
- roots.Add(new byte[n]);
- continue;
- }
- else
- {
- trendPhase = DEC;
- }
- }
-
- if (trendPhase == DEC)
- {
- if (bytes > minBytes)
- {
- if (roots.Count > 0)
- {
- var i = rand.Next(0, roots.Count);
- bytes -= roots[i].Length;
- roots.RemoveAt(i);
- }
- continue;
- }
- else
- {
- trendPhase = INC;
- }
- }
- }
-
- mem += busy.Elapsed;
- }
-
- var sleepFor = rand.Next(100, 1000);
- Thread.Sleep(sleepFor);
-
- avgSum += bytes;
- count++;
- //Console.WriteLine(bytes + " - Avg = " + avgSum / count);
- }
- });
-
- allocator.Start();
- started.WaitOne();
-
- try
- {
- a();
- }
- finally
- {
- Interlocked.Exchange(ref stopped, 1);
- allocator.Join();
- }
- }
-
- public static void RunWithProcessorPressure(int threadCount, int lockCount, double activePercent, double lockChancePercent, Action a)
- {
- var stopped = 0;
- var started = new CountdownEvent(threadCount);
-
- var ts = new Thread[threadCount];
- var locks = Enumerable.Range(0, lockCount).Select(_ => new object()).ToArray();
-
- for (int i = 0; i < threadCount; i++)
- {
- var id = i;
-
- var t = ts[i] = new Thread(() =>
- {
- var rand = new Random();
-
- started.Signal();
-
- var sw = Stopwatch.StartNew();
- var run = TimeSpan.Zero;
-
- while (Thread.VolatileRead(ref stopped) == 0)
- {
- var busy = new Stopwatch();
-
- while (Thread.VolatileRead(ref stopped) == 0 && (double)run.Ticks / (double)sw.ElapsedTicks < activePercent)
- {
- busy.Restart();
-
- const int RUN = 0;
- const int BLOCK = 1;
-
- var action = lockCount > 0 && rand.Next() % 100 <= lockChancePercent * 100 ? BLOCK : RUN;
-
- switch (action)
- {
- case RUN:
- //Console.WriteLine("~" + id);
- while (busy.ElapsedMilliseconds < 10)
- ;
- break;
- case BLOCK:
- //Console.WriteLine("!" + id);
- lock (locks[rand.Next(0, lockCount)])
- Thread.Sleep(rand.Next(100, 1000));
- break;
- }
-
- run += busy.Elapsed;
- }
-
- Thread.Sleep(rand.Next(100, 1000));
- }
- });
-
- t.Start();
- }
-
- started.Wait();
-
- try
- {
- a();
- }
- finally
- {
- Interlocked.Exchange(ref stopped, 1);
- foreach (var t in ts)
- t.Join();
- }
- }
-
- public static void SleepOrSpin(int ms)
- {
- if (ms == 0)
- return;
-
- if (ms % 2 == 0)
- {
- var sw = Stopwatch.StartNew();
- while (sw.Elapsed.TotalMilliseconds < ms)
- ;
- }
- else
- Thread.Sleep(ms);
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/Tests.System.Reactive/Stress/Linq/Delay.cs b/Rx.NET/Tests.System.Reactive/Stress/Linq/Delay.cs
deleted file mode 100644
index 8f3c8c0..0000000
--- a/Rx.NET/Tests.System.Reactive/Stress/Linq/Delay.cs
+++ /dev/null
@@ -1,64 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System;
-using System.Reactive.Concurrency;
-using System.Reactive.Linq;
-
-namespace ReactiveTests.Stress.Linq
-{
- public class Delay
- {
- /// <summary>
- /// Tests OnError messages are propagated all the time.
- /// </summary>
- public static void Errors()
- {
- while (true)
- {
- foreach (var N in new[] { 1, 10, 100, 1000, 10000, 100000 })
- {
- Console.WriteLine("N = {0}", N);
- foreach (var d in new[] { 1, 10, 20, 50, 100, 200, 250, 500 })
- {
- try
- {
- var ex = new Exception();
- Observable.Range(0, N, NewThreadScheduler.Default).Concat(Observable.Throw<int>(ex)).Delay(TimeSpan.FromMilliseconds(d), NewThreadScheduler.Default).Count().Wait();
- }
- catch (Exception)
- {
- Console.Write(".");
- continue;
- }
-
- throw new InvalidOperationException("Didn't throw!");
- }
- Console.WriteLine();
- }
- }
- }
-
- /// <summary>
- /// Tests no OnNext messages are lost.
- /// </summary>
- public static void OnNextMessages()
- {
- while (true)
- {
- foreach (var N in new[] { 1, 10, 100, 1000, 10000, 100000 })
- {
- Console.WriteLine("N = {0}", N);
- foreach (var d in new[] { 1, 10, 20, 50, 100, 200, 250, 500 })
- {
- var n = Observable.Range(0, N, NewThreadScheduler.Default).Delay(TimeSpan.FromMilliseconds(d), NewThreadScheduler.Default).Count().Wait();
- if (n != N)
- throw new InvalidOperationException("Lost OnNext message!");
-
- Console.Write(".");
- }
- Console.WriteLine();
- }
- }
- }
- }
-}
diff --git a/Rx.NET/Tests.System.Reactive/Stress/Linq/FromEvent.cs b/Rx.NET/Tests.System.Reactive/Stress/Linq/FromEvent.cs
deleted file mode 100644
index f867795..0000000
--- a/Rx.NET/Tests.System.Reactive/Stress/Linq/FromEvent.cs
+++ /dev/null
@@ -1,412 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if STRESS
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Reactive.Disposables;
-using System.Reactive.Linq;
-using System.Reflection;
-using System.Threading;
-
-namespace ReactiveTests.Stress.Linq
-{
- public class FromEvent
- {
- private static Lazy<Random> s_rand = new Lazy<Random>();
-
- /// <summary>
- /// Multiple threads are subscribing to a FromEventPattern sequence and disposing their subscriptions.
- /// While this is going on, one consumer does not want to be disturbed while receiving the sequence.
- ///
- /// Runs a set of combinations of the RefCount_* tests.
- /// </summary>
- public static void RefCount_Mix()
- {
- Console.Title = MethodInfo.GetCurrentMethod().Name + " - 0% complete";
-
- for (int i = 1; i <= 100; i++)
- {
- var repeatCount = 10;
-
- foreach (var msgCount in new[] { 100, 1000, 10000, 100000 })
- {
- // concurrency level {10, 20, ..., 100}
- RefCount_ConcurrencyLevel_Linear(msgCount, repeatCount, 10, 100, 10);
-
- // concurrency level {100, 200, ..., 1000}
- RefCount_ConcurrencyLevel_Linear(msgCount, repeatCount, 100, 1000, 100);
-
- // concurrency level {1, 2, 4, ..., 65536}
- RefCount_ConcurrencyLevel_Exponential(msgCount, repeatCount, 1, 65536, 2);
- }
-
- foreach (var maxMsgCount in new[] { 10, 100, 1000, 10000, 100000 })
- {
- foreach (var maxConcurrency in new[] { 10, 100, 1000, 10000, 100000 })
- {
- RefCount_Rand(repeatCount, maxMsgCount, maxConcurrency);
- }
- }
-
- Console.Title = MethodInfo.GetCurrentMethod().Name + " - " + i + "% complete";
- }
- }
-
- /// <summary>
- /// Multiple threads are subscribing to a FromEventPattern sequence and disposing their subscriptions.
- /// While this is going on, one consumer does not want to be disturbed while receiving the sequence.
- /// Subscriptions are happening on the ThreadPool, possibly causing (expected) time gaps.
- ///
- /// Runs a set of combinations of the RefCount_* tests.
- /// </summary>
- public static void RefCountWithPost_Mix()
- {
- Console.Title = MethodInfo.GetCurrentMethod().Name + " - 0% complete";
-
- for (int i = 1; i <= 100; i++)
- {
- var repeatCount = 10;
-
- foreach (var msgCount in new[] { 100, 1000, 10000, 100000 })
- {
- // concurrency level {10, 20, ..., 100}
- RefCountWithPost_ConcurrencyLevel_Linear(msgCount, repeatCount, 10, 100, 10);
-
- // concurrency level {100, 200, ..., 1000}
- RefCountWithPost_ConcurrencyLevel_Linear(msgCount, repeatCount, 100, 1000, 100);
-
- // concurrency level {1, 2, 4, ..., 65536}
- RefCountWithPost_ConcurrencyLevel_Exponential(msgCount, repeatCount, 1, 65536, 2);
- }
-
- foreach (var maxMsgCount in new[] { 10, 100, 1000, 10000, 100000 })
- {
- foreach (var maxConcurrency in new[] { 10, 100, 1000, 10000, 100000 })
- {
- RefCountWithPost_Rand(repeatCount, maxMsgCount, maxConcurrency);
- }
- }
-
- Console.Title = MethodInfo.GetCurrentMethod().Name + " - " + i + "% complete";
- }
- }
-
- /// <summary>
- /// Multiple threads are subscribing to a FromEventPattern sequence and disposing their subscriptions.
- /// While this is going on, one consumer does not want to be disturbed while receiving the sequence.
- ///
- /// Uses random parameters for the number of messages and the level of concurrency.
- /// </summary>
- /// <param name="n">Number of iterations.</param>
- /// <param name="maxN">Maximum number of message.</param>
- /// <param name="maxM">Maximum level of concurrency.</param>
- public static void RefCount_Rand(int n, int maxN, int maxM)
- {
- RefCount_(RefCount_Rand_Params(n, maxN, maxM));
- }
-
- /// <summary>
- /// Multiple threads are subscribing to a FromEventPattern sequence and disposing their subscriptions.
- /// While this is going on, one consumer does not want to be disturbed while receiving the sequence.
- /// Subscriptions are happening on the ThreadPool, possibly causing (expected) time gaps.
- ///
- /// Uses random parameters for the number of messages and the level of concurrency.
- /// </summary>
- /// <param name="n">Number of iterations.</param>
- /// <param name="maxN">Maximum number of message.</param>
- /// <param name="maxM">Maximum level of concurrency.</param>
- public static void RefCountWithPost_Rand(int n, int maxN, int maxM)
- {
- RefCountWithPost_(RefCount_Rand_Params(n, maxN, maxM));
- }
-
- private static IEnumerable<Tuple<int, int>> RefCount_Rand_Params(int n, int maxN, int maxM)
- {
- for (int i = 0; i < n; i++)
- {
- var N = s_rand.Value.Next(1, maxN);
- var M = s_rand.Value.Next(1, maxM);
-
- yield return new Tuple<int, int>(N, M);
- }
- }
-
- /// <summary>
- /// Multiple threads are subscribing to a FromEventPattern sequence and disposing their subscriptions.
- /// While this is going on, one consumer does not want to be disturbed while receiving the sequence.
- ///
- /// Uses linear increments for the concurrency level.
- /// </summary>
- /// <param name="N">Number of messages.</param>
- /// <param name="n">Number of iterations.</param>
- /// <param name="min">Minimum level of concurrency.</param>
- /// <param name="max">Maximum level of concurrency.</param>
- /// <param name="step">Additive step size to increase level of concurrency.</param>
- public static void RefCount_ConcurrencyLevel_Linear(int N, int n, int min, int max, int step)
- {
- RefCount_(RefCount_ConcurrencyLevel_Linear_Params(N, n, min, max, step));
- }
-
- /// <summary>
- /// Multiple threads are subscribing to a FromEventPattern sequence and disposing their subscriptions.
- /// While this is going on, one consumer does not want to be disturbed while receiving the sequence.
- /// Subscriptions are happening on the ThreadPool, possibly causing (expected) time gaps.
- ///
- /// Uses linear increments for the concurrency level.
- /// </summary>
- /// <param name="N">Number of messages.</param>
- /// <param name="n">Number of iterations.</param>
- /// <param name="min">Minimum level of concurrency.</param>
- /// <param name="max">Maximum level of concurrency.</param>
- /// <param name="step">Additive step size to increase level of concurrency.</param>
- public static void RefCountWithPost_ConcurrencyLevel_Linear(int N, int n, int min, int max, int step)
- {
- RefCountWithPost_(RefCount_ConcurrencyLevel_Linear_Params(N, n, min, max, step));
- }
-
- private static IEnumerable<Tuple<int, int>> RefCount_ConcurrencyLevel_Linear_Params(int N, int n, int min, int max, int step)
- {
- for (int i = 0; i < n; i++)
- {
- for (int M = min; M <= max; M += step)
- {
- yield return new Tuple<int, int>(N, M);
- }
- }
- }
-
- /// <summary>
- /// Multiple threads are subscribing to a FromEventPattern sequence and disposing their subscriptions.
- /// While this is going on, one consumer does not want to be disturbed while receiving the sequence.
- ///
- /// Uses exponential increments for the concurrency level.
- /// </summary>
- /// <param name="N">Number of messages.</param>
- /// <param name="n">Number of iterations.</param>
- /// <param name="min">Minimum level of concurrency.</param>
- /// <param name="max">Maximum level of concurrency.</param>
- /// <param name="step">Multiplicative step size to increase level of concurrency.</param>
- public static void RefCount_ConcurrencyLevel_Exponential(int N, int n, int min, int max, int step)
- {
- RefCount_(RefCount_ConcurrencyLevel_Exponential_Params(N, n, min, max, step));
- }
-
- /// <summary>
- /// Multiple threads are subscribing to a FromEventPattern sequence and disposing their subscriptions.
- /// While this is going on, one consumer does not want to be disturbed while receiving the sequence.
- /// Subscriptions are happening on the ThreadPool, possibly causing (expected) time gaps.
- ///
- /// Uses exponential increments for the concurrency level.
- /// </summary>
- /// <param name="N">Number of messages.</param>
- /// <param name="n">Number of iterations.</param>
- /// <param name="min">Minimum level of concurrency.</param>
- /// <param name="max">Maximum level of concurrency.</param>
- /// <param name="step">Multiplicative step size to increase level of concurrency.</param>
- public static void RefCountWithPost_ConcurrencyLevel_Exponential(int N, int n, int min, int max, int step)
- {
- RefCountWithPost_(RefCount_ConcurrencyLevel_Exponential_Params(N, n, min, max, step));
- }
-
- private static IEnumerable<Tuple<int, int>> RefCount_ConcurrencyLevel_Exponential_Params(int N, int n, int min, int max, int step)
- {
- for (int i = 0; i < n; i++)
- {
- for (int M = min; M <= max; M *= step)
- {
- yield return new Tuple<int, int>(N, M);
- }
- }
- }
-
- private static void RefCount_(IEnumerable<Tuple<int, int>> parameters)
- {
- foreach (var p in parameters)
- {
- var N = p.Item1;
- var M = p.Item2;
-
- Console.Write("N = {0}, M = {1} - ", N, M);
-
- var bar = new Bar();
-
- var foo = Observable.FromEventPattern<FooEventArgs>(h => { Console.Write("+"); bar.Foo += h; }, h => { bar.Foo -= h; Console.Write("-"); });
-
- var res = new List<int>();
- var n = 0;
- var e = new ManualResetEvent(false);
-
- var cd = new CountdownEvent(M * 2);
- for (int i = 0; i < M; i++)
- {
- var f = new SingleAssignmentDisposable();
-
- ThreadPool.QueueUserWorkItem(_ =>
- {
- f.Disposable = foo.Subscribe(__ => { Console.Write("!"); });
- cd.Signal();
- });
-
- ThreadPool.QueueUserWorkItem(_ =>
- {
- f.Dispose();
- cd.Signal();
- });
- }
-
- Console.Write("{SB}");
-
- var d = foo.Subscribe(x =>
- {
- //Console.Write("&");
-
- if (++n == N)
- e.Set();
-
- res.Add(x.EventArgs.Qux);
- });
-
- Console.Write("{SE}");
-
- var t = new Thread(() =>
- {
- Console.Write("{TB}");
-
- for (int i = 0; i < N; i++)
- bar.OnFoo(i);
-
- Console.Write("{TE}");
- });
-
- t.Start();
- t.Join();
-
- cd.Wait();
-
- e.WaitOne();
- d.Dispose();
-
- if (!res.SequenceEqual(Enumerable.Range(0, N)))
- {
- Console.WriteLine("Panic!");
- break;
- }
-
- Console.WriteLine(".");
- }
- }
-
- private static void RefCountWithPost_(IEnumerable<Tuple<int, int>> parameters)
- {
- var worker = new Thread(() =>
- {
- SynchronizationContext.SetSynchronizationContext(new MySyncCtx());
-
- foreach (var p in parameters)
- {
- var N = p.Item1;
- var M = p.Item2;
-
- Console.Write("N = {0}, M = {1} - ", N, M);
-
- var bar = new Bar();
-
- var foo = Observable.FromEventPattern<FooEventArgs>(h => { /*Console.Write("+");*/ bar.Foo += h; }, h => { bar.Foo -= h; /*Console.Write("-"); */});
-
- var e = new ManualResetEvent(false);
-
- var cd = new CountdownEvent(M * 2);
- for (int i = 0; i < M; i++)
- {
- var f = new SingleAssignmentDisposable();
-
- ThreadPool.QueueUserWorkItem(_ =>
- {
- f.Disposable = foo.Subscribe(__ => { /*Console.Write("!");*/ });
- cd.Signal();
- });
-
- ThreadPool.QueueUserWorkItem(_ =>
- {
- f.Dispose();
- cd.Signal();
- });
- }
-
- var hasObserved = 0;
-
- Console.Write("{SB}");
-
- var d = foo.Subscribe(x =>
- {
- //
- // [on BARTDE-M6500 with CPU and RAM pressure]
- //
- // Up to 8K concurrent observers, we typically don't see a time gap (expected worst-case behavior).
- // The code below uses an event to check the desired behavior of eventually tuning in to the event stream.
- //
- Console.Write("&" + x.EventArgs.Qux);
- e.Set();
- Interlocked.Exchange(ref hasObserved, 1);
- });
-
- Console.Write("{SE}");
-
- var t = new Thread(() =>
- {
- Console.Write("{TB}");
-
- var i = 0;
- while (Thread.VolatileRead(ref hasObserved) == 0)
- bar.OnFoo(i++);
-
- Console.Write("{TE}");
- });
-
- t.Start();
- t.Join();
-
- cd.Wait();
-
- e.WaitOne();
- d.Dispose();
-
- Console.WriteLine(".");
- }
- });
-
- worker.Start();
- worker.Join();
- }
-
- class Bar
- {
- public event EventHandler<FooEventArgs> Foo;
-
- public void OnFoo(int x)
- {
- var foo = Foo;
- if (foo != null)
- foo(this, new FooEventArgs { Qux = x });
- }
- }
-
- class FooEventArgs : EventArgs
- {
- public int Qux { get; set; }
- }
-
- class MySyncCtx : SynchronizationContext
- {
- public override void Post(SendOrPostCallback d, object state)
- {
- ThreadPool.QueueUserWorkItem(_ =>
- {
- d(state);
- });
- }
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/Tests.System.Reactive/Stress/Linq/Replay.cs b/Rx.NET/Tests.System.Reactive/Stress/Linq/Replay.cs
deleted file mode 100644
index d9f8256..0000000
--- a/Rx.NET/Tests.System.Reactive/Stress/Linq/Replay.cs
+++ /dev/null
@@ -1,57 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if STRESS
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Reactive.Concurrency;
-using System.Threading;
-using System.Reactive.Linq;
-
-namespace ReactiveTests.Stress.Linq
-{
- public class Replay
- {
- /// <summary>
- /// Tests the Replay operator with different schedulers, supporting ISchedulerLongRunning and otherwise.
- /// Stresses the ScheduledObserver implementation with its counting logic.
- /// </summary>
- public static void DifferentSchedulers()
- {
- while (true)
- {
- for (int i = 100; i <= 10000; i *= 10)
- {
- foreach (var s in new IScheduler[] { Scheduler.Default, TaskPoolScheduler.Default, ThreadPoolScheduler.Instance })
- {
- foreach (var b in new[] { true, false })
- {
- var t = b ? s : s.DisableOptimizations();
-
- var e = new ManualResetEvent(false);
- var xs = Observable.Range(0, i, TaskPoolScheduler.Default.DisableOptimizations()).Do(_ => { }, () => e.Set());
-
- var ys = xs.Replay(t);
-
- var f = new ManualResetEvent(false);
- var r = new List<int>();
- ys.Subscribe(r.Add, () => f.Set());
-
- ys.Connect();
-
- e.WaitOne();
- f.WaitOne();
-
- if (!r.SequenceEqual(Enumerable.Range(0, i)))
- throw new Exception();
-
- Console.Write(".");
- }
- }
- }
- }
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/Tests.System.Reactive/TestBase.cs b/Rx.NET/Tests.System.Reactive/TestBase.cs
deleted file mode 100644
index fa7ed14..0000000
--- a/Rx.NET/Tests.System.Reactive/TestBase.cs
+++ /dev/null
@@ -1,79 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading;
-
-namespace ReactiveTests
-{
-#if SILVERLIGHT && !SILVERLIGHTM7
- public class TestBase : Microsoft.Silverlight.Testing.SilverlightTest
- {
- public void RunAsync(Action<Waiter> a)
- {
- EnqueueCallback(() =>
- {
- var w = new Waiter(TestComplete);
- a(w);
- w.Wait();
- });
- }
-
- public void CompleteAsync()
- {
- EnqueueTestComplete();
- }
- }
-
- public class Waiter
- {
- private Action _complete;
-
- public Waiter(Action complete)
- {
- _complete = complete;
- }
-
- public void Set()
- {
- _complete();
- }
-
- public void Wait()
- {
- }
- }
-#else
- public class TestBase
- {
- public void RunAsync(Action<Waiter> a)
- {
- var w = new Waiter();
- a(w);
- w.Wait();
- }
- }
-
- public class Waiter
- {
- private ManualResetEvent _evt = new ManualResetEvent(false);
-
- public void Set()
- {
- _evt.Set();
- }
-
- public void Wait()
- {
- _evt.WaitOne();
- }
- }
-
- [AttributeUsage(AttributeTargets.Method)]
- public class AsynchronousAttribute : Attribute
- {
- }
-#endif
-}
diff --git a/Rx.NET/Tests.System.Reactive/TestLongRunningScheduler.cs b/Rx.NET/Tests.System.Reactive/TestLongRunningScheduler.cs
deleted file mode 100644
index f9545a8..0000000
--- a/Rx.NET/Tests.System.Reactive/TestLongRunningScheduler.cs
+++ /dev/null
@@ -1,89 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System;
-using System.Reactive.Concurrency;
-using System.Reactive.Disposables;
-using System.Threading;
-
-namespace ReactiveTests
-{
- class TestLongRunningScheduler : IScheduler, ISchedulerLongRunning, IServiceProvider
- {
- private Action<ManualResetEvent> _setStart;
- private Action<ManualResetEvent> _setEnd;
- private Action<Exception> _setException;
-
- public TestLongRunningScheduler(Action<ManualResetEvent> setStart, Action<ManualResetEvent> setEnd)
- : this(setStart, setEnd, null)
- {
- }
-
- public TestLongRunningScheduler(Action<ManualResetEvent> setStart, Action<ManualResetEvent> setEnd, Action<Exception> setException)
- {
- _setStart = setStart;
- _setEnd = setEnd;
- _setException = setException;
- }
-
- public DateTimeOffset Now
- {
- get { return DateTimeOffset.Now; }
- }
-
- public IDisposable Schedule<TState>(TState state, Func<IScheduler, TState, IDisposable> action)
- {
- throw new NotImplementedException();
- }
-
- public IDisposable Schedule<TState>(TState state, TimeSpan dueTime, Func<IScheduler, TState, IDisposable> action)
- {
- throw new NotImplementedException();
- }
-
- public IDisposable Schedule<TState>(TState state, DateTimeOffset dueTime, Func<IScheduler, TState, IDisposable> action)
- {
- throw new NotImplementedException();
- }
-
- public IDisposable ScheduleLongRunning<TState>(TState state, Action<TState, ICancelable> action)
- {
- var d = new BooleanDisposable();
-
- var eb = new ManualResetEvent(false);
- _setStart(eb);
-
- var ee = new ManualResetEvent(false);
- _setEnd(ee);
-
- new Thread(() =>
- {
- eb.Set();
- try
- {
- action(state, d);
- }
- catch (Exception ex)
- {
- if (_setException == null)
- throw;
-
- _setException(ex);
- }
- finally
- {
- ee.Set();
- }
- }).Start();
-
- return d;
- }
-
- object IServiceProvider.GetService(Type serviceType)
- {
- if (serviceType == typeof(ISchedulerLongRunning))
- return this;
-
- return null;
- }
- }
-}
diff --git a/Rx.NET/Tests.System.Reactive/TestTaskScheduler.cs b/Rx.NET/Tests.System.Reactive/TestTaskScheduler.cs
deleted file mode 100644
index 858b640..0000000
--- a/Rx.NET/Tests.System.Reactive/TestTaskScheduler.cs
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_TPL
-using System.Collections.Generic;
-using System.Threading.Tasks;
-
-namespace ReactiveTests
-{
- class TestTaskScheduler : TaskScheduler
- {
- protected override void QueueTask(Task task)
- {
- TryExecuteTaskInline(task, false);
- }
-
- protected override bool TryExecuteTaskInline(Task task, bool taskWasPreviouslyQueued)
- {
- return TryExecuteTask(task);
- }
-
- protected override IEnumerable<Task> GetScheduledTasks()
- {
- return null;
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/Tests.System.Reactive/Tests.System.Reactive.csproj b/Rx.NET/Tests.System.Reactive/Tests.System.Reactive.csproj
deleted file mode 100644
index b8c4484..0000000
--- a/Rx.NET/Tests.System.Reactive/Tests.System.Reactive.csproj
+++ /dev/null
@@ -1,192 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{2FEFC068-E2DE-43A9-A4E6-E0336A532B7A}</ProjectGuid>
- <OutputType>Library</OutputType>
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <RootNamespace>ReactiveTests</RootNamespace>
- <AssemblyName>Tests.System.Reactive</AssemblyName>
- <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
- <FileAlignment>512</FileAlignment>
- <ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
- <CodeAnalysisRuleSet>..\Test.ruleset</CodeAnalysisRuleSet>
- <NoWarn>618</NoWarn>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'ReleaseXBLV|AnyCPU'">
- <OutputPath>bin\ReleaseXBLV\</OutputPath>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'DebugXBLV|AnyCPU'">
- <OutputPath>bin\DebugXBLV\</OutputPath>
- </PropertyGroup>
- <Import Project="..\Common.targets" />
- <PropertyGroup Condition="'$(BuildPlatform)' == 'SILVERLIGHT' AND !('$(BuildFlavor)' == 'SILVERLIGHTM7')">
- <SilverlightApplication>true</SilverlightApplication>
- <XapOutputs>true</XapOutputs>
- <XapFilename>$(AssemblyName).xap</XapFilename>
- <GenerateSilverlightManifest>true</GenerateSilverlightManifest>
- <SilverlightManifestTemplate>Properties\AppManifest.xml</SilverlightManifestTemplate>
- <SilverlightAppEntry>ReactiveTests.App</SilverlightAppEntry>
- <TestPageFileName>TestPage.html</TestPageFileName>
- <CreateTestPage>true</CreateTestPage>
- </PropertyGroup>
- <!-- Temporary workaround to disable tests as part of automated builds (defeating the **\Tests*.dll the search pattern). -->
- <PropertyGroup Condition="'$(BuildPlatform)' != 'DESKTOPCLR'">
- <AssemblyName>_$(AssemblyName)</AssemblyName>
- </PropertyGroup>
- <ItemGroup>
- <!-- See readme.txt file in the References\$(BuildFlavor) folder for information on the test assemblies used here. -->
- <Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework" />
- <Reference Include="mscorlib" Condition=" '$(BuildPlatform)' == 'SILVERLIGHT' Or '$(BuildPlatform)' == 'XNA' " />
- <Reference Include="System" />
- <Reference Include="System.Core" />
- <Reference Include="System.Observable" Condition=" '$(BuildFlavor)' == 'SILVERLIGHTM7' " />
- <Reference Include="System.Windows" Condition=" '$(BuildPlatform)' == 'SILVERLIGHT' " />
- <Reference Include="System.Windows.Browser" Condition=" '$(BuildPlatform)' == 'SILVERLIGHT' AND !('$(BuildFlavor)' == 'SILVERLIGHTM7')" />
- <Reference Include="Microsoft.Silverlight.Testing" Condition=" '$(BuildPlatform)' == 'SILVERLIGHT' AND !('$(BuildFlavor)' == 'SILVERLIGHTM7')">
- <Private>true</Private>
- </Reference>
- <Reference Include="System.Windows.Forms" Condition=" '$(BuildPlatform)' == 'DESKTOPCLR' " />
- <Reference Include="WindowsBase" Condition=" '$(BuildPlatform)' == 'DESKTOPCLR' " />
- </ItemGroup>
- <ItemGroup>
- <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
- <Visible>False</Visible>
- </CodeAnalysisDependentAssemblyPaths>
- </ItemGroup>
- <ItemGroup>
- <Compile Include="App.cs" />
- <Compile Include="DispatcherHelpers.cs" />
- <Compile Include="Semaphore.cs" />
- <Compile Include="Stress\Core\Disposables\Composite.cs">
- <SubType>Code</SubType>
- </Compile>
- <Compile Include="Stress\Core\Disposables\Serial.cs" />
- <Compile Include="Stress\Core\Disposables\SingleAssignment.cs" />
- <Compile Include="Stress\Core\Disposables\RefCount.cs" />
- <Compile Include="Stress\Linq\Delay.cs" />
- <Compile Include="Stress\Linq\FromEvent.cs" />
- <Compile Include="Stress\Helpers.cs" />
- <Compile Include="Stress\Linq\Replay.cs" />
- <Compile Include="TestBase.cs" />
- <Compile Include="TestLongRunningScheduler.cs" />
- <Compile Include="Tests\AnonymousTest.cs" />
- <Compile Include="Tests\AsyncLockTest.cs" />
- <Compile Include="Tests\ConcurrencyTest.cs" />
- <Compile Include="Tests\ConnectableObservable.cs" />
- <Compile Include="Tests\ConnectableObservableTest.cs" />
- <Compile Include="Tests\ControlSchedulerTest.cs" />
- <Compile Include="Tests\ObservableExTest.cs" />
- <Compile Include="Tests\ObservableSafetyTest.cs" />
- <Compile Include="Tests\QbservableExTest.cs" />
- <Compile Include="Tests\RogueEnumerable.cs" />
- <Compile Include="Tests\ScheduledItemTest.cs" />
- <Compile Include="Tests\StopwatchTest.cs" />
- <Compile Include="Tests\SystemClockTest.cs" />
- <Compile Include="Tests\DefaultConcurrencyAbstractionLayerTest.cs" />
- <Compile Include="Tests\EventPatternSourceBaseTest.cs" />
- <Compile Include="Tests\SynchronizationTest.cs" />
- <Compile Include="Tests\DefaultSchedulerTest.cs" />
- <Compile Include="Tests\CurrentThreadSchedulerTest.cs" />
- <Compile Include="Tests\DispatcherSchedulerTest.cs" />
- <Compile Include="Tests\DisposableTests.cs" />
- <Compile Include="Tests\EventLoopSchedulerTest.cs" />
- <Compile Include="Tests\HistoricalSchedulerTest.cs" />
- <Compile Include="Tests\ImmediateSchedulerTest.cs" />
- <Compile Include="Tests\MySubject.cs" />
- <Compile Include="Tests\NewThreadSchedulerTest.cs" />
- <Compile Include="Tests\NotificationTest.cs" />
- <Compile Include="Tests\ObservableEventsTest.cs" />
- <Compile Include="Tests\ObservableImperativeTest.cs" />
- <Compile Include="Tests\SchedulerTest.cs" />
- <Compile Include="Tests\SynchronizationContextSchedulerTest.cs" />
- <Compile Include="Tests\TaskObservableExtensionsTest.cs" />
- <Compile Include="Tests\TaskPoolSchedulerTest.cs" />
- <Compile Include="Tests\ThreadPoolSchedulerTest.cs" />
- <Compile Include="Tests\TimeTests.cs" />
- <Compile Include="Tests\UnitTest.cs" />
- <Compile Include="Tests\VirtualSchedulerTest.cs" />
- <Compile Include="Dummies\DummyDisposable.cs" />
- <Compile Include="Dummies\DummyEnumerable.cs" />
- <Compile Include="Dummies\DummyFunc.cs" />
- <Compile Include="Dummies\DummyObservable.cs" />
- <Compile Include="Dummies\DummyObserver.cs" />
- <Compile Include="Dummies\DummyScheduler.cs" />
- <Compile Include="Extensions.cs" />
- <Compile Include="MockDisposable.cs" />
- <Compile Include="MockEnumerable.cs" />
- <Compile Include="NullErrorObservable.cs" />
- <Compile Include="Properties\AssemblyInfo.cs" />
- <Compile Include="Tests\AsyncSubjectTest.cs" />
- <Compile Include="Tests\BehaviorSubjectTest.cs" />
- <Compile Include="Tests\SubjectTest.cs" />
- <Compile Include="Tests\ListObservableTest.cs" />
- <Compile Include="Tests\ObservableAggregateTest.cs" />
- <Compile Include="Tests\ObservableAsyncTest.cs" />
- <Compile Include="Tests\ObservableAwaiterTest.cs" />
- <Compile Include="Tests\ObservableBindingTest.cs" />
- <Compile Include="Tests\ObservableBlockingTest.cs" />
- <Compile Include="Tests\ObservableConcurrencyTest.cs" />
- <Compile Include="Tests\ObservableConversionTests.cs" />
- <Compile Include="Tests\ObservableCreationTest.cs" />
- <Compile Include="Tests\ObservableExtensionsTest.cs" />
- <Compile Include="Tests\ObservableJoinsTest.cs" />
- <Compile Include="Tests\ObservableMultipleTest.cs" />
- <Compile Include="Tests\ObservableRemotingTest.cs" />
- <Compile Include="Tests\ObservableSingleTest.cs" />
- <Compile Include="Tests\ObservableStandardQueryOperatorTest.cs" />
- <Compile Include="Tests\ObservableTimeTest.cs" />
- <Compile Include="Tests\ObserverTest.cs" />
- <Compile Include="Tests\PrivateTypesTest.cs" />
- <Compile Include="Tests\QbservableTest.cs" />
- <Compile Include="Tests\RegressionTest.cs" />
- <Compile Include="Tests\ReplaySubjectTest.cs" />
- <Compile Include="TestTaskScheduler.cs" />
- <Compile Include="Utils.cs" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\Microsoft.Reactive.Testing\Microsoft.Reactive.Testing.csproj">
- <Project>{E7B7408B-B039-4F30-B6CF-CC06218CE4CA}</Project>
- <Name>Microsoft.Reactive.Testing</Name>
- </ProjectReference>
- <ProjectReference Include="..\System.Reactive.Core\System.Reactive.Core.csproj">
- <Project>{4E516F10-DA7A-4D43-963E-A93865ABEA5B}</Project>
- <Name>System.Reactive.Core</Name>
- </ProjectReference>
- <ProjectReference Include="..\System.Reactive.Experimental\System.Reactive.Experimental.csproj">
- <Project>{41E65B96-733B-41C4-A1BB-7476359B89EB}</Project>
- <Name>System.Reactive.Experimental</Name>
- </ProjectReference>
- <ProjectReference Include="..\System.Reactive.Interfaces\System.Reactive.Interfaces.csproj">
- <Project>{9E9B9C60-98B0-40FA-9C2B-1218D417CAA4}</Project>
- <Name>System.Reactive.Interfaces</Name>
- </ProjectReference>
- <ProjectReference Include="..\System.Reactive.PlatformServices\System.Reactive.PlatformServices.csproj">
- <Project>{0CCCF009-763F-40D2-8655-7A94828023BF}</Project>
- <Name>System.Reactive.PlatformServices</Name>
- </ProjectReference>
- <ProjectReference Include="..\System.Reactive.Providers\System.Reactive.Providers.csproj" Condition=" '$(BuildFlavor)' != 'SILVERLIGHTM7' And '$(BuildPlatform)' != 'XNA' ">
- <Project>{C7B9D7BE-F47F-466B-A6B0-E46F1069B171}</Project>
- <Name>System.Reactive.Providers</Name>
- </ProjectReference>
- <ProjectReference Include="..\System.Reactive.Linq\System.Reactive.Linq.csproj">
- <Project>{63252AE9-5186-45CA-BFCD-FA51C6B66A43}</Project>
- <Name>System.Reactive.Linq</Name>
- </ProjectReference>
- <ProjectReference Include="..\System.Reactive.Runtime.Remoting\System.Reactive.Runtime.Remoting.csproj">
- <Project>{7A6EF49E-7946-4101-9C89-407B9C53A173}</Project>
- <Name>System.Reactive.Runtime.Remoting</Name>
- </ProjectReference>
- <ProjectReference Include="..\System.Reactive.Windows.Forms\System.Reactive.Windows.Forms.csproj" Condition=" '$(BuildPlatform)' == 'DESKTOPCLR' ">
- <Project>{E32328A1-1F5B-45F9-B005-02EF5CC2CF0D}</Project>
- <Name>System.Reactive.Windows.Forms</Name>
- </ProjectReference>
- <ProjectReference Include="..\System.Reactive.Windows.Threading\System.Reactive.Windows.Threading.csproj">
- <Project>{2F7D32BD-5BFC-45D4-9899-F1A76DB32FCB}</Project>
- <Name>System.Reactive.Windows.Threading</Name>
- </ProjectReference>
- </ItemGroup>
- <Import Project="..\Import.targets" />
-</Project> \ No newline at end of file
diff --git a/Rx.NET/Tests.System.Reactive/Tests/AnonymousTest.cs b/Rx.NET/Tests.System.Reactive/Tests/AnonymousTest.cs
deleted file mode 100644
index 6da61bb..0000000
--- a/Rx.NET/Tests.System.Reactive/Tests/AnonymousTest.cs
+++ /dev/null
@@ -1,42 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using Microsoft.Reactive.Testing;
-using System.Reactive;
-
-namespace ReactiveTests.Tests
-{
- [TestClass]
- public class AnonymousTest
- {
- [TestMethod]
- public void AnonymousObservable_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => new AnonymousObservable<int>(null));
- }
-
- [TestMethod]
- public void AnonymousObserver_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => new AnonymousObserver<int>(default(Action<int>)));
-
- ReactiveAssert.Throws<ArgumentNullException>(() => new AnonymousObserver<int>(default(Action<int>), () => { }));
- ReactiveAssert.Throws<ArgumentNullException>(() => new AnonymousObserver<int>(x => { }, default(Action)));
-
- ReactiveAssert.Throws<ArgumentNullException>(() => new AnonymousObserver<int>(default(Action<int>), ex => { }));
- ReactiveAssert.Throws<ArgumentNullException>(() => new AnonymousObserver<int>(x => { }, default(Action<Exception>)));
-
- ReactiveAssert.Throws<ArgumentNullException>(() => new AnonymousObserver<int>(default(Action<int>), ex => { }, () => { }));
- ReactiveAssert.Throws<ArgumentNullException>(() => new AnonymousObserver<int>(x => { }, default(Action<Exception>), () => { }));
- ReactiveAssert.Throws<ArgumentNullException>(() => new AnonymousObserver<int>(x => { }, ex => { }, default(Action)));
- }
-
- [TestMethod]
- public void AnonymousObserver_Error_Null()
- {
- var observer = new AnonymousObserver<int>(_ => { }, e => { }, () => { });
- ReactiveAssert.Throws<ArgumentNullException>(() => observer.OnError(null));
- }
- }
-}
diff --git a/Rx.NET/Tests.System.Reactive/Tests/AsyncLockTest.cs b/Rx.NET/Tests.System.Reactive/Tests/AsyncLockTest.cs
deleted file mode 100644
index 6060dae..0000000
--- a/Rx.NET/Tests.System.Reactive/Tests/AsyncLockTest.cs
+++ /dev/null
@@ -1,133 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !SILVERLIGHT // MethodAccessException
-using System;
-using System.Reactive.Concurrency;
-using System.Reflection;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-
-namespace ReactiveTests.Tests
-{
- [TestClass]
- public class AsyncLockTest
- {
- [TestMethod, ExpectedException(typeof(ArgumentNullException))]
- public void Wait_ArgumentChecking()
- {
- var asyncLock = new AsyncLock();
- asyncLock.Wait(null);
- }
-
- [TestMethod]
- public void Wait_Graceful()
- {
- var ok = false;
- new AsyncLock().Wait(() => { ok = true; });
- Assert.IsTrue(ok);
- }
-
- [TestMethod]
- public void Wait_Fail()
- {
- var l = new AsyncLock();
-
- var ex = new Exception();
- try
- {
- l.Wait(() => { throw ex; });
- Assert.Fail();
- }
- catch (Exception e)
- {
- Assert.AreSame(ex, e);
- }
-
- // has faulted; should not run
- l.Wait(() => { Assert.Fail(); });
- }
-
- [TestMethod]
- public void Wait_QueuesWork()
- {
- var l = new AsyncLock();
-
- var l1 = false;
- var l2 = false;
- l.Wait(() => { l.Wait(() => { Assert.IsTrue(l1); l2 = true; }); l1 = true; });
- Assert.IsTrue(l2);
- }
-
- [TestMethod]
- public void Dispose()
- {
- var l = new AsyncLock();
-
- var l1 = false;
- var l2 = false;
- var l3 = false;
- var l4 = false;
-
- l.Wait(() =>
- {
- l.Wait(() =>
- {
- l.Wait(() =>
- {
- l3 = true;
- });
-
- l2 = true;
-
- l.Dispose();
-
- l.Wait(() =>
- {
- l4 = true;
- });
- });
-
- l1 = true;
- });
-
- Assert.IsTrue(l1);
- Assert.IsTrue(l2);
- Assert.IsFalse(l3);
- Assert.IsFalse(l4);
- }
-
- public class AsyncLock
- {
- object instance;
-
- public AsyncLock()
- {
- instance = typeof(Scheduler).Assembly.GetType("System.Reactive.Concurrency.AsyncLock").GetConstructor(new Type[] { }).Invoke(new object[] { });
- }
-
- public void Wait(Action action)
- {
- try
- {
- instance.GetType().GetMethod("Wait").Invoke(instance, new object[] { action });
- }
- catch (TargetInvocationException ex)
- {
- throw ex.InnerException;
- }
- }
-
- public void Dispose()
- {
- try
- {
- instance.GetType().GetMethod("Dispose").Invoke(instance, new object[0]);
- }
- catch (TargetInvocationException ex)
- {
- throw ex.InnerException;
- }
- }
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/Tests.System.Reactive/Tests/AsyncSubjectTest.cs b/Rx.NET/Tests.System.Reactive/Tests/AsyncSubjectTest.cs
deleted file mode 100644
index aeb6193..0000000
--- a/Rx.NET/Tests.System.Reactive/Tests/AsyncSubjectTest.cs
+++ /dev/null
@@ -1,434 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System;
-using System.Reactive.Concurrency;
-using System.Reactive.Subjects;
-using System.Threading;
-using Microsoft.Reactive.Testing;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-
-namespace ReactiveTests.Tests
-{
- [TestClass]
- public partial class AsyncSubjectTest : ReactiveTest
- {
- [TestMethod]
- public void Subscribe_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => new AsyncSubject<int>().Subscribe(null));
- }
-
- [TestMethod]
- public void OnError_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => new AsyncSubject<int>().OnError(null));
- }
-
- [TestMethod]
- public void Infinite()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(70, 1),
- OnNext(110, 2),
- OnNext(220, 3),
- OnNext(270, 4),
- OnNext(340, 5),
- OnNext(410, 6),
- OnNext(520, 7),
- OnNext(630, 8),
- OnNext(710, 9),
- OnNext(870, 10),
- OnNext(940, 11),
- OnNext(1020, 12)
- );
-
- var subject = default(AsyncSubject<int>);
- var subscription = default(IDisposable);
-
- var results1 = scheduler.CreateObserver<int>();
- var subscription1 = default(IDisposable);
-
- var results2 = scheduler.CreateObserver<int>();
- var subscription2 = default(IDisposable);
-
- var results3 = scheduler.CreateObserver<int>();
- var subscription3 = default(IDisposable);
-
- scheduler.ScheduleAbsolute(100, () => subject = new AsyncSubject<int>());
- scheduler.ScheduleAbsolute(200, () => subscription = xs.Subscribe(subject));
- scheduler.ScheduleAbsolute(1000, () => subscription.Dispose());
-
- scheduler.ScheduleAbsolute(300, () => subscription1 = subject.Subscribe(results1));
- scheduler.ScheduleAbsolute(400, () => subscription2 = subject.Subscribe(results2));
- scheduler.ScheduleAbsolute(900, () => subscription3 = subject.Subscribe(results3));
-
- scheduler.ScheduleAbsolute(600, () => subscription1.Dispose());
- scheduler.ScheduleAbsolute(700, () => subscription2.Dispose());
- scheduler.ScheduleAbsolute(800, () => subscription1.Dispose());
- scheduler.ScheduleAbsolute(950, () => subscription3.Dispose());
-
- scheduler.Start();
-
- results1.Messages.AssertEqual(
- );
-
- results2.Messages.AssertEqual(
- );
-
- results3.Messages.AssertEqual(
- );
- }
-
- [TestMethod]
- public void Finite()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(70, 1),
- OnNext(110, 2),
- OnNext(220, 3),
- OnNext(270, 4),
- OnNext(340, 5),
- OnNext(410, 6),
- OnNext(520, 7),
- OnCompleted<int>(630),
- OnNext(640, 9),
- OnCompleted<int>(650),
- OnError<int>(660, new Exception())
- );
-
- var subject = default(AsyncSubject<int>);
- var subscription = default(IDisposable);
-
- var results1 = scheduler.CreateObserver<int>();
- var subscription1 = default(IDisposable);
-
- var results2 = scheduler.CreateObserver<int>();
- var subscription2 = default(IDisposable);
-
- var results3 = scheduler.CreateObserver<int>();
- var subscription3 = default(IDisposable);
-
- scheduler.ScheduleAbsolute(100, () => subject = new AsyncSubject<int>());
- scheduler.ScheduleAbsolute(200, () => subscription = xs.Subscribe(subject));
- scheduler.ScheduleAbsolute(1000, () => subscription.Dispose());
-
- scheduler.ScheduleAbsolute(300, () => subscription1 = subject.Subscribe(results1));
- scheduler.ScheduleAbsolute(400, () => subscription2 = subject.Subscribe(results2));
- scheduler.ScheduleAbsolute(900, () => subscription3 = subject.Subscribe(results3));
-
- scheduler.ScheduleAbsolute(600, () => subscription1.Dispose());
- scheduler.ScheduleAbsolute(700, () => subscription2.Dispose());
- scheduler.ScheduleAbsolute(800, () => subscription1.Dispose());
- scheduler.ScheduleAbsolute(950, () => subscription3.Dispose());
-
- scheduler.Start();
-
- results1.Messages.AssertEqual(
- );
-
- results2.Messages.AssertEqual(
- OnNext(630, 7),
- OnCompleted<int>(630)
- );
-
- results3.Messages.AssertEqual(
- OnNext(900, 7),
- OnCompleted<int>(900)
- );
- }
-
- [TestMethod]
- public void Error()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(70, 1),
- OnNext(110, 2),
- OnNext(220, 3),
- OnNext(270, 4),
- OnNext(340, 5),
- OnNext(410, 6),
- OnNext(520, 7),
- OnError<int>(630, ex),
- OnNext(640, 9),
- OnCompleted<int>(650),
- OnError<int>(660, new Exception())
- );
-
- var subject = default(AsyncSubject<int>);
- var subscription = default(IDisposable);
-
- var results1 = scheduler.CreateObserver<int>();
- var subscription1 = default(IDisposable);
-
- var results2 = scheduler.CreateObserver<int>();
- var subscription2 = default(IDisposable);
-
- var results3 = scheduler.CreateObserver<int>();
- var subscription3 = default(IDisposable);
-
- scheduler.ScheduleAbsolute(100, () => subject = new AsyncSubject<int>());
- scheduler.ScheduleAbsolute(200, () => subscription = xs.Subscribe(subject));
- scheduler.ScheduleAbsolute(1000, () => subscription.Dispose());
-
- scheduler.ScheduleAbsolute(300, () => subscription1 = subject.Subscribe(results1));
- scheduler.ScheduleAbsolute(400, () => subscription2 = subject.Subscribe(results2));
- scheduler.ScheduleAbsolute(900, () => subscription3 = subject.Subscribe(results3));
-
- scheduler.ScheduleAbsolute(600, () => subscription1.Dispose());
- scheduler.ScheduleAbsolute(700, () => subscription2.Dispose());
- scheduler.ScheduleAbsolute(800, () => subscription1.Dispose());
- scheduler.ScheduleAbsolute(950, () => subscription3.Dispose());
-
- scheduler.Start();
-
- results1.Messages.AssertEqual(
- );
-
- results2.Messages.AssertEqual(
- OnError<int>(630, ex)
- );
-
- results3.Messages.AssertEqual(
- OnError<int>(900, ex)
- );
- }
-
- [TestMethod]
- public void Canceled()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnCompleted<int>(630),
- OnNext(640, 9),
- OnCompleted<int>(650),
- OnError<int>(660, new Exception())
- );
-
- var subject = default(AsyncSubject<int>);
- var subscription = default(IDisposable);
-
- var results1 = scheduler.CreateObserver<int>();
- var subscription1 = default(IDisposable);
-
- var results2 = scheduler.CreateObserver<int>();
- var subscription2 = default(IDisposable);
-
- var results3 = scheduler.CreateObserver<int>();
- var subscription3 = default(IDisposable);
-
- scheduler.ScheduleAbsolute(100, () => subject = new AsyncSubject<int>());
- scheduler.ScheduleAbsolute(200, () => subscription = xs.Subscribe(subject));
- scheduler.ScheduleAbsolute(1000, () => subscription.Dispose());
-
- scheduler.ScheduleAbsolute(300, () => subscription1 = subject.Subscribe(results1));
- scheduler.ScheduleAbsolute(400, () => subscription2 = subject.Subscribe(results2));
- scheduler.ScheduleAbsolute(900, () => subscription3 = subject.Subscribe(results3));
-
- scheduler.ScheduleAbsolute(600, () => subscription1.Dispose());
- scheduler.ScheduleAbsolute(700, () => subscription2.Dispose());
- scheduler.ScheduleAbsolute(800, () => subscription1.Dispose());
- scheduler.ScheduleAbsolute(950, () => subscription3.Dispose());
-
- scheduler.Start();
-
- results1.Messages.AssertEqual(
- );
-
- results2.Messages.AssertEqual(
- OnCompleted<int>(630)
- );
-
- results3.Messages.AssertEqual(
- OnCompleted<int>(900)
- );
- }
-
- [TestMethod]
- public void SubjectDisposed()
- {
- var scheduler = new TestScheduler();
-
- var subject = default(AsyncSubject<int>);
-
- var results1 = scheduler.CreateObserver<int>();
- var subscription1 = default(IDisposable);
-
- var results2 = scheduler.CreateObserver<int>();
- var subscription2 = default(IDisposable);
-
- var results3 = scheduler.CreateObserver<int>();
- var subscription3 = default(IDisposable);
-
- scheduler.ScheduleAbsolute(100, () => subject = new AsyncSubject<int>());
- scheduler.ScheduleAbsolute(200, () => subscription1 = subject.Subscribe(results1));
- scheduler.ScheduleAbsolute(300, () => subscription2 = subject.Subscribe(results2));
- scheduler.ScheduleAbsolute(400, () => subscription3 = subject.Subscribe(results3));
- scheduler.ScheduleAbsolute(500, () => subscription1.Dispose());
- scheduler.ScheduleAbsolute(600, () => subject.Dispose());
- scheduler.ScheduleAbsolute(700, () => subscription2.Dispose());
- scheduler.ScheduleAbsolute(800, () => subscription3.Dispose());
-
- scheduler.ScheduleAbsolute(150, () => subject.OnNext(1));
- scheduler.ScheduleAbsolute(250, () => subject.OnNext(2));
- scheduler.ScheduleAbsolute(350, () => subject.OnNext(3));
- scheduler.ScheduleAbsolute(450, () => subject.OnNext(4));
- scheduler.ScheduleAbsolute(550, () => subject.OnNext(5));
- scheduler.ScheduleAbsolute(650, () => ReactiveAssert.Throws<ObjectDisposedException>(() => subject.OnNext(6)));
- scheduler.ScheduleAbsolute(750, () => ReactiveAssert.Throws<ObjectDisposedException>(() => subject.OnCompleted()));
- scheduler.ScheduleAbsolute(850, () => ReactiveAssert.Throws<ObjectDisposedException>(() => subject.OnError(new Exception())));
- scheduler.ScheduleAbsolute(950, () => ReactiveAssert.Throws<ObjectDisposedException>(() => subject.Subscribe()));
-
- scheduler.Start();
-
- results1.Messages.AssertEqual(
- );
-
- results2.Messages.AssertEqual(
- );
-
- results3.Messages.AssertEqual(
- );
- }
-
-#if HAS_AWAIT
- [TestMethod]
- public void Await_Blocking()
- {
- var s = new AsyncSubject<int>();
- GetResult_Blocking(s.GetAwaiter());
- }
-
- [TestMethod]
- public void Await_Throw()
- {
- var s = new AsyncSubject<int>();
- GetResult_Blocking_Throw(s.GetAwaiter());
- }
-#endif
-
- [TestMethod]
- public void GetResult_Empty()
- {
- var s = new AsyncSubject<int>();
- s.OnCompleted();
- ReactiveAssert.Throws<InvalidOperationException>(() => s.GetResult());
- }
-
- [TestMethod]
- public void GetResult_Blocking()
- {
- GetResult_Blocking(new AsyncSubject<int>());
- }
-
- private void GetResult_Blocking(AsyncSubject<int> s)
- {
- Assert.IsFalse(s.IsCompleted);
-
- var e = new ManualResetEvent(false);
-
- new Thread(() => { e.WaitOne(); s.OnNext(42); s.OnCompleted(); }).Start();
-
- var y = default(int);
- var t = new Thread(() => { y = s.GetResult(); });
- t.Start();
-
- while (t.ThreadState != ThreadState.WaitSleepJoin)
- ;
-
- e.Set();
- t.Join();
-
- Assert.AreEqual(42, y);
- Assert.IsTrue(s.IsCompleted);
- }
-
- [TestMethod]
- public void GetResult_Blocking_Throw()
- {
- GetResult_Blocking_Throw(new AsyncSubject<int>());
- }
-
- private void GetResult_Blocking_Throw(AsyncSubject<int> s)
- {
- Assert.IsFalse(s.IsCompleted);
-
- var e = new ManualResetEvent(false);
-
- var ex = new Exception();
-
- new Thread(() => { e.WaitOne(); s.OnError(ex); }).Start();
-
- var y = default(Exception);
- var t = new Thread(() =>
- {
- try
- {
- s.GetResult();
- }
- catch (Exception ex_)
- {
- y = ex_;
- }
- });
- t.Start();
-
- while (t.ThreadState != ThreadState.WaitSleepJoin)
- ;
-
- e.Set();
- t.Join();
-
- Assert.AreSame(ex, y);
- Assert.IsTrue(s.IsCompleted);
- }
-
-#if HAS_AWAIT
- [TestMethod]
- public void GetResult_Context()
- {
- var x = new AsyncSubject<int>();
-
- var ctx = new MyContext();
- var e = new ManualResetEvent(false);
-
- new Thread(() =>
- {
- SynchronizationContext.SetSynchronizationContext(ctx);
-
- var a = x.GetAwaiter();
- a.OnCompleted(() =>
- {
- e.Set();
- });
- }).Start();
-
- x.OnNext(42);
- x.OnCompleted();
-
- e.WaitOne();
-
- Assert.IsTrue(ctx.ran);
- }
-
- class MyContext : SynchronizationContext
- {
- public bool ran;
-
- public override void Post(SendOrPostCallback d, object state)
- {
- ran = true;
- d(state);
- }
- }
-#endif
- }
-}
diff --git a/Rx.NET/Tests.System.Reactive/Tests/BehaviorSubjectTest.cs b/Rx.NET/Tests.System.Reactive/Tests/BehaviorSubjectTest.cs
deleted file mode 100644
index c9a9048..0000000
--- a/Rx.NET/Tests.System.Reactive/Tests/BehaviorSubjectTest.cs
+++ /dev/null
@@ -1,336 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System;
-using System.Reactive.Concurrency;
-using System.Reactive.Subjects;
-using Microsoft.Reactive.Testing;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-
-namespace ReactiveTests.Tests
-{
- [TestClass]
- public partial class BehaviorSubjectTest : ReactiveTest
- {
- [TestMethod]
- public void Subscribe_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => new BehaviorSubject<int>(1).Subscribe(null));
- }
-
- [TestMethod]
- public void OnError_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => new BehaviorSubject<int>(1).OnError(null));
- }
-
- [TestMethod]
- public void Infinite()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(70, 1),
- OnNext(110, 2),
- OnNext(220, 3),
- OnNext(270, 4),
- OnNext(340, 5),
- OnNext(410, 6),
- OnNext(520, 7),
- OnNext(630, 8),
- OnNext(710, 9),
- OnNext(870, 10),
- OnNext(940, 11),
- OnNext(1020, 12)
- );
-
- var subject = default(BehaviorSubject<int>);
- var subscription = default(IDisposable);
-
- var results1 = scheduler.CreateObserver<int>();
- var subscription1 = default(IDisposable);
-
- var results2 = scheduler.CreateObserver<int>();
- var subscription2 = default(IDisposable);
-
- var results3 = scheduler.CreateObserver<int>();
- var subscription3 = default(IDisposable);
-
- scheduler.ScheduleAbsolute(100, () => subject = new BehaviorSubject<int>(100));
- scheduler.ScheduleAbsolute(200, () => subscription = xs.Subscribe(subject));
- scheduler.ScheduleAbsolute(1000, () => subscription.Dispose());
-
- scheduler.ScheduleAbsolute(300, () => subscription1 = subject.Subscribe(results1));
- scheduler.ScheduleAbsolute(400, () => subscription2 = subject.Subscribe(results2));
- scheduler.ScheduleAbsolute(900, () => subscription3 = subject.Subscribe(results3));
-
- scheduler.ScheduleAbsolute(600, () => subscription1.Dispose());
- scheduler.ScheduleAbsolute(700, () => subscription2.Dispose());
- scheduler.ScheduleAbsolute(800, () => subscription1.Dispose());
- scheduler.ScheduleAbsolute(950, () => subscription3.Dispose());
-
- scheduler.Start();
-
- results1.Messages.AssertEqual(
- OnNext(300, 4),
- OnNext(340, 5),
- OnNext(410, 6),
- OnNext(520, 7)
- );
-
- results2.Messages.AssertEqual(
- OnNext(400, 5),
- OnNext(410, 6),
- OnNext(520, 7),
- OnNext(630, 8)
- );
-
- results3.Messages.AssertEqual(
- OnNext(900, 10),
- OnNext(940, 11)
- );
- }
-
- [TestMethod]
- public void Finite()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(70, 1),
- OnNext(110, 2),
- OnNext(220, 3),
- OnNext(270, 4),
- OnNext(340, 5),
- OnNext(410, 6),
- OnNext(520, 7),
- OnCompleted<int>(630),
- OnNext(640, 9),
- OnCompleted<int>(650),
- OnError<int>(660, new Exception())
- );
-
- var subject = default(BehaviorSubject<int>);
- var subscription = default(IDisposable);
-
- var results1 = scheduler.CreateObserver<int>();
- var subscription1 = default(IDisposable);
-
- var results2 = scheduler.CreateObserver<int>();
- var subscription2 = default(IDisposable);
-
- var results3 = scheduler.CreateObserver<int>();
- var subscription3 = default(IDisposable);
-
- scheduler.ScheduleAbsolute(100, () => subject = new BehaviorSubject<int>(100));
- scheduler.ScheduleAbsolute(200, () => subscription = xs.Subscribe(subject));
- scheduler.ScheduleAbsolute(1000, () => subscription.Dispose());
-
- scheduler.ScheduleAbsolute(300, () => subscription1 = subject.Subscribe(results1));
- scheduler.ScheduleAbsolute(400, () => subscription2 = subject.Subscribe(results2));
- scheduler.ScheduleAbsolute(900, () => subscription3 = subject.Subscribe(results3));
-
- scheduler.ScheduleAbsolute(600, () => subscription1.Dispose());
- scheduler.ScheduleAbsolute(700, () => subscription2.Dispose());
- scheduler.ScheduleAbsolute(800, () => subscription1.Dispose());
- scheduler.ScheduleAbsolute(950, () => subscription3.Dispose());
-
- scheduler.Start();
-
- results1.Messages.AssertEqual(
- OnNext(300, 4),
- OnNext(340, 5),
- OnNext(410, 6),
- OnNext(520, 7)
- );
-
- results2.Messages.AssertEqual(
- OnNext(400, 5),
- OnNext(410, 6),
- OnNext(520, 7),
- OnCompleted<int>(630)
- );
-
- results3.Messages.AssertEqual(
- OnCompleted<int>(900)
- );
- }
-
- [TestMethod]
- public void Error()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(70, 1),
- OnNext(110, 2),
- OnNext(220, 3),
- OnNext(270, 4),
- OnNext(340, 5),
- OnNext(410, 6),
- OnNext(520, 7),
- OnError<int>(630, ex),
- OnNext(640, 9),
- OnCompleted<int>(650),
- OnError<int>(660, new Exception())
- );
-
- var subject = default(BehaviorSubject<int>);
- var subscription = default(IDisposable);
-
- var results1 = scheduler.CreateObserver<int>();
- var subscription1 = default(IDisposable);
-
- var results2 = scheduler.CreateObserver<int>();
- var subscription2 = default(IDisposable);
-
- var results3 = scheduler.CreateObserver<int>();
- var subscription3 = default(IDisposable);
-
- scheduler.ScheduleAbsolute(100, () => subject = new BehaviorSubject<int>(100));
- scheduler.ScheduleAbsolute(200, () => subscription = xs.Subscribe(subject));
- scheduler.ScheduleAbsolute(1000, () => subscription.Dispose());
-
- scheduler.ScheduleAbsolute(300, () => subscription1 = subject.Subscribe(results1));
- scheduler.ScheduleAbsolute(400, () => subscription2 = subject.Subscribe(results2));
- scheduler.ScheduleAbsolute(900, () => subscription3 = subject.Subscribe(results3));
-
- scheduler.ScheduleAbsolute(600, () => subscription1.Dispose());
- scheduler.ScheduleAbsolute(700, () => subscription2.Dispose());
- scheduler.ScheduleAbsolute(800, () => subscription1.Dispose());
- scheduler.ScheduleAbsolute(950, () => subscription3.Dispose());
-
- scheduler.Start();
-
- results1.Messages.AssertEqual(
- OnNext(300, 4),
- OnNext(340, 5),
- OnNext(410, 6),
- OnNext(520, 7)
- );
-
- results2.Messages.AssertEqual(
- OnNext(400, 5),
- OnNext(410, 6),
- OnNext(520, 7),
- OnError<int>(630, ex)
- );
-
- results3.Messages.AssertEqual(
- OnError<int>(900, ex)
- );
- }
-
- [TestMethod]
- public void Canceled()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnCompleted<int>(630),
- OnNext(640, 9),
- OnCompleted<int>(650),
- OnError<int>(660, new Exception())
- );
-
- var subject = default(BehaviorSubject<int>);
- var subscription = default(IDisposable);
-
- var results1 = scheduler.CreateObserver<int>();
- var subscription1 = default(IDisposable);
-
- var results2 = scheduler.CreateObserver<int>();
- var subscription2 = default(IDisposable);
-
- var results3 = scheduler.CreateObserver<int>();
- var subscription3 = default(IDisposable);
-
- scheduler.ScheduleAbsolute(100, () => subject = new BehaviorSubject<int>(100));
- scheduler.ScheduleAbsolute(200, () => subscription = xs.Subscribe(subject));
- scheduler.ScheduleAbsolute(1000, () => subscription.Dispose());
-
- scheduler.ScheduleAbsolute(300, () => subscription1 = subject.Subscribe(results1));
- scheduler.ScheduleAbsolute(400, () => subscription2 = subject.Subscribe(results2));
- scheduler.ScheduleAbsolute(900, () => subscription3 = subject.Subscribe(results3));
-
- scheduler.ScheduleAbsolute(600, () => subscription1.Dispose());
- scheduler.ScheduleAbsolute(700, () => subscription2.Dispose());
- scheduler.ScheduleAbsolute(800, () => subscription1.Dispose());
- scheduler.ScheduleAbsolute(950, () => subscription3.Dispose());
-
- scheduler.Start();
-
- results1.Messages.AssertEqual(
- OnNext(300, 100)
- );
-
- results2.Messages.AssertEqual(
- OnNext(400, 100),
- OnCompleted<int>(630)
- );
-
- results3.Messages.AssertEqual(
- OnCompleted<int>(900)
- );
- }
-
- [TestMethod]
- public void SubjectDisposed()
- {
- var scheduler = new TestScheduler();
-
- var subject = default(BehaviorSubject<int>);
-
- var results1 = scheduler.CreateObserver<int>();
- var subscription1 = default(IDisposable);
-
- var results2 = scheduler.CreateObserver<int>();
- var subscription2 = default(IDisposable);
-
- var results3 = scheduler.CreateObserver<int>();
- var subscription3 = default(IDisposable);
-
- scheduler.ScheduleAbsolute(100, () => subject = new BehaviorSubject<int>(0));
- scheduler.ScheduleAbsolute(200, () => subscription1 = subject.Subscribe(results1));
- scheduler.ScheduleAbsolute(300, () => subscription2 = subject.Subscribe(results2));
- scheduler.ScheduleAbsolute(400, () => subscription3 = subject.Subscribe(results3));
- scheduler.ScheduleAbsolute(500, () => subscription1.Dispose());
- scheduler.ScheduleAbsolute(600, () => subject.Dispose());
- scheduler.ScheduleAbsolute(700, () => subscription2.Dispose());
- scheduler.ScheduleAbsolute(800, () => subscription3.Dispose());
-
- scheduler.ScheduleAbsolute(150, () => subject.OnNext(1));
- scheduler.ScheduleAbsolute(250, () => subject.OnNext(2));
- scheduler.ScheduleAbsolute(350, () => subject.OnNext(3));
- scheduler.ScheduleAbsolute(450, () => subject.OnNext(4));
- scheduler.ScheduleAbsolute(550, () => subject.OnNext(5));
- scheduler.ScheduleAbsolute(650, () => ReactiveAssert.Throws<ObjectDisposedException>(() => subject.OnNext(6)));
- scheduler.ScheduleAbsolute(750, () => ReactiveAssert.Throws<ObjectDisposedException>(() => subject.OnCompleted()));
- scheduler.ScheduleAbsolute(850, () => ReactiveAssert.Throws<ObjectDisposedException>(() => subject.OnError(new Exception())));
- scheduler.ScheduleAbsolute(950, () => ReactiveAssert.Throws<ObjectDisposedException>(() => subject.Subscribe()));
-
- scheduler.Start();
-
- results1.Messages.AssertEqual(
- OnNext(200, 1),
- OnNext(250, 2),
- OnNext(350, 3),
- OnNext(450, 4)
- );
-
- results2.Messages.AssertEqual(
- OnNext(300, 2),
- OnNext(350, 3),
- OnNext(450, 4),
- OnNext(550, 5)
- );
-
- results3.Messages.AssertEqual(
- OnNext(400, 3),
- OnNext(450, 4),
- OnNext(550, 5)
- );
- }
- }
-}
diff --git a/Rx.NET/Tests.System.Reactive/Tests/ConcurrencyTest.cs b/Rx.NET/Tests.System.Reactive/Tests/ConcurrencyTest.cs
deleted file mode 100644
index 9079d9c..0000000
--- a/Rx.NET/Tests.System.Reactive/Tests/ConcurrencyTest.cs
+++ /dev/null
@@ -1,91 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System;
-using System.Reactive.Concurrency;
-using System.Threading;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-
-namespace ReactiveTests.Tests
-{
- [TestClass]
- public class ConcurrencyTest
- {
- [TestMethod]
- public void CurrentScheduler_EnsureTrampoline()
- {
- const int concurrency = 100;
-
- var passed = true;
-
- var s = new Semaphore(0, int.MaxValue);
- var e = new ManualResetEvent(false);
-
- for (var i = 0; i < concurrency; ++i)
- NewThreadScheduler.Default.Schedule(() =>
- {
- e.WaitOne();
- try
- {
- if (Scheduler.CurrentThread.ScheduleRequired)
- Scheduler.CurrentThread.Schedule(() => { });
- else
- new Action(() => { })();
- }
- catch (NullReferenceException)
- {
- passed = false;
- }
- finally
- {
- s.Release();
- }
- });
-
- e.Set();
-
- for (var i = 0; i < concurrency; ++i)
- s.WaitOne();
-
- Assert.IsTrue(passed);
- }
-
- [TestMethod]
- public void CurrentScheduler_Schedule()
- {
- const int concurrency = 100;
-
- var passed = true;
-
- var s = new Semaphore(0, int.MaxValue);
- var e = new ManualResetEvent(false);
-
- for (var i = 0; i < concurrency; ++i)
- NewThreadScheduler.Default.Schedule(() =>
- {
- e.WaitOne();
- try
- {
- if (Scheduler.CurrentThread.ScheduleRequired)
- Scheduler.CurrentThread.Schedule(() => { });
- else
- new Action(() => { })();
- }
- catch (NullReferenceException)
- {
- passed = false;
- }
- finally
- {
- s.Release();
- }
- });
-
- e.Set();
-
- for (var i = 0; i < concurrency; ++i)
- s.WaitOne();
-
- Assert.IsTrue(passed);
- }
- }
-}
diff --git a/Rx.NET/Tests.System.Reactive/Tests/ConnectableObservable.cs b/Rx.NET/Tests.System.Reactive/Tests/ConnectableObservable.cs
deleted file mode 100644
index 568bc02..0000000
--- a/Rx.NET/Tests.System.Reactive/Tests/ConnectableObservable.cs
+++ /dev/null
@@ -1,28 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System;
-using System.Reactive.Linq;
-using System.Reactive.Subjects;
-
-namespace ReactiveTests.Tests
-{
- class ConnectableObservable<T> : IConnectableObservable<T>
- {
- private IConnectableObservable<T> _o;
-
- public ConnectableObservable(IObservable<T> o, ISubject<T, T> s)
- {
- _o = o.Multicast(s);
- }
-
- public IDisposable Connect()
- {
- return _o.Connect();
- }
-
- public IDisposable Subscribe(IObserver<T> observer)
- {
- return _o.Subscribe(observer);
- }
- }
-}
diff --git a/Rx.NET/Tests.System.Reactive/Tests/ConnectableObservableTest.cs b/Rx.NET/Tests.System.Reactive/Tests/ConnectableObservableTest.cs
deleted file mode 100644
index 80c3f1e..0000000
--- a/Rx.NET/Tests.System.Reactive/Tests/ConnectableObservableTest.cs
+++ /dev/null
@@ -1,196 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System;
-using System.Reactive.Concurrency;
-using System.Reactive.Linq;
-using System.Reactive.Subjects;
-using Microsoft.Reactive.Testing;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-
-namespace ReactiveTests.Tests
-{
- [TestClass]
- public partial class ConnectableObservableTest : ReactiveTest
- {
- [TestMethod]
- public void ConnectableObservable_Creation()
- {
- var y = 0;
-
- var s2 = new Subject<int>();
- var co2 = new ConnectableObservable<int>(Observable.Return<int>(1), s2);
-
- co2.Subscribe(x => y = x);
- Assert.AreNotEqual(1, y);
-
- co2.Connect();
- Assert.AreEqual(1, y);
- }
-
- [TestMethod]
- public void ConnectableObservable_Connected()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable<int>(
- OnNext(210, 1),
- OnNext(220, 2),
- OnNext(230, 3),
- OnNext(240, 4),
- OnCompleted<int>(250)
- );
-
- var subject = new MySubject();
-
- var conn = new ConnectableObservable<int>(xs, subject);
- var disconnect = conn.Connect();
-
- var res = scheduler.Start(() => conn);
-
- res.Messages.AssertEqual(
- OnNext(210, 1),
- OnNext(220, 2),
- OnNext(230, 3),
- OnNext(240, 4),
- OnCompleted<int>(250)
- );
- }
-
- [TestMethod]
- public void ConnectableObservable_NotConnected()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable<int>(
- OnNext(210, 1),
- OnNext(220, 2),
- OnNext(230, 3),
- OnNext(240, 4),
- OnCompleted<int>(250)
- );
-
- var subject = new MySubject();
-
- var conn = new ConnectableObservable<int>(xs, subject);
-
- var res = scheduler.Start(() => conn);
-
- res.Messages.AssertEqual(
- );
- }
-
- [TestMethod]
- public void ConnectableObservable_Disconnected()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable<int>(
- OnNext(210, 1),
- OnNext(220, 2),
- OnNext(230, 3),
- OnNext(240, 4),
- OnCompleted<int>(250)
- );
-
- var subject = new MySubject();
-
- var conn = new ConnectableObservable<int>(xs, subject);
- var disconnect = conn.Connect();
- disconnect.Dispose();
-
- var res = scheduler.Start(() => conn);
-
- res.Messages.AssertEqual(
- );
- }
-
- [TestMethod]
- public void ConnectableObservable_DisconnectFuture()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable<int>(
- OnNext(210, 1),
- OnNext(220, 2),
- OnNext(230, 3),
- OnNext(240, 4),
- OnCompleted<int>(250)
- );
-
- var subject = new MySubject();
-
- var conn = new ConnectableObservable<int>(xs, subject);
- subject.DisposeOn(3, conn.Connect());
-
- var res = scheduler.Start(() => conn);
-
- res.Messages.AssertEqual(
- OnNext(210, 1),
- OnNext(220, 2),
- OnNext(230, 3)
- );
- }
-
- [TestMethod]
- public void ConnectableObservable_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Return(42).Publish().Subscribe(default(IObserver<int>)));
- }
-
- [TestMethod]
- public void ConnectableObservable_MultipleNonOverlappedConnections()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable<int>(
- OnNext(210, 1),
- OnNext(220, 2),
- OnNext(230, 3),
- OnNext(240, 4),
- OnNext(250, 5),
- OnNext(260, 6),
- OnNext(270, 7),
- OnNext(280, 8),
- OnNext(290, 9),
- OnCompleted<int>(300)
- );
-
- var subject = new Subject<int>();
-
- var conn = xs.Multicast(subject);
-
- var c1 = default(IDisposable);
- scheduler.ScheduleAbsolute(225, () => { c1 = conn.Connect(); });
- scheduler.ScheduleAbsolute(241, () => { c1.Dispose(); });
- scheduler.ScheduleAbsolute(245, () => { c1.Dispose(); }); // idempotency test
- scheduler.ScheduleAbsolute(251, () => { c1.Dispose(); }); // idempotency test
- scheduler.ScheduleAbsolute(260, () => { c1.Dispose(); }); // idempotency test
-
- var c2 = default(IDisposable);
- scheduler.ScheduleAbsolute(249, () => { c2 = conn.Connect(); });
- scheduler.ScheduleAbsolute(255, () => { c2.Dispose(); });
- scheduler.ScheduleAbsolute(265, () => { c2.Dispose(); }); // idempotency test
- scheduler.ScheduleAbsolute(280, () => { c2.Dispose(); }); // idempotency test
-
- var c3 = default(IDisposable);
- scheduler.ScheduleAbsolute(275, () => { c3 = conn.Connect(); });
- scheduler.ScheduleAbsolute(295, () => { c3.Dispose(); });
-
- var res = scheduler.Start(() => conn);
-
- res.Messages.AssertEqual(
- OnNext(230, 3),
- OnNext(240, 4),
- OnNext(250, 5),
- OnNext(280, 8),
- OnNext(290, 9)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(225, 241),
- Subscribe(249, 255),
- Subscribe(275, 295)
- );
- }
- }
-}
diff --git a/Rx.NET/Tests.System.Reactive/Tests/ControlSchedulerTest.cs b/Rx.NET/Tests.System.Reactive/Tests/ControlSchedulerTest.cs
deleted file mode 100644
index 5a214fd..0000000
--- a/Rx.NET/Tests.System.Reactive/Tests/ControlSchedulerTest.cs
+++ /dev/null
@@ -1,329 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if HAS_WINFORMS
-
-using System;
-using System.Reactive.Concurrency;
-using System.Reactive.Disposables;
-using System.Diagnostics;
-using System.Threading;
-using System.Windows.Forms;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using Microsoft.Reactive.Testing;
-
-namespace ReactiveTests.Tests
-{
- [TestClass]
- public class ControlSchedulerTest
- {
- [TestMethod]
- public void Ctor_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => new ControlScheduler(null));
- }
-
- [TestMethod]
- public void Control()
- {
- var lbl = new Label();
- Assert.AreSame(lbl, new ControlScheduler(lbl).Control);
- }
-
- [TestMethod]
- public void Now()
- {
- var res = new ControlScheduler(new Label()).Now - DateTime.Now;
- Assert.IsTrue(res.Seconds < 1);
- }
-
- [TestMethod]
- public void Schedule_ArgumentChecking()
- {
- var s = new ControlScheduler(new Label());
- ReactiveAssert.Throws<ArgumentNullException>(() => s.Schedule(42, default(Func<IScheduler, int, IDisposable>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => s.Schedule(42, TimeSpan.FromSeconds(1), default(Func<IScheduler, int, IDisposable>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => s.Schedule(42, DateTimeOffset.Now, default(Func<IScheduler, int, IDisposable>)));
- }
-
- [TestMethod]
- public void Schedule()
- {
- var evt = new ManualResetEvent(false);
-
- var id = Thread.CurrentThread.ManagedThreadId;
-
- var lbl = CreateLabel();
- var sch = new ControlScheduler(lbl);
-
- sch.Schedule(() => { lbl.Text = "Okay"; Assert.AreNotEqual(id, Thread.CurrentThread.ManagedThreadId); });
- sch.Schedule(() => { Assert.AreEqual("Okay", lbl.Text); Assert.AreNotEqual(id, Thread.CurrentThread.ManagedThreadId); evt.Set(); });
-
- evt.WaitOne();
- Application.Exit();
- }
-
- [TestMethod]
- public void ScheduleError()
- {
- var evt = new ManualResetEvent(false);
-
- var ex = new Exception();
-
- var lbl = CreateLabelWithHandler(e => {
- Assert.AreSame(ex, e);
- evt.Set();
- });
-
- var sch = new ControlScheduler(lbl);
- sch.Schedule(() => { throw ex; });
-
- evt.WaitOne();
- Application.Exit();
- }
-
- [TestMethod]
- public void ScheduleRelative()
- {
- ScheduleRelative_(TimeSpan.FromSeconds(0.1));
- }
-
- [TestMethod]
- public void ScheduleRelative_Zero()
- {
- ScheduleRelative_(TimeSpan.Zero);
- }
-
- private void ScheduleRelative_(TimeSpan delay)
- {
- var evt = new ManualResetEvent(false);
-
- var id = Thread.CurrentThread.ManagedThreadId;
-
- var lbl = CreateLabel();
- var sch = new ControlScheduler(lbl);
-
- sch.Schedule(delay, () =>
- {
- lbl.Text = "Okay";
- Assert.AreNotEqual(id, Thread.CurrentThread.ManagedThreadId);
-
- sch.Schedule(() =>
- {
- Assert.AreEqual("Okay", lbl.Text);
- Assert.AreNotEqual(id, Thread.CurrentThread.ManagedThreadId);
- evt.Set();
- });
- });
-
- evt.WaitOne();
- Application.Exit();
- }
-
- [TestMethod]
- public void ScheduleRelative_Nested()
- {
- var evt = new ManualResetEvent(false);
-
- var id = Thread.CurrentThread.ManagedThreadId;
-
- var lbl = CreateLabel();
- var sch = new ControlScheduler(lbl);
-
- sch.Schedule(TimeSpan.FromSeconds(0.1), () =>
- {
- sch.Schedule(TimeSpan.FromSeconds(0.1), () =>
- {
- lbl.Text = "Okay";
- Assert.AreNotEqual(id, Thread.CurrentThread.ManagedThreadId);
-
- sch.Schedule(() =>
- {
- Assert.AreEqual("Okay", lbl.Text);
- Assert.AreNotEqual(id, Thread.CurrentThread.ManagedThreadId);
- evt.Set();
- });
- });
- });
-
- evt.WaitOne();
- Application.Exit();
- }
-
- [TestMethod]
- public void ScheduleRelative_Cancel()
- {
- var evt = new ManualResetEvent(false);
-
- var id = Thread.CurrentThread.ManagedThreadId;
-
- var lbl = CreateLabel();
- var sch = new ControlScheduler(lbl);
-
- sch.Schedule(TimeSpan.FromSeconds(0.1), () =>
- {
- lbl.Text = "Okay";
- Assert.AreNotEqual(id, Thread.CurrentThread.ManagedThreadId);
-
- var d = sch.Schedule(TimeSpan.FromSeconds(0.1), () =>
- {
- lbl.Text = "Oops!";
- });
-
- sch.Schedule(() =>
- {
- d.Dispose();
- });
-
- sch.Schedule(TimeSpan.FromSeconds(0.2), () =>
- {
- Assert.AreEqual("Okay", lbl.Text);
- Assert.AreNotEqual(id, Thread.CurrentThread.ManagedThreadId);
- evt.Set();
- });
- });
-
- evt.WaitOne();
- Application.Exit();
- }
-
- [TestMethod]
- public void SchedulePeriodic_ArgumentChecking()
- {
- var s = new ControlScheduler(new Label());
- ReactiveAssert.Throws<ArgumentNullException>(() => s.SchedulePeriodic(42, TimeSpan.FromSeconds(1), default(Func<int, int>)));
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => s.SchedulePeriodic(42, TimeSpan.Zero, x => x));
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => s.SchedulePeriodic(42, TimeSpan.FromMilliseconds(1).Subtract(TimeSpan.FromTicks(1)), x => x));
- }
-
- [TestMethod]
- public void SchedulePeriodic()
- {
- var evt = new ManualResetEvent(false);
-
- var id = Thread.CurrentThread.ManagedThreadId;
-
- var lbl = CreateLabel();
- var sch = new ControlScheduler(lbl);
-
- var d = new SingleAssignmentDisposable();
-
- d.Disposable = sch.SchedulePeriodic(1, TimeSpan.FromSeconds(0.1), n =>
- {
- lbl.Text = "Okay " + n;
- Assert.AreNotEqual(id, Thread.CurrentThread.ManagedThreadId);
-
- if (n == 3)
- {
- d.Dispose();
-
- sch.Schedule(TimeSpan.FromSeconds(0.2), () =>
- {
- Assert.AreEqual("Okay 3", lbl.Text);
- Assert.AreNotEqual(id, Thread.CurrentThread.ManagedThreadId);
- evt.Set();
- });
- }
-
- if (n > 3)
- {
- Assert.Fail();
- }
-
- return n + 1;
- });
-
- evt.WaitOne();
- Application.Exit();
- }
-
- [TestMethod]
- public void SchedulePeriodic_Nested()
- {
- var evt = new ManualResetEvent(false);
-
- var id = Thread.CurrentThread.ManagedThreadId;
-
- var lbl = CreateLabel();
- var sch = new ControlScheduler(lbl);
-
- sch.Schedule(() =>
- {
- lbl.Text = "Okay";
-
- var d = new SingleAssignmentDisposable();
-
- d.Disposable = sch.SchedulePeriodic(1, TimeSpan.FromSeconds(0.1), n =>
- {
- lbl.Text = "Okay " + n;
- Assert.AreNotEqual(id, Thread.CurrentThread.ManagedThreadId);
-
- if (n == 3)
- {
- d.Dispose();
-
- sch.Schedule(TimeSpan.FromSeconds(0.2), () =>
- {
- Assert.AreEqual("Okay 3", lbl.Text);
- Assert.AreNotEqual(id, Thread.CurrentThread.ManagedThreadId);
- evt.Set();
- });
- }
-
- return n + 1;
- });
- });
-
- evt.WaitOne();
- Application.Exit();
- }
-
- private Label CreateLabel()
- {
- var loaded = new ManualResetEvent(false);
- var lbl = default(Label);
-
- var t = new Thread(() =>
- {
- lbl = new Label();
- var frm = new Form { Controls = { lbl }, Width = 0, Height = 0, FormBorderStyle = FormBorderStyle.None, ShowInTaskbar = false };
- frm.Load += (_, __) =>
- {
- loaded.Set();
- };
- Application.Run(frm);
- });
- t.SetApartmentState(ApartmentState.STA);
- t.Start();
-
- loaded.WaitOne();
- return lbl;
- }
-
- private Label CreateLabelWithHandler(Action<Exception> handler)
- {
- var loaded = new ManualResetEvent(false);
- var lbl = default(Label);
-
- var t = new Thread(() =>
- {
- lbl = new Label();
- var frm = new Form { Controls = { lbl }, Width = 0, Height = 0, FormBorderStyle = FormBorderStyle.None, ShowInTaskbar = false };
- frm.Load += (_, __) =>
- {
- loaded.Set();
- };
- Application.ThreadException += (o, e) =>
- {
- handler(e.Exception);
- };
- Application.Run(frm);
- });
- t.SetApartmentState(ApartmentState.STA);
- t.Start();
-
- loaded.WaitOne();
- return lbl;
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/Tests.System.Reactive/Tests/CurrentThreadSchedulerTest.cs b/Rx.NET/Tests.System.Reactive/Tests/CurrentThreadSchedulerTest.cs
deleted file mode 100644
index dbef946..0000000
--- a/Rx.NET/Tests.System.Reactive/Tests/CurrentThreadSchedulerTest.cs
+++ /dev/null
@@ -1,178 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System;
-using System.Diagnostics;
-using System.Reactive.Concurrency;
-using System.Threading;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using Microsoft.Reactive.Testing;
-
-namespace ReactiveTests.Tests
-{
- [TestClass]
- public class CurrentThreadSchedulerTest
- {
- [TestMethod]
- public void CurrentThread_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Scheduler.CurrentThread.Schedule(42, default(Func<IScheduler, int, IDisposable>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Scheduler.CurrentThread.Schedule(42, default(TimeSpan), default(Func<IScheduler, int, IDisposable>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Scheduler.CurrentThread.Schedule(42, default(DateTimeOffset), default(Func<IScheduler, int, IDisposable>)));
- }
-
- [TestMethod]
- public void CurrentThread_Now()
- {
- var res = Scheduler.CurrentThread.Now - DateTime.Now;
- Assert.IsTrue(res.Seconds < 1);
- }
-
- [TestMethod]
- public void CurrentThread_ScheduleAction()
- {
- var id = Thread.CurrentThread.ManagedThreadId;
- var ran = false;
- Scheduler.CurrentThread.Schedule(() => { Assert.AreEqual(id, Thread.CurrentThread.ManagedThreadId); ran = true; });
- Assert.IsTrue(ran);
- }
-
- [TestMethod]
- public void CurrentThread_ScheduleActionError()
- {
- var ex = new Exception();
-
- try
- {
- Scheduler.CurrentThread.Schedule(() => { throw ex; });
- Assert.Fail();
- }
- catch (Exception e)
- {
- Assert.AreSame(e, ex);
- }
- }
-
- [TestMethod]
- public void CurrentThread_ScheduleActionNested()
- {
- var id = Thread.CurrentThread.ManagedThreadId;
- var ran = false;
- Scheduler.CurrentThread.Schedule(() => {
- Assert.AreEqual(id, Thread.CurrentThread.ManagedThreadId);
- Scheduler.CurrentThread.Schedule(() => { ran = true; });
- });
- Assert.IsTrue(ran);
- }
-
- [TestMethod]
- public void CurrentThread_ScheduleActionNested_TimeSpan()
- {
- var id = Thread.CurrentThread.ManagedThreadId;
- var ran = false;
- Scheduler.CurrentThread.Schedule(() =>
- {
- Assert.AreEqual(id, Thread.CurrentThread.ManagedThreadId);
- Scheduler.CurrentThread.Schedule(TimeSpan.FromSeconds(1), () => { ran = true; });
- });
- Assert.IsTrue(ran);
- }
-
-#if !SILVERLIGHT
-
- [TestMethod]
- [Ignore]
- public void CurrentThread_ScheduleActionDue()
- {
- var id = Thread.CurrentThread.ManagedThreadId;
- var ran = false;
- var sw = new Stopwatch();
- sw.Start();
- Scheduler.CurrentThread.Schedule(TimeSpan.FromSeconds(0.2), () => { sw.Stop(); Assert.AreEqual(id, Thread.CurrentThread.ManagedThreadId); ran = true; });
- Assert.IsTrue(ran, "ran");
- Assert.IsTrue(sw.ElapsedMilliseconds > 180, "due " + sw.ElapsedMilliseconds);
- }
-
- [TestMethod]
- [Ignore]
- public void CurrentThread_ScheduleActionDueNested()
- {
- var id = Thread.CurrentThread.ManagedThreadId;
- var ran = false;
- var sw = new Stopwatch();
- sw.Start();
- Scheduler.CurrentThread.Schedule(TimeSpan.FromSeconds(0.2), () => {
- sw.Stop();
- Assert.AreEqual(id, Thread.CurrentThread.ManagedThreadId);
- sw.Start();
- Scheduler.CurrentThread.Schedule(TimeSpan.FromSeconds(0.2), () => {
- sw.Stop();
- ran = true;
- });
- });
- Assert.IsTrue(ran, "ran");
- Assert.IsTrue(sw.ElapsedMilliseconds > 380, "due " + sw.ElapsedMilliseconds);
- }
-#endif
- [TestMethod]
- public void CurrentThread_EnsureTrampoline()
- {
- var ran1 = false;
- var ran2 = false;
- Scheduler.CurrentThread.EnsureTrampoline(() => {
- Scheduler.CurrentThread.Schedule(() => { ran1 = true; });
- Scheduler.CurrentThread.Schedule(() => { ran2 = true; });
- });
- Assert.IsTrue(ran1);
- Assert.IsTrue(ran2);
- }
-
- [TestMethod]
- public void CurrentThread_EnsureTrampoline_Nested()
- {
- var ran1 = false;
- var ran2 = false;
- Scheduler.CurrentThread.EnsureTrampoline(() =>
- {
- Scheduler.CurrentThread.EnsureTrampoline(() => { ran1 = true; });
- Scheduler.CurrentThread.EnsureTrampoline(() => { ran2 = true; });
- });
- Assert.IsTrue(ran1);
- Assert.IsTrue(ran2);
- }
-
- [TestMethod]
- public void CurrentThread_EnsureTrampolineAndCancel()
- {
- var ran1 = false;
- var ran2 = false;
- Scheduler.CurrentThread.EnsureTrampoline(() =>
- {
- Scheduler.CurrentThread.Schedule(() => {
- ran1 = true;
- var d = Scheduler.CurrentThread.Schedule(() => { ran2 = true; });
- d.Dispose();
- });
- });
- Assert.IsTrue(ran1);
- Assert.IsFalse(ran2);
- }
-
- [TestMethod]
- public void CurrentThread_EnsureTrampolineAndCancelTimed()
- {
- var ran1 = false;
- var ran2 = false;
- Scheduler.CurrentThread.EnsureTrampoline(() =>
- {
- Scheduler.CurrentThread.Schedule(() =>
- {
- ran1 = true;
- var d = Scheduler.CurrentThread.Schedule(TimeSpan.FromSeconds(1), () => { ran2 = true; });
- d.Dispose();
- });
- });
- Assert.IsTrue(ran1);
- Assert.IsFalse(ran2);
- }
- }
-}
diff --git a/Rx.NET/Tests.System.Reactive/Tests/DefaultConcurrencyAbstractionLayerTest.cs b/Rx.NET/Tests.System.Reactive/Tests/DefaultConcurrencyAbstractionLayerTest.cs
deleted file mode 100644
index a818db4..0000000
--- a/Rx.NET/Tests.System.Reactive/Tests/DefaultConcurrencyAbstractionLayerTest.cs
+++ /dev/null
@@ -1,291 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_REMOTING
-using System;
-using System.IO;
-using System.Reactive.Concurrency;
-using System.Reactive.PlatformServices;
-using System.Runtime.CompilerServices;
-using System.Threading;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-
-namespace ReactiveTests.Tests
-{
- [TestClass]
- [Serializable]
- public class DefaultConcurrencyAbstractionLayerTest
- {
- private AppDomain _domain;
-
- [TestInitialize]
- public void Init()
- {
- if (_domain == null)
- {
- var cur = AppDomain.CurrentDomain.BaseDirectory;
- var sub = Path.Combine(cur, "NoCAL");
-
- if (!Directory.Exists(sub))
- {
- Directory.CreateDirectory(sub);
-
- foreach (var file in Directory.GetFiles(cur))
- {
- var fn = Path.GetFileName(file);
- if (!file.Contains("PlatformServices"))
- File.Copy(Path.Combine(cur, fn), Path.Combine(sub, fn));
- }
- }
-
- _domain = AppDomain.CreateDomain("Default_CAL", null, new AppDomainSetup { ApplicationBase = sub });
- }
- }
-
- private void Run(CrossAppDomainDelegate a)
- {
- _domain.DoCallBack(a);
- }
-
- [TestMethod]
- public void Sleep()
- {
- var ran = new MarshalByRefCell<bool>();
- _domain.SetData("state", ran);
-
- Run(() =>
- {
- Scheduler.Immediate.Schedule(TimeSpan.FromMilliseconds(1), () =>
- {
- var state = (MarshalByRefCell<bool>)_domain.GetData("state");
- state.Value = true;
- });
- });
-
- Assert.IsTrue(ran.Value);
- }
-
- [TestMethod]
- public void QueueUserWorkItem()
- {
- var e = new MarshalByRefCell<ManualResetEvent> { Value = new ManualResetEvent(false) };
- _domain.SetData("state", e);
-
- Run(() =>
- {
- Scheduler.Default.Schedule(() =>
- {
- var state = (MarshalByRefCell<ManualResetEvent>)_domain.GetData("state");
- state.Value.Set();
- });
- });
-
- e.Value.WaitOne();
- }
-
- [TestMethod]
- public void StartTimer()
- {
- var e = new MarshalByRefCell<ManualResetEvent> { Value = new ManualResetEvent(false) };
- _domain.SetData("state", e);
-
- Run(() =>
- {
- Scheduler.Default.Schedule(TimeSpan.FromMilliseconds(10), () =>
- {
- var state = (MarshalByRefCell<ManualResetEvent>)_domain.GetData("state");
- state.Value.Set();
- });
- });
-
- e.Value.WaitOne();
- }
-
- [TestMethod]
- public void StartTimer_Cancel()
- {
- Run(() =>
- {
- Scheduler.Default.Schedule(TimeSpan.FromSeconds(60), () =>
- {
- throw new InvalidOperationException("This shouldn't have happened!");
- }).Dispose();
- });
- }
-
- [TestMethod]
- public void StartPeriodicTimer()
- {
- var e = new MarshalByRefCell<ManualResetEvent> { Value = new ManualResetEvent(false) };
- _domain.SetData("state", e);
-
- Run(() =>
- {
- var n = 0;
-
- Scheduler.Default.SchedulePeriodic(TimeSpan.FromMilliseconds(10), () =>
- {
- var state = (MarshalByRefCell<ManualResetEvent>)_domain.GetData("state");
-
- if (n++ == 10)
- state.Value.Set();
- });
- });
-
- e.Value.WaitOne();
- }
-
- [TestMethod]
- public void StartPeriodicTimer_Cancel()
- {
- Run(() =>
- {
- Scheduler.Default.SchedulePeriodic(TimeSpan.FromSeconds(60), () =>
- {
- throw new InvalidOperationException("This shouldn't have happened!");
- }).Dispose();
- });
- }
-
- [TestMethod]
- public void CreateThread()
- {
- var e = new MarshalByRefCell<ManualResetEvent> { Value = new ManualResetEvent(false) };
- _domain.SetData("state", e);
-
- var r = new MarshalByRefCell<string> { Value = "" };
- _domain.SetData("res", r);
-
- Run(() =>
- {
- var state = (MarshalByRefCell<ManualResetEvent>)_domain.GetData("state");
- var res = (MarshalByRefCell<string>)_domain.GetData("res");
-
- var svc = (IServiceProvider)Scheduler.Default;
-
- var per = (ISchedulerPeriodic)svc.GetService(typeof(ISchedulerPeriodic));
- if (per == null)
- {
- res.Value = "Failed to get ISchedulerPeriodic.";
- state.Value.Set();
- return;
- }
-
- var slr = (ISchedulerLongRunning)svc.GetService(typeof(ISchedulerLongRunning));
- if (slr == null)
- {
- res.Value = "Failed to get ISchedulerLongRunning.";
- state.Value.Set();
- return;
- }
-
- var success = false;
- try
- {
- slr.ScheduleLongRunning(42, null);
- }
- catch (ArgumentNullException)
- {
- success = true;
- }
-
- if (!success)
- {
- res.Value = "Failed null check ScheduleLongRunnign.";
- state.Value.Set();
- return;
- }
-
- state.Value.Set();
-#if !NO_THREAD
- var w = new ManualResetEvent(false);
-
- var d = slr.ScheduleLongRunning(cancel =>
- {
- while (!cancel.IsDisposed)
- ;
-
- w.Set();
- });
-
- Thread.Sleep(50);
- d.Dispose();
- w.WaitOne();
-#else
- state.Value.Set();
-#endif
- });
-
- e.Value.WaitOne();
- Assert.IsTrue(string.IsNullOrEmpty(r.Value));
- }
-
-#if !NO_TPL
- [TestMethod]
- public void Cant_Locate_Scheduler()
- {
- if (!Utils.IsRunningWithPortableLibraryBinaries())
- {
- Cant_Locate_Scheduler_NoPlib();
- }
- }
-
- [MethodImpl(MethodImplOptions.NoInlining)]
- private void Cant_Locate_Scheduler_NoPlib()
- {
- var e = new MarshalByRefCell<Exception>();
- _domain.SetData("state", e);
-
- Run(() =>
- {
- var state = (MarshalByRefCell<Exception>)_domain.GetData("state");
- try
- {
- Scheduler.TaskPool.Schedule(() => { });
- }
- catch (Exception ex)
- {
- state.Value = ex;
- }
- });
-
- Assert.IsTrue(e.Value != null && e.Value is NotSupportedException);
- }
-#endif
-
-#if !NO_PERF && !NO_STOPWATCH
- [TestMethod]
- public void Stopwatch()
- {
- var e = new MarshalByRefCell<bool>();
- _domain.SetData("state", e);
-
- Run(() =>
- {
- var state = (MarshalByRefCell<bool>)_domain.GetData("state");
-
- var sw = Scheduler.Default.StartStopwatch();
-
- var fst = sw.Elapsed;
- Thread.Sleep(100);
- var snd = sw.Elapsed;
-
- state.Value = snd > fst;
- });
-
- Assert.IsTrue(e.Value);
- }
-#endif
-
- [TestMethod]
- public void EnsureLoaded()
- {
- Assert.IsTrue(EnlightenmentProvider.EnsureLoaded());
- }
- }
-
- public class MarshalByRefCell<T> : MarshalByRefObject
- {
- public T Value;
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/Tests.System.Reactive/Tests/DefaultSchedulerTest.cs b/Rx.NET/Tests.System.Reactive/Tests/DefaultSchedulerTest.cs
deleted file mode 100644
index a5a39ac..0000000
--- a/Rx.NET/Tests.System.Reactive/Tests/DefaultSchedulerTest.cs
+++ /dev/null
@@ -1,95 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System;
-using System.Reactive.Concurrency;
-using System.Diagnostics;
-using System.Threading;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using Microsoft.Reactive.Testing;
-
-namespace ReactiveTests.Tests
-{
- [TestClass]
- public class DefaultSchedulerTest
- {
- [TestMethod]
- public void Schedule_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => DefaultScheduler.Instance.Schedule<int>(42, default(Func<IScheduler, int, IDisposable>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => DefaultScheduler.Instance.Schedule<int>(42, DateTimeOffset.Now, default(Func<IScheduler, int, IDisposable>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => DefaultScheduler.Instance.Schedule<int>(42, TimeSpan.Zero, default(Func<IScheduler, int, IDisposable>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => DefaultScheduler.Instance.SchedulePeriodic(42, TimeSpan.FromSeconds(1), default(Func<int, int>)));
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => DefaultScheduler.Instance.SchedulePeriodic(42, TimeSpan.FromSeconds(-1), _ => _));
- }
-
- [TestMethod]
- public void Get_Now()
- {
- var res = DefaultScheduler.Instance.Now - DateTime.Now;
- Assert.IsTrue(res.Seconds < 1);
- }
-
- [TestMethod]
- public void ScheduleAction()
- {
- var id = Thread.CurrentThread.ManagedThreadId;
- var nt = DefaultScheduler.Instance;
- var evt = new ManualResetEvent(false);
- nt.Schedule(() => { Assert.AreNotEqual(id, Thread.CurrentThread.ManagedThreadId); evt.Set(); });
- evt.WaitOne();
- }
-
-#if !SILVERLIGHT
- [TestMethod]
- public void ScheduleActionDue()
- {
- var id = Thread.CurrentThread.ManagedThreadId;
- var nt = DefaultScheduler.Instance;
- var evt = new ManualResetEvent(false);
- nt.Schedule(TimeSpan.FromSeconds(0.2), () => { Assert.AreNotEqual(id, Thread.CurrentThread.ManagedThreadId); evt.Set(); });
- evt.WaitOne();
- }
-#endif
-
- [TestMethod]
- public void ScheduleActionCancel()
- {
- var id = Thread.CurrentThread.ManagedThreadId;
- var nt = DefaultScheduler.Instance;
- var set = false;
- var d = nt.Schedule(TimeSpan.FromSeconds(0.2), () => { Assert.Fail(); set = true; });
- d.Dispose();
- Thread.Sleep(400);
- Assert.IsFalse(set);
- }
-
- [TestMethod]
- public void Periodic_NonReentrant()
- {
- var n = 0;
- var fail = false;
-
- var d = DefaultScheduler.Instance.SchedulePeriodic(0, TimeSpan.FromMilliseconds(50), x =>
- {
- try
- {
- if (Interlocked.Increment(ref n) > 1) // Without an AsyncLock this would fail.
- fail = true;
-
- Thread.Sleep(100);
-
- return x + 1;
- }
- finally
- {
- Interlocked.Decrement(ref n);
- }
- });
-
- Thread.Sleep(500);
- d.Dispose();
-
- Assert.IsFalse(fail);
- }
- }
-}
diff --git a/Rx.NET/Tests.System.Reactive/Tests/DispatcherSchedulerTest.cs b/Rx.NET/Tests.System.Reactive/Tests/DispatcherSchedulerTest.cs
deleted file mode 100644
index a64624a..0000000
--- a/Rx.NET/Tests.System.Reactive/Tests/DispatcherSchedulerTest.cs
+++ /dev/null
@@ -1,260 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System;
-using System.Diagnostics;
-using System.Reactive.Concurrency;
-using System.Reactive.Disposables;
-using System.Threading;
-using System.Windows.Threading;
-using Microsoft.Reactive.Testing;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-
-#if SILVERLIGHT && !SILVERLIGHTM7
-using Microsoft.Silverlight.Testing;
-#endif
-
-namespace ReactiveTests.Tests
-{
- [TestClass]
- public class DispatcherSchedulerTest : TestBase
- {
- [TestMethod]
- public void Ctor_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => new DispatcherScheduler(null));
- }
-
- [TestMethod]
- public void Current()
- {
- var d = DispatcherHelpers.EnsureDispatcher();
- var e = new ManualResetEvent(false);
-
- d.BeginInvoke(() =>
- {
- var c = DispatcherScheduler.Current;
- c.Schedule(() => { e.Set(); });
- });
-
- e.WaitOne();
- }
-
- [TestMethod]
- public void Current_None()
- {
- var e = default(Exception);
-
- var t = new Thread(() =>
- {
- try
- {
- var ignored = DispatcherScheduler.Current;
- }
- catch (Exception ex)
- {
- e = ex;
- }
- });
-
- t.Start();
- t.Join();
-
- Assert.IsTrue(e != null && e is InvalidOperationException);
- }
-
- [TestMethod]
- public void Dispatcher()
- {
- var disp = DispatcherHelpers.EnsureDispatcher();
- Assert.AreSame(disp.Dispatcher, new DispatcherScheduler(disp).Dispatcher);
- }
-
- [TestMethod]
- public void Now()
- {
- var disp = DispatcherHelpers.EnsureDispatcher();
- var res = new DispatcherScheduler(disp).Now - DateTime.Now;
- Assert.IsTrue(res.Seconds < 1);
- }
-
- [TestMethod]
- public void Schedule_ArgumentChecking()
- {
- var disp = DispatcherHelpers.EnsureDispatcher();
- var s = new DispatcherScheduler(disp);
- ReactiveAssert.Throws<ArgumentNullException>(() => s.Schedule(42, default(Func<IScheduler, int, IDisposable>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => s.Schedule(42, TimeSpan.FromSeconds(1), default(Func<IScheduler, int, IDisposable>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => s.Schedule(42, DateTimeOffset.Now, default(Func<IScheduler, int, IDisposable>)));
- }
-
- [TestMethod]
- [Asynchronous]
- public void Schedule()
- {
- var disp = DispatcherHelpers.EnsureDispatcher();
-
- RunAsync(evt =>
- {
- var id = Thread.CurrentThread.ManagedThreadId;
- var sch = new DispatcherScheduler(disp);
- sch.Schedule(() =>
- {
-#if SILVERLIGHT
- Assert.AreEqual(id, Thread.CurrentThread.ManagedThreadId); // Single-threaded test framework
-#else
- Assert.AreNotEqual(id, Thread.CurrentThread.ManagedThreadId);
-#endif
- disp.InvokeShutdown();
- evt.Set();
- });
- });
- }
-
-#if !USE_SL_DISPATCHER
- [TestMethod]
- public void ScheduleError()
- {
- var ex = new Exception();
-
- var id = Thread.CurrentThread.ManagedThreadId;
- var disp = DispatcherHelpers.EnsureDispatcher();
- var evt = new ManualResetEvent(false);
- disp.UnhandledException += (o, e) =>
- {
-#if DESKTOPCLR40 || DESKTOPCLR45
- Assert.AreSame(ex, e.Exception); // CHECK
-#else
- Assert.AreSame(ex, e.Exception.InnerException); // CHECK
-#endif
- evt.Set();
- e.Handled = true;
- };
- var sch = new DispatcherScheduler(disp);
- sch.Schedule(() => { throw ex; });
- evt.WaitOne();
- disp.InvokeShutdown();
- }
-
- [TestMethod]
- public void ScheduleRelative()
- {
- ScheduleRelative_(TimeSpan.FromSeconds(0.2));
- }
-
- [TestMethod]
- public void ScheduleRelative_Zero()
- {
- ScheduleRelative_(TimeSpan.Zero);
- }
-
- private void ScheduleRelative_(TimeSpan delay)
- {
- var evt = new ManualResetEvent(false);
-
- var id = Thread.CurrentThread.ManagedThreadId;
-
- var disp = DispatcherHelpers.EnsureDispatcher();
- var sch = new DispatcherScheduler(disp);
-
- sch.Schedule(delay, () =>
- {
- Assert.AreNotEqual(id, Thread.CurrentThread.ManagedThreadId);
-
- sch.Schedule(delay, () =>
- {
- Assert.AreNotEqual(id, Thread.CurrentThread.ManagedThreadId);
- evt.Set();
- });
- });
-
- evt.WaitOne();
- disp.InvokeShutdown();
- }
-
- [TestMethod]
- public void ScheduleRelative_Cancel()
- {
- var evt = new ManualResetEvent(false);
-
- var id = Thread.CurrentThread.ManagedThreadId;
-
- var disp = DispatcherHelpers.EnsureDispatcher();
- var sch = new DispatcherScheduler(disp);
-
- sch.Schedule(TimeSpan.FromSeconds(0.1), () =>
- {
- Assert.AreNotEqual(id, Thread.CurrentThread.ManagedThreadId);
-
- var d = sch.Schedule(TimeSpan.FromSeconds(0.1), () =>
- {
- Assert.Fail();
- evt.Set();
- });
-
- sch.Schedule(() =>
- {
- d.Dispose();
- });
-
- sch.Schedule(TimeSpan.FromSeconds(0.2), () =>
- {
- Assert.AreNotEqual(id, Thread.CurrentThread.ManagedThreadId);
- evt.Set();
- });
- });
-
- evt.WaitOne();
- disp.InvokeShutdown();
- }
-
- [TestMethod]
- public void SchedulePeriodic_ArgumentChecking()
- {
- var disp = DispatcherHelpers.EnsureDispatcher();
- var s = new DispatcherScheduler(disp);
-
- ReactiveAssert.Throws<ArgumentNullException>(() => s.SchedulePeriodic(42, TimeSpan.FromSeconds(1), default(Func<int, int>)));
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => s.SchedulePeriodic(42, TimeSpan.FromSeconds(-1), x => x));
- }
-
- [TestMethod]
- public void SchedulePeriodic()
- {
- var evt = new ManualResetEvent(false);
-
- var id = Thread.CurrentThread.ManagedThreadId;
-
- var disp = DispatcherHelpers.EnsureDispatcher();
- var sch = new DispatcherScheduler(disp);
-
- var d = new SingleAssignmentDisposable();
-
- d.Disposable = sch.SchedulePeriodic(1, TimeSpan.FromSeconds(0.1), n =>
- {
- Assert.AreNotEqual(id, Thread.CurrentThread.ManagedThreadId);
-
- if (n == 3)
- {
- d.Dispose();
-
- sch.Schedule(TimeSpan.FromSeconds(0.2), () =>
- {
- Assert.AreNotEqual(id, Thread.CurrentThread.ManagedThreadId);
- evt.Set();
- });
- }
-
- if (n > 3)
- {
- Assert.Fail();
- }
-
- return n + 1;
- });
-
- evt.WaitOne();
- disp.InvokeShutdown();
- }
-#endif
- }
-}
diff --git a/Rx.NET/Tests.System.Reactive/Tests/DisposableTests.cs b/Rx.NET/Tests.System.Reactive/Tests/DisposableTests.cs
deleted file mode 100644
index e5728c4..0000000
--- a/Rx.NET/Tests.System.Reactive/Tests/DisposableTests.cs
+++ /dev/null
@@ -1,626 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.Linq;
-using System.Reactive.Concurrency;
-using System.Reactive.Disposables;
-using System.Threading;
-using Microsoft.Reactive.Testing;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-
-namespace ReactiveTests.Tests
-{
- [TestClass]
- public class DisposableTests
- {
- [TestMethod]
- public void AnonymousDisposable_Create()
- {
- var d = Disposable.Create(() => { });
- Assert.IsNotNull(d);
- }
-
- [TestMethod, ExpectedException(typeof(ArgumentNullException))]
- public void AnonymousDisposable_CreateNull()
- {
- Disposable.Create(null);
- }
-
- [TestMethod]
- public void AnonymousDisposable_Dispose()
- {
- var disposed = false;
- var d = Disposable.Create(() => { disposed = true; });
- Assert.IsFalse(disposed);
- d.Dispose();
- Assert.IsTrue(disposed);
-
- var c = d as ICancelable;
- Assert.IsNotNull(c);
- Assert.IsTrue(c.IsDisposed);
- }
-
- [TestMethod]
- public void EmptyDisposable()
- {
- var d = Disposable.Empty;
- Assert.IsNotNull(d);
- d.Dispose();
- }
-
- [TestMethod]
- public void BooleanDisposable()
- {
- var d = new BooleanDisposable();
- Assert.IsFalse(d.IsDisposed);
- d.Dispose();
- Assert.IsTrue(d.IsDisposed);
- d.Dispose();
- Assert.IsTrue(d.IsDisposed);
- }
-
- [TestMethod]
- public void SingleAssignmentDisposable_SetNull()
- {
- var d = new SingleAssignmentDisposable();
- d.Disposable = null;
- }
-
- [TestMethod]
- public void SingleAssignmentDisposable_DisposeAfterSet()
- {
- var disposed = false;
-
- var d = new SingleAssignmentDisposable();
- var dd = Disposable.Create(() => { disposed = true; });
- d.Disposable = dd;
-
- Assert.AreSame(dd, d.Disposable);
-
- Assert.IsFalse(disposed);
- d.Dispose();
- Assert.IsTrue(disposed);
- d.Dispose();
- Assert.IsTrue(disposed);
-
- Assert.IsTrue(d.IsDisposed);
- }
-
- [TestMethod]
- public void SingleAssignmentDisposable_DisposeBeforeSet()
- {
- var disposed = false;
-
- var d = new SingleAssignmentDisposable();
- var dd = Disposable.Create(() => { disposed = true; });
-
- Assert.IsFalse(disposed);
- d.Dispose();
- Assert.IsFalse(disposed);
- Assert.IsTrue(d.IsDisposed);
-
- d.Disposable = dd;
- Assert.IsTrue(disposed);
- //Assert.IsNull(d.Disposable); // BREAKING CHANGE v2 > v1.x - Undefined behavior after disposal.
- d.Disposable.Dispose(); // This should be a nop.
-
- d.Dispose();
- Assert.IsTrue(disposed);
- }
-
- [TestMethod]
- public void SingleAssignmentDisposable_SetMultipleTimes()
- {
- var d = new SingleAssignmentDisposable();
- d.Disposable = Disposable.Empty;
-
- ReactiveAssert.Throws<InvalidOperationException>(() => { d.Disposable = Disposable.Empty; });
- }
-
- [TestMethod]
- public void CompositeDisposable_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => new CompositeDisposable(default(IDisposable[])));
- ReactiveAssert.Throws<ArgumentNullException>(() => new CompositeDisposable(default(IEnumerable<IDisposable>)));
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => new CompositeDisposable(-1));
- }
-
- [TestMethod]
- public void CompositeDisposable_Contains()
- {
- var d1 = Disposable.Create(() => {} );
- var d2 = Disposable.Create(() => { });
-
- var g = new CompositeDisposable(d1, d2);
- Assert.AreEqual(2, g.Count);
- Assert.IsTrue(g.Contains(d1));
- Assert.IsTrue(g.Contains(d2));
-
- ReactiveAssert.Throws<ArgumentNullException>(() => g.Contains(null));
- }
-
- [TestMethod]
- public void CompositeDisposable_IsReadOnly()
- {
- Assert.IsFalse(new CompositeDisposable().IsReadOnly);
- }
-
- [TestMethod, ExpectedException(typeof(ArgumentNullException))]
- public void CompositeDisposable_CopyTo_Null()
- {
- new CompositeDisposable().CopyTo(null, 0);
- }
-
- [TestMethod, ExpectedException(typeof(ArgumentOutOfRangeException))]
- public void CompositeDisposable_CopyTo_Negative()
- {
- new CompositeDisposable().CopyTo(new IDisposable[2], -1);
- }
-
- [TestMethod, ExpectedException(typeof(ArgumentOutOfRangeException))]
- public void CompositeDisposable_CopyTo_BeyondEnd()
- {
- new CompositeDisposable().CopyTo(new IDisposable[2], 2);
- }
-
- [TestMethod]
- public void CompositeDisposable_CopyTo()
- {
- var d1 = Disposable.Create(() => { });
- var d2 = Disposable.Create(() => { });
- var g = new CompositeDisposable(new List<IDisposable> { d1, d2 });
-
- var d = new IDisposable[3];
- g.CopyTo(d, 1);
- Assert.AreSame(d1, d[1]);
- Assert.AreSame(d2, d[2]);
- }
-
- [TestMethod]
- public void CompositeDisposable_ToArray()
- {
- var d1 = Disposable.Create(() => { });
- var d2 = Disposable.Create(() => { });
- var g = new CompositeDisposable(d1, d2);
- Assert.AreEqual(2, g.Count);
- var x = Enumerable.ToArray(g);
- Assert.IsTrue(g.ToArray().SequenceEqual(new[] { d1, d2 }));
- }
-
- [TestMethod]
- public void CompositeDisposable_GetEnumerator()
- {
- var d1 = Disposable.Create(() => { });
- var d2 = Disposable.Create(() => { });
- var g = new CompositeDisposable(d1, d2);
- var lst = new List<IDisposable>();
- foreach (var x in g)
- lst.Add(x);
- Assert.IsTrue(lst.SequenceEqual(new[] { d1, d2 }));
- }
-
- [TestMethod]
- public void CompositeDisposable_GetEnumeratorNonGeneric()
- {
- var d1 = Disposable.Create(() => { });
- var d2 = Disposable.Create(() => { });
- var g = new CompositeDisposable(d1, d2);
- var lst = new List<IDisposable>();
- foreach (IDisposable x in (IEnumerable)g)
- lst.Add(x);
- Assert.IsTrue(lst.SequenceEqual(new[] { d1, d2 }));
- }
-
- [TestMethod]
- public void CompositeDisposable_CollectionInitializer()
- {
- var d1 = Disposable.Create(() => { });
- var d2 = Disposable.Create(() => { });
- var g = new CompositeDisposable { d1, d2 };
- Assert.AreEqual(2, g.Count);
- Assert.IsTrue(g.Contains(d1));
- Assert.IsTrue(g.Contains(d2));
- }
-
- [TestMethod, ExpectedException(typeof(ArgumentNullException))]
- public void CompositeDisposable_AddNull()
- {
- new CompositeDisposable().Add(null);
- }
-
- [TestMethod]
- public void CompositeDisposable_Add()
- {
- var d1 = Disposable.Create(() => { });
- var d2 = Disposable.Create(() => { });
- var g = new CompositeDisposable(d1);
- Assert.AreEqual(1, g.Count);
- Assert.IsTrue(g.Contains(d1));
- g.Add(d2);
- Assert.AreEqual(2, g.Count);
- Assert.IsTrue(g.Contains(d2));
- }
-
- [TestMethod]
- public void CompositeDisposable_AddAfterDispose()
- {
- var disp1 = false;
- var disp2 = false;
-
- var d1 = Disposable.Create(() => { disp1 = true; });
- var d2 = Disposable.Create(() => { disp2 = true; });
- var g = new CompositeDisposable(d1);
- Assert.AreEqual(1, g.Count);
-
- g.Dispose();
- Assert.IsTrue(disp1);
- Assert.AreEqual(0, g.Count); // CHECK
-
- g.Add(d2);
- Assert.IsTrue(disp2);
- Assert.AreEqual(0, g.Count); // CHECK
-
- Assert.IsTrue(g.IsDisposed);
- }
-
- [TestMethod]
- public void CompositeDisposable_Remove()
- {
- var disp1 = false;
- var disp2 = false;
-
- var d1 = Disposable.Create(() => { disp1 = true; });
- var d2 = Disposable.Create(() => { disp2 = true; });
- var g = new CompositeDisposable(d1, d2);
-
- Assert.AreEqual(2, g.Count);
- Assert.IsTrue(g.Contains(d1));
- Assert.IsTrue(g.Contains(d2));
-
- Assert.IsTrue(g.Remove(d1));
- Assert.AreEqual(1, g.Count);
- Assert.IsFalse(g.Contains(d1));
- Assert.IsTrue(g.Contains(d2));
- Assert.IsTrue(disp1);
-
- Assert.IsTrue(g.Remove(d2));
- Assert.IsFalse(g.Contains(d1));
- Assert.IsFalse(g.Contains(d2));
- Assert.IsTrue(disp2);
-
- var disp3 = false;
- var d3 = Disposable.Create(() => { disp3 = true; });
- Assert.IsFalse(g.Remove(d3));
- Assert.IsFalse(disp3);
- }
-
- [TestMethod]
- public void CompositeDisposable_Clear()
- {
- var disp1 = false;
- var disp2 = false;
-
- var d1 = Disposable.Create(() => { disp1 = true; });
- var d2 = Disposable.Create(() => { disp2 = true; });
- var g = new CompositeDisposable(d1, d2);
- Assert.AreEqual(2, g.Count);
-
- g.Clear();
- Assert.IsTrue(disp1);
- Assert.IsTrue(disp2);
- Assert.AreEqual(0, g.Count);
-
- var disp3 = false;
- var d3 = Disposable.Create(() => { disp3 = true; });
- g.Add(d3);
- Assert.IsFalse(disp3);
- Assert.AreEqual(1, g.Count);
- }
-
- [TestMethod]
- public void CompositeDisposable_RemoveOptimizationBehavior()
- {
- var g = new CompositeDisposable();
- var m = new Dictionary<int, IDisposable>();
- var r = new List<int>();
-
- var N = 100;
-
- for (int i = 0; i < N; i++)
- {
- var j = i;
-
- var d = Disposable.Create(() => r.Add(j));
- m[j] = d;
- g.Add(d);
- }
-
- var d1 = Enumerable.Range(0, N).Where(i => i % 2 == 0).ToArray();
- foreach (var i in d1)
- g.Remove(m[i]);
- Assert.IsTrue(r.SequenceEqual(d1));
-
- var d2 = Enumerable.Range(0, N).Where(i => i % 3 == 0).ToArray();
- foreach (var i in d2)
- g.Remove(m[i]);
- Assert.IsTrue(r.SequenceEqual(d1.Concat(d2.Where(x => !d1.Any(y => x == y)))));
-
- var d3 = Enumerable.Range(0, N).Where(i => i % 5 == 0).ToArray();
- foreach (var i in d3)
- g.Remove(m[i]);
- Assert.IsTrue(r.SequenceEqual(d1.Concat(d2.Where(x => !d1.Any(y => x == y))).Concat(d3.Where(x => !d1.Any(y => x == y) && !d2.Any(y => x == y)))));
-
- g.Dispose();
-
- var z = r.Except(d1.Union(d2).Union(d3)).ToArray();
- Assert.IsTrue(z.SequenceEqual(Enumerable.Range(0, N).Where(i => !(i % 2 == 0 || i % 3 == 0 || i % 5 == 0))));
- }
-
- [TestMethod, ExpectedException(typeof(ArgumentNullException))]
- public void CompositeDisposable_RemoveNull()
- {
- new CompositeDisposable().Remove(null);
- }
-
-#if DESKTOPCLR40 || DESKTOPCLR45
- [TestMethod, ExpectedException(typeof(ArgumentNullException))]
- public void CancellationDisposable_Ctor_Null()
- {
- new CancellationDisposable(null);
- }
-
- [TestMethod]
- public void CancellationDisposable_DefaultCtor()
- {
- var c = new CancellationDisposable();
- Assert.IsNotNull(c.Token);
- Assert.IsFalse(c.Token.IsCancellationRequested);
- Assert.IsTrue(c.Token.CanBeCanceled);
- c.Dispose();
- Assert.IsTrue(c.IsDisposed);
- Assert.IsTrue(c.Token.IsCancellationRequested);
- }
-
- [TestMethod]
- public void CancellationDisposable_TokenCtor()
- {
- var t = new CancellationTokenSource();
- var c = new CancellationDisposable(t);
- Assert.IsTrue(t.Token == c.Token);
- Assert.IsFalse(c.Token.IsCancellationRequested);
- Assert.IsTrue(c.Token.CanBeCanceled);
- c.Dispose();
- Assert.IsTrue(c.IsDisposed);
- Assert.IsTrue(c.Token.IsCancellationRequested);
- }
-#endif
- [TestMethod, ExpectedException(typeof(ArgumentNullException))]
- public void ContextDisposable_CreateNullContext()
- {
- new ContextDisposable(null, Disposable.Empty);
- }
-
- [TestMethod, ExpectedException(typeof(ArgumentNullException))]
- public void ContextDisposable_CreateNullDisposable()
- {
- new ContextDisposable(new SynchronizationContext(), null);
- }
-
- [TestMethod]
- public void ContextDisposable()
- {
- var disp = false;
- var m = new MySync();
- var c = new ContextDisposable(m, Disposable.Create(() => { disp = true; }));
- Assert.AreSame(m, c.Context);
- Assert.IsFalse(m._disposed);
- Assert.IsFalse(disp);
- c.Dispose();
- Assert.IsTrue(c.IsDisposed);
- Assert.IsTrue(m._disposed);
- Assert.IsTrue(disp);
- }
-
- class MySync : SynchronizationContext
- {
- internal bool _disposed = false;
-
- public override void Post(SendOrPostCallback d, object state)
- {
- d(state);
- _disposed = true;
- }
- }
-
- [TestMethod]
- public void SerialDisposable_Ctor_Prop()
- {
- var m = new SerialDisposable();
- Assert.IsNull(m.Disposable);
- }
-
- [TestMethod]
- public void SerialDisposable_ReplaceBeforeDispose()
- {
- var disp1 = false;
- var disp2 = false;
-
- var m = new SerialDisposable();
- var d1 = Disposable.Create(() => { disp1 = true; });
- m.Disposable = d1;
- Assert.AreSame(d1, m.Disposable);
- Assert.IsFalse(disp1);
-
- var d2 = Disposable.Create(() => { disp2 = true; });
- m.Disposable = d2;
- Assert.AreSame(d2, m.Disposable);
- Assert.IsTrue(disp1);
- Assert.IsFalse(disp2);
- }
-
- [TestMethod]
- public void SerialDisposable_ReplaceAfterDispose()
- {
- var disp1 = false;
- var disp2 = false;
-
- var m = new SerialDisposable();
- m.Dispose();
- Assert.IsTrue(m.IsDisposed);
-
- var d1 = Disposable.Create(() => { disp1 = true; });
- m.Disposable = d1;
- Assert.IsNull(m.Disposable); // CHECK
- Assert.IsTrue(disp1);
-
- var d2 = Disposable.Create(() => { disp2 = true; });
- m.Disposable = d2;
- Assert.IsNull(m.Disposable); // CHECK
- Assert.IsTrue(disp2);
- }
-
- [TestMethod]
- public void SerialDisposable_Dispose()
- {
- var disp = false;
-
- var m = new SerialDisposable();
- var d = Disposable.Create(() => { disp = true; });
- m.Disposable = d;
- Assert.AreSame(d, m.Disposable);
- Assert.IsFalse(disp);
-
- m.Dispose();
- Assert.IsTrue(m.IsDisposed);
- Assert.IsTrue(disp);
- //Assert.IsNull(m.Disposable); // BREAKING CHANGE v2 > v1.x - Undefined behavior after disposal.
- }
-
- [TestMethod, ExpectedException(typeof(ArgumentNullException))]
- public void RefCountDisposable_Ctor_Null()
- {
- new RefCountDisposable(null);
- }
-
- [TestMethod]
- public void RefCountDisposable_SingleReference()
- {
- var d = new BooleanDisposable();
- var r = new RefCountDisposable(d);
- Assert.IsFalse(d.IsDisposed);
- r.Dispose();
- Assert.IsTrue(d.IsDisposed);
- r.Dispose();
- Assert.IsTrue(d.IsDisposed);
- }
-
- [TestMethod]
- public void RefCountDisposable_RefCounting()
- {
- var d = new BooleanDisposable();
- var r = new RefCountDisposable(d);
- Assert.IsFalse(d.IsDisposed);
-
- var d1 = r.GetDisposable();
- var d2 = r.GetDisposable();
- Assert.IsFalse(d.IsDisposed);
-
- d1.Dispose();
- Assert.IsFalse(d.IsDisposed);
-
- d2.Dispose();
- Assert.IsFalse(d.IsDisposed); // CHECK
-
- r.Dispose();
- Assert.IsTrue(d.IsDisposed);
- Assert.IsTrue(r.IsDisposed);
-
- var d3 = r.GetDisposable(); // CHECK
- d3.Dispose();
- }
-
- [TestMethod]
- public void RefCountDisposable_PrimaryDisposesFirst()
- {
- var d = new BooleanDisposable();
- var r = new RefCountDisposable(d);
- Assert.IsFalse(d.IsDisposed);
-
- var d1 = r.GetDisposable();
- var d2 = r.GetDisposable();
- Assert.IsFalse(d.IsDisposed);
-
- d1.Dispose();
- Assert.IsFalse(d.IsDisposed);
-
- r.Dispose();
- Assert.IsFalse(d.IsDisposed);
-
- d2.Dispose();
- Assert.IsTrue(d.IsDisposed);
- }
-
- [TestMethod]
- public void ScheduledDisposable_Null()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => new ScheduledDisposable(null, Disposable.Empty));
- ReactiveAssert.Throws<ArgumentNullException>(() => new ScheduledDisposable(Scheduler.Immediate, null));
- }
-
- [TestMethod]
- public void ScheduledDisposable()
- {
- var d = new BooleanDisposable();
- var s = new ScheduledDisposable(Scheduler.Immediate, d);
-
- Assert.IsFalse(d.IsDisposed);
-
- Assert.AreSame(Scheduler.Immediate, s.Scheduler);
- Assert.AreSame(d, s.Disposable);
-
- s.Dispose();
-
- Assert.IsTrue(d.IsDisposed);
- Assert.IsTrue(s.IsDisposed);
-
- Assert.AreSame(Scheduler.Immediate, s.Scheduler);
- //Assert.AreSame(d, s.Disposable); // BREAKING CHANGE v2 > v1.x - Undefined behavior after disposal.
- s.Disposable.Dispose(); // This should be a nop.
- }
-
- [TestMethod]
- public void MultipleAssignmentDisposable()
- {
- var m = new MultipleAssignmentDisposable();
-
- var disp1 = false;
- var d1 = Disposable.Create(() => { disp1 = true; });
- m.Disposable = d1;
- Assert.AreSame(d1, m.Disposable);
- Assert.IsFalse(m.IsDisposed);
-
- var disp2 = false;
- var d2 = Disposable.Create(() => { disp2 = true; });
- m.Disposable = d2;
- Assert.AreSame(d2, m.Disposable);
- Assert.IsFalse(m.IsDisposed);
- Assert.IsFalse(disp1);
-
- m.Dispose();
- Assert.IsTrue(disp2);
- Assert.IsTrue(m.IsDisposed);
- //Assert.IsNull(m.Disposable); // BREAKING CHANGE v2 > v1.x - Undefined behavior after disposal.
- m.Disposable.Dispose(); // This should be a nop.
-
- var disp3 = false;
- var d3 = Disposable.Create(() => { disp3 = true; });
- m.Disposable = d3;
- Assert.IsTrue(disp3);
- //Assert.IsNull(m.Disposable); // BREAKING CHANGE v2 > v1.x - Undefined behavior after disposal.
- m.Disposable.Dispose(); // This should be a nop.
- Assert.IsTrue(m.IsDisposed);
- }
- }
-}
diff --git a/Rx.NET/Tests.System.Reactive/Tests/EventLoopSchedulerTest.cs b/Rx.NET/Tests.System.Reactive/Tests/EventLoopSchedulerTest.cs
deleted file mode 100644
index f5b06f6..0000000
--- a/Rx.NET/Tests.System.Reactive/Tests/EventLoopSchedulerTest.cs
+++ /dev/null
@@ -1,374 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Reactive.Concurrency;
-using System.Threading;
-using Microsoft.Reactive.Testing;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-
-namespace ReactiveTests.Tests
-{
- [TestClass]
- public class EventLoopSchedulerTest
- {
- [TestMethod]
- public void EventLoop_ArgumentChecking()
- {
- var el = new EventLoopScheduler();
-
- ReactiveAssert.Throws<ArgumentNullException>(() => new EventLoopScheduler(null));
- ReactiveAssert.Throws<ArgumentNullException>(() => el.Schedule<int>(42, default(Func<IScheduler, int, IDisposable>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => el.Schedule<int>(42, DateTimeOffset.Now, default(Func<IScheduler, int, IDisposable>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => el.Schedule<int>(42, TimeSpan.Zero, default(Func<IScheduler, int, IDisposable>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => el.SchedulePeriodic(42, TimeSpan.FromSeconds(1), default(Func<int, int>)));
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => el.SchedulePeriodic(42, TimeSpan.FromSeconds(-1), _ => _));
- }
-
- [TestMethod]
- public void EventLoop_Now()
- {
- var res = new EventLoopScheduler().Now - DateTime.Now;
- Assert.IsTrue(res.Seconds < 1);
- }
-
- [TestMethod]
- public void EventLoop_ScheduleAction()
- {
- var ran = false;
- var gate = new Semaphore(0, 1);
- var el = new EventLoopScheduler();
- el.Schedule(() => { ran = true;
- gate.Release(); });
- Assert.IsTrue(gate.WaitOne(TimeSpan.FromSeconds(2)));
- Assert.IsTrue(ran);
- }
-
- [TestMethod]
- public void EventLoop_DifferentThread()
- {
- var id = default(int);
- var gate = new Semaphore(0, 1);
- var el = new EventLoopScheduler();
- el.Schedule(() =>
- {
- id = Thread.CurrentThread.ManagedThreadId;
- gate.Release();
- });
- Assert.IsTrue(gate.WaitOne(TimeSpan.FromSeconds(2)));
- Assert.AreNotEqual(Thread.CurrentThread.ManagedThreadId, id);
- }
-
- [TestMethod]
- public void EventLoop_ScheduleOrderedActions()
- {
- var results = new List<int>();
- var gate = new Semaphore(0, 1);
- var el = new EventLoopScheduler();
- el.Schedule(() => results.Add(0));
- el.Schedule(() =>
- {
- results.Add(1);
- gate.Release();
- });
- Assert.IsTrue(gate.WaitOne(TimeSpan.FromSeconds(2)));
- results.AssertEqual(0, 1);
- }
-
- [TestMethod]
- public void EventLoop_SchedulerDisposed()
- {
- var d = 0;
- var e = new ManualResetEvent(false);
- var f = new ManualResetEvent(false);
-
- var results = new List<int>();
- var el = new EventLoopScheduler();
- el.Schedule(() => results.Add(0));
- el.Schedule(() =>
- {
- el.Dispose();
- e.Set();
-
- results.Add(1);
-
- try
- {
- el.Schedule(() => { throw new Exception("Should be disposed!"); });
- f.Set();
- }
- catch (ObjectDisposedException)
- {
- // BREAKING CHANGE v2 > v1.x - New exception behavior.
- Interlocked.Increment(ref d);
- f.Set();
- }
- });
-
- e.WaitOne();
-
- try
- {
- el.Schedule(() => results.Add(2));
- }
- catch (ObjectDisposedException)
- {
- // BREAKING CHANGE v2 > v1.x - New exception behavior.
- Interlocked.Increment(ref d);
- }
-
- f.WaitOne();
-
- results.AssertEqual(0, 1);
-
- Assert.AreEqual(2, d);
- }
-
- [TestMethod]
- public void EventLoop_ScheduleTimeOrderedActions()
- {
- var results = new List<int>();
- var gate = new Semaphore(0, 1);
- var el = new EventLoopScheduler();
- el.Schedule(TimeSpan.FromMilliseconds(50), () => results.Add(1));
- el.Schedule(TimeSpan.FromMilliseconds(100), () =>
- {
- results.Add(0);
- gate.Release();
- });
-
- Assert.IsTrue(gate.WaitOne(TimeSpan.FromSeconds(2)));
- results.AssertEqual(1, 0);
- }
-
- [TestMethod]
- public void EventLoop_ScheduleOrderedAndTimedActions()
- {
- var results = new List<int>();
- var gate = new Semaphore(0, 1);
- var el = new EventLoopScheduler();
- el.Schedule(() => results.Add(1));
- el.Schedule(TimeSpan.FromMilliseconds(100), () =>
- {
- results.Add(0);
- gate.Release();
- });
-
- Assert.IsTrue(gate.WaitOne(TimeSpan.FromSeconds(2)));
- results.AssertEqual(1, 0);
- }
-
- [TestMethod]
- public void EventLoop_ScheduleTimeOrderedInFlightActions()
- {
- var results = new List<int>();
- var gate = new Semaphore(0, 1);
- var el = new EventLoopScheduler();
-
- el.Schedule(TimeSpan.FromMilliseconds(100), () =>
- {
- results.Add(0);
- el.Schedule(TimeSpan.FromMilliseconds(50), () => results.Add(1));
- el.Schedule(TimeSpan.FromMilliseconds(100), ()=>
- {
- results.Add(2);
- gate.Release();
- });
- });
-
- Assert.IsTrue(gate.WaitOne(TimeSpan.FromSeconds(2)));
- results.AssertEqual(0, 1, 2);
- }
-
-
- [TestMethod]
- public void EventLoop_ScheduleTimeAndOrderedInFlightActions()
- {
- var results = new List<int>();
- var gate = new Semaphore(0, 1);
- var el = new EventLoopScheduler();
-
- el.Schedule(TimeSpan.FromMilliseconds(100), () =>
- {
- results.Add(0);
- el.Schedule(() => results.Add(4));
- el.Schedule(TimeSpan.FromMilliseconds(50), () => results.Add(1));
- el.Schedule(TimeSpan.FromMilliseconds(100), () =>
- {
- results.Add(2);
- gate.Release();
- });
- });
-
- Assert.IsTrue(gate.WaitOne(TimeSpan.FromSeconds(2)));
- results.AssertEqual(0, 4, 1, 2);
- }
-
- [TestMethod]
- public void EventLoop_ScheduleActionNested()
- {
- var ran = false;
- var el = new EventLoopScheduler();
- var gate = new Semaphore(0, 1);
- el.Schedule(() => el.Schedule(() => { ran = true;
- gate.Release(); }));
- Assert.IsTrue(gate.WaitOne(TimeSpan.FromSeconds(2)));
- Assert.IsTrue(ran);
- }
-
-#if !SILVERLIGHT
- [TestMethod]
- [Ignore]
- public void EventLoop_ScheduleActionDue()
- {
- var ran = false;
- var el = new EventLoopScheduler();
- var sw = new Stopwatch();
- var gate = new Semaphore(0, 1);
- sw.Start();
- el.Schedule(TimeSpan.FromSeconds(0.2), () => {
- ran = true;
- sw.Stop();
- gate.Release();
- });
- Assert.IsTrue(gate.WaitOne(TimeSpan.FromSeconds(2)));
- Assert.IsTrue(ran, "ran");
- Assert.IsTrue(sw.ElapsedMilliseconds > 180, "due " + sw.ElapsedMilliseconds);
- }
-
- [TestMethod]
- [Ignore]
- public void EventLoop_ScheduleActionDueNested()
- {
- var ran = false;
- var el = new EventLoopScheduler();
- var gate = new Semaphore(0, 1);
-
- var sw = new Stopwatch();
- sw.Start();
- el.Schedule(TimeSpan.FromSeconds(0.2), () =>
- {
- sw.Stop();
- sw.Start();
- el.Schedule(TimeSpan.FromSeconds(0.2), () =>
- {
- sw.Stop();
- ran = true;
- gate.Release();
- });
- });
-
- Assert.IsTrue(gate.WaitOne(TimeSpan.FromSeconds(2)));
- Assert.IsTrue(ran, "ran");
- Assert.IsTrue(sw.ElapsedMilliseconds > 380, "due " + sw.ElapsedMilliseconds);
- }
-#endif
-
-#if !NO_PERF
-#if !NO_STOPWATCH
- [TestMethod]
- public void Stopwatch()
- {
- StopwatchTest.Run(new EventLoopScheduler());
- }
-#endif
-#endif
-
-#if !NO_CDS
- [TestMethod]
- public void EventLoop_Immediate()
- {
- var M = 1000;
- var N = 4;
-
- for (int i = 0; i < N; i++)
- {
- for (int j = 1; j <= M; j *= 10)
- {
- using (var e = new EventLoopScheduler())
- {
- var cd = new CountdownEvent(j);
-
- for (int k = 0; k < j; k++)
- e.Schedule(() => cd.Signal());
-
- if (!cd.Wait(10000))
- Assert.Fail("j = " + j);
- }
- }
- }
- }
-
- [TestMethod]
- public void EventLoop_TimeCollisions()
- {
- var M = 1000;
- var N = 4;
-
- for (int i = 0; i < N; i++)
- {
- for (int j = 1; j <= M; j *= 10)
- {
- using (var e = new EventLoopScheduler())
- {
- var cd = new CountdownEvent(j);
-
- for (int k = 0; k < j; k++)
- e.Schedule(TimeSpan.FromMilliseconds(100), () => cd.Signal());
-
- if (!cd.Wait(10000))
- Assert.Fail("j = " + j);
- }
- }
- }
- }
-
- [TestMethod]
- public void EventLoop_Spread()
- {
- var M = 1000;
- var N = 4;
-
- for (int i = 0; i < N; i++)
- {
- for (int j = 1; j <= M; j *= 10)
- {
- using (var e = new EventLoopScheduler())
- {
- var cd = new CountdownEvent(j);
-
- for (int k = 0; k < j; k++)
- e.Schedule(TimeSpan.FromMilliseconds(k), () => cd.Signal());
-
- if (!cd.Wait(10000))
- Assert.Fail("j = " + j);
- }
- }
- }
- }
-#endif
-
- [TestMethod]
- public void EventLoop_Periodic()
- {
- var n = 0;
-
- using (var s = new EventLoopScheduler())
- {
- var e = new ManualResetEvent(false);
-
- var d = s.SchedulePeriodic(TimeSpan.FromMilliseconds(25), () =>
- {
- if (Interlocked.Increment(ref n) == 10)
- e.Set();
- });
-
- if (!e.WaitOne(10000))
- Assert.Fail();
-
- d.Dispose();
- }
- }
- }
-}
diff --git a/Rx.NET/Tests.System.Reactive/Tests/EventPatternSourceBaseTest.cs b/Rx.NET/Tests.System.Reactive/Tests/EventPatternSourceBaseTest.cs
deleted file mode 100644
index 21add27..0000000
--- a/Rx.NET/Tests.System.Reactive/Tests/EventPatternSourceBaseTest.cs
+++ /dev/null
@@ -1,57 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System;
-using System.Reactive;
-using System.Reactive.Linq;
-using Microsoft.Reactive.Testing;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-
-namespace ReactiveTests.Tests
-{
- [TestClass]
- public class EventPatternSourceBaseTest
- {
- [TestMethod]
- public void ArgumentChecking()
- {
- var xs = Observable.Empty<EventPattern<object, EventArgs>>();
-
- ReactiveAssert.Throws<ArgumentNullException>(() => new MyEventPatternSource(null, (a, x) => { }));
- ReactiveAssert.Throws<ArgumentNullException>(() => new MyEventPatternSource(xs, null));
-
- var e = new MyEventPatternSource(xs, (a, x) => { });
- e.GetInvoke = h => (_, __) => { };
-
- ReactiveAssert.Throws<ArgumentNullException>(() => e.OnNext += null);
-
- e.GetInvoke = h => null;
- ReactiveAssert.Throws<ArgumentNullException>(() => e.OnNext += (_, __) => { });
- e.GetInvoke = null;
-
- ReactiveAssert.Throws<ArgumentNullException>(() => e.OnNext -= null);
- }
- }
-
- class MyEventPatternSource : EventPatternSourceBase<object, EventArgs>
- {
- public MyEventPatternSource(IObservable<EventPattern<object, EventArgs>> source, Action<Action<object, EventArgs>, EventPattern<object, EventArgs>> invokeHandler)
- : base(source, invokeHandler)
- {
- }
-
- public Func<EventHandler<EventArgs>, Action<object, EventArgs>> GetInvoke;
-
- public event EventHandler<EventArgs> OnNext
- {
- add
- {
- base.Add(value, GetInvoke(value));
- }
-
- remove
- {
- Remove(value);
- }
- }
- }
-}
diff --git a/Rx.NET/Tests.System.Reactive/Tests/HistoricalSchedulerTest.cs b/Rx.NET/Tests.System.Reactive/Tests/HistoricalSchedulerTest.cs
deleted file mode 100644
index cd91f92..0000000
--- a/Rx.NET/Tests.System.Reactive/Tests/HistoricalSchedulerTest.cs
+++ /dev/null
@@ -1,417 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Reactive;
-using System.Reactive.Concurrency;
-using Microsoft.Reactive.Testing;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-
-namespace ReactiveTests.Tests
-{
- [TestClass]
- public class HistoricalSchedulerTest
- {
- public DateTimeOffset Time(int i)
- {
- return new DateTimeOffset(1979, 10, 31, 4, 30, 15, TimeSpan.Zero).AddDays(i);
- }
-
- [TestMethod]
- public void Ctor()
- {
- var s = new HistoricalScheduler();
-
- Assert.AreEqual(DateTimeOffset.MinValue, s.Clock);
- Assert.AreEqual(DateTimeOffset.MinValue, s.Now);
- Assert.AreEqual(false, s.IsEnabled);
- }
-
- [TestMethod]
- public void Start_Stop()
- {
- var s = new HistoricalScheduler();
-
- var list = new List<Timestamped<int>>();
-
- var ts = TimeSpan.FromHours(1);
-
- s.Schedule(Time(0), () => list.Add(new Timestamped<int>(1, s.Now)));
- s.Schedule(Time(1), () => list.Add(new Timestamped<int>(2, s.Now)));
- s.Schedule(Time(2), () => s.Stop());
- s.Schedule(Time(3), () => list.Add(new Timestamped<int>(3, s.Now)));
- s.Schedule(Time(4), () => s.Stop());
- s.Schedule(Time(5), () => s.Start());
- s.Schedule(Time(6), () => list.Add(new Timestamped<int>(4, s.Now)));
-
- s.Start();
-
- Assert.AreEqual(Time(2), s.Now);
- Assert.AreEqual(Time(2), s.Clock);
-
- s.Start();
-
- Assert.AreEqual(Time(4), s.Now);
- Assert.AreEqual(Time(4), s.Clock);
-
- s.Start();
-
- Assert.AreEqual(Time(6), s.Now);
- Assert.AreEqual(Time(6), s.Clock);
-
- s.Start();
-
- Assert.AreEqual(Time(6), s.Now);
- Assert.AreEqual(Time(6), s.Clock);
-
- list.AssertEqual(
- new Timestamped<int>(1, Time(0)),
- new Timestamped<int>(2, Time(1)),
- new Timestamped<int>(3, Time(3)),
- new Timestamped<int>(4, Time(6))
- );
- }
-
- [TestMethod]
- public void Order()
- {
- var s = new HistoricalScheduler();
-
- var list = new List<Timestamped<int>>();
-
- s.Schedule(Time(2), () => list.Add(new Timestamped<int>(2, s.Now)));
-
- s.Schedule(Time(3), () => list.Add(new Timestamped<int>(3, s.Now)));
-
- s.Schedule(Time(1), () => list.Add(new Timestamped<int>(0, s.Now)));
- s.Schedule(Time(1), () => list.Add(new Timestamped<int>(1, s.Now)));
-
- s.Start();
-
- list.AssertEqual(
- new Timestamped<int>(0, Time(1)),
- new Timestamped<int>(1, Time(1)),
- new Timestamped<int>(2, Time(2)),
- new Timestamped<int>(3, Time(3))
- );
- }
-
- [TestMethod]
- public void Cancellation()
- {
- var s = new HistoricalScheduler();
-
- var list = new List<Timestamped<int>>();
-
- var d = s.Schedule(Time(2), () => list.Add(new Timestamped<int>(2, s.Now)));
-
- s.Schedule(Time(1), () =>
- {
- list.Add(new Timestamped<int>(0, s.Now));
- d.Dispose();
- });
-
- s.Start();
-
- list.AssertEqual(
- new Timestamped<int>(0, Time(1))
- );
- }
-
- [TestMethod]
- public void AdvanceTo_ArgumentChecking()
- {
- var now = DateTimeOffset.Now;
-
- var s = new HistoricalScheduler(now);
-
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => s.AdvanceTo(now.Subtract(TimeSpan.FromSeconds(1))));
- }
-
- [TestMethod]
- public void AdvanceTo()
- {
- var s = new HistoricalScheduler();
-
- var list = new List<Timestamped<int>>();
-
- s.Schedule(Time(0), () => list.Add(new Timestamped<int>(0, s.Now)));
- s.Schedule(Time(1), () => list.Add(new Timestamped<int>(1, s.Now)));
- s.Schedule(Time(2), () => list.Add(new Timestamped<int>(2, s.Now)));
- s.Schedule(Time(10), () => list.Add(new Timestamped<int>(10, s.Now)));
- s.Schedule(Time(11), () => list.Add(new Timestamped<int>(11, s.Now)));
-
- s.AdvanceTo(Time(8));
-
- Assert.AreEqual(Time(8), s.Now);
- Assert.AreEqual(Time(8), s.Clock);
-
- list.AssertEqual(
- new Timestamped<int>(0, Time(0)),
- new Timestamped<int>(1, Time(1)),
- new Timestamped<int>(2, Time(2))
- );
-
- s.AdvanceTo(Time(8));
-
- Assert.AreEqual(Time(8), s.Now);
- Assert.AreEqual(Time(8), s.Clock);
-
- list.AssertEqual(
- new Timestamped<int>(0, Time(0)),
- new Timestamped<int>(1, Time(1)),
- new Timestamped<int>(2, Time(2))
- );
-
- s.Schedule(Time(7), () => list.Add(new Timestamped<int>(7, s.Now)));
- s.Schedule(Time(8), () => list.Add(new Timestamped<int>(8, s.Now)));
-
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => s.AdvanceTo(Time(4)));
-
- Assert.AreEqual(Time(8), s.Now);
- Assert.AreEqual(Time(8), s.Clock);
-
- list.AssertEqual(
- new Timestamped<int>(0, Time(0)),
- new Timestamped<int>(1, Time(1)),
- new Timestamped<int>(2, Time(2))
- );
-
- s.AdvanceTo(Time(10));
-
- Assert.AreEqual(Time(10), s.Now);
- Assert.AreEqual(Time(10), s.Clock);
-
- list.AssertEqual(
- new Timestamped<int>(0, Time(0)),
- new Timestamped<int>(1, Time(1)),
- new Timestamped<int>(2, Time(2)),
- new Timestamped<int>(7, Time(8)),
- new Timestamped<int>(8, Time(8)),
- new Timestamped<int>(10, Time(10))
- );
-
- s.AdvanceTo(Time(100));
-
- Assert.AreEqual(Time(100), s.Now);
- Assert.AreEqual(Time(100), s.Clock);
-
- list.AssertEqual(
- new Timestamped<int>(0, Time(0)),
- new Timestamped<int>(1, Time(1)),
- new Timestamped<int>(2, Time(2)),
- new Timestamped<int>(7, Time(8)),
- new Timestamped<int>(8, Time(8)),
- new Timestamped<int>(10, Time(10)),
- new Timestamped<int>(11, Time(11))
- );
- }
-
- [TestMethod]
- public void AdvanceBy_ArgumentChecking()
- {
- var s = new HistoricalScheduler();
-
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => s.AdvanceBy(TimeSpan.FromSeconds(-1)));
- }
-
- [TestMethod]
- public void AdvanceBy()
- {
- var s = new HistoricalScheduler();
-
- var list = new List<Timestamped<int>>();
-
- s.Schedule(Time(0), () => list.Add(new Timestamped<int>(0, s.Now)));
- s.Schedule(Time(1), () => list.Add(new Timestamped<int>(1, s.Now)));
- s.Schedule(Time(2), () => list.Add(new Timestamped<int>(2, s.Now)));
- s.Schedule(Time(10), () => list.Add(new Timestamped<int>(10, s.Now)));
- s.Schedule(Time(11), () => list.Add(new Timestamped<int>(11, s.Now)));
-
- s.AdvanceBy(Time(8) - s.Now);
-
- Assert.AreEqual(Time(8), s.Now);
- Assert.AreEqual(Time(8), s.Clock);
-
- list.AssertEqual(
- new Timestamped<int>(0, Time(0)),
- new Timestamped<int>(1, Time(1)),
- new Timestamped<int>(2, Time(2))
- );
-
- s.Schedule(Time(7), () => list.Add(new Timestamped<int>(7, s.Now)));
- s.Schedule(Time(8), () => list.Add(new Timestamped<int>(8, s.Now)));
-
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => s.AdvanceBy(TimeSpan.FromDays(-4)));
-
- Assert.AreEqual(Time(8), s.Now);
- Assert.AreEqual(Time(8), s.Clock);
-
- list.AssertEqual(
- new Timestamped<int>(0, Time(0)),
- new Timestamped<int>(1, Time(1)),
- new Timestamped<int>(2, Time(2))
- );
-
- s.AdvanceBy(TimeSpan.Zero);
-
- Assert.AreEqual(Time(8), s.Now);
- Assert.AreEqual(Time(8), s.Clock);
-
- list.AssertEqual(
- new Timestamped<int>(0, Time(0)),
- new Timestamped<int>(1, Time(1)),
- new Timestamped<int>(2, Time(2))
- );
-
- s.AdvanceBy(TimeSpan.FromDays(2));
-
- Assert.AreEqual(Time(10), s.Now);
- Assert.AreEqual(Time(10), s.Clock);
-
- list.AssertEqual(
- new Timestamped<int>(0, Time(0)),
- new Timestamped<int>(1, Time(1)),
- new Timestamped<int>(2, Time(2)),
- new Timestamped<int>(7, Time(8)),
- new Timestamped<int>(8, Time(8)),
- new Timestamped<int>(10, Time(10))
- );
-
- s.AdvanceBy(TimeSpan.FromDays(90));
-
- Assert.AreEqual(Time(100), s.Now);
- Assert.AreEqual(Time(100), s.Clock);
-
- list.AssertEqual(
- new Timestamped<int>(0, Time(0)),
- new Timestamped<int>(1, Time(1)),
- new Timestamped<int>(2, Time(2)),
- new Timestamped<int>(7, Time(8)),
- new Timestamped<int>(8, Time(8)),
- new Timestamped<int>(10, Time(10)),
- new Timestamped<int>(11, Time(11))
- );
- }
-
- [TestMethod]
- public void IsEnabled()
- {
- var s = new HistoricalScheduler();
-
- Assert.AreEqual(false, s.IsEnabled);
-
- s.Schedule(() =>
- {
- Assert.AreEqual(true, s.IsEnabled);
- s.Stop();
- Assert.AreEqual(false, s.IsEnabled);
- });
-
- Assert.AreEqual(false, s.IsEnabled);
-
- s.Start();
-
- Assert.AreEqual(false, s.IsEnabled);
- }
-
- [TestMethod]
- public void No_Nested_AdvanceBy()
- {
- var s = new HistoricalScheduler();
-
- s.Schedule(() => s.AdvanceBy(TimeSpan.FromSeconds(1)));
-
- ReactiveAssert.Throws<InvalidOperationException>(() => s.Start());
- }
-
- [TestMethod]
- public void No_Nested_AdvanceTo()
- {
- var s = new HistoricalScheduler();
-
- s.Schedule(() => s.AdvanceTo(DateTimeOffset.Now.AddDays(1)));
-
- ReactiveAssert.Throws<InvalidOperationException>(() => s.Start());
- }
-
- [TestMethod]
- public void Sleep_ArgumentChecking()
- {
- var s = new HistoricalScheduler(DateTimeOffset.Now);
-
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => s.Sleep(TimeSpan.FromSeconds(-1)));
- }
-
- [TestMethod]
- public void Sleep1()
- {
- var now = new DateTimeOffset(1983, 2, 11, 12, 0, 0, TimeSpan.Zero);
-
- var s = new HistoricalScheduler(now);
-
- s.Sleep(TimeSpan.FromDays(1));
-
- Assert.AreEqual(now + TimeSpan.FromDays(1), s.Clock);
- }
-
- [TestMethod]
- public void Sleep2()
- {
- var s = new HistoricalScheduler();
-
- var n = 0;
-
- s.Schedule(s.Now.AddMinutes(1), rec =>
- {
- s.Sleep(TimeSpan.FromMinutes(3));
- n++;
-
- rec(s.Now.AddMinutes(1));
- });
-
- s.AdvanceTo(s.Now + TimeSpan.FromMinutes(5));
-
- Assert.AreEqual(2, n);
- }
-
- [TestMethod]
- public void WithComparer_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => new HistoricalScheduler(DateTimeOffset.Now, null));
- }
-
- [TestMethod]
- public void WithComparer()
- {
- var now = DateTimeOffset.Now;
-
- var s = new HistoricalScheduler(now, new ReverseComparer<DateTimeOffset>(Comparer<DateTimeOffset>.Default));
-
- var res = new List<int>();
-
- s.Schedule(now - TimeSpan.FromSeconds(1), () => res.Add(1));
- s.Schedule(now - TimeSpan.FromSeconds(2), () => res.Add(2));
-
- s.Start();
-
- Assert.IsTrue(new[] { 1, 2 }.SequenceEqual(res));
- }
-
- class ReverseComparer<T> : IComparer<T>
- {
- private readonly IComparer<T> _comparer;
-
- public ReverseComparer(IComparer<T> comparer)
- {
- _comparer = comparer;
- }
-
- public int Compare(T x, T y)
- {
- return -_comparer.Compare(x, y);
- }
- }
- }
-}
diff --git a/Rx.NET/Tests.System.Reactive/Tests/ImmediateSchedulerTest.cs b/Rx.NET/Tests.System.Reactive/Tests/ImmediateSchedulerTest.cs
deleted file mode 100644
index dd9510e..0000000
--- a/Rx.NET/Tests.System.Reactive/Tests/ImmediateSchedulerTest.cs
+++ /dev/null
@@ -1,159 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System;
-using System.Diagnostics;
-using System.Reactive.Concurrency;
-using System.Reactive.Disposables;
-using System.Threading;
-using Microsoft.Reactive.Testing;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-
-namespace ReactiveTests.Tests
-{
- [TestClass]
- public class ImmediateSchedulerTest
- {
- [TestMethod]
- public void Immediate_Now()
- {
- var res = Scheduler.Immediate.Now - DateTime.Now;
- Assert.IsTrue(res.Seconds < 1);
- }
-
- [TestMethod]
- public void Immediate_ScheduleAction()
- {
- var id = Thread.CurrentThread.ManagedThreadId;
- var ran = false;
- Scheduler.Immediate.Schedule(() => { Assert.AreEqual(id, Thread.CurrentThread.ManagedThreadId); ran = true; });
- Assert.IsTrue(ran);
- }
-
- [TestMethod]
- public void Immediate_ScheduleActionError()
- {
- var ex = new Exception();
-
- try
- {
- Scheduler.Immediate.Schedule(() => { throw ex; });
- Assert.Fail();
- }
- catch (Exception e)
- {
- Assert.AreSame(e, ex);
- }
- }
-
- [TestMethod]
- public void Immediate_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Scheduler.Immediate.Schedule<int>(42, default(Func<IScheduler, int, IDisposable>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Scheduler.Immediate.Schedule<int>(42, DateTimeOffset.Now, default(Func<IScheduler, int, IDisposable>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Scheduler.Immediate.Schedule<int>(42, TimeSpan.Zero, default(Func<IScheduler, int, IDisposable>)));
- }
-
- [TestMethod]
- public void Immediate_Simple1()
- {
- var _x = 0;
- Scheduler.Immediate.Schedule<int>(42, (self, x) => { _x = x; return Disposable.Empty; });
- Assert.AreEqual(42, _x);
- }
-
- [TestMethod]
- public void Immediate_Simple2()
- {
- var _x = 0;
- Scheduler.Immediate.Schedule<int>(42, DateTimeOffset.Now, (self, x) => { _x = x; return Disposable.Empty; });
- Assert.AreEqual(42, _x);
- }
-
- [TestMethod]
- public void Immediate_Simple3()
- {
- var _x = 0;
- Scheduler.Immediate.Schedule<int>(42, TimeSpan.Zero, (self, x) => { _x = x; return Disposable.Empty; });
- Assert.AreEqual(42, _x);
- }
-
- [TestMethod]
- public void Immediate_Recursive1()
- {
- var _x = 0;
- var _y = 0;
- Scheduler.Immediate.Schedule<int>(42, (self, x) => { _x = x; return self.Schedule<int>(43, (self2, y) => { _y = y; return Disposable.Empty; }); });
- Assert.AreEqual(42, _x);
- Assert.AreEqual(43, _y);
- }
-
- [TestMethod]
- public void Immediate_Recursive2()
- {
- var _x = 0;
- var _y = 0;
- Scheduler.Immediate.Schedule<int>(42, (self, x) => { _x = x; return self.Schedule<int>(43, DateTimeOffset.Now, (self2, y) => { _y = y; return Disposable.Empty; }); });
- Assert.AreEqual(42, _x);
- Assert.AreEqual(43, _y);
- }
-
- [TestMethod]
- public void Immediate_Recursive3()
- {
- var _x = 0;
- var _y = 0;
- Scheduler.Immediate.Schedule<int>(42, (self, x) => { _x = x; return self.Schedule<int>(43, TimeSpan.FromMilliseconds(100), (self2, y) => { _y = y; return Disposable.Empty; }); });
- Assert.AreEqual(42, _x);
- Assert.AreEqual(43, _y);
- }
-
- [TestMethod]
- public void Immediate_ArgumentChecking_More()
- {
- Scheduler.Immediate.Schedule(42, (self, state) =>
- {
- ReactiveAssert.Throws<ArgumentNullException>(() =>
- {
- self.Schedule(43, default(Func<IScheduler, int, IDisposable>));
- });
-
- return Disposable.Empty;
- });
-
- Scheduler.Immediate.Schedule(42, (self, state) =>
- {
- ReactiveAssert.Throws<ArgumentNullException>(() =>
- {
- self.Schedule(43, TimeSpan.FromSeconds(1), default(Func<IScheduler, int, IDisposable>));
- });
-
- return Disposable.Empty;
- });
-
- Scheduler.Immediate.Schedule(42, (self, state) =>
- {
- ReactiveAssert.Throws<ArgumentNullException>(() =>
- {
- self.Schedule(43, DateTimeOffset.UtcNow.AddDays(1), default(Func<IScheduler, int, IDisposable>));
- });
-
- return Disposable.Empty;
- });
- }
-
-#if !SILVERLIGHT
- [TestMethod]
- [Ignore]
- public void Immediate_ScheduleActionDue()
- {
- var id = Thread.CurrentThread.ManagedThreadId;
- var ran = false;
- var sw = new Stopwatch();
- sw.Start();
- Scheduler.Immediate.Schedule(TimeSpan.FromSeconds(0.2), () => { sw.Stop(); Assert.AreEqual(id, Thread.CurrentThread.ManagedThreadId); ran = true; });
- Assert.IsTrue(ran, "ran");
- Assert.IsTrue(sw.ElapsedMilliseconds > 180, "due " + sw.ElapsedMilliseconds);
- }
-#endif
- }
-}
diff --git a/Rx.NET/Tests.System.Reactive/Tests/ListObservableTest.cs b/Rx.NET/Tests.System.Reactive/Tests/ListObservableTest.cs
deleted file mode 100644
index 4dd8d5d..0000000
--- a/Rx.NET/Tests.System.Reactive/Tests/ListObservableTest.cs
+++ /dev/null
@@ -1,434 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.Reactive;
-using System.Reactive.Concurrency;
-using System.Reactive.Linq;
-using Microsoft.Reactive.Testing;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-
-namespace ReactiveTests.Tests
-{
- [TestClass]
- public partial class ListObservableTest : ReactiveTest
- {
- [TestMethod]
- public void Ctor_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => new ListObservable<int>(null));
- }
-
- [TestMethod]
- public void Subscribe_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => new ListObservable<int>(Observable.Never<int>()).Subscribe(null));
- }
-
- [TestMethod]
- public void Value_None()
- {
- var o = new ListObservable<int>(Observable.Empty<int>());
- ReactiveAssert.Throws<InvalidOperationException>(() => { var t = o.Value; });
- }
-
- [TestMethod]
- public void Value_Some()
- {
- var o = new ListObservable<int>(Observable.Range(0, 10));
- Assert.AreEqual(9, o.Value);
- }
-
- [TestMethod]
- public void IndexOf_None()
- {
- var o = new ListObservable<int>(Observable.Empty<int>());
- Assert.AreEqual(-1, o.IndexOf(0));
- }
-
- [TestMethod]
- public void IndexOf_Some_NotFound()
- {
- var o = new ListObservable<int>(Observable.Range(0, 10));
- Assert.AreEqual(-1, o.IndexOf(100));
- }
-
- [TestMethod]
- public void IndexOf_Some_Found()
- {
- var o = new ListObservable<int>(Observable.Range(0, 10));
- Assert.AreEqual(3, o.IndexOf(3));
- }
-
- [TestMethod]
- public void RemoveAt_Some_NotFound()
- {
- var o = new ListObservable<int>(Observable.Range(0, 10));
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => o.RemoveAt(100));
- o.AssertEqual(0, 1, 2, 3, 4, 5, 6, 7, 8, 9);
- }
-
- [TestMethod]
- public void RemoveAt_Some_Found()
- {
- var o = new ListObservable<int>(Observable.Range(0, 10));
- o.RemoveAt(3);
- o.AssertEqual(0, 1, 2, 4, 5, 6, 7, 8, 9);
- }
-
- [TestMethod]
- public void Insert_Invalid()
- {
- var o = new ListObservable<int>(Observable.Range(0, 10));
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => o.Insert(100, 100));
- o.AssertEqual(0, 1, 2, 3, 4, 5, 6, 7, 8, 9);
- }
-
- [TestMethod]
- public void Insert_Invalid_2()
- {
- var o = new ListObservable<int>(Observable.Range(0, 10));
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => o.Insert(-1, 100));
- o.AssertEqual(0, 1, 2, 3, 4, 5, 6, 7, 8, 9);
- }
-
- [TestMethod]
- public void Insert_Beginning()
- {
- var o = new ListObservable<int>(Observable.Range(0, 10));
- o.Insert(0, -1);
- o.AssertEqual(-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9);
- }
-
- [TestMethod]
- public void Insert_Middle()
- {
- var o = new ListObservable<int>(Observable.Range(0, 10));
- o.Insert(3, -1);
- o.AssertEqual(0, 1, 2, -1, 3, 4, 5, 6, 7, 8, 9);
- }
-
- [TestMethod]
- public void Change_Beginning()
- {
- var o = new ListObservable<int>(Observable.Range(0, 10));
- o[0] = -1;
- o.AssertEqual(-1, 1, 2, 3, 4, 5, 6, 7, 8, 9);
- }
-
- [TestMethod]
- public void Change_Middle()
- {
- var o = new ListObservable<int>(Observable.Range(0, 10));
- o[5] = -1;
- o.AssertEqual(0, 1, 2, 3, 4, -1, 6, 7, 8, 9);
- }
-
- [TestMethod]
- public void Change_End()
- {
- var o = new ListObservable<int>(Observable.Range(0, 10));
- o[9] = -1;
- o.AssertEqual(0, 1, 2, 3, 4, 5, 6, 7, 8, -1);
- }
-
- [TestMethod]
- public void Change_Error()
- {
- var o = new ListObservable<int>(Observable.Range(0, 10));
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => o[100] = -1);
- }
-
- [TestMethod]
- public void Insert_End()
- {
- var o = new ListObservable<int>(Observable.Range(0, 10));
- o.Insert(10, -1);
- o.AssertEqual(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, -1);
- }
-
- [TestMethod]
- public void Contains_None()
- {
- var o = new ListObservable<int>(Observable.Empty<int>());
- Assert.AreEqual(false, o.Contains(0));
- }
-
- [TestMethod]
- public void Contains_Some_NotFound()
- {
- var o = new ListObservable<int>(Observable.Range(0, 10));
- Assert.AreEqual(false, o.Contains(100));
- }
-
- [TestMethod]
- public void Contains_Some_Found()
- {
- var o = new ListObservable<int>(Observable.Range(0, 10));
- Assert.AreEqual(true, o.Contains(3));
- }
-
- [TestMethod]
- public void Clear()
- {
- var o = new ListObservable<int>(Observable.Range(0, 10));
- o.Clear();
- o.AssertEqual();
- }
-
- [TestMethod]
- public void IsReadOnly()
- {
- var o = new ListObservable<int>(Observable.Never<int>());
- Assert.AreEqual(false, o.IsReadOnly);
- }
-
- [TestMethod]
- public void This_None()
- {
- var o = new ListObservable<int>(Observable.Empty<int>());
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => { var t = o[0]; });
- }
-
- [TestMethod]
- public void This_Some_NotFound()
- {
- var o = new ListObservable<int>(Observable.Range(0, 10));
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => { var t = o[100]; });
- }
-
- [TestMethod]
- public void This_Some_Found()
- {
- var o = new ListObservable<int>(Observable.Range(0, 10));
- Assert.AreEqual(5, o[5]);
- }
-
- [TestMethod]
- public void CopyTo_RightSize()
- {
- var o = new ListObservable<int>(Observable.Range(0, 10));
- var array = new int[10];
- o.CopyTo(array, 0);
- array.AssertEqual(0, 1, 2, 3, 4, 5, 6, 7, 8, 9);
- }
-
- [TestMethod]
- public void CopyTo_RightSize_Offset()
- {
- var o = new ListObservable<int>(Observable.Range(0, 10));
- var array = new int[10];
- ReactiveAssert.Throws<ArgumentException>(() => o.CopyTo(array, 3));
- }
-
- [TestMethod]
- public void CopyTo_Bigger()
- {
- var o = new ListObservable<int>(Observable.Range(0, 10));
- var array = new int[15];
- o.CopyTo(array, 0);
- array.AssertEqual(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 0, 0, 0, 0);
- }
-
- [TestMethod]
- public void CopyTo_Bigger_Offset()
- {
- var o = new ListObservable<int>(Observable.Range(0, 10));
- var array = new int[15];
- o.CopyTo(array, 3);
- array.AssertEqual(0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 0);
- }
-
- [TestMethod]
- public void CopyTo_Smaller()
- {
- var o = new ListObservable<int>(Observable.Range(0, 10));
- var array = new int[5];
- ReactiveAssert.Throws<ArgumentException>(() => o.CopyTo(array, 0));
- }
-
- [TestMethod]
- public void CopyTo_Smaller_Offset()
- {
- var o = new ListObservable<int>(Observable.Range(0, 10));
- var array = new int[5];
- ReactiveAssert.Throws<ArgumentException>(() => o.CopyTo(array, 3));
- }
-
- [TestMethod]
- public void Add_Empty()
- {
- var o = new ListObservable<int>(Observable.Empty<int>());
- o.Add(100);
- o.AssertEqual(100);
- }
-
- [TestMethod]
- public void Add_Some()
- {
- var o = new ListObservable<int>(Observable.Return(200));
- o.Add(100);
- o.AssertEqual(200, 100);
- }
-
- [TestMethod]
- public void Remove_None()
- {
- var o = new ListObservable<int>(Observable.Empty<int>());
- Assert.AreEqual(false, o.Remove(0));
- o.AssertEqual();
- }
-
- [TestMethod]
- public void Remove_Some_NotFound()
- {
- var o = new ListObservable<int>(Observable.Range(0, 10));
- Assert.AreEqual(false, o.Remove(100));
- o.AssertEqual(0, 1, 2, 3, 4, 5, 6, 7, 8, 9);
- }
-
- [TestMethod]
- public void Remove_Some_Found()
- {
- var o = new ListObservable<int>(Observable.Range(0, 10));
- Assert.AreEqual(true, o.Remove(3));
- o.AssertEqual(0, 1, 2, 4, 5, 6, 7, 8, 9);
- }
-
- [TestMethod]
- public void ForEach()
- {
- var o = new ListObservable<int>(Observable.Range(0, 10));
- var l = new List<int>();
-
- foreach (var x in o)
- l.Add(x);
-
- l.AssertEqual(0, 1, 2, 3, 4, 5, 6, 7, 8, 9);
- }
-
- [TestMethod]
- public void ForEach_Old()
- {
- var o = new ListObservable<int>(Observable.Range(0, 10));
- var l = new List<int>();
-
- foreach (int x in (IEnumerable)o)
- l.Add(x);
-
- l.AssertEqual(0, 1, 2, 3, 4, 5, 6, 7, 8, 9);
- }
-
- [TestMethod]
- public void Subscribe_Never()
- {
- var s = new TestScheduler();
-
- var xs = s.CreateHotObservable<int>(
- );
-
- var results = s.Start(() => new ListObservable<int>(xs));
-
- results.Messages.AssertEqual(
- );
- }
-
- [TestMethod]
- public void Subscribe_Infinite()
- {
- var s = new TestScheduler();
-
- var xs = s.CreateHotObservable<int>(
- OnNext(300, 1)
- );
-
- var results = s.Start(() => new ListObservable<int>(xs));
-
- results.Messages.AssertEqual(
- );
- }
-
- [TestMethod]
- public void Subscribe_Error()
- {
- var s = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = s.CreateHotObservable<int>(
- OnNext(300, 1),
- OnError<int>(400, ex)
- );
-
- var results = s.Start(() => new ListObservable<int>(xs));
-
- results.Messages.AssertEqual(
- OnError<Object>(400, ex)
- );
- }
-
- [TestMethod]
- public void Subscribe_Completed()
- {
- var s = new TestScheduler();
-
- var xs = s.CreateHotObservable<int>(
- OnNext(300, 1),
- OnCompleted<int>(400)
- );
-
- var results = s.Start(() => new ListObservable<int>(xs));
-
- results.Messages.AssertEqual(
- OnCompleted<Object>(400)
- );
- }
-
- [TestMethod]
- public void Subscribe_Disposed()
- {
- var s = new TestScheduler();
-
- var xs = s.CreateHotObservable<int>(
- OnNext(300, 1),
- OnCompleted<int>(1100)
- );
-
- var results = s.Start(() => new ListObservable<int>(xs));
-
- results.Messages.AssertEqual(
- );
- }
-
- [TestMethod]
- public void Subscribe_Disposed_Multi()
- {
- var s = new TestScheduler();
-
- var xs = s.CreateHotObservable<int>(
- OnNext(300, 1),
- OnCompleted<int>(400)
- );
-
- var o = new ListObservable<int>(xs);
-
- var results1 = s.CreateObserver<object>();
- var results2 = s.CreateObserver<object>();
-
- var d1 = o.Subscribe(results1);
- var d2 = o.Subscribe(results2);
-
- s.ScheduleAbsolute(350, () => d1.Dispose());
- s.ScheduleAbsolute(500, () => d2.Dispose());
-
- s.Start();
-
- results1.Messages.AssertEqual(
- );
-
- results2.Messages.AssertEqual(
- );
- }
- }
-}
diff --git a/Rx.NET/Tests.System.Reactive/Tests/MySubject.cs b/Rx.NET/Tests.System.Reactive/Tests/MySubject.cs
deleted file mode 100644
index b1dd907..0000000
--- a/Rx.NET/Tests.System.Reactive/Tests/MySubject.cs
+++ /dev/null
@@ -1,53 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System;
-using System.Collections.Generic;
-using System.Reactive.Disposables;
-using System.Reactive.Subjects;
-
-namespace ReactiveTests.Tests
-{
- class MySubject : ISubject<int>
- {
- private Dictionary<int, IDisposable> _disposeOn = new Dictionary<int, IDisposable>();
-
- public void DisposeOn(int value, IDisposable disposable)
- {
- _disposeOn[value] = disposable;
- }
-
- private IObserver<int> _observer;
-
- public void OnNext(int value)
- {
- _observer.OnNext(value);
-
- IDisposable disconnect;
- if (_disposeOn.TryGetValue(value, out disconnect))
- disconnect.Dispose();
- }
-
- public void OnError(Exception exception)
- {
- _observer.OnError(exception);
- }
-
- public void OnCompleted()
- {
- _observer.OnCompleted();
- }
-
- public IDisposable Subscribe(IObserver<int> observer)
- {
- _subscribeCount++;
- _observer = observer;
- return Disposable.Create(() => { _disposed = true; });
- }
-
- private int _subscribeCount;
- private bool _disposed;
-
- public int SubscribeCount { get { return _subscribeCount; } }
- public bool Disposed { get { return _disposed; } }
- }
-}
diff --git a/Rx.NET/Tests.System.Reactive/Tests/NewThreadSchedulerTest.cs b/Rx.NET/Tests.System.Reactive/Tests/NewThreadSchedulerTest.cs
deleted file mode 100644
index 2d6efc6..0000000
--- a/Rx.NET/Tests.System.Reactive/Tests/NewThreadSchedulerTest.cs
+++ /dev/null
@@ -1,118 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System;
-using System.Diagnostics;
-using System.Reactive.Concurrency;
-using System.Reactive.Disposables;
-using System.Threading;
-using Microsoft.Reactive.Testing;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-
-namespace ReactiveTests.Tests
-{
- [TestClass]
- public class NewThreadSchedulerTest
- {
- [TestMethod]
- public void NewThread_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => new NewThreadScheduler(null));
- ReactiveAssert.Throws<ArgumentNullException>(() => NewThreadScheduler.Default.Schedule<int>(42, default(Func<IScheduler, int, IDisposable>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => NewThreadScheduler.Default.Schedule<int>(42, DateTimeOffset.Now, default(Func<IScheduler, int, IDisposable>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => NewThreadScheduler.Default.Schedule<int>(42, TimeSpan.Zero, default(Func<IScheduler, int, IDisposable>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => NewThreadScheduler.Default.SchedulePeriodic<int>(42, TimeSpan.FromSeconds(1), default(Func<int, int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => NewThreadScheduler.Default.ScheduleLongRunning<int>(42, default(Action<int, ICancelable>)));
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => NewThreadScheduler.Default.SchedulePeriodic<int>(42, TimeSpan.FromSeconds(-1), _ => _));
- }
-
- [TestMethod]
- public void NewThread_Now()
- {
- var res = NewThreadScheduler.Default.Now - DateTime.Now;
- Assert.IsTrue(res.Seconds < 1);
- }
-
- [TestMethod]
- public void NewThread_ScheduleAction()
- {
- var id = Thread.CurrentThread.ManagedThreadId;
- var nt = NewThreadScheduler.Default;
- var evt = new ManualResetEvent(false);
- nt.Schedule(() => { Assert.AreNotEqual(id, Thread.CurrentThread.ManagedThreadId); evt.Set(); });
- evt.WaitOne();
- }
-
-#if !SILVERLIGHT
- [TestMethod]
- [Ignore]
- public void NewThread_ScheduleActionDue()
- {
- var id = Thread.CurrentThread.ManagedThreadId;
- var nt = NewThreadScheduler.Default;
- var evt = new ManualResetEvent(false);
- var sw = new Stopwatch();
- sw.Start();
- nt.Schedule(TimeSpan.FromSeconds(0.2), () => { sw.Stop(); Assert.AreNotEqual(id, Thread.CurrentThread.ManagedThreadId); evt.Set(); });
- evt.WaitOne();
- Assert.IsTrue(sw.ElapsedMilliseconds > 180, "due " + sw.ElapsedMilliseconds);
- }
-#endif
-
-#if !NO_PERF
-#if !NO_STOPWATCH
- [TestMethod]
- public void Stopwatch()
- {
- StopwatchTest.Run(NewThreadScheduler.Default);
- }
-#endif
-#endif
-
- [TestMethod]
- public void NewThread_Periodic()
- {
- var n = 0;
- var e = new ManualResetEvent(false);
-
- var d = NewThreadScheduler.Default.SchedulePeriodic(TimeSpan.FromMilliseconds(25), () =>
- {
- if (Interlocked.Increment(ref n) == 10)
- e.Set();
- });
-
- if (!e.WaitOne(10000))
- Assert.Fail();
-
- d.Dispose();
- }
-
- [TestMethod]
- public void NewThread_Periodic_NonReentrant()
- {
- var n = 0;
- var fail = false;
-
- var d = NewThreadScheduler.Default.SchedulePeriodic(0, TimeSpan.FromMilliseconds(50), x =>
- {
- try
- {
- if (Interlocked.Increment(ref n) > 1) // Without an AsyncLock this would fail.
- fail = true;
-
- Thread.Sleep(100);
-
- return x + 1;
- }
- finally
- {
- Interlocked.Decrement(ref n);
- }
- });
-
- Thread.Sleep(500);
- d.Dispose();
-
- Assert.IsFalse(fail);
- }
- }
-}
diff --git a/Rx.NET/Tests.System.Reactive/Tests/NotificationTest.cs b/Rx.NET/Tests.System.Reactive/Tests/NotificationTest.cs
deleted file mode 100644
index c05ce0b..0000000
--- a/Rx.NET/Tests.System.Reactive/Tests/NotificationTest.cs
+++ /dev/null
@@ -1,592 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System;
-using System.Reactive;
-using System.Threading;
-using Microsoft.Reactive.Testing;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-
-namespace ReactiveTests.Tests
-{
- [TestClass]
- public class NotificationTest : ReactiveTest
- {
- #region ToObservable
-
- [TestMethod]
- public void ToObservable_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Notification.CreateOnNext<int>(1).ToObservable(null));
- }
-
- [TestMethod]
- public void ToObservable_Empty()
- {
- var scheduler = new TestScheduler();
-
- var res = scheduler.Start(() =>
- Notification.CreateOnCompleted<int>().ToObservable(scheduler)
- );
-
- res.Messages.AssertEqual(
- OnCompleted<int>(201)
- );
- }
-
- [TestMethod]
- public void ToObservable_Return()
- {
- var scheduler = new TestScheduler();
-
- var res = scheduler.Start(() =>
- Notification.CreateOnNext<int>(42).ToObservable(scheduler)
- );
-
- res.Messages.AssertEqual(
- OnNext<int>(201, 42),
- OnCompleted<int>(201)
- );
- }
-
- [TestMethod]
- public void ToObservable_Throw()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var res = scheduler.Start(() =>
- Notification.CreateOnError<int>(ex).ToObservable(scheduler)
- );
-
- res.Messages.AssertEqual(
- OnError<int>(201, ex)
- );
- }
-
- [TestMethod]
- public void ToObservable_CurrentThread()
- {
- var evt = new ManualResetEvent(false);
-
- Notification.CreateOnCompleted<int>().ToObservable().Subscribe(_ => { }, () =>
- {
- evt.Set();
- });
-
- evt.WaitOne();
- }
-
- #endregion
-
- [TestMethod]
- public void Notifications_Equality()
- {
- var n = Notification.CreateOnNext(42);
- var e = Notification.CreateOnError<int>(new Exception());
- var c = Notification.CreateOnCompleted<int>();
-
- var n1 = n; var n2 = n;
- var e1 = e; var e2 = e;
- var c1 = c; var c2 = c;
-
- Assert.IsTrue(n1 == n2);
- Assert.IsTrue(e1 == e2);
- Assert.IsTrue(c1 == c2);
-
- Assert.IsTrue(n1.Equals(n2));
- Assert.IsTrue(e1.Equals(e2));
- Assert.IsTrue(c1.Equals(c2));
- }
-
- [TestMethod]
- public void OnNext_CtorAndProps()
- {
- var n = Notification.CreateOnNext<int>(42);
- Assert.AreEqual(NotificationKind.OnNext, n.Kind);
- Assert.IsTrue(n.HasValue);
- Assert.AreEqual(42, n.Value);
- Assert.IsNull(n.Exception);
- }
-
- [TestMethod]
- public void OnNext_Equality()
- {
- var n1 = Notification.CreateOnNext<int>(42);
- var n2 = Notification.CreateOnNext<int>(42);
- var n3 = Notification.CreateOnNext<int>(24);
- var n4 = Notification.CreateOnCompleted<int>();
-
- Assert.IsTrue(n1.Equals(n1));
- Assert.IsTrue(n1.Equals(n2));
- Assert.IsTrue(n2.Equals(n1));
-
- Assert.IsFalse(n1.Equals(null));
- Assert.IsFalse(n1.Equals(""));
-
- Assert.IsFalse(n1.Equals(n3));
- Assert.IsFalse(n3.Equals(n1));
- Assert.IsFalse(n1.Equals(n4));
- Assert.IsFalse(n4.Equals(n1));
-
- Assert.IsTrue(n1 == n2);
- Assert.IsTrue(n2 == n1);
- Assert.IsFalse(n1 == null);
- Assert.IsFalse(null == n1);
- Assert.IsTrue(!(n1 != n2));
- Assert.IsTrue(!(n2 != n1));
- Assert.IsFalse(!(n1 != null));
- Assert.IsFalse(!(null != n1));
- }
-
- [TestMethod]
- public void OnNext_GetHashCode()
- {
- var n1 = Notification.CreateOnNext<int>(42);
- var n2 = Notification.CreateOnNext<int>(42);
-
- Assert.AreNotEqual(0, n1.GetHashCode());
- Assert.AreEqual(n1.GetHashCode(), n2.GetHashCode());
- }
-
- [TestMethod]
- public void OnNext_ToString()
- {
- var n1 = Notification.CreateOnNext<int>(42);
- Assert.IsTrue(n1.ToString().Contains("OnNext"));
- Assert.IsTrue(n1.ToString().Contains(42.ToString()));
- }
-
- [TestMethod]
- public void OnNext_AcceptObserver()
- {
- var con = new CheckOnNextObserver();
- var n1 = Notification.CreateOnNext<int>(42);
- n1.Accept(con);
-
- Assert.AreEqual(42, con.Value);
- }
-
- class CheckOnNextObserver : IObserver<int>
- {
- public void OnNext(int value)
- {
- Value = value;
- }
-
- public int Value { get; private set; }
-
- public void OnError(Exception exception)
- {
- throw new NotImplementedException();
- }
-
- public void OnCompleted()
- {
- throw new NotImplementedException();
- }
- }
-
- [TestMethod]
- public void OnNext_AcceptObserverWithResult()
- {
- var n1 = Notification.CreateOnNext<int>(42);
- var res = n1.Accept(new AcceptObserver(x => "OK", _ => { Assert.Fail(); return null; }, () => { Assert.Fail(); return null; }));
-
- Assert.AreEqual("OK", res);
- }
-
- [TestMethod]
- public void OnNext_AcceptObserverWithResult_Null()
- {
- var n1 = Notification.CreateOnNext<int>(42);
- ReactiveAssert.Throws<ArgumentNullException>(() => n1.Accept(default(IObserver<int, string>)));
- }
-
- [TestMethod]
- public void OnNext_AcceptAction()
- {
- var obs = false;
-
- var n1 = Notification.CreateOnNext<int>(42);
- n1.Accept(x => { obs = true; }, _ => { Assert.Fail(); }, () => { Assert.Fail(); });
-
- Assert.IsTrue(obs);
- }
-
- [TestMethod]
- public void OnNext_Accept_ArgumentChecking()
- {
- var n = Notification.CreateOnNext<int>(42);
-
- ReactiveAssert.Throws<ArgumentNullException>(() => n.Accept(default(IObserver<int>)));
-
- ReactiveAssert.Throws<ArgumentNullException>(() => n.Accept(default(Action<int>), ex => { }, () => { }));
- ReactiveAssert.Throws<ArgumentNullException>(() => n.Accept(x => { }, default(Action<Exception>), () => { }));
- ReactiveAssert.Throws<ArgumentNullException>(() => n.Accept(x => { }, ex => { }, default(Action)));
-
- ReactiveAssert.Throws<ArgumentNullException>(() => n.Accept<string>(default(Func<int, string>), ex => "", () => ""));
- ReactiveAssert.Throws<ArgumentNullException>(() => n.Accept<string>(x => "", default(Func<Exception, string>), () => ""));
- ReactiveAssert.Throws<ArgumentNullException>(() => n.Accept<string>(x => "", ex => "", default(Func<string>)));
- }
-
- [TestMethod]
- public void OnNext_AcceptActionWithResult()
- {
- var n1 = Notification.CreateOnNext<int>(42);
- var res = n1.Accept(x => "OK", _ => { Assert.Fail(); return null; }, () => { Assert.Fail(); return null; });
-
- Assert.AreEqual("OK", res);
- }
-
- [TestMethod, ExpectedException(typeof(ArgumentNullException))]
- public void OnError_CtorNull()
- {
- Notification.CreateOnError<int>(null);
- }
-
- [TestMethod]
- public void OnError_Accept_ArgumentChecking()
- {
- var n = Notification.CreateOnError<int>(new Exception());
-
- ReactiveAssert.Throws<ArgumentNullException>(() => n.Accept(default(IObserver<int>)));
-
- ReactiveAssert.Throws<ArgumentNullException>(() => n.Accept(default(Action<int>), ex => { }, () => { }));
- ReactiveAssert.Throws<ArgumentNullException>(() => n.Accept(x => { }, default(Action<Exception>), () => { }));
- ReactiveAssert.Throws<ArgumentNullException>(() => n.Accept(x => { }, ex => { }, default(Action)));
-
- ReactiveAssert.Throws<ArgumentNullException>(() => n.Accept<string>(default(Func<int, string>), ex => "", () => ""));
- ReactiveAssert.Throws<ArgumentNullException>(() => n.Accept<string>(x => "", default(Func<Exception, string>), () => ""));
- ReactiveAssert.Throws<ArgumentNullException>(() => n.Accept<string>(x => "", ex => "", default(Func<string>)));
- }
-
- [TestMethod]
- public void OnError_CtorAndProps()
- {
- var e = new Exception();
- var n = Notification.CreateOnError<int>(e);
- Assert.AreEqual(NotificationKind.OnError, n.Kind);
- Assert.IsFalse(n.HasValue);
- Assert.AreSame(e, n.Exception);
-
- try
- {
- var x = n.Value;
- Assert.Fail();
- }
- catch (Exception _e)
- {
- Assert.AreSame(e, _e);
- }
- }
-
- [TestMethod]
- public void OnError_Equality()
- {
- var ex1 = new Exception();
- var ex2 = new Exception();
-
- var n1 = Notification.CreateOnError<int>(ex1);
- var n2 = Notification.CreateOnError<int>(ex1);
- var n3 = Notification.CreateOnError<int>(ex2);
- var n4 = Notification.CreateOnCompleted<int>();
-
- Assert.IsTrue(n1.Equals(n1));
- Assert.IsTrue(n1.Equals(n2));
- Assert.IsTrue(n2.Equals(n1));
-
- Assert.IsFalse(n1.Equals(null));
- Assert.IsFalse(n1.Equals(""));
-
- Assert.IsFalse(n1.Equals(n3));
- Assert.IsFalse(n3.Equals(n1));
- Assert.IsFalse(n1.Equals(n4));
- Assert.IsFalse(n4.Equals(n1));
-
- Assert.IsTrue(n1 == n2);
- Assert.IsTrue(n2 == n1);
- Assert.IsFalse(n1 == null);
- Assert.IsFalse(null == n1);
- Assert.IsTrue(!(n1 != n2));
- Assert.IsTrue(!(n2 != n1));
- Assert.IsFalse(!(n1 != null));
- Assert.IsFalse(!(null != n1));
- }
-
- [TestMethod]
- public void OnError_GetHashCode()
- {
- var ex = new Exception();
-
- var n1 = Notification.CreateOnError<int>(ex);
- var n2 = Notification.CreateOnError<int>(ex);
-
- Assert.AreNotEqual(0, n1.GetHashCode());
- Assert.AreEqual(n1.GetHashCode(), n2.GetHashCode());
- }
-
- [TestMethod]
- public void OnError_ToString()
- {
- var ex = new Exception();
-
- var n1 = Notification.CreateOnError<int>(ex);
- Assert.IsTrue(n1.ToString().Contains("OnError"));
- Assert.IsTrue(n1.ToString().Contains(ex.GetType().Name)); // CHECK, no message?
- }
-
- [TestMethod]
- public void OnError_AcceptObserver()
- {
- var ex = new Exception();
-
- var obs = new CheckOnErrorObserver();
-
- var n1 = Notification.CreateOnError<int>(ex);
- n1.Accept(obs);
-
- Assert.AreSame(ex, obs.Error);
- }
-
- class CheckOnErrorObserver : IObserver<int>
- {
- public void OnNext(int value)
- {
- throw new NotImplementedException();
- }
-
- public Exception Error { get; private set; }
-
- public void OnError(Exception exception)
- {
- Error = exception;
- }
-
- public void OnCompleted()
- {
- throw new NotImplementedException();
- }
- }
-
- [TestMethod]
- public void OnError_AcceptObserverWithResult()
- {
- var ex = new Exception();
-
- var n1 = Notification.CreateOnError<int>(ex);
- var res = n1.Accept(new AcceptObserver(x => { Assert.Fail(); return null; }, _ => { Assert.AreSame(ex, _); return "OK"; }, () => { Assert.Fail(); return null; }));
-
- Assert.AreEqual("OK", res);
- }
-
- [TestMethod]
- public void OnError_AcceptObserverWithResult_Null()
- {
- var n1 = Notification.CreateOnError<int>(new Exception());
- ReactiveAssert.Throws<ArgumentNullException>(() => n1.Accept(default(IObserver<int, string>)));
- }
-
- [TestMethod]
- public void OnError_AcceptAction()
- {
- var ex = new Exception();
-
- var obs = false;
-
- var n1 = Notification.CreateOnError<int>(ex);
- n1.Accept(x => { Assert.Fail(); }, _ => { obs = true; }, () => { Assert.Fail(); });
-
- Assert.IsTrue(obs);
- }
-
- [TestMethod]
- public void OnError_AcceptActionWithResult()
- {
- var ex = new Exception();
-
- var n1 = Notification.CreateOnError<int>(ex);
- var res = n1.Accept(x => { Assert.Fail(); return null; }, x => "OK", () => { Assert.Fail(); return null; });
-
- Assert.AreEqual("OK", res);
- }
-
- [TestMethod]
- public void OnCompleted_CtorAndProps()
- {
- var n = Notification.CreateOnCompleted<int>();
- Assert.AreEqual(NotificationKind.OnCompleted, n.Kind);
- Assert.IsFalse(n.HasValue);
- Assert.IsNull(n.Exception);
-
- var ok = false;
- try
- {
- var x = n.Value;
- Assert.Fail();
- }
- catch (InvalidOperationException)
- {
- ok = true;
- }
-
- Assert.IsTrue(ok);
- }
-
- [TestMethod]
- public void OnCompleted_Accept_ArgumentChecking()
- {
- var n = Notification.CreateOnCompleted<int>();
-
- ReactiveAssert.Throws<ArgumentNullException>(() => n.Accept(default(IObserver<int>)));
-
- ReactiveAssert.Throws<ArgumentNullException>(() => n.Accept(default(Action<int>), ex => { }, () => { }));
- ReactiveAssert.Throws<ArgumentNullException>(() => n.Accept(x => { }, default(Action<Exception>), () => { }));
- ReactiveAssert.Throws<ArgumentNullException>(() => n.Accept(x => { }, ex => { }, default(Action)));
-
- ReactiveAssert.Throws<ArgumentNullException>(() => n.Accept<string>(default(Func<int, string>), ex => "", () => ""));
- ReactiveAssert.Throws<ArgumentNullException>(() => n.Accept<string>(x => "", default(Func<Exception, string>), () => ""));
- ReactiveAssert.Throws<ArgumentNullException>(() => n.Accept<string>(x => "", ex => "", default(Func<string>)));
- }
-
- [TestMethod]
- public void OnCompleted_Equality()
- {
- var n1 = Notification.CreateOnCompleted<int>();
- var n2 = Notification.CreateOnCompleted<int>();
- var n3 = Notification.CreateOnNext<int>(2);
-
- Assert.IsTrue(n1.Equals(n1));
- Assert.IsTrue(n1.Equals(n2));
- Assert.IsTrue(n2.Equals(n1));
-
- Assert.IsFalse(n1.Equals(null));
- Assert.IsFalse(n1.Equals(""));
-
- Assert.IsFalse(n1.Equals(n3));
- Assert.IsFalse(n3.Equals(n1));
-
- Assert.IsTrue(n1 == n2);
- Assert.IsTrue(n2 == n1);
- Assert.IsFalse(n1 == null);
- Assert.IsFalse(null == n1);
- Assert.IsTrue(!(n1 != n2));
- Assert.IsTrue(!(n2 != n1));
- Assert.IsFalse(!(n1 != null));
- Assert.IsFalse(!(null != n1));
- }
-
- [TestMethod]
- public void OnCompleted_GetHashCode()
- {
- var n1 = Notification.CreateOnCompleted<int>();
- var n2 = Notification.CreateOnCompleted<int>();
-
- Assert.AreNotEqual(0, n1.GetHashCode());
- Assert.AreEqual(n1.GetHashCode(), n2.GetHashCode());
- }
-
- [TestMethod]
- public void OnCompleted_ToString()
- {
- var n1 = Notification.CreateOnCompleted<int>();
- Assert.IsTrue(n1.ToString().Contains("OnCompleted"));
- }
-
- [TestMethod]
- public void OnCompleted_AcceptObserver()
- {
- var obs = new CheckOnCompletedObserver();
-
- var n1 = Notification.CreateOnCompleted<int>();
- n1.Accept(obs);
-
- Assert.IsTrue(obs.Completed);
- }
-
- class CheckOnCompletedObserver : IObserver<int>
- {
- public void OnNext(int value)
- {
- throw new NotImplementedException();
- }
-
- public bool Completed { get; private set; }
-
- public void OnError(Exception exception)
- {
- throw new NotImplementedException();
- }
-
- public void OnCompleted()
- {
- Completed = true;
- }
- }
-
- [TestMethod]
- public void OnCompleted_AcceptObserverWithResult()
- {
- var n1 = Notification.CreateOnCompleted<int>();
- var res = n1.Accept(new AcceptObserver(x => { Assert.Fail(); return null; }, _ => { Assert.Fail(); return null; }, () => "OK"));
-
- Assert.AreEqual("OK", res);
- }
-
- [TestMethod]
- public void OnCompleted_AcceptObserverWithResult_Null()
- {
- var n1 = Notification.CreateOnCompleted<int>();
- ReactiveAssert.Throws<ArgumentNullException>(() => n1.Accept(default(IObserver<int, string>)));
- }
-
- [TestMethod]
- public void OnCompleted_AcceptAction()
- {
- var obs = false;
-
- var n1 = Notification.CreateOnCompleted<int>();
- n1.Accept(x => { Assert.Fail(); }, _ => { Assert.Fail(); }, () => { obs = true; });
-
- Assert.IsTrue(obs);
- }
-
- [TestMethod]
- public void OnCompleted_AcceptActionWithResult()
- {
- var n1 = Notification.CreateOnCompleted<int>();
- var res = n1.Accept(x => { Assert.Fail(); return null; }, _ => { Assert.Fail(); return null; }, () => "OK");
-
- Assert.AreEqual("OK", res);
- }
-
- class AcceptObserver : IObserver<int, string>
- {
- private Func<int, string> _onNext;
- private Func<Exception, string> _onError;
- private Func<string> _onCompleted;
-
- public AcceptObserver(Func<int, string> onNext, Func<Exception, string> onError, Func<string> onCompleted)
- {
- _onNext = onNext;
- _onError = onError;
- _onCompleted = onCompleted;
- }
-
- public string OnNext(int value)
- {
- return _onNext(value);
- }
-
- public string OnError(Exception exception)
- {
- return _onError(exception);
- }
-
- public string OnCompleted()
- {
- return _onCompleted();
- }
- }
- }
-}
diff --git a/Rx.NET/Tests.System.Reactive/Tests/ObservableAggregateTest.cs b/Rx.NET/Tests.System.Reactive/Tests/ObservableAggregateTest.cs
deleted file mode 100644
index 75c41cc..0000000
--- a/Rx.NET/Tests.System.Reactive/Tests/ObservableAggregateTest.cs
+++ /dev/null
@@ -1,14465 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Reactive;
-using System.Reactive.Concurrency;
-using System.Reactive.Linq;
-using Microsoft.Reactive.Testing;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using ReactiveTests.Dummies;
-
-namespace ReactiveTests.Tests
-{
- [TestClass]
- public partial class ObservableAggregateTest : ReactiveTest
- {
- #region + Aggregate +
-
- [TestMethod]
- public void Aggregate_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Aggregate<int, int>(default(IObservable<int>), 1, (x, y) => x + y));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Aggregate<int, int>(DummyObservable<int>.Instance, 1, default(Func<int, int, int>)));
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Aggregate<int>(default(IObservable<int>), (x, y) => x + y));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Aggregate<int>(DummyObservable<int>.Instance, default(Func<int, int, int>)));
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Aggregate<int, int, int>(default(IObservable<int>), 1, (x, y) => x + y, x => x));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Aggregate<int, int, int>(DummyObservable<int>.Instance, 1, default(Func<int, int, int>), x => x));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Aggregate<int, int, int>(DummyObservable<int>.Instance, 1, (x, y) => x + y, default(Func<int, int>)));
- }
-
- [TestMethod]
- public void AggregateWithSeed_Empty()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Aggregate(42, (acc, x) => acc + x)
- );
-
- res.Messages.AssertEqual(
- OnNext(250, 42),
- OnCompleted<int>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void AggregateWithSeed_Return()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 24),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Aggregate(42, (acc, x) => acc + x)
- );
-
- res.Messages.AssertEqual(
- OnNext<int>(250, 42 + 24),
- OnCompleted<int>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void AggregateWithSeed_Throw()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnError<int>(210, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.Aggregate(42, (acc, x) => acc + x)
- );
-
- res.Messages.AssertEqual(
- OnError<int>(210, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void AggregateWithSeed_Never()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1)
- );
-
- var res = scheduler.Start(() =>
- xs.Aggregate(42, (acc, x) => acc + x)
- );
-
- res.Messages.AssertEqual(
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
- }
-
- [TestMethod]
- public void AggregateWithSeed_Range()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 0),
- OnNext(220, 1),
- OnNext(230, 2),
- OnNext(240, 3),
- OnNext(250, 4),
- OnCompleted<int>(260)
- );
-
- var res = scheduler.Start(() =>
- xs.Aggregate(42, (acc, x) => acc + x)
- );
-
- res.Messages.AssertEqual(
- OnNext(260, 42 + Enumerable.Range(0, 5).Sum()),
- OnCompleted<int>(260)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 260)
- );
- }
-
- [TestMethod]
- public void AggregateWithSeed_AccumulatorThrows()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 0),
- OnNext(220, 1),
- OnNext(230, 2),
- OnNext(240, 3),
- OnNext(250, 4),
- OnCompleted<int>(260)
- );
-
- var res = scheduler.Start(() =>
- xs.Aggregate(0, (acc, x) => { if (x < 3) return acc + x; throw ex; })
- );
-
- res.Messages.AssertEqual(
- OnError<int>(240, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 240)
- );
- }
-
- [TestMethod]
- public void AggregateWithSeedAndResult_Empty()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Aggregate(42, (acc, x) => acc + x, x => x * 5)
- );
-
- res.Messages.AssertEqual(
- OnNext(250, 42 * 5),
- OnCompleted<int>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void AggregateWithSeedAndResult_Return()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 24),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Aggregate(42, (acc, x) => acc + x, x => x * 5)
- );
-
- res.Messages.AssertEqual(
- OnNext<int>(250, (42 + 24) * 5),
- OnCompleted<int>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void AggregateWithSeedAndResult_Throw()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnError<int>(210, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.Aggregate(42, (acc, x) => acc + x, x => x * 5)
- );
-
- res.Messages.AssertEqual(
- OnError<int>(210, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void AggregateWithSeedAndResult_Never()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1)
- );
-
- var res = scheduler.Start(() =>
- xs.Aggregate(42, (acc, x) => acc + x, x => x * 5)
- );
-
- res.Messages.AssertEqual(
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
- }
-
- [TestMethod]
- public void AggregateWithSeedAndResult_Range()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 0),
- OnNext(220, 1),
- OnNext(230, 2),
- OnNext(240, 3),
- OnNext(250, 4),
- OnCompleted<int>(260)
- );
-
- var res = scheduler.Start(() =>
- xs.Aggregate(42, (acc, x) => acc + x, x => x * 5)
- );
-
- res.Messages.AssertEqual(
- OnNext(260, (42 + Enumerable.Range(0, 5).Sum()) * 5),
- OnCompleted<int>(260)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 260)
- );
- }
-
- [TestMethod]
- public void AggregateWithSeedAndResult_AccumulatorThrows()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 0),
- OnNext(220, 1),
- OnNext(230, 2),
- OnNext(240, 3),
- OnNext(250, 4),
- OnCompleted<int>(260)
- );
-
- var res = scheduler.Start(() =>
- xs.Aggregate(0, (acc, x) => { if (x < 3) return acc + x; throw ex; }, x => x * 5)
- );
-
- res.Messages.AssertEqual(
- OnError<int>(240, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 240)
- );
- }
-
- [TestMethod]
- public void AggregateWithSeedAndResult_ResultSelectorThrows()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 0),
- OnNext(220, 1),
- OnNext(230, 2),
- OnNext(240, 3),
- OnNext(250, 4),
- OnCompleted<int>(260)
- );
-
- var res = scheduler.Start(() =>
- xs.Aggregate<int, int, int>(0, (acc, x) => acc + x, x => { throw ex; })
- );
-
- res.Messages.AssertEqual(
- OnError<int>(260, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 260)
- );
- }
-
- [TestMethod]
- public void AggregateWithoutSeed_Empty()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Aggregate((acc, x) => acc + x)
- );
-
- res.Messages.AssertEqual(
- OnError<int>(250, e => e is InvalidOperationException)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void AggregateWithoutSeed_Return()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 24),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Aggregate((acc, x) => acc + x)
- );
-
- res.Messages.AssertEqual(
- OnNext<int>(250, 24),
- OnCompleted<int>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void AggregateWithoutSeed_Throw()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnError<int>(210, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.Aggregate((acc, x) => acc + x)
- );
-
- res.Messages.AssertEqual(
- OnError<int>(210, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void AggregateWithoutSeed_Never()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1)
- );
-
- var res = scheduler.Start(() =>
- xs.Aggregate((acc, x) => acc + x)
- );
-
- res.Messages.AssertEqual(
- );
- }
-
- [TestMethod]
- public void AggregateWithoutSeed_Range()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 0),
- OnNext(220, 1),
- OnNext(230, 2),
- OnNext(240, 3),
- OnNext(250, 4),
- OnCompleted<int>(260)
- );
-
- var res = scheduler.Start(() =>
- xs.Aggregate((acc, x) => acc + x)
- );
-
- res.Messages.AssertEqual(
- OnNext(260, Enumerable.Range(0, 5).Sum()),
- OnCompleted<int>(260)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 260)
- );
- }
-
- [TestMethod]
- public void AggregateWithoutSeed_AccumulatorThrows()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 0),
- OnNext(220, 1),
- OnNext(230, 2),
- OnNext(240, 3),
- OnNext(250, 4),
- OnCompleted<int>(260)
- );
-
- var res = scheduler.Start(() =>
- xs.Aggregate((acc, x) => { if (x < 3) return acc + x; throw ex; })
- );
-
- res.Messages.AssertEqual(
- OnError<int>(240, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 240)
- );
- }
-
- #endregion
-
- #region + All +
-
- [TestMethod]
- public void All_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.All(DummyObservable<int>.Instance, default(Func<int, bool>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.All(default(IObservable<int>), x => true));
- }
-
- [TestMethod]
- public void All_Empty()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.All(x => x > 0)
- );
-
- res.Messages.AssertEqual(
- OnNext(250, true),
- OnCompleted<bool>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void All_Return()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.All(x => x > 0)
- );
-
- res.Messages.AssertEqual(
- OnNext(250, true),
- OnCompleted<bool>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void All_ReturnNotMatch()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, -2),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.All(x => x > 0)
- );
-
- res.Messages.AssertEqual(
- OnNext(210, false),
- OnCompleted<bool>(210)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void All_SomeNoneMatch()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, -2),
- OnNext(220, -3),
- OnNext(230, -4),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.All(x => x > 0)
- );
-
- res.Messages.AssertEqual(
- OnNext(210, false),
- OnCompleted<bool>(210)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void All_SomeMatch()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, -2),
- OnNext(220, 3),
- OnNext(230, -4),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.All(x => x > 0)
- );
-
- res.Messages.AssertEqual(
- OnNext(210, false),
- OnCompleted<bool>(210)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void All_SomeAllMatch()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnNext(220, 3),
- OnNext(230, 4),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.All(x => x > 0)
- );
-
- res.Messages.AssertEqual(
- OnNext(250, true),
- OnCompleted<bool>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void All_Throw()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnError<int>(210, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.All(x => x > 0)
- );
-
- res.Messages.AssertEqual(
- OnError<bool>(210, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void All_Never()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1)
- );
-
- var res = scheduler.Start(() =>
- xs.All(x => x > 0)
- );
-
- res.Messages.AssertEqual(
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
- }
-
- [TestMethod]
- public void All_PredicateThrows()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnNext(220, 3),
- OnNext(230, 4),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.All(x => { if (x < 4) return true; throw ex; })
- );
-
- res.Messages.AssertEqual(
- OnError<bool>(230, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 230)
- );
- }
-
- #endregion
-
- #region + Any +
-
- [TestMethod]
- public void Any_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Any(default(IObservable<int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Any(DummyObservable<int>.Instance, default(Func<int, bool>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Any(default(IObservable<int>), x => true));
- }
-
- [TestMethod]
- public void Any_Empty()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Any()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, false),
- OnCompleted<bool>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Any_Return()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Any()
- );
-
- res.Messages.AssertEqual(
- OnNext(210, true),
- OnCompleted<bool>(210)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void Any_Throw()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnError<int>(210, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.Any()
- );
-
- res.Messages.AssertEqual(
- OnError<bool>(210, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void Any_Never()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1)
- );
-
- var res = scheduler.Start(() =>
- xs.Any()
- );
-
- res.Messages.AssertEqual(
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
- }
-
- [TestMethod]
- public void Any_Predicate_Empty()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Any(x => x > 0)
- );
-
- res.Messages.AssertEqual(
- OnNext(250, false),
- OnCompleted<bool>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Any_Predicate_Return()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Any(x => x > 0)
- );
-
- res.Messages.AssertEqual(
- OnNext(210, true),
- OnCompleted<bool>(210)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void Any_Predicate_ReturnNotMatch()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, -2),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Any(x => x > 0)
- );
-
- res.Messages.AssertEqual(
- OnNext(250, false),
- OnCompleted<bool>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Any_Predicate_SomeNoneMatch()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, -2),
- OnNext(220, -3),
- OnNext(230, -4),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Any(x => x > 0)
- );
-
- res.Messages.AssertEqual(
- OnNext(250, false),
- OnCompleted<bool>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Any_Predicate_SomeMatch()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, -2),
- OnNext(220, 3),
- OnNext(230, -4),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Any(x => x > 0)
- );
-
- res.Messages.AssertEqual(
- OnNext(220, true),
- OnCompleted<bool>(220)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 220)
- );
- }
-
- [TestMethod]
- public void Any_Predicate_Throw()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnError<int>(210, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.Any(x => x > 0)
- );
-
- res.Messages.AssertEqual(
- OnError<bool>(210, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void Any_Predicate_Never()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1)
- );
-
- var res = scheduler.Start(() =>
- xs.Any(x => x > 0)
- );
-
- res.Messages.AssertEqual(
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
- }
-
- [TestMethod]
- public void Any_Predicate_PredicateThrows()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, -2),
- OnNext(220, 3),
- OnNext(230, -4),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Any(x => { if (x != -4) return false; throw ex; })
- );
-
- res.Messages.AssertEqual(
- OnError<bool>(230, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 230)
- );
- }
-
- #endregion
-
- #region + Average +
-
- [TestMethod]
- public void Average_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Average(default(IObservable<int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Average(default(IObservable<double>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Average(default(IObservable<float>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Average(default(IObservable<decimal>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Average(default(IObservable<long>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Average(default(IObservable<int?>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Average(default(IObservable<double?>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Average(default(IObservable<float?>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Average(default(IObservable<decimal?>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Average(default(IObservable<long?>)));
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Average(default(IObservable<DateTime>), _ => default(int)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Average(default(IObservable<DateTime>), _ => default(double)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Average(default(IObservable<DateTime>), _ => default(float)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Average(default(IObservable<DateTime>), _ => default(decimal)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Average(default(IObservable<DateTime>), _ => default(long)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Average(default(IObservable<DateTime>), _ => default(int?)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Average(default(IObservable<DateTime>), _ => default(double?)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Average(default(IObservable<DateTime>), _ => default(float?)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Average(default(IObservable<DateTime>), _ => default(decimal?)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Average(default(IObservable<DateTime>), _ => default(long?)));
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Average(Observable.Empty<DateTime>(), default(Func<DateTime, int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Average(Observable.Empty<DateTime>(), default(Func<DateTime, double>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Average(Observable.Empty<DateTime>(), default(Func<DateTime, float>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Average(Observable.Empty<DateTime>(), default(Func<DateTime, decimal>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Average(Observable.Empty<DateTime>(), default(Func<DateTime, long>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Average(Observable.Empty<DateTime>(), default(Func<DateTime, int?>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Average(Observable.Empty<DateTime>(), default(Func<DateTime, double?>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Average(Observable.Empty<DateTime>(), default(Func<DateTime, float?>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Average(Observable.Empty<DateTime>(), default(Func<DateTime, decimal?>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Average(Observable.Empty<DateTime>(), default(Func<DateTime, long?>)));
- }
-
- [TestMethod]
- public void Average_Int32_Empty()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Average()
- );
-
- res.Messages.AssertEqual(
- OnError<double>(250, e => e is InvalidOperationException)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Average_Int32_Return()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Average()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, 2.0),
- OnCompleted<double>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Average_Int32_Some()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 3),
- OnNext(220, 4),
- OnNext(230, 2),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Average()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, 3.0),
- OnCompleted<double>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Average_Int32_Throw()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnError<int>(210, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.Average()
- );
-
- res.Messages.AssertEqual(
- OnError<double>(210, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void Average_Int32_Never()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1)
- );
-
- var res = scheduler.Start(() =>
- xs.Average()
- );
-
- res.Messages.AssertEqual(
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
- }
-
- [TestMethod]
- public void Average_Int64_Empty()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1L),
- OnCompleted<long>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Average()
- );
-
- res.Messages.AssertEqual(
- OnError<double>(250, e => e is InvalidOperationException)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Average_Int64_Return()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1L),
- OnNext(210, 2L),
- OnCompleted<long>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Average()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, 2.0),
- OnCompleted<double>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Average_Int64_Some()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1L),
- OnNext(210, 3L),
- OnNext(220, 4L),
- OnNext(230, 2L),
- OnCompleted<long>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Average()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, 3.0),
- OnCompleted<double>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Average_Int64_Throw()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1L),
- OnError<long>(210, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.Average()
- );
-
- res.Messages.AssertEqual(
- OnError<double>(210, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void Average_Int64_Never()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1L)
- );
-
- var res = scheduler.Start(() =>
- xs.Average()
- );
-
- res.Messages.AssertEqual(
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
- }
-
- [TestMethod]
- public void Average_Double_Empty()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1.0),
- OnCompleted<double>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Average()
- );
-
- res.Messages.AssertEqual(
- OnError<double>(250, e => e is InvalidOperationException)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Average_Double_Return()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1.0),
- OnNext(210, 2.0),
- OnCompleted<double>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Average()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, 2.0),
- OnCompleted<double>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Average_Double_Some()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1.0),
- OnNext(210, 3.0),
- OnNext(220, 4.0),
- OnNext(230, 2.0),
- OnCompleted<double>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Average()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, 3.0),
- OnCompleted<double>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Average_Double_Throw()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1.0),
- OnError<double>(210, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.Average()
- );
-
- res.Messages.AssertEqual(
- OnError<double>(210, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void Average_Double_Never()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1.0)
- );
-
- var res = scheduler.Start(() =>
- xs.Average()
- );
-
- res.Messages.AssertEqual(
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
- }
-
- [TestMethod]
- public void Average_Float_Empty()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1f),
- OnCompleted<float>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Average()
- );
-
- res.Messages.AssertEqual(
- OnError<float>(250, e => e is InvalidOperationException)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Average_Float_Return()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1f),
- OnNext(210, 2f),
- OnCompleted<float>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Average()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, 2f),
- OnCompleted<float>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Average_Float_Some()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1f),
- OnNext(210, 3f),
- OnNext(220, 4f),
- OnNext(230, 2f),
- OnCompleted<float>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Average()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, 3f),
- OnCompleted<float>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Average_Float_Throw()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1f),
- OnError<float>(210, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.Average()
- );
-
- res.Messages.AssertEqual(
- OnError<float>(210, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void Average_Float_Never()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1f)
- );
-
- var res = scheduler.Start(() =>
- xs.Average()
- );
-
- res.Messages.AssertEqual(
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
- }
-
- [TestMethod]
- public void Average_Decimal_Empty()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1m),
- OnCompleted<decimal>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Average()
- );
-
- res.Messages.AssertEqual(
- OnError<decimal>(250, e => e is InvalidOperationException)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Average_Decimal_Return()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1m),
- OnNext(210, 2m),
- OnCompleted<decimal>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Average()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, 2m),
- OnCompleted<decimal>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Average_Decimal_Some()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1m),
- OnNext(210, 3m),
- OnNext(220, 4m),
- OnNext(230, 2m),
- OnCompleted<decimal>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Average()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, 3m),
- OnCompleted<decimal>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Average_Decimal_Throw()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1m),
- OnError<decimal>(210, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.Average()
- );
-
- res.Messages.AssertEqual(
- OnError<decimal>(210, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void Average_Decimal_Never()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1m)
- );
-
- var res = scheduler.Start(() =>
- xs.Average()
- );
-
- res.Messages.AssertEqual(
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
- }
-
- [TestMethod]
- public void Average_Nullable_Int32_Empty()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (int?)1),
- OnCompleted<int?>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Average()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, (double?)null),
- OnCompleted<double?>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Average_Nullable_Int32_Return()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (int?)1),
- OnNext(210, (int?)2),
- OnCompleted<int?>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Average()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, (double?)2.0),
- OnCompleted<double?>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Average_Nullable_Int32_Some()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (int?)1),
- OnNext(210, (int?)3),
- OnNext(220, (int?)null),
- OnNext(230, (int?)2),
- OnCompleted<int?>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Average()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, (double?)2.5),
- OnCompleted<double?>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Average_Nullable_Int32_Throw()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (int?)1),
- OnError<int?>(210, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.Average()
- );
-
- res.Messages.AssertEqual(
- OnError<double?>(210, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void Average_Nullable_Int32_Never()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (int?)1)
- );
-
- var res = scheduler.Start(() =>
- xs.Average()
- );
-
- res.Messages.AssertEqual(
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
- }
-
- [TestMethod]
- public void Average_Nullable_Int64_Empty()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (long?)1L),
- OnCompleted<long?>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Average()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, (double?)null),
- OnCompleted<double?>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Average_Nullable_Int64_Return()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (long?)1L),
- OnNext(210, (long?)2L),
- OnCompleted<long?>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Average()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, (double?)2.0),
- OnCompleted<double?>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Average_Nullable_Int64_Some()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (long?)1L),
- OnNext(210, (long?)3L),
- OnNext(220, (long?)null),
- OnNext(230, (long?)2L),
- OnCompleted<long?>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Average()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, (double?)2.5),
- OnCompleted<double?>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Average_Nullable_Int64_Throw()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (long?)1L),
- OnError<long?>(210, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.Average()
- );
-
- res.Messages.AssertEqual(
- OnError<double?>(210, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void Average_Nullable_Int64_Never()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (long?)1L)
- );
-
- var res = scheduler.Start(() =>
- xs.Average()
- );
-
- res.Messages.AssertEqual(
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
- }
-
- [TestMethod]
- public void Average_Nullable_Double_Empty()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (double?)1.0),
- OnCompleted<double?>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Average()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, (double?)null),
- OnCompleted<double?>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Average_Nullable_Double_Return()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (double?)1.0),
- OnNext(210, (double?)2.0),
- OnCompleted<double?>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Average()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, (double?)2.0),
- OnCompleted<double?>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Average_Nullable_Double_Some()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (double?)1.0),
- OnNext(210, (double?)3.0),
- OnNext(220, (double?)null),
- OnNext(230, (double?)2.0),
- OnCompleted<double?>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Average()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, (double?)2.5),
- OnCompleted<double?>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Average_Nullable_Double_Throw()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (double?)1.0),
- OnError<double?>(210, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.Average()
- );
-
- res.Messages.AssertEqual(
- OnError<double?>(210, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void Average_Nullable_Double_Never()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (double?)1.0)
- );
-
- var res = scheduler.Start(() =>
- xs.Average()
- );
-
- res.Messages.AssertEqual(
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
- }
-
- [TestMethod]
- public void Average_Nullable_Float_Empty()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (float?)1f),
- OnCompleted<float?>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Average()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, (float?)null),
- OnCompleted<float?>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Average_Nullable_Float_Return()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (float?)1f),
- OnNext(210, (float?)2f),
- OnCompleted<float?>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Average()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, (float?)2f),
- OnCompleted<float?>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Average_Nullable_Float_Some()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (float?)1f),
- OnNext(210, (float?)3f),
- OnNext(220, (float?)null),
- OnNext(230, (float?)2f),
- OnCompleted<float?>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Average()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, (float?)2.5f),
- OnCompleted<float?>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Average_Nullable_Float_Throw()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (float?)1f),
- OnError<float?>(210, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.Average()
- );
-
- res.Messages.AssertEqual(
- OnError<float?>(210, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void Average_Nullable_Float_Never()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (float?)1f)
- );
-
- var res = scheduler.Start(() =>
- xs.Average()
- );
-
- res.Messages.AssertEqual(
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
- }
-
- [TestMethod]
- public void Average_Nullable_Decimal_Empty()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (decimal?)1m),
- OnCompleted<decimal?>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Average()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, (decimal?)null),
- OnCompleted<decimal?>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Average_Nullable_Decimal_Return()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (decimal?)1m),
- OnNext(210, (decimal?)2m),
- OnCompleted<decimal?>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Average()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, (decimal?)2m),
- OnCompleted<decimal?>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Average_Nullable_Decimal_Some()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (decimal?)1m),
- OnNext(210, (decimal?)3m),
- OnNext(220, (decimal?)null),
- OnNext(230, (decimal?)2m),
- OnCompleted<decimal?>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Average()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, (decimal?)2.5m),
- OnCompleted<decimal?>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Average_Nullable_Decimal_Throw()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (decimal?)1m),
- OnError<decimal?>(210, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.Average()
- );
-
- res.Messages.AssertEqual(
- OnError<decimal?>(210, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void Average_Nullable_Decimal_Never()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (decimal?)1m)
- );
-
- var res = scheduler.Start(() =>
- xs.Average()
- );
-
- res.Messages.AssertEqual(
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
- }
-
-#if !NO_PERF
- [TestMethod]
- public void Average_InjectOverflow_Int32()
- {
- var xs = Observable.Return(42, ThreadPoolScheduler.Instance);
-
- var res = new OverflowInjection<int>(xs, long.MaxValue).Average();
-
- ReactiveAssert.Throws<OverflowException>(() => res.ForEach(_ => { }));
- }
-
- [TestMethod]
- public void Average_InjectOverflow_Int64()
- {
- var xs = Observable.Return(42L, ThreadPoolScheduler.Instance);
-
- var res = new OverflowInjection<long>(xs, long.MaxValue).Average();
-
- ReactiveAssert.Throws<OverflowException>(() => res.ForEach(_ => { }));
- }
-
- [TestMethod]
- public void Average_InjectOverflow_Double()
- {
- var xs = Observable.Return(42.0, ThreadPoolScheduler.Instance);
-
- var res = new OverflowInjection<double>(xs, long.MaxValue).Average();
-
- ReactiveAssert.Throws<OverflowException>(() => res.ForEach(_ => { }));
- }
-
- [TestMethod]
- public void Average_InjectOverflow_Single()
- {
- var xs = Observable.Return(42.0f, ThreadPoolScheduler.Instance);
-
- var res = new OverflowInjection<float>(xs, long.MaxValue).Average();
-
- ReactiveAssert.Throws<OverflowException>(() => res.ForEach(_ => { }));
- }
-
- [TestMethod]
- public void Average_InjectOverflow_Decimal()
- {
- var xs = Observable.Return(42.0m, ThreadPoolScheduler.Instance);
-
- var res = new OverflowInjection<decimal>(xs, long.MaxValue).Average();
-
- ReactiveAssert.Throws<OverflowException>(() => res.ForEach(_ => { }));
- }
-
- [TestMethod]
- public void Average_InjectOverflow_Int32_Nullable()
- {
- var xs = Observable.Return((int?)42, ThreadPoolScheduler.Instance);
-
- var res = new OverflowInjection<int?>(xs, long.MaxValue).Average();
-
- ReactiveAssert.Throws<OverflowException>(() => res.ForEach(_ => { }));
- }
-
- [TestMethod]
- public void Average_InjectOverflow_Int64_Nullable()
- {
- var xs = Observable.Return((long?)42L, ThreadPoolScheduler.Instance);
-
- var res = new OverflowInjection<long?>(xs, long.MaxValue).Average();
-
- ReactiveAssert.Throws<OverflowException>(() => res.ForEach(_ => { }));
- }
-
- [TestMethod]
- public void Average_InjectOverflow_Double_Nullable()
- {
- var xs = Observable.Return((double?)42.0, ThreadPoolScheduler.Instance);
-
- var res = new OverflowInjection<double?>(xs, long.MaxValue).Average();
-
- ReactiveAssert.Throws<OverflowException>(() => res.ForEach(_ => { }));
- }
-
- [TestMethod]
- public void Average_InjectOverflow_Single_Nullable()
- {
- var xs = Observable.Return((float?)42.0f, ThreadPoolScheduler.Instance);
-
- var res = new OverflowInjection<float?>(xs, long.MaxValue).Average();
-
- ReactiveAssert.Throws<OverflowException>(() => res.ForEach(_ => { }));
- }
-
- [TestMethod]
- public void Average_InjectOverflow_Decimal_Nullable()
- {
- var xs = Observable.Return((decimal?)42.0m, ThreadPoolScheduler.Instance);
-
- var res = new OverflowInjection<decimal?>(xs, long.MaxValue).Average();
-
- ReactiveAssert.Throws<OverflowException>(() => res.ForEach(_ => { }));
- }
-
- class OverflowInjection<T> : IObservable<T>
- {
- private readonly IObservable<T> _source;
- private readonly object _initialCount;
-
- public OverflowInjection(IObservable<T> source, object initialCount)
- {
- _source = source;
- _initialCount = initialCount;
- }
-
- public IDisposable Subscribe(IObserver<T> observer)
- {
- var f = observer.GetType().GetField("_count", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic);
- f.SetValue(observer, _initialCount);
-
- return _source.Subscribe(observer);
- }
- }
-#endif
-
- [TestMethod]
- public void Average_Selector_Regular_Int32()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable<string>(
- OnNext(210, "b"),
- OnNext(220, "fo"),
- OnNext(230, "qux"),
- OnCompleted<string>(240)
- );
-
- var res = scheduler.Start(() => xs.Average(x => (int)x.Length));
-
- res.Messages.AssertEqual(
- OnNext(240, 2.0),
- OnCompleted<double>(240)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 240)
- );
- }
-
- [TestMethod]
- public void Average_Selector_Regular_Int64()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable<string>(
- OnNext(210, "b"),
- OnNext(220, "fo"),
- OnNext(230, "qux"),
- OnCompleted<string>(240)
- );
-
- var res = scheduler.Start(() => xs.Average(x => (long)x.Length));
-
- res.Messages.AssertEqual(
- OnNext(240, 2.0),
- OnCompleted<double>(240)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 240)
- );
- }
-
- [TestMethod]
- public void Average_Selector_Regular_Single()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable<string>(
- OnNext(210, "b"),
- OnNext(220, "fo"),
- OnNext(230, "qux"),
- OnCompleted<string>(240)
- );
-
- var res = scheduler.Start(() => xs.Average(x => (float)x.Length));
-
- res.Messages.AssertEqual(
- OnNext(240, 2.0f),
- OnCompleted<float>(240)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 240)
- );
- }
-
- [TestMethod]
- public void Average_Selector_Regular_Double()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable<string>(
- OnNext(210, "b"),
- OnNext(220, "fo"),
- OnNext(230, "qux"),
- OnCompleted<string>(240)
- );
-
- var res = scheduler.Start(() => xs.Average(x => (double)x.Length));
-
- res.Messages.AssertEqual(
- OnNext(240, 2.0),
- OnCompleted<double>(240)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 240)
- );
- }
-
- [TestMethod]
- public void Average_Selector_Regular_Decimal()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable<string>(
- OnNext(210, "b"),
- OnNext(220, "fo"),
- OnNext(230, "qux"),
- OnCompleted<string>(240)
- );
-
- var res = scheduler.Start(() => xs.Average(x => (decimal)x.Length));
-
- res.Messages.AssertEqual(
- OnNext(240, 2.0m),
- OnCompleted<decimal>(240)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 240)
- );
- }
-
- [TestMethod]
- public void Average_Selector_Regular_Int32_Nullable()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable<string>(
- OnNext(210, "b"),
- OnNext(220, "fo"),
- OnNext(230, "qux"),
- OnCompleted<string>(240)
- );
-
- var res = scheduler.Start(() => xs.Average(x => x == "fo" ? default(int?) : x.Length));
-
- res.Messages.AssertEqual(
- OnNext(240, (double?)2.0),
- OnCompleted<double?>(240)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 240)
- );
- }
-
- [TestMethod]
- public void Average_Selector_Regular_Int64_Nullable()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable<string>(
- OnNext(210, "b"),
- OnNext(220, "fo"),
- OnNext(230, "qux"),
- OnCompleted<string>(240)
- );
-
- var res = scheduler.Start(() => xs.Average(x => x == "fo" ? default(long?) : x.Length));
-
- res.Messages.AssertEqual(
- OnNext(240, (double?)2.0),
- OnCompleted<double?>(240)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 240)
- );
- }
-
- [TestMethod]
- public void Average_Selector_Regular_Single_Nullable()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable<string>(
- OnNext(210, "b"),
- OnNext(220, "fo"),
- OnNext(230, "qux"),
- OnCompleted<string>(240)
- );
-
- var res = scheduler.Start(() => xs.Average(x => x == "fo" ? default(float?) : x.Length));
-
- res.Messages.AssertEqual(
- OnNext(240, (float?)2.0),
- OnCompleted<float?>(240)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 240)
- );
- }
-
- [TestMethod]
- public void Average_Selector_Regular_Double_Nullable()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable<string>(
- OnNext(210, "b"),
- OnNext(220, "fo"),
- OnNext(230, "qux"),
- OnCompleted<string>(240)
- );
-
- var res = scheduler.Start(() => xs.Average(x => x == "fo" ? default(double?) : x.Length));
-
- res.Messages.AssertEqual(
- OnNext(240, (double?)2.0),
- OnCompleted<double?>(240)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 240)
- );
- }
-
- [TestMethod]
- public void Average_Selector_Regular_Decimal_Nullable()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable<string>(
- OnNext(210, "b"),
- OnNext(220, "fo"),
- OnNext(230, "qux"),
- OnCompleted<string>(240)
- );
-
- var res = scheduler.Start(() => xs.Average(x => x == "fo" ? default(decimal?) : x.Length));
-
- res.Messages.AssertEqual(
- OnNext(240, (decimal?)2.0),
- OnCompleted<decimal?>(240)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 240)
- );
- }
-
- #endregion
-
- #region + Contains +
-
- [TestMethod]
- public void Contains_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Contains(default(IObservable<int>), 42));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Contains(default(IObservable<int>), 42, EqualityComparer<int>.Default));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Contains(DummyObservable<int>.Instance, 42, null));
- }
-
- [TestMethod]
- public void Contains_Empty()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Contains(42)
- );
-
- res.Messages.AssertEqual(
- OnNext(250, false),
- OnCompleted<bool>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Contains_ReturnPositive()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Contains(2)
- );
-
- res.Messages.AssertEqual(
- OnNext(210, true),
- OnCompleted<bool>(210)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void Contains_ReturnNegative()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Contains(-2)
- );
-
- res.Messages.AssertEqual(
- OnNext(250, false),
- OnCompleted<bool>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Contains_SomePositive()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnNext(220, 3),
- OnNext(230, 4),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Contains(3)
- );
-
- res.Messages.AssertEqual(
- OnNext(220, true),
- OnCompleted<bool>(220)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 220)
- );
- }
-
- [TestMethod]
- public void Contains_SomeNegative()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnNext(220, 3),
- OnNext(230, 4),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Contains(-3)
- );
-
- res.Messages.AssertEqual(
- OnNext(250, false),
- OnCompleted<bool>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Contains_Throw()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnError<int>(210, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.Contains(42)
- );
-
- res.Messages.AssertEqual(
- OnError<bool>(210, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void Contains_Never()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1)
- );
-
- var res = scheduler.Start(() =>
- xs.Contains(42)
- );
-
- res.Messages.AssertEqual(
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
- }
-
- [TestMethod]
- public void Contains_ComparerThrows()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2)
- );
-
- var res = scheduler.Start(() =>
- xs.Contains(42, new ContainsComparerThrows())
- );
-
- res.Messages.AssertEqual(
- OnError<bool>(210, e => e is NotImplementedException)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- class ContainsComparerThrows : IEqualityComparer<int>
- {
- public bool Equals(int x, int y)
- {
- throw new NotImplementedException();
- }
-
- public int GetHashCode(int obj)
- {
- throw new NotImplementedException();
- }
- }
-
- [TestMethod]
- public void Contains_ComparerContainsValue()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 3),
- OnNext(220, 4),
- OnNext(230, 8),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Contains(42, new ContainsComparerMod2())
- );
-
- res.Messages.AssertEqual(
- OnNext(220, true),
- OnCompleted<bool>(220)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 220)
- );
- }
-
- [TestMethod]
- public void Contains_ComparerDoesNotContainValue()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnNext(220, 4),
- OnNext(230, 8),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Contains(21, new ContainsComparerMod2())
- );
-
- res.Messages.AssertEqual(
- OnNext(250, false),
- OnCompleted<bool>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- class ContainsComparerMod2 : IEqualityComparer<int>
- {
- public bool Equals(int x, int y)
- {
- return x % 2 == y % 2;
- }
-
- public int GetHashCode(int obj)
- {
- return obj.GetHashCode();
- }
- }
-
- #endregion
-
- #region + Count +
-
- [TestMethod]
- public void Count_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Count(default(IObservable<int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Count(default(IObservable<int>), _ => true));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Count(DummyObservable<int>.Instance, default(Func<int, bool>)));
- }
-
- [TestMethod]
- public void Count_Empty()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Count()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, 0),
- OnCompleted<int>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Count_Return()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Count()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, 1),
- OnCompleted<int>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Count_Some()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnNext(220, 3),
- OnNext(230, 4),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Count()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, 3),
- OnCompleted<int>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Count_Throw()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnError<int>(210, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.Count()
- );
-
- res.Messages.AssertEqual(
- OnError<int>(210, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void Count_Never()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1)
- );
-
- var res = scheduler.Start(() =>
- xs.Count()
- );
-
- res.Messages.AssertEqual(
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
- }
-
-#if !NO_PERF
- [TestMethod]
- public void Count_InjectOverflow()
- {
- var xs = Observable.Return(42, ThreadPoolScheduler.Instance);
-
- var res = new OverflowInjection<int>(xs, int.MaxValue).Count();
-
- ReactiveAssert.Throws<OverflowException>(() => res.ForEach(_ => { }));
- }
-#endif
-
- [TestMethod]
- public void Count_Predicate_Empty_True()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Count(_ => true)
- );
-
- res.Messages.AssertEqual(
- OnNext(250, 0),
- OnCompleted<int>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Count_Predicate_Empty_False()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Count(_ => false)
- );
-
- res.Messages.AssertEqual(
- OnNext(250, 0),
- OnCompleted<int>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Count_Predicate_Return_True()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Count(_ => true)
- );
-
- res.Messages.AssertEqual(
- OnNext(250, 1),
- OnCompleted<int>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Count_Predicate_Return_False()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Count(_ => false)
- );
-
- res.Messages.AssertEqual(
- OnNext(250, 0),
- OnCompleted<int>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Count_Predicate_Some_All()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnNext(220, 3),
- OnNext(230, 4),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Count(x => x < 10)
- );
-
- res.Messages.AssertEqual(
- OnNext(250, 3),
- OnCompleted<int>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Count_Predicate_Some_None()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnNext(220, 3),
- OnNext(230, 4),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Count(x => x > 10)
- );
-
- res.Messages.AssertEqual(
- OnNext(250, 0),
- OnCompleted<int>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Count_Predicate_Some_Even()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnNext(220, 3),
- OnNext(230, 4),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Count(x => x % 2 == 0)
- );
-
- res.Messages.AssertEqual(
- OnNext(250, 2),
- OnCompleted<int>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Count_Predicate_Throw_True()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnError<int>(210, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.Count(_ => true)
- );
-
- res.Messages.AssertEqual(
- OnError<int>(210, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void Count_Predicate_Throw_False()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnError<int>(210, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.Count(_ => false)
- );
-
- res.Messages.AssertEqual(
- OnError<int>(210, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void Count_Predicate_Never()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1)
- );
-
- var res = scheduler.Start(() =>
- xs.Count(_ => true)
- );
-
- res.Messages.AssertEqual(
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
- }
-
- [TestMethod]
- public void Count_Predicate_PredicateThrows()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnNext(230, 3),
- OnCompleted<int>(240)
- );
-
- var ex = new Exception();
-
- var res = scheduler.Start(() =>
- xs.Count(x =>
- {
- if (x == 3)
- throw ex;
-
- return true;
- })
- );
-
- res.Messages.AssertEqual(
- OnError<int>(230, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 230)
- );
- }
-
-#if !NO_PERF
- [TestMethod]
- public void Count_Predicate_InjectOverflow()
- {
- var xs = Observable.Return(42, ThreadPoolScheduler.Instance);
-
- var res = new OverflowInjection<int>(xs, int.MaxValue).Count(_ => true);
-
- ReactiveAssert.Throws<OverflowException>(() => res.ForEach(_ => { }));
- }
-#endif
-
- #endregion
-
- #region + ElementAt +
-
- [TestMethod]
- public void ElementAt_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ElementAt(default(IObservable<int>), 2));
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => Observable.ElementAt(DummyObservable<int>.Instance, -1));
- }
-
- [TestMethod]
- public void ElementAt_First()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(280, 42),
- OnNext(360, 43),
- OnNext(470, 44),
- OnCompleted<int>(600)
- );
-
- var res = scheduler.Start(() =>
- xs.ElementAt(0)
- );
-
- res.Messages.AssertEqual(
- OnNext(280, 42),
- OnCompleted<int>(280)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 280)
- );
- }
-
- [TestMethod]
- public void ElementAt_Other()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(280, 42),
- OnNext(360, 43),
- OnNext(470, 44),
- OnCompleted<int>(600)
- );
-
- var res = scheduler.Start(() =>
- xs.ElementAt(2)
- );
-
- res.Messages.AssertEqual(
- OnNext(470, 44),
- OnCompleted<int>(470)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 470)
- );
- }
-
- [TestMethod]
- public void ElementAt_OutOfRange()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(280, 42),
- OnNext(360, 43),
- OnNext(470, 44),
- OnCompleted<int>(600)
- );
-
- var res = scheduler.Start(() =>
- xs.ElementAt(3)
- );
-
- res.Messages.AssertEqual(
- OnError<int>(600, e => e is ArgumentOutOfRangeException)
- );
- }
-
- [TestMethod]
- public void ElementAt_Error()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(280, 42),
- OnNext(360, 43),
- OnError<int>(420, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.ElementAt(3)
- );
-
- res.Messages.AssertEqual(
- OnError<int>(420, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 420)
- );
- }
-
- #endregion
-
- #region + ElementAtOrDefault +
-
- [TestMethod]
- public void ElementAtOrDefault_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ElementAtOrDefault(default(IObservable<int>), 2));
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => Observable.ElementAtOrDefault(DummyObservable<int>.Instance, -1));
- }
-
- [TestMethod]
- public void ElementAtOrDefault_First()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(280, 42),
- OnNext(360, 43),
- OnNext(470, 44),
- OnCompleted<int>(600)
- );
-
- var res = scheduler.Start(() =>
- xs.ElementAtOrDefault(0)
- );
-
- res.Messages.AssertEqual(
- OnNext(280, 42),
- OnCompleted<int>(280)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 280)
- );
- }
-
- [TestMethod]
- public void ElementAtOrDefault_Other()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(280, 42),
- OnNext(360, 43),
- OnNext(470, 44),
- OnCompleted<int>(600)
- );
-
- var res = scheduler.Start(() =>
- xs.ElementAtOrDefault(2)
- );
-
- res.Messages.AssertEqual(
- OnNext(470, 44),
- OnCompleted<int>(470)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 470)
- );
- }
-
- [TestMethod]
- public void ElementAtOrDefault_OutOfRange()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(280, 42),
- OnNext(360, 43),
- OnNext(470, 44),
- OnCompleted<int>(600)
- );
-
- var res = scheduler.Start(() =>
- xs.ElementAtOrDefault(3)
- );
-
- res.Messages.AssertEqual(
- OnNext(600, 0),
- OnCompleted<int>(600)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 600)
- );
- }
-
- [TestMethod]
- public void ElementAtOrDefault_Error()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(280, 42),
- OnNext(360, 43),
- OnError<int>(420, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.ElementAtOrDefault(3)
- );
-
- res.Messages.AssertEqual(
- OnError<int>(420, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 420)
- );
- }
-
- #endregion
-
- #region + FirstAsync +
-
- [TestMethod]
- public void FirstAsync_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FirstAsync(default(IObservable<int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FirstAsync(default(IObservable<int>), _ => true));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FirstAsync(DummyObservable<int>.Instance, default(Func<int, bool>)));
- }
-
- [TestMethod]
- public void FirstAsync_Empty()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.FirstAsync()
- );
-
- res.Messages.AssertEqual(
- OnError<int>(250, e => e is InvalidOperationException)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void FirstAsync_One()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.FirstAsync()
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 2),
- OnCompleted<int>(210)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void FirstAsync_Many()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnNext(220, 3),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.FirstAsync()
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 2),
- OnCompleted<int>(210)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void FirstAsync_Error()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnError<int>(210, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.FirstAsync()
- );
-
- res.Messages.AssertEqual(
- OnError<int>(210, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void FirstAsync_Predicate()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnNext(220, 3),
- OnNext(230, 4),
- OnNext(240, 5),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.FirstAsync(x => x % 2 == 1)
- );
-
- res.Messages.AssertEqual(
- OnNext(220, 3),
- OnCompleted<int>(220)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 220)
- );
- }
-
- [TestMethod]
- public void FirstAsync_Predicate_None()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnNext(220, 3),
- OnNext(230, 4),
- OnNext(240, 5),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.FirstAsync(x => x > 10)
- );
-
- res.Messages.AssertEqual(
- OnError<int>(250, e => e is InvalidOperationException)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void FirstAsync_Predicate_Throw()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnError<int>(220, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.FirstAsync(x => x % 2 == 1)
- );
-
- res.Messages.AssertEqual(
- OnError<int>(220, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 220)
- );
- }
-
- [TestMethod]
- public void FirstAsync_PredicateThrows()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnNext(220, 3),
- OnNext(230, 4),
- OnNext(240, 5),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.FirstAsync(x => { if (x < 4) return false; throw ex; })
- );
-
- res.Messages.AssertEqual(
- OnError<int>(230, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 230)
- );
- }
-
- #endregion
-
- #region + FirstOrDefaultAsync +
-
- [TestMethod]
- public void FirstOrDefaultAsync_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FirstOrDefaultAsync(default(IObservable<int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FirstOrDefaultAsync(default(IObservable<int>), _ => true));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FirstOrDefaultAsync(DummyObservable<int>.Instance, default(Func<int, bool>)));
- }
-
- [TestMethod]
- public void FirstOrDefaultAsync_Empty()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.FirstOrDefaultAsync()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, 0),
- OnCompleted<int>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void FirstOrDefaultAsync_One()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.FirstOrDefaultAsync()
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 2),
- OnCompleted<int>(210)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void FirstOrDefaultAsync_Many()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnNext(220, 3),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.FirstOrDefaultAsync()
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 2),
- OnCompleted<int>(210)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void FirstOrDefaultAsync_Error()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnError<int>(210, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.FirstOrDefaultAsync()
- );
-
- res.Messages.AssertEqual(
- OnError<int>(210, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void FirstOrDefaultAsync_Predicate()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnNext(220, 3),
- OnNext(230, 4),
- OnNext(240, 5),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.FirstOrDefaultAsync(x => x % 2 == 1)
- );
-
- res.Messages.AssertEqual(
- OnNext(220, 3),
- OnCompleted<int>(220)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 220)
- );
- }
-
- [TestMethod]
- public void FirstOrDefaultAsync_Predicate_None()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnNext(220, 3),
- OnNext(230, 4),
- OnNext(240, 5),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.FirstOrDefaultAsync(x => x > 10)
- );
-
- res.Messages.AssertEqual(
- OnNext(250, 0),
- OnCompleted<int>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void FirstOrDefaultAsync_Predicate_Throw()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnError<int>(220, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.FirstOrDefaultAsync(x => x % 2 == 1)
- );
-
- res.Messages.AssertEqual(
- OnError<int>(220, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 220)
- );
- }
-
- [TestMethod]
- public void FirstOrDefaultAsync_PredicateThrows()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnNext(220, 3),
- OnNext(230, 4),
- OnNext(240, 5),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.FirstOrDefaultAsync(x => { if (x < 4) return false; throw ex; })
- );
-
- res.Messages.AssertEqual(
- OnError<int>(230, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 230)
- );
- }
-
- #endregion
-
- #region + IsEmpty +
-
- [TestMethod]
- public void IsEmpty_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.IsEmpty(default(IObservable<int>)));
- }
-
- [TestMethod]
- public void IsEmpty_Empty()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.IsEmpty()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, true),
- OnCompleted<bool>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void IsEmpty_Return()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.IsEmpty()
- );
-
- res.Messages.AssertEqual(
- OnNext(210, false),
- OnCompleted<bool>(210)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void IsEmpty_Throw()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnError<int>(210, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.IsEmpty()
- );
-
- res.Messages.AssertEqual(
- OnError<bool>(210, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void IsEmpty_Never()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1)
- );
-
- var res = scheduler.Start(() =>
- xs.IsEmpty()
- );
-
- res.Messages.AssertEqual(
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
- }
-
- #endregion
-
- #region + LastAsync +
-
- [TestMethod]
- public void LastAsync_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.LastAsync(default(IObservable<int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.LastAsync(default(IObservable<int>), _ => true));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.LastAsync(DummyObservable<int>.Instance, default(Func<int, bool>)));
- }
-
- [TestMethod]
- public void LastAsync_Empty()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.LastAsync()
- );
-
- res.Messages.AssertEqual(
- OnError<int>(250, e => e is InvalidOperationException)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void LastAsync_One()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.LastAsync()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, 2),
- OnCompleted<int>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void LastAsync_Many()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnNext(220, 3),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.LastAsync()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, 3),
- OnCompleted<int>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void LastAsync_Error()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnError<int>(210, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.LastAsync()
- );
-
- res.Messages.AssertEqual(
- OnError<int>(210, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void LastAsync_Predicate()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnNext(220, 3),
- OnNext(230, 4),
- OnNext(240, 5),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.LastAsync(x => x % 2 == 1)
- );
-
- res.Messages.AssertEqual(
- OnNext(250, 5),
- OnCompleted<int>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void LastAsync_Predicate_None()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnNext(220, 3),
- OnNext(230, 4),
- OnNext(240, 5),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.LastAsync(x => x > 10)
- );
-
- res.Messages.AssertEqual(
- OnError<int>(250, e => e is InvalidOperationException)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void LastAsync_Predicate_Throw()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnError<int>(210, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.LastAsync(x => x % 2 == 1)
- );
-
- res.Messages.AssertEqual(
- OnError<int>(210, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void LastAsync_PredicateThrows()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnNext(220, 3),
- OnNext(230, 4),
- OnNext(240, 5),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.LastAsync(x => { if (x < 4) return x % 2 == 1; throw ex; })
- );
-
- res.Messages.AssertEqual(
- OnError<int>(230, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 230)
- );
- }
-
- #endregion
-
- #region + LastOrDefaultAsync +
-
- [TestMethod]
- public void LastOrDefaultAsync_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.LastOrDefaultAsync(default(IObservable<int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.LastOrDefaultAsync(default(IObservable<int>), _ => true));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.LastOrDefaultAsync(DummyObservable<int>.Instance, default(Func<int, bool>)));
- }
-
- [TestMethod]
- public void LastOrDefaultAsync_Empty()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.LastOrDefaultAsync()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, 0),
- OnCompleted<int>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void LastOrDefaultAsync_One()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.LastOrDefaultAsync()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, 2),
- OnCompleted<int>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void LastOrDefaultAsync_Many()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnNext(220, 3),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.LastOrDefaultAsync()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, 3),
- OnCompleted<int>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void LastOrDefaultAsync_Error()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnError<int>(210, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.LastOrDefaultAsync()
- );
-
- res.Messages.AssertEqual(
- OnError<int>(210, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void LastOrDefaultAsync_Predicate()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnNext(220, 3),
- OnNext(230, 4),
- OnNext(240, 5),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.LastOrDefaultAsync(x => x % 2 == 1)
- );
-
- res.Messages.AssertEqual(
- OnNext(250, 5),
- OnCompleted<int>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void LastOrDefaultAsync_Predicate_None()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnNext(220, 3),
- OnNext(230, 4),
- OnNext(240, 5),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.LastOrDefaultAsync(x => x > 10)
- );
-
- res.Messages.AssertEqual(
- OnNext(250, 0),
- OnCompleted<int>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void LastOrDefaultAsync_Predicate_Throw()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnError<int>(210, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.LastOrDefaultAsync(x => x > 10)
- );
-
- res.Messages.AssertEqual(
- OnError<int>(210, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void LastOrDefaultAsync_PredicateThrows()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnNext(220, 3),
- OnNext(230, 4),
- OnNext(240, 5),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.LastOrDefaultAsync(x => { if (x < 4) return x % 2 == 1; throw ex; })
- );
-
- res.Messages.AssertEqual(
- OnError<int>(230, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 230)
- );
- }
-
- #endregion
-
- #region + LongCount +
-
- [TestMethod]
- public void LongCount_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.LongCount(default(IObservable<int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.LongCount(default(IObservable<int>), _ => true));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.LongCount(DummyObservable<int>.Instance, default(Func<int, bool>)));
- }
-
- [TestMethod]
- public void LongCount_Empty()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.LongCount()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, 0L),
- OnCompleted<long>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void LongCount_Return()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.LongCount()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, 1L),
- OnCompleted<long>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void LongCount_Some()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnNext(220, 3),
- OnNext(230, 4),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.LongCount()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, 3L),
- OnCompleted<long>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void LongCount_Throw()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnError<int>(210, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.LongCount()
- );
-
- res.Messages.AssertEqual(
- OnError<long>(210, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void LongCount_Never()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1)
- );
-
- var res = scheduler.Start(() =>
- xs.LongCount()
- );
-
- res.Messages.AssertEqual(
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
- }
-
-#if !NO_PERF
- [TestMethod]
- public void LongCount_InjectOverflow()
- {
- var xs = Observable.Return(42, ThreadPoolScheduler.Instance);
-
- var res = new OverflowInjection<int>(xs, long.MaxValue).LongCount();
-
- ReactiveAssert.Throws<OverflowException>(() => res.ForEach(_ => { }));
- }
-#endif
-
- [TestMethod]
- public void LongCount_Predicate_Empty_True()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.LongCount(_ => true)
- );
-
- res.Messages.AssertEqual(
- OnNext(250, 0L),
- OnCompleted<long>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void LongCount_Predicate_Empty_False()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.LongCount(_ => false)
- );
-
- res.Messages.AssertEqual(
- OnNext(250, 0L),
- OnCompleted<long>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void LongCount_Predicate_Return_True()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.LongCount(_ => true)
- );
-
- res.Messages.AssertEqual(
- OnNext(250, 1L),
- OnCompleted<long>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void LongCount_Predicate_Return_False()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.LongCount(_ => false)
- );
-
- res.Messages.AssertEqual(
- OnNext(250, 0L),
- OnCompleted<long>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void LongCount_Predicate_Some_All()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnNext(220, 3),
- OnNext(230, 4),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.LongCount(x => x < 10)
- );
-
- res.Messages.AssertEqual(
- OnNext(250, 3L),
- OnCompleted<long>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void LongCount_Predicate_Some_None()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnNext(220, 3),
- OnNext(230, 4),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.LongCount(x => x > 10)
- );
-
- res.Messages.AssertEqual(
- OnNext(250, 0L),
- OnCompleted<long>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void LongCount_Predicate_Some_Even()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnNext(220, 3),
- OnNext(230, 4),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.LongCount(x => x % 2 == 0)
- );
-
- res.Messages.AssertEqual(
- OnNext(250, 2L),
- OnCompleted<long>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void LongCount_Predicate_Throw_True()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnError<int>(210, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.LongCount(_ => true)
- );
-
- res.Messages.AssertEqual(
- OnError<long>(210, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void LongCount_Predicate_Throw_False()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnError<int>(210, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.LongCount(_ => false)
- );
-
- res.Messages.AssertEqual(
- OnError<long>(210, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void LongCount_Predicate_Never()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1)
- );
-
- var res = scheduler.Start(() =>
- xs.LongCount(_ => true)
- );
-
- res.Messages.AssertEqual(
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
- }
-
- [TestMethod]
- public void LongCount_Predicate_PredicateThrows()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnNext(230, 3),
- OnCompleted<int>(240)
- );
-
- var ex = new Exception();
-
- var res = scheduler.Start(() =>
- xs.LongCount(x =>
- {
- if (x == 3)
- throw ex;
-
- return true;
- })
- );
-
- res.Messages.AssertEqual(
- OnError<long>(230, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 230)
- );
- }
-
-#if !NO_PERF
- [TestMethod]
- public void LongCount_Predicate_InjectOverflow()
- {
- var xs = Observable.Return(42, ThreadPoolScheduler.Instance);
-
- var res = new OverflowInjection<int>(xs, long.MaxValue).LongCount(_ => true);
-
- ReactiveAssert.Throws<OverflowException>(() => res.ForEach(_ => { }));
- }
-#endif
-
- #endregion
-
- #region + Max +
-
- [TestMethod]
- public void Max_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Max(default(IObservable<int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Max(default(IObservable<double>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Max(default(IObservable<float>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Max(default(IObservable<decimal>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Max(default(IObservable<long>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Max(default(IObservable<int?>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Max(default(IObservable<double?>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Max(default(IObservable<float?>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Max(default(IObservable<decimal?>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Max(default(IObservable<long?>)));
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Max(default(IObservable<DateTime>), _ => default(int)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Max(default(IObservable<DateTime>), _ => default(double)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Max(default(IObservable<DateTime>), _ => default(float)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Max(default(IObservable<DateTime>), _ => default(decimal)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Max(default(IObservable<DateTime>), _ => default(long)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Max(default(IObservable<DateTime>), _ => default(int?)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Max(default(IObservable<DateTime>), _ => default(double?)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Max(default(IObservable<DateTime>), _ => default(float?)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Max(default(IObservable<DateTime>), _ => default(decimal?)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Max(default(IObservable<DateTime>), _ => default(long?)));
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Max(Observable.Empty<DateTime>(), default(Func<DateTime, int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Max(Observable.Empty<DateTime>(), default(Func<DateTime, double>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Max(Observable.Empty<DateTime>(), default(Func<DateTime, float>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Max(Observable.Empty<DateTime>(), default(Func<DateTime, decimal>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Max(Observable.Empty<DateTime>(), default(Func<DateTime, long>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Max(Observable.Empty<DateTime>(), default(Func<DateTime, int?>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Max(Observable.Empty<DateTime>(), default(Func<DateTime, double?>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Max(Observable.Empty<DateTime>(), default(Func<DateTime, float?>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Max(Observable.Empty<DateTime>(), default(Func<DateTime, decimal?>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Max(Observable.Empty<DateTime>(), default(Func<DateTime, long?>)));
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Max(default(IObservable<DateTime>)));
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Max(default(IObservable<DateTime>), Comparer<DateTime>.Default));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Max(Observable.Empty<DateTime>(), default(IComparer<DateTime>)));
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Max(default(IObservable<DateTime>), _ => ""));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Max(Observable.Empty<DateTime>(), default(Func<DateTime, string>)));
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Max(default(IObservable<DateTime>), _ => "", Comparer<string>.Default));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Max(Observable.Empty<DateTime>(), default(Func<DateTime, string>), Comparer<string>.Default));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Max(Observable.Empty<DateTime>(), _ => "", default(IComparer<string>)));
- }
-
- [TestMethod]
- public void Max_Int32_Empty()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Max()
- );
-
- res.Messages.AssertEqual(
- OnError<int>(250, e => e is InvalidOperationException)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Max_Int32_Return()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Max()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, 2),
- OnCompleted<int>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Max_Int32_Some()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 3),
- OnNext(220, 4),
- OnNext(230, 2),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Max()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, 4),
- OnCompleted<int>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Max_Int32_Throw()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnError<int>(210, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.Max()
- );
-
- res.Messages.AssertEqual(
- OnError<int>(210, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void Max_Int32_Never()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1)
- );
-
- var res = scheduler.Start(() =>
- xs.Max()
- );
-
- res.Messages.AssertEqual(
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
- }
-
- [TestMethod]
- public void Max_Int64_Empty()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1L),
- OnCompleted<long>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Max()
- );
-
- res.Messages.AssertEqual(
- OnError<long>(250, e => e is InvalidOperationException)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Max_Int64_Return()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1L),
- OnNext(210, 2L),
- OnCompleted<long>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Max()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, 2L),
- OnCompleted<long>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Max_Int64_Some()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1L),
- OnNext(210, 3L),
- OnNext(220, 4L),
- OnNext(230, 2L),
- OnCompleted<long>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Max()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, 4L),
- OnCompleted<long>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Max_Int64_Throw()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1L),
- OnError<long>(210, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.Max()
- );
-
- res.Messages.AssertEqual(
- OnError<long>(210, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void Max_Int64_Never()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1L)
- );
-
- var res = scheduler.Start(() =>
- xs.Max()
- );
-
- res.Messages.AssertEqual(
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
- }
-
- [TestMethod]
- public void Max_Float_Empty()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1f),
- OnCompleted<float>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Max()
- );
-
- res.Messages.AssertEqual(
- OnError<float>(250, e => e is InvalidOperationException)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Max_Float_Return()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1f),
- OnNext(210, 2f),
- OnCompleted<float>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Max()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, 2f),
- OnCompleted<float>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Max_Float_Some()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1f),
- OnNext(210, 3f),
- OnNext(220, 4f),
- OnNext(230, 2f),
- OnCompleted<float>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Max()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, 4f),
- OnCompleted<float>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Max_Float_Throw()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1f),
- OnError<float>(210, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.Max()
- );
-
- res.Messages.AssertEqual(
- OnError<float>(210, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void Max_Float_Never()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1f)
- );
-
- var res = scheduler.Start(() =>
- xs.Max()
- );
-
- res.Messages.AssertEqual(
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
- }
-
- [TestMethod]
- public void Max_Double_Empty()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1.0),
- OnCompleted<double>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Max()
- );
-
- res.Messages.AssertEqual(
- OnError<double>(250, e => e is InvalidOperationException)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Max_Double_Return()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1.0),
- OnNext(210, 2.0),
- OnCompleted<double>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Max()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, 2.0),
- OnCompleted<double>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Max_Double_Some()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1.0),
- OnNext(210, 3.0),
- OnNext(220, 4.0),
- OnNext(230, 2.0),
- OnCompleted<double>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Max()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, 4.0),
- OnCompleted<double>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Max_Double_Throw()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1.0),
- OnError<double>(210, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.Max()
- );
-
- res.Messages.AssertEqual(
- OnError<double>(210, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void Max_Double_Never()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1.0)
- );
-
- var res = scheduler.Start(() =>
- xs.Max()
- );
-
- res.Messages.AssertEqual(
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
- }
-
- [TestMethod]
- public void Max_Decimal_Empty()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1m),
- OnCompleted<decimal>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Max()
- );
-
- res.Messages.AssertEqual(
- OnError<decimal>(250, e => e is InvalidOperationException)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Max_Decimal_Return()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1m),
- OnNext(210, 2m),
- OnCompleted<decimal>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Max()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, 2m),
- OnCompleted<decimal>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Max_Decimal_Some()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1m),
- OnNext(210, 3m),
- OnNext(220, 4m),
- OnNext(230, 2m),
- OnCompleted<decimal>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Max()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, 4m),
- OnCompleted<decimal>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Max_Decimal_Throw()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1m),
- OnError<decimal>(210, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.Max()
- );
-
- res.Messages.AssertEqual(
- OnError<decimal>(210, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void Max_Decimal_Never()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1m)
- );
-
- var res = scheduler.Start(() =>
- xs.Max()
- );
-
- res.Messages.AssertEqual(
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
- }
-
- [TestMethod]
- public void Max_Nullable_Int32_Empty()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (int?)1),
- OnCompleted<int?>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Max()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, default(int?)),
- OnCompleted<int?>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Max_Nullable_Int32_Return()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (int?)1),
- OnNext(210, (int?)2),
- OnCompleted<int?>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Max()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, (int?)2),
- OnCompleted<int?>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Max_Nullable_Int32_Some1()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (int?)1),
- OnNext(210, (int?)null),
- OnNext(220, (int?)4),
- OnNext(230, (int?)2),
- OnCompleted<int?>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Max()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, (int?)4),
- OnCompleted<int?>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Max_Nullable_Int32_Some2()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (int?)1),
- OnNext(210, (int?)null),
- OnNext(220, (int?)2),
- OnNext(230, (int?)4),
- OnCompleted<int?>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Max()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, (int?)4),
- OnCompleted<int?>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Max_Nullable_GeneralNullableMaxTest_LhsIsNull()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (int?)1),
- OnNext(210, (int?)null),
- OnNext(220, (int?)2),
- OnCompleted<int?>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Max()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, (int?)2),
- OnCompleted<int?>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Max_Nullable_GeneralNullableMaxTest_RhsIsNull()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (int?)1),
- OnNext(210, (int?)2),
- OnNext(220, (int?)null),
- OnCompleted<int?>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Max()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, (int?)2),
- OnCompleted<int?>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Max_Nullable_GeneralNullableMaxTest_Less()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (int?)1),
- OnNext(210, (int?)2),
- OnNext(220, (int?)3),
- OnCompleted<int?>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Max()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, (int?)3),
- OnCompleted<int?>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Max_Nullable_GeneralNullableMaxTest_Greater()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (int?)1),
- OnNext(210, (int?)3),
- OnNext(220, (int?)2),
- OnCompleted<int?>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Max()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, (int?)3),
- OnCompleted<int?>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Max_Nullable_Int32_Throw()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (int?)1),
- OnError<int?>(210, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.Max()
- );
-
- res.Messages.AssertEqual(
- OnError<int?>(210, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void Max_Nullable_Int32_Never()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (int?)1)
- );
-
- var res = scheduler.Start(() =>
- xs.Max()
- );
-
- res.Messages.AssertEqual(
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
- }
-
- [TestMethod]
- public void Max_Nullable_Int64_Empty()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (long?)1L),
- OnCompleted<long?>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Max()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, default(long?)),
- OnCompleted<long?>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Max_Nullable_Int64_Return()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (long?)1L),
- OnNext(210, (long?)2L),
- OnCompleted<long?>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Max()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, (long?)2L),
- OnCompleted<long?>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Max_Nullable_Int64_Some1()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (long?)1L),
- OnNext(210, (long?)null),
- OnNext(220, (long?)4L),
- OnNext(230, (long?)2L),
- OnCompleted<long?>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Max()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, (long?)4L),
- OnCompleted<long?>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Max_Nullable_Int64_Some2()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (long?)1L),
- OnNext(210, (long?)null),
- OnNext(220, (long?)2L),
- OnNext(230, (long?)4L),
- OnCompleted<long?>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Max()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, (long?)4L),
- OnCompleted<long?>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Max_Nullable_Int64_Throw()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (long?)1L),
- OnError<long?>(210, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.Max()
- );
-
- res.Messages.AssertEqual(
- OnError<long?>(210, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void Max_Nullable_Int64_Never()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (long?)1L)
- );
-
- var res = scheduler.Start(() =>
- xs.Max()
- );
-
- res.Messages.AssertEqual(
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
- }
-
- [TestMethod]
- public void Max_Nullable_Float_Empty()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (float?)1f),
- OnCompleted<float?>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Max()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, default(float?)),
- OnCompleted<float?>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Max_Nullable_Float_Return()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (float?)1f),
- OnNext(210, (float?)2f),
- OnCompleted<float?>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Max()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, (float?)2f),
- OnCompleted<float?>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Max_Nullable_Float_Some1()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (float?)1f),
- OnNext(210, (float?)null),
- OnNext(220, (float?)4f),
- OnNext(230, (float?)2f),
- OnCompleted<float?>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Max()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, (float?)4f),
- OnCompleted<float?>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Max_Nullable_Float_Some2()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (float?)1f),
- OnNext(210, (float?)null),
- OnNext(220, (float?)2f),
- OnNext(230, (float?)4f),
- OnCompleted<float?>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Max()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, (float?)4f),
- OnCompleted<float?>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Max_Nullable_Float_Throw()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (float?)1f),
- OnError<float?>(210, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.Max()
- );
-
- res.Messages.AssertEqual(
- OnError<float?>(210, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void Max_Nullable_Float_Never()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (float?)1f)
- );
-
- var res = scheduler.Start(() =>
- xs.Max()
- );
-
- res.Messages.AssertEqual(
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
- }
-
- [TestMethod]
- public void Max_Nullable_Double_Empty()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (double?)1.0),
- OnCompleted<double?>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Max()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, default(double?)),
- OnCompleted<double?>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Max_Nullable_Double_Return()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (double?)1.0),
- OnNext(210, (double?)2.0),
- OnCompleted<double?>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Max()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, (double?)2.0),
- OnCompleted<double?>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Max_Nullable_Double_Some1()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (double?)1.0),
- OnNext(210, (double?)null),
- OnNext(220, (double?)4.0),
- OnNext(230, (double?)2.0),
- OnCompleted<double?>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Max()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, (double?)4.0),
- OnCompleted<double?>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Max_Nullable_Double_Some2()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (double?)1.0),
- OnNext(210, (double?)null),
- OnNext(220, (double?)2.0),
- OnNext(230, (double?)4.0),
- OnCompleted<double?>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Max()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, (double?)4.0),
- OnCompleted<double?>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Max_Nullable_Double_Throw()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (double?)1.0),
- OnError<double?>(210, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.Max()
- );
-
- res.Messages.AssertEqual(
- OnError<double?>(210, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void Max_Nullable_Double_Never()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (double?)1.0)
- );
-
- var res = scheduler.Start(() =>
- xs.Max()
- );
-
- res.Messages.AssertEqual(
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
- }
-
- [TestMethod]
- public void Max_Nullable_Decimal_Empty()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (decimal?)1m),
- OnCompleted<decimal?>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Max()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, default(decimal?)),
- OnCompleted<decimal?>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Max_Nullable_Decimal_Return()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (decimal?)1m),
- OnNext(210, (decimal?)2m),
- OnCompleted<decimal?>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Max()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, (decimal?)2m),
- OnCompleted<decimal?>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Max_Nullable_Decimal_Some1()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (decimal?)1m),
- OnNext(210, (decimal?)null),
- OnNext(220, (decimal?)4m),
- OnNext(230, (decimal?)2m),
- OnCompleted<decimal?>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Max()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, (decimal?)4m),
- OnCompleted<decimal?>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Max_Nullable_Decimal_Some2()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (decimal?)1m),
- OnNext(210, (decimal?)null),
- OnNext(220, (decimal?)2m),
- OnNext(230, (decimal?)4m),
- OnCompleted<decimal?>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Max()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, (decimal?)4m),
- OnCompleted<decimal?>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Max_Nullable_Decimal_Throw()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (decimal?)1m),
- OnError<decimal?>(210, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.Max()
- );
-
- res.Messages.AssertEqual(
- OnError<decimal?>(210, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void Max_Nullable_Decimal_Never()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (decimal?)1m)
- );
-
- var res = scheduler.Start(() =>
- xs.Max()
- );
-
- res.Messages.AssertEqual(
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
- }
-
- [TestMethod]
- public void MaxOfT_Reference_Empty()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, "z"),
- OnCompleted<string>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Max()
- );
-
-#if !NO_PERF
- // BREAKING CHANGE v2 > v1.x - Behavior for reference types
- res.Messages.AssertEqual(
- OnNext(250, default(string)),
- OnCompleted<string>(250)
- );
-#else
- res.Messages.AssertEqual(
- OnError<string>(250, e => e is InvalidOperationException)
- );
-#endif
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void MaxOfT_Value_Empty()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, DateTime.Now),
- OnCompleted<DateTime>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Max()
- );
-
- res.Messages.AssertEqual(
- OnError<DateTime>(250, e => e is InvalidOperationException)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void MaxOfT_Reference_Return()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, "z"),
- OnNext(210, "a"),
- OnCompleted<string>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Max()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, "a"),
- OnCompleted<string>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void MaxOfT_Value_Return()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, DateTime.Now),
- OnNext(210, new DateTime(1983, 2, 11)),
- OnCompleted<DateTime>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Max()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, new DateTime(1983, 2, 11)),
- OnCompleted<DateTime>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void MaxOfT_Reference_Some()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, "z"),
- OnNext(210, "b"),
- OnNext(220, "c"),
- OnNext(230, "a"),
- OnCompleted<string>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Max()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, "c"),
- OnCompleted<string>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void MaxOfT_Value_Some()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, DateTime.Now),
- OnNext(210, new DateTime(1993, 2, 11)),
- OnNext(220, new DateTime(2003, 2, 11)),
- OnNext(230, new DateTime(1983, 2, 11)),
- OnCompleted<DateTime>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Max()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, new DateTime(2003, 2, 11)),
- OnCompleted<DateTime>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void MaxOfT_Reference_Throw()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, "z"),
- OnError<string>(210, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.Max()
- );
-
- res.Messages.AssertEqual(
- OnError<string>(210, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void MaxOfT_Value_Throw()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, DateTime.Now),
- OnError<DateTime>(210, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.Max()
- );
-
- res.Messages.AssertEqual(
- OnError<DateTime>(210, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void MaxOfT_Reference_Never()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, "z")
- );
-
- var res = scheduler.Start(() =>
- xs.Max()
- );
-
- res.Messages.AssertEqual(
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
- }
-
- [TestMethod]
- public void MaxOfT_Value_Never()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, DateTime.Now)
- );
-
- var res = scheduler.Start(() =>
- xs.Max()
- );
-
- res.Messages.AssertEqual(
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
- }
-
- [TestMethod]
- public void MaxOfT_Reference_Comparer_Empty()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, "z"),
- OnCompleted<string>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Max(new ReverseComparer<string>(Comparer<string>.Default))
- );
-
-#if !NO_PERF
- // BREAKING CHANGE v2 > v1.x - Behavior for reference types
- res.Messages.AssertEqual(
- OnNext(250, default(string)),
- OnCompleted<string>(250)
- );
-#else
- res.Messages.AssertEqual(
- OnError<string>(250, e => e is InvalidOperationException)
- );
-#endif
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void MaxOfT_Value_Comparer_Empty()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, DateTime.Now),
- OnCompleted<DateTime>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Max(new ReverseComparer<DateTime>(Comparer<DateTime>.Default))
- );
-
- res.Messages.AssertEqual(
- OnError<DateTime>(250, e => e is InvalidOperationException)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void MaxOfT_Reference_Comparer_Return()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, "z"),
- OnNext(210, "a"),
- OnCompleted<string>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Max(new ReverseComparer<string>(Comparer<string>.Default))
- );
-
- res.Messages.AssertEqual(
- OnNext(250, "a"),
- OnCompleted<string>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void MaxOfT_Value_Comparer_Return()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, DateTime.Now),
- OnNext(210, new DateTime(1983, 2, 11)),
- OnCompleted<DateTime>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Max(new ReverseComparer<DateTime>(Comparer<DateTime>.Default))
- );
-
- res.Messages.AssertEqual(
- OnNext(250, new DateTime(1983, 2, 11)),
- OnCompleted<DateTime>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void MaxOfT_Reference_Comparer_Some()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, "z"),
- OnNext(210, "b"),
- OnNext(220, "c"),
- OnNext(230, "a"),
- OnCompleted<string>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Max(new ReverseComparer<string>(Comparer<string>.Default))
- );
-
- res.Messages.AssertEqual(
- OnNext(250, "a"),
- OnCompleted<string>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void MaxOfT_Value_Comparer_Some()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, DateTime.Now),
- OnNext(210, new DateTime(1993, 2, 11)),
- OnNext(220, new DateTime(2003, 2, 11)),
- OnNext(230, new DateTime(1983, 2, 11)),
- OnCompleted<DateTime>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Max(new ReverseComparer<DateTime>(Comparer<DateTime>.Default))
- );
-
- res.Messages.AssertEqual(
- OnNext(250, new DateTime(1983, 2, 11)),
- OnCompleted<DateTime>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void MaxOfT_Reference_Comparer_Throw()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, "z"),
- OnError<string>(210, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.Max(new ReverseComparer<string>(Comparer<string>.Default))
- );
-
- res.Messages.AssertEqual(
- OnError<string>(210, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void MaxOfT_Value_Comparer_Throw()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, DateTime.Now),
- OnError<DateTime>(210, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.Max(new ReverseComparer<DateTime>(Comparer<DateTime>.Default))
- );
-
- res.Messages.AssertEqual(
- OnError<DateTime>(210, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void MaxOfT_Reference_Comparer_Never()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, "z")
- );
-
- var res = scheduler.Start(() =>
- xs.Max(new ReverseComparer<string>(Comparer<string>.Default))
- );
-
- res.Messages.AssertEqual(
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
- }
-
- [TestMethod]
- public void MaxOfT_Value_Comparer_Never()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, DateTime.Now)
- );
-
- var res = scheduler.Start(() =>
- xs.Max(new ReverseComparer<DateTime>(Comparer<DateTime>.Default))
- );
-
- res.Messages.AssertEqual(
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
- }
-
- [TestMethod]
- public void MaxOfT_Reference_ComparerThrows()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, "z"),
- OnNext(210, "b"),
- OnNext(220, "c"),
- OnNext(230, "a"),
- OnCompleted<string>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Max(new ThrowingComparer<string>(ex))
- );
-
- res.Messages.AssertEqual(
- OnError<string>(220, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 220)
- );
- }
-
- [TestMethod]
- public void MaxOfT_Value_ComparerThrows()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, DateTime.Now),
- OnNext(210, new DateTime(1993, 2, 11)),
- OnNext(220, new DateTime(2003, 2, 11)),
- OnNext(230, new DateTime(1983, 2, 11)),
- OnCompleted<DateTime>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Max(new ThrowingComparer<DateTime>(ex))
- );
-
- res.Messages.AssertEqual(
- OnError<DateTime>(220, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 220)
- );
- }
-
- [TestMethod]
- public void Max_Selector_Regular_Int32()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable<string>(
- OnNext(210, "fo"),
- OnNext(220, "b"),
- OnNext(230, "qux"),
- OnCompleted<string>(240)
- );
-
- var res = scheduler.Start(() => xs.Max(x => (int)x.Length));
-
- res.Messages.AssertEqual(
- OnNext(240, 3),
- OnCompleted<int>(240)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 240)
- );
- }
-
- [TestMethod]
- public void Max_Selector_Regular_Int64()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable<string>(
- OnNext(210, "fo"),
- OnNext(220, "b"),
- OnNext(230, "qux"),
- OnCompleted<string>(240)
- );
-
- var res = scheduler.Start(() => xs.Max(x => (long)x.Length));
-
- res.Messages.AssertEqual(
- OnNext(240, 3L),
- OnCompleted<long>(240)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 240)
- );
- }
-
- [TestMethod]
- public void Max_Selector_Regular_Single()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable<string>(
- OnNext(210, "fo"),
- OnNext(220, "b"),
- OnNext(230, "qux"),
- OnCompleted<string>(240)
- );
-
- var res = scheduler.Start(() => xs.Max(x => (float)x.Length));
-
- res.Messages.AssertEqual(
- OnNext(240, 3.0f),
- OnCompleted<float>(240)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 240)
- );
- }
-
- [TestMethod]
- public void Max_Selector_Regular_Double()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable<string>(
- OnNext(210, "fo"),
- OnNext(220, "b"),
- OnNext(230, "qux"),
- OnCompleted<string>(240)
- );
-
- var res = scheduler.Start(() => xs.Max(x => (double)x.Length));
-
- res.Messages.AssertEqual(
- OnNext(240, 3.0),
- OnCompleted<double>(240)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 240)
- );
- }
-
- [TestMethod]
- public void Max_Selector_Regular_Decimal()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable<string>(
- OnNext(210, "fo"),
- OnNext(220, "b"),
- OnNext(230, "qux"),
- OnCompleted<string>(240)
- );
-
- var res = scheduler.Start(() => xs.Max(x => (decimal)x.Length));
-
- res.Messages.AssertEqual(
- OnNext(240, 3.0m),
- OnCompleted<decimal>(240)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 240)
- );
- }
-
- [TestMethod]
- public void Max_Selector_Regular_Int32_Nullable()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable<string>(
- OnNext(210, "fo"),
- OnNext(220, "b"),
- OnNext(230, "qux"),
- OnCompleted<string>(240)
- );
-
- var res = scheduler.Start(() => xs.Max(x => x == "fo" ? default(int?) : x.Length));
-
- res.Messages.AssertEqual(
- OnNext(240, (int?)3),
- OnCompleted<int?>(240)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 240)
- );
- }
-
- [TestMethod]
- public void Max_Selector_Regular_Int64_Nullable()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable<string>(
- OnNext(210, "fo"),
- OnNext(220, "b"),
- OnNext(230, "qux"),
- OnCompleted<string>(240)
- );
-
- var res = scheduler.Start(() => xs.Max(x => x == "fo" ? default(long?) : x.Length));
-
- res.Messages.AssertEqual(
- OnNext(240, (long?)3.0),
- OnCompleted<long?>(240)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 240)
- );
- }
-
- [TestMethod]
- public void Max_Selector_Regular_Single_Nullable()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable<string>(
- OnNext(210, "fo"),
- OnNext(220, "b"),
- OnNext(230, "qux"),
- OnCompleted<string>(240)
- );
-
- var res = scheduler.Start(() => xs.Max(x => x == "fo" ? default(float?) : x.Length));
-
- res.Messages.AssertEqual(
- OnNext(240, (float?)3.0),
- OnCompleted<float?>(240)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 240)
- );
- }
-
- [TestMethod]
- public void Max_Selector_Regular_Double_Nullable()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable<string>(
- OnNext(210, "fo"),
- OnNext(220, "b"),
- OnNext(230, "qux"),
- OnCompleted<string>(240)
- );
-
- var res = scheduler.Start(() => xs.Max(x => x == "fo" ? default(double?) : x.Length));
-
- res.Messages.AssertEqual(
- OnNext(240, (double?)3.0),
- OnCompleted<double?>(240)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 240)
- );
- }
-
- [TestMethod]
- public void Max_Selector_Regular_Decimal_Nullable()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable<string>(
- OnNext(210, "fo"),
- OnNext(220, "b"),
- OnNext(230, "qux"),
- OnCompleted<string>(240)
- );
-
- var res = scheduler.Start(() => xs.Max(x => x == "fo" ? default(decimal?) : x.Length));
-
- res.Messages.AssertEqual(
- OnNext(240, (decimal?)3.0),
- OnCompleted<decimal?>(240)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 240)
- );
- }
-
- [TestMethod]
- public void MaxOfT_Selector_Regular()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable<string>(
- OnNext(210, "bar"),
- OnNext(220, "qux"),
- OnNext(230, "foo"),
- OnCompleted<string>(240)
- );
-
- var res = scheduler.Start(() => xs.Max(x => new string(x.Reverse().ToArray())));
-
- res.Messages.AssertEqual(
- OnNext(240, "xuq"),
- OnCompleted<string>(240)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 240)
- );
- }
-
- [TestMethod]
- public void MaxOfT_Selector_Regular_Comparer()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable<string>(
- OnNext(210, "bar"),
- OnNext(220, "qux"),
- OnNext(230, "foo"),
- OnCompleted<string>(240)
- );
-
- var res = scheduler.Start(() => xs.Max(x => new string(x.Reverse().ToArray()), new ReverseComparer<string>(Comparer<string>.Default)));
-
- res.Messages.AssertEqual(
- OnNext(240, "oof"),
- OnCompleted<string>(240)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 240)
- );
- }
-
- #endregion
-
- #region + MaxBy +
-
- [TestMethod]
- public void MaxBy_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.MaxBy(default(IObservable<int>), x => x));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.MaxBy(DummyObservable<int>.Instance, default(Func<int, int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.MaxBy(default(IObservable<int>), x => x, Comparer<int>.Default));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.MaxBy(DummyObservable<int>.Instance, default(Func<int, int>), Comparer<int>.Default));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.MaxBy(DummyObservable<int>.Instance, x => x, null));
- }
-
- [TestMethod]
- public void MaxBy_Empty()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, new KeyValuePair<int, string>(1, "z")),
- OnCompleted<KeyValuePair<int, string>>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.MaxBy(x => x.Key)
- );
-
- res.Messages.AssertEqual(
- OnNext<IList<KeyValuePair<int, string>>>(250, x => x.Count == 0),
- OnCompleted<IList<KeyValuePair<int, string>>>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void MaxBy_Return()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, new KeyValuePair<int, string>(1, "z")),
- OnNext(210, new KeyValuePair<int, string>(2, "a")),
- OnCompleted<KeyValuePair<int, string>>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.MaxBy(x => x.Key)
- );
-
- res.Messages.AssertEqual(
- OnNext<IList<KeyValuePair<int, string>>>(250, x => x.SequenceEqual(new[] {
- new KeyValuePair<int, string>(2, "a"),
- })),
- OnCompleted<IList<KeyValuePair<int, string>>>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void MaxBy_Some()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, new KeyValuePair<int, string>(1, "z")),
- OnNext(210, new KeyValuePair<int, string>(3, "b")),
- OnNext(220, new KeyValuePair<int, string>(4, "c")),
- OnNext(230, new KeyValuePair<int, string>(2, "a")),
- OnCompleted<KeyValuePair<int, string>>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.MaxBy(x => x.Key)
- );
-
- res.Messages.AssertEqual(
- OnNext<IList<KeyValuePair<int, string>>>(250, x => x.SequenceEqual(new[] {
- new KeyValuePair<int, string>(4, "c"),
- })),
- OnCompleted<IList<KeyValuePair<int, string>>>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void MaxBy_Multiple()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, new KeyValuePair<int, string>(1, "z")),
- OnNext(210, new KeyValuePair<int, string>(3, "b")),
- OnNext(215, new KeyValuePair<int, string>(2, "d")),
- OnNext(220, new KeyValuePair<int, string>(3, "c")),
- OnNext(225, new KeyValuePair<int, string>(2, "y")),
- OnNext(230, new KeyValuePair<int, string>(4, "a")),
- OnNext(235, new KeyValuePair<int, string>(4, "r")),
- OnCompleted<KeyValuePair<int, string>>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.MaxBy(x => x.Key)
- );
-
- res.Messages.AssertEqual(
- OnNext<IList<KeyValuePair<int, string>>>(250, x => x.SequenceEqual(new[] {
- new KeyValuePair<int, string>(4, "a"),
- new KeyValuePair<int, string>(4, "r"),
- })),
- OnCompleted<IList<KeyValuePair<int, string>>>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
- [TestMethod]
- public void MaxBy_Throw()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, new KeyValuePair<int, string>(1, "z")),
- OnError<KeyValuePair<int, string>>(210, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.MaxBy(x => x.Key)
- );
-
- res.Messages.AssertEqual(
- OnError<IList<KeyValuePair<int, string>>>(210, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void MaxBy_Never()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, new KeyValuePair<int, string>(1, "z"))
- );
-
- var res = scheduler.Start(() =>
- xs.MaxBy(x => x.Key)
- );
-
- res.Messages.AssertEqual(
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
- }
-
- [TestMethod]
- public void MaxBy_Comparer_Empty()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, new KeyValuePair<int, string>(1, "z")),
- OnCompleted<KeyValuePair<int, string>>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.MaxBy(x => x.Key, new ReverseComparer<int>(Comparer<int>.Default))
- );
-
- res.Messages.AssertEqual(
- OnNext<IList<KeyValuePair<int, string>>>(250, x => x.Count == 0),
- OnCompleted<IList<KeyValuePair<int, string>>>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void MaxBy_Comparer_Return()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, new KeyValuePair<int, string>(1, "z")),
- OnNext(210, new KeyValuePair<int, string>(2, "a")),
- OnCompleted<KeyValuePair<int, string>>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.MaxBy(x => x.Key, new ReverseComparer<int>(Comparer<int>.Default))
- );
-
- res.Messages.AssertEqual(
- OnNext<IList<KeyValuePair<int, string>>>(250, x => x.SequenceEqual(new[] {
- new KeyValuePair<int, string>(2, "a"),
- })),
- OnCompleted<IList<KeyValuePair<int, string>>>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void MaxBy_Comparer_Some()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, new KeyValuePair<int, string>(1, "z")),
- OnNext(210, new KeyValuePair<int, string>(3, "b")),
- OnNext(220, new KeyValuePair<int, string>(4, "c")),
- OnNext(230, new KeyValuePair<int, string>(2, "a")),
- OnCompleted<KeyValuePair<int, string>>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.MaxBy(x => x.Key, new ReverseComparer<int>(Comparer<int>.Default))
- );
-
- res.Messages.AssertEqual(
- OnNext<IList<KeyValuePair<int, string>>>(250, x => x.SequenceEqual(new[] {
- new KeyValuePair<int, string>(2, "a"),
- })),
- OnCompleted<IList<KeyValuePair<int, string>>>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void MaxBy_Comparer_Throw()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, new KeyValuePair<int, string>(1, "z")),
- OnError<KeyValuePair<int, string>>(210, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.MaxBy(x => x.Key, new ReverseComparer<int>(Comparer<int>.Default))
- );
-
- res.Messages.AssertEqual(
- OnError<IList<KeyValuePair<int, string>>>(210, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void MaxBy_Comparer_Never()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, new KeyValuePair<int, string>(1, "z"))
- );
-
- var res = scheduler.Start(() =>
- xs.MaxBy(x => x.Key, new ReverseComparer<int>(Comparer<int>.Default))
- );
-
- res.Messages.AssertEqual(
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
- }
-
- [TestMethod]
- public void MaxBy_SelectorThrows()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, new KeyValuePair<int, string>(1, "z")),
- OnNext(210, new KeyValuePair<int, string>(3, "b")),
- OnNext(220, new KeyValuePair<int, string>(2, "c")),
- OnNext(230, new KeyValuePair<int, string>(4, "a")),
- OnCompleted<KeyValuePair<int, string>>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.MaxBy<KeyValuePair<int, string>, int>(x => { throw ex; })
- );
-
- res.Messages.AssertEqual(
- OnError<IList<KeyValuePair<int, string>>>(210, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void MaxBy_ComparerThrows()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, new KeyValuePair<int, string>(1, "z")),
- OnNext(210, new KeyValuePair<int, string>(3, "b")),
- OnNext(220, new KeyValuePair<int, string>(2, "c")),
- OnNext(230, new KeyValuePair<int, string>(4, "a")),
- OnCompleted<KeyValuePair<int, string>>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.MaxBy(x => x.Key, new ThrowingComparer<int>(ex))
- );
-
- res.Messages.AssertEqual(
- OnError<IList<KeyValuePair<int, string>>>(220, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 220)
- );
- }
-
- #endregion
-
- #region + Min +
-
- [TestMethod]
- public void Min_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Min(default(IObservable<int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Min(default(IObservable<double>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Min(default(IObservable<float>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Min(default(IObservable<decimal>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Min(default(IObservable<long>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Min(default(IObservable<int?>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Min(default(IObservable<double?>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Min(default(IObservable<float?>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Min(default(IObservable<decimal?>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Min(default(IObservable<long?>)));
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Min(default(IObservable<DateTime>), _ => default(int)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Min(default(IObservable<DateTime>), _ => default(double)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Min(default(IObservable<DateTime>), _ => default(float)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Min(default(IObservable<DateTime>), _ => default(decimal)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Min(default(IObservable<DateTime>), _ => default(long)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Min(default(IObservable<DateTime>), _ => default(int?)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Min(default(IObservable<DateTime>), _ => default(double?)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Min(default(IObservable<DateTime>), _ => default(float?)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Min(default(IObservable<DateTime>), _ => default(decimal?)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Min(default(IObservable<DateTime>), _ => default(long?)));
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Min(Observable.Empty<DateTime>(), default(Func<DateTime, int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Min(Observable.Empty<DateTime>(), default(Func<DateTime, double>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Min(Observable.Empty<DateTime>(), default(Func<DateTime, float>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Min(Observable.Empty<DateTime>(), default(Func<DateTime, decimal>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Min(Observable.Empty<DateTime>(), default(Func<DateTime, long>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Min(Observable.Empty<DateTime>(), default(Func<DateTime, int?>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Min(Observable.Empty<DateTime>(), default(Func<DateTime, double?>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Min(Observable.Empty<DateTime>(), default(Func<DateTime, float?>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Min(Observable.Empty<DateTime>(), default(Func<DateTime, decimal?>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Min(Observable.Empty<DateTime>(), default(Func<DateTime, long?>)));
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Min(default(IObservable<DateTime>)));
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Min(default(IObservable<DateTime>), Comparer<DateTime>.Default));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Min(Observable.Empty<DateTime>(), default(IComparer<DateTime>)));
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Min(default(IObservable<DateTime>), _ => ""));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Min(Observable.Empty<DateTime>(), default(Func<DateTime, string>)));
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Min(default(IObservable<DateTime>), _ => "", Comparer<string>.Default));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Min(Observable.Empty<DateTime>(), default(Func<DateTime, string>), Comparer<string>.Default));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Min(Observable.Empty<DateTime>(), _ => "", default(IComparer<string>)));
- }
-
- [TestMethod]
- public void Min_Int32_Empty()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Min()
- );
-
- res.Messages.AssertEqual(
- OnError<int>(250, e => e is InvalidOperationException)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Min_Int32_Return()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Min()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, 2),
- OnCompleted<int>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Min_Int32_Some()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 3),
- OnNext(220, 2),
- OnNext(230, 4),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Min()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, 2),
- OnCompleted<int>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Min_Int32_Throw()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnError<int>(210, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.Min()
- );
-
- res.Messages.AssertEqual(
- OnError<int>(210, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void Min_Int32_Never()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1)
- );
-
- var res = scheduler.Start(() =>
- xs.Min()
- );
-
- res.Messages.AssertEqual(
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
- }
-
- [TestMethod]
- public void Min_Int64_Empty()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1L),
- OnCompleted<long>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Min()
- );
-
- res.Messages.AssertEqual(
- OnError<long>(250, e => e is InvalidOperationException)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Min_Int64_Return()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1L),
- OnNext(210, 2L),
- OnCompleted<long>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Min()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, 2L),
- OnCompleted<long>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Min_Int64_Some()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1L),
- OnNext(210, 3L),
- OnNext(220, 2L),
- OnNext(230, 4L),
- OnCompleted<long>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Min()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, 2L),
- OnCompleted<long>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Min_Int64_Throw()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1L),
- OnError<long>(210, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.Min()
- );
-
- res.Messages.AssertEqual(
- OnError<long>(210, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void Min_Int64_Never()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1L)
- );
-
- var res = scheduler.Start(() =>
- xs.Min()
- );
-
- res.Messages.AssertEqual(
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
- }
-
- [TestMethod]
- public void Min_Float_Empty()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1f),
- OnCompleted<float>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Min()
- );
-
- res.Messages.AssertEqual(
- OnError<float>(250, e => e is InvalidOperationException)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Min_Float_Return()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1f),
- OnNext(210, 2f),
- OnCompleted<float>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Min()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, 2f),
- OnCompleted<float>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Min_Float_Some()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1f),
- OnNext(210, 3f),
- OnNext(220, 2f),
- OnNext(230, 4f),
- OnCompleted<float>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Min()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, 2f),
- OnCompleted<float>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Min_Float_Throw()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1f),
- OnError<float>(210, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.Min()
- );
-
- res.Messages.AssertEqual(
- OnError<float>(210, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void Min_Float_Never()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1f)
- );
-
- var res = scheduler.Start(() =>
- xs.Min()
- );
-
- res.Messages.AssertEqual(
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
- }
-
- [TestMethod]
- public void Min_Double_Empty()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1.0),
- OnCompleted<double>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Min()
- );
-
- res.Messages.AssertEqual(
- OnError<double>(250, e => e is InvalidOperationException)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Min_Double_Return()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1.0),
- OnNext(210, 2.0),
- OnCompleted<double>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Min()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, 2.0),
- OnCompleted<double>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Min_Double_Some()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1.0),
- OnNext(210, 3.0),
- OnNext(220, 2.0),
- OnNext(230, 4.0),
- OnCompleted<double>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Min()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, 2.0),
- OnCompleted<double>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Min_Double_Throw()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1.0),
- OnError<double>(210, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.Min()
- );
-
- res.Messages.AssertEqual(
- OnError<double>(210, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void Min_Double_Never()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1.0)
- );
-
- var res = scheduler.Start(() =>
- xs.Min()
- );
-
- res.Messages.AssertEqual(
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
- }
-
- [TestMethod]
- public void Min_Decimal_Empty()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1m),
- OnCompleted<decimal>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Min()
- );
-
- res.Messages.AssertEqual(
- OnError<decimal>(250, e => e is InvalidOperationException)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Min_Decimal_Return()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1m),
- OnNext(210, 2m),
- OnCompleted<decimal>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Min()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, 2m),
- OnCompleted<decimal>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Min_Decimal_Some()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1m),
- OnNext(210, 3m),
- OnNext(220, 2m),
- OnNext(230, 4m),
- OnCompleted<decimal>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Min()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, 2m),
- OnCompleted<decimal>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Min_Decimal_Throw()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1m),
- OnError<decimal>(210, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.Min()
- );
-
- res.Messages.AssertEqual(
- OnError<decimal>(210, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void Min_Decimal_Never()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1m)
- );
-
- var res = scheduler.Start(() =>
- xs.Min()
- );
-
- res.Messages.AssertEqual(
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
- }
-
- [TestMethod]
- public void Min_Nullable_Int32_Empty()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (int?)1),
- OnCompleted<int?>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Min()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, default(int?)),
- OnCompleted<int?>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Min_Nullable_Int32_Return()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (int?)1),
- OnNext(210, (int?)2),
- OnCompleted<int?>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Min()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, (int?)2),
- OnCompleted<int?>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Min_Nullable_Int32_Some1()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (int?)1),
- OnNext(210, (int?)null),
- OnNext(220, (int?)2),
- OnNext(230, (int?)4),
- OnCompleted<int?>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Min()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, (int?)2),
- OnCompleted<int?>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Min_Nullable_Int32_Some2()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (int?)1),
- OnNext(210, (int?)null),
- OnNext(220, (int?)4),
- OnNext(230, (int?)2),
- OnCompleted<int?>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Min()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, (int?)2),
- OnCompleted<int?>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Min_Nullable_GeneralNullableMinTest_LhsIsNull()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (int?)1),
- OnNext(210, (int?)null),
- OnNext(220, (int?)2),
- OnCompleted<int?>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Min()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, (int?)2),
- OnCompleted<int?>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Min_Nullable_GeneralNullableMinTest_RhsIsNull()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (int?)1),
- OnNext(210, (int?)2),
- OnNext(220, (int?)null),
- OnCompleted<int?>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Min()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, (int?)2),
- OnCompleted<int?>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Min_Nullable_GeneralNullableMinTest_Less()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (int?)1),
- OnNext(210, (int?)2),
- OnNext(220, (int?)3),
- OnCompleted<int?>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Min()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, (int?)2),
- OnCompleted<int?>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Min_Nullable_GeneralNullableMinTest_Greater()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (int?)1),
- OnNext(210, (int?)3),
- OnNext(220, (int?)2),
- OnCompleted<int?>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Min()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, (int?)2),
- OnCompleted<int?>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Min_Nullable_Int32_Throw()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (int?)1),
- OnError<int?>(210, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.Min()
- );
-
- res.Messages.AssertEqual(
- OnError<int?>(210, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void Min_Nullable_Int32_Never()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (int?)1)
- );
-
- var res = scheduler.Start(() =>
- xs.Min()
- );
-
- res.Messages.AssertEqual(
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
- }
-
- [TestMethod]
- public void Min_Nullable_Int64_Empty()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (long?)1L),
- OnCompleted<long?>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Min()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, default(long?)),
- OnCompleted<long?>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Min_Nullable_Int64_Return()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (long?)1L),
- OnNext(210, (long?)2L),
- OnCompleted<long?>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Min()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, (long?)2L),
- OnCompleted<long?>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Min_Nullable_Int64_Some1()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (long?)1L),
- OnNext(210, (long?)null),
- OnNext(220, (long?)2L),
- OnNext(230, (long?)4L),
- OnCompleted<long?>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Min()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, (long?)2L),
- OnCompleted<long?>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Min_Nullable_Int64_Some2()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (long?)1L),
- OnNext(210, (long?)null),
- OnNext(220, (long?)4L),
- OnNext(230, (long?)2L),
- OnCompleted<long?>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Min()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, (long?)2L),
- OnCompleted<long?>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Min_Nullable_Int64_Throw()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (long?)1L),
- OnError<long?>(210, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.Min()
- );
-
- res.Messages.AssertEqual(
- OnError<long?>(210, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void Min_Nullable_Int64_Never()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (long?)1L)
- );
-
- var res = scheduler.Start(() =>
- xs.Min()
- );
-
- res.Messages.AssertEqual(
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
- }
-
- [TestMethod]
- public void Min_Nullable_Float_Empty()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (float?)1f),
- OnCompleted<float?>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Min()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, default(float?)),
- OnCompleted<float?>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Min_Nullable_Float_Return()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (float?)1f),
- OnNext(210, (float?)2f),
- OnCompleted<float?>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Min()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, (float?)2f),
- OnCompleted<float?>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Min_Nullable_Float_Some1()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (float?)1f),
- OnNext(210, (float?)null),
- OnNext(220, (float?)2f),
- OnNext(230, (float?)4f),
- OnCompleted<float?>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Min()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, (float?)2f),
- OnCompleted<float?>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Min_Nullable_Float_Some2()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (float?)1f),
- OnNext(210, (float?)null),
- OnNext(220, (float?)4f),
- OnNext(230, (float?)2f),
- OnCompleted<float?>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Min()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, (float?)2f),
- OnCompleted<float?>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Min_Nullable_Float_Throw()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (float?)1f),
- OnError<float?>(210, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.Min()
- );
-
- res.Messages.AssertEqual(
- OnError<float?>(210, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void Min_Nullable_Float_Never()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (float?)1f)
- );
-
- var res = scheduler.Start(() =>
- xs.Min()
- );
-
- res.Messages.AssertEqual(
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
- }
-
- [TestMethod]
- public void Min_Nullable_Double_Empty()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (double?)1.0),
- OnCompleted<double?>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Min()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, default(double?)),
- OnCompleted<double?>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Min_Nullable_Double_Return()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (double?)1.0),
- OnNext(210, (double?)2.0),
- OnCompleted<double?>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Min()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, (double?)2.0),
- OnCompleted<double?>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Min_Nullable_Double_Some1()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (double?)1.0),
- OnNext(210, (double?)null),
- OnNext(220, (double?)2.0),
- OnNext(230, (double?)4.0),
- OnCompleted<double?>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Min()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, (double?)2.0),
- OnCompleted<double?>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Min_Nullable_Double_Some2()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (double?)1.0),
- OnNext(210, (double?)null),
- OnNext(220, (double?)4.0),
- OnNext(230, (double?)2.0),
- OnCompleted<double?>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Min()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, (double?)2.0),
- OnCompleted<double?>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Min_Nullable_Double_Throw()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (double?)1.0),
- OnError<double?>(210, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.Min()
- );
-
- res.Messages.AssertEqual(
- OnError<double?>(210, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void Min_Nullable_Double_Never()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (double?)1.0)
- );
-
- var res = scheduler.Start(() =>
- xs.Min()
- );
-
- res.Messages.AssertEqual(
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
- }
-
- [TestMethod]
- public void Min_Nullable_Decimal_Empty()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (decimal?)1m),
- OnCompleted<decimal?>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Min()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, default(decimal?)),
- OnCompleted<decimal?>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Min_Nullable_Decimal_Return()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (decimal?)1m),
- OnNext(210, (decimal?)2m),
- OnCompleted<decimal?>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Min()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, (decimal?)2m),
- OnCompleted<decimal?>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Min_Nullable_Decimal_Some1()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (decimal?)1m),
- OnNext(210, (decimal?)null),
- OnNext(220, (decimal?)2m),
- OnNext(230, (decimal?)4m),
- OnCompleted<decimal?>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Min()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, (decimal?)2m),
- OnCompleted<decimal?>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Min_Nullable_Decimal_Some2()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (decimal?)1m),
- OnNext(210, (decimal?)null),
- OnNext(220, (decimal?)4m),
- OnNext(230, (decimal?)2m),
- OnCompleted<decimal?>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Min()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, (decimal?)2m),
- OnCompleted<decimal?>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Min_Nullable_Decimal_Throw()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (decimal?)1m),
- OnError<decimal?>(210, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.Min()
- );
-
- res.Messages.AssertEqual(
- OnError<decimal?>(210, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void Min_Nullable_Decimal_Never()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (decimal?)1m)
- );
-
- var res = scheduler.Start(() =>
- xs.Min()
- );
-
- res.Messages.AssertEqual(
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
- }
-
- [TestMethod]
- public void MinOfT_Reference_Empty()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, "z"),
- OnCompleted<string>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Min()
- );
-
-#if !NO_PERF
- // BREAKING CHANGE v2 > v1.x - Behavior for reference types
- res.Messages.AssertEqual(
- OnNext(250, default(string)),
- OnCompleted<string>(250)
- );
-#else
- res.Messages.AssertEqual(
- OnError<string>(250, e => e is InvalidOperationException)
- );
-#endif
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void MinOfT_Value_Empty()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, DateTime.Now),
- OnCompleted<DateTime>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Min()
- );
-
- res.Messages.AssertEqual(
- OnError<DateTime>(250, e => e is InvalidOperationException)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void MinOfT_Reference_Return()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, "z"),
- OnNext(210, "a"),
- OnCompleted<string>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Min()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, "a"),
- OnCompleted<string>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void MinOfT_Value_Return()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, DateTime.Now),
- OnNext(210, new DateTime(1983, 2, 11)),
- OnCompleted<DateTime>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Min()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, new DateTime(1983, 2, 11)),
- OnCompleted<DateTime>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void MinOfT_Reference_Some()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, "z"),
- OnNext(210, "b"),
- OnNext(220, "c"),
- OnNext(230, "a"),
- OnCompleted<string>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Min()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, "a"),
- OnCompleted<string>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void MinOfT_Value_Some()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, DateTime.Now),
- OnNext(210, new DateTime(1993, 2, 11)),
- OnNext(220, new DateTime(2003, 2, 11)),
- OnNext(230, new DateTime(1983, 2, 11)),
- OnCompleted<DateTime>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Min()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, new DateTime(1983, 2, 11)),
- OnCompleted<DateTime>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void MinOfT_Reference_Throw()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, "z"),
- OnError<string>(210, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.Min()
- );
-
- res.Messages.AssertEqual(
- OnError<string>(210, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void MinOfT_Value_Throw()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, DateTime.Now),
- OnError<DateTime>(210, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.Min()
- );
-
- res.Messages.AssertEqual(
- OnError<DateTime>(210, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void MinOfT_Reference_Never()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, "z")
- );
-
- var res = scheduler.Start(() =>
- xs.Min()
- );
-
- res.Messages.AssertEqual(
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
- }
-
- [TestMethod]
- public void MinOfT_Value_Never()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, DateTime.Now)
- );
-
- var res = scheduler.Start(() =>
- xs.Min()
- );
-
- res.Messages.AssertEqual(
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
- }
-
- [TestMethod]
- public void MinOfT_Reference_Comparer_Empty()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, "z"),
- OnCompleted<string>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Min(new ReverseComparer<string>(Comparer<string>.Default))
- );
-
-#if !NO_PERF
- // BREAKING CHANGE v2 > v1.x - Behavior for reference types
- res.Messages.AssertEqual(
- OnNext(250, default(string)),
- OnCompleted<string>(250)
- );
-#else
- res.Messages.AssertEqual(
- OnError<string>(250, e => e is InvalidOperationException)
- );
-#endif
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void MinOfT_Value_Comparer_Empty()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, DateTime.Now),
- OnCompleted<DateTime>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Min(new ReverseComparer<DateTime>(Comparer<DateTime>.Default))
- );
-
- res.Messages.AssertEqual(
- OnError<DateTime>(250, e => e is InvalidOperationException)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void MinOfT_Reference_Comparer_Return()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, "z"),
- OnNext(210, "a"),
- OnCompleted<string>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Min(new ReverseComparer<string>(Comparer<string>.Default))
- );
-
- res.Messages.AssertEqual(
- OnNext(250, "a"),
- OnCompleted<string>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void MinOfT_Value_Comparer_Return()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, DateTime.Now),
- OnNext(210, new DateTime(1983, 2, 11)),
- OnCompleted<DateTime>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Min(new ReverseComparer<DateTime>(Comparer<DateTime>.Default))
- );
-
- res.Messages.AssertEqual(
- OnNext(250, new DateTime(1983, 2, 11)),
- OnCompleted<DateTime>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void MinOfT_Reference_Comparer_Some()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, "z"),
- OnNext(210, "b"),
- OnNext(220, "c"),
- OnNext(230, "a"),
- OnCompleted<string>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Min(new ReverseComparer<string>(Comparer<string>.Default))
- );
-
- res.Messages.AssertEqual(
- OnNext(250, "c"),
- OnCompleted<string>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void MinOfT_Value_Comparer_Some()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, DateTime.Now),
- OnNext(210, new DateTime(1993, 2, 11)),
- OnNext(220, new DateTime(2003, 2, 11)),
- OnNext(230, new DateTime(1983, 2, 11)),
- OnCompleted<DateTime>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Min(new ReverseComparer<DateTime>(Comparer<DateTime>.Default))
- );
-
- res.Messages.AssertEqual(
- OnNext(250, new DateTime(2003, 2, 11)),
- OnCompleted<DateTime>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void MinOfT_Reference_Comparer_Throw()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, "z"),
- OnError<string>(210, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.Min(new ReverseComparer<string>(Comparer<string>.Default))
- );
-
- res.Messages.AssertEqual(
- OnError<string>(210, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void MinOfT_Value_Comparer_Throw()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, DateTime.Now),
- OnError<DateTime>(210, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.Min(new ReverseComparer<DateTime>(Comparer<DateTime>.Default))
- );
-
- res.Messages.AssertEqual(
- OnError<DateTime>(210, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void MinOfT_Reference_Comparer_Never()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, "z")
- );
-
- var res = scheduler.Start(() =>
- xs.Min(new ReverseComparer<string>(Comparer<string>.Default))
- );
-
- res.Messages.AssertEqual(
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
- }
-
- [TestMethod]
- public void MinOfT_Value_Comparer_Never()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, DateTime.Now)
- );
-
- var res = scheduler.Start(() =>
- xs.Min(new ReverseComparer<DateTime>(Comparer<DateTime>.Default))
- );
-
- res.Messages.AssertEqual(
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
- }
-
- [TestMethod]
- public void MinOfT_Reference_ComparerThrows()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, "z"),
- OnNext(210, "b"),
- OnNext(220, "c"),
- OnNext(230, "a"),
- OnCompleted<string>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Min(new ThrowingComparer<string>(ex))
- );
-
- res.Messages.AssertEqual(
- OnError<string>(220, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 220)
- );
- }
-
- [TestMethod]
- public void MinOfT_Value_ComparerThrows()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, DateTime.Now),
- OnNext(210, new DateTime(1993, 2, 11)),
- OnNext(220, new DateTime(2003, 2, 11)),
- OnNext(230, new DateTime(1983, 2, 11)),
- OnCompleted<DateTime>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Min(new ThrowingComparer<DateTime>(ex))
- );
-
- res.Messages.AssertEqual(
- OnError<DateTime>(220, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 220)
- );
- }
-
- [TestMethod]
- public void Min_Selector_Regular_Int32()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable<string>(
- OnNext(210, "fo"),
- OnNext(220, "b"),
- OnNext(230, "qux"),
- OnCompleted<string>(240)
- );
-
- var res = scheduler.Start(() => xs.Min(x => (int)x.Length));
-
- res.Messages.AssertEqual(
- OnNext(240, 1),
- OnCompleted<int>(240)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 240)
- );
- }
-
- [TestMethod]
- public void Min_Selector_Regular_Int64()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable<string>(
- OnNext(210, "fo"),
- OnNext(220, "b"),
- OnNext(230, "qux"),
- OnCompleted<string>(240)
- );
-
- var res = scheduler.Start(() => xs.Min(x => (long)x.Length));
-
- res.Messages.AssertEqual(
- OnNext(240, 1L),
- OnCompleted<long>(240)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 240)
- );
- }
-
- [TestMethod]
- public void Min_Selector_Regular_Single()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable<string>(
- OnNext(210, "fo"),
- OnNext(220, "b"),
- OnNext(230, "qux"),
- OnCompleted<string>(240)
- );
-
- var res = scheduler.Start(() => xs.Min(x => (float)x.Length));
-
- res.Messages.AssertEqual(
- OnNext(240, 1.0f),
- OnCompleted<float>(240)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 240)
- );
- }
-
- [TestMethod]
- public void Min_Selector_Regular_Double()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable<string>(
- OnNext(210, "fo"),
- OnNext(220, "b"),
- OnNext(230, "qux"),
- OnCompleted<string>(240)
- );
-
- var res = scheduler.Start(() => xs.Min(x => (double)x.Length));
-
- res.Messages.AssertEqual(
- OnNext(240, 1.0),
- OnCompleted<double>(240)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 240)
- );
- }
-
- [TestMethod]
- public void Min_Selector_Regular_Decimal()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable<string>(
- OnNext(210, "fo"),
- OnNext(220, "b"),
- OnNext(230, "qux"),
- OnCompleted<string>(240)
- );
-
- var res = scheduler.Start(() => xs.Min(x => (decimal)x.Length));
-
- res.Messages.AssertEqual(
- OnNext(240, 1.0m),
- OnCompleted<decimal>(240)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 240)
- );
- }
-
- [TestMethod]
- public void Min_Selector_Regular_Int32_Nullable()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable<string>(
- OnNext(210, "fo"),
- OnNext(220, "b"),
- OnNext(230, "qux"),
- OnCompleted<string>(240)
- );
-
- var res = scheduler.Start(() => xs.Min(x => x == "fo" ? default(int?) : x.Length));
-
- res.Messages.AssertEqual(
- OnNext(240, (int?)1),
- OnCompleted<int?>(240)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 240)
- );
- }
-
- [TestMethod]
- public void Min_Selector_Regular_Int64_Nullable()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable<string>(
- OnNext(210, "fo"),
- OnNext(220, "b"),
- OnNext(230, "qux"),
- OnCompleted<string>(240)
- );
-
- var res = scheduler.Start(() => xs.Min(x => x == "fo" ? default(long?) : x.Length));
-
- res.Messages.AssertEqual(
- OnNext(240, (long?)1.0),
- OnCompleted<long?>(240)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 240)
- );
- }
-
- [TestMethod]
- public void Min_Selector_Regular_Single_Nullable()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable<string>(
- OnNext(210, "fo"),
- OnNext(220, "b"),
- OnNext(230, "qux"),
- OnCompleted<string>(240)
- );
-
- var res = scheduler.Start(() => xs.Min(x => x == "fo" ? default(float?) : x.Length));
-
- res.Messages.AssertEqual(
- OnNext(240, (float?)1.0),
- OnCompleted<float?>(240)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 240)
- );
- }
-
- [TestMethod]
- public void Min_Selector_Regular_Double_Nullable()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable<string>(
- OnNext(210, "fo"),
- OnNext(220, "b"),
- OnNext(230, "qux"),
- OnCompleted<string>(240)
- );
-
- var res = scheduler.Start(() => xs.Min(x => x == "fo" ? default(double?) : x.Length));
-
- res.Messages.AssertEqual(
- OnNext(240, (double?)1.0),
- OnCompleted<double?>(240)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 240)
- );
- }
-
- [TestMethod]
- public void Min_Selector_Regular_Decimal_Nullable()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable<string>(
- OnNext(210, "fo"),
- OnNext(220, "b"),
- OnNext(230, "qux"),
- OnCompleted<string>(240)
- );
-
- var res = scheduler.Start(() => xs.Min(x => x == "fo" ? default(decimal?) : x.Length));
-
- res.Messages.AssertEqual(
- OnNext(240, (decimal?)1.0),
- OnCompleted<decimal?>(240)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 240)
- );
- }
-
- [TestMethod]
- public void MinOfT_Selector_Regular()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable<string>(
- OnNext(210, "qux"),
- OnNext(220, "foo"),
- OnNext(230, "bar"),
- OnCompleted<string>(240)
- );
-
- var res = scheduler.Start(() => xs.Min(x => new string(x.Reverse().ToArray())));
-
- res.Messages.AssertEqual(
- OnNext(240, "oof"),
- OnCompleted<string>(240)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 240)
- );
- }
-
- [TestMethod]
- public void MinOfT_Selector_Regular_Comparer()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable<string>(
- OnNext(210, "qux"),
- OnNext(220, "foo"),
- OnNext(230, "bar"),
- OnCompleted<string>(240)
- );
-
- var res = scheduler.Start(() => xs.Min(x => new string(x.Reverse().ToArray()), new ReverseComparer<string>(Comparer<string>.Default)));
-
- res.Messages.AssertEqual(
- OnNext(240, "xuq"),
- OnCompleted<string>(240)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 240)
- );
- }
-
- #endregion
-
- #region + MinBy +
-
- [TestMethod]
- public void MinBy_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.MinBy(default(IObservable<int>), x => x));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.MinBy(DummyObservable<int>.Instance, default(Func<int, int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.MinBy(default(IObservable<int>), x => x, Comparer<int>.Default));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.MinBy(DummyObservable<int>.Instance, default(Func<int, int>), Comparer<int>.Default));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.MinBy(DummyObservable<int>.Instance, x => x, null));
- }
-
- [TestMethod]
- public void MinBy_Empty()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, new KeyValuePair<int, string>(1, "z")),
- OnCompleted<KeyValuePair<int, string>>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.MinBy(x => x.Key)
- );
-
- res.Messages.AssertEqual(
- OnNext<IList<KeyValuePair<int, string>>>(250, x => x.Count == 0),
- OnCompleted<IList<KeyValuePair<int, string>>>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void MinBy_Return()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, new KeyValuePair<int, string>(1, "z")),
- OnNext(210, new KeyValuePair<int, string>(2, "a")),
- OnCompleted<KeyValuePair<int, string>>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.MinBy(x => x.Key)
- );
-
- res.Messages.AssertEqual(
- OnNext<IList<KeyValuePair<int, string>>>(250, x => x.SequenceEqual(new[] {
- new KeyValuePair<int, string>(2, "a"),
- })),
- OnCompleted<IList<KeyValuePair<int, string>>>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void MinBy_Some()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, new KeyValuePair<int, string>(1, "z")),
- OnNext(210, new KeyValuePair<int, string>(3, "b")),
- OnNext(220, new KeyValuePair<int, string>(2, "c")),
- OnNext(230, new KeyValuePair<int, string>(4, "a")),
- OnCompleted<KeyValuePair<int, string>>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.MinBy(x => x.Key)
- );
-
- res.Messages.AssertEqual(
- OnNext<IList<KeyValuePair<int, string>>>(250, x => x.SequenceEqual(new[] {
- new KeyValuePair<int, string>(2, "c"),
- })),
- OnCompleted<IList<KeyValuePair<int, string>>>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void MinBy_Multiple()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, new KeyValuePair<int, string>(1, "z")),
- OnNext(210, new KeyValuePair<int, string>(3, "b")),
- OnNext(215, new KeyValuePair<int, string>(2, "d")),
- OnNext(220, new KeyValuePair<int, string>(3, "c")),
- OnNext(225, new KeyValuePair<int, string>(2, "y")),
- OnNext(230, new KeyValuePair<int, string>(4, "a")),
- OnNext(235, new KeyValuePair<int, string>(4, "r")),
- OnCompleted<KeyValuePair<int, string>>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.MinBy(x => x.Key)
- );
-
- res.Messages.AssertEqual(
- OnNext<IList<KeyValuePair<int, string>>>(250, x => x.SequenceEqual(new[] {
- new KeyValuePair<int, string>(2, "d"),
- new KeyValuePair<int, string>(2, "y"),
- })),
- OnCompleted<IList<KeyValuePair<int, string>>>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void MinBy_Throw()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, new KeyValuePair<int, string>(1, "z")),
- OnError<KeyValuePair<int, string>>(210, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.MinBy(x => x.Key)
- );
-
- res.Messages.AssertEqual(
- OnError<IList<KeyValuePair<int, string>>>(210, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void MinBy_Never()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, new KeyValuePair<int, string>(1, "z"))
- );
-
- var res = scheduler.Start(() =>
- xs.MinBy(x => x.Key)
- );
-
- res.Messages.AssertEqual(
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
- }
-
- [TestMethod]
- public void MinBy_Comparer_Empty()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, new KeyValuePair<int, string>(1, "z")),
- OnCompleted<KeyValuePair<int, string>>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.MinBy(x => x.Key, new ReverseComparer<int>(Comparer<int>.Default))
- );
-
- res.Messages.AssertEqual(
- OnNext<IList<KeyValuePair<int, string>>>(250, x => x.Count == 0),
- OnCompleted<IList<KeyValuePair<int, string>>>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void MinBy_Comparer_Return()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, new KeyValuePair<int, string>(1, "z")),
- OnNext(210, new KeyValuePair<int, string>(2, "a")),
- OnCompleted<KeyValuePair<int, string>>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.MinBy(x => x.Key, new ReverseComparer<int>(Comparer<int>.Default))
- );
-
- res.Messages.AssertEqual(
- OnNext<IList<KeyValuePair<int, string>>>(250, x => x.SequenceEqual(new[] {
- new KeyValuePair<int, string>(2, "a"),
- })),
- OnCompleted<IList<KeyValuePair<int, string>>>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void MinBy_Comparer_Some()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, new KeyValuePair<int, string>(1, "z")),
- OnNext(210, new KeyValuePair<int, string>(3, "b")),
- OnNext(220, new KeyValuePair<int, string>(20, "c")),
- OnNext(230, new KeyValuePair<int, string>(4, "a")),
- OnCompleted<KeyValuePair<int, string>>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.MinBy(x => x.Key, new ReverseComparer<int>(Comparer<int>.Default))
- );
-
- res.Messages.AssertEqual(
- OnNext<IList<KeyValuePair<int, string>>>(250, x => x.SequenceEqual(new[] {
- new KeyValuePair<int, string>(20, "c"),
- })),
- OnCompleted<IList<KeyValuePair<int, string>>>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void MinBy_Comparer_Throw()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, new KeyValuePair<int, string>(1, "z")),
- OnError<KeyValuePair<int, string>>(210, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.MinBy(x => x.Key, new ReverseComparer<int>(Comparer<int>.Default))
- );
-
- res.Messages.AssertEqual(
- OnError<IList<KeyValuePair<int, string>>>(210, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void MinBy_Comparer_Never()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, new KeyValuePair<int, string>(1, "z"))
- );
-
- var res = scheduler.Start(() =>
- xs.MinBy(x => x.Key, new ReverseComparer<int>(Comparer<int>.Default))
- );
-
- res.Messages.AssertEqual(
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
- }
-
- [TestMethod]
- public void MinBy_SelectorThrows()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, new KeyValuePair<int, string>(1, "z")),
- OnNext(210, new KeyValuePair<int, string>(3, "b")),
- OnNext(220, new KeyValuePair<int, string>(2, "c")),
- OnNext(230, new KeyValuePair<int, string>(4, "a")),
- OnCompleted<KeyValuePair<int, string>>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.MinBy<KeyValuePair<int, string>, int>(x => { throw ex; })
- );
-
- res.Messages.AssertEqual(
- OnError<IList<KeyValuePair<int, string>>>(210, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void MinBy_ComparerThrows()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, new KeyValuePair<int, string>(1, "z")),
- OnNext(210, new KeyValuePair<int, string>(3, "b")),
- OnNext(220, new KeyValuePair<int, string>(2, "c")),
- OnNext(230, new KeyValuePair<int, string>(4, "a")),
- OnCompleted<KeyValuePair<int, string>>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.MinBy(x => x.Key, new ThrowingComparer<int>(ex))
- );
-
- res.Messages.AssertEqual(
- OnError<IList<KeyValuePair<int, string>>>(220, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 220)
- );
- }
-
- class ReverseComparer<T> : IComparer<T>
- {
- private IComparer<T> _comparer;
-
- public ReverseComparer(IComparer<T> comparer)
- {
- _comparer = comparer;
- }
-
- public int Compare(T x, T y)
- {
- return -_comparer.Compare(x, y);
- }
- }
-
- class ThrowingComparer<T> : IComparer<T>
- {
- private Exception _ex;
-
- public ThrowingComparer(Exception ex)
- {
- _ex = ex;
- }
-
- public int Compare(T x, T y)
- {
- throw _ex;
- }
- }
-
- #endregion
-
- #region + SequenceEqual +
-
- [TestMethod]
- public void SequenceEqual_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.SequenceEqual<int>(default(IObservable<int>), DummyObservable<int>.Instance));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.SequenceEqual<int>(DummyObservable<int>.Instance, default(IObservable<int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.SequenceEqual<int>(default(IObservable<int>), DummyObservable<int>.Instance, EqualityComparer<int>.Default));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.SequenceEqual<int>(DummyObservable<int>.Instance, default(IObservable<int>), EqualityComparer<int>.Default));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.SequenceEqual<int>(DummyObservable<int>.Instance, DummyObservable<int>.Instance, default(IEqualityComparer<int>)));
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.SequenceEqual<int>(default(IObservable<int>), new[] { 42 }));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.SequenceEqual<int>(DummyObservable<int>.Instance, default(IEnumerable<int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.SequenceEqual<int>(default(IObservable<int>), new[] { 42 }, EqualityComparer<int>.Default));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.SequenceEqual<int>(DummyObservable<int>.Instance, default(IEnumerable<int>), EqualityComparer<int>.Default));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.SequenceEqual<int>(DummyObservable<int>.Instance, new[] { 42 }, default(IEqualityComparer<int>)));
- }
-
- [TestMethod]
- public void SequenceEqual_Observable_Equal()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(110, 1),
- OnNext(190, 2),
- OnNext(240, 3),
- OnNext(290, 4),
- OnNext(310, 5),
- OnNext(340, 6),
- OnNext(450, 7),
- OnCompleted<int>(510)
- );
-
- var ys = scheduler.CreateHotObservable(
- OnNext(90, 1),
- OnNext(270, 3),
- OnNext(280, 4),
- OnNext(300, 5),
- OnNext(330, 6),
- OnNext(340, 7),
- OnCompleted<int>(720)
- );
-
- var res = scheduler.Start(() =>
- xs.SequenceEqual(ys)
- );
-
- res.Messages.AssertEqual(
- OnNext(720, true),
- OnCompleted<bool>(720)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 720)
- );
-
- ys.Subscriptions.AssertEqual(
- Subscribe(200, 720)
- );
- }
-
- [TestMethod]
- public void SequenceEqual_Observable_Equal_Sym()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(110, 1),
- OnNext(190, 2),
- OnNext(240, 3),
- OnNext(290, 4),
- OnNext(310, 5),
- OnNext(340, 6),
- OnNext(450, 7),
- OnCompleted<int>(510)
- );
-
- var ys = scheduler.CreateHotObservable(
- OnNext(90, 1),
- OnNext(270, 3),
- OnNext(280, 4),
- OnNext(300, 5),
- OnNext(330, 6),
- OnNext(340, 7),
- OnCompleted<int>(720)
- );
-
- var res = scheduler.Start(() =>
- ys.SequenceEqual(xs)
- );
-
- res.Messages.AssertEqual(
- OnNext(720, true),
- OnCompleted<bool>(720)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 720)
- );
-
- ys.Subscriptions.AssertEqual(
- Subscribe(200, 720)
- );
- }
-
- [TestMethod]
- public void SequenceEqual_Observable_NotEqual_Left()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(110, 1),
- OnNext(190, 2),
- OnNext(240, 3),
- OnNext(290, 4),
- OnNext(310, 0),
- OnNext(340, 6),
- OnNext(450, 7),
- OnCompleted<int>(510)
- );
-
- var ys = scheduler.CreateHotObservable(
- OnNext(90, 1),
- OnNext(270, 3),
- OnNext(280, 4),
- OnNext(300, 5),
- OnNext(330, 6),
- OnNext(340, 7),
- OnCompleted<int>(720)
- );
-
- var res = scheduler.Start(() =>
- xs.SequenceEqual(ys)
- );
-
- res.Messages.AssertEqual(
- OnNext(310, false),
- OnCompleted<bool>(310)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 310)
- );
-
- ys.Subscriptions.AssertEqual(
- Subscribe(200, 310)
- );
- }
-
- [TestMethod]
- public void SequenceEqual_Observable_NotEqual_Left_Sym()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(110, 1),
- OnNext(190, 2),
- OnNext(240, 3),
- OnNext(290, 4),
- OnNext(310, 0),
- OnNext(340, 6),
- OnNext(450, 7),
- OnCompleted<int>(510)
- );
-
- var ys = scheduler.CreateHotObservable(
- OnNext(90, 1),
- OnNext(270, 3),
- OnNext(280, 4),
- OnNext(300, 5),
- OnNext(330, 6),
- OnNext(340, 7),
- OnCompleted<int>(720)
- );
-
- var res = scheduler.Start(() =>
- ys.SequenceEqual(xs)
- );
-
- res.Messages.AssertEqual(
- OnNext(310, false),
- OnCompleted<bool>(310)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 310)
- );
-
- ys.Subscriptions.AssertEqual(
- Subscribe(200, 310)
- );
- }
-
- [TestMethod]
- public void SequenceEqual_Observable_NotEqual_Right()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(110, 1),
- OnNext(190, 2),
- OnNext(240, 3),
- OnNext(290, 4),
- OnNext(310, 5),
- OnNext(340, 6),
- OnNext(450, 7),
- OnCompleted<int>(510)
- );
-
- var ys = scheduler.CreateHotObservable(
- OnNext(90, 1),
- OnNext(270, 3),
- OnNext(280, 4),
- OnNext(300, 5),
- OnNext(330, 6),
- OnNext(340, 7),
- OnNext(350, 8)
- );
-
- var res = scheduler.Start(() =>
- xs.SequenceEqual(ys)
- );
-
- res.Messages.AssertEqual(
- OnNext(510, false),
- OnCompleted<bool>(510)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 510)
- );
-
- ys.Subscriptions.AssertEqual(
- Subscribe(200, 510)
- );
- }
-
- [TestMethod]
- public void SequenceEqual_Observable_NotEqual_Right_Sym()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(110, 1),
- OnNext(190, 2),
- OnNext(240, 3),
- OnNext(290, 4),
- OnNext(310, 5),
- OnNext(340, 6),
- OnNext(450, 7),
- OnCompleted<int>(510)
- );
-
- var ys = scheduler.CreateHotObservable(
- OnNext(90, 1),
- OnNext(270, 3),
- OnNext(280, 4),
- OnNext(300, 5),
- OnNext(330, 6),
- OnNext(340, 7),
- OnNext(350, 8)
- );
-
- var res = scheduler.Start(() =>
- ys.SequenceEqual(xs)
- );
-
- res.Messages.AssertEqual(
- OnNext(510, false),
- OnCompleted<bool>(510)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 510)
- );
-
- ys.Subscriptions.AssertEqual(
- Subscribe(200, 510)
- );
- }
-
- [TestMethod]
- public void SequenceEqual_Observable_NotEqual_2()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(110, 1),
- OnNext(190, 2),
- OnNext(240, 3),
- OnNext(290, 4),
- OnNext(310, 5),
- OnNext(340, 6),
- OnNext(450, 7),
- OnNext(490, 8),
- OnNext(520, 9),
- OnNext(580, 10),
- OnNext(600, 11)
- );
-
- var ys = scheduler.CreateHotObservable(
- OnNext(90, 1),
- OnNext(270, 3),
- OnNext(280, 4),
- OnNext(300, 5),
- OnNext(330, 6),
- OnNext(340, 7),
- OnNext(350, 9),
- OnNext(400, 9),
- OnNext(410, 10),
- OnNext(490, 11),
- OnNext(550, 12),
- OnNext(560, 13)
- );
-
- var res = scheduler.Start(() =>
- xs.SequenceEqual(ys)
- );
-
- res.Messages.AssertEqual(
- OnNext(490, false),
- OnCompleted<bool>(490)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 490)
- );
-
- ys.Subscriptions.AssertEqual(
- Subscribe(200, 490)
- );
- }
-
- [TestMethod]
- public void SequenceEqual_Observable_NotEqual_2_Sym()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(110, 1),
- OnNext(190, 2),
- OnNext(240, 3),
- OnNext(290, 4),
- OnNext(310, 5),
- OnNext(340, 6),
- OnNext(450, 7),
- OnNext(490, 8),
- OnNext(520, 9),
- OnNext(580, 10),
- OnNext(600, 11)
- );
-
- var ys = scheduler.CreateHotObservable(
- OnNext(90, 1),
- OnNext(270, 3),
- OnNext(280, 4),
- OnNext(300, 5),
- OnNext(330, 6),
- OnNext(340, 7),
- OnNext(350, 9),
- OnNext(400, 9),
- OnNext(410, 10),
- OnNext(490, 11),
- OnNext(550, 12),
- OnNext(560, 13)
- );
-
- var res = scheduler.Start(() =>
- ys.SequenceEqual(xs)
- );
-
- res.Messages.AssertEqual(
- OnNext(490, false),
- OnCompleted<bool>(490)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 490)
- );
-
- ys.Subscriptions.AssertEqual(
- Subscribe(200, 490)
- );
- }
-
- [TestMethod]
- public void SequenceEqual_Observable_NotEqual_3()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(110, 1),
- OnNext(190, 2),
- OnNext(240, 3),
- OnNext(290, 4),
- OnNext(310, 5),
- OnCompleted<int>(330)
- );
-
- var ys = scheduler.CreateHotObservable(
- OnNext(90, 1),
- OnNext(270, 3),
- OnNext(400, 4),
- OnCompleted<int>(420)
- );
-
- var res = scheduler.Start(() =>
- xs.SequenceEqual(ys)
- );
-
- res.Messages.AssertEqual(
- OnNext(420, false),
- OnCompleted<bool>(420)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 420)
- );
-
- ys.Subscriptions.AssertEqual(
- Subscribe(200, 420)
- );
- }
-
- [TestMethod]
- public void SequenceEqual_Observable_NotEqual_3_Sym()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(110, 1),
- OnNext(190, 2),
- OnNext(240, 3),
- OnNext(290, 4),
- OnNext(310, 5),
- OnCompleted<int>(330)
- );
-
- var ys = scheduler.CreateHotObservable(
- OnNext(90, 1),
- OnNext(270, 3),
- OnNext(400, 4),
- OnCompleted<int>(420)
- );
-
- var res = scheduler.Start(() =>
- ys.SequenceEqual(xs)
- );
-
- res.Messages.AssertEqual(
- OnNext(420, false),
- OnCompleted<bool>(420)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 420)
- );
-
- ys.Subscriptions.AssertEqual(
- Subscribe(200, 420)
- );
- }
-
- [TestMethod]
- public void SequenceEqual_Observable_ComparerThrows()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(110, 1),
- OnNext(190, 2),
- OnNext(240, 3),
- OnNext(290, 4),
- OnNext(310, 5),
- OnCompleted<int>(330)
- );
-
- var ys = scheduler.CreateHotObservable(
- OnNext(90, 1),
- OnNext(270, 3),
- OnNext(400, 4),
- OnCompleted<int>(420)
- );
-
- var ex = new Exception();
-
- var res = scheduler.Start(() =>
- xs.SequenceEqual(ys, new ThrowComparer(ex))
- );
-
- res.Messages.AssertEqual(
- OnError<bool>(270, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 270)
- );
-
- ys.Subscriptions.AssertEqual(
- Subscribe(200, 270)
- );
- }
-
- [TestMethod]
- public void SequenceEqual_Observable_ComparerThrows_Sym()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(110, 1),
- OnNext(190, 2),
- OnNext(240, 3),
- OnNext(290, 4),
- OnNext(310, 5),
- OnCompleted<int>(330)
- );
-
- var ys = scheduler.CreateHotObservable(
- OnNext(90, 1),
- OnNext(270, 3),
- OnNext(400, 4),
- OnCompleted<int>(420)
- );
-
- var ex = new Exception();
-
- var res = scheduler.Start(() =>
- ys.SequenceEqual(xs, new ThrowComparer(ex))
- );
-
- res.Messages.AssertEqual(
- OnError<bool>(270, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 270)
- );
-
- ys.Subscriptions.AssertEqual(
- Subscribe(200, 270)
- );
- }
-
- class ThrowComparer : IEqualityComparer<int>
- {
- private Exception _ex;
-
- public ThrowComparer(Exception ex)
- {
- _ex = ex;
- }
-
- public bool Equals(int x, int y)
- {
- throw _ex;
- }
-
- public int GetHashCode(int obj)
- {
- throw new NotImplementedException();
- }
- }
-
- [TestMethod]
- public void SequenceEqual_Observable_NotEqual_4()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(250, 1),
- OnCompleted<int>(300)
- );
-
- var ys = scheduler.CreateHotObservable(
- OnNext(290, 1),
- OnNext(310, 2),
- OnCompleted<int>(350)
- );
-
- var res = scheduler.Start(() =>
- xs.SequenceEqual(ys)
- );
-
- res.Messages.AssertEqual(
- OnNext(310, false),
- OnCompleted<bool>(310)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 310)
- );
-
- ys.Subscriptions.AssertEqual(
- Subscribe(200, 310)
- );
- }
-
- [TestMethod]
- public void SequenceEqual_Observable_NotEqual_4_Sym()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(250, 1),
- OnCompleted<int>(300)
- );
-
- var ys = scheduler.CreateHotObservable(
- OnNext(290, 1),
- OnNext(310, 2),
- OnCompleted<int>(350)
- );
-
- var res = scheduler.Start(() =>
- ys.SequenceEqual(xs)
- );
-
- res.Messages.AssertEqual(
- OnNext(310, false),
- OnCompleted<bool>(310)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 310)
- );
-
- ys.Subscriptions.AssertEqual(
- Subscribe(200, 310)
- );
- }
-
- [TestMethod]
- public void SequenceEqual_Observable_Left_Throw()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(250, 1),
- OnError<int>(300, ex)
- );
-
- var ys = scheduler.CreateHotObservable(
- OnNext(290, 1),
- OnNext(310, 2),
- OnCompleted<int>(350)
- );
-
- var res = scheduler.Start(() =>
- ys.SequenceEqual(xs)
- );
-
- res.Messages.AssertEqual(
- OnError<bool>(300, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 300)
- );
-
- ys.Subscriptions.AssertEqual(
- Subscribe(200, 300)
- );
- }
-
- [TestMethod]
- public void SequenceEqual_Observable_Right_Throw()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(290, 1),
- OnNext(310, 2),
- OnCompleted<int>(350)
- );
-
- var ys = scheduler.CreateHotObservable(
- OnNext(250, 1),
- OnError<int>(300, ex)
- );
-
- var res = scheduler.Start(() =>
- ys.SequenceEqual(xs)
- );
-
- res.Messages.AssertEqual(
- OnError<bool>(300, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 300)
- );
-
- ys.Subscriptions.AssertEqual(
- Subscribe(200, 300)
- );
- }
-
- [TestMethod]
- public void SequenceEqual_Enumerable_Equal()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(110, 1),
- OnNext(190, 2),
- OnNext(240, 3),
- OnNext(290, 4),
- OnNext(310, 5),
- OnNext(340, 6),
- OnNext(450, 7),
- OnCompleted<int>(510)
- );
-
- var res = scheduler.Start(() =>
- xs.SequenceEqual(new[] { 3, 4, 5, 6, 7 })
- );
-
- res.Messages.AssertEqual(
- OnNext(510, true),
- OnCompleted<bool>(510)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 510)
- );
- }
-
- [TestMethod]
- public void SequenceEqual_Enumerable_NotEqual_Elements()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(110, 1),
- OnNext(190, 2),
- OnNext(240, 3),
- OnNext(290, 4),
- OnNext(310, 5),
- OnNext(340, 6),
- OnNext(450, 7),
- OnCompleted<int>(510)
- );
-
- var res = scheduler.Start(() =>
- xs.SequenceEqual(new[] { 3, 4, 9, 6, 7 })
- );
-
- res.Messages.AssertEqual(
- OnNext(310, false),
- OnCompleted<bool>(310)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 310)
- );
- }
-
- [TestMethod]
- public void SequenceEqual_Enumerable_Comparer_Equal()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(110, 1),
- OnNext(190, 2),
- OnNext(240, 3),
- OnNext(290, 4),
- OnNext(310, 5),
- OnNext(340, 6),
- OnNext(450, 7),
- OnCompleted<int>(510)
- );
-
- var res = scheduler.Start(() =>
- xs.SequenceEqual(new[] { 3 - 2, 4, 5, 6 + 42, 7 - 6 }, new OddEvenComparer())
- );
-
- res.Messages.AssertEqual(
- OnNext(510, true),
- OnCompleted<bool>(510)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 510)
- );
- }
-
- [TestMethod]
- public void SequenceEqual_Enumerable_Comparer_NotEqual()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(110, 1),
- OnNext(190, 2),
- OnNext(240, 3),
- OnNext(290, 4),
- OnNext(310, 5),
- OnNext(340, 6),
- OnNext(450, 7),
- OnCompleted<int>(510)
- );
-
- var res = scheduler.Start(() =>
- xs.SequenceEqual(new[] { 3 - 2, 4, 5 + 9, 6 + 42, 7 - 6 }, new OddEvenComparer())
- );
-
- res.Messages.AssertEqual(
- OnNext(310, false),
- OnCompleted<bool>(310)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 310)
- );
- }
-
- class OddEvenComparer : IEqualityComparer<int>
- {
- public bool Equals(int x, int y)
- {
- return x % 2 == y % 2;
- }
-
- public int GetHashCode(int obj)
- {
- return (obj % 2).GetHashCode();
- }
- }
-
- [TestMethod]
- public void SequenceEqual_Enumerable_Comparer_Throws()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(110, 1),
- OnNext(190, 2),
- OnNext(240, 3),
- OnNext(290, 4),
- OnNext(310, 5),
- OnNext(340, 6),
- OnNext(450, 7),
- OnCompleted<int>(510)
- );
-
- var ex = new Exception();
-
- var res = scheduler.Start(() =>
- xs.SequenceEqual(new[] { 3, 4, 5, 6, 7 }, new ThrowingComparer(5, ex))
- );
-
- res.Messages.AssertEqual(
- OnError<bool>(310, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 310)
- );
- }
-
- class ThrowingComparer : IEqualityComparer<int>
- {
- private int _x;
- private Exception _ex;
-
- public ThrowingComparer(int x, Exception ex)
- {
- _x = x;
- _ex = ex;
- }
-
- public bool Equals(int x, int y)
- {
- if (x == _x)
- throw _ex;
-
- return x == y;
- }
-
- public int GetHashCode(int obj)
- {
- return obj.GetHashCode();
- }
- }
-
- [TestMethod]
- public void SequenceEqual_Enumerable_NotEqual_TooLong()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(110, 1),
- OnNext(190, 2),
- OnNext(240, 3),
- OnNext(290, 4),
- OnNext(310, 5),
- OnNext(340, 6),
- OnNext(450, 7),
- OnCompleted<int>(510)
- );
-
- var res = scheduler.Start(() =>
- xs.SequenceEqual(new[] { 3, 4, 5, 6, 7, 8 })
- );
-
- res.Messages.AssertEqual(
- OnNext(510, false),
- OnCompleted<bool>(510)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 510)
- );
- }
-
- [TestMethod]
- public void SequenceEqual_Enumerable_NotEqual_TooShort()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(110, 1),
- OnNext(190, 2),
- OnNext(240, 3),
- OnNext(290, 4),
- OnNext(310, 5),
- OnNext(340, 6),
- OnNext(450, 7),
- OnCompleted<int>(510)
- );
-
- var res = scheduler.Start(() =>
- xs.SequenceEqual(new[] { 3, 4, 5, 6 })
- );
-
- res.Messages.AssertEqual(
- OnNext(450, false),
- OnCompleted<bool>(450)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 450)
- );
- }
-
- [TestMethod]
- public void SequenceEqual_Enumerable_OnError()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(110, 1),
- OnNext(190, 2),
- OnNext(240, 3),
- OnNext(290, 4),
- OnError<int>(310, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.SequenceEqual(new[] { 3, 4 })
- );
-
- res.Messages.AssertEqual(
- OnError<bool>(310, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 310)
- );
- }
-
- [TestMethod]
- public void SequenceEqual_Enumerable_IteratorThrows1()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(110, 1),
- OnNext(190, 2),
- OnNext(240, 3),
- OnNext(290, 4),
- OnCompleted<int>(310)
- );
-
- var res = scheduler.Start(() =>
- xs.SequenceEqual(Throw(ex))
- );
-
- res.Messages.AssertEqual(
- OnError<bool>(290, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 290)
- );
- }
-
- [TestMethod]
- public void SequenceEqual_Enumerable_IteratorThrows2()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(110, 1),
- OnNext(190, 2),
- OnNext(240, 3),
- OnCompleted<int>(310)
- );
-
- var res = scheduler.Start(() =>
- xs.SequenceEqual(Throw(ex))
- );
-
- res.Messages.AssertEqual(
- OnError<bool>(310, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 310)
- );
- }
-
- private IEnumerable<int> Throw(Exception ex)
- {
- yield return 3;
- throw ex;
- }
-
- [TestMethod]
- public void SequenceEqual_Enumerable_GetEnumeratorThrows()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(110, 1),
- OnNext(190, 2),
- OnNext(240, 3),
- OnCompleted<int>(310)
- );
-
- var res = scheduler.Start(() =>
- xs.SequenceEqual(new RogueEnumerable<int>(ex))
- );
-
- res.Messages.AssertEqual(
- OnError<bool>(200, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- );
- }
-
- #endregion
-
- #region + SingleAsync +
-
- [TestMethod]
- public void SingleAsync_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.SingleAsync(default(IObservable<int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.SingleAsync(default(IObservable<int>), _ => true));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.SingleAsync(DummyObservable<int>.Instance, default(Func<int, bool>)));
- }
-
- [TestMethod]
- public void SingleAsync_Empty()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.SingleAsync()
- );
-
- res.Messages.AssertEqual(
- OnError<int>(250, e => e is InvalidOperationException)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void SingleAsync_One()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.SingleAsync()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, 2),
- OnCompleted<int>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void SingleAsync_Many()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnNext(220, 3),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.SingleAsync()
- );
-
- res.Messages.AssertEqual(
- OnError<int>(220, e => e is InvalidOperationException)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 220)
- );
- }
-
- [TestMethod]
- public void SingleAsync_Error()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnError<int>(210, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.SingleAsync()
- );
-
- res.Messages.AssertEqual(
- OnError<int>(210, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void SingleAsync_Predicate()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnNext(220, 3),
- OnNext(230, 4),
- OnNext(240, 5),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.SingleAsync(x => x % 2 == 1)
- );
-
- res.Messages.AssertEqual(
- OnError<int>(240, e => e is InvalidOperationException)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 240)
- );
- }
-
- [TestMethod]
- public void SingleAsync_Predicate_Empty()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.SingleAsync(x => x % 2 == 1)
- );
-
- res.Messages.AssertEqual(
- OnError<int>(250, e => e is InvalidOperationException)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void SingleAsync_Predicate_One()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnNext(220, 3),
- OnNext(230, 4),
- OnNext(240, 5),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.SingleAsync(x => x == 4)
- );
-
- res.Messages.AssertEqual(
- OnNext(250, 4),
- OnCompleted<int>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void SingleAsync_Predicate_Throw()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnError<int>(210, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.SingleAsync(x => x > 10)
- );
-
- res.Messages.AssertEqual(
- OnError<int>(210, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void SingleAsync_PredicateThrows()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnNext(220, 3),
- OnNext(230, 4),
- OnNext(240, 5),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.SingleAsync(x => { if (x < 4) return false; throw ex; })
- );
-
- res.Messages.AssertEqual(
- OnError<int>(230, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 230)
- );
- }
-
- #endregion
-
- #region + SingleOrDefaultAsync +
-
- [TestMethod]
- public void SingleOrDefaultAsync_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.SingleOrDefaultAsync(default(IObservable<int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.SingleOrDefaultAsync(default(IObservable<int>), _ => true));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.SingleOrDefaultAsync(DummyObservable<int>.Instance, default(Func<int, bool>)));
- }
-
- [TestMethod]
- public void SingleOrDefaultAsync_Empty()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.SingleOrDefaultAsync()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, 0),
- OnCompleted<int>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void SingleOrDefaultAsync_One()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.SingleOrDefaultAsync()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, 2),
- OnCompleted<int>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void SingleOrDefaultAsync_Many()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnNext(220, 3),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.SingleOrDefaultAsync()
- );
-
- res.Messages.AssertEqual(
- OnError<int>(220, e => e is InvalidOperationException)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 220)
- );
- }
-
- [TestMethod]
- public void SingleOrDefaultAsync_Error()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnError<int>(210, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.SingleOrDefaultAsync()
- );
-
- res.Messages.AssertEqual(
- OnError<int>(210, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void SingleOrDefaultAsync_Predicate()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnNext(220, 3),
- OnNext(230, 4),
- OnNext(240, 5),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.SingleOrDefaultAsync(x => x % 2 == 1)
- );
-
- res.Messages.AssertEqual(
- OnError<int>(240, e => e is InvalidOperationException)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 240)
- );
- }
-
- [TestMethod]
- public void SingleOrDefaultAsync_Predicate_Empty()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.SingleOrDefaultAsync(x => x % 2 == 1)
- );
-
- res.Messages.AssertEqual(
- OnNext(250, 0),
- OnCompleted<int>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void SingleOrDefaultAsync_Predicate_One()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnNext(220, 3),
- OnNext(230, 4),
- OnNext(240, 5),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.SingleOrDefaultAsync(x => x == 4)
- );
-
- res.Messages.AssertEqual(
- OnNext(250, 4),
- OnCompleted<int>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void SingleOrDefaultAsync_Predicate_None()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnNext(220, 3),
- OnNext(230, 4),
- OnNext(240, 5),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.SingleOrDefaultAsync(x => x > 10)
- );
-
- res.Messages.AssertEqual(
- OnNext(250, 0),
- OnCompleted<int>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void SingleOrDefaultAsync_Predicate_Throw()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnError<int>(210, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.SingleOrDefaultAsync(x => x > 10)
- );
-
- res.Messages.AssertEqual(
- OnError<int>(210, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void SingleOrDefaultAsync_PredicateThrows()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnNext(220, 3),
- OnNext(230, 4),
- OnNext(240, 5),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.SingleOrDefaultAsync(x => { if (x < 4) return false; throw ex; })
- );
-
- res.Messages.AssertEqual(
- OnError<int>(230, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 230)
- );
- }
-
- #endregion
-
- #region + Sum +
-
- [TestMethod]
- public void Sum_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Sum(default(IObservable<int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Sum(default(IObservable<double>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Sum(default(IObservable<float>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Sum(default(IObservable<decimal>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Sum(default(IObservable<long>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Sum(default(IObservable<int?>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Sum(default(IObservable<double?>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Sum(default(IObservable<float?>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Sum(default(IObservable<decimal?>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Sum(default(IObservable<long?>)));
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Sum(default(IObservable<DateTime>), _ => default(int)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Sum(default(IObservable<DateTime>), _ => default(double)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Sum(default(IObservable<DateTime>), _ => default(float)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Sum(default(IObservable<DateTime>), _ => default(decimal)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Sum(default(IObservable<DateTime>), _ => default(long)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Sum(default(IObservable<DateTime>), _ => default(int?)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Sum(default(IObservable<DateTime>), _ => default(double?)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Sum(default(IObservable<DateTime>), _ => default(float?)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Sum(default(IObservable<DateTime>), _ => default(decimal?)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Sum(default(IObservable<DateTime>), _ => default(long?)));
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Sum(Observable.Empty<DateTime>(), default(Func<DateTime, int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Sum(Observable.Empty<DateTime>(), default(Func<DateTime, double>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Sum(Observable.Empty<DateTime>(), default(Func<DateTime, float>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Sum(Observable.Empty<DateTime>(), default(Func<DateTime, decimal>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Sum(Observable.Empty<DateTime>(), default(Func<DateTime, long>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Sum(Observable.Empty<DateTime>(), default(Func<DateTime, int?>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Sum(Observable.Empty<DateTime>(), default(Func<DateTime, double?>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Sum(Observable.Empty<DateTime>(), default(Func<DateTime, float?>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Sum(Observable.Empty<DateTime>(), default(Func<DateTime, decimal?>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Sum(Observable.Empty<DateTime>(), default(Func<DateTime, long?>)));
- }
-
- [TestMethod]
- public void Sum_Int32_Empty()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Sum()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, 0),
- OnCompleted<int>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Sum_Int32_Return()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Sum()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, 2),
- OnCompleted<int>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Sum_Int32_Some()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnNext(220, 3),
- OnNext(230, 4),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Sum()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, 2 + 3 + 4),
- OnCompleted<int>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Sum_Int32_Overflow()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, int.MaxValue),
- OnNext(220, 1),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Sum()
- );
-
- res.Messages.AssertEqual(
- OnError<int>(220, e => e is OverflowException)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 220)
- );
- }
-
- [TestMethod]
- public void Sum_Int32_Throw()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnError<int>(210, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.Sum()
- );
-
- res.Messages.AssertEqual(
- OnError<int>(210, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void Sum_Int32_Never()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1)
- );
-
- var res = scheduler.Start(() =>
- xs.Sum()
- );
-
- res.Messages.AssertEqual(
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
- }
-
- [TestMethod]
- public void Sum_Int64_Empty()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1L),
- OnCompleted<long>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Sum()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, 0L),
- OnCompleted<long>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Sum_Int64_Return()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1L),
- OnNext(210, 2L),
- OnCompleted<long>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Sum()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, 2L),
- OnCompleted<long>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Sum_Int64_Some()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1L),
- OnNext(210, 2L),
- OnNext(220, 3L),
- OnNext(230, 4L),
- OnCompleted<long>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Sum()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, 2L + 3L + 4L),
- OnCompleted<long>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Sum_Int64_Overflow()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1L),
- OnNext(210, long.MaxValue),
- OnNext(220, 1L),
- OnCompleted<long>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Sum()
- );
-
- res.Messages.AssertEqual(
- OnError<long>(220, e => e is OverflowException)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 220)
- );
- }
-
- [TestMethod]
- public void Sum_Int64_Throw()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1L),
- OnError<long>(210, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.Sum()
- );
-
- res.Messages.AssertEqual(
- OnError<long>(210, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void Sum_Int64_Never()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1L)
- );
-
- var res = scheduler.Start(() =>
- xs.Sum()
- );
-
- res.Messages.AssertEqual(
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
- }
-
- [TestMethod]
- public void Sum_Float_Empty()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1f),
- OnCompleted<float>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Sum()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, 0f),
- OnCompleted<float>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Sum_Float_Return()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1f),
- OnNext(210, 2f),
- OnCompleted<float>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Sum()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, 2f),
- OnCompleted<float>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Sum_Float_Some()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1f),
- OnNext(210, 2f),
- OnNext(220, 3f),
- OnNext(230, 4f),
- OnCompleted<float>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Sum()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, 2f + 3f + 4f),
- OnCompleted<float>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Sum_Float_Throw()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1f),
- OnError<float>(210, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.Sum()
- );
-
- res.Messages.AssertEqual(
- OnError<float>(210, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void Sum_Float_Never()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1f)
- );
-
- var res = scheduler.Start(() =>
- xs.Sum()
- );
-
- res.Messages.AssertEqual(
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
- }
-
- [TestMethod]
- public void Sum_Double_Empty()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1.0),
- OnCompleted<double>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Sum()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, 0.0),
- OnCompleted<double>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Sum_Double_Return()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1.0),
- OnNext(210, 2.0),
- OnCompleted<double>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Sum()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, 2.0),
- OnCompleted<double>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Sum_Double_Some()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1.0),
- OnNext(210, 2.0),
- OnNext(220, 3.0),
- OnNext(230, 4.0),
- OnCompleted<double>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Sum()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, 2.0 + 3.0 + 4.0),
- OnCompleted<double>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Sum_Double_Throw()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1.0),
- OnError<double>(210, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.Sum()
- );
-
- res.Messages.AssertEqual(
- OnError<double>(210, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void Sum_Double_Never()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1.0)
- );
-
- var res = scheduler.Start(() =>
- xs.Sum()
- );
-
- res.Messages.AssertEqual(
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
- }
-
- [TestMethod]
- public void Sum_Decimal_Empty()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1m),
- OnCompleted<decimal>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Sum()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, 0m),
- OnCompleted<decimal>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Sum_Decimal_Return()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1m),
- OnNext(210, 2m),
- OnCompleted<decimal>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Sum()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, 2m),
- OnCompleted<decimal>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Sum_Decimal_Some()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1m),
- OnNext(210, 2m),
- OnNext(220, 3m),
- OnNext(230, 4m),
- OnCompleted<decimal>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Sum()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, 2m + 3m + 4m),
- OnCompleted<decimal>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Sum_Decimal_Throw()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1m),
- OnError<decimal>(210, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.Sum()
- );
-
- res.Messages.AssertEqual(
- OnError<decimal>(210, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void Sum_Decimal_Never()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1m)
- );
-
- var res = scheduler.Start(() =>
- xs.Sum()
- );
-
- res.Messages.AssertEqual(
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
- }
-
- [TestMethod]
- public void Sum_Nullable_Int32_Empty()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (int?)1),
- OnCompleted<int?>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Sum()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, (int?)0),
- OnCompleted<int?>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Sum_Nullable_Int32_Return()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (int?)1),
- OnNext(210, (int?)2),
- OnCompleted<int?>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Sum()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, (int?)2),
- OnCompleted<int?>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Sum_Nullable_Int32_Some()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (int?)1),
- OnNext(210, (int?)2),
- OnNext(220, (int?)null),
- OnNext(230, (int?)4),
- OnCompleted<int?>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Sum()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, (int?)(2 + 4)),
- OnCompleted<int?>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Sum_Nullable_Int32_Overflow()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (int?)1),
- OnNext(210, (int?)int.MaxValue),
- OnNext(220, (int?)1),
- OnCompleted<int?>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Sum()
- );
-
- res.Messages.AssertEqual(
- OnError<int?>(220, e => e is OverflowException)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 220)
- );
- }
-
- [TestMethod]
- public void Sum_Nullable_Int32_Throw()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (int?)1),
- OnError<int?>(210, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.Sum()
- );
-
- res.Messages.AssertEqual(
- OnError<int?>(210, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void Sum_Nullable_Int32_Never()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (int?)1)
- );
-
- var res = scheduler.Start(() =>
- xs.Sum()
- );
-
- res.Messages.AssertEqual(
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
- }
-
- [TestMethod]
- public void Sum_Nullable_Int64_Empty()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (long?)1L),
- OnCompleted<long?>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Sum()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, (long?)0L),
- OnCompleted<long?>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Sum_Nullable_Int64_Return()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (long?)1L),
- OnNext(210, (long?)2L),
- OnCompleted<long?>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Sum()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, (long?)2L),
- OnCompleted<long?>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Sum_Nullable_Int64_Some()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (long?)1L),
- OnNext(210, (long?)2L),
- OnNext(220, (long?)null),
- OnNext(230, (long?)4L),
- OnCompleted<long?>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Sum()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, (long?)(2L + 4L)),
- OnCompleted<long?>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Sum_Nullable_Int64_Overflow()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (long?)1L),
- OnNext(210, (long?)long.MaxValue),
- OnNext(220, (long?)1L),
- OnCompleted<long?>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Sum()
- );
-
- res.Messages.AssertEqual(
- OnError<long?>(220, e => e is OverflowException)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 220)
- );
- }
-
- [TestMethod]
- public void Sum_Nullable_Int64_Throw()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (long?)1L),
- OnError<long?>(210, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.Sum()
- );
-
- res.Messages.AssertEqual(
- OnError<long?>(210, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void Sum_Nullable_Int64_Never()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (long?)1L)
- );
-
- var res = scheduler.Start(() =>
- xs.Sum()
- );
-
- res.Messages.AssertEqual(
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
- }
-
- [TestMethod]
- public void Sum_Nullable_Float_Empty()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (float?)1f),
- OnCompleted<float?>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Sum()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, (float?)0f),
- OnCompleted<float?>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Sum_Nullable_Float_Return()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (float?)1f),
- OnNext(210, (float?)2f),
- OnCompleted<float?>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Sum()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, (float?)2f),
- OnCompleted<float?>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Sum_Nullable_Float_Some()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (float?)1f),
- OnNext(210, (float?)2f),
- OnNext(220, (float?)null),
- OnNext(230, (float?)4f),
- OnCompleted<float?>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Sum()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, (float?)(2f + 4f)),
- OnCompleted<float?>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Sum_Nullable_Float_Throw()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (float?)1f),
- OnError<float?>(210, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.Sum()
- );
-
- res.Messages.AssertEqual(
- OnError<float?>(210, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void Sum_Nullable_Float_Never()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (float?)1f)
- );
-
- var res = scheduler.Start(() =>
- xs.Sum()
- );
-
- res.Messages.AssertEqual(
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
- }
-
- [TestMethod]
- public void Sum_Nullable_Double_Empty()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (double?)1.0),
- OnCompleted<double?>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Sum()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, (double?)0.0),
- OnCompleted<double?>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Sum_Nullable_Double_Return()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (double?)1.0),
- OnNext(210, (double?)2.0),
- OnCompleted<double?>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Sum()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, (double?)2.0),
- OnCompleted<double?>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Sum_Nullable_Double_Some()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (double?)1.0),
- OnNext(210, (double?)2.0),
- OnNext(220, (double?)null),
- OnNext(230, (double?)4.0),
- OnCompleted<double?>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Sum()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, (double?)(2.0 + 4.0)),
- OnCompleted<double?>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Sum_Nullable_Double_Throw()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (double?)1.0),
- OnError<double?>(210, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.Sum()
- );
-
- res.Messages.AssertEqual(
- OnError<double?>(210, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void Sum_Nullable_Double_Never()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (double?)1.0)
- );
-
- var res = scheduler.Start(() =>
- xs.Sum()
- );
-
- res.Messages.AssertEqual(
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
- }
-
- [TestMethod]
- public void Sum_Nullable_Decimal_Empty()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (decimal?)1m),
- OnCompleted<decimal?>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Sum()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, (decimal?)0m),
- OnCompleted<decimal?>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Sum_Nullable_Decimal_Return()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (decimal?)1m),
- OnNext(210, (decimal?)2m),
- OnCompleted<decimal?>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Sum()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, (decimal?)2m),
- OnCompleted<decimal?>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Sum_Nullable_Decimal_Some()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (decimal?)1m),
- OnNext(210, (decimal?)2m),
- OnNext(220, (decimal?)null),
- OnNext(230, (decimal?)4m),
- OnCompleted<decimal?>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Sum()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, (decimal?)(2m + 4m)),
- OnCompleted<decimal?>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Sum_Nullable_Decimal_Throw()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (decimal?)1m),
- OnError<decimal?>(210, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.Sum()
- );
-
- res.Messages.AssertEqual(
- OnError<decimal?>(210, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void Sum_Nullable_Decimal_Never()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, (decimal?)1m)
- );
-
- var res = scheduler.Start(() =>
- xs.Sum()
- );
-
- res.Messages.AssertEqual(
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
- }
-
- [TestMethod]
- public void Sum_Selector_Regular_Int32()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable<string>(
- OnNext(210, "fo"),
- OnNext(220, "b"),
- OnNext(230, "qux"),
- OnCompleted<string>(240)
- );
-
- var res = scheduler.Start(() => xs.Sum(x => (int)x.Length));
-
- res.Messages.AssertEqual(
- OnNext(240, 6),
- OnCompleted<int>(240)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 240)
- );
- }
-
- [TestMethod]
- public void Sum_Selector_Regular_Int64()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable<string>(
- OnNext(210, "fo"),
- OnNext(220, "b"),
- OnNext(230, "qux"),
- OnCompleted<string>(240)
- );
-
- var res = scheduler.Start(() => xs.Sum(x => (long)x.Length));
-
- res.Messages.AssertEqual(
- OnNext(240, 6L),
- OnCompleted<long>(240)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 240)
- );
- }
-
- [TestMethod]
- public void Sum_Selector_Regular_Single()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable<string>(
- OnNext(210, "fo"),
- OnNext(220, "b"),
- OnNext(230, "qux"),
- OnCompleted<string>(240)
- );
-
- var res = scheduler.Start(() => xs.Sum(x => (float)x.Length));
-
- res.Messages.AssertEqual(
- OnNext(240, 6.0f),
- OnCompleted<float>(240)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 240)
- );
- }
-
- [TestMethod]
- public void Sum_Selector_Regular_Double()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable<string>(
- OnNext(210, "fo"),
- OnNext(220, "b"),
- OnNext(230, "qux"),
- OnCompleted<string>(240)
- );
-
- var res = scheduler.Start(() => xs.Sum(x => (double)x.Length));
-
- res.Messages.AssertEqual(
- OnNext(240, 6.0),
- OnCompleted<double>(240)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 240)
- );
- }
-
- [TestMethod]
- public void Sum_Selector_Regular_Decimal()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable<string>(
- OnNext(210, "fo"),
- OnNext(220, "b"),
- OnNext(230, "qux"),
- OnCompleted<string>(240)
- );
-
- var res = scheduler.Start(() => xs.Sum(x => (decimal)x.Length));
-
- res.Messages.AssertEqual(
- OnNext(240, 6.0m),
- OnCompleted<decimal>(240)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 240)
- );
- }
-
- [TestMethod]
- public void Sum_Selector_Regular_Int32_Nullable()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable<string>(
- OnNext(210, "fo"),
- OnNext(220, "b"),
- OnNext(230, "qux"),
- OnCompleted<string>(240)
- );
-
- var res = scheduler.Start(() => xs.Sum(x => x == "fo" ? default(int?) : x.Length));
-
- res.Messages.AssertEqual(
- OnNext(240, (int?)4),
- OnCompleted<int?>(240)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 240)
- );
- }
-
- [TestMethod]
- public void Sum_Selector_Regular_Int64_Nullable()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable<string>(
- OnNext(210, "fo"),
- OnNext(220, "b"),
- OnNext(230, "qux"),
- OnCompleted<string>(240)
- );
-
- var res = scheduler.Start(() => xs.Sum(x => x == "fo" ? default(long?) : x.Length));
-
- res.Messages.AssertEqual(
- OnNext(240, (long?)4.0),
- OnCompleted<long?>(240)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 240)
- );
- }
-
- [TestMethod]
- public void Sum_Selector_Regular_Single_Nullable()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable<string>(
- OnNext(210, "fo"),
- OnNext(220, "b"),
- OnNext(230, "qux"),
- OnCompleted<string>(240)
- );
-
- var res = scheduler.Start(() => xs.Sum(x => x == "fo" ? default(float?) : x.Length));
-
- res.Messages.AssertEqual(
- OnNext(240, (float?)4.0),
- OnCompleted<float?>(240)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 240)
- );
- }
-
- [TestMethod]
- public void Sum_Selector_Regular_Double_Nullable()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable<string>(
- OnNext(210, "fo"),
- OnNext(220, "b"),
- OnNext(230, "qux"),
- OnCompleted<string>(240)
- );
-
- var res = scheduler.Start(() => xs.Sum(x => x == "fo" ? default(double?) : x.Length));
-
- res.Messages.AssertEqual(
- OnNext(240, (double?)4.0),
- OnCompleted<double?>(240)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 240)
- );
- }
-
- [TestMethod]
- public void Sum_Selector_Regular_Decimal_Nullable()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable<string>(
- OnNext(210, "fo"),
- OnNext(220, "b"),
- OnNext(230, "qux"),
- OnCompleted<string>(240)
- );
-
- var res = scheduler.Start(() => xs.Sum(x => x == "fo" ? default(decimal?) : x.Length));
-
- res.Messages.AssertEqual(
- OnNext(240, (decimal?)4.0),
- OnCompleted<decimal?>(240)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 240)
- );
- }
-
- #endregion
-
- #region + ToArray +
-
- [TestMethod]
- public void ToArray_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToArray<int>(null));
- }
-
- [TestMethod]
- public void ToArray_Completed()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(110, 1),
- OnNext(220, 2),
- OnNext(330, 3),
- OnNext(440, 4),
- OnNext(550, 5),
- OnCompleted<int>(660)
- );
-
- var res = scheduler.Start(() =>
- xs.ToArray()
- );
-
- res.Messages.AssertEqual(
- OnNext<int[]>(660, a => a.SequenceEqual(new[] { 2, 3, 4, 5 })),
- OnCompleted<int[]>(660)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 660)
- );
- }
-
- [TestMethod]
- public void ToArray_Error()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(110, 1),
- OnNext(220, 2),
- OnNext(330, 3),
- OnNext(440, 4),
- OnNext(550, 5),
- OnError<int>(660, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.ToArray()
- );
-
- res.Messages.AssertEqual(
- OnError<int[]>(660, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 660)
- );
- }
-
- [TestMethod]
- public void ToArray_Disposed()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(110, 1),
- OnNext(220, 2),
- OnNext(330, 3),
- OnNext(440, 4),
- OnNext(550, 5)
- );
-
- var res = scheduler.Start(() =>
- xs.ToArray()
- );
-
- res.Messages.AssertEqual(
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
- }
-
- #endregion
-
- #region + ToDictionary +
-
- [TestMethod]
- public void ToDictionary_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToDictionary<int, int>(null, DummyFunc<int, int>.Instance, EqualityComparer<int>.Default));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToDictionary<int, int>(DummyObservable<int>.Instance, null, EqualityComparer<int>.Default));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToDictionary<int, int>(DummyObservable<int>.Instance, DummyFunc<int, int>.Instance, null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToDictionary<int, int>(null, DummyFunc<int, int>.Instance));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToDictionary<int, int>(DummyObservable<int>.Instance, null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToDictionary<int, int, int>(null, DummyFunc<int, int>.Instance, DummyFunc<int, int>.Instance, EqualityComparer<int>.Default));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToDictionary<int, int, int>(DummyObservable<int>.Instance, null, DummyFunc<int, int>.Instance, EqualityComparer<int>.Default));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToDictionary<int, int, int>(DummyObservable<int>.Instance, DummyFunc<int, int>.Instance, null, EqualityComparer<int>.Default));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToDictionary<int, int, int>(DummyObservable<int>.Instance, DummyFunc<int, int>.Instance, DummyFunc<int, int>.Instance, null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToDictionary<int, int, int>(null, DummyFunc<int, int>.Instance, DummyFunc<int, int>.Instance));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToDictionary<int, int, int>(DummyObservable<int>.Instance, null, DummyFunc<int, int>.Instance));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToDictionary<int, int, int>(DummyObservable<int>.Instance, DummyFunc<int, int>.Instance, null));
- }
-
- [TestMethod]
- public void ToDictionary_Completed()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(110, 1),
- OnNext(220, 2),
- OnNext(330, 3),
- OnNext(440, 4),
- OnNext(550, 5),
- OnCompleted<int>(660)
- );
-
- var res = scheduler.Start(() =>
- xs.ToDictionary(x => x * 2, x => x * 4, EqualityComparer<int>.Default)
- );
-
- res.Messages.AssertEqual(
- OnNext<IDictionary<int, int>>(660, d =>
- {
- return d.Count == 4
- && d[4] == 8
- && d[6] == 12
- && d[8] == 16
- && d[10] == 20;
- }),
- OnCompleted<IDictionary<int, int>>(660)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 660)
- );
- }
-
- [TestMethod]
- public void ToDictionary_Error()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(110, 1),
- OnNext(220, 2),
- OnNext(330, 3),
- OnNext(440, 4),
- OnNext(550, 5),
- OnError<int>(660, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.ToDictionary(x => x * 2, x => x * 4, EqualityComparer<int>.Default)
- );
-
- res.Messages.AssertEqual(
- OnError<IDictionary<int, int>>(660, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 660)
- );
- }
-
- [TestMethod]
- public void ToDictionary_KeySelectorThrows()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(110, 1),
- OnNext(220, 2),
- OnNext(330, 3),
- OnNext(440, 4),
- OnNext(550, 5),
- OnCompleted<int>(600)
- );
-
- var res = scheduler.Start(() =>
- xs.ToDictionary(x => { if (x < 4) return x * 2; throw ex; }, x => x * 4, EqualityComparer<int>.Default)
- );
-
- res.Messages.AssertEqual(
- OnError<IDictionary<int, int>>(440, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 440)
- );
- }
-
- [TestMethod]
- public void ToDictionary_ElementSelectorThrows()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(110, 1),
- OnNext(220, 2),
- OnNext(330, 3),
- OnNext(440, 4),
- OnNext(550, 5),
- OnCompleted<int>(600)
- );
-
- var res = scheduler.Start(() =>
- xs.ToDictionary(x => x * 2, x => { if (x < 4) return x * 4; throw ex; }, EqualityComparer<int>.Default)
- );
-
- res.Messages.AssertEqual(
- OnError<IDictionary<int, int>>(440, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 440)
- );
- }
-
- [TestMethod]
- public void ToDictionary_Disposed()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(110, 1),
- OnNext(220, 2),
- OnNext(330, 3),
- OnNext(440, 4),
- OnNext(550, 5)
- );
-
- var res = scheduler.Start(() =>
- xs.ToDictionary(x => x * 2, x => x * 4, EqualityComparer<int>.Default)
- );
-
- res.Messages.AssertEqual(
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
- }
-
- [TestMethod]
- public void ToDictionary_MultipleAdd()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(110, 1),
- OnNext(220, 2),
- OnNext(330, 3),
- OnNext(440, 4),
- OnNext(550, 5),
- OnCompleted<int>(660)
- );
-
- var res = scheduler.Start(() =>
- xs.ToDictionary(x => x % 2, x => x * 2, EqualityComparer<int>.Default)
- );
-
- res.Messages.AssertEqual(
- OnError<IDictionary<int, int>>(440, e => true)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 440)
- );
- }
-
- [TestMethod]
- public void ToDictionary_Default()
- {
- var d1 = Observable.Range(1, 10).ToDictionary(x => x.ToString()).First();
- Assert.AreEqual(7, d1["7"]);
-
- var d2 = Observable.Range(1, 10).ToDictionary(x => x.ToString(), x => x * 2).First();
- Assert.AreEqual(18, d2["9"]);
-
- var d3 = Observable.Range(1, 10).ToDictionary(x => x.ToString(), EqualityComparer<string>.Default).First();
- Assert.AreEqual(7, d3["7"]);
- }
-
- #endregion
-
- #region + ToList +
-
- [TestMethod]
- public void ToList_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToList<int>(null));
- }
-
- [TestMethod]
- public void ToList_Completed()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(110, 1),
- OnNext(220, 2),
- OnNext(330, 3),
- OnNext(440, 4),
- OnNext(550, 5),
- OnCompleted<int>(660)
- );
-
- var res = scheduler.Start(() =>
- xs.ToList()
- );
-
- res.Messages.AssertEqual(
- OnNext<IList<int>>(660, l => l.SequenceEqual(new[] { 2, 3, 4, 5 })),
- OnCompleted<IList<int>>(660)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 660)
- );
- }
-
- [TestMethod]
- public void ToList_Error()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(110, 1),
- OnNext(220, 2),
- OnNext(330, 3),
- OnNext(440, 4),
- OnNext(550, 5),
- OnError<int>(660, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.ToList()
- );
-
- res.Messages.AssertEqual(
- OnError<IList<int>>(660, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 660)
- );
- }
-
- [TestMethod]
- public void ToList_Disposed()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(110, 1),
- OnNext(220, 2),
- OnNext(330, 3),
- OnNext(440, 4),
- OnNext(550, 5)
- );
-
- var res = scheduler.Start(() =>
- xs.ToList()
- );
-
- res.Messages.AssertEqual(
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
- }
-
- #endregion
-
- #region + ToLookup +
-
- [TestMethod]
- public void ToLookup_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToLookup<int, int>(null, DummyFunc<int, int>.Instance, EqualityComparer<int>.Default));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToLookup<int, int>(DummyObservable<int>.Instance, null, EqualityComparer<int>.Default));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToLookup<int, int>(DummyObservable<int>.Instance, DummyFunc<int, int>.Instance, null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToLookup<int, int>(null, DummyFunc<int, int>.Instance));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToLookup<int, int>(DummyObservable<int>.Instance, null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToLookup<int, int, int>(null, DummyFunc<int, int>.Instance, DummyFunc<int, int>.Instance, EqualityComparer<int>.Default));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToLookup<int, int, int>(DummyObservable<int>.Instance, null, DummyFunc<int, int>.Instance, EqualityComparer<int>.Default));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToLookup<int, int, int>(DummyObservable<int>.Instance, DummyFunc<int, int>.Instance, null, EqualityComparer<int>.Default));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToLookup<int, int, int>(DummyObservable<int>.Instance, DummyFunc<int, int>.Instance, DummyFunc<int, int>.Instance, null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToLookup<int, int, int>(null, DummyFunc<int, int>.Instance, DummyFunc<int, int>.Instance));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToLookup<int, int, int>(DummyObservable<int>.Instance, null, DummyFunc<int, int>.Instance));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToLookup<int, int, int>(DummyObservable<int>.Instance, DummyFunc<int, int>.Instance, null));
- }
-
-
- [TestMethod]
- public void ToLookup_Completed()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(110, 1),
- OnNext(220, 2),
- OnNext(330, 3),
- OnNext(440, 4),
- OnNext(550, 5),
- OnCompleted<int>(660)
- );
-
- var res = scheduler.Start(() =>
- xs.ToLookup(x => x % 2, x => x * 2, EqualityComparer<int>.Default)
- );
-
- res.Messages.AssertEqual(
- OnNext<ILookup<int, int>>(660, d =>
- {
- return d.Count == 2
- && d[0].SequenceEqual(new[] { 4, 8 })
- && d[1].SequenceEqual(new[] { 6, 10 });
- }),
- OnCompleted<ILookup<int, int>>(660)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 660)
- );
- }
-
- [TestMethod]
- public void ToLookup_Error()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(110, 1),
- OnNext(220, 2),
- OnNext(330, 3),
- OnNext(440, 4),
- OnNext(550, 5),
- OnError<int>(660, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.ToLookup(x => x % 2, x => x * 2, EqualityComparer<int>.Default)
- );
-
- res.Messages.AssertEqual(
- OnError<ILookup<int, int>>(660, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 660)
- );
- }
-
- [TestMethod]
- public void ToLookup_KeySelectorThrows()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(110, 1),
- OnNext(220, 2),
- OnNext(330, 3),
- OnNext(440, 4),
- OnNext(550, 5),
- OnCompleted<int>(600)
- );
-
- var res = scheduler.Start(() =>
- xs.ToLookup(x => { if (x < 4) return x * 2; throw ex; }, x => x * 4, EqualityComparer<int>.Default)
- );
-
- res.Messages.AssertEqual(
- OnError<ILookup<int, int>>(440, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 440)
- );
- }
-
- [TestMethod]
- public void ToLookup_ElementSelectorThrows()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(110, 1),
- OnNext(220, 2),
- OnNext(330, 3),
- OnNext(440, 4),
- OnNext(550, 5),
- OnCompleted<int>(600)
- );
-
- var res = scheduler.Start(() =>
- xs.ToLookup(x => x * 2, x => { if (x < 4) return x * 4; throw ex; }, EqualityComparer<int>.Default)
- );
-
- res.Messages.AssertEqual(
- OnError<ILookup<int, int>>(440, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 440)
- );
- }
-
- [TestMethod]
- public void ToLookup_Disposed()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(110, 1),
- OnNext(220, 2),
- OnNext(330, 3),
- OnNext(440, 4),
- OnNext(550, 5)
- );
-
- var res = scheduler.Start(() =>
- xs.ToLookup(x => x % 2, x => x * 2, EqualityComparer<int>.Default)
- );
-
- res.Messages.AssertEqual(
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
- }
-
- [TestMethod]
- public void ToLookup_Default()
- {
- var d1 = Observable.Range(1, 10).ToLookup(x => (x % 2).ToString()).First();
- d1["0"].AssertEqual(2, 4, 6, 8, 10);
-
- var d2 = Observable.Range(1, 10).ToLookup(x => (x % 2).ToString(), x => x * 2).First();
- d2["1"].AssertEqual(2, 6, 10, 14, 18);
-
- var d3 = Observable.Range(1, 10).ToLookup(x => (x % 2).ToString(), EqualityComparer<string>.Default).First();
- d3["0"].AssertEqual(2, 4, 6, 8, 10);
- }
-
- [TestMethod]
- public void ToLookup_Contains()
- {
- var d1 = Observable.Range(1, 10).ToLookup(x => (x % 2).ToString()).First();
- Assert.IsTrue(d1.Contains("1"));
- Assert.IsFalse(d1.Contains("2"));
- }
-
- [TestMethod]
- public void ToLookup_Groups()
- {
- var d1 = Observable.Range(1, 10).ToLookup(x => (x % 2).ToString()).First();
-
- foreach (var g in d1)
- {
- if (g.Key == "0")
- {
- g.AssertEqual(2, 4, 6, 8, 10);
- }
- else if (g.Key == "1")
- {
- g.AssertEqual(1, 3, 5, 7, 9);
- }
- else
- Assert.Fail("Unknown group.");
- }
- }
-
- [TestMethod]
- public void ToLookup_Groups_2()
- {
- var d1 = Observable.Range(1, 10).ToLookup(x => (x % 2).ToString()).First();
-
- foreach (IGrouping<string, int> g in ((System.Collections.IEnumerable)d1))
- {
- if (g.Key == "0")
- {
- var l = new List<int>();
- foreach (int v in ((System.Collections.IEnumerable)g)) l.Add(v);
- l.AssertEqual(2, 4, 6, 8, 10);
- }
- else if (g.Key == "1")
- {
- var l = new List<int>();
- foreach (int v in ((System.Collections.IEnumerable)g)) l.Add(v);
- l.AssertEqual(1, 3, 5, 7, 9);
- }
- else
- Assert.Fail("Unknown group.");
- }
- }
-
- #endregion
- }
-}
diff --git a/Rx.NET/Tests.System.Reactive/Tests/ObservableAsyncTest.cs b/Rx.NET/Tests.System.Reactive/Tests/ObservableAsyncTest.cs
deleted file mode 100644
index 2fd0590..0000000
--- a/Rx.NET/Tests.System.Reactive/Tests/ObservableAsyncTest.cs
+++ /dev/null
@@ -1,2460 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System;
-using System.Linq;
-using System.Reactive;
-using System.Reactive.Concurrency;
-using System.Reactive.Linq;
-using System.Threading;
-using Microsoft.Reactive.Testing;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-
-#if !NO_TPL
-using System.Threading.Tasks;
-#endif
-
-namespace ReactiveTests.Tests
-{
- [TestClass]
- public partial class ObservableAsyncTest : ReactiveTest
- {
- #region FromAsyncPattern
-
- [TestMethod]
- public void FromAsyncPattern_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern(null, iar => { }));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern<int>(null, iar => 0));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern<int>(null, iar => { }));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern<int, int>(null, iar => 0));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern<int, int>(null, iar => { }));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern<int, int, int>(null, iar => 0));
-#if !NO_LARGEARITY
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern<int, int, int>(null, iar => { }));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern<int, int, int, int>(null, iar => 0));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern<int, int, int, int>(null, iar => { }));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern<int, int, int, int, int>(null, iar => 0));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern<int, int, int, int, int>(null, iar => { }));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern<int, int, int, int, int, int>(null, iar => 0));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern<int, int, int, int, int, int>(null, iar => { }));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern<int, int, int, int, int, int, int>(null, iar => 0));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern<int, int, int, int, int, int, int>(null, iar => { }));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern<int, int, int, int, int, int, int, int>(null, iar => 0));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern<int, int, int, int, int, int, int, int>(null, iar => { }));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern<int, int, int, int, int, int, int, int, int>(null, iar => 0));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern<int, int, int, int, int, int, int, int, int>(null, iar => { }));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern<int, int, int, int, int, int, int, int, int, int>(null, iar => 0));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern<int, int, int, int, int, int, int, int, int, int>(null, iar => { }));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern<int, int, int, int, int, int, int, int, int, int, int>(null, iar => 0));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern<int, int, int, int, int, int, int, int, int, int, int>(null, iar => { }));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern<int, int, int, int, int, int, int, int, int, int, int, int>(null, iar => 0));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern<int, int, int, int, int, int, int, int, int, int, int, int>(null, iar => { }));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern<int, int, int, int, int, int, int, int, int, int, int, int, int>(null, iar => 0));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern<int, int, int, int, int, int, int, int, int, int, int, int, int>(null, iar => { }));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern<int, int, int, int, int, int, int, int, int, int, int, int, int, int>(null, iar => 0));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern<int, int, int, int, int, int, int, int, int, int, int, int, int, int>(null, iar => { }));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern<int, int, int, int, int, int, int, int, int, int, int, int, int, int, int>(null, iar => 0));
-#endif
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern((cb, o) => null, default(Action<IAsyncResult>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern<int>((cb, o) => null, default(Func<IAsyncResult, int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern<int>((a, cb, o) => null, default(Action<IAsyncResult>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern<int, int>((a, cb, o) => null, default(Func<IAsyncResult, int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern<int, int>((a, b, cb, o) => null, default(Action<IAsyncResult>)));
-#if !NO_LARGEARITY
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern<int, int, int>((a, b, cb, o) => null, default(Func<IAsyncResult, int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern<int, int, int>((a, b, c, cb, o) => null, default(Action<IAsyncResult>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern<int, int, int, int>((a, b, c, cb, o) => null, default(Func<IAsyncResult, int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern<int, int, int, int>((a, b, c, d, cb, o) => null, default(Action<IAsyncResult>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern<int, int, int, int, int>((a, b, c, d, cb, o) => null, default(Func<IAsyncResult, int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern<int, int, int, int, int>((a, b, c, d, e, cb, o) => null, default(Action<IAsyncResult>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern<int, int, int, int, int, int>((a, b, c, d, e, cb, o) => null, default(Func<IAsyncResult, int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern<int, int, int, int, int, int>((a, b, c, d, e, f, cb, o) => null, default(Action<IAsyncResult>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern<int, int, int, int, int, int, int>((a, b, c, d, e, f, cb, o) => null, default(Func<IAsyncResult, int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern<int, int, int, int, int, int, int>((a, b, c, d, e, f, g, cb, o) => null, default(Action<IAsyncResult>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern<int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, cb, o) => null, default(Func<IAsyncResult, int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern<int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, cb, o) => null, default(Action<IAsyncResult>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern<int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, cb, o) => null, default(Func<IAsyncResult, int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern<int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, cb, o) => null, default(Action<IAsyncResult>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern<int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, cb, o) => null, default(Func<IAsyncResult, int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern<int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, cb, o) => null, default(Action<IAsyncResult>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern<int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, cb, o) => null, default(Func<IAsyncResult, int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern<int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, k, cb, o) => null, default(Action<IAsyncResult>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern<int, int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, k, cb, o) => null, default(Func<IAsyncResult, int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern<int, int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, k, l, cb, o) => null, default(Action<IAsyncResult>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern<int, int, int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, k, l, cb, o) => null, default(Func<IAsyncResult, int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern<int, int, int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, k, l, m, cb, o) => null, default(Action<IAsyncResult>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern<int, int, int, int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, k, l, m, cb, o) => null, default(Func<IAsyncResult, int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern<int, int, int, int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, k, l, m, n, cb, o) => null, default(Action<IAsyncResult>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern<int, int, int, int, int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, k, l, m, n, cb, o) => null, default(Func<IAsyncResult, int>)));
-#endif
- }
-
- [TestMethod]
- public void FromAsyncPattern0()
- {
- var x = new Result();
-
- Func<AsyncCallback, object, IAsyncResult> begin = (cb, _) => { cb(x); return x; };
- Func<IAsyncResult, int> end = iar => { Assert.AreSame(x, iar); return 1; };
-
- var res = Observable.FromAsyncPattern(begin, end)().Materialize().ToEnumerable().ToArray();
- Assert.IsTrue(res.SequenceEqual(new Notification<int>[] { Notification.CreateOnNext<int>(1), Notification.CreateOnCompleted<int>() }));
- }
-
- [TestMethod]
- public void FromAsyncPatternAction0()
- {
- var x = new Result();
-
- Func<AsyncCallback, object, IAsyncResult> begin = (cb, _) => { cb(x); return x; };
- Action<IAsyncResult> end = iar => { Assert.AreSame(x, iar); };
-
- var res = Observable.FromAsyncPattern(begin, end)().ToEnumerable().ToArray();
- Assert.IsTrue(res.SequenceEqual(new[] { new Unit() }));
- }
-
- [TestMethod]
- public void FromAsyncPattern0_Error()
- {
- var x = new Result();
- var ex = new Exception();
-
- Func<AsyncCallback, object, IAsyncResult> begin = (cb, _) => { cb(x); return x; };
- Func<IAsyncResult, int> end = iar => { Assert.AreSame(x, iar); throw ex; };
-
- var res = Observable.FromAsyncPattern(begin, end)().Materialize().ToEnumerable().ToArray();
- Assert.IsTrue(res.SequenceEqual(new Notification<int>[] { Notification.CreateOnError<int>(ex) }));
- }
-
- [TestMethod]
- public void FromAsyncPattern0_ErrorBegin()
- {
- var x = new Result();
- var ex = new Exception();
-
- Func<AsyncCallback, object, IAsyncResult> begin = (cb, _) => { cb(x); throw ex; };
- Func<IAsyncResult, int> end = iar => { Assert.AreSame(x, iar); return 0; };
-
- var res = Observable.FromAsyncPattern(begin, end)().Materialize().ToEnumerable().ToArray();
- Assert.IsTrue(res.SequenceEqual(new Notification<int>[] { Notification.CreateOnError<int>(ex) }));
- }
-
- [TestMethod]
- public void FromAsyncPattern1()
- {
- var x = new Result();
-
- Func<int, AsyncCallback, object, IAsyncResult> begin = (a, cb, _) =>
- {
- Assert.AreEqual(a, 2);
- cb(x);
- return x;
- };
- Func<IAsyncResult, int> end = iar => { Assert.AreSame(x, iar); return 1; };
-
- var res = Observable.FromAsyncPattern(begin, end)(2).Materialize().ToEnumerable().ToArray();
- Assert.IsTrue(res.SequenceEqual(new Notification<int>[] { Notification.CreateOnNext<int>(1), Notification.CreateOnCompleted<int>() }));
- }
-
- [TestMethod]
- public void FromAsyncPatternAction1()
- {
- var x = new Result();
-
- Func<int, AsyncCallback, object, IAsyncResult> begin = (a, cb, _) =>
- {
- Assert.AreEqual(a, 2);
- cb(x);
- return x;
- };
- Action<IAsyncResult> end = iar => { Assert.AreSame(x, iar); };
-
- var res = Observable.FromAsyncPattern(begin, end)(2).ToEnumerable().ToArray();
- Assert.IsTrue(res.SequenceEqual(new[] { new Unit() }));
- }
-
- [TestMethod]
- public void FromAsyncPattern1_Error()
- {
- var x = new Result();
- var ex = new Exception();
-
- Func<int, AsyncCallback, object, IAsyncResult> begin = (a, cb, o) => { cb(x); return x; };
- Func<IAsyncResult, int> end = iar => { Assert.AreSame(x, iar); throw ex; };
-
- var res = Observable.FromAsyncPattern(begin, end)(2).Materialize().ToEnumerable().ToArray();
- Assert.IsTrue(res.SequenceEqual(new Notification<int>[] { Notification.CreateOnError<int>(ex) }));
- }
-
- [TestMethod]
- public void FromAsyncPattern1_ErrorBegin()
- {
- var x = new Result();
- var ex = new Exception();
-
- Func<int, AsyncCallback, object, IAsyncResult> begin = (a, cb, o) => { cb(x); throw ex; };
- Func<IAsyncResult, int> end = iar => { Assert.AreSame(x, iar); return 0; };
-
- var res = Observable.FromAsyncPattern(begin, end)(2).Materialize().ToEnumerable().ToArray();
- Assert.IsTrue(res.SequenceEqual(new Notification<int>[] { Notification.CreateOnError<int>(ex) }));
- }
-
- [TestMethod]
- public void FromAsyncPattern2()
- {
- var x = new Result();
-
- Func<int, int, AsyncCallback, object, IAsyncResult> begin = (a, b, cb, _) =>
- {
- Assert.AreEqual(a, 2);
- Assert.AreEqual(b, 3);
- cb(x);
- return x;
- };
- Func<IAsyncResult, int> end = iar => { Assert.AreSame(x, iar); return 1; };
-
- var res = Observable.FromAsyncPattern(begin, end)(2, 3).Materialize().ToEnumerable().ToArray();
- Assert.IsTrue(res.SequenceEqual(new Notification<int>[] { Notification.CreateOnNext<int>(1), Notification.CreateOnCompleted<int>() }));
- }
-
- [TestMethod]
- public void FromAsyncPatternAction2()
- {
- var x = new Result();
-
- Func<int, int, AsyncCallback, object, IAsyncResult> begin = (a, b, cb, _) =>
- {
- Assert.AreEqual(a, 2);
- Assert.AreEqual(b, 3);
- cb(x);
- return x;
- };
- Action<IAsyncResult> end = iar => { Assert.AreSame(x, iar); };
-
- var res = Observable.FromAsyncPattern(begin, end)(2, 3).ToEnumerable().ToArray();
- Assert.IsTrue(res.SequenceEqual(new[] { new Unit() }));
- }
-
- [TestMethod]
- public void FromAsyncPattern2_Error()
- {
- var x = new Result();
- var ex = new Exception();
-
- Func<int, int, AsyncCallback, object, IAsyncResult> begin = (a, b, cb, o) => { cb(x); return x; };
- Func<IAsyncResult, int> end = iar => { Assert.AreSame(x, iar); throw ex; };
-
- var res = Observable.FromAsyncPattern(begin, end)(2, 3).Materialize().ToEnumerable().ToArray();
- Assert.IsTrue(res.SequenceEqual(new Notification<int>[] { Notification.CreateOnError<int>(ex) }));
- }
-
- [TestMethod]
- public void FromAsyncPattern2_ErrorBegin()
- {
- var x = new Result();
- var ex = new Exception();
-
- Func<int, int, AsyncCallback, object, IAsyncResult> begin = (a, b, cb, o) => { cb(x); throw ex; };
- Func<IAsyncResult, int> end = iar => { Assert.AreSame(x, iar); return 0; };
-
- var res = Observable.FromAsyncPattern(begin, end)(2, 3).Materialize().ToEnumerable().ToArray();
- Assert.IsTrue(res.SequenceEqual(new Notification<int>[] { Notification.CreateOnError<int>(ex) }));
- }
-
-#if !NO_LARGEARITY
- [TestMethod]
- public void FromAsyncPattern3()
- {
- var x = new Result();
-
- Func<int, int, int, AsyncCallback, object, IAsyncResult> begin = (a, b, c, cb, _) =>
- {
- Assert.AreEqual(a, 2);
- Assert.AreEqual(b, 3);
- Assert.AreEqual(c, 4);
- cb(x);
- return x;
- };
- Func<IAsyncResult, int> end = iar => { Assert.AreSame(x, iar); return 1; };
-
- var res = Observable.FromAsyncPattern(begin, end)(2, 3, 4).Materialize().ToEnumerable().ToArray();
- Assert.IsTrue(res.SequenceEqual(new Notification<int>[] { Notification.CreateOnNext<int>(1), Notification.CreateOnCompleted<int>() }));
- }
- [TestMethod]
- public void FromAsyncPatternAction3()
- {
- var x = new Result();
-
- Func<int, int, int, AsyncCallback, object, IAsyncResult> begin = (a, b, c, cb, _) =>
- {
- Assert.AreEqual(a, 2);
- Assert.AreEqual(b, 3);
- Assert.AreEqual(c, 4);
- cb(x);
- return x;
- };
- Action<IAsyncResult> end = iar => { Assert.AreSame(x, iar); };
-
- var res = Observable.FromAsyncPattern(begin, end)(2, 3, 4).ToEnumerable().ToArray();
- Assert.IsTrue(res.SequenceEqual(new[] { new Unit() }));
- }
-
- [TestMethod]
- public void FromAsyncPattern3_Error()
- {
- var x = new Result();
- var ex = new Exception();
-
- Func<int, int, int, AsyncCallback, object, IAsyncResult> begin = (a, b, c, cb, o) => { cb(x); return x; };
- Func<IAsyncResult, int> end = iar => { Assert.AreSame(x, iar); throw ex; };
-
- var res = Observable.FromAsyncPattern(begin, end)(2, 3, 4).Materialize().ToEnumerable().ToArray();
- Assert.IsTrue(res.SequenceEqual(new Notification<int>[] { Notification.CreateOnError<int>(ex) }));
- }
-
- [TestMethod]
- public void FromAsyncPattern3_ErrorBegin()
- {
- var x = new Result();
- var ex = new Exception();
-
- Func<int, int, int, AsyncCallback, object, IAsyncResult> begin = (a, b, c, cb, o) => { cb(x); throw ex; };
- Func<IAsyncResult, int> end = iar => { Assert.AreSame(x, iar); return 0; };
-
- var res = Observable.FromAsyncPattern(begin, end)(2, 3, 4).Materialize().ToEnumerable().ToArray();
- Assert.IsTrue(res.SequenceEqual(new Notification<int>[] { Notification.CreateOnError<int>(ex) }));
- }
-
- [TestMethod]
- public void FromAsyncPattern4()
- {
- var x = new Result();
-
- Func<int, int, int, int, AsyncCallback, object, IAsyncResult> begin = (a, b, c, d, cb, _) =>
- {
- Assert.AreEqual(a, 2);
- Assert.AreEqual(b, 3);
- Assert.AreEqual(c, 4);
- Assert.AreEqual(d, 5);
- cb(x);
- return x;
- };
- Func<IAsyncResult, int> end = iar => { Assert.AreSame(x, iar); return 1; };
-
- var res = Observable.FromAsyncPattern(begin, end)(2, 3, 4, 5).Materialize().ToEnumerable().ToArray();
- Assert.IsTrue(res.SequenceEqual(new Notification<int>[] { Notification.CreateOnNext<int>(1), Notification.CreateOnCompleted<int>() }));
- }
-
- [TestMethod]
- public void FromAsyncPatternAction4()
- {
- var x = new Result();
-
- Func<int, int, int, int, AsyncCallback, object, IAsyncResult> begin = (a, b, c, d, cb, _) =>
- {
- Assert.AreEqual(a, 2);
- Assert.AreEqual(b, 3);
- Assert.AreEqual(c, 4);
- Assert.AreEqual(d, 5);
- cb(x);
- return x;
- };
- Action<IAsyncResult> end = iar => { Assert.AreSame(x, iar); };
-
- var res = Observable.FromAsyncPattern(begin, end)(2, 3, 4, 5).ToEnumerable().ToArray();
- Assert.IsTrue(res.SequenceEqual(new[] { new Unit() }));
- }
-
- [TestMethod]
- public void FromAsyncPattern4_Error()
- {
- var x = new Result();
- var ex = new Exception();
-
- Func<int, int, int, int, AsyncCallback, object, IAsyncResult> begin = (a, b, c, d, cb, o) => { cb(x); return x; };
- Func<IAsyncResult, int> end = iar => { Assert.AreSame(x, iar); throw ex; };
-
- var res = Observable.FromAsyncPattern(begin, end)(2, 3, 4, 5).Materialize().ToEnumerable().ToArray();
- Assert.IsTrue(res.SequenceEqual(new Notification<int>[] { Notification.CreateOnError<int>(ex) }));
- }
-
- [TestMethod]
- public void FromAsyncPattern4_ErrorBegin()
- {
- var x = new Result();
- var ex = new Exception();
-
- Func<int, int, int, int, AsyncCallback, object, IAsyncResult> begin = (a, b, c, d, cb, o) => { cb(x); throw ex; };
- Func<IAsyncResult, int> end = iar => { Assert.AreSame(x, iar); return 0; };
-
- var res = Observable.FromAsyncPattern(begin, end)(2, 3, 4, 5).Materialize().ToEnumerable().ToArray();
- Assert.IsTrue(res.SequenceEqual(new Notification<int>[] { Notification.CreateOnError<int>(ex) }));
- }
-
- [TestMethod]
- public void FromAsyncPattern5()
- {
- var x = new Result();
-
- Func<int, int, int, int, int, AsyncCallback, object, IAsyncResult> begin = (a, b, c, d, e, cb, _) =>
- {
- Assert.AreEqual(a, 2);
- Assert.AreEqual(b, 3);
- Assert.AreEqual(c, 4);
- Assert.AreEqual(d, 5);
- Assert.AreEqual(e, 6);
- cb(x);
- return x;
- };
- Func<IAsyncResult, int> end = iar => { Assert.AreSame(x, iar); return 1; };
-
- var res = Observable.FromAsyncPattern(begin, end)(2, 3, 4, 5, 6).Materialize().ToEnumerable().ToArray();
- Assert.IsTrue(res.SequenceEqual(new Notification<int>[] { Notification.CreateOnNext<int>(1), Notification.CreateOnCompleted<int>() }));
- }
-
- [TestMethod]
- public void FromAsyncPatternAction5()
- {
- var x = new Result();
-
- Func<int, int, int, int, int, AsyncCallback, object, IAsyncResult> begin = (a, b, c, d, e, cb, _) =>
- {
- Assert.AreEqual(a, 2);
- Assert.AreEqual(b, 3);
- Assert.AreEqual(c, 4);
- Assert.AreEqual(d, 5);
- Assert.AreEqual(e, 6);
- cb(x);
- return x;
- };
- Action<IAsyncResult> end = iar => { Assert.AreSame(x, iar); };
-
- var res = Observable.FromAsyncPattern(begin, end)(2, 3, 4, 5, 6).ToEnumerable().ToArray();
- Assert.IsTrue(res.SequenceEqual(new[] { new Unit() }));
- }
-
- [TestMethod]
- public void FromAsyncPattern5_Error()
- {
- var x = new Result();
- var ex = new Exception();
-
- Func<int, int, int, int, int, AsyncCallback, object, IAsyncResult> begin = (a, b, c, d, e, cb, o) => { cb(x); return x; };
- Func<IAsyncResult, int> end = iar => { Assert.AreSame(x, iar); throw ex; };
-
- var res = Observable.FromAsyncPattern(begin, end)(2, 3, 4, 5, 6).Materialize().ToEnumerable().ToArray();
- Assert.IsTrue(res.SequenceEqual(new Notification<int>[] { Notification.CreateOnError<int>(ex) }));
- }
-
- [TestMethod]
- public void FromAsyncPattern5_ErrorBegin()
- {
- var x = new Result();
- var ex = new Exception();
-
- Func<int, int, int, int, int, AsyncCallback, object, IAsyncResult> begin = (a, b, c, d, e, cb, o) => { cb(x); throw ex; };
- Func<IAsyncResult, int> end = iar => { Assert.AreSame(x, iar); return 0; };
-
- var res = Observable.FromAsyncPattern(begin, end)(2, 3, 4, 5, 6).Materialize().ToEnumerable().ToArray();
- Assert.IsTrue(res.SequenceEqual(new Notification<int>[] { Notification.CreateOnError<int>(ex) }));
- }
-
- [TestMethod]
- public void FromAsyncPattern6()
- {
- var x = new Result();
-
- Func<int, int, int, int, int, int, AsyncCallback, object, IAsyncResult> begin = (a, b, c, d, e, f, cb, _) =>
- {
- Assert.AreEqual(a, 2);
- Assert.AreEqual(b, 3);
- Assert.AreEqual(c, 4);
- Assert.AreEqual(d, 5);
- Assert.AreEqual(e, 6);
- Assert.AreEqual(f, 7);
- cb(x);
- return x;
- };
- Func<IAsyncResult, int> end = iar => { Assert.AreSame(x, iar); return 1; };
-
- var res = Observable.FromAsyncPattern(begin, end)(2, 3, 4, 5, 6, 7).Materialize().ToEnumerable().ToArray();
- Assert.IsTrue(res.SequenceEqual(new Notification<int>[] { Notification.CreateOnNext<int>(1), Notification.CreateOnCompleted<int>() }));
- }
-
- [TestMethod]
- public void FromAsyncPatternAction6()
- {
- var x = new Result();
-
- Func<int, int, int, int, int, int, AsyncCallback, object, IAsyncResult> begin = (a, b, c, d, e, f, cb, _) =>
- {
- Assert.AreEqual(a, 2);
- Assert.AreEqual(b, 3);
- Assert.AreEqual(c, 4);
- Assert.AreEqual(d, 5);
- Assert.AreEqual(e, 6);
- Assert.AreEqual(f, 7);
- cb(x);
- return x;
- };
- Action<IAsyncResult> end = iar => { Assert.AreSame(x, iar); };
-
- var res = Observable.FromAsyncPattern(begin, end)(2, 3, 4, 5, 6, 7).ToEnumerable().ToArray();
- Assert.IsTrue(res.SequenceEqual(new[] { new Unit() }));
- }
-
- [TestMethod]
- public void FromAsyncPattern6_Error()
- {
- var x = new Result();
- var ex = new Exception();
-
- Func<int, int, int, int, int, int, AsyncCallback, object, IAsyncResult> begin = (a, b, c, d, e, f, cb, o) => { cb(x); return x; };
- Func<IAsyncResult, int> end = iar => { Assert.AreSame(x, iar); throw ex; };
-
- var res = Observable.FromAsyncPattern(begin, end)(2, 3, 4, 5, 6, 7).Materialize().ToEnumerable().ToArray();
- Assert.IsTrue(res.SequenceEqual(new Notification<int>[] { Notification.CreateOnError<int>(ex) }));
- }
-
- [TestMethod]
- public void FromAsyncPattern6_ErrorBegin()
- {
- var x = new Result();
- var ex = new Exception();
-
- Func<int, int, int, int, int, int, AsyncCallback, object, IAsyncResult> begin = (a, b, c, d, e, f, cb, o) => { cb(x); throw ex; };
- Func<IAsyncResult, int> end = iar => { Assert.AreSame(x, iar); return 0; };
-
- var res = Observable.FromAsyncPattern(begin, end)(2, 3, 4, 5, 6, 7).Materialize().ToEnumerable().ToArray();
- Assert.IsTrue(res.SequenceEqual(new Notification<int>[] { Notification.CreateOnError<int>(ex) }));
- }
-
- [TestMethod]
- public void FromAsyncPattern7()
- {
- var x = new Result();
-
- Func<int, int, int, int, int, int, int, AsyncCallback, object, IAsyncResult> begin = (a, b, c, d, e, f, g, cb, _) =>
- {
- Assert.AreEqual(a, 2);
- Assert.AreEqual(b, 3);
- Assert.AreEqual(c, 4);
- Assert.AreEqual(d, 5);
- Assert.AreEqual(e, 6);
- Assert.AreEqual(f, 7);
- Assert.AreEqual(g, 8);
- cb(x);
- return x;
- };
- Func<IAsyncResult, int> end = iar => { Assert.AreSame(x, iar); return 1; };
-
- var res = Observable.FromAsyncPattern(begin, end)(2, 3, 4, 5, 6, 7, 8).Materialize().ToEnumerable().ToArray();
- Assert.IsTrue(res.SequenceEqual(new Notification<int>[] { Notification.CreateOnNext<int>(1), Notification.CreateOnCompleted<int>() }));
- }
-
- [TestMethod]
- public void FromAsyncPatternAction7()
- {
- var x = new Result();
-
- Func<int, int, int, int, int, int, int, AsyncCallback, object, IAsyncResult> begin = (a, b, c, d, e, f, g, cb, _) =>
- {
- Assert.AreEqual(a, 2);
- Assert.AreEqual(b, 3);
- Assert.AreEqual(c, 4);
- Assert.AreEqual(d, 5);
- Assert.AreEqual(e, 6);
- Assert.AreEqual(f, 7);
- Assert.AreEqual(g, 8);
- cb(x);
- return x;
- };
- Action<IAsyncResult> end = iar => { Assert.AreSame(x, iar); };
-
- var res = Observable.FromAsyncPattern(begin, end)(2, 3, 4, 5, 6, 7, 8).ToEnumerable().ToArray();
- Assert.IsTrue(res.SequenceEqual(new[] { new Unit() }));
- }
-
- [TestMethod]
- public void FromAsyncPattern7_Error()
- {
- var x = new Result();
- var ex = new Exception();
-
- Func<int, int, int, int, int, int, int, AsyncCallback, object, IAsyncResult> begin = (a, b, c, d, e, f, g, cb, o) => { cb(x); return x; };
- Func<IAsyncResult, int> end = iar => { Assert.AreSame(x, iar); throw ex; };
-
- var res = Observable.FromAsyncPattern(begin, end)(2, 3, 4, 5, 6, 7, 8).Materialize().ToEnumerable().ToArray();
- Assert.IsTrue(res.SequenceEqual(new Notification<int>[] { Notification.CreateOnError<int>(ex) }));
- }
-
- [TestMethod]
- public void FromAsyncPattern7_ErrorBegin()
- {
- var x = new Result();
- var ex = new Exception();
-
- Func<int, int, int, int, int, int, int, AsyncCallback, object, IAsyncResult> begin = (a, b, c, d, e, f, g, cb, o) => { cb(x); throw ex; };
- Func<IAsyncResult, int> end = iar => { Assert.AreSame(x, iar); return 0; };
-
- var res = Observable.FromAsyncPattern(begin, end)(2, 3, 4, 5, 6, 7, 8).Materialize().ToEnumerable().ToArray();
- Assert.IsTrue(res.SequenceEqual(new Notification<int>[] { Notification.CreateOnError<int>(ex) }));
- }
-
- [TestMethod]
- public void FromAsyncPattern8()
- {
- var x = new Result();
-
- Func<int, int, int, int, int, int, int, int, AsyncCallback, object, IAsyncResult> begin = (a, b, c, d, e, f, g, h, cb, _) =>
- {
- Assert.AreEqual(a, 2);
- Assert.AreEqual(b, 3);
- Assert.AreEqual(c, 4);
- Assert.AreEqual(d, 5);
- Assert.AreEqual(e, 6);
- Assert.AreEqual(f, 7);
- Assert.AreEqual(g, 8);
- Assert.AreEqual(h, 9);
- cb(x);
- return x;
- };
- Func<IAsyncResult, int> end = iar => { Assert.AreSame(x, iar); return 1; };
-
- var res = Observable.FromAsyncPattern(begin, end)(2, 3, 4, 5, 6, 7, 8, 9).Materialize().ToEnumerable().ToArray();
- Assert.IsTrue(res.SequenceEqual(new Notification<int>[] { Notification.CreateOnNext<int>(1), Notification.CreateOnCompleted<int>() }));
- }
-
- [TestMethod]
- public void FromAsyncPatternAction8()
- {
- var x = new Result();
-
- Func<int, int, int, int, int, int, int, int, AsyncCallback, object, IAsyncResult> begin = (a, b, c, d, e, f, g, h, cb, _) =>
- {
- Assert.AreEqual(a, 2);
- Assert.AreEqual(b, 3);
- Assert.AreEqual(c, 4);
- Assert.AreEqual(d, 5);
- Assert.AreEqual(e, 6);
- Assert.AreEqual(f, 7);
- Assert.AreEqual(g, 8);
- Assert.AreEqual(h, 9);
- cb(x);
- return x;
- };
- Action<IAsyncResult> end = iar => { Assert.AreSame(x, iar); };
-
- var res = Observable.FromAsyncPattern(begin, end)(2, 3, 4, 5, 6, 7, 8, 9).ToEnumerable().ToArray();
- Assert.IsTrue(res.SequenceEqual(new[] { new Unit() }));
- }
-
- [TestMethod]
- public void FromAsyncPattern8_Error()
- {
- var x = new Result();
- var ex = new Exception();
-
- Func<int, int, int, int, int, int, int, int, AsyncCallback, object, IAsyncResult> begin = (a, b, c, d, e, f, g, h, cb, o) => { cb(x); return x; };
- Func<IAsyncResult, int> end = iar => { Assert.AreSame(x, iar); throw ex; };
-
- var res = Observable.FromAsyncPattern(begin, end)(2, 3, 4, 5, 6, 7, 8, 9).Materialize().ToEnumerable().ToArray();
- Assert.IsTrue(res.SequenceEqual(new Notification<int>[] { Notification.CreateOnError<int>(ex) }));
- }
-
- [TestMethod]
- public void FromAsyncPattern8_ErrorBegin()
- {
- var x = new Result();
- var ex = new Exception();
-
- Func<int, int, int, int, int, int, int, int, AsyncCallback, object, IAsyncResult> begin = (a, b, c, d, e, f, g, h, cb, o) => { cb(x); throw ex; };
- Func<IAsyncResult, int> end = iar => { Assert.AreSame(x, iar); return 0; };
-
- var res = Observable.FromAsyncPattern(begin, end)(2, 3, 4, 5, 6, 7, 8, 9).Materialize().ToEnumerable().ToArray();
- Assert.IsTrue(res.SequenceEqual(new Notification<int>[] { Notification.CreateOnError<int>(ex) }));
- }
-
- [TestMethod]
- public void FromAsyncPattern9()
- {
- var x = new Result();
-
- Func<int, int, int, int, int, int, int, int, int, AsyncCallback, object, IAsyncResult> begin = (a, b, c, d, e, f, g, h, i, cb, _) =>
- {
- Assert.AreEqual(a, 2);
- Assert.AreEqual(b, 3);
- Assert.AreEqual(c, 4);
- Assert.AreEqual(d, 5);
- Assert.AreEqual(e, 6);
- Assert.AreEqual(f, 7);
- Assert.AreEqual(g, 8);
- Assert.AreEqual(h, 9);
- Assert.AreEqual(i, 10);
- cb(x);
- return x;
- };
- Func<IAsyncResult, int> end = iar => { Assert.AreSame(x, iar); return 1; };
-
- var res = Observable.FromAsyncPattern(begin, end)(2, 3, 4, 5, 6, 7, 8, 9, 10).Materialize().ToEnumerable().ToArray();
- Assert.IsTrue(res.SequenceEqual(new Notification<int>[] { Notification.CreateOnNext<int>(1), Notification.CreateOnCompleted<int>() }));
- }
-
- [TestMethod]
- public void FromAsyncPatternAction9()
- {
- var x = new Result();
-
- Func<int, int, int, int, int, int, int, int, int, AsyncCallback, object, IAsyncResult> begin = (a, b, c, d, e, f, g, h, i, cb, _) =>
- {
- Assert.AreEqual(a, 2);
- Assert.AreEqual(b, 3);
- Assert.AreEqual(c, 4);
- Assert.AreEqual(d, 5);
- Assert.AreEqual(e, 6);
- Assert.AreEqual(f, 7);
- Assert.AreEqual(g, 8);
- Assert.AreEqual(h, 9);
- Assert.AreEqual(i, 10);
- cb(x);
- return x;
- };
- Action<IAsyncResult> end = iar => { Assert.AreSame(x, iar); };
-
- var res = Observable.FromAsyncPattern(begin, end)(2, 3, 4, 5, 6, 7, 8, 9, 10).ToEnumerable().ToArray();
- Assert.IsTrue(res.SequenceEqual(new[] { new Unit() }));
- }
-
- [TestMethod]
- public void FromAsyncPattern9_Error()
- {
- var x = new Result();
- var ex = new Exception();
-
- Func<int, int, int, int, int, int, int, int, int, AsyncCallback, object, IAsyncResult> begin = (a, b, c, d, e, f, g, h, i, cb, o) => { cb(x); return x; };
- Func<IAsyncResult, int> end = iar => { Assert.AreSame(x, iar); throw ex; };
-
- var res = Observable.FromAsyncPattern(begin, end)(2, 3, 4, 5, 6, 7, 8, 9, 10).Materialize().ToEnumerable().ToArray();
- Assert.IsTrue(res.SequenceEqual(new Notification<int>[] { Notification.CreateOnError<int>(ex) }));
- }
-
- [TestMethod]
- public void FromAsyncPattern9_ErrorBegin()
- {
- var x = new Result();
- var ex = new Exception();
-
- Func<int, int, int, int, int, int, int, int, int, AsyncCallback, object, IAsyncResult> begin = (a, b, c, d, e, f, g, h, i, cb, o) => { cb(x); throw ex; };
- Func<IAsyncResult, int> end = iar => { Assert.AreSame(x, iar); return 0; };
-
- var res = Observable.FromAsyncPattern(begin, end)(2, 3, 4, 5, 6, 7, 8, 9, 10).Materialize().ToEnumerable().ToArray();
- Assert.IsTrue(res.SequenceEqual(new Notification<int>[] { Notification.CreateOnError<int>(ex) }));
- }
-
- [TestMethod]
- public void FromAsyncPattern10()
- {
- var x = new Result();
-
- Func<int, int, int, int, int, int, int, int, int, int, AsyncCallback, object, IAsyncResult> begin = (a, b, c, d, e, f, g, h, i, j, cb, _) =>
- {
- Assert.AreEqual(a, 2);
- Assert.AreEqual(b, 3);
- Assert.AreEqual(c, 4);
- Assert.AreEqual(d, 5);
- Assert.AreEqual(e, 6);
- Assert.AreEqual(f, 7);
- Assert.AreEqual(g, 8);
- Assert.AreEqual(h, 9);
- Assert.AreEqual(i, 10);
- Assert.AreEqual(j, 11);
- cb(x);
- return x;
- };
- Func<IAsyncResult, int> end = iar => { Assert.AreSame(x, iar); return 1; };
-
- var res = Observable.FromAsyncPattern(begin, end)(2, 3, 4, 5, 6, 7, 8, 9, 10, 11).Materialize().ToEnumerable().ToArray();
- Assert.IsTrue(res.SequenceEqual(new Notification<int>[] { Notification.CreateOnNext<int>(1), Notification.CreateOnCompleted<int>() }));
- }
-
- [TestMethod]
- public void FromAsyncPatternAction10()
- {
- var x = new Result();
-
- Func<int, int, int, int, int, int, int, int, int, int, AsyncCallback, object, IAsyncResult> begin = (a, b, c, d, e, f, g, h, i, j, cb, _) =>
- {
- Assert.AreEqual(a, 2);
- Assert.AreEqual(b, 3);
- Assert.AreEqual(c, 4);
- Assert.AreEqual(d, 5);
- Assert.AreEqual(e, 6);
- Assert.AreEqual(f, 7);
- Assert.AreEqual(g, 8);
- Assert.AreEqual(h, 9);
- Assert.AreEqual(i, 10);
- Assert.AreEqual(j, 11);
- cb(x);
- return x;
- };
- Action<IAsyncResult> end = iar => { Assert.AreSame(x, iar); };
-
- var res = Observable.FromAsyncPattern(begin, end)(2, 3, 4, 5, 6, 7, 8, 9, 10, 11).ToEnumerable().ToArray();
- Assert.IsTrue(res.SequenceEqual(new[] { new Unit() }));
- }
-
- [TestMethod]
- public void FromAsyncPattern10_Error()
- {
- var x = new Result();
- var ex = new Exception();
-
- Func<int, int, int, int, int, int, int, int, int, int, AsyncCallback, object, IAsyncResult> begin = (a, b, c, d, e, f, g, h, i, j, cb, o) => { cb(x); return x; };
- Func<IAsyncResult, int> end = iar => { Assert.AreSame(x, iar); throw ex; };
-
- var res = Observable.FromAsyncPattern(begin, end)(2, 3, 4, 5, 6, 7, 8, 9, 10, 11).Materialize().ToEnumerable().ToArray();
- Assert.IsTrue(res.SequenceEqual(new Notification<int>[] { Notification.CreateOnError<int>(ex) }));
- }
-
- [TestMethod]
- public void FromAsyncPattern10_ErrorBegin()
- {
- var x = new Result();
- var ex = new Exception();
-
- Func<int, int, int, int, int, int, int, int, int, int, AsyncCallback, object, IAsyncResult> begin = (a, b, c, d, e, f, g, h, i, j, cb, o) => { cb(x); throw ex; };
- Func<IAsyncResult, int> end = iar => { Assert.AreSame(x, iar); return 0; };
-
- var res = Observable.FromAsyncPattern(begin, end)(2, 3, 4, 5, 6, 7, 8, 9, 10, 11).Materialize().ToEnumerable().ToArray();
- Assert.IsTrue(res.SequenceEqual(new Notification<int>[] { Notification.CreateOnError<int>(ex) }));
- }
-
- [TestMethod]
- public void FromAsyncPattern11()
- {
- var x = new Result();
-
- Func<int, int, int, int, int, int, int, int, int, int, int, AsyncCallback, object, IAsyncResult> begin = (a, b, c, d, e, f, g, h, i, j, k, cb, _) =>
- {
- Assert.AreEqual(a, 2);
- Assert.AreEqual(b, 3);
- Assert.AreEqual(c, 4);
- Assert.AreEqual(d, 5);
- Assert.AreEqual(e, 6);
- Assert.AreEqual(f, 7);
- Assert.AreEqual(g, 8);
- Assert.AreEqual(h, 9);
- Assert.AreEqual(i, 10);
- Assert.AreEqual(j, 11);
- Assert.AreEqual(k, 12);
- cb(x);
- return x;
- };
- Func<IAsyncResult, int> end = iar => { Assert.AreSame(x, iar); return 1; };
-
- var res = Observable.FromAsyncPattern(begin, end)(2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12).Materialize().ToEnumerable().ToArray();
- Assert.IsTrue(res.SequenceEqual(new Notification<int>[] { Notification.CreateOnNext<int>(1), Notification.CreateOnCompleted<int>() }));
- }
-
- [TestMethod]
- public void FromAsyncPatternAction11()
- {
- var x = new Result();
-
- Func<int, int, int, int, int, int, int, int, int, int, int, AsyncCallback, object, IAsyncResult> begin = (a, b, c, d, e, f, g, h, i, j, k, cb, _) =>
- {
- Assert.AreEqual(a, 2);
- Assert.AreEqual(b, 3);
- Assert.AreEqual(c, 4);
- Assert.AreEqual(d, 5);
- Assert.AreEqual(e, 6);
- Assert.AreEqual(f, 7);
- Assert.AreEqual(g, 8);
- Assert.AreEqual(h, 9);
- Assert.AreEqual(i, 10);
- Assert.AreEqual(j, 11);
- Assert.AreEqual(k, 12);
- cb(x);
- return x;
- };
- Action<IAsyncResult> end = iar => { Assert.AreSame(x, iar); };
-
- var res = Observable.FromAsyncPattern(begin, end)(2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12).ToEnumerable().ToArray();
- Assert.IsTrue(res.SequenceEqual(new[] { new Unit() }));
- }
-
- [TestMethod]
- public void FromAsyncPattern11_Error()
- {
- var x = new Result();
- var ex = new Exception();
-
- Func<int, int, int, int, int, int, int, int, int, int, int, AsyncCallback, object, IAsyncResult> begin = (a, b, c, d, e, f, g, h, i, j, k, cb, o) => { cb(x); return x; };
- Func<IAsyncResult, int> end = iar => { Assert.AreSame(x, iar); throw ex; };
-
- var res = Observable.FromAsyncPattern(begin, end)(2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12).Materialize().ToEnumerable().ToArray();
- Assert.IsTrue(res.SequenceEqual(new Notification<int>[] { Notification.CreateOnError<int>(ex) }));
- }
-
- [TestMethod]
- public void FromAsyncPattern11_ErrorBegin()
- {
- var x = new Result();
- var ex = new Exception();
-
- Func<int, int, int, int, int, int, int, int, int, int, int, AsyncCallback, object, IAsyncResult> begin = (a, b, c, d, e, f, g, h, i, j, k, cb, o) => { cb(x); throw ex; };
- Func<IAsyncResult, int> end = iar => { Assert.AreSame(x, iar); return 0; };
-
- var res = Observable.FromAsyncPattern(begin, end)(2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12).Materialize().ToEnumerable().ToArray();
- Assert.IsTrue(res.SequenceEqual(new Notification<int>[] { Notification.CreateOnError<int>(ex) }));
- }
-
- [TestMethod]
- public void FromAsyncPattern12()
- {
- var x = new Result();
-
- Func<int, int, int, int, int, int, int, int, int, int, int, int, AsyncCallback, object, IAsyncResult> begin = (a, b, c, d, e, f, g, h, i, j, k, l, cb, _) =>
- {
- Assert.AreEqual(a, 2);
- Assert.AreEqual(b, 3);
- Assert.AreEqual(c, 4);
- Assert.AreEqual(d, 5);
- Assert.AreEqual(e, 6);
- Assert.AreEqual(f, 7);
- Assert.AreEqual(g, 8);
- Assert.AreEqual(h, 9);
- Assert.AreEqual(i, 10);
- Assert.AreEqual(j, 11);
- Assert.AreEqual(k, 12);
- Assert.AreEqual(l, 13);
- cb(x);
- return x;
- };
- Func<IAsyncResult, int> end = iar => { Assert.AreSame(x, iar); return 1; };
-
- var res = Observable.FromAsyncPattern(begin, end)(2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13).Materialize().ToEnumerable().ToArray();
- Assert.IsTrue(res.SequenceEqual(new Notification<int>[] { Notification.CreateOnNext<int>(1), Notification.CreateOnCompleted<int>() }));
- }
-
- [TestMethod]
- public void FromAsyncPatternAction12()
- {
- var x = new Result();
-
- Func<int, int, int, int, int, int, int, int, int, int, int, int, AsyncCallback, object, IAsyncResult> begin = (a, b, c, d, e, f, g, h, i, j, k, l, cb, _) =>
- {
- Assert.AreEqual(a, 2);
- Assert.AreEqual(b, 3);
- Assert.AreEqual(c, 4);
- Assert.AreEqual(d, 5);
- Assert.AreEqual(e, 6);
- Assert.AreEqual(f, 7);
- Assert.AreEqual(g, 8);
- Assert.AreEqual(h, 9);
- Assert.AreEqual(i, 10);
- Assert.AreEqual(j, 11);
- Assert.AreEqual(k, 12);
- Assert.AreEqual(l, 13);
- cb(x);
- return x;
- };
- Action<IAsyncResult> end = iar => { Assert.AreSame(x, iar); };
-
- var res = Observable.FromAsyncPattern(begin, end)(2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13).ToEnumerable().ToArray();
- Assert.IsTrue(res.SequenceEqual(new[] { new Unit() }));
- }
-
- [TestMethod]
- public void FromAsyncPattern12_Error()
- {
- var x = new Result();
- var ex = new Exception();
-
- Func<int, int, int, int, int, int, int, int, int, int, int, int, AsyncCallback, object, IAsyncResult> begin = (a, b, c, d, e, f, g, h, i, j, k, l, cb, o) => { cb(x); return x; };
- Func<IAsyncResult, int> end = iar => { Assert.AreSame(x, iar); throw ex; };
-
- var res = Observable.FromAsyncPattern(begin, end)(2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13).Materialize().ToEnumerable().ToArray();
- Assert.IsTrue(res.SequenceEqual(new Notification<int>[] { Notification.CreateOnError<int>(ex) }));
- }
-
- [TestMethod]
- public void FromAsyncPattern12_ErrorBegin()
- {
- var x = new Result();
- var ex = new Exception();
-
- Func<int, int, int, int, int, int, int, int, int, int, int, int, AsyncCallback, object, IAsyncResult> begin = (a, b, c, d, e, f, g, h, i, j, k, l, cb, o) => { cb(x); throw ex; };
- Func<IAsyncResult, int> end = iar => { Assert.AreSame(x, iar); return 0; };
-
- var res = Observable.FromAsyncPattern(begin, end)(2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13).Materialize().ToEnumerable().ToArray();
- Assert.IsTrue(res.SequenceEqual(new Notification<int>[] { Notification.CreateOnError<int>(ex) }));
- }
-
- [TestMethod]
- public void FromAsyncPattern13()
- {
- var x = new Result();
-
- Func<int, int, int, int, int, int, int, int, int, int, int, int, int, AsyncCallback, object, IAsyncResult> begin = (a, b, c, d, e, f, g, h, i, j, k, l, m, cb, _) =>
- {
- Assert.AreEqual(a, 2);
- Assert.AreEqual(b, 3);
- Assert.AreEqual(c, 4);
- Assert.AreEqual(d, 5);
- Assert.AreEqual(e, 6);
- Assert.AreEqual(f, 7);
- Assert.AreEqual(g, 8);
- Assert.AreEqual(h, 9);
- Assert.AreEqual(i, 10);
- Assert.AreEqual(j, 11);
- Assert.AreEqual(k, 12);
- Assert.AreEqual(l, 13);
- Assert.AreEqual(m, 14);
- cb(x);
- return x;
- };
- Func<IAsyncResult, int> end = iar => { Assert.AreSame(x, iar); return 1; };
-
- var res = Observable.FromAsyncPattern(begin, end)(2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14).Materialize().ToEnumerable().ToArray();
- Assert.IsTrue(res.SequenceEqual(new Notification<int>[] { Notification.CreateOnNext<int>(1), Notification.CreateOnCompleted<int>() }));
- }
-
- [TestMethod]
- public void FromAsyncPatternAction13()
- {
- var x = new Result();
-
- Func<int, int, int, int, int, int, int, int, int, int, int, int, int, AsyncCallback, object, IAsyncResult> begin = (a, b, c, d, e, f, g, h, i, j, k, l, m, cb, _) =>
- {
- Assert.AreEqual(a, 2);
- Assert.AreEqual(b, 3);
- Assert.AreEqual(c, 4);
- Assert.AreEqual(d, 5);
- Assert.AreEqual(e, 6);
- Assert.AreEqual(f, 7);
- Assert.AreEqual(g, 8);
- Assert.AreEqual(h, 9);
- Assert.AreEqual(i, 10);
- Assert.AreEqual(j, 11);
- Assert.AreEqual(k, 12);
- Assert.AreEqual(l, 13);
- Assert.AreEqual(m, 14);
- cb(x);
- return x;
- };
- Action<IAsyncResult> end = iar => { Assert.AreSame(x, iar); };
-
- var res = Observable.FromAsyncPattern(begin, end)(2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14).ToEnumerable().ToArray();
- Assert.IsTrue(res.SequenceEqual(new[] { new Unit() }));
- }
-
- [TestMethod]
- public void FromAsyncPattern13_Error()
- {
- var x = new Result();
- var ex = new Exception();
-
- Func<int, int, int, int, int, int, int, int, int, int, int, int, int, AsyncCallback, object, IAsyncResult> begin = (a, b, c, d, e, f, g, h, i, j, k, l, m, cb, o) => { cb(x); return x; };
- Func<IAsyncResult, int> end = iar => { Assert.AreSame(x, iar); throw ex; };
-
- var res = Observable.FromAsyncPattern(begin, end)(2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14).Materialize().ToEnumerable().ToArray();
- Assert.IsTrue(res.SequenceEqual(new Notification<int>[] { Notification.CreateOnError<int>(ex) }));
- }
-
- [TestMethod]
- public void FromAsyncPattern13_ErrorBegin()
- {
- var x = new Result();
- var ex = new Exception();
-
- Func<int, int, int, int, int, int, int, int, int, int, int, int, int, AsyncCallback, object, IAsyncResult> begin = (a, b, c, d, e, f, g, h, i, j, k, l, m, cb, o) => { cb(x); throw ex; };
- Func<IAsyncResult, int> end = iar => { Assert.AreSame(x, iar); return 0; };
-
- var res = Observable.FromAsyncPattern(begin, end)(2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14).Materialize().ToEnumerable().ToArray();
- Assert.IsTrue(res.SequenceEqual(new Notification<int>[] { Notification.CreateOnError<int>(ex) }));
- }
-
- [TestMethod]
- public void FromAsyncPattern14()
- {
- var x = new Result();
-
- Func<int, int, int, int, int, int, int, int, int, int, int, int, int, int, AsyncCallback, object, IAsyncResult> begin = (a, b, c, d, e, f, g, h, i, j, k, l, m, n, cb, _) =>
- {
- Assert.AreEqual(a, 2);
- Assert.AreEqual(b, 3);
- Assert.AreEqual(c, 4);
- Assert.AreEqual(d, 5);
- Assert.AreEqual(e, 6);
- Assert.AreEqual(f, 7);
- Assert.AreEqual(g, 8);
- Assert.AreEqual(h, 9);
- Assert.AreEqual(i, 10);
- Assert.AreEqual(j, 11);
- Assert.AreEqual(k, 12);
- Assert.AreEqual(l, 13);
- Assert.AreEqual(m, 14);
- Assert.AreEqual(n, 15);
- cb(x);
- return x;
- };
- Func<IAsyncResult, int> end = iar => { Assert.AreSame(x, iar); return 1; };
-
- var res = Observable.FromAsyncPattern(begin, end)(2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15).Materialize().ToEnumerable().ToArray();
- Assert.IsTrue(res.SequenceEqual(new Notification<int>[] { Notification.CreateOnNext<int>(1), Notification.CreateOnCompleted<int>() }));
- }
-
- [TestMethod]
- public void FromAsyncPatternAction14()
- {
- var x = new Result();
-
- Func<int, int, int, int, int, int, int, int, int, int, int, int, int, int, AsyncCallback, object, IAsyncResult> begin = (a, b, c, d, e, f, g, h, i, j, k, l, m, n, cb, _) =>
- {
- Assert.AreEqual(a, 2);
- Assert.AreEqual(b, 3);
- Assert.AreEqual(c, 4);
- Assert.AreEqual(d, 5);
- Assert.AreEqual(e, 6);
- Assert.AreEqual(f, 7);
- Assert.AreEqual(g, 8);
- Assert.AreEqual(h, 9);
- Assert.AreEqual(i, 10);
- Assert.AreEqual(j, 11);
- Assert.AreEqual(k, 12);
- Assert.AreEqual(l, 13);
- Assert.AreEqual(m, 14);
- Assert.AreEqual(n, 15);
- cb(x);
- return x;
- };
- Action<IAsyncResult> end = iar => { Assert.AreSame(x, iar); };
-
- var res = Observable.FromAsyncPattern(begin, end)(2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15).ToEnumerable().ToArray();
- Assert.IsTrue(res.SequenceEqual(new[] { new Unit() }));
- }
-
- [TestMethod]
- public void FromAsyncPattern14_Error()
- {
- var x = new Result();
- var ex = new Exception();
-
- Func<int, int, int, int, int, int, int, int, int, int, int, int, int, int, AsyncCallback, object, IAsyncResult> begin = (a, b, c, d, e, f, g, h, i, j, k, l, m, n, cb, o) => { cb(x); return x; };
- Func<IAsyncResult, int> end = iar => { Assert.AreSame(x, iar); throw ex; };
-
- var res = Observable.FromAsyncPattern(begin, end)(2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15).Materialize().ToEnumerable().ToArray();
- Assert.IsTrue(res.SequenceEqual(new Notification<int>[] { Notification.CreateOnError<int>(ex) }));
- }
-
- [TestMethod]
- public void FromAsyncPattern14_ErrorBegin()
- {
- var x = new Result();
- var ex = new Exception();
-
- Func<int, int, int, int, int, int, int, int, int, int, int, int, int, int, AsyncCallback, object, IAsyncResult> begin = (a, b, c, d, e, f, g, h, i, j, k, l, m, n, cb, o) => { cb(x); throw ex; };
- Func<IAsyncResult, int> end = iar => { Assert.AreSame(x, iar); return 0; };
-
- var res = Observable.FromAsyncPattern(begin, end)(2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15).Materialize().ToEnumerable().ToArray();
- Assert.IsTrue(res.SequenceEqual(new Notification<int>[] { Notification.CreateOnError<int>(ex) }));
- }
-
-#endif
- class Result : IAsyncResult
- {
- public object AsyncState
- {
- get { throw new NotImplementedException(); }
- }
-
- public System.Threading.WaitHandle AsyncWaitHandle
- {
- get { throw new NotImplementedException(); }
- }
-
- public bool CompletedSynchronously
- {
- get { throw new NotImplementedException(); }
- }
-
- public bool IsCompleted
- {
- get { throw new NotImplementedException(); }
- }
- }
-
- #endregion
-
- #region Start
-
- [TestMethod]
- public void Start_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Start(null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Start<int>((Func<int>)null));
-
- var someScheduler = new TestScheduler();
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Start(null, someScheduler));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Start<int>(null, someScheduler));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Start(() => { }, null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Start<int>(() => 1, null));
- }
-
-
- [TestMethod]
- public void Start_Action()
- {
- bool done = false;
- Assert.IsTrue(Observable.Start(() => { done = true; }).ToEnumerable().SequenceEqual(new[] { new Unit() }));
- Assert.IsTrue(done, "done");
- }
-
- [TestMethod]
- public void Start_Action2()
- {
- var scheduler = new TestScheduler();
-
- bool done = false;
-
- var res = scheduler.Start(() =>
- Observable.Start(() => { done = true; }, scheduler)
- );
-
- res.Messages.AssertEqual(
- OnNext(200, new Unit()),
- OnCompleted<Unit>(200)
- );
-
- Assert.IsTrue(done, "done");
- }
-
- [TestMethod]
- public void Start_ActionError()
- {
- var ex = new Exception();
-
- var res = Observable.Start(() => { throw ex; }).Materialize().ToEnumerable();
-
- Assert.IsTrue(res.SequenceEqual(new[] {
- Notification.CreateOnError<Unit>(ex)
- }));
- }
-
- [TestMethod]
- public void Start_Func()
- {
- var res = Observable.Start(() => 1).ToEnumerable();
-
- Assert.IsTrue(res.SequenceEqual(new[] {
- 1
- }));
- }
-
- [TestMethod]
- public void Start_Func2()
- {
- var scheduler = new TestScheduler();
-
- var res = scheduler.Start(() =>
- Observable.Start(() => 1, scheduler)
- );
-
- res.Messages.AssertEqual(
- OnNext(200, 1),
- OnCompleted<int>(200)
- );
- }
-
- [TestMethod]
- public void Start_FuncError()
- {
- var ex = new Exception();
-
- var res = Observable.Start<int>(() => { throw ex; }).Materialize().ToEnumerable();
-
- Assert.IsTrue(res.SequenceEqual(new[] {
- Notification.CreateOnError<int>(ex)
- }));
- }
-
- #endregion
-
- #region StartAsync
-
-#if !NO_TPL
-
- #region Func
-
- [TestMethod]
- public void StartAsync_Func_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.StartAsync<int>(default(Func<Task<int>>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.StartAsync<int>(default(Func<CancellationToken, Task<int>>)));
- }
-
- [TestMethod]
- public void StartAsync_Func_Success()
- {
- var n = 42;
-
- var i = 0;
-
- var xs = Observable.StartAsync(() =>
- {
- i++;
- return Task.Factory.StartNew(() => n);
- });
-
- Assert.AreEqual(n, xs.Single());
- Assert.AreEqual(1, i);
-
- Assert.AreEqual(n, xs.Single());
- Assert.AreEqual(1, i);
- }
-
- [TestMethod]
- public void StartAsync_Func_Throw_Synchronous()
- {
- var ex = new Exception();
-
- var xs = Observable.StartAsync<int>(() =>
- {
- throw ex;
- });
-
- ReactiveAssert.Throws(ex, () => xs.Single());
- }
-
- [TestMethod]
- public void StartAsync_Func_Throw_Asynchronous()
- {
- var ex = new Exception();
-
- var xs = Observable.StartAsync<int>(() =>
- Task.Factory.StartNew<int>(() =>
- {
- throw ex;
- })
- );
-
- ReactiveAssert.Throws(ex, () => xs.Single());
- }
-
- [TestMethod]
- public void StartAsync_FuncWithCancel_Success()
- {
- var n = 42;
-
- var i = 0;
- var xs = Observable.StartAsync(ct =>
- {
- i++;
- return Task.Factory.StartNew(() => n);
- });
-
- Assert.AreEqual(n, xs.Single());
- Assert.AreEqual(1, i);
-
- Assert.AreEqual(n, xs.Single());
- Assert.AreEqual(1, i);
- }
-
- [TestMethod]
- public void StartAsync_FuncWithCancel_Throw_Synchronous()
- {
- var ex = new Exception();
-
- var xs = Observable.StartAsync<int>(ct =>
- {
- throw ex;
- });
-
- ReactiveAssert.Throws(ex, () => xs.Single());
- }
-
- [TestMethod]
- public void StartAsync_FuncWithCancel_Throw_Asynchronous()
- {
- var ex = new Exception();
-
- var xs = Observable.StartAsync<int>(ct =>
- Task.Factory.StartNew<int>(() => { throw ex; })
- );
-
- ReactiveAssert.Throws(ex, () => xs.Single());
- }
-
- [TestMethod]
- public void StartAsync_FuncWithCancel_Cancel()
- {
- var N = 10;
-
- for (int n = 0; n < N; n++)
- {
- var e = new ManualResetEvent(false);
- var f = new ManualResetEvent(false);
-
- var t = default(Task<int>);
- var xs = Observable.StartAsync(ct =>
- t = Task.Factory.StartNew<int>(() =>
- {
- try
- {
- e.Set();
- while (true)
- ct.ThrowIfCancellationRequested();
- }
- finally
- {
- f.Set();
- }
- })
- );
-
- e.WaitOne();
-
- var d = xs.Subscribe(_ => { });
- d.Dispose();
-
- f.WaitOne();
- while (!t.IsCompleted)
- ;
-
- ReactiveAssert.Throws<OperationCanceledException>(() => xs.Single());
- }
- }
-
- #endregion
-
- #region Action
-
- [TestMethod]
- public void StartAsync_Action_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.StartAsync(default(Func<Task>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.StartAsync(default(Func<CancellationToken, Task>)));
- }
-
- [TestMethod]
- public void StartAsync_Action_Success()
- {
- var i = 0;
- var xs = Observable.StartAsync(() =>
- {
- i++;
- return Task.Factory.StartNew(() => { });
- });
-
- Assert.AreEqual(Unit.Default, xs.Single());
- Assert.AreEqual(1, i);
-
- Assert.AreEqual(Unit.Default, xs.Single());
- Assert.AreEqual(1, i);
- }
-
- [TestMethod]
- public void StartAsync_Action_Throw_Synchronous()
- {
- var ex = new Exception();
-
- var xs = Observable.StartAsync(() =>
- {
- throw ex;
- });
-
- ReactiveAssert.Throws(ex, () => xs.Single());
- }
-
- [TestMethod]
- public void StartAsync_Action_Throw_Asynchronous()
- {
- var ex = new Exception();
-
- var xs = Observable.StartAsync(() =>
- Task.Factory.StartNew(() => { throw ex; })
- );
-
- ReactiveAssert.Throws(ex, () => xs.Single());
- }
-
- [TestMethod]
- public void StartAsync_ActionWithCancel_Success()
- {
- var i = 0;
- var xs = Observable.StartAsync(ct =>
- {
- i++;
- return Task.Factory.StartNew(() => { });
- });
-
- Assert.AreEqual(Unit.Default, xs.Single());
- Assert.AreEqual(1, i);
-
- Assert.AreEqual(Unit.Default, xs.Single());
- Assert.AreEqual(1, i);
- }
-
- [TestMethod]
- public void StartAsync_ActionWithCancel_Throw_Synchronous()
- {
- var ex = new Exception();
-
- var xs = Observable.StartAsync(ct =>
- {
- throw ex;
- });
-
- ReactiveAssert.Throws(ex, () => xs.Single());
- }
-
- [TestMethod]
- public void StartAsync_ActionWithCancel_Throw_Asynchronous()
- {
- var ex = new Exception();
-
- var xs = Observable.StartAsync(ct =>
- Task.Factory.StartNew(() => { throw ex; })
- );
-
- ReactiveAssert.Throws(ex, () => xs.Single());
- }
-
- [TestMethod]
- public void StartAsync_ActionWithCancel_Cancel()
- {
- var N = 10;
-
- for (int n = 0; n < N; n++)
- {
- var e = new ManualResetEvent(false);
- var f = new ManualResetEvent(false);
-
- var t = default(Task);
- var xs = Observable.StartAsync(ct =>
- t = Task.Factory.StartNew(() =>
- {
- try
- {
- e.Set();
- while (true)
- ct.ThrowIfCancellationRequested();
- }
- finally
- {
- f.Set();
- }
- })
- );
-
- e.WaitOne();
-
- var d = xs.Subscribe(_ => { });
- d.Dispose();
-
- f.WaitOne();
- while (!t.IsCompleted)
- ;
-
- ReactiveAssert.Throws<OperationCanceledException>(() => xs.Single());
- }
- }
-
- #endregion
-
-#endif
-
- #endregion
-
- #region FromAsync
-
-#if !NO_TPL
-
- #region Func
-
- [TestMethod]
- public void FromAsync_Func_Success()
- {
- var n = 42;
-
- var i = 0;
- var xs = Observable.FromAsync(() =>
- {
- i++;
- return Task.Factory.StartNew(() => n);
- });
-
- Assert.AreEqual(n, xs.Single());
- Assert.AreEqual(1, i);
-
- Assert.AreEqual(n, xs.Single());
- Assert.AreEqual(2, i);
- }
-
- [TestMethod]
- public void FromAsync_Func_Throw_Synchronous()
- {
- var ex = new Exception();
-
- var xs = Observable.FromAsync<int>(() =>
- {
- throw ex;
- });
-
- ReactiveAssert.Throws(ex, () => xs.Single());
- }
-
- [TestMethod]
- public void FromAsync_Func_Throw_Asynchronous()
- {
- var ex = new Exception();
-
- var xs = Observable.FromAsync<int>(() =>
- Task.Factory.StartNew<int>(() => { throw ex; })
- );
-
- ReactiveAssert.Throws(ex, () => xs.Single());
- }
-
- [TestMethod]
- public void FromAsync_FuncWithCancel_Success()
- {
- var n = 42;
-
- var i = 0;
- var xs = Observable.FromAsync(ct =>
- {
- i++;
- return Task.Factory.StartNew(() => n);
- });
-
- Assert.AreEqual(n, xs.Single());
- Assert.AreEqual(1, i);
-
- Assert.AreEqual(n, xs.Single());
- Assert.AreEqual(2, i);
- }
-
- [TestMethod]
- public void FromAsync_FuncWithCancel_Throw_Synchronous()
- {
- var ex = new Exception();
-
- var xs = Observable.FromAsync<int>(ct =>
- {
- throw ex;
- });
-
- ReactiveAssert.Throws(ex, () => xs.Single());
- }
-
- [TestMethod]
- public void FromAsync_FuncWithCancel_Throw_Asynchronous()
- {
- var ex = new Exception();
-
- var xs = Observable.FromAsync<int>(ct =>
- Task.Factory.StartNew<int>(() => { throw ex; })
- );
-
- ReactiveAssert.Throws(ex, () => xs.Single());
- }
-
- [TestMethod]
- public void FromAsync_FuncWithCancel_Cancel()
- {
- var e = new ManualResetEvent(false);
- var f = new ManualResetEvent(false);
-
- var t = default(Task<int>);
- var xs = Observable.FromAsync(ct =>
- t = Task.Factory.StartNew<int>(() =>
- {
- try
- {
- e.Set();
- while (true)
- ct.ThrowIfCancellationRequested();
- }
- finally
- {
- f.Set();
- }
- })
- );
-
- var d = xs.Subscribe(_ => { });
- e.WaitOne();
- d.Dispose();
-
- f.WaitOne();
- while (!t.IsCompleted)
- ;
- }
-
- #endregion
-
- #region Action
-
- [TestMethod]
- public void FromAsync_Action_Success()
- {
- var i = 0;
- var xs = Observable.FromAsync(() =>
- {
- i++;
- return Task.Factory.StartNew(() => { });
- });
-
- Assert.AreEqual(Unit.Default, xs.Single());
- Assert.AreEqual(1, i);
-
- Assert.AreEqual(Unit.Default, xs.Single());
- Assert.AreEqual(2, i);
- }
-
- [TestMethod]
- public void FromAsync_Action_Throw_Synchronous()
- {
- var ex = new Exception();
-
- var xs = Observable.FromAsync(() =>
- {
- throw ex;
- });
-
- ReactiveAssert.Throws(ex, () => xs.Single());
- }
-
- [TestMethod]
- public void FromAsync_Action_Throw_Asynchronous()
- {
- var ex = new Exception();
-
- var xs = Observable.FromAsync(() =>
- Task.Factory.StartNew(() => { throw ex; })
- );
-
- ReactiveAssert.Throws(ex, () => xs.Single());
- }
-
- [TestMethod]
- public void FromAsync_ActionWithCancel_Success()
- {
- var i = 0;
- var xs = Observable.FromAsync(ct =>
- {
- i++;
- return Task.Factory.StartNew(() => { });
- });
-
- Assert.AreEqual(Unit.Default, xs.Single());
- Assert.AreEqual(1, i);
-
- Assert.AreEqual(Unit.Default, xs.Single());
- Assert.AreEqual(2, i);
- }
-
- [TestMethod]
- public void FromAsync_ActionWithCancel_Throw_Synchronous()
- {
- var ex = new Exception();
-
- var xs = Observable.FromAsync(ct =>
- {
- throw ex;
- });
-
- ReactiveAssert.Throws(ex, () => xs.Single());
- }
-
- [TestMethod]
- public void FromAsync_ActionWithCancel_Throw_Asynchronous()
- {
- var ex = new Exception();
-
- var xs = Observable.FromAsync(ct =>
- Task.Factory.StartNew(() => { throw ex; })
- );
-
- ReactiveAssert.Throws(ex, () => xs.Single());
- }
-
- [TestMethod]
- public void FromAsync_ActionWithCancel_Cancel()
- {
- var e = new ManualResetEvent(false);
- var f = new ManualResetEvent(false);
-
- var t = default(Task);
- var xs = Observable.FromAsync(ct =>
- t = Task.Factory.StartNew(() =>
- {
- try
- {
- e.Set();
- while (true)
- ct.ThrowIfCancellationRequested();
- }
- finally
- {
- f.Set();
- }
- })
- );
-
- var d = xs.Subscribe(_ => { });
- e.WaitOne();
- d.Dispose();
-
- f.WaitOne();
- while (!t.IsCompleted)
- ;
- }
-
- #endregion
-
-#endif
-
- #endregion
-
- #region ToAsync
-
- [TestMethod]
- public void ToAsync_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync(default(Action)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int>(default(Action<int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int>(default(Func<int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int>(default(Action<int, int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int>(default(Func<int, int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int>(default(Action<int, int, int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int>(default(Func<int, int, int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int>(default(Action<int, int, int, int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int>(default(Func<int, int, int, int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int>(default(Func<int, int, int, int, int>)));
-#if !NO_LARGEARITY
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int>(default(Action<int, int, int, int, int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int>(default(Action<int, int, int, int, int, int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int>(default(Func<int, int, int, int, int, int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int>(default(Action<int, int, int, int, int, int, int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int>(default(Func<int, int, int, int, int, int, int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int, int>(default(Action<int, int, int, int, int, int, int, int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int, int>(default(Func<int, int, int, int, int, int, int, int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int, int, int>(default(Action<int, int, int, int, int, int, int, int, int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int, int, int>(default(Func<int, int, int, int, int, int, int, int, int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int, int, int, int>(default(Action<int, int, int, int, int, int, int, int, int, int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int, int, int, int>(default(Func<int, int, int, int, int, int, int, int, int, int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int>(default(Action<int, int, int, int, int, int, int, int, int, int, int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int>(default(Func<int, int, int, int, int, int, int, int, int, int, int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int>(default(Action<int, int, int, int, int, int, int, int, int, int, int, int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int>(default(Func<int, int, int, int, int, int, int, int, int, int, int, int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int, int>(default(Action<int, int, int, int, int, int, int, int, int, int, int, int, int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int, int>(default(Func<int, int, int, int, int, int, int, int, int, int, int, int, int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int, int, int>(default(Action<int, int, int, int, int, int, int, int, int, int, int, int, int, int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int, int, int>(default(Func<int, int, int, int, int, int, int, int, int, int, int, int, int, int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int, int, int, int>(default(Action<int, int, int, int, int, int, int, int, int, int, int, int, int, int, int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int, int, int, int>(default(Func<int, int, int, int, int, int, int, int, int, int, int, int, int, int, int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int>(default(Action<int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int>(default(Func<int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int>(default(Func<int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int>)));
-#endif
- var someScheduler = new TestScheduler();
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync(default(Action), someScheduler));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int>(default(Action<int>), someScheduler));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int>(default(Func<int>), someScheduler));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int>(default(Action<int, int>), someScheduler));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int>(default(Func<int, int>), someScheduler));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int>(default(Action<int, int, int>), someScheduler));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int>(default(Func<int, int, int>), someScheduler));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int>(default(Action<int, int, int, int>), someScheduler));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int>(default(Func<int, int, int, int>), someScheduler));
-#if !NO_LARGEARITY
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int>(default(Func<int, int, int, int, int>), someScheduler));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int>(default(Action<int, int, int, int, int>), someScheduler));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int>(default(Action<int, int, int, int, int, int>), someScheduler));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int>(default(Func<int, int, int, int, int, int>), someScheduler));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int>(default(Action<int, int, int, int, int, int, int>), someScheduler));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int>(default(Func<int, int, int, int, int, int, int>), someScheduler));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int, int>(default(Action<int, int, int, int, int, int, int, int>), someScheduler));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int, int>(default(Func<int, int, int, int, int, int, int, int>), someScheduler));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int, int, int>(default(Action<int, int, int, int, int, int, int, int, int>), someScheduler));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int, int, int>(default(Func<int, int, int, int, int, int, int, int, int>), someScheduler));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int, int, int, int>(default(Action<int, int, int, int, int, int, int, int, int, int>), someScheduler));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int, int, int, int>(default(Func<int, int, int, int, int, int, int, int, int, int>), someScheduler));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int>(default(Action<int, int, int, int, int, int, int, int, int, int, int>), someScheduler));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int>(default(Func<int, int, int, int, int, int, int, int, int, int, int>), someScheduler));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int>(default(Action<int, int, int, int, int, int, int, int, int, int, int, int>), someScheduler));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int>(default(Func<int, int, int, int, int, int, int, int, int, int, int, int>), someScheduler));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int, int>(default(Action<int, int, int, int, int, int, int, int, int, int, int, int, int>), someScheduler));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int, int>(default(Func<int, int, int, int, int, int, int, int, int, int, int, int, int>), someScheduler));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int, int, int>(default(Action<int, int, int, int, int, int, int, int, int, int, int, int, int, int>), someScheduler));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int, int, int>(default(Func<int, int, int, int, int, int, int, int, int, int, int, int, int, int>), someScheduler));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int, int, int, int>(default(Action<int, int, int, int, int, int, int, int, int, int, int, int, int, int, int>), someScheduler));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int, int, int, int>(default(Func<int, int, int, int, int, int, int, int, int, int, int, int, int, int, int>), someScheduler));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int>(default(Action<int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int>), someScheduler));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int>(default(Func<int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int>), someScheduler));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int>(default(Func<int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int>), someScheduler));
-#endif
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync(() => { }, null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int>(a => { }, null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int>(() => 1, null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int>((a, b) => { }, null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int>(a => 1, null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int>((a, b, c) => { }, null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int>((a, b) => 1, null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int>((a, b, c, d) => { }, null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int>((a, b, c) => 1, null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int>((a, b, c, d) => 1, null));
-#if !NO_LARGEARITY
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int>((a, b, c, d, e) => { }, null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int>((a, b, c, d, e, f) => { }, null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int>((a, b, c, d, e) => 1, null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int>((a, b, c, d, e, f, g) => { }, null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int>((a, b, c, d, e, f) => 1, null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h) => { }, null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g) => 1, null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i) => { }, null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h) => 1, null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j) => { }, null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i) => 1, null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, k) => { }, null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j) => 1, null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, k, l) => { }, null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, k) => 1, null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, k, l, m) => { }, null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, k, l) => 1, null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, k, l, m, n) => { }, null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, k, l, m) => 1, null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) => { }, null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, k, l, m, n) => 1, null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) => { }, null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) => 1, null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) => 1, null));
-#endif
- }
-
- [TestMethod]
- public void ToAsync0()
- {
- Assert.IsTrue(Observable.ToAsync<int>(() => 0)().ToEnumerable().SequenceEqual(new[] { 0 }));
- Assert.IsTrue(Observable.ToAsync<int>(() => 0, Scheduler.Default)().ToEnumerable().SequenceEqual(new[] { 0 }));
- }
-
- [TestMethod]
- public void ToAsync1()
- {
- Assert.IsTrue(Observable.ToAsync<int, int>(a => a)(1).ToEnumerable().SequenceEqual(new[] { 1 }));
- Assert.IsTrue(Observable.ToAsync<int, int>(a => a, Scheduler.Default)(1).ToEnumerable().SequenceEqual(new[] { 1 }));
- }
-
- [TestMethod]
- public void ToAsync2()
- {
- Assert.IsTrue(Observable.ToAsync<int, int, int>((a, b) => a + b)(1, 2).ToEnumerable().SequenceEqual(new[] { 1 + 2 }));
- Assert.IsTrue(Observable.ToAsync<int, int, int>((a, b) => a + b, Scheduler.Default)(1, 2).ToEnumerable().SequenceEqual(new[] { 1 + 2 }));
- }
-
- [TestMethod]
- public void ToAsync3()
- {
- Assert.IsTrue(Observable.ToAsync<int, int, int, int>((a, b, c) => a + b + c)(1, 2, 3).ToEnumerable().SequenceEqual(new[] { 1 + 2 + 3 }));
- Assert.IsTrue(Observable.ToAsync<int, int, int, int>((a, b, c) => a + b + c, Scheduler.Default)(1, 2, 3).ToEnumerable().SequenceEqual(new[] { 1 + 2 + 3 }));
- }
-
- [TestMethod]
- public void ToAsync4()
- {
- Assert.IsTrue(Observable.ToAsync<int, int, int, int, int>((a, b, c, d) => a + b + c + d)(1, 2, 3, 4).ToEnumerable().SequenceEqual(new[] { 1 + 2 + 3 + 4 }));
- Assert.IsTrue(Observable.ToAsync<int, int, int, int, int>((a, b, c, d) => a + b + c + d, Scheduler.Default)(1, 2, 3, 4).ToEnumerable().SequenceEqual(new[] { 1 + 2 + 3 + 4 }));
- }
-
-#if !NO_LARGEARITY
-
- [TestMethod]
- public void ToAsync5()
- {
- Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int>((a, b, c, d, e) => a + b + c + d + e)(1, 2, 3, 4, 5).ToEnumerable().SequenceEqual(new[] { 1 + 2 + 3 + 4 + 5 }));
- Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int>((a, b, c, d, e) => a + b + c + d + e, Scheduler.Default)(1, 2, 3, 4, 5).ToEnumerable().SequenceEqual(new[] { 1 + 2 + 3 + 4 + 5 }));
- }
-
- [TestMethod]
- public void ToAsync6()
- {
- Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int>((a, b, c, d, e, f) => a + b + c + d + e + f)(1, 2, 3, 4, 5, 6).ToEnumerable().SequenceEqual(new[] { 1 + 2 + 3 + 4 + 5 + 6 }));
- Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int>((a, b, c, d, e, f) => a + b + c + d + e + f, Scheduler.Default)(1, 2, 3, 4, 5, 6).ToEnumerable().SequenceEqual(new[] { 1 + 2 + 3 + 4 + 5 + 6 }));
- }
-
- [TestMethod]
- public void ToAsync7()
- {
- Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g) => a + b + c + d + e + f + g)(1, 2, 3, 4, 5, 6, 7).ToEnumerable().SequenceEqual(new[] { 1 + 2 + 3 + 4 + 5 + 6 + 7 }));
- Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g) => a + b + c + d + e + f + g, Scheduler.Default)(1, 2, 3, 4, 5, 6, 7).ToEnumerable().SequenceEqual(new[] { 1 + 2 + 3 + 4 + 5 + 6 + 7 }));
- }
-
- [TestMethod]
- public void ToAsync8()
- {
- Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h) => a + b + c + d + e + f + g + h)(1, 2, 3, 4, 5, 6, 7, 8).ToEnumerable().SequenceEqual(new[] { 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 }));
- Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h) => a + b + c + d + e + f + g + h, Scheduler.Default)(1, 2, 3, 4, 5, 6, 7, 8).ToEnumerable().SequenceEqual(new[] { 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 }));
- }
-
- [TestMethod]
- public void ToAsync9()
- {
- Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i) => a + b + c + d + e + f + g + h + i)(1, 2, 3, 4, 5, 6, 7, 8, 9).ToEnumerable().SequenceEqual(new[] { 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 }));
- Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i) => a + b + c + d + e + f + g + h + i, Scheduler.Default)(1, 2, 3, 4, 5, 6, 7, 8, 9).ToEnumerable().SequenceEqual(new[] { 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 }));
- }
-
- [TestMethod]
- public void ToAsync10()
- {
- Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j) => a + b + c + d + e + f + g + h + i + j)(1, 2, 3, 4, 5, 6, 7, 8, 9, 10).ToEnumerable().SequenceEqual(new[] { 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 }));
- Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j) => a + b + c + d + e + f + g + h + i + j, Scheduler.Default)(1, 2, 3, 4, 5, 6, 7, 8, 9, 10).ToEnumerable().SequenceEqual(new[] { 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 }));
- }
-
- [TestMethod]
- public void ToAsync11()
- {
- Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, k) => a + b + c + d + e + f + g + h + i + j + k)(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11).ToEnumerable().SequenceEqual(new[] { 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 }));
- Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, k) => a + b + c + d + e + f + g + h + i + j + k, Scheduler.Default)(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11).ToEnumerable().SequenceEqual(new[] { 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 }));
- }
-
- [TestMethod]
- public void ToAsync12()
- {
- Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, k, l) => a + b + c + d + e + f + g + h + i + j + k + l)(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12).ToEnumerable().SequenceEqual(new[] { 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 }));
- Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, k, l) => a + b + c + d + e + f + g + h + i + j + k + l, Scheduler.Default)(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12).ToEnumerable().SequenceEqual(new[] { 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 }));
- }
-
- [TestMethod]
- public void ToAsync13()
- {
- Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, k, l, m) => a + b + c + d + e + f + g + h + i + j + k + l + m)(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13).ToEnumerable().SequenceEqual(new[] { 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 }));
- Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, k, l, m) => a + b + c + d + e + f + g + h + i + j + k + l + m, Scheduler.Default)(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13).ToEnumerable().SequenceEqual(new[] { 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 }));
- }
-
- [TestMethod]
- public void ToAsync14()
- {
- Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, k, l, m, n) => a + b + c + d + e + f + g + h + i + j + k + l + m + n)(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14).ToEnumerable().SequenceEqual(new[] { 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 }));
- Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, k, l, m, n) => a + b + c + d + e + f + g + h + i + j + k + l + m + n, Scheduler.Default)(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14).ToEnumerable().SequenceEqual(new[] { 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 }));
- }
-
- [TestMethod]
- public void ToAsync15()
- {
- Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) => a + b + c + d + e + f + g + h + i + j + k + l + m + n + o)(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15).ToEnumerable().SequenceEqual(new[] { 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 }));
- Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) => a + b + c + d + e + f + g + h + i + j + k + l + m + n + o, Scheduler.Default)(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15).ToEnumerable().SequenceEqual(new[] { 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 }));
- }
-
- [TestMethod]
- public void ToAsync16()
- {
- Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) => a + b + c + d + e + f + g + h + i + j + k + l + m + n + o + p)(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16).ToEnumerable().SequenceEqual(new[] { 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 }));
- Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) => a + b + c + d + e + f + g + h + i + j + k + l + m + n + o + p, Scheduler.Default)(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16).ToEnumerable().SequenceEqual(new[] { 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 }));
- }
-#endif
-
- [TestMethod]
- public void ToAsync_Error0()
- {
- var ex = new Exception();
- Assert.IsTrue(Observable.ToAsync<int>(() => { throw ex; })().Materialize().ToEnumerable().SequenceEqual(new Notification<int>[] { Notification.CreateOnError<int>(ex) }));
- }
-
- [TestMethod]
- public void ToAsync_Error1()
- {
- var ex = new Exception();
- Assert.IsTrue(Observable.ToAsync<int, int>(a => { throw ex; })(1).Materialize().ToEnumerable().SequenceEqual(new Notification<int>[] { Notification.CreateOnError<int>(ex) }));
- }
-
- [TestMethod]
- public void ToAsync_Error2()
- {
- var ex = new Exception();
- Assert.IsTrue(Observable.ToAsync<int, int, int>((a, b) => { throw ex; })(1, 2).Materialize().ToEnumerable().SequenceEqual(new Notification<int>[] { Notification.CreateOnError<int>(ex) }));
- }
-
- [TestMethod]
- public void ToAsync_Error3()
- {
- var ex = new Exception();
- Assert.IsTrue(Observable.ToAsync<int, int, int, int>((a, b, c) => { throw ex; })(1, 2, 3).Materialize().ToEnumerable().SequenceEqual(new Notification<int>[] { Notification.CreateOnError<int>(ex) }));
- }
-
- [TestMethod]
- public void ToAsync_Error4()
- {
- var ex = new Exception();
- Assert.IsTrue(Observable.ToAsync<int, int, int, int, int>((a, b, c, d) => { throw ex; })(1, 2, 3, 4).Materialize().ToEnumerable().SequenceEqual(new Notification<int>[] { Notification.CreateOnError<int>(ex) }));
- }
-
-#if !NO_LARGEARITY
-
- [TestMethod]
- public void ToAsync_Error5()
- {
- var ex = new Exception();
- Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int>((a, b, c, d, e) => { throw ex; })(1, 2, 3, 4, 5).Materialize().ToEnumerable().SequenceEqual(new Notification<int>[] { Notification.CreateOnError<int>(ex) }));
- }
-
- [TestMethod]
- public void ToAsync_Error6()
- {
- var ex = new Exception();
- Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int>((a, b, c, d, e, f) => { throw ex; })(1, 2, 3, 4, 5, 6).Materialize().ToEnumerable().SequenceEqual(new Notification<int>[] { Notification.CreateOnError<int>(ex) }));
- }
-
- [TestMethod]
- public void ToAsync_Error7()
- {
- var ex = new Exception();
- Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g) => { throw ex; })(1, 2, 3, 4, 5, 6, 7).Materialize().ToEnumerable().SequenceEqual(new Notification<int>[] { Notification.CreateOnError<int>(ex) }));
- }
-
- [TestMethod]
- public void ToAsync_Error8()
- {
- var ex = new Exception();
- Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h) => { throw ex; })(1, 2, 3, 4, 5, 6, 7, 8).Materialize().ToEnumerable().SequenceEqual(new Notification<int>[] { Notification.CreateOnError<int>(ex) }));
- }
-
- [TestMethod]
- public void ToAsync_Error9()
- {
- var ex = new Exception();
- Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i) => { throw ex; })(1, 2, 3, 4, 5, 6, 7, 8, 9).Materialize().ToEnumerable().SequenceEqual(new Notification<int>[] { Notification.CreateOnError<int>(ex) }));
- }
-
- [TestMethod]
- public void ToAsync_Error10()
- {
- var ex = new Exception();
- Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j) => { throw ex; })(1, 2, 3, 4, 5, 6, 7, 8, 9, 10).Materialize().ToEnumerable().SequenceEqual(new Notification<int>[] { Notification.CreateOnError<int>(ex) }));
- }
-
- [TestMethod]
- public void ToAsync_Error11()
- {
- var ex = new Exception();
- Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, k) => { throw ex; })(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11).Materialize().ToEnumerable().SequenceEqual(new Notification<int>[] { Notification.CreateOnError<int>(ex) }));
- }
-
- [TestMethod]
- public void ToAsync_Error12()
- {
- var ex = new Exception();
- Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, k, l) => { throw ex; })(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12).Materialize().ToEnumerable().SequenceEqual(new Notification<int>[] { Notification.CreateOnError<int>(ex) }));
- }
-
- [TestMethod]
- public void ToAsync_Error13()
- {
- var ex = new Exception();
- Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, k, l, m) => { throw ex; })(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13).Materialize().ToEnumerable().SequenceEqual(new Notification<int>[] { Notification.CreateOnError<int>(ex) }));
- }
-
- [TestMethod]
- public void ToAsync_Error14()
- {
- var ex = new Exception();
- Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, k, l, m, n) => { throw ex; })(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14).Materialize().ToEnumerable().SequenceEqual(new Notification<int>[] { Notification.CreateOnError<int>(ex) }));
- }
-
- [TestMethod]
- public void ToAsync_Error15()
- {
- var ex = new Exception();
- Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) => { throw ex; })(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15).Materialize().ToEnumerable().SequenceEqual(new Notification<int>[] { Notification.CreateOnError<int>(ex) }));
- }
-
- [TestMethod]
- public void ToAsync_Error16()
- {
- var ex = new Exception();
- Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) => { throw ex; })(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16).Materialize().ToEnumerable().SequenceEqual(new Notification<int>[] { Notification.CreateOnError<int>(ex) }));
- }
-#endif
-
- [TestMethod]
- public void ToAsyncAction0()
- {
- bool hasRun = false;
- Assert.IsTrue(Observable.ToAsync(() => { hasRun = true; })().ToEnumerable().SequenceEqual(new[] { new Unit() }));
- Assert.IsTrue(Observable.ToAsync(() => { hasRun = true; }, Scheduler.Default)().ToEnumerable().SequenceEqual(new[] { new Unit() }));
- Assert.IsTrue(hasRun, "has run");
- }
-
- [TestMethod]
- public void ToAsyncActionError0()
- {
- var ex = new Exception();
- Assert.IsTrue(Observable.ToAsync(() => { throw ex; })().Materialize().ToEnumerable().SequenceEqual(new[] { Notification.CreateOnError<Unit>(ex) }));
- }
-
- [TestMethod]
- public void ToAsyncAction1()
- {
- bool hasRun = false;
- Assert.IsTrue(Observable.ToAsync<int>(a => { Assert.AreEqual(1, a); hasRun = true; })(1).ToEnumerable().SequenceEqual(new[] { new Unit() }));
- Assert.IsTrue(Observable.ToAsync<int>(a => { Assert.AreEqual(1, a); hasRun = true; }, Scheduler.Default)(1).ToEnumerable().SequenceEqual(new[] { new Unit() }));
- Assert.IsTrue(hasRun, "has run");
- }
-
- [TestMethod]
- public void ToAsyncActionError1()
- {
- var ex = new Exception();
- Assert.IsTrue(Observable.ToAsync<int>(a => { Assert.AreEqual(1, a); throw ex; })(1).Materialize().ToEnumerable().SequenceEqual(new[] { Notification.CreateOnError<Unit>(ex) }));
- }
-
- [TestMethod]
- public void ToAsyncAction2()
- {
- bool hasRun = false;
- Assert.IsTrue(Observable.ToAsync<int, int>((a, b) => { Assert.AreEqual(1, a); Assert.AreEqual(2, b); hasRun = true; })(1, 2).ToEnumerable().SequenceEqual(new[] { new Unit() }));
- Assert.IsTrue(Observable.ToAsync<int, int>((a, b) => { Assert.AreEqual(1, a); Assert.AreEqual(2, b); hasRun = true; }, Scheduler.Default)(1, 2).ToEnumerable().SequenceEqual(new[] { new Unit() }));
- Assert.IsTrue(hasRun, "has run");
- }
-
- [TestMethod]
- public void ToAsyncActionError2()
- {
- var ex = new Exception();
- Assert.IsTrue(Observable.ToAsync<int, int>((a, b) => { Assert.AreEqual(1, a); Assert.AreEqual(2, b); throw ex; })(1, 2).Materialize().ToEnumerable().SequenceEqual(new[] { Notification.CreateOnError<Unit>(ex) }));
- }
-
- [TestMethod]
- public void ToAsyncAction3()
- {
- bool hasRun = false;
- Assert.IsTrue(Observable.ToAsync<int, int, int>((a, b, c) => { Assert.AreEqual(1, a); Assert.AreEqual(2, b); Assert.AreEqual(3, c); hasRun = true; })(1, 2, 3).ToEnumerable().SequenceEqual(new[] { new Unit() }));
- Assert.IsTrue(Observable.ToAsync<int, int, int>((a, b, c) => { Assert.AreEqual(1, a); Assert.AreEqual(2, b); Assert.AreEqual(3, c); hasRun = true; }, Scheduler.Default)(1, 2, 3).ToEnumerable().SequenceEqual(new[] { new Unit() }));
- Assert.IsTrue(hasRun, "has run");
- }
-
- [TestMethod]
- public void ToAsyncActionError3()
- {
- var ex = new Exception();
- Assert.IsTrue(Observable.ToAsync<int, int, int>((a, b, c) => { Assert.AreEqual(1, a); Assert.AreEqual(2, b); Assert.AreEqual(3, c); throw ex; })(1, 2, 3).Materialize().ToEnumerable().SequenceEqual(new[] { Notification.CreateOnError<Unit>(ex) }));
- }
-
- [TestMethod]
- public void ToAsyncAction4()
- {
- bool hasRun = false;
- Assert.IsTrue(Observable.ToAsync<int, int, int, int>((a, b, c, d) => { Assert.AreEqual(1, a); Assert.AreEqual(2, b); Assert.AreEqual(3, c); Assert.AreEqual(4, d); hasRun = true; })(1, 2, 3, 4).ToEnumerable().SequenceEqual(new[] { new Unit() }));
- Assert.IsTrue(Observable.ToAsync<int, int, int, int>((a, b, c, d) => { Assert.AreEqual(1, a); Assert.AreEqual(2, b); Assert.AreEqual(3, c); Assert.AreEqual(4, d); hasRun = true; }, Scheduler.Default)(1, 2, 3, 4).ToEnumerable().SequenceEqual(new[] { new Unit() }));
- Assert.IsTrue(hasRun, "has run");
- }
-
- [TestMethod]
- public void ToAsyncActionError4()
- {
- var ex = new Exception();
- Assert.IsTrue(Observable.ToAsync<int, int, int, int>((a, b, c, d) => { Assert.AreEqual(1, a); Assert.AreEqual(2, b); Assert.AreEqual(3, c); Assert.AreEqual(4, d); throw ex; })(1, 2, 3, 4).Materialize().ToEnumerable().SequenceEqual(new[] { Notification.CreateOnError<Unit>(ex) }));
- }
-
-#if !NO_LARGEARITY
-
- [TestMethod]
- public void ToAsyncAction5()
- {
- bool hasRun = false;
- Assert.IsTrue(Observable.ToAsync<int, int, int, int, int>((a, b, c, d, e) => { Assert.AreEqual(1, a); Assert.AreEqual(2, b); Assert.AreEqual(3, c); Assert.AreEqual(4, d); Assert.AreEqual(5, e); hasRun = true; })(1, 2, 3, 4, 5).ToEnumerable().SequenceEqual(new[] { new Unit() }));
- Assert.IsTrue(Observable.ToAsync<int, int, int, int, int>((a, b, c, d, e) => { Assert.AreEqual(1, a); Assert.AreEqual(2, b); Assert.AreEqual(3, c); Assert.AreEqual(4, d); Assert.AreEqual(5, e); hasRun = true; }, Scheduler.Default)(1, 2, 3, 4, 5).ToEnumerable().SequenceEqual(new[] { new Unit() }));
- Assert.IsTrue(hasRun, "has run");
- }
-
- [TestMethod]
- public void ToAsyncActionError5()
- {
- var ex = new Exception();
- Assert.IsTrue(Observable.ToAsync<int, int, int, int, int>((a, b, c, d, e) => { Assert.AreEqual(1, a); Assert.AreEqual(2, b); Assert.AreEqual(3, c); Assert.AreEqual(4, d); Assert.AreEqual(5, e); throw ex; })(1, 2, 3, 4, 5).Materialize().ToEnumerable().SequenceEqual(new[] { Notification.CreateOnError<Unit>(ex) }));
- }
-
- [TestMethod]
- public void ToAsyncAction6()
- {
- bool hasRun = false;
- Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int>((a, b, c, d, e, f) => { Assert.AreEqual(1, a); Assert.AreEqual(2, b); Assert.AreEqual(3, c); Assert.AreEqual(4, d); Assert.AreEqual(5, e); Assert.AreEqual(6, f); hasRun = true; })(1, 2, 3, 4, 5, 6).ToEnumerable().SequenceEqual(new[] { new Unit() }));
- Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int>((a, b, c, d, e, f) => { Assert.AreEqual(1, a); Assert.AreEqual(2, b); Assert.AreEqual(3, c); Assert.AreEqual(4, d); Assert.AreEqual(5, e); Assert.AreEqual(6, f); hasRun = true; }, Scheduler.Default)(1, 2, 3, 4, 5, 6).ToEnumerable().SequenceEqual(new[] { new Unit() }));
- Assert.IsTrue(hasRun, "has run");
- }
-
- [TestMethod]
- public void ToAsyncActionError6()
- {
- var ex = new Exception();
- Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int>((a, b, c, d, e, f) => { Assert.AreEqual(1, a); Assert.AreEqual(2, b); Assert.AreEqual(3, c); Assert.AreEqual(4, d); Assert.AreEqual(5, e); Assert.AreEqual(6, f); throw ex; })(1, 2, 3, 4, 5, 6).Materialize().ToEnumerable().SequenceEqual(new[] { Notification.CreateOnError<Unit>(ex) }));
- }
-
- [TestMethod]
- public void ToAsyncAction7()
- {
- bool hasRun = false;
- Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int>((a, b, c, d, e, f, g) => { Assert.AreEqual(1, a); Assert.AreEqual(2, b); Assert.AreEqual(3, c); Assert.AreEqual(4, d); Assert.AreEqual(5, e); Assert.AreEqual(6, f); Assert.AreEqual(7, g); hasRun = true; })(1, 2, 3, 4, 5, 6, 7).ToEnumerable().SequenceEqual(new[] { new Unit() }));
- Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int>((a, b, c, d, e, f, g) => { Assert.AreEqual(1, a); Assert.AreEqual(2, b); Assert.AreEqual(3, c); Assert.AreEqual(4, d); Assert.AreEqual(5, e); Assert.AreEqual(6, f); Assert.AreEqual(7, g); hasRun = true; }, Scheduler.Default)(1, 2, 3, 4, 5, 6, 7).ToEnumerable().SequenceEqual(new[] { new Unit() }));
- Assert.IsTrue(hasRun, "has run");
- }
-
- [TestMethod]
- public void ToAsyncActionError7()
- {
- var ex = new Exception();
- Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int>((a, b, c, d, e, f, g) => { Assert.AreEqual(1, a); Assert.AreEqual(2, b); Assert.AreEqual(3, c); Assert.AreEqual(4, d); Assert.AreEqual(5, e); Assert.AreEqual(6, f); Assert.AreEqual(7, g); throw ex; })(1, 2, 3, 4, 5, 6, 7).Materialize().ToEnumerable().SequenceEqual(new[] { Notification.CreateOnError<Unit>(ex) }));
- }
-
- [TestMethod]
- public void ToAsyncAction8()
- {
- bool hasRun = false;
- Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h) => { Assert.AreEqual(1, a); Assert.AreEqual(2, b); Assert.AreEqual(3, c); Assert.AreEqual(4, d); Assert.AreEqual(5, e); Assert.AreEqual(6, f); Assert.AreEqual(7, g); Assert.AreEqual(8, h); hasRun = true; })(1, 2, 3, 4, 5, 6, 7, 8).ToEnumerable().SequenceEqual(new[] { new Unit() }));
- Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h) => { Assert.AreEqual(1, a); Assert.AreEqual(2, b); Assert.AreEqual(3, c); Assert.AreEqual(4, d); Assert.AreEqual(5, e); Assert.AreEqual(6, f); Assert.AreEqual(7, g); Assert.AreEqual(8, h); hasRun = true; }, Scheduler.Default)(1, 2, 3, 4, 5, 6, 7, 8).ToEnumerable().SequenceEqual(new[] { new Unit() }));
- Assert.IsTrue(hasRun, "has run");
- }
-
- [TestMethod]
- public void ToAsyncActionError8()
- {
- var ex = new Exception();
- Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h) => { Assert.AreEqual(1, a); Assert.AreEqual(2, b); Assert.AreEqual(3, c); Assert.AreEqual(4, d); Assert.AreEqual(5, e); Assert.AreEqual(6, f); Assert.AreEqual(7, g); Assert.AreEqual(8, h); throw ex; })(1, 2, 3, 4, 5, 6, 7, 8).Materialize().ToEnumerable().SequenceEqual(new[] { Notification.CreateOnError<Unit>(ex) }));
- }
-
- [TestMethod]
- public void ToAsyncAction9()
- {
- bool hasRun = false;
- Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i) => { Assert.AreEqual(1, a); Assert.AreEqual(2, b); Assert.AreEqual(3, c); Assert.AreEqual(4, d); Assert.AreEqual(5, e); Assert.AreEqual(6, f); Assert.AreEqual(7, g); Assert.AreEqual(8, h); Assert.AreEqual(9, i); hasRun = true; })(1, 2, 3, 4, 5, 6, 7, 8, 9).ToEnumerable().SequenceEqual(new[] { new Unit() }));
- Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i) => { Assert.AreEqual(1, a); Assert.AreEqual(2, b); Assert.AreEqual(3, c); Assert.AreEqual(4, d); Assert.AreEqual(5, e); Assert.AreEqual(6, f); Assert.AreEqual(7, g); Assert.AreEqual(8, h); Assert.AreEqual(9, i); hasRun = true; }, Scheduler.Default)(1, 2, 3, 4, 5, 6, 7, 8, 9).ToEnumerable().SequenceEqual(new[] { new Unit() }));
- Assert.IsTrue(hasRun, "has run");
- }
-
- [TestMethod]
- public void ToAsyncActionError9()
- {
- var ex = new Exception();
- Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i) => { Assert.AreEqual(1, a); Assert.AreEqual(2, b); Assert.AreEqual(3, c); Assert.AreEqual(4, d); Assert.AreEqual(5, e); Assert.AreEqual(6, f); Assert.AreEqual(7, g); Assert.AreEqual(8, h); Assert.AreEqual(9, i); throw ex; })(1, 2, 3, 4, 5, 6, 7, 8, 9).Materialize().ToEnumerable().SequenceEqual(new[] { Notification.CreateOnError<Unit>(ex) }));
- }
-
- [TestMethod]
- public void ToAsyncAction10()
- {
- bool hasRun = false;
- Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j) => { Assert.AreEqual(1, a); Assert.AreEqual(2, b); Assert.AreEqual(3, c); Assert.AreEqual(4, d); Assert.AreEqual(5, e); Assert.AreEqual(6, f); Assert.AreEqual(7, g); Assert.AreEqual(8, h); Assert.AreEqual(9, i); Assert.AreEqual(10, j); hasRun = true; })(1, 2, 3, 4, 5, 6, 7, 8, 9, 10).ToEnumerable().SequenceEqual(new[] { new Unit() }));
- Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j) => { Assert.AreEqual(1, a); Assert.AreEqual(2, b); Assert.AreEqual(3, c); Assert.AreEqual(4, d); Assert.AreEqual(5, e); Assert.AreEqual(6, f); Assert.AreEqual(7, g); Assert.AreEqual(8, h); Assert.AreEqual(9, i); Assert.AreEqual(10, j); hasRun = true; }, Scheduler.Default)(1, 2, 3, 4, 5, 6, 7, 8, 9, 10).ToEnumerable().SequenceEqual(new[] { new Unit() }));
- Assert.IsTrue(hasRun, "has run");
- }
-
- [TestMethod]
- public void ToAsyncActionError10()
- {
- var ex = new Exception();
- Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j) => { Assert.AreEqual(1, a); Assert.AreEqual(2, b); Assert.AreEqual(3, c); Assert.AreEqual(4, d); Assert.AreEqual(5, e); Assert.AreEqual(6, f); Assert.AreEqual(7, g); Assert.AreEqual(8, h); Assert.AreEqual(9, i); Assert.AreEqual(10, j); throw ex; })(1, 2, 3, 4, 5, 6, 7, 8, 9, 10).Materialize().ToEnumerable().SequenceEqual(new[] { Notification.CreateOnError<Unit>(ex) }));
- }
-
- [TestMethod]
- public void ToAsyncAction11()
- {
- bool hasRun = false;
- Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, k) => { Assert.AreEqual(1, a); Assert.AreEqual(2, b); Assert.AreEqual(3, c); Assert.AreEqual(4, d); Assert.AreEqual(5, e); Assert.AreEqual(6, f); Assert.AreEqual(7, g); Assert.AreEqual(8, h); Assert.AreEqual(9, i); Assert.AreEqual(10, j); Assert.AreEqual(11, k); hasRun = true; })(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11).ToEnumerable().SequenceEqual(new[] { new Unit() }));
- Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, k) => { Assert.AreEqual(1, a); Assert.AreEqual(2, b); Assert.AreEqual(3, c); Assert.AreEqual(4, d); Assert.AreEqual(5, e); Assert.AreEqual(6, f); Assert.AreEqual(7, g); Assert.AreEqual(8, h); Assert.AreEqual(9, i); Assert.AreEqual(10, j); Assert.AreEqual(11, k); hasRun = true; }, Scheduler.Default)(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11).ToEnumerable().SequenceEqual(new[] { new Unit() }));
- Assert.IsTrue(hasRun, "has run");
- }
-
- [TestMethod]
- public void ToAsyncActionError11()
- {
- var ex = new Exception();
- Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, k) => { Assert.AreEqual(1, a); Assert.AreEqual(2, b); Assert.AreEqual(3, c); Assert.AreEqual(4, d); Assert.AreEqual(5, e); Assert.AreEqual(6, f); Assert.AreEqual(7, g); Assert.AreEqual(8, h); Assert.AreEqual(9, i); Assert.AreEqual(10, j); Assert.AreEqual(11, k); throw ex; })(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11).Materialize().ToEnumerable().SequenceEqual(new[] { Notification.CreateOnError<Unit>(ex) }));
- }
-
- [TestMethod]
- public void ToAsyncAction12()
- {
- bool hasRun = false;
- Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, k, l) => { Assert.AreEqual(1, a); Assert.AreEqual(2, b); Assert.AreEqual(3, c); Assert.AreEqual(4, d); Assert.AreEqual(5, e); Assert.AreEqual(6, f); Assert.AreEqual(7, g); Assert.AreEqual(8, h); Assert.AreEqual(9, i); Assert.AreEqual(10, j); Assert.AreEqual(11, k); Assert.AreEqual(12, l); hasRun = true; })(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12).ToEnumerable().SequenceEqual(new[] { new Unit() }));
- Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, k, l) => { Assert.AreEqual(1, a); Assert.AreEqual(2, b); Assert.AreEqual(3, c); Assert.AreEqual(4, d); Assert.AreEqual(5, e); Assert.AreEqual(6, f); Assert.AreEqual(7, g); Assert.AreEqual(8, h); Assert.AreEqual(9, i); Assert.AreEqual(10, j); Assert.AreEqual(11, k); Assert.AreEqual(12, l); hasRun = true; }, Scheduler.Default)(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12).ToEnumerable().SequenceEqual(new[] { new Unit() }));
- Assert.IsTrue(hasRun, "has run");
- }
-
- [TestMethod]
- public void ToAsyncActionError12()
- {
- var ex = new Exception();
- Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, k, l) => { Assert.AreEqual(1, a); Assert.AreEqual(2, b); Assert.AreEqual(3, c); Assert.AreEqual(4, d); Assert.AreEqual(5, e); Assert.AreEqual(6, f); Assert.AreEqual(7, g); Assert.AreEqual(8, h); Assert.AreEqual(9, i); Assert.AreEqual(10, j); Assert.AreEqual(11, k); Assert.AreEqual(12, l); throw ex; })(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12).Materialize().ToEnumerable().SequenceEqual(new[] { Notification.CreateOnError<Unit>(ex) }));
- }
-
- [TestMethod]
- public void ToAsyncAction13()
- {
- bool hasRun = false;
- Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, k, l, m) => { Assert.AreEqual(1, a); Assert.AreEqual(2, b); Assert.AreEqual(3, c); Assert.AreEqual(4, d); Assert.AreEqual(5, e); Assert.AreEqual(6, f); Assert.AreEqual(7, g); Assert.AreEqual(8, h); Assert.AreEqual(9, i); Assert.AreEqual(10, j); Assert.AreEqual(11, k); Assert.AreEqual(12, l); Assert.AreEqual(13, m); hasRun = true; })(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13).ToEnumerable().SequenceEqual(new[] { new Unit() }));
- Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, k, l, m) => { Assert.AreEqual(1, a); Assert.AreEqual(2, b); Assert.AreEqual(3, c); Assert.AreEqual(4, d); Assert.AreEqual(5, e); Assert.AreEqual(6, f); Assert.AreEqual(7, g); Assert.AreEqual(8, h); Assert.AreEqual(9, i); Assert.AreEqual(10, j); Assert.AreEqual(11, k); Assert.AreEqual(12, l); Assert.AreEqual(13, m); hasRun = true; }, Scheduler.Default)(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13).ToEnumerable().SequenceEqual(new[] { new Unit() }));
- Assert.IsTrue(hasRun, "has run");
- }
-
- [TestMethod]
- public void ToAsyncActionError13()
- {
- var ex = new Exception();
- Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, k, l, m) => { Assert.AreEqual(1, a); Assert.AreEqual(2, b); Assert.AreEqual(3, c); Assert.AreEqual(4, d); Assert.AreEqual(5, e); Assert.AreEqual(6, f); Assert.AreEqual(7, g); Assert.AreEqual(8, h); Assert.AreEqual(9, i); Assert.AreEqual(10, j); Assert.AreEqual(11, k); Assert.AreEqual(12, l); Assert.AreEqual(13, m); throw ex; })(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13).Materialize().ToEnumerable().SequenceEqual(new[] { Notification.CreateOnError<Unit>(ex) }));
- }
-
- [TestMethod]
- public void ToAsyncAction14()
- {
- bool hasRun = false;
- Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, k, l, m, n) => { Assert.AreEqual(1, a); Assert.AreEqual(2, b); Assert.AreEqual(3, c); Assert.AreEqual(4, d); Assert.AreEqual(5, e); Assert.AreEqual(6, f); Assert.AreEqual(7, g); Assert.AreEqual(8, h); Assert.AreEqual(9, i); Assert.AreEqual(10, j); Assert.AreEqual(11, k); Assert.AreEqual(12, l); Assert.AreEqual(13, m); Assert.AreEqual(14, n); hasRun = true; })(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14).ToEnumerable().SequenceEqual(new[] { new Unit() }));
- Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, k, l, m, n) => { Assert.AreEqual(1, a); Assert.AreEqual(2, b); Assert.AreEqual(3, c); Assert.AreEqual(4, d); Assert.AreEqual(5, e); Assert.AreEqual(6, f); Assert.AreEqual(7, g); Assert.AreEqual(8, h); Assert.AreEqual(9, i); Assert.AreEqual(10, j); Assert.AreEqual(11, k); Assert.AreEqual(12, l); Assert.AreEqual(13, m); Assert.AreEqual(14, n); hasRun = true; }, Scheduler.Default)(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14).ToEnumerable().SequenceEqual(new[] { new Unit() }));
- Assert.IsTrue(hasRun, "has run");
- }
-
- [TestMethod]
- public void ToAsyncActionError14()
- {
- var ex = new Exception();
- Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, k, l, m, n) => { Assert.AreEqual(1, a); Assert.AreEqual(2, b); Assert.AreEqual(3, c); Assert.AreEqual(4, d); Assert.AreEqual(5, e); Assert.AreEqual(6, f); Assert.AreEqual(7, g); Assert.AreEqual(8, h); Assert.AreEqual(9, i); Assert.AreEqual(10, j); Assert.AreEqual(11, k); Assert.AreEqual(12, l); Assert.AreEqual(13, m); Assert.AreEqual(14, n); throw ex; })(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14).Materialize().ToEnumerable().SequenceEqual(new[] { Notification.CreateOnError<Unit>(ex) }));
- }
-
- [TestMethod]
- public void ToAsyncAction15()
- {
- bool hasRun = false;
- Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) => { Assert.AreEqual(1, a); Assert.AreEqual(2, b); Assert.AreEqual(3, c); Assert.AreEqual(4, d); Assert.AreEqual(5, e); Assert.AreEqual(6, f); Assert.AreEqual(7, g); Assert.AreEqual(8, h); Assert.AreEqual(9, i); Assert.AreEqual(10, j); Assert.AreEqual(11, k); Assert.AreEqual(12, l); Assert.AreEqual(13, m); Assert.AreEqual(14, n); Assert.AreEqual(15, o); hasRun = true; })(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15).ToEnumerable().SequenceEqual(new[] { new Unit() }));
- Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) => { Assert.AreEqual(1, a); Assert.AreEqual(2, b); Assert.AreEqual(3, c); Assert.AreEqual(4, d); Assert.AreEqual(5, e); Assert.AreEqual(6, f); Assert.AreEqual(7, g); Assert.AreEqual(8, h); Assert.AreEqual(9, i); Assert.AreEqual(10, j); Assert.AreEqual(11, k); Assert.AreEqual(12, l); Assert.AreEqual(13, m); Assert.AreEqual(14, n); Assert.AreEqual(15, o); hasRun = true; }, Scheduler.Default)(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15).ToEnumerable().SequenceEqual(new[] { new Unit() }));
- Assert.IsTrue(hasRun, "has run");
- }
-
- [TestMethod]
- public void ToAsyncActionError15()
- {
- var ex = new Exception();
- Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) => { Assert.AreEqual(1, a); Assert.AreEqual(2, b); Assert.AreEqual(3, c); Assert.AreEqual(4, d); Assert.AreEqual(5, e); Assert.AreEqual(6, f); Assert.AreEqual(7, g); Assert.AreEqual(8, h); Assert.AreEqual(9, i); Assert.AreEqual(10, j); Assert.AreEqual(11, k); Assert.AreEqual(12, l); Assert.AreEqual(13, m); Assert.AreEqual(14, n); Assert.AreEqual(15, o); throw ex; })(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15).Materialize().ToEnumerable().SequenceEqual(new[] { Notification.CreateOnError<Unit>(ex) }));
- }
-
- [TestMethod]
- public void ToAsyncAction16()
- {
- bool hasRun = false;
- Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) => { Assert.AreEqual(1, a); Assert.AreEqual(2, b); Assert.AreEqual(3, c); Assert.AreEqual(4, d); Assert.AreEqual(5, e); Assert.AreEqual(6, f); Assert.AreEqual(7, g); Assert.AreEqual(8, h); Assert.AreEqual(9, i); Assert.AreEqual(10, j); Assert.AreEqual(11, k); Assert.AreEqual(12, l); Assert.AreEqual(13, m); Assert.AreEqual(14, n); Assert.AreEqual(15, o); Assert.AreEqual(16, p); hasRun = true; })(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16).ToEnumerable().SequenceEqual(new[] { new Unit() }));
- Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) => { Assert.AreEqual(1, a); Assert.AreEqual(2, b); Assert.AreEqual(3, c); Assert.AreEqual(4, d); Assert.AreEqual(5, e); Assert.AreEqual(6, f); Assert.AreEqual(7, g); Assert.AreEqual(8, h); Assert.AreEqual(9, i); Assert.AreEqual(10, j); Assert.AreEqual(11, k); Assert.AreEqual(12, l); Assert.AreEqual(13, m); Assert.AreEqual(14, n); Assert.AreEqual(15, o); Assert.AreEqual(16, p); hasRun = true; }, Scheduler.Default)(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16).ToEnumerable().SequenceEqual(new[] { new Unit() }));
- Assert.IsTrue(hasRun, "has run");
- }
-
- [TestMethod]
- public void ToAsyncActionError16()
- {
- var ex = new Exception();
- Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) => { Assert.AreEqual(1, a); Assert.AreEqual(2, b); Assert.AreEqual(3, c); Assert.AreEqual(4, d); Assert.AreEqual(5, e); Assert.AreEqual(6, f); Assert.AreEqual(7, g); Assert.AreEqual(8, h); Assert.AreEqual(9, i); Assert.AreEqual(10, j); Assert.AreEqual(11, k); Assert.AreEqual(12, l); Assert.AreEqual(13, m); Assert.AreEqual(14, n); Assert.AreEqual(15, o); Assert.AreEqual(16, p); throw ex; })(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16).Materialize().ToEnumerable().SequenceEqual(new[] { Notification.CreateOnError<Unit>(ex) }));
- }
-#endif
-
- #endregion
- }
-}
diff --git a/Rx.NET/Tests.System.Reactive/Tests/ObservableAwaiterTest.cs b/Rx.NET/Tests.System.Reactive/Tests/ObservableAwaiterTest.cs
deleted file mode 100644
index 346e345..0000000
--- a/Rx.NET/Tests.System.Reactive/Tests/ObservableAwaiterTest.cs
+++ /dev/null
@@ -1,145 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if HAS_AWAIT
-
-using System;
-using System.Collections.Generic;
-using System.Reactive;
-using System.Reactive.Concurrency;
-using System.Reactive.Linq;
-using System.Reactive.Subjects;
-using Microsoft.Reactive.Testing;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using ReactiveTests.Dummies;
-
-namespace ReactiveTests.Tests
-{
- [TestClass]
- public class ObservableAwaiterTest : ReactiveTest
- {
- [TestMethod]
- public void Await_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.GetAwaiter<int>(null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.GetAwaiter(Observable.Empty<int>()).OnCompleted(null));
- }
-
- [TestMethod]
- public void Await()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(20, -1),
- OnNext(150, 0),
- OnNext(220, 1),
- OnNext(290, 2),
- OnNext(340, 3),
- OnCompleted<int>(410)
- );
-
- var awaiter = default(AsyncSubject<int>);
- var result = default(int);
- var t = long.MaxValue;
-
- scheduler.ScheduleAbsolute(100, () => awaiter = xs.GetAwaiter());
- scheduler.ScheduleAbsolute(200, () => awaiter.OnCompleted(() => { t = scheduler.Clock; result = awaiter.GetResult(); }));
-
- scheduler.Start();
-
- Assert.AreEqual(410, t);
- Assert.AreEqual(3, result);
-
- xs.Subscriptions.AssertEqual(
- Subscribe(100)
- );
- }
-
- [TestMethod]
- public void Await_Error()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(20, -1),
- OnNext(150, 0),
- OnNext(220, 1),
- OnNext(290, 2),
- OnNext(340, 3),
- OnError<int>(410, ex)
- );
-
- var awaiter = default(AsyncSubject<int>);
- var t = long.MaxValue;
-
- scheduler.ScheduleAbsolute(100, () => awaiter = xs.GetAwaiter());
- scheduler.ScheduleAbsolute(200, () => awaiter.OnCompleted(() => { t = scheduler.Clock; ReactiveAssert.Throws(ex, () => awaiter.GetResult()); }));
-
- scheduler.Start();
-
- Assert.AreEqual(410, t);
-
- xs.Subscriptions.AssertEqual(
- Subscribe(100)
- );
- }
-
- [TestMethod]
- public void Await_Never()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(20, -1),
- OnNext(150, 0),
- OnNext(220, 1),
- OnNext(290, 2),
- OnNext(340, 3)
- );
-
- var awaiter = default(AsyncSubject<int>);
- var hasValue = default(bool);
- var t = long.MaxValue;
-
- scheduler.ScheduleAbsolute(100, () => awaiter = xs.GetAwaiter());
- scheduler.ScheduleAbsolute(200, () => awaiter.OnCompleted(() => { t = scheduler.Clock; awaiter.GetResult(); hasValue = true; }));
-
- scheduler.Start();
-
- Assert.AreEqual(long.MaxValue, t);
- Assert.IsFalse(hasValue);
-
- xs.Subscriptions.AssertEqual(
- Subscribe(100)
- );
- }
-
- [TestMethod]
- public void Await_Empty()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnCompleted<int>(300)
- );
-
- var awaiter = default(AsyncSubject<int>);
- var t = long.MaxValue;
-
- scheduler.ScheduleAbsolute(100, () => awaiter = xs.GetAwaiter());
- scheduler.ScheduleAbsolute(200, () => awaiter.OnCompleted(() => { t = scheduler.Clock; ReactiveAssert.Throws<InvalidOperationException>(() => awaiter.GetResult()); }));
-
- scheduler.Start();
-
- Assert.AreEqual(300, t);
-
- xs.Subscriptions.AssertEqual(
- Subscribe(100)
- );
- }
- }
-}
-
-#endif
diff --git a/Rx.NET/Tests.System.Reactive/Tests/ObservableBindingTest.cs b/Rx.NET/Tests.System.Reactive/Tests/ObservableBindingTest.cs
deleted file mode 100644
index 10685b5..0000000
--- a/Rx.NET/Tests.System.Reactive/Tests/ObservableBindingTest.cs
+++ /dev/null
@@ -1,2817 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System;
-using System.Collections.Generic;
-using System.Reactive.Concurrency;
-using System.Reactive.Disposables;
-using System.Reactive.Linq;
-using System.Reactive.Subjects;
-using Microsoft.Reactive.Testing;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using ReactiveTests.Dummies;
-
-namespace ReactiveTests.Tests
-{
- [TestClass]
- public partial class ObservableBindingTest : ReactiveTest
- {
- #region Multicast
-
- [TestMethod]
- public void Multicast_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Multicast<int, int>(null, new Subject<int>()));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Multicast<int, int>(Observable.Return(42), null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Multicast<int, int, int>(null, () => new Subject<int>(), xs => xs));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Multicast<int, int, int>(Observable.Return(42), null, xs => xs));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Multicast<int, int, int>(Observable.Return(42), () => new Subject<int>(), null));
- }
-
- [TestMethod]
- public void Multicast_Hot_1()
- {
- var scheduler = new TestScheduler();
-
- var s = new Subject<int>();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(40, 0),
- OnNext(90, 1),
- OnNext(150, 2),
- OnNext(210, 3),
- OnNext(240, 4),
- OnNext(270, 5),
- OnNext(330, 6),
- OnNext(340, 7),
- OnCompleted<int>(390)
- );
-
- var c = default(IConnectableObservable<int>);
- var o = scheduler.CreateObserver<int>();
- var d1 = default(IDisposable);
- var d2 = default(IDisposable);
-
- scheduler.ScheduleAbsolute(50, () => c = xs.Multicast(s));
- scheduler.ScheduleAbsolute(100, () => d1 = c.Subscribe(o));
- scheduler.ScheduleAbsolute(200, () => d2 = c.Connect());
- scheduler.ScheduleAbsolute(300, () => d1.Dispose());
-
- scheduler.Start();
-
- o.Messages.AssertEqual(
- OnNext(210, 3),
- OnNext(240, 4),
- OnNext(270, 5)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 390)
- );
- }
-
- [TestMethod]
- public void Multicast_Hot_2()
- {
- var scheduler = new TestScheduler();
-
- var s = new Subject<int>();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(40, 0),
- OnNext(90, 1),
- OnNext(150, 2),
- OnNext(210, 3),
- OnNext(240, 4),
- OnNext(270, 5),
- OnNext(330, 6),
- OnNext(340, 7),
- OnCompleted<int>(390)
- );
-
- var c = default(IConnectableObservable<int>);
- var o = scheduler.CreateObserver<int>();
- var d1 = default(IDisposable);
- var d2 = default(IDisposable);
-
- scheduler.ScheduleAbsolute(50, () => c = xs.Multicast(s));
- scheduler.ScheduleAbsolute(100, () => d2 = c.Connect());
- scheduler.ScheduleAbsolute(200, () => d1 = c.Subscribe(o));
- scheduler.ScheduleAbsolute(300, () => d1.Dispose());
-
- scheduler.Start();
-
- o.Messages.AssertEqual(
- OnNext(210, 3),
- OnNext(240, 4),
- OnNext(270, 5)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(100, 390)
- );
- }
-
- [TestMethod]
- public void Multicast_Hot_3()
- {
- var scheduler = new TestScheduler();
-
- var s = new Subject<int>();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(40, 0),
- OnNext(90, 1),
- OnNext(150, 2),
- OnNext(210, 3),
- OnNext(240, 4),
- OnNext(270, 5),
- OnNext(330, 6),
- OnNext(340, 7),
- OnCompleted<int>(390)
- );
-
- var c = default(IConnectableObservable<int>);
- var o = scheduler.CreateObserver<int>();
- var d1 = default(IDisposable);
- var d2 = default(IDisposable);
-
- scheduler.ScheduleAbsolute(50, () => c = xs.Multicast(s));
- scheduler.ScheduleAbsolute(100, () => d2 = c.Connect());
- scheduler.ScheduleAbsolute(200, () => d1 = c.Subscribe(o));
- scheduler.ScheduleAbsolute(300, () => d2.Dispose());
- scheduler.ScheduleAbsolute(335, () => d2 = c.Connect());
-
- scheduler.Start();
-
- o.Messages.AssertEqual(
- OnNext(210, 3),
- OnNext(240, 4),
- OnNext(270, 5),
- OnNext(340, 7),
- OnCompleted<int>(390)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(100, 300),
- Subscribe(335, 390)
- );
- }
-
- [TestMethod]
- public void Multicast_Hot_4()
- {
- var scheduler = new TestScheduler();
-
- var s = new Subject<int>();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(40, 0),
- OnNext(90, 1),
- OnNext(150, 2),
- OnNext(210, 3),
- OnNext(240, 4),
- OnNext(270, 5),
- OnNext(330, 6),
- OnNext(340, 7),
- OnError<int>(390, ex)
- );
-
- var c = default(IConnectableObservable<int>);
- var o = scheduler.CreateObserver<int>();
- var d1 = default(IDisposable);
- var d2 = default(IDisposable);
-
- scheduler.ScheduleAbsolute(50, () => c = xs.Multicast(s));
- scheduler.ScheduleAbsolute(100, () => d2 = c.Connect());
- scheduler.ScheduleAbsolute(200, () => d1 = c.Subscribe(o));
- scheduler.ScheduleAbsolute(300, () => d2.Dispose());
- scheduler.ScheduleAbsolute(335, () => d2 = c.Connect());
-
- scheduler.Start();
-
- o.Messages.AssertEqual(
- OnNext(210, 3),
- OnNext(240, 4),
- OnNext(270, 5),
- OnNext(340, 7),
- OnError<int>(390, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(100, 300),
- Subscribe(335, 390)
- );
- }
-
- [TestMethod]
- public void Multicast_Hot_5()
- {
- var scheduler = new TestScheduler();
-
- var s = new Subject<int>();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(40, 0),
- OnNext(90, 1),
- OnNext(150, 2),
- OnNext(210, 3),
- OnNext(240, 4),
- OnNext(270, 5),
- OnNext(330, 6),
- OnNext(340, 7),
- OnError<int>(390, ex)
- );
-
- var c = default(IConnectableObservable<int>);
- var o = scheduler.CreateObserver<int>();
- var d1 = default(IDisposable);
- var d2 = default(IDisposable);
-
- scheduler.ScheduleAbsolute(50, () => c = xs.Multicast(s));
- scheduler.ScheduleAbsolute(100, () => d2 = c.Connect());
- scheduler.ScheduleAbsolute(400, () => d1 = c.Subscribe(o));
-
- scheduler.Start();
-
- o.Messages.AssertEqual(
- OnError<int>(400, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(100, 390)
- );
- }
-
- [TestMethod]
- public void Multicast_Hot_6()
- {
- var scheduler = new TestScheduler();
-
- var s = new Subject<int>();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(40, 0),
- OnNext(90, 1),
- OnNext(150, 2),
- OnNext(210, 3),
- OnNext(240, 4),
- OnNext(270, 5),
- OnNext(330, 6),
- OnNext(340, 7),
- OnCompleted<int>(390)
- );
-
- var c = default(IConnectableObservable<int>);
- var o = scheduler.CreateObserver<int>();
- var d1 = default(IDisposable);
- var d2 = default(IDisposable);
-
- scheduler.ScheduleAbsolute(50, () => c = xs.Multicast(s));
- scheduler.ScheduleAbsolute(100, () => d2 = c.Connect());
- scheduler.ScheduleAbsolute(400, () => d1 = c.Subscribe(o));
-
- scheduler.Start();
-
- o.Messages.AssertEqual(
- OnCompleted<int>(400)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(100, 390)
- );
- }
-
- [TestMethod]
- public void Multicast_Cold_Completed()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(40, 0),
- OnNext(90, 1),
- OnNext(150, 2),
- OnNext(210, 3),
- OnNext(240, 4),
- OnNext(270, 5),
- OnNext(330, 6),
- OnNext(340, 7),
- OnCompleted<int>(390)
- );
-
- var res = scheduler.Start(() =>
- xs.Multicast(() => new Subject<int>(), ys => ys)
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 3),
- OnNext(240, 4),
- OnNext(270, 5),
- OnNext(330, 6),
- OnNext(340, 7),
- OnCompleted<int>(390)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 390)
- );
- }
-
- [TestMethod]
- public void Multicast_Cold_Error()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(40, 0),
- OnNext(90, 1),
- OnNext(150, 2),
- OnNext(210, 3),
- OnNext(240, 4),
- OnNext(270, 5),
- OnNext(330, 6),
- OnNext(340, 7),
- OnError<int>(390, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.Multicast(() => new Subject<int>(), ys => ys)
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 3),
- OnNext(240, 4),
- OnNext(270, 5),
- OnNext(330, 6),
- OnNext(340, 7),
- OnError<int>(390, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 390)
- );
- }
-
- [TestMethod]
- public void Multicast_Cold_Dispose()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(40, 0),
- OnNext(90, 1),
- OnNext(150, 2),
- OnNext(210, 3),
- OnNext(240, 4),
- OnNext(270, 5),
- OnNext(330, 6),
- OnNext(340, 7)
- );
-
- var res = scheduler.Start(() =>
- xs.Multicast(() => new Subject<int>(), ys => ys)
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 3),
- OnNext(240, 4),
- OnNext(270, 5),
- OnNext(330, 6),
- OnNext(340, 7)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
- }
-
- [TestMethod]
- public void Multicast_Cold_Zip()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(40, 0),
- OnNext(90, 1),
- OnNext(150, 2),
- OnNext(210, 3),
- OnNext(240, 4),
- OnNext(270, 5),
- OnNext(330, 6),
- OnNext(340, 7),
- OnCompleted<int>(390)
- );
-
- var res = scheduler.Start(() =>
- xs.Multicast(() => new Subject<int>(), ys => ys.Zip(ys, (a, b) => a + b))
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 6),
- OnNext(240, 8),
- OnNext(270, 10),
- OnNext(330, 12),
- OnNext(340, 14),
- OnCompleted<int>(390)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 390)
- );
- }
-
- [TestMethod]
- public void Multicast_SubjectSelectorThrows()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(210, 1),
- OnNext(240, 2),
- OnCompleted<int>(300)
- );
-
- var res = scheduler.Start(() =>
- xs.Multicast<int, int, int>(() => { throw ex; }, _ => _)
- );
-
- res.Messages.AssertEqual(
- OnError<int>(200, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- );
- }
-
- [TestMethod]
- public void Multicast_SelectorThrows()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(210, 1),
- OnNext(240, 2),
- OnCompleted<int>(300)
- );
-
- var res = scheduler.Start(() =>
- xs.Multicast<int, int, int>(() => new Subject<int>(), _ => { throw ex; })
- );
-
- res.Messages.AssertEqual(
- OnError<int>(200, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- );
- }
-
- #endregion
-
- #region Publish
-
- [TestMethod]
- public void Publish_Cold_Zip()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(40, 0),
- OnNext(90, 1),
- OnNext(150, 2),
- OnNext(210, 3),
- OnNext(240, 4),
- OnNext(270, 5),
- OnNext(330, 6),
- OnNext(340, 7),
- OnCompleted<int>(390)
- );
-
- var res = scheduler.Start(() =>
- xs.Publish(ys => ys.Zip(ys, (a, b) => a + b))
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 6),
- OnNext(240, 8),
- OnNext(270, 10),
- OnNext(330, 12),
- OnNext(340, 14),
- OnCompleted<int>(390)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 390)
- );
- }
-
- [TestMethod]
- public void Publish_ArgumentChecking()
- {
- var someObservable = Observable.Empty<int>();
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Publish(default(IObservable<int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Publish(default(IObservable<int>), x => x));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Publish<int, int>(someObservable, null));
- }
-
- [TestMethod]
- public void Publish_Basic()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(110, 7),
- OnNext(220, 3),
- OnNext(280, 4),
- OnNext(290, 1),
- OnNext(340, 8),
- OnNext(360, 5),
- OnNext(370, 6),
- OnNext(390, 7),
- OnNext(410, 13),
- OnNext(430, 2),
- OnNext(450, 9),
- OnNext(520, 11),
- OnNext(560, 20),
- OnCompleted<int>(600)
- );
-
- var ys = default(IConnectableObservable<int>);
- var subscription = default(IDisposable);
- var connection = default(IDisposable);
- var res = scheduler.CreateObserver<int>();
-
- scheduler.ScheduleAbsolute(Created, () => ys = xs.Publish());
- scheduler.ScheduleAbsolute(Subscribed, () => subscription = ys.Subscribe(res));
- scheduler.ScheduleAbsolute(Disposed, () => subscription.Dispose());
-
- scheduler.ScheduleAbsolute(300, () => connection = ys.Connect());
- scheduler.ScheduleAbsolute(400, () => connection.Dispose());
-
- scheduler.ScheduleAbsolute(500, () => connection = ys.Connect());
- scheduler.ScheduleAbsolute(550, () => connection.Dispose());
-
- scheduler.ScheduleAbsolute(650, () => connection = ys.Connect());
- scheduler.ScheduleAbsolute(800, () => connection.Dispose());
-
- scheduler.Start();
-
- res.Messages.AssertEqual(
- OnNext(340, 8),
- OnNext(360, 5),
- OnNext(370, 6),
- OnNext(390, 7),
- OnNext(520, 11)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(300, 400),
- Subscribe(500, 550),
- Subscribe(650, 800)
- );
- }
-
- [TestMethod]
- public void Publish_Error()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(110, 7),
- OnNext(220, 3),
- OnNext(280, 4),
- OnNext(290, 1),
- OnNext(340, 8),
- OnNext(360, 5),
- OnNext(370, 6),
- OnNext(390, 7),
- OnNext(410, 13),
- OnNext(430, 2),
- OnNext(450, 9),
- OnNext(520, 11),
- OnNext(560, 20),
- OnError<int>(600, ex)
- );
-
- var ys = default(IConnectableObservable<int>);
- var subscription = default(IDisposable);
- var connection = default(IDisposable);
- var res = scheduler.CreateObserver<int>();
-
- scheduler.ScheduleAbsolute(Created, () => ys = xs.Publish());
- scheduler.ScheduleAbsolute(Subscribed, () => subscription = ys.Subscribe(res));
- scheduler.ScheduleAbsolute(Disposed, () => subscription.Dispose());
-
- scheduler.ScheduleAbsolute(300, () => connection = ys.Connect());
- scheduler.ScheduleAbsolute(400, () => connection.Dispose());
-
- scheduler.ScheduleAbsolute(500, () => connection = ys.Connect());
- scheduler.ScheduleAbsolute(800, () => connection.Dispose());
-
- scheduler.Start();
-
- res.Messages.AssertEqual(
- OnNext(340, 8),
- OnNext(360, 5),
- OnNext(370, 6),
- OnNext(390, 7),
- OnNext(520, 11),
- OnNext(560, 20),
- OnError<int>(600, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(300, 400),
- Subscribe(500, 600)
- );
- }
-
- [TestMethod]
- public void Publish_Complete()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(110, 7),
- OnNext(220, 3),
- OnNext(280, 4),
- OnNext(290, 1),
- OnNext(340, 8),
- OnNext(360, 5),
- OnNext(370, 6),
- OnNext(390, 7),
- OnNext(410, 13),
- OnNext(430, 2),
- OnNext(450, 9),
- OnNext(520, 11),
- OnNext(560, 20),
- OnCompleted<int>(600)
- );
-
- var ys = default(IConnectableObservable<int>);
- var subscription = default(IDisposable);
- var connection = default(IDisposable);
- var res = scheduler.CreateObserver<int>();
-
- scheduler.ScheduleAbsolute(Created, () => ys = xs.Publish());
- scheduler.ScheduleAbsolute(Subscribed, () => subscription = ys.Subscribe(res));
- scheduler.ScheduleAbsolute(Disposed, () => subscription.Dispose());
-
- scheduler.ScheduleAbsolute(300, () => connection = ys.Connect());
- scheduler.ScheduleAbsolute(400, () => connection.Dispose());
-
- scheduler.ScheduleAbsolute(500, () => connection = ys.Connect());
- scheduler.ScheduleAbsolute(800, () => connection.Dispose());
-
- scheduler.Start();
-
- res.Messages.AssertEqual(
- OnNext(340, 8),
- OnNext(360, 5),
- OnNext(370, 6),
- OnNext(390, 7),
- OnNext(520, 11),
- OnNext(560, 20),
- OnCompleted<int>(600)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(300, 400),
- Subscribe(500, 600)
- );
- }
-
- [TestMethod]
- public void Publish_Dispose()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(110, 7),
- OnNext(220, 3),
- OnNext(280, 4),
- OnNext(290, 1),
- OnNext(340, 8),
- OnNext(360, 5),
- OnNext(370, 6),
- OnNext(390, 7),
- OnNext(410, 13),
- OnNext(430, 2),
- OnNext(450, 9),
- OnNext(520, 11),
- OnNext(560, 20),
- OnCompleted<int>(600)
- );
-
- var ys = default(IConnectableObservable<int>);
- var subscription = default(IDisposable);
- var connection = default(IDisposable);
- var res = scheduler.CreateObserver<int>();
-
- scheduler.ScheduleAbsolute(Created, () => ys = xs.Publish());
- scheduler.ScheduleAbsolute(Subscribed, () => subscription = ys.Subscribe(res));
- scheduler.ScheduleAbsolute(350, () => subscription.Dispose());
-
- scheduler.ScheduleAbsolute(300, () => connection = ys.Connect());
- scheduler.ScheduleAbsolute(400, () => connection.Dispose());
-
- scheduler.ScheduleAbsolute(500, () => connection = ys.Connect());
- scheduler.ScheduleAbsolute(550, () => connection.Dispose());
-
- scheduler.ScheduleAbsolute(650, () => connection = ys.Connect());
- scheduler.ScheduleAbsolute(800, () => connection.Dispose());
-
- scheduler.Start();
-
- res.Messages.AssertEqual(
- OnNext(340, 8)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(300, 400),
- Subscribe(500, 550),
- Subscribe(650, 800)
- );
- }
-
- [TestMethod]
- public void Publish_MultipleConnections()
- {
- var xs = Observable.Never<int>();
- var ys = xs.Publish();
-
- var connection1 = ys.Connect();
- var connection2 = ys.Connect();
-
- Assert.AreSame(connection1, connection2);
-
- connection1.Dispose();
- connection2.Dispose();
-
- var connection3 = ys.Connect();
-
- Assert.AreNotSame(connection1, connection3);
-
- connection3.Dispose();
- }
-
- [TestMethod]
- public void PublishLambda_Zip_Complete()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(110, 7),
- OnNext(220, 3),
- OnNext(280, 4),
- OnNext(290, 1),
- OnNext(340, 8),
- OnNext(360, 5),
- OnNext(370, 6),
- OnNext(390, 7),
- OnNext(410, 13),
- OnNext(430, 2),
- OnNext(450, 9),
- OnNext(520, 11),
- OnNext(560, 20),
- OnCompleted<int>(600)
- );
-
- var res = scheduler.Start(() =>
- xs.Publish(_xs => _xs.Zip(_xs.Skip(1), (prev, cur) => cur + prev))
- );
-
- res.Messages.AssertEqual(
- OnNext(280, 7),
- OnNext(290, 5),
- OnNext(340, 9),
- OnNext(360, 13),
- OnNext(370, 11),
- OnNext(390, 13),
- OnNext(410, 20),
- OnNext(430, 15),
- OnNext(450, 11),
- OnNext(520, 20),
- OnNext(560, 31),
- OnCompleted<int>(600)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 600)
- );
- }
-
- [TestMethod]
- public void PublishLambda_Zip_Error()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(110, 7),
- OnNext(220, 3),
- OnNext(280, 4),
- OnNext(290, 1),
- OnNext(340, 8),
- OnNext(360, 5),
- OnNext(370, 6),
- OnNext(390, 7),
- OnNext(410, 13),
- OnNext(430, 2),
- OnNext(450, 9),
- OnNext(520, 11),
- OnNext(560, 20),
- OnError<int>(600, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.Publish(_xs => _xs.Zip(_xs.Skip(1), (prev, cur) => cur + prev))
- );
-
- res.Messages.AssertEqual(
- OnNext(280, 7),
- OnNext(290, 5),
- OnNext(340, 9),
- OnNext(360, 13),
- OnNext(370, 11),
- OnNext(390, 13),
- OnNext(410, 20),
- OnNext(430, 15),
- OnNext(450, 11),
- OnNext(520, 20),
- OnNext(560, 31),
- OnError<int>(600, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 600)
- );
- }
-
- [TestMethod]
- public void PublishLambda_Zip_Dispose()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(110, 7),
- OnNext(220, 3),
- OnNext(280, 4),
- OnNext(290, 1),
- OnNext(340, 8),
- OnNext(360, 5),
- OnNext(370, 6),
- OnNext(390, 7),
- OnNext(410, 13),
- OnNext(430, 2),
- OnNext(450, 9),
- OnNext(520, 11),
- OnNext(560, 20),
- OnCompleted<int>(600)
- );
-
- var res = scheduler.Start(() =>
- xs.Publish(_xs => _xs.Zip(_xs.Skip(1), (prev, cur) => cur + prev)),
- 470
- );
-
- res.Messages.AssertEqual(
- OnNext(280, 7),
- OnNext(290, 5),
- OnNext(340, 9),
- OnNext(360, 13),
- OnNext(370, 11),
- OnNext(390, 13),
- OnNext(410, 20),
- OnNext(430, 15),
- OnNext(450, 11)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 470)
- );
- }
-
- [TestMethod]
- public void PublishWithInitialValue_ArgumentChecking()
- {
- var someObservable = Observable.Empty<int>();
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Publish(default(IObservable<int>), 1));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Publish(default(IObservable<int>), x => x, 1));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Publish(someObservable, default(Func<IObservable<int>, IObservable<int>>), 1));
- }
-
- [TestMethod]
- public void PublishWithInitialValue_SanityCheck()
- {
- var someObservable = Observable.Empty<int>();
-
- Observable.Publish(Observable.Range(1, 10), x => x, 0).AssertEqual(Observable.Range(0, 11));
- }
-
- [TestMethod]
- public void PublishWithInitialValue_Basic()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(110, 7),
- OnNext(220, 3),
- OnNext(280, 4),
- OnNext(290, 1),
- OnNext(340, 8),
- OnNext(360, 5),
- OnNext(370, 6),
- OnNext(390, 7),
- OnNext(410, 13),
- OnNext(430, 2),
- OnNext(450, 9),
- OnNext(520, 11),
- OnNext(560, 20),
- OnCompleted<int>(600)
- );
-
- var ys = default(IConnectableObservable<int>);
- var subscription = default(IDisposable);
- var connection = default(IDisposable);
- var res = scheduler.CreateObserver<int>();
-
- scheduler.ScheduleAbsolute(Created, () => ys = xs.Publish(1979));
- scheduler.ScheduleAbsolute(Subscribed, () => subscription = ys.Subscribe(res));
- scheduler.ScheduleAbsolute(Disposed, () => subscription.Dispose());
-
- scheduler.ScheduleAbsolute(300, () => connection = ys.Connect());
- scheduler.ScheduleAbsolute(400, () => connection.Dispose());
-
- scheduler.ScheduleAbsolute(500, () => connection = ys.Connect());
- scheduler.ScheduleAbsolute(550, () => connection.Dispose());
-
- scheduler.ScheduleAbsolute(650, () => connection = ys.Connect());
- scheduler.ScheduleAbsolute(800, () => connection.Dispose());
-
- scheduler.Start();
-
- res.Messages.AssertEqual(
- OnNext(200, 1979),
- OnNext(340, 8),
- OnNext(360, 5),
- OnNext(370, 6),
- OnNext(390, 7),
- OnNext(520, 11)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(300, 400),
- Subscribe(500, 550),
- Subscribe(650, 800)
- );
- }
-
- [TestMethod]
- public void PublishWithInitialValue_Error()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(110, 7),
- OnNext(220, 3),
- OnNext(280, 4),
- OnNext(290, 1),
- OnNext(340, 8),
- OnNext(360, 5),
- OnNext(370, 6),
- OnNext(390, 7),
- OnNext(410, 13),
- OnNext(430, 2),
- OnNext(450, 9),
- OnNext(520, 11),
- OnNext(560, 20),
- OnError<int>(600, ex)
- );
-
- var ys = default(IConnectableObservable<int>);
- var subscription = default(IDisposable);
- var connection = default(IDisposable);
- var res = scheduler.CreateObserver<int>();
-
- scheduler.ScheduleAbsolute(Created, () => ys = xs.Publish(1979));
- scheduler.ScheduleAbsolute(Subscribed, () => subscription = ys.Subscribe(res));
- scheduler.ScheduleAbsolute(Disposed, () => subscription.Dispose());
-
- scheduler.ScheduleAbsolute(300, () => connection = ys.Connect());
- scheduler.ScheduleAbsolute(400, () => connection.Dispose());
-
- scheduler.ScheduleAbsolute(500, () => connection = ys.Connect());
- scheduler.ScheduleAbsolute(800, () => connection.Dispose());
-
- scheduler.Start();
-
- res.Messages.AssertEqual(
- OnNext(200, 1979),
- OnNext(340, 8),
- OnNext(360, 5),
- OnNext(370, 6),
- OnNext(390, 7),
- OnNext(520, 11),
- OnNext(560, 20),
- OnError<int>(600, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(300, 400),
- Subscribe(500, 600)
- );
- }
-
- [TestMethod]
- public void PublishWithInitialValue_Complete()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(110, 7),
- OnNext(220, 3),
- OnNext(280, 4),
- OnNext(290, 1),
- OnNext(340, 8),
- OnNext(360, 5),
- OnNext(370, 6),
- OnNext(390, 7),
- OnNext(410, 13),
- OnNext(430, 2),
- OnNext(450, 9),
- OnNext(520, 11),
- OnNext(560, 20),
- OnCompleted<int>(600)
- );
-
- var ys = default(IConnectableObservable<int>);
- var subscription = default(IDisposable);
- var connection = default(IDisposable);
- var res = scheduler.CreateObserver<int>();
-
- scheduler.ScheduleAbsolute(Created, () => ys = xs.Publish(1979));
- scheduler.ScheduleAbsolute(Subscribed, () => subscription = ys.Subscribe(res));
- scheduler.ScheduleAbsolute(Disposed, () => subscription.Dispose());
-
- scheduler.ScheduleAbsolute(300, () => connection = ys.Connect());
- scheduler.ScheduleAbsolute(400, () => connection.Dispose());
-
- scheduler.ScheduleAbsolute(500, () => connection = ys.Connect());
- scheduler.ScheduleAbsolute(800, () => connection.Dispose());
-
- scheduler.Start();
-
- res.Messages.AssertEqual(
- OnNext(200, 1979),
- OnNext(340, 8),
- OnNext(360, 5),
- OnNext(370, 6),
- OnNext(390, 7),
- OnNext(520, 11),
- OnNext(560, 20),
- OnCompleted<int>(600)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(300, 400),
- Subscribe(500, 600)
- );
- }
-
- [TestMethod]
- public void PublishWithInitialValue_Dispose()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(110, 7),
- OnNext(220, 3),
- OnNext(280, 4),
- OnNext(290, 1),
- OnNext(340, 8),
- OnNext(360, 5),
- OnNext(370, 6),
- OnNext(390, 7),
- OnNext(410, 13),
- OnNext(430, 2),
- OnNext(450, 9),
- OnNext(520, 11),
- OnNext(560, 20),
- OnCompleted<int>(600)
- );
-
- var ys = default(IConnectableObservable<int>);
- var subscription = default(IDisposable);
- var connection = default(IDisposable);
- var res = scheduler.CreateObserver<int>();
-
- scheduler.ScheduleAbsolute(Created, () => ys = xs.Publish(1979));
- scheduler.ScheduleAbsolute(Subscribed, () => subscription = ys.Subscribe(res));
- scheduler.ScheduleAbsolute(350, () => subscription.Dispose());
-
- scheduler.ScheduleAbsolute(300, () => connection = ys.Connect());
- scheduler.ScheduleAbsolute(400, () => connection.Dispose());
-
- scheduler.ScheduleAbsolute(500, () => connection = ys.Connect());
- scheduler.ScheduleAbsolute(550, () => connection.Dispose());
-
- scheduler.ScheduleAbsolute(650, () => connection = ys.Connect());
- scheduler.ScheduleAbsolute(800, () => connection.Dispose());
-
- scheduler.Start();
-
- res.Messages.AssertEqual(
- OnNext(200, 1979),
- OnNext(340, 8)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(300, 400),
- Subscribe(500, 550),
- Subscribe(650, 800)
- );
- }
-
- [TestMethod]
- public void PublishWithInitialValue_MultipleConnections()
- {
- var xs = Observable.Never<int>();
- var ys = xs.Publish(1979);
-
- var connection1 = ys.Connect();
- var connection2 = ys.Connect();
-
- Assert.AreSame(connection1, connection2);
-
- connection1.Dispose();
- connection2.Dispose();
-
- var connection3 = ys.Connect();
-
- Assert.AreNotSame(connection1, connection3);
-
- connection3.Dispose();
- }
-
- [TestMethod]
- public void PublishWithInitialValueLambda_Zip_Complete()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(110, 7),
- OnNext(220, 3),
- OnNext(280, 4),
- OnNext(290, 1),
- OnNext(340, 8),
- OnNext(360, 5),
- OnNext(370, 6),
- OnNext(390, 7),
- OnNext(410, 13),
- OnNext(430, 2),
- OnNext(450, 9),
- OnNext(520, 11),
- OnNext(560, 20),
- OnCompleted<int>(600)
- );
-
- var res = scheduler.Start(() =>
- xs.Publish(_xs => _xs.Zip(_xs.Skip(1), (prev, cur) => cur + prev), 1979)
- );
-
- res.Messages.AssertEqual(
- OnNext(220, 1982),
- OnNext(280, 7),
- OnNext(290, 5),
- OnNext(340, 9),
- OnNext(360, 13),
- OnNext(370, 11),
- OnNext(390, 13),
- OnNext(410, 20),
- OnNext(430, 15),
- OnNext(450, 11),
- OnNext(520, 20),
- OnNext(560, 31),
- OnCompleted<int>(600)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 600)
- );
- }
-
- [TestMethod]
- public void PublishWithInitialValueLambda_Zip_Error()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(110, 7),
- OnNext(220, 3),
- OnNext(280, 4),
- OnNext(290, 1),
- OnNext(340, 8),
- OnNext(360, 5),
- OnNext(370, 6),
- OnNext(390, 7),
- OnNext(410, 13),
- OnNext(430, 2),
- OnNext(450, 9),
- OnNext(520, 11),
- OnNext(560, 20),
- OnError<int>(600, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.Publish(_xs => _xs.Zip(_xs.Skip(1), (prev, cur) => cur + prev), 1979)
- );
-
- res.Messages.AssertEqual(
- OnNext(220, 1982),
- OnNext(280, 7),
- OnNext(290, 5),
- OnNext(340, 9),
- OnNext(360, 13),
- OnNext(370, 11),
- OnNext(390, 13),
- OnNext(410, 20),
- OnNext(430, 15),
- OnNext(450, 11),
- OnNext(520, 20),
- OnNext(560, 31),
- OnError<int>(600, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 600)
- );
- }
-
- [TestMethod]
- public void PublishWithInitialValueLambda_Zip_Dispose()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(110, 7),
- OnNext(220, 3),
- OnNext(280, 4),
- OnNext(290, 1),
- OnNext(340, 8),
- OnNext(360, 5),
- OnNext(370, 6),
- OnNext(390, 7),
- OnNext(410, 13),
- OnNext(430, 2),
- OnNext(450, 9),
- OnNext(520, 11),
- OnNext(560, 20),
- OnCompleted<int>(600)
- );
-
- var res = scheduler.Start(() =>
- xs.Publish(_xs => _xs.Zip(_xs.Skip(1), (prev, cur) => cur + prev), 1979),
- 470
- );
-
- res.Messages.AssertEqual(
- OnNext(220, 1982),
- OnNext(280, 7),
- OnNext(290, 5),
- OnNext(340, 9),
- OnNext(360, 13),
- OnNext(370, 11),
- OnNext(390, 13),
- OnNext(410, 20),
- OnNext(430, 15),
- OnNext(450, 11)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 470)
- );
- }
-
- #endregion
-
- #region PublishLast
-
- [TestMethod]
- public void PublishLast_ArgumentChecking()
- {
- var someObservable = Observable.Empty<int>();
- var scheduler = new TestScheduler();
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.PublishLast(default(IObservable<int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.PublishLast(default(IObservable<int>), x => x));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.PublishLast<int, int>(someObservable, null));
- }
-
- [TestMethod]
- public void PublishLast_Basic()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(110, 7),
- OnNext(220, 3),
- OnNext(280, 4),
- OnNext(290, 1),
- OnNext(340, 8),
- OnNext(360, 5),
- OnNext(370, 6),
- OnNext(390, 7),
- OnNext(410, 13),
- OnNext(430, 2),
- OnNext(450, 9),
- OnNext(520, 11),
- OnNext(560, 20),
- OnCompleted<int>(600)
- );
-
- var ys = default(IConnectableObservable<int>);
- var subscription = default(IDisposable);
- var connection = default(IDisposable);
- var res = scheduler.CreateObserver<int>();
-
- scheduler.ScheduleAbsolute(Created, () => ys = xs.PublishLast());
- scheduler.ScheduleAbsolute(Subscribed, () => subscription = ys.Subscribe(res));
- scheduler.ScheduleAbsolute(Disposed, () => subscription.Dispose());
-
- scheduler.ScheduleAbsolute(300, () => connection = ys.Connect());
- scheduler.ScheduleAbsolute(400, () => connection.Dispose());
-
- scheduler.ScheduleAbsolute(500, () => connection = ys.Connect());
- scheduler.ScheduleAbsolute(550, () => connection.Dispose());
-
- scheduler.ScheduleAbsolute(650, () => connection = ys.Connect());
- scheduler.ScheduleAbsolute(800, () => connection.Dispose());
-
- scheduler.Start();
-
- res.Messages.AssertEqual(
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(300, 400),
- Subscribe(500, 550),
- Subscribe(650, 800)
- );
- }
-
- [TestMethod]
- public void PublishLast_Error()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(110, 7),
- OnNext(220, 3),
- OnNext(280, 4),
- OnNext(290, 1),
- OnNext(340, 8),
- OnNext(360, 5),
- OnNext(370, 6),
- OnNext(390, 7),
- OnNext(410, 13),
- OnNext(430, 2),
- OnNext(450, 9),
- OnNext(520, 11),
- OnNext(560, 20),
- OnError<int>(600, ex)
- );
-
- var ys = default(IConnectableObservable<int>);
- var subscription = default(IDisposable);
- var connection = default(IDisposable);
- var res = scheduler.CreateObserver<int>();
-
- scheduler.ScheduleAbsolute(Created, () => ys = xs.PublishLast());
- scheduler.ScheduleAbsolute(Subscribed, () => subscription = ys.Subscribe(res));
- scheduler.ScheduleAbsolute(Disposed, () => subscription.Dispose());
-
- scheduler.ScheduleAbsolute(300, () => connection = ys.Connect());
- scheduler.ScheduleAbsolute(400, () => connection.Dispose());
-
- scheduler.ScheduleAbsolute(500, () => connection = ys.Connect());
- scheduler.ScheduleAbsolute(800, () => connection.Dispose());
-
- scheduler.Start();
-
- res.Messages.AssertEqual(
- OnError<int>(600, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(300, 400),
- Subscribe(500, 600)
- );
- }
-
- [TestMethod]
- public void PublishLast_Complete()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(110, 7),
- OnNext(220, 3),
- OnNext(280, 4),
- OnNext(290, 1),
- OnNext(340, 8),
- OnNext(360, 5),
- OnNext(370, 6),
- OnNext(390, 7),
- OnNext(410, 13),
- OnNext(430, 2),
- OnNext(450, 9),
- OnNext(520, 11),
- OnNext(560, 20),
- OnCompleted<int>(600)
- );
-
- var ys = default(IConnectableObservable<int>);
- var subscription = default(IDisposable);
- var connection = default(IDisposable);
- var res = scheduler.CreateObserver<int>();
-
- scheduler.ScheduleAbsolute(Created, () => ys = xs.PublishLast());
- scheduler.ScheduleAbsolute(Subscribed, () => subscription = ys.Subscribe(res));
- scheduler.ScheduleAbsolute(Disposed, () => subscription.Dispose());
-
- scheduler.ScheduleAbsolute(300, () => connection = ys.Connect());
- scheduler.ScheduleAbsolute(400, () => connection.Dispose());
-
- scheduler.ScheduleAbsolute(500, () => connection = ys.Connect());
- scheduler.ScheduleAbsolute(800, () => connection.Dispose());
-
- scheduler.Start();
-
- res.Messages.AssertEqual(
- OnNext(600, 20),
- OnCompleted<int>(600)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(300, 400),
- Subscribe(500, 600)
- );
- }
-
- [TestMethod]
- public void PublishLast_Dispose()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(110, 7),
- OnNext(220, 3),
- OnNext(280, 4),
- OnNext(290, 1),
- OnNext(340, 8),
- OnNext(360, 5),
- OnNext(370, 6),
- OnNext(390, 7),
- OnNext(410, 13),
- OnNext(430, 2),
- OnNext(450, 9),
- OnNext(520, 11),
- OnNext(560, 20),
- OnCompleted<int>(600)
- );
-
- var ys = default(IConnectableObservable<int>);
- var subscription = default(IDisposable);
- var connection = default(IDisposable);
- var res = scheduler.CreateObserver<int>();
-
- scheduler.ScheduleAbsolute(Created, () => ys = xs.PublishLast());
- scheduler.ScheduleAbsolute(Subscribed, () => subscription = ys.Subscribe(res));
- scheduler.ScheduleAbsolute(350, () => subscription.Dispose());
-
- scheduler.ScheduleAbsolute(300, () => connection = ys.Connect());
- scheduler.ScheduleAbsolute(400, () => connection.Dispose());
-
- scheduler.ScheduleAbsolute(500, () => connection = ys.Connect());
- scheduler.ScheduleAbsolute(550, () => connection.Dispose());
-
- scheduler.ScheduleAbsolute(650, () => connection = ys.Connect());
- scheduler.ScheduleAbsolute(800, () => connection.Dispose());
-
- scheduler.Start();
-
- res.Messages.AssertEqual(
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(300, 400),
- Subscribe(500, 550),
- Subscribe(650, 800)
- );
- }
-
- [TestMethod]
- public void PublishLast_MultipleConnections()
- {
- var xs = Observable.Never<int>();
- var ys = xs.PublishLast();
-
- var connection1 = ys.Connect();
- var connection2 = ys.Connect();
-
- Assert.AreSame(connection1, connection2);
-
- connection1.Dispose();
- connection2.Dispose();
-
- var connection3 = ys.Connect();
-
- Assert.AreNotSame(connection1, connection3);
-
- connection3.Dispose();
- }
-
- [TestMethod]
- public void PublishLastLambda_Zip_Complete()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(110, 7),
- OnNext(220, 3),
- OnNext(280, 4),
- OnNext(290, 1),
- OnNext(340, 8),
- OnNext(360, 5),
- OnNext(370, 6),
- OnNext(390, 7),
- OnNext(410, 13),
- OnNext(430, 2),
- OnNext(450, 9),
- OnNext(520, 11),
- OnNext(560, 20),
- OnCompleted<int>(600)
- );
-
- var res = scheduler.Start(() =>
- xs.PublishLast(_xs => _xs.Zip(_xs, (x, y) => x + y))
- );
-
- res.Messages.AssertEqual(
- OnNext(600, 40),
- OnCompleted<int>(600)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 600)
- );
- }
-
- [TestMethod]
- public void PublishLastLambda_Zip_Error()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(110, 7),
- OnNext(220, 3),
- OnNext(280, 4),
- OnNext(290, 1),
- OnNext(340, 8),
- OnNext(360, 5),
- OnNext(370, 6),
- OnNext(390, 7),
- OnNext(410, 13),
- OnNext(430, 2),
- OnNext(450, 9),
- OnNext(520, 11),
- OnNext(560, 20),
- OnError<int>(600, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.PublishLast(_xs => _xs.Zip(_xs, (x, y) => x + y))
- );
-
- res.Messages.AssertEqual(
- OnError<int>(600, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 600)
- );
- }
-
- [TestMethod]
- public void PublishLastLambda_Zip_Dispose()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(110, 7),
- OnNext(220, 3),
- OnNext(280, 4),
- OnNext(290, 1),
- OnNext(340, 8),
- OnNext(360, 5),
- OnNext(370, 6),
- OnNext(390, 7),
- OnNext(410, 13),
- OnNext(430, 2),
- OnNext(450, 9),
- OnNext(520, 11),
- OnNext(560, 20),
- OnCompleted<int>(600)
- );
-
- var res = scheduler.Start(() =>
- xs.PublishLast(_xs => _xs.Zip(_xs, (x, y) => x + y)),
- 470
- );
-
- res.Messages.AssertEqual(
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 470)
- );
- }
-
- #endregion
-
- #region RefCount
-
- [TestMethod]
- public void RefCount_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.RefCount<int>(null));
- }
-
- [TestMethod]
- public void RefCount_ConnectsOnFirst()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable<int>(
- OnNext(210, 1),
- OnNext(220, 2),
- OnNext(230, 3),
- OnNext(240, 4),
- OnCompleted<int>(250)
- );
-
- var subject = new MySubject();
-
- var conn = new ConnectableObservable<int>(xs, subject);
-
- var res = scheduler.Start(() =>
- conn.RefCount()
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 1),
- OnNext(220, 2),
- OnNext(230, 3),
- OnNext(240, 4),
- OnCompleted<int>(250)
- );
-
- Assert.IsTrue(subject.Disposed);
- }
-
- [TestMethod]
- public void RefCount_NotConnected()
- {
- var disconnected = false;
- var count = 0;
- var xs = Observable.Defer(() =>
- {
- count++;
- return Observable.Create<int>(obs =>
- {
- return () => { disconnected = true; };
- });
- });
-
- var subject = new MySubject();
-
- var conn = new ConnectableObservable<int>(xs, subject);
- var refd = conn.RefCount();
-
- var dis1 = refd.Subscribe();
- Assert.AreEqual(1, count);
- Assert.AreEqual(1, subject.SubscribeCount);
- Assert.IsFalse(disconnected);
-
- var dis2 = refd.Subscribe();
- Assert.AreEqual(1, count);
- Assert.AreEqual(2, subject.SubscribeCount);
- Assert.IsFalse(disconnected);
-
- dis1.Dispose();
- Assert.IsFalse(disconnected);
- dis2.Dispose();
- Assert.IsTrue(disconnected);
- disconnected = false;
-
- var dis3 = refd.Subscribe();
- Assert.AreEqual(2, count);
- Assert.AreEqual(3, subject.SubscribeCount);
- Assert.IsFalse(disconnected);
-
- dis3.Dispose();
- Assert.IsTrue(disconnected);
- }
-
- [TestMethod]
- public void RefCount_OnError()
- {
- var ex = new Exception();
- var xs = Observable.Throw<int>(ex, Scheduler.Immediate);
-
- var res = xs.Publish().RefCount();
-
- res.Subscribe(_ => { Assert.Fail(); }, ex_ => { Assert.AreSame(ex, ex_); }, () => { Assert.Fail(); });
- res.Subscribe(_ => { Assert.Fail(); }, ex_ => { Assert.AreSame(ex, ex_); }, () => { Assert.Fail(); });
- }
-
- [TestMethod]
- public void RefCount_Publish()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable<int>(
- OnNext(210, 1),
- OnNext(220, 2),
- OnNext(230, 3),
- OnNext(240, 4),
- OnNext(250, 5),
- OnNext(260, 6),
- OnNext(270, 7),
- OnNext(280, 8),
- OnNext(290, 9),
- OnCompleted<int>(300)
- );
-
- var res = xs.Publish().RefCount();
-
- var d1 = default(IDisposable);
- var o1 = scheduler.CreateObserver<int>();
- scheduler.ScheduleAbsolute(215, () => { d1 = res.Subscribe(o1); });
- scheduler.ScheduleAbsolute(235, () => { d1.Dispose(); });
-
- var d2 = default(IDisposable);
- var o2 = scheduler.CreateObserver<int>();
- scheduler.ScheduleAbsolute(225, () => { d2 = res.Subscribe(o2); });
- scheduler.ScheduleAbsolute(275, () => { d2.Dispose(); });
-
- var d3 = default(IDisposable);
- var o3 = scheduler.CreateObserver<int>();
- scheduler.ScheduleAbsolute(255, () => { d3 = res.Subscribe(o3); });
- scheduler.ScheduleAbsolute(265, () => { d3.Dispose(); });
-
- var d4 = default(IDisposable);
- var o4 = scheduler.CreateObserver<int>();
- scheduler.ScheduleAbsolute(285, () => { d4 = res.Subscribe(o4); });
- scheduler.ScheduleAbsolute(320, () => { d4.Dispose(); });
-
- scheduler.Start();
-
- o1.Messages.AssertEqual(
- OnNext(220, 2),
- OnNext(230, 3)
- );
-
- o2.Messages.AssertEqual(
- OnNext(230, 3),
- OnNext(240, 4),
- OnNext(250, 5),
- OnNext(260, 6),
- OnNext(270, 7)
- );
-
- o3.Messages.AssertEqual(
- OnNext(260, 6)
- );
-
- o4.Messages.AssertEqual(
- OnNext(290, 9),
- OnCompleted<int>(300)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(215, 275),
- Subscribe(285, 300)
- );
- }
-
- #endregion
-
- #region Replay
-
- [TestMethod]
- public void Replay_ArgumentChecking()
- {
- var someObservable = Observable.Empty<int>();
- var scheduler = new TestScheduler();
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Replay(default(IObservable<int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Replay(default(IObservable<int>), x => x));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Replay<int, int>(someObservable, null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Replay<int>(null, DummyScheduler.Instance));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Replay<int>(DummyObservable<int>.Instance, (IScheduler)null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Replay<int, int>(null, DummyFunc<IObservable<int>, IObservable<int>>.Instance, DummyScheduler.Instance));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Replay<int, int>(DummyObservable<int>.Instance, null, DummyScheduler.Instance));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Replay<int, int>(DummyObservable<int>.Instance, DummyFunc<IObservable<int>, IObservable<int>>.Instance, null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Replay(default(IObservable<int>), TimeSpan.FromSeconds(1)));
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => Observable.Replay(someObservable, TimeSpan.FromSeconds(-1)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Replay(default(IObservable<int>), x => x, TimeSpan.FromSeconds(1)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Replay<int, int>(someObservable, null, TimeSpan.FromSeconds(1)));
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => Observable.Replay<int, int>(someObservable, x => x, TimeSpan.FromSeconds(-1)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Replay(default(IObservable<int>), TimeSpan.FromSeconds(1), scheduler));
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => Observable.Replay(someObservable, TimeSpan.FromSeconds(-1), scheduler));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Replay(someObservable, TimeSpan.FromSeconds(1), default(IScheduler)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Replay(default(IObservable<int>), x => x, TimeSpan.FromSeconds(1), scheduler));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Replay<int, int>(someObservable, null, TimeSpan.FromSeconds(1), scheduler));
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => Observable.Replay(someObservable, x => x, TimeSpan.FromSeconds(-1), scheduler));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Replay(someObservable, x => x, TimeSpan.FromSeconds(1), default(IScheduler)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Replay(default(IObservable<int>), 1, scheduler));
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => Observable.Replay(someObservable, -2, scheduler));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Replay(someObservable, 1, default(IScheduler)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Replay(default(IObservable<int>), x => x, 1, scheduler));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Replay<int, int>(someObservable, null, -2, scheduler));
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => Observable.Replay(someObservable, x => x, -2, scheduler));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Replay(someObservable, x => x, 1, default(IScheduler)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Replay(default(IObservable<int>), 1));
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => Observable.Replay(someObservable, -2));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Replay(default(IObservable<int>), x => x, 1));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Replay<int, int>(someObservable, null, 1));
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => Observable.Replay(someObservable, x => x, -2));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Replay(default(IObservable<int>), 1, TimeSpan.FromSeconds(1)));
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => Observable.Replay(someObservable, -2, TimeSpan.FromSeconds(1)));
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => Observable.Replay(someObservable, 1, TimeSpan.FromSeconds(-1)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Replay(default(IObservable<int>), x => x, 1, TimeSpan.FromSeconds(1)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Replay<int, int>(someObservable, null, 1, TimeSpan.FromSeconds(1)));
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => Observable.Replay(someObservable, x => x, -2, TimeSpan.FromSeconds(1)));
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => Observable.Replay(someObservable, x => x, 1, TimeSpan.FromSeconds(-1)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Replay(default(IObservable<int>), 1, TimeSpan.FromSeconds(1), scheduler));
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => Observable.Replay(someObservable, -2, TimeSpan.FromSeconds(1), scheduler));
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => Observable.Replay(someObservable, 1, TimeSpan.FromSeconds(-1), scheduler));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Replay(someObservable, 1, TimeSpan.FromSeconds(1), null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Replay(default(IObservable<int>), x => x, 1, TimeSpan.FromSeconds(1), scheduler));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Replay<int, int>(someObservable, null, 1, TimeSpan.FromSeconds(1), scheduler));
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => Observable.Replay(someObservable, x => x, -2, TimeSpan.FromSeconds(1), scheduler));
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => Observable.Replay(someObservable, x => x, 1, TimeSpan.FromSeconds(-1), scheduler));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Replay(someObservable, x => x, 1, TimeSpan.FromSeconds(1), null));
- }
-
- [TestMethod]
- public void ReplayCount_Basic()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(110, 7),
- OnNext(220, 3),
- OnNext(280, 4),
- OnNext(290, 1),
- OnNext(340, 8),
- OnNext(360, 5),
- OnNext(370, 6),
- OnNext(390, 7),
- OnNext(410, 13),
- OnNext(430, 2),
- OnNext(450, 9),
- OnNext(520, 11),
- OnNext(560, 20),
- OnCompleted<int>(600)
- );
-
- var ys = default(IConnectableObservable<int>);
- var subscription = default(IDisposable);
- var connection = default(IDisposable);
- var res = scheduler.CreateObserver<int>();
-
- scheduler.ScheduleAbsolute(Created, () => ys = xs.Replay(3, scheduler));
- scheduler.ScheduleAbsolute(450, () => subscription = ys.Subscribe(res));
- scheduler.ScheduleAbsolute(Disposed, () => subscription.Dispose());
-
- scheduler.ScheduleAbsolute(300, () => connection = ys.Connect());
- scheduler.ScheduleAbsolute(400, () => connection.Dispose());
-
- scheduler.ScheduleAbsolute(500, () => connection = ys.Connect());
- scheduler.ScheduleAbsolute(550, () => connection.Dispose());
-
- scheduler.ScheduleAbsolute(650, () => connection = ys.Connect());
- scheduler.ScheduleAbsolute(800, () => connection.Dispose());
-
- scheduler.Start();
-
- res.Messages.AssertEqual(
- OnNext(451, 5),
- OnNext(452, 6),
- OnNext(453, 7),
- OnNext(521, 11)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(300, 400),
- Subscribe(500, 550),
- Subscribe(650, 800)
- );
- }
-
- [TestMethod]
- public void ReplayCount_Error()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(110, 7),
- OnNext(220, 3),
- OnNext(280, 4),
- OnNext(290, 1),
- OnNext(340, 8),
- OnNext(360, 5),
- OnNext(370, 6),
- OnNext(390, 7),
- OnNext(410, 13),
- OnNext(430, 2),
- OnNext(450, 9),
- OnNext(520, 11),
- OnNext(560, 20),
- OnError<int>(600, ex)
- );
-
- var ys = default(IConnectableObservable<int>);
- var subscription = default(IDisposable);
- var connection = default(IDisposable);
- var res = scheduler.CreateObserver<int>();
-
- scheduler.ScheduleAbsolute(Created, () => ys = xs.Replay(3, scheduler));
- scheduler.ScheduleAbsolute(450, () => subscription = ys.Subscribe(res));
- scheduler.ScheduleAbsolute(Disposed, () => subscription.Dispose());
-
- scheduler.ScheduleAbsolute(300, () => connection = ys.Connect());
- scheduler.ScheduleAbsolute(400, () => connection.Dispose());
-
- scheduler.ScheduleAbsolute(500, () => connection = ys.Connect());
- scheduler.ScheduleAbsolute(800, () => connection.Dispose());
-
- scheduler.Start();
-
- res.Messages.AssertEqual(
- OnNext(451, 5),
- OnNext(452, 6),
- OnNext(453, 7),
- OnNext(521, 11),
- OnNext(561, 20),
- OnError<int>(601, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(300, 400),
- Subscribe(500, 600)
- );
- }
-
- [TestMethod]
- public void ReplayCount_Complete()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(110, 7),
- OnNext(220, 3),
- OnNext(280, 4),
- OnNext(290, 1),
- OnNext(340, 8),
- OnNext(360, 5),
- OnNext(370, 6),
- OnNext(390, 7),
- OnNext(410, 13),
- OnNext(430, 2),
- OnNext(450, 9),
- OnNext(520, 11),
- OnNext(560, 20),
- OnCompleted<int>(600)
- );
-
- var ys = default(IConnectableObservable<int>);
- var subscription = default(IDisposable);
- var connection = default(IDisposable);
- var res = scheduler.CreateObserver<int>();
-
- scheduler.ScheduleAbsolute(Created, () => ys = xs.Replay(3, scheduler));
- scheduler.ScheduleAbsolute(450, () => subscription = ys.Subscribe(res));
- scheduler.ScheduleAbsolute(Disposed, () => subscription.Dispose());
-
- scheduler.ScheduleAbsolute(300, () => connection = ys.Connect());
- scheduler.ScheduleAbsolute(400, () => connection.Dispose());
-
- scheduler.ScheduleAbsolute(500, () => connection = ys.Connect());
- scheduler.ScheduleAbsolute(800, () => connection.Dispose());
-
- scheduler.Start();
-
- res.Messages.AssertEqual(
- OnNext(451, 5),
- OnNext(452, 6),
- OnNext(453, 7),
- OnNext(521, 11),
- OnNext(561, 20),
- OnCompleted<int>(601)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(300, 400),
- Subscribe(500, 600)
- );
- }
-
- [TestMethod]
- public void ReplayCount_Dispose()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(110, 7),
- OnNext(220, 3),
- OnNext(280, 4),
- OnNext(290, 1),
- OnNext(340, 8),
- OnNext(360, 5),
- OnNext(370, 6),
- OnNext(390, 7),
- OnNext(410, 13),
- OnNext(430, 2),
- OnNext(450, 9),
- OnNext(520, 11),
- OnNext(560, 20),
- OnCompleted<int>(600)
- );
-
- var ys = default(IConnectableObservable<int>);
- var subscription = default(IDisposable);
- var connection = default(IDisposable);
- var res = scheduler.CreateObserver<int>();
-
- scheduler.ScheduleAbsolute(Created, () => ys = xs.Replay(3, scheduler));
- scheduler.ScheduleAbsolute(450, () => subscription = ys.Subscribe(res));
- scheduler.ScheduleAbsolute(475, () => subscription.Dispose());
-
- scheduler.ScheduleAbsolute(300, () => connection = ys.Connect());
- scheduler.ScheduleAbsolute(400, () => connection.Dispose());
-
- scheduler.ScheduleAbsolute(500, () => connection = ys.Connect());
- scheduler.ScheduleAbsolute(550, () => connection.Dispose());
-
- scheduler.ScheduleAbsolute(650, () => connection = ys.Connect());
- scheduler.ScheduleAbsolute(800, () => connection.Dispose());
-
- scheduler.Start();
-
- res.Messages.AssertEqual(
- OnNext(451, 5),
- OnNext(452, 6),
- OnNext(453, 7)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(300, 400),
- Subscribe(500, 550),
- Subscribe(650, 800)
- );
- }
-
- [TestMethod]
- public void ReplayCount_MultipleConnections()
- {
- var xs = Observable.Never<int>();
- var ys = xs.Replay(3, new TestScheduler());
-
- var connection1 = ys.Connect();
- var connection2 = ys.Connect();
-
- Assert.AreSame(connection1, connection2);
-
- connection1.Dispose();
- connection2.Dispose();
-
- var connection3 = ys.Connect();
-
- Assert.AreNotSame(connection1, connection3);
-
- connection3.Dispose();
- }
-
- [TestMethod]
- public void ReplayCountLambda_Zip_Complete()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(110, 7),
- OnNext(220, 3),
- OnNext(280, 4),
- OnNext(290, 1),
- OnNext(340, 8),
- OnNext(360, 5),
- OnNext(370, 6),
- OnNext(390, 7),
- OnNext(410, 13),
- OnNext(430, 2),
- OnNext(450, 9),
- OnNext(520, 11),
- OnNext(560, 20),
- OnCompleted<int>(600)
- );
-
- var res = scheduler.Start(() =>
- xs.Replay(_xs => _xs.Take(6).Repeat(), 3, scheduler),
- 610
- );
-
- res.Messages.AssertEqual(
- OnNext(221, 3),
- OnNext(281, 4),
- OnNext(291, 1),
- OnNext(341, 8),
- OnNext(361, 5),
- OnNext(371, 6),
- OnNext(372, 8),
- OnNext(373, 5),
- OnNext(374, 6),
- OnNext(391, 7),
- OnNext(411, 13),
- OnNext(431, 2),
- OnNext(432, 7),
- OnNext(433, 13),
- OnNext(434, 2),
- OnNext(451, 9),
- OnNext(521, 11),
- OnNext(561, 20),
- OnNext(562, 9),
- OnNext(563, 11),
- OnNext(564, 20),
- OnNext(602, 9),
- OnNext(603, 11),
- OnNext(604, 20),
- OnNext(606, 9),
- OnNext(607, 11),
- OnNext(608, 20)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 600)
- );
- }
-
- [TestMethod]
- public void ReplayCountLambda_Zip_Error()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(110, 7),
- OnNext(220, 3),
- OnNext(280, 4),
- OnNext(290, 1),
- OnNext(340, 8),
- OnNext(360, 5),
- OnNext(370, 6),
- OnNext(390, 7),
- OnNext(410, 13),
- OnNext(430, 2),
- OnNext(450, 9),
- OnNext(520, 11),
- OnNext(560, 20),
- OnError<int>(600, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.Replay(_xs => _xs.Take(6).Repeat(), 3, scheduler)
- );
-
- res.Messages.AssertEqual(
- OnNext(221, 3),
- OnNext(281, 4),
- OnNext(291, 1),
- OnNext(341, 8),
- OnNext(361, 5),
- OnNext(371, 6),
- OnNext(372, 8),
- OnNext(373, 5),
- OnNext(374, 6),
- OnNext(391, 7),
- OnNext(411, 13),
- OnNext(431, 2),
- OnNext(432, 7),
- OnNext(433, 13),
- OnNext(434, 2),
- OnNext(451, 9),
- OnNext(521, 11),
- OnNext(561, 20),
- OnNext(562, 9),
- OnNext(563, 11),
- OnNext(564, 20),
- OnError<int>(601, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 600)
- );
- }
-
- [TestMethod]
- public void ReplayCountLambda_Zip_Dispose()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(110, 7),
- OnNext(220, 3),
- OnNext(280, 4),
- OnNext(290, 1),
- OnNext(340, 8),
- OnNext(360, 5),
- OnNext(370, 6),
- OnNext(390, 7),
- OnNext(410, 13),
- OnNext(430, 2),
- OnNext(450, 9),
- OnNext(520, 11),
- OnNext(560, 20),
- OnCompleted<int>(600)
- );
-
- var res = scheduler.Start(() =>
- xs.Replay(_xs => _xs.Take(6).Repeat(), 3, scheduler),
- 470
- );
-
- res.Messages.AssertEqual(
- OnNext(221, 3),
- OnNext(281, 4),
- OnNext(291, 1),
- OnNext(341, 8),
- OnNext(361, 5),
- OnNext(371, 6),
- OnNext(372, 8),
- OnNext(373, 5),
- OnNext(374, 6),
- OnNext(391, 7),
- OnNext(411, 13),
- OnNext(431, 2),
- OnNext(432, 7),
- OnNext(433, 13),
- OnNext(434, 2),
- OnNext(451, 9)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 470)
- );
- }
-
- [TestMethod]
- public void ReplayTime_Basic()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(110, 7),
- OnNext(220, 3),
- OnNext(280, 4),
- OnNext(290, 1),
- OnNext(340, 8),
- OnNext(360, 5),
- OnNext(370, 6),
- OnNext(390, 7),
- OnNext(410, 13),
- OnNext(430, 2),
- OnNext(450, 9),
- OnNext(520, 11),
- OnNext(560, 20),
- OnCompleted<int>(600)
- );
-
- var ys = default(IConnectableObservable<int>);
- var subscription = default(IDisposable);
- var connection = default(IDisposable);
- var res = scheduler.CreateObserver<int>();
-
- scheduler.ScheduleAbsolute(Created, () => ys = xs.Replay(TimeSpan.FromTicks(150), scheduler));
- scheduler.ScheduleAbsolute(450, () => subscription = ys.Subscribe(res));
- scheduler.ScheduleAbsolute(Disposed, () => subscription.Dispose());
-
- scheduler.ScheduleAbsolute(300, () => connection = ys.Connect());
- scheduler.ScheduleAbsolute(400, () => connection.Dispose());
-
- scheduler.ScheduleAbsolute(500, () => connection = ys.Connect());
- scheduler.ScheduleAbsolute(550, () => connection.Dispose());
-
- scheduler.ScheduleAbsolute(650, () => connection = ys.Connect());
- scheduler.ScheduleAbsolute(800, () => connection.Dispose());
-
- scheduler.Start();
-
- res.Messages.AssertEqual(
- OnNext(451, 8),
- OnNext(452, 5),
- OnNext(453, 6),
- OnNext(454, 7),
- OnNext(521, 11)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(300, 400),
- Subscribe(500, 550),
- Subscribe(650, 800)
- );
- }
-
- [TestMethod]
- public void ReplayTime_Error()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(110, 7),
- OnNext(220, 3),
- OnNext(280, 4),
- OnNext(290, 1),
- OnNext(340, 8),
- OnNext(360, 5),
- OnNext(370, 6),
- OnNext(390, 7),
- OnNext(410, 13),
- OnNext(430, 2),
- OnNext(450, 9),
- OnNext(520, 11),
- OnNext(560, 20),
- OnError<int>(600, ex)
- );
-
- var ys = default(IConnectableObservable<int>);
- var subscription = default(IDisposable);
- var connection = default(IDisposable);
- var res = scheduler.CreateObserver<int>();
-
- scheduler.ScheduleAbsolute(Created, () => ys = xs.Replay(TimeSpan.FromTicks(75), scheduler));
- scheduler.ScheduleAbsolute(450, () => subscription = ys.Subscribe(res));
- scheduler.ScheduleAbsolute(Disposed, () => subscription.Dispose());
-
- scheduler.ScheduleAbsolute(300, () => connection = ys.Connect());
- scheduler.ScheduleAbsolute(400, () => connection.Dispose());
-
- scheduler.ScheduleAbsolute(500, () => connection = ys.Connect());
- scheduler.ScheduleAbsolute(800, () => connection.Dispose());
-
- scheduler.Start();
-
- res.Messages.AssertEqual(
- OnNext(451, 7),
- OnNext(521, 11),
- OnNext(561, 20),
- OnError<int>(601, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(300, 400),
- Subscribe(500, 600)
- );
- }
-
- [TestMethod]
- public void ReplayTime_Complete()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(110, 7),
- OnNext(220, 3),
- OnNext(280, 4),
- OnNext(290, 1),
- OnNext(340, 8),
- OnNext(360, 5),
- OnNext(370, 6),
- OnNext(390, 7),
- OnNext(410, 13),
- OnNext(430, 2),
- OnNext(450, 9),
- OnNext(520, 11),
- OnNext(560, 20),
- OnCompleted<int>(600)
- );
-
- var ys = default(IConnectableObservable<int>);
- var subscription = default(IDisposable);
- var connection = default(IDisposable);
- var res = scheduler.CreateObserver<int>();
-
- scheduler.ScheduleAbsolute(Created, () => ys = xs.Replay(TimeSpan.FromTicks(85), scheduler));
- scheduler.ScheduleAbsolute(450, () => subscription = ys.Subscribe(res));
- scheduler.ScheduleAbsolute(Disposed, () => subscription.Dispose());
-
- scheduler.ScheduleAbsolute(300, () => connection = ys.Connect());
- scheduler.ScheduleAbsolute(400, () => connection.Dispose());
-
- scheduler.ScheduleAbsolute(500, () => connection = ys.Connect());
- scheduler.ScheduleAbsolute(800, () => connection.Dispose());
-
- scheduler.Start();
-
- res.Messages.AssertEqual(
- OnNext(451, 6),
- OnNext(452, 7),
- OnNext(521, 11),
- OnNext(561, 20),
- OnCompleted<int>(601)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(300, 400),
- Subscribe(500, 600)
- );
- }
-
- [TestMethod]
- public void ReplayTime_Dispose()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(110, 7),
- OnNext(220, 3),
- OnNext(280, 4),
- OnNext(290, 1),
- OnNext(340, 8),
- OnNext(360, 5),
- OnNext(370, 6),
- OnNext(390, 7),
- OnNext(410, 13),
- OnNext(430, 2),
- OnNext(450, 9),
- OnNext(520, 11),
- OnNext(560, 20),
- OnCompleted<int>(600)
- );
-
- var ys = default(IConnectableObservable<int>);
- var subscription = default(IDisposable);
- var connection = default(IDisposable);
- var res = scheduler.CreateObserver<int>();
-
- scheduler.ScheduleAbsolute(Created, () => ys = xs.Replay(TimeSpan.FromTicks(100), scheduler));
- scheduler.ScheduleAbsolute(450, () => subscription = ys.Subscribe(res));
- scheduler.ScheduleAbsolute(475, () => subscription.Dispose());
-
- scheduler.ScheduleAbsolute(300, () => connection = ys.Connect());
- scheduler.ScheduleAbsolute(400, () => connection.Dispose());
-
- scheduler.ScheduleAbsolute(500, () => connection = ys.Connect());
- scheduler.ScheduleAbsolute(550, () => connection.Dispose());
-
- scheduler.ScheduleAbsolute(650, () => connection = ys.Connect());
- scheduler.ScheduleAbsolute(800, () => connection.Dispose());
-
- scheduler.Start();
-
- res.Messages.AssertEqual(
- OnNext(451, 5),
- OnNext(452, 6),
- OnNext(453, 7)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(300, 400),
- Subscribe(500, 550),
- Subscribe(650, 800)
- );
- }
-
- [TestMethod]
- public void ReplayTime_MultipleConnections()
- {
- var xs = Observable.Never<int>();
- var ys = xs.Replay(TimeSpan.FromTicks(100), new TestScheduler());
-
- var connection1 = ys.Connect();
- var connection2 = ys.Connect();
-
- Assert.AreSame(connection1, connection2);
-
- connection1.Dispose();
- connection2.Dispose();
-
- var connection3 = ys.Connect();
-
- Assert.AreNotSame(connection1, connection3);
-
- connection3.Dispose();
- }
-
- [TestMethod]
- public void ReplayTimeLambda_Zip_Complete()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(110, 7),
- OnNext(220, 3),
- OnNext(280, 4),
- OnNext(290, 1),
- OnNext(340, 8),
- OnNext(360, 5),
- OnNext(370, 6),
- OnNext(390, 7),
- OnNext(410, 13),
- OnNext(430, 2),
- OnNext(450, 9),
- OnNext(520, 11),
- OnNext(560, 20),
- OnCompleted<int>(600)
- );
-
- var res = scheduler.Start(() =>
- xs.Replay(_xs => _xs.Take(6).Repeat(), TimeSpan.FromTicks(50), scheduler),
- 610
- );
-
- res.Messages.AssertEqual(
- OnNext(221, 3),
- OnNext(281, 4),
- OnNext(291, 1),
- OnNext(341, 8),
- OnNext(361, 5),
- OnNext(371, 6),
- OnNext(372, 8),
- OnNext(373, 5),
- OnNext(374, 6),
- OnNext(391, 7),
- OnNext(411, 13),
- OnNext(431, 2),
- OnNext(432, 7),
- OnNext(433, 13),
- OnNext(434, 2),
- OnNext(451, 9),
- OnNext(521, 11),
- OnNext(561, 20),
- OnNext(562, 11),
- OnNext(563, 20),
- OnNext(602, 20),
- OnNext(604, 20),
- OnNext(606, 20),
- OnNext(608, 20)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 600)
- );
- }
-
- [TestMethod]
- public void ReplayTimeLambda_Zip_Error()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(110, 7),
- OnNext(220, 3),
- OnNext(280, 4),
- OnNext(290, 1),
- OnNext(340, 8),
- OnNext(360, 5),
- OnNext(370, 6),
- OnNext(390, 7),
- OnNext(410, 13),
- OnNext(430, 2),
- OnNext(450, 9),
- OnNext(520, 11),
- OnNext(560, 20),
- OnError<int>(600, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.Replay(_xs => _xs.Take(6).Repeat(), TimeSpan.FromTicks(50), scheduler)
- );
-
- res.Messages.AssertEqual(
- OnNext(221, 3),
- OnNext(281, 4),
- OnNext(291, 1),
- OnNext(341, 8),
- OnNext(361, 5),
- OnNext(371, 6),
- OnNext(372, 8),
- OnNext(373, 5),
- OnNext(374, 6),
- OnNext(391, 7),
- OnNext(411, 13),
- OnNext(431, 2),
- OnNext(432, 7),
- OnNext(433, 13),
- OnNext(434, 2),
- OnNext(451, 9),
- OnNext(521, 11),
- OnNext(561, 20),
- OnNext(562, 11),
- OnNext(563, 20),
- OnError<int>(601, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 600)
- );
- }
-
- [TestMethod]
- public void ReplayTimeLambda_Zip_Dispose()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(110, 7),
- OnNext(220, 3),
- OnNext(280, 4),
- OnNext(290, 1),
- OnNext(340, 8),
- OnNext(360, 5),
- OnNext(370, 6),
- OnNext(390, 7),
- OnNext(410, 13),
- OnNext(430, 2),
- OnNext(450, 9),
- OnNext(520, 11),
- OnNext(560, 20),
- OnCompleted<int>(600)
- );
-
- var res = scheduler.Start(() =>
- xs.Replay(_xs => _xs.Take(6).Repeat(), TimeSpan.FromTicks(50), scheduler),
- 470
- );
-
- res.Messages.AssertEqual(
- OnNext(221, 3),
- OnNext(281, 4),
- OnNext(291, 1),
- OnNext(341, 8),
- OnNext(361, 5),
- OnNext(371, 6),
- OnNext(372, 8),
- OnNext(373, 5),
- OnNext(374, 6),
- OnNext(391, 7),
- OnNext(411, 13),
- OnNext(431, 2),
- OnNext(432, 7),
- OnNext(433, 13),
- OnNext(434, 2),
- OnNext(451, 9)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 470)
- );
- }
-
- [TestMethod]
- public void Replay_Default1()
- {
- var s = new Subject<int>();
- var xs = s.Replay(100, DefaultScheduler.Instance);
- var ys = s.Replay(100);
-
- xs.Connect();
- ys.Connect();
-
- s.OnNext(1);
- s.OnNext(2);
- s.OnCompleted();
-
- xs.AssertEqual(ys);
- }
-
- [TestMethod]
- public void Replay_Default2()
- {
- var s = new Subject<int>();
- var xs = s.Replay(TimeSpan.FromHours(1), DefaultScheduler.Instance);
- var ys = s.Replay(TimeSpan.FromHours(1));
-
- xs.Connect();
- ys.Connect();
-
- s.OnNext(1);
- s.OnNext(2);
- s.OnCompleted();
-
- xs.AssertEqual(ys);
- }
-
- [TestMethod]
- public void Replay_Default3()
- {
- var s = new Subject<int>();
- var xs = s.Replay(100, TimeSpan.FromHours(1), DefaultScheduler.Instance);
- var ys = s.Replay(100, TimeSpan.FromHours(1));
-
- xs.Connect();
- ys.Connect();
-
- s.OnNext(1);
- s.OnNext(2);
- s.OnCompleted();
-
- xs.AssertEqual(ys);
- }
-
- [TestMethod]
- public void Replay_Default4()
- {
- var s = new Subject<int>();
- var xs = s.Replay(DefaultScheduler.Instance);
- var ys = s.Replay();
-
- xs.Connect();
- ys.Connect();
-
- s.OnNext(1);
- s.OnNext(2);
- s.OnCompleted();
-
- xs.AssertEqual(ys);
- }
-
- [TestMethod]
- public void ReplayLambda_Default1()
- {
- var xs = Observable.Range(1, 10).Replay(_xs => _xs, 100, DefaultScheduler.Instance);
- var ys = Observable.Range(1, 10).Replay(_xs => _xs, 100);
-
- xs.AssertEqual(ys);
- }
-
- [TestMethod]
- public void ReplayLambda_Default2()
- {
- var xs = Observable.Range(1, 10).Replay(_xs => _xs, TimeSpan.FromHours(1), DefaultScheduler.Instance);
- var ys = Observable.Range(1, 10).Replay(_xs => _xs, TimeSpan.FromHours(1));
-
- xs.AssertEqual(ys);
- }
-
- [TestMethod]
- public void ReplayLambda_Default3()
- {
- var xs = Observable.Range(1, 10).Replay(_xs => _xs, 100, TimeSpan.FromHours(1), DefaultScheduler.Instance);
- var ys = Observable.Range(1, 10).Replay(_xs => _xs, 100, TimeSpan.FromHours(1));
-
- xs.AssertEqual(ys);
- }
-
- [TestMethod]
- public void ReplayLambda_Default4()
- {
- var xs = Observable.Range(1, 10).Replay(_xs => _xs, DefaultScheduler.Instance);
- var ys = Observable.Range(1, 10).Replay(_xs => _xs);
-
- xs.AssertEqual(ys);
- }
-
- #endregion
- }
-}
diff --git a/Rx.NET/Tests.System.Reactive/Tests/ObservableBlockingTest.cs b/Rx.NET/Tests.System.Reactive/Tests/ObservableBlockingTest.cs
deleted file mode 100644
index 48705db..0000000
--- a/Rx.NET/Tests.System.Reactive/Tests/ObservableBlockingTest.cs
+++ /dev/null
@@ -1,1652 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.Linq;
-using System.Reactive.Concurrency;
-using System.Reactive.Disposables;
-using System.Reactive.Linq;
-using System.Threading;
-using Microsoft.Reactive.Testing;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using ReactiveTests.Dummies;
-
-#if !NO_TPL
-using System.Threading.Tasks;
-#endif
-
-namespace ReactiveTests.Tests
-{
- [TestClass]
- public partial class ObservableBlockingTest : ReactiveTest
- {
- #region Chunkify
-
- [TestMethod]
- public void Chunkify_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Chunkify(default(IObservable<int>)));
- }
-
- [TestMethod]
- public void Chunkify_Regular1()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(100, 1),
- OnNext(200, 2),
- OnNext(300, 3),
- OnNext(400, 4),
- OnNext(500, 5),
- OnNext(600, 6),
- OnNext(700, 7),
- OnNext(800, 8),
- OnCompleted<int>(900)
- );
-
- var ys = xs.Chunkify();
- var e = default(IEnumerator<IList<int>>);
-
- var res = new List<IList<int>>();
-
- var log = new Action(() =>
- {
- Assert.IsTrue(e.MoveNext());
- res.Add(e.Current);
- });
-
- scheduler.ScheduleAbsolute(250, () => { e = ys.GetEnumerator(); });
- scheduler.ScheduleAbsolute(270, log);
- scheduler.ScheduleAbsolute(310, log);
- scheduler.ScheduleAbsolute(450, log);
- scheduler.ScheduleAbsolute(470, log);
- scheduler.ScheduleAbsolute(750, log);
- scheduler.ScheduleAbsolute(850, log);
- scheduler.ScheduleAbsolute(950, log);
- scheduler.ScheduleAbsolute(980, () => Assert.IsFalse(e.MoveNext()));
-
- scheduler.Start();
-
- xs.Subscriptions.AssertEqual(
- Subscribe(250, 900)
- );
-
- Assert.AreEqual(7, res.Count);
- Assert.IsTrue(res[0].SequenceEqual(new int[] { }));
- Assert.IsTrue(res[1].SequenceEqual(new int[] { 3 }));
- Assert.IsTrue(res[2].SequenceEqual(new int[] { 4 }));
- Assert.IsTrue(res[3].SequenceEqual(new int[] { }));
- Assert.IsTrue(res[4].SequenceEqual(new int[] { 5, 6, 7 }));
- Assert.IsTrue(res[5].SequenceEqual(new int[] { 8 }));
- Assert.IsTrue(res[6].SequenceEqual(new int[] { }));
- }
-
- [TestMethod]
- public void Chunkify_Regular2()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(100, 1),
- OnNext(200, 2),
- OnNext(300, 3),
- OnNext(400, 4),
- OnNext(500, 5),
- OnNext(600, 6),
- OnNext(700, 7),
- OnNext(800, 8),
- OnCompleted<int>(900)
- );
-
- var ys = xs.Chunkify();
- var e = default(IEnumerator<IList<int>>);
-
- var res = new List<IList<int>>();
-
- var log = new Action(() =>
- {
- Assert.IsTrue(e.MoveNext());
- res.Add(e.Current);
- });
-
- scheduler.ScheduleAbsolute(250, () => { e = ys.GetEnumerator(); });
- scheduler.ScheduleAbsolute(550, log);
- scheduler.ScheduleAbsolute(950, log);
- scheduler.ScheduleAbsolute(980, () => Assert.IsFalse(e.MoveNext()));
-
- scheduler.Start();
-
- xs.Subscriptions.AssertEqual(
- Subscribe(250, 900)
- );
-
- Assert.AreEqual(2, res.Count);
- Assert.IsTrue(res[0].SequenceEqual(new int[] { 3, 4, 5 }));
- Assert.IsTrue(res[1].SequenceEqual(new int[] { 6, 7, 8 }));
- }
-
- [TestMethod]
- public void Chunkify_Error()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(100, 1),
- OnNext(200, 2),
- OnNext(300, 3),
- OnNext(400, 4),
- OnNext(500, 5),
- OnNext(600, 6),
- OnError<int>(700, ex)
- );
-
- var ys = xs.Chunkify();
- var e = default(IEnumerator<IList<int>>);
-
- var res = new List<IList<int>>();
-
- var log = new Action(() =>
- {
- Assert.IsTrue(e.MoveNext());
- res.Add(e.Current);
- });
-
- scheduler.ScheduleAbsolute(250, () => { e = ys.GetEnumerator(); });
- scheduler.ScheduleAbsolute(270, log);
- scheduler.ScheduleAbsolute(310, log);
- scheduler.ScheduleAbsolute(450, log);
- scheduler.ScheduleAbsolute(470, log);
- scheduler.ScheduleAbsolute(750, () =>
- {
- try
- {
- e.MoveNext();
- Assert.Fail();
- }
- catch (Exception error)
- {
- Assert.AreSame(ex, error);
- }
- });
-
- scheduler.Start();
-
- xs.Subscriptions.AssertEqual(
- Subscribe(250, 700)
- );
-
- Assert.AreEqual(4, res.Count);
- Assert.IsTrue(res[0].SequenceEqual(new int[] { }));
- Assert.IsTrue(res[1].SequenceEqual(new int[] { 3 }));
- Assert.IsTrue(res[2].SequenceEqual(new int[] { 4 }));
- Assert.IsTrue(res[3].SequenceEqual(new int[] { }));
- }
-
- #endregion
-
- #region Collect
-
- [TestMethod]
- public void Collect_ArgumentChecking()
- {
- var someObservable = Observable.Empty<int>();
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Collect(default(IObservable<int>), () => 0, (x, y) => x));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Collect(someObservable, default(Func<int>), (x, y) => x));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Collect(someObservable, () => 0, default(Func<int, int, int>)));
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Collect(default(IObservable<int>), () => 0, (x, y) => x, x => x));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Collect(someObservable, default(Func<int>), (x, y) => x, x => x));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Collect(someObservable, () => 0, default(Func<int, int, int>), x => x));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Collect(someObservable, () => 0, (x, y) => x, default(Func<int, int>)));
- }
-
- [TestMethod]
- public void Collect_Regular1()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(100, 1),
- OnNext(200, 2),
- OnNext(300, 3),
- OnNext(400, 4),
- OnNext(500, 5),
- OnNext(600, 6),
- OnNext(700, 7),
- OnNext(800, 8),
- OnCompleted<int>(900)
- );
-
- var ys = xs.Collect(() => 0, (x, y) => x + y);
- var e = default(IEnumerator<int>);
-
- var res = new List<int>();
-
- var log = new Action(() =>
- {
- Assert.IsTrue(e.MoveNext());
- res.Add(e.Current);
- });
-
- scheduler.ScheduleAbsolute(250, () => { e = ys.GetEnumerator(); });
- scheduler.ScheduleAbsolute(270, log);
- scheduler.ScheduleAbsolute(310, log);
- scheduler.ScheduleAbsolute(450, log);
- scheduler.ScheduleAbsolute(470, log);
- scheduler.ScheduleAbsolute(750, log);
- scheduler.ScheduleAbsolute(850, log);
- scheduler.ScheduleAbsolute(950, log);
- scheduler.ScheduleAbsolute(980, () => Assert.IsFalse(e.MoveNext()));
-
- scheduler.Start();
-
- xs.Subscriptions.AssertEqual(
- Subscribe(250, 900)
- );
-
- Assert.AreEqual(7, res.Count);
- Assert.AreEqual(res[0], new int[] { }.Sum());
- Assert.AreEqual(res[1], new int[] { 3 }.Sum());
- Assert.AreEqual(res[2], new int[] { 4 }.Sum());
- Assert.AreEqual(res[3], new int[] { }.Sum());
- Assert.AreEqual(res[4], new int[] { 5, 6, 7 }.Sum());
- Assert.AreEqual(res[5], new int[] { 8 }.Sum());
- Assert.AreEqual(res[6], new int[] { }.Sum());
- }
-
- [TestMethod]
- public void Collect_Regular2()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(100, 1),
- OnNext(200, 2),
- OnNext(300, 3),
- OnNext(400, 4),
- OnNext(500, 5),
- OnNext(600, 6),
- OnNext(700, 7),
- OnNext(800, 8),
- OnCompleted<int>(900)
- );
-
- var ys = xs.Collect(() => 0, (x, y) => x + y);
- var e = default(IEnumerator<int>);
-
- var res = new List<int>();
-
- var log = new Action(() =>
- {
- Assert.IsTrue(e.MoveNext());
- res.Add(e.Current);
- });
-
- scheduler.ScheduleAbsolute(250, () => { e = ys.GetEnumerator(); });
- scheduler.ScheduleAbsolute(550, log);
- scheduler.ScheduleAbsolute(950, log);
- scheduler.ScheduleAbsolute(980, () => Assert.IsFalse(e.MoveNext()));
-
- scheduler.Start();
-
- xs.Subscriptions.AssertEqual(
- Subscribe(250, 900)
- );
-
- Assert.AreEqual(2, res.Count);
- Assert.AreEqual(res[0], new int[] { 3, 4, 5 }.Sum());
- Assert.AreEqual(res[1], new int[] { 6, 7, 8 }.Sum());
- }
-
- [TestMethod]
- public void Collect_InitialCollectorThrows()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(100, 1),
- OnNext(200, 2),
- OnNext(300, 3),
- OnNext(400, 4),
- OnCompleted<int>(500)
- );
-
- var ex = new Exception();
- var ys = xs.Collect<int, int>(() => { throw ex; }, (x, y) => x + y);
-
- var ex_ = default(Exception);
-
- scheduler.ScheduleAbsolute(250, () =>
- {
- try
- {
- ys.GetEnumerator();
- }
- catch (Exception err)
- {
- ex_ = err;
- }
- });
-
- scheduler.Start();
-
- xs.Subscriptions.AssertEqual(
- );
-
- Assert.AreSame(ex_, ex);
- }
-
- [TestMethod]
- public void Collect_SecondCollectorThrows()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(100, 1),
- OnNext(200, 2),
- OnNext(300, 3),
- OnNext(400, 4),
- OnCompleted<int>(500)
- );
-
- var ex = new Exception();
- var n = 0;
- var ys = xs.Collect<int, int>(() => { if (n++ == 0) return 0; else throw ex; }, (x, y) => x + y);
- var e = default(IEnumerator<int>);
-
- var ex_ = default(Exception);
-
- scheduler.ScheduleAbsolute(250, () => e = ys.GetEnumerator());
- scheduler.ScheduleAbsolute(350, () =>
- {
- try
- {
- e.MoveNext();
- }
- catch (Exception err)
- {
- ex_ = err;
- }
- });
-
- scheduler.Start();
-
- xs.Subscriptions.AssertEqual(
- Subscribe(250, 350)
- );
-
- Assert.AreSame(ex_, ex);
- }
-
- [TestMethod]
- public void Collect_NewCollectorThrows()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(100, 1),
- OnNext(200, 2),
- OnNext(300, 3),
- OnNext(400, 4),
- OnCompleted<int>(500)
- );
-
- var ex = new Exception();
- var ys = xs.Collect<int, int>(() => 0, (x, y) => x + y, x => { throw ex; });
- var e = default(IEnumerator<int>);
-
- var ex_ = default(Exception);
-
- scheduler.ScheduleAbsolute(250, () => e = ys.GetEnumerator());
- scheduler.ScheduleAbsolute(350, () =>
- {
- try
- {
- e.MoveNext();
- }
- catch (Exception err)
- {
- ex_ = err;
- }
- });
-
- scheduler.Start();
-
- xs.Subscriptions.AssertEqual(
- Subscribe(250, 350)
- );
-
- Assert.AreSame(ex_, ex);
- }
-
- [TestMethod]
- public void Collect_MergeThrows()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(100, 1),
- OnNext(200, 2),
- OnNext(300, 3),
- OnNext(400, 4),
- OnCompleted<int>(500)
- );
-
- var ex = new Exception();
- var ys = xs.Collect<int, int>(() => 0, (x, y) => { throw ex; });
- var e = default(IEnumerator<int>);
-
- var ex_ = default(Exception);
-
- scheduler.ScheduleAbsolute(250, () => { e = ys.GetEnumerator(); });
- scheduler.ScheduleAbsolute(350, () =>
- {
- try
- {
- e.MoveNext();
- }
- catch (Exception err)
- {
- ex_ = err;
- }
- });
-
- scheduler.Start();
-
- xs.Subscriptions.AssertEqual(
- Subscribe(250, 300)
- );
-
- Assert.AreSame(ex_, ex);
- }
-
- #endregion
-
- #region First
-
- [TestMethod]
- public void First_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.First(default(IObservable<int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.First(default(IObservable<int>), _ => true));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.First(DummyObservable<int>.Instance, default(Func<int, bool>)));
- }
-
- [TestMethod]
- public void First_Empty()
- {
- ReactiveAssert.Throws<InvalidOperationException>(() => Observable.Empty<int>().First());
- }
-
- [TestMethod]
- public void FirstPredicate_Empty()
- {
- ReactiveAssert.Throws<InvalidOperationException>(() => Observable.Empty<int>().First(_ => true));
- }
-
- [TestMethod]
- public void First_Return()
- {
- var value = 42;
- Assert.AreEqual(value, Observable.Return<int>(value).First());
- }
-
- [TestMethod]
- public void FirstPredicate_Return()
- {
- var value = 42;
- Assert.AreEqual(value, Observable.Return<int>(value).First(i => i % 2 == 0));
- }
-
- [TestMethod]
- public void FirstPredicate_Return_NoMatch()
- {
- var value = 42;
- ReactiveAssert.Throws<InvalidOperationException>(() => Observable.Return<int>(value).First(i => i % 2 != 0));
- }
-
- [TestMethod]
- public void First_Throw()
- {
- var ex = new Exception();
-
- var xs = Observable.Throw<int>(ex);
-
- ReactiveAssert.Throws(ex, () => xs.First());
- }
-
- [TestMethod]
- public void FirstPredicate_Throw()
- {
- var ex = new Exception();
-
- var xs = Observable.Throw<int>(ex);
-
- ReactiveAssert.Throws(ex, () => xs.First(_ => true));
- }
-
- [TestMethod]
- public void First_Range()
- {
- var value = 42;
- Assert.AreEqual(value, Observable.Range(value, 10).First());
- }
-
- [TestMethod]
- public void FirstPredicate_Range()
- {
- var value = 42;
- Assert.AreEqual(46, Observable.Range(value, 10).First(i => i > 45));
- }
-
- #endregion
-
- #region FirstOrDefault
-
- [TestMethod]
- public void FirstOrDefault_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FirstOrDefault(default(IObservable<int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FirstOrDefault(default(IObservable<int>), _ => true));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FirstOrDefault(DummyObservable<int>.Instance, default(Func<int, bool>)));
- }
-
- [TestMethod]
- public void FirstOrDefault_Empty()
- {
- Assert.AreEqual(default(int), Observable.Empty<int>().FirstOrDefault());
- }
-
- [TestMethod]
- public void FirstOrDefaultPredicate_Empty()
- {
- Assert.AreEqual(default(int), Observable.Empty<int>().FirstOrDefault(_ => true));
- }
-
- [TestMethod]
- public void FirstOrDefault_Return()
- {
- var value = 42;
- Assert.AreEqual(value, Observable.Return<int>(value).FirstOrDefault());
- }
-
- [TestMethod]
- public void FirstOrDefault_Throw()
- {
- var ex = new Exception();
-
- var xs = Observable.Throw<int>(ex);
-
- ReactiveAssert.Throws(ex, () => xs.FirstOrDefault());
- }
-
- [TestMethod]
- public void FirstOrDefault_Range()
- {
- var value = 42;
- Assert.AreEqual(value, Observable.Range(value, 10).FirstOrDefault());
- }
-
- #endregion
-
- #region + ForEach +
-
- [TestMethod]
- public void ForEach_ArgumentChecking()
- {
- var someObservable = Observable.Empty<int>();
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ForEach(default(IObservable<int>), x => { }));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ForEach(someObservable, default(Action<int>)));
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ForEach(default(IObservable<int>), (x, i) => { }));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ForEach(someObservable, default(Action<int, int>)));
- }
-
- [TestMethod]
- public void ForEach_Empty()
- {
- var lst = new List<int>();
- Observable.Empty<int>().ForEach(x => lst.Add(x));
- Assert.IsTrue(lst.SequenceEqual(Enumerable.Empty<int>()));
- }
-
- [TestMethod]
- public void ForEach_Index_Empty()
- {
- var lstX = new List<int>();
- Observable.Empty<int>().ForEach((x, i) => lstX.Add(x));
- Assert.IsTrue(lstX.SequenceEqual(Enumerable.Empty<int>()));
- }
-
- [TestMethod]
- public void ForEach_Return()
- {
- var lst = new List<int>();
- Observable.Return(42).ForEach(x => lst.Add(x));
- Assert.IsTrue(lst.SequenceEqual(new[] { 42 }));
- }
-
- [TestMethod]
- public void ForEach_Index_Return()
- {
- var lstX = new List<int>();
- var lstI = new List<int>();
- Observable.Return(42).ForEach((x, i) => { lstX.Add(x); lstI.Add(i); });
- Assert.IsTrue(lstX.SequenceEqual(new[] { 42 }));
- Assert.IsTrue(lstI.SequenceEqual(new[] { 0 }));
- }
-
- [TestMethod]
- public void ForEach_Throw()
- {
- var ex = new Exception();
-
- var xs = Observable.Throw<int>(ex);
-
- ReactiveAssert.Throws(ex, () => xs.ForEach(x => { Assert.Fail(); }));
- }
-
- [TestMethod]
- public void ForEach_Index_Throw()
- {
- var ex = new Exception();
-
- var xs = Observable.Throw<int>(ex);
-
- ReactiveAssert.Throws(ex, () => xs.ForEach((x, i) => { Assert.Fail(); }));
- }
-
- [TestMethod]
- public void ForEach_SomeData()
- {
- var lstX = new List<int>();
- Observable.Range(10, 10).ForEach(x => lstX.Add(x));
- Assert.IsTrue(lstX.SequenceEqual(Enumerable.Range(10, 10)));
- }
-
- [TestMethod]
- public void ForEach_Index_SomeData()
- {
- var lstX = new List<int>();
- var lstI = new List<int>();
- Observable.Range(10, 10).ForEach((x, i) => { lstX.Add(x); lstI.Add(i); });
- Assert.IsTrue(lstX.SequenceEqual(Enumerable.Range(10, 10)));
- Assert.IsTrue(lstI.SequenceEqual(Enumerable.Range(0, 10)));
- }
-
- [TestMethod]
- public void ForEach_OnNextThrows()
- {
- var ex = new Exception();
-
- var xs = Observable.Range(0, 10);
-
- ReactiveAssert.Throws(ex, () => xs.ForEach(x => { throw ex; }));
- }
-
- [TestMethod]
- public void ForEach_Index_OnNextThrows()
- {
- var ex = new Exception();
-
- var xs = Observable.Range(0, 10);
-
- ReactiveAssert.Throws(ex, () => xs.ForEach((x, i) => { throw ex; }));
- }
-
- #endregion
-
- #region + GetEnumerator +
-
- [TestMethod]
- public void GetEnumerator_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.GetEnumerator(default(IObservable<int>)));
- }
-
- [TestMethod]
- public void GetEnumerator_Regular1()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateColdObservable<int>(
- OnNext(10, 2),
- OnNext(20, 3),
- OnNext(30, 5),
- OnNext(40, 7),
- OnCompleted<int>(50)
- );
-
- var res = default(IEnumerator<int>);
-
- scheduler.ScheduleAbsolute(default(object), 100, (self, _) => { res = xs.GetEnumerator(); return Disposable.Empty; });
-
- var hasNext = new List<bool>();
- var vals = new List<Tuple<long, int>>();
- for (long i = 200; i <= 250; i += 10)
- {
- var t = i;
- scheduler.ScheduleAbsolute(default(object), t, (self, _) =>
- {
- var b = res.MoveNext();
- hasNext.Add(b);
- if (b)
- vals.Add(new Tuple<long, int>(scheduler.Clock, res.Current));
- return Disposable.Empty;
- });
- }
-
- scheduler.Start();
-
- xs.Subscriptions.AssertEqual(
- Subscribe(100, 150)
- );
-
- Assert.AreEqual(6, hasNext.Count);
- Assert.IsTrue(hasNext.Take(4).All(_ => _));
- Assert.IsTrue(hasNext.Skip(4).All(_ => !_));
-
- Assert.AreEqual(4, vals.Count);
- Assert.IsTrue(vals[0].Item1 == 200 && vals[0].Item2 == 2);
- Assert.IsTrue(vals[1].Item1 == 210 && vals[1].Item2 == 3);
- Assert.IsTrue(vals[2].Item1 == 220 && vals[2].Item2 == 5);
- Assert.IsTrue(vals[3].Item1 == 230 && vals[3].Item2 == 7);
- }
-
- [TestMethod]
- public void GetEnumerator_Regular2()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateColdObservable<int>(
- OnNext(10, 2),
- OnNext(30, 3),
- OnNext(50, 5),
- OnNext(70, 7),
- OnCompleted<int>(90)
- );
-
- var res = default(IEnumerator<int>);
-
- scheduler.ScheduleAbsolute(default(object), 100, (self, _) => { res = xs.GetEnumerator(); return Disposable.Empty; });
-
- var hasNext = new List<bool>();
- var vals = new List<Tuple<long, int>>();
- for (long i = 120; i <= 220; i += 20)
- {
- var t = i;
- scheduler.ScheduleAbsolute(default(object), t, (self, _) =>
- {
- var b = res.MoveNext();
- hasNext.Add(b);
- if (b)
- vals.Add(new Tuple<long, int>(scheduler.Clock, res.Current));
- return Disposable.Empty;
- });
- }
-
- scheduler.Start();
-
- xs.Subscriptions.AssertEqual(
- Subscribe(100, 190)
- );
-
- Assert.AreEqual(6, hasNext.Count);
- Assert.IsTrue(hasNext.Take(4).All(_ => _));
- Assert.IsTrue(hasNext.Skip(4).All(_ => !_));
-
- Assert.AreEqual(4, vals.Count);
- Assert.IsTrue(vals[0].Item1 == 120 && vals[0].Item2 == 2);
- Assert.IsTrue(vals[1].Item1 == 140 && vals[1].Item2 == 3);
- Assert.IsTrue(vals[2].Item1 == 160 && vals[2].Item2 == 5);
- Assert.IsTrue(vals[3].Item1 == 180 && vals[3].Item2 == 7);
- }
-
- [TestMethod]
- public void GetEnumerator_Dispose()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateColdObservable<int>(
- OnNext(10, 2),
- OnNext(30, 3),
- OnNext(50, 5),
- OnNext(70, 7),
- OnCompleted<int>(90)
- );
-
- var res = default(IEnumerator<int>);
-
- scheduler.ScheduleAbsolute(default(object), 100, (self, _) => { res = xs.GetEnumerator(); return Disposable.Empty; });
-
- scheduler.ScheduleAbsolute(default(object), 140, (self, _) =>
- {
- Assert.IsTrue(res.MoveNext());
- Assert.AreEqual(2, res.Current);
-
- Assert.IsTrue(res.MoveNext());
- Assert.AreEqual(3, res.Current);
-
- res.Dispose();
-
- return Disposable.Empty;
- });
-
- scheduler.ScheduleAbsolute(default(object), 160, (self, _) =>
- {
- ReactiveAssert.Throws<ObjectDisposedException>(() => res.MoveNext());
- return Disposable.Empty;
- });
-
- scheduler.Start();
-
- xs.Subscriptions.AssertEqual(
- Subscribe(100, 140)
- );
- }
-
-#if DESKTOPCLR20 || SILVERLIGHTM7
- class Tuple<T1, T2>
- {
- public Tuple(T1 item1, T2 item2)
- {
- Item1 = item1;
- Item2 = item2;
- }
-
- public T1 Item1 { get; private set; }
- public T2 Item2 { get; private set; }
- }
-#endif
-
- #endregion
-
- #region Last
-
- [TestMethod]
- public void Last_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Last(default(IObservable<int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Last(default(IObservable<int>), _ => true));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Last(DummyObservable<int>.Instance, default(Func<int, bool>)));
- }
-
- [TestMethod]
- public void Last_Empty()
- {
- ReactiveAssert.Throws<InvalidOperationException>(() => Observable.Empty<int>().Last());
- }
-
- [TestMethod]
- public void LastPredicate_Empty()
- {
- ReactiveAssert.Throws<InvalidOperationException>(() => Observable.Empty<int>().Last(_ => true));
- }
-
- [TestMethod]
- public void Last_Return()
- {
- var value = 42;
- Assert.AreEqual(value, Observable.Return<int>(value).Last());
- }
-
- [TestMethod]
- public void Last_Throw()
- {
- var ex = new Exception();
-
- var xs = Observable.Throw<int>(ex);
-
- ReactiveAssert.Throws(ex, () => xs.Last());
- }
-
- [TestMethod]
- public void Last_Range()
- {
- var value = 42;
- Assert.AreEqual(value, Observable.Range(value - 9, 10).Last());
- }
-
- [TestMethod]
- public void LastPredicate_Range()
- {
- var value = 42;
- Assert.AreEqual(50, Observable.Range(value, 10).Last(i => i % 2 == 0));
- }
-
- #endregion
-
- #region LastOrDefault
-
- [TestMethod]
- public void LastOrDefault_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.LastOrDefault(default(IObservable<int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.LastOrDefault(default(IObservable<int>), _ => true));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.LastOrDefault(DummyObservable<int>.Instance, default(Func<int, bool>)));
- }
-
- [TestMethod]
- public void LastOrDefault_Empty()
- {
- Assert.AreEqual(default(int), Observable.Empty<int>().LastOrDefault());
- }
-
- [TestMethod]
- public void LastOrDefaultPredicate_Empty()
- {
- Assert.AreEqual(default(int), Observable.Empty<int>().LastOrDefault(_ => true));
- }
-
- [TestMethod]
- public void LastOrDefault_Return()
- {
- var value = 42;
- Assert.AreEqual(value, Observable.Return<int>(value).LastOrDefault());
- }
-
- [TestMethod]
- public void LastOrDefault_Throw()
- {
- var ex = new Exception();
-
- var xs = Observable.Throw<int>(ex);
-
- ReactiveAssert.Throws(ex, () => xs.LastOrDefault());
- }
-
- [TestMethod]
- public void LastOrDefault_Range()
- {
- var value = 42;
- Assert.AreEqual(value, Observable.Range(value - 9, 10).LastOrDefault());
- }
-
- [TestMethod]
- public void LastOrDefaultPredicate_Range()
- {
- var value = 42;
- Assert.AreEqual(50, Observable.Range(value, 10).LastOrDefault(i => i % 2 == 0));
- }
-
- #endregion
-
- #region + Latest +
-
- [TestMethod]
- public void Latest_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Latest(default(IObservable<int>)));
- }
-
- [TestMethod]
- public void Latest1()
- {
- var disposed = false;
- var evt = new AutoResetEvent(false);
- var src = Observable.Create<int>(obs =>
- {
- new Thread(() =>
- {
- evt.WaitOne();
- obs.OnNext(1);
- evt.WaitOne();
- obs.OnNext(2);
- evt.WaitOne();
- obs.OnCompleted();
- }).Start();
-
- return () => { disposed = true; };
- });
-
- var res = src.Latest().GetEnumerator();
-
- new Thread(() =>
- {
- Thread.Sleep(250);
- evt.Set();
- }).Start();
-
- Assert.IsTrue(res.MoveNext());
- Assert.AreEqual(1, res.Current);
-
- evt.Set();
- Assert.IsTrue(((IEnumerator)res).MoveNext());
- Assert.AreEqual(2, ((IEnumerator)res).Current);
-
- evt.Set();
- Assert.IsFalse(res.MoveNext());
-
- ReactiveAssert.Throws<NotSupportedException>(() => res.Reset());
-
- res.Dispose();
- //ReactiveAssert.Throws<ObjectDisposedException>(() => res.MoveNext());
- Assert.IsTrue(disposed);
- }
-
- [TestMethod]
- public void Latest2()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable<int>(
- OnNext(210, 1),
- OnNext(220, 2),
- OnNext(230, 3),
- OnNext(240, 4),
- OnNext(250, 5),
- OnNext(260, 6),
- OnNext(270, 7),
- OnNext(280, 8),
- OnNext(290, 9),
- OnCompleted<int>(300)
- );
-
- var res = xs.Latest();
-
- var e1 = default(IEnumerator<int>);
- scheduler.ScheduleAbsolute(205, () =>
- {
- e1 = res.GetEnumerator();
- });
-
- var o1 = new List<int>();
- scheduler.ScheduleAbsolute(235, () =>
- {
- Assert.IsTrue(e1.MoveNext());
- o1.Add(e1.Current);
- });
- scheduler.ScheduleAbsolute(265, () =>
- {
- Assert.IsTrue(e1.MoveNext());
- o1.Add(e1.Current);
- });
-
- scheduler.ScheduleAbsolute(285, () => e1.Dispose());
-
- var e2 = default(IEnumerator);
- scheduler.ScheduleAbsolute(255, () =>
- {
- e2 = ((IEnumerable)res).GetEnumerator();
- });
-
- var o2 = new List<int>();
- scheduler.ScheduleAbsolute(265, () =>
- {
- Assert.IsTrue(e2.MoveNext());
- o2.Add((int)e2.Current);
- });
- scheduler.ScheduleAbsolute(275, () =>
- {
- Assert.IsTrue(e2.MoveNext());
- o2.Add((int)e2.Current);
- });
-
- scheduler.Start();
-
- xs.Subscriptions.AssertEqual(
- Subscribe(205, 285),
- Subscribe(255, 300)
- );
-
- o1.AssertEqual(3, 6);
- o2.AssertEqual(6, 7);
- }
-
- [TestMethod]
- public void Latest_Error()
- {
- var ex = new Exception();
-
- var evt = new AutoResetEvent(false);
- var src = Observable.Create<int>(obs =>
- {
- new Thread(() =>
- {
- evt.WaitOne();
- obs.OnNext(1);
- evt.WaitOne();
- obs.OnError(ex);
- }).Start();
-
- return () => { };
- });
-
- var res = src.Latest().GetEnumerator();
-
- new Thread(() =>
- {
- Thread.Sleep(250);
- evt.Set();
- }).Start();
-
- Assert.IsTrue(res.MoveNext());
- Assert.AreEqual(1, res.Current);
-
- evt.Set();
-
- ReactiveAssert.Throws(ex, () => res.MoveNext());
- }
-
- #endregion
-
- #region + MostRecent +
-
- [TestMethod]
- public void MostRecent_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.MostRecent(default(IObservable<int>), 1));
- }
-
- [TestMethod]
- public void MostRecent1()
- {
- var evt = new AutoResetEvent(false);
- var nxt = new AutoResetEvent(false);
- var src = Observable.Create<int>(obs =>
- {
- new Thread(() =>
- {
- evt.WaitOne();
- obs.OnNext(1);
- nxt.Set();
- evt.WaitOne();
- obs.OnNext(2);
- nxt.Set();
- evt.WaitOne();
- obs.OnCompleted();
- nxt.Set();
- }).Start();
-
- return () => { };
- });
-
- var res = src.MostRecent(42).GetEnumerator();
-
- Assert.IsTrue(res.MoveNext());
- Assert.AreEqual(42, res.Current);
- Assert.IsTrue(res.MoveNext());
- Assert.AreEqual(42, res.Current);
-
- for (int i = 1; i <= 2; i++)
- {
- evt.Set();
- nxt.WaitOne();
- Assert.IsTrue(res.MoveNext());
- Assert.AreEqual(i, res.Current);
- Assert.IsTrue(res.MoveNext());
- Assert.AreEqual(i, res.Current);
- }
-
- evt.Set();
- nxt.WaitOne();
- Assert.IsFalse(res.MoveNext());
- }
-
- [TestMethod]
- public void MostRecent2()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable<int>(
- OnNext(210, 1),
- OnNext(220, 2),
- OnNext(230, 3),
- OnNext(240, 4),
- OnNext(250, 5),
- OnNext(260, 6),
- OnNext(270, 7),
- OnNext(280, 8),
- OnNext(290, 9),
- OnCompleted<int>(300)
- );
-
- var res = xs.MostRecent(0);
-
- var e1 = default(IEnumerator<int>);
- scheduler.ScheduleAbsolute(200, () =>
- {
- e1 = res.GetEnumerator();
- });
-
- var o1 = new List<int>();
- scheduler.ScheduleAbsolute(205, () =>
- {
- Assert.IsTrue(e1.MoveNext());
- o1.Add(e1.Current);
- });
- scheduler.ScheduleAbsolute(232, () =>
- {
- Assert.IsTrue(e1.MoveNext());
- o1.Add(e1.Current);
- });
- scheduler.ScheduleAbsolute(234, () =>
- {
- Assert.IsTrue(e1.MoveNext());
- o1.Add(e1.Current);
- });
- scheduler.ScheduleAbsolute(265, () =>
- {
- Assert.IsTrue(e1.MoveNext());
- o1.Add(e1.Current);
- });
-
- scheduler.ScheduleAbsolute(285, () => e1.Dispose());
-
- var e2 = default(IEnumerator);
- scheduler.ScheduleAbsolute(255, () =>
- {
- e2 = ((IEnumerable)res).GetEnumerator();
- });
-
- var o2 = new List<int>();
- scheduler.ScheduleAbsolute(258, () =>
- {
- Assert.IsTrue(e2.MoveNext());
- o2.Add((int)e2.Current);
- });
- scheduler.ScheduleAbsolute(262, () =>
- {
- Assert.IsTrue(e2.MoveNext());
- o2.Add((int)e2.Current);
- });
- scheduler.ScheduleAbsolute(264, () =>
- {
- Assert.IsTrue(e2.MoveNext());
- o2.Add((int)e2.Current);
- });
- scheduler.ScheduleAbsolute(275, () =>
- {
- Assert.IsTrue(e2.MoveNext());
- o2.Add((int)e2.Current);
- });
-
- scheduler.Start();
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 285),
- Subscribe(255, 300)
- );
-
- o1.AssertEqual(0, 3, 3, 6);
- o2.AssertEqual(0, 6, 6, 7);
- }
-
- [TestMethod]
- public void MostRecent_Error()
- {
- var ex = new Exception();
-
- var evt = new AutoResetEvent(false);
- var nxt = new AutoResetEvent(false);
- var src = Observable.Create<int>(obs =>
- {
- new Thread(() =>
- {
- evt.WaitOne();
- obs.OnNext(1);
- nxt.Set();
- evt.WaitOne();
- obs.OnError(ex);
- nxt.Set();
- }).Start();
-
- return () => { };
- });
-
- var res = src.MostRecent(42).GetEnumerator();
-
- Assert.IsTrue(res.MoveNext());
- Assert.AreEqual(42, res.Current);
- Assert.IsTrue(res.MoveNext());
- Assert.AreEqual(42, res.Current);
-
- evt.Set();
- nxt.WaitOne();
- Assert.IsTrue(res.MoveNext());
- Assert.AreEqual(1, res.Current);
- Assert.IsTrue(res.MoveNext());
- Assert.AreEqual(1, res.Current);
-
- evt.Set();
- nxt.WaitOne();
-
- ReactiveAssert.Throws(ex, () => res.MoveNext());
- }
-
- #endregion
-
- #region + Next +
-
- [TestMethod]
- public void Next_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Next(default(IObservable<int>)));
- }
-
- [TestMethod]
- public void Next1()
- {
- var evt = new AutoResetEvent(false);
- var src = Observable.Create<int>(obs =>
- {
- new Thread(() =>
- {
- evt.WaitOne();
- obs.OnNext(1);
- evt.WaitOne();
- obs.OnNext(2);
- evt.WaitOne();
- obs.OnCompleted();
- }).Start();
-
- return () => { };
- });
-
- var res = src.Next().GetEnumerator();
-
- Action release = () => new Thread(() =>
- {
- Thread.Sleep(250);
- evt.Set();
- }).Start();
-
- release();
- Assert.IsTrue(res.MoveNext());
- Assert.AreEqual(1, res.Current);
-
- release();
- Assert.IsTrue(res.MoveNext());
- Assert.AreEqual(2, res.Current);
-
- release();
- Assert.IsFalse(res.MoveNext());
- }
-
- [TestMethod]
- public void Next2()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable<int>(
- OnNext(210, 1),
- OnNext(220, 2),
- OnNext(230, 3),
- OnNext(240, 4),
- OnNext(250, 5),
- OnNext(260, 6),
- OnNext(270, 7),
- OnNext(280, 8),
- OnNext(290, 9),
- OnCompleted<int>(300)
- );
-
- var res = xs.Next();
-
- var e1 = default(IEnumerator<int>);
- scheduler.ScheduleAbsolute(200, () =>
- {
- e1 = res.GetEnumerator();
- });
-
- scheduler.ScheduleAbsolute(285, () => e1.Dispose());
-
- var e2 = default(IEnumerator);
- scheduler.ScheduleAbsolute(255, () =>
- {
- e2 = ((IEnumerable)res).GetEnumerator();
- });
-
- scheduler.Start();
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 285),
- Subscribe(255, 300)
- );
- }
-
- [TestMethod]
- public void Next_DoesNotBlock()
- {
- var evt = new ManualResetEvent(false);
-
- var xs = Observable.Empty<int>().Do(_ => { }, () => evt.Set());
-
- var e = xs.Next().GetEnumerator();
-
- evt.WaitOne();
-
- Assert.IsFalse(e.MoveNext());
- }
-
- [TestMethod]
- public void Next_SomeResults()
- {
- var xs = Observable.Range(0, 100, Scheduler.Default);
-
- var res = xs.Next().ToList();
-
- Assert.IsTrue(res.All(x => x < 100));
- Assert.IsTrue(res.Count == res.Distinct().Count());
- }
-
- [TestMethod]
- public void Next_Error()
- {
- var ex = new Exception();
-
- var evt = new AutoResetEvent(false);
- var src = Observable.Create<int>(obs =>
- {
- new Thread(() =>
- {
- evt.WaitOne();
- obs.OnNext(1);
- evt.WaitOne();
- obs.OnError(ex);
- }).Start();
-
- return () => { };
- });
-
- var res = src.Next().GetEnumerator();
-
- Action release = () => new Thread(() =>
- {
- Thread.Sleep(250);
- evt.Set();
- }).Start();
-
- release();
- Assert.IsTrue(res.MoveNext());
- Assert.AreEqual(1, res.Current);
-
- release();
-
- ReactiveAssert.Throws(ex, () => res.MoveNext());
- }
-
- #endregion
-
- #region Single
-
- [TestMethod]
- public void Single_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Single(default(IObservable<int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Single(default(IObservable<int>), _ => true));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Single(DummyObservable<int>.Instance, default(Func<int, bool>)));
- }
-
- [TestMethod]
- public void Single_Empty()
- {
- ReactiveAssert.Throws<InvalidOperationException>(() => Observable.Empty<int>().Single());
- }
-
- [TestMethod]
- public void SinglePredicate_Empty()
- {
- ReactiveAssert.Throws<InvalidOperationException>(() => Observable.Empty<int>().Single(_ => true));
- }
-
- [TestMethod]
- public void Single_Return()
- {
- var value = 42;
- Assert.AreEqual(value, Observable.Return<int>(value).Single());
- }
-
- [TestMethod]
- public void Single_Throw()
- {
- var ex = new Exception();
-
- var xs = Observable.Throw<int>(ex);
-
- ReactiveAssert.Throws(ex, () => xs.Single());
- }
-
- [TestMethod]
- public void Single_Range()
- {
- var value = 42;
- ReactiveAssert.Throws<InvalidOperationException>(() => Observable.Range(value, 10).Single());
- }
-
- [TestMethod]
- public void SinglePredicate_Range()
- {
- var value = 42;
- ReactiveAssert.Throws<InvalidOperationException>(() => Observable.Range(value, 10).Single(i => i % 2 == 0));
- }
-
- [TestMethod]
- public void SinglePredicate_Range_ReducesToSingle()
- {
- var value = 42;
- Assert.AreEqual(45, Observable.Range(value, 10).Single(i => i == 45));
- }
-
- #endregion
-
- #region SingleOrDefault
-
- [TestMethod]
- public void SingleOrDefault_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.SingleOrDefault(default(IObservable<int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.SingleOrDefault(default(IObservable<int>), _ => true));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.SingleOrDefault(DummyObservable<int>.Instance, default(Func<int, bool>)));
- }
-
- [TestMethod]
- public void SingleOrDefault_Empty()
- {
- Assert.AreEqual(default(int), Observable.Empty<int>().SingleOrDefault());
- }
-
- [TestMethod]
- public void SingleOrDefaultPredicate_Empty()
- {
- Assert.AreEqual(default(int), Observable.Empty<int>().SingleOrDefault(_ => true));
- }
-
- [TestMethod]
- public void SingleOrDefault_Return()
- {
- var value = 42;
- Assert.AreEqual(value, Observable.Return<int>(value).SingleOrDefault());
- }
-
- [TestMethod]
- public void SingleOrDefault_Throw()
- {
- var ex = new Exception();
-
- var xs = Observable.Throw<int>(ex);
-
- ReactiveAssert.Throws(ex, () => xs.SingleOrDefault());
- }
-
- [TestMethod]
- public void SingleOrDefault_Range()
- {
- var value = 42;
- ReactiveAssert.Throws<InvalidOperationException>(() => Observable.Range(value, 10).SingleOrDefault());
- }
-
- [TestMethod]
- public void SingleOrDefaultPredicate_Range()
- {
- var value = 42;
- ReactiveAssert.Throws<InvalidOperationException>(() => Observable.Range(value, 10).SingleOrDefault(i => i % 2 == 0));
- }
-
- [TestMethod]
- public void SingleOrDefault_Range_ReducesToSingle()
- {
- var value = 42;
- Assert.AreEqual(45, Observable.Range(value, 10).SingleOrDefault(i => i == 45));
- }
-
- [TestMethod]
- public void SingleOrDefault_Range_ReducesToNone()
- {
- var value = 42;
- Assert.AreEqual(0, Observable.Range(value, 10).SingleOrDefault(i => i > 100));
- }
-
- #endregion
-
- #region Wait
-
- [TestMethod]
- public void Wait_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Wait(default(IObservable<int>)));
- }
-
- [TestMethod]
- public void Wait_Return()
- {
- var x = 42;
- var xs = Observable.Return(x, ThreadPoolScheduler.Instance);
- var res = xs.Wait();
- Assert.AreEqual(x, res);
- }
-
- [TestMethod]
- public void Wait_Empty()
- {
- ReactiveAssert.Throws<InvalidOperationException>(() => Observable.Empty<int>().Wait());
- }
-
- [TestMethod]
- public void Wait_Throw()
- {
- var ex = new Exception();
-
- var xs = Observable.Throw<int>(ex);
-
- ReactiveAssert.Throws(ex, () => xs.Wait());
- }
-
- [TestMethod]
- public void Wait_Range()
- {
- var n = 42;
- var xs = Observable.Range(1, n, ThreadPoolScheduler.Instance);
- var res = xs.Wait();
- Assert.AreEqual(n, res);
- }
-
- #endregion
- }
-}
diff --git a/Rx.NET/Tests.System.Reactive/Tests/ObservableConcurrencyTest.cs b/Rx.NET/Tests.System.Reactive/Tests/ObservableConcurrencyTest.cs
deleted file mode 100644
index e8f04ad..0000000
--- a/Rx.NET/Tests.System.Reactive/Tests/ObservableConcurrencyTest.cs
+++ /dev/null
@@ -1,1124 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Reactive;
-using System.Reactive.Concurrency;
-using System.Reactive.Disposables;
-using System.Reactive.Linq;
-using System.Reactive.Subjects;
-using System.Threading;
-using System.Windows.Threading;
-using Microsoft.Reactive.Testing;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using ReactiveTests.Dummies;
-
-#if HAS_WINFORMS
-using System.Windows.Forms;
-#endif
-
-#if SILVERLIGHT && !SILVERLIGHTM7
-using Microsoft.Silverlight.Testing;
-#endif
-
-namespace ReactiveTests.Tests
-{
- [TestClass]
- public partial class ObservableConcurrencyTest : TestBase
- {
- #region + ObserveOn +
-
- [TestMethod]
- public void ObserveOn_ArgumentChecking()
- {
- var someObservable = Observable.Empty<int>();
-
-#if HAS_WINFORMS
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ObserveOn<int>(default(IObservable<int>), new ControlScheduler(new Label())));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ObserveOn<int>(someObservable, default(ControlScheduler)));
-
- ReactiveAssert.Throws<ArgumentNullException>(() => ControlObservable.ObserveOn<int>(default(IObservable<int>), new Label()));
- ReactiveAssert.Throws<ArgumentNullException>(() => ControlObservable.ObserveOn<int>(someObservable, default(Label)));
-#endif
-
-#if USE_SL_DISPATCHER
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ObserveOn<int>(default(IObservable<int>), new DispatcherScheduler(System.Windows.Deployment.Current.Dispatcher)));
-#else
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ObserveOn<int>(default(IObservable<int>), new DispatcherScheduler(Dispatcher.CurrentDispatcher)));
-#endif
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ObserveOn<int>(someObservable, default(DispatcherScheduler)));
-
-#if USE_SL_DISPATCHER
- ReactiveAssert.Throws<ArgumentNullException>(() => DispatcherObservable.ObserveOn<int>(default(IObservable<int>), System.Windows.Deployment.Current.Dispatcher));
-#else
- ReactiveAssert.Throws<ArgumentNullException>(() => DispatcherObservable.ObserveOn<int>(default(IObservable<int>), Dispatcher.CurrentDispatcher));
-#endif
- ReactiveAssert.Throws<ArgumentNullException>(() => DispatcherObservable.ObserveOn<int>(someObservable, default(Dispatcher)));
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ObserveOn<int>(default(IObservable<int>), new SynchronizationContext()));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ObserveOn<int>(someObservable, default(SynchronizationContext)));
-
- ReactiveAssert.Throws<ArgumentNullException>(() => DispatcherObservable.ObserveOnDispatcher<int>(default(IObservable<int>)));
- }
-
-#if HAS_WINFORMS
- [TestMethod]
- public void ObserveOn_Control()
- {
- var lbl = CreateLabel();
-
- var evt = new ManualResetEvent(false);
- bool okay = true;
- Observable.Range(0, 10, NewThreadScheduler.Default).ObserveOn(lbl).Subscribe(x =>
- {
- lbl.Text = x.ToString();
- okay &= (SynchronizationContext.Current is System.Windows.Forms.WindowsFormsSynchronizationContext);
- }, () => evt.Set());
-
- evt.WaitOne();
- Application.Exit();
- Assert.IsTrue(okay);
- }
-
- [TestMethod]
- public void ObserveOn_ControlScheduler()
- {
- var lbl = CreateLabel();
-
- var evt = new ManualResetEvent(false);
- bool okay = true;
- Observable.Range(0, 10, NewThreadScheduler.Default).ObserveOn(new ControlScheduler(lbl)).Subscribe(x =>
- {
- lbl.Text = x.ToString();
- okay &= (SynchronizationContext.Current is System.Windows.Forms.WindowsFormsSynchronizationContext);
- }, () => evt.Set());
-
- evt.WaitOne();
- Application.Exit();
- Assert.IsTrue(okay);
- }
-
- private Label CreateLabel()
- {
- var loaded = new ManualResetEvent(false);
- var lbl = default(Label);
-
- var t = new Thread(() =>
- {
- lbl = new Label();
- var frm = new Form { Controls = { lbl }, Width = 0, Height = 0, FormBorderStyle = FormBorderStyle.None, ShowInTaskbar = false };
- frm.Load += (_, __) =>
- {
- loaded.Set();
- };
- Application.Run(frm);
- });
- t.SetApartmentState(ApartmentState.STA);
- t.Start();
-
- loaded.WaitOne();
- return lbl;
- }
-#endif
-
- [TestMethod]
- [Asynchronous]
- public void ObserveOn_Dispatcher()
- {
- var dispatcher = DispatcherHelpers.EnsureDispatcher();
-
- RunAsync(evt =>
- {
- bool okay = true;
- Observable.Range(0, 10, NewThreadScheduler.Default).ObserveOn(dispatcher).Subscribe(x =>
- {
- okay &= (SynchronizationContext.Current is System.Windows.Threading.DispatcherSynchronizationContext);
- }, () =>
- {
- Assert.IsTrue(okay);
- dispatcher.InvokeShutdown();
- evt.Set();
- });
- });
- }
-
- [TestMethod]
- [Asynchronous]
- public void ObserveOn_DispatcherScheduler()
- {
- var dispatcher = DispatcherHelpers.EnsureDispatcher();
-
- RunAsync(evt =>
- {
- bool okay = true;
- Observable.Range(0, 10, NewThreadScheduler.Default).ObserveOn(new DispatcherScheduler(dispatcher)).Subscribe(x =>
- {
- okay &= (SynchronizationContext.Current is System.Windows.Threading.DispatcherSynchronizationContext);
- }, () =>
- {
- Assert.IsTrue(okay);
- dispatcher.InvokeShutdown();
- evt.Set();
- });
- });
- }
-
- [TestMethod]
- [Asynchronous]
- public void ObserveOn_CurrentDispatcher()
- {
- var dispatcher = DispatcherHelpers.EnsureDispatcher();
-
- RunAsync(evt =>
- {
- bool okay = true;
- dispatcher.BeginInvoke(new Action(() =>
- {
- Observable.Range(0, 10, NewThreadScheduler.Default).ObserveOnDispatcher().Subscribe(x =>
- {
- okay &= (SynchronizationContext.Current is System.Windows.Threading.DispatcherSynchronizationContext);
- }, () =>
- {
- Assert.IsTrue(okay);
- dispatcher.InvokeShutdown();
- evt.Set();
- });
- }));
- });
- }
-
- [TestMethod]
- [Asynchronous]
- public void ObserveOn_Error()
- {
- var dispatcher = DispatcherHelpers.EnsureDispatcher();
-
- RunAsync(evt =>
- {
- var ex = new Exception();
- bool okay = true;
-
- dispatcher.BeginInvoke(new Action(() =>
- {
- Observable.Throw<int>(ex).ObserveOnDispatcher().Subscribe(x =>
- {
- okay &= (SynchronizationContext.Current is System.Windows.Threading.DispatcherSynchronizationContext);
- },
- e =>
- {
- Assert.IsTrue(okay);
- Assert.AreSame(ex, e);
- dispatcher.InvokeShutdown();
- evt.Set();
- },
- () =>
- {
- Assert.Fail();
- dispatcher.InvokeShutdown();
- evt.Set();
- });
- }));
- });
- }
-
- #endregion
-
- #region SubscribeOn
-
- [TestMethod]
- public void SubscribeOn_ArgumentChecking()
- {
- var someObservable = Observable.Empty<int>();
-
-#if HAS_WINFORMS
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.SubscribeOn<int>(default(IObservable<int>), new ControlScheduler(new Label())));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.SubscribeOn<int>(someObservable, default(ControlScheduler)));
-
- ReactiveAssert.Throws<ArgumentNullException>(() => ControlObservable.SubscribeOn<int>(default(IObservable<int>), new Label()));
- ReactiveAssert.Throws<ArgumentNullException>(() => ControlObservable.SubscribeOn<int>(someObservable, default(Label)));
-#endif
-
-#if USE_SL_DISPATCHER
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.SubscribeOn<int>(default(IObservable<int>), new DispatcherScheduler(System.Windows.Deployment.Current.Dispatcher)));
-#else
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.SubscribeOn<int>(default(IObservable<int>), new DispatcherScheduler(Dispatcher.CurrentDispatcher)));
-#endif
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.SubscribeOn<int>(someObservable, default(DispatcherScheduler)));
-
-#if USE_SL_DISPATCHER
- ReactiveAssert.Throws<ArgumentNullException>(() => DispatcherObservable.SubscribeOn<int>(default(IObservable<int>), System.Windows.Deployment.Current.Dispatcher));
-#else
- ReactiveAssert.Throws<ArgumentNullException>(() => DispatcherObservable.SubscribeOn<int>(default(IObservable<int>), Dispatcher.CurrentDispatcher));
-#endif
- ReactiveAssert.Throws<ArgumentNullException>(() => DispatcherObservable.SubscribeOn<int>(someObservable, default(Dispatcher)));
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.SubscribeOn<int>(default(IObservable<int>), new SynchronizationContext()));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.SubscribeOn<int>(someObservable, default(SynchronizationContext)));
-
- ReactiveAssert.Throws<ArgumentNullException>(() => DispatcherObservable.SubscribeOnDispatcher<int>(default(IObservable<int>)));
- }
-
-#if HAS_WINFORMS
- [TestMethod]
- public void SubscribeOn_Control()
- {
- var lbl = CreateLabel();
-
- var evt2 = new ManualResetEvent(false);
- var evt = new ManualResetEvent(false);
- bool okay = true;
- var d = Observable.Create<int>(obs =>
- {
- lbl.Text = "Subscribe";
- okay &= (SynchronizationContext.Current is System.Windows.Forms.WindowsFormsSynchronizationContext);
- evt2.Set();
-
- return () =>
- {
- lbl.Text = "Unsubscribe";
- okay &= (SynchronizationContext.Current is System.Windows.Forms.WindowsFormsSynchronizationContext);
- evt.Set();
- };
- })
- .SubscribeOn(lbl)
- .Subscribe(_ => {});
-
- evt2.WaitOne();
- d.Dispose();
-
- evt.WaitOne();
- Application.Exit();
- Assert.IsTrue(okay);
- }
-
- [TestMethod]
- public void SubscribeOn_ControlScheduler()
- {
- var lbl = CreateLabel();
-
- var evt2 = new ManualResetEvent(false);
- var evt = new ManualResetEvent(false);
- bool okay = true;
- var d = Observable.Create<int>(obs =>
- {
- lbl.Text = "Subscribe";
- okay &= (SynchronizationContext.Current is System.Windows.Forms.WindowsFormsSynchronizationContext);
- evt2.Set();
-
- return () =>
- {
- lbl.Text = "Unsubscribe";
- okay &= (SynchronizationContext.Current is System.Windows.Forms.WindowsFormsSynchronizationContext);
- evt.Set();
- };
- })
- .SubscribeOn(new ControlScheduler(lbl))
- .Subscribe(_ => { });
-
- evt2.WaitOne();
- d.Dispose();
-
- evt.WaitOne();
- Application.Exit();
- Assert.IsTrue(okay);
- }
-#endif
-
- [TestMethod]
- [Asynchronous]
- public void SubscribeOn_Dispatcher()
- {
- var dispatcher = DispatcherHelpers.EnsureDispatcher();
-
- RunAsync(evt =>
- {
- var s = new AsyncSubject<Unit>();
- bool okay = true;
- var d = Observable.Create<int>(obs =>
- {
- okay &= (SynchronizationContext.Current is System.Windows.Threading.DispatcherSynchronizationContext);
- s.OnNext(Unit.Default);
- s.OnCompleted();
-
- return () =>
- {
- okay &= (SynchronizationContext.Current is System.Windows.Threading.DispatcherSynchronizationContext);
- Assert.IsTrue(okay);
- dispatcher.InvokeShutdown();
- evt.Set();
- };
- })
- .SubscribeOn(dispatcher)
- .Subscribe(_ => { });
-
- s.Subscribe(_ => d.Dispose());
- });
- }
-
- [TestMethod]
- [Asynchronous]
- public void SubscribeOn_DispatcherScheduler()
- {
- var dispatcher = DispatcherHelpers.EnsureDispatcher();
-
- RunAsync(evt =>
- {
- var s = new AsyncSubject<Unit>();
- bool okay = true;
- var d = Observable.Create<int>(obs =>
- {
- okay &= (SynchronizationContext.Current is System.Windows.Threading.DispatcherSynchronizationContext);
- s.OnNext(Unit.Default);
- s.OnCompleted();
-
- return () =>
- {
- okay &= (SynchronizationContext.Current is System.Windows.Threading.DispatcherSynchronizationContext);
- Assert.IsTrue(okay);
- dispatcher.InvokeShutdown();
- evt.Set();
- };
- })
- .SubscribeOn(new DispatcherScheduler(dispatcher))
- .Subscribe(_ => { });
-
- s.Subscribe(_ => d.Dispose());
- });
- }
-
- [TestMethod]
- [Asynchronous]
- public void SubscribeOn_CurrentDispatcher()
- {
- var dispatcher = DispatcherHelpers.EnsureDispatcher();
-
- RunAsync(evt =>
- {
- var s = new AsyncSubject<Unit>();
- bool okay = true;
-
- dispatcher.BeginInvoke(new Action(() =>
- {
- var d = Observable.Create<int>(obs =>
- {
- okay &= (SynchronizationContext.Current is System.Windows.Threading.DispatcherSynchronizationContext);
- s.OnNext(Unit.Default);
- s.OnCompleted();
-
- return () =>
- {
- okay &= (SynchronizationContext.Current is System.Windows.Threading.DispatcherSynchronizationContext);
- Assert.IsTrue(okay);
- dispatcher.InvokeShutdown();
- evt.Set();
- };
- })
- .SubscribeOnDispatcher()
- .Subscribe(_ => { });
-
- s.Subscribe(_ => d.Dispose());
- }));
- });
- }
-
- #endregion
-
- #region + Synchronize +
-
- [TestMethod]
- public void Synchronize_ArgumentChecking()
- {
- var someObservable = Observable.Empty<int>();
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Synchronize<int>(default(IObservable<int>)));
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Synchronize<int>(default(IObservable<int>), new object()));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Synchronize<int>(someObservable, null));
- }
-
- [TestMethod]
- public void Synchronize_Range()
- {
- int i = 0;
- bool outsideLock = true;
-
- var gate = new object();
- lock (gate)
- {
- outsideLock = false;
- Observable.Range(0, 100, NewThreadScheduler.Default).Synchronize(gate).Subscribe(x => i++, () => { Assert.IsTrue(outsideLock); });
- Thread.Sleep(100);
- Assert.AreEqual(0, i);
- outsideLock = true;
- }
-
- while (i < 100)
- {
- Thread.Sleep(10);
- lock (gate)
- {
- int start = i;
- Thread.Sleep(100);
- Assert.AreEqual(start, i);
- }
- }
- }
-
- [TestMethod]
- public void Synchronize_Throw()
- {
- var ex = new Exception();
- var resLock = new object();
- var e = default(Exception);
- bool outsideLock = true;
-
- var gate = new object();
- lock (gate)
- {
- outsideLock = false;
- Observable.Throw<int>(ex, NewThreadScheduler.Default).Synchronize(gate).Subscribe(x => { Assert.Fail(); }, err => { lock (resLock) { e = err; } }, () => { Assert.IsTrue(outsideLock); });
- Thread.Sleep(100);
- Assert.IsNull(e);
- outsideLock = true;
- }
-
- while (true)
- {
- lock (resLock)
- {
- if (e != null)
- break;
- }
- }
-
- Assert.AreSame(ex, e);
- }
-
- [TestMethod]
- public void Synchronize_BadObservable()
- {
- var o = Observable.Create<int>(obs =>
- {
- var t1 = new Thread(() =>
- {
- for (int i = 0; i < 100; i++)
- {
- obs.OnNext(i);
- }
- });
-
- new Thread(() =>
- {
- t1.Start();
-
- for (int i = 100; i < 200; i++)
- {
- obs.OnNext(i);
- }
-
- t1.Join();
- obs.OnCompleted();
- }).Start();
-
- return () => { };
- });
-
- var evt = new ManualResetEvent(false);
-
- int sum = 0;
- o.Synchronize().Subscribe(x => sum += x, () => { evt.Set(); });
-
- evt.WaitOne();
-
- Assert.AreEqual(Enumerable.Range(0, 200).Sum(), sum);
- }
-
- #endregion
- }
-
- [TestClass]
- public class ObservableConcurrencyReactiveTest : ReactiveTest
- {
- #region + ObserveOn +
-
- [TestMethod]
- public void ObserveOn_Scheduler_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ObserveOn(default(IObservable<int>), DummyScheduler.Instance));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ObserveOn(DummyObservable<int>.Instance, default(IScheduler)));
- }
-
- [TestMethod]
- public void ObserveOn_Scheduler_Completed()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext( 90, 1),
- OnNext(120, 2),
- OnNext(230, 3),
- OnNext(240, 4),
- OnNext(310, 5),
- OnNext(470, 6),
- OnCompleted<int>(530)
- );
-
- var results = scheduler.Start(() =>
- xs.ObserveOn(scheduler)
- );
-
- results.Messages.AssertEqual(
- OnNext(231, 3),
- OnNext(241, 4),
- OnNext(311, 5),
- OnNext(471, 6),
- OnCompleted<int>(531)
- );
-
-#if !NO_PERF && !NO_CDS
- // BREAKING CHANGE v2 > v1.x -> More aggressive disposal behavior
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 531)
- );
-#else
- //
- // TODO: Check platform discrepancies
- //
-
- //xs.Subscriptions.AssertEqual(
- // Subscribe(200, 1000)
- //);
-#endif
- }
-
- [TestMethod]
- public void ObserveOn_Scheduler_Error()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(90, 1),
- OnNext(120, 2),
- OnNext(230, 3),
- OnNext(240, 4),
- OnNext(310, 5),
- OnNext(470, 6),
- OnError<int>(530, ex)
- );
-
- var results = scheduler.Start(() =>
- xs.ObserveOn(scheduler)
- );
-
- results.Messages.AssertEqual(
- OnNext(231, 3),
- OnNext(241, 4),
- OnNext(311, 5),
- OnNext(471, 6),
- OnError<int>(531, ex)
- );
-
-#if !NO_PERF && !NO_CDS
- // BREAKING CHANGE v2 > v1.x -> More aggressive disposal behavior
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 531)
- );
-#else
- //
- // TODO: Check platform discrepancies
- //
- //xs.Subscriptions.AssertEqual(
- // Subscribe(200, 1000)
- //);
-#endif
- }
-
- [TestMethod]
- public void ObserveOn_Scheduler_Dispose()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(90, 1),
- OnNext(120, 2),
- OnNext(230, 3),
- OnNext(240, 4),
- OnNext(310, 5),
- OnNext(470, 6)
- );
-
- var results = scheduler.Start(() =>
- xs.ObserveOn(scheduler)
- );
-
- results.Messages.AssertEqual(
- OnNext(231, 3),
- OnNext(241, 4),
- OnNext(311, 5),
- OnNext(471, 6)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
- }
-
- [TestMethod]
- public void ObserveOn_Scheduler_SameTime()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(210, 1),
- OnNext(210, 2)
- );
-
- var results = scheduler.Start(() =>
- xs.ObserveOn(scheduler)
- );
-
- results.Messages.AssertEqual(
- OnNext(211, 1),
- OnNext(212, 2)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
- }
-
- [TestMethod]
- public void ObserveOn_Scheduler_OnNextThrows()
- {
- var e = new ManualResetEvent(false);
-
- var scheduler = new MyScheduler(e);
-
- Observable.Range(0, 10, Scheduler.Default).ObserveOn(scheduler).Subscribe(
- x =>
- {
- if (x == 5)
- throw new Exception();
- }
- );
-
- e.WaitOne();
- Assert.IsNotNull(scheduler._exception);
- }
-
- class MyScheduler : IScheduler
- {
- internal Exception _exception;
- private ManualResetEvent _evt;
-
- public MyScheduler(ManualResetEvent e)
- {
- _evt = e;
- }
-
- public DateTimeOffset Now
- {
- get { throw new NotImplementedException(); }
- }
-
- public IDisposable Schedule<TState>(TState state, Func<IScheduler, TState, IDisposable> action)
- {
- try
- {
- return action(this, state);
- }
- catch (Exception ex)
- {
- _exception = ex;
- _evt.Set();
- return Disposable.Empty;
- }
- }
-
- public IDisposable Schedule<TState>(TState state, TimeSpan dueTime, Func<IScheduler, TState, IDisposable> action)
- {
- throw new NotImplementedException();
- }
-
- public IDisposable Schedule<TState>(TState state, DateTimeOffset dueTime, Func<IScheduler, TState, IDisposable> action)
- {
- throw new NotImplementedException();
- }
- }
-
-#if !NO_PERF && !NO_CDS
- [TestMethod]
- public void ObserveOn_LongRunning_Simple()
- {
- var started = default(ManualResetEvent);
- var stopped = default(ManualResetEvent);
-
- var scheduler = new TestLongRunningScheduler(e => started = e, e => stopped = e);
-
- var s = new Subject<int>();
-
- var end = new ManualResetEvent(false);
- var lst = new List<int>();
- s.ObserveOn(scheduler).Subscribe(lst.Add, () => end.Set());
-
- s.OnNext(1);
- s.OnNext(2);
- s.OnNext(3);
- s.OnCompleted();
-
- end.WaitOne();
-
- Assert.IsTrue(lst.SequenceEqual(new[] { 1, 2, 3 }));
- }
-
- [TestMethod]
- public void ObserveOn_LongRunning_Error()
- {
- var started = default(ManualResetEvent);
- var stopped = default(ManualResetEvent);
-
- var scheduler = new TestLongRunningScheduler(e => started = e, e => stopped = e);
-
- var s = new Subject<int>();
-
- var end = new ManualResetEvent(false);
- var err = default(Exception);
- s.ObserveOn(scheduler).Subscribe(_ => { }, ex => { err = ex; end.Set(); });
-
- s.OnNext(1);
- s.OnNext(2);
- s.OnNext(3);
-
- var ex_ = new Exception();
- s.OnError(ex_);
-
- end.WaitOne();
-
- Assert.AreSame(ex_, err);
- }
-
- [TestMethod]
- public void ObserveOn_LongRunning_TimeVariance()
- {
- var started = default(ManualResetEvent);
- var stopped = default(ManualResetEvent);
-
- var scheduler = new TestLongRunningScheduler(e => started = e, e => stopped = e);
-
- var s = new Subject<int>();
-
- var end = new ManualResetEvent(false);
- s.ObserveOn(scheduler).Subscribe(_ => { }, () => end.Set());
-
- s.OnNext(1); // Ensure active
- started.WaitOne();
- Thread.Sleep(100); // Try to enter the dispatcher event wait state
-
- for (int i = 0; i < 1000; i++)
- {
- if (i % 100 == 0)
- Thread.Sleep(10);
-
- s.OnNext(i);
- }
-
- s.OnCompleted();
-
- end.WaitOne();
- }
-
- [TestMethod]
- public void ObserveOn_LongRunning_HoldUpDuringDispatchAndFail()
- {
- var started = default(ManualResetEvent);
- var stopped = default(ManualResetEvent);
-
- var scheduler = new TestLongRunningScheduler(e => started = e, e => stopped = e);
-
- var s = new Subject<int>();
-
- var onNext = new ManualResetEvent(false);
- var resume = new ManualResetEvent(false);
- var lst = new List<int>();
- var err = default(Exception);
- var end = new ManualResetEvent(false);
- s.ObserveOn(scheduler).Subscribe(x => { lst.Add(x); onNext.Set(); resume.WaitOne(); }, ex_ => { err = ex_; end.Set(); });
-
- s.OnNext(1);
- onNext.WaitOne();
-
- s.OnNext(2);
- s.OnNext(3);
-
- var ex = new Exception();
- s.OnError(ex);
-
- resume.Set();
-
- end.WaitOne();
- Assert.IsTrue(lst.SequenceEqual(new[] { 1, 2, 3 }));
- Assert.AreSame(ex, err);
- }
-
- [TestMethod]
- public void ObserveOn_LongRunning_Cancel()
- {
- var started = default(ManualResetEvent);
- var stopped = default(ManualResetEvent);
-
- var scheduler = new TestLongRunningScheduler(e => started = e, e => stopped = e);
-
- var s = new Subject<int>();
-
- var lst = new List<int>();
- var end = new ManualResetEvent(false);
-
- var running = new ManualResetEvent(false);
- var d = s.ObserveOn(scheduler).Subscribe(x => { lst.Add(x); running.Set(); });
-
- s.OnNext(0);
- started.WaitOne();
-
- s.OnNext(1);
- s.OnNext(2);
- s.OnNext(3);
- running.WaitOne();
-
- d.Dispose();
- stopped.WaitOne();
-
- s.OnNext(4);
-
- Assert.IsTrue(lst.Count > 0 && !lst.Contains(4));
- }
-
- [TestMethod]
- public void ObserveOn_LongRunning_OnNextThrows()
- {
- var started = default(ManualResetEvent);
- var stopped = default(ManualResetEvent);
- var exception = default(Exception);
-
- var scheduler = new TestLongRunningScheduler(e => started = e, e => stopped = e, ex => exception = ex);
-
- var s = new Subject<int>();
-
- var lst = new List<int>();
- var end = new ManualResetEvent(false);
-
- var running = new ManualResetEvent(false);
- var d = s.ObserveOn(scheduler).Subscribe(x => { lst.Add(x); running.Set(); if (x == 3) throw new Exception(); });
-
- s.OnNext(0);
- started.WaitOne();
-
- s.OnNext(1);
- s.OnNext(2);
- s.OnNext(3);
- running.WaitOne();
-
- s.OnNext(4);
-
- stopped.WaitOne();
-
- Assert.IsNotNull(exception);
- }
-#endif
-
-#if !NO_SYNCCTX
- [TestMethod]
- public void ObserveOn_SynchronizationContext_Simple()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(90, 1),
- OnNext(120, 2),
- OnNext(230, 3),
- OnNext(240, 4),
- OnNext(310, 5),
- OnNext(470, 6),
- OnCompleted<int>(530)
- );
-
- var results = scheduler.Start(() =>
- xs.ObserveOn(new MyCtx(scheduler))
- );
-
- results.Messages.AssertEqual(
- OnNext(231, 3),
- OnNext(241, 4),
- OnNext(311, 5),
- OnNext(471, 6),
- OnCompleted<int>(531)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 531)
- );
- }
-#endif
-
- #endregion
-
- #region SubscribeOn
-
- [TestMethod]
- public void SubscribeOn_Scheduler_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.SubscribeOn(default(IObservable<int>), DummyScheduler.Instance));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.SubscribeOn(DummyObservable<int>.Instance, default(IScheduler)));
- }
-
- [TestMethod]
- public void SubscribeOn_Scheduler_Sleep()
- {
- var scheduler = new TestScheduler();
-
- var s = 0L;
- var d = 0L;
-
- var xs = Observable.Create<long>(observer =>
- {
- s = scheduler.Clock;
- return () => d = scheduler.Clock;
- });
-
- var results = scheduler.Start(() =>
- xs.SubscribeOn(scheduler)
- );
-
- results.Messages.AssertEqual(
- );
-
- Assert.AreEqual(201, s);
- Assert.AreEqual(1001, d);
- }
-
- [TestMethod]
- public void SubscribeOn_Scheduler_Completed()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnCompleted<long>(300)
- );
-
- var results = scheduler.Start(() =>
- xs.SubscribeOn(scheduler)
- );
-
- results.Messages.AssertEqual(
- OnCompleted<long>(300)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(201, 301)
- );
- }
-
- [TestMethod]
- public void SubscribeOn_Scheduler_Error()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnError<int>(300, ex)
- );
-
- var results = scheduler.Start(() =>
- xs.SubscribeOn(scheduler)
- );
-
- results.Messages.AssertEqual(
- OnError<int>(300, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(201, 301)
- );
- }
-
- [TestMethod]
- public void SubscribeOn_Scheduler_Dispose()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable<int>(
- );
-
- var results = scheduler.Start(() =>
- xs.SubscribeOn(scheduler)
- );
-
- results.Messages.AssertEqual(
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(201, 1001)
- );
- }
-
-#if !NO_SYNCCTX
- [TestMethod]
- public void SubscribeOn_SynchronizationContext_Simple()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(90, 1),
- OnNext(120, 2),
- OnNext(230, 3),
- OnNext(240, 4),
- OnNext(310, 5),
- OnNext(470, 6),
- OnCompleted<int>(530)
- );
-
- var results = scheduler.Start(() =>
- xs.SubscribeOn(new MyCtx(scheduler))
- );
-
- results.Messages.AssertEqual(
- OnNext(230, 3),
- OnNext(240, 4),
- OnNext(310, 5),
- OnNext(470, 6),
- OnCompleted<int>(530)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(201, 531)
- );
- }
-#endif
-
- #endregion
-
- #region |> Helpers <|
-
-#if !NO_SYNCCTX
- class MyCtx : SynchronizationContext
- {
- private IScheduler scheduler;
-
- public MyCtx(IScheduler scheduler)
- {
- this.scheduler = scheduler;
- }
-
- public override void Post(SendOrPostCallback d, object state)
- {
- scheduler.Schedule(state, (self, s) => { d(s); return Disposable.Empty; });
- }
- }
-#endif
-
- #endregion
- }
-}
diff --git a/Rx.NET/Tests.System.Reactive/Tests/ObservableConversionTests.cs b/Rx.NET/Tests.System.Reactive/Tests/ObservableConversionTests.cs
deleted file mode 100644
index c29d07a..0000000
--- a/Rx.NET/Tests.System.Reactive/Tests/ObservableConversionTests.cs
+++ /dev/null
@@ -1,855 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.Linq;
-using System.Reactive;
-using System.Reactive.Concurrency;
-using System.Reactive.Linq;
-using System.Reactive.Subjects;
-using System.Reflection;
-using System.Threading;
-using Microsoft.Reactive.Testing;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using ReactiveTests.Dummies;
-
-namespace ReactiveTests.Tests
-{
- [TestClass]
- public class ObservableConversionTests : ReactiveTest
- {
- #region + Subscribe +
-
- [TestMethod]
- public void SubscribeToEnumerable_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Subscribe<int>((IEnumerable<int>)null, DummyObserver<int>.Instance));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Subscribe<int>(DummyEnumerable<int>.Instance, (IObserver<int>)null));
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Subscribe<int>((IEnumerable<int>)null, DummyObserver<int>.Instance, DummyScheduler.Instance));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Subscribe<int>(DummyEnumerable<int>.Instance, DummyObserver<int>.Instance, null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Subscribe<int>(DummyEnumerable<int>.Instance, (IObserver<int>)null, DummyScheduler.Instance));
- ReactiveAssert.Throws<NullReferenceException>(() => NullEnumeratorEnumerable<int>.Instance.Subscribe(Observer.Create<int>(x => { }), Scheduler.CurrentThread));
- }
-
- [TestMethod]
- public void SubscribeToEnumerable_Finite()
- {
- var scheduler = new TestScheduler();
-
- var results = scheduler.CreateObserver<int>();
- var d = default(IDisposable);
- var xs = default(MockEnumerable<int>);
-
- scheduler.ScheduleAbsolute(Created, () => xs = new MockEnumerable<int>(scheduler, Enumerable_Finite()));
- scheduler.ScheduleAbsolute(Subscribed, () => d = xs.Subscribe(results, scheduler));
- scheduler.ScheduleAbsolute(Disposed, () => d.Dispose());
-
- scheduler.Start();
-
- results.Messages.AssertEqual(
- OnNext(201, 1),
- OnNext(202, 2),
- OnNext(203, 3),
- OnNext(204, 4),
- OnNext(205, 5),
- OnCompleted<int>(206)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 206)
- );
- }
-
- [TestMethod]
- public void SubscribeToEnumerable_Infinite()
- {
- var scheduler = new TestScheduler();
-
- var results = scheduler.CreateObserver<int>();
- var d = default(IDisposable);
- var xs = default(MockEnumerable<int>);
-
- scheduler.ScheduleAbsolute(Created, () => xs = new MockEnumerable<int>(scheduler, Enumerable_Infinite()));
- scheduler.ScheduleAbsolute(Subscribed, () => d = xs.Subscribe(results, scheduler));
- scheduler.ScheduleAbsolute(210, () => d.Dispose());
-
- scheduler.Start();
-
- results.Messages.AssertEqual(
- OnNext(201, 1),
- OnNext(202, 1),
- OnNext(203, 1),
- OnNext(204, 1),
- OnNext(205, 1),
- OnNext(206, 1),
- OnNext(207, 1),
- OnNext(208, 1),
- OnNext(209, 1)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void SubscribeToEnumerable_Error()
- {
- var scheduler = new TestScheduler();
-
- var results = scheduler.CreateObserver<int>();
- var d = default(IDisposable);
- var xs = default(MockEnumerable<int>);
- var ex = new Exception();
-
- scheduler.ScheduleAbsolute(Created, () => xs = new MockEnumerable<int>(scheduler, Enumerable_Error(ex)));
- scheduler.ScheduleAbsolute(Subscribed, () => d = xs.Subscribe(results, scheduler));
- scheduler.ScheduleAbsolute(Disposed, () => d.Dispose());
-
- scheduler.Start();
-
- results.Messages.AssertEqual(
- OnNext(201, 1),
- OnNext(202, 2),
- OnNext(203, 3),
- OnError<int>(204, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 204)
- );
- }
-
-#if !SILVERLIGHTM7
- [TestMethod]
- public void SubscribeToEnumerable_DefaultScheduler()
- {
- for (int i = 0; i < 100; i++)
- {
- var scheduler = new TestScheduler();
-
- var results1 = new List<int>();
- var results2 = new List<int>();
-
- var s1 = new Semaphore(0, 1);
- var s2 = new Semaphore(0, 1);
-
- Observable.Subscribe(Enumerable_Finite(),
- Observer.Create<int>(x => results1.Add(x), ex => { throw ex; }, () => s1.Release()));
- Observable.Subscribe(Enumerable_Finite(),
- Observer.Create<int>(x => results2.Add(x), ex => { throw ex; }, () => s2.Release()),
- DefaultScheduler.Instance);
-
- s1.WaitOne();
- s2.WaitOne();
-
- results1.AssertEqual(results2);
- }
- }
-#endif
-
- #endregion
-
- #region ToEnumerable
-
- [TestMethod]
- public void ToEnumerable_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToEnumerable(default(IObservable<int>)));
- }
-
- [TestMethod]
- public void ToEnumerable_Generic()
- {
- Assert.IsTrue(Observable.Range(0, 10).ToEnumerable().SequenceEqual(Enumerable.Range(0, 10)));
- }
-
- [TestMethod]
- public void ToEnumerable_NonGeneric()
- {
- Assert.IsTrue(((IEnumerable)Observable.Range(0, 10).ToEnumerable()).Cast<int>().SequenceEqual(Enumerable.Range(0, 10)));
- }
-
- [TestMethod]
- public void ToEnumerable_ManualGeneric()
- {
- var res = Observable.Range(0, 10).ToEnumerable();
- var ieg = res.GetEnumerator();
- for (int i = 0; i < 10; i++)
- {
- Assert.IsTrue(ieg.MoveNext());
- Assert.AreEqual(i, ieg.Current);
- }
- Assert.IsFalse(ieg.MoveNext());
- }
-
- [TestMethod]
- public void ToEnumerable_ManualNonGeneric()
- {
- var res = (IEnumerable)Observable.Range(0, 10).ToEnumerable();
- var ien = res.GetEnumerator();
- for (int i = 0; i < 10; i++)
- {
- Assert.IsTrue(ien.MoveNext());
- Assert.AreEqual(i, ien.Current);
- }
- Assert.IsFalse(ien.MoveNext());
- }
-
- [TestMethod]
- public void ToEnumerable_ResetNotSupported()
- {
- ReactiveAssert.Throws<NotSupportedException>(() => Observable.Range(0, 10).ToEnumerable().GetEnumerator().Reset());
- }
-
- #endregion
-
- #region ToEvent
-
- [TestMethod]
- public void ToEvent_ArgumentChecks()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToEvent(default(IObservable<Unit>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToEvent(default(IObservable<int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToEvent(default(IObservable<EventPattern<EventArgs>>)));
- }
-
- [TestMethod]
- public void ToEvent_Unit()
- {
- var src = new Subject<Unit>();
- var evt = src.ToEvent();
-
- var num = 0;
- var hnd = new Action<Unit>(_ =>
- {
- num++;
- });
-
- evt.OnNext += hnd;
-
- Assert.AreEqual(0, num);
-
- src.OnNext(new Unit());
- Assert.AreEqual(1, num);
-
- src.OnNext(new Unit());
- Assert.AreEqual(2, num);
-
- evt.OnNext -= hnd;
-
- src.OnNext(new Unit());
- Assert.AreEqual(2, num);
- }
-
- [TestMethod]
- public void ToEvent_NonUnit()
- {
- var src = new Subject<int>();
- var evt = src.ToEvent();
-
- var lst = new List<int>();
- var hnd = new Action<int>(e =>
- {
- lst.Add(e);
- });
-
- evt.OnNext += hnd;
-
- src.OnNext(1);
- src.OnNext(2);
-
- evt.OnNext -= hnd;
-
- src.OnNext(3);
-
- Assert.IsTrue(lst.SequenceEqual(new[] { 1, 2 }));
- }
-
- [TestMethod]
- public void ToEvent_FromEvent()
- {
- var src = new Subject<int>();
- var evt = src.ToEvent();
-
- var res = Observable.FromEvent<int>(h => evt.OnNext += h, h => evt.OnNext -= h);
-
- var lst = new List<int>();
- using (res.Subscribe(e => lst.Add(e), () => Assert.Fail()))
- {
- src.OnNext(1);
- src.OnNext(2);
- }
-
- src.OnNext(3);
-
- Assert.IsTrue(lst.SequenceEqual(new[] { 1, 2 }));
- }
-
- #endregion
-
- #region ToEventPattern
-
- [TestMethod]
- public void ToEventPattern_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToEventPattern<EventArgs>(null));
- }
-
- [TestMethod]
- public void ToEventPattern_IEvent()
- {
- var src = new Subject<EventPattern<EventArgs<int>>>();
- var evt = src.ToEventPattern();
-
- var snd = new object();
-
- var lst = new List<int>();
- var hnd = new EventHandler<EventArgs<int>>((s, e) =>
- {
- Assert.AreSame(snd, s);
- lst.Add(e.Value);
- });
-
- evt.OnNext += hnd;
-
- src.OnNext(new EventPattern<EventArgs<int>>(snd, new EventArgs<int>(42)));
- src.OnNext(new EventPattern<EventArgs<int>>(snd, new EventArgs<int>(43)));
-
- evt.OnNext -= hnd;
-
- src.OnNext(new EventPattern<EventArgs<int>>(snd, new EventArgs<int>(44)));
-
- Assert.IsTrue(lst.SequenceEqual(new[] { 42, 43 }));
- }
-
- [TestMethod]
- public void ToEventPattern_IEvent_Fails()
- {
- var src = new Subject<EventPattern<EventArgs<int>>>();
- var evt = src.ToEventPattern();
-
- var snd = new object();
-
- var lst = new List<int>();
- var hnd = new EventHandler<EventArgs<int>>((s, e) =>
- {
- Assert.AreSame(snd, s);
- lst.Add(e.Value);
- });
-
- evt.OnNext += hnd;
-
- src.OnNext(new EventPattern<EventArgs<int>>(snd, new EventArgs<int>(42)));
- src.OnNext(new EventPattern<EventArgs<int>>(snd, new EventArgs<int>(43)));
-
- var ex = new Exception();
-
- ReactiveAssert.Throws(ex, () => src.OnError(ex));
-
- Assert.IsTrue(lst.SequenceEqual(new[] { 42, 43 }));
- }
-
- [TestMethod]
- public void ToEventPattern_IEvent_Completes()
- {
- var src = new Subject<EventPattern<EventArgs<int>>>();
- var evt = src.ToEventPattern();
-
- var snd = new object();
-
- var lst = new List<int>();
- var hnd = new EventHandler<EventArgs<int>>((s, e) =>
- {
- Assert.AreSame(snd, s);
- lst.Add(e.Value);
- });
-
- evt.OnNext += hnd;
-
- src.OnNext(new EventPattern<EventArgs<int>>(snd, new EventArgs<int>(42)));
- src.OnNext(new EventPattern<EventArgs<int>>(snd, new EventArgs<int>(43)));
-
- src.OnCompleted();
-
- Assert.IsTrue(lst.SequenceEqual(new[] { 42, 43 }));
- }
-
- class EventSrc
- {
- public event EventHandler<EventArgs<string>> E;
-
- public void On(string s)
- {
- var e = E;
- if (e != null)
- e(this, new EventArgs<string>(s));
- }
- }
-
- class EventArgs<T> : EventArgs
- {
- public T Value { get; private set; }
-
- public EventArgs(T value)
- {
- Value = value;
- }
- }
-
- [TestMethod]
- public void FromEventPattern_ToEventPattern()
- {
- var src = new EventSrc();
- var evt = Observable.FromEventPattern<EventHandler<EventArgs<string>>, EventArgs<string>>(h => new EventHandler<EventArgs<string>>(h), h => src.E += h, h => src.E -= h);
-
- var res = evt.ToEventPattern();
-
- var lst = new List<string>();
- var hnd = new EventHandler<EventArgs<string>>((s, e) =>
- {
- Assert.AreSame(src, s);
- lst.Add(e.Value);
- });
-
- src.On("bar");
-
- res.OnNext += hnd;
-
- src.On("foo");
- src.On("baz");
-
- res.OnNext -= hnd;
-
- src.On("qux");
-
- Assert.IsTrue(lst.SequenceEqual(new[] { "foo", "baz" }));
- }
-
- [TestMethod]
- public void ToEvent_DuplicateHandlers()
- {
- var src = new Subject<Unit>();
- var evt = src.ToEvent();
-
- var num = 0;
- var hnd = new Action<Unit>(e => num++);
-
- evt.OnNext += hnd;
-
- Assert.AreEqual(0, num);
-
- src.OnNext(new Unit());
- Assert.AreEqual(1, num);
-
- evt.OnNext += hnd;
-
- src.OnNext(new Unit());
- Assert.AreEqual(3, num);
-
- evt.OnNext -= hnd;
-
- src.OnNext(new Unit());
- Assert.AreEqual(4, num);
-
- evt.OnNext -= hnd;
-
- src.OnNext(new Unit());
- Assert.AreEqual(4, num);
- }
-
- [TestMethod]
- public void ToEvent_SourceCompletes()
- {
- var src = new Subject<Unit>();
- var evt = src.ToEvent();
-
- var num = 0;
- var hnd = new Action<Unit>(e => num++);
-
- evt.OnNext += hnd;
-
- Assert.AreEqual(0, num);
-
- src.OnNext(new Unit());
- Assert.AreEqual(1, num);
-
- src.OnNext(new Unit());
- Assert.AreEqual(2, num);
-
- src.OnCompleted();
- Assert.AreEqual(2, num);
-
-#if !SILVERLIGHT // FieldAccessException
- var tbl = GetSubscriptionTable(evt);
- Assert.IsTrue(tbl.Count == 0);
-#endif
- }
-
- [TestMethod]
- public void ToEvent_SourceFails()
- {
- var src = new Subject<Unit>();
- var evt = src.ToEvent();
-
- var num = 0;
- var hnd = new Action<Unit>(e => num++);
-
- evt.OnNext += hnd;
-
- Assert.AreEqual(0, num);
-
- src.OnNext(new Unit());
- Assert.AreEqual(1, num);
-
- src.OnNext(new Unit());
- Assert.AreEqual(2, num);
-
- var ex = new Exception();
-
- ReactiveAssert.Throws(ex, () => src.OnError(ex));
-
-#if !SILVERLIGHT // FieldAccessException
- var tbl = GetSubscriptionTable(evt);
- Assert.IsTrue(tbl.Count == 0);
-#endif
- }
-
- [TestMethod]
- public void ToEvent_DoneImmediately()
- {
- var src = Observable.Empty<Unit>();
- var evt = src.ToEvent();
-
- var num = 0;
- var hnd = new Action<Unit>(e => num++);
-
- for (int i = 0; i < 2; i++)
- {
- evt.OnNext += hnd;
-
- Assert.AreEqual(0, num);
-
-#if !SILVERLIGHT // FieldAccessException
- var tbl = GetSubscriptionTable(evt);
- Assert.IsTrue(tbl.Count == 0);
-#endif
- }
- }
-
- [TestMethod]
- public void ToEvent_UnbalancedHandlers()
- {
- var src = new Subject<Unit>();
- var evt = src.ToEvent();
-
- var num = 0;
- var hnd = new Action<Unit>(e => num++);
-
- evt.OnNext += hnd;
- Assert.AreEqual(0, num);
-
- evt.OnNext -= hnd;
- Assert.AreEqual(0, num);
-
- evt.OnNext -= hnd;
- Assert.AreEqual(0, num);
-
- evt.OnNext += hnd;
- Assert.AreEqual(0, num);
-
- src.OnNext(new Unit());
- Assert.AreEqual(1, num);
-
- src.OnNext(new Unit());
- Assert.AreEqual(2, num);
-
- evt.OnNext -= hnd;
- Assert.AreEqual(2, num);
-
- src.OnNext(new Unit());
- Assert.AreEqual(2, num);
- }
-
- private static Dictionary<Delegate, Stack<IDisposable>> GetSubscriptionTable(object evt)
- {
- return (Dictionary<Delegate, Stack<IDisposable>>)evt.GetType().GetField("_subscriptions", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(evt);
- }
-
- [TestMethod]
- public void EventPattern_Equality()
- {
- var e1 = new EventPattern<string, EventArgs>("Bart", EventArgs.Empty);
- var e2 = new EventPattern<string, EventArgs>("Bart", EventArgs.Empty);
-
- Assert.IsTrue(e1.Equals(e1));
- Assert.IsTrue(e1.Equals(e2));
- Assert.IsTrue(e2.Equals(e1));
- Assert.IsTrue(e1 == e2);
- Assert.IsTrue(!(e1 != e2));
- Assert.IsTrue(e1.GetHashCode() == e2.GetHashCode());
-
- Assert.IsFalse(e1.Equals(null));
- Assert.IsFalse(e1.Equals("xy"));
- Assert.IsFalse(e1 == null);
- }
-
- [TestMethod]
- public void EventPattern_Inequality()
- {
- var a1 = new MyEventArgs();
- var a2 = new MyEventArgs();
-
- var e1 = new EventPattern<string, MyEventArgs>("Bart", a1);
- var e2 = new EventPattern<string, MyEventArgs>("John", a1);
- var e3 = new EventPattern<string, MyEventArgs>("Bart", a2);
-
- Assert.IsTrue(!e1.Equals(e2));
- Assert.IsTrue(!e2.Equals(e1));
- Assert.IsTrue(!(e1 == e2));
- Assert.IsTrue(e1 != e2);
- Assert.IsTrue(e1.GetHashCode() != e2.GetHashCode());
-
- Assert.IsTrue(!e1.Equals(e3));
- Assert.IsTrue(!e3.Equals(e1));
- Assert.IsTrue(!(e1 == e3));
- Assert.IsTrue(e1 != e3);
- Assert.IsTrue(e1.GetHashCode() != e3.GetHashCode());
- }
-
- class MyEventArgs : EventArgs
- {
- }
-
- #endregion
-
- #region + ToObservable +
-
- [TestMethod]
- public void EnumerableToObservable_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToObservable((IEnumerable<int>)null, DummyScheduler.Instance));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToObservable(DummyEnumerable<int>.Instance, (IScheduler)null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToObservable(DummyEnumerable<int>.Instance, DummyScheduler.Instance).Subscribe(null));
- ReactiveAssert.Throws<NullReferenceException>(() => Observable.ToObservable(NullEnumeratorEnumerable<int>.Instance, Scheduler.CurrentThread).Subscribe());
- }
-
- [TestMethod]
- public void EnumerableToObservable_Complete()
- {
- var scheduler = new TestScheduler();
-
- var e = new MockEnumerable<int>(scheduler,
- new[] { 3, 1, 2, 4 }
- );
-
- var results = scheduler.Start(() =>
- e.ToObservable(scheduler)
- );
-
- results.Messages.AssertEqual(
- OnNext(201, 3),
- OnNext(202, 1),
- OnNext(203, 2),
- OnNext(204, 4),
- OnCompleted<int>(205)
- );
-
- e.Subscriptions.AssertEqual(
- Subscribe(200, 205)
- );
- }
-
- [TestMethod]
- public void EnumerableToObservable_Dispose()
- {
- var scheduler = new TestScheduler();
-
- var e = new MockEnumerable<int>(scheduler,
- new[] { 3, 1, 2, 4 }
- );
-
- var results = scheduler.Start(() =>
- e.ToObservable(scheduler),
- 203
- );
-
- results.Messages.AssertEqual(
- OnNext(201, 3),
- OnNext(202, 1)
- );
-
- e.Subscriptions.AssertEqual(
- Subscribe(200, 203)
- );
- }
-
- [TestMethod]
- public void EnumerableToObservable_Error()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var e = new MockEnumerable<int>(scheduler,
- EnumerableToObservable_Error_Core(ex)
- );
-
- var results = scheduler.Start(() =>
- e.ToObservable(scheduler)
- );
-
- results.Messages.AssertEqual(
- OnNext(201, 1),
- OnNext(202, 2),
- OnError<int>(203, ex)
- );
-
- e.Subscriptions.AssertEqual(
- Subscribe(200, 203)
- );
- }
-
- [TestMethod]
- public void EnumerableToObservable_Default_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToObservable((IEnumerable<int>)null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToObservable(DummyEnumerable<int>.Instance).Subscribe(null));
- }
-
- [TestMethod]
- public void EnumerableToObservable_Default()
- {
- var xs = new[] { 4, 3, 1, 5, 9, 2 };
-
- xs.ToObservable().AssertEqual(xs.ToObservable(DefaultScheduler.Instance));
- }
-
-#if !NO_PERF
- [TestMethod]
- public void EnumerableToObservable_LongRunning_Complete()
- {
- var start = default(ManualResetEvent);
- var end = default(ManualResetEvent);
- var scheduler = new TestLongRunningScheduler(x => start = x, x => end = x);
-
- var e = new[] { 3, 1, 2, 4 };
-
- var results = e.ToObservable(scheduler);
-
- var lst = new List<int>();
- results.Subscribe(lst.Add);
-
- start.WaitOne();
- end.WaitOne();
-
- Assert.IsTrue(e.SequenceEqual(lst));
- }
-
- [TestMethod]
- public void EnumerableToObservable_LongRunning_Dispose()
- {
- var start = default(ManualResetEvent);
- var end = default(ManualResetEvent);
- var scheduler = new TestLongRunningScheduler(x => start = x, x => end = x);
-
- var e = Enumerable.Range(0, int.MaxValue);
-
- var results = e.ToObservable(scheduler);
-
- var lst = new List<int>();
- var d = results.Subscribe(lst.Add);
-
- start.WaitOne();
-
- while (lst.Count < 100)
- ;
-
- d.Dispose();
- end.WaitOne();
-
- Assert.IsTrue(e.Take(100).SequenceEqual(lst.Take(100)));
- }
-
- [TestMethod]
- public void EnumerableToObservable_LongRunning_Error()
- {
- var start = default(ManualResetEvent);
- var end = default(ManualResetEvent);
- var scheduler = new TestLongRunningScheduler(x => start = x, x => end = x);
-
- var ex = new Exception();
- var e = EnumerableToObservable_Error_Core(ex);
-
- var results = e.ToObservable(scheduler);
-
- var lst = new List<int>();
- var err = default(Exception);
- results.Subscribe(lst.Add, ex_ => err = ex_);
-
- start.WaitOne();
- end.WaitOne();
-
- Assert.IsTrue(new[] { 1, 2 }.SequenceEqual(lst));
- Assert.AreSame(ex, err);
- }
-#endif
-
- static IEnumerable<int> EnumerableToObservable_Error_Core(Exception ex)
- {
- yield return 1;
- yield return 2;
- throw ex;
- }
-
- [TestMethod]
- public void EnumerableToObservable_GetEnumeratorThrows()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = new RogueEnumerable<int>(ex);
-
- var res = scheduler.Start(() =>
- xs.ToObservable(scheduler)
- );
-
- res.Messages.AssertEqual(
- OnError<int>(200, ex)
- );
- }
-
- #endregion
-
- #region |> Helpers <|
-
- IEnumerable<int> Enumerable_Finite()
- {
- yield return 1;
- yield return 2;
- yield return 3;
- yield return 4;
- yield return 5;
- yield break;
- }
-
- IEnumerable<int> Enumerable_Infinite()
- {
- while (true)
- yield return 1;
- }
-
- IEnumerable<int> Enumerable_Error(Exception exception)
- {
- yield return 1;
- yield return 2;
- yield return 3;
- throw exception;
- }
-
- #endregion
- }
-}
diff --git a/Rx.NET/Tests.System.Reactive/Tests/ObservableCreationTest.cs b/Rx.NET/Tests.System.Reactive/Tests/ObservableCreationTest.cs
deleted file mode 100644
index e9f31ab..0000000
--- a/Rx.NET/Tests.System.Reactive/Tests/ObservableCreationTest.cs
+++ /dev/null
@@ -1,2553 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Diagnostics;
-using System.Linq;
-using System.Reactive;
-using System.Reactive.Concurrency;
-using System.Reactive.Disposables;
-using System.Reactive.Linq;
-using System.Reflection;
-using System.Threading;
-using Microsoft.Reactive.Testing;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using ReactiveTests.Dummies;
-
-#if !NO_TPL
-using System.Threading.Tasks;
-#endif
-
-namespace ReactiveTests.Tests
-{
- [TestClass]
- public partial class ObservableTest : ReactiveTest
- {
- #region - Create -
-
- [TestMethod]
- public void Create_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Create<int>(default(Func<IObserver<int>, Action>)));
-
- //
- // BREAKING CHANGE v2.0 > v1.x - Returning null from Subscribe means "nothing to do upon unsubscription"
- // all null-coalesces to Disposable.Empty.
- //
- //ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Create<int>(o => default(Action)).Subscribe(DummyObserver<int>.Instance));
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Create<int>(o => () => { }).Subscribe(null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Create<int>(o =>
- {
- o.OnError(null);
- return () => { };
- }).Subscribe(null));
- }
-
- [TestMethod]
- public void Create_NullCoalescingAction()
- {
- var xs = Observable.Create<int>(o =>
- {
- o.OnNext(42);
- return default(Action);
- });
-
- var lst = new List<int>();
- var d = xs.Subscribe(lst.Add);
- d.Dispose();
-
- Assert.IsTrue(lst.SequenceEqual(new[] {42}));
- }
-
- [TestMethod]
- public void Create_Next()
- {
- var scheduler = new TestScheduler();
-
- var res = scheduler.Start(() =>
- Observable.Create<int>(o =>
- {
- o.OnNext(1);
- o.OnNext(2);
- return () => { };
- })
- );
-
- res.Messages.AssertEqual(
- OnNext(200, 1),
- OnNext(200, 2)
- );
- }
-
- [TestMethod]
- public void Create_Completed()
- {
- var scheduler = new TestScheduler();
-
- var res = scheduler.Start(() =>
- Observable.Create<int>(o =>
- {
- o.OnCompleted();
- o.OnNext(100);
- o.OnError(new Exception());
- o.OnCompleted();
- return () => { };
- })
- );
-
- res.Messages.AssertEqual(
- OnCompleted<int>(200)
- );
- }
-
- [TestMethod]
- public void Create_Error()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var res = scheduler.Start(() =>
- Observable.Create<int>(o =>
- {
- o.OnError(ex);
- o.OnNext(100);
- o.OnError(new Exception());
- o.OnCompleted();
- return () => { };
- })
- );
-
- res.Messages.AssertEqual(
- OnError<int>(200, ex)
- );
- }
-
- [TestMethod]
- public void Create_Exception()
- {
- ReactiveAssert.Throws<InvalidOperationException>(() =>
- Observable.Create<int>(new Func<IObserver<int>, Action>(o => { throw new InvalidOperationException(); })).Subscribe());
- }
-
- [TestMethod]
- public void Create_Dispose()
- {
- var scheduler = new TestScheduler();
-
- var res = scheduler.Start(() =>
- Observable.Create<int>(o =>
- {
- var stopped = false;
-
- o.OnNext(1);
- o.OnNext(2);
- scheduler.Schedule(TimeSpan.FromTicks(600), () =>
- {
- if (!stopped)
- o.OnNext(3);
- });
- scheduler.Schedule(TimeSpan.FromTicks(700), () =>
- {
- if (!stopped)
- o.OnNext(4);
- });
- scheduler.Schedule(TimeSpan.FromTicks(900), () =>
- {
- if (!stopped)
- o.OnNext(5);
- });
- scheduler.Schedule(TimeSpan.FromTicks(1100), () =>
- {
- if (!stopped)
- o.OnNext(6);
- });
-
- return () => { stopped = true; };
- })
- );
-
- res.Messages.AssertEqual(
- OnNext(200, 1),
- OnNext(200, 2),
- OnNext(800, 3),
- OnNext(900, 4)
- );
- }
-
- [TestMethod]
- public void Create_ObserverThrows()
- {
- ReactiveAssert.Throws<InvalidOperationException>(() =>
- Observable.Create<int>(o =>
- {
- o.OnNext(1);
- return () => { };
- }).Subscribe(x => { throw new InvalidOperationException(); }));
- ReactiveAssert.Throws<InvalidOperationException>(() =>
- Observable.Create<int>(o =>
- {
- o.OnError(new Exception());
- return () => { };
- }).Subscribe(x => { }, ex => { throw new InvalidOperationException(); }));
- ReactiveAssert.Throws<InvalidOperationException>(() =>
- Observable.Create<int>(o =>
- {
- o.OnCompleted();
- return () => { };
- }).Subscribe(x => { }, ex => { }, () => { throw new InvalidOperationException(); }));
- }
-
- [TestMethod]
- public void CreateWithDisposable_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Create<int>(default(Func<IObserver<int>, IDisposable>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Create<int>(o => DummyDisposable.Instance).Subscribe(null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Create<int>(o =>
- {
- o.OnError(null);
- return DummyDisposable.Instance;
- }).Subscribe(null));
- }
-
- [TestMethod]
- public void CreateWithDisposable_NullCoalescingAction()
- {
- var xs = Observable.Create<int>(o =>
- {
- o.OnNext(42);
- return default(IDisposable);
- });
-
- var lst = new List<int>();
- var d = xs.Subscribe(lst.Add);
- d.Dispose();
-
- Assert.IsTrue(lst.SequenceEqual(new[] { 42 }));
- }
-
- [TestMethod]
- public void CreateWithDisposable_Next()
- {
- var scheduler = new TestScheduler();
-
- var res = scheduler.Start(() =>
- Observable.Create<int>(o =>
- {
- o.OnNext(1);
- o.OnNext(2);
- return Disposable.Empty;
- })
- );
-
- res.Messages.AssertEqual(
- OnNext(200, 1),
- OnNext(200, 2)
- );
- }
-
- [TestMethod]
- public void CreateWithDisposable_Completed()
- {
- var scheduler = new TestScheduler();
-
- var res = scheduler.Start(() =>
- Observable.Create<int>(o =>
- {
- o.OnCompleted();
- o.OnNext(100);
- o.OnError(new Exception());
- o.OnCompleted();
- return Disposable.Empty;
- })
- );
-
- res.Messages.AssertEqual(
- OnCompleted<int>(200)
- );
- }
-
- [TestMethod]
- public void CreateWithDisposable_Error()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var res = scheduler.Start(() =>
- Observable.Create<int>(o =>
- {
- o.OnError(ex);
- o.OnNext(100);
- o.OnError(new Exception());
- o.OnCompleted();
- return Disposable.Empty;
- })
- );
-
- res.Messages.AssertEqual(
- OnError<int>(200, ex)
- );
- }
-
- [TestMethod]
- public void CreateWithDisposable_Exception()
- {
- ReactiveAssert.Throws<InvalidOperationException>(() =>
- Observable.Create<int>(new Func<IObserver<int>, IDisposable>(o => { throw new InvalidOperationException(); })).Subscribe());
- }
-
- [TestMethod]
- public void CreateWithDisposable_Dispose()
- {
- var scheduler = new TestScheduler();
-
- var res = scheduler.Start(() =>
- Observable.Create<int>(o =>
- {
- var d = new BooleanDisposable();
-
- o.OnNext(1);
- o.OnNext(2);
- scheduler.Schedule(TimeSpan.FromTicks(600), () =>
- {
- if (!d.IsDisposed)
- o.OnNext(3);
- });
- scheduler.Schedule(TimeSpan.FromTicks(700), () =>
- {
- if (!d.IsDisposed)
- o.OnNext(4);
- });
- scheduler.Schedule(TimeSpan.FromTicks(900), () =>
- {
- if (!d.IsDisposed)
- o.OnNext(5);
- });
- scheduler.Schedule(TimeSpan.FromTicks(1100), () =>
- {
- if (!d.IsDisposed)
- o.OnNext(6);
- });
-
- return d;
- })
- );
-
- res.Messages.AssertEqual(
- OnNext(200, 1),
- OnNext(200, 2),
- OnNext(800, 3),
- OnNext(900, 4)
- );
- }
-
- [TestMethod]
- public void CreateWithDisposable_ObserverThrows()
- {
- ReactiveAssert.Throws<InvalidOperationException>(() =>
- Observable.Create<int>(o =>
- {
- o.OnNext(1);
- return Disposable.Empty;
- }).Subscribe(x => { throw new InvalidOperationException(); }));
- ReactiveAssert.Throws<InvalidOperationException>(() =>
- Observable.Create<int>(o =>
- {
- o.OnError(new Exception());
- return Disposable.Empty;
- }).Subscribe(x => { }, ex => { throw new InvalidOperationException(); }));
- ReactiveAssert.Throws<InvalidOperationException>(() =>
- Observable.Create<int>(o =>
- {
- o.OnCompleted();
- return Disposable.Empty;
- }).Subscribe(x => { }, ex => { }, () => { throw new InvalidOperationException(); }));
- }
-
- #endregion
-
- #region - CreateAsync -
-
-#if !NO_TPL
-
- [TestMethod]
- public void CreateAsync_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Create<int>(default(Func<IObserver<int>, Task>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Create<int>(default(Func<IObserver<int>, CancellationToken, Task>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Create<int>(default(Func<IObserver<int>, Task<IDisposable>>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Create<int>(default(Func<IObserver<int>, CancellationToken, Task<IDisposable>>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Create<int>(default(Func<IObserver<int>, Task<Action>>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Create<int>(default(Func<IObserver<int>, CancellationToken, Task<Action>>)));
- }
-
- [TestMethod]
- public void CreateAsync_NullCoalescingAction1()
- {
- var xs = Observable.Create<int>(o =>
- {
- o.OnNext(42);
- return Task.Factory.StartNew(() => default(Action));
- });
-
- var lst = new List<int>();
- var d = xs.Subscribe(lst.Add);
- d.Dispose();
-
- Assert.IsTrue(lst.SequenceEqual(new[] { 42 }));
- }
-
- [TestMethod]
- public void CreateAsync_NullCoalescingAction2()
- {
- var xs = Observable.Create<int>((o, ct) =>
- {
- o.OnNext(42);
- return Task.Factory.StartNew(() => default(Action));
- });
-
- var lst = new List<int>();
- var d = xs.Subscribe(lst.Add);
- d.Dispose();
-
- Assert.IsTrue(lst.SequenceEqual(new[] { 42 }));
- }
-
- [TestMethod]
- public void CreateAsync_NullCoalescingDisposable1()
- {
- var xs = Observable.Create<int>(o =>
- {
- o.OnNext(42);
- return Task.Factory.StartNew(() => default(IDisposable));
- });
-
- var lst = new List<int>();
- var d = xs.Subscribe(lst.Add);
- d.Dispose();
-
- Assert.IsTrue(lst.SequenceEqual(new[] { 42 }));
- }
-
- [TestMethod]
- public void CreateAsync_NullCoalescingDisposable2()
- {
- var xs = Observable.Create<int>((o, ct) =>
- {
- o.OnNext(42);
- return Task.Factory.StartNew(() => default(IDisposable));
- });
-
- var lst = new List<int>();
- var d = xs.Subscribe(lst.Add);
- d.Dispose();
-
- Assert.IsTrue(lst.SequenceEqual(new[] { 42 }));
- }
-
- Task Producer1(IObserver<int> results, CancellationToken token, IScheduler scheduler)
- {
- var tcs = new TaskCompletionSource<object>();
-
- var x = 0;
-
- var d = scheduler.Schedule(TimeSpan.FromTicks(100), self =>
- {
- results.OnNext(++x);
- self(TimeSpan.FromTicks(100));
- });
-
- token.Register(d.Dispose);
-
- return tcs.Task;
- }
-
- [TestMethod]
- public void CreateAsync_Never()
- {
- RunSynchronously(() =>
- {
- var scheduler = new TestScheduler();
-
- var res = scheduler.Start(() =>
- Observable.Create<int>((observer, token) => Producer1(observer, token, scheduler))
- );
-
- res.Messages.AssertEqual(
- OnNext(300, 1),
- OnNext(400, 2),
- OnNext(500, 3),
- OnNext(600, 4),
- OnNext(700, 5),
- OnNext(800, 6),
- OnNext(900, 7)
- );
- });
- }
-
- Task Producer2(IObserver<int> results, CancellationToken token, IScheduler scheduler)
- {
- var tcs = new TaskCompletionSource<object>();
-
- var x = 0;
-
- var d = scheduler.Schedule(TimeSpan.FromTicks(100), self =>
- {
- if (x == 4)
- {
- tcs.SetResult(null);
- }
- results.OnNext(++x);
- self(TimeSpan.FromTicks(100));
- });
-
- token.Register(d.Dispose);
-
- return tcs.Task;
- }
-
- [TestMethod]
- public void CreateAsync_Completed1()
- {
- RunSynchronously(() =>
- {
- var scheduler = new TestScheduler();
-
- var res = scheduler.Start(() =>
- Observable.Create<int>((observer, token) => Producer2(observer, token, scheduler))
- );
-
- res.Messages.AssertEqual(
- OnNext(300, 1),
- OnNext(400, 2),
- OnNext(500, 3),
- OnNext(600, 4),
- OnCompleted<int>(700)
- );
- });
- }
-
- Task Producer3(IObserver<int> results, CancellationToken token, IScheduler scheduler)
- {
- var tcs = new TaskCompletionSource<object>();
-
- var x = 0;
-
- var d = scheduler.Schedule(TimeSpan.FromTicks(100), self =>
- {
- if (x == 4)
- {
- results.OnCompleted();
- }
- results.OnNext(++x);
- self(TimeSpan.FromTicks(100));
- });
-
- token.Register(d.Dispose);
-
- return tcs.Task;
- }
-
- [TestMethod]
- public void CreateAsync_Completed2()
- {
- RunSynchronously(() =>
- {
- var scheduler = new TestScheduler();
-
- var res = scheduler.Start(() =>
- Observable.Create<int>((observer, token) => Producer3(observer, token, scheduler))
- );
-
- res.Messages.AssertEqual(
- OnNext(300, 1),
- OnNext(400, 2),
- OnNext(500, 3),
- OnNext(600, 4),
- OnCompleted<int>(700)
- );
- });
- }
-
- Task Producer4(IObserver<int> results, CancellationToken token, IScheduler scheduler, Exception exception)
- {
- var tcs = new TaskCompletionSource<object>();
-
- var x = 0;
-
- var d = scheduler.Schedule(TimeSpan.FromTicks(100), self =>
- {
- if (x == 4)
- {
- results.OnError(exception);
- }
- results.OnNext(++x);
- self(TimeSpan.FromTicks(100));
- });
-
- token.Register(d.Dispose);
-
- return tcs.Task;
- }
-
- [TestMethod]
- public void CreateAsync_Error1()
- {
- RunSynchronously(() =>
- {
- var scheduler = new TestScheduler();
-
- var exception = new Exception();
-
- var res = scheduler.Start(() =>
- Observable.Create<int>((observer, token) => Producer4(observer, token, scheduler, exception))
- );
-
- res.Messages.AssertEqual(
- OnNext(300, 1),
- OnNext(400, 2),
- OnNext(500, 3),
- OnNext(600, 4),
- OnError<int>(700, exception)
- );
- });
- }
-
- Task Producer5(IObserver<int> results, CancellationToken token, IScheduler scheduler, Exception exception)
- {
- var tcs = new TaskCompletionSource<object>();
-
- var x = 0;
-
- var d = scheduler.Schedule(TimeSpan.FromTicks(100), self =>
- {
- if (x == 4)
- {
- tcs.SetException(exception);
- }
- results.OnNext(++x);
- self(TimeSpan.FromTicks(100));
- });
-
- token.Register(d.Dispose);
-
- return tcs.Task;
- }
-
- [TestMethod]
- public void CreateAsync_Error2()
- {
- RunSynchronously(() =>
- {
- var scheduler = new TestScheduler();
-
- var exception = new Exception();
-
- var res = scheduler.Start(() =>
- Observable.Create<int>((observer, token) => Producer5(observer, token, scheduler, exception))
- );
-
- res.Messages.AssertEqual(
- OnNext(300, 1),
- OnNext(400, 2),
- OnNext(500, 3),
- OnNext(600, 4),
- OnError<int>(700, exception)
- );
- });
- }
-
-
- Task Producer6(IObserver<int> results, CancellationToken token, Exception exception)
- {
- throw exception;
- }
-
- [TestMethod]
- public void CreateAsync_Error3()
- {
- RunSynchronously(() =>
- {
- var scheduler = new TestScheduler();
-
- var exception = new InvalidOperationException();
-
- var res = scheduler.Start(() =>
- Observable.Create<int>((observer, token) => Producer6(observer, token, exception))
- );
-
- res.Messages.AssertEqual(
- OnError<int>(200, exception)
- );
- });
- }
-
- Task Producer7(IObserver<int> results, CancellationToken token, IScheduler scheduler)
- {
- var tcs = new TaskCompletionSource<object>();
-
- var x = 0;
-
- var d = scheduler.Schedule(TimeSpan.FromTicks(100), self =>
- {
- if (x == 4)
- {
- tcs.SetResult(null);
- }
- results.OnNext(++x);
- self(TimeSpan.FromTicks(100));
- });
-
- token.Register(d.Dispose);
-
- return tcs.Task;
- }
-
- [TestMethod]
- public void CreateAsync_Cancel1()
- {
- RunSynchronously(() =>
- {
- var scheduler = new TestScheduler();
-
- var res = scheduler.Start(() =>
- Observable.Create<int>((observer, token) => Producer7(observer, token, scheduler)),
- 650
- );
-
- res.Messages.AssertEqual(
- OnNext(300, 1),
- OnNext(400, 2),
- OnNext(500, 3),
- OnNext(600, 4)
- );
- });
- }
-
- Task Producer8(IObserver<int> results, CancellationToken token, IScheduler scheduler)
- {
- var tcs = new TaskCompletionSource<object>();
-
- var x = 0;
-
- var d = scheduler.Schedule(TimeSpan.FromTicks(100), self =>
- {
- if (x == 4)
- {
- results.OnCompleted();
- }
- results.OnNext(++x);
- self(TimeSpan.FromTicks(100));
- });
-
- token.Register(d.Dispose);
-
- return tcs.Task;
- }
-
- [TestMethod]
- public void CreateAsync_Cancel2()
- {
- RunSynchronously(() =>
- {
- var scheduler = new TestScheduler();
-
- var res = scheduler.Start(() =>
- Observable.Create<int>((observer, token) => Producer8(observer, token, scheduler)),
- 650
- );
-
- res.Messages.AssertEqual(
- OnNext(300, 1),
- OnNext(400, 2),
- OnNext(500, 3),
- OnNext(600, 4)
- );
- });
- }
-
- Task Producer9(IObserver<int> results, CancellationToken token, IScheduler scheduler)
- {
- var tcs = new TaskCompletionSource<object>();
-
- var x = 0;
-
- var d = scheduler.Schedule(TimeSpan.FromTicks(100), self =>
- {
- if (x == 4)
- {
- results.OnCompleted();
- }
- results.OnNext(++x);
- self(TimeSpan.FromTicks(100));
- });
-
- token.Register(d.Dispose);
-
- return tcs.Task;
- }
-
- [TestMethod]
- public void CreateAsync_Cancel3()
- {
- RunSynchronously(() =>
- {
- var scheduler = new TestScheduler();
-
- var res = scheduler.Start(() =>
- Observable.Create<int>((observer, token) => Producer9(observer, token, scheduler)),
- 750
- );
-
- res.Messages.AssertEqual(
- OnNext(300, 1),
- OnNext(400, 2),
- OnNext(500, 3),
- OnNext(600, 4),
- OnCompleted<int>(700)
- );
- });
- }
-
- Task Producer10(IObserver<int> results, CancellationToken token, IScheduler scheduler)
- {
- var tcs = new TaskCompletionSource<object>();
-
- var x = 0;
-
- var d = scheduler.Schedule(TimeSpan.FromTicks(100), self =>
- {
- if (x == 4)
- {
- tcs.SetCanceled();
- }
- results.OnNext(++x);
- self(TimeSpan.FromTicks(100));
- });
-
- token.Register(d.Dispose);
-
- return tcs.Task;
- }
-
- [TestMethod]
- public void CreateAsync_Cancel4()
- {
- RunSynchronously(() =>
- {
- var scheduler = new TestScheduler();
-
- var res = scheduler.Start(() =>
- Observable.Create<int>((observer, token) => Producer10(observer, token, scheduler))
- );
-
- res.Messages.Take(4).AssertEqual(
- OnNext(300, 1),
- OnNext(400, 2),
- OnNext(500, 3),
- OnNext(600, 4)
- );
-
- Assert.AreEqual(5, res.Messages.Count);
-
- Assert.AreEqual(700, res.Messages[4].Time);
- Assert.AreEqual(NotificationKind.OnError, res.Messages[4].Value.Kind);
- Assert.IsTrue(res.Messages[4].Value.Exception is OperationCanceledException);
- });
- }
-
- void RunSynchronously(Action action)
- {
- var t = new Task(action);
- t.RunSynchronously(new SynchronousScheduler());
- t.Wait();
- }
-
- class SynchronousScheduler : TaskScheduler
- {
- protected override IEnumerable<Task> GetScheduledTasks()
- {
- throw new NotImplementedException();
- }
-
- protected override void QueueTask(Task task)
- {
- TryExecuteTask(task);
- }
-
- protected override bool TryExecuteTaskInline(Task task, bool taskWasPreviouslyQueued)
- {
- return TryExecuteTask(task);
- }
- }
-
- [TestMethod]
- public void CreateAsync_Task_Simple()
- {
- var xs = Observable.Create<int>(observer =>
- {
- return Task.Factory.StartNew(() =>
- {
- observer.OnNext(42);
- observer.OnCompleted();
- });
- });
-
- var lst = new List<int>();
- xs.ForEach(lst.Add);
-
- Assert.IsTrue(new[] { 42 }.SequenceEqual(lst));
- }
-
- [TestMethod]
- public void CreateAsync_Task_Token()
- {
- var e = new ManualResetEvent(false);
-
- var xs = Observable.Create<int>((observer, ct) =>
- {
- return Task.Factory.StartNew(() =>
- {
- var i = 0;
-
- while (!ct.IsCancellationRequested)
- {
- if (i++ == 10)
- e.Set();
-
- observer.OnNext(42);
- }
- });
- });
-
- var lst = new List<int>();
- var d = xs.Subscribe(lst.Add);
-
- e.WaitOne();
- d.Dispose();
-
- Assert.IsTrue(lst.Take(10).SequenceEqual(Enumerable.Repeat(42, 10)));
- }
-
- [TestMethod]
- public void CreateAsync_IDisposable_Simple()
- {
- var stopped = new ManualResetEvent(false);
- var s = Disposable.Create(() => stopped.Set());
-
- var xs = Observable.Create<int>(observer =>
- {
- return Task.Factory.StartNew(() =>
- {
- observer.OnNext(42);
- observer.OnCompleted();
-
- return s;
- });
- });
-
- var lst = new List<int>();
- xs.ForEach(lst.Add);
-
- stopped.WaitOne();
-
- Assert.IsTrue(new[] { 42 }.SequenceEqual(lst));
- }
-
- [TestMethod]
- public void CreateAsync_IDisposable_Token()
- {
- var stopped = new ManualResetEvent(false);
- var s = Disposable.Create(() => stopped.Set());
-
- var e = new ManualResetEvent(false);
-
- var xs = Observable.Create<int>((observer, ct) =>
- {
- return Task.Factory.StartNew(() =>
- {
- var i = 0;
-
- while (!ct.IsCancellationRequested)
- {
- if (i++ == 10)
- e.Set();
-
- observer.OnNext(42);
- }
-
- return s;
- });
- });
-
- var lst = new List<int>();
- var d = xs.Subscribe(lst.Add);
-
- e.WaitOne();
- d.Dispose();
- stopped.WaitOne();
-
- Assert.IsTrue(lst.Take(10).SequenceEqual(Enumerable.Repeat(42, 10)));
- }
-
- [TestMethod]
- public void CreateAsync_Action_Simple()
- {
- var stopped = new ManualResetEvent(false);
- var s = new Action(() => stopped.Set());
-
- var xs = Observable.Create<int>(observer =>
- {
- return Task.Factory.StartNew(() =>
- {
- observer.OnNext(42);
- observer.OnCompleted();
-
- return s;
- });
- });
-
- var lst = new List<int>();
- xs.ForEach(lst.Add);
-
- stopped.WaitOne();
-
- Assert.IsTrue(new[] { 42 }.SequenceEqual(lst));
- }
-
- [TestMethod]
- public void CreateAsync_Action_Token()
- {
- var stopped = new ManualResetEvent(false);
- var s = new Action(() => stopped.Set());
-
- var e = new ManualResetEvent(false);
-
- var xs = Observable.Create<int>((observer, ct) =>
- {
- return Task.Factory.StartNew(() =>
- {
- var i = 0;
-
- while (!ct.IsCancellationRequested)
- {
- if (i++ == 10)
- e.Set();
-
- observer.OnNext(42);
- }
-
- return s;
- });
- });
-
- var lst = new List<int>();
- var d = xs.Subscribe(lst.Add);
-
- e.WaitOne();
- d.Dispose();
- stopped.WaitOne();
-
- Assert.IsTrue(lst.Take(10).SequenceEqual(Enumerable.Repeat(42, 10)));
- }
-
-#endif
-
- #endregion
-
- #region + Defer +
-
- [TestMethod]
- public void Defer_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Defer<int>(default(Func<IObservable<int>>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Defer(() => DummyObservable<int>.Instance).Subscribe(null));
- ReactiveAssert.Throws</*some*/Exception>(() => Observable.Defer<int>(() => default(IObservable<int>)).Subscribe());
- }
-
- [TestMethod]
- public void Defer_Complete()
- {
- var scheduler = new TestScheduler();
-
- var invoked = 0;
- var xs = default(ITestableObservable<long>);
-
- var res = scheduler.Start(() =>
- Observable.Defer(() =>
- {
- invoked++;
- xs = scheduler.CreateColdObservable(
- OnNext<long>(100, scheduler.Clock),
- OnCompleted<long>(200));
- return xs;
- })
- );
-
- res.Messages.AssertEqual(
- OnNext(300, 200L),
- OnCompleted<long>(400)
- );
-
- Assert.AreEqual(1, invoked);
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 400)
- );
- }
-
- [TestMethod]
- public void Defer_Error()
- {
- var scheduler = new TestScheduler();
-
- var invoked = 0;
- var xs = default(ITestableObservable<long>);
- var ex = new Exception();
-
- var res = scheduler.Start(() =>
- Observable.Defer(() =>
- {
- invoked++;
- xs = scheduler.CreateColdObservable(
- OnNext<long>(100, scheduler.Clock),
- OnError<long>(200, ex));
- return xs;
- })
- );
-
- res.Messages.AssertEqual(
- OnNext(300, 200L),
- OnError<long>(400, ex)
- );
-
- Assert.AreEqual(1, invoked);
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 400)
- );
- }
-
- [TestMethod]
- public void Defer_Dispose()
- {
- var scheduler = new TestScheduler();
-
- var invoked = 0;
- var xs = default(ITestableObservable<long>);
-
- var res = scheduler.Start(() =>
- Observable.Defer(() =>
- {
- invoked++;
- xs = scheduler.CreateColdObservable(
- OnNext<long>(100, scheduler.Clock),
- OnNext<long>(200, invoked),
- OnNext<long>(1100, 1000));
- return xs;
- })
- );
-
- res.Messages.AssertEqual(
- OnNext(300, 200L),
- OnNext(400, 1L)
- );
-
- Assert.AreEqual(1, invoked);
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
- }
-
- [TestMethod]
- public void Defer_Throw()
- {
- var scheduler = new TestScheduler();
-
- var invoked = 0;
- var ex = new Exception();
-
- var res = scheduler.Start(() =>
- Observable.Defer<int>(new Func<IObservable<int>>(() =>
- {
- invoked++;
- throw ex;
- }))
- );
-
- res.Messages.AssertEqual(
- OnError<int>(200, ex)
- );
-
- Assert.AreEqual(1, invoked);
- }
-
- #endregion
-
- #region - DeferAsync -
-
-#if !NO_TPL
-
- [TestMethod]
- public void DeferAsync_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Defer(default(Func<Task<IObservable<int>>>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.DeferAsync(default(Func<CancellationToken, Task<IObservable<int>>>)));
- }
-
- [TestMethod]
- public void DeferAsync_Simple()
- {
- var xs = Observable.Defer<int>(() => Task.Factory.StartNew(() => Observable.Return(42)));
-
- var res = xs.ToEnumerable().ToList();
-
- Assert.IsTrue(new[] { 42 }.SequenceEqual(res));
- }
-
- [TestMethod]
- public void DeferAsync_WithCancel_Simple()
- {
- var xs = Observable.DeferAsync<int>(ct => Task.Factory.StartNew(() => Observable.Return(42)));
-
- var res = xs.ToEnumerable().ToList();
-
- Assert.IsTrue(new[] { 42 }.SequenceEqual(res));
- }
-
- [TestMethod]
- public void DeferAsync_WithCancel_Cancel()
- {
- var N = 10;// 0000;
- for (int i = 0; i < N; i++)
- {
- var e = new ManualResetEvent(false);
- var called = false;
-
- var xs = Observable.DeferAsync<int>(ct => Task.Factory.StartNew(() =>
- {
- e.Set();
-
- while (!ct.IsCancellationRequested)
- ;
-
- return Observable.Defer(() => { called = true; return Observable.Return(42); });
- }));
-
- var d = xs.Subscribe(_ => { });
-
- e.WaitOne();
- d.Dispose();
-
- Assert.IsFalse(called);
- }
- }
-
-#endif
-
- #endregion
-
- #region + Empty +
-
- [TestMethod]
- public void Empty_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Empty<int>(null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Empty<int>(null, 42));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Empty<int>(DummyScheduler.Instance).Subscribe(null));
- }
-
- [TestMethod]
- public void Empty_Basic()
- {
- var scheduler = new TestScheduler();
-
- var res = scheduler.Start(() =>
- Observable.Empty<int>(scheduler)
- );
-
- res.Messages.AssertEqual(
- OnCompleted<int>(201)
- );
- }
-
- [TestMethod]
- public void Empty_Disposed()
- {
- var scheduler = new TestScheduler();
-
- var res = scheduler.Start(() =>
- Observable.Empty<int>(scheduler),
- 200
- );
-
- res.Messages.AssertEqual(
- );
- }
-
- [TestMethod]
- public void Empty_ObserverThrows()
- {
- var scheduler1 = new TestScheduler();
-
- var xs = Observable.Empty<int>(scheduler1);
-
- xs.Subscribe(x => { }, exception => { }, () => { throw new InvalidOperationException(); });
-
- ReactiveAssert.Throws<InvalidOperationException>(() => scheduler1.Start());
- }
-
- [TestMethod]
- public void Empty_DefaultScheduler()
- {
- Observable.Empty<int>().AssertEqual(Observable.Empty<int>(DefaultScheduler.Instance));
- }
-
- [TestMethod]
- public void Empty_Basic_Witness()
- {
- var scheduler = new TestScheduler();
-
- var res = scheduler.Start(() =>
- Observable.Empty<int>(scheduler, 42)
- );
-
- res.Messages.AssertEqual(
- OnCompleted<int>(201)
- );
- }
-
- #endregion
-
- #region + Generate +
-
- [TestMethod]
- public void Generate_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Generate(0, DummyFunc<int, bool>.Instance, DummyFunc<int, int>.Instance, DummyFunc<int, int>.Instance, (IScheduler)null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Generate(0, (Func<int, bool>)null, DummyFunc<int, int>.Instance, DummyFunc<int, int>.Instance, DummyScheduler.Instance));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Generate(0, DummyFunc<int, bool>.Instance, DummyFunc<int, int>.Instance, (Func<int, int>)null, DummyScheduler.Instance));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Generate(0, DummyFunc<int, bool>.Instance, (Func<int, int>)null, DummyFunc<int, int>.Instance, DummyScheduler.Instance));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Generate(0, DummyFunc<int, bool>.Instance, DummyFunc<int, int>.Instance, DummyFunc<int, int>.Instance, DummyScheduler.Instance).Subscribe(null));
- }
-
- [TestMethod]
- public void Generate_Finite()
- {
- var scheduler = new TestScheduler();
-
- var res = scheduler.Start(() =>
- Observable.Generate(0, x => x <= 3, x => x + 1, x => x, scheduler)
- );
-
- res.Messages.AssertEqual(
- OnNext(201, 0),
- OnNext(202, 1),
- OnNext(203, 2),
- OnNext(204, 3),
- OnCompleted<int>(205)
- );
- }
-
- [TestMethod]
- public void Generate_Throw_Condition()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var res = scheduler.Start(() =>
- Observable.Generate(0, new Func<int, bool>(x => { throw ex; }), x => x + 1, x => x, scheduler)
- );
-
- res.Messages.AssertEqual(
- OnError<int>(201, ex)
- );
- }
-
- [TestMethod]
- public void Generate_Throw_ResultSelector()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var res = scheduler.Start(() =>
- Observable.Generate(0, x => true, x => x + 1, new Func<int, int>(x => { throw ex; }), scheduler)
- );
-
- res.Messages.AssertEqual(
- OnError<int>(201, ex)
- );
- }
-
- [TestMethod]
- public void Generate_Throw_Iterate()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var res = scheduler.Start(() =>
- Observable.Generate(0, x => true, new Func<int, int>(x => { throw ex; }), x => x, scheduler)
- );
-
- res.Messages.AssertEqual(
- OnNext(201, 0),
- OnError<int>(202, ex)
- );
- }
-
- [TestMethod]
- public void Generate_Dispose()
- {
- var scheduler = new TestScheduler();
-
- var res = scheduler.Start(() =>
- Observable.Generate(0, x => true, x => x + 1, x => x, scheduler),
- 203
- );
-
- res.Messages.AssertEqual(
- OnNext(201, 0),
- OnNext(202, 1)
- );
- }
-
- [TestMethod]
- public void Generate_DefaultScheduler_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Generate(0, (Func<int, bool>)null, DummyFunc<int, int>.Instance, DummyFunc<int, int>.Instance));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Generate(0, DummyFunc<int, bool>.Instance, DummyFunc<int, int>.Instance, (Func<int, int>)null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Generate(0, DummyFunc<int, bool>.Instance, (Func<int, int>)null, DummyFunc<int, int>.Instance));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Generate(0, DummyFunc<int, bool>.Instance, DummyFunc<int, int>.Instance, DummyFunc<int, int>.Instance).Subscribe(null));
- }
-
- [TestMethod]
- public void Generate_DefaultScheduler()
- {
- Observable.Generate(0, x => x < 10, x => x + 1, x => x).AssertEqual(Observable.Generate(0, x => x < 10, x => x + 1, x => x, DefaultScheduler.Instance));
- }
-
-#if !NO_PERF
- [TestMethod]
- public void Generate_LongRunning1()
- {
- var start = default(ManualResetEvent);
- var end = default(ManualResetEvent);
- var s = new TestLongRunningScheduler(x => start = x, x => end = x);
-
- var xs = Observable.Generate(0, x => x < 100, x => x + 1, x => x, s);
-
- var lst = new List<int>();
- var done = false;
- xs.Subscribe(x => { lst.Add(x); }, () => done = true);
-
- end.WaitOne();
-
- Assert.IsTrue(lst.SequenceEqual(Enumerable.Range(0, 100)));
- Assert.IsTrue(done);
- }
-
- [TestMethod]
- public void Generate_LongRunning2()
- {
- var start = default(ManualResetEvent);
- var end = default(ManualResetEvent);
- var s = new TestLongRunningScheduler(x => start = x, x => end = x);
-
- var xs = Observable.Generate(0, _ => true, x => x + 1, x => x, s);
-
- var lst = new List<int>();
- var d = xs.Subscribe(x => { lst.Add(x); });
-
- start.WaitOne();
-
- while (lst.Count < 100)
- ;
-
- d.Dispose();
- end.WaitOne();
-
- Assert.IsTrue(lst.Take(100).SequenceEqual(Enumerable.Range(0, 100)));
- }
-
- [TestMethod]
- public void Generate_LongRunning_Throw()
- {
- var start = default(ManualResetEvent);
- var end = default(ManualResetEvent);
- var s = new TestLongRunningScheduler(x => start = x, x => end = x);
-
- var ex = new Exception();
- var xs = Observable.Generate(0, x => { if (x < 100) return true; throw ex; }, x => x + 1, x => x, s);
-
- var lst = new List<int>();
- var e = default(Exception);
- var done = false;
- xs.Subscribe(x => { lst.Add(x); }, e_ => e = e_, () => done = true);
-
- end.WaitOne();
-
- Assert.IsTrue(lst.SequenceEqual(Enumerable.Range(0, 100)));
- Assert.AreSame(ex, e);
- Assert.IsFalse(done);
- }
-#endif
-
- #endregion
-
- #region + Never +
-
- [TestMethod]
- public void Never_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Never<int>().Subscribe(null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Never<int>(42).Subscribe(null));
- }
-
- [TestMethod]
- public void Never_Basic()
- {
- var scheduler = new TestScheduler();
-
- var xs = Observable.Never<int>();
-
- var res = scheduler.CreateObserver<int>();
-
- xs.Subscribe(res);
-
- scheduler.Start();
-
- res.Messages.AssertEqual(
- );
- }
-
- [TestMethod]
- public void Never_Basic_Witness()
- {
- var scheduler = new TestScheduler();
-
- var xs = Observable.Never<int>(42);
-
- var res = scheduler.CreateObserver<int>();
-
- xs.Subscribe(res);
-
- scheduler.Start();
-
- res.Messages.AssertEqual(
- );
- }
-
- #endregion
-
- #region + Range +
-
- [TestMethod]
- public void Range_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Range(0, 0, null));
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => Observable.Range(0, -1, DummyScheduler.Instance));
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => Observable.Range(int.MaxValue, 2, DummyScheduler.Instance));
- }
-
- [TestMethod]
- public void Range_Zero()
- {
- var scheduler = new TestScheduler();
-
- var res = scheduler.Start(() =>
- Observable.Range(0, 0, scheduler)
- );
-
- res.Messages.AssertEqual(
- OnCompleted<int>(201)
- );
- }
-
- [TestMethod]
- public void Range_One()
- {
- var scheduler = new TestScheduler();
-
- var res = scheduler.Start(() =>
- Observable.Range(0, 1, scheduler)
- );
-
- res.Messages.AssertEqual(
- OnNext(201, 0),
- OnCompleted<int>(202)
- );
- }
-
- [TestMethod]
- public void Range_Five()
- {
- var scheduler = new TestScheduler();
-
- var res = scheduler.Start(() =>
- Observable.Range(10, 5, scheduler)
- );
-
- res.Messages.AssertEqual(
- OnNext(201, 10),
- OnNext(202, 11),
- OnNext(203, 12),
- OnNext(204, 13),
- OnNext(205, 14),
- OnCompleted<int>(206)
- );
- }
-
- [TestMethod]
- public void Range_Boundaries()
- {
- var scheduler = new TestScheduler();
-
- var res = scheduler.Start(() =>
- Observable.Range(int.MaxValue, 1, scheduler)
- );
-
- res.Messages.AssertEqual(
- OnNext(201, int.MaxValue),
- OnCompleted<int>(202)
- );
- }
-
- [TestMethod]
- public void Range_Dispose()
- {
- var scheduler = new TestScheduler();
-
- var res = scheduler.Start(() =>
- Observable.Range(-10, 5, scheduler),
- 204
- );
-
- res.Messages.AssertEqual(
- OnNext(201, -10),
- OnNext(202, -9),
- OnNext(203, -8)
- );
- }
-
- [TestMethod]
- public void Range_Default_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => Observable.Range(0, -1));
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => Observable.Range(int.MaxValue, 2));
- }
-
- [TestMethod]
- public void Range_Default()
- {
- for (int i = 0; i < 100; i++)
- Observable.Range(100, 100).AssertEqual(Observable.Range(100, 100, DefaultScheduler.Instance));
- }
-
-#if !NO_PERF
- [TestMethod]
- public void Range_LongRunning1()
- {
- var start = default(ManualResetEvent);
- var end = default(ManualResetEvent);
- var s = new TestLongRunningScheduler(x => start = x, x => end = x);
-
- var xs = Observable.Range(0, 100, s);
-
- var lst = new List<int>();
- var done = false;
- xs.Subscribe(x => { lst.Add(x); }, () => done = true);
-
- end.WaitOne();
-
- Assert.IsTrue(lst.SequenceEqual(Enumerable.Range(0, 100)));
- Assert.IsTrue(done);
- }
-
- [TestMethod]
- public void Range_LongRunning2()
- {
- var start = default(ManualResetEvent);
- var end = default(ManualResetEvent);
- var s = new TestLongRunningScheduler(x => start = x, x => end = x);
-
- var xs = Observable.Range(0, int.MaxValue, s);
-
- var lst = new List<int>();
- var d = xs.Subscribe(x => { lst.Add(x); });
-
- start.WaitOne();
-
- while (lst.Count < 100)
- ;
-
- d.Dispose();
- end.WaitOne();
-
- Assert.IsTrue(true);
- }
-
- [TestMethod]
- public void Range_LongRunning_Empty()
- {
- var start = default(ManualResetEvent);
- var end = default(ManualResetEvent);
- var scheduler = new TestLongRunningScheduler(x => start = x, x => end = x);
-
- var xs = Observable.Range(5, 0, scheduler);
-
- var lst = new List<int>();
- xs.ForEach(lst.Add);
-
- Assert.IsTrue(lst.SequenceEqual(Enumerable.Range(5, 0)));
- }
-
- [TestMethod]
- public void Range_LongRunning_Regular()
- {
- var start = default(ManualResetEvent);
- var end = default(ManualResetEvent);
- var scheduler = new TestLongRunningScheduler(x => start = x, x => end = x);
-
- var xs = Observable.Range(5, 17, scheduler);
-
- var lst = new List<int>();
- xs.ForEach(lst.Add);
-
- Assert.IsTrue(lst.SequenceEqual(Enumerable.Range(5, 17)));
- }
-
- [TestMethod]
- public void Range_LongRunning_Boundaries()
- {
- var start = default(ManualResetEvent);
- var end = default(ManualResetEvent);
- var scheduler = new TestLongRunningScheduler(x => start = x, x => end = x);
-
- var xs = Observable.Range(int.MaxValue, 1, scheduler);
-
- var lst = new List<int>();
- xs.ForEach(lst.Add);
-
- Assert.IsTrue(lst.SequenceEqual(Enumerable.Range(int.MaxValue, 1)));
- }
-#endif
-
- #endregion
-
- #region + Repeat +
-
- [TestMethod]
- public void Repeat_Value_Count_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Repeat(1, 0, default(IScheduler)));
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => Observable.Repeat(1, -1, DummyScheduler.Instance));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Repeat(1, 1, DummyScheduler.Instance).Subscribe(null));
- }
-
- [TestMethod]
- public void Repeat_Value_Count_Zero()
- {
- var scheduler = new TestScheduler();
-
- var res = scheduler.Start(() =>
- Observable.Repeat(42, 0, scheduler)
- );
-
-#if !NO_PERF
- res.Messages.AssertEqual(
- OnCompleted<int>(201)
- );
-#else
- res.Messages.AssertEqual(
- OnCompleted<int>(200)
- );
-#endif
- }
-
- [TestMethod]
- public void Repeat_Value_Count_One()
- {
- var scheduler = new TestScheduler();
-
- var res = scheduler.Start(() =>
- Observable.Repeat(42, 1, scheduler)
- );
-
- res.Messages.AssertEqual(
- OnNext(201, 42),
- OnCompleted<int>(201)
- );
- }
-
- [TestMethod]
- public void Repeat_Value_Count_Ten()
- {
- var scheduler = new TestScheduler();
-
- var res = scheduler.Start(() =>
- Observable.Repeat(42, 10, scheduler)
- );
-
- res.Messages.AssertEqual(
- OnNext(201, 42),
- OnNext(202, 42),
- OnNext(203, 42),
- OnNext(204, 42),
- OnNext(205, 42),
- OnNext(206, 42),
- OnNext(207, 42),
- OnNext(208, 42),
- OnNext(209, 42),
- OnNext(210, 42),
- OnCompleted<int>(210)
- );
- }
-
- [TestMethod]
- public void Repeat_Value_Count_Dispose()
- {
- var scheduler = new TestScheduler();
-
- var res = scheduler.Start(() =>
- Observable.Repeat(42, 10, scheduler),
- 207
- );
-
- res.Messages.AssertEqual(
- OnNext(201, 42),
- OnNext(202, 42),
- OnNext(203, 42),
- OnNext(204, 42),
- OnNext(205, 42),
- OnNext(206, 42)
- );
- }
-
- [TestMethod]
- public void Repeat_Value_Count_Default_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => Observable.Repeat(1, -1));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Repeat(1, 1).Subscribe(null));
- }
-
- [TestMethod]
- public void Repeat_Value_Count_Default()
- {
- Observable.Repeat(42, 10).AssertEqual(Observable.Repeat(42, 10, DefaultScheduler.Instance));
- }
-
- [TestMethod]
- public void Repeat_Value_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Repeat(1, (IScheduler)null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Repeat(DummyScheduler.Instance, 1).Subscribe(null));
- }
-
- [TestMethod]
- public void Repeat_Value()
- {
- var scheduler = new TestScheduler();
-
- var res = scheduler.Start(() =>
- Observable.Repeat(42, scheduler),
- 207
- );
-
- res.Messages.AssertEqual(
- OnNext(201, 42),
- OnNext(202, 42),
- OnNext(203, 42),
- OnNext(204, 42),
- OnNext(205, 42),
- OnNext(206, 42)
- );
- }
-
- [TestMethod]
- public void Repeat_Value_Default_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Repeat(1).Subscribe(null));
- }
-
- [TestMethod]
- public void Repeat_Value_Default()
- {
- Observable.Repeat(42).Take(100).AssertEqual(Observable.Repeat(42, DefaultScheduler.Instance).Take(100));
- }
-
-#if !NO_PERF
- [TestMethod]
- public void Repeat_Count_LongRunning1()
- {
- var start = default(ManualResetEvent);
- var end = default(ManualResetEvent);
- var s = new TestLongRunningScheduler(x => start = x, x => end = x);
-
- var xs = Observable.Repeat(42, 100, s);
-
- var lst = new List<int>();
- var done = false;
- xs.Subscribe(x => { lst.Add(x); }, () => done = true);
-
- end.WaitOne();
-
- Assert.IsTrue(lst.SequenceEqual(Enumerable.Repeat(42, 100)));
- Assert.IsTrue(done);
- }
-
- [TestMethod]
- public void Repeat_Count_LongRunning2()
- {
- var start = default(ManualResetEvent);
- var end = default(ManualResetEvent);
- var s = new TestLongRunningScheduler(x => start = x, x => end = x);
-
- var xs = Observable.Repeat(42, int.MaxValue, s);
-
- var lst = new List<int>();
- var d = xs.Subscribe(x => { lst.Add(x); });
-
- start.WaitOne();
-
- while (lst.Count < 100)
- ;
-
- d.Dispose();
- end.WaitOne();
-
- Assert.IsTrue(true);
- }
-
- [TestMethod]
- public void Repeat_Inf_LongRunning()
- {
- var start = default(ManualResetEvent);
- var end = default(ManualResetEvent);
- var s = new TestLongRunningScheduler(x => start = x, x => end = x);
-
- var xs = Observable.Repeat(42, s);
-
- var lst = new List<int>();
- var d = xs.Subscribe(x => { lst.Add(x); });
-
- start.WaitOne();
-
- while (lst.Count < 100)
- ;
-
- d.Dispose();
- end.WaitOne();
-
- Assert.IsTrue(true);
- }
-#endif
-
- #endregion
-
- #region + Return +
-
- [TestMethod]
- public void Return_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Return(0, null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Return(0, DummyScheduler.Instance).Subscribe(null));
- }
-
- [TestMethod]
- public void Return_Basic()
- {
- var scheduler = new TestScheduler();
-
- var res = scheduler.Start(() =>
- Observable.Return(42, scheduler)
- );
-
- res.Messages.AssertEqual(
- OnNext(201, 42),
- OnCompleted<int>(201)
- );
- }
-
- [TestMethod]
- public void Return_Disposed()
- {
- var scheduler = new TestScheduler();
-
- var res = scheduler.Start(() =>
- Observable.Return(42, scheduler),
- 200
- );
-
- res.Messages.AssertEqual(
- );
- }
-
- [TestMethod]
- public void Return_DisposedAfterNext()
- {
- var scheduler = new TestScheduler();
-
- var d = new SerialDisposable();
-
- var xs = Observable.Return(42, scheduler);
-
- var res = scheduler.CreateObserver<int>();
-
- scheduler.ScheduleAbsolute(100, () =>
- d.Disposable = xs.Subscribe(
- x =>
- {
- d.Dispose();
- res.OnNext(x);
- },
- res.OnError,
- res.OnCompleted
- )
- );
-
- scheduler.Start();
-
- res.Messages.AssertEqual(
- OnNext(101, 42)
- );
- }
-
- [TestMethod]
- public void Return_ObserverThrows()
- {
- var scheduler1 = new TestScheduler();
-
- var xs = Observable.Return(1, scheduler1);
-
- xs.Subscribe(x => { throw new InvalidOperationException(); });
-
- ReactiveAssert.Throws<InvalidOperationException>(() => scheduler1.Start());
-
- var scheduler2 = new TestScheduler();
-
- var ys = Observable.Return(1, scheduler2);
-
- ys.Subscribe(x => { }, ex => { }, () => { throw new InvalidOperationException(); });
-
- ReactiveAssert.Throws<InvalidOperationException>(() => scheduler2.Start());
- }
-
- [TestMethod]
- public void Return_DefaultScheduler()
- {
- Observable.Return(42).AssertEqual(Observable.Return(42, DefaultScheduler.Instance));
- }
-
- #endregion
-
- #region + Throw +
-
- [TestMethod]
- public void Throw_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Throw<int>(null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Throw<int>(null, 42));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Throw<int>(new Exception(), null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Throw<int>(new Exception(), null, 42));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Throw<int>(null, DummyScheduler.Instance));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Throw<int>(null, DummyScheduler.Instance, 42));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Throw<int>(new Exception(), DummyScheduler.Instance).Subscribe(null));
- }
-
- [TestMethod]
- public void Throw_Basic()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var res = scheduler.Start(() =>
- Observable.Throw<int>(ex, scheduler)
- );
-
- res.Messages.AssertEqual(
- OnError<int>(201, ex)
- );
- }
-
- [TestMethod]
- public void Throw_Disposed()
- {
- var scheduler = new TestScheduler();
-
- var res = scheduler.Start(() =>
- Observable.Throw<int>(new Exception(), scheduler),
- 200
- );
-
- res.Messages.AssertEqual(
- );
- }
-
- [TestMethod]
- public void Throw_ObserverThrows()
- {
- var scheduler1 = new TestScheduler();
-
- var xs = Observable.Throw<int>(new Exception(), scheduler1);
-
- xs.Subscribe(x => { }, ex => { throw new InvalidOperationException(); }, () => { });
-
- ReactiveAssert.Throws<InvalidOperationException>(() => scheduler1.Start());
- }
-
- [TestMethod]
- public void Throw_DefaultScheduler()
- {
- var ex = new Exception();
- Observable.Throw<int>(ex).AssertEqual(Observable.Throw<int>(ex, DefaultScheduler.Instance));
- }
-
- [TestMethod]
- public void Throw_Witness_Basic()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var res = scheduler.Start(() =>
- Observable.Throw<int>(ex, scheduler, 42)
- );
-
- res.Messages.AssertEqual(
- OnError<int>(201, ex)
- );
- }
-
- #endregion
-
- #region + Using +
-
- [TestMethod]
- public void Using_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Using((Func<IDisposable>)null, DummyFunc<IDisposable, IObservable<int>>.Instance));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Using(DummyFunc<IDisposable>.Instance, (Func<IDisposable, IObservable<int>>)null));
- ReactiveAssert.Throws</*some*/Exception>(() => Observable.Using(() => DummyDisposable.Instance, d => default(IObservable<int>)).Subscribe());
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Using(() => DummyDisposable.Instance, d => DummyObservable<int>.Instance).Subscribe(null));
- }
-
- [TestMethod]
- public void Using_Null()
- {
- var scheduler = new TestScheduler();
-
- var disposeInvoked = 0L;
- var createInvoked = 0L;
- var xs = default(ITestableObservable<long>);
- var disposable = default(MockDisposable);
- var _d = default(MockDisposable);
-
- var res = scheduler.Start(() =>
- Observable.Using(
- () =>
- {
- disposeInvoked++;
- disposable = default(MockDisposable);
- return disposable;
- },
- d =>
- {
- _d = d;
- createInvoked++;
- xs = scheduler.CreateColdObservable(
- OnNext<long>(100, scheduler.Clock),
- OnCompleted<long>(200));
- return xs;
- }
- )
- );
-
- Assert.AreSame(disposable, _d);
-
- res.Messages.AssertEqual(
- OnNext(300, 200L),
- OnCompleted<long>(400)
- );
-
- Assert.AreEqual(1, createInvoked);
- Assert.AreEqual(1, disposeInvoked);
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 400)
- );
-
- Assert.IsNull(disposable);
- }
-
- [TestMethod]
- public void Using_Complete()
- {
- var scheduler = new TestScheduler();
-
- var disposeInvoked = 0;
- var createInvoked = 0;
- var xs = default(ITestableObservable<long>);
- var disposable = default(MockDisposable);
- var _d = default(MockDisposable);
-
- var res = scheduler.Start(() =>
- Observable.Using(
- () =>
- {
- disposeInvoked++;
- disposable = new MockDisposable(scheduler);
- return disposable;
- },
- d =>
- {
- _d = d;
- createInvoked++;
- xs = scheduler.CreateColdObservable(
- OnNext<long>(100, scheduler.Clock),
- OnCompleted<long>(200));
- return xs;
- }
- )
- );
-
- Assert.AreSame(disposable, _d);
-
- res.Messages.AssertEqual(
- OnNext(300, 200L),
- OnCompleted<long>(400)
- );
-
- Assert.AreEqual(1, createInvoked);
- Assert.AreEqual(1, disposeInvoked);
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 400)
- );
-
- disposable.AssertEqual(
- 200,
- 400
- );
- }
-
- [TestMethod]
- public void Using_Error()
- {
- var scheduler = new TestScheduler();
-
- var disposeInvoked = 0;
- var createInvoked = 0;
- var xs = default(ITestableObservable<long>);
- var disposable = default(MockDisposable);
- var _d = default(MockDisposable);
- var ex = new Exception();
-
- var res = scheduler.Start(() =>
- Observable.Using(
- () =>
- {
- disposeInvoked++;
- disposable = new MockDisposable(scheduler);
- return disposable;
- },
- d =>
- {
- _d = d;
- createInvoked++;
- xs = scheduler.CreateColdObservable(
- OnNext<long>(100, scheduler.Clock),
- OnError<long>(200, ex));
- return xs;
- }
- )
- );
-
- Assert.AreSame(disposable, _d);
-
- res.Messages.AssertEqual(
- OnNext(300, 200L),
- OnError<long>(400, ex)
- );
-
- Assert.AreEqual(1, createInvoked);
- Assert.AreEqual(1, disposeInvoked);
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 400)
- );
-
- disposable.AssertEqual(
- 200,
- 400
- );
- }
-
- [TestMethod]
- public void Using_Dispose()
- {
- var scheduler = new TestScheduler();
-
- var disposeInvoked = 0;
- var createInvoked = 0;
- var xs = default(ITestableObservable<long>);
- var disposable = default(MockDisposable);
- var _d = default(MockDisposable);
-
- var res = scheduler.Start(() =>
- Observable.Using(
- () =>
- {
- disposeInvoked++;
- disposable = new MockDisposable(scheduler);
- return disposable;
- },
- d =>
- {
- _d = d;
- createInvoked++;
- xs = scheduler.CreateColdObservable(
- OnNext<long>(100, scheduler.Clock),
- OnNext<long>(1000, scheduler.Clock + 1));
- return xs;
- }
- )
- );
-
- Assert.AreSame(disposable, _d);
-
- res.Messages.AssertEqual(
- OnNext(300, 200L)
- );
-
- Assert.AreEqual(1, createInvoked);
- Assert.AreEqual(1, disposeInvoked);
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
-
- disposable.AssertEqual(
- 200,
- 1000
- );
- }
-
- [TestMethod]
- public void Using_ThrowResourceSelector()
- {
- var scheduler = new TestScheduler();
-
- var disposeInvoked = 0;
- var createInvoked = 0;
- var ex = new Exception();
-
- var res = scheduler.Start(() =>
- Observable.Using<int, IDisposable>(
- () =>
- {
- disposeInvoked++;
- throw ex;
- },
- d =>
- {
- createInvoked++;
- return Observable.Never<int>();
- }
- )
- );
-
- res.Messages.AssertEqual(
- OnError<int>(200, ex)
- );
-
- Assert.AreEqual(0, createInvoked);
- Assert.AreEqual(1, disposeInvoked);
- }
-
- [TestMethod]
- public void Using_ThrowResourceUsage()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var disposeInvoked = 0;
- var createInvoked = 0;
- var disposable = default(MockDisposable);
-
- var res = scheduler.Start(() =>
- Observable.Using<int, IDisposable>(
- () =>
- {
- disposeInvoked++;
- disposable = new MockDisposable(scheduler);
- return disposable;
- },
- d =>
- {
- createInvoked++;
- throw ex;
- }
- )
- );
-
- res.Messages.AssertEqual(
- OnError<int>(200, ex)
- );
-
- Assert.AreEqual(1, createInvoked);
- Assert.AreEqual(1, disposeInvoked);
-
- disposable.AssertEqual(
- 200,
- 200
- );
- }
-
- #endregion
-
- #region - UsingAsync -
-
-#if !NO_TPL
-
- [TestMethod]
- public void UsingAsync_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Using<int, IDisposable>(null, (res, ct) => null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Using<int, IDisposable>(ct => null, null));
- }
-
- [TestMethod]
- public void UsingAsync_Simple()
- {
- var done = false;
-
- var xs = Observable.Using<int, IDisposable>(
- ct => Task.Factory.StartNew<IDisposable>(() => Disposable.Create(() => done = true)),
- (_, ct) => Task.Factory.StartNew<IObservable<int>>(() => Observable.Return(42))
- );
-
- var res = xs.ToEnumerable().ToList();
-
- Assert.IsTrue(new[] { 42 }.SequenceEqual(res));
- Assert.IsTrue(done);
- }
-
- [TestMethod]
- public void UsingAsync_CancelResource()
- {
- var N = 10;// 0000;
- for (int i = 0; i < N; i++)
- {
- var called = false;
-
- var s = new ManualResetEvent(false);
- var e = new ManualResetEvent(false);
- var x = new ManualResetEvent(false);
-
- var xs = Observable.Using<int, IDisposable>(
- ct => Task.Factory.StartNew<IDisposable>(() =>
- {
- s.Set();
- e.WaitOne();
- while (!ct.IsCancellationRequested)
- ;
- x.Set();
- return Disposable.Empty;
- }),
- (_, ct) =>
- {
- called = true;
- return Task.Factory.StartNew<IObservable<int>>(() =>
- Observable.Return(42)
- );
- }
- );
-
- var d = xs.Subscribe(_ => { });
-
- s.WaitOne();
- d.Dispose();
-
- e.Set();
- x.WaitOne();
-
- Assert.IsFalse(called);
- }
- }
-
- [TestMethod]
- public void UsingAsync_CancelFactory()
- {
- var N = 10;// 0000;
- for (int i = 0; i < N; i++)
- {
- var gate = new object();
- var disposed = false;
- var called = false;
-
- var s = new ManualResetEvent(false);
- var e = new ManualResetEvent(false);
- var x = new ManualResetEvent(false);
-
- var xs = Observable.Using<int, IDisposable>(
- ct => Task.Factory.StartNew<IDisposable>(() =>
- Disposable.Create(() =>
- {
- lock (gate)
- disposed = true;
- })
- ),
- (_, ct) => Task.Factory.StartNew<IObservable<int>>(() =>
- {
- s.Set();
- e.WaitOne();
- while (!ct.IsCancellationRequested)
- ;
- x.Set();
- return Observable.Defer<int>(() =>
- {
- called = true;
- return Observable.Return(42);
- });
- })
- );
-
- var d = xs.Subscribe(_ => { });
-
- s.WaitOne();
-
- //
- // This will *eventually* set the CancellationToken. There's a fundamental race between observing the CancellationToken
- // and returning the IDisposable that will set the CancellationTokenSource. Notice this is reflected in the code above,
- // by looping until the CancellationToken is set.
- //
- d.Dispose();
-
- e.Set();
- x.WaitOne();
-
- while (true)
- {
- lock (gate)
- if (disposed)
- break;
- }
-
- Assert.IsFalse(called, i.ToString());
- }
- }
-
-#endif
-
- #endregion
- }
-}
diff --git a/Rx.NET/Tests.System.Reactive/Tests/ObservableEventsTest.cs b/Rx.NET/Tests.System.Reactive/Tests/ObservableEventsTest.cs
deleted file mode 100644
index 0688f87..0000000
--- a/Rx.NET/Tests.System.Reactive/Tests/ObservableEventsTest.cs
+++ /dev/null
@@ -1,1360 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Diagnostics;
-using System.Linq;
-using System.Reactive;
-using System.Reactive.Concurrency;
-using System.Reactive.Linq;
-using System.Reflection;
-using System.Threading;
-using Microsoft.Reactive.Testing;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-
-namespace ReactiveTests.Tests
-{
- [TestClass]
- public partial class ObservableEventsTest : ReactiveTest
- {
- #region + FromEventPattern +
-
- #region Strongly typed
-
- [TestMethod]
- public void FromEventPattern_Conversion_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromEventPattern(null, h => { }));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromEventPattern(h => { }, null));
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromEventPattern(null, h => { }, Scheduler.Default));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromEventPattern(h => { }, null, Scheduler.Default));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromEventPattern(h => { }, h => { }, default(IScheduler)));
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromEventPattern<EventHandler, EventArgs>(null, h => { }, h => { }));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromEventPattern<EventHandler, EventArgs>(h => new EventHandler(h), null, h => { }));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromEventPattern<EventHandler, EventArgs>(h => new EventHandler(h), h => { }, null));
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromEventPattern<EventHandler, EventArgs>(null, h => { }, h => { }, Scheduler.Default));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromEventPattern<EventHandler, EventArgs>(h => new EventHandler(h), null, h => { }, Scheduler.Default));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromEventPattern<EventHandler, EventArgs>(h => new EventHandler(h), h => { }, null, Scheduler.Default));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromEventPattern<EventHandler, EventArgs>(h => new EventHandler(h), h => { }, h => { }, default(IScheduler)));
- }
-
- [TestMethod]
- public void FromEventPattern_E2()
- {
- var scheduler = new TestScheduler();
-
- var fe = new FromEventPattern();
-
- scheduler.ScheduleAbsolute(50, () => fe.M2(1));
- scheduler.ScheduleAbsolute(150, () => fe.M2(2));
- scheduler.ScheduleAbsolute(250, () => fe.M2(3));
- scheduler.ScheduleAbsolute(350, () => fe.M2(4));
- scheduler.ScheduleAbsolute(450, () => fe.M2(5));
- scheduler.ScheduleAbsolute(1050, () => fe.M2(6));
-
- var results = scheduler.Start(() =>
- Observable.FromEventPattern<EventHandler<FromEventPattern.TestEventArgs>, FromEventPattern.TestEventArgs>(
- h => fe.E2 += h,
- h => fe.E2 -= h)
- .Select(evt => new { evt.Sender, evt.EventArgs }));
-
- results.Messages.AssertEqual(
- OnNext(250, new { Sender = (object)fe, EventArgs = new FromEventPattern.TestEventArgs { Id = 3 } }),
- OnNext(350, new { Sender = (object)fe, EventArgs = new FromEventPattern.TestEventArgs { Id = 4 } }),
- OnNext(450, new { Sender = (object)fe, EventArgs = new FromEventPattern.TestEventArgs { Id = 5 } })
- );
- }
-
- [TestMethod]
- public void FromEventPattern_Conversion_E4()
- {
- var scheduler = new TestScheduler();
-
- var fe = new FromEventPattern();
-
- scheduler.ScheduleAbsolute(50, () => fe.M4(1));
- scheduler.ScheduleAbsolute(150, () => fe.M4(2));
- scheduler.ScheduleAbsolute(250, () => fe.M4(3));
- scheduler.ScheduleAbsolute(350, () => fe.M4(4));
- scheduler.ScheduleAbsolute(450, () => fe.M4(5));
- scheduler.ScheduleAbsolute(1050, () => fe.M4(6));
-
- var results = scheduler.Start(() =>
- Observable.FromEventPattern<Action<int>, FromEventPattern.TestEventArgs>(
- h => new Action<int>(x => h(fe, new FromEventPattern.TestEventArgs { Id = x })),
- h => fe.E4 += h,
- h => fe.E4 -= h)
- .Select(evt => new { evt.Sender, evt.EventArgs }));
-
- results.Messages.AssertEqual(
- OnNext(250, new { Sender = (object)fe, EventArgs = new FromEventPattern.TestEventArgs { Id = 3 } }),
- OnNext(350, new { Sender = (object)fe, EventArgs = new FromEventPattern.TestEventArgs { Id = 4 } }),
- OnNext(450, new { Sender = (object)fe, EventArgs = new FromEventPattern.TestEventArgs { Id = 5 } })
- );
- }
-
- [TestMethod]
- public void FromEventPattern_Conversion_E5()
- {
- var scheduler = new TestScheduler();
-
- var fe = new FromEventPattern();
-
- scheduler.ScheduleAbsolute(50, () => fe.M5(1));
- scheduler.ScheduleAbsolute(150, () => fe.M5(2));
- scheduler.ScheduleAbsolute(250, () => fe.M5(3));
- scheduler.ScheduleAbsolute(350, () => fe.M5(4));
- scheduler.ScheduleAbsolute(450, () => fe.M5(5));
- scheduler.ScheduleAbsolute(1050, () => fe.M5(6));
-
- var results = scheduler.Start(() =>
- Observable.FromEventPattern(
- h => fe.E5 += h,
- h => fe.E5 -= h)
- .Select(evt => new { evt.Sender, EventArgs = (FromEventPattern.TestEventArgs)evt.EventArgs }));
-
- results.Messages.AssertEqual(
- OnNext(250, new { Sender = (object)fe, EventArgs = new FromEventPattern.TestEventArgs { Id = 3 } }),
- OnNext(350, new { Sender = (object)fe, EventArgs = new FromEventPattern.TestEventArgs { Id = 4 } }),
- OnNext(450, new { Sender = (object)fe, EventArgs = new FromEventPattern.TestEventArgs { Id = 5 } })
- );
- }
-
- [TestMethod]
- public void FromEventPattern_ConversionThrows()
- {
- var ex = new Exception();
-
- var fe = new FromEventPattern();
-
- var res =
- Observable.FromEventPattern<Action<int>, FromEventPattern.TestEventArgs>(
- h => { throw ex; },
- h => fe.E4 += h,
- h => fe.E4 -= h
- );
-
- var err = default(Exception);
- res.Subscribe(_ => { Assert.Fail(); }, ex_ => err = ex_, () => { Assert.Fail(); });
-
- Assert.AreSame(ex, err);
- }
-
- [TestMethod]
- public void FromEventPattern_E2_WithSender()
- {
- var scheduler = new TestScheduler();
-
- var fe = new FromEventPattern();
-
- scheduler.ScheduleAbsolute(50, () => fe.M2(1));
- scheduler.ScheduleAbsolute(150, () => fe.M2(2));
- scheduler.ScheduleAbsolute(250, () => fe.M2(3));
- scheduler.ScheduleAbsolute(350, () => fe.M2(4));
- scheduler.ScheduleAbsolute(450, () => fe.M2(5));
- scheduler.ScheduleAbsolute(1050, () => fe.M2(6));
-
- var results = scheduler.Start(() =>
- Observable.FromEventPattern<EventHandler<FromEventPattern.TestEventArgs>, object, FromEventPattern.TestEventArgs>(
- h => fe.E2 += h,
- h => fe.E2 -= h)
- .Select(evt => new { evt.Sender, evt.EventArgs }));
-
- results.Messages.AssertEqual(
- OnNext(250, new { Sender = (object)fe, EventArgs = new FromEventPattern.TestEventArgs { Id = 3 } }),
- OnNext(350, new { Sender = (object)fe, EventArgs = new FromEventPattern.TestEventArgs { Id = 4 } }),
- OnNext(450, new { Sender = (object)fe, EventArgs = new FromEventPattern.TestEventArgs { Id = 5 } })
- );
- }
-
- [TestMethod]
- public void FromEventPattern_AddRemove_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromEventPattern<EventArgs>(null, h => { }));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromEventPattern<EventArgs>(h => { }, null));
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromEventPattern<EventHandler, EventArgs>(null, h => { }));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromEventPattern<EventHandler, EventArgs>(h => { }, null));
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromEventPattern<EventHandler, object, EventArgs>(null, h => { }));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromEventPattern<EventHandler, object, EventArgs>(h => { }, null));
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromEventPattern<EventArgs>(null, h => { }, Scheduler.Default));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromEventPattern<EventArgs>(h => { }, null, Scheduler.Default));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromEventPattern<EventArgs>(h => { }, h => { }, default(IScheduler)));
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromEventPattern<EventHandler, EventArgs>(null, h => { }, Scheduler.Default));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromEventPattern<EventHandler, EventArgs>(h => { }, null, Scheduler.Default));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromEventPattern<EventHandler, EventArgs>(h => { }, h => { }, default(IScheduler)));
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromEventPattern<EventHandler, object, EventArgs>(null, h => { }, Scheduler.Default));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromEventPattern<EventHandler, object, EventArgs>(h => { }, null, Scheduler.Default));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromEventPattern<EventHandler, object, EventArgs>(h => { }, h => { }, default(IScheduler)));
- }
-
- [TestMethod]
- public void FromEventPattern_AddRemove_E4()
- {
- var scheduler = new TestScheduler();
-
- var fe = new FromEventPattern();
-
- scheduler.ScheduleAbsolute(50, () => fe.M2(1));
- scheduler.ScheduleAbsolute(150, () => fe.M2(2));
- scheduler.ScheduleAbsolute(250, () => fe.M2(3));
- scheduler.ScheduleAbsolute(350, () => fe.M2(4));
- scheduler.ScheduleAbsolute(450, () => fe.M2(5));
- scheduler.ScheduleAbsolute(1050, () => fe.M2(6));
-
- var results = scheduler.Start(() =>
- Observable.FromEventPattern<FromEventPattern.TestEventArgs>(
- h => fe.E2 += h,
- h => fe.E2 -= h)
- .Select(evt => new { evt.Sender, evt.EventArgs }));
-
- results.Messages.AssertEqual(
- OnNext(250, new { Sender = (object)fe, EventArgs = new FromEventPattern.TestEventArgs { Id = 3 } }),
- OnNext(350, new { Sender = (object)fe, EventArgs = new FromEventPattern.TestEventArgs { Id = 4 } }),
- OnNext(450, new { Sender = (object)fe, EventArgs = new FromEventPattern.TestEventArgs { Id = 5 } })
- );
- }
-
- #endregion
-
- #region Reflection
-
- #region Instance events
-
- [TestMethod]
- public void FromEventPattern_Reflection_Instance_ArgumentChecking()
- {
- ReactiveAssert.Throws</**/ArgumentNullException>(() => Observable.FromEventPattern(default(object), "foo"));
- ReactiveAssert.Throws</**/ArgumentNullException>(() => Observable.FromEventPattern(new FromEventPattern_ArgCheck(), null));
- ReactiveAssert.Throws</**/ArgumentNullException>(() => Observable.FromEventPattern(default(object), "foo", Scheduler.Default));
- ReactiveAssert.Throws</**/ArgumentNullException>(() => Observable.FromEventPattern(new FromEventPattern_ArgCheck(), null, Scheduler.Default));
- ReactiveAssert.Throws</**/ArgumentNullException>(() => Observable.FromEventPattern(new FromEventPattern_ArgCheck(), "foo", default(IScheduler)));
- ReactiveAssert.Throws<InvalidOperationException>(() => Observable.FromEventPattern(new FromEventPattern_ArgCheck(), "E1"));
-#if !NO_EVENTARGS_CONSTRAINT
- ReactiveAssert.Throws<InvalidOperationException>(() => Observable.FromEventPattern(new FromEventPattern_ArgCheck(), "E2"));
- ReactiveAssert.Throws<InvalidOperationException>(() => Observable.FromEventPattern(new FromEventPattern_ArgCheck(), "E3"));
- ReactiveAssert.Throws<InvalidOperationException>(() => Observable.FromEventPattern(new FromEventPattern_ArgCheck(), "E4"));
-#endif
- ReactiveAssert.Throws<InvalidOperationException>(() => Observable.FromEventPattern(new FromEventPattern_ArgCheck(), "E5"));
- ReactiveAssert.Throws<InvalidOperationException>(() => Observable.FromEventPattern(new FromEventPattern_ArgCheck(), "E6"));
- ReactiveAssert.Throws<InvalidOperationException>(() => Observable.FromEventPattern(new FromEventPattern_ArgCheck(), "foo"));
-
- ReactiveAssert.Throws</**/ArgumentNullException>(() => Observable.FromEventPattern<EventArgs>(default(object), "foo"));
- ReactiveAssert.Throws</**/ArgumentNullException>(() => Observable.FromEventPattern<EventArgs>(new FromEventPattern_ArgCheck(), null));
- ReactiveAssert.Throws</**/ArgumentNullException>(() => Observable.FromEventPattern<EventArgs>(default(object), "foo", Scheduler.Default));
- ReactiveAssert.Throws</**/ArgumentNullException>(() => Observable.FromEventPattern<EventArgs>(new FromEventPattern_ArgCheck(), null, Scheduler.Default));
- ReactiveAssert.Throws</**/ArgumentNullException>(() => Observable.FromEventPattern<EventArgs>(new FromEventPattern_ArgCheck(), "foo", default(IScheduler)));
- ReactiveAssert.Throws<InvalidOperationException>(() => Observable.FromEventPattern<EventArgs>(new FromEventPattern_ArgCheck(), "E1"));
- ReactiveAssert.Throws<InvalidOperationException>(() => Observable.FromEventPattern<EventArgs>(new FromEventPattern_ArgCheck(), "E2"));
- ReactiveAssert.Throws<InvalidOperationException>(() => Observable.FromEventPattern<EventArgs>(new FromEventPattern_ArgCheck(), "E3"));
- ReactiveAssert.Throws<InvalidOperationException>(() => Observable.FromEventPattern<EventArgs>(new FromEventPattern_ArgCheck(), "E4"));
- ReactiveAssert.Throws<InvalidOperationException>(() => Observable.FromEventPattern<EventArgs>(new FromEventPattern_ArgCheck(), "E5"));
- ReactiveAssert.Throws<InvalidOperationException>(() => Observable.FromEventPattern<EventArgs>(new FromEventPattern_ArgCheck(), "E6"));
- ReactiveAssert.Throws<InvalidOperationException>(() => Observable.FromEventPattern<EventArgs>(new FromEventPattern_ArgCheck(), "foo"));
-
- ReactiveAssert.Throws</**/ArgumentNullException>(() => Observable.FromEventPattern<FromEventPattern_ArgCheck, EventArgs>(default(object), "foo"));
- ReactiveAssert.Throws</**/ArgumentNullException>(() => Observable.FromEventPattern<FromEventPattern_ArgCheck, EventArgs>(new FromEventPattern_ArgCheck(), null));
- ReactiveAssert.Throws</**/ArgumentNullException>(() => Observable.FromEventPattern<FromEventPattern_ArgCheck, EventArgs>(default(object), "foo", Scheduler.Default));
- ReactiveAssert.Throws</**/ArgumentNullException>(() => Observable.FromEventPattern<FromEventPattern_ArgCheck, EventArgs>(new FromEventPattern_ArgCheck(), null, Scheduler.Default));
- ReactiveAssert.Throws</**/ArgumentNullException>(() => Observable.FromEventPattern<FromEventPattern_ArgCheck, EventArgs>(new FromEventPattern_ArgCheck(), "foo", default(IScheduler)));
- ReactiveAssert.Throws<InvalidOperationException>(() => Observable.FromEventPattern<FromEventPattern_ArgCheck, EventArgs>(new FromEventPattern_ArgCheck(), "E1"));
- ReactiveAssert.Throws<InvalidOperationException>(() => Observable.FromEventPattern<FromEventPattern_ArgCheck, EventArgs>(new FromEventPattern_ArgCheck(), "E2"));
- ReactiveAssert.Throws<InvalidOperationException>(() => Observable.FromEventPattern<FromEventPattern_ArgCheck, EventArgs>(new FromEventPattern_ArgCheck(), "E3"));
- ReactiveAssert.Throws<InvalidOperationException>(() => Observable.FromEventPattern<FromEventPattern_ArgCheck, EventArgs>(new FromEventPattern_ArgCheck(), "E4"));
- ReactiveAssert.Throws<InvalidOperationException>(() => Observable.FromEventPattern<FromEventPattern_ArgCheck, EventArgs>(new FromEventPattern_ArgCheck(), "E5"));
- ReactiveAssert.Throws<InvalidOperationException>(() => Observable.FromEventPattern<FromEventPattern_ArgCheck, EventArgs>(new FromEventPattern_ArgCheck(), "E6"));
- ReactiveAssert.Throws<InvalidOperationException>(() => Observable.FromEventPattern<FromEventPattern_ArgCheck, EventArgs>(new FromEventPattern_ArgCheck(), "foo"));
- }
-
- [TestMethod]
- public void FromEventPattern_Reflection_Instance_InvalidVariance()
- {
- ReactiveAssert.Throws<InvalidOperationException>(() => Observable.FromEventPattern<CancelEventArgs>(new FromEventPattern_VarianceCheck(), "E1"));
- }
-
- [TestMethod]
- public void FromEventPattern_Reflection_Instance_VarianceArgs()
- {
- var src = new FromEventPattern_VarianceCheck();
-
- var es = Observable.FromEventPattern<EventArgs>(src, "E2");
-
- var e1 = new CancelEventArgs();
- var e2 = new CancelEventArgs();
-
- var lst = new List<EventPattern<EventArgs>>();
- using (es.Subscribe(e => lst.Add(e)))
- {
- src.OnE2(e1);
- src.OnE2(e2);
- }
-
- src.OnE2(new CancelEventArgs());
-
- Assert.IsTrue(lst.Count == 2, "Count");
- Assert.AreSame(e1, lst[0].EventArgs, "First");
- Assert.AreSame(e2, lst[1].EventArgs, "Second");
- }
-
- [TestMethod]
- public void FromEventPattern_Reflection_Instance_VarianceSender()
- {
- var src = new FromEventPattern_VarianceCheck();
-
- var es = Observable.FromEventPattern<EventArgs>(src, "E3");
-
- var s1 = "Hello";
- var s2 = "World";
-
- var lst = new List<EventPattern<EventArgs>>();
- using (es.Subscribe(e => lst.Add(e)))
- {
- src.OnE3(s1);
- src.OnE3(s2);
- }
-
- src.OnE3("Fail!");
-
- Assert.IsTrue(lst.Count == 2, "Count");
- Assert.AreSame(s1, lst[0].Sender, "First");
- Assert.AreSame(s2, lst[1].Sender, "Second");
- }
-
- [TestMethod]
- public void FromEventPattern_Reflection_Instance_NonGeneric()
- {
- var src = new FromEventPattern_VarianceCheck();
-
- var es = Observable.FromEventPattern(src, "E2");
-
- var e1 = new CancelEventArgs();
- var e2 = new CancelEventArgs();
-
-#if !NO_EVENTARGS_CONSTRAINT
- var lst = new List<EventPattern<EventArgs>>();
-#else
- var lst = new List<EventPattern<object>>();
-#endif
- using (es.Subscribe(e => lst.Add(e)))
- {
- src.OnE2(e1);
- src.OnE2(e2);
- }
-
- src.OnE2(new CancelEventArgs());
-
- Assert.IsTrue(lst.Count == 2, "Count");
- Assert.AreSame(e1, lst[0].EventArgs, "First");
- Assert.AreSame(e2, lst[1].EventArgs, "Second");
- }
-
- [TestMethod]
- public void FromEventPattern_Reflection_Instance_Throws()
- {
- //
- // BREAKING CHANGE v2.0 > v1.x - We no longer throw the exception synchronously as part of
- // the Subscribe, so it comes out through OnError now. Also,
- // we now unwrap TargetInvocationException objects.
- //
- var exAdd = default(Exception);
- var xs = Observable.FromEventPattern<FromEventPattern.TestEventArgs>(new FromEventPattern(), "AddThrows");
- xs.Subscribe(_ => { Assert.Fail(); }, ex => exAdd = ex, () => { Assert.Fail(); });
- Assert.IsTrue(exAdd is InvalidOperationException);
-
- //
- // Notice the exception propgation behavior is asymmetric by design. Below, the Dispose
- // call will throw synchronously, merely because we happen to use FromEventPattern from a
- // thread with no SynchronizationContext, causing the Immediate scheduler to be used.
- //
- // See AddHandler in FromEvent.cs for more information on the design rationale of the
- // asymmetry you see here.
- //
- var exRem = default(Exception);
- var ys = Observable.FromEventPattern<FromEventPattern.TestEventArgs>(new FromEventPattern(), "RemoveThrows");
- var d = ys.Subscribe(_ => { Assert.Fail(); }, ex => exRem = ex, () => { Assert.Fail(); });
- ReactiveAssert.Throws<InvalidOperationException>(d.Dispose);
- }
-
- [TestMethod]
- public void FromEventPattern_Reflection_Instance_E1()
- {
- var scheduler = new TestScheduler();
-
- var fe = new FromEventPattern();
-
- scheduler.ScheduleAbsolute(50, () => fe.M1(1));
- scheduler.ScheduleAbsolute(150, () => fe.M1(2));
- scheduler.ScheduleAbsolute(250, () => fe.M1(3));
- scheduler.ScheduleAbsolute(350, () => fe.M1(4));
- scheduler.ScheduleAbsolute(450, () => fe.M1(5));
- scheduler.ScheduleAbsolute(1050, () => fe.M1(6));
-
- var results = scheduler.Start(() =>
- Observable.FromEventPattern<FromEventPattern.TestEventArgs>(fe, "E1").Select(evt => new { Sender = (object)evt.Sender, EventArgs = (object)evt.EventArgs })
- );
-
- results.Messages.AssertEqual(
- OnNext(250, new { Sender = (object)fe, EventArgs = (object)new FromEventPattern.TestEventArgs { Id = 3 } }),
- OnNext(350, new { Sender = (object)fe, EventArgs = (object)new FromEventPattern.TestEventArgs { Id = 4 } }),
- OnNext(450, new { Sender = (object)fe, EventArgs = (object)new FromEventPattern.TestEventArgs { Id = 5 } })
- );
- }
-
- [TestMethod]
- public void FromEventPattern_Reflection_Instance_E2()
- {
- var scheduler = new TestScheduler();
-
- var fe = new FromEventPattern();
-
- scheduler.ScheduleAbsolute(50, () => fe.M2(1));
- scheduler.ScheduleAbsolute(150, () => fe.M2(2));
- scheduler.ScheduleAbsolute(250, () => fe.M2(3));
- scheduler.ScheduleAbsolute(350, () => fe.M2(4));
- scheduler.ScheduleAbsolute(450, () => fe.M2(5));
- scheduler.ScheduleAbsolute(1050, () => fe.M2(6));
-
- var results = scheduler.Start(() =>
- Observable.FromEventPattern<FromEventPattern.TestEventArgs>(fe, "E2").Select(evt => new { Sender = (object)evt.Sender, EventArgs = (object)evt.EventArgs })
- );
-
- results.Messages.AssertEqual(
- OnNext(250, new { Sender = (object)fe, EventArgs = (object)new FromEventPattern.TestEventArgs { Id = 3 } }),
- OnNext(350, new { Sender = (object)fe, EventArgs = (object)new FromEventPattern.TestEventArgs { Id = 4 } }),
- OnNext(450, new { Sender = (object)fe, EventArgs = (object)new FromEventPattern.TestEventArgs { Id = 5 } })
- );
- }
-
- [TestMethod]
- public void FromEventPattern_Reflection_Instance_E2_WithSender()
- {
- var scheduler = new TestScheduler();
-
- var fe = new FromEventPattern();
-
- scheduler.ScheduleAbsolute(50, () => fe.M2(1));
- scheduler.ScheduleAbsolute(150, () => fe.M2(2));
- scheduler.ScheduleAbsolute(250, () => fe.M2(3));
- scheduler.ScheduleAbsolute(350, () => fe.M2(4));
- scheduler.ScheduleAbsolute(450, () => fe.M2(5));
- scheduler.ScheduleAbsolute(1050, () => fe.M2(6));
-
- var results = scheduler.Start(() =>
- Observable.FromEventPattern<object, FromEventPattern.TestEventArgs>(fe, "E2").Select(evt => new { Sender = (object)evt.Sender, EventArgs = (object)evt.EventArgs })
- );
-
- results.Messages.AssertEqual(
- OnNext(250, new { Sender = (object)fe, EventArgs = (object)new FromEventPattern.TestEventArgs { Id = 3 } }),
- OnNext(350, new { Sender = (object)fe, EventArgs = (object)new FromEventPattern.TestEventArgs { Id = 4 } }),
- OnNext(450, new { Sender = (object)fe, EventArgs = (object)new FromEventPattern.TestEventArgs { Id = 5 } })
- );
- }
-
- [TestMethod]
- public void FromEventPattern_Reflection_Instance_E3()
- {
- var scheduler = new TestScheduler();
-
- var fe = new FromEventPattern();
-
- scheduler.ScheduleAbsolute(50, () => fe.M3(1));
- scheduler.ScheduleAbsolute(150, () => fe.M3(2));
- scheduler.ScheduleAbsolute(250, () => fe.M3(3));
- scheduler.ScheduleAbsolute(350, () => fe.M3(4));
- scheduler.ScheduleAbsolute(450, () => fe.M3(5));
- scheduler.ScheduleAbsolute(1050, () => fe.M3(6));
-
- var results = scheduler.Start(() =>
- Observable.FromEventPattern<FromEventPattern.TestEventArgs>(fe, "E3").Select(evt => new { Sender = (object)evt.Sender, EventArgs = (object)evt.EventArgs })
- );
-
- results.Messages.AssertEqual(
- OnNext(250, new { Sender = (object)fe, EventArgs = (object)new FromEventPattern.TestEventArgs { Id = 3 } }),
- OnNext(350, new { Sender = (object)fe, EventArgs = (object)new FromEventPattern.TestEventArgs { Id = 4 } }),
- OnNext(450, new { Sender = (object)fe, EventArgs = (object)new FromEventPattern.TestEventArgs { Id = 5 } })
- );
- }
-
-#if DESKTOPCLR
- [TestMethod]
- public void FromEventPattern_Reflection_Instance_MissingAccessors()
- {
- var asm = AppDomain.CurrentDomain.DefineDynamicAssembly(new AssemblyName("EventsTest"), System.Reflection.Emit.AssemblyBuilderAccess.RunAndSave);
- var mod = asm.DefineDynamicModule("Events");
- var tpe = mod.DefineType("FromEvent");
-
- var ev1 = tpe.DefineEvent("Bar", (EventAttributes)MethodAttributes.Public, typeof(Action));
- var add = tpe.DefineMethod("add_Bar", MethodAttributes.Public, CallingConventions.Standard, typeof(void), new Type[0]);
- var ge1 = add.GetILGenerator();
- ge1.Emit(System.Reflection.Emit.OpCodes.Ret);
- ev1.SetAddOnMethod(add);
-
- var ev2 = tpe.DefineEvent("Foo", (EventAttributes)MethodAttributes.Public, typeof(Action));
- var rem = tpe.DefineMethod("remove_Foo", MethodAttributes.Public, CallingConventions.Standard, typeof(void), new Type[0]);
- var ge2 = rem.GetILGenerator();
- ge2.Emit(System.Reflection.Emit.OpCodes.Ret);
- ev2.SetRemoveOnMethod(rem);
-
- var evt = tpe.DefineEvent("Evt", (EventAttributes)MethodAttributes.Public, typeof(Action));
- evt.SetAddOnMethod(add);
- evt.SetRemoveOnMethod(rem);
-
- var res = tpe.CreateType();
- var obj = Activator.CreateInstance(res);
-
- ReactiveAssert.Throws<InvalidOperationException>(() => Observable.FromEventPattern<EventArgs>(obj, "Bar"));
- ReactiveAssert.Throws<InvalidOperationException>(() => Observable.FromEventPattern<EventArgs>(obj, "Foo"));
- ReactiveAssert.Throws<InvalidOperationException>(() => Observable.FromEventPattern<EventArgs>(obj, "Evt"));
- }
-#endif
-
- #endregion
-
- #region Static events
-
- [TestMethod]
- public void FromEventPattern_Reflection_Static_ArgumentChecking()
- {
- ReactiveAssert.Throws</**/ArgumentNullException>(() => Observable.FromEventPattern(default(Type), "foo"));
- ReactiveAssert.Throws</**/ArgumentNullException>(() => Observable.FromEventPattern(typeof(FromEventPattern_ArgCheck), null));
- ReactiveAssert.Throws</**/ArgumentNullException>(() => Observable.FromEventPattern(default(Type), "foo", Scheduler.Default));
- ReactiveAssert.Throws</**/ArgumentNullException>(() => Observable.FromEventPattern(typeof(FromEventPattern_ArgCheck), null, Scheduler.Default));
- ReactiveAssert.Throws</**/ArgumentNullException>(() => Observable.FromEventPattern(typeof(FromEventPattern_ArgCheck), "foo", default(IScheduler)));
- ReactiveAssert.Throws<InvalidOperationException>(() => Observable.FromEventPattern(typeof(FromEventPattern_ArgCheck), "foo"));
-
- ReactiveAssert.Throws</**/ArgumentNullException>(() => Observable.FromEventPattern<EventArgs>(default(Type), "foo"));
- ReactiveAssert.Throws</**/ArgumentNullException>(() => Observable.FromEventPattern<EventArgs>(typeof(FromEventPattern_ArgCheck), null));
- ReactiveAssert.Throws</**/ArgumentNullException>(() => Observable.FromEventPattern<EventArgs>(default(Type), "foo", Scheduler.Default));
- ReactiveAssert.Throws</**/ArgumentNullException>(() => Observable.FromEventPattern<EventArgs>(typeof(FromEventPattern_ArgCheck), null, Scheduler.Default));
- ReactiveAssert.Throws</**/ArgumentNullException>(() => Observable.FromEventPattern<EventArgs>(typeof(FromEventPattern_ArgCheck), "foo", default(IScheduler)));
- ReactiveAssert.Throws<InvalidOperationException>(() => Observable.FromEventPattern<EventArgs>(typeof(FromEventPattern_ArgCheck), "foo"));
-
- ReactiveAssert.Throws</**/ArgumentNullException>(() => Observable.FromEventPattern<object, EventArgs>(default(Type), "foo"));
- ReactiveAssert.Throws</**/ArgumentNullException>(() => Observable.FromEventPattern<object, EventArgs>(typeof(FromEventPattern_ArgCheck), null));
- ReactiveAssert.Throws</**/ArgumentNullException>(() => Observable.FromEventPattern<object, EventArgs>(default(Type), "foo", Scheduler.Default));
- ReactiveAssert.Throws</**/ArgumentNullException>(() => Observable.FromEventPattern<object, EventArgs>(typeof(FromEventPattern_ArgCheck), null, Scheduler.Default));
- ReactiveAssert.Throws</**/ArgumentNullException>(() => Observable.FromEventPattern<object, EventArgs>(typeof(FromEventPattern_ArgCheck), "foo", default(IScheduler)));
- ReactiveAssert.Throws<InvalidOperationException>(() => Observable.FromEventPattern<object, EventArgs>(typeof(FromEventPattern_ArgCheck), "foo"));
- }
-
- [TestMethod]
- public void FromEventPattern_Reflection_Static_E6()
- {
- var scheduler = new TestScheduler();
-
- scheduler.ScheduleAbsolute(50, () => FromEventPattern.M6(1));
- scheduler.ScheduleAbsolute(150, () => FromEventPattern.M6(2));
- scheduler.ScheduleAbsolute(250, () => FromEventPattern.M6(3));
- scheduler.ScheduleAbsolute(350, () => FromEventPattern.M6(4));
- scheduler.ScheduleAbsolute(450, () => FromEventPattern.M6(5));
- scheduler.ScheduleAbsolute(1050, () => FromEventPattern.M6(6));
-
- var results = scheduler.Start(() =>
- Observable.FromEventPattern<FromEventPattern.TestEventArgs>(typeof(FromEventPattern), "E6").Select(evt => new { Sender = (object)evt.Sender, EventArgs = (object)evt.EventArgs })
- );
-
- results.Messages.AssertEqual(
- OnNext(250, new { Sender = default(object), EventArgs = (object)new FromEventPattern.TestEventArgs { Id = 3 } }),
- OnNext(350, new { Sender = default(object), EventArgs = (object)new FromEventPattern.TestEventArgs { Id = 4 } }),
- OnNext(450, new { Sender = default(object), EventArgs = (object)new FromEventPattern.TestEventArgs { Id = 5 } })
- );
- }
-
- [TestMethod]
- public void FromEventPattern_Reflection_Static_E6_WithSender()
- {
- var scheduler = new TestScheduler();
-
- scheduler.ScheduleAbsolute(50, () => FromEventPattern.M6(1));
- scheduler.ScheduleAbsolute(150, () => FromEventPattern.M6(2));
- scheduler.ScheduleAbsolute(250, () => FromEventPattern.M6(3));
- scheduler.ScheduleAbsolute(350, () => FromEventPattern.M6(4));
- scheduler.ScheduleAbsolute(450, () => FromEventPattern.M6(5));
- scheduler.ScheduleAbsolute(1050, () => FromEventPattern.M6(6));
-
- var results = scheduler.Start(() =>
- Observable.FromEventPattern<object, FromEventPattern.TestEventArgs>(typeof(FromEventPattern), "E6").Select(evt => new { Sender = (object)evt.Sender, EventArgs = (object)evt.EventArgs })
- );
-
- results.Messages.AssertEqual(
- OnNext(250, new { Sender = default(object), EventArgs = (object)new FromEventPattern.TestEventArgs { Id = 3 } }),
- OnNext(350, new { Sender = default(object), EventArgs = (object)new FromEventPattern.TestEventArgs { Id = 4 } }),
- OnNext(450, new { Sender = default(object), EventArgs = (object)new FromEventPattern.TestEventArgs { Id = 5 } })
- );
- }
-
- [TestMethod]
- public void FromEventPattern_Reflection_Static_NonGeneric_E6()
- {
- var scheduler = new TestScheduler();
-
- scheduler.ScheduleAbsolute(50, () => FromEventPattern.M6(1));
- scheduler.ScheduleAbsolute(150, () => FromEventPattern.M6(2));
- scheduler.ScheduleAbsolute(250, () => FromEventPattern.M6(3));
- scheduler.ScheduleAbsolute(350, () => FromEventPattern.M6(4));
- scheduler.ScheduleAbsolute(450, () => FromEventPattern.M6(5));
- scheduler.ScheduleAbsolute(1050, () => FromEventPattern.M6(6));
-
- var results = scheduler.Start(() =>
- Observable.FromEventPattern(typeof(FromEventPattern), "E6").Select(evt => new { Sender = (object)evt.Sender, EventArgs = (object)evt.EventArgs })
- );
-
- results.Messages.AssertEqual(
- OnNext(250, new { Sender = default(object), EventArgs = (object)new FromEventPattern.TestEventArgs { Id = 3 } }),
- OnNext(350, new { Sender = default(object), EventArgs = (object)new FromEventPattern.TestEventArgs { Id = 4 } }),
- OnNext(450, new { Sender = default(object), EventArgs = (object)new FromEventPattern.TestEventArgs { Id = 5 } })
- );
- }
-
- #endregion
-
- #endregion
-
- #endregion
-
- #region + FromEvent +
-
- [TestMethod]
- public void FromEvent_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromEvent<Action<int>, int>(default(Func<Action<int>, Action<int>>), h => { }, h => { }));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromEvent<Action<int>, int>(h => h, default(Action<Action<int>>), h => { }));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromEvent<Action<int>, int>(h => h, h => { }, default(Action<Action<int>>)));
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromEvent<Action<int>, int>(default(Action<Action<int>>), h => { }));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromEvent<Action<int>, int>(h => { }, default(Action<Action<int>>)));
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromEvent<int>(default(Action<Action<int>>), h => { }));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromEvent<int>(h => { }, default(Action<Action<int>>)));
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromEvent(default(Action<Action>), h => { }));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromEvent(h => { }, default(Action<Action>)));
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromEvent<Action<int>, int>(default(Func<Action<int>, Action<int>>), h => { }, h => { }, Scheduler.Default));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromEvent<Action<int>, int>(h => h, default(Action<Action<int>>), h => { }, Scheduler.Default));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromEvent<Action<int>, int>(h => h, h => { }, default(Action<Action<int>>), Scheduler.Default));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromEvent<Action<int>, int>(h => h, h => { }, h => { }, default(IScheduler)));
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromEvent<Action<int>, int>(default(Action<Action<int>>), h => { }, Scheduler.Default));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromEvent<Action<int>, int>(h => { }, default(Action<Action<int>>), Scheduler.Default));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromEvent<Action<int>, int>(h => { }, h => { }, default(IScheduler)));
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromEvent<int>(default(Action<Action<int>>), h => { }, Scheduler.Default));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromEvent<int>(h => { }, default(Action<Action<int>>), Scheduler.Default));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromEvent<int>(h => { }, h => { }, default(IScheduler)));
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromEvent(default(Action<Action>), h => { }, Scheduler.Default));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromEvent(h => { }, default(Action<Action>), Scheduler.Default));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromEvent(h => { }, h => { }, default(IScheduler)));
- }
-
- [TestMethod]
- public void FromEvent_Action()
- {
- var fe = new FromEvent();
-
- var xs = Observable.FromEvent(h => fe.A += h, h => fe.A -= h);
-
- fe.OnA();
-
- var n = 0;
- var d = xs.Subscribe(_ => n++);
-
- fe.OnA();
- fe.OnA();
-
- d.Dispose();
-
- fe.OnA();
-
- Assert.AreEqual(2, n);
- }
-
- [TestMethod]
- public void FromEvent_ActionOfInt()
- {
- var fe = new FromEvent();
-
- var xs = Observable.FromEvent<int>(h => fe.B += h, h => fe.B -= h);
-
- fe.OnB(1);
-
- var n = 0;
- var d = xs.Subscribe(x => n += x);
-
- fe.OnB(2);
- fe.OnB(3);
-
- d.Dispose();
-
- fe.OnB(4);
-
- Assert.AreEqual(2 + 3, n);
- }
-
- [TestMethod]
- public void FromEvent_ActionOfInt_SpecifiedExplicitly()
- {
- var fe = new FromEvent();
-
- var xs = Observable.FromEvent<Action<int>, int>(h => fe.B += h, h => fe.B -= h);
-
- fe.OnB(1);
-
- var n = 0;
- var d = xs.Subscribe(x => n += x);
-
- fe.OnB(2);
- fe.OnB(3);
-
- d.Dispose();
-
- fe.OnB(4);
-
- Assert.AreEqual(2 + 3, n);
- }
-
- [TestMethod]
- public void FromEvent_ActionOfInt_SpecifiedExplicitly_TrivialConversion()
- {
- var fe = new FromEvent();
-
- var xs = Observable.FromEvent<Action<int>, int>(h => h, h => fe.B += h, h => fe.B -= h);
-
- fe.OnB(1);
-
- var n = 0;
- var d = xs.Subscribe(x => n += x);
-
- fe.OnB(2);
- fe.OnB(3);
-
- d.Dispose();
-
- fe.OnB(4);
-
- Assert.AreEqual(2 + 3, n);
- }
-
- [TestMethod]
- public void FromEvent_MyAction()
- {
- var fe = new FromEvent();
-
- var xs = Observable.FromEvent<MyAction, int>(h => new MyAction(h), h => fe.C += h, h => fe.C -= h);
-
- fe.OnC(1);
-
- var n = 0;
- var d = xs.Subscribe(x => n += x);
-
- fe.OnC(2);
- fe.OnC(3);
-
- d.Dispose();
-
- fe.OnC(4);
-
- Assert.AreEqual(2 + 3, n);
- }
-
- #endregion
-
- #region Rx v2.0 behavior
-
- [TestMethod]
- public void FromEvent_ImplicitPublish()
- {
- var src = new MyEventSource();
-
- var addCount = 0;
- var remCount = 0;
-
- var xs = Observable.FromEventPattern<MyEventArgs>(h => { addCount++; src.Bar += h; }, h => { src.Bar -= h; remCount++; }, Scheduler.Immediate);
-
- Assert.AreEqual(0, addCount);
- Assert.AreEqual(0, remCount);
-
- src.OnBar(41);
-
- var fst = new List<int>();
- var d1 = xs.Subscribe(e => fst.Add(e.EventArgs.Value));
-
- Assert.AreEqual(1, addCount);
- Assert.AreEqual(0, remCount);
-
- src.OnBar(42);
-
- Assert.IsTrue(fst.SequenceEqual(new[] { 42 }));
-
- d1.Dispose();
-
- Assert.AreEqual(1, addCount);
- Assert.AreEqual(1, remCount);
-
- var snd = new List<int>();
- var d2 = xs.Subscribe(e => snd.Add(e.EventArgs.Value));
-
- Assert.AreEqual(2, addCount);
- Assert.AreEqual(1, remCount);
-
- src.OnBar(43);
-
- Assert.IsTrue(fst.SequenceEqual(new[] { 42 }));
- Assert.IsTrue(snd.SequenceEqual(new[] { 43 }));
-
- var thd = new List<int>();
- var d3 = xs.Subscribe(e => thd.Add(e.EventArgs.Value));
-
- Assert.AreEqual(2, addCount);
- Assert.AreEqual(1, remCount);
-
- src.OnBar(44);
-
- Assert.IsTrue(fst.SequenceEqual(new[] { 42 }));
- Assert.IsTrue(snd.SequenceEqual(new[] { 43, 44 }));
- Assert.IsTrue(thd.SequenceEqual(new[] { 44 }));
-
- d2.Dispose();
-
- Assert.AreEqual(2, addCount);
- Assert.AreEqual(1, remCount);
-
- src.OnBar(45);
-
- Assert.IsTrue(fst.SequenceEqual(new[] { 42 }));
- Assert.IsTrue(snd.SequenceEqual(new[] { 43, 44 }));
- Assert.IsTrue(thd.SequenceEqual(new[] { 44, 45 }));
-
- d3.Dispose();
-
- Assert.AreEqual(2, addCount);
- Assert.AreEqual(2, remCount);
-
- src.OnBar(46);
-
- Assert.IsTrue(fst.SequenceEqual(new[] { 42 }));
- Assert.IsTrue(snd.SequenceEqual(new[] { 43, 44 }));
- Assert.IsTrue(thd.SequenceEqual(new[] { 44, 45 }));
- }
-
- [TestMethod]
- public void FromEvent_SynchronizationContext()
- {
- var beforeSubscribeNull = false;
- var afterSubscribeNull = false;
- var subscribeOnCtx = false;
-
- var fstNext = false;
- var sndNext = false;
- var thdNext = false;
-
- var beforeDisposeNull = false;
- var afterDisposeNull = false;
- var disposeOnCtx = false;
-
- RunWithContext(new MyEventSyncCtx(), ctx =>
- {
- var src = new MyEventSource();
-
- var addCtx = default(SynchronizationContext);
- var remCtx = default(SynchronizationContext);
-
- var addEvt = new ManualResetEvent(false);
- var remEvt = new ManualResetEvent(false);
-
- var xs = Observable.FromEventPattern<MyEventArgs>(h => { addCtx = SynchronizationContext.Current; src.Bar += h; addEvt.Set(); }, h => { remCtx = SynchronizationContext.Current; src.Bar -= h; remEvt.Set(); });
-
- Assert.IsNull(addCtx);
- Assert.IsNull(remCtx);
-
- var d = default(IDisposable);
- var res = new List<int>();
-
- var s = new Thread(() =>
- {
- beforeSubscribeNull = object.ReferenceEquals(SynchronizationContext.Current, null);
- d = xs.Subscribe(e => res.Add(e.EventArgs.Value));
- afterSubscribeNull = object.ReferenceEquals(SynchronizationContext.Current, null);
- });
-
- s.Start();
- s.Join();
-
- addEvt.WaitOne();
-
- subscribeOnCtx = object.ReferenceEquals(addCtx, ctx);
-
- src.OnBar(42);
- fstNext = res.SequenceEqual(new[] { 42 });
-
- src.OnBar(43);
- sndNext = res.SequenceEqual(new[] { 42, 43 });
-
- var u = new Thread(() =>
- {
- beforeDisposeNull = object.ReferenceEquals(SynchronizationContext.Current, null);
- d.Dispose();
- afterDisposeNull = object.ReferenceEquals(SynchronizationContext.Current, null);
- });
-
- u.Start();
- u.Join();
-
- remEvt.WaitOne();
-
- disposeOnCtx = object.ReferenceEquals(remCtx, ctx);
-
- src.OnBar(44);
- thdNext = res.SequenceEqual(new[] { 42, 43 });
- });
-
- Assert.IsTrue(beforeSubscribeNull);
- Assert.IsTrue(subscribeOnCtx);
- Assert.IsTrue(afterSubscribeNull);
-
- Assert.IsTrue(fstNext);
- Assert.IsTrue(sndNext);
- Assert.IsTrue(thdNext);
-
- Assert.IsTrue(beforeDisposeNull);
- Assert.IsTrue(disposeOnCtx);
- Assert.IsTrue(afterDisposeNull);
- }
-
- private void RunWithContext<T>(T ctx, Action<T> run)
- where T : SynchronizationContext
- {
- var t = new Thread(() =>
- {
- SynchronizationContext.SetSynchronizationContext(ctx);
- run(ctx);
- });
-
- t.Start();
- t.Join();
- }
-
- [TestMethod]
- public void FromEvent_Scheduler1()
- {
- RunWithScheduler((s, add, remove) => Observable.FromEvent<MyEventArgs>(h => { add(); }, h => { remove(); }, s));
- }
-
- [TestMethod]
- public void FromEvent_Scheduler2()
- {
- RunWithScheduler((s, add, remove) => Observable.FromEvent(h => { add(); }, h => { remove(); }, s));
- }
-
- [TestMethod]
- public void FromEvent_Scheduler3()
- {
- RunWithScheduler((s, add, remove) => Observable.FromEvent<Action<MyEventArgs>, MyEventArgs>(h => { add(); }, h => { remove(); }, s));
- }
-
- [TestMethod]
- public void FromEvent_Scheduler4()
- {
- RunWithScheduler((s, add, remove) => Observable.FromEvent<Action, MyEventArgs>(h => () => { }, h => { add(); }, h => { remove(); }, s));
- }
-
- [TestMethod]
- public void FromEventPattern_Scheduler1()
- {
- RunWithScheduler((s, add, remove) => Observable.FromEventPattern<MyEventArgs>(h => { add(); }, h => { remove(); }, s));
- }
-
- [TestMethod]
- public void FromEventPattern_Scheduler2()
- {
- RunWithScheduler((s, add, remove) =>
- {
- MyEventObject.Add = add;
- MyEventObject.Remove = remove;
- return Observable.FromEventPattern<MyEventArgs>(typeof(MyEventObject), "S", s);
- });
- }
-
- [TestMethod]
- public void FromEventPattern_Scheduler3()
- {
- RunWithScheduler((s, add, remove) =>
- {
- MyEventObject.Add = add;
- MyEventObject.Remove = remove;
- return Observable.FromEventPattern<MyEventArgs>(new MyEventObject(), "I", s);
- });
- }
-
- [TestMethod]
- public void FromEventPattern_Scheduler4()
- {
- RunWithScheduler((s, add, remove) => Observable.FromEventPattern(h => { add(); }, h => { remove(); }, s));
- }
-
- [TestMethod]
- public void FromEventPattern_Scheduler5()
- {
- RunWithScheduler((s, add, remove) =>
- {
- MyEventObject.Add = add;
- MyEventObject.Remove = remove;
- return Observable.FromEventPattern(typeof(MyEventObject), "S", s);
- });
- }
-
- [TestMethod]
- public void FromEventPattern_Scheduler6()
- {
- RunWithScheduler((s, add, remove) =>
- {
- MyEventObject.Add = add;
- MyEventObject.Remove = remove;
- return Observable.FromEventPattern(new MyEventObject(), "I", s);
- });
- }
-
- [TestMethod]
- public void FromEventPattern_Scheduler7()
- {
- RunWithScheduler((s, add, remove) => Observable.FromEventPattern<EventHandler<MyEventArgs>, MyEventArgs>(h => { add(); }, h => { remove(); }, s));
- }
-
- [TestMethod]
- public void FromEventPattern_Scheduler8()
- {
- RunWithScheduler((s, add, remove) => Observable.FromEventPattern<EventHandler<MyEventArgs>, MyEventArgs>(h => h, h => { add(); }, h => { remove(); }, s));
- }
-
- [TestMethod]
- public void FromEventPattern_Scheduler9()
- {
- RunWithScheduler((s, add, remove) =>
- {
- MyEventObject.Add = add;
- MyEventObject.Remove = remove;
- return Observable.FromEventPattern<object, MyEventArgs>(typeof(MyEventObject), "S", s);
- });
- }
-
- [TestMethod]
- public void FromEventPattern_Scheduler10()
- {
- RunWithScheduler((s, add, remove) =>
- {
- MyEventObject.Add = add;
- MyEventObject.Remove = remove;
- return Observable.FromEventPattern<object, MyEventArgs>(new MyEventObject(), "I", s);
- });
- }
-
- [TestMethod]
- public void FromEventPattern_Scheduler11()
- {
- RunWithScheduler((s, add, remove) => Observable.FromEventPattern<EventHandler<MyEventArgs>, object, MyEventArgs>(h => { add(); }, h => { remove(); }, s));
- }
-
- class MyEventObject
- {
- public static Action Add;
- public static Action Remove;
-
- public event EventHandler<MyEventArgs> I
- {
- add { Add(); }
- remove { Remove(); }
- }
-
- public static event EventHandler<MyEventArgs> S
- {
- add { Add(); }
- remove { Remove(); }
- }
- }
-
- private void RunWithScheduler<T>(Func<IScheduler, Action, Action, IObservable<T>> run)
- {
- var n = 0;
- var a = 0;
- var r = 0;
-
- var s = new MyEventScheduler(() => n++);
-
- var add = new Action(() => a++);
- var rem = new Action(() => r++);
-
- var xs = run(s, add, rem);
-
- Assert.AreEqual(0, n);
- Assert.AreEqual(0, a);
- Assert.AreEqual(0, r);
-
- var d1 = xs.Subscribe();
- Assert.AreEqual(1, n);
- Assert.AreEqual(1, a);
- Assert.AreEqual(0, r);
-
- var d2 = xs.Subscribe();
- Assert.AreEqual(1, n);
- Assert.AreEqual(1, a);
- Assert.AreEqual(0, r);
-
- d1.Dispose();
- Assert.AreEqual(1, n);
- Assert.AreEqual(1, a);
- Assert.AreEqual(0, r);
-
- d2.Dispose();
- Assert.AreEqual(2, n);
- Assert.AreEqual(1, a);
- Assert.AreEqual(1, r);
- }
-
- class MyEventSource
- {
- public event EventHandler<MyEventArgs> Bar;
-
- public void OnBar(int value)
- {
- var bar = Bar;
- if (bar != null)
- bar(this, new MyEventArgs(value));
- }
- }
-
- class MyEventArgs : EventArgs
- {
- public MyEventArgs(int value)
- {
- Value = value;
- }
-
- public int Value { get; private set; }
- }
-
- class MyEventSyncCtx : SynchronizationContext
- {
- public int PostCount { get; private set; }
-
- public override void Post(SendOrPostCallback d, object state)
- {
- var old = SynchronizationContext.Current;
- SynchronizationContext.SetSynchronizationContext(this);
- try
- {
- PostCount++;
- d(state);
- }
- finally
- {
- SynchronizationContext.SetSynchronizationContext(old);
- }
- }
- }
-
- class MyEventScheduler : LocalScheduler
- {
- private Action _schedule;
-
- public MyEventScheduler(Action schedule)
- {
- _schedule = schedule;
- }
-
- public override IDisposable Schedule<TState>(TState state, Func<IScheduler, TState, IDisposable> action)
- {
- _schedule();
-
- return action(this, state);
- }
-
- public override IDisposable Schedule<TState>(TState state, TimeSpan dueTime, Func<IScheduler, TState, IDisposable> action)
- {
- throw new NotImplementedException();
- }
- }
-
-
- #endregion
-
- #region <| Helpers |>
-
- class FromEventPattern_ArgCheck
- {
-#pragma warning disable 67
- public event Action E1;
- public event Action<int, int> E2;
- public event Action<object, object> E3;
- public event Action<object, int> E4;
- public event Func<object, EventArgs, int> E5;
- public event Action<EventArgs> E6;
-#pragma warning restore 67
- }
-
- public class FromEventPattern_VarianceCheck
- {
-#pragma warning disable 67
- public event EventHandler<EventArgs> E1;
- public event EventHandler<CancelEventArgs> E2;
- public event Action<string, EventArgs> E3;
-#pragma warning restore 67
-
- public void OnE2(CancelEventArgs args)
- {
- var e = E2;
- if (e != null)
- e(this, args);
- }
-
- public void OnE3(string sender)
- {
- var e = E3;
- if (e != null)
- e(sender, EventArgs.Empty);
- }
- }
-
- public class FromEventPattern
- {
- [DebuggerDisplay("{Id}")]
- public class TestEventArgs : EventArgs, IEquatable<TestEventArgs>
- {
- public int Id { get; set; }
-
- public override string ToString()
- {
- return Id.ToString();
- }
-
- public bool Equals(TestEventArgs other)
- {
- if (other == this)
- return true;
- if (other == null)
- return false;
- return other.Id == Id;
- }
-
- public override bool Equals(object obj)
- {
- return Equals(obj as TestEventArgs);
- }
-
- public override int GetHashCode()
- {
- return Id;
- }
- }
-
- public delegate void TestEventHandler(object sender, TestEventArgs eventArgs);
-
- public event TestEventHandler E1;
-
- public void M1(int i)
- {
- var e = E1;
- if (e != null)
- e(this, new TestEventArgs { Id = i });
- }
-
- public event EventHandler<TestEventArgs> E2;
-
- public void M2(int i)
- {
- var e = E2;
- if (e != null)
- e(this, new TestEventArgs { Id = i });
- }
-
- public event Action<object, TestEventArgs> E3;
-
- public void M3(int i)
- {
- var e = E3;
- if (e != null)
- e(this, new TestEventArgs { Id = i });
- }
-
- public event Action<int> E4;
-
- public void M4(int i)
- {
- var e = E4;
- if (e != null)
- e(i);
- }
-
- public event TestEventHandler AddThrows
- {
- add { throw new InvalidOperationException(); }
- remove { }
- }
-
- public event TestEventHandler RemoveThrows
- {
- add { }
- remove { throw new InvalidOperationException(); }
- }
-
- public event EventHandler E5;
- public void M5(int i)
- {
- var e = E5;
- if (e != null)
- e(this, new FromEventPattern.TestEventArgs { Id = i });
- }
-
- public static event EventHandler<TestEventArgs> E6;
-
- public static void M6(int i)
- {
- var e = E6;
- if (e != null)
- e(null, new TestEventArgs { Id = i });
- }
- }
-
- public delegate void MyAction(int x);
-
- public class FromEvent
- {
- public event Action A;
-
- public void OnA()
- {
- var a = A;
- if (a != null)
- a();
- }
-
- public event Action<int> B;
-
- public void OnB(int x)
- {
- var b = B;
- if (b != null)
- b(x);
- }
-
- public event MyAction C;
-
- public void OnC(int x)
- {
- var c = C;
- if (c != null)
- c(x);
- }
- }
-
- #endregion
- }
-}
diff --git a/Rx.NET/Tests.System.Reactive/Tests/ObservableExTest.cs b/Rx.NET/Tests.System.Reactive/Tests/ObservableExTest.cs
deleted file mode 100644
index ddcc8c6..0000000
--- a/Rx.NET/Tests.System.Reactive/Tests/ObservableExTest.cs
+++ /dev/null
@@ -1,1692 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Reactive;
-using System.Reactive.Concurrency;
-using System.Reactive.Linq;
-using Microsoft.Reactive.Testing;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using ReactiveTests.Dummies;
-
-namespace ReactiveTests.Tests
-{
- [TestClass]
- public class ObservableExTest : ReactiveTest
- {
- #region Create
-
- [TestMethod]
- public void Iterate_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => ObservableEx.Create<int>(default(Func<IObserver<int>, IEnumerable<IObservable<Object>>>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => ObservableEx.Create(DummyFunc<IObserver<int>, IEnumerable<IObservable<Object>>>.Instance).Subscribe(null));
- }
-
- IEnumerable<IObservable<Object>> ToIterate_Complete(IObservable<int> xs, IObservable<int> ys, IObservable<int> zs, IObserver<int> observer)
- {
- observer.OnNext(1);
- yield return xs.Select(x => new Object());
-
- observer.OnNext(2);
- yield return ys.Select(x => new Object());
-
- observer.OnNext(3);
- observer.OnCompleted();
- yield return zs.Select(x => new Object());
-
- observer.OnNext(4);
- }
-
- [TestMethod]
- public void Iterate_Complete()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateColdObservable(
- OnNext(10, 1),
- OnNext(20, 2),
- OnNext(30, 3),
- OnNext(40, 4),
- OnCompleted<int>(50)
- );
-
- var ys = scheduler.CreateColdObservable(
- OnNext(10, 1),
- OnNext(20, 2),
- OnCompleted<int>(30)
- );
-
- var zs = scheduler.CreateColdObservable(
- OnNext(10, 1),
- OnNext(20, 2),
- OnNext(30, 3),
- OnNext(40, 4),
- OnNext(50, 5),
- OnCompleted<int>(60)
- );
-
- var res = scheduler.Start(() => ObservableEx.Create<int>(observer => ToIterate_Complete(xs, ys, zs, observer)));
-
- res.Messages.AssertEqual(
- OnNext(200, 1),
- OnNext(250, 2),
- OnNext(280, 3),
- OnCompleted<int>(280)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
-
- ys.Subscriptions.AssertEqual(
- Subscribe(250, 280)
- );
-
- zs.Subscriptions.AssertEqual(
- Subscribe(280, 280)
- );
- }
-
- IEnumerable<IObservable<Object>> ToIterate_Complete_Implicit(IObservable<int> xs, IObservable<int> ys, IObservable<int> zs, IObserver<int> observer)
- {
- observer.OnNext(1);
- yield return xs.Select(x => new Object());
-
- observer.OnNext(2);
- yield return ys.Select(x => new Object());
-
- observer.OnNext(3);
- yield return zs.Select(x => new Object());
-
- observer.OnNext(4);
- }
-
- [TestMethod]
- public void Iterate_Complete_Implicit()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateColdObservable(
- OnNext(10, 1),
- OnNext(20, 2),
- OnNext(30, 3),
- OnNext(40, 4),
- OnCompleted<int>(50)
- );
-
- var ys = scheduler.CreateColdObservable(
- OnNext(10, 1),
- OnNext(20, 2),
- OnCompleted<int>(30)
- );
-
- var zs = scheduler.CreateColdObservable(
- OnNext(10, 1),
- OnNext(20, 2),
- OnNext(30, 3),
- OnNext(40, 4),
- OnNext(50, 5),
- OnCompleted<int>(60)
- );
-
- var res = scheduler.Start(() => ObservableEx.Create<int>(observer => ToIterate_Complete_Implicit(xs, ys, zs, observer)));
-
- res.Messages.AssertEqual(
- OnNext(200, 1),
- OnNext(250, 2),
- OnNext(280, 3),
- OnNext(340, 4),
- OnCompleted<int>(340)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
-
- ys.Subscriptions.AssertEqual(
- Subscribe(250, 280)
- );
-
- zs.Subscriptions.AssertEqual(
- Subscribe(280, 340)
- );
- }
-
- IEnumerable<IObservable<Object>> ToIterate_Throw(IObservable<int> xs, IObservable<int> ys, IObservable<int> zs, IObserver<int> observer, Exception ex)
- {
- observer.OnNext(1);
- yield return xs.Select(x => new Object());
-
- observer.OnNext(2);
- yield return ys.Select(x => new Object());
-
- observer.OnNext(3);
-
- if (xs != null)
- throw ex;
-
- yield return zs.Select(x => new Object());
-
- observer.OnNext(4);
- observer.OnCompleted();
- }
-
- [TestMethod]
- public void Iterate_Iterator_Throw()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateColdObservable(
- OnNext(10, 1),
- OnNext(20, 2),
- OnNext(30, 3),
- OnNext(40, 4),
- OnCompleted<int>(50)
- );
-
- var ys = scheduler.CreateColdObservable(
- OnNext(10, 1),
- OnNext(20, 2),
- OnCompleted<int>(30)
- );
-
- var zs = scheduler.CreateColdObservable(
- OnNext(10, 1),
- OnNext(20, 2),
- OnNext(30, 3),
- OnNext(40, 4),
- OnNext(50, 5),
- OnCompleted<int>(60)
- );
-
- var ex = new Exception();
-
- var res = scheduler.Start(() => ObservableEx.Create<int>(observer => ToIterate_Throw(xs, ys, zs, observer, ex)));
-
- res.Messages.AssertEqual(
- OnNext(200, 1),
- OnNext(250, 2),
- OnNext(280, 3),
- OnError<int>(280, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
-
- ys.Subscriptions.AssertEqual(
- Subscribe(250, 280)
- );
-
- zs.Subscriptions.AssertEqual(
- );
- }
-
- IEnumerable<IObservable<Object>> ToIterate_Error(IObservable<int> xs, IObservable<int> ys, IObservable<int> zs, IObserver<int> observer, Exception ex)
- {
- observer.OnNext(1);
- yield return xs.Select(x => new Object());
-
- observer.OnNext(2);
- observer.OnError(ex);
-
- yield return ys.Select(x => new Object());
-
- observer.OnNext(3);
-
- yield return zs.Select(x => new Object());
-
- observer.OnNext(4);
- observer.OnCompleted();
- }
-
- [TestMethod]
- public void Iterate_Iterator_Error()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateColdObservable(
- OnNext(10, 1),
- OnNext(20, 2),
- OnNext(30, 3),
- OnNext(40, 4),
- OnCompleted<int>(50)
- );
-
- var ys = scheduler.CreateColdObservable(
- OnNext(10, 1),
- OnNext(20, 2),
- OnCompleted<int>(30)
- );
-
- var zs = scheduler.CreateColdObservable(
- OnNext(10, 1),
- OnNext(20, 2),
- OnNext(30, 3),
- OnNext(40, 4),
- OnNext(50, 5),
- OnCompleted<int>(60)
- );
-
- var res = scheduler.Start(() => ObservableEx.Create<int>(observer => ToIterate_Error(xs, ys, zs, observer, ex)));
-
- res.Messages.AssertEqual(
- OnNext(200, 1),
- OnNext(250, 2),
- OnError<int>(250, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
-
- ys.Subscriptions.AssertEqual(
- Subscribe(250, 250)
- );
-
- zs.Subscriptions.AssertEqual(
- );
- }
-
- IEnumerable<IObservable<Object>> ToIterate_Complete_Dispose(IObservable<int> xs, IObservable<int> ys, IObservable<int> zs, IObserver<int> observer)
- {
- observer.OnNext(1);
- yield return xs.Select(x => new Object());
-
- observer.OnNext(2);
- yield return ys.Select(x => new Object());
-
- observer.OnNext(3);
- yield return zs.Select(x => new Object());
-
- observer.OnNext(4);
- }
-
- [TestMethod]
- public void Iterate_Complete_Dispose()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateColdObservable(
- OnNext(10, 1),
- OnNext(20, 2),
- OnNext(30, 3),
- OnNext(40, 4),
- OnCompleted<int>(50)
- );
-
- var ys = scheduler.CreateColdObservable(
- OnNext(10, 1),
- OnNext(20, 2),
- OnCompleted<int>(30)
- );
-
- var zs = scheduler.CreateColdObservable(
- OnNext(100, 1),
- OnNext(200, 2),
- OnNext(300, 3),
- OnNext(400, 4),
- OnNext(500, 5),
- OnNext(600, 6),
- OnNext(700, 7),
- OnNext(800, 8),
- OnNext(900, 9),
- OnNext(1000, 10)
- );
-
- var res = scheduler.Start(() => ObservableEx.Create<int>(observer => ToIterate_Complete_Dispose(xs, ys, zs, observer)));
-
- res.Messages.AssertEqual(
- OnNext(200, 1),
- OnNext(250, 2),
- OnNext(280, 3)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
-
- ys.Subscriptions.AssertEqual(
- Subscribe(250, 280)
- );
-
- zs.Subscriptions.AssertEqual(
- Subscribe(280, 1000)
- );
- }
-
- [TestMethod]
- public void IteratorScenario()
- {
- var xs = ObservableEx.Create<int>(o => _IteratorScenario(100, 1000, o));
-
- xs.AssertEqual(new[] { 100, 1000 }.ToObservable());
- }
-
- static IEnumerable<IObservable<Object>> _IteratorScenario(int x, int y, IObserver<int> results)
- {
- var xs = Observable.Range(1, x).ToListObservable();
- yield return xs;
-
- results.OnNext(xs.Value);
-
- var ys = Observable.Range(1, y).ToListObservable();
- yield return ys;
-
- results.OnNext(ys.Value);
- }
-
- [TestMethod]
- public void Iterate_Void_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => ObservableEx.Create(default(Func<IEnumerable<IObservable<object>>>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => ObservableEx.Create(DummyFunc<IEnumerable<IObservable<Object>>>.Instance).Subscribe(null));
- }
-
- IEnumerable<IObservable<Object>> ToIterate_Void_Complete(IObservable<int> xs, IObservable<int> ys, IObservable<int> zs)
- {
- yield return xs.Select(x => new Object());
-
- yield return ys.Select(x => new Object());
-
- yield return zs.Select(x => new Object());
- }
-
- [TestMethod]
- public void Iterate_Void_Complete()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateColdObservable(
- OnNext(10, 1),
- OnNext(20, 2),
- OnNext(30, 3),
- OnNext(40, 4),
- OnCompleted<int>(50)
- );
-
- var ys = scheduler.CreateColdObservable(
- OnNext(10, 1),
- OnNext(20, 2),
- OnCompleted<int>(30)
- );
-
- var zs = scheduler.CreateColdObservable(
- OnNext(10, 1),
- OnNext(20, 2),
- OnNext(30, 3),
- OnNext(40, 4),
- OnNext(50, 5),
- OnCompleted<int>(60)
- );
-
- var res = scheduler.Start(() => ObservableEx.Create(() => ToIterate_Void_Complete(xs, ys, zs)));
-
- res.Messages.AssertEqual(
- OnCompleted<Unit>(340)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
-
- ys.Subscriptions.AssertEqual(
- Subscribe(250, 280)
- );
-
- zs.Subscriptions.AssertEqual(
- Subscribe(280, 340)
- );
- }
-
- IEnumerable<IObservable<Object>> ToIterate_Void_Complete_Implicit(IObservable<int> xs, IObservable<int> ys, IObservable<int> zs)
- {
- yield return xs.Select(x => new Object());
-
- yield return ys.Select(x => new Object());
-
- yield return zs.Select(x => new Object());
- }
-
- [TestMethod]
- public void Iterate_Void_Complete_Implicit()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateColdObservable(
- OnNext(10, 1),
- OnNext(20, 2),
- OnNext(30, 3),
- OnNext(40, 4),
- OnCompleted<int>(50)
- );
-
- var ys = scheduler.CreateColdObservable(
- OnNext(10, 1),
- OnNext(20, 2),
- OnCompleted<int>(30)
- );
-
- var zs = scheduler.CreateColdObservable(
- OnNext(10, 1),
- OnNext(20, 2),
- OnNext(30, 3),
- OnNext(40, 4),
- OnNext(50, 5),
- OnCompleted<int>(60)
- );
-
- var res = scheduler.Start(() => ObservableEx.Create(() => ToIterate_Void_Complete_Implicit(xs, ys, zs)));
-
- res.Messages.AssertEqual(
- OnCompleted<Unit>(340)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
-
- ys.Subscriptions.AssertEqual(
- Subscribe(250, 280)
- );
-
- zs.Subscriptions.AssertEqual(
- Subscribe(280, 340)
- );
- }
-
- IEnumerable<IObservable<Object>> ToIterate_Void_Throw(IObservable<int> xs, IObservable<int> ys, IObservable<int> zs, Exception ex)
- {
- yield return xs.Select(x => new Object());
-
- yield return ys.Select(x => new Object());
-
- if (xs != null)
- throw ex;
-
- yield return zs.Select(x => new Object());
- }
-
- [TestMethod]
- public void Iterate_Void_Iterator_Throw()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateColdObservable(
- OnNext(10, 1),
- OnNext(20, 2),
- OnNext(30, 3),
- OnNext(40, 4),
- OnCompleted<int>(50)
- );
-
- var ys = scheduler.CreateColdObservable(
- OnNext(10, 1),
- OnNext(20, 2),
- OnCompleted<int>(30)
- );
-
- var zs = scheduler.CreateColdObservable(
- OnNext(10, 1),
- OnNext(20, 2),
- OnNext(30, 3),
- OnNext(40, 4),
- OnNext(50, 5),
- OnCompleted<int>(60)
- );
-
- var ex = new Exception();
-
- var res = scheduler.Start(() => ObservableEx.Create(() => ToIterate_Void_Throw(xs, ys, zs, ex)));
-
- res.Messages.AssertEqual(
- OnError<Unit>(280, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
-
- ys.Subscriptions.AssertEqual(
- Subscribe(250, 280)
- );
-
- zs.Subscriptions.AssertEqual(
- );
- }
-
- IEnumerable<IObservable<Object>> ToIterate_Void_Complete_Dispose(IObservable<int> xs, IObservable<int> ys, IObservable<int> zs)
- {
- yield return xs.Select(x => new Object());
-
- yield return ys.Select(x => new Object());
-
- yield return zs.Select(x => new Object());
- }
-
- [TestMethod]
- public void Iterate_Void_Complete_Dispose()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateColdObservable(
- OnNext(10, 1),
- OnNext(20, 2),
- OnNext(30, 3),
- OnNext(40, 4),
- OnCompleted<int>(50)
- );
-
- var ys = scheduler.CreateColdObservable(
- OnNext(10, 1),
- OnNext(20, 2),
- OnCompleted<int>(30)
- );
-
- var zs = scheduler.CreateColdObservable(
- OnNext(100, 1),
- OnNext(200, 2),
- OnNext(300, 3),
- OnNext(400, 4),
- OnNext(500, 5),
- OnNext(600, 6),
- OnNext(700, 7),
- OnNext(800, 8),
- OnNext(900, 9),
- OnNext(1000, 10)
- );
-
- var res = scheduler.Start(() => ObservableEx.Create(() => ToIterate_Void_Complete_Dispose(xs, ys, zs)));
-
- res.Messages.AssertEqual(
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
-
- ys.Subscriptions.AssertEqual(
- Subscribe(250, 280)
- );
-
- zs.Subscriptions.AssertEqual(
- Subscribe(280, 1000)
- );
- }
-
- [TestMethod]
- [Ignore]
- public void Iterate_Void_Func_Throw()
- {
- var scheduler = new TestScheduler();
-
- ReactiveAssert.Throws<InvalidOperationException>(() => scheduler.Start(() => ObservableEx.Create(() => { throw new InvalidOperationException(); })));
- }
-
- static IEnumerable<IObservable<Object>> _IteratorScenario_Void(int x, int y)
- {
- var xs = Observable.Range(1, x).ToListObservable();
- yield return xs;
-
- var ys = Observable.Range(1, y).ToListObservable();
- yield return ys;
- }
-
- [TestMethod]
- public void IteratorScenario_Void()
- {
- var xs = ObservableEx.Create(() => _IteratorScenario_Void(100, 1000));
-
- xs.AssertEqual(new Unit[] { }.ToObservable());
- }
-
- #endregion
-
- #region Expand
-
- [TestMethod]
- public void Expand_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => ObservableEx.Expand(null, DummyFunc<int, IObservable<int>>.Instance, DummyScheduler.Instance));
- ReactiveAssert.Throws<ArgumentNullException>(() => ObservableEx.Expand(DummyObservable<int>.Instance, null, DummyScheduler.Instance));
- ReactiveAssert.Throws<ArgumentNullException>(() => ObservableEx.Expand(DummyObservable<int>.Instance, DummyFunc<int, IObservable<int>>.Instance, null));
- ReactiveAssert.Throws<ArgumentNullException>(() => ObservableEx.Expand(null, DummyFunc<int, IObservable<int>>.Instance));
- ReactiveAssert.Throws<ArgumentNullException>(() => ObservableEx.Expand(DummyObservable<int>.Instance, null));
- }
-
- [TestMethod]
- public void Expand_Default()
- {
- var b = Observable.Return(1).Expand(x => x < 10 ? Observable.Return(x + 1) : Observable.Empty<int>())
- .SequenceEqual(Observable.Range(1, 10)).First();
-
- Assert.IsTrue(b);
- }
-
- [TestMethod]
- public void Expand_Empty()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnCompleted<int>(300)
- );
-
- var res = scheduler.Start(() =>
- xs.Expand(x => scheduler.CreateColdObservable(
- OnNext(100, 1),
- OnNext(200, 2),
- OnCompleted<int>(300)
- ), scheduler)
- );
-
- res.Messages.AssertEqual(
- OnCompleted<int>(300)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(201, 300)
- );
- }
-
- [TestMethod]
- public void Expand_Error()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnError<int>(300, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.Expand(x => scheduler.CreateColdObservable<int>(
- OnNext(100 + x, 2 * x),
- OnNext(200 + x, 3 * x),
- OnCompleted<int>(300 + x)
- ), scheduler)
- );
-
- res.Messages.AssertEqual(
- OnError<int>(300, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(201, 300)
- );
- }
-
- [TestMethod]
- public void Expand_Never()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable<int>(
- );
-
- var res = scheduler.Start(() =>
- xs.Expand(x => scheduler.CreateColdObservable<int>(
- OnNext(100 + x, 2 * x),
- OnNext(200 + x, 3 * x),
- OnCompleted<int>(300 + x)
- ), scheduler)
- );
-
- res.Messages.AssertEqual(
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(201, 1000)
- );
- }
-
- [TestMethod]
- public void Expand_Basic()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(550, 1),
- OnNext(850, 2),
- OnCompleted<int>(950)
- );
-
- var res = scheduler.Start(() =>
- xs.Expand(x => scheduler.CreateColdObservable(
- OnNext(100, 2 * x),
- OnNext(200, 3 * x),
- OnCompleted<int>(300)
- ), scheduler)
- );
-
- res.Messages.AssertEqual(
- OnNext(550, 1),
- OnNext(651, 2),
- OnNext(751, 3),
- OnNext(752, 4),
- OnNext(850, 2),
- OnNext(852, 6),
- OnNext(852, 6),
- OnNext(853, 8),
- OnNext(951, 4),
- OnNext(952, 9),
- OnNext(952, 12),
- OnNext(953, 12),
- OnNext(953, 12),
- OnNext(954, 16)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(201, 950)
- );
- }
-
- [TestMethod]
- public void Expand_Throw()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(550, 1),
- OnNext(850, 2),
- OnCompleted<int>(950)
- );
-
- var ex = new Exception();
-
- var res = scheduler.Start(() =>
- xs.Expand(x => { throw ex; }, scheduler)
- );
-
- res.Messages.AssertEqual(
- OnNext(550, 1),
- OnError<int>(550, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(201, 550)
- );
- }
-
- #endregion
-
- #region ForkJoin
-
- [TestMethod]
- public void ForkJoin_ArgumentChecking()
- {
- var someObservable = DummyObservable<int>.Instance;
-
- ReactiveAssert.Throws<ArgumentNullException>(() => ObservableEx.ForkJoin(someObservable, someObservable, (Func<int, int, int>)null));
- ReactiveAssert.Throws<ArgumentNullException>(() => ObservableEx.ForkJoin(someObservable, (IObservable<int>)null, (_, __) => _ + __));
- ReactiveAssert.Throws<ArgumentNullException>(() => ObservableEx.ForkJoin((IObservable<int>)null, someObservable, (_, __) => _ + __));
- ReactiveAssert.Throws<ArgumentNullException>(() => ObservableEx.ForkJoin((IObservable<int>[])null));
- ReactiveAssert.Throws<ArgumentNullException>(() => ObservableEx.ForkJoin((IEnumerable<IObservable<int>>)null));
- }
-
- [TestMethod]
- public void ForkJoin_EmptyEmpty()
- {
- var scheduler = new TestScheduler();
-
- var msgs1 = new[] {
- OnNext(150, 1),
- OnCompleted<int>(230)
- };
-
- var msgs2 = new[] {
- OnNext(150, 1),
- OnCompleted<int>(250)
- };
-
- var o = scheduler.CreateHotObservable(msgs1);
- var e = scheduler.CreateHotObservable(msgs2);
-
- var res = scheduler.Start(() => e.ForkJoin(o, (x, y) => x + y));
- res.Messages.AssertEqual(
- OnCompleted<int>(250)
- );
- }
-
- [TestMethod]
- public void ForkJoin_None()
- {
- var scheduler = new TestScheduler();
-
- var res = scheduler.Start(() => ObservableEx.ForkJoin<int>());
- res.Messages.AssertEqual(
- OnCompleted<int[]>(200)
- );
- }
-
- [TestMethod]
- public void ForkJoin_EmptyReturn()
- {
- var scheduler = new TestScheduler();
-
- var msgs1 = new[] {
- OnNext(150, 1),
- OnCompleted<int>(230)
- };
-
- var msgs2 = new[] {
- OnNext(150, 1),
- OnNext(210, 2),
- OnCompleted<int>(250)
- };
-
- var o = scheduler.CreateHotObservable(msgs1);
- var e = scheduler.CreateHotObservable(msgs2);
-
- var res = scheduler.Start(() => e.ForkJoin(o, (x, y) => x + y));
- res.Messages.AssertEqual(
- OnCompleted<int>(250)
- );
- }
-
- [TestMethod]
- public void ForkJoin_ReturnEmpty()
- {
- var scheduler = new TestScheduler();
-
- var msgs1 = new[] {
- OnNext(150, 1),
- OnNext(210, 2),
- OnCompleted<int>(230)
- };
-
- var msgs2 = new[] {
- OnNext(150, 1),
- OnCompleted<int>(250)
- };
-
- var o = scheduler.CreateHotObservable(msgs1);
- var e = scheduler.CreateHotObservable(msgs2);
-
- var res = scheduler.Start(() => e.ForkJoin(o, (x, y) => x + y));
- res.Messages.AssertEqual(
- OnCompleted<int>(250)
- );
- }
-
- [TestMethod]
- public void ForkJoin_ReturnReturn()
- {
- var scheduler = new TestScheduler();
-
- var msgs1 = new[] {
- OnNext(150, 1),
- OnNext(210, 2),
- OnCompleted<int>(230)
- };
-
- var msgs2 = new[] {
- OnNext(150, 1),
- OnNext(220, 3),
- OnCompleted<int>(250)
- };
-
- var o = scheduler.CreateHotObservable(msgs1);
- var e = scheduler.CreateHotObservable(msgs2);
-
- var res = scheduler.Start(() => e.ForkJoin(o, (x, y) => x + y));
- res.Messages.AssertEqual(
- OnNext(250, 2 + 3),
- OnCompleted<int>(250)
- );
- }
-
- [TestMethod]
- public void ForkJoin_EmptyThrow()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var msgs1 = new[] {
- OnNext(150, 1),
- OnCompleted<int>(230)
- };
-
- var msgs2 = new[] {
- OnNext(150, 1),
- OnError<int>(210, ex),
- OnCompleted<int>(250)
- };
-
- var o = scheduler.CreateHotObservable(msgs1);
- var e = scheduler.CreateHotObservable(msgs2);
-
- var res = scheduler.Start(() => e.ForkJoin(o, (x, y) => x + y));
- res.Messages.AssertEqual(
- OnError<int>(210, ex)
- );
- }
-
- [TestMethod]
- public void ForkJoin_ThrowEmpty()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var msgs1 = new[] {
- OnNext(150, 1),
- OnError<int>(210, ex),
- OnCompleted<int>(230)
- };
-
- var msgs2 = new[] {
- OnNext(150, 1),
- OnCompleted<int>(250)
- };
-
- var o = scheduler.CreateHotObservable(msgs1);
- var e = scheduler.CreateHotObservable(msgs2);
-
- var res = scheduler.Start(() => e.ForkJoin(o, (x, y) => x + y));
- res.Messages.AssertEqual(
- OnError<int>(210, ex)
- );
- }
-
- [TestMethod]
- public void ForkJoin_ReturnThrow()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var msgs1 = new[] {
- OnNext(150, 1),
- OnNext(210, 2),
- OnCompleted<int>(230)
- };
-
- var msgs2 = new[] {
- OnNext(150, 1),
- OnError<int>(220, ex),
- OnCompleted<int>(250)
- };
-
- var o = scheduler.CreateHotObservable(msgs1);
- var e = scheduler.CreateHotObservable(msgs2);
-
- var res = scheduler.Start(() => e.ForkJoin(o, (x, y) => x + y));
- res.Messages.AssertEqual(
- OnError<int>(220, ex)
- );
- }
-
- [TestMethod]
- public void ForkJoin_ThrowReturn()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var msgs1 = new[] {
- OnNext(150, 1),
- OnError<int>(220, ex),
- OnCompleted<int>(230)
- };
-
- var msgs2 = new[] {
- OnNext(150, 1),
- OnNext(210, 2),
- OnCompleted<int>(250)
- };
-
- var o = scheduler.CreateHotObservable(msgs1);
- var e = scheduler.CreateHotObservable(msgs2);
-
- var res = scheduler.Start(() => e.ForkJoin(o, (x, y) => x + y));
- res.Messages.AssertEqual(
- OnError<int>(220, ex)
- );
- }
-
- [TestMethod]
- public void ForkJoin_Binary()
- {
- var scheduler = new TestScheduler();
-
- var msgs1 = new[] {
- OnNext(150, 1),
- OnNext(215, 2),
- OnNext(225, 4),
- OnCompleted<int>(230)
- };
-
- var msgs2 = new[] {
- OnNext(150, 1),
- OnNext(235, 6),
- OnNext(240, 7),
- OnCompleted<int>(250)
- };
-
- var o = scheduler.CreateHotObservable(msgs1);
- var e = scheduler.CreateHotObservable(msgs2);
-
- var res = scheduler.Start(() => e.ForkJoin(o, (x, y) => x + y));
- res.Messages.AssertEqual(
- OnNext(250, 4 + 7), // TODO: fix ForkJoin behavior
- OnCompleted<int>(250)
- );
- }
-
- [TestMethod]
- public void ForkJoin_NaryParams()
- {
- var scheduler = new TestScheduler();
-
- var msgs1 = new[] {
- OnNext(150, 1),
- OnNext(215, 2),
- OnNext(225, 4),
- OnCompleted<int>(230)
- };
-
- var msgs2 = new[] {
- OnNext(150, 1),
- OnNext(235, 6),
- OnNext(240, 7),
- OnCompleted<int>(250)
- };
-
- var msgs3 = new[] {
- OnNext(150, 1),
- OnNext(230, 3),
- OnNext(245, 5),
- OnCompleted<int>(270)
- };
-
- var o1 = scheduler.CreateHotObservable(msgs1);
- var o2 = scheduler.CreateHotObservable(msgs2);
- var o3 = scheduler.CreateHotObservable(msgs3);
-
- var res = scheduler.Start(() => ObservableEx.ForkJoin(o1, o2, o3));
-
- res.Messages.AssertEqual(
- OnNext<int[]>(270, l => l.SequenceEqual(new[] { 4, 7, 5 })), // TODO: fix ForkJoin behavior
- OnCompleted<int[]>(270)
- );
- }
-
- [TestMethod]
- public void ForkJoin_NaryParamsEmpty()
- {
- var scheduler = new TestScheduler();
-
- var msgs1 = new[] {
- OnNext(150, 1),
- OnNext(215, 2),
- OnNext(225, 4),
- OnCompleted<int>(230)
- };
-
- var msgs2 = new[] {
- OnNext(150, 1),
- OnNext(235, 6),
- OnNext(240, 7),
- OnCompleted<int>(250)
- };
-
- var msgs3 = new[] {
- OnCompleted<int>(270)
- };
-
- var o1 = scheduler.CreateHotObservable(msgs1);
- var o2 = scheduler.CreateHotObservable(msgs2);
- var o3 = scheduler.CreateHotObservable(msgs3);
-
- var res = scheduler.Start(() => ObservableEx.ForkJoin(o1, o2, o3));
-
- res.Messages.AssertEqual(
- OnCompleted<int[]>(270)
- );
- }
-
- [TestMethod]
- public void ForkJoin_NaryParamsEmptyBeforeEnd()
- {
- var scheduler = new TestScheduler();
-
- var msgs1 = new[] {
- OnNext(150, 1),
- OnNext(215, 2),
- OnNext(225, 4),
- OnCompleted<int>(230)
- };
-
- var msgs2 = new[] {
- OnCompleted<int>(235)
- };
-
- var msgs3 = new[] {
- OnNext(150, 1),
- OnNext(230, 3),
- OnNext(245, 5),
- OnCompleted<int>(270)
- };
-
- var o1 = scheduler.CreateHotObservable(msgs1);
- var o2 = scheduler.CreateHotObservable(msgs2);
- var o3 = scheduler.CreateHotObservable(msgs3);
-
- var res = scheduler.Start(() => ObservableEx.ForkJoin(o1, o2, o3));
-
- res.Messages.AssertEqual(
- OnCompleted<int[]>(235)
- );
- }
-
- [TestMethod]
- public void ForkJoin_Nary_Immediate()
- {
- ObservableEx.ForkJoin(Observable.Return(1), Observable.Return(2)).First().SequenceEqual(new[] { 1, 2 });
- }
-
- [TestMethod]
- public void ForkJoin_Nary_Virtual_And_Immediate()
- {
- var scheduler = new TestScheduler();
-
- var msgs1 = new[] {
- OnNext(150, 1),
- OnNext(215, 2),
- OnNext(225, 4),
- OnCompleted<int>(230)
- };
-
- var msgs2 = new[] {
- OnNext(150, 1),
- OnNext(235, 6),
- OnNext(240, 7),
- OnCompleted<int>(250)
- };
-
- var msgs3 = new[] {
- OnNext(150, 1),
- OnNext(230, 3),
- OnNext(245, 5),
- OnCompleted<int>(270)
- };
-
- var o1 = scheduler.CreateHotObservable(msgs1);
- var o2 = scheduler.CreateHotObservable(msgs2);
- var o3 = scheduler.CreateHotObservable(msgs3);
-
- var res = scheduler.Start(() => ObservableEx.ForkJoin(new List<IObservable<int>> { o1, o2, o3, Observable.Return(20) }));
-
- res.Messages.AssertEqual(
- OnNext<int[]>(270, l => l.SequenceEqual(new[] { 4, 7, 5, 20 })),
- OnCompleted<int[]>(270)
- );
- }
-
- [TestMethod]
- public void ForkJoin_Nary_Immediate_And_Virtual()
- {
- var scheduler = new TestScheduler();
-
- var msgs1 = new[] {
- OnNext(150, 1),
- OnNext(215, 2),
- OnNext(225, 4),
- OnCompleted<int>(230)
- };
-
- var msgs2 = new[] {
- OnNext(150, 1),
- OnNext(235, 6),
- OnNext(240, 7),
- OnCompleted<int>(250)
- };
-
- var msgs3 = new[] {
- OnNext(150, 1),
- OnNext(230, 3),
- OnNext(245, 5),
- OnCompleted<int>(270)
- };
-
- var o1 = scheduler.CreateHotObservable(msgs1);
- var o2 = scheduler.CreateHotObservable(msgs2);
- var o3 = scheduler.CreateHotObservable(msgs3);
-
- var res = scheduler.Start(() => ObservableEx.ForkJoin(new List<IObservable<int>> { Observable.Return(20), o1, o2, o3 }));
-
- res.Messages.AssertEqual(
- OnNext<int[]>(270, l => l.SequenceEqual(new[] { 20, 4, 7, 5 })),
- OnCompleted<int[]>(270)
- );
- }
-
- [TestMethod]
- public void ForkJoin_Nary()
- {
- var scheduler = new TestScheduler();
-
- var msgs1 = new[] {
- OnNext(150, 1),
- OnNext(215, 2),
- OnNext(225, 4),
- OnCompleted<int>(230)
- };
-
- var msgs2 = new[] {
- OnNext(150, 1),
- OnNext(235, 6),
- OnNext(240, 7),
- OnCompleted<int>(250)
- };
-
- var msgs3 = new[] {
- OnNext(150, 1),
- OnNext(230, 3),
- OnNext(245, 5),
- OnCompleted<int>(270)
- };
-
- var o1 = scheduler.CreateHotObservable(msgs1);
- var o2 = scheduler.CreateHotObservable(msgs2);
- var o3 = scheduler.CreateHotObservable(msgs3);
-
- var res = scheduler.Start(() => ObservableEx.ForkJoin(new List<IObservable<int>> { o1, o2, o3 }));
-
- res.Messages.AssertEqual(
- OnNext<int[]>(270, l => l.SequenceEqual(new[] { 4, 7, 5 })), // TODO: fix ForkJoin behavior
- OnCompleted<int[]>(270)
- );
- }
-
- [TestMethod]
- public void Bug_1302_SelectorThrows_LeftLast()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(210, 1),
- OnCompleted<int>(220)
- );
-
- var ys = scheduler.CreateHotObservable(
- OnNext(215, 2),
- OnCompleted<int>(217)
- );
-
- var ex = new Exception();
-
- var results = scheduler.Start(() => xs.ForkJoin<int, int, int>(ys, (x, y) => { throw ex; }));
-
- results.Messages.AssertEqual(
- OnError<int>(220, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 220)
- );
-
- ys.Subscriptions.AssertEqual(
- Subscribe(200, 217)
- );
- }
-
- [TestMethod]
- public void Bug_1302_SelectorThrows_RightLast()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(210, 1),
- OnCompleted<int>(217)
- );
-
- var ys = scheduler.CreateHotObservable(
- OnNext(215, 2),
- OnCompleted<int>(220)
- );
-
- var ex = new Exception();
-
- var results = scheduler.Start(() => xs.ForkJoin<int, int, int>(ys, (x, y) => { throw ex; }));
-
- results.Messages.AssertEqual(
- OnError<int>(220, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 217)
- );
-
- ys.Subscriptions.AssertEqual(
- Subscribe(200, 220)
- );
- }
-
- [TestMethod]
- public void Bug_1302_RightLast_NoLeft()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnCompleted<int>(217)
- );
-
- var ys = scheduler.CreateHotObservable(
- OnNext(215, 2),
- OnCompleted<int>(220)
- );
-
- var results = scheduler.Start(() => xs.ForkJoin<int, int, int>(ys, (x, y) => x + y));
-
- results.Messages.AssertEqual(
- OnCompleted<int>(220)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 217)
- );
-
- ys.Subscriptions.AssertEqual(
- Subscribe(200, 220)
- );
- }
-
- [TestMethod]
- public void Bug_1302_RightLast_NoRight()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(215, 2),
- OnCompleted<int>(217)
- );
-
- var ys = scheduler.CreateHotObservable(
- OnCompleted<int>(220)
- );
-
- var results = scheduler.Start(() => xs.ForkJoin<int, int, int>(ys, (x, y) => x + y));
-
- results.Messages.AssertEqual(
- OnCompleted<int>(220)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 217)
- );
-
- ys.Subscriptions.AssertEqual(
- Subscribe(200, 220)
- );
- }
-
- #endregion
-
- #region Let
-
- [TestMethod]
- public void Let_ArgumentChecking()
- {
- var someObservable = Observable.Empty<int>();
-
- ReactiveAssert.Throws<ArgumentNullException>(() => ObservableEx.Let(default(IObservable<int>), x => x));
- ReactiveAssert.Throws<ArgumentNullException>(() => ObservableEx.Let<int, int>(someObservable, null));
- }
-
- [TestMethod]
- public void Let_CallsFunctionImmediately()
- {
- bool called = false;
- Observable.Empty<int>().Let(x => { called = true; return x; });
- Assert.IsTrue(called);
- }
-
- #endregion
-
- #region ManySelect
-
- [TestMethod]
- public void ManySelect_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => ObservableEx.ManySelect<int, int>(null, DummyFunc<IObservable<int>, int>.Instance, DummyScheduler.Instance));
- ReactiveAssert.Throws<ArgumentNullException>(() => ObservableEx.ManySelect<int, int>(DummyObservable<int>.Instance, null, DummyScheduler.Instance));
- ReactiveAssert.Throws<ArgumentNullException>(() => ObservableEx.ManySelect<int, int>(DummyObservable<int>.Instance, DummyFunc<IObservable<int>, int>.Instance, null));
- ReactiveAssert.Throws<ArgumentNullException>(() => ObservableEx.ManySelect<int, int>(null, DummyFunc<IObservable<int>, int>.Instance));
- ReactiveAssert.Throws<ArgumentNullException>(() => ObservableEx.ManySelect<int, int>(DummyObservable<int>.Instance, null));
- }
-
- [TestMethod]
- public void ManySelect_Law_1()
- {
- var xs = Observable.Range(1, 0);
-
- var left = xs.ManySelect(Observable.First);
- var right = xs;
-
- Assert.IsTrue(left.SequenceEqual(right).First());
- }
-
- [TestMethod]
- public void ManySelect_Law_2()
- {
- var xs = Observable.Range(1, 10);
- Func<IObservable<int>, int> f = ys => ys.Count().First();
-
- var left = xs.ManySelect(f).First();
- var right = f(xs);
-
- Assert.AreEqual(left, right);
- }
-
- [TestMethod]
- public void ManySelect_Law_3()
- {
- var xs = Observable.Range(1, 10);
- Func<IObservable<int>, int> f = ys => ys.Count().First();
- Func<IObservable<int>, int> g = ys => ys.Last();
-
- var left = xs.ManySelect(f).ManySelect(g);
- var right = xs.ManySelect(ys => g(ys.ManySelect(f)));
-
- Assert.IsTrue(left.SequenceEqual(right).First());
- }
-
- [TestMethod]
- public void ManySelect_Basic()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(100, 1),
- OnNext(220, 2),
- OnNext(270, 3),
- OnNext(410, 4),
- OnCompleted<int>(500)
- );
-
- var res = scheduler.Start(() =>
- xs.ManySelect(ys => ys.First(), scheduler)
- );
-
- res.Messages.AssertEqual(
- OnNext(221, 2),
- OnNext(271, 3),
- OnNext(411, 4),
- OnCompleted<int>(501)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 500)
- );
- }
-
- [TestMethod]
- public void ManySelect_Error()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(100, 1),
- OnNext(220, 2),
- OnNext(270, 3),
- OnNext(410, 4),
- OnError<int>(500, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.ManySelect(ys => ys.First(), scheduler)
- );
-
- res.Messages.AssertEqual(
- OnNext(221, 2),
- OnNext(271, 3),
- OnNext(411, 4),
- OnError<int>(501, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 500)
- );
- }
-
- #endregion
-
- #region ToListObservable
-
- [TestMethod]
- public void ToListObservable_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => ((IObservable<int>)null).ToListObservable());
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Never<int>().ToListObservable().Subscribe(null));
- }
-
- [TestMethod]
- public void ToListObservable_OnNext()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(300, 1),
- OnNext(400, 2),
- OnNext(500, 3),
- OnNext(600, 4)
- );
-
- var res = scheduler.Start(() =>
- xs.ToListObservable()
- );
-
- res.Messages.AssertEqual(
- );
- }
-
- [TestMethod]
- public void ToListObservable_OnError()
- {
- var scheduler = new TestScheduler();
-
- var ex = new InvalidOperationException();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(300, 1),
- OnNext(400, 2),
- OnNext(500, 3),
- OnError<int>(600, ex)
- );
-
- var s = default(ListObservable<int>);
- var subscription = default(IDisposable);
- var res = scheduler.CreateObserver<object>();
-
- scheduler.ScheduleAbsolute(Created, () => s = xs.ToListObservable());
- scheduler.ScheduleAbsolute(Subscribed, () => subscription = s.Subscribe(res));
- scheduler.ScheduleAbsolute(Disposed, () => subscription.Dispose());
-
- scheduler.Start();
-
- ReactiveAssert.Throws<InvalidOperationException>(() => { var t = s.Value; });
-
- res.Messages.AssertEqual(
- OnError<Object>(600, ex)
- );
- }
-
- [TestMethod]
- public void ToListObservable_OnCompleted()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(300, 1),
- OnNext(400, 2),
- OnNext(500, 3),
- OnCompleted<int>(600)
- );
-
- var s = default(ListObservable<int>);
-
- var res = scheduler.Start(() =>
- s = xs.ToListObservable()
- );
-
- s.AssertEqual(1, 2, 3);
-
- res.Messages.AssertEqual(
- OnCompleted<Object>(600)
- );
-
- Assert.AreEqual(3, s.Value);
- }
-
- [TestMethod]
- public void ToListObservable_Disposed()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(300, 1),
- OnNext(400, 2),
- OnNext(500, 3),
- OnNext(1050, 4),
- OnCompleted<int>(1100)
- );
-
- var s = default(ListObservable<int>);
-
- var res = scheduler.Start(() =>
- s = xs.ToListObservable()
- );
-
- res.Messages.AssertEqual(
- );
- }
-
- [TestMethod]
- public void ToListObservable_Never()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable<int>(
- );
-
- var res = scheduler.Start(() =>
- xs.ToListObservable()
- );
-
- res.Messages.AssertEqual(
- );
- }
-
- #endregion
- }
-}
diff --git a/Rx.NET/Tests.System.Reactive/Tests/ObservableExtensionsTest.cs b/Rx.NET/Tests.System.Reactive/Tests/ObservableExtensionsTest.cs
deleted file mode 100644
index b3f6175..0000000
--- a/Rx.NET/Tests.System.Reactive/Tests/ObservableExtensionsTest.cs
+++ /dev/null
@@ -1,116 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System;
-using System.Reactive.Concurrency;
-using System.Reactive.Linq;
-using Microsoft.Reactive.Testing;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-
-namespace ReactiveTests.Tests
-{
- [TestClass]
- public partial class ObservableExtensionsTest : ReactiveTest
- {
- #region Subscribe
-
- [TestMethod]
- public void Subscribe_ArgumentChecking()
- {
- var someObservable = Observable.Empty<int>();
-
- ReactiveAssert.Throws<ArgumentNullException>(() => ObservableExtensions.Subscribe<int>(default(IObservable<int>)));
-
- ReactiveAssert.Throws<ArgumentNullException>(() => ObservableExtensions.Subscribe<int>(default(IObservable<int>), _ => { }));
- ReactiveAssert.Throws<ArgumentNullException>(() => ObservableExtensions.Subscribe<int>(someObservable, default(Action<int>)));
-
- ReactiveAssert.Throws<ArgumentNullException>(() => ObservableExtensions.Subscribe<int>(default(IObservable<int>), _ => { }, () => { }));
- ReactiveAssert.Throws<ArgumentNullException>(() => ObservableExtensions.Subscribe<int>(someObservable, default(Action<int>), () => { }));
- ReactiveAssert.Throws<ArgumentNullException>(() => ObservableExtensions.Subscribe<int>(someObservable, _ => { }, default(Action)));
-
- ReactiveAssert.Throws<ArgumentNullException>(() => ObservableExtensions.Subscribe<int>(default(IObservable<int>), _ => { }, (Exception _) => { }));
- ReactiveAssert.Throws<ArgumentNullException>(() => ObservableExtensions.Subscribe<int>(someObservable, default(Action<int>), (Exception _) => { }));
- ReactiveAssert.Throws<ArgumentNullException>(() => ObservableExtensions.Subscribe<int>(someObservable, _ => { }, default(Action<Exception>)));
-
- ReactiveAssert.Throws<ArgumentNullException>(() => ObservableExtensions.Subscribe<int>(default(IObservable<int>), _ => { }, (Exception _) => { }, () => { }));
- ReactiveAssert.Throws<ArgumentNullException>(() => ObservableExtensions.Subscribe<int>(someObservable, default(Action<int>), (Exception _) => { }, () => { }));
- ReactiveAssert.Throws<ArgumentNullException>(() => ObservableExtensions.Subscribe<int>(someObservable, _ => { }, default(Action<Exception>), () => { }));
- ReactiveAssert.Throws<ArgumentNullException>(() => ObservableExtensions.Subscribe<int>(someObservable, _ => { }, (Exception _) => { }, default(Action)));
- }
-
- [TestMethod]
- public void Subscribe_None_Return()
- {
- Observable.Return(1, Scheduler.Immediate).Subscribe();
- }
-
- [TestMethod]
- public void Subscribe_None_Throw()
- {
- var ex = new Exception();
-
- var xs = Observable.Throw<int>(ex, Scheduler.Immediate);
-
- ReactiveAssert.Throws(ex, () => xs.Subscribe());
- }
-
- [TestMethod]
- public void Subscribe_None_Empty()
- {
- Observable.Empty<int>(Scheduler.Immediate).Subscribe((int _) => { Assert.Fail(); });
- }
-
- [TestMethod]
- public void Subscribe_OnNext_Return()
- {
- int _x = -1;
- Observable.Return(42, Scheduler.Immediate).Subscribe((int x) => { _x = x; });
- Assert.AreEqual(42, _x);
- }
-
- [TestMethod]
- public void Subscribe_OnNext_Throw()
- {
- var ex = new Exception();
-
- var xs = Observable.Throw<int>(ex, Scheduler.Immediate);
-
- ReactiveAssert.Throws(ex, () => xs.Subscribe(_ => { Assert.Fail(); }));
- }
-
- [TestMethod]
- public void Subscribe_OnNext_Empty()
- {
- Observable.Empty<int>(Scheduler.Immediate).Subscribe((int _) => { Assert.Fail(); });
- }
-
- [TestMethod]
- public void Subscribe_OnNextOnCompleted_Return()
- {
- bool finished = false;
- int _x = -1;
- Observable.Return(42, Scheduler.Immediate).Subscribe((int x) => { _x = x; }, () => { finished = true; });
- Assert.AreEqual(42, _x);
- Assert.IsTrue(finished);
- }
-
- [TestMethod]
- public void Subscribe_OnNextOnCompleted_Throw()
- {
- var ex = new Exception();
-
- var xs = Observable.Throw<int>(ex, Scheduler.Immediate);
-
- ReactiveAssert.Throws(ex, () => xs.Subscribe(_ => { Assert.Fail(); }, () => { Assert.Fail(); }));
- }
-
- [TestMethod]
- public void Subscribe_OnNextOnCompleted_Empty()
- {
- bool finished = false;
- Observable.Empty<int>(Scheduler.Immediate).Subscribe((int _) => { Assert.Fail(); }, () => { finished = true; });
- Assert.IsTrue(finished);
- }
-
- #endregion
- }
-}
diff --git a/Rx.NET/Tests.System.Reactive/Tests/ObservableImperativeTest.cs b/Rx.NET/Tests.System.Reactive/Tests/ObservableImperativeTest.cs
deleted file mode 100644
index 00f03c8..0000000
--- a/Rx.NET/Tests.System.Reactive/Tests/ObservableImperativeTest.cs
+++ /dev/null
@@ -1,1747 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Reactive.Concurrency;
-using System.Reactive.Disposables;
-using System.Reactive.Linq;
-using System.Threading;
-using Microsoft.Reactive.Testing;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using ReactiveTests.Dummies;
-
-#if !NO_TPL
-using System.Threading.Tasks;
-#endif
-
-namespace ReactiveTests.Tests
-{
- [TestClass]
- public partial class ObservableImperativeTest : ReactiveTest
- {
- #region ForEachAsync
-
-#if !NO_TPL
- [TestMethod]
- public void ForEachAsync_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ForEachAsync(default(IObservable<int>), x => { }));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ForEachAsync(Observable.Never<int>(), default(Action<int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ForEachAsync(default(IObservable<int>), x => { }, CancellationToken.None));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ForEachAsync(Observable.Never<int>(), default(Action<int>), CancellationToken.None));
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ForEachAsync(default(IObservable<int>), (x, i) => { }));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ForEachAsync(Observable.Never<int>(), default(Action<int, int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ForEachAsync(default(IObservable<int>), (x, i) => { }, CancellationToken.None));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ForEachAsync(Observable.Never<int>(), default(Action<int, int>), CancellationToken.None));
- }
-
- [TestMethod]
- public void ForEachAsync_Never()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(100, 1),
- OnNext(200, 2),
- OnNext(300, 3),
- OnNext(400, 4),
- OnNext(500, 5)
- );
-
- var task = default(Task);
- var cts = new CancellationTokenSource();
- var list = new List<Recorded<int>>();
-
- scheduler.ScheduleAbsolute(150, () => task = xs.ForEachAsync(x => list.Add(new Recorded<int>(scheduler.Clock, x)), cts.Token));
-
- scheduler.Start();
-
- xs.Subscriptions.AssertEqual(
- Subscribe(150)
- );
-
- list.AssertEqual(
- new Recorded<int>(200, 2),
- new Recorded<int>(300, 3),
- new Recorded<int>(400, 4),
- new Recorded<int>(500, 5)
- );
-
- Assert.AreEqual(TaskStatus.WaitingForActivation, task.Status);
- }
-
- [TestMethod]
- public void ForEachAsync_Completed()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(100, 1),
- OnNext(200, 2),
- OnNext(300, 3),
- OnNext(400, 4),
- OnNext(500, 5),
- OnCompleted<int>(600)
- );
-
- var task = default(Task);
- var cts = new CancellationTokenSource();
- var list = new List<Recorded<int>>();
-
- scheduler.ScheduleAbsolute(150, () => task = xs.ForEachAsync(x => list.Add(new Recorded<int>(scheduler.Clock, x)), cts.Token));
-
- scheduler.Start();
-
- xs.Subscriptions.AssertEqual(
- Subscribe(150, 600)
- );
-
- list.AssertEqual(
- new Recorded<int>(200, 2),
- new Recorded<int>(300, 3),
- new Recorded<int>(400, 4),
- new Recorded<int>(500, 5)
- );
-
- Assert.AreEqual(TaskStatus.RanToCompletion, task.Status);
- }
-
- [TestMethod]
- public void ForEachAsync_Error()
- {
- var scheduler = new TestScheduler();
-
- var exception = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(100, 1),
- OnNext(200, 2),
- OnNext(300, 3),
- OnNext(400, 4),
- OnNext(500, 5),
- OnError<int>(600, exception)
- );
-
- var task = default(Task);
- var cts = new CancellationTokenSource();
- var list = new List<Recorded<int>>();
-
- scheduler.ScheduleAbsolute(150, () => task = xs.ForEachAsync(x => list.Add(new Recorded<int>(scheduler.Clock, x)), cts.Token));
-
- scheduler.Start();
-
- xs.Subscriptions.AssertEqual(
- Subscribe(150, 600)
- );
-
- list.AssertEqual(
- new Recorded<int>(200, 2),
- new Recorded<int>(300, 3),
- new Recorded<int>(400, 4),
- new Recorded<int>(500, 5)
- );
-
- Assert.AreEqual(TaskStatus.Faulted, task.Status);
- Assert.AreSame(exception, task.Exception.InnerException);
- }
-
- [TestMethod]
- public void ForEachAsync_Throw()
- {
- var scheduler = new TestScheduler();
-
- var exception = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(100, 1),
- OnNext(200, 2),
- OnNext(300, 3),
- OnNext(400, 4),
- OnNext(500, 5),
- OnCompleted<int>(600)
- );
-
- var task = default(Task);
- var cts = new CancellationTokenSource();
- var list = new List<Recorded<int>>();
-
- scheduler.ScheduleAbsolute(150, () => task = xs.ForEachAsync(x =>
- {
- if (scheduler.Clock > 400)
- throw exception;
- list.Add(new Recorded<int>(scheduler.Clock, x));
- }, cts.Token));
-
- scheduler.Start();
-
- xs.Subscriptions.AssertEqual(
- Subscribe(150, 500)
- );
-
- list.AssertEqual(
- new Recorded<int>(200, 2),
- new Recorded<int>(300, 3),
- new Recorded<int>(400, 4)
- );
-
- Assert.AreEqual(TaskStatus.Faulted, task.Status);
- Assert.AreSame(exception, task.Exception.InnerException);
- }
-
- [TestMethod]
- public void ForEachAsync_CancelDuring()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(100, 1),
- OnNext(200, 2),
- OnNext(300, 3),
- OnNext(400, 4),
- OnNext(500, 5),
- OnCompleted<int>(600)
- );
-
- var task = default(Task);
- var cts = new CancellationTokenSource();
- var list = new List<Recorded<int>>();
-
- scheduler.ScheduleAbsolute(150, () => task = xs.ForEachAsync(x => list.Add(new Recorded<int>(scheduler.Clock, x)), cts.Token));
- scheduler.ScheduleAbsolute(350, () => cts.Cancel());
-
- scheduler.Start();
-
- xs.Subscriptions.AssertEqual(
- Subscribe(150, 350)
- );
-
- list.AssertEqual(
- new Recorded<int>(200, 2),
- new Recorded<int>(300, 3)
- );
-
- Assert.AreEqual(TaskStatus.Canceled, task.Status);
- }
-
- [TestMethod]
- public void ForEachAsync_CancelBefore()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(100, 1),
- OnNext(200, 2),
- OnNext(300, 3),
- OnNext(400, 4),
- OnNext(500, 5),
- OnCompleted<int>(600)
- );
-
- var task = default(Task);
- var cts = new CancellationTokenSource();
- var list = new List<Recorded<int>>();
-
- cts.Cancel();
-
- scheduler.ScheduleAbsolute(150, () => task = xs.ForEachAsync(x => list.Add(new Recorded<int>(scheduler.Clock, x)), cts.Token));
-
- scheduler.Start();
-
- xs.Subscriptions.AssertEqual(
- );
-
- list.AssertEqual(
- );
-
- Assert.AreEqual(TaskStatus.Canceled, task.Status);
- }
-
- [TestMethod]
- public void ForEachAsync_CancelAfter()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(100, 1),
- OnNext(200, 2),
- OnNext(300, 3),
- OnNext(400, 4),
- OnNext(500, 5),
- OnCompleted<int>(600)
- );
-
- var task = default(Task);
- var cts = new CancellationTokenSource();
- var list = new List<Recorded<int>>();
-
- scheduler.ScheduleAbsolute(150, () => task = xs.ForEachAsync(x => list.Add(new Recorded<int>(scheduler.Clock, x)), cts.Token));
- scheduler.ScheduleAbsolute(700, () => cts.Cancel());
-
- scheduler.Start();
-
- xs.Subscriptions.AssertEqual(
- Subscribe(150, 600)
- );
-
- list.AssertEqual(
- new Recorded<int>(200, 2),
- new Recorded<int>(300, 3),
- new Recorded<int>(400, 4),
- new Recorded<int>(500, 5)
- );
-
- Assert.AreEqual(TaskStatus.RanToCompletion, task.Status);
- }
-
- [TestMethod]
- public void ForEachAsync_Default()
- {
- var list = new List<int>();
- Observable.Range(1, 10).ForEachAsync(list.Add).Wait();
- list.AssertEqual(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
- }
-
- [TestMethod]
- public void ForEachAsync_Index()
- {
- var list = new List<int>();
- Observable.Range(3, 5).ForEachAsync((x, i) => list.Add(x * i)).Wait();
- list.AssertEqual(3 * 0, 4 * 1, 5 * 2, 6 * 3, 7 * 4);
- }
-
- [TestMethod]
- public void ForEachAsync_Default_Cancel()
- {
- var N = 10;
-
- for (int n = 0; n < N; n++)
- {
- var cts = new CancellationTokenSource();
- var done = false;
-
- var xs = Observable.Create<int>(observer =>
- {
- return new CompositeDisposable(
- Observable.Repeat(42, Scheduler.Default).Subscribe(observer),
- Disposable.Create(() => done = true)
- );
- });
-
- var lst = new List<int>();
-
- var t = xs.ForEachAsync(
- x =>
- {
- lock (lst)
- lst.Add(x);
- },
- cts.Token
- );
-
- while (true)
- {
- lock (lst)
- if (lst.Count >= 10)
- break;
- }
-
- cts.Cancel();
-
- while (!t.IsCompleted)
- ;
-
- for (int i = 0; i < 10; i++)
- Assert.AreEqual(42, lst[i]);
-
- Assert.IsTrue(done);
- Assert.IsTrue(t.IsCanceled);
- }
- }
-
- [TestMethod]
- public void ForEachAsync_Index_Cancel()
- {
- var N = 10;
-
- for (int n = 0; n < N; n++)
- {
- var cts = new CancellationTokenSource();
- var done = false;
-
- var xs = Observable.Create<int>(observer =>
- {
- return new CompositeDisposable(
- Observable.Repeat(42, Scheduler.Default).Subscribe(observer),
- Disposable.Create(() => done = true)
- );
- });
-
- var lst = new List<int>();
-
- var t = xs.ForEachAsync(
- (x, i) =>
- {
- lock (lst)
- lst.Add(x * i);
- },
- cts.Token
- );
-
- while (true)
- {
- lock (lst)
- if (lst.Count >= 10)
- break;
- }
-
- cts.Cancel();
-
- while (!t.IsCompleted)
- ;
-
- for (int i = 0; i < 10; i++)
- Assert.AreEqual(i * 42, lst[i]);
-
- Assert.IsTrue(done);
- Assert.IsTrue(t.IsCanceled);
- }
- }
-
- [TestMethod]
- [Ignore]
- public void ForEachAsync_DisposeThrows()
- {
- var cts = new CancellationTokenSource();
- var ex = new Exception();
-
- var xs = Observable.Create<int>(observer =>
- {
- return new CompositeDisposable(
- Observable.Range(0, 10, Scheduler.Default).Subscribe(observer),
- Disposable.Create(() => { throw ex; })
- );
- });
-
- var lst = new List<int>();
- var t = xs.ForEachAsync(lst.Add, cts.Token);
-
- try
- {
- t.Wait();
- Assert.Fail();
- }
- catch (AggregateException err)
- {
- Assert.AreEqual(1, err.InnerExceptions.Count);
- Assert.AreSame(ex, err.InnerExceptions[0]);
- }
- }
-
- [TestMethod]
- public void ForEachAsync_SubscribeThrows()
- {
- var ex = new Exception();
-
- var x = 42;
- var xs = Observable.Create<int>(observer =>
- {
- if (x == 42)
- throw ex;
- return Disposable.Empty;
- });
-
- var t = xs.ForEachAsync(_ => { });
-
- try
- {
- t.Wait();
- Assert.Fail();
- }
- catch (AggregateException err)
- {
- Assert.AreEqual(1, err.InnerExceptions.Count);
- Assert.AreSame(ex, err.InnerExceptions[0]);
- }
- }
-#endif
-
- #endregion
-
- #region + Case +
-
- [TestMethod]
- public void Case_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Case(null, new Dictionary<int, IObservable<int>>(), DummyObservable<int>.Instance));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Case(DummyFunc<int>.Instance, null, DummyObservable<int>.Instance));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Case(DummyFunc<int>.Instance, new Dictionary<int, IObservable<int>>(), default(IObservable<int>)));
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Case(null, new Dictionary<int, IObservable<int>>(), DummyScheduler.Instance));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Case<int, int>(DummyFunc<int>.Instance, null, DummyScheduler.Instance));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Case(DummyFunc<int>.Instance, new Dictionary<int, IObservable<int>>(), default(IScheduler)));
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Case(null, new Dictionary<int, IObservable<int>>()));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Case<int, int>(DummyFunc<int>.Instance, null));
- }
-
- [TestMethod]
- public void Case_One()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(210, 1),
- OnNext(240, 2),
- OnNext(270, 3),
- OnCompleted<int>(300)
- );
-
- var ys = scheduler.CreateHotObservable(
- OnNext(220, 11),
- OnNext(250, 12),
- OnNext(280, 13),
- OnCompleted<int>(310)
- );
-
- var zs = scheduler.CreateHotObservable(
- OnNext(230, 21),
- OnNext(240, 22),
- OnNext(290, 23),
- OnCompleted<int>(320)
- );
-
- var map = new Dictionary<int, IObservable<int>>
- {
- { 1, xs },
- { 2, ys }
- };
-
- var results = scheduler.Start(() => Observable.Case(() => 1, map, zs));
-
- results.Messages.AssertEqual(
- OnNext(210, 1),
- OnNext(240, 2),
- OnNext(270, 3),
- OnCompleted<int>(300)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 300)
- );
-
- ys.Subscriptions.AssertEqual(
- );
-
- zs.Subscriptions.AssertEqual(
- );
- }
-
- [TestMethod]
- public void Case_Two()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(210, 1),
- OnNext(240, 2),
- OnNext(270, 3),
- OnCompleted<int>(300)
- );
-
- var ys = scheduler.CreateHotObservable(
- OnNext(220, 11),
- OnNext(250, 12),
- OnNext(280, 13),
- OnCompleted<int>(310)
- );
-
- var zs = scheduler.CreateHotObservable(
- OnNext(230, 21),
- OnNext(240, 22),
- OnNext(290, 23),
- OnCompleted<int>(320)
- );
-
- var map = new Dictionary<int, IObservable<int>>
- {
- { 1, xs },
- { 2, ys }
- };
-
- var results = scheduler.Start(() => Observable.Case(() => 2, map, zs));
-
- results.Messages.AssertEqual(
- OnNext(220, 11),
- OnNext(250, 12),
- OnNext(280, 13),
- OnCompleted<int>(310)
- );
-
- xs.Subscriptions.AssertEqual(
- );
-
- ys.Subscriptions.AssertEqual(
- Subscribe(200, 310)
- );
-
- zs.Subscriptions.AssertEqual(
- );
- }
-
- [TestMethod]
- public void Case_Three()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(210, 1),
- OnNext(240, 2),
- OnNext(270, 3),
- OnCompleted<int>(300)
- );
-
- var ys = scheduler.CreateHotObservable(
- OnNext(220, 11),
- OnNext(250, 12),
- OnNext(280, 13),
- OnCompleted<int>(310)
- );
-
- var zs = scheduler.CreateHotObservable(
- OnNext(230, 21),
- OnNext(240, 22),
- OnNext(290, 23),
- OnCompleted<int>(320)
- );
-
- var map = new Dictionary<int, IObservable<int>>
- {
- { 1, xs },
- { 2, ys }
- };
-
- var results = scheduler.Start(() => Observable.Case(() => 3, map, zs));
-
- results.Messages.AssertEqual(
- OnNext(230, 21),
- OnNext(240, 22),
- OnNext(290, 23),
- OnCompleted<int>(320)
- );
-
- xs.Subscriptions.AssertEqual(
- );
-
- ys.Subscriptions.AssertEqual(
- );
-
- zs.Subscriptions.AssertEqual(
- Subscribe(200, 320)
- );
- }
-
- [TestMethod]
- public void Case_Throw()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(210, 1),
- OnNext(240, 2),
- OnNext(270, 3),
- OnCompleted<int>(300)
- );
-
- var ys = scheduler.CreateHotObservable(
- OnNext(220, 11),
- OnNext(250, 12),
- OnNext(280, 13),
- OnCompleted<int>(310)
- );
-
- var zs = scheduler.CreateHotObservable(
- OnNext(230, 21),
- OnNext(240, 22),
- OnNext(290, 23),
- OnCompleted<int>(320)
- );
-
- var map = new Dictionary<int, IObservable<int>>
- {
- { 1, xs },
- { 2, ys }
- };
-
- var ex = new Exception();
-
- var results = scheduler.Start(() => Observable.Case(() => Throw<int>(ex), map, zs));
-
- results.Messages.AssertEqual(
- OnError<int>(200, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- );
-
- ys.Subscriptions.AssertEqual(
- );
-
- zs.Subscriptions.AssertEqual(
- );
- }
-
- [TestMethod]
- public void CaseWithDefault_One()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(210, 1),
- OnNext(240, 2),
- OnNext(270, 3),
- OnCompleted<int>(300)
- );
-
- var ys = scheduler.CreateHotObservable(
- OnNext(220, 11),
- OnNext(250, 12),
- OnNext(280, 13),
- OnCompleted<int>(310)
- );
-
- var map = new Dictionary<int, IObservable<int>>
- {
- { 1, xs },
- { 2, ys }
- };
-
- var results = scheduler.Start(() => Observable.Case(() => 1, map, scheduler));
-
- results.Messages.AssertEqual(
- OnNext(210, 1),
- OnNext(240, 2),
- OnNext(270, 3),
- OnCompleted<int>(300)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 300)
- );
-
- ys.Subscriptions.AssertEqual(
- );
- }
-
- [TestMethod]
- public void CaseWithDefault_Two()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(210, 1),
- OnNext(240, 2),
- OnNext(270, 3),
- OnCompleted<int>(300)
- );
-
- var ys = scheduler.CreateHotObservable(
- OnNext(220, 11),
- OnNext(250, 12),
- OnNext(280, 13),
- OnCompleted<int>(310)
- );
-
- var map = new Dictionary<int, IObservable<int>>
- {
- { 1, xs },
- { 2, ys }
- };
-
- var results = scheduler.Start(() => Observable.Case(() => 2, map, scheduler));
-
- results.Messages.AssertEqual(
- OnNext(220, 11),
- OnNext(250, 12),
- OnNext(280, 13),
- OnCompleted<int>(310)
- );
-
- xs.Subscriptions.AssertEqual(
- );
-
- ys.Subscriptions.AssertEqual(
- Subscribe(200, 310)
- );
- }
-
- [TestMethod]
- public void CaseWithDefault_Three()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(210, 1),
- OnNext(240, 2),
- OnNext(270, 3),
- OnCompleted<int>(300)
- );
-
- var ys = scheduler.CreateHotObservable(
- OnNext(220, 11),
- OnNext(250, 12),
- OnNext(280, 13),
- OnCompleted<int>(310)
- );
-
- var map = new Dictionary<int, IObservable<int>>
- {
- { 1, xs },
- { 2, ys }
- };
-
- var results = scheduler.Start(() => Observable.Case(() => 3, map, scheduler));
-
- results.Messages.AssertEqual(
- OnCompleted<int>(201)
- );
-
- xs.Subscriptions.AssertEqual(
- );
-
- ys.Subscriptions.AssertEqual(
- );
- }
-
- [TestMethod]
- public void CaseWithDefault_Throw()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(210, 1),
- OnNext(240, 2),
- OnNext(270, 3),
- OnCompleted<int>(300)
- );
-
- var ys = scheduler.CreateHotObservable(
- OnNext(220, 11),
- OnNext(250, 12),
- OnNext(280, 13),
- OnCompleted<int>(310)
- );
-
- var map = new Dictionary<int, IObservable<int>>
- {
- { 1, xs },
- { 2, ys }
- };
-
- var ex = new Exception();
-
- var results = scheduler.Start(() => Observable.Case(() => Throw<int>(ex), map, scheduler));
-
- results.Messages.AssertEqual(
- OnError<int>(200, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- );
-
- ys.Subscriptions.AssertEqual(
- );
- }
-
- [TestMethod]
- public void CaseWithDefault_CheckDefault()
- {
- Observable.Case(() => 1, new Dictionary<int, IObservable<int>>(), DefaultScheduler.Instance)
- .AssertEqual(Observable.Case(() => 1, new Dictionary<int, IObservable<int>>()));
- }
-
- [TestMethod]
- public void Case_Error()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(210, 1),
- OnNext(240, 2),
- OnNext(270, 3),
- OnError<int>(300, ex)
- );
-
- var ys = scheduler.CreateHotObservable(
- OnNext(220, 11),
- OnNext(250, 12),
- OnNext(280, 13),
- OnCompleted<int>(310)
- );
-
- var map = new Dictionary<int, IObservable<int>>
- {
- { 1, xs },
- { 2, ys }
- };
-
- var results = scheduler.Start(() => Observable.Case(() => 1, map, scheduler));
-
- results.Messages.AssertEqual(
- OnNext(210, 1),
- OnNext(240, 2),
- OnNext(270, 3),
- OnError<int>(300, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 300)
- );
-
- ys.Subscriptions.AssertEqual(
- );
- }
-
- #endregion
-
- #region + DoWhile +
-
- [TestMethod]
- public void DoWhile_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.DoWhile(DummyObservable<int>.Instance, null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.DoWhile(default(IObservable<int>), DummyFunc<bool>.Instance));
- }
-
- [TestMethod]
- public void DoWhile_AlwaysFalse()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateColdObservable(
- OnNext(50, 1),
- OnNext(100, 2),
- OnNext(150, 3),
- OnNext(200, 4),
- OnCompleted<int>(250)
- );
-
- var results = scheduler.Start(() => Observable.DoWhile(xs, () => false));
-
- results.Messages.AssertEqual(
- OnNext(250, 1),
- OnNext(300, 2),
- OnNext(350, 3),
- OnNext(400, 4),
- OnCompleted<int>(450)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 450)
- );
- }
-
- [TestMethod]
- public void DoWhile_AlwaysTrue()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateColdObservable(
- OnNext(50, 1),
- OnNext(100, 2),
- OnNext(150, 3),
- OnNext(200, 4),
- OnCompleted<int>(250)
- );
-
- var results = scheduler.Start(() => Observable.DoWhile(xs, () => true));
-
- results.Messages.AssertEqual(
- OnNext(250, 1),
- OnNext(300, 2),
- OnNext(350, 3),
- OnNext(400, 4),
- OnNext(500, 1),
- OnNext(550, 2),
- OnNext(600, 3),
- OnNext(650, 4),
- OnNext(750, 1),
- OnNext(800, 2),
- OnNext(850, 3),
- OnNext(900, 4)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 450),
- Subscribe(450, 700),
- Subscribe(700, 950),
- Subscribe(950, 1000)
- );
- }
-
- [TestMethod]
- public void DoWhile_AlwaysTrue_Throw()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateColdObservable(
- OnError<int>(50, ex)
- );
-
- var results = scheduler.Start(() => Observable.DoWhile(xs, () => true));
-
- results.Messages.AssertEqual(
- OnError<int>(250, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void DoWhile_AlwaysTrue_Infinite()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateColdObservable(
- OnNext(50, 1)
- );
-
- var results = scheduler.Start(() => Observable.DoWhile(xs, () => true));
-
- results.Messages.AssertEqual(
- OnNext(250, 1)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
- }
-
- [TestMethod]
- public void DoWhile_SometimesTrue()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateColdObservable(
- OnNext(50, 1),
- OnNext(100, 2),
- OnNext(150, 3),
- OnNext(200, 4),
- OnCompleted<int>(250)
- );
-
- int n = 0;
-
- var results = scheduler.Start(() => Observable.DoWhile(xs, () => ++n < 3));
-
- results.Messages.AssertEqual(
- OnNext(250, 1),
- OnNext(300, 2),
- OnNext(350, 3),
- OnNext(400, 4),
- OnNext(500, 1),
- OnNext(550, 2),
- OnNext(600, 3),
- OnNext(650, 4),
- OnNext(750, 1),
- OnNext(800, 2),
- OnNext(850, 3),
- OnNext(900, 4),
- OnCompleted<int>(950)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 450),
- Subscribe(450, 700),
- Subscribe(700, 950)
- );
- }
-
- [TestMethod]
- public void DoWhile_SometimesThrows()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateColdObservable(
- OnNext(50, 1),
- OnNext(100, 2),
- OnNext(150, 3),
- OnNext(200, 4),
- OnCompleted<int>(250)
- );
-
- int n = 0;
-
- var ex = new Exception();
-
- var results = scheduler.Start(() => Observable.DoWhile(xs, () => ++n < 3 ? true : Throw<bool>(ex)));
-
- results.Messages.AssertEqual(
- OnNext(250, 1),
- OnNext(300, 2),
- OnNext(350, 3),
- OnNext(400, 4),
- OnNext(500, 1),
- OnNext(550, 2),
- OnNext(600, 3),
- OnNext(650, 4),
- OnNext(750, 1),
- OnNext(800, 2),
- OnNext(850, 3),
- OnNext(900, 4),
- OnError<int>(950, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 450),
- Subscribe(450, 700),
- Subscribe(700, 950)
- );
- }
-
- #endregion
-
- #region + For +
-
- [TestMethod]
- public void For_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.For(DummyEnumerable<int>.Instance, default(Func<int, IObservable<int>>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.For(null, DummyFunc<int, IObservable<int>>.Instance));
- }
-
- [TestMethod]
- public void For_Basic()
- {
- var scheduler = new TestScheduler();
-
- var results = scheduler.Start(() => Observable.For(new[] { 1, 2, 3 }, x => scheduler.CreateColdObservable(
- OnNext<int>((ushort)(x * 100 + 10), x * 10 + 1),
- OnNext<int>((ushort)(x * 100 + 20), x * 10 + 2),
- OnNext<int>((ushort)(x * 100 + 30), x * 10 + 3),
- OnCompleted<int>((ushort)(x * 100 + 40)))));
-
- results.Messages.AssertEqual(
- OnNext(310, 11),
- OnNext(320, 12),
- OnNext(330, 13),
- OnNext(550, 21),
- OnNext(560, 22),
- OnNext(570, 23),
- OnNext(890, 31),
- OnNext(900, 32),
- OnNext(910, 33),
- OnCompleted<int>(920)
- );
- }
-
- IEnumerable<int> For_Error_Core(Exception ex)
- {
- yield return 1;
- yield return 2;
- yield return 3;
- throw ex;
- }
-
- [TestMethod]
- public void For_Error_Iterator()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var results = scheduler.Start(() => Observable.For(For_Error_Core(ex), x => scheduler.CreateColdObservable(
- OnNext<int>((ushort)(x * 100 + 10), x * 10 + 1),
- OnNext<int>((ushort)(x * 100 + 20), x * 10 + 2),
- OnNext<int>((ushort)(x * 100 + 30), x * 10 + 3),
- OnCompleted<int>((ushort)(x * 100 + 40)))));
-
- results.Messages.AssertEqual(
- OnNext(310, 11),
- OnNext(320, 12),
- OnNext(330, 13),
- OnNext(550, 21),
- OnNext(560, 22),
- OnNext(570, 23),
- OnNext(890, 31),
- OnNext(900, 32),
- OnNext(910, 33),
- OnError<int>(920, ex)
- );
- }
-
- [TestMethod]
- public void For_Error_Source()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var results = scheduler.Start(() => Observable.For(new[] { 1, 2, 3 }, x => Observable.Throw<int>(ex)));
-
- results.Messages.AssertEqual(
- OnError<int>(200, ex)
- );
- }
-
- [TestMethod]
- public void For_SelectorThrows()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var results = scheduler.Start(() => Observable.For(new[] { 1, 2, 3 }, x => Throw<IObservable<int>>(ex)));
-
- results.Messages.AssertEqual(
- OnError<int>(200, ex)
- );
- }
-
- #endregion
-
- #region + If +
-
- [TestMethod]
- public void If_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.If(null, DummyObservable<int>.Instance, DummyObservable<int>.Instance));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.If(DummyFunc<bool>.Instance, null, DummyObservable<int>.Instance));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.If(DummyFunc<bool>.Instance, DummyObservable<int>.Instance, default(IObservable<int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.If(null, DummyObservable<int>.Instance, Scheduler.Default));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.If(DummyFunc<bool>.Instance, default(IObservable<int>), Scheduler.Default));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.If(DummyFunc<bool>.Instance, DummyObservable<int>.Instance, default(IScheduler)));
- }
-
- [TestMethod]
- public void If_True()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(210, 1),
- OnNext(250, 2),
- OnCompleted<int>(300)
- );
-
- var ys = scheduler.CreateHotObservable(
- OnNext(310, 3),
- OnNext(350, 4),
- OnCompleted<int>(400)
- );
-
- var results = scheduler.Start(() => Observable.If(() => true, xs, ys));
-
- results.Messages.AssertEqual(
- OnNext(210, 1),
- OnNext(250, 2),
- OnCompleted<int>(300)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 300)
- );
-
- ys.Subscriptions.AssertEqual(
- );
- }
-
- [TestMethod]
- public void If_False()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(210, 1),
- OnNext(250, 2),
- OnCompleted<int>(300)
- );
-
- var ys = scheduler.CreateHotObservable(
- OnNext(310, 3),
- OnNext(350, 4),
- OnCompleted<int>(400)
- );
-
- var results = scheduler.Start(() => Observable.If(() => false, xs, ys));
-
- results.Messages.AssertEqual(
- OnNext(310, 3),
- OnNext(350, 4),
- OnCompleted<int>(400)
- );
-
- xs.Subscriptions.AssertEqual(
- );
-
- ys.Subscriptions.AssertEqual(
- Subscribe(200, 400)
- );
- }
-
- [TestMethod]
- public void If_Throw()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(210, 1),
- OnNext(250, 2),
- OnCompleted<int>(300)
- );
-
- var ys = scheduler.CreateHotObservable(
- OnNext(310, 3),
- OnNext(350, 4),
- OnCompleted<int>(400)
- );
-
- var ex = new Exception();
-
- var results = scheduler.Start(() => Observable.If(() => Throw<bool>(ex), xs, ys));
-
- results.Messages.AssertEqual(
- OnError<int>(200, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- );
-
- ys.Subscriptions.AssertEqual(
- );
- }
-
- [TestMethod]
- public void If_Dispose()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(210, 1),
- OnNext(250, 2)
- );
-
- var ys = scheduler.CreateHotObservable(
- OnNext(310, 3),
- OnNext(350, 4),
- OnCompleted<int>(400)
- );
-
- var results = scheduler.Start(() => Observable.If(() => true, xs, ys));
-
- results.Messages.AssertEqual(
- OnNext(210, 1),
- OnNext(250, 2)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
-
- ys.Subscriptions.AssertEqual(
- );
- }
-
- [TestMethod]
- public void If_Default_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.If<int>(null, DummyObservable<int>.Instance));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.If<int>(DummyFunc<bool>.Instance, null));
- }
-
- [TestMethod]
- public void If_Default_Completed()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(110, 1),
- OnNext(220, 2),
- OnNext(330, 3),
- OnCompleted<int>(440)
- );
-
- var b = false;
-
- scheduler.ScheduleAbsolute(150, () => b = true);
-
- var results = scheduler.Start(() => Observable.If(() => b, xs));
-
- results.Messages.AssertEqual(
- OnNext(220, 2),
- OnNext(330, 3),
- OnCompleted<int>(440)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 440)
- );
- }
-
- [TestMethod]
- public void If_Default_Error()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(110, 1),
- OnNext(220, 2),
- OnNext(330, 3),
- OnError<int>(440, ex)
- );
-
- var b = false;
-
- scheduler.ScheduleAbsolute(150, () => b = true);
-
- var results = scheduler.Start(() => Observable.If(() => b, xs));
-
- results.Messages.AssertEqual(
- OnNext(220, 2),
- OnNext(330, 3),
- OnError<int>(440, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 440)
- );
- }
-
- [TestMethod]
- public void If_Default_Never()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(110, 1),
- OnNext(220, 2),
- OnNext(330, 3)
- );
-
- var b = false;
-
- scheduler.ScheduleAbsolute(150, () => b = true);
-
- var results = scheduler.Start(() => Observable.If(() => b, xs));
-
- results.Messages.AssertEqual(
- OnNext(220, 2),
- OnNext(330, 3)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
- }
-
- [TestMethod]
- public void If_Default_Other()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(110, 1),
- OnNext(220, 2),
- OnNext(330, 3),
- OnError<int>(440, new Exception())
- );
-
- var b = true;
-
- scheduler.ScheduleAbsolute(150, () => b = false);
-
- var results = scheduler.Start(() => Observable.If(() => b, xs));
-
- results.Messages.AssertEqual(
- OnCompleted<int>(200)
- );
-
- xs.Subscriptions.AssertEqual(
- );
- }
-
- [TestMethod]
- public void If_Default_Scheduler()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(110, 1),
- OnNext(220, 2),
- OnNext(330, 3),
- OnError<int>(440, new Exception())
- );
-
- var results = scheduler.Start(() => Observable.If(() => false, xs, scheduler));
-
- results.Messages.AssertEqual(
- OnCompleted<int>(201)
- );
-
- xs.Subscriptions.AssertEqual(
- );
- }
-
- #endregion
-
- #region + While +
-
- [TestMethod]
- public void While_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.While(default(Func<bool>), DummyObservable<int>.Instance));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.While(DummyFunc<bool>.Instance, default(IObservable<int>)));
- }
-
- [TestMethod]
- public void While_AlwaysFalse()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateColdObservable(
- OnNext(50, 1),
- OnNext(100, 2),
- OnNext(150, 3),
- OnNext(200, 4),
- OnCompleted<int>(250)
- );
-
- var results = scheduler.Start(() => Observable.While(() => false, xs));
-
- results.Messages.AssertEqual(
- OnCompleted<int>(200)
- );
-
- xs.Subscriptions.AssertEqual(
- );
- }
-
- [TestMethod]
- public void While_AlwaysTrue()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateColdObservable(
- OnNext(50, 1),
- OnNext(100, 2),
- OnNext(150, 3),
- OnNext(200, 4),
- OnCompleted<int>(250)
- );
-
- var results = scheduler.Start(() => Observable.While(() => true, xs));
-
- results.Messages.AssertEqual(
- OnNext(250, 1),
- OnNext(300, 2),
- OnNext(350, 3),
- OnNext(400, 4),
- OnNext(500, 1),
- OnNext(550, 2),
- OnNext(600, 3),
- OnNext(650, 4),
- OnNext(750, 1),
- OnNext(800, 2),
- OnNext(850, 3),
- OnNext(900, 4)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 450),
- Subscribe(450, 700),
- Subscribe(700, 950),
- Subscribe(950, 1000)
- );
- }
-
- [TestMethod]
- public void While_AlwaysTrue_Throw()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateColdObservable(
- OnError<int>(50, ex)
- );
-
- var results = scheduler.Start(() => Observable.While(() => true, xs));
-
- results.Messages.AssertEqual(
- OnError<int>(250, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void While_AlwaysTrue_Infinite()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateColdObservable(
- OnNext(50, 1)
- );
-
- var results = scheduler.Start(() => Observable.While(() => true, xs));
-
- results.Messages.AssertEqual(
- OnNext(250, 1)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
- }
-
- [TestMethod]
- public void While_SometimesTrue()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateColdObservable(
- OnNext(50, 1),
- OnNext(100, 2),
- OnNext(150, 3),
- OnNext(200, 4),
- OnCompleted<int>(250)
- );
-
- int n = 0;
-
- var results = scheduler.Start(() => Observable.While(() => ++n < 3, xs));
-
- results.Messages.AssertEqual(
- OnNext(250, 1),
- OnNext(300, 2),
- OnNext(350, 3),
- OnNext(400, 4),
- OnNext(500, 1),
- OnNext(550, 2),
- OnNext(600, 3),
- OnNext(650, 4),
- OnCompleted<int>(700)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 450),
- Subscribe(450, 700)
- );
- }
-
- static T Throw<T>(Exception ex)
- {
- throw ex;
- }
-
- [TestMethod]
- public void While_SometimesThrows()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateColdObservable(
- OnNext(50, 1),
- OnNext(100, 2),
- OnNext(150, 3),
- OnNext(200, 4),
- OnCompleted<int>(250)
- );
-
- int n = 0;
-
- var ex = new Exception();
-
- var results = scheduler.Start(() => Observable.While(() => ++n < 3 ? true : Throw<bool>(ex), xs));
-
- results.Messages.AssertEqual(
- OnNext(250, 1),
- OnNext(300, 2),
- OnNext(350, 3),
- OnNext(400, 4),
- OnNext(500, 1),
- OnNext(550, 2),
- OnNext(600, 3),
- OnNext(650, 4),
- OnError<int>(700, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 450),
- Subscribe(450, 700)
- );
- }
-
- #endregion
-
- #region General tests for loops
-
- [TestMethod]
- public void LoopTest1()
- {
- var loop = Observable.Defer(() =>
- {
- var n = 0;
- return Observable.While(
- () => n++ < 5,
- Observable.Defer(() =>
- {
- return Observable.For(
- Enumerable.Range(0, n),
- x => Observable.Return(x)
- );
- })
- );
- });
-
- var res = new List<int>();
- var std = new List<int>();
- loop.ForEach(x =>
- {
- res.Add(x);
- std.Add(new System.Diagnostics.StackTrace().FrameCount);
- });
-
- Assert.IsTrue(res.SequenceEqual(new[] { 0, 0, 1, 0, 1, 2, 0, 1, 2, 3, 0, 1, 2, 3, 4 }));
- Assert.IsTrue(std.Distinct().Count() == 1);
- }
-
- [TestMethod]
- public void LoopTest2()
- {
- var n = 0;
-
- var loop = default(IObservable<int>);
- loop = Observable.While(
- () => n++ < 10,
- Observable.Concat(
- Observable.Return(42),
- Observable.Defer(() => loop)
- )
- );
-
- var res = new List<int>();
- var std = new List<int>();
- loop.ForEach(x =>
- {
- res.Add(x);
- std.Add(new System.Diagnostics.StackTrace().FrameCount);
- });
-
- Assert.IsTrue(res.SequenceEqual(Enumerable.Repeat(42, 10)));
- Assert.IsTrue(std.Distinct().Count() == 1);
- }
-
- #endregion
- }
-}
diff --git a/Rx.NET/Tests.System.Reactive/Tests/ObservableJoinsTest.cs b/Rx.NET/Tests.System.Reactive/Tests/ObservableJoinsTest.cs
deleted file mode 100644
index 59c505c..0000000
--- a/Rx.NET/Tests.System.Reactive/Tests/ObservableJoinsTest.cs
+++ /dev/null
@@ -1,1709 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System;
-using System.Collections.Generic;
-using System.Reactive.Joins;
-using System.Reactive.Linq;
-using Microsoft.Reactive.Testing;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-
-namespace ReactiveTests.Tests
-{
- [TestClass]
- public partial class ObservableWhensTest : ReactiveTest
- {
- #region And
-
- [TestMethod]
- public void And_ArgumentChecking()
- {
- var someObservable = Observable.Return(1);
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.And<int, int>(null, someObservable));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.And<int, int>(someObservable, null));
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.And<int, int>(someObservable, someObservable).And<int>(null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.And<int, int>(someObservable, someObservable).And(someObservable).And<int>(null));
-
-#if !NO_LARGEARITY
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.And<int, int>(someObservable, someObservable).And(someObservable).And(someObservable).And<int>(null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.And<int, int>(someObservable, someObservable).And(someObservable).And(someObservable).And(someObservable).And<int>(null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.And<int, int>(someObservable, someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).And<int>(null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.And<int, int>(someObservable, someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).And<int>(null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.And<int, int>(someObservable, someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).And<int>(null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.And<int, int>(someObservable, someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).And<int>(null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.And<int, int>(someObservable, someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).And<int>(null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.And<int, int>(someObservable, someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).And<int>(null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.And<int, int>(someObservable, someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).And<int>(null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.And<int, int>(someObservable, someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).And<int>(null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.And<int, int>(someObservable, someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).And<int>(null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.And<int, int>(someObservable, someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).And<int>(null));
-#endif
- }
-
- [TestMethod]
- public void And2()
- {
- var scheduler = new TestScheduler();
-
- const int N = 2;
-
- var obs = new List<IObservable<int>>();
- for (int i = 0; i < N; i++)
- {
- obs.Add(scheduler.CreateHotObservable(
- OnNext(210, 1),
- OnCompleted<int>(220)
- ));
- }
-
- var res = scheduler.Start(() =>
- Observable.When(obs[0].And(obs[1]).Then((a, b) => a + b))
- );
-
- res.Messages.AssertEqual(
- OnNext(210, N),
- OnCompleted<int>(220)
- );
- }
-
- [TestMethod]
- public void And2Error()
- {
- var ex = new Exception();
-
- const int N = 2;
-
- for (int i = 0; i < N; i++)
- {
- var scheduler = new TestScheduler();
- var obs = new List<IObservable<int>>();
-
- for (int j = 0; j < N; j++)
- {
- if (j == i)
- {
- obs.Add(scheduler.CreateHotObservable(
- OnError<int>(210, ex)
- ));
- }
- else
- {
- obs.Add(scheduler.CreateHotObservable(
- OnNext(210, 1),
- OnCompleted<int>(220)
- ));
- }
- }
-
- var res = scheduler.Start(() =>
- Observable.When(obs[0].And(obs[1]).Then((a, b) => 0))
- );
-
- res.Messages.AssertEqual(
- OnError<int>(210, ex)
- );
- }
- }
-
- [TestMethod]
- public void And3()
- {
- var scheduler = new TestScheduler();
-
- const int N = 3;
-
- var obs = new List<IObservable<int>>();
- for (int i = 0; i < N; i++)
- {
- obs.Add(scheduler.CreateHotObservable(
- OnNext(210, 1),
- OnCompleted<int>(220)
- ));
- }
-
- var res = scheduler.Start(() =>
- Observable.When(obs[0].And(obs[1]).And(obs[2]).Then((a, b, c) => a + b + c))
- );
-
- res.Messages.AssertEqual(
- OnNext(210, N),
- OnCompleted<int>(220)
- );
- }
-
- [TestMethod]
- public void And3Error()
- {
- var ex = new Exception();
-
- const int N = 3;
-
- for (int i = 0; i < N; i++)
- {
- var scheduler = new TestScheduler();
- var obs = new List<IObservable<int>>();
-
- for (int j = 0; j < N; j++)
- {
- if (j == i)
- {
- obs.Add(scheduler.CreateHotObservable(
- OnError<int>(210, ex)
- ));
- }
- else
- {
- obs.Add(scheduler.CreateHotObservable(
- OnNext(210, 1),
- OnCompleted<int>(220)
- ));
- }
- }
-
- var res = scheduler.Start(() =>
- Observable.When(obs[0].And(obs[1]).And(obs[2]).Then((a, b, c) => 0))
- );
-
- res.Messages.AssertEqual(
- OnError<int>(210, ex)
- );
- }
- }
-
- [TestMethod]
- public void And4()
- {
- var scheduler = new TestScheduler();
-
- const int N = 4;
-
- var obs = new List<IObservable<int>>();
- for (int i = 0; i < N; i++)
- {
- obs.Add(scheduler.CreateHotObservable(
- OnNext(210, 1),
- OnCompleted<int>(220)
- ));
- }
-
- var res = scheduler.Start(() =>
- Observable.When(obs[0].And(obs[1]).And(obs[2]).And(obs[3]).Then((a, b, c, d) => a + b + c + d))
- );
-
- res.Messages.AssertEqual(
- OnNext(210, N),
- OnCompleted<int>(220)
- );
- }
-
- [TestMethod]
- public void And4Error()
- {
- var ex = new Exception();
-
- const int N = 4;
-
- for (int i = 0; i < N; i++)
- {
- var scheduler = new TestScheduler();
- var obs = new List<IObservable<int>>();
-
- for (int j = 0; j < N; j++)
- {
- if (j == i)
- {
- obs.Add(scheduler.CreateHotObservable(
- OnError<int>(210, ex)
- ));
- }
- else
- {
- obs.Add(scheduler.CreateHotObservable(
- OnNext(210, 1),
- OnCompleted<int>(220)
- ));
- }
- }
-
- var res = scheduler.Start(() =>
- Observable.When(obs[0].And(obs[1]).And(obs[2]).And(obs[3]).Then((a, b, c, d) => 0))
- );
-
- res.Messages.AssertEqual(
- OnError<int>(210, ex)
- );
- }
- }
-
-#if !NO_LARGEARITY
- [TestMethod]
- public void And5()
- {
- var scheduler = new TestScheduler();
-
- const int N = 5;
-
- var obs = new List<IObservable<int>>();
- for (int i = 0; i < N; i++)
- {
- obs.Add(scheduler.CreateHotObservable(
- OnNext(210, 1),
- OnCompleted<int>(220)
- ));
- }
-
- var res = scheduler.Start(() =>
- Observable.When(obs[0].And(obs[1]).And(obs[2]).And(obs[3]).And(obs[4]).Then((a, b, c, d, e) => a + b + c + d + e))
- );
-
- res.Messages.AssertEqual(
- OnNext(210, N),
- OnCompleted<int>(220)
- );
- }
-
- [TestMethod]
- public void And5Error()
- {
- var ex = new Exception();
-
- const int N = 5;
-
- for (int i = 0; i < N; i++)
- {
- var scheduler = new TestScheduler();
- var obs = new List<IObservable<int>>();
-
- for (int j = 0; j < N; j++)
- {
- if (j == i)
- {
- obs.Add(scheduler.CreateHotObservable(
- OnError<int>(210, ex)
- ));
- }
- else
- {
- obs.Add(scheduler.CreateHotObservable(
- OnNext(210, 1),
- OnCompleted<int>(220)
- ));
- }
- }
-
- var res = scheduler.Start(() =>
- Observable.When(obs[0].And(obs[1]).And(obs[2]).And(obs[3]).And(obs[4]).Then((a, b, c, d, e) => 0))
- );
-
- res.Messages.AssertEqual(
- OnError<int>(210, ex)
- );
- }
- }
-
- [TestMethod]
- public void And6()
- {
- var scheduler = new TestScheduler();
-
- const int N = 6;
-
- var obs = new List<IObservable<int>>();
- for (int i = 0; i < N; i++)
- {
- obs.Add(scheduler.CreateHotObservable(
- OnNext(210, 1),
- OnCompleted<int>(220)
- ));
- }
-
- var res = scheduler.Start(() =>
- Observable.When(obs[0].And(obs[1]).And(obs[2]).And(obs[3]).And(obs[4]).And(obs[5]).Then((a, b, c, d, e, f) => a + b + c + d + e + f))
- );
-
- res.Messages.AssertEqual(
- OnNext(210, N),
- OnCompleted<int>(220)
- );
- }
-
- [TestMethod]
- public void And6Error()
- {
- var ex = new Exception();
-
- const int N = 6;
-
- for (int i = 0; i < N; i++)
- {
- var scheduler = new TestScheduler();
- var obs = new List<IObservable<int>>();
-
- for (int j = 0; j < N; j++)
- {
- if (j == i)
- {
- obs.Add(scheduler.CreateHotObservable(
- OnError<int>(210, ex)
- ));
- }
- else
- {
- obs.Add(scheduler.CreateHotObservable(
- OnNext(210, 1),
- OnCompleted<int>(220)
- ));
- }
- }
-
- var res = scheduler.Start(() =>
- Observable.When(obs[0].And(obs[1]).And(obs[2]).And(obs[3]).And(obs[4]).And(obs[5]).Then((a, b, c, d, e, f) => 0))
- );
-
- res.Messages.AssertEqual(
- OnError<int>(210, ex)
- );
- }
- }
-
- [TestMethod]
- public void And7()
- {
- var scheduler = new TestScheduler();
-
- const int N = 7;
-
- var obs = new List<IObservable<int>>();
- for (int i = 0; i < N; i++)
- {
- obs.Add(scheduler.CreateHotObservable(
- OnNext(210, 1),
- OnCompleted<int>(220)
- ));
- }
-
- var res = scheduler.Start(() =>
- Observable.When(obs[0].And(obs[1]).And(obs[2]).And(obs[3]).And(obs[4]).And(obs[5]).And(obs[6]).Then((a, b, c, d, e, f, g) => a + b + c + d + e + f + g))
- );
-
- res.Messages.AssertEqual(
- OnNext(210, N),
- OnCompleted<int>(220)
- );
- }
-
- [TestMethod]
- public void And7Error()
- {
- var ex = new Exception();
-
- const int N = 7;
-
- for (int i = 0; i < N; i++)
- {
- var scheduler = new TestScheduler();
- var obs = new List<IObservable<int>>();
-
- for (int j = 0; j < N; j++)
- {
- if (j == i)
- {
- obs.Add(scheduler.CreateHotObservable(
- OnError<int>(210, ex)
- ));
- }
- else
- {
- obs.Add(scheduler.CreateHotObservable(
- OnNext(210, 1),
- OnCompleted<int>(220)
- ));
- }
- }
-
- var res = scheduler.Start(() =>
- Observable.When(obs[0].And(obs[1]).And(obs[2]).And(obs[3]).And(obs[4]).And(obs[5]).And(obs[6]).Then((a, b, c, d, e, f, g) => 0))
- );
-
- res.Messages.AssertEqual(
- OnError<int>(210, ex)
- );
- }
- }
-
- [TestMethod]
- public void And8()
- {
- var scheduler = new TestScheduler();
-
- const int N = 8;
-
- var obs = new List<IObservable<int>>();
- for (int i = 0; i < N; i++)
- {
- obs.Add(scheduler.CreateHotObservable(
- OnNext(210, 1),
- OnCompleted<int>(220)
- ));
- }
-
- var res = scheduler.Start(() =>
- Observable.When(obs[0].And(obs[1]).And(obs[2]).And(obs[3]).And(obs[4]).And(obs[5]).And(obs[6]).And(obs[7]).Then((a, b, c, d, e, f, g, h) => a + b + c + d + e + f + g + h))
- );
-
- res.Messages.AssertEqual(
- OnNext(210, N),
- OnCompleted<int>(220)
- );
- }
-
- [TestMethod]
- public void And8Error()
- {
- var ex = new Exception();
-
- const int N = 8;
-
- for (int i = 0; i < N; i++)
- {
- var scheduler = new TestScheduler();
- var obs = new List<IObservable<int>>();
-
- for (int j = 0; j < N; j++)
- {
- if (j == i)
- {
- obs.Add(scheduler.CreateHotObservable(
- OnError<int>(210, ex)
- ));
- }
- else
- {
- obs.Add(scheduler.CreateHotObservable(
- OnNext(210, 1),
- OnCompleted<int>(220)
- ));
- }
- }
-
- var res = scheduler.Start(() =>
- Observable.When(obs[0].And(obs[1]).And(obs[2]).And(obs[3]).And(obs[4]).And(obs[5]).And(obs[6]).And(obs[7]).Then((a, b, c, d, e, f, g, h) => 0))
- );
-
- res.Messages.AssertEqual(
- OnError<int>(210, ex)
- );
- }
- }
-
- [TestMethod]
- public void And9()
- {
- var scheduler = new TestScheduler();
-
- const int N = 9;
-
- var obs = new List<IObservable<int>>();
- for (int i = 0; i < N; i++)
- {
- obs.Add(scheduler.CreateHotObservable(
- OnNext(210, 1),
- OnCompleted<int>(220)
- ));
- }
-
- var res = scheduler.Start(() =>
- Observable.When(obs[0].And(obs[1]).And(obs[2]).And(obs[3]).And(obs[4]).And(obs[5]).And(obs[6]).And(obs[7]).And(obs[8]).Then((a, b, c, d, e, f, g, h, i) => a + b + c + d + e + f + g + h + i))
- );
-
- res.Messages.AssertEqual(
- OnNext(210, N),
- OnCompleted<int>(220)
- );
- }
-
- [TestMethod]
- public void And9Error()
- {
- var ex = new Exception();
-
- const int N = 9;
-
- for (int i = 0; i < N; i++)
- {
- var scheduler = new TestScheduler();
- var obs = new List<IObservable<int>>();
-
- for (int j = 0; j < N; j++)
- {
- if (j == i)
- {
- obs.Add(scheduler.CreateHotObservable(
- OnError<int>(210, ex)
- ));
- }
- else
- {
- obs.Add(scheduler.CreateHotObservable(
- OnNext(210, 1),
- OnCompleted<int>(220)
- ));
- }
- }
-
- var res = scheduler.Start(() =>
- Observable.When(obs[0].And(obs[1]).And(obs[2]).And(obs[3]).And(obs[4]).And(obs[5]).And(obs[6]).And(obs[7]).And(obs[8]).Then((a, b, c, d, e, f, g, h, i_) => 0))
- );
-
- res.Messages.AssertEqual(
- OnError<int>(210, ex)
- );
- }
- }
-
- [TestMethod]
- public void And10()
- {
- var scheduler = new TestScheduler();
-
- const int N = 10;
-
- var obs = new List<IObservable<int>>();
- for (int i = 0; i < N; i++)
- {
- obs.Add(scheduler.CreateHotObservable(
- OnNext(210, 1),
- OnCompleted<int>(220)
- ));
- }
-
- var res = scheduler.Start(() =>
- Observable.When(obs[0].And(obs[1]).And(obs[2]).And(obs[3]).And(obs[4]).And(obs[5]).And(obs[6]).And(obs[7]).And(obs[8]).And(obs[9]).Then((a, b, c, d, e, f, g, h, i, j) => a + b + c + d + e + f + g + h + i + j))
- );
-
- res.Messages.AssertEqual(
- OnNext(210, N),
- OnCompleted<int>(220)
- );
- }
-
- [TestMethod]
- public void And10Error()
- {
- var ex = new Exception();
-
- const int N = 10;
-
- for (int i = 0; i < N; i++)
- {
- var scheduler = new TestScheduler();
- var obs = new List<IObservable<int>>();
-
- for (int j = 0; j < N; j++)
- {
- if (j == i)
- {
- obs.Add(scheduler.CreateHotObservable(
- OnError<int>(210, ex)
- ));
- }
- else
- {
- obs.Add(scheduler.CreateHotObservable(
- OnNext(210, 1),
- OnCompleted<int>(220)
- ));
- }
- }
-
- var res = scheduler.Start(() =>
- Observable.When(obs[0].And(obs[1]).And(obs[2]).And(obs[3]).And(obs[4]).And(obs[5]).And(obs[6]).And(obs[7]).And(obs[8]).And(obs[9]).Then((a, b, c, d, e, f, g, h, i_, j) => 0))
- );
-
- res.Messages.AssertEqual(
- OnError<int>(210, ex)
- );
- }
- }
-
- [TestMethod]
- public void And11()
- {
- var scheduler = new TestScheduler();
-
- const int N = 11;
-
- var obs = new List<IObservable<int>>();
- for (int i = 0; i < N; i++)
- {
- obs.Add(scheduler.CreateHotObservable(
- OnNext(210, 1),
- OnCompleted<int>(220)
- ));
- }
-
- var res = scheduler.Start(() =>
- Observable.When(obs[0].And(obs[1]).And(obs[2]).And(obs[3]).And(obs[4]).And(obs[5]).And(obs[6]).And(obs[7]).And(obs[8]).And(obs[9]).And(obs[10]).Then((a, b, c, d, e, f, g, h, i, j, k) => a + b + c + d + e + f + g + h + i + j + k))
- );
-
- res.Messages.AssertEqual(
- OnNext(210, N),
- OnCompleted<int>(220)
- );
- }
-
- [TestMethod]
- public void And11Error()
- {
- var ex = new Exception();
-
- const int N = 11;
-
- for (int i = 0; i < N; i++)
- {
- var scheduler = new TestScheduler();
- var obs = new List<IObservable<int>>();
-
- for (int j = 0; j < N; j++)
- {
- if (j == i)
- {
- obs.Add(scheduler.CreateHotObservable(
- OnError<int>(210, ex)
- ));
- }
- else
- {
- obs.Add(scheduler.CreateHotObservable(
- OnNext(210, 1),
- OnCompleted<int>(220)
- ));
- }
- }
-
- var res = scheduler.Start(() =>
- Observable.When(obs[0].And(obs[1]).And(obs[2]).And(obs[3]).And(obs[4]).And(obs[5]).And(obs[6]).And(obs[7]).And(obs[8]).And(obs[9]).And(obs[10]).Then((a, b, c, d, e, f, g, h, i_, j, k) => 0))
- );
-
- res.Messages.AssertEqual(
- OnError<int>(210, ex)
- );
- }
- }
-
- [TestMethod]
- public void And12()
- {
- var scheduler = new TestScheduler();
-
- const int N = 12;
-
- var obs = new List<IObservable<int>>();
- for (int i = 0; i < N; i++)
- {
- obs.Add(scheduler.CreateHotObservable(
- OnNext(210, 1),
- OnCompleted<int>(220)
- ));
- }
-
- var res = scheduler.Start(() =>
- Observable.When(obs[0].And(obs[1]).And(obs[2]).And(obs[3]).And(obs[4]).And(obs[5]).And(obs[6]).And(obs[7]).And(obs[8]).And(obs[9]).And(obs[10]).And(obs[11]).Then((a, b, c, d, e, f, g, h, i, j, k, l) => a + b + c + d + e + f + g + h + i + j + k + l))
- );
-
- res.Messages.AssertEqual(
- OnNext(210, N),
- OnCompleted<int>(220)
- );
- }
-
- [TestMethod]
- public void And12Error()
- {
- var ex = new Exception();
-
- const int N = 12;
-
- for (int i = 0; i < N; i++)
- {
- var scheduler = new TestScheduler();
- var obs = new List<IObservable<int>>();
-
- for (int j = 0; j < N; j++)
- {
- if (j == i)
- {
- obs.Add(scheduler.CreateHotObservable(
- OnError<int>(210, ex)
- ));
- }
- else
- {
- obs.Add(scheduler.CreateHotObservable(
- OnNext(210, 1),
- OnCompleted<int>(220)
- ));
- }
- }
-
- var res = scheduler.Start(() =>
- Observable.When(obs[0].And(obs[1]).And(obs[2]).And(obs[3]).And(obs[4]).And(obs[5]).And(obs[6]).And(obs[7]).And(obs[8]).And(obs[9]).And(obs[10]).And(obs[11]).Then((a, b, c, d, e, f, g, h, i_, j, k, l) => 0))
- );
-
- res.Messages.AssertEqual(
- OnError<int>(210, ex)
- );
- }
- }
-
- [TestMethod]
- public void And13()
- {
- var scheduler = new TestScheduler();
-
- const int N = 13;
-
- var obs = new List<IObservable<int>>();
- for (int i = 0; i < N; i++)
- {
- obs.Add(scheduler.CreateHotObservable(
- OnNext(210, 1),
- OnCompleted<int>(220)
- ));
- }
-
- var res = scheduler.Start(() =>
- Observable.When(obs[0].And(obs[1]).And(obs[2]).And(obs[3]).And(obs[4]).And(obs[5]).And(obs[6]).And(obs[7]).And(obs[8]).And(obs[9]).And(obs[10]).And(obs[11]).And(obs[12]).Then((a, b, c, d, e, f, g, h, i, j, k, l, m) => a + b + c + d + e + f + g + h + i + j + k + l + m))
- );
-
- res.Messages.AssertEqual(
- OnNext(210, N),
- OnCompleted<int>(220)
- );
- }
-
- [TestMethod]
- public void And13Error()
- {
- var ex = new Exception();
-
- const int N = 13;
-
- for (int i = 0; i < N; i++)
- {
- var scheduler = new TestScheduler();
- var obs = new List<IObservable<int>>();
-
- for (int j = 0; j < N; j++)
- {
- if (j == i)
- {
- obs.Add(scheduler.CreateHotObservable(
- OnError<int>(210, ex)
- ));
- }
- else
- {
- obs.Add(scheduler.CreateHotObservable(
- OnNext(210, 1),
- OnCompleted<int>(220)
- ));
- }
- }
-
- var res = scheduler.Start(() =>
- Observable.When(obs[0].And(obs[1]).And(obs[2]).And(obs[3]).And(obs[4]).And(obs[5]).And(obs[6]).And(obs[7]).And(obs[8]).And(obs[9]).And(obs[10]).And(obs[11]).And(obs[12]).Then((a, b, c, d, e, f, g, h, i_, j, k, l, m) => 0))
- );
-
- res.Messages.AssertEqual(
- OnError<int>(210, ex)
- );
- }
- }
-
- [TestMethod]
- public void And14()
- {
- var scheduler = new TestScheduler();
-
- const int N = 14;
-
- var obs = new List<IObservable<int>>();
- for (int i = 0; i < N; i++)
- {
- obs.Add(scheduler.CreateHotObservable(
- OnNext(210, 1),
- OnCompleted<int>(220)
- ));
- }
-
- var res = scheduler.Start(() =>
- Observable.When(obs[0].And(obs[1]).And(obs[2]).And(obs[3]).And(obs[4]).And(obs[5]).And(obs[6]).And(obs[7]).And(obs[8]).And(obs[9]).And(obs[10]).And(obs[11]).And(obs[12]).And(obs[13]).Then((a, b, c, d, e, f, g, h, i, j, k, l, m, n) => a + b + c + d + e + f + g + h + i + j + k + l + m + n))
- );
-
- res.Messages.AssertEqual(
- OnNext(210, N),
- OnCompleted<int>(220)
- );
- }
-
- [TestMethod]
- public void And14Error()
- {
- var ex = new Exception();
-
- const int N = 14;
-
- for (int i = 0; i < N; i++)
- {
- var scheduler = new TestScheduler();
- var obs = new List<IObservable<int>>();
-
- for (int j = 0; j < N; j++)
- {
- if (j == i)
- {
- obs.Add(scheduler.CreateHotObservable(
- OnError<int>(210, ex)
- ));
- }
- else
- {
- obs.Add(scheduler.CreateHotObservable(
- OnNext(210, 1),
- OnCompleted<int>(220)
- ));
- }
- }
-
- var res = scheduler.Start(() =>
- Observable.When(obs[0].And(obs[1]).And(obs[2]).And(obs[3]).And(obs[4]).And(obs[5]).And(obs[6]).And(obs[7]).And(obs[8]).And(obs[9]).And(obs[10]).And(obs[11]).And(obs[12]).And(obs[13]).Then((a, b, c, d, e, f, g, h, i_, j, k, l, m, n) => 0))
- );
-
- res.Messages.AssertEqual(
- OnError<int>(210, ex)
- );
- }
- }
-
- [TestMethod]
- public void And15()
- {
- var scheduler = new TestScheduler();
-
- const int N = 15;
-
- var obs = new List<IObservable<int>>();
- for (int i = 0; i < N; i++)
- {
- obs.Add(scheduler.CreateHotObservable(
- OnNext(210, 1),
- OnCompleted<int>(220)
- ));
- }
-
- var res = scheduler.Start(() =>
- Observable.When(obs[0].And(obs[1]).And(obs[2]).And(obs[3]).And(obs[4]).And(obs[5]).And(obs[6]).And(obs[7]).And(obs[8]).And(obs[9]).And(obs[10]).And(obs[11]).And(obs[12]).And(obs[13]).And(obs[14]).Then((a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) => a + b + c + d + e + f + g + h + i + j + k + l + m + n + o))
- );
-
- res.Messages.AssertEqual(
- OnNext(210, N),
- OnCompleted<int>(220)
- );
- }
-
- [TestMethod]
- public void And15Error()
- {
- var ex = new Exception();
-
- const int N = 15;
-
- for (int i = 0; i < N; i++)
- {
- var scheduler = new TestScheduler();
- var obs = new List<IObservable<int>>();
-
- for (int j = 0; j < N; j++)
- {
- if (j == i)
- {
- obs.Add(scheduler.CreateHotObservable(
- OnError<int>(210, ex)
- ));
- }
- else
- {
- obs.Add(scheduler.CreateHotObservable(
- OnNext(210, 1),
- OnCompleted<int>(220)
- ));
- }
- }
-
- var res = scheduler.Start(() =>
- Observable.When(obs[0].And(obs[1]).And(obs[2]).And(obs[3]).And(obs[4]).And(obs[5]).And(obs[6]).And(obs[7]).And(obs[8]).And(obs[9]).And(obs[10]).And(obs[11]).And(obs[12]).And(obs[13]).And(obs[14]).Then((a, b, c, d, e, f, g, h, i_, j, k, l, m, n, o) => 0))
- );
-
- res.Messages.AssertEqual(
- OnError<int>(210, ex)
- );
- }
- }
-
- [TestMethod]
- public void And16()
- {
- var scheduler = new TestScheduler();
-
- const int N = 16;
-
- var obs = new List<IObservable<int>>();
- for (int i = 0; i < N; i++)
- {
- obs.Add(scheduler.CreateHotObservable(
- OnNext(210, 1),
- OnCompleted<int>(220)
- ));
- }
-
- var res = scheduler.Start(() =>
- Observable.When(obs[0].And(obs[1]).And(obs[2]).And(obs[3]).And(obs[4]).And(obs[5]).And(obs[6]).And(obs[7]).And(obs[8]).And(obs[9]).And(obs[10]).And(obs[11]).And(obs[12]).And(obs[13]).And(obs[14]).And(obs[15]).Then((a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) => a + b + c + d + e + f + g + h + i + j + k + l + m + n + o + p))
- );
-
- res.Messages.AssertEqual(
- OnNext(210, N),
- OnCompleted<int>(220)
- );
- }
-
- [TestMethod]
- public void And16Error()
- {
- var ex = new Exception();
-
- const int N = 16;
-
- for (int i = 0; i < N; i++)
- {
- var scheduler = new TestScheduler();
- var obs = new List<IObservable<int>>();
-
- for (int j = 0; j < N; j++)
- {
- if (j == i)
- {
- obs.Add(scheduler.CreateHotObservable(
- OnError<int>(210, ex)
- ));
- }
- else
- {
- obs.Add(scheduler.CreateHotObservable(
- OnNext(210, 1),
- OnCompleted<int>(220)
- ));
- }
- }
-
- var res = scheduler.Start(() =>
- Observable.When(obs[0].And(obs[1]).And(obs[2]).And(obs[3]).And(obs[4]).And(obs[5]).And(obs[6]).And(obs[7]).And(obs[8]).And(obs[9]).And(obs[10]).And(obs[11]).And(obs[12]).And(obs[13]).And(obs[14]).And(obs[15]).Then((a, b, c, d, e, f, g, h, i_, j, k, l, m, n, o, p) => 0))
- );
-
- res.Messages.AssertEqual(
- OnError<int>(210, ex)
- );
- }
- }
-#endif
-
- #endregion
-
- #region Then
-
- [TestMethod]
- public void Then_ArgumentChecking()
- {
- var someObservable = Observable.Return(1);
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Then<int, int>(null, _ => _));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Then<int, int>(someObservable, null));
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.And<int, int>(someObservable, someObservable).Then<int>(null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.And<int, int>(someObservable, someObservable).And(someObservable).Then<int>(null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.And<int, int>(someObservable, someObservable).And(someObservable).And(someObservable).Then<int>(null));
-
-#if !NO_LARGEARITY
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.And<int, int>(someObservable, someObservable).And(someObservable).And(someObservable).And(someObservable).Then<int>(null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.And<int, int>(someObservable, someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).Then<int>(null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.And<int, int>(someObservable, someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).Then<int>(null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.And<int, int>(someObservable, someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).Then<int>(null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.And<int, int>(someObservable, someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).Then<int>(null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.And<int, int>(someObservable, someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).Then<int>(null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.And<int, int>(someObservable, someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).Then<int>(null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.And<int, int>(someObservable, someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).Then<int>(null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.And<int, int>(someObservable, someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).Then<int>(null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.And<int, int>(someObservable, someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).Then<int>(null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.And<int, int>(someObservable, someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).Then<int>(null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.And<int, int>(someObservable, someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).And(someObservable).Then<int>(null));
-#endif
- }
-
- [TestMethod]
- public void Then1()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(210, 1),
- OnCompleted<int>(220)
- );
-
- var res = scheduler.Start(() =>
- Observable.When(xs.Then(a => a))
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 1),
- OnCompleted<int>(220)
- );
- }
-
- [TestMethod]
- public void Then1Error()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnError<int>(210, ex)
- );
-
- var res = scheduler.Start(() =>
- Observable.When(xs.Then(a => a))
- );
-
- res.Messages.AssertEqual(
- OnError<int>(210, ex)
- );
- }
-
- [TestMethod]
- public void Then1Throws()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(210, 1),
- OnCompleted<int>(220)
- );
-
- var res = scheduler.Start(() =>
- Observable.When(xs.Then<int, int>(a => { throw ex; }))
- );
-
- res.Messages.AssertEqual(
- OnError<int>(210, ex)
- );
- }
-
- [TestMethod]
- public void Then2Throws()
- {
- var scheduler = new TestScheduler();
- var ex = new Exception();
-
- const int N = 2;
-
- var obs = new List<IObservable<int>>();
- for (int i = 0; i < N; i++)
- {
- obs.Add(scheduler.CreateHotObservable(
- OnNext(210, 1),
- OnCompleted<int>(220)
- ));
- }
-
- var res = scheduler.Start(() =>
- Observable.When(obs[0].And(obs[1]).Then<int>((a, b) => { throw ex; }))
- );
-
- res.Messages.AssertEqual(
- OnError<int>(210, ex)
- );
- }
-
- [TestMethod]
- public void Then3Throws()
- {
- var scheduler = new TestScheduler();
- var ex = new Exception();
-
- const int N = 3;
-
- var obs = new List<IObservable<int>>();
- for (int i = 0; i < N; i++)
- {
- obs.Add(scheduler.CreateHotObservable(
- OnNext(210, 1),
- OnCompleted<int>(220)
- ));
- }
-
- var res = scheduler.Start(() =>
- Observable.When(obs[0].And(obs[1]).And(obs[2]).Then<int>((a, b, c) => { throw ex; }))
- );
-
- res.Messages.AssertEqual(
- OnError<int>(210, ex)
- );
- }
-
- [TestMethod]
- public void Then4Throws()
- {
- var scheduler = new TestScheduler();
- var ex = new Exception();
-
- const int N = 4;
-
- var obs = new List<IObservable<int>>();
- for (int i = 0; i < N; i++)
- {
- obs.Add(scheduler.CreateHotObservable(
- OnNext(210, 1),
- OnCompleted<int>(220)
- ));
- }
-
- var res = scheduler.Start(() =>
- Observable.When(obs[0].And(obs[1]).And(obs[2]).And(obs[3]).Then<int>((a, b, c, d) => { throw ex; }))
- );
-
- res.Messages.AssertEqual(
- OnError<int>(210, ex)
- );
- }
-
-#if !NO_LARGEARITY
- [TestMethod]
- public void Then5Throws()
- {
- var scheduler = new TestScheduler();
- var ex = new Exception();
-
- const int N = 5;
-
- var obs = new List<IObservable<int>>();
- for (int i = 0; i < N; i++)
- {
- obs.Add(scheduler.CreateHotObservable(
- OnNext(210, 1),
- OnCompleted<int>(220)
- ));
- }
-
- var res = scheduler.Start(() =>
- Observable.When(obs[0].And(obs[1]).And(obs[2]).And(obs[3]).And(obs[4]).Then<int>((a, b, c, d, e) => { throw ex; }))
- );
-
- res.Messages.AssertEqual(
- OnError<int>(210, ex)
- );
- }
-
- [TestMethod]
- public void Then6Throws()
- {
- var scheduler = new TestScheduler();
- var ex = new Exception();
-
- const int N = 6;
-
- var obs = new List<IObservable<int>>();
- for (int i = 0; i < N; i++)
- {
- obs.Add(scheduler.CreateHotObservable(
- OnNext(210, 1),
- OnCompleted<int>(220)
- ));
- }
-
- var res = scheduler.Start(() =>
- Observable.When(obs[0].And(obs[1]).And(obs[2]).And(obs[3]).And(obs[4]).And(obs[5]).Then<int>((a, b, c, d, e, f) => { throw ex; }))
- );
-
- res.Messages.AssertEqual(
- OnError<int>(210, ex)
- );
- }
-
- [TestMethod]
- public void Then7Throws()
- {
- var scheduler = new TestScheduler();
- var ex = new Exception();
-
- const int N = 7;
-
- var obs = new List<IObservable<int>>();
- for (int i = 0; i < N; i++)
- {
- obs.Add(scheduler.CreateHotObservable(
- OnNext(210, 1),
- OnCompleted<int>(220)
- ));
- }
-
- var res = scheduler.Start(() =>
- Observable.When(obs[0].And(obs[1]).And(obs[2]).And(obs[3]).And(obs[4]).And(obs[5]).And(obs[6]).Then<int>((a, b, c, d, e, f, g) => { throw ex; }))
- );
-
- res.Messages.AssertEqual(
- OnError<int>(210, ex)
- );
- }
-
- [TestMethod]
- public void Then8Throws()
- {
- var scheduler = new TestScheduler();
- var ex = new Exception();
-
- const int N = 8;
-
- var obs = new List<IObservable<int>>();
- for (int i = 0; i < N; i++)
- {
- obs.Add(scheduler.CreateHotObservable(
- OnNext(210, 1),
- OnCompleted<int>(220)
- ));
- }
-
- var res = scheduler.Start(() =>
- Observable.When(obs[0].And(obs[1]).And(obs[2]).And(obs[3]).And(obs[4]).And(obs[5]).And(obs[6]).And(obs[7]).Then<int>((a, b, c, d, e, f, g, h) => { throw ex; }))
- );
-
- res.Messages.AssertEqual(
- OnError<int>(210, ex)
- );
- }
-
- [TestMethod]
- public void Then9Throws()
- {
- var scheduler = new TestScheduler();
- var ex = new Exception();
-
- const int N = 9;
-
- var obs = new List<IObservable<int>>();
- for (int i = 0; i < N; i++)
- {
- obs.Add(scheduler.CreateHotObservable(
- OnNext(210, 1),
- OnCompleted<int>(220)
- ));
- }
-
- var res = scheduler.Start(() =>
- Observable.When(obs[0].And(obs[1]).And(obs[2]).And(obs[3]).And(obs[4]).And(obs[5]).And(obs[6]).And(obs[7]).And(obs[8]).Then<int>((a, b, c, d, e, f, g, h, i_) => { throw ex; }))
- );
-
- res.Messages.AssertEqual(
- OnError<int>(210, ex)
- );
- }
-
- [TestMethod]
- public void Then10Throws()
- {
- var scheduler = new TestScheduler();
- var ex = new Exception();
-
- const int N = 10;
-
- var obs = new List<IObservable<int>>();
- for (int i = 0; i < N; i++)
- {
- obs.Add(scheduler.CreateHotObservable(
- OnNext(210, 1),
- OnCompleted<int>(220)
- ));
- }
-
- var res = scheduler.Start(() =>
- Observable.When(obs[0].And(obs[1]).And(obs[2]).And(obs[3]).And(obs[4]).And(obs[5]).And(obs[6]).And(obs[7]).And(obs[8]).And(obs[9]).Then<int>((a, b, c, d, e, f, g, h, i_, j) => { throw ex; }))
- );
-
- res.Messages.AssertEqual(
- OnError<int>(210, ex)
- );
- }
-
- [TestMethod]
- public void Then11Throws()
- {
- var scheduler = new TestScheduler();
- var ex = new Exception();
-
- const int N = 11;
-
- var obs = new List<IObservable<int>>();
- for (int i = 0; i < N; i++)
- {
- obs.Add(scheduler.CreateHotObservable(
- OnNext(210, 1),
- OnCompleted<int>(220)
- ));
- }
-
- var res = scheduler.Start(() =>
- Observable.When(obs[0].And(obs[1]).And(obs[2]).And(obs[3]).And(obs[4]).And(obs[5]).And(obs[6]).And(obs[7]).And(obs[8]).And(obs[9]).And(obs[10]).Then<int>((a, b, c, d, e, f, g, h, i_, j, k) => { throw ex; }))
- );
-
- res.Messages.AssertEqual(
- OnError<int>(210, ex)
- );
- }
-
- [TestMethod]
- public void Then12Throws()
- {
- var scheduler = new TestScheduler();
- var ex = new Exception();
-
- const int N = 12;
-
- var obs = new List<IObservable<int>>();
- for (int i = 0; i < N; i++)
- {
- obs.Add(scheduler.CreateHotObservable(
- OnNext(210, 1),
- OnCompleted<int>(220)
- ));
- }
-
- var res = scheduler.Start(() =>
- Observable.When(obs[0].And(obs[1]).And(obs[2]).And(obs[3]).And(obs[4]).And(obs[5]).And(obs[6]).And(obs[7]).And(obs[8]).And(obs[9]).And(obs[10]).And(obs[11]).Then<int>((a, b, c, d, e, f, g, h, i_, j, k, l) => { throw ex; }))
- );
-
- res.Messages.AssertEqual(
- OnError<int>(210, ex)
- );
- }
-
- [TestMethod]
- public void Then13Throws()
- {
- var scheduler = new TestScheduler();
- var ex = new Exception();
-
- const int N = 13;
-
- var obs = new List<IObservable<int>>();
- for (int i = 0; i < N; i++)
- {
- obs.Add(scheduler.CreateHotObservable(
- OnNext(210, 1),
- OnCompleted<int>(220)
- ));
- }
-
- var res = scheduler.Start(() =>
- Observable.When(obs[0].And(obs[1]).And(obs[2]).And(obs[3]).And(obs[4]).And(obs[5]).And(obs[6]).And(obs[7]).And(obs[8]).And(obs[9]).And(obs[10]).And(obs[11]).And(obs[12]).Then<int>((a, b, c, d, e, f, g, h, i_, j, k, l, m) => { throw ex; }))
- );
-
- res.Messages.AssertEqual(
- OnError<int>(210, ex)
- );
- }
-
- [TestMethod]
- public void Then14Throws()
- {
- var scheduler = new TestScheduler();
- var ex = new Exception();
-
- const int N = 14;
-
- var obs = new List<IObservable<int>>();
- for (int i = 0; i < N; i++)
- {
- obs.Add(scheduler.CreateHotObservable(
- OnNext(210, 1),
- OnCompleted<int>(220)
- ));
- }
-
- var res = scheduler.Start(() =>
- Observable.When(obs[0].And(obs[1]).And(obs[2]).And(obs[3]).And(obs[4]).And(obs[5]).And(obs[6]).And(obs[7]).And(obs[8]).And(obs[9]).And(obs[10]).And(obs[11]).And(obs[12]).And(obs[13]).Then<int>((a, b, c, d, e, f, g, h, i_, j, k, l, m, n) => { throw ex; }))
- );
-
- res.Messages.AssertEqual(
- OnError<int>(210, ex)
- );
- }
-
- [TestMethod]
- public void Then15Throws()
- {
- var scheduler = new TestScheduler();
- var ex = new Exception();
-
- const int N = 15;
-
- var obs = new List<IObservable<int>>();
- for (int i = 0; i < N; i++)
- {
- obs.Add(scheduler.CreateHotObservable(
- OnNext(210, 1),
- OnCompleted<int>(220)
- ));
- }
-
- var res = scheduler.Start(() =>
- Observable.When(obs[0].And(obs[1]).And(obs[2]).And(obs[3]).And(obs[4]).And(obs[5]).And(obs[6]).And(obs[7]).And(obs[8]).And(obs[9]).And(obs[10]).And(obs[11]).And(obs[12]).And(obs[13]).And(obs[14]).Then<int>((a, b, c, d, e, f, g, h, i_, j, k, l, m, n, o) => { throw ex; }))
- );
-
- res.Messages.AssertEqual(
- OnError<int>(210, ex)
- );
- }
-
- [TestMethod]
- public void Then16Throws()
- {
- var scheduler = new TestScheduler();
- var ex = new Exception();
-
- const int N = 16;
-
- var obs = new List<IObservable<int>>();
- for (int i = 0; i < N; i++)
- {
- obs.Add(scheduler.CreateHotObservable(
- OnNext(210, 1),
- OnCompleted<int>(220)
- ));
- }
-
- var res = scheduler.Start(() =>
- Observable.When(obs[0].And(obs[1]).And(obs[2]).And(obs[3]).And(obs[4]).And(obs[5]).And(obs[6]).And(obs[7]).And(obs[8]).And(obs[9]).And(obs[10]).And(obs[11]).And(obs[12]).And(obs[13]).And(obs[14]).And(obs[15]).Then<int>((a, b, c, d, e, f, g, h, i_, j, k, l, m, n, o, p) => { throw ex; }))
- );
-
- res.Messages.AssertEqual(
- OnError<int>(210, ex)
- );
- }
-#endif
-
- #endregion
-
- #region When
-
- [TestMethod]
- public void When_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.When<int>((Plan<int>[])null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.When<int>((IEnumerable<Plan<int>>)null));
- }
-
- [TestMethod]
- public void WhenMultipleDataSymmetric()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(210, 1),
- OnNext(220, 2),
- OnNext(230, 3),
- OnCompleted<int>(240)
- );
-
- var ys = scheduler.CreateHotObservable(
- OnNext(240, 4),
- OnNext(250, 5),
- OnNext(260, 6),
- OnCompleted<int>(270)
- );
-
- var res = scheduler.Start(() =>
- Observable.When(
- xs.And(ys).Then((x, y) => x + y)
- )
- );
-
- res.Messages.AssertEqual(
- OnNext(240, 1 + 4),
- OnNext(250, 2 + 5),
- OnNext(260, 3 + 6),
- OnCompleted<int>(270)
- );
- }
-
- [TestMethod]
- public void WhenMultipleDataAsymmetric()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(210, 1),
- OnNext(220, 2),
- OnNext(230, 3),
- OnCompleted<int>(240)
- );
-
- var ys = scheduler.CreateHotObservable(
- OnNext(240, 4),
- OnNext(250, 5),
- OnCompleted<int>(270)
- );
-
- var res = scheduler.Start(() =>
- Observable.When(
- xs.And(ys).Then((x, y) => x + y)
- )
- );
-
- res.Messages.AssertEqual(
- OnNext(240, 1 + 4),
- OnNext(250, 2 + 5),
- OnCompleted<int>(270)
- );
- }
-
- [TestMethod]
- public void WhenEmptyEmpty()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnCompleted<int>(240)
- );
-
- var ys = scheduler.CreateHotObservable(
- OnCompleted<int>(270)
- );
-
- var res = scheduler.Start(() =>
- Observable.When(
- xs.And(ys).Then((x, y) => x + y)
- )
- );
-
- res.Messages.AssertEqual(
- OnCompleted<int>(270)
- );
- }
-
- [TestMethod]
- public void WhenNeverNever()
- {
- var scheduler = new TestScheduler();
-
- var xs = Observable.Never<int>();
- var ys = Observable.Never<int>();
-
- var res = scheduler.Start(() =>
- Observable.When(
- xs.And(ys).Then((x, y) => x + y)
- )
- );
-
- res.Messages.AssertEqual(
- );
- }
-
- [TestMethod]
- public void WhenThrowNonEmpty()
- {
- var ex = new Exception();
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnError<int>(240, ex)
- );
-
- var ys = scheduler.CreateHotObservable(
- OnCompleted<int>(270)
- );
-
- var res = scheduler.Start(() =>
- Observable.When(
- xs.And(ys).Then((x, y) => x + y)
- )
- );
-
- res.Messages.AssertEqual(
- OnError<int>(240, ex)
- );
- }
-
- [TestMethod]
- public void ComplicatedWhen()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(210, 1),
- OnNext(220, 2),
- OnNext(230, 3),
- OnCompleted<int>(240)
- );
-
- var ys = scheduler.CreateHotObservable(
- OnNext(240, 4),
- OnNext(250, 5),
- OnNext(260, 6),
- OnCompleted<int>(270)
- );
-
- var zs = scheduler.CreateHotObservable(
- OnNext(220, 7),
- OnNext(230, 8),
- OnNext(240, 9),
- OnCompleted<int>(300)
- );
-
- var res = scheduler.Start(() =>
- Observable.When(
- xs.And(ys).Then((x, y) => x + y),
- xs.And(zs).Then((x, z) => x * z),
- ys.And(zs).Then((y, z) => y - z)
- )
- );
-
- res.Messages.AssertEqual(
- OnNext(220, 1 * 7),
- OnNext(230, 2 * 8),
- OnNext(240, 3 + 4),
- OnNext(250, 5 - 9),
- OnCompleted<int>(300)
- );
- }
-
- [TestMethod]
- public void When_PlansIteratorThrows()
- {
- var ex = new Exception();
- var _e = default(Exception);
-
- GetPlans(ex).When().Subscribe(_ => { }, e => { _e = e; });
- Assert.AreSame(_e, ex);
- }
-
- private IEnumerable<Plan<int>> GetPlans(Exception ex)
- {
- if (ex != null)
- throw ex;
-
- yield break;
- }
-
- #endregion
- }
-} \ No newline at end of file
diff --git a/Rx.NET/Tests.System.Reactive/Tests/ObservableMultipleTest.cs b/Rx.NET/Tests.System.Reactive/Tests/ObservableMultipleTest.cs
deleted file mode 100644
index db4280d..0000000
--- a/Rx.NET/Tests.System.Reactive/Tests/ObservableMultipleTest.cs
+++ /dev/null
@@ -1,15208 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Linq;
-using System.Reactive;
-using System.Reactive.Concurrency;
-using System.Reactive.Linq;
-using System.Threading;
-using Microsoft.Reactive.Testing;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using ReactiveTests.Dummies;
-
-#if !NO_TPL
-using System.Threading.Tasks;
-#endif
-
-namespace ReactiveTests.Tests
-{
- [TestClass]
- public class ObservableMultipleTest : ReactiveTest
- {
- #region + Amb +
-
- [TestMethod]
- public void Amb_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Amb((IObservable<int>[])null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Amb((IEnumerable<IObservable<int>>)null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Amb(null, DummyObservable<int>.Instance));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Amb(DummyObservable<int>.Instance, null));
- }
-
- [TestMethod]
- public void Amb_Never2()
- {
- var scheduler = new TestScheduler();
-
- var l = scheduler.CreateHotObservable(
- OnNext(150, 1)
- );
-
- var r = scheduler.CreateHotObservable(
- OnNext(150, 1)
- );
-
- var res = scheduler.Start(() =>
- l.Amb(r)
- );
-
- res.Messages.AssertEqual(
- );
-
- l.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
-
- r.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
- }
-
- [TestMethod]
- public void Amb_Never3()
- {
- var scheduler = new TestScheduler();
-
- var n1 = scheduler.CreateHotObservable(
- OnNext(150, 1)
- );
-
- var n2 = scheduler.CreateHotObservable(
- OnNext(150, 1)
- );
-
- var n3 = scheduler.CreateHotObservable(
- OnNext(150, 1)
- );
-
- var res = scheduler.Start(() =>
- new[] { n1, n2, n3 }.Amb()
- );
-
- res.Messages.AssertEqual(
- );
-
- n1.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
-
- n2.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
-
- n3.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
- }
-
- [TestMethod]
- public void Amb_Never3_Params()
- {
- var scheduler = new TestScheduler();
-
- var n1 = scheduler.CreateHotObservable(
- OnNext(150, 1)
- );
-
- var n2 = scheduler.CreateHotObservable(
- OnNext(150, 1)
- );
-
- var n3 = scheduler.CreateHotObservable(
- OnNext(150, 1)
- );
-
- var res = scheduler.Start(() =>
- Observable.Amb(n1, n2, n3)
- );
-
- res.Messages.AssertEqual(
- );
-
- n1.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
-
- n2.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
-
- n3.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
- }
-
- [TestMethod]
- public void Amb_NeverEmpty()
- {
- var scheduler = new TestScheduler();
-
- var n = scheduler.CreateHotObservable(
- OnNext(150, 1)
- );
-
- var e = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnCompleted<int>(225)
- );
-
- var res = scheduler.Start(() =>
- n.Amb(e)
- );
-
- res.Messages.AssertEqual(
- OnCompleted<int>(225)
- );
-
- n.Subscriptions.AssertEqual(
- Subscribe(200, 225)
- );
-
- e.Subscriptions.AssertEqual(
- Subscribe(200, 225)
- );
- }
-
- [TestMethod]
- public void Amb_EmptyNever()
- {
- var scheduler = new TestScheduler();
-
- var n = scheduler.CreateHotObservable(
- OnNext(150, 1)
- );
-
- var e = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnCompleted<int>(225)
- );
-
- var res = scheduler.Start(() =>
- e.Amb(n)
- );
-
- res.Messages.AssertEqual(
- OnCompleted<int>(225)
- );
-
- n.Subscriptions.AssertEqual(
- Subscribe(200, 225)
- );
-
- e.Subscriptions.AssertEqual(
- Subscribe(200, 225)
- );
- }
-
- [TestMethod]
- public void Amb_RegularShouldDisposeLoser()
- {
- var scheduler = new TestScheduler();
-
- var o1 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnCompleted<int>(240)
- );
-
- var o2 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(220, 3),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- o1.Amb(o2)
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 2),
- OnCompleted<int>(240)
- );
-
- o1.Subscriptions.AssertEqual(
- Subscribe(200, 240)
- );
-
- o2.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void Amb_WinnerThrows()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var o1 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnError<int>(220, ex)
- );
-
- var o2 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(220, 3),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- o1.Amb(o2)
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 2),
- OnError<int>(220, ex)
- );
-
- o1.Subscriptions.AssertEqual(
- Subscribe(200, 220)
- );
-
- o2.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void Amb_LoserThrows()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var o1 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(220, 2),
- OnError<int>(230, ex)
- );
-
- var o2 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 3),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- o1.Amb(o2)
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 3),
- OnCompleted<int>(250)
- );
-
- o1.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
-
- o2.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Amb_ThrowsBeforeElectionLeft()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var o1 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnError<int>(210, ex)
- );
-
- var o2 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(220, 3),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- o1.Amb(o2)
- );
-
- res.Messages.AssertEqual(
- OnError<int>(210, ex)
- );
-
- o1.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
-
- o2.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void Amb_ThrowsBeforeElectionRight()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var o1 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(220, 3),
- OnCompleted<int>(250)
- );
-
- var o2 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnError<int>(210, ex)
- );
-
- var res = scheduler.Start(() =>
- o1.Amb(o2)
- );
-
- res.Messages.AssertEqual(
- OnError<int>(210, ex)
- );
-
- o1.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
-
- o2.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- #endregion
-
- #region + Buffer +
-
- [TestMethod]
- public void Buffer_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Buffer(default(IObservable<int>), DummyFunc<IObservable<int>>.Instance));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Buffer(DummyObservable<int>.Instance, default(Func<IObservable<int>>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Buffer(default(IObservable<int>), DummyObservable<int>.Instance, DummyFunc<int, IObservable<int>>.Instance));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Buffer(DummyObservable<int>.Instance, default(IObservable<int>), DummyFunc<int, IObservable<int>>.Instance));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Buffer(DummyObservable<int>.Instance, DummyObservable<int>.Instance, default(Func<int, IObservable<int>>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Buffer(default(IObservable<int>), DummyObservable<int>.Instance));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Buffer(DummyObservable<int>.Instance, default(IObservable<int>)));
- }
-
- [TestMethod]
- public void Buffer_Closings_Basic()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(90, 1),
- OnNext(180, 2),
- OnNext(250, 3),
- OnNext(260, 4),
- OnNext(310, 5),
- OnNext(340, 6),
- OnNext(410, 7),
- OnNext(420, 8),
- OnNext(470, 9),
- OnNext(550, 10),
- OnCompleted<int>(590)
- );
-
- var window = 1;
-
- var res = scheduler.Start(() =>
- xs.Buffer(() => Observable.Timer(TimeSpan.FromTicks((window++) * 100), scheduler))
- );
-
- res.Messages.AssertEqual(
- OnNext<IList<int>>(300, b => b.SequenceEqual(new int[] { 3, 4 })),
- OnNext<IList<int>>(500, b => b.SequenceEqual(new int[] { 5, 6, 7, 8, 9 })),
- OnNext<IList<int>>(590, b => b.SequenceEqual(new int[] { 10 })),
- OnCompleted<IList<int>>(590)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 590)
- );
- }
-
- [TestMethod]
- public void Buffer_Closings_InnerSubscriptions()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(90, 1),
- OnNext(180, 2),
- OnNext(250, 3),
- OnNext(260, 4),
- OnNext(310, 5),
- OnNext(340, 6),
- OnNext(410, 7),
- OnNext(420, 8),
- OnNext(470, 9),
- OnNext(550, 10),
- OnCompleted<int>(590)
- );
-
- var closings = new ITestableObservable<bool>[] {
- scheduler.CreateHotObservable(
- OnNext(300, true),
- OnNext(350, false),
- OnCompleted<bool>(380)
- ),
- scheduler.CreateHotObservable(
- OnNext(400, true),
- OnNext(510, false),
- OnNext(620, false)
- ),
- scheduler.CreateHotObservable(
- OnCompleted<bool>(500)
- ),
- scheduler.CreateHotObservable(
- OnNext(600, true)
- )
- };
-
- var window = 0;
-
- var res = scheduler.Start(() =>
- xs.Buffer(() => closings[window++])
- );
-
- res.Messages.AssertEqual(
- OnNext<IList<int>>(300, b => b.SequenceEqual(new int[] { 3, 4 })),
- OnNext<IList<int>>(400, b => b.SequenceEqual(new int[] { 5, 6 })),
- OnNext<IList<int>>(500, b => b.SequenceEqual(new int[] { 7, 8, 9 })),
- OnNext<IList<int>>(590, b => b.SequenceEqual(new int[] { 10 })),
- OnCompleted<IList<int>>(590)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 590)
- );
-
- closings[0].Subscriptions.AssertEqual(
- Subscribe(200, 300)
- );
-
- closings[1].Subscriptions.AssertEqual(
- Subscribe(300, 400)
- );
-
- closings[2].Subscriptions.AssertEqual(
- Subscribe(400, 500)
- );
-
- closings[3].Subscriptions.AssertEqual(
- Subscribe(500, 590)
- );
- }
-
- [TestMethod]
- public void Buffer_Closings_Empty()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(90, 1),
- OnNext(180, 2),
- OnNext(250, 3),
- OnNext(260, 4),
- OnNext(310, 5),
- OnNext(340, 6),
- OnNext(410, 7),
- OnNext(420, 8),
- OnNext(470, 9),
- OnNext(550, 10),
- OnCompleted<int>(590)
- );
-
- var window = 1;
-
- var res = scheduler.Start(() =>
- xs.Buffer(() => Observable.Empty<int>().Delay(TimeSpan.FromTicks((window++) * 100), scheduler))
- );
-
- res.Messages.AssertEqual(
- OnNext<IList<int>>(300, l => l.SequenceEqual(new int[] { 3, 4 })),
- OnNext<IList<int>>(500, l => l.SequenceEqual(new int[] { 5, 6, 7, 8, 9 })),
- OnNext<IList<int>>(590, l => l.SequenceEqual(new int[] { 10 })),
- OnCompleted<IList<int>>(590)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 590)
- );
- }
-
-
- [TestMethod]
- public void Buffer_Closings_Dispose()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(90, 1),
- OnNext(180, 2),
- OnNext(250, 3),
- OnNext(260, 4),
- OnNext(310, 5),
- OnNext(340, 6),
- OnNext(410, 7),
- OnNext(420, 8),
- OnNext(470, 9),
- OnNext(550, 10),
- OnCompleted<int>(590)
- );
-
- var window = 1;
-
- var res = scheduler.Start(() =>
- xs.Buffer(() => Observable.Timer(TimeSpan.FromTicks((window++) * 100), scheduler)),
- 400
- );
-
- res.Messages.AssertEqual(
- OnNext<IList<int>>(300, l => l.SequenceEqual(new int[] { 3, 4 }))
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 400)
- );
- }
-
- [TestMethod]
- public void Buffer_Closings_Error()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(90, 1),
- OnNext(180, 2),
- OnNext(250, 3),
- OnNext(260, 4),
- OnNext(310, 5),
- OnNext(340, 6),
- OnNext(410, 7),
- OnNext(420, 8),
- OnNext(470, 9),
- OnNext(550, 10),
- OnError<int>(590, ex)
- );
-
- var window = 1;
-
- var res = scheduler.Start(() =>
- xs.Buffer(() => Observable.Timer(TimeSpan.FromTicks((window++) * 100), scheduler))
- );
-
- res.Messages.AssertEqual(
- OnNext<IList<int>>(300, l => l.SequenceEqual(new int[] { 3, 4 })),
- OnNext<IList<int>>(500, l => l.SequenceEqual(new int[] { 5, 6, 7, 8, 9 })),
- OnError<IList<int>>(590, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 590)
- );
- }
-
- [TestMethod]
- public void Buffer_Closings_Throw()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(90, 1),
- OnNext(180, 2),
- OnNext(250, 3),
- OnNext(260, 4),
- OnNext(310, 5),
- OnNext(340, 6),
- OnNext(410, 7),
- OnNext(420, 8),
- OnNext(470, 9),
- OnNext(550, 10),
- OnError<int>(590, new Exception())
- );
-
- var res = scheduler.Start(() =>
- xs.Buffer<int, int>(() => { throw ex; })
- );
-
- res.Messages.AssertEqual(
- OnError<IList<int>>(200, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 200)
- );
- }
-
- [TestMethod]
- public void Buffer_Closings_WindowClose_Error()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(90, 1),
- OnNext(180, 2),
- OnNext(250, 3),
- OnNext(260, 4),
- OnNext(310, 5),
- OnNext(340, 6),
- OnNext(410, 7),
- OnNext(420, 8),
- OnNext(470, 9),
- OnNext(550, 10),
- OnError<int>(590, new Exception())
- );
-
- var res = scheduler.Start(() =>
- xs.Buffer(() => Observable.Throw<int>(ex, scheduler))
- );
-
- res.Messages.AssertEqual(
- OnError<IList<int>>(201, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 201)
- );
- }
-
- [TestMethod]
- public void Buffer_OpeningClosings_Basic()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(90, 1),
- OnNext(180, 2),
- OnNext(250, 3),
- OnNext(260, 4),
- OnNext(310, 5),
- OnNext(340, 6),
- OnNext(410, 7),
- OnNext(420, 8),
- OnNext(470, 9),
- OnNext(550, 10),
- OnCompleted<int>(590)
- );
-
- var ys = scheduler.CreateHotObservable(
- OnNext(255, 50),
- OnNext(330, 100),
- OnNext(350, 50),
- OnNext(400, 90),
- OnCompleted<int>(900)
- );
-
- var res = scheduler.Start(() =>
- xs.Buffer(ys, x => Observable.Timer(TimeSpan.FromTicks(x), scheduler))
- );
-
- res.Messages.AssertEqual(
- OnNext<IList<int>>(305, b => b.SequenceEqual(new int[] { 4 })),
- OnNext<IList<int>>(400, b => b.SequenceEqual(new int[] { })),
- OnNext<IList<int>>(430, b => b.SequenceEqual(new int[] { 6, 7, 8 })),
- OnNext<IList<int>>(490, b => b.SequenceEqual(new int[] { 7, 8, 9 })),
- OnCompleted<IList<int>>(900)
- );
-
-#if !NO_PERF // BREAKING CHANGE v2 > v1.x -> More aggressive disposal behavior
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 590)
- );
-#else
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 900)
- );
-#endif
-
- ys.Subscriptions.AssertEqual(
- Subscribe(200, 900)
- );
- }
-
- [TestMethod]
- public void Buffer_Boundaries_Simple()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(90, 1),
- OnNext(180, 2),
- OnNext(250, 3),
- OnNext(260, 4),
- OnNext(310, 5),
- OnNext(340, 6),
- OnNext(410, 7),
- OnNext(420, 8),
- OnNext(470, 9),
- OnNext(550, 10),
- OnCompleted<int>(590)
- );
-
- var ys = scheduler.CreateHotObservable(
- OnNext(255, true),
- OnNext(330, true),
- OnNext(350, true),
- OnNext(400, true),
- OnNext(500, true),
- OnCompleted<bool>(900)
- );
-
- var res = scheduler.Start(() =>
- xs.Buffer(ys)
- );
-
- res.Messages.AssertEqual(
- OnNext<IList<int>>(255, b => b.SequenceEqual(new int[] { 3 })),
- OnNext<IList<int>>(330, b => b.SequenceEqual(new int[] { 4, 5 })),
- OnNext<IList<int>>(350, b => b.SequenceEqual(new int[] { 6 })),
- OnNext<IList<int>>(400, b => b.SequenceEqual(new int[] { })),
- OnNext<IList<int>>(500, b => b.SequenceEqual(new int[] { 7, 8, 9 })),
- OnNext<IList<int>>(590, b => b.SequenceEqual(new int[] { 10 })),
- OnCompleted<IList<int>>(590)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 590)
- );
-
- ys.Subscriptions.AssertEqual(
- Subscribe(200, 590)
- );
- }
-
- [TestMethod]
- public void Buffer_Boundaries_OnCompletedBoundaries()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(90, 1),
- OnNext(180, 2),
- OnNext(250, 3),
- OnNext(260, 4),
- OnNext(310, 5),
- OnNext(340, 6),
- OnNext(410, 7),
- OnNext(420, 8),
- OnNext(470, 9),
- OnNext(550, 10),
- OnCompleted<int>(590)
- );
-
- var ys = scheduler.CreateHotObservable(
- OnNext(255, true),
- OnNext(330, true),
- OnNext(350, true),
- OnCompleted<bool>(400)
- );
-
- var res = scheduler.Start(() =>
- xs.Buffer(ys)
- );
-
- res.Messages.AssertEqual(
- OnNext<IList<int>>(255, b => b.SequenceEqual(new int[] { 3 })),
- OnNext<IList<int>>(330, b => b.SequenceEqual(new int[] { 4, 5 })),
- OnNext<IList<int>>(350, b => b.SequenceEqual(new int[] { 6 })),
- OnNext<IList<int>>(400, b => b.SequenceEqual(new int[] { })),
- OnCompleted<IList<int>>(400)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 400)
- );
-
- ys.Subscriptions.AssertEqual(
- Subscribe(200, 400)
- );
- }
-
- [TestMethod]
- public void Buffer_Boundaries_OnErrorSource()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(90, 1),
- OnNext(180, 2),
- OnNext(250, 3),
- OnNext(260, 4),
- OnNext(310, 5),
- OnNext(340, 6),
- OnNext(380, 7),
- OnError<int>(400, ex)
- );
-
- var ys = scheduler.CreateHotObservable(
- OnNext(255, true),
- OnNext(330, true),
- OnNext(350, true),
- OnCompleted<bool>(500)
- );
-
- var res = scheduler.Start(() =>
- xs.Buffer(ys)
- );
-
- res.Messages.AssertEqual(
- OnNext<IList<int>>(255, b => b.SequenceEqual(new int[] { 3 })),
- OnNext<IList<int>>(330, b => b.SequenceEqual(new int[] { 4, 5 })),
- OnNext<IList<int>>(350, b => b.SequenceEqual(new int[] { 6 })),
- OnError<IList<int>>(400, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 400)
- );
-
- ys.Subscriptions.AssertEqual(
- Subscribe(200, 400)
- );
- }
-
- [TestMethod]
- public void Buffer_Boundaries_OnErrorBoundaries()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(90, 1),
- OnNext(180, 2),
- OnNext(250, 3),
- OnNext(260, 4),
- OnNext(310, 5),
- OnNext(340, 6),
- OnNext(410, 7),
- OnNext(420, 8),
- OnNext(470, 9),
- OnNext(550, 10),
- OnCompleted<int>(590)
- );
-
- var ys = scheduler.CreateHotObservable(
- OnNext(255, true),
- OnNext(330, true),
- OnNext(350, true),
- OnError<bool>(400, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.Buffer(ys)
- );
-
- res.Messages.AssertEqual(
- OnNext<IList<int>>(255, b => b.SequenceEqual(new int[] { 3 })),
- OnNext<IList<int>>(330, b => b.SequenceEqual(new int[] { 4, 5 })),
- OnNext<IList<int>>(350, b => b.SequenceEqual(new int[] { 6 })),
- OnError<IList<int>>(400, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 400)
- );
-
- ys.Subscriptions.AssertEqual(
- Subscribe(200, 400)
- );
- }
-
- #endregion
-
- #region + Catch +
-
- [TestMethod]
- public void Catch_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Catch<int>((IObservable<int>[])null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Catch<int>((IEnumerable<IObservable<int>>)null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Catch<int>(DummyObservable<int>.Instance, null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Catch<int>((IObservable<int>)null, DummyObservable<int>.Instance));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Catch<int, Exception>(null, _ => DummyObservable<int>.Instance));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Catch<int, Exception>(DummyObservable<int>.Instance, null));
- }
-
- [TestMethod]
- public void Catch_IEofIO_GetEnumeratorThrows()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xss = new RogueEnumerable<IObservable<int>>(ex);
-
- var res = scheduler.Start(() =>
- Observable.Catch(xss)
- );
-
- res.Messages.AssertEqual(
- OnError<int>(200, ex)
- );
- }
-
- [TestMethod]
- public void Catch_IEofIO()
- {
- var scheduler = new TestScheduler();
-
- var xs1 = scheduler.CreateColdObservable<int>(
- OnNext(10, 1),
- OnNext(20, 2),
- OnNext(30, 3),
- OnError<int>(40, new Exception())
- );
-
- var xs2 = scheduler.CreateColdObservable<int>(
- OnNext(10, 4),
- OnNext(20, 5),
- OnError<int>(30, new Exception())
- );
-
- var xs3 = scheduler.CreateColdObservable<int>(
- OnNext(10, 6),
- OnNext(20, 7),
- OnNext(30, 8),
- OnNext(40, 9),
- OnCompleted<int>(50)
- );
-
- var res = scheduler.Start(() =>
- Observable.Catch(new[] { xs1, xs2, xs3 })
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 1),
- OnNext(220, 2),
- OnNext(230, 3),
- OnNext(250, 4),
- OnNext(260, 5),
- OnNext(280, 6),
- OnNext(290, 7),
- OnNext(300, 8),
- OnNext(310, 9),
- OnCompleted<int>(320)
- );
-
- xs1.Subscriptions.AssertEqual(
- Subscribe(200, 240)
- );
-
- xs2.Subscriptions.AssertEqual(
- Subscribe(240, 270)
- );
-
- xs3.Subscriptions.AssertEqual(
- Subscribe(270, 320)
- );
- }
-
- [TestMethod]
- public void Catch_NoErrors()
- {
- var scheduler = new TestScheduler();
-
- var o1 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnNext(220, 3),
- OnCompleted<int>(230)
- );
-
- var o2 = scheduler.CreateHotObservable(
- OnNext(240, 4),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- o1.Catch(o2)
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 2),
- OnNext(220, 3),
- OnCompleted<int>(230)
- );
-
- o1.Subscriptions.AssertEqual(
- Subscribe(200, 230)
- );
-
- o2.Subscriptions.AssertEqual(
- );
- }
-
- [TestMethod]
- public void Catch_Never()
- {
- var scheduler = new TestScheduler();
-
- var o1 = scheduler.CreateHotObservable(
- OnNext(150, 1)
- );
-
- var o2 = scheduler.CreateHotObservable(
- OnNext(240, 4),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- o1.Catch(o2)
- );
-
- res.Messages.AssertEqual(
- );
-
- o1.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
-
- o2.Subscriptions.AssertEqual(
- );
- }
-
- [TestMethod]
- public void Catch_Empty()
- {
- var scheduler = new TestScheduler();
-
- var o1 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnCompleted<int>(230)
- );
-
- var o2 = scheduler.CreateHotObservable(
- OnNext(240, 4),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- o1.Catch(o2)
- );
-
- res.Messages.AssertEqual(
- OnCompleted<int>(230)
- );
-
- o1.Subscriptions.AssertEqual(
- Subscribe(200, 230)
- );
-
- o2.Subscriptions.AssertEqual(
- );
- }
-
- [TestMethod]
- public void Catch_Return()
- {
- var scheduler = new TestScheduler();
-
- var o1 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnCompleted<int>(230)
- );
-
- var o2 = scheduler.CreateHotObservable(
- OnNext(240, 4),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- o1.Catch(o2)
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 2),
- OnCompleted<int>(230)
- );
-
- o1.Subscriptions.AssertEqual(
- Subscribe(200, 230)
- );
-
- o2.Subscriptions.AssertEqual(
- );
- }
-
- [TestMethod]
- public void Catch_Error()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var o1 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnNext(220, 3),
- OnError<int>(230, ex)
- );
-
- var o2 = scheduler.CreateHotObservable(
- OnNext(240, 4),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- o1.Catch(o2)
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 2),
- OnNext(220, 3),
- OnNext(240, 4),
- OnCompleted<int>(250)
- );
-
- o1.Subscriptions.AssertEqual(
- Subscribe(200, 230)
- );
-
- o2.Subscriptions.AssertEqual(
- Subscribe(230, 250)
- );
- }
-
- [TestMethod]
- public void Catch_Error_Never()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var o1 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnNext(220, 3),
- OnError<int>(230, ex)
- );
-
- var o2 = scheduler.CreateHotObservable(
- OnNext(150, 1)
- );
-
- var res = scheduler.Start(() =>
- o1.Catch(o2)
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 2),
- OnNext(220, 3)
- );
-
- o1.Subscriptions.AssertEqual(
- Subscribe(200, 230)
- );
-
- o2.Subscriptions.AssertEqual(
- Subscribe(230, 1000)
- );
- }
-
- [TestMethod]
- public void Catch_Error_Error()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var o1 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnNext(220, 3),
- OnError<int>(230, new Exception())
- );
-
- var o2 = scheduler.CreateHotObservable(
- OnNext(240, 4),
- OnError<int>(250, ex)
- );
-
- var res = scheduler.Start(() =>
- o1.Catch(o2)
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 2),
- OnNext(220, 3),
- OnNext(240, 4),
- OnError<int>(250, ex)
- );
-
- o1.Subscriptions.AssertEqual(
- Subscribe(200, 230)
- );
-
- o2.Subscriptions.AssertEqual(
- Subscribe(230, 250)
- );
- }
-
- [TestMethod]
- public void Catch_Multiple()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var o1 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnError<int>(215, ex)
- );
-
- var o2 = scheduler.CreateHotObservable(
- OnNext(220, 3),
- OnError<int>(225, ex)
- );
-
- var o3 = scheduler.CreateHotObservable(
- OnNext(230, 4),
- OnCompleted<int>(235)
- );
-
- var res = scheduler.Start(() =>
- Observable.Catch(o1, o2, o3)
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 2),
- OnNext(220, 3),
- OnNext(230, 4),
- OnCompleted<int>(235)
- );
-
- o1.Subscriptions.AssertEqual(
- Subscribe(200, 215)
- );
-
- o2.Subscriptions.AssertEqual(
- Subscribe(215, 225)
- );
-
- o3.Subscriptions.AssertEqual(
- Subscribe(225, 235)
- );
- }
-
- [TestMethod]
- public void Catch_ErrorSpecific_Caught()
- {
- var scheduler = new TestScheduler();
-
- var ex = new ArgumentException("x");
-
- var o1 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnNext(220, 3),
- OnError<int>(230, ex)
- );
-
- var o2 = scheduler.CreateHotObservable(
- OnNext(240, 4),
- OnCompleted<int>(250)
- );
-
- var handlerCalled = default(long?);
-
- var res = scheduler.Start(() =>
- o1.Catch((ArgumentException ex_) => { handlerCalled = scheduler.Clock; return o2; })
- );
-
- Assert.AreEqual(230, handlerCalled);
-
- res.Messages.AssertEqual(
- OnNext(210, 2),
- OnNext(220, 3),
- OnNext(240, 4),
- OnCompleted<int>(250)
- );
-
- o1.Subscriptions.AssertEqual(
- Subscribe(200, 230)
- );
-
- o2.Subscriptions.AssertEqual(
- Subscribe(230, 250)
- );
- }
-
- [TestMethod]
- public void Catch_ErrorSpecific_Uncaught()
- {
- var scheduler = new TestScheduler();
-
- var ex = new InvalidOperationException("x");
-
- var o1 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnNext(220, 3),
- OnError<int>(230, ex)
- );
-
- var o2 = scheduler.CreateHotObservable(
- OnNext(240, 4),
- OnCompleted<int>(250)
- );
-
- var handlerCalled = default(long?);
-
- var res = scheduler.Start(() =>
- o1.Catch((ArgumentException ex_) => { handlerCalled = scheduler.Clock; return o2; })
- );
-
- Assert.AreEqual(null, handlerCalled);
-
- res.Messages.AssertEqual(
- OnNext(210, 2),
- OnNext(220, 3),
- OnError<int>(230, ex)
- );
-
- o1.Subscriptions.AssertEqual(
- Subscribe(200, 230)
- );
-
- o2.Subscriptions.AssertEqual(
- );
- }
-
- [TestMethod]
- public void Catch_HandlerThrows()
- {
- var scheduler = new TestScheduler();
-
- var ex1 = new ArgumentException("x");
- var ex2 = new Exception();
-
- var o1 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnNext(220, 3),
- OnError<int>(230, ex1)
- );
-
- var handlerCalled = default(long?);
-
- var res = scheduler.Start(() =>
- o1.Catch((ArgumentException ex_) => { handlerCalled = scheduler.Clock; throw ex2; })
- );
-
- Assert.AreEqual(230, handlerCalled);
-
- res.Messages.AssertEqual(
- OnNext(210, 2),
- OnNext(220, 3),
- OnError<int>(230, ex2)
- );
-
- o1.Subscriptions.AssertEqual(
- Subscribe(200, 230)
- );
- }
-
- [TestMethod]
- public void Catch_Nested_OuterCatches()
- {
- var scheduler = new TestScheduler();
-
- var ex = new ArgumentException("x");
-
- var o1 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnError<int>(215, ex)
- );
-
- var o2 = scheduler.CreateHotObservable(
- OnNext(220, 3),
- OnCompleted<int>(225)
- );
-
- var o3 = scheduler.CreateHotObservable(
- OnNext(220, 4), //!
- OnCompleted<int>(225)
- );
-
- var firstHandlerCalled = default(long?);
- var secondHandlerCalled = default(long?);
-
- var res = scheduler.Start(() =>
- o1
- .Catch((InvalidOperationException ex_) => { firstHandlerCalled = scheduler.Clock; return o2; })
- .Catch((ArgumentException ex_) => { secondHandlerCalled = scheduler.Clock; return o3; })
- );
-
- Assert.AreEqual(null, firstHandlerCalled);
- Assert.AreEqual(215, secondHandlerCalled);
-
- res.Messages.AssertEqual(
- OnNext(210, 2),
- OnNext(220, 4),
- OnCompleted<int>(225)
- );
-
- o1.Subscriptions.AssertEqual(
- Subscribe(200, 215)
- );
-
- o2.Subscriptions.AssertEqual(
- );
-
- o3.Subscriptions.AssertEqual(
- Subscribe(215, 225)
- );
- }
-
- [TestMethod]
- public void Catch_Nested_InnerCatches()
- {
- var scheduler = new TestScheduler();
-
- var ex = new ArgumentException("x");
-
- var o1 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnError<int>(215, ex)
- );
-
- var o2 = scheduler.CreateHotObservable(
- OnNext(220, 3), //!
- OnCompleted<int>(225)
- );
-
- var o3 = scheduler.CreateHotObservable(
- OnNext(220, 4),
- OnCompleted<int>(225)
- );
-
- var firstHandlerCalled = default(long?);
- var secondHandlerCalled = default(long?);
-
- var res = scheduler.Start(() =>
- o1
- .Catch((ArgumentException ex_) => { firstHandlerCalled = scheduler.Clock; return o2; })
- .Catch((InvalidOperationException ex_) => { secondHandlerCalled = scheduler.Clock; return o3; })
- );
-
- Assert.AreEqual(215, firstHandlerCalled);
- Assert.AreEqual(null, secondHandlerCalled);
-
- res.Messages.AssertEqual(
- OnNext(210, 2),
- OnNext(220, 3),
- OnCompleted<int>(225)
- );
-
- o1.Subscriptions.AssertEqual(
- Subscribe(200, 215)
- );
-
- o2.Subscriptions.AssertEqual(
- Subscribe(215, 225)
- );
-
- o3.Subscriptions.AssertEqual(
- );
- }
-
- [TestMethod]
- public void Catch_ThrowFromNestedCatch()
- {
- var scheduler = new TestScheduler();
-
- var ex1 = new ArgumentException("x1");
- var ex2 = new ArgumentException("x2");
-
- var o1 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnError<int>(215, ex1)
- );
-
- var o2 = scheduler.CreateHotObservable(
- OnNext(220, 3), //!
- OnError<int>(225, ex2)
- );
-
- var o3 = scheduler.CreateHotObservable(
- OnNext(230, 4),
- OnCompleted<int>(235)
- );
-
- var firstHandlerCalled = default(long?);
- var secondHandlerCalled = default(long?);
-
- var res = scheduler.Start(() =>
- o1
- .Catch((ArgumentException ex_) => { firstHandlerCalled = scheduler.Clock; Assert.IsTrue(ex1 == ex_, "Expected ex1"); return o2; })
- .Catch((ArgumentException ex_) => { secondHandlerCalled = scheduler.Clock; Assert.IsTrue(ex2 == ex_, "Expected ex2"); return o3; })
- );
-
- Assert.AreEqual(215, firstHandlerCalled);
- Assert.AreEqual(225, secondHandlerCalled);
-
- res.Messages.AssertEqual(
- OnNext(210, 2),
- OnNext(220, 3),
- OnNext(230, 4),
- OnCompleted<int>(235)
- );
-
- o1.Subscriptions.AssertEqual(
- Subscribe(200, 215)
- );
-
- o2.Subscriptions.AssertEqual(
- Subscribe(215, 225)
- );
-
- o3.Subscriptions.AssertEqual(
- Subscribe(225, 235)
- );
- }
-
- [TestMethod]
- public void Catch_DefaultScheduler_Binary()
- {
- var evt = new ManualResetEvent(false);
-
- int res = 0;
- Observable.Return(1).Catch(Observable.Return(2)).Subscribe(x =>
- {
- res = x;
- evt.Set();
- });
-
- evt.WaitOne();
- Assert.AreEqual(1, res);
- }
-
- [TestMethod]
- public void Catch_DefaultScheduler_Nary()
- {
- var evt = new ManualResetEvent(false);
-
- int res = 0;
- Observable.Catch(Observable.Return(1), Observable.Return(2), Observable.Return(3)).Subscribe(x =>
- {
- res = x;
- evt.Set();
- });
-
- evt.WaitOne();
- Assert.AreEqual(1, res);
- }
-
- [TestMethod]
- public void Catch_DefaultScheduler_NaryEnumerable()
- {
- var evt = new ManualResetEvent(false);
-
- IEnumerable<IObservable<int>> sources = new[] { Observable.Return(1), Observable.Return(2), Observable.Return(3) };
-
- int res = 0;
- Observable.Catch(sources).Subscribe(x =>
- {
- res = x;
- evt.Set();
- });
-
- evt.WaitOne();
- Assert.AreEqual(1, res);
- }
-
- [TestMethod]
- public void Catch_EmptyIterator()
- {
- var scheduler = new TestScheduler();
-
- var res = scheduler.Start(() =>
- Observable.Catch<int>((IEnumerable<IObservable<int>>)new IObservable<int>[0])
- );
-
- res.Messages.AssertEqual(
- OnCompleted<int>(200)
- );
- }
-
- [TestMethod]
- public void Catch_IteratorThrows()
- {
- var scheduler = new TestScheduler();
- var ex = new Exception();
-
- var res = scheduler.Start(() =>
- Observable.Catch<int>(Catch_IteratorThrows_Source(ex, true))
- );
-
- res.Messages.AssertEqual(
- OnError<int>(200, ex)
- );
- }
-
- private IEnumerable<IObservable<int>> Catch_IteratorThrows_Source(Exception ex, bool b)
- {
- if (b)
- throw ex;
- else
- yield break;
- }
-
- [TestMethod]
- public void Catch_EnumerableThrows()
- {
- var scheduler = new TestScheduler();
-
- var o = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnNext(220, 3),
- OnCompleted<int>(225)
- );
-
- var ex = new Exception();
- var xss = new MockEnumerable<IObservable<int>>(scheduler, GetObservablesForCatchThrow(o, ex));
-
- var res = scheduler.Start(() =>
- xss.Catch()
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 2),
- OnNext(220, 3),
- OnCompleted<int>(225)
- );
-
- o.Subscriptions.AssertEqual(
- Subscribe(200, 225)
- );
-
- xss.Subscriptions.AssertEqual(
- Subscribe(200, 225)
- );
- }
-
- private IEnumerable<IObservable<int>> GetObservablesForCatchThrow(IObservable<int> first, Exception ex)
- {
- yield return first;
- throw ex;
- }
-
- [TestMethod]
- public void Catch_EnumerableTiming()
- {
- var scheduler = new TestScheduler();
-
- var o1 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2), // !
- OnNext(220, 3), // !
- OnError<int>(230, new Exception())
- );
-
- var o2 = scheduler.CreateColdObservable(
- OnNext(50, 4), // !
- OnNext(60, 5), // !
- OnNext(70, 6), // !
- OnError<int>(80, new Exception())
- );
-
- var o3 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(200, 2),
- OnNext(210, 3),
- OnNext(220, 4),
- OnNext(230, 5),
- OnNext(270, 6),
- OnNext(320, 7), // !
- OnNext(330, 8), // !
- OnCompleted<int>(340)
- );
-
- var xss = new MockEnumerable<ITestableObservable<int>>(scheduler, new[] { o1, o2, o3, o2 });
-
- var res = scheduler.Start(() =>
- xss.Select(xs => (IObservable<int>)xs).Catch()
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 2),
- OnNext(220, 3),
- OnNext(280, 4),
- OnNext(290, 5),
- OnNext(300, 6),
- OnNext(320, 7),
- OnNext(330, 8),
- OnCompleted<int>(340)
- );
-
- o1.Subscriptions.AssertEqual(
- Subscribe(200, 230)
- );
-
- o2.Subscriptions.AssertEqual(
- Subscribe(230, 310)
- );
-
- o3.Subscriptions.AssertEqual(
- Subscribe(310, 340)
- );
-
- xss.Subscriptions.AssertEqual(
- Subscribe(200, 340)
- );
- }
-
- [TestMethod]
- public void Catch_Enumerable_Dispose()
- {
- var scheduler = new TestScheduler();
-
- var o1 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnNext(220, 3),
- OnError<int>(230, new Exception())
- );
-
- var o2 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(200, 2),
- OnNext(210, 3),
- OnNext(240, 4),
- OnNext(270, 5),
- OnNext(320, 6),
- OnNext(330, 7),
- OnCompleted<int>(340)
- );
-
- var xss = new MockEnumerable<ITestableObservable<int>>(scheduler, new[] { o1, o2 });
-
- var res = scheduler.Start(() =>
- xss.Select(xs => (IObservable<int>)xs).Catch(),
- 300
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 2),
- OnNext(220, 3),
- OnNext(240, 4),
- OnNext(270, 5)
- );
-
- o1.Subscriptions.AssertEqual(
- Subscribe(200, 230)
- );
-
- o2.Subscriptions.AssertEqual(
- Subscribe(230, 300)
- );
-
- xss.Subscriptions.AssertEqual(
- Subscribe(200, 300)
- );
- }
-
-#if !NO_PERF
- [TestMethod]
- public void Catch_TailRecursive1()
- {
- var create = 0L;
- var start = 200L;
- var end = 1000L;
-
- var scheduler = new TestScheduler();
-
- var o = scheduler.CreateColdObservable<int>(
- OnNext(10, 1),
- OnNext(20, 2),
- OnNext(30, 3),
- OnError<int>(40, new Exception())
- );
-
- var f = default(Func<IObservable<int>>);
- f = () => Observable.Defer(() => o.Catch(f()));
-
- var res = scheduler.Start(() => f(), create, start, end);
-
- var expected = new List<Recorded<Notification<int>>>();
-
- var t = start;
- while (t <= end)
- {
- var n = (t - start) / 10;
- if (n % 4 != 0)
- {
- expected.Add(OnNext(t, (int)(n % 4)));
- }
-
- t += 10;
- }
-
- res.Messages.AssertEqual(expected);
- }
-
- [TestMethod]
- public void Catch_TailRecursive2()
- {
- var f = default(Func<int, IObservable<int>>);
- f = x => Observable.Defer(() => Observable.Throw<int>(new Exception(), ThreadPoolScheduler.Instance).StartWith(x).Catch(f(x + 1)));
-
- var lst = new List<int>();
- f(0).Select(x => new StackTrace().FrameCount).Take(10).ForEach(lst.Add);
-
- Assert.IsTrue(lst.Last() - lst.First() < 10);
- }
-#endif
-
- #endregion
-
- #region + CombineLatest +
-
- #region ArgumentChecking
-
- [TestMethod]
- public void CombineLatest_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest<int, int, int>(DummyObservable<int>.Instance, DummyObservable<int>.Instance, null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest<int, int, int>(null, DummyObservable<int>.Instance, (_, __) => 0));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest<int, int, int>(DummyObservable<int>.Instance, null, (_, __) => 0));
- }
-
- [TestMethod]
- public void CombineLatest_ArgumentCheckingHighArity()
- {
- var xs = DummyObservable<int>.Instance;
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(default(IObservable<int>), xs, (_0, _1) => _0 + _1));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, default(IObservable<int>), (_0, _1) => _0 + _1));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, default(Func<int, int, int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(default(IObservable<int>), xs, xs, (_0, _1, _2) => _0 + _1 + _2));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, default(IObservable<int>), xs, (_0, _1, _2) => _0 + _1 + _2));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, default(IObservable<int>), (_0, _1, _2) => _0 + _1 + _2));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, xs, default(Func<int, int, int, int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(default(IObservable<int>), xs, xs, xs, (_0, _1, _2, _3) => _0 + _1 + _2 + _3));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, default(IObservable<int>), xs, xs, (_0, _1, _2, _3) => _0 + _1 + _2 + _3));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, default(IObservable<int>), xs, (_0, _1, _2, _3) => _0 + _1 + _2 + _3));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, xs, default(IObservable<int>), (_0, _1, _2, _3) => _0 + _1 + _2 + _3));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, xs, xs, default(Func<int, int, int, int, int>)));
-#if !NO_LARGEARITY
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(default(IObservable<int>), xs, xs, xs, xs, (_0, _1, _2, _3, _4) => _0 + _1 + _2 + _3 + _4));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, default(IObservable<int>), xs, xs, xs, (_0, _1, _2, _3, _4) => _0 + _1 + _2 + _3 + _4));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, default(IObservable<int>), xs, xs, (_0, _1, _2, _3, _4) => _0 + _1 + _2 + _3 + _4));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, xs, default(IObservable<int>), xs, (_0, _1, _2, _3, _4) => _0 + _1 + _2 + _3 + _4));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, xs, xs, default(IObservable<int>), (_0, _1, _2, _3, _4) => _0 + _1 + _2 + _3 + _4));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, xs, xs, xs, default(Func<int, int, int, int, int, int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(default(IObservable<int>), xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5) => _0 + _1 + _2 + _3 + _4 + _5));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, default(IObservable<int>), xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5) => _0 + _1 + _2 + _3 + _4 + _5));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, default(IObservable<int>), xs, xs, xs, (_0, _1, _2, _3, _4, _5) => _0 + _1 + _2 + _3 + _4 + _5));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, xs, default(IObservable<int>), xs, xs, (_0, _1, _2, _3, _4, _5) => _0 + _1 + _2 + _3 + _4 + _5));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, xs, xs, default(IObservable<int>), xs, (_0, _1, _2, _3, _4, _5) => _0 + _1 + _2 + _3 + _4 + _5));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, xs, xs, xs, default(IObservable<int>), (_0, _1, _2, _3, _4, _5) => _0 + _1 + _2 + _3 + _4 + _5));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, xs, xs, xs, xs, default(Func<int, int, int, int, int, int, int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(default(IObservable<int>), xs, xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6) => _0 + _1 + _2 + _3 + _4 + _5 + _6));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, default(IObservable<int>), xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6) => _0 + _1 + _2 + _3 + _4 + _5 + _6));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, default(IObservable<int>), xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6) => _0 + _1 + _2 + _3 + _4 + _5 + _6));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, xs, default(IObservable<int>), xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6) => _0 + _1 + _2 + _3 + _4 + _5 + _6));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, xs, xs, default(IObservable<int>), xs, xs, (_0, _1, _2, _3, _4, _5, _6) => _0 + _1 + _2 + _3 + _4 + _5 + _6));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, xs, xs, xs, default(IObservable<int>), xs, (_0, _1, _2, _3, _4, _5, _6) => _0 + _1 + _2 + _3 + _4 + _5 + _6));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, xs, xs, xs, xs, default(IObservable<int>), (_0, _1, _2, _3, _4, _5, _6) => _0 + _1 + _2 + _3 + _4 + _5 + _6));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, xs, xs, xs, xs, xs, default(Func<int, int, int, int, int, int, int, int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(default(IObservable<int>), xs, xs, xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, default(IObservable<int>), xs, xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, default(IObservable<int>), xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, xs, default(IObservable<int>), xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, xs, xs, default(IObservable<int>), xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, xs, xs, xs, default(IObservable<int>), xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, xs, xs, xs, xs, default(IObservable<int>), xs, (_0, _1, _2, _3, _4, _5, _6, _7) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, xs, xs, xs, xs, xs, default(IObservable<int>), (_0, _1, _2, _3, _4, _5, _6, _7) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, xs, xs, xs, xs, xs, xs, default(Func<int, int, int, int, int, int, int, int, int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(default(IObservable<int>), xs, xs, xs, xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, default(IObservable<int>), xs, xs, xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, default(IObservable<int>), xs, xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, xs, default(IObservable<int>), xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, xs, xs, default(IObservable<int>), xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, xs, xs, xs, default(IObservable<int>), xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, xs, xs, xs, xs, default(IObservable<int>), xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, xs, xs, xs, xs, xs, default(IObservable<int>), xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, xs, xs, xs, xs, xs, xs, default(IObservable<int>), (_0, _1, _2, _3, _4, _5, _6, _7, _8) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, xs, xs, xs, xs, xs, xs, xs, default(Func<int, int, int, int, int, int, int, int, int, int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(default(IObservable<int>), xs, xs, xs, xs, xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, default(IObservable<int>), xs, xs, xs, xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, default(IObservable<int>), xs, xs, xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, xs, default(IObservable<int>), xs, xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, xs, xs, default(IObservable<int>), xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, xs, xs, xs, default(IObservable<int>), xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, xs, xs, xs, xs, default(IObservable<int>), xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, xs, xs, xs, xs, xs, default(IObservable<int>), xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, xs, xs, xs, xs, xs, xs, default(IObservable<int>), xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, xs, xs, xs, xs, xs, xs, xs, default(IObservable<int>), (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, default(Func<int, int, int, int, int, int, int, int, int, int, int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(default(IObservable<int>), xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, default(IObservable<int>), xs, xs, xs, xs, xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, default(IObservable<int>), xs, xs, xs, xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, xs, default(IObservable<int>), xs, xs, xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, xs, xs, default(IObservable<int>), xs, xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, xs, xs, xs, default(IObservable<int>), xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, xs, xs, xs, xs, default(IObservable<int>), xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, xs, xs, xs, xs, xs, default(IObservable<int>), xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, xs, xs, xs, xs, xs, xs, default(IObservable<int>), xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, xs, xs, xs, xs, xs, xs, xs, default(IObservable<int>), xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, default(IObservable<int>), (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, default(Func<int, int, int, int, int, int, int, int, int, int, int, int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(default(IObservable<int>), xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, default(IObservable<int>), xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, default(IObservable<int>), xs, xs, xs, xs, xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, xs, default(IObservable<int>), xs, xs, xs, xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, xs, xs, default(IObservable<int>), xs, xs, xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, xs, xs, xs, default(IObservable<int>), xs, xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, xs, xs, xs, xs, default(IObservable<int>), xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, xs, xs, xs, xs, xs, default(IObservable<int>), xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, xs, xs, xs, xs, xs, xs, default(IObservable<int>), xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, xs, xs, xs, xs, xs, xs, xs, default(IObservable<int>), xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, default(IObservable<int>), xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, default(IObservable<int>), (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, default(Func<int, int, int, int, int, int, int, int, int, int, int, int, int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(default(IObservable<int>), xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, default(IObservable<int>), xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, default(IObservable<int>), xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, xs, default(IObservable<int>), xs, xs, xs, xs, xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, xs, xs, default(IObservable<int>), xs, xs, xs, xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, xs, xs, xs, default(IObservable<int>), xs, xs, xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, xs, xs, xs, xs, default(IObservable<int>), xs, xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, xs, xs, xs, xs, xs, default(IObservable<int>), xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, xs, xs, xs, xs, xs, xs, default(IObservable<int>), xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, xs, xs, xs, xs, xs, xs, xs, default(IObservable<int>), xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, default(IObservable<int>), xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, default(IObservable<int>), xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, default(IObservable<int>), (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, default(Func<int, int, int, int, int, int, int, int, int, int, int, int, int, int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(default(IObservable<int>), xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12 + _13));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, default(IObservable<int>), xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12 + _13));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, default(IObservable<int>), xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12 + _13));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, xs, default(IObservable<int>), xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12 + _13));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, xs, xs, default(IObservable<int>), xs, xs, xs, xs, xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12 + _13));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, xs, xs, xs, default(IObservable<int>), xs, xs, xs, xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12 + _13));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, xs, xs, xs, xs, default(IObservable<int>), xs, xs, xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12 + _13));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, xs, xs, xs, xs, xs, default(IObservable<int>), xs, xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12 + _13));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, xs, xs, xs, xs, xs, xs, default(IObservable<int>), xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12 + _13));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, xs, xs, xs, xs, xs, xs, xs, default(IObservable<int>), xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12 + _13));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, default(IObservable<int>), xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12 + _13));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, default(IObservable<int>), xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12 + _13));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, default(IObservable<int>), xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12 + _13));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, default(IObservable<int>), (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12 + _13));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, default(Func<int, int, int, int, int, int, int, int, int, int, int, int, int, int, int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(default(IObservable<int>), xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12 + _13 + _14));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, default(IObservable<int>), xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12 + _13 + _14));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, default(IObservable<int>), xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12 + _13 + _14));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, xs, default(IObservable<int>), xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12 + _13 + _14));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, xs, xs, default(IObservable<int>), xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12 + _13 + _14));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, xs, xs, xs, default(IObservable<int>), xs, xs, xs, xs, xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12 + _13 + _14));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, xs, xs, xs, xs, default(IObservable<int>), xs, xs, xs, xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12 + _13 + _14));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, xs, xs, xs, xs, xs, default(IObservable<int>), xs, xs, xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12 + _13 + _14));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, xs, xs, xs, xs, xs, xs, default(IObservable<int>), xs, xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12 + _13 + _14));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, xs, xs, xs, xs, xs, xs, xs, default(IObservable<int>), xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12 + _13 + _14));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, default(IObservable<int>), xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12 + _13 + _14));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, default(IObservable<int>), xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12 + _13 + _14));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, default(IObservable<int>), xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12 + _13 + _14));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, default(IObservable<int>), xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12 + _13 + _14));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, default(IObservable<int>), (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12 + _13 + _14));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, default(Func<int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(default(IObservable<int>), xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12 + _13 + _14 + _15));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, default(IObservable<int>), xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12 + _13 + _14 + _15));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, default(IObservable<int>), xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12 + _13 + _14 + _15));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, xs, default(IObservable<int>), xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12 + _13 + _14 + _15));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, xs, xs, default(IObservable<int>), xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12 + _13 + _14 + _15));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, xs, xs, xs, default(IObservable<int>), xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12 + _13 + _14 + _15));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, xs, xs, xs, xs, default(IObservable<int>), xs, xs, xs, xs, xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12 + _13 + _14 + _15));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, xs, xs, xs, xs, xs, default(IObservable<int>), xs, xs, xs, xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12 + _13 + _14 + _15));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, xs, xs, xs, xs, xs, xs, default(IObservable<int>), xs, xs, xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12 + _13 + _14 + _15));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, xs, xs, xs, xs, xs, xs, xs, default(IObservable<int>), xs, xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12 + _13 + _14 + _15));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, default(IObservable<int>), xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12 + _13 + _14 + _15));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, default(IObservable<int>), xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12 + _13 + _14 + _15));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, default(IObservable<int>), xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12 + _13 + _14 + _15));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, default(IObservable<int>), xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12 + _13 + _14 + _15));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, default(IObservable<int>), xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12 + _13 + _14 + _15));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, default(IObservable<int>), (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12 + _13 + _14 + _15));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, default(Func<int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int>)));
-#endif
- }
-
- #endregion
-
- #region Never
-
- [TestMethod]
- public void CombineLatest_NeverN()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
-
- var res = scheduler.Start(() =>
- Observable.CombineLatest(new[] { e0, e1, e2 }, xs => xs.Sum())
- );
-
- res.Messages.AssertEqual(
- );
-
- foreach (var e in new[] { e0, e1, e2 })
- e.Subscriptions.AssertEqual(Subscribe(200, 1000));
- }
-
- [TestMethod]
- public void CombineLatest_Never2()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
-
- var res = scheduler.Start(() =>
- Observable.CombineLatest(e0, e1, (_0, _1) => 42)
- );
-
- res.Messages.AssertEqual(
- );
-
- foreach (var e in new[] { e0, e1 })
- e.Subscriptions.AssertEqual(Subscribe(200, 1000));
- }
-
- [TestMethod]
- public void CombineLatest_Never3()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
-
- var res = scheduler.Start(() =>
- Observable.CombineLatest(e0, e1, e2, (_0, _1, _2) => 42)
- );
-
- res.Messages.AssertEqual(
- );
-
- foreach (var e in new[] { e0, e1, e2 })
- e.Subscriptions.AssertEqual(Subscribe(200, 1000));
- }
-
- [TestMethod]
- public void CombineLatest_Never4()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
-
- var res = scheduler.Start(() =>
- Observable.CombineLatest(e0, e1, e2, e3, (_0, _1, _2, _3) => 42)
- );
-
- res.Messages.AssertEqual(
- );
-
- foreach (var e in new[] { e0, e1, e2, e3 })
- e.Subscriptions.AssertEqual(Subscribe(200, 1000));
- }
-
-#if !NO_LARGEARITY
- [TestMethod]
- public void CombineLatest_Never5()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
-
- var res = scheduler.Start(() =>
- Observable.CombineLatest(e0, e1, e2, e3, e4, (_0, _1, _2, _3, _4) => 42)
- );
-
- res.Messages.AssertEqual(
- );
-
- foreach (var e in new[] { e0, e1, e2, e3, e4 })
- e.Subscriptions.AssertEqual(Subscribe(200, 1000));
- }
-
- [TestMethod]
- public void CombineLatest_Never6()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e5 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
-
- var res = scheduler.Start(() =>
- Observable.CombineLatest(e0, e1, e2, e3, e4, e5, (_0, _1, _2, _3, _4, _5) => 42)
- );
-
- res.Messages.AssertEqual(
- );
-
- foreach (var e in new[] { e0, e1, e2, e3, e4, e5 })
- e.Subscriptions.AssertEqual(Subscribe(200, 1000));
- }
-
- [TestMethod]
- public void CombineLatest_Never7()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e5 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e6 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
-
- var res = scheduler.Start(() =>
- Observable.CombineLatest(e0, e1, e2, e3, e4, e5, e6, (_0, _1, _2, _3, _4, _5, _6) => 42)
- );
-
- res.Messages.AssertEqual(
- );
-
- foreach (var e in new[] { e0, e1, e2, e3, e4, e5, e6 })
- e.Subscriptions.AssertEqual(Subscribe(200, 1000));
- }
-
- [TestMethod]
- public void CombineLatest_Never8()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e5 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e6 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e7 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
-
- var res = scheduler.Start(() =>
- Observable.CombineLatest(e0, e1, e2, e3, e4, e5, e6, e7, (_0, _1, _2, _3, _4, _5, _6, _7) => 42)
- );
-
- res.Messages.AssertEqual(
- );
-
- foreach (var e in new[] { e0, e1, e2, e3, e4, e5, e6, e7 })
- e.Subscriptions.AssertEqual(Subscribe(200, 1000));
- }
-
- [TestMethod]
- public void CombineLatest_Never9()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e5 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e6 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e7 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e8 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
-
- var res = scheduler.Start(() =>
- Observable.CombineLatest(e0, e1, e2, e3, e4, e5, e6, e7, e8, (_0, _1, _2, _3, _4, _5, _6, _7, _8) => 42)
- );
-
- res.Messages.AssertEqual(
- );
-
- foreach (var e in new[] { e0, e1, e2, e3, e4, e5, e6, e7, e8 })
- e.Subscriptions.AssertEqual(Subscribe(200, 1000));
- }
-
- [TestMethod]
- public void CombineLatest_Never10()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e5 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e6 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e7 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e8 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e9 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
-
- var res = scheduler.Start(() =>
- Observable.CombineLatest(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9) => 42)
- );
-
- res.Messages.AssertEqual(
- );
-
- foreach (var e in new[] { e0, e1, e2, e3, e4, e5, e6, e7, e8, e9 })
- e.Subscriptions.AssertEqual(Subscribe(200, 1000));
- }
-
- [TestMethod]
- public void CombineLatest_Never11()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e5 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e6 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e7 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e8 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e9 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e10 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
-
- var res = scheduler.Start(() =>
- Observable.CombineLatest(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10) => 42)
- );
-
- res.Messages.AssertEqual(
- );
-
- foreach (var e in new[] { e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10 })
- e.Subscriptions.AssertEqual(Subscribe(200, 1000));
- }
-
- [TestMethod]
- public void CombineLatest_Never12()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e5 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e6 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e7 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e8 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e9 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e10 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e11 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
-
- var res = scheduler.Start(() =>
- Observable.CombineLatest(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11) => 42)
- );
-
- res.Messages.AssertEqual(
- );
-
- foreach (var e in new[] { e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11 })
- e.Subscriptions.AssertEqual(Subscribe(200, 1000));
- }
-
- [TestMethod]
- public void CombineLatest_Never13()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e5 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e6 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e7 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e8 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e9 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e10 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e11 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e12 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
-
- var res = scheduler.Start(() =>
- Observable.CombineLatest(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12) => 42)
- );
-
- res.Messages.AssertEqual(
- );
-
- foreach (var e in new[] { e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12 })
- e.Subscriptions.AssertEqual(Subscribe(200, 1000));
- }
-
- [TestMethod]
- public void CombineLatest_Never14()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e5 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e6 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e7 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e8 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e9 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e10 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e11 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e12 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e13 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
-
- var res = scheduler.Start(() =>
- Observable.CombineLatest(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13) => 42)
- );
-
- res.Messages.AssertEqual(
- );
-
- foreach (var e in new[] { e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13 })
- e.Subscriptions.AssertEqual(Subscribe(200, 1000));
- }
-
- [TestMethod]
- public void CombineLatest_Never15()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e5 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e6 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e7 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e8 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e9 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e10 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e11 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e12 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e13 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e14 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
-
- var res = scheduler.Start(() =>
- Observable.CombineLatest(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14) => 42)
- );
-
- res.Messages.AssertEqual(
- );
-
- foreach (var e in new[] { e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14 })
- e.Subscriptions.AssertEqual(Subscribe(200, 1000));
- }
-
- [TestMethod]
- public void CombineLatest_Never16()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e5 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e6 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e7 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e8 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e9 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e10 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e11 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e12 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e13 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e14 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e15 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
-
- var res = scheduler.Start(() =>
- Observable.CombineLatest(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15) => 42)
- );
-
- res.Messages.AssertEqual(
- );
-
- foreach (var e in new[] { e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15 })
- e.Subscriptions.AssertEqual(Subscribe(200, 1000));
- }
-#endif
-
- #endregion
-
- #region Never/Empty
-
- [TestMethod]
- public void CombineLatest_NeverEmpty()
- {
- var scheduler = new TestScheduler();
-
- var n = scheduler.CreateHotObservable(
- OnNext(150, 1)
- );
-
- var e = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnCompleted<int>(210)
- );
-
- var res = scheduler.Start(() =>
- n.CombineLatest(e, (x, y) => x + y)
- );
-
- res.Messages.AssertEqual(
- );
-
- n.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
-
- e.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void CombineLatest_EmptyNever()
- {
- var scheduler = new TestScheduler();
-
- var e = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnCompleted<int>(210)
- );
-
- var n = scheduler.CreateHotObservable(
- OnNext(150, 1)
- );
-
- var res = scheduler.Start(() =>
- e.CombineLatest(n, (x, y) => x + y)
- );
-
- res.Messages.AssertEqual(
- );
-
- n.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
-
- e.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- #endregion
-
- #region Empty
-
- [TestMethod]
- public void CombineLatest_EmptyN()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(210) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(220) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(230) });
-
- var res = scheduler.Start(() =>
- Observable.CombineLatest(new[] { e0, e1, e2 }, xs => xs.Sum())
- );
-
- res.Messages.AssertEqual(
- OnCompleted<int>(230)
- );
-
- var i = 0;
- foreach (var e in new[] { e0, e1, e2 })
- e.Subscriptions.AssertEqual(Subscribe(200, 200 + (++i * 10)));
- }
-
- [TestMethod]
- public void CombineLatest_Empty2()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(210) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(220) });
-
- var res = scheduler.Start(() =>
- Observable.CombineLatest(e0, e1, (_0, _1) => 42)
- );
-
- res.Messages.AssertEqual(
- OnCompleted<int>(220)
- );
-
- var i = 0;
- foreach (var e in new[] { e0, e1 })
- e.Subscriptions.AssertEqual(Subscribe(200, 200 + (++i * 10)));
- }
-
- [TestMethod]
- public void CombineLatest_Empty3()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(210) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(220) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(230) });
-
- var res = scheduler.Start(() =>
- Observable.CombineLatest(e0, e1, e2, (_0, _1, _2) => 42)
- );
-
- res.Messages.AssertEqual(
- OnCompleted<int>(230)
- );
-
- var i = 0;
- foreach (var e in new[] { e0, e1, e2 })
- e.Subscriptions.AssertEqual(Subscribe(200, 200 + (++i * 10)));
- }
-
- [TestMethod]
- public void CombineLatest_Empty4()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(210) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(220) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(230) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(240) });
-
- var res = scheduler.Start(() =>
- Observable.CombineLatest(e0, e1, e2, e3, (_0, _1, _2, _3) => 42)
- );
-
- res.Messages.AssertEqual(
- OnCompleted<int>(240)
- );
-
- var i = 0;
- foreach (var e in new[] { e0, e1, e2, e3 })
- e.Subscriptions.AssertEqual(Subscribe(200, 200 + (++i * 10)));
- }
-
-#if !NO_LARGEARITY
- [TestMethod]
- public void CombineLatest_Empty5()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(210) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(220) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(230) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(240) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(250) });
-
- var res = scheduler.Start(() =>
- Observable.CombineLatest(e0, e1, e2, e3, e4, (_0, _1, _2, _3, _4) => 42)
- );
-
- res.Messages.AssertEqual(
- OnCompleted<int>(250)
- );
-
- var i = 0;
- foreach (var e in new[] { e0, e1, e2, e3, e4 })
- e.Subscriptions.AssertEqual(Subscribe(200, 200 + (++i * 10)));
- }
-
- [TestMethod]
- public void CombineLatest_Empty6()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(210) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(220) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(230) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(240) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(250) });
- var e5 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(260) });
-
- var res = scheduler.Start(() =>
- Observable.CombineLatest(e0, e1, e2, e3, e4, e5, (_0, _1, _2, _3, _4, _5) => 42)
- );
-
- res.Messages.AssertEqual(
- OnCompleted<int>(260)
- );
-
- var i = 0;
- foreach (var e in new[] { e0, e1, e2, e3, e4, e5 })
- e.Subscriptions.AssertEqual(Subscribe(200, 200 + (++i * 10)));
- }
-
- [TestMethod]
- public void CombineLatest_Empty7()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(210) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(220) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(230) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(240) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(250) });
- var e5 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(260) });
- var e6 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(270) });
-
- var res = scheduler.Start(() =>
- Observable.CombineLatest(e0, e1, e2, e3, e4, e5, e6, (_0, _1, _2, _3, _4, _5, _6) => 42)
- );
-
- res.Messages.AssertEqual(
- OnCompleted<int>(270)
- );
-
- var i = 0;
- foreach (var e in new[] { e0, e1, e2, e3, e4, e5, e6 })
- e.Subscriptions.AssertEqual(Subscribe(200, 200 + (++i * 10)));
- }
-
- [TestMethod]
- public void CombineLatest_Empty8()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(210) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(220) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(230) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(240) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(250) });
- var e5 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(260) });
- var e6 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(270) });
- var e7 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(280) });
-
- var res = scheduler.Start(() =>
- Observable.CombineLatest(e0, e1, e2, e3, e4, e5, e6, e7, (_0, _1, _2, _3, _4, _5, _6, _7) => 42)
- );
-
- res.Messages.AssertEqual(
- OnCompleted<int>(280)
- );
-
- var i = 0;
- foreach (var e in new[] { e0, e1, e2, e3, e4, e5, e6, e7 })
- e.Subscriptions.AssertEqual(Subscribe(200, 200 + (++i * 10)));
- }
-
- [TestMethod]
- public void CombineLatest_Empty9()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(210) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(220) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(230) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(240) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(250) });
- var e5 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(260) });
- var e6 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(270) });
- var e7 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(280) });
- var e8 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(290) });
-
- var res = scheduler.Start(() =>
- Observable.CombineLatest(e0, e1, e2, e3, e4, e5, e6, e7, e8, (_0, _1, _2, _3, _4, _5, _6, _7, _8) => 42)
- );
-
- res.Messages.AssertEqual(
- OnCompleted<int>(290)
- );
-
- var i = 0;
- foreach (var e in new[] { e0, e1, e2, e3, e4, e5, e6, e7, e8 })
- e.Subscriptions.AssertEqual(Subscribe(200, 200 + (++i * 10)));
- }
-
- [TestMethod]
- public void CombineLatest_Empty10()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(210) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(220) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(230) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(240) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(250) });
- var e5 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(260) });
- var e6 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(270) });
- var e7 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(280) });
- var e8 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(290) });
- var e9 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(300) });
-
- var res = scheduler.Start(() =>
- Observable.CombineLatest(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9) => 42)
- );
-
- res.Messages.AssertEqual(
- OnCompleted<int>(300)
- );
-
- var i = 0;
- foreach (var e in new[] { e0, e1, e2, e3, e4, e5, e6, e7, e8, e9 })
- e.Subscriptions.AssertEqual(Subscribe(200, 200 + (++i * 10)));
- }
-
- [TestMethod]
- public void CombineLatest_Empty11()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(210) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(220) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(230) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(240) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(250) });
- var e5 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(260) });
- var e6 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(270) });
- var e7 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(280) });
- var e8 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(290) });
- var e9 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(300) });
- var e10 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(310) });
-
- var res = scheduler.Start(() =>
- Observable.CombineLatest(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10) => 42)
- );
-
- res.Messages.AssertEqual(
- OnCompleted<int>(310)
- );
-
- var i = 0;
- foreach (var e in new[] { e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10 })
- e.Subscriptions.AssertEqual(Subscribe(200, 200 + (++i * 10)));
- }
-
- [TestMethod]
- public void CombineLatest_Empty12()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(210) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(220) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(230) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(240) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(250) });
- var e5 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(260) });
- var e6 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(270) });
- var e7 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(280) });
- var e8 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(290) });
- var e9 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(300) });
- var e10 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(310) });
- var e11 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(320) });
-
- var res = scheduler.Start(() =>
- Observable.CombineLatest(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11) => 42)
- );
-
- res.Messages.AssertEqual(
- OnCompleted<int>(320)
- );
-
- var i = 0;
- foreach (var e in new[] { e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11 })
- e.Subscriptions.AssertEqual(Subscribe(200, 200 + (++i * 10)));
- }
-
- [TestMethod]
- public void CombineLatest_Empty13()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(210) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(220) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(230) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(240) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(250) });
- var e5 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(260) });
- var e6 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(270) });
- var e7 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(280) });
- var e8 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(290) });
- var e9 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(300) });
- var e10 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(310) });
- var e11 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(320) });
- var e12 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(330) });
-
- var res = scheduler.Start(() =>
- Observable.CombineLatest(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12) => 42)
- );
-
- res.Messages.AssertEqual(
- OnCompleted<int>(330)
- );
-
- var i = 0;
- foreach (var e in new[] { e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12 })
- e.Subscriptions.AssertEqual(Subscribe(200, 200 + (++i * 10)));
- }
-
- [TestMethod]
- public void CombineLatest_Empty14()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(210) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(220) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(230) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(240) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(250) });
- var e5 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(260) });
- var e6 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(270) });
- var e7 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(280) });
- var e8 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(290) });
- var e9 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(300) });
- var e10 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(310) });
- var e11 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(320) });
- var e12 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(330) });
- var e13 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(340) });
-
- var res = scheduler.Start(() =>
- Observable.CombineLatest(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13) => 42)
- );
-
- res.Messages.AssertEqual(
- OnCompleted<int>(340)
- );
-
- var i = 0;
- foreach (var e in new[] { e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13 })
- e.Subscriptions.AssertEqual(Subscribe(200, 200 + (++i * 10)));
- }
-
- [TestMethod]
- public void CombineLatest_Empty15()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(210) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(220) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(230) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(240) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(250) });
- var e5 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(260) });
- var e6 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(270) });
- var e7 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(280) });
- var e8 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(290) });
- var e9 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(300) });
- var e10 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(310) });
- var e11 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(320) });
- var e12 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(330) });
- var e13 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(340) });
- var e14 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(350) });
-
- var res = scheduler.Start(() =>
- Observable.CombineLatest(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14) => 42)
- );
-
- res.Messages.AssertEqual(
- OnCompleted<int>(350)
- );
-
- var i = 0;
- foreach (var e in new[] { e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14 })
- e.Subscriptions.AssertEqual(Subscribe(200, 200 + (++i * 10)));
- }
-
- [TestMethod]
- public void CombineLatest_Empty16()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(210) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(220) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(230) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(240) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(250) });
- var e5 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(260) });
- var e6 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(270) });
- var e7 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(280) });
- var e8 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(290) });
- var e9 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(300) });
- var e10 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(310) });
- var e11 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(320) });
- var e12 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(330) });
- var e13 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(340) });
- var e14 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(350) });
- var e15 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(360) });
-
- var res = scheduler.Start(() =>
- Observable.CombineLatest(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15) => 42)
- );
-
- res.Messages.AssertEqual(
- OnCompleted<int>(360)
- );
-
- var i = 0;
- foreach (var e in new[] { e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15 })
- e.Subscriptions.AssertEqual(Subscribe(200, 200 + (++i * 10)));
- }
-#endif
-
- #endregion
-
- #region Empty/Return
-
- [TestMethod]
- public void CombineLatest_EmptyReturn()
- {
- var scheduler = new TestScheduler();
-
- var e = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnCompleted<int>(210)
- );
-
- var o = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(215, 2),
- OnCompleted<int>(220)
- );
-
- var res = scheduler.Start(() =>
- e.CombineLatest(o, (x, y) => x + y)
- );
-
- res.Messages.AssertEqual(
- OnCompleted<int>(215)
- );
-
- e.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
-
- o.Subscriptions.AssertEqual(
- Subscribe(200, 215)
- );
- }
-
- [TestMethod]
- public void CombineLatest_ReturnEmpty()
- {
- var scheduler = new TestScheduler();
-
- var e = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnCompleted<int>(210)
- );
-
- var o = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(215, 2),
- OnCompleted<int>(220)
- );
-
- var res = scheduler.Start(() =>
- o.CombineLatest(e, (x, y) => x + y)
- );
-
- res.Messages.AssertEqual(
- OnCompleted<int>(215)
- );
-
- e.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
-
- o.Subscriptions.AssertEqual(
- Subscribe(200, 215)
- );
- }
-
- #endregion
-
- #region Never/Return
-
- [TestMethod]
- public void CombineLatest_NeverReturn()
- {
- var scheduler = new TestScheduler();
-
- var o = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(215, 2),
- OnCompleted<int>(220)
- );
-
- var n = scheduler.CreateHotObservable(
- OnNext(150, 1)
- );
-
- var res = scheduler.Start(() =>
- n.CombineLatest(o, (x, y) => x + y)
- );
-
- res.Messages.AssertEqual(
- );
-
- o.Subscriptions.AssertEqual(
- Subscribe(200, 220)
- );
-
- n.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
- }
-
- [TestMethod]
- public void CombineLatest_ReturnNever()
- {
- var scheduler = new TestScheduler();
-
- var o = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(215, 2),
- OnCompleted<int>(220)
- );
-
- var n = scheduler.CreateHotObservable(
- OnNext(150, 1)
- );
-
- var res = scheduler.Start(() =>
- o.CombineLatest(n, (x, y) => x + y)
- );
-
- res.Messages.AssertEqual(
- );
-
- o.Subscriptions.AssertEqual(
- Subscribe(200, 220)
- );
-
- n.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
- }
-
- #endregion
-
- #region Return/Return
-
- [TestMethod]
- public void CombineLatest_ReturnReturn()
- {
- var scheduler = new TestScheduler();
-
- var o1 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(215, 2),
- OnCompleted<int>(230)
- );
-
- var o2 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(220, 3),
- OnCompleted<int>(240)
- );
-
- var res = scheduler.Start(() =>
- o1.CombineLatest(o2, (x, y) => x + y)
- );
-
- res.Messages.AssertEqual(
- OnNext(220, 2 + 3),
- OnCompleted<int>(240)
- );
-
- o1.Subscriptions.AssertEqual(
- Subscribe(200, 230)
- );
-
- o2.Subscriptions.AssertEqual(
- Subscribe(200, 240)
- );
- }
-
- #endregion
-
- #region Empty/Error
-
- [TestMethod]
- public void CombineLatest_EmptyError()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var o1 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnCompleted<int>(230)
- );
-
- var o2 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnError<int>(220, ex)
- );
-
- var res = scheduler.Start(() =>
- o1.CombineLatest(o2, (x, y) => x + y)
- );
-
- res.Messages.AssertEqual(
- OnError<int>(220, ex)
- );
-
- o1.Subscriptions.AssertEqual(
- Subscribe(200, 220)
- );
-
- o2.Subscriptions.AssertEqual(
- Subscribe(200, 220)
- );
- }
-
- [TestMethod]
- public void CombineLatest_ErrorEmpty()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var e = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnCompleted<int>(230)
- );
-
- var f = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnError<int>(220, ex)
- );
-
- var res = scheduler.Start(() =>
- f.CombineLatest(e, (x, y) => x + y)
- );
-
- res.Messages.AssertEqual(
- OnError<int>(220, ex)
- );
-
- e.Subscriptions.AssertEqual(
- Subscribe(200, 220)
- );
-
- f.Subscriptions.AssertEqual(
- Subscribe(200, 220)
- );
- }
-
- #endregion
-
- #region Return/Throw
-
- [TestMethod]
- public void CombineLatest_ReturnThrow()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var o1 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnCompleted<int>(230)
- );
-
- var o2 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnError<int>(220, ex)
- );
-
- var res = scheduler.Start(() =>
- o1.CombineLatest(o2, (x, y) => x + y)
- );
-
- res.Messages.AssertEqual(
- OnError<int>(220, ex)
- );
-
- o1.Subscriptions.AssertEqual(
- Subscribe(200, 220)
- );
-
- o2.Subscriptions.AssertEqual(
- Subscribe(200, 220)
- );
- }
-
- [TestMethod]
- public void CombineLatest_ThrowReturn()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var o1 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnCompleted<int>(230)
- );
-
- var o2 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnError<int>(220, ex)
- );
-
- var res = scheduler.Start(() =>
- o2.CombineLatest(o1, (x, y) => x + y)
- );
-
- res.Messages.AssertEqual(
- OnError<int>(220, ex)
- );
-
- o1.Subscriptions.AssertEqual(
- Subscribe(200, 220)
- );
-
- o2.Subscriptions.AssertEqual(
- Subscribe(200, 220)
- );
- }
-
- #endregion
-
- #region Throw/Throw
-
- [TestMethod]
- public void CombineLatest_ThrowThrow()
- {
- var scheduler = new TestScheduler();
-
- var ex1 = new Exception();
- var ex2 = new Exception();
-
- var o1 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnError<int>(220, ex1)
- );
-
- var o2 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnError<int>(230, ex2)
- );
-
- var res = scheduler.Start(() =>
- o2.CombineLatest(o1, (x, y) => x + y)
- );
-
- res.Messages.AssertEqual(
- OnError<int>(220, ex1)
- );
-
- o1.Subscriptions.AssertEqual(
- Subscribe(200, 220)
- );
-
- o2.Subscriptions.AssertEqual(
- Subscribe(200, 220)
- );
- }
-
- [TestMethod]
- public void CombineLatest_ErrorThrow()
- {
- var scheduler = new TestScheduler();
-
- var ex1 = new Exception();
- var ex2 = new Exception();
-
- var o1 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnError<int>(220, ex1)
- );
-
- var o2 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnError<int>(230, ex2)
- );
-
- var res = scheduler.Start(() =>
- o2.CombineLatest(o1, (x, y) => x + y)
- );
-
- res.Messages.AssertEqual(
- OnError<int>(220, ex1)
- );
-
- o1.Subscriptions.AssertEqual(
- Subscribe(200, 220)
- );
-
- o2.Subscriptions.AssertEqual(
- Subscribe(200, 220)
- );
- }
-
- [TestMethod]
- public void CombineLatest_ThrowError()
- {
- var scheduler = new TestScheduler();
-
- var ex1 = new Exception();
- var ex2 = new Exception();
-
- var o1 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnError<int>(220, ex1)
- );
-
- var o2 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnError<int>(230, ex2)
- );
-
- var res = scheduler.Start(() =>
- o1.CombineLatest(o2, (x, y) => x + y)
- );
-
- res.Messages.AssertEqual(
- OnError<int>(220, ex1)
- );
-
- o1.Subscriptions.AssertEqual(
- Subscribe(200, 220)
- );
-
- o2.Subscriptions.AssertEqual(
- Subscribe(200, 220)
- );
- }
-
- #endregion
-
- #region Never/Throw
-
- [TestMethod]
- public void CombineLatest_NeverThrow()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var o1 = scheduler.CreateHotObservable(
- OnNext(150, 1)
- );
-
- var o2 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnError<int>(220, ex)
- );
-
- var res = scheduler.Start(() =>
- o1.CombineLatest(o2, (x, y) => x + y)
- );
-
- res.Messages.AssertEqual(
- OnError<int>(220, ex)
- );
-
- o1.Subscriptions.AssertEqual(
- Subscribe(200, 220)
- );
-
- o2.Subscriptions.AssertEqual(
- Subscribe(200, 220)
- );
- }
-
- [TestMethod]
- public void CombineLatest_ThrowNever()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var o1 = scheduler.CreateHotObservable(
- OnNext(150, 1)
- );
-
- var o2 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnError<int>(220, ex)
- );
-
- var res = scheduler.Start(() =>
- o2.CombineLatest(o1, (x, y) => x + y)
- );
-
- res.Messages.AssertEqual(
- OnError<int>(220, ex)
- );
-
- o1.Subscriptions.AssertEqual(
- Subscribe(200, 220)
- );
-
- o2.Subscriptions.AssertEqual(
- Subscribe(200, 220)
- );
- }
-
- #endregion
-
- #region Some/Throw
-
- [TestMethod]
- public void CombineLatest_SomeThrow()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var o1 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(215, 2),
- OnCompleted<int>(230)
- );
-
- var o2 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnError<int>(220, ex)
- );
-
- var res = scheduler.Start(() =>
- o1.CombineLatest(o2, (x, y) => x + y)
- );
-
- res.Messages.AssertEqual(
- OnError<int>(220, ex)
- );
-
- o1.Subscriptions.AssertEqual(
- Subscribe(200, 220)
- );
-
- o2.Subscriptions.AssertEqual(
- Subscribe(200, 220)
- );
- }
-
- [TestMethod]
- public void CombineLatest_ThrowSome()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var o1 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(215, 2),
- OnCompleted<int>(230)
- );
-
- var o2 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnError<int>(220, ex)
- );
-
- var res = scheduler.Start(() =>
- o2.CombineLatest(o1, (x, y) => x + y)
- );
-
- res.Messages.AssertEqual(
- OnError<int>(220, ex)
- );
-
- o1.Subscriptions.AssertEqual(
- Subscribe(200, 220)
- );
-
- o2.Subscriptions.AssertEqual(
- Subscribe(200, 220)
- );
- }
-
- #endregion
-
- #region ThrowAfterCompleted
-
- [TestMethod]
- public void CombineLatest_ThrowAfterCompleteLeft()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var o1 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(215, 2),
- OnCompleted<int>(220)
- );
-
- var o2 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnError<int>(230, ex)
- );
-
- var res = scheduler.Start(() =>
- o2.CombineLatest(o1, (x, y) => x + y)
- );
-
- res.Messages.AssertEqual(
- OnError<int>(230, ex)
- );
-
- o1.Subscriptions.AssertEqual(
- Subscribe(200, 220)
- );
-
- o2.Subscriptions.AssertEqual(
- Subscribe(200, 230)
- );
- }
-
- [TestMethod]
- public void CombineLatest_ThrowAfterCompleteRight()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var o1 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(215, 2),
- OnCompleted<int>(220)
- );
-
- var o2 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnError<int>(230, ex)
- );
-
- var res = scheduler.Start(() =>
- o1.CombineLatest(o2, (x, y) => x + y)
- );
-
- res.Messages.AssertEqual(
- OnError<int>(230, ex)
- );
-
- o1.Subscriptions.AssertEqual(
- Subscribe(200, 220)
- );
-
- o2.Subscriptions.AssertEqual(
- Subscribe(200, 230)
- );
- }
-
- #endregion
-
- #region Basics
-
- [TestMethod]
- public void CombineLatest_InterleavedWithTail()
- {
- var scheduler = new TestScheduler();
-
- var o1 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(215, 2),
- OnNext(225, 4),
- OnCompleted<int>(230)
- );
-
- var o2 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(220, 3),
- OnNext(230, 5),
- OnNext(235, 6),
- OnNext(240, 7),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- o2.CombineLatest(o1, (x, y) => x + y)
- );
-
- res.Messages.AssertEqual(
- OnNext(220, 2 + 3),
- OnNext(225, 3 + 4),
- OnNext(230, 4 + 5),
- OnNext(235, 4 + 6),
- OnNext(240, 4 + 7),
- OnCompleted<int>(250)
- );
-
- o1.Subscriptions.AssertEqual(
- Subscribe(200, 230)
- );
-
- o2.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void CombineLatest_Consecutive()
- {
- var scheduler = new TestScheduler();
-
- var o1 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(215, 2),
- OnNext(225, 4),
- OnCompleted<int>(230)
- );
-
- var o2 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(235, 6),
- OnNext(240, 7),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- o2.CombineLatest(o1, (x, y) => x + y)
- );
-
- res.Messages.AssertEqual(
- OnNext(235, 4 + 6),
- OnNext(240, 4 + 7),
- OnCompleted<int>(250)
- );
-
- o1.Subscriptions.AssertEqual(
- Subscribe(200, 230)
- );
-
- o2.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void CombineLatest_ConsecutiveEndWithErrorLeft()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var o1 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(215, 2),
- OnNext(225, 4),
- OnError<int>(230, ex)
- );
-
- var o2 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(235, 6),
- OnNext(240, 7),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- o2.CombineLatest(o1, (x, y) => x + y)
- );
-
- res.Messages.AssertEqual(
- OnError<int>(230, ex)
- );
-
- o1.Subscriptions.AssertEqual(
- Subscribe(200, 230)
- );
-
- o2.Subscriptions.AssertEqual(
- Subscribe(200, 230)
- );
- }
-
- [TestMethod]
- public void CombineLatest_ConsecutiveEndWithErrorRight()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var o1 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(215, 2),
- OnNext(225, 4),
- OnCompleted<int>(250)
- );
-
- var o2 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(235, 6),
- OnNext(240, 7),
- OnError<int>(245, ex)
- );
-
- var res = scheduler.Start(() =>
- o2.CombineLatest(o1, (x, y) => x + y)
- );
-
- res.Messages.AssertEqual(
- OnNext(235, 4 + 6),
- OnNext(240, 4 + 7),
- OnError<int>(245, ex)
- );
-
- o1.Subscriptions.AssertEqual(
- Subscribe(200, 245)
- );
-
- o2.Subscriptions.AssertEqual(
- Subscribe(200, 245)
- );
- }
-
- #endregion
-
- #region SelectorThrows
-
- [TestMethod]
- public void CombineLatest_SelectorThrows()
- {
- var scheduler = new TestScheduler();
-
- var o1 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(215, 2),
- OnCompleted<int>(230)
- );
-
- var o2 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(220, 3),
- OnCompleted<int>(240)
- );
-
- var ex = new Exception();
-
- var res = scheduler.Start(() =>
- o2.CombineLatest<int, int, int>(o1, (x, y) => { throw ex; })
- );
-
- res.Messages.AssertEqual(
- OnError<int>(220, ex)
- );
-
- o1.Subscriptions.AssertEqual(
- Subscribe(200, 220)
- );
-
- o2.Subscriptions.AssertEqual(
- Subscribe(200, 220)
- );
- }
-
- [TestMethod]
- public void CombineLatest_SelectorThrowsN()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 1), OnCompleted<int>(400) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(220, 2), OnCompleted<int>(400) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(230, 3), OnCompleted<int>(400) });
-
- var ex = new Exception();
- Func<IList<int>, int> f = xs => { throw ex; };
-
- var res = scheduler.Start(() =>
- Observable.CombineLatest(new[] { e0, e1, e2 }, f)
- );
-
- res.Messages.AssertEqual(
- OnError<int>(230, ex)
- );
-
- var es = new[] { e0, e1, e2 };
- foreach (var e in es)
- e.Subscriptions.AssertEqual(Subscribe(200, 200 + 10 * es.Length));
- }
-
- [TestMethod]
- public void CombineLatest_SelectorThrows2()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 1), OnCompleted<int>(400) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(220, 2), OnCompleted<int>(400) });
-
- var ex = new Exception();
- Func<int> f = () => { throw ex; };
-
- var res = scheduler.Start(() =>
- Observable.CombineLatest(e0, e1, (_0, _1) => f())
- );
-
- res.Messages.AssertEqual(
- OnError<int>(220, ex)
- );
-
- var es = new[] { e0, e1 };
- foreach (var e in es)
- e.Subscriptions.AssertEqual(Subscribe(200, 200 + 10 * es.Length));
- }
-
- [TestMethod]
- public void CombineLatest_SelectorThrows3()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 1), OnCompleted<int>(400) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(220, 2), OnCompleted<int>(400) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(230, 3), OnCompleted<int>(400) });
-
- var ex = new Exception();
- Func<int> f = () => { throw ex; };
-
- var res = scheduler.Start(() =>
- Observable.CombineLatest(e0, e1, e2, (_0, _1, _2) => f())
- );
-
- res.Messages.AssertEqual(
- OnError<int>(230, ex)
- );
-
- var es = new[] { e0, e1, e2 };
- foreach (var e in es)
- e.Subscriptions.AssertEqual(Subscribe(200, 200 + 10 * es.Length));
- }
-
- [TestMethod]
- public void CombineLatest_SelectorThrows4()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 1), OnCompleted<int>(400) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(220, 2), OnCompleted<int>(400) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(230, 3), OnCompleted<int>(400) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(240, 4), OnCompleted<int>(400) });
-
- var ex = new Exception();
- Func<int> f = () => { throw ex; };
-
- var res = scheduler.Start(() =>
- Observable.CombineLatest(e0, e1, e2, e3, (_0, _1, _2, _3) => f())
- );
-
- res.Messages.AssertEqual(
- OnError<int>(240, ex)
- );
-
- var es = new[] { e0, e1, e2, e3 };
- foreach (var e in es)
- e.Subscriptions.AssertEqual(Subscribe(200, 200 + 10 * es.Length));
- }
-
-#if !NO_LARGEARITY
- [TestMethod]
- public void CombineLatest_SelectorThrows5()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 1), OnCompleted<int>(400) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(220, 2), OnCompleted<int>(400) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(230, 3), OnCompleted<int>(400) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(240, 4), OnCompleted<int>(400) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(250, 5), OnCompleted<int>(400) });
-
- var ex = new Exception();
- Func<int> f = () => { throw ex; };
-
- var res = scheduler.Start(() =>
- Observable.CombineLatest(e0, e1, e2, e3, e4, (_0, _1, _2, _3, _4) => f())
- );
-
- res.Messages.AssertEqual(
- OnError<int>(250, ex)
- );
-
- var es = new[] { e0, e1, e2, e3, e4 };
- foreach (var e in es)
- e.Subscriptions.AssertEqual(Subscribe(200, 200 + 10 * es.Length));
- }
-
- [TestMethod]
- public void CombineLatest_SelectorThrows6()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 1), OnCompleted<int>(400) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(220, 2), OnCompleted<int>(400) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(230, 3), OnCompleted<int>(400) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(240, 4), OnCompleted<int>(400) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(250, 5), OnCompleted<int>(400) });
- var e5 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(260, 6), OnCompleted<int>(400) });
-
- var ex = new Exception();
- Func<int> f = () => { throw ex; };
-
- var res = scheduler.Start(() =>
- Observable.CombineLatest(e0, e1, e2, e3, e4, e5, (_0, _1, _2, _3, _4, _5) => f())
- );
-
- res.Messages.AssertEqual(
- OnError<int>(260, ex)
- );
-
- var es = new[] { e0, e1, e2, e3, e4, e5 };
- foreach (var e in es)
- e.Subscriptions.AssertEqual(Subscribe(200, 200 + 10 * es.Length));
- }
-
- [TestMethod]
- public void CombineLatest_SelectorThrows7()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 1), OnCompleted<int>(400) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(220, 2), OnCompleted<int>(400) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(230, 3), OnCompleted<int>(400) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(240, 4), OnCompleted<int>(400) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(250, 5), OnCompleted<int>(400) });
- var e5 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(260, 6), OnCompleted<int>(400) });
- var e6 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(270, 7), OnCompleted<int>(400) });
-
- var ex = new Exception();
- Func<int> f = () => { throw ex; };
-
- var res = scheduler.Start(() =>
- Observable.CombineLatest(e0, e1, e2, e3, e4, e5, e6, (_0, _1, _2, _3, _4, _5, _6) => f())
- );
-
- res.Messages.AssertEqual(
- OnError<int>(270, ex)
- );
-
- var es = new[] { e0, e1, e2, e3, e4, e5, e6 };
- foreach (var e in es)
- e.Subscriptions.AssertEqual(Subscribe(200, 200 + 10 * es.Length));
- }
-
- [TestMethod]
- public void CombineLatest_SelectorThrows8()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 1), OnCompleted<int>(400) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(220, 2), OnCompleted<int>(400) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(230, 3), OnCompleted<int>(400) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(240, 4), OnCompleted<int>(400) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(250, 5), OnCompleted<int>(400) });
- var e5 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(260, 6), OnCompleted<int>(400) });
- var e6 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(270, 7), OnCompleted<int>(400) });
- var e7 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(280, 8), OnCompleted<int>(400) });
-
- var ex = new Exception();
- Func<int> f = () => { throw ex; };
-
- var res = scheduler.Start(() =>
- Observable.CombineLatest(e0, e1, e2, e3, e4, e5, e6, e7, (_0, _1, _2, _3, _4, _5, _6, _7) => f())
- );
-
- res.Messages.AssertEqual(
- OnError<int>(280, ex)
- );
-
- var es = new[] { e0, e1, e2, e3, e4, e5, e6, e7 };
- foreach (var e in es)
- e.Subscriptions.AssertEqual(Subscribe(200, 200 + 10 * es.Length));
- }
-
- [TestMethod]
- public void CombineLatest_SelectorThrows9()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 1), OnCompleted<int>(400) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(220, 2), OnCompleted<int>(400) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(230, 3), OnCompleted<int>(400) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(240, 4), OnCompleted<int>(400) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(250, 5), OnCompleted<int>(400) });
- var e5 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(260, 6), OnCompleted<int>(400) });
- var e6 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(270, 7), OnCompleted<int>(400) });
- var e7 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(280, 8), OnCompleted<int>(400) });
- var e8 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(290, 9), OnCompleted<int>(400) });
-
- var ex = new Exception();
- Func<int> f = () => { throw ex; };
-
- var res = scheduler.Start(() =>
- Observable.CombineLatest(e0, e1, e2, e3, e4, e5, e6, e7, e8, (_0, _1, _2, _3, _4, _5, _6, _7, _8) => f())
- );
-
- res.Messages.AssertEqual(
- OnError<int>(290, ex)
- );
-
- var es = new[] { e0, e1, e2, e3, e4, e5, e6, e7, e8 };
- foreach (var e in es)
- e.Subscriptions.AssertEqual(Subscribe(200, 200 + 10 * es.Length));
- }
-
- [TestMethod]
- public void CombineLatest_SelectorThrows10()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 1), OnCompleted<int>(400) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(220, 2), OnCompleted<int>(400) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(230, 3), OnCompleted<int>(400) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(240, 4), OnCompleted<int>(400) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(250, 5), OnCompleted<int>(400) });
- var e5 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(260, 6), OnCompleted<int>(400) });
- var e6 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(270, 7), OnCompleted<int>(400) });
- var e7 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(280, 8), OnCompleted<int>(400) });
- var e8 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(290, 9), OnCompleted<int>(400) });
- var e9 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(300, 10), OnCompleted<int>(400) });
-
- var ex = new Exception();
- Func<int> f = () => { throw ex; };
-
- var res = scheduler.Start(() =>
- Observable.CombineLatest(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9) => f())
- );
-
- res.Messages.AssertEqual(
- OnError<int>(300, ex)
- );
-
- var es = new[] { e0, e1, e2, e3, e4, e5, e6, e7, e8, e9 };
- foreach (var e in es)
- e.Subscriptions.AssertEqual(Subscribe(200, 200 + 10 * es.Length));
- }
-
- [TestMethod]
- public void CombineLatest_SelectorThrows11()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 1), OnCompleted<int>(400) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(220, 2), OnCompleted<int>(400) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(230, 3), OnCompleted<int>(400) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(240, 4), OnCompleted<int>(400) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(250, 5), OnCompleted<int>(400) });
- var e5 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(260, 6), OnCompleted<int>(400) });
- var e6 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(270, 7), OnCompleted<int>(400) });
- var e7 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(280, 8), OnCompleted<int>(400) });
- var e8 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(290, 9), OnCompleted<int>(400) });
- var e9 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(300, 10), OnCompleted<int>(400) });
- var e10 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(310, 11), OnCompleted<int>(400) });
-
- var ex = new Exception();
- Func<int> f = () => { throw ex; };
-
- var res = scheduler.Start(() =>
- Observable.CombineLatest(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10) => f())
- );
-
- res.Messages.AssertEqual(
- OnError<int>(310, ex)
- );
-
- var es = new[] { e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10 };
- foreach (var e in es)
- e.Subscriptions.AssertEqual(Subscribe(200, 200 + 10 * es.Length));
- }
-
- [TestMethod]
- public void CombineLatest_SelectorThrows12()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 1), OnCompleted<int>(400) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(220, 2), OnCompleted<int>(400) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(230, 3), OnCompleted<int>(400) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(240, 4), OnCompleted<int>(400) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(250, 5), OnCompleted<int>(400) });
- var e5 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(260, 6), OnCompleted<int>(400) });
- var e6 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(270, 7), OnCompleted<int>(400) });
- var e7 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(280, 8), OnCompleted<int>(400) });
- var e8 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(290, 9), OnCompleted<int>(400) });
- var e9 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(300, 10), OnCompleted<int>(400) });
- var e10 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(310, 11), OnCompleted<int>(400) });
- var e11 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(320, 12), OnCompleted<int>(400) });
-
- var ex = new Exception();
- Func<int> f = () => { throw ex; };
-
- var res = scheduler.Start(() =>
- Observable.CombineLatest(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11) => f())
- );
-
- res.Messages.AssertEqual(
- OnError<int>(320, ex)
- );
-
- var es = new[] { e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11 };
- foreach (var e in es)
- e.Subscriptions.AssertEqual(Subscribe(200, 200 + 10 * es.Length));
- }
-
- [TestMethod]
- public void CombineLatest_SelectorThrows13()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 1), OnCompleted<int>(400) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(220, 2), OnCompleted<int>(400) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(230, 3), OnCompleted<int>(400) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(240, 4), OnCompleted<int>(400) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(250, 5), OnCompleted<int>(400) });
- var e5 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(260, 6), OnCompleted<int>(400) });
- var e6 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(270, 7), OnCompleted<int>(400) });
- var e7 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(280, 8), OnCompleted<int>(400) });
- var e8 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(290, 9), OnCompleted<int>(400) });
- var e9 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(300, 10), OnCompleted<int>(400) });
- var e10 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(310, 11), OnCompleted<int>(400) });
- var e11 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(320, 12), OnCompleted<int>(400) });
- var e12 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(330, 13), OnCompleted<int>(400) });
-
- var ex = new Exception();
- Func<int> f = () => { throw ex; };
-
- var res = scheduler.Start(() =>
- Observable.CombineLatest(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12) => f())
- );
-
- res.Messages.AssertEqual(
- OnError<int>(330, ex)
- );
-
- var es = new[] { e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12 };
- foreach (var e in es)
- e.Subscriptions.AssertEqual(Subscribe(200, 200 + 10 * es.Length));
- }
-
- [TestMethod]
- public void CombineLatest_SelectorThrows14()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 1), OnCompleted<int>(400) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(220, 2), OnCompleted<int>(400) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(230, 3), OnCompleted<int>(400) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(240, 4), OnCompleted<int>(400) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(250, 5), OnCompleted<int>(400) });
- var e5 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(260, 6), OnCompleted<int>(400) });
- var e6 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(270, 7), OnCompleted<int>(400) });
- var e7 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(280, 8), OnCompleted<int>(400) });
- var e8 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(290, 9), OnCompleted<int>(400) });
- var e9 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(300, 10), OnCompleted<int>(400) });
- var e10 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(310, 11), OnCompleted<int>(400) });
- var e11 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(320, 12), OnCompleted<int>(400) });
- var e12 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(330, 13), OnCompleted<int>(400) });
- var e13 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(340, 14), OnCompleted<int>(400) });
-
- var ex = new Exception();
- Func<int> f = () => { throw ex; };
-
- var res = scheduler.Start(() =>
- Observable.CombineLatest(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13) => f())
- );
-
- res.Messages.AssertEqual(
- OnError<int>(340, ex)
- );
-
- var es = new[] { e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13 };
- foreach (var e in es)
- e.Subscriptions.AssertEqual(Subscribe(200, 200 + 10 * es.Length));
- }
-
- [TestMethod]
- public void CombineLatest_SelectorThrows15()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 1), OnCompleted<int>(400) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(220, 2), OnCompleted<int>(400) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(230, 3), OnCompleted<int>(400) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(240, 4), OnCompleted<int>(400) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(250, 5), OnCompleted<int>(400) });
- var e5 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(260, 6), OnCompleted<int>(400) });
- var e6 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(270, 7), OnCompleted<int>(400) });
- var e7 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(280, 8), OnCompleted<int>(400) });
- var e8 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(290, 9), OnCompleted<int>(400) });
- var e9 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(300, 10), OnCompleted<int>(400) });
- var e10 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(310, 11), OnCompleted<int>(400) });
- var e11 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(320, 12), OnCompleted<int>(400) });
- var e12 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(330, 13), OnCompleted<int>(400) });
- var e13 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(340, 14), OnCompleted<int>(400) });
- var e14 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(350, 15), OnCompleted<int>(400) });
-
- var ex = new Exception();
- Func<int> f = () => { throw ex; };
-
- var res = scheduler.Start(() =>
- Observable.CombineLatest(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14) => f())
- );
-
- res.Messages.AssertEqual(
- OnError<int>(350, ex)
- );
-
- var es = new[] { e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14 };
- foreach (var e in es)
- e.Subscriptions.AssertEqual(Subscribe(200, 200 + 10 * es.Length));
- }
-
- [TestMethod]
- public void CombineLatest_SelectorThrows16()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 1), OnCompleted<int>(400) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(220, 2), OnCompleted<int>(400) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(230, 3), OnCompleted<int>(400) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(240, 4), OnCompleted<int>(400) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(250, 5), OnCompleted<int>(400) });
- var e5 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(260, 6), OnCompleted<int>(400) });
- var e6 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(270, 7), OnCompleted<int>(400) });
- var e7 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(280, 8), OnCompleted<int>(400) });
- var e8 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(290, 9), OnCompleted<int>(400) });
- var e9 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(300, 10), OnCompleted<int>(400) });
- var e10 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(310, 11), OnCompleted<int>(400) });
- var e11 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(320, 12), OnCompleted<int>(400) });
- var e12 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(330, 13), OnCompleted<int>(400) });
- var e13 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(340, 14), OnCompleted<int>(400) });
- var e14 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(350, 15), OnCompleted<int>(400) });
- var e15 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(360, 16), OnCompleted<int>(400) });
-
- var ex = new Exception();
- Func<int> f = () => { throw ex; };
-
- var res = scheduler.Start(() =>
- Observable.CombineLatest(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15) => f())
- );
-
- res.Messages.AssertEqual(
- OnError<int>(360, ex)
- );
-
- var es = new[] { e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15 };
- foreach (var e in es)
- e.Subscriptions.AssertEqual(Subscribe(200, 200 + 10 * es.Length));
- }
-#endif
-
- #endregion
-
- #region AllEmptyButOne
-
- [TestMethod]
- public void CombineLatest_WillNeverBeAbleToCombineN()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(250) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(260) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(500, 2), OnCompleted<int>(800) });
-
- var res = scheduler.Start(() =>
- Observable.CombineLatest(new[] { e0, e1, e2 }, xs => 42)
- );
-
- res.Messages.AssertEqual(
- OnCompleted<int>(500)
- );
-
- var i = 0;
- var es = new[] { e0, e1, e2 };
- foreach (var e in es.Take(es.Length - 1))
- e.Subscriptions.AssertEqual(Subscribe(200, 200 + 50 + (i++ * 10)));
-
- es.Last().Subscriptions.AssertEqual(Subscribe(200, 500));
- }
-
- [TestMethod]
- public void CombineLatest_WillNeverBeAbleToCombine2()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(250) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(500, 2), OnCompleted<int>(800) });
-
- var res = scheduler.Start(() =>
- Observable.CombineLatest(e0, e1, (_0, _1) => 42)
- );
-
- res.Messages.AssertEqual(
- OnCompleted<int>(500)
- );
-
- var i = 0;
- var es = new[] { e0, e1 };
- foreach (var e in es.Take(es.Length - 1))
- e.Subscriptions.AssertEqual(Subscribe(200, 200 + 50 + (i++ * 10)));
-
- es.Last().Subscriptions.AssertEqual(Subscribe(200, 500));
- }
-
- [TestMethod]
- public void CombineLatest_WillNeverBeAbleToCombine3()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(250) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(260) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(500, 2), OnCompleted<int>(800) });
-
- var res = scheduler.Start(() =>
- Observable.CombineLatest(e0, e1, e2, (_0, _1, _2) => 42)
- );
-
- res.Messages.AssertEqual(
- OnCompleted<int>(500)
- );
-
- var i = 0;
- var es = new[] { e0, e1, e2 };
- foreach (var e in es.Take(es.Length - 1))
- e.Subscriptions.AssertEqual(Subscribe(200, 200 + 50 + (i++ * 10)));
-
- es.Last().Subscriptions.AssertEqual(Subscribe(200, 500));
- }
-
- [TestMethod]
- public void CombineLatest_WillNeverBeAbleToCombine4()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(250) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(260) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(270) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(500, 2), OnCompleted<int>(800) });
-
- var res = scheduler.Start(() =>
- Observable.CombineLatest(e0, e1, e2, e3, (_0, _1, _2, _3) => 42)
- );
-
- res.Messages.AssertEqual(
- OnCompleted<int>(500)
- );
-
- var i = 0;
- var es = new[] { e0, e1, e2, e3 };
- foreach (var e in es.Take(es.Length - 1))
- e.Subscriptions.AssertEqual(Subscribe(200, 200 + 50 + (i++ * 10)));
-
- es.Last().Subscriptions.AssertEqual(Subscribe(200, 500));
- }
-
-#if !NO_LARGEARITY
- [TestMethod]
- public void CombineLatest_WillNeverBeAbleToCombine5()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(250) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(260) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(270) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(280) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(500, 2), OnCompleted<int>(800) });
-
- var res = scheduler.Start(() =>
- Observable.CombineLatest(e0, e1, e2, e3, e4, (_0, _1, _2, _3, _4) => 42)
- );
-
- res.Messages.AssertEqual(
- OnCompleted<int>(500)
- );
-
- var i = 0;
- var es = new[] { e0, e1, e2, e3, e4 };
- foreach (var e in es.Take(es.Length - 1))
- e.Subscriptions.AssertEqual(Subscribe(200, 200 + 50 + (i++ * 10)));
-
- es.Last().Subscriptions.AssertEqual(Subscribe(200, 500));
- }
-
- [TestMethod]
- public void CombineLatest_WillNeverBeAbleToCombine6()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(250) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(260) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(270) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(280) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(290) });
- var e5 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(500, 2), OnCompleted<int>(800) });
-
- var res = scheduler.Start(() =>
- Observable.CombineLatest(e0, e1, e2, e3, e4, e5, (_0, _1, _2, _3, _4, _5) => 42)
- );
-
- res.Messages.AssertEqual(
- OnCompleted<int>(500)
- );
-
- var i = 0;
- var es = new[] { e0, e1, e2, e3, e4, e5 };
- foreach (var e in es.Take(es.Length - 1))
- e.Subscriptions.AssertEqual(Subscribe(200, 200 + 50 + (i++ * 10)));
-
- es.Last().Subscriptions.AssertEqual(Subscribe(200, 500));
- }
-
- [TestMethod]
- public void CombineLatest_WillNeverBeAbleToCombine7()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(250) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(260) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(270) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(280) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(290) });
- var e5 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(300) });
- var e6 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(500, 2), OnCompleted<int>(800) });
-
- var res = scheduler.Start(() =>
- Observable.CombineLatest(e0, e1, e2, e3, e4, e5, e6, (_0, _1, _2, _3, _4, _5, _6) => 42)
- );
-
- res.Messages.AssertEqual(
- OnCompleted<int>(500)
- );
-
- var i = 0;
- var es = new[] { e0, e1, e2, e3, e4, e5, e6 };
- foreach (var e in es.Take(es.Length - 1))
- e.Subscriptions.AssertEqual(Subscribe(200, 200 + 50 + (i++ * 10)));
-
- es.Last().Subscriptions.AssertEqual(Subscribe(200, 500));
- }
-
- [TestMethod]
- public void CombineLatest_WillNeverBeAbleToCombine8()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(250) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(260) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(270) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(280) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(290) });
- var e5 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(300) });
- var e6 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(310) });
- var e7 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(500, 2), OnCompleted<int>(800) });
-
- var res = scheduler.Start(() =>
- Observable.CombineLatest(e0, e1, e2, e3, e4, e5, e6, e7, (_0, _1, _2, _3, _4, _5, _6, _7) => 42)
- );
-
- res.Messages.AssertEqual(
- OnCompleted<int>(500)
- );
-
- var i = 0;
- var es = new[] { e0, e1, e2, e3, e4, e5, e6, e7 };
- foreach (var e in es.Take(es.Length - 1))
- e.Subscriptions.AssertEqual(Subscribe(200, 200 + 50 + (i++ * 10)));
-
- es.Last().Subscriptions.AssertEqual(Subscribe(200, 500));
- }
-
- [TestMethod]
- public void CombineLatest_WillNeverBeAbleToCombine9()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(250) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(260) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(270) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(280) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(290) });
- var e5 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(300) });
- var e6 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(310) });
- var e7 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(320) });
- var e8 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(500, 2), OnCompleted<int>(800) });
-
- var res = scheduler.Start(() =>
- Observable.CombineLatest(e0, e1, e2, e3, e4, e5, e6, e7, e8, (_0, _1, _2, _3, _4, _5, _6, _7, _8) => 42)
- );
-
- res.Messages.AssertEqual(
- OnCompleted<int>(500)
- );
-
- var i = 0;
- var es = new[] { e0, e1, e2, e3, e4, e5, e6, e7, e8 };
- foreach (var e in es.Take(es.Length - 1))
- e.Subscriptions.AssertEqual(Subscribe(200, 200 + 50 + (i++ * 10)));
-
- es.Last().Subscriptions.AssertEqual(Subscribe(200, 500));
- }
-
- [TestMethod]
- public void CombineLatest_WillNeverBeAbleToCombine10()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(250) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(260) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(270) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(280) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(290) });
- var e5 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(300) });
- var e6 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(310) });
- var e7 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(320) });
- var e8 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(330) });
- var e9 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(500, 2), OnCompleted<int>(800) });
-
- var res = scheduler.Start(() =>
- Observable.CombineLatest(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9) => 42)
- );
-
- res.Messages.AssertEqual(
- OnCompleted<int>(500)
- );
-
- var i = 0;
- var es = new[] { e0, e1, e2, e3, e4, e5, e6, e7, e8, e9 };
- foreach (var e in es.Take(es.Length - 1))
- e.Subscriptions.AssertEqual(Subscribe(200, 200 + 50 + (i++ * 10)));
-
- es.Last().Subscriptions.AssertEqual(Subscribe(200, 500));
- }
-
- [TestMethod]
- public void CombineLatest_WillNeverBeAbleToCombine11()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(250) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(260) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(270) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(280) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(290) });
- var e5 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(300) });
- var e6 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(310) });
- var e7 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(320) });
- var e8 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(330) });
- var e9 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(340) });
- var e10 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(500, 2), OnCompleted<int>(800) });
-
- var res = scheduler.Start(() =>
- Observable.CombineLatest(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10) => 42)
- );
-
- res.Messages.AssertEqual(
- OnCompleted<int>(500)
- );
-
- var i = 0;
- var es = new[] { e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10 };
- foreach (var e in es.Take(es.Length - 1))
- e.Subscriptions.AssertEqual(Subscribe(200, 200 + 50 + (i++ * 10)));
-
- es.Last().Subscriptions.AssertEqual(Subscribe(200, 500));
- }
-
- [TestMethod]
- public void CombineLatest_WillNeverBeAbleToCombine12()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(250) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(260) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(270) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(280) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(290) });
- var e5 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(300) });
- var e6 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(310) });
- var e7 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(320) });
- var e8 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(330) });
- var e9 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(340) });
- var e10 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(350) });
- var e11 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(500, 2), OnCompleted<int>(800) });
-
- var res = scheduler.Start(() =>
- Observable.CombineLatest(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11) => 42)
- );
-
- res.Messages.AssertEqual(
- OnCompleted<int>(500)
- );
-
- var i = 0;
- var es = new[] { e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11 };
- foreach (var e in es.Take(es.Length - 1))
- e.Subscriptions.AssertEqual(Subscribe(200, 200 + 50 + (i++ * 10)));
-
- es.Last().Subscriptions.AssertEqual(Subscribe(200, 500));
- }
-
- [TestMethod]
- public void CombineLatest_WillNeverBeAbleToCombine13()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(250) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(260) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(270) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(280) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(290) });
- var e5 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(300) });
- var e6 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(310) });
- var e7 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(320) });
- var e8 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(330) });
- var e9 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(340) });
- var e10 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(350) });
- var e11 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(360) });
- var e12 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(500, 2), OnCompleted<int>(800) });
-
- var res = scheduler.Start(() =>
- Observable.CombineLatest(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12) => 42)
- );
-
- res.Messages.AssertEqual(
- OnCompleted<int>(500)
- );
-
- var i = 0;
- var es = new[] { e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12 };
- foreach (var e in es.Take(es.Length - 1))
- e.Subscriptions.AssertEqual(Subscribe(200, 200 + 50 + (i++ * 10)));
-
- es.Last().Subscriptions.AssertEqual(Subscribe(200, 500));
- }
-
- [TestMethod]
- public void CombineLatest_WillNeverBeAbleToCombine14()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(250) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(260) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(270) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(280) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(290) });
- var e5 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(300) });
- var e6 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(310) });
- var e7 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(320) });
- var e8 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(330) });
- var e9 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(340) });
- var e10 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(350) });
- var e11 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(360) });
- var e12 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(370) });
- var e13 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(500, 2), OnCompleted<int>(800) });
-
- var res = scheduler.Start(() =>
- Observable.CombineLatest(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13) => 42)
- );
-
- res.Messages.AssertEqual(
- OnCompleted<int>(500)
- );
-
- var i = 0;
- var es = new[] { e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13 };
- foreach (var e in es.Take(es.Length - 1))
- e.Subscriptions.AssertEqual(Subscribe(200, 200 + 50 + (i++ * 10)));
-
- es.Last().Subscriptions.AssertEqual(Subscribe(200, 500));
- }
-
- [TestMethod]
- public void CombineLatest_WillNeverBeAbleToCombine15()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(250) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(260) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(270) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(280) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(290) });
- var e5 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(300) });
- var e6 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(310) });
- var e7 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(320) });
- var e8 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(330) });
- var e9 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(340) });
- var e10 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(350) });
- var e11 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(360) });
- var e12 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(370) });
- var e13 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(380) });
- var e14 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(500, 2), OnCompleted<int>(800) });
-
- var res = scheduler.Start(() =>
- Observable.CombineLatest(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14) => 42)
- );
-
- res.Messages.AssertEqual(
- OnCompleted<int>(500)
- );
-
- var i = 0;
- var es = new[] { e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14 };
- foreach (var e in es.Take(es.Length - 1))
- e.Subscriptions.AssertEqual(Subscribe(200, 200 + 50 + (i++ * 10)));
-
- es.Last().Subscriptions.AssertEqual(Subscribe(200, 500));
- }
-
- [TestMethod]
- public void CombineLatest_WillNeverBeAbleToCombine16()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(250) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(260) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(270) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(280) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(290) });
- var e5 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(300) });
- var e6 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(310) });
- var e7 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(320) });
- var e8 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(330) });
- var e9 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(340) });
- var e10 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(350) });
- var e11 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(360) });
- var e12 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(370) });
- var e13 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(380) });
- var e14 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(390) });
- var e15 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(500, 2), OnCompleted<int>(800) });
-
- var res = scheduler.Start(() =>
- Observable.CombineLatest(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15) => 42)
- );
-
- res.Messages.AssertEqual(
- OnCompleted<int>(500)
- );
-
- var i = 0;
- var es = new[] { e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15 };
- foreach (var e in es.Take(es.Length - 1))
- e.Subscriptions.AssertEqual(Subscribe(200, 200 + 50 + (i++ * 10)));
-
- es.Last().Subscriptions.AssertEqual(Subscribe(200, 500));
- }
-#endif
-
- #endregion
-
- #region Typical
-
- [TestMethod]
- public void CombineLatest_TypicalN()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 1), OnNext(410, 4), OnCompleted<int>(800) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(220, 2), OnNext(420, 5), OnCompleted<int>(800) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(230, 3), OnNext(430, 6), OnCompleted<int>(800) });
-
- var res = scheduler.Start(() =>
- Observable.CombineLatest(new[] { e0, e1, e2 }, xs => xs.Sum())
- );
-
- res.Messages.AssertEqual(
- OnNext(230, 6),
- OnNext(410, 9),
- OnNext(420, 12),
- OnNext(430, 15),
- OnCompleted<int>(800)
- );
-
- foreach (var e in new[] { e0, e1, e2 })
- e.Subscriptions.AssertEqual(Subscribe(200, 800));
- }
-
- [TestMethod]
- public void CombineLatest_Typical2()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 1), OnNext(410, 3), OnCompleted<int>(800) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(220, 2), OnNext(420, 4), OnCompleted<int>(800) });
-
- var res = scheduler.Start(() =>
- Observable.CombineLatest(e0, e1, (_0, _1) => _0 + _1)
- );
-
- res.Messages.AssertEqual(
- OnNext(220, 3),
- OnNext(410, 5),
- OnNext(420, 7),
- OnCompleted<int>(800)
- );
-
- foreach (var e in new[] { e0, e1 })
- e.Subscriptions.AssertEqual(Subscribe(200, 800));
- }
-
- [TestMethod]
- public void CombineLatest_Typical3()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 1), OnNext(410, 4), OnCompleted<int>(800) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(220, 2), OnNext(420, 5), OnCompleted<int>(800) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(230, 3), OnNext(430, 6), OnCompleted<int>(800) });
-
- var res = scheduler.Start(() =>
- Observable.CombineLatest(e0, e1, e2, (_0, _1, _2) => _0 + _1 + _2)
- );
-
- res.Messages.AssertEqual(
- OnNext(230, 6),
- OnNext(410, 9),
- OnNext(420, 12),
- OnNext(430, 15),
- OnCompleted<int>(800)
- );
-
- foreach (var e in new[] { e0, e1, e2 })
- e.Subscriptions.AssertEqual(Subscribe(200, 800));
- }
-
- [TestMethod]
- public void CombineLatest_Typical4()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 1), OnNext(410, 5), OnCompleted<int>(800) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(220, 2), OnNext(420, 6), OnCompleted<int>(800) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(230, 3), OnNext(430, 7), OnCompleted<int>(800) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(240, 4), OnNext(440, 8), OnCompleted<int>(800) });
-
- var res = scheduler.Start(() =>
- Observable.CombineLatest(e0, e1, e2, e3, (_0, _1, _2, _3) => _0 + _1 + _2 + _3)
- );
-
- res.Messages.AssertEqual(
- OnNext(240, 10),
- OnNext(410, 14),
- OnNext(420, 18),
- OnNext(430, 22),
- OnNext(440, 26),
- OnCompleted<int>(800)
- );
-
- foreach (var e in new[] { e0, e1, e2, e3 })
- e.Subscriptions.AssertEqual(Subscribe(200, 800));
- }
-
-#if !NO_LARGEARITY
- [TestMethod]
- public void CombineLatest_Typical5()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 1), OnNext(410, 6), OnCompleted<int>(800) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(220, 2), OnNext(420, 7), OnCompleted<int>(800) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(230, 3), OnNext(430, 8), OnCompleted<int>(800) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(240, 4), OnNext(440, 9), OnCompleted<int>(800) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(250, 5), OnNext(450, 10), OnCompleted<int>(800) });
-
- var res = scheduler.Start(() =>
- Observable.CombineLatest(e0, e1, e2, e3, e4, (_0, _1, _2, _3, _4) => _0 + _1 + _2 + _3 + _4)
- );
-
- res.Messages.AssertEqual(
- OnNext(250, 15),
- OnNext(410, 20),
- OnNext(420, 25),
- OnNext(430, 30),
- OnNext(440, 35),
- OnNext(450, 40),
- OnCompleted<int>(800)
- );
-
- foreach (var e in new[] { e0, e1, e2, e3, e4 })
- e.Subscriptions.AssertEqual(Subscribe(200, 800));
- }
-
- [TestMethod]
- public void CombineLatest_Typical6()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 1), OnNext(410, 7), OnCompleted<int>(800) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(220, 2), OnNext(420, 8), OnCompleted<int>(800) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(230, 3), OnNext(430, 9), OnCompleted<int>(800) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(240, 4), OnNext(440, 10), OnCompleted<int>(800) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(250, 5), OnNext(450, 11), OnCompleted<int>(800) });
- var e5 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(260, 6), OnNext(460, 12), OnCompleted<int>(800) });
-
- var res = scheduler.Start(() =>
- Observable.CombineLatest(e0, e1, e2, e3, e4, e5, (_0, _1, _2, _3, _4, _5) => _0 + _1 + _2 + _3 + _4 + _5)
- );
-
- res.Messages.AssertEqual(
- OnNext(260, 21),
- OnNext(410, 27),
- OnNext(420, 33),
- OnNext(430, 39),
- OnNext(440, 45),
- OnNext(450, 51),
- OnNext(460, 57),
- OnCompleted<int>(800)
- );
-
- foreach (var e in new[] { e0, e1, e2, e3, e4, e5 })
- e.Subscriptions.AssertEqual(Subscribe(200, 800));
- }
-
- [TestMethod]
- public void CombineLatest_Typical7()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 1), OnNext(410, 8), OnCompleted<int>(800) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(220, 2), OnNext(420, 9), OnCompleted<int>(800) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(230, 3), OnNext(430, 10), OnCompleted<int>(800) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(240, 4), OnNext(440, 11), OnCompleted<int>(800) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(250, 5), OnNext(450, 12), OnCompleted<int>(800) });
- var e5 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(260, 6), OnNext(460, 13), OnCompleted<int>(800) });
- var e6 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(270, 7), OnNext(470, 14), OnCompleted<int>(800) });
-
- var res = scheduler.Start(() =>
- Observable.CombineLatest(e0, e1, e2, e3, e4, e5, e6, (_0, _1, _2, _3, _4, _5, _6) => _0 + _1 + _2 + _3 + _4 + _5 + _6)
- );
-
- res.Messages.AssertEqual(
- OnNext(270, 28),
- OnNext(410, 35),
- OnNext(420, 42),
- OnNext(430, 49),
- OnNext(440, 56),
- OnNext(450, 63),
- OnNext(460, 70),
- OnNext(470, 77),
- OnCompleted<int>(800)
- );
-
- foreach (var e in new[] { e0, e1, e2, e3, e4, e5, e6 })
- e.Subscriptions.AssertEqual(Subscribe(200, 800));
- }
-
- [TestMethod]
- public void CombineLatest_Typical8()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 1), OnNext(410, 9), OnCompleted<int>(800) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(220, 2), OnNext(420, 10), OnCompleted<int>(800) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(230, 3), OnNext(430, 11), OnCompleted<int>(800) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(240, 4), OnNext(440, 12), OnCompleted<int>(800) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(250, 5), OnNext(450, 13), OnCompleted<int>(800) });
- var e5 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(260, 6), OnNext(460, 14), OnCompleted<int>(800) });
- var e6 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(270, 7), OnNext(470, 15), OnCompleted<int>(800) });
- var e7 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(280, 8), OnNext(480, 16), OnCompleted<int>(800) });
-
- var res = scheduler.Start(() =>
- Observable.CombineLatest(e0, e1, e2, e3, e4, e5, e6, e7, (_0, _1, _2, _3, _4, _5, _6, _7) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7)
- );
-
- res.Messages.AssertEqual(
- OnNext(280, 36),
- OnNext(410, 44),
- OnNext(420, 52),
- OnNext(430, 60),
- OnNext(440, 68),
- OnNext(450, 76),
- OnNext(460, 84),
- OnNext(470, 92),
- OnNext(480, 100),
- OnCompleted<int>(800)
- );
-
- foreach (var e in new[] { e0, e1, e2, e3, e4, e5, e6, e7 })
- e.Subscriptions.AssertEqual(Subscribe(200, 800));
- }
-
- [TestMethod]
- public void CombineLatest_Typical9()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 1), OnNext(410, 10), OnCompleted<int>(800) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(220, 2), OnNext(420, 11), OnCompleted<int>(800) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(230, 3), OnNext(430, 12), OnCompleted<int>(800) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(240, 4), OnNext(440, 13), OnCompleted<int>(800) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(250, 5), OnNext(450, 14), OnCompleted<int>(800) });
- var e5 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(260, 6), OnNext(460, 15), OnCompleted<int>(800) });
- var e6 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(270, 7), OnNext(470, 16), OnCompleted<int>(800) });
- var e7 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(280, 8), OnNext(480, 17), OnCompleted<int>(800) });
- var e8 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(290, 9), OnNext(490, 18), OnCompleted<int>(800) });
-
- var res = scheduler.Start(() =>
- Observable.CombineLatest(e0, e1, e2, e3, e4, e5, e6, e7, e8, (_0, _1, _2, _3, _4, _5, _6, _7, _8) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8)
- );
-
- res.Messages.AssertEqual(
- OnNext(290, 45),
- OnNext(410, 54),
- OnNext(420, 63),
- OnNext(430, 72),
- OnNext(440, 81),
- OnNext(450, 90),
- OnNext(460, 99),
- OnNext(470, 108),
- OnNext(480, 117),
- OnNext(490, 126),
- OnCompleted<int>(800)
- );
-
- foreach (var e in new[] { e0, e1, e2, e3, e4, e5, e6, e7, e8 })
- e.Subscriptions.AssertEqual(Subscribe(200, 800));
- }
-
- [TestMethod]
- public void CombineLatest_Typical10()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 1), OnNext(410, 11), OnCompleted<int>(800) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(220, 2), OnNext(420, 12), OnCompleted<int>(800) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(230, 3), OnNext(430, 13), OnCompleted<int>(800) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(240, 4), OnNext(440, 14), OnCompleted<int>(800) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(250, 5), OnNext(450, 15), OnCompleted<int>(800) });
- var e5 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(260, 6), OnNext(460, 16), OnCompleted<int>(800) });
- var e6 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(270, 7), OnNext(470, 17), OnCompleted<int>(800) });
- var e7 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(280, 8), OnNext(480, 18), OnCompleted<int>(800) });
- var e8 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(290, 9), OnNext(490, 19), OnCompleted<int>(800) });
- var e9 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(300, 10), OnNext(500, 20), OnCompleted<int>(800) });
-
- var res = scheduler.Start(() =>
- Observable.CombineLatest(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9)
- );
-
- res.Messages.AssertEqual(
- OnNext(300, 55),
- OnNext(410, 65),
- OnNext(420, 75),
- OnNext(430, 85),
- OnNext(440, 95),
- OnNext(450, 105),
- OnNext(460, 115),
- OnNext(470, 125),
- OnNext(480, 135),
- OnNext(490, 145),
- OnNext(500, 155),
- OnCompleted<int>(800)
- );
-
- foreach (var e in new[] { e0, e1, e2, e3, e4, e5, e6, e7, e8, e9 })
- e.Subscriptions.AssertEqual(Subscribe(200, 800));
- }
-
- [TestMethod]
- public void CombineLatest_Typical11()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 1), OnNext(410, 12), OnCompleted<int>(800) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(220, 2), OnNext(420, 13), OnCompleted<int>(800) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(230, 3), OnNext(430, 14), OnCompleted<int>(800) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(240, 4), OnNext(440, 15), OnCompleted<int>(800) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(250, 5), OnNext(450, 16), OnCompleted<int>(800) });
- var e5 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(260, 6), OnNext(460, 17), OnCompleted<int>(800) });
- var e6 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(270, 7), OnNext(470, 18), OnCompleted<int>(800) });
- var e7 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(280, 8), OnNext(480, 19), OnCompleted<int>(800) });
- var e8 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(290, 9), OnNext(490, 20), OnCompleted<int>(800) });
- var e9 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(300, 10), OnNext(500, 21), OnCompleted<int>(800) });
- var e10 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(310, 11), OnNext(510, 22), OnCompleted<int>(800) });
-
- var res = scheduler.Start(() =>
- Observable.CombineLatest(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10)
- );
-
- res.Messages.AssertEqual(
- OnNext(310, 66),
- OnNext(410, 77),
- OnNext(420, 88),
- OnNext(430, 99),
- OnNext(440, 110),
- OnNext(450, 121),
- OnNext(460, 132),
- OnNext(470, 143),
- OnNext(480, 154),
- OnNext(490, 165),
- OnNext(500, 176),
- OnNext(510, 187),
- OnCompleted<int>(800)
- );
-
- foreach (var e in new[] { e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10 })
- e.Subscriptions.AssertEqual(Subscribe(200, 800));
- }
-
- [TestMethod]
- public void CombineLatest_Typical12()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 1), OnNext(410, 13), OnCompleted<int>(800) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(220, 2), OnNext(420, 14), OnCompleted<int>(800) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(230, 3), OnNext(430, 15), OnCompleted<int>(800) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(240, 4), OnNext(440, 16), OnCompleted<int>(800) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(250, 5), OnNext(450, 17), OnCompleted<int>(800) });
- var e5 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(260, 6), OnNext(460, 18), OnCompleted<int>(800) });
- var e6 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(270, 7), OnNext(470, 19), OnCompleted<int>(800) });
- var e7 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(280, 8), OnNext(480, 20), OnCompleted<int>(800) });
- var e8 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(290, 9), OnNext(490, 21), OnCompleted<int>(800) });
- var e9 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(300, 10), OnNext(500, 22), OnCompleted<int>(800) });
- var e10 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(310, 11), OnNext(510, 23), OnCompleted<int>(800) });
- var e11 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(320, 12), OnNext(520, 24), OnCompleted<int>(800) });
-
- var res = scheduler.Start(() =>
- Observable.CombineLatest(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11)
- );
-
- res.Messages.AssertEqual(
- OnNext(320, 78),
- OnNext(410, 90),
- OnNext(420, 102),
- OnNext(430, 114),
- OnNext(440, 126),
- OnNext(450, 138),
- OnNext(460, 150),
- OnNext(470, 162),
- OnNext(480, 174),
- OnNext(490, 186),
- OnNext(500, 198),
- OnNext(510, 210),
- OnNext(520, 222),
- OnCompleted<int>(800)
- );
-
- foreach (var e in new[] { e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11 })
- e.Subscriptions.AssertEqual(Subscribe(200, 800));
- }
-
- [TestMethod]
- public void CombineLatest_Typical13()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 1), OnNext(410, 14), OnCompleted<int>(800) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(220, 2), OnNext(420, 15), OnCompleted<int>(800) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(230, 3), OnNext(430, 16), OnCompleted<int>(800) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(240, 4), OnNext(440, 17), OnCompleted<int>(800) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(250, 5), OnNext(450, 18), OnCompleted<int>(800) });
- var e5 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(260, 6), OnNext(460, 19), OnCompleted<int>(800) });
- var e6 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(270, 7), OnNext(470, 20), OnCompleted<int>(800) });
- var e7 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(280, 8), OnNext(480, 21), OnCompleted<int>(800) });
- var e8 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(290, 9), OnNext(490, 22), OnCompleted<int>(800) });
- var e9 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(300, 10), OnNext(500, 23), OnCompleted<int>(800) });
- var e10 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(310, 11), OnNext(510, 24), OnCompleted<int>(800) });
- var e11 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(320, 12), OnNext(520, 25), OnCompleted<int>(800) });
- var e12 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(330, 13), OnNext(530, 26), OnCompleted<int>(800) });
-
- var res = scheduler.Start(() =>
- Observable.CombineLatest(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12)
- );
-
- res.Messages.AssertEqual(
- OnNext(330, 91),
- OnNext(410, 104),
- OnNext(420, 117),
- OnNext(430, 130),
- OnNext(440, 143),
- OnNext(450, 156),
- OnNext(460, 169),
- OnNext(470, 182),
- OnNext(480, 195),
- OnNext(490, 208),
- OnNext(500, 221),
- OnNext(510, 234),
- OnNext(520, 247),
- OnNext(530, 260),
- OnCompleted<int>(800)
- );
-
- foreach (var e in new[] { e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12 })
- e.Subscriptions.AssertEqual(Subscribe(200, 800));
- }
-
- [TestMethod]
- public void CombineLatest_Typical14()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 1), OnNext(410, 15), OnCompleted<int>(800) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(220, 2), OnNext(420, 16), OnCompleted<int>(800) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(230, 3), OnNext(430, 17), OnCompleted<int>(800) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(240, 4), OnNext(440, 18), OnCompleted<int>(800) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(250, 5), OnNext(450, 19), OnCompleted<int>(800) });
- var e5 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(260, 6), OnNext(460, 20), OnCompleted<int>(800) });
- var e6 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(270, 7), OnNext(470, 21), OnCompleted<int>(800) });
- var e7 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(280, 8), OnNext(480, 22), OnCompleted<int>(800) });
- var e8 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(290, 9), OnNext(490, 23), OnCompleted<int>(800) });
- var e9 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(300, 10), OnNext(500, 24), OnCompleted<int>(800) });
- var e10 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(310, 11), OnNext(510, 25), OnCompleted<int>(800) });
- var e11 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(320, 12), OnNext(520, 26), OnCompleted<int>(800) });
- var e12 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(330, 13), OnNext(530, 27), OnCompleted<int>(800) });
- var e13 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(340, 14), OnNext(540, 28), OnCompleted<int>(800) });
-
- var res = scheduler.Start(() =>
- Observable.CombineLatest(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12 + _13)
- );
-
- res.Messages.AssertEqual(
- OnNext(340, 105),
- OnNext(410, 119),
- OnNext(420, 133),
- OnNext(430, 147),
- OnNext(440, 161),
- OnNext(450, 175),
- OnNext(460, 189),
- OnNext(470, 203),
- OnNext(480, 217),
- OnNext(490, 231),
- OnNext(500, 245),
- OnNext(510, 259),
- OnNext(520, 273),
- OnNext(530, 287),
- OnNext(540, 301),
- OnCompleted<int>(800)
- );
-
- foreach (var e in new[] { e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13 })
- e.Subscriptions.AssertEqual(Subscribe(200, 800));
- }
-
- [TestMethod]
- public void CombineLatest_Typical15()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 1), OnNext(410, 16), OnCompleted<int>(800) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(220, 2), OnNext(420, 17), OnCompleted<int>(800) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(230, 3), OnNext(430, 18), OnCompleted<int>(800) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(240, 4), OnNext(440, 19), OnCompleted<int>(800) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(250, 5), OnNext(450, 20), OnCompleted<int>(800) });
- var e5 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(260, 6), OnNext(460, 21), OnCompleted<int>(800) });
- var e6 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(270, 7), OnNext(470, 22), OnCompleted<int>(800) });
- var e7 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(280, 8), OnNext(480, 23), OnCompleted<int>(800) });
- var e8 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(290, 9), OnNext(490, 24), OnCompleted<int>(800) });
- var e9 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(300, 10), OnNext(500, 25), OnCompleted<int>(800) });
- var e10 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(310, 11), OnNext(510, 26), OnCompleted<int>(800) });
- var e11 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(320, 12), OnNext(520, 27), OnCompleted<int>(800) });
- var e12 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(330, 13), OnNext(530, 28), OnCompleted<int>(800) });
- var e13 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(340, 14), OnNext(540, 29), OnCompleted<int>(800) });
- var e14 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(350, 15), OnNext(550, 30), OnCompleted<int>(800) });
-
- var res = scheduler.Start(() =>
- Observable.CombineLatest(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12 + _13 + _14)
- );
-
- res.Messages.AssertEqual(
- OnNext(350, 120),
- OnNext(410, 135),
- OnNext(420, 150),
- OnNext(430, 165),
- OnNext(440, 180),
- OnNext(450, 195),
- OnNext(460, 210),
- OnNext(470, 225),
- OnNext(480, 240),
- OnNext(490, 255),
- OnNext(500, 270),
- OnNext(510, 285),
- OnNext(520, 300),
- OnNext(530, 315),
- OnNext(540, 330),
- OnNext(550, 345),
- OnCompleted<int>(800)
- );
-
- foreach (var e in new[] { e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14 })
- e.Subscriptions.AssertEqual(Subscribe(200, 800));
- }
-
- [TestMethod]
- public void CombineLatest_Typical16()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 1), OnNext(410, 17), OnCompleted<int>(800) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(220, 2), OnNext(420, 18), OnCompleted<int>(800) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(230, 3), OnNext(430, 19), OnCompleted<int>(800) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(240, 4), OnNext(440, 20), OnCompleted<int>(800) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(250, 5), OnNext(450, 21), OnCompleted<int>(800) });
- var e5 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(260, 6), OnNext(460, 22), OnCompleted<int>(800) });
- var e6 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(270, 7), OnNext(470, 23), OnCompleted<int>(800) });
- var e7 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(280, 8), OnNext(480, 24), OnCompleted<int>(800) });
- var e8 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(290, 9), OnNext(490, 25), OnCompleted<int>(800) });
- var e9 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(300, 10), OnNext(500, 26), OnCompleted<int>(800) });
- var e10 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(310, 11), OnNext(510, 27), OnCompleted<int>(800) });
- var e11 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(320, 12), OnNext(520, 28), OnCompleted<int>(800) });
- var e12 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(330, 13), OnNext(530, 29), OnCompleted<int>(800) });
- var e13 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(340, 14), OnNext(540, 30), OnCompleted<int>(800) });
- var e14 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(350, 15), OnNext(550, 31), OnCompleted<int>(800) });
- var e15 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(360, 16), OnNext(560, 32), OnCompleted<int>(800) });
-
- var res = scheduler.Start(() =>
- Observable.CombineLatest(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12 + _13 + _14 + _15)
- );
-
- res.Messages.AssertEqual(
- OnNext(360, 136),
- OnNext(410, 152),
- OnNext(420, 168),
- OnNext(430, 184),
- OnNext(440, 200),
- OnNext(450, 216),
- OnNext(460, 232),
- OnNext(470, 248),
- OnNext(480, 264),
- OnNext(490, 280),
- OnNext(500, 296),
- OnNext(510, 312),
- OnNext(520, 328),
- OnNext(530, 344),
- OnNext(540, 360),
- OnNext(550, 376),
- OnNext(560, 392),
- OnCompleted<int>(800)
- );
-
- foreach (var e in new[] { e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15 })
- e.Subscriptions.AssertEqual(Subscribe(200, 800));
- }
-#endif
-
- #endregion
-
- #region NAry
-
- [TestMethod]
- public void CombineLatest_List_Regular()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 1), OnNext(240, 4), OnCompleted<int>(270) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(220, 2), OnNext(250, 5), OnCompleted<int>(280) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(230, 3), OnNext(260, 6), OnCompleted<int>(290) });
-
- var res = scheduler.Start(() =>
- Observable.CombineLatest<int>(new IObservable<int>[] { e0, e1, e2 }.AsEnumerable())
- );
-
- res.Messages.AssertEqual(
- OnNext<IList<int>>(230, l => l.SequenceEqual(new[] { 1, 2, 3 })),
- OnNext<IList<int>>(240, l => l.SequenceEqual(new[] { 4, 2, 3 })),
- OnNext<IList<int>>(250, l => l.SequenceEqual(new[] { 4, 5, 3 })),
- OnNext<IList<int>>(260, l => l.SequenceEqual(new[] { 4, 5, 6 })),
- OnCompleted<IList<int>>(290)
- );
- }
-
- [TestMethod]
- public void CombineLatest_NAry_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(default(IEnumerable<IObservable<int>>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(default(IEnumerable<IObservable<int>>), _ => 42));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(new[] { Observable.Return(42) }, default(Func<IList<int>, string>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.CombineLatest(default(IObservable<int>[])));
- }
-
- [TestMethod]
- public void CombineLatest_NAry_Symmetric()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 1), OnNext(250, 4), OnCompleted<int>(420) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(220, 2), OnNext(240, 5), OnCompleted<int>(410) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(230, 3), OnNext(260, 6), OnCompleted<int>(400) });
-
- var res = scheduler.Start(() =>
- Observable.CombineLatest(e0, e1, e2)
- );
-
- res.Messages.AssertEqual(
- OnNext<IList<int>>(230, l => l.SequenceEqual(new[] { 1, 2, 3 })),
- OnNext<IList<int>>(240, l => l.SequenceEqual(new[] { 1, 5, 3 })),
- OnNext<IList<int>>(250, l => l.SequenceEqual(new[] { 4, 5, 3 })),
- OnNext<IList<int>>(260, l => l.SequenceEqual(new[] { 4, 5, 6 })),
- OnCompleted<IList<int>>(420)
- );
-
- e0.Subscriptions.AssertEqual(
- Subscribe(200, 420)
- );
-
- e1.Subscriptions.AssertEqual(
- Subscribe(200, 410)
- );
-
- e2.Subscriptions.AssertEqual(
- Subscribe(200, 400)
- );
- }
-
- [TestMethod]
- public void CombineLatest_NAry_Symmetric_Selector()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 1), OnNext(250, 4), OnCompleted<int>(420) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(220, 2), OnNext(240, 5), OnCompleted<int>(410) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(230, 3), OnNext(260, 6), OnCompleted<int>(400) });
-
- var res = scheduler.Start(() =>
- Observable.CombineLatest(new[] { e0, e1, e2 }, xs => xs.Sum())
- );
-
- res.Messages.AssertEqual(
- OnNext<int>(230, new[] { 1, 2, 3 }.Sum()),
- OnNext<int>(240, new[] { 1, 5, 3 }.Sum()),
- OnNext<int>(250, new[] { 4, 5, 3 }.Sum()),
- OnNext<int>(260, new[] { 4, 5, 6 }.Sum()),
- OnCompleted<int>(420)
- );
-
- e0.Subscriptions.AssertEqual(
- Subscribe(200, 420)
- );
-
- e1.Subscriptions.AssertEqual(
- Subscribe(200, 410)
- );
-
- e2.Subscriptions.AssertEqual(
- Subscribe(200, 400)
- );
- }
-
- [TestMethod]
- public void CombineLatest_NAry_Asymmetric()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 1), OnNext(250, 4), OnCompleted<int>(270) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(220, 2), OnNext(240, 5), OnNext(290, 7), OnNext(310, 9), OnCompleted<int>(410) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(230, 3), OnNext(260, 6), OnNext(280, 8), OnCompleted<int>(300) });
-
- var res = scheduler.Start(() =>
- Observable.CombineLatest(e0, e1, e2)
- );
-
- res.Messages.AssertEqual(
- OnNext<IList<int>>(230, l => l.SequenceEqual(new[] { 1, 2, 3 })),
- OnNext<IList<int>>(240, l => l.SequenceEqual(new[] { 1, 5, 3 })),
- OnNext<IList<int>>(250, l => l.SequenceEqual(new[] { 4, 5, 3 })),
- OnNext<IList<int>>(260, l => l.SequenceEqual(new[] { 4, 5, 6 })),
- OnNext<IList<int>>(280, l => l.SequenceEqual(new[] { 4, 5, 8 })),
- OnNext<IList<int>>(290, l => l.SequenceEqual(new[] { 4, 7, 8 })),
- OnNext<IList<int>>(310, l => l.SequenceEqual(new[] { 4, 9, 8 })),
- OnCompleted<IList<int>>(410)
- );
-
- e0.Subscriptions.AssertEqual(
- Subscribe(200, 270)
- );
-
- e1.Subscriptions.AssertEqual(
- Subscribe(200, 410)
- );
-
- e2.Subscriptions.AssertEqual(
- Subscribe(200, 300)
- );
- }
-
- [TestMethod]
- public void CombineLatest_NAry_Asymmetric_Selector()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 1), OnNext(250, 4), OnCompleted<int>(270) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(220, 2), OnNext(240, 5), OnNext(290, 7), OnNext(310, 9), OnCompleted<int>(410) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(230, 3), OnNext(260, 6), OnNext(280, 8), OnCompleted<int>(300) });
-
- var res = scheduler.Start(() =>
- Observable.CombineLatest(new[] { e0, e1, e2 }, xs => xs.Sum())
- );
-
- res.Messages.AssertEqual(
- OnNext<int>(230, new[] { 1, 2, 3 }.Sum()),
- OnNext<int>(240, new[] { 1, 5, 3 }.Sum()),
- OnNext<int>(250, new[] { 4, 5, 3 }.Sum()),
- OnNext<int>(260, new[] { 4, 5, 6 }.Sum()),
- OnNext<int>(280, new[] { 4, 5, 8 }.Sum()),
- OnNext<int>(290, new[] { 4, 7, 8 }.Sum()),
- OnNext<int>(310, new[] { 4, 9, 8 }.Sum()),
- OnCompleted<int>(410)
- );
-
- e0.Subscriptions.AssertEqual(
- Subscribe(200, 270)
- );
-
- e1.Subscriptions.AssertEqual(
- Subscribe(200, 410)
- );
-
- e2.Subscriptions.AssertEqual(
- Subscribe(200, 300)
- );
- }
-
- [TestMethod]
- public void CombineLatest_NAry_Error()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 1), OnError<int>(250, ex) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(220, 2), OnNext(240, 5), OnCompleted<int>(410) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(230, 3), OnNext(260, 6), OnCompleted<int>(400) });
-
- var res = scheduler.Start(() =>
- Observable.CombineLatest(e0, e1, e2)
- );
-
- res.Messages.AssertEqual(
- OnNext<IList<int>>(230, l => l.SequenceEqual(new[] { 1, 2, 3 })),
- OnNext<IList<int>>(240, l => l.SequenceEqual(new[] { 1, 5, 3 })),
- OnError<IList<int>>(250, ex)
- );
-
- e0.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
-
- e1.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
-
- e2.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void CombineLatest_NAry_Error_Selector()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 1), OnError<int>(250, ex) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(220, 2), OnNext(240, 5), OnCompleted<int>(410) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(230, 3), OnNext(260, 6), OnCompleted<int>(400) });
-
- var res = scheduler.Start(() =>
- Observable.CombineLatest(new[] { e0, e1, e2 }, xs => xs.Sum())
- );
-
- res.Messages.AssertEqual(
- OnNext<int>(230, new[] { 1, 2, 3 }.Sum()),
- OnNext<int>(240, new[] { 1, 5, 3 }.Sum()),
- OnError<int>(250, ex)
- );
-
- e0.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
-
- e1.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
-
- e2.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- #endregion
-
- #region AtLeastOneThrows
-
- [TestMethod]
- public void CombineLatest_AtLeastOneThrows4()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 1), OnCompleted<int>(400) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(220, 2), OnCompleted<int>(400) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnError<int>(230, ex) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(240, 4), OnCompleted<int>(400) });
-
- var res = scheduler.Start(() =>
- Observable.CombineLatest(e0, e1, e2, e3, (_0, _1, _2, _3) => 42)
- );
-
- res.Messages.AssertEqual(
- OnError<int>(230, ex)
- );
-
- e0.Subscriptions.AssertEqual(Subscribe(200, 230));
- e1.Subscriptions.AssertEqual(Subscribe(200, 230));
- e2.Subscriptions.AssertEqual(Subscribe(200, 230));
- e3.Subscriptions.AssertEqual(Subscribe(200, 230));
- }
-
- #endregion
-
- #endregion
-
- #region + Concat +
-
- [TestMethod]
- public void Concat_ArgumentChecking()
- {
- var xs = DummyObservable<int>.Instance;
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Concat(xs, (IObservable<int>)null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Concat((IObservable<int>)null, xs));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Concat((IObservable<int>[])null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Concat((IEnumerable<IObservable<int>>)null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Concat((IObservable<int>[])null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Concat((IEnumerable<IObservable<int>>)null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Concat(xs, null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Concat(null, xs));
- }
-
- [TestMethod]
- public void Concat_DefaultScheduler()
- {
- var evt = new ManualResetEvent(false);
-
- int sum = 0;
- Observable.Concat(Observable.Return(1), Observable.Return(2), Observable.Return(3)).Subscribe(n =>
- {
- sum += n;
- }, () => evt.Set());
-
- evt.WaitOne();
-
- Assert.AreEqual(6, sum);
- }
-
- [TestMethod]
- public void Concat_IEofIO_DefaultScheduler()
- {
- var evt = new ManualResetEvent(false);
-
- IEnumerable<IObservable<int>> sources = new[] { Observable.Return(1), Observable.Return(2), Observable.Return(3) };
-
- int sum = 0;
- Observable.Concat(sources).Subscribe(n =>
- {
- sum += n;
- }, () => evt.Set());
-
- evt.WaitOne();
-
- Assert.AreEqual(6, sum);
- }
-
- [TestMethod]
- public void Concat_IEofIO_GetEnumeratorThrows()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xss = new RogueEnumerable<IObservable<int>>(ex);
-
- var res = scheduler.Start(() =>
- Observable.Concat(xss)
- );
-
- res.Messages.AssertEqual(
- OnError<int>(200, ex)
- );
- }
-
- [TestMethod]
- public void Concat_IEofIO()
- {
- var scheduler = new TestScheduler();
-
- var xs1 = scheduler.CreateColdObservable<int>(
- OnNext(10, 1),
- OnNext(20, 2),
- OnNext(30, 3),
- OnCompleted<int>(40)
- );
-
- var xs2 = scheduler.CreateColdObservable<int>(
- OnNext(10, 4),
- OnNext(20, 5),
- OnCompleted<int>(30)
- );
-
- var xs3 = scheduler.CreateColdObservable<int>(
- OnNext(10, 6),
- OnNext(20, 7),
- OnNext(30, 8),
- OnNext(40, 9),
- OnCompleted<int>(50)
- );
-
- var res = scheduler.Start(() =>
- Observable.Concat(new[] { xs1, xs2, xs3 })
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 1),
- OnNext(220, 2),
- OnNext(230, 3),
- OnNext(250, 4),
- OnNext(260, 5),
- OnNext(280, 6),
- OnNext(290, 7),
- OnNext(300, 8),
- OnNext(310, 9),
- OnCompleted<int>(320)
- );
-
- xs1.Subscriptions.AssertEqual(
- Subscribe(200, 240)
- );
-
- xs2.Subscriptions.AssertEqual(
- Subscribe(240, 270)
- );
-
- xs3.Subscriptions.AssertEqual(
- Subscribe(270, 320)
- );
- }
-
- [TestMethod]
- public void Concat_EmptyEmpty()
- {
- var scheduler = new TestScheduler();
-
- var o1 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnCompleted<int>(230)
- );
-
- var o2 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- o1.Concat(o2)
- );
-
- res.Messages.AssertEqual(
- OnCompleted<int>(250)
- );
-
- o1.Subscriptions.AssertEqual(
- Subscribe(200, 230)
- );
-
- o2.Subscriptions.AssertEqual(
- Subscribe(230, 250)
- );
- }
-
- [TestMethod]
- public void Concat_EmptyNever()
- {
- var scheduler = new TestScheduler();
-
- var o1 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnCompleted<int>(230)
- );
-
- var o2 = scheduler.CreateHotObservable(
- OnNext(150, 1)
- );
-
- var res = scheduler.Start(() =>
- o1.Concat(o2)
- );
-
- res.Messages.AssertEqual(
- );
-
- o1.Subscriptions.AssertEqual(
- Subscribe(200, 230)
- );
-
- o2.Subscriptions.AssertEqual(
- Subscribe(230, 1000)
- );
- }
-
- [TestMethod]
- public void Concat_NeverEmpty()
- {
- var scheduler = new TestScheduler();
-
- var o1 = scheduler.CreateHotObservable(
- OnNext(150, 1)
- );
-
- var o2 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnCompleted<int>(230)
- );
-
- var res = scheduler.Start(() =>
- o1.Concat(o2)
- );
-
- res.Messages.AssertEqual(
- );
-
- o1.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
-
- o2.Subscriptions.AssertEqual(
- );
- }
-
- [TestMethod]
- public void Concat_NeverNever()
- {
- var scheduler = new TestScheduler();
-
- var o1 = scheduler.CreateHotObservable(
- OnNext(150, 1)
- );
-
- var o2 = scheduler.CreateHotObservable(
- OnNext(150, 1)
- );
-
- var res = scheduler.Start(() =>
- o1.Concat(o2)
- );
-
- res.Messages.AssertEqual(
- );
-
- o1.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
-
- o2.Subscriptions.AssertEqual(
- );
- }
-
- [TestMethod]
- public void Concat_EmptyThrow()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var o1 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnCompleted<int>(230)
- );
-
- var o2 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnError<int>(250, ex)
- );
-
- var res = scheduler.Start(() =>
- o1.Concat(o2)
- );
-
- res.Messages.AssertEqual(
- OnError<int>(250, ex)
- );
-
- o1.Subscriptions.AssertEqual(
- Subscribe(200, 230)
- );
-
- o2.Subscriptions.AssertEqual(
- Subscribe(230, 250)
- );
- }
-
- [TestMethod]
- public void Concat_ThrowEmpty()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var o1 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnError<int>(230, ex)
- );
-
- var o2 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- o1.Concat(o2)
- );
-
- res.Messages.AssertEqual(
- OnError<int>(230, ex)
- );
-
- o1.Subscriptions.AssertEqual(
- Subscribe(200, 230)
- );
-
- o2.Subscriptions.AssertEqual(
- );
- }
-
- [TestMethod]
- public void Concat_ThrowThrow()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var o1 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnError<int>(230, ex)
- );
-
- var o2 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnError<int>(250, new Exception())
- );
-
- var res = scheduler.Start(() =>
- o1.Concat(o2)
- );
-
- res.Messages.AssertEqual(
- OnError<int>(230, ex)
- );
-
- o1.Subscriptions.AssertEqual(
- Subscribe(200, 230)
- );
-
- o2.Subscriptions.AssertEqual(
- );
- }
-
- [TestMethod]
- public void Concat_ReturnEmpty()
- {
- var scheduler = new TestScheduler();
-
- var o1 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnCompleted<int>(230)
- );
-
- var o2 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- o1.Concat(o2)
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 2),
- OnCompleted<int>(250)
- );
-
- o1.Subscriptions.AssertEqual(
- Subscribe(200, 230)
- );
-
- o2.Subscriptions.AssertEqual(
- Subscribe(230, 250)
- );
- }
-
- [TestMethod]
- public void Concat_EmptyReturn()
- {
- var scheduler = new TestScheduler();
-
- var o1 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnCompleted<int>(230)
- );
-
- var o2 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(240, 2),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- o1.Concat(o2)
- );
-
- res.Messages.AssertEqual(
- OnNext(240, 2),
- OnCompleted<int>(250)
- );
-
- o1.Subscriptions.AssertEqual(
- Subscribe(200, 230)
- );
-
- o2.Subscriptions.AssertEqual(
- Subscribe(230, 250)
- );
- }
-
- [TestMethod]
- public void Concat_ReturnNever()
- {
- var scheduler = new TestScheduler();
-
- var o1 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnCompleted<int>(230)
- );
-
- var o2 = scheduler.CreateHotObservable(
- OnNext(150, 1)
- );
-
- var res = scheduler.Start(() =>
- o1.Concat(o2)
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 2)
- );
-
- o1.Subscriptions.AssertEqual(
- Subscribe(200, 230)
- );
-
- o2.Subscriptions.AssertEqual(
- Subscribe(230, 1000)
- );
- }
-
- [TestMethod]
- public void Concat_NeverReturn()
- {
- var scheduler = new TestScheduler();
-
- var o1 = scheduler.CreateHotObservable(
- OnNext(150, 1)
- );
-
- var o2 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnCompleted<int>(230)
- );
-
- var res = scheduler.Start(() =>
- o1.Concat(o2)
- );
-
- res.Messages.AssertEqual(
- );
-
- o1.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
-
- o2.Subscriptions.AssertEqual(
- );
- }
-
- [TestMethod]
- public void Concat_ReturnReturn()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var o1 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(220, 2),
- OnCompleted<int>(230)
- );
-
- var o2 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(240, 3),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- o1.Concat(o2)
- );
-
- res.Messages.AssertEqual(
- OnNext(220, 2),
- OnNext(240, 3),
- OnCompleted<int>(250)
- );
-
- o1.Subscriptions.AssertEqual(
- Subscribe(200, 230)
- );
-
- o2.Subscriptions.AssertEqual(
- Subscribe(230, 250)
- );
- }
-
- [TestMethod]
- public void Concat_ThrowReturn()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var o1 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnError<int>(230, ex)
- );
-
- var o2 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(240, 2),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- o1.Concat(o2)
- );
-
- res.Messages.AssertEqual(
- OnError<int>(230, ex)
- );
-
- o1.Subscriptions.AssertEqual(
- Subscribe(200, 230)
- );
-
- o2.Subscriptions.AssertEqual(
- );
- }
-
- [TestMethod]
- public void Concat_ReturnThrow()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var o1 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(220, 2),
- OnCompleted<int>(230)
- );
-
- var o2 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnError<int>(250, ex)
- );
-
- var res = scheduler.Start(() =>
- o1.Concat(o2)
- );
-
- res.Messages.AssertEqual(
- OnNext(220, 2),
- OnError<int>(250, ex)
- );
-
- o1.Subscriptions.AssertEqual(
- Subscribe(200, 230)
- );
-
- o2.Subscriptions.AssertEqual(
- Subscribe(230, 250)
- );
- }
-
- [TestMethod]
- public void Concat_SomeDataSomeData()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var o1 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnNext(220, 3),
- OnCompleted<int>(225)
- );
-
- var o2 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(230, 4),
- OnNext(240, 5),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- o1.Concat(o2)
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 2),
- OnNext(220, 3),
- OnNext(230, 4),
- OnNext(240, 5),
- OnCompleted<int>(250)
- );
-
- o1.Subscriptions.AssertEqual(
- Subscribe(200, 225)
- );
-
- o2.Subscriptions.AssertEqual(
- Subscribe(225, 250)
- );
- }
-
- [TestMethod]
- public void Concat_EnumerableThrows()
- {
- var scheduler = new TestScheduler();
-
- var o = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnNext(220, 3),
- OnCompleted<int>(225)
- );
-
- var ex = new Exception();
- var xss = new MockEnumerable<IObservable<int>>(scheduler, GetObservablesForConcatThrow(o, ex));
-
- var res = scheduler.Start(() =>
- xss.Concat()
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 2),
- OnNext(220, 3),
- OnError<int>(225, ex)
- );
-
- o.Subscriptions.AssertEqual(
- Subscribe(200, 225)
- );
-
- xss.Subscriptions.AssertEqual(
- Subscribe(200, 225)
- );
- }
-
- private IEnumerable<IObservable<int>> GetObservablesForConcatThrow(IObservable<int> first, Exception ex)
- {
- yield return first;
- throw ex;
- }
-
- [TestMethod]
- public void Concat_EnumerableTiming()
- {
- var scheduler = new TestScheduler();
-
- var o1 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2), // !
- OnNext(220, 3), // !
- OnCompleted<int>(230)
- );
-
- var o2 = scheduler.CreateColdObservable(
- OnNext(50, 4), // !
- OnNext(60, 5), // !
- OnNext(70, 6), // !
- OnCompleted<int>(80)
- );
-
- var o3 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(200, 2),
- OnNext(210, 3),
- OnNext(220, 4),
- OnNext(230, 5),
- OnNext(270, 6),
- OnNext(320, 7), // !
- OnNext(330, 8), // !
- OnCompleted<int>(340)
- );
-
- var xss = new MockEnumerable<ITestableObservable<int>>(scheduler, new[] { o1, o2, o3, o2 });
-
- var res = scheduler.Start(() =>
- xss.Select(xs => (IObservable<int>)xs).Concat()
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 2),
- OnNext(220, 3),
- OnNext(280, 4),
- OnNext(290, 5),
- OnNext(300, 6),
- OnNext(320, 7),
- OnNext(330, 8),
- OnNext(390, 4),
- OnNext(400, 5),
- OnNext(410, 6),
- OnCompleted<int>(420)
- );
-
- o1.Subscriptions.AssertEqual(
- Subscribe(200, 230)
- );
-
- o2.Subscriptions.AssertEqual(
- Subscribe(230, 310),
- Subscribe(340, 420)
- );
-
- o3.Subscriptions.AssertEqual(
- Subscribe(310, 340)
- );
-
- xss.Subscriptions.AssertEqual(
- Subscribe(200, 420)
- );
- }
-
- [TestMethod]
- public void Concat_Enumerable_Dispose()
- {
- var scheduler = new TestScheduler();
-
- var o1 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnNext(220, 3),
- OnCompleted<int>(230)
- );
-
- var o2 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(200, 2),
- OnNext(210, 3),
- OnNext(240, 4),
- OnNext(270, 5),
- OnNext(320, 6),
- OnNext(330, 7),
- OnCompleted<int>(340)
- );
-
- var xss = new MockEnumerable<ITestableObservable<int>>(scheduler, new[] { o1, o2 });
-
- var res = scheduler.Start(() =>
- xss.Select(xs => (IObservable<int>)xs).Concat(),
- 300
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 2),
- OnNext(220, 3),
- OnNext(240, 4),
- OnNext(270, 5)
- );
-
- o1.Subscriptions.AssertEqual(
- Subscribe(200, 230)
- );
-
- o2.Subscriptions.AssertEqual(
- Subscribe(230, 300)
- );
-
- xss.Subscriptions.AssertEqual(
- Subscribe(200, 300)
- );
- }
-
- [TestMethod]
- public void Concat_Optimization_DeferEvalTiming()
- {
- var scheduler = new TestScheduler();
-
- var o1 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnNext(220, 3),
- OnCompleted<int>(230)
- );
-
- var o2 = scheduler.CreateColdObservable(
- OnNext(10, 4),
- OnNext(20, 5),
- OnNext(30, 6),
- OnCompleted<int>(40)
- );
-
- var invoked = default(long);
-
- var xs = o1;
- var ys = Observable.Defer(() => { invoked = scheduler.Clock; return o2; });
-
- var res = scheduler.Start(() =>
- xs.Concat(ys)
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 2),
- OnNext(220, 3),
- OnNext(240, 4),
- OnNext(250, 5),
- OnNext(260, 6),
- OnCompleted<int>(270)
- );
-
- o1.Subscriptions.AssertEqual(
- Subscribe(200, 230)
- );
-
- o2.Subscriptions.AssertEqual(
- Subscribe(230, 270)
- );
-
- Assert.AreEqual(230, invoked);
- }
-
- [TestMethod]
- public void Concat_Optimization_DeferExceptionPropagation()
- {
- var scheduler = new TestScheduler();
-
- var o1 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnCompleted<int>(220)
- );
-
- var ex = new Exception();
- var invoked = default(long);
-
- var xs = o1;
- var ys = Observable.Defer<int>(new Func<IObservable<int>>(() => { invoked = scheduler.Clock; throw ex; }));
-
- var res = scheduler.Start(() =>
- xs.Concat(ys)
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 2),
- OnError<int>(220, ex)
- );
-
- o1.Subscriptions.AssertEqual(
- Subscribe(200, 220)
- );
-
- Assert.AreEqual(220, invoked);
- }
-
-#if !NO_PERF
- [TestMethod]
- public void Concat_TailRecursive1()
- {
- var create = 0L;
- var start = 200L;
- var end = 1000L;
-
- var scheduler = new TestScheduler();
-
- var o = scheduler.CreateColdObservable<int>(
- OnNext(10, 1),
- OnNext(20, 2),
- OnNext(30, 3),
- OnCompleted<int>(40)
- );
-
- var f = default(Func<IObservable<int>>);
- f = () => Observable.Defer(() => o.Concat(f()));
-
- var res = scheduler.Start(() => f(), create, start, end);
-
- var expected = new List<Recorded<Notification<int>>>();
-
- var t = start;
- while (t <= end)
- {
- var n = (t - start) / 10;
- if (n % 4 != 0)
- {
- expected.Add(OnNext(t, (int)(n % 4)));
- }
-
- t += 10;
- }
-
- res.Messages.AssertEqual(expected);
- }
-
- [TestMethod]
- public void Concat_TailRecursive2()
- {
- var f = default(Func<int, IObservable<int>>);
- f = x => Observable.Defer(() => Observable.Return(x, ThreadPoolScheduler.Instance).Concat(f(x + 1)));
-
- var lst = new List<int>();
- f(0).Select(x => new StackTrace().FrameCount).Take(10).ForEach(lst.Add);
-
- Assert.IsTrue(lst.Last() - lst.First() < 10);
- }
-#endif
-
-#if !NO_TPL
- [TestMethod]
- public void Concat_Task()
- {
- var tss = Observable.Concat(new[] { Task.Factory.StartNew(() => 1), Task.Factory.StartNew(() => 2), Task.Factory.StartNew(() => 3) }.ToObservable());
-
- var res = tss.ToArray().Single();
-
- Assert.IsTrue(res.SequenceEqual(new[] { 1, 2, 3 }));
- }
-#endif
-
- #endregion
-
- #region + Merge +
-
- [TestMethod]
- public void Merge_ArgumentChecking()
- {
- var xs = DummyObservable<int>.Instance;
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Merge(default(IScheduler), xs, xs));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Merge(xs, xs, default(IScheduler)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Merge(xs, null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Merge(default(IObservable<int>), xs));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Merge((IObservable<int>[])null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Merge((IEnumerable<IObservable<int>>)null));
- ReactiveAssert.Throws<ArgumentNullException>(() => ((IObservable<int>)null).Merge(xs, DummyScheduler.Instance));
- ReactiveAssert.Throws<ArgumentNullException>(() => xs.Merge(default(IObservable<int>), DummyScheduler.Instance));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Merge((IEnumerable<IObservable<int>>)null, DummyScheduler.Instance));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Merge(new IObservable<int>[0], default(IScheduler)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Merge((IObservable<IObservable<int>>)null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Merge(DummyScheduler.Instance, (IObservable<int>[])null));
-
-#if !NO_TPL
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Merge((IObservable<System.Threading.Tasks.Task<int>>)null));
-#endif
- }
-
- [TestMethod]
- public void Merge_DefaultScheduler()
- {
- var xs = Observable.Merge<int>(Observable.Return(42), Observable.Return(43), Observable.Return(44));
- var res = xs.ToList().Single();
- Assert.IsTrue(new[] { 42, 43, 44 }.SequenceEqual(res));
- }
-
- [TestMethod]
- public void Merge_Never2()
- {
- var scheduler = new TestScheduler();
-
- var n1 = scheduler.CreateHotObservable(
- OnNext(150, 1)
- );
-
- var n2 = scheduler.CreateHotObservable(
- OnNext(150, 1)
- );
-
- var res = scheduler.Start(() =>
- Observable.Merge(scheduler, n1, n2)
- );
-
- res.Messages.AssertEqual(
- );
-
- n1.Subscriptions.AssertEqual(
- Subscribe(201, 1000)
- );
-
- n2.Subscriptions.AssertEqual(
- Subscribe(202, 1000)
- );
- }
-
- [TestMethod]
- public void Merge_Never3()
- {
- var scheduler = new TestScheduler();
-
- var n1 = scheduler.CreateHotObservable(
- OnNext(150, 1)
- );
-
- var n2 = scheduler.CreateHotObservable(
- OnNext(150, 1)
- );
-
- var n3 = scheduler.CreateHotObservable(
- OnNext(150, 1)
- );
-
- var res = scheduler.Start(() =>
- Observable.Merge(scheduler, n1, n2, n3)
- );
-
- res.Messages.AssertEqual(
- );
-
- n1.Subscriptions.AssertEqual(
- Subscribe(201, 1000)
- );
-
- n2.Subscriptions.AssertEqual(
- Subscribe(202, 1000)
- );
-
- n3.Subscriptions.AssertEqual(
- Subscribe(203, 1000)
- );
- }
-
- [TestMethod]
- public void Merge_Empty2()
- {
- var scheduler = new TestScheduler();
-
- var e1 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnCompleted<int>(210)
- );
-
- var e2 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnCompleted<int>(230)
- );
-
- var res = scheduler.Start(() =>
- Observable.Merge(scheduler, e1, e2)
- );
-
- res.Messages.AssertEqual(
- OnCompleted<int>(230)
- );
-
- e1.Subscriptions.AssertEqual(
- Subscribe(201, 210)
- );
-
- e2.Subscriptions.AssertEqual(
- Subscribe(202, 230)
- );
- }
-
- [TestMethod]
- public void Merge_Empty3()
- {
- var scheduler = new TestScheduler();
-
- var e1 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnCompleted<int>(210)
- );
-
- var e2 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnCompleted<int>(230)
- );
-
- var e3 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnCompleted<int>(240)
- );
-
- var res = scheduler.Start(() =>
- Observable.Merge(scheduler, e1, e2, e3)
- );
-
- res.Messages.AssertEqual(
- OnCompleted<int>(240)
- );
-
- e1.Subscriptions.AssertEqual(
- Subscribe(201, 210)
- );
-
- e2.Subscriptions.AssertEqual(
- Subscribe(202, 230)
- );
-
- e3.Subscriptions.AssertEqual(
- Subscribe(203, 240)
- );
- }
-
- [TestMethod]
- public void Merge_EmptyDelayed2_RightLast()
- {
- var scheduler = new TestScheduler();
-
- var e1 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnCompleted<int>(240)
- );
-
- var e2 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- Observable.Merge(scheduler, e1, e2)
- );
-
- res.Messages.AssertEqual(
- OnCompleted<int>(250)
- );
-
- e1.Subscriptions.AssertEqual(
- Subscribe(201, 240)
- );
-
- e2.Subscriptions.AssertEqual(
- Subscribe(202, 250)
- );
- }
-
- [TestMethod]
- public void Merge_EmptyDelayed2_LeftLast()
- {
- var scheduler = new TestScheduler();
-
- var e1 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnCompleted<int>(250)
- );
-
- var e2 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnCompleted<int>(240)
- );
-
- var res = scheduler.Start(() =>
- Observable.Merge(scheduler, e1, e2)
- );
-
- res.Messages.AssertEqual(
- OnCompleted<int>(250)
- );
-
- e1.Subscriptions.AssertEqual(
- Subscribe(201, 250)
- );
-
- e2.Subscriptions.AssertEqual(
- Subscribe(202, 240)
- );
- }
-
- [TestMethod]
- public void Merge_EmptyDelayed3_MiddleLast()
- {
- var scheduler = new TestScheduler();
-
- var e1 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnCompleted<int>(245)
- );
-
- var e2 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnCompleted<int>(250)
- );
-
- var e3 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnCompleted<int>(240)
- );
-
- var res = scheduler.Start(() =>
- Observable.Merge(scheduler, e1, e2, e3)
- );
-
- res.Messages.AssertEqual(
- OnCompleted<int>(250)
- );
-
- e1.Subscriptions.AssertEqual(
- Subscribe(201, 245)
- );
-
- e2.Subscriptions.AssertEqual(
- Subscribe(202, 250)
- );
-
- e3.Subscriptions.AssertEqual(
- Subscribe(203, 240)
- );
- }
-
- [TestMethod]
- public void Merge_EmptyNever()
- {
- var scheduler = new TestScheduler();
-
- var e1 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnCompleted<int>(245)
- );
-
- var n1 = scheduler.CreateHotObservable(
- OnNext(150, 1)
- );
-
- var res = scheduler.Start(() =>
- Observable.Merge(scheduler, e1, n1)
- );
-
- res.Messages.AssertEqual(
- );
-
- e1.Subscriptions.AssertEqual(
- Subscribe(201, 245)
- );
-
- n1.Subscriptions.AssertEqual(
- Subscribe(202, 1000)
- );
- }
-
- [TestMethod]
- public void Merge_NeverEmpty()
- {
- var scheduler = new TestScheduler();
-
- var n1 = scheduler.CreateHotObservable(
- OnNext(150, 1)
- );
-
- var e1 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnCompleted<int>(245)
- );
-
- var res = scheduler.Start(() =>
- Observable.Merge(scheduler, n1, e1)
- );
-
- res.Messages.AssertEqual(
- );
-
- n1.Subscriptions.AssertEqual(
- Subscribe(201, 1000)
- );
-
- e1.Subscriptions.AssertEqual(
- Subscribe(202, 245)
- );
- }
-
- [TestMethod]
- public void Merge_ReturnNever()
- {
- var scheduler = new TestScheduler();
-
- var r1 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnCompleted<int>(245)
- );
-
- var n1 = scheduler.CreateHotObservable(
- OnNext(150, 1)
- );
-
- var res = scheduler.Start(() =>
- Observable.Merge(scheduler, r1, n1)
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 2)
- );
-
- r1.Subscriptions.AssertEqual(
- Subscribe(201, 245)
- );
-
- n1.Subscriptions.AssertEqual(
- Subscribe(202, 1000)
- );
- }
-
- [TestMethod]
- public void Merge_NeverReturn()
- {
- var scheduler = new TestScheduler();
-
- var n1 = scheduler.CreateHotObservable(
- OnNext(150, 1)
- );
-
- var r1 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnCompleted<int>(245)
- );
-
- var res = scheduler.Start(() =>
- Observable.Merge(scheduler, n1, r1)
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 2)
- );
-
- n1.Subscriptions.AssertEqual(
- Subscribe(201, 1000)
- );
-
- r1.Subscriptions.AssertEqual(
- Subscribe(202, 245)
- );
- }
-
- [TestMethod]
- public void Merge_ErrorNever()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var e1 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnError<int>(245, ex)
- );
-
- var n1 = scheduler.CreateHotObservable(
- OnNext(150, 1)
- );
-
- var res = scheduler.Start(() =>
- Observable.Merge(scheduler, e1, n1)
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 2),
- OnError<int>(245, ex)
- );
-
- e1.Subscriptions.AssertEqual(
- Subscribe(201, 245)
- );
-
- n1.Subscriptions.AssertEqual(
- Subscribe(202, 245)
- );
- }
-
- [TestMethod]
- public void Merge_NeverError()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var n1 = scheduler.CreateHotObservable(
- OnNext(150, 1)
- );
-
- var e1 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnError<int>(245, ex)
- );
-
- var res = scheduler.Start(() =>
- Observable.Merge(scheduler, n1, e1)
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 2),
- OnError<int>(245, ex)
- );
-
- n1.Subscriptions.AssertEqual(
- Subscribe(201, 245)
- );
-
- e1.Subscriptions.AssertEqual(
- Subscribe(202, 245)
- );
- }
-
- [TestMethod]
- public void Merge_EmptyReturn()
- {
- var scheduler = new TestScheduler();
-
- var e1 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnCompleted<int>(245)
- );
-
- var r1 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- Observable.Merge(scheduler, e1, r1)
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 2),
- OnCompleted<int>(250)
- );
-
- e1.Subscriptions.AssertEqual(
- Subscribe(201, 245)
- );
-
- r1.Subscriptions.AssertEqual(
- Subscribe(202, 250)
- );
- }
-
- [TestMethod]
- public void Merge_ReturnEmpty()
- {
- var scheduler = new TestScheduler();
-
- var r1 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnCompleted<int>(250)
- );
-
- var e1 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnCompleted<int>(245)
- );
-
- var res = scheduler.Start(() =>
- Observable.Merge(scheduler, r1, e1)
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 2),
- OnCompleted<int>(250)
- );
-
- r1.Subscriptions.AssertEqual(
- Subscribe(201, 250)
- );
-
- e1.Subscriptions.AssertEqual(
- Subscribe(202, 245)
- );
- }
-
- [TestMethod]
- public void Merge_Lots2()
- {
- var scheduler = new TestScheduler();
-
- var o1 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnNext(220, 4),
- OnNext(230, 6),
- OnNext(240, 8),
- OnCompleted<int>(245)
- );
-
- var o2 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(215, 3),
- OnNext(225, 5),
- OnNext(235, 7),
- OnNext(245, 9),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- Observable.Merge(scheduler, o1, o2)
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 2),
- OnNext(215, 3),
- OnNext(220, 4),
- OnNext(225, 5),
- OnNext(230, 6),
- OnNext(235, 7),
- OnNext(240, 8),
- OnNext(245, 9),
- OnCompleted<int>(250)
- );
-
- o1.Subscriptions.AssertEqual(
- Subscribe(201, 245)
- );
-
- o2.Subscriptions.AssertEqual(
- Subscribe(202, 250)
- );
- }
-
- [TestMethod]
- public void Merge_Lots3()
- {
- var scheduler = new TestScheduler();
-
- var o1 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnNext(225, 5),
- OnNext(240, 8),
- OnCompleted<int>(245)
- );
-
- var o2 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(215, 3),
- OnNext(230, 6),
- OnNext(245, 9),
- OnCompleted<int>(250)
- );
-
- var o3 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(220, 4),
- OnNext(235, 7),
- OnCompleted<int>(240)
- );
-
- var res = scheduler.Start(() =>
- new[] { o1, o2, o3 }.Merge(scheduler)
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 2),
- OnNext(215, 3),
- OnNext(220, 4),
- OnNext(225, 5),
- OnNext(230, 6),
- OnNext(235, 7),
- OnNext(240, 8),
- OnNext(245, 9),
- OnCompleted<int>(250)
- );
-
- o1.Subscriptions.AssertEqual(
- Subscribe(201, 245)
- );
-
- o2.Subscriptions.AssertEqual(
- Subscribe(202, 250)
- );
-
- o3.Subscriptions.AssertEqual(
- Subscribe(203, 240)
- );
- }
-
- [TestMethod]
- public void Merge_LotsMore()
- {
- var inputs = new List<List<Recorded<Notification<int>>>>();
-
- const int N = 10;
- for (int i = 0; i < N; i++)
- {
- var lst = new List<Recorded<Notification<int>>> { OnNext(150, 1) };
- inputs.Add(lst);
-
- ushort start = (ushort)(301 + i);
- for (int j = 0; j < i; j++)
- {
- var onNext = OnNext(start += (ushort)(j * 5), j + i + 2);
- lst.Add(onNext);
- }
-
- lst.Add(OnCompleted<int>((ushort)(start + N - i)));
- }
-
- var inputsFlat = inputs.Aggregate((l, r) => l.Concat(r).ToList()).ToArray();
-
- var resOnNext = (from n in inputsFlat
- where n.Time >= 200
- where n.Value.Kind == NotificationKind.OnNext
- orderby n.Time
- select n).ToList();
-
- var lastCompleted = (from n in inputsFlat
- where n.Time >= 200
- where n.Value.Kind == NotificationKind.OnCompleted
- orderby n.Time descending
- select n).First();
-
- var scheduler = new TestScheduler();
-
- // Last ToArray: got to create the hot observables *now*
- var xss = inputs.Select(lst => (IObservable<int>)scheduler.CreateHotObservable(lst.ToArray())).ToArray();
-
- var res = scheduler.Start(() =>
- xss.Merge(scheduler)
- );
-
- Assert.AreEqual(resOnNext.Count + 1, res.Messages.Count, "length");
- for (int i = 0; i < resOnNext.Count; i++)
- {
- var msg = res.Messages[i];
- Assert.IsTrue(msg.Time == resOnNext[i].Time);
- Assert.IsTrue(msg.Value.Kind == NotificationKind.OnNext);
- Assert.IsTrue(msg.Value.Value == resOnNext[i].Value.Value);
- }
- Assert.IsTrue(res.Messages[resOnNext.Count].Value.Kind == NotificationKind.OnCompleted && res.Messages[resOnNext.Count].Time == lastCompleted.Time, "complete");
- }
-
- [TestMethod]
- public void Merge_ErrorLeft()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var o1 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnError<int>(245, ex)
- );
-
- var o2 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(215, 3),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- Observable.Merge(o1, o2, scheduler)
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 2),
- OnNext(215, 3),
- OnError<int>(245, ex)
- );
-
- o1.Subscriptions.AssertEqual(
- Subscribe(201, 245)
- );
-
- o2.Subscriptions.AssertEqual(
- Subscribe(202, 245)
- );
- }
-
- [TestMethod]
- public void Merge_ErrorCausesDisposal()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var e1 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnError<int>(210, ex) //!
- );
-
- var o1 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(220, 1), // should not come
- OnCompleted<int>(230)
- );
-
- var res = scheduler.Start(() =>
- Observable.Merge(e1, o1, scheduler)
- );
-
- res.Messages.AssertEqual(
- OnError<int>(210, ex) //!
- );
-
- e1.Subscriptions.AssertEqual(
- Subscribe(201, 210)
- );
-
- o1.Subscriptions.AssertEqual(
- Subscribe(202, 210)
- );
- }
-
- [TestMethod]
- public void Merge_ObservableOfObservable_Data()
- {
- var scheduler = new TestScheduler();
-
- var ys1 = scheduler.CreateColdObservable(
- OnNext(10, 101),
- OnNext(20, 102),
- OnNext(110, 103),
- OnNext(120, 104),
- OnNext(210, 105),
- OnNext(220, 106),
- OnCompleted<int>(230)
- );
-
- var ys2 = scheduler.CreateColdObservable(
- OnNext(10, 201),
- OnNext(20, 202),
- OnNext(30, 203),
- OnNext(40, 204),
- OnCompleted<int>(50)
- );
-
- var ys3 = scheduler.CreateColdObservable(
- OnNext(10, 301),
- OnNext(20, 302),
- OnNext(30, 303),
- OnNext(40, 304),
- OnNext(120, 305),
- OnCompleted<int>(150)
- );
-
- var xs = scheduler.CreateHotObservable(
- OnNext<IObservable<int>>(300, ys1),
- OnNext<IObservable<int>>(400, ys2),
- OnNext<IObservable<int>>(500, ys3),
- OnCompleted<IObservable<int>>(600)
- );
-
- var res = scheduler.Start(() =>
- xs.Merge()
- );
-
- res.Messages.AssertEqual(
- OnNext(310, 101),
- OnNext(320, 102),
- OnNext(410, 103),
- OnNext(410, 201),
- OnNext(420, 104),
- OnNext(420, 202),
- OnNext(430, 203),
- OnNext(440, 204),
- OnNext(510, 105),
- OnNext(510, 301),
- OnNext(520, 106),
- OnNext(520, 302),
- OnNext(530, 303),
- OnNext(540, 304),
- OnNext(620, 305),
- OnCompleted<int>(650)
- );
-
-#if !NO_PERF
- // BREAKING CHANGE v2 > v1.x -> More aggressive disposal behavior
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 600)
- );
-#else
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 650)
- );
-#endif
-
- ys1.Subscriptions.AssertEqual(
- Subscribe(300, 530)
- );
-
- ys2.Subscriptions.AssertEqual(
- Subscribe(400, 450)
- );
-
- ys3.Subscriptions.AssertEqual(
- Subscribe(500, 650)
- );
- }
-
- [TestMethod]
- public void Merge_ObservableOfObservable_Data_NonOverlapped()
- {
- var scheduler = new TestScheduler();
-
- var ys1 = scheduler.CreateColdObservable(
- OnNext(10, 101),
- OnNext(20, 102),
- OnCompleted<int>(230)
- );
-
- var ys2 = scheduler.CreateColdObservable(
- OnNext(10, 201),
- OnNext(20, 202),
- OnNext(30, 203),
- OnNext(40, 204),
- OnCompleted<int>(50)
- );
-
- var ys3 = scheduler.CreateColdObservable(
- OnNext(10, 301),
- OnNext(20, 302),
- OnNext(30, 303),
- OnNext(40, 304),
- OnCompleted<int>(50)
- );
-
- var xs = scheduler.CreateHotObservable(
- OnNext<IObservable<int>>(300, ys1),
- OnNext<IObservable<int>>(400, ys2),
- OnNext<IObservable<int>>(500, ys3),
- OnCompleted<IObservable<int>>(600)
- );
-
- var res = scheduler.Start(() =>
- xs.Merge()
- );
-
- res.Messages.AssertEqual(
- OnNext(310, 101),
- OnNext(320, 102),
- OnNext(410, 201),
- OnNext(420, 202),
- OnNext(430, 203),
- OnNext(440, 204),
- OnNext(510, 301),
- OnNext(520, 302),
- OnNext(530, 303),
- OnNext(540, 304),
- OnCompleted<int>(600)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 600)
- );
-
- ys1.Subscriptions.AssertEqual(
- Subscribe(300, 530)
- );
-
- ys2.Subscriptions.AssertEqual(
- Subscribe(400, 450)
- );
-
- ys3.Subscriptions.AssertEqual(
- Subscribe(500, 550)
- );
- }
-
- [TestMethod]
- public void Merge_ObservableOfObservable_InnerThrows()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var ys1 = scheduler.CreateColdObservable(
- OnNext(10, 101),
- OnNext(20, 102),
- OnNext(110, 103),
- OnNext(120, 104),
- OnNext(210, 105),
- OnNext(220, 106),
- OnCompleted<int>(230)
- );
-
- var ys2 = scheduler.CreateColdObservable(
- OnNext(10, 201),
- OnNext(20, 202),
- OnNext(30, 203),
- OnNext(40, 204),
- OnError<int>(50, ex)
- );
-
- var ys3 = scheduler.CreateColdObservable(
- OnNext(10, 301),
- OnNext(20, 302),
- OnNext(30, 303),
- OnNext(40, 304),
- OnCompleted<int>(150)
- );
-
- var xs = scheduler.CreateHotObservable(
- OnNext<IObservable<int>>(300, ys1),
- OnNext<IObservable<int>>(400, ys2),
- OnNext<IObservable<int>>(500, ys3),
- OnCompleted<IObservable<int>>(600)
- );
-
- var res = scheduler.Start(() =>
- xs.Merge()
- );
-
- res.Messages.AssertEqual(
- OnNext(310, 101),
- OnNext(320, 102),
- OnNext(410, 103),
- OnNext(410, 201),
- OnNext(420, 104),
- OnNext(420, 202),
- OnNext(430, 203),
- OnNext(440, 204),
- OnError<int>(450, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 450)
- );
-
- ys1.Subscriptions.AssertEqual(
- Subscribe(300, 450)
- );
-
- ys2.Subscriptions.AssertEqual(
- Subscribe(400, 450)
- );
-
- ys3.Subscriptions.AssertEqual(
- );
- }
-
- [TestMethod]
- public void Merge_ObservableOfObservable_OuterThrows()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var ys1 = scheduler.CreateColdObservable(
- OnNext(10, 101),
- OnNext(20, 102),
- OnNext(110, 103),
- OnNext(120, 104),
- OnNext(210, 105),
- OnNext(220, 106),
- OnCompleted<int>(230)
- );
-
- var ys2 = scheduler.CreateColdObservable(
- OnNext(10, 201),
- OnNext(20, 202),
- OnNext(30, 203),
- OnNext(40, 204),
- OnCompleted<int>(50)
- );
-
- var xs = scheduler.CreateHotObservable(
- OnNext<IObservable<int>>(300, ys1),
- OnNext<IObservable<int>>(400, ys2),
- OnError<IObservable<int>>(500, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.Merge()
- );
-
- res.Messages.AssertEqual(
- OnNext(310, 101),
- OnNext(320, 102),
- OnNext(410, 103),
- OnNext(410, 201),
- OnNext(420, 104),
- OnNext(420, 202),
- OnNext(430, 203),
- OnNext(440, 204),
- OnError<int>(500, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 500)
- );
-
- ys1.Subscriptions.AssertEqual(
- Subscribe(300, 500)
- );
-
- ys2.Subscriptions.AssertEqual(
- Subscribe(400, 450)
- );
- }
-
- [TestMethod]
- public void Merge_Binary_DefaultScheduler()
- {
- Assert.IsTrue(Observable.Return(1).Merge(Observable.Return(2)).ToEnumerable().OrderBy(x => x).SequenceEqual(new[] { 1, 2 }));
- }
-
- [TestMethod]
- public void Merge_Params_DefaultScheduler()
- {
- Assert.IsTrue(Observable.Merge(Observable.Return(1), Observable.Return(2)).ToEnumerable().OrderBy(x => x).SequenceEqual(new[] { 1, 2 }));
- }
-
- [TestMethod]
- public void Merge_IEnumerableOfIObservable_DefaultScheduler()
- {
- Assert.IsTrue(Observable.Merge((IEnumerable<IObservable<int>>)new[] { Observable.Return(1), Observable.Return(2) }).ToEnumerable().OrderBy(x => x).SequenceEqual(new[] { 1, 2 }));
- }
-
- [TestMethod]
- public void MergeConcat_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Merge(default(IEnumerable<IObservable<int>>), 1, DummyScheduler.Instance));
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => Observable.Merge(DummyEnumerable<IObservable<int>>.Instance, 0, DummyScheduler.Instance));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Merge(DummyEnumerable<IObservable<int>>.Instance, 1, null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Merge(default(IEnumerable<IObservable<int>>), 1));
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => Observable.Merge(DummyEnumerable<IObservable<int>>.Instance, 0));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Merge(default(IObservable<IObservable<int>>), 1));
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => Observable.Merge(DummyObservable<IObservable<int>>.Instance, 0));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Concat(default(IObservable<IObservable<int>>)));
-
-#if !NO_TPL
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Concat(default(IObservable<System.Threading.Tasks.Task<int>>)));
-#endif
- }
-
- [TestMethod]
- public void MergeConcat_Enumerable_Scheduler()
- {
- var b = Enumerable.Range(1, 3).Select(x => Observable.Range(x * 10, 3)).Merge(1)
- .SequenceEqual(new[] { 10, 11, 12, 20, 21, 22, 30, 31, 32 }.ToObservable())
- .First();
- Assert.IsTrue(b);
- }
-
- [TestMethod]
- public void MergeConcat_Enumerable()
- {
- var b = Enumerable.Range(1, 3).Select(x => Observable.Range(x * 10, 3)).Merge(1, DefaultScheduler.Instance)
- .SequenceEqual(new[] { 10, 11, 12, 20, 21, 22, 30, 31, 32 }.ToObservable())
- .First();
- Assert.IsTrue(b);
- }
-
- [TestMethod]
- public void MergeConcat_Default()
- {
- var b = Observable.Range(1, 3).Select(x => Observable.Range(x * 10, 3)).Concat()
- .SequenceEqual(new[] { 10, 11, 12, 20, 21, 22, 30, 31, 32 }.ToObservable())
- .First();
- Assert.IsTrue(b);
- }
-
- [TestMethod]
- public void MergeConcat_Basic()
- {
- var scheduler = new TestScheduler();
-
- var ys1 = scheduler.CreateColdObservable(
- OnNext(50, 1),
- OnNext(100, 2),
- OnNext(120, 3),
- OnCompleted<int>(140)
- );
-
- var ys2 = scheduler.CreateColdObservable(
- OnNext(20, 4),
- OnNext(70, 5),
- OnCompleted<int>(200)
- );
-
- var ys3 = scheduler.CreateColdObservable(
- OnNext(10, 6),
- OnNext(90, 7),
- OnNext(110, 8),
- OnCompleted<int>(130)
- );
-
- var ys4 = scheduler.CreateColdObservable(
- OnNext(210, 9),
- OnNext(240, 10),
- OnCompleted<int>(300)
- );
-
- var xs = scheduler.CreateHotObservable<IObservable<int>>(
- OnNext<IObservable<int>>(210, ys1),
- OnNext<IObservable<int>>(260, ys2),
- OnNext<IObservable<int>>(270, ys3),
- OnNext<IObservable<int>>(320, ys4),
- OnCompleted<IObservable<int>>(400)
- );
-
- var res = scheduler.Start(() =>
- xs.Merge(2)
- );
-
- res.Messages.AssertEqual(
- OnNext(260, 1),
- OnNext(280, 4),
- OnNext(310, 2),
- OnNext(330, 3),
- OnNext(330, 5),
- OnNext(360, 6),
- OnNext(440, 7),
- OnNext(460, 8),
- OnNext(670, 9),
- OnNext(700, 10),
- OnCompleted<int>(760)
- );
-
-#if !NO_PERF
- // BREAKING CHANGE v2 > v1.x -> More aggressive disposal behavior
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 400)
- );
-#else
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 760)
- );
-#endif
-
- ys1.Subscriptions.AssertEqual(
- Subscribe(210, 350)
- );
-
- ys2.Subscriptions.AssertEqual(
- Subscribe(260, 460)
- );
-
- ys3.Subscriptions.AssertEqual(
- Subscribe(350, 480)
- );
-
- ys4.Subscriptions.AssertEqual(
- Subscribe(460, 760)
- );
- }
-
- [TestMethod]
- public void MergeConcat_Basic_Long()
- {
- var scheduler = new TestScheduler();
-
- var ys1 = scheduler.CreateColdObservable(
- OnNext(50, 1),
- OnNext(100, 2),
- OnNext(120, 3),
- OnCompleted<int>(140)
- );
-
- var ys2 = scheduler.CreateColdObservable(
- OnNext(20, 4),
- OnNext(70, 5),
- OnCompleted<int>(300)
- );
-
- var ys3 = scheduler.CreateColdObservable(
- OnNext(10, 6),
- OnNext(90, 7),
- OnNext(110, 8),
- OnCompleted<int>(130)
- );
-
- var ys4 = scheduler.CreateColdObservable(
- OnNext(210, 9),
- OnNext(240, 10),
- OnCompleted<int>(300)
- );
-
- var xs = scheduler.CreateHotObservable(
- OnNext<IObservable<int>>(210, ys1),
- OnNext<IObservable<int>>(260, ys2),
- OnNext<IObservable<int>>(270, ys3),
- OnNext<IObservable<int>>(320, ys4),
- OnCompleted<IObservable<int>>(400)
- );
-
- var res = scheduler.Start(() =>
- xs.Merge(2)
- );
-
- res.Messages.AssertEqual(
- OnNext(260, 1),
- OnNext(280, 4),
- OnNext(310, 2),
- OnNext(330, 3),
- OnNext(330, 5),
- OnNext(360, 6),
- OnNext(440, 7),
- OnNext(460, 8),
- OnNext(690, 9),
- OnNext(720, 10),
- OnCompleted<int>(780)
- );
-
-#if !NO_PERF
- // BREAKING CHANGE v2 > v1.x -> More aggressive disposal behavior
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 400)
- );
-#else
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 780)
- );
-#endif
-
- ys1.Subscriptions.AssertEqual(
- Subscribe(210, 350)
- );
-
- ys2.Subscriptions.AssertEqual(
- Subscribe(260, 560)
- );
-
- ys3.Subscriptions.AssertEqual(
- Subscribe(350, 480)
- );
-
- ys4.Subscriptions.AssertEqual(
- Subscribe(480, 780)
- );
- }
-
- [TestMethod]
- public void MergeConcat_Basic_Wide()
- {
- var scheduler = new TestScheduler();
-
- var ys1 = scheduler.CreateColdObservable(
- OnNext(50, 1),
- OnNext(100, 2),
- OnNext(120, 3),
- OnCompleted<int>(140)
- );
-
- var ys2 = scheduler.CreateColdObservable(
- OnNext(20, 4),
- OnNext(70, 5),
- OnCompleted<int>(300)
- );
-
- var ys3 = scheduler.CreateColdObservable(
- OnNext(10, 6),
- OnNext(90, 7),
- OnNext(110, 8),
- OnCompleted<int>(130)
- );
-
- var ys4 = scheduler.CreateColdObservable(
- OnNext(210, 9),
- OnNext(240, 10),
- OnCompleted<int>(300)
- );
-
- var xs = scheduler.CreateHotObservable(
- OnNext<IObservable<int>>(210, ys1),
- OnNext<IObservable<int>>(260, ys2),
- OnNext<IObservable<int>>(270, ys3),
- OnNext<IObservable<int>>(420, ys4),
- OnCompleted<IObservable<int>>(450)
- );
-
- var res = scheduler.Start(() =>
- xs.Merge(3)
- );
-
- res.Messages.AssertEqual(
- OnNext(260, 1),
- OnNext(280, 4),
- OnNext(280, 6),
- OnNext(310, 2),
- OnNext(330, 3),
- OnNext(330, 5),
- OnNext(360, 7),
- OnNext(380, 8),
- OnNext(630, 9),
- OnNext(660, 10),
- OnCompleted<int>(720)
- );
-
-#if !NO_PERF
- // BREAKING CHANGE v2 > v1.x -> More aggressive disposal behavior
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 450)
- );
-#else
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 720)
- );
-#endif
-
- ys1.Subscriptions.AssertEqual(
- Subscribe(210, 350)
- );
-
- ys2.Subscriptions.AssertEqual(
- Subscribe(260, 560)
- );
-
- ys3.Subscriptions.AssertEqual(
- Subscribe(270, 400)
- );
-
- ys4.Subscriptions.AssertEqual(
- Subscribe(420, 720)
- );
- }
-
- [TestMethod]
- public void MergeConcat_Basic_Late()
- {
- var scheduler = new TestScheduler();
-
- var ys1 = scheduler.CreateColdObservable(
- OnNext(50, 1),
- OnNext(100, 2),
- OnNext(120, 3),
- OnCompleted<int>(140)
- );
-
- var ys2 = scheduler.CreateColdObservable(
- OnNext(20, 4),
- OnNext(70, 5),
- OnCompleted<int>(300)
- );
-
- var ys3 = scheduler.CreateColdObservable(
- OnNext(10, 6),
- OnNext(90, 7),
- OnNext(110, 8),
- OnCompleted<int>(130)
- );
-
- var ys4 = scheduler.CreateColdObservable(
- OnNext(210, 9),
- OnNext(240, 10),
- OnCompleted<int>(300)
- );
-
- var xs = scheduler.CreateHotObservable(
- OnNext<IObservable<int>>(210, ys1),
- OnNext<IObservable<int>>(260, ys2),
- OnNext<IObservable<int>>(270, ys3),
- OnNext<IObservable<int>>(420, ys4),
- OnCompleted<IObservable<int>>(750)
- );
-
- var res = scheduler.Start(() =>
- xs.Merge(3)
- );
-
- res.Messages.AssertEqual(
- OnNext(260, 1),
- OnNext(280, 4),
- OnNext(280, 6),
- OnNext(310, 2),
- OnNext(330, 3),
- OnNext(330, 5),
- OnNext(360, 7),
- OnNext(380, 8),
- OnNext(630, 9),
- OnNext(660, 10),
- OnCompleted<int>(750)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 750)
- );
-
- ys1.Subscriptions.AssertEqual(
- Subscribe(210, 350)
- );
-
- ys2.Subscriptions.AssertEqual(
- Subscribe(260, 560)
- );
-
- ys3.Subscriptions.AssertEqual(
- Subscribe(270, 400)
- );
-
- ys4.Subscriptions.AssertEqual(
- Subscribe(420, 720)
- );
- }
-
- [TestMethod]
- public void MergeConcat_Disposed()
- {
- var scheduler = new TestScheduler();
-
- var ys1 = scheduler.CreateColdObservable(
- OnNext(50, 1),
- OnNext(100, 2),
- OnNext(120, 3),
- OnCompleted<int>(140)
- );
-
- var ys2 = scheduler.CreateColdObservable(
- OnNext(20, 4),
- OnNext(70, 5),
- OnCompleted<int>(200)
- );
-
- var ys3 = scheduler.CreateColdObservable(
- OnNext(10, 6),
- OnNext(90, 7),
- OnNext(110, 8),
- OnCompleted<int>(130)
- );
-
- var ys4 = scheduler.CreateColdObservable(
- OnNext(210, 9),
- OnNext(240, 10),
- OnCompleted<int>(300)
- );
-
- var xs = scheduler.CreateHotObservable(
- OnNext<IObservable<int>>(210, ys1),
- OnNext<IObservable<int>>(260, ys2),
- OnNext<IObservable<int>>(270, ys3),
- OnNext<IObservable<int>>(320, ys4),
- OnCompleted<IObservable<int>>(400)
- );
-
- var res = scheduler.Start(() =>
- xs.Merge(2),
- 450
- );
-
- res.Messages.AssertEqual(
- OnNext(260, 1),
- OnNext(280, 4),
- OnNext(310, 2),
- OnNext(330, 3),
- OnNext(330, 5),
- OnNext(360, 6),
- OnNext(440, 7)
- );
-
-#if !NO_PERF
- // BREAKING CHANGE v2 > v1.x -> More aggressive disposal behavior
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 400)
- );
-#else
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 450)
- );
-#endif
-
- ys1.Subscriptions.AssertEqual(
- Subscribe(210, 350)
- );
-
- ys2.Subscriptions.AssertEqual(
- Subscribe(260, 450)
- );
-
- ys3.Subscriptions.AssertEqual(
- Subscribe(350, 450)
- );
-
- ys4.Subscriptions.AssertEqual(
- );
- }
-
- [TestMethod]
- public void MergeConcat_OuterError()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var ys1 = scheduler.CreateColdObservable(
- OnNext(50, 1),
- OnNext(100, 2),
- OnNext(120, 3),
- OnCompleted<int>(140)
- );
-
- var ys2 = scheduler.CreateColdObservable(
- OnNext(20, 4),
- OnNext(70, 5),
- OnCompleted<int>(200)
- );
-
- var ys3 = scheduler.CreateColdObservable(
- OnNext(10, 6),
- OnNext(90, 7),
- OnNext(110, 8),
- OnCompleted<int>(130)
- );
-
- var ys4 = scheduler.CreateColdObservable(
- OnNext(210, 9),
- OnNext(240, 10),
- OnCompleted<int>(300)
- );
-
- var xs = scheduler.CreateHotObservable(
- OnNext<IObservable<int>>(210, ys1),
- OnNext<IObservable<int>>(260, ys2),
- OnNext<IObservable<int>>(270, ys3),
- OnNext<IObservable<int>>(320, ys4),
- OnError<IObservable<int>>(400, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.Merge(2)
- );
-
- res.Messages.AssertEqual(
- OnNext(260, 1),
- OnNext(280, 4),
- OnNext(310, 2),
- OnNext(330, 3),
- OnNext(330, 5),
- OnNext(360, 6),
- OnError<int>(400, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 400)
- );
-
- ys1.Subscriptions.AssertEqual(
- Subscribe(210, 350)
- );
-
- ys2.Subscriptions.AssertEqual(
- Subscribe(260, 400)
- );
-
- ys3.Subscriptions.AssertEqual(
- Subscribe(350, 400)
- );
-
- ys4.Subscriptions.AssertEqual(
- );
- }
-
- [TestMethod]
- public void MergeConcat_InnerError()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var ys1 = scheduler.CreateColdObservable(
- OnNext(50, 1),
- OnNext(100, 2),
- OnNext(120, 3),
- OnCompleted<int>(140)
- );
-
- var ys2 = scheduler.CreateColdObservable(
- OnNext(20, 4),
- OnNext(70, 5),
- OnCompleted<int>(200)
- );
-
- var ys3 = scheduler.CreateColdObservable(
- OnNext(10, 6),
- OnNext(90, 7),
- OnNext(110, 8),
- OnError<int>(140, ex)
- );
-
- var ys4 = scheduler.CreateColdObservable(
- OnNext(210, 9),
- OnNext(240, 10),
- OnCompleted<int>(300)
- );
-
- var xs = scheduler.CreateHotObservable(
- OnNext<IObservable<int>>(210, ys1),
- OnNext<IObservable<int>>(260, ys2),
- OnNext<IObservable<int>>(270, ys3),
- OnNext<IObservable<int>>(320, ys4),
- OnCompleted<IObservable<int>>(400)
- );
-
- var res = scheduler.Start(() =>
- xs.Merge(2)
- );
-
- res.Messages.AssertEqual(
- OnNext(260, 1),
- OnNext(280, 4),
- OnNext(310, 2),
- OnNext(330, 3),
- OnNext(330, 5),
- OnNext(360, 6),
- OnNext(440, 7),
- OnNext(460, 8),
- OnError<int>(490, ex)
- );
-
-#if !NO_PERF
- // BREAKING CHANGE v2 > v1.x -> More aggressive disposal behavior
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 400)
- );
-#else
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 490)
- );
-#endif
-
- ys1.Subscriptions.AssertEqual(
- Subscribe(210, 350)
- );
-
- ys2.Subscriptions.AssertEqual(
- Subscribe(260, 460)
- );
-
- ys3.Subscriptions.AssertEqual(
- Subscribe(350, 490)
- );
-
- ys4.Subscriptions.AssertEqual(
- Subscribe(460, 490)
- );
- }
-
-#if !NO_TPL
- [TestMethod]
- public void Merge_Task()
- {
- var tss = Observable.Merge(new[] { Task.Factory.StartNew(() => 1), Task.Factory.StartNew(() => 2), Task.Factory.StartNew(() => 3) }.ToObservable());
-
- var res = tss.ToArray().Single();
-
- Assert.IsTrue(res.OrderBy(x => x).SequenceEqual(new[] { 1, 2, 3 }));
- }
-#endif
-
- #endregion
-
- #region + OnErrorResumeNext +
-
- [TestMethod]
- public void OnErrorResumeNext_ArgumentChecking()
- {
- var xs = DummyObservable<int>.Instance;
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.OnErrorResumeNext<int>((IObservable<int>[])null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.OnErrorResumeNext<int>((IEnumerable<IObservable<int>>)null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.OnErrorResumeNext<int>((IObservable<int>)null, xs));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.OnErrorResumeNext<int>(xs, (IObservable<int>)null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.OnErrorResumeNext<int>(null, xs));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.OnErrorResumeNext<int>(xs, null));
- }
-
- [TestMethod]
- public void OnErrorResumeNext_IEofIO_GetEnumeratorThrows()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xss = new RogueEnumerable<IObservable<int>>(ex);
-
- var res = scheduler.Start(() =>
- Observable.OnErrorResumeNext(xss)
- );
-
- res.Messages.AssertEqual(
- OnError<int>(200, ex)
- );
- }
-
- [TestMethod]
- public void OnErrorResumeNext_IEofIO()
- {
- var scheduler = new TestScheduler();
-
- var xs1 = scheduler.CreateColdObservable<int>(
- OnNext(10, 1),
- OnNext(20, 2),
- OnNext(30, 3),
- OnCompleted<int>(40)
- );
-
- var xs2 = scheduler.CreateColdObservable<int>(
- OnNext(10, 4),
- OnNext(20, 5),
- OnError<int>(30, new Exception())
- );
-
- var xs3 = scheduler.CreateColdObservable<int>(
- OnNext(10, 6),
- OnNext(20, 7),
- OnNext(30, 8),
- OnNext(40, 9),
- OnCompleted<int>(50)
- );
-
- var res = scheduler.Start(() =>
- Observable.OnErrorResumeNext(new[] { xs1, xs2, xs3 })
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 1),
- OnNext(220, 2),
- OnNext(230, 3),
- OnNext(250, 4),
- OnNext(260, 5),
- OnNext(280, 6),
- OnNext(290, 7),
- OnNext(300, 8),
- OnNext(310, 9),
- OnCompleted<int>(320)
- );
-
- xs1.Subscriptions.AssertEqual(
- Subscribe(200, 240)
- );
-
- xs2.Subscriptions.AssertEqual(
- Subscribe(240, 270)
- );
-
- xs3.Subscriptions.AssertEqual(
- Subscribe(270, 320)
- );
- }
-
- [TestMethod]
- public void OnErrorResumeNext_NoErrors()
- {
- var scheduler = new TestScheduler();
-
- var o1 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnNext(220, 3),
- OnCompleted<int>(230)
- );
-
- var o2 = scheduler.CreateHotObservable(
- OnNext(240, 4),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- o1.OnErrorResumeNext(o2)
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 2),
- OnNext(220, 3),
- OnNext(240, 4),
- OnCompleted<int>(250)
- );
-
- o1.Subscriptions.AssertEqual(
- Subscribe(200, 230)
- );
-
- o2.Subscriptions.AssertEqual(
- Subscribe(230, 250)
- );
- }
-
- [TestMethod]
- public void OnErrorResumeNext_Error()
- {
- var scheduler = new TestScheduler();
-
- var o1 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnNext(220, 3),
- OnError<int>(230, new Exception())
- );
-
- var o2 = scheduler.CreateHotObservable(
- OnNext(240, 4),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- o1.OnErrorResumeNext(o2)
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 2),
- OnNext(220, 3),
- OnNext(240, 4),
- OnCompleted<int>(250)
- );
-
- o1.Subscriptions.AssertEqual(
- Subscribe(200, 230)
- );
-
- o2.Subscriptions.AssertEqual(
- Subscribe(230, 250)
- );
- }
-
- [TestMethod]
- public void OnErrorResumeNext_ErrorMultiple()
- {
- var scheduler = new TestScheduler();
-
- var o1 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnError<int>(220, new Exception())
- );
-
- var o2 = scheduler.CreateHotObservable(
- OnNext(230, 3),
- OnError<int>(240, new Exception())
- );
-
- var o3 = scheduler.CreateHotObservable(
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- Observable.OnErrorResumeNext(o1, o2, o3)
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 2),
- OnNext(230, 3),
- OnCompleted<int>(250)
- );
-
- o1.Subscriptions.AssertEqual(
- Subscribe(200, 220)
- );
-
- o2.Subscriptions.AssertEqual(
- Subscribe(220, 240)
- );
-
- o3.Subscriptions.AssertEqual(
- Subscribe(240, 250)
- );
- }
-
- [TestMethod]
- public void OnErrorResumeNext_EmptyReturnThrowAndMore()
- {
- var scheduler = new TestScheduler();
-
- var o1 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnCompleted<int>(205)
- );
-
- var o2 = scheduler.CreateHotObservable(
- OnNext(215, 2),
- OnCompleted<int>(220)
- );
-
- var o3 = scheduler.CreateHotObservable(
- OnNext(225, 3),
- OnNext(230, 4),
- OnCompleted<int>(235)
- );
-
- var o4 = scheduler.CreateHotObservable(
- OnError<int>(240, new Exception())
- );
-
- var o5 = scheduler.CreateHotObservable(
- OnNext<int>(245, 5),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- new[] { o1, o2, o3, o4, o5 }.OnErrorResumeNext()
- );
-
- res.Messages.AssertEqual(
- OnNext(215, 2),
- OnNext(225, 3),
- OnNext(230, 4),
- OnNext(245, 5),
- OnCompleted<int>(250)
- );
-
- o1.Subscriptions.AssertEqual(
- Subscribe(200, 205)
- );
-
- o2.Subscriptions.AssertEqual(
- Subscribe(205, 220)
- );
-
- o3.Subscriptions.AssertEqual(
- Subscribe(220, 235)
- );
-
- o4.Subscriptions.AssertEqual(
- Subscribe(235, 240)
- );
-
- o5.Subscriptions.AssertEqual(
- Subscribe(240, 250)
- );
- }
-
- [TestMethod]
- public void OnErrorResumeNext_LastIsntSpecial()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var o1 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnCompleted<int>(220)
- );
-
- var o2 = scheduler.CreateHotObservable(
- OnError<int>(230, ex)
- );
-
- var res = scheduler.Start(() =>
- o1.OnErrorResumeNext(o2)
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 2),
- OnCompleted<int>(230)
- );
-
- o1.Subscriptions.AssertEqual(
- Subscribe(200, 220)
- );
-
- o2.Subscriptions.AssertEqual(
- Subscribe(220, 230)
- );
- }
-
- [TestMethod]
- public void OnErrorResumeNext_SingleSourceDoesntThrow()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var o1 = scheduler.CreateHotObservable(
- OnError<int>(230, ex)
- );
-
- var res = scheduler.Start(() =>
- Observable.OnErrorResumeNext(o1)
- );
-
- res.Messages.AssertEqual(
- OnCompleted<int>(230)
- );
-
- o1.Subscriptions.AssertEqual(
- Subscribe(200, 230)
- );
- }
-
- [TestMethod]
- public void OnErrorResumeNext_EndWithNever()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var o1 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnCompleted<int>(220)
- );
-
- var o2 = scheduler.CreateHotObservable(
- OnNext(150, 1)
- );
-
- var res = scheduler.Start(() =>
- Observable.OnErrorResumeNext(o1, o2)
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 2)
- );
-
- o1.Subscriptions.AssertEqual(
- Subscribe(200, 220)
- );
-
- o2.Subscriptions.AssertEqual(
- Subscribe(220, 1000)
- );
- }
-
- [TestMethod]
- public void OnErrorResumeNext_StartWithNever()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var o1 = scheduler.CreateHotObservable(
- OnNext(150, 1)
- );
-
- var o2 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnCompleted<int>(220)
- );
-
- var res = scheduler.Start(() =>
- Observable.OnErrorResumeNext(o1, o2)
- );
-
- res.Messages.AssertEqual(
- );
-
- o1.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
-
- o2.Subscriptions.AssertEqual(
- );
- }
-
- [TestMethod]
- public void OnErrorResumeNext_DefaultScheduler_Binary()
- {
- var evt = new ManualResetEvent(false);
-
- int sum = 0;
- Observable.Return(1).OnErrorResumeNext(Observable.Return(2)).Subscribe(x =>
- {
- sum += x;
- }, () => evt.Set());
-
- evt.WaitOne();
- Assert.AreEqual(3, sum);
- }
-
- [TestMethod]
- public void OnErrorResumeNext_DefaultScheduler_Nary()
- {
- var evt = new ManualResetEvent(false);
-
- int sum = 0;
- Observable.OnErrorResumeNext(Observable.Return(1), Observable.Return(2), Observable.Return(3)).Subscribe(x =>
- {
- sum += x;
- }, () => evt.Set());
-
- evt.WaitOne();
- Assert.AreEqual(6, sum);
- }
-
- [TestMethod]
- public void OnErrorResumeNext_DefaultScheduler_NaryEnumerable()
- {
- var evt = new ManualResetEvent(false);
-
- IEnumerable<IObservable<int>> sources = new[] { Observable.Return(1), Observable.Return(2), Observable.Return(3) };
-
- int sum = 0;
- Observable.OnErrorResumeNext(sources).Subscribe(x =>
- {
- sum += x;
- }, () => evt.Set());
-
- evt.WaitOne();
- Assert.AreEqual(6, sum);
- }
-
- [TestMethod]
- public void OnErrorResumeNext_IteratorThrows()
- {
- var scheduler = new TestScheduler();
- var ex = new Exception();
-
- var res = scheduler.Start(() =>
- Observable.OnErrorResumeNext<int>(Catch_IteratorThrows_Source(ex, true))
- );
-
- res.Messages.AssertEqual(
- OnError<int>(200, ex)
- );
- }
-
- [TestMethod]
- public void OnErrorResumeNext_EnumerableThrows()
- {
- var scheduler = new TestScheduler();
-
- var o = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnNext(220, 3),
- OnError<int>(225, new Exception())
- );
-
- var ex = new Exception();
- var xss = new MockEnumerable<IObservable<int>>(scheduler, GetObservablesForOnErrorResumeNextThrow(o, ex));
-
- var res = scheduler.Start(() =>
- xss.OnErrorResumeNext()
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 2),
- OnNext(220, 3),
- OnError<int>(225, ex)
- );
-
- o.Subscriptions.AssertEqual(
- Subscribe(200, 225)
- );
-
- xss.Subscriptions.AssertEqual(
- Subscribe(200, 225)
- );
- }
-
- private IEnumerable<IObservable<int>> GetObservablesForOnErrorResumeNextThrow(IObservable<int> first, Exception ex)
- {
- yield return first;
- throw ex;
- }
-
- [TestMethod]
- public void OnErrorResumeNext_EnumerableTiming()
- {
- var scheduler = new TestScheduler();
-
- var o1 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2), // !
- OnNext(220, 3), // !
- OnCompleted<int>(230)
- );
-
- var o2 = scheduler.CreateColdObservable(
- OnNext(50, 4), // !
- OnNext(60, 5), // !
- OnNext(70, 6), // !
- OnError<int>(80, new Exception())
- );
-
- var o3 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(200, 2),
- OnNext(210, 3),
- OnNext(220, 4),
- OnNext(230, 5),
- OnNext(270, 6),
- OnNext(320, 7), // !
- OnNext(330, 8), // !
- OnCompleted<int>(340)
- );
-
- var xss = new MockEnumerable<ITestableObservable<int>>(scheduler, new[] { o1, o2, o3, o2 });
-
- var res = scheduler.Start(() =>
- xss.Select(xs => (IObservable<int>)xs).OnErrorResumeNext()
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 2),
- OnNext(220, 3),
- OnNext(280, 4),
- OnNext(290, 5),
- OnNext(300, 6),
- OnNext(320, 7),
- OnNext(330, 8),
- OnNext(390, 4),
- OnNext(400, 5),
- OnNext(410, 6),
- OnCompleted<int>(420)
- );
-
- o1.Subscriptions.AssertEqual(
- Subscribe(200, 230)
- );
-
- o2.Subscriptions.AssertEqual(
- Subscribe(230, 310),
- Subscribe(340, 420)
- );
-
- o3.Subscriptions.AssertEqual(
- Subscribe(310, 340)
- );
-
- xss.Subscriptions.AssertEqual(
- Subscribe(200, 420)
- );
- }
-
- [TestMethod]
- public void OnErrorResumeNext_Enumerable_Dispose()
- {
- var scheduler = new TestScheduler();
-
- var o1 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnNext(220, 3),
- OnError<int>(230, new Exception())
- );
-
- var o2 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(200, 2),
- OnNext(210, 3),
- OnNext(240, 4),
- OnNext(270, 5),
- OnNext(320, 6),
- OnNext(330, 7),
- OnCompleted<int>(340)
- );
-
- var xss = new MockEnumerable<ITestableObservable<int>>(scheduler, new[] { o1, o2 });
-
- var res = scheduler.Start(() =>
- xss.Select(xs => (IObservable<int>)xs).OnErrorResumeNext(),
- 300
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 2),
- OnNext(220, 3),
- OnNext(240, 4),
- OnNext(270, 5)
- );
-
- o1.Subscriptions.AssertEqual(
- Subscribe(200, 230)
- );
-
- o2.Subscriptions.AssertEqual(
- Subscribe(230, 300)
- );
-
- xss.Subscriptions.AssertEqual(
- Subscribe(200, 300)
- );
- }
-
-#if !NO_PERF
- [TestMethod]
- public void OnErrorResumeNext_TailRecursive1()
- {
- var create = 0L;
- var start = 200L;
- var end = 1000L;
-
- var scheduler = new TestScheduler();
-
- var o = scheduler.CreateColdObservable<int>(
- OnNext(10, 1),
- OnNext(20, 2),
- OnNext(30, 3),
- OnError<int>(40, new Exception())
- );
-
- var f = default(Func<IObservable<int>>);
- f = () => Observable.Defer(() => o.OnErrorResumeNext(f()));
-
- var res = scheduler.Start(() => f(), create, start, end);
-
- var expected = new List<Recorded<Notification<int>>>();
-
- var t = start;
- while (t <= end)
- {
- var n = (t - start) / 10;
- if (n % 4 != 0)
- {
- expected.Add(OnNext(t, (int)(n % 4)));
- }
-
- t += 10;
- }
-
- res.Messages.AssertEqual(expected);
- }
-
- [TestMethod]
- public void OnErrorResumeNext_TailRecursive2()
- {
- var f = default(Func<int, IObservable<int>>);
- f = x => Observable.Defer(() => Observable.Throw<int>(new Exception(), ThreadPoolScheduler.Instance).StartWith(x).OnErrorResumeNext(f(x + 1)));
-
- var lst = new List<int>();
- f(0).Select(x => new StackTrace().FrameCount).Take(10).ForEach(lst.Add);
-
- Assert.IsTrue(lst.Last() - lst.First() < 10);
- }
-#endif
-
- #endregion
-
- #region + SkipUntil +
-
- [TestMethod]
- public void SkipUntil_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.SkipUntil<int, int>(null, DummyObservable<int>.Instance));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.SkipUntil<int, int>(DummyObservable<int>.Instance, null));
- }
-
- [TestMethod]
- public void SkipUntil_SomeData_Next()
- {
- var scheduler = new TestScheduler();
-
- var l = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnNext(220, 3),
- OnNext(230, 4), //!
- OnNext(240, 5), //!
- OnCompleted<int>(250)
- );
-
- var r = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(225, 99),
- OnCompleted<int>(230)
- );
-
- var res = scheduler.Start(() =>
- l.SkipUntil(r)
- );
-
- res.Messages.AssertEqual(
- OnNext(230, 4),
- OnNext(240, 5),
- OnCompleted<int>(250)
- );
-
- l.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
-
- r.Subscriptions.AssertEqual(
- Subscribe(200, 225)
- );
- }
-
- [TestMethod]
- public void SkipUntil_SomeData_Error()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var l = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnNext(220, 3),
- OnNext(230, 4),
- OnNext(240, 5),
- OnCompleted<int>(250)
- );
-
- var r = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnError<int>(225, ex)
- );
-
- var res = scheduler.Start(() =>
- l.SkipUntil(r)
- );
-
- res.Messages.AssertEqual(
- OnError<int>(225, ex)
- );
-
- l.Subscriptions.AssertEqual(
- Subscribe(200, 225)
- );
-
- r.Subscriptions.AssertEqual(
- Subscribe(200, 225)
- );
- }
-
- [TestMethod]
- public void SkipUntil_Error_SomeData()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var l = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnError<int>(220, ex)
- );
-
- var r = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(230, 2),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- l.SkipUntil(r)
- );
-
- res.Messages.AssertEqual(
- OnError<int>(220, ex)
- );
-
- l.Subscriptions.AssertEqual(
- Subscribe(200, 220)
- );
-
- r.Subscriptions.AssertEqual(
- Subscribe(200, 220)
- );
- }
-
- [TestMethod]
- public void SkipUntil_SomeData_Empty()
- {
- var scheduler = new TestScheduler();
-
- var l = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnNext(220, 3),
- OnNext(230, 4),
- OnNext(240, 5),
- OnCompleted<int>(250)
- );
-
- var r = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnCompleted<int>(225)
- );
-
- var res = scheduler.Start(() =>
- l.SkipUntil(r)
- );
-
- res.Messages.AssertEqual(
- );
-
- l.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
-
- r.Subscriptions.AssertEqual(
- Subscribe(200, 225)
- );
- }
-
- [TestMethod]
- public void SkipUntil_Never_Next()
- {
- var scheduler = new TestScheduler();
-
- var l = scheduler.CreateHotObservable(
- OnNext(150, 1)
- );
-
- var r = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(225, 2), //!
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- l.SkipUntil(r)
- );
-
- res.Messages.AssertEqual(
- );
-
- l.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
-
- r.Subscriptions.AssertEqual(
- Subscribe(200, 225)
- );
- }
-
- [TestMethod]
- public void SkipUntil_Never_Error1()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var l = scheduler.CreateHotObservable(
- OnNext(150, 1)
- );
-
- var r = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnError<int>(225, ex)
- );
-
- var res = scheduler.Start(() =>
- l.SkipUntil(r)
- );
-
- res.Messages.AssertEqual(
- OnError<int>(225, ex)
- );
-
- l.Subscriptions.AssertEqual(
- Subscribe(200, 225)
- );
-
- r.Subscriptions.AssertEqual(
- Subscribe(200, 225)
- );
- }
-
- [TestMethod]
- public void SkipUntil_SomeData_Error2()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var l = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnNext(220, 3),
- OnNext(230, 4),
- OnNext(240, 5),
- OnCompleted<int>(250)
- );
-
- var r = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnError<int>(300, ex)
- );
-
- var res = scheduler.Start(() =>
- l.SkipUntil(r)
- );
-
- res.Messages.AssertEqual(
- OnError<int>(300, ex)
- );
-
- l.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
-
- r.Subscriptions.AssertEqual(
- Subscribe(200, 300)
- );
- }
-
- [TestMethod]
- public void SkipUntil_SomeData_Never()
- {
- var scheduler = new TestScheduler();
-
- var l = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnNext(220, 3),
- OnNext(230, 4),
- OnNext(240, 5),
- OnCompleted<int>(250)
- );
-
- var r = scheduler.CreateHotObservable(
- OnNext(150, 1)
- );
-
- var res = scheduler.Start(() =>
- l.SkipUntil(r)
- );
-
- res.Messages.AssertEqual(
- );
-
- l.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
-
- r.Subscriptions.AssertEqual(
- Subscribe(200, 1000 /* can't dispose prematurely, could be in flight to dispatch OnError */)
- );
- }
-
- [TestMethod]
- public void SkipUntil_Never_Empty()
- {
- var scheduler = new TestScheduler();
-
- var l = scheduler.CreateHotObservable(
- OnNext(150, 1)
- );
-
- var r = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnCompleted<int>(225)
- );
-
- var res = scheduler.Start(() =>
- l.SkipUntil(r)
- );
-
- res.Messages.AssertEqual(
- );
-
- l.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
-
- r.Subscriptions.AssertEqual(
- Subscribe(200, 225)
- );
- }
-
- [TestMethod]
- public void SkipUntil_Never_Never()
- {
- var scheduler = new TestScheduler();
-
- var l = scheduler.CreateHotObservable(
- OnNext(150, 1)
- );
-
- var r = scheduler.CreateHotObservable(
- OnNext(150, 1)
- );
-
- var res = scheduler.Start(() =>
- l.SkipUntil(r)
- );
-
- res.Messages.AssertEqual(
- );
-
- l.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
-
- r.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
- }
-
- [TestMethod]
- public void SkipUntil_HasCompletedCausesDisposal()
- {
- var scheduler = new TestScheduler();
-
- bool disposed = false;
-
- var l = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnNext(220, 3),
- OnNext(230, 4),
- OnNext(240, 5),
- OnCompleted<int>(250)
- );
-
- var r = Observable.Create<int>(obs => () => { disposed = true; });
-
- var res = scheduler.Start(() =>
- l.SkipUntil(r)
- );
-
- res.Messages.AssertEqual(
- );
-
- Assert.IsTrue(disposed, "disposed");
- }
-
- #endregion
-
- #region + Switch +
-
- [TestMethod]
- public void Switch_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Switch((IObservable<IObservable<int>>)null));
-
-#if !NO_TPL
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Switch((IObservable<System.Threading.Tasks.Task<int>>)null));
-#endif
- }
-
- [TestMethod]
- public void Switch_Data()
- {
- var scheduler = new TestScheduler();
-
- var ys1 = scheduler.CreateColdObservable(
- OnNext(10, 101),
- OnNext(20, 102),
- OnNext(110, 103),
- OnNext(120, 104),
- OnNext(210, 105),
- OnNext(220, 106),
- OnCompleted<int>(230)
- );
-
- var ys2 = scheduler.CreateColdObservable(
- OnNext(10, 201),
- OnNext(20, 202),
- OnNext(30, 203),
- OnNext(40, 204),
- OnCompleted<int>(50)
- );
-
- var ys3 = scheduler.CreateColdObservable(
- OnNext(10, 301),
- OnNext(20, 302),
- OnNext(30, 303),
- OnNext(40, 304),
- OnCompleted<int>(150)
- );
-
- var xs = scheduler.CreateHotObservable(
- OnNext<IObservable<int>>(300, ys1),
- OnNext<IObservable<int>>(400, ys2),
- OnNext<IObservable<int>>(500, ys3),
- OnCompleted<IObservable<int>>(600)
- );
-
- var res = scheduler.Start(() =>
- xs.Switch()
- );
-
- res.Messages.AssertEqual(
- OnNext(310, 101),
- OnNext(320, 102),
- OnNext(410, 201),
- OnNext(420, 202),
- OnNext(430, 203),
- OnNext(440, 204),
- OnNext(510, 301),
- OnNext(520, 302),
- OnNext(530, 303),
- OnNext(540, 304),
- OnCompleted<int>(650)
- );
-
-#if !NO_PERF
- // BREAKING CHANGE v2 > v1.x -> More aggressive disposal behavior
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 600)
- );
-#else
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 650)
- );
-#endif
-
- ys1.Subscriptions.AssertEqual(
- Subscribe(300, 400)
- );
-
-#if !NO_PERF
- // BREAKING CHANGE v2 > v1.x -> More aggressive disposal behavior
- ys2.Subscriptions.AssertEqual(
- Subscribe(400, 450)
- );
-#else
- ys2.Subscriptions.AssertEqual(
- Subscribe(400, 500)
- );
-#endif
-
- ys3.Subscriptions.AssertEqual(
- Subscribe(500, 650)
- );
- }
-
- [TestMethod]
- public void Switch_InnerThrows()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var ys1 = scheduler.CreateColdObservable(
- OnNext(10, 101),
- OnNext(20, 102),
- OnNext(110, 103),
- OnNext(120, 104),
- OnNext(210, 105),
- OnNext(220, 106),
- OnCompleted<int>(230)
- );
-
- var ys2 = scheduler.CreateColdObservable(
- OnNext(10, 201),
- OnNext(20, 202),
- OnNext(30, 203),
- OnNext(40, 204),
- OnError<int>(50, ex)
- );
-
- var ys3 = scheduler.CreateColdObservable(
- OnNext(10, 301),
- OnNext(20, 302),
- OnNext(30, 303),
- OnNext(40, 304),
- OnCompleted<int>(150)
- );
-
- var xs = scheduler.CreateHotObservable(
- OnNext<IObservable<int>>(300, ys1),
- OnNext<IObservable<int>>(400, ys2),
- OnNext<IObservable<int>>(500, ys3),
- OnCompleted<IObservable<int>>(600)
- );
-
- var res = scheduler.Start(() =>
- xs.Switch()
- );
-
- res.Messages.AssertEqual(
- OnNext(310, 101),
- OnNext(320, 102),
- OnNext(410, 201),
- OnNext(420, 202),
- OnNext(430, 203),
- OnNext(440, 204),
- OnError<int>(450, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 450)
- );
-
- ys1.Subscriptions.AssertEqual(
- Subscribe(300, 400)
- );
-
- ys2.Subscriptions.AssertEqual(
- Subscribe(400, 450)
- );
-
- ys3.Subscriptions.AssertEqual(
- );
- }
-
- [TestMethod]
- public void Switch_OuterThrows()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var ys1 = scheduler.CreateColdObservable(
- OnNext(10, 101),
- OnNext(20, 102),
- OnNext(110, 103),
- OnNext(120, 104),
- OnNext(210, 105),
- OnNext(220, 106),
- OnCompleted<int>(230)
- );
-
- var ys2 = scheduler.CreateColdObservable(
- OnNext(10, 201),
- OnNext(20, 202),
- OnNext(30, 203),
- OnNext(40, 204),
- OnCompleted<int>(50)
- );
-
- var xs = scheduler.CreateHotObservable(
- OnNext<IObservable<int>>(300, ys1),
- OnNext<IObservable<int>>(400, ys2),
- OnError<IObservable<int>>(500, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.Switch()
- );
-
- res.Messages.AssertEqual(
- OnNext(310, 101),
- OnNext(320, 102),
- OnNext(410, 201),
- OnNext(420, 202),
- OnNext(430, 203),
- OnNext(440, 204),
- OnError<int>(500, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 500)
- );
-
- ys1.Subscriptions.AssertEqual(
- Subscribe(300, 400)
- );
-
-#if !NO_PERF
- // BREAKING CHANGE v2 > v1.x -> More aggressive disposal behavior
- ys2.Subscriptions.AssertEqual(
- Subscribe(400, 450)
- );
-#else
- ys2.Subscriptions.AssertEqual(
- Subscribe(400, 500)
- );
-#endif
- }
-
- [TestMethod]
- public void Switch_NoInner()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnCompleted<IObservable<int>>(500)
- );
-
- var res = scheduler.Start(() =>
- xs.Switch()
- );
-
- res.Messages.AssertEqual(
- OnCompleted<int>(500)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 500)
- );
- }
-
- [TestMethod]
- public void Switch_InnerCompletes()
- {
- var scheduler = new TestScheduler();
-
- var ys1 = scheduler.CreateColdObservable(
- OnNext(10, 101),
- OnNext(20, 102),
- OnNext(110, 103),
- OnNext(120, 104),
- OnNext(210, 105),
- OnNext(220, 106),
- OnCompleted<int>(230)
- );
-
- var xs = scheduler.CreateHotObservable(
- OnNext<IObservable<int>>(300, ys1),
- OnCompleted<IObservable<int>>(540)
- );
-
- var res = scheduler.Start(() =>
- xs.Switch()
- );
-
- res.Messages.AssertEqual(
- OnNext(310, 101),
- OnNext(320, 102),
- OnNext(410, 103),
- OnNext(420, 104),
- OnNext(510, 105),
- OnNext(520, 106),
- OnCompleted<int>(540)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 540)
- );
-
-#if !NO_PERF
- // BREAKING CHANGE v2 > v1.x -> More aggressive disposal behavior
- ys1.Subscriptions.AssertEqual(
- Subscribe(300, 530)
- );
-#else
- ys1.Subscriptions.AssertEqual(
- Subscribe(300, 540)
- );
-#endif
- }
-
-#if !NO_TPL
- [TestMethod]
- public void Switch_Task()
- {
- var tss = Observable.Switch(new[] { Task.Factory.StartNew(() => 1), Task.Factory.StartNew(() => 2), Task.Factory.StartNew(() => 3) }.ToObservable());
-
- var res = tss.ToArray().Single();
-
- Assert.IsTrue(res.Zip(res.Skip(1), (l, r) => r > l).All(b => b));
- }
-#endif
-
- #endregion
-
- #region + TakeUntil +
-
- [TestMethod]
- public void TakeUntil_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.TakeUntil<int, int>(null, DummyObservable<int>.Instance));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.TakeUntil<int, int>(DummyObservable<int>.Instance, null));
- }
-
- [TestMethod]
- public void TakeUntil_Preempt_SomeData_Next()
- {
- var scheduler = new TestScheduler();
-
- var l = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnNext(220, 3),
- OnNext(230, 4),
- OnNext(240, 5),
- OnCompleted<int>(250)
- );
-
- var r = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(225, 99),
- OnCompleted<int>(230)
- );
-
- var res = scheduler.Start(() =>
- l.TakeUntil(r)
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 2),
- OnNext(220, 3),
- OnCompleted<int>(225)
- );
-
- l.Subscriptions.AssertEqual(
- Subscribe(200, 225)
- );
-
- r.Subscriptions.AssertEqual(
- Subscribe(200, 225)
- );
- }
-
- [TestMethod]
- public void TakeUntil_Preempt_SomeData_Error()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var l = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnNext(220, 3),
- OnNext(230, 4),
- OnNext(240, 5),
- OnCompleted<int>(250)
- );
-
- var r = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnError<int>(225, ex)
- );
-
- var res = scheduler.Start(() =>
- l.TakeUntil(r)
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 2),
- OnNext(220, 3),
- OnError<int>(225, ex)
- );
-
- l.Subscriptions.AssertEqual(
- Subscribe(200, 225)
- );
-
- r.Subscriptions.AssertEqual(
- Subscribe(200, 225)
- );
- }
-
- [TestMethod]
- public void TakeUntil_NoPreempt_SomeData_Empty()
- {
- var scheduler = new TestScheduler();
-
- var l = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnNext(220, 3),
- OnNext(230, 4),
- OnNext(240, 5),
- OnCompleted<int>(250)
- );
-
- var r = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnCompleted<int>(225)
- );
-
- var res = scheduler.Start(() =>
- l.TakeUntil(r)
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 2),
- OnNext(220, 3),
- OnNext(230, 4),
- OnNext(240, 5),
- OnCompleted<int>(250)
- );
-
- l.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
-
- r.Subscriptions.AssertEqual(
- Subscribe(200, 225)
- );
- }
-
- [TestMethod]
- public void TakeUntil_NoPreempt_SomeData_Never()
- {
- var scheduler = new TestScheduler();
-
- var l = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnNext(220, 3),
- OnNext(230, 4),
- OnNext(240, 5),
- OnCompleted<int>(250)
- );
-
- var r = scheduler.CreateHotObservable(
- OnNext(150, 1)
- );
-
- var res = scheduler.Start(() =>
- l.TakeUntil(r)
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 2),
- OnNext(220, 3),
- OnNext(230, 4),
- OnNext(240, 5),
- OnCompleted<int>(250)
- );
-
- l.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
-
- r.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void TakeUntil_Preempt_Never_Next()
- {
- var scheduler = new TestScheduler();
-
- var l = scheduler.CreateHotObservable(
- OnNext(150, 1)
- );
-
- var r = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(225, 2), //!
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- l.TakeUntil(r)
- );
-
- res.Messages.AssertEqual(
- OnCompleted<int>(225)
- );
-
- l.Subscriptions.AssertEqual(
- Subscribe(200, 225)
- );
-
- r.Subscriptions.AssertEqual(
- Subscribe(200, 225)
- );
- }
-
- [TestMethod]
- public void TakeUntil_Preempt_Never_Error()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var l = scheduler.CreateHotObservable(
- OnNext(150, 1)
- );
-
- var r = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnError<int>(225, ex)
- );
-
- var res = scheduler.Start(() =>
- l.TakeUntil(r)
- );
-
- res.Messages.AssertEqual(
- OnError<int>(225, ex)
- );
-
- l.Subscriptions.AssertEqual(
- Subscribe(200, 225)
- );
-
- r.Subscriptions.AssertEqual(
- Subscribe(200, 225)
- );
- }
-
- [TestMethod]
- public void TakeUntil_NoPreempt_Never_Empty()
- {
- var scheduler = new TestScheduler();
-
- var l = scheduler.CreateHotObservable(
- OnNext(150, 1)
- );
-
- var r = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnCompleted<int>(225)
- );
-
- var res = scheduler.Start(() =>
- l.TakeUntil(r)
- );
-
- res.Messages.AssertEqual(
- );
-
- l.Subscriptions.AssertEqual(
- Subscribe(200, 1000 /* can't dispose prematurely, could be in flight to dispatch OnError */)
- );
-
- r.Subscriptions.AssertEqual(
- Subscribe(200, 225)
- );
- }
-
- [TestMethod]
- public void TakeUntil_NoPreempt_Never_Never()
- {
- var scheduler = new TestScheduler();
-
- var l = scheduler.CreateHotObservable(
- OnNext(150, 1)
- );
-
- var r = scheduler.CreateHotObservable(
- OnNext(150, 1)
- );
-
- var res = scheduler.Start(() =>
- l.TakeUntil(r)
- );
-
- res.Messages.AssertEqual(
- );
-
- l.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
-
- r.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
- }
-
- [TestMethod]
- public void TakeUntil_Preempt_BeforeFirstProduced()
- {
- var scheduler = new TestScheduler();
-
- var l = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(230, 2),
- OnCompleted<int>(240)
- );
-
- var r = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2), //!
- OnCompleted<int>(220)
- );
-
- var res = scheduler.Start(() =>
- l.TakeUntil(r)
- );
-
- res.Messages.AssertEqual(
- OnCompleted<int>(210)
- );
-
- l.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
-
- r.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void TakeUntil_Preempt_BeforeFirstProduced_RemainSilentAndProperDisposed()
- {
- var scheduler = new TestScheduler();
-
- bool sourceNotDisposed = false;
-
- var l = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnError<int>(215, new Exception()), // should not come
- OnCompleted<int>(240)
- );
-
- var r = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2), //!
- OnCompleted<int>(220)
- );
-
- var res = scheduler.Start(() =>
- l.Do(_ => sourceNotDisposed = true).TakeUntil(r)
- );
-
- res.Messages.AssertEqual(
- OnCompleted<int>(210)
- );
-
- Assert.IsFalse(sourceNotDisposed);
- }
-
- [TestMethod]
- public void TakeUntil_NoPreempt_AfterLastProduced_ProperDisposedSignal()
- {
- var scheduler = new TestScheduler();
-
- bool signalNotDisposed = false;
-
- var l = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(230, 2),
- OnCompleted<int>(240)
- );
-
- var r = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(250, 2),
- OnCompleted<int>(260)
- );
-
- var res = scheduler.Start(() =>
- l.TakeUntil(r.Do(_ => signalNotDisposed = true))
- );
-
- res.Messages.AssertEqual(
- OnNext(230, 2),
- OnCompleted<int>(240)
- );
-
- Assert.IsFalse(signalNotDisposed);
- }
-
- [TestMethod]
- public void TakeUntil_Error_Some()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var l = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnError<int>(225, ex)
- );
-
- var r = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext<int>(240, 2)
- );
-
- var res = scheduler.Start(() =>
- l.TakeUntil(r)
- );
-
- res.Messages.AssertEqual(
- OnError<int>(225, ex)
- );
-
- l.Subscriptions.AssertEqual(
- Subscribe(200, 225)
- );
-
- r.Subscriptions.AssertEqual(
- Subscribe(200, 225)
- );
- }
-
- #endregion
-
- #region + Window +
-
- [TestMethod]
- public void Window_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Window(default(IObservable<int>), DummyFunc<IObservable<int>>.Instance));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Window(DummyObservable<int>.Instance, default(Func<IObservable<int>>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Window(default(IObservable<int>), DummyObservable<int>.Instance, DummyFunc<int, IObservable<int>>.Instance));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Window(DummyObservable<int>.Instance, default(IObservable<int>), DummyFunc<int, IObservable<int>>.Instance));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Window(DummyObservable<int>.Instance, DummyObservable<int>.Instance, default(Func<int, IObservable<int>>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Window(default(IObservable<int>), DummyObservable<int>.Instance));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Window(DummyObservable<int>.Instance, default(IObservable<int>)));
- }
-
- [TestMethod]
- public void Window_Closings_Basic()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(90, 1),
- OnNext(180, 2),
- OnNext(250, 3),
- OnNext(260, 4),
- OnNext(310, 5),
- OnNext(340, 6),
- OnNext(410, 7),
- OnNext(420, 8),
- OnNext(470, 9),
- OnNext(550, 10),
- OnCompleted<int>(590)
- );
-
- var window = 1;
-
- var res = scheduler.Start(() =>
- xs.Window(() => Observable.Timer(TimeSpan.FromTicks((window++) * 100), scheduler)).Select((w, i) => w.Select(x => i.ToString() + " " + x.ToString())).Merge()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, "0 3"),
- OnNext(260, "0 4"),
- OnNext(310, "1 5"),
- OnNext(340, "1 6"),
- OnNext(410, "1 7"),
- OnNext(420, "1 8"),
- OnNext(470, "1 9"),
- OnNext(550, "2 10"),
- OnCompleted<string>(590)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 590)
- );
- }
-
- [TestMethod]
- public void Window_Closings_InnerSubscriptions()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(90, 1),
- OnNext(180, 2),
- OnNext(250, 3),
- OnNext(260, 4),
- OnNext(310, 5),
- OnNext(340, 6),
- OnNext(410, 7),
- OnNext(420, 8),
- OnNext(470, 9),
- OnNext(550, 10),
- OnCompleted<int>(590)
- );
-
- var closings = new ITestableObservable<bool>[] {
- scheduler.CreateHotObservable(
- OnNext(300, true),
- OnNext(350, false),
- OnCompleted<bool>(380)
- ),
- scheduler.CreateHotObservable(
- OnNext(400, true),
- OnNext(510, false),
- OnNext(620, false)
- ),
- scheduler.CreateHotObservable(
- OnCompleted<bool>(500)
- ),
- scheduler.CreateHotObservable(
- OnNext(600, true)
- )
- };
-
- var window = 0;
-
- var res = scheduler.Start(() =>
- xs.Window(() => closings[window++]).Select((w, i) => w.Select(x => i.ToString() + " " + x.ToString())).Merge()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, "0 3"),
- OnNext(260, "0 4"),
- OnNext(310, "1 5"),
- OnNext(340, "1 6"),
- OnNext(410, "2 7"),
- OnNext(420, "2 8"),
- OnNext(470, "2 9"),
- OnNext(550, "3 10"),
- OnCompleted<string>(590)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 590)
- );
-
- closings[0].Subscriptions.AssertEqual(
- Subscribe(200, 300)
- );
-
- closings[1].Subscriptions.AssertEqual(
- Subscribe(300, 400)
- );
-
- closings[2].Subscriptions.AssertEqual(
- Subscribe(400, 500)
- );
-
- closings[3].Subscriptions.AssertEqual(
- Subscribe(500, 590)
- );
- }
-
- [TestMethod]
- public void Window_Closings_Empty()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(90, 1),
- OnNext(180, 2),
- OnNext(250, 3),
- OnNext(260, 4),
- OnNext(310, 5),
- OnNext(340, 6),
- OnNext(410, 7),
- OnNext(420, 8),
- OnNext(470, 9),
- OnNext(550, 10),
- OnCompleted<int>(590)
- );
-
- var window = 1;
-
- var res = scheduler.Start(() =>
- xs.Window(() => Observable.Empty<int>().Delay(TimeSpan.FromTicks((window++) * 100), scheduler)).Select((w, i) => w.Select(x => i.ToString() + " " + x.ToString())).Merge()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, "0 3"),
- OnNext(260, "0 4"),
- OnNext(310, "1 5"),
- OnNext(340, "1 6"),
- OnNext(410, "1 7"),
- OnNext(420, "1 8"),
- OnNext(470, "1 9"),
- OnNext(550, "2 10"),
- OnCompleted<string>(590)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 590)
- );
- }
-
- [TestMethod]
- public void Window_Closings_Dispose()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(90, 1),
- OnNext(180, 2),
- OnNext(250, 3),
- OnNext(260, 4),
- OnNext(310, 5),
- OnNext(340, 6),
- OnNext(410, 7),
- OnNext(420, 8),
- OnNext(470, 9),
- OnNext(550, 10),
- OnCompleted<int>(590)
- );
-
- var window = 1;
-
- var res = scheduler.Start(() =>
- xs.Window(() => Observable.Timer(TimeSpan.FromTicks((window++) * 100), scheduler)).Select((w, i) => w.Select(x => i.ToString() + " " + x.ToString())).Merge(),
- 400
- );
-
- res.Messages.AssertEqual(
- OnNext(250, "0 3"),
- OnNext(260, "0 4"),
- OnNext(310, "1 5"),
- OnNext(340, "1 6")
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 400)
- );
- }
-
- [TestMethod]
- public void Window_Closings_Error()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(90, 1),
- OnNext(180, 2),
- OnNext(250, 3),
- OnNext(260, 4),
- OnNext(310, 5),
- OnNext(340, 6),
- OnNext(410, 7),
- OnNext(420, 8),
- OnNext(470, 9),
- OnNext(550, 10),
- OnError<int>(590, ex)
- );
-
- var window = 1;
-
- var res = scheduler.Start(() =>
- xs.Window(() => Observable.Timer(TimeSpan.FromTicks((window++) * 100), scheduler)).Select((w, i) => w.Select(x => i.ToString() + " " + x.ToString())).Merge()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, "0 3"),
- OnNext(260, "0 4"),
- OnNext(310, "1 5"),
- OnNext(340, "1 6"),
- OnNext(410, "1 7"),
- OnNext(420, "1 8"),
- OnNext(470, "1 9"),
- OnNext(550, "2 10"),
- OnError<string>(590, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 590)
- );
- }
-
- [TestMethod]
- public void Window_Closings_Throw()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(90, 1),
- OnNext(180, 2),
- OnNext(250, 3),
- OnNext(260, 4),
- OnNext(310, 5),
- OnNext(340, 6),
- OnNext(410, 7),
- OnNext(420, 8),
- OnNext(470, 9),
- OnNext(550, 10),
- OnError<int>(590, new Exception())
- );
-
- var res = scheduler.Start(() =>
- xs.Window<int, int>(() => { throw ex; }).Select((w, i) => w.Select(x => i.ToString() + " " + x.ToString())).Merge()
- );
-
- res.Messages.AssertEqual(
- OnError<string>(200, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 200)
- );
- }
-
- [TestMethod]
- public void Window_Closings_WindowClose_Error()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(90, 1),
- OnNext(180, 2),
- OnNext(250, 3),
- OnNext(260, 4),
- OnNext(310, 5),
- OnNext(340, 6),
- OnNext(410, 7),
- OnNext(420, 8),
- OnNext(470, 9),
- OnNext(550, 10),
- OnError<int>(590, new Exception())
- );
-
- var res = scheduler.Start(() =>
- xs.Window(() => Observable.Throw<int>(ex, scheduler)).Select((w, i) => w.Select(x => i.ToString() + " " + x.ToString())).Merge()
- );
-
- res.Messages.AssertEqual(
- OnError<string>(201, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 201)
- );
- }
-
- [TestMethod]
- public void Window_Closings_Default()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(90, 1),
- OnNext(180, 2),
- OnNext(250, 3),
- OnNext(260, 4),
- OnNext(310, 5),
- OnNext(340, 6),
- OnNext(410, 7),
- OnNext(420, 8),
- OnNext(470, 9),
- OnNext(550, 10),
- OnCompleted<int>(590)
- );
-
- var window = 1;
-
- var res = scheduler.Start(() =>
- xs.Window(() => Observable.Timer(TimeSpan.FromTicks((window++) * 100), scheduler)).Select((w, i) => w.Select(x => i.ToString() + " " + x.ToString())).Merge()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, "0 3"),
- OnNext(260, "0 4"),
- OnNext(310, "1 5"),
- OnNext(340, "1 6"),
- OnNext(410, "1 7"),
- OnNext(420, "1 8"),
- OnNext(470, "1 9"),
- OnNext(550, "2 10"),
- OnCompleted<string>(590)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 590)
- );
- }
-
- [TestMethod]
- public void Window_OpeningClosings_Basic()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(90, 1),
- OnNext(180, 2),
- OnNext(250, 3),
- OnNext(260, 4),
- OnNext(310, 5),
- OnNext(340, 6),
- OnNext(410, 7),
- OnNext(420, 8),
- OnNext(470, 9),
- OnNext(550, 10),
- OnCompleted<int>(590)
- );
-
- var ys = scheduler.CreateHotObservable(
- OnNext(255, 50),
- OnNext(330, 100),
- OnNext(350, 50),
- OnNext(400, 90),
- OnCompleted<int>(900)
- );
-
- var res = scheduler.Start(() =>
- xs.Window(ys, x => Observable.Timer(TimeSpan.FromTicks(x), scheduler)).Select((w, i) => w.Select(x => i.ToString() + " " + x.ToString())).Merge()
- );
-
- res.Messages.AssertEqual(
- OnNext(260, "0 4"),
- OnNext(340, "1 6"),
- OnNext(410, "1 7"),
- OnNext(410, "3 7"),
- OnNext(420, "1 8"),
- OnNext(420, "3 8"),
- OnNext(470, "3 9"),
- OnCompleted<string>(900)
- );
-
-#if !NO_PERF // BREAKING CHANGE v2 > v1.x -> More aggressive disposal behavior
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 590)
- );
-#else
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 900)
- );
-#endif
-
- ys.Subscriptions.AssertEqual(
- Subscribe(200, 900)
- );
- }
-
- [TestMethod]
- public void Window_OpeningClosings_Throw()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(90, 1),
- OnNext(180, 2),
- OnNext(250, 3),
- OnNext(260, 4),
- OnNext(310, 5),
- OnNext(340, 6),
- OnNext(410, 7),
- OnNext(420, 8),
- OnNext(470, 9),
- OnNext(550, 10),
- OnCompleted<int>(590)
- );
-
- var ys = scheduler.CreateHotObservable(
- OnNext(255, 50),
- OnNext(330, 100),
- OnNext(350, 50),
- OnNext(400, 90),
- OnCompleted<int>(900)
- );
-
- var ex = new Exception();
-
- var res = scheduler.Start(() =>
- xs.Window<int, int, int>(ys, x => { throw ex; }).Select((w, i) => w.Select(x => i.ToString() + " " + x.ToString())).Merge()
- );
-
- res.Messages.AssertEqual(
- OnError<string>(255, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 255)
- );
-
- ys.Subscriptions.AssertEqual(
- Subscribe(200, 255)
- );
- }
-
- [TestMethod]
- public void Window_OpeningClosings_Dispose()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(90, 1),
- OnNext(180, 2),
- OnNext(250, 3),
- OnNext(260, 4),
- OnNext(310, 5),
- OnNext(340, 6),
- OnNext(410, 7),
- OnNext(420, 8),
- OnNext(470, 9),
- OnNext(550, 10),
- OnCompleted<int>(590)
- );
-
- var ys = scheduler.CreateHotObservable(
- OnNext(255, 50),
- OnNext(330, 100),
- OnNext(350, 50),
- OnNext(400, 90),
- OnCompleted<int>(900)
- );
-
- var res = scheduler.Start(() =>
- xs.Window(ys, x => Observable.Timer(TimeSpan.FromTicks(x), scheduler)).Select((w, i) => w.Select(x => i.ToString() + " " + x.ToString())).Merge(),
- 415
- );
-
- res.Messages.AssertEqual(
- OnNext(260, "0 4"),
- OnNext(340, "1 6"),
- OnNext(410, "1 7"),
- OnNext(410, "3 7")
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 415)
- );
-
- ys.Subscriptions.AssertEqual(
- Subscribe(200, 415)
- );
- }
-
- [TestMethod]
- public void Window_OpeningClosings_Data_Error()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(90, 1),
- OnNext(180, 2),
- OnNext(250, 3),
- OnNext(260, 4),
- OnNext(310, 5),
- OnNext(340, 6),
- OnNext(410, 7),
- OnError<int>(415, ex)
- );
-
- var ys = scheduler.CreateHotObservable(
- OnNext(255, 50),
- OnNext(330, 100),
- OnNext(350, 50),
- OnNext(400, 90),
- OnCompleted<int>(900)
- );
-
- var res = scheduler.Start(() =>
- xs.Window(ys, x => Observable.Timer(TimeSpan.FromTicks(x), scheduler)).Select((w, i) => w.Select(x => i.ToString() + " " + x.ToString())).Merge()
- );
-
- res.Messages.AssertEqual(
- OnNext(260, "0 4"),
- OnNext(340, "1 6"),
- OnNext(410, "1 7"),
- OnNext(410, "3 7"),
- OnError<string>(415, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 415)
- );
-
- ys.Subscriptions.AssertEqual(
- Subscribe(200, 415)
- );
- }
-
- [TestMethod]
- public void Window_OpeningClosings_Window_Error()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(90, 1),
- OnNext(180, 2),
- OnNext(250, 3),
- OnNext(260, 4),
- OnNext(310, 5),
- OnNext(340, 6),
- OnNext(410, 7),
- OnNext(420, 8),
- OnNext(470, 9),
- OnNext(550, 10),
- OnCompleted<int>(590)
- );
-
- var ys = scheduler.CreateHotObservable(
- OnNext(255, 50),
- OnNext(330, 100),
- OnNext(350, 50),
- OnNext(400, 90),
- OnError<int>(415, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.Window(ys, x => Observable.Timer(TimeSpan.FromTicks(x), scheduler)).Select((w, i) => w.Select(x => i.ToString() + " " + x.ToString())).Merge()
- );
-
- res.Messages.AssertEqual(
- OnNext(260, "0 4"),
- OnNext(340, "1 6"),
- OnNext(410, "1 7"),
- OnNext(410, "3 7"),
- OnError<string>(415, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 415)
- );
-
- ys.Subscriptions.AssertEqual(
- Subscribe(200, 415)
- );
- }
-
- [TestMethod]
- public void Window_Boundaries_Simple()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(90, 1),
- OnNext(180, 2),
- OnNext(250, 3),
- OnNext(260, 4),
- OnNext(310, 5),
- OnNext(340, 6),
- OnNext(410, 7),
- OnNext(420, 8),
- OnNext(470, 9),
- OnNext(550, 10),
- OnCompleted<int>(590)
- );
-
- var ys = scheduler.CreateHotObservable(
- OnNext(255, true),
- OnNext(330, true),
- OnNext(350, true),
- OnNext(400, true),
- OnNext(500, true),
- OnCompleted<bool>(900)
- );
-
- var res = scheduler.Start(() =>
- xs.Window(ys).Select((w, i) => w.Select(x => i.ToString() + " " + x.ToString())).Merge()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, "0 3"),
- OnNext(260, "1 4"),
- OnNext(310, "1 5"),
- OnNext(340, "2 6"),
- OnNext(410, "4 7"),
- OnNext(420, "4 8"),
- OnNext(470, "4 9"),
- OnNext(550, "5 10"),
- OnCompleted<string>(590)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 590)
- );
-
- ys.Subscriptions.AssertEqual(
- Subscribe(200, 590)
- );
- }
-
- [TestMethod]
- public void Window_Boundaries_OnCompletedBoundaries()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(90, 1),
- OnNext(180, 2),
- OnNext(250, 3),
- OnNext(260, 4),
- OnNext(310, 5),
- OnNext(340, 6),
- OnNext(410, 7),
- OnNext(420, 8),
- OnNext(470, 9),
- OnNext(550, 10),
- OnCompleted<int>(590)
- );
-
- var ys = scheduler.CreateHotObservable(
- OnNext(255, true),
- OnNext(330, true),
- OnNext(350, true),
- OnCompleted<bool>(400)
- );
-
- var res = scheduler.Start(() =>
- xs.Window(ys).Select((w, i) => w.Select(x => i.ToString() + " " + x.ToString())).Merge()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, "0 3"),
- OnNext(260, "1 4"),
- OnNext(310, "1 5"),
- OnNext(340, "2 6"),
- OnCompleted<string>(400)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 400)
- );
-
- ys.Subscriptions.AssertEqual(
- Subscribe(200, 400)
- );
- }
-
- [TestMethod]
- public void Window_Boundaries_OnErrorSource()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(90, 1),
- OnNext(180, 2),
- OnNext(250, 3),
- OnNext(260, 4),
- OnNext(310, 5),
- OnNext(340, 6),
- OnNext(380, 7),
- OnError<int>(400, ex)
- );
-
- var ys = scheduler.CreateHotObservable(
- OnNext(255, true),
- OnNext(330, true),
- OnNext(350, true),
- OnCompleted<bool>(500)
- );
-
- var res = scheduler.Start(() =>
- xs.Window(ys).Select((w, i) => w.Select(x => i.ToString() + " " + x.ToString())).Merge()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, "0 3"),
- OnNext(260, "1 4"),
- OnNext(310, "1 5"),
- OnNext(340, "2 6"),
- OnNext(380, "3 7"),
- OnError<string>(400, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 400)
- );
-
- ys.Subscriptions.AssertEqual(
- Subscribe(200, 400)
- );
- }
-
- [TestMethod]
- public void Window_Boundaries_OnErrorBoundaries()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(90, 1),
- OnNext(180, 2),
- OnNext(250, 3),
- OnNext(260, 4),
- OnNext(310, 5),
- OnNext(340, 6),
- OnNext(410, 7),
- OnNext(420, 8),
- OnNext(470, 9),
- OnNext(550, 10),
- OnCompleted<int>(590)
- );
-
- var ys = scheduler.CreateHotObservable(
- OnNext(255, true),
- OnNext(330, true),
- OnNext(350, true),
- OnError<bool>(400, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.Window(ys).Select((w, i) => w.Select(x => i.ToString() + " " + x.ToString())).Merge()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, "0 3"),
- OnNext(260, "1 4"),
- OnNext(310, "1 5"),
- OnNext(340, "2 6"),
- OnError<string>(400, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 400)
- );
-
- ys.Subscriptions.AssertEqual(
- Subscribe(200, 400)
- );
- }
-
- #endregion
-
- #region + Zip +
-
- #region ArgumentChecking
-
- [TestMethod]
- public void Zip_ArgumentChecking()
- {
- var someObservable = DummyObservable<int>.Instance;
- var someEnumerable = DummyEnumerable<int>.Instance;
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip<int, int, int>(someObservable, someObservable, null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip<int, int, int>(null, someObservable, (_, __) => 0));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip<int, int, int>(someObservable, default(IObservable<int>), (_, __) => 0));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip<int, int, int>(someObservable, someEnumerable, null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip<int, int, int>(null, someEnumerable, (_, __) => 0));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip<int, int, int>(someObservable, default(IEnumerable<int>), (_, __) => 0));
- }
-
- [TestMethod]
- public void Zip_ArgumentCheckingHighArity()
- {
- var xs = DummyObservable<int>.Instance;
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(default(IObservable<int>), xs, (_0, _1) => _0 + _1));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, default(IObservable<int>), (_0, _1) => _0 + _1));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, default(Func<int, int, int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(default(IObservable<int>), xs, xs, (_0, _1, _2) => _0 + _1 + _2));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, default(IObservable<int>), xs, (_0, _1, _2) => _0 + _1 + _2));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, default(IObservable<int>), (_0, _1, _2) => _0 + _1 + _2));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, xs, default(Func<int, int, int, int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(default(IObservable<int>), xs, xs, xs, (_0, _1, _2, _3) => _0 + _1 + _2 + _3));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, default(IObservable<int>), xs, xs, (_0, _1, _2, _3) => _0 + _1 + _2 + _3));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, default(IObservable<int>), xs, (_0, _1, _2, _3) => _0 + _1 + _2 + _3));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, xs, default(IObservable<int>), (_0, _1, _2, _3) => _0 + _1 + _2 + _3));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, xs, xs, default(Func<int, int, int, int, int>)));
-#if !NO_LARGEARITY
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(default(IObservable<int>), xs, xs, xs, xs, (_0, _1, _2, _3, _4) => _0 + _1 + _2 + _3 + _4));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, default(IObservable<int>), xs, xs, xs, (_0, _1, _2, _3, _4) => _0 + _1 + _2 + _3 + _4));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, default(IObservable<int>), xs, xs, (_0, _1, _2, _3, _4) => _0 + _1 + _2 + _3 + _4));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, xs, default(IObservable<int>), xs, (_0, _1, _2, _3, _4) => _0 + _1 + _2 + _3 + _4));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, xs, xs, default(IObservable<int>), (_0, _1, _2, _3, _4) => _0 + _1 + _2 + _3 + _4));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, xs, xs, xs, default(Func<int, int, int, int, int, int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(default(IObservable<int>), xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5) => _0 + _1 + _2 + _3 + _4 + _5));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, default(IObservable<int>), xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5) => _0 + _1 + _2 + _3 + _4 + _5));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, default(IObservable<int>), xs, xs, xs, (_0, _1, _2, _3, _4, _5) => _0 + _1 + _2 + _3 + _4 + _5));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, xs, default(IObservable<int>), xs, xs, (_0, _1, _2, _3, _4, _5) => _0 + _1 + _2 + _3 + _4 + _5));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, xs, xs, default(IObservable<int>), xs, (_0, _1, _2, _3, _4, _5) => _0 + _1 + _2 + _3 + _4 + _5));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, xs, xs, xs, default(IObservable<int>), (_0, _1, _2, _3, _4, _5) => _0 + _1 + _2 + _3 + _4 + _5));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, xs, xs, xs, xs, default(Func<int, int, int, int, int, int, int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(default(IObservable<int>), xs, xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6) => _0 + _1 + _2 + _3 + _4 + _5 + _6));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, default(IObservable<int>), xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6) => _0 + _1 + _2 + _3 + _4 + _5 + _6));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, default(IObservable<int>), xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6) => _0 + _1 + _2 + _3 + _4 + _5 + _6));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, xs, default(IObservable<int>), xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6) => _0 + _1 + _2 + _3 + _4 + _5 + _6));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, xs, xs, default(IObservable<int>), xs, xs, (_0, _1, _2, _3, _4, _5, _6) => _0 + _1 + _2 + _3 + _4 + _5 + _6));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, xs, xs, xs, default(IObservable<int>), xs, (_0, _1, _2, _3, _4, _5, _6) => _0 + _1 + _2 + _3 + _4 + _5 + _6));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, xs, xs, xs, xs, default(IObservable<int>), (_0, _1, _2, _3, _4, _5, _6) => _0 + _1 + _2 + _3 + _4 + _5 + _6));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, xs, xs, xs, xs, xs, default(Func<int, int, int, int, int, int, int, int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(default(IObservable<int>), xs, xs, xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, default(IObservable<int>), xs, xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, default(IObservable<int>), xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, xs, default(IObservable<int>), xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, xs, xs, default(IObservable<int>), xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, xs, xs, xs, default(IObservable<int>), xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, xs, xs, xs, xs, default(IObservable<int>), xs, (_0, _1, _2, _3, _4, _5, _6, _7) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, xs, xs, xs, xs, xs, default(IObservable<int>), (_0, _1, _2, _3, _4, _5, _6, _7) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, xs, xs, xs, xs, xs, xs, default(Func<int, int, int, int, int, int, int, int, int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(default(IObservable<int>), xs, xs, xs, xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, default(IObservable<int>), xs, xs, xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, default(IObservable<int>), xs, xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, xs, default(IObservable<int>), xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, xs, xs, default(IObservable<int>), xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, xs, xs, xs, default(IObservable<int>), xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, xs, xs, xs, xs, default(IObservable<int>), xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, xs, xs, xs, xs, xs, default(IObservable<int>), xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, xs, xs, xs, xs, xs, xs, default(IObservable<int>), (_0, _1, _2, _3, _4, _5, _6, _7, _8) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, xs, xs, xs, xs, xs, xs, xs, default(Func<int, int, int, int, int, int, int, int, int, int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(default(IObservable<int>), xs, xs, xs, xs, xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, default(IObservable<int>), xs, xs, xs, xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, default(IObservable<int>), xs, xs, xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, xs, default(IObservable<int>), xs, xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, xs, xs, default(IObservable<int>), xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, xs, xs, xs, default(IObservable<int>), xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, xs, xs, xs, xs, default(IObservable<int>), xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, xs, xs, xs, xs, xs, default(IObservable<int>), xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, xs, xs, xs, xs, xs, xs, default(IObservable<int>), xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, xs, xs, xs, xs, xs, xs, xs, default(IObservable<int>), (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, default(Func<int, int, int, int, int, int, int, int, int, int, int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(default(IObservable<int>), xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, default(IObservable<int>), xs, xs, xs, xs, xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, default(IObservable<int>), xs, xs, xs, xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, xs, default(IObservable<int>), xs, xs, xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, xs, xs, default(IObservable<int>), xs, xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, xs, xs, xs, default(IObservable<int>), xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, xs, xs, xs, xs, default(IObservable<int>), xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, xs, xs, xs, xs, xs, default(IObservable<int>), xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, xs, xs, xs, xs, xs, xs, default(IObservable<int>), xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, xs, xs, xs, xs, xs, xs, xs, default(IObservable<int>), xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, default(IObservable<int>), (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, default(Func<int, int, int, int, int, int, int, int, int, int, int, int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(default(IObservable<int>), xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, default(IObservable<int>), xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, default(IObservable<int>), xs, xs, xs, xs, xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, xs, default(IObservable<int>), xs, xs, xs, xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, xs, xs, default(IObservable<int>), xs, xs, xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, xs, xs, xs, default(IObservable<int>), xs, xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, xs, xs, xs, xs, default(IObservable<int>), xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, xs, xs, xs, xs, xs, default(IObservable<int>), xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, xs, xs, xs, xs, xs, xs, default(IObservable<int>), xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, xs, xs, xs, xs, xs, xs, xs, default(IObservable<int>), xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, default(IObservable<int>), xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, default(IObservable<int>), (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, default(Func<int, int, int, int, int, int, int, int, int, int, int, int, int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(default(IObservable<int>), xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, default(IObservable<int>), xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, default(IObservable<int>), xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, xs, default(IObservable<int>), xs, xs, xs, xs, xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, xs, xs, default(IObservable<int>), xs, xs, xs, xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, xs, xs, xs, default(IObservable<int>), xs, xs, xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, xs, xs, xs, xs, default(IObservable<int>), xs, xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, xs, xs, xs, xs, xs, default(IObservable<int>), xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, xs, xs, xs, xs, xs, xs, default(IObservable<int>), xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, xs, xs, xs, xs, xs, xs, xs, default(IObservable<int>), xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, default(IObservable<int>), xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, default(IObservable<int>), xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, default(IObservable<int>), (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, default(Func<int, int, int, int, int, int, int, int, int, int, int, int, int, int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(default(IObservable<int>), xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12 + _13));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, default(IObservable<int>), xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12 + _13));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, default(IObservable<int>), xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12 + _13));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, xs, default(IObservable<int>), xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12 + _13));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, xs, xs, default(IObservable<int>), xs, xs, xs, xs, xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12 + _13));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, xs, xs, xs, default(IObservable<int>), xs, xs, xs, xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12 + _13));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, xs, xs, xs, xs, default(IObservable<int>), xs, xs, xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12 + _13));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, xs, xs, xs, xs, xs, default(IObservable<int>), xs, xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12 + _13));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, xs, xs, xs, xs, xs, xs, default(IObservable<int>), xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12 + _13));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, xs, xs, xs, xs, xs, xs, xs, default(IObservable<int>), xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12 + _13));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, default(IObservable<int>), xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12 + _13));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, default(IObservable<int>), xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12 + _13));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, default(IObservable<int>), xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12 + _13));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, default(IObservable<int>), (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12 + _13));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, default(Func<int, int, int, int, int, int, int, int, int, int, int, int, int, int, int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(default(IObservable<int>), xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12 + _13 + _14));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, default(IObservable<int>), xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12 + _13 + _14));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, default(IObservable<int>), xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12 + _13 + _14));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, xs, default(IObservable<int>), xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12 + _13 + _14));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, xs, xs, default(IObservable<int>), xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12 + _13 + _14));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, xs, xs, xs, default(IObservable<int>), xs, xs, xs, xs, xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12 + _13 + _14));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, xs, xs, xs, xs, default(IObservable<int>), xs, xs, xs, xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12 + _13 + _14));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, xs, xs, xs, xs, xs, default(IObservable<int>), xs, xs, xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12 + _13 + _14));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, xs, xs, xs, xs, xs, xs, default(IObservable<int>), xs, xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12 + _13 + _14));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, xs, xs, xs, xs, xs, xs, xs, default(IObservable<int>), xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12 + _13 + _14));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, default(IObservable<int>), xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12 + _13 + _14));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, default(IObservable<int>), xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12 + _13 + _14));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, default(IObservable<int>), xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12 + _13 + _14));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, default(IObservable<int>), xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12 + _13 + _14));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, default(IObservable<int>), (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12 + _13 + _14));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, default(Func<int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(default(IObservable<int>), xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12 + _13 + _14 + _15));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, default(IObservable<int>), xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12 + _13 + _14 + _15));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, default(IObservable<int>), xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12 + _13 + _14 + _15));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, xs, default(IObservable<int>), xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12 + _13 + _14 + _15));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, xs, xs, default(IObservable<int>), xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12 + _13 + _14 + _15));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, xs, xs, xs, default(IObservable<int>), xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12 + _13 + _14 + _15));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, xs, xs, xs, xs, default(IObservable<int>), xs, xs, xs, xs, xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12 + _13 + _14 + _15));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, xs, xs, xs, xs, xs, default(IObservable<int>), xs, xs, xs, xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12 + _13 + _14 + _15));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, xs, xs, xs, xs, xs, xs, default(IObservable<int>), xs, xs, xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12 + _13 + _14 + _15));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, xs, xs, xs, xs, xs, xs, xs, default(IObservable<int>), xs, xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12 + _13 + _14 + _15));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, default(IObservable<int>), xs, xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12 + _13 + _14 + _15));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, default(IObservable<int>), xs, xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12 + _13 + _14 + _15));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, default(IObservable<int>), xs, xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12 + _13 + _14 + _15));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, default(IObservable<int>), xs, xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12 + _13 + _14 + _15));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, default(IObservable<int>), xs, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12 + _13 + _14 + _15));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, default(IObservable<int>), (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12 + _13 + _14 + _15));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, xs, default(Func<int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int>)));
-#endif
- }
-
- #endregion
-
- #region Never/Never
-
- [TestMethod]
- public void Zip_Never2()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
-
- var res = scheduler.Start(() =>
- Observable.Zip(e0, e1, (_0, _1) => 42)
- );
-
- res.Messages.AssertEqual(
- );
-
- foreach (var e in new[] { e0, e1 })
- e.Subscriptions.AssertEqual(Subscribe(200, 1000));
- }
-
- [TestMethod]
- public void Zip_Never3()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
-
- var res = scheduler.Start(() =>
- Observable.Zip(e0, e1, e2, (_0, _1, _2) => 42)
- );
-
- res.Messages.AssertEqual(
- );
-
- foreach (var e in new[] { e0, e1, e2 })
- e.Subscriptions.AssertEqual(Subscribe(200, 1000));
- }
-
- [TestMethod]
- public void Zip_Never4()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
-
- var res = scheduler.Start(() =>
- Observable.Zip(e0, e1, e2, e3, (_0, _1, _2, _3) => 42)
- );
-
- res.Messages.AssertEqual(
- );
-
- foreach (var e in new[] { e0, e1, e2, e3 })
- e.Subscriptions.AssertEqual(Subscribe(200, 1000));
- }
-
-#if !NO_LARGEARITY
- [TestMethod]
- public void Zip_Never5()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
-
- var res = scheduler.Start(() =>
- Observable.Zip(e0, e1, e2, e3, e4, (_0, _1, _2, _3, _4) => 42)
- );
-
- res.Messages.AssertEqual(
- );
-
- foreach (var e in new[] { e0, e1, e2, e3, e4 })
- e.Subscriptions.AssertEqual(Subscribe(200, 1000));
- }
-
- [TestMethod]
- public void Zip_Never6()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e5 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
-
- var res = scheduler.Start(() =>
- Observable.Zip(e0, e1, e2, e3, e4, e5, (_0, _1, _2, _3, _4, _5) => 42)
- );
-
- res.Messages.AssertEqual(
- );
-
- foreach (var e in new[] { e0, e1, e2, e3, e4, e5 })
- e.Subscriptions.AssertEqual(Subscribe(200, 1000));
- }
-
- [TestMethod]
- public void Zip_Never7()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e5 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e6 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
-
- var res = scheduler.Start(() =>
- Observable.Zip(e0, e1, e2, e3, e4, e5, e6, (_0, _1, _2, _3, _4, _5, _6) => 42)
- );
-
- res.Messages.AssertEqual(
- );
-
- foreach (var e in new[] { e0, e1, e2, e3, e4, e5, e6 })
- e.Subscriptions.AssertEqual(Subscribe(200, 1000));
- }
-
- [TestMethod]
- public void Zip_Never8()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e5 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e6 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e7 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
-
- var res = scheduler.Start(() =>
- Observable.Zip(e0, e1, e2, e3, e4, e5, e6, e7, (_0, _1, _2, _3, _4, _5, _6, _7) => 42)
- );
-
- res.Messages.AssertEqual(
- );
-
- foreach (var e in new[] { e0, e1, e2, e3, e4, e5, e6, e7 })
- e.Subscriptions.AssertEqual(Subscribe(200, 1000));
- }
-
- [TestMethod]
- public void Zip_Never9()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e5 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e6 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e7 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e8 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
-
- var res = scheduler.Start(() =>
- Observable.Zip(e0, e1, e2, e3, e4, e5, e6, e7, e8, (_0, _1, _2, _3, _4, _5, _6, _7, _8) => 42)
- );
-
- res.Messages.AssertEqual(
- );
-
- foreach (var e in new[] { e0, e1, e2, e3, e4, e5, e6, e7, e8 })
- e.Subscriptions.AssertEqual(Subscribe(200, 1000));
- }
-
- [TestMethod]
- public void Zip_Never10()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e5 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e6 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e7 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e8 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e9 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
-
- var res = scheduler.Start(() =>
- Observable.Zip(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9) => 42)
- );
-
- res.Messages.AssertEqual(
- );
-
- foreach (var e in new[] { e0, e1, e2, e3, e4, e5, e6, e7, e8, e9 })
- e.Subscriptions.AssertEqual(Subscribe(200, 1000));
- }
-
- [TestMethod]
- public void Zip_Never11()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e5 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e6 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e7 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e8 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e9 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e10 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
-
- var res = scheduler.Start(() =>
- Observable.Zip(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10) => 42)
- );
-
- res.Messages.AssertEqual(
- );
-
- foreach (var e in new[] { e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10 })
- e.Subscriptions.AssertEqual(Subscribe(200, 1000));
- }
-
- [TestMethod]
- public void Zip_Never12()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e5 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e6 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e7 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e8 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e9 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e10 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e11 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
-
- var res = scheduler.Start(() =>
- Observable.Zip(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11) => 42)
- );
-
- res.Messages.AssertEqual(
- );
-
- foreach (var e in new[] { e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11 })
- e.Subscriptions.AssertEqual(Subscribe(200, 1000));
- }
-
- [TestMethod]
- public void Zip_Never13()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e5 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e6 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e7 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e8 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e9 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e10 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e11 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e12 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
-
- var res = scheduler.Start(() =>
- Observable.Zip(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12) => 42)
- );
-
- res.Messages.AssertEqual(
- );
-
- foreach (var e in new[] { e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12 })
- e.Subscriptions.AssertEqual(Subscribe(200, 1000));
- }
-
- [TestMethod]
- public void Zip_Never14()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e5 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e6 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e7 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e8 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e9 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e10 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e11 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e12 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e13 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
-
- var res = scheduler.Start(
- () => Observable.Zip(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13) => 42)
- );
-
- res.Messages.AssertEqual(
- );
-
- foreach (var e in new[] { e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13 })
- e.Subscriptions.AssertEqual(Subscribe(200, 1000));
- }
-
- [TestMethod]
- public void Zip_Never15()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e5 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e6 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e7 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e8 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e9 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e10 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e11 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e12 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e13 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e14 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
-
- var res = scheduler.Start(() =>
- Observable.Zip(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14) => 42)
- );
-
- res.Messages.AssertEqual(
- );
-
- foreach (var e in new[] { e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14 })
- e.Subscriptions.AssertEqual(Subscribe(200, 1000));
- }
-
- [TestMethod]
- public void Zip_Never16()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e5 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e6 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e7 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e8 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e9 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e10 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e11 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e12 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e13 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e14 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
- var e15 = scheduler.CreateHotObservable(new[] { OnNext(150, 1) });
-
- var res = scheduler.Start(() =>
- Observable.Zip(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15) => 42)
- );
-
- res.Messages.AssertEqual(
- );
-
- foreach (var e in new[] { e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15 })
- e.Subscriptions.AssertEqual(Subscribe(200, 1000));
- }
-#endif
-
- #endregion
-
- #region Never/Empty
-
- [TestMethod]
- public void Zip_NeverEmpty()
- {
- var scheduler = new TestScheduler();
-
- var n = scheduler.CreateHotObservable(
- OnNext(150, 1)
- );
-
- var e = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnCompleted<int>(210)
- );
-
- var res = scheduler.Start(() =>
- n.Zip(e, (x, y) => x + y)
- );
-
- res.Messages.AssertEqual(
- );
-
- n.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
-
- e.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void Zip_EmptyNever()
- {
- var scheduler = new TestScheduler();
-
- var n = scheduler.CreateHotObservable(
- OnNext(150, 1)
- );
-
- var e = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnCompleted<int>(210)
- );
-
- var res = scheduler.Start(() =>
- e.Zip(n, (x, y) => x + y)
- );
-
- res.Messages.AssertEqual(
- );
-
- n.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
-
- e.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- #endregion
-
- #region Empty/Empty
-
- [TestMethod]
- public void Zip_EmptyEmpty()
- {
- var scheduler = new TestScheduler();
-
- var e1 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnCompleted<int>(210)
- );
-
- var e2 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnCompleted<int>(210)
- );
-
- var res = scheduler.Start(() =>
- e1.Zip(e2, (x, y) => x + y)
- );
-
- res.Messages.AssertEqual(
- OnCompleted<int>(210)
- );
-
- e1.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
-
- e2.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void Zip_Empty2()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(210) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(220) });
-
- var res = scheduler.Start(() =>
- Observable.Zip(e0, e1, (_0, _1) => 42)
- );
-
- res.Messages.AssertEqual(
- OnCompleted<int>(220)
- );
-
- var i = 0;
- foreach (var e in new[] { e0, e1 })
- e.Subscriptions.AssertEqual(Subscribe(200, 200 + (++i * 10)));
- }
-
- [TestMethod]
- public void Zip_Empty3()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(210) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(220) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(230) });
-
- var res = scheduler.Start(() =>
- Observable.Zip(e0, e1, e2, (_0, _1, _2) => 42)
- );
-
- res.Messages.AssertEqual(
- OnCompleted<int>(230)
- );
-
- var i = 0;
- foreach (var e in new[] { e0, e1, e2 })
- e.Subscriptions.AssertEqual(Subscribe(200, 200 + (++i * 10)));
- }
-
- [TestMethod]
- public void Zip_Empty4()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(210) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(220) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(230) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(240) });
-
- var res = scheduler.Start(() =>
- Observable.Zip(e0, e1, e2, e3, (_0, _1, _2, _3) => 42)
- );
-
- res.Messages.AssertEqual(
- OnCompleted<int>(240)
- );
-
- var i = 0;
- foreach (var e in new[] { e0, e1, e2, e3 })
- e.Subscriptions.AssertEqual(Subscribe(200, 200 + (++i * 10)));
- }
-
-#if !NO_LARGEARITY
- [TestMethod]
- public void Zip_Empty5()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(210) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(220) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(230) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(240) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(250) });
-
- var res = scheduler.Start(() =>
- Observable.Zip(e0, e1, e2, e3, e4, (_0, _1, _2, _3, _4) => 42)
- );
-
- res.Messages.AssertEqual(
- OnCompleted<int>(250)
- );
-
- var i = 0;
- foreach (var e in new[] { e0, e1, e2, e3, e4 })
- e.Subscriptions.AssertEqual(Subscribe(200, 200 + (++i * 10)));
- }
-
- [TestMethod]
- public void Zip_Empty6()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(210) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(220) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(230) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(240) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(250) });
- var e5 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(260) });
-
- var res = scheduler.Start(() =>
- Observable.Zip(e0, e1, e2, e3, e4, e5, (_0, _1, _2, _3, _4, _5) => 42)
- );
-
- res.Messages.AssertEqual(
- OnCompleted<int>(260)
- );
-
- var i = 0;
- foreach (var e in new[] { e0, e1, e2, e3, e4, e5 })
- e.Subscriptions.AssertEqual(Subscribe(200, 200 + (++i * 10)));
- }
-
- [TestMethod]
- public void Zip_Empty7()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(210) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(220) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(230) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(240) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(250) });
- var e5 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(260) });
- var e6 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(270) });
-
- var res = scheduler.Start(() =>
- Observable.Zip(e0, e1, e2, e3, e4, e5, e6, (_0, _1, _2, _3, _4, _5, _6) => 42)
- );
-
- res.Messages.AssertEqual(
- OnCompleted<int>(270)
- );
-
- var i = 0;
- foreach (var e in new[] { e0, e1, e2, e3, e4, e5, e6 })
- e.Subscriptions.AssertEqual(Subscribe(200, 200 + (++i * 10)));
- }
-
- [TestMethod]
- public void Zip_Empty8()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(210) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(220) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(230) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(240) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(250) });
- var e5 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(260) });
- var e6 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(270) });
- var e7 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(280) });
-
- var res = scheduler.Start(() =>
- Observable.Zip(e0, e1, e2, e3, e4, e5, e6, e7, (_0, _1, _2, _3, _4, _5, _6, _7) => 42)
- );
-
- res.Messages.AssertEqual(
- OnCompleted<int>(280)
- );
-
- var i = 0;
- foreach (var e in new[] { e0, e1, e2, e3, e4, e5, e6, e7 })
- e.Subscriptions.AssertEqual(Subscribe(200, 200 + (++i * 10)));
- }
-
- [TestMethod]
- public void Zip_Empty9()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(210) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(220) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(230) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(240) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(250) });
- var e5 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(260) });
- var e6 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(270) });
- var e7 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(280) });
- var e8 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(290) });
-
- var res = scheduler.Start(() =>
- Observable.Zip(e0, e1, e2, e3, e4, e5, e6, e7, e8, (_0, _1, _2, _3, _4, _5, _6, _7, _8) => 42)
- );
-
- res.Messages.AssertEqual(
- OnCompleted<int>(290)
- );
-
- var i = 0;
- foreach (var e in new[] { e0, e1, e2, e3, e4, e5, e6, e7, e8 })
- e.Subscriptions.AssertEqual(Subscribe(200, 200 + (++i * 10)));
- }
-
- [TestMethod]
- public void Zip_Empty10()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(210) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(220) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(230) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(240) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(250) });
- var e5 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(260) });
- var e6 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(270) });
- var e7 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(280) });
- var e8 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(290) });
- var e9 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(300) });
-
- var res = scheduler.Start(() =>
- Observable.Zip(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9) => 42)
- );
-
- res.Messages.AssertEqual(
- OnCompleted<int>(300)
- );
-
- var i = 0;
- foreach (var e in new[] { e0, e1, e2, e3, e4, e5, e6, e7, e8, e9 })
- e.Subscriptions.AssertEqual(Subscribe(200, 200 + (++i * 10)));
- }
-
- [TestMethod]
- public void Zip_Empty11()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(210) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(220) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(230) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(240) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(250) });
- var e5 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(260) });
- var e6 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(270) });
- var e7 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(280) });
- var e8 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(290) });
- var e9 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(300) });
- var e10 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(310) });
-
- var res = scheduler.Start(() =>
- Observable.Zip(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10) => 42)
- );
-
- res.Messages.AssertEqual(
- OnCompleted<int>(310)
- );
-
- var i = 0;
- foreach (var e in new[] { e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10 })
- e.Subscriptions.AssertEqual(Subscribe(200, 200 + (++i * 10)));
- }
-
- [TestMethod]
- public void Zip_Empty12()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(210) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(220) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(230) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(240) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(250) });
- var e5 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(260) });
- var e6 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(270) });
- var e7 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(280) });
- var e8 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(290) });
- var e9 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(300) });
- var e10 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(310) });
- var e11 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(320) });
-
- var res = scheduler.Start(() =>
- Observable.Zip(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11) => 42)
- );
-
- res.Messages.AssertEqual(
- OnCompleted<int>(320)
- );
-
- var i = 0;
- foreach (var e in new[] { e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11 })
- e.Subscriptions.AssertEqual(Subscribe(200, 200 + (++i * 10)));
- }
-
- [TestMethod]
- public void Zip_Empty13()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(210) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(220) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(230) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(240) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(250) });
- var e5 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(260) });
- var e6 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(270) });
- var e7 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(280) });
- var e8 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(290) });
- var e9 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(300) });
- var e10 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(310) });
- var e11 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(320) });
- var e12 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(330) });
-
- var res = scheduler.Start(() =>
- Observable.Zip(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12) => 42)
- );
-
- res.Messages.AssertEqual(
- OnCompleted<int>(330)
- );
-
- var i = 0;
- foreach (var e in new[] { e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12 })
- e.Subscriptions.AssertEqual(Subscribe(200, 200 + (++i * 10)));
- }
-
- [TestMethod]
- public void Zip_Empty14()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(210) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(220) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(230) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(240) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(250) });
- var e5 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(260) });
- var e6 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(270) });
- var e7 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(280) });
- var e8 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(290) });
- var e9 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(300) });
- var e10 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(310) });
- var e11 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(320) });
- var e12 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(330) });
- var e13 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(340) });
-
- var res = scheduler.Start(() =>
- Observable.Zip(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13) => 42)
- );
-
- res.Messages.AssertEqual(
- OnCompleted<int>(340)
- );
-
- var i = 0;
- foreach (var e in new[] { e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13 })
- e.Subscriptions.AssertEqual(Subscribe(200, 200 + (++i * 10)));
- }
-
- [TestMethod]
- public void Zip_Empty15()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(210) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(220) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(230) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(240) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(250) });
- var e5 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(260) });
- var e6 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(270) });
- var e7 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(280) });
- var e8 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(290) });
- var e9 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(300) });
- var e10 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(310) });
- var e11 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(320) });
- var e12 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(330) });
- var e13 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(340) });
- var e14 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(350) });
-
- var res = scheduler.Start(() =>
- Observable.Zip(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14) => 42)
- );
-
- res.Messages.AssertEqual(
- OnCompleted<int>(350)
- );
-
- var i = 0;
- foreach (var e in new[] { e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14 })
- e.Subscriptions.AssertEqual(Subscribe(200, 200 + (++i * 10)));
- }
-
- [TestMethod]
- public void Zip_Empty16()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(210) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(220) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(230) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(240) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(250) });
- var e5 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(260) });
- var e6 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(270) });
- var e7 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(280) });
- var e8 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(290) });
- var e9 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(300) });
- var e10 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(310) });
- var e11 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(320) });
- var e12 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(330) });
- var e13 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(340) });
- var e14 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(350) });
- var e15 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnCompleted<int>(360) });
-
- var res = scheduler.Start(() =>
- Observable.Zip(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15) => 42)
- );
-
- res.Messages.AssertEqual(
- OnCompleted<int>(360)
- );
-
- var i = 0;
- foreach (var e in new[] { e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15 })
- e.Subscriptions.AssertEqual(Subscribe(200, 200 + (++i * 10)));
- }
-#endif
-
- #endregion
-
- #region Empty/Some
-
- [TestMethod]
- public void Zip_EmptyNonEmpty()
- {
- var scheduler = new TestScheduler();
-
- var e = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnCompleted<int>(210)
- );
-
- var o = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(215, 2), // Intended behavior - will only know here there was no error and we can complete gracefully
- OnCompleted<int>(220)
- );
-
- var res = scheduler.Start(() =>
- e.Zip(o, (x, y) => x + y)
- );
-
- res.Messages.AssertEqual(
- OnCompleted<int>(215)
- );
-
- e.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
-
- o.Subscriptions.AssertEqual(
- Subscribe(200, 215)
- );
- }
-
- [TestMethod]
- public void Zip_NonEmptyEmpty()
- {
- var scheduler = new TestScheduler();
-
- var e = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnCompleted<int>(210)
- );
-
- var o = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(215, 2),
- OnCompleted<int>(220)
- );
-
- var res = scheduler.Start(() =>
- o.Zip(e, (x, y) => x + y)
- );
-
- res.Messages.AssertEqual(
- OnCompleted<int>(215)
- );
-
- e.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
-
- o.Subscriptions.AssertEqual(
- Subscribe(200, 215)
- );
- }
-
- #endregion
-
- #region Never/Some
-
- [TestMethod]
- public void Zip_NeverNonEmpty()
- {
- var scheduler = new TestScheduler();
-
- var o = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(215, 2),
- OnCompleted<int>(220)
- );
-
- var n = scheduler.CreateHotObservable(
- OnNext(150, 1)
- );
-
- var res = scheduler.Start(() =>
- n.Zip(o, (x, y) => x + y)
- );
-
- res.Messages.AssertEqual(
- );
-
- o.Subscriptions.AssertEqual(
- Subscribe(200, 220)
- );
-
- n.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
- }
-
- [TestMethod]
- public void Zip_NonEmptyNever()
- {
- var scheduler = new TestScheduler();
-
- var o = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(215, 2),
- OnCompleted<int>(220)
- );
-
- var n = scheduler.CreateHotObservable(
- OnNext(150, 1)
- );
-
- var res = scheduler.Start(() =>
- o.Zip(n, (x, y) => x + y)
- );
-
- res.Messages.AssertEqual(
- );
-
- o.Subscriptions.AssertEqual(
- Subscribe(200, 220)
- );
-
- n.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
- }
-
- #endregion
-
- #region Some/Some
-
- [TestMethod]
- public void Zip_NonEmptyNonEmpty()
- {
- var scheduler = new TestScheduler();
-
- var o1 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(215, 2),
- OnCompleted<int>(230)
- );
-
- var o2 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(220, 3),
- OnCompleted<int>(240) // Intended behavior - will only know here there was no error and we can complete gracefully
- );
-
- var res = scheduler.Start(() =>
- o1.Zip(o2, (x, y) => x + y)
- );
-
- res.Messages.AssertEqual(
- OnNext(220, 2 + 3),
- OnCompleted<int>(240)
- );
-
- o1.Subscriptions.AssertEqual(
- Subscribe(200, 230)
- );
-
- o2.Subscriptions.AssertEqual(
- Subscribe(200, 240)
- );
- }
-
- #endregion
-
- #region Empty/Error
-
- [TestMethod]
- public void Zip_EmptyError()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var e = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnCompleted<int>(230)
- );
-
- var f = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnError<int>(220, ex)
- );
-
- var res = scheduler.Start(() =>
- e.Zip(f, (x, y) => x + y)
- );
-
- res.Messages.AssertEqual(
- OnError<int>(220, ex)
- );
-
- e.Subscriptions.AssertEqual(
- Subscribe(200, 220)
- );
-
- f.Subscriptions.AssertEqual(
- Subscribe(200, 220)
- );
- }
-
- [TestMethod]
- public void Zip_ErrorEmpty()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var e = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnCompleted<int>(230)
- );
-
- var f = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnError<int>(220, ex)
- );
-
- var res = scheduler.Start(() =>
- f.Zip(e, (x, y) => x + y)
- );
-
- res.Messages.AssertEqual(
- OnError<int>(220, ex)
- );
-
- e.Subscriptions.AssertEqual(
- Subscribe(200, 220)
- );
-
- f.Subscriptions.AssertEqual(
- Subscribe(200, 220)
- );
- }
-
- #endregion
-
- #region Never/Error
-
- [TestMethod]
- public void Zip_NeverError()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var n = scheduler.CreateHotObservable(
- OnNext(150, 1)
- );
-
- var f = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnError<int>(220, ex)
- );
-
- var res = scheduler.Start(() =>
- n.Zip(f, (x, y) => x + y)
- );
-
- res.Messages.AssertEqual(
- OnError<int>(220, ex)
- );
-
- n.Subscriptions.AssertEqual(
- Subscribe(200, 220)
- );
-
- f.Subscriptions.AssertEqual(
- Subscribe(200, 220)
- );
- }
-
- [TestMethod]
- public void Zip_ErrorNever()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var n = scheduler.CreateHotObservable(
- OnNext(150, 1)
- );
-
- var f = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnError<int>(220, ex)
- );
-
- var res = scheduler.Start(() =>
- f.Zip(n, (x, y) => x + y)
- );
-
- res.Messages.AssertEqual(
- OnError<int>(220, ex)
- );
-
- n.Subscriptions.AssertEqual(
- Subscribe(200, 220)
- );
-
- f.Subscriptions.AssertEqual(
- Subscribe(200, 220)
- );
- }
-
- #endregion
-
- #region Error/Error
-
- [TestMethod]
- public void Zip_ErrorError()
- {
- var scheduler = new TestScheduler();
-
- var ex1 = new Exception();
- var ex2 = new Exception();
-
- var f1 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnError<int>(230, ex1)
- );
-
- var f2 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnError<int>(220, ex2)
- );
-
- var res = scheduler.Start(() =>
- f1.Zip(f2, (x, y) => x + y)
- );
-
- res.Messages.AssertEqual(
- OnError<int>(220, ex2)
- );
-
- f1.Subscriptions.AssertEqual(
- Subscribe(200, 220)
- );
-
- f2.Subscriptions.AssertEqual(
- Subscribe(200, 220)
- );
- }
-
- #endregion
-
- #region Some/Error
-
- [TestMethod]
- public void Zip_SomeError()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var o = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(215, 2),
- OnCompleted<int>(230)
- );
-
- var e = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnError<int>(220, ex)
- );
-
- var res = scheduler.Start(() =>
- o.Zip(e, (x, y) => x + y)
- );
-
- res.Messages.AssertEqual(
- OnError<int>(220, ex)
- );
-
- o.Subscriptions.AssertEqual(
- Subscribe(200, 220)
- );
-
- e.Subscriptions.AssertEqual(
- Subscribe(200, 220)
- );
- }
-
- [TestMethod]
- public void Zip_ErrorSome()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var o = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(215, 2),
- OnCompleted<int>(230)
- );
-
- var e = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnError<int>(220, ex)
- );
-
- var res = scheduler.Start(() =>
- e.Zip(o, (x, y) => x + y)
- );
-
- res.Messages.AssertEqual(
- OnError<int>(220, ex)
- );
-
- o.Subscriptions.AssertEqual(
- Subscribe(200, 220)
- );
-
- e.Subscriptions.AssertEqual(
- Subscribe(200, 220)
- );
- }
-
- #endregion
-
- #region Simple
-
- [TestMethod]
- public void Zip_LeftCompletesFirst()
- {
- var scheduler = new TestScheduler();
-
- var o = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnCompleted<int>(220)
- );
-
- var e = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(215, 4),
- OnCompleted<int>(225)
- );
-
- var res = scheduler.Start(() =>
- o.Zip(e, (x, y) => x + y)
- );
-
- res.Messages.AssertEqual(
- OnNext(215, 6),
- OnCompleted<int>(225)
- );
-
- o.Subscriptions.AssertEqual(
- Subscribe(200, 220)
- );
-
- e.Subscriptions.AssertEqual(
- Subscribe(200, 225)
- );
- }
-
- [TestMethod]
- public void Zip_RightCompletesFirst()
- {
- var scheduler = new TestScheduler();
-
- var o = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(215, 4),
- OnCompleted<int>(225)
- );
-
- var e = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnCompleted<int>(220)
- );
-
- var res = scheduler.Start(() =>
- o.Zip(e, (x, y) => x + y)
- );
-
- res.Messages.AssertEqual(
- OnNext(215, 6),
- OnCompleted<int>(225)
- );
-
- o.Subscriptions.AssertEqual(
- Subscribe(200, 225)
- );
-
- e.Subscriptions.AssertEqual(
- Subscribe(200, 220)
- );
- }
-
- [TestMethod]
- public void Zip_LeftTriggersSelectorError()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var o = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(220, 2)
- );
-
- var e = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 4)
- );
-
- var res = scheduler.Start(() =>
- o.Zip(e, (x, y) => { if (x == y) return 42; throw ex; })
- );
-
- res.Messages.AssertEqual(
- OnError<int>(220, ex)
- );
-
- o.Subscriptions.AssertEqual(
- Subscribe(200, 220)
- );
-
- e.Subscriptions.AssertEqual(
- Subscribe(200, 220)
- );
- }
-
- [TestMethod]
- public void Zip_RightTriggersSelectorError()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var o = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2)
- );
-
- var e = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(220, 4)
- );
-
- var res = scheduler.Start(() =>
- o.Zip(e, (x, y) => { if (x == y) return 42; throw ex; })
- );
-
- res.Messages.AssertEqual(
- OnError<int>(220, ex)
- );
-
- o.Subscriptions.AssertEqual(
- Subscribe(200, 220)
- );
-
- e.Subscriptions.AssertEqual(
- Subscribe(200, 220)
- );
- }
-
- #endregion
-
- #region SymmetricReturn
-
- [TestMethod]
- public void Zip_SymmetricReturn2()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 1), OnCompleted<int>(400) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(220, 2), OnCompleted<int>(400) });
-
- var res = scheduler.Start(() =>
- Observable.Zip(e0, e1, (_0, _1) => _0 + _1)
- );
-
- res.Messages.AssertEqual(
- OnNext(220, 3),
- OnCompleted<int>(400)
- );
-
- foreach (var e in new[] { e0, e1 })
- e.Subscriptions.AssertEqual(Subscribe(200, 400));
- }
-
- [TestMethod]
- public void Zip_SymmetricReturn3()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 1), OnCompleted<int>(400) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(220, 2), OnCompleted<int>(400) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(230, 3), OnCompleted<int>(400) });
-
- var res = scheduler.Start(() =>
- Observable.Zip(e0, e1, e2, (_0, _1, _2) => _0 + _1 + _2)
- );
-
- res.Messages.AssertEqual(
- OnNext(230, 6),
- OnCompleted<int>(400)
- );
-
- foreach (var e in new[] { e0, e1, e2 })
- e.Subscriptions.AssertEqual(Subscribe(200, 400));
- }
-
- [TestMethod]
- public void Zip_SymmetricReturn4()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 1), OnCompleted<int>(400) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(220, 2), OnCompleted<int>(400) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(230, 3), OnCompleted<int>(400) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(240, 4), OnCompleted<int>(400) });
-
- var res = scheduler.Start(() =>
- Observable.Zip(e0, e1, e2, e3, (_0, _1, _2, _3) => _0 + _1 + _2 + _3)
- );
-
- res.Messages.AssertEqual(
- OnNext(240, 10),
- OnCompleted<int>(400)
- );
-
- foreach (var e in new[] { e0, e1, e2, e3 })
- e.Subscriptions.AssertEqual(Subscribe(200, 400));
- }
-
-#if !NO_LARGEARITY
- [TestMethod]
- public void Zip_SymmetricReturn5()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 1), OnCompleted<int>(400) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(220, 2), OnCompleted<int>(400) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(230, 3), OnCompleted<int>(400) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(240, 4), OnCompleted<int>(400) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(250, 5), OnCompleted<int>(400) });
-
- var res = scheduler.Start(() =>
- Observable.Zip(e0, e1, e2, e3, e4, (_0, _1, _2, _3, _4) => _0 + _1 + _2 + _3 + _4)
- );
-
- res.Messages.AssertEqual(
- OnNext(250, 15),
- OnCompleted<int>(400)
- );
-
- foreach (var e in new[] { e0, e1, e2, e3, e4 })
- e.Subscriptions.AssertEqual(Subscribe(200, 400));
- }
-
- [TestMethod]
- public void Zip_SymmetricReturn6()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 1), OnCompleted<int>(400) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(220, 2), OnCompleted<int>(400) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(230, 3), OnCompleted<int>(400) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(240, 4), OnCompleted<int>(400) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(250, 5), OnCompleted<int>(400) });
- var e5 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(260, 6), OnCompleted<int>(400) });
-
- var res = scheduler.Start(() =>
- Observable.Zip(e0, e1, e2, e3, e4, e5, (_0, _1, _2, _3, _4, _5) => _0 + _1 + _2 + _3 + _4 + _5)
- );
-
- res.Messages.AssertEqual(
- OnNext(260, 21),
- OnCompleted<int>(400)
- );
-
- foreach (var e in new[] { e0, e1, e2, e3, e4, e5 })
- e.Subscriptions.AssertEqual(Subscribe(200, 400));
- }
-
- [TestMethod]
- public void Zip_SymmetricReturn7()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 1), OnCompleted<int>(400) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(220, 2), OnCompleted<int>(400) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(230, 3), OnCompleted<int>(400) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(240, 4), OnCompleted<int>(400) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(250, 5), OnCompleted<int>(400) });
- var e5 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(260, 6), OnCompleted<int>(400) });
- var e6 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(270, 7), OnCompleted<int>(400) });
-
- var res = scheduler.Start(() =>
- Observable.Zip(e0, e1, e2, e3, e4, e5, e6, (_0, _1, _2, _3, _4, _5, _6) => _0 + _1 + _2 + _3 + _4 + _5 + _6)
- );
-
- res.Messages.AssertEqual(
- OnNext(270, 28),
- OnCompleted<int>(400)
- );
-
- foreach (var e in new[] { e0, e1, e2, e3, e4, e5, e6 })
- e.Subscriptions.AssertEqual(Subscribe(200, 400));
- }
-
- [TestMethod]
- public void Zip_SymmetricReturn8()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 1), OnCompleted<int>(400) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(220, 2), OnCompleted<int>(400) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(230, 3), OnCompleted<int>(400) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(240, 4), OnCompleted<int>(400) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(250, 5), OnCompleted<int>(400) });
- var e5 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(260, 6), OnCompleted<int>(400) });
- var e6 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(270, 7), OnCompleted<int>(400) });
- var e7 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(280, 8), OnCompleted<int>(400) });
-
- var res = scheduler.Start(() =>
- Observable.Zip(e0, e1, e2, e3, e4, e5, e6, e7, (_0, _1, _2, _3, _4, _5, _6, _7) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7)
- );
-
- res.Messages.AssertEqual(
- OnNext(280, 36),
- OnCompleted<int>(400)
- );
-
- foreach (var e in new[] { e0, e1, e2, e3, e4, e5, e6, e7 })
- e.Subscriptions.AssertEqual(Subscribe(200, 400));
- }
-
- [TestMethod]
- public void Zip_SymmetricReturn9()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 1), OnCompleted<int>(400) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(220, 2), OnCompleted<int>(400) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(230, 3), OnCompleted<int>(400) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(240, 4), OnCompleted<int>(400) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(250, 5), OnCompleted<int>(400) });
- var e5 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(260, 6), OnCompleted<int>(400) });
- var e6 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(270, 7), OnCompleted<int>(400) });
- var e7 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(280, 8), OnCompleted<int>(400) });
- var e8 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(290, 9), OnCompleted<int>(400) });
-
- var res = scheduler.Start(() =>
- Observable.Zip(e0, e1, e2, e3, e4, e5, e6, e7, e8, (_0, _1, _2, _3, _4, _5, _6, _7, _8) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8)
- );
-
- res.Messages.AssertEqual(
- OnNext(290, 45),
- OnCompleted<int>(400)
- );
-
- foreach (var e in new[] { e0, e1, e2, e3, e4, e5, e6, e7, e8 })
- e.Subscriptions.AssertEqual(Subscribe(200, 400));
- }
-
- [TestMethod]
- public void Zip_SymmetricReturn10()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 1), OnCompleted<int>(400) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(220, 2), OnCompleted<int>(400) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(230, 3), OnCompleted<int>(400) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(240, 4), OnCompleted<int>(400) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(250, 5), OnCompleted<int>(400) });
- var e5 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(260, 6), OnCompleted<int>(400) });
- var e6 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(270, 7), OnCompleted<int>(400) });
- var e7 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(280, 8), OnCompleted<int>(400) });
- var e8 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(290, 9), OnCompleted<int>(400) });
- var e9 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(300, 10), OnCompleted<int>(400) });
-
- var res = scheduler.Start(() =>
- Observable.Zip(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9)
- );
-
- res.Messages.AssertEqual(
- OnNext(300, 55),
- OnCompleted<int>(400)
- );
-
- foreach (var e in new[] { e0, e1, e2, e3, e4, e5, e6, e7, e8, e9 })
- e.Subscriptions.AssertEqual(Subscribe(200, 400));
- }
-
- [TestMethod]
- public void Zip_SymmetricReturn11()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 1), OnCompleted<int>(400) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(220, 2), OnCompleted<int>(400) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(230, 3), OnCompleted<int>(400) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(240, 4), OnCompleted<int>(400) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(250, 5), OnCompleted<int>(400) });
- var e5 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(260, 6), OnCompleted<int>(400) });
- var e6 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(270, 7), OnCompleted<int>(400) });
- var e7 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(280, 8), OnCompleted<int>(400) });
- var e8 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(290, 9), OnCompleted<int>(400) });
- var e9 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(300, 10), OnCompleted<int>(400) });
- var e10 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(310, 11), OnCompleted<int>(400) });
-
- var res = scheduler.Start(() =>
- Observable.Zip(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10)
- );
-
- res.Messages.AssertEqual(
- OnNext(310, 66),
- OnCompleted<int>(400)
- );
-
- foreach (var e in new[] { e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10 })
- e.Subscriptions.AssertEqual(Subscribe(200, 400));
- }
-
- [TestMethod]
- public void Zip_SymmetricReturn12()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 1), OnCompleted<int>(400) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(220, 2), OnCompleted<int>(400) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(230, 3), OnCompleted<int>(400) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(240, 4), OnCompleted<int>(400) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(250, 5), OnCompleted<int>(400) });
- var e5 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(260, 6), OnCompleted<int>(400) });
- var e6 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(270, 7), OnCompleted<int>(400) });
- var e7 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(280, 8), OnCompleted<int>(400) });
- var e8 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(290, 9), OnCompleted<int>(400) });
- var e9 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(300, 10), OnCompleted<int>(400) });
- var e10 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(310, 11), OnCompleted<int>(400) });
- var e11 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(320, 12), OnCompleted<int>(400) });
-
- var res = scheduler.Start(() =>
- Observable.Zip(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11)
- );
-
- res.Messages.AssertEqual(
- OnNext(320, 78),
- OnCompleted<int>(400)
- );
-
- foreach (var e in new[] { e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11 })
- e.Subscriptions.AssertEqual(Subscribe(200, 400));
- }
-
- [TestMethod]
- public void Zip_SymmetricReturn13()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 1), OnCompleted<int>(400) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(220, 2), OnCompleted<int>(400) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(230, 3), OnCompleted<int>(400) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(240, 4), OnCompleted<int>(400) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(250, 5), OnCompleted<int>(400) });
- var e5 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(260, 6), OnCompleted<int>(400) });
- var e6 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(270, 7), OnCompleted<int>(400) });
- var e7 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(280, 8), OnCompleted<int>(400) });
- var e8 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(290, 9), OnCompleted<int>(400) });
- var e9 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(300, 10), OnCompleted<int>(400) });
- var e10 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(310, 11), OnCompleted<int>(400) });
- var e11 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(320, 12), OnCompleted<int>(400) });
- var e12 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(330, 13), OnCompleted<int>(400) });
-
- var res = scheduler.Start(() =>
- Observable.Zip(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12)
- );
-
- res.Messages.AssertEqual(
- OnNext(330, 91),
- OnCompleted<int>(400)
- );
-
- foreach (var e in new[] { e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12 })
- e.Subscriptions.AssertEqual(Subscribe(200, 400));
- }
-
- [TestMethod]
- public void Zip_SymmetricReturn14()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 1), OnCompleted<int>(400) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(220, 2), OnCompleted<int>(400) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(230, 3), OnCompleted<int>(400) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(240, 4), OnCompleted<int>(400) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(250, 5), OnCompleted<int>(400) });
- var e5 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(260, 6), OnCompleted<int>(400) });
- var e6 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(270, 7), OnCompleted<int>(400) });
- var e7 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(280, 8), OnCompleted<int>(400) });
- var e8 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(290, 9), OnCompleted<int>(400) });
- var e9 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(300, 10), OnCompleted<int>(400) });
- var e10 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(310, 11), OnCompleted<int>(400) });
- var e11 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(320, 12), OnCompleted<int>(400) });
- var e12 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(330, 13), OnCompleted<int>(400) });
- var e13 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(340, 14), OnCompleted<int>(400) });
-
- var res = scheduler.Start(() =>
- Observable.Zip(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12 + _13)
- );
-
- res.Messages.AssertEqual(
- OnNext(340, 105),
- OnCompleted<int>(400)
- );
-
- foreach (var e in new[] { e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13 })
- e.Subscriptions.AssertEqual(Subscribe(200, 400));
- }
-
- [TestMethod]
- public void Zip_SymmetricReturn15()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 1), OnCompleted<int>(400) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(220, 2), OnCompleted<int>(400) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(230, 3), OnCompleted<int>(400) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(240, 4), OnCompleted<int>(400) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(250, 5), OnCompleted<int>(400) });
- var e5 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(260, 6), OnCompleted<int>(400) });
- var e6 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(270, 7), OnCompleted<int>(400) });
- var e7 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(280, 8), OnCompleted<int>(400) });
- var e8 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(290, 9), OnCompleted<int>(400) });
- var e9 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(300, 10), OnCompleted<int>(400) });
- var e10 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(310, 11), OnCompleted<int>(400) });
- var e11 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(320, 12), OnCompleted<int>(400) });
- var e12 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(330, 13), OnCompleted<int>(400) });
- var e13 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(340, 14), OnCompleted<int>(400) });
- var e14 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(350, 15), OnCompleted<int>(400) });
-
- var res = scheduler.Start(() =>
- Observable.Zip(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12 + _13 + _14)
- );
-
- res.Messages.AssertEqual(
- OnNext(350, 120),
- OnCompleted<int>(400)
- );
-
- foreach (var e in new[] { e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14 })
- e.Subscriptions.AssertEqual(Subscribe(200, 400));
- }
-
- [TestMethod]
- public void Zip_SymmetricReturn16()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 1), OnCompleted<int>(400) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(220, 2), OnCompleted<int>(400) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(230, 3), OnCompleted<int>(400) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(240, 4), OnCompleted<int>(400) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(250, 5), OnCompleted<int>(400) });
- var e5 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(260, 6), OnCompleted<int>(400) });
- var e6 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(270, 7), OnCompleted<int>(400) });
- var e7 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(280, 8), OnCompleted<int>(400) });
- var e8 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(290, 9), OnCompleted<int>(400) });
- var e9 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(300, 10), OnCompleted<int>(400) });
- var e10 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(310, 11), OnCompleted<int>(400) });
- var e11 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(320, 12), OnCompleted<int>(400) });
- var e12 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(330, 13), OnCompleted<int>(400) });
- var e13 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(340, 14), OnCompleted<int>(400) });
- var e14 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(350, 15), OnCompleted<int>(400) });
- var e15 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(360, 16), OnCompleted<int>(400) });
-
- var res = scheduler.Start(() =>
- Observable.Zip(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12 + _13 + _14 + _15)
- );
-
- res.Messages.AssertEqual(
- OnNext(360, 136),
- OnCompleted<int>(400)
- );
-
- foreach (var e in new[] { e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15 })
- e.Subscriptions.AssertEqual(Subscribe(200, 400));
- }
-#endif
-
- #endregion
-
- #region Various
-
- [TestMethod]
- public void Zip_SomeDataAsymmetric1()
- {
- var scheduler = new TestScheduler();
-
- var msgs1 = Enumerable.Range(0, 5).Select((x, i) => OnNext((ushort)(205 + i * 5), x)).ToArray();
- var msgs2 = Enumerable.Range(0, 10).Select((x, i) => OnNext((ushort)(202 + i * 8), x)).ToArray();
-
- int len = Math.Min(msgs1.Length, msgs2.Length);
-
- var o1 = scheduler.CreateHotObservable(msgs1);
- var o2 = scheduler.CreateHotObservable(msgs2);
-
- var res = scheduler.Start(() =>
- o1.Zip(o2, (x, y) => x + y)
- );
-
- Assert.AreEqual(len, res.Messages.Count, "length");
- for (int i = 0; i < len; i++)
- {
- var sum = msgs1[i].Value.Value + msgs2[i].Value.Value;
- var time = Math.Max(msgs1[i].Time, msgs2[i].Time);
-
- Assert.IsTrue(res.Messages[i].Time == time);
- Assert.IsTrue(res.Messages[i].Value.Kind == NotificationKind.OnNext);
- Assert.IsTrue(res.Messages[i].Value.Value == sum, i.ToString());
- }
- }
-
- [TestMethod]
- public void Zip_SomeDataAsymmetric2()
- {
- var scheduler = new TestScheduler();
-
- var msgs1 = Enumerable.Range(0, 10).Select((x, i) => OnNext((ushort)(205 + i * 5), x)).ToArray();
- var msgs2 = Enumerable.Range(0, 5).Select((x, i) => OnNext((ushort)(202 + i * 8), x)).ToArray();
-
- int len = Math.Min(msgs1.Length, msgs2.Length);
-
- var o1 = scheduler.CreateHotObservable(msgs1);
- var o2 = scheduler.CreateHotObservable(msgs2);
-
- var res = scheduler.Start(() =>
- o1.Zip(o2, (x, y) => x + y)
- );
-
- Assert.AreEqual(len, res.Messages.Count, "length");
- for (int i = 0; i < len; i++)
- {
- var sum = msgs1[i].Value.Value + msgs2[i].Value.Value;
- var time = Math.Max(msgs1[i].Time, msgs2[i].Time);
-
- Assert.IsTrue(res.Messages[i].Time == time);
- Assert.IsTrue(res.Messages[i].Value.Kind == NotificationKind.OnNext);
- Assert.IsTrue(res.Messages[i].Value.Value == sum, i.ToString());
- }
- }
-
- [TestMethod]
- public void Zip_SomeDataSymmetric()
- {
- var scheduler = new TestScheduler();
-
- var msgs1 = Enumerable.Range(0, 10).Select((x, i) => OnNext((ushort)(205 + i * 5), x)).ToArray();
- var msgs2 = Enumerable.Range(0, 10).Select((x, i) => OnNext((ushort)(202 + i * 8), x)).ToArray();
-
- int len = Math.Min(msgs1.Length, msgs2.Length);
-
- var o1 = scheduler.CreateHotObservable(msgs1);
- var o2 = scheduler.CreateHotObservable(msgs2);
-
- var res = scheduler.Start(() =>
- o1.Zip(o2, (x, y) => x + y)
- );
-
- Assert.AreEqual(len, res.Messages.Count, "length");
- for (int i = 0; i < len; i++)
- {
- var sum = msgs1[i].Value.Value + msgs2[i].Value.Value;
- var time = Math.Max(msgs1[i].Time, msgs2[i].Time);
-
- Assert.IsTrue(res.Messages[i].Time == time);
- Assert.IsTrue(res.Messages[i].Value.Kind == NotificationKind.OnNext);
- Assert.IsTrue(res.Messages[i].Value.Value == sum, i.ToString());
- }
- }
-
- #endregion
-
- #region SelectorThrows
-
- [TestMethod]
- public void Zip_SelectorThrows()
- {
- var scheduler = new TestScheduler();
-
- var o1 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(215, 2),
- OnNext(225, 4),
- OnCompleted<int>(240)
- );
-
- var o2 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(220, 3),
- OnNext(230, 5), //!
- OnCompleted<int>(250)
- );
-
- var ex = new Exception();
-
- var res = scheduler.Start(() =>
- o1.Zip(o2, (x, y) =>
- {
- if (y == 5)
- throw ex;
- return x + y;
- })
- );
-
- res.Messages.AssertEqual(
- OnNext(220, 2 + 3),
- OnError<int>(230, ex)
- );
- }
-
- [TestMethod]
- public void Zip_SelectorThrows2()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 1), OnCompleted<int>(400) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(220, 2), OnCompleted<int>(400) });
-
- var ex = new Exception();
- Func<int> f = () => { throw ex; };
-
- var res = scheduler.Start(() =>
- Observable.Zip(e0, e1, (_0, _1) => f())
- );
-
- res.Messages.AssertEqual(
- OnError<int>(220, ex)
- );
-
- var es = new[] { e0, e1 };
- foreach (var e in es)
- e.Subscriptions.AssertEqual(Subscribe(200, 200 + es.Length * 10));
- }
-
- [TestMethod]
- public void Zip_SelectorThrows3()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 1), OnCompleted<int>(400) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(220, 2), OnCompleted<int>(400) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(230, 3), OnCompleted<int>(400) });
-
- var ex = new Exception();
- Func<int> f = () => { throw ex; };
-
- var res = scheduler.Start(() =>
- Observable.Zip(e0, e1, e2, (_0, _1, _2) => f())
- );
-
- res.Messages.AssertEqual(
- OnError<int>(230, ex)
- );
-
- var es = new[] { e0, e1, e2 };
- foreach (var e in es)
- e.Subscriptions.AssertEqual(Subscribe(200, 200 + es.Length * 10));
- }
-
- [TestMethod]
- public void Zip_SelectorThrows4()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 1), OnCompleted<int>(400) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(220, 2), OnCompleted<int>(400) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(230, 3), OnCompleted<int>(400) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(240, 4), OnCompleted<int>(400) });
-
- var ex = new Exception();
- Func<int> f = () => { throw ex; };
-
- var res = scheduler.Start(() =>
- Observable.Zip(e0, e1, e2, e3, (_0, _1, _2, _3) => f())
- );
-
- res.Messages.AssertEqual(
- OnError<int>(240, ex)
- );
-
- var es = new[] { e0, e1, e2, e3 };
- foreach (var e in es)
- e.Subscriptions.AssertEqual(Subscribe(200, 200 + es.Length * 10));
- }
-
-#if !NO_LARGEARITY
- [TestMethod]
- public void Zip_SelectorThrows5()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 1), OnCompleted<int>(400) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(220, 2), OnCompleted<int>(400) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(230, 3), OnCompleted<int>(400) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(240, 4), OnCompleted<int>(400) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(250, 5), OnCompleted<int>(400) });
-
- var ex = new Exception();
- Func<int> f = () => { throw ex; };
-
- var res = scheduler.Start(() =>
- Observable.Zip(e0, e1, e2, e3, e4, (_0, _1, _2, _3, _4) => f())
- );
-
- res.Messages.AssertEqual(
- OnError<int>(250, ex)
- );
-
- var es = new[] { e0, e1, e2, e3, e4 };
- foreach (var e in es)
- e.Subscriptions.AssertEqual(Subscribe(200, 200 + es.Length * 10));
- }
-
- [TestMethod]
- public void Zip_SelectorThrows6()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 1), OnCompleted<int>(400) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(220, 2), OnCompleted<int>(400) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(230, 3), OnCompleted<int>(400) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(240, 4), OnCompleted<int>(400) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(250, 5), OnCompleted<int>(400) });
- var e5 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(260, 6), OnCompleted<int>(400) });
-
- var ex = new Exception();
- Func<int> f = () => { throw ex; };
-
- var res = scheduler.Start(() =>
- Observable.Zip(e0, e1, e2, e3, e4, e5, (_0, _1, _2, _3, _4, _5) => f())
- );
-
- res.Messages.AssertEqual(
- OnError<int>(260, ex)
- );
-
- var es = new[] { e0, e1, e2, e3, e4, e5 };
- foreach (var e in es)
- e.Subscriptions.AssertEqual(Subscribe(200, 200 + es.Length * 10));
- }
-
- [TestMethod]
- public void Zip_SelectorThrows7()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 1), OnCompleted<int>(400) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(220, 2), OnCompleted<int>(400) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(230, 3), OnCompleted<int>(400) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(240, 4), OnCompleted<int>(400) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(250, 5), OnCompleted<int>(400) });
- var e5 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(260, 6), OnCompleted<int>(400) });
- var e6 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(270, 7), OnCompleted<int>(400) });
-
- var ex = new Exception();
- Func<int> f = () => { throw ex; };
-
- var res = scheduler.Start(() =>
- Observable.Zip(e0, e1, e2, e3, e4, e5, e6, (_0, _1, _2, _3, _4, _5, _6) => f())
- );
-
- res.Messages.AssertEqual(
- OnError<int>(270, ex)
- );
-
- var es = new[] { e0, e1, e2, e3, e4, e5, e6 };
- foreach (var e in es)
- e.Subscriptions.AssertEqual(Subscribe(200, 200 + es.Length * 10));
- }
-
- [TestMethod]
- public void Zip_SelectorThrows8()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 1), OnCompleted<int>(400) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(220, 2), OnCompleted<int>(400) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(230, 3), OnCompleted<int>(400) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(240, 4), OnCompleted<int>(400) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(250, 5), OnCompleted<int>(400) });
- var e5 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(260, 6), OnCompleted<int>(400) });
- var e6 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(270, 7), OnCompleted<int>(400) });
- var e7 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(280, 8), OnCompleted<int>(400) });
-
- var ex = new Exception();
- Func<int> f = () => { throw ex; };
-
- var res = scheduler.Start(() =>
- Observable.Zip(e0, e1, e2, e3, e4, e5, e6, e7, (_0, _1, _2, _3, _4, _5, _6, _7) => f())
- );
-
- res.Messages.AssertEqual(
- OnError<int>(280, ex)
- );
-
- var es = new[] { e0, e1, e2, e3, e4, e5, e6, e7 };
- foreach (var e in es)
- e.Subscriptions.AssertEqual(Subscribe(200, 200 + es.Length * 10));
- }
-
- [TestMethod]
- public void Zip_SelectorThrows9()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 1), OnCompleted<int>(400) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(220, 2), OnCompleted<int>(400) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(230, 3), OnCompleted<int>(400) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(240, 4), OnCompleted<int>(400) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(250, 5), OnCompleted<int>(400) });
- var e5 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(260, 6), OnCompleted<int>(400) });
- var e6 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(270, 7), OnCompleted<int>(400) });
- var e7 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(280, 8), OnCompleted<int>(400) });
- var e8 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(290, 9), OnCompleted<int>(400) });
-
- var ex = new Exception();
- Func<int> f = () => { throw ex; };
-
- var res = scheduler.Start(() =>
- Observable.Zip(e0, e1, e2, e3, e4, e5, e6, e7, e8, (_0, _1, _2, _3, _4, _5, _6, _7, _8) => f())
- );
-
- res.Messages.AssertEqual(
- OnError<int>(290, ex)
- );
-
- var es = new[] { e0, e1, e2, e3, e4, e5, e6, e7, e8 };
- foreach (var e in es)
- e.Subscriptions.AssertEqual(Subscribe(200, 200 + es.Length * 10));
- }
-
- [TestMethod]
- public void Zip_SelectorThrows10()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 1), OnCompleted<int>(400) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(220, 2), OnCompleted<int>(400) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(230, 3), OnCompleted<int>(400) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(240, 4), OnCompleted<int>(400) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(250, 5), OnCompleted<int>(400) });
- var e5 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(260, 6), OnCompleted<int>(400) });
- var e6 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(270, 7), OnCompleted<int>(400) });
- var e7 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(280, 8), OnCompleted<int>(400) });
- var e8 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(290, 9), OnCompleted<int>(400) });
- var e9 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(300, 10), OnCompleted<int>(400) });
-
- var ex = new Exception();
- Func<int> f = () => { throw ex; };
-
- var res = scheduler.Start(() =>
- Observable.Zip(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9) => f())
- );
-
- res.Messages.AssertEqual(
- OnError<int>(300, ex)
- );
-
- var es = new[] { e0, e1, e2, e3, e4, e5, e6, e7, e8, e9 };
- foreach (var e in es)
- e.Subscriptions.AssertEqual(Subscribe(200, 200 + es.Length * 10));
- }
-
- [TestMethod]
- public void Zip_SelectorThrows11()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 1), OnCompleted<int>(400) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(220, 2), OnCompleted<int>(400) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(230, 3), OnCompleted<int>(400) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(240, 4), OnCompleted<int>(400) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(250, 5), OnCompleted<int>(400) });
- var e5 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(260, 6), OnCompleted<int>(400) });
- var e6 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(270, 7), OnCompleted<int>(400) });
- var e7 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(280, 8), OnCompleted<int>(400) });
- var e8 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(290, 9), OnCompleted<int>(400) });
- var e9 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(300, 10), OnCompleted<int>(400) });
- var e10 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(310, 11), OnCompleted<int>(400) });
-
- var ex = new Exception();
- Func<int> f = () => { throw ex; };
-
- var res = scheduler.Start(() =>
- Observable.Zip(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10) => f())
- );
-
- res.Messages.AssertEqual(
- OnError<int>(310, ex)
- );
-
- var es = new[] { e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10 };
- foreach (var e in es)
- e.Subscriptions.AssertEqual(Subscribe(200, 200 + es.Length * 10));
- }
-
- [TestMethod]
- public void Zip_SelectorThrows12()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 1), OnCompleted<int>(400) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(220, 2), OnCompleted<int>(400) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(230, 3), OnCompleted<int>(400) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(240, 4), OnCompleted<int>(400) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(250, 5), OnCompleted<int>(400) });
- var e5 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(260, 6), OnCompleted<int>(400) });
- var e6 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(270, 7), OnCompleted<int>(400) });
- var e7 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(280, 8), OnCompleted<int>(400) });
- var e8 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(290, 9), OnCompleted<int>(400) });
- var e9 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(300, 10), OnCompleted<int>(400) });
- var e10 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(310, 11), OnCompleted<int>(400) });
- var e11 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(320, 12), OnCompleted<int>(400) });
-
- var ex = new Exception();
- Func<int> f = () => { throw ex; };
-
- var res = scheduler.Start(() =>
- Observable.Zip(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11) => f())
- );
-
- res.Messages.AssertEqual(
- OnError<int>(320, ex)
- );
-
- var es = new[] { e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11 };
- foreach (var e in es)
- e.Subscriptions.AssertEqual(Subscribe(200, 200 + es.Length * 10));
- }
-
- [TestMethod]
- public void Zip_SelectorThrows13()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 1), OnCompleted<int>(400) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(220, 2), OnCompleted<int>(400) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(230, 3), OnCompleted<int>(400) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(240, 4), OnCompleted<int>(400) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(250, 5), OnCompleted<int>(400) });
- var e5 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(260, 6), OnCompleted<int>(400) });
- var e6 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(270, 7), OnCompleted<int>(400) });
- var e7 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(280, 8), OnCompleted<int>(400) });
- var e8 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(290, 9), OnCompleted<int>(400) });
- var e9 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(300, 10), OnCompleted<int>(400) });
- var e10 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(310, 11), OnCompleted<int>(400) });
- var e11 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(320, 12), OnCompleted<int>(400) });
- var e12 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(330, 13), OnCompleted<int>(400) });
-
- var ex = new Exception();
- Func<int> f = () => { throw ex; };
-
- var res = scheduler.Start(() =>
- Observable.Zip(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12) => f())
- );
-
- res.Messages.AssertEqual(
- OnError<int>(330, ex)
- );
-
- var es = new[] { e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12 };
- foreach (var e in es)
- e.Subscriptions.AssertEqual(Subscribe(200, 200 + es.Length * 10));
- }
-
- [TestMethod]
- public void Zip_SelectorThrows14()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 1), OnCompleted<int>(400) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(220, 2), OnCompleted<int>(400) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(230, 3), OnCompleted<int>(400) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(240, 4), OnCompleted<int>(400) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(250, 5), OnCompleted<int>(400) });
- var e5 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(260, 6), OnCompleted<int>(400) });
- var e6 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(270, 7), OnCompleted<int>(400) });
- var e7 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(280, 8), OnCompleted<int>(400) });
- var e8 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(290, 9), OnCompleted<int>(400) });
- var e9 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(300, 10), OnCompleted<int>(400) });
- var e10 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(310, 11), OnCompleted<int>(400) });
- var e11 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(320, 12), OnCompleted<int>(400) });
- var e12 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(330, 13), OnCompleted<int>(400) });
- var e13 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(340, 14), OnCompleted<int>(400) });
-
- var ex = new Exception();
- Func<int> f = () => { throw ex; };
-
- var res = scheduler.Start(() =>
- Observable.Zip(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13) => f())
- );
-
- res.Messages.AssertEqual(
- OnError<int>(340, ex)
- );
-
- var es = new[] { e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13 };
- foreach (var e in es)
- e.Subscriptions.AssertEqual(Subscribe(200, 200 + es.Length * 10));
- }
-
- [TestMethod]
- public void Zip_SelectorThrows15()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 1), OnCompleted<int>(400) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(220, 2), OnCompleted<int>(400) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(230, 3), OnCompleted<int>(400) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(240, 4), OnCompleted<int>(400) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(250, 5), OnCompleted<int>(400) });
- var e5 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(260, 6), OnCompleted<int>(400) });
- var e6 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(270, 7), OnCompleted<int>(400) });
- var e7 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(280, 8), OnCompleted<int>(400) });
- var e8 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(290, 9), OnCompleted<int>(400) });
- var e9 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(300, 10), OnCompleted<int>(400) });
- var e10 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(310, 11), OnCompleted<int>(400) });
- var e11 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(320, 12), OnCompleted<int>(400) });
- var e12 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(330, 13), OnCompleted<int>(400) });
- var e13 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(340, 14), OnCompleted<int>(400) });
- var e14 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(350, 15), OnCompleted<int>(400) });
-
- var ex = new Exception();
- Func<int> f = () => { throw ex; };
-
- var res = scheduler.Start(() =>
- Observable.Zip(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14) => f())
- );
-
- res.Messages.AssertEqual(
- OnError<int>(350, ex)
- );
-
- var es = new[] { e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14 };
- foreach (var e in es)
- e.Subscriptions.AssertEqual(Subscribe(200, 200 + es.Length * 10));
- }
-
- [TestMethod]
- public void Zip_SelectorThrows16()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 1), OnCompleted<int>(400) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(220, 2), OnCompleted<int>(400) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(230, 3), OnCompleted<int>(400) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(240, 4), OnCompleted<int>(400) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(250, 5), OnCompleted<int>(400) });
- var e5 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(260, 6), OnCompleted<int>(400) });
- var e6 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(270, 7), OnCompleted<int>(400) });
- var e7 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(280, 8), OnCompleted<int>(400) });
- var e8 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(290, 9), OnCompleted<int>(400) });
- var e9 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(300, 10), OnCompleted<int>(400) });
- var e10 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(310, 11), OnCompleted<int>(400) });
- var e11 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(320, 12), OnCompleted<int>(400) });
- var e12 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(330, 13), OnCompleted<int>(400) });
- var e13 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(340, 14), OnCompleted<int>(400) });
- var e14 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(350, 15), OnCompleted<int>(400) });
- var e15 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(360, 16), OnCompleted<int>(400) });
-
- var ex = new Exception();
- Func<int> f = () => { throw ex; };
-
- var res = scheduler.Start(() =>
- Observable.Zip(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15) => f())
- );
-
- res.Messages.AssertEqual(
- OnError<int>(360, ex)
- );
-
- var es = new[] { e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15 };
- foreach (var e in es)
- e.Subscriptions.AssertEqual(Subscribe(200, 200 + es.Length * 10));
- }
-#endif
-
- #endregion
-
- #region GetEnumeratorThrows
-
- [TestMethod]
- public void Zip_GetEnumeratorThrows()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable<int>(
- OnNext(210, 42),
- OnNext(220, 43),
- OnCompleted<int>(230)
- );
-
- var ys = new RogueEnumerable<int>(ex);
-
- var res = scheduler.Start(() =>
- xs.Zip(ys, (x, y) => x + y)
- );
-
- res.Messages.AssertEqual(
- OnError<int>(200, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- );
- }
-
- #endregion
-
- #region AllCompleted
-
- [TestMethod]
- public void Zip_AllCompleted2()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnCompleted<int>(220) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnCompleted<int>(230) });
-
- var res = scheduler.Start(() =>
- Observable.Zip(e0, e1, (_0, _1) => _0 + _1)
- );
-
- res.Messages.AssertEqual(
- OnNext<int>(210, 10),
- OnCompleted<int>(220)
- );
-
- var es = new[] { e0, e1 };
-
- var i = 0;
- foreach (var e in es.Take(es.Length - 1))
- e.Subscriptions.AssertEqual(Subscribe(200, 220 + (i++ * 10)));
-
- es.Last().Subscriptions.AssertEqual(
- Subscribe(200, 220 + (i - 1) * 10)
- );
- }
-
- [TestMethod]
- public void Zip_AllCompleted3()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnCompleted<int>(220) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnCompleted<int>(230) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnNext(230, 7), OnCompleted<int>(240) });
-
- var res = scheduler.Start(() =>
- Observable.Zip(e0, e1, e2, (_0, _1, _2) => _0 + _1 + _2)
- );
-
- res.Messages.AssertEqual(
- OnNext<int>(210, 15),
- OnCompleted<int>(230)
- );
-
- var es = new[] { e0, e1, e2 };
-
- var i = 0;
- foreach (var e in es.Take(es.Length - 1))
- e.Subscriptions.AssertEqual(Subscribe(200, 220 + (i++ * 10)));
-
- es.Last().Subscriptions.AssertEqual(
- Subscribe(200, 220 + (i - 1) * 10)
- );
- }
-
- [TestMethod]
- public void Zip_AllCompleted4()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnCompleted<int>(220) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnCompleted<int>(230) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnNext(230, 7), OnCompleted<int>(240) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnNext(230, 7), OnNext(240, 8), OnCompleted<int>(250) });
-
- var res = scheduler.Start(() =>
- Observable.Zip(e0, e1, e2, e3, (_0, _1, _2, _3) => _0 + _1 + _2 + _3)
- );
-
- res.Messages.AssertEqual(
- OnNext<int>(210, 20),
- OnCompleted<int>(240)
- );
-
- var es = new[] { e0, e1, e2, e3 };
-
- var i = 0;
- foreach (var e in es.Take(es.Length - 1))
- e.Subscriptions.AssertEqual(Subscribe(200, 220 + (i++ * 10)));
-
- es.Last().Subscriptions.AssertEqual(
- Subscribe(200, 220 + (i - 1) * 10)
- );
- }
-
-#if !NO_LARGEARITY
- [TestMethod]
- public void Zip_AllCompleted5()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnCompleted<int>(220) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnCompleted<int>(230) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnNext(230, 7), OnCompleted<int>(240) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnNext(230, 7), OnNext(240, 8), OnCompleted<int>(250) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnNext(230, 7), OnNext(240, 8), OnNext(250, 9), OnCompleted<int>(260) });
-
- var res = scheduler.Start(() =>
- Observable.Zip(e0, e1, e2, e3, e4, (_0, _1, _2, _3, _4) => _0 + _1 + _2 + _3 + _4)
- );
-
- res.Messages.AssertEqual(
- OnNext<int>(210, 25),
- OnCompleted<int>(250)
- );
-
- var es = new[] { e0, e1, e2, e3, e4 };
-
- var i = 0;
- foreach (var e in es.Take(es.Length - 1))
- e.Subscriptions.AssertEqual(Subscribe(200, 220 + (i++ * 10)));
-
- es.Last().Subscriptions.AssertEqual(
- Subscribe(200, 220 + (i - 1) * 10)
- );
- }
-
- [TestMethod]
- public void Zip_AllCompleted6()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnCompleted<int>(220) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnCompleted<int>(230) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnNext(230, 7), OnCompleted<int>(240) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnNext(230, 7), OnNext(240, 8), OnCompleted<int>(250) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnNext(230, 7), OnNext(240, 8), OnNext(250, 9), OnCompleted<int>(260) });
- var e5 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnNext(230, 7), OnNext(240, 8), OnNext(250, 9), OnNext(260, 10), OnCompleted<int>(270) });
-
- var res = scheduler.Start(() =>
- Observable.Zip(e0, e1, e2, e3, e4, e5, (_0, _1, _2, _3, _4, _5) => _0 + _1 + _2 + _3 + _4 + _5)
- );
-
- res.Messages.AssertEqual(
- OnNext<int>(210, 30),
- OnCompleted<int>(260)
- );
-
- var es = new[] { e0, e1, e2, e3, e4, e5 };
-
- var i = 0;
- foreach (var e in es.Take(es.Length - 1))
- e.Subscriptions.AssertEqual(Subscribe(200, 220 + (i++ * 10)));
-
- es.Last().Subscriptions.AssertEqual(
- Subscribe(200, 220 + (i - 1) * 10)
- );
- }
-
- [TestMethod]
- public void Zip_AllCompleted7()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnCompleted<int>(220) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnCompleted<int>(230) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnNext(230, 7), OnCompleted<int>(240) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnNext(230, 7), OnNext(240, 8), OnCompleted<int>(250) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnNext(230, 7), OnNext(240, 8), OnNext(250, 9), OnCompleted<int>(260) });
- var e5 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnNext(230, 7), OnNext(240, 8), OnNext(250, 9), OnNext(260, 10), OnCompleted<int>(270) });
- var e6 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnNext(230, 7), OnNext(240, 8), OnNext(250, 9), OnNext(260, 10), OnNext(270, 11), OnCompleted<int>(280) });
-
- var res = scheduler.Start(() =>
- Observable.Zip(e0, e1, e2, e3, e4, e5, e6, (_0, _1, _2, _3, _4, _5, _6) => _0 + _1 + _2 + _3 + _4 + _5 + _6)
- );
-
- res.Messages.AssertEqual(
- OnNext<int>(210, 35),
- OnCompleted<int>(270)
- );
-
- var es = new[] { e0, e1, e2, e3, e4, e5, e6 };
-
- var i = 0;
- foreach (var e in es.Take(es.Length - 1))
- e.Subscriptions.AssertEqual(Subscribe(200, 220 + (i++ * 10)));
-
- es.Last().Subscriptions.AssertEqual(
- Subscribe(200, 220 + (i - 1) * 10)
- );
- }
-
- [TestMethod]
- public void Zip_AllCompleted8()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnCompleted<int>(220) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnCompleted<int>(230) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnNext(230, 7), OnCompleted<int>(240) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnNext(230, 7), OnNext(240, 8), OnCompleted<int>(250) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnNext(230, 7), OnNext(240, 8), OnNext(250, 9), OnCompleted<int>(260) });
- var e5 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnNext(230, 7), OnNext(240, 8), OnNext(250, 9), OnNext(260, 10), OnCompleted<int>(270) });
- var e6 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnNext(230, 7), OnNext(240, 8), OnNext(250, 9), OnNext(260, 10), OnNext(270, 11), OnCompleted<int>(280) });
- var e7 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnNext(230, 7), OnNext(240, 8), OnNext(250, 9), OnNext(260, 10), OnNext(270, 11), OnNext(280, 12), OnCompleted<int>(290) });
-
- var res = scheduler.Start(() =>
- Observable.Zip(e0, e1, e2, e3, e4, e5, e6, e7, (_0, _1, _2, _3, _4, _5, _6, _7) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7)
- );
-
- res.Messages.AssertEqual(
- OnNext<int>(210, 40),
- OnCompleted<int>(280)
- );
-
- var es = new[] { e0, e1, e2, e3, e4, e5, e6, e7 };
-
- var i = 0;
- foreach (var e in es.Take(es.Length - 1))
- e.Subscriptions.AssertEqual(Subscribe(200, 220 + (i++ * 10)));
-
- es.Last().Subscriptions.AssertEqual(
- Subscribe(200, 220 + (i - 1) * 10)
- );
- }
-
- [TestMethod]
- public void Zip_AllCompleted9()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnCompleted<int>(220) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnCompleted<int>(230) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnNext(230, 7), OnCompleted<int>(240) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnNext(230, 7), OnNext(240, 8), OnCompleted<int>(250) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnNext(230, 7), OnNext(240, 8), OnNext(250, 9), OnCompleted<int>(260) });
- var e5 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnNext(230, 7), OnNext(240, 8), OnNext(250, 9), OnNext(260, 10), OnCompleted<int>(270) });
- var e6 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnNext(230, 7), OnNext(240, 8), OnNext(250, 9), OnNext(260, 10), OnNext(270, 11), OnCompleted<int>(280) });
- var e7 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnNext(230, 7), OnNext(240, 8), OnNext(250, 9), OnNext(260, 10), OnNext(270, 11), OnNext(280, 12), OnCompleted<int>(290) });
- var e8 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnNext(230, 7), OnNext(240, 8), OnNext(250, 9), OnNext(260, 10), OnNext(270, 11), OnNext(280, 12), OnNext(290, 13), OnCompleted<int>(300) });
-
- var res = scheduler.Start(() =>
- Observable.Zip(e0, e1, e2, e3, e4, e5, e6, e7, e8, (_0, _1, _2, _3, _4, _5, _6, _7, _8) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8)
- );
-
- res.Messages.AssertEqual(
- OnNext<int>(210, 45),
- OnCompleted<int>(290)
- );
-
- var es = new[] { e0, e1, e2, e3, e4, e5, e6, e7, e8 };
-
- var i = 0;
- foreach (var e in es.Take(es.Length - 1))
- e.Subscriptions.AssertEqual(Subscribe(200, 220 + (i++ * 10)));
-
- es.Last().Subscriptions.AssertEqual(
- Subscribe(200, 220 + (i - 1) * 10)
- );
- }
-
- [TestMethod]
- public void Zip_AllCompleted10()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnCompleted<int>(220) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnCompleted<int>(230) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnNext(230, 7), OnCompleted<int>(240) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnNext(230, 7), OnNext(240, 8), OnCompleted<int>(250) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnNext(230, 7), OnNext(240, 8), OnNext(250, 9), OnCompleted<int>(260) });
- var e5 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnNext(230, 7), OnNext(240, 8), OnNext(250, 9), OnNext(260, 10), OnCompleted<int>(270) });
- var e6 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnNext(230, 7), OnNext(240, 8), OnNext(250, 9), OnNext(260, 10), OnNext(270, 11), OnCompleted<int>(280) });
- var e7 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnNext(230, 7), OnNext(240, 8), OnNext(250, 9), OnNext(260, 10), OnNext(270, 11), OnNext(280, 12), OnCompleted<int>(290) });
- var e8 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnNext(230, 7), OnNext(240, 8), OnNext(250, 9), OnNext(260, 10), OnNext(270, 11), OnNext(280, 12), OnNext(290, 13), OnCompleted<int>(300) });
- var e9 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnNext(230, 7), OnNext(240, 8), OnNext(250, 9), OnNext(260, 10), OnNext(270, 11), OnNext(280, 12), OnNext(290, 13), OnNext(300, 14), OnCompleted<int>(310) });
-
- var res = scheduler.Start(() =>
- Observable.Zip(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9)
- );
-
- res.Messages.AssertEqual(
- OnNext<int>(210, 50),
- OnCompleted<int>(300)
- );
-
- var es = new[] { e0, e1, e2, e3, e4, e5, e6, e7, e8, e9 };
-
- var i = 0;
- foreach (var e in es.Take(es.Length - 1))
- e.Subscriptions.AssertEqual(Subscribe(200, 220 + (i++ * 10)));
-
- es.Last().Subscriptions.AssertEqual(
- Subscribe(200, 220 + (i - 1) * 10)
- );
- }
-
- [TestMethod]
- public void Zip_AllCompleted11()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnCompleted<int>(220) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnCompleted<int>(230) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnNext(230, 7), OnCompleted<int>(240) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnNext(230, 7), OnNext(240, 8), OnCompleted<int>(250) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnNext(230, 7), OnNext(240, 8), OnNext(250, 9), OnCompleted<int>(260) });
- var e5 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnNext(230, 7), OnNext(240, 8), OnNext(250, 9), OnNext(260, 10), OnCompleted<int>(270) });
- var e6 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnNext(230, 7), OnNext(240, 8), OnNext(250, 9), OnNext(260, 10), OnNext(270, 11), OnCompleted<int>(280) });
- var e7 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnNext(230, 7), OnNext(240, 8), OnNext(250, 9), OnNext(260, 10), OnNext(270, 11), OnNext(280, 12), OnCompleted<int>(290) });
- var e8 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnNext(230, 7), OnNext(240, 8), OnNext(250, 9), OnNext(260, 10), OnNext(270, 11), OnNext(280, 12), OnNext(290, 13), OnCompleted<int>(300) });
- var e9 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnNext(230, 7), OnNext(240, 8), OnNext(250, 9), OnNext(260, 10), OnNext(270, 11), OnNext(280, 12), OnNext(290, 13), OnNext(300, 14), OnCompleted<int>(310) });
- var e10 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnNext(230, 7), OnNext(240, 8), OnNext(250, 9), OnNext(260, 10), OnNext(270, 11), OnNext(280, 12), OnNext(290, 13), OnNext(300, 14), OnNext(310, 15), OnCompleted<int>(320) });
-
- var res = scheduler.Start(() =>
- Observable.Zip(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10)
- );
-
- res.Messages.AssertEqual(
- OnNext<int>(210, 55),
- OnCompleted<int>(310)
- );
-
- var es = new[] { e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10 };
-
- var i = 0;
- foreach (var e in es.Take(es.Length - 1))
- e.Subscriptions.AssertEqual(Subscribe(200, 220 + (i++ * 10)));
-
- es.Last().Subscriptions.AssertEqual(
- Subscribe(200, 220 + (i - 1) * 10)
- );
- }
-
- [TestMethod]
- public void Zip_AllCompleted12()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnCompleted<int>(220) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnCompleted<int>(230) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnNext(230, 7), OnCompleted<int>(240) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnNext(230, 7), OnNext(240, 8), OnCompleted<int>(250) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnNext(230, 7), OnNext(240, 8), OnNext(250, 9), OnCompleted<int>(260) });
- var e5 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnNext(230, 7), OnNext(240, 8), OnNext(250, 9), OnNext(260, 10), OnCompleted<int>(270) });
- var e6 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnNext(230, 7), OnNext(240, 8), OnNext(250, 9), OnNext(260, 10), OnNext(270, 11), OnCompleted<int>(280) });
- var e7 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnNext(230, 7), OnNext(240, 8), OnNext(250, 9), OnNext(260, 10), OnNext(270, 11), OnNext(280, 12), OnCompleted<int>(290) });
- var e8 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnNext(230, 7), OnNext(240, 8), OnNext(250, 9), OnNext(260, 10), OnNext(270, 11), OnNext(280, 12), OnNext(290, 13), OnCompleted<int>(300) });
- var e9 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnNext(230, 7), OnNext(240, 8), OnNext(250, 9), OnNext(260, 10), OnNext(270, 11), OnNext(280, 12), OnNext(290, 13), OnNext(300, 14), OnCompleted<int>(310) });
- var e10 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnNext(230, 7), OnNext(240, 8), OnNext(250, 9), OnNext(260, 10), OnNext(270, 11), OnNext(280, 12), OnNext(290, 13), OnNext(300, 14), OnNext(310, 15), OnCompleted<int>(320) });
- var e11 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnNext(230, 7), OnNext(240, 8), OnNext(250, 9), OnNext(260, 10), OnNext(270, 11), OnNext(280, 12), OnNext(290, 13), OnNext(300, 14), OnNext(310, 15), OnNext(320, 16), OnCompleted<int>(330) });
-
- var res = scheduler.Start(() =>
- Observable.Zip(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11)
- );
-
- res.Messages.AssertEqual(
- OnNext<int>(210, 60),
- OnCompleted<int>(320)
- );
-
- var es = new[] { e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11 };
-
- var i = 0;
- foreach (var e in es.Take(es.Length - 1))
- e.Subscriptions.AssertEqual(Subscribe(200, 220 + (i++ * 10)));
-
- es.Last().Subscriptions.AssertEqual(
- Subscribe(200, 220 + (i - 1) * 10)
- );
- }
-
- [TestMethod]
- public void Zip_AllCompleted13()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnCompleted<int>(220) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnCompleted<int>(230) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnNext(230, 7), OnCompleted<int>(240) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnNext(230, 7), OnNext(240, 8), OnCompleted<int>(250) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnNext(230, 7), OnNext(240, 8), OnNext(250, 9), OnCompleted<int>(260) });
- var e5 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnNext(230, 7), OnNext(240, 8), OnNext(250, 9), OnNext(260, 10), OnCompleted<int>(270) });
- var e6 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnNext(230, 7), OnNext(240, 8), OnNext(250, 9), OnNext(260, 10), OnNext(270, 11), OnCompleted<int>(280) });
- var e7 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnNext(230, 7), OnNext(240, 8), OnNext(250, 9), OnNext(260, 10), OnNext(270, 11), OnNext(280, 12), OnCompleted<int>(290) });
- var e8 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnNext(230, 7), OnNext(240, 8), OnNext(250, 9), OnNext(260, 10), OnNext(270, 11), OnNext(280, 12), OnNext(290, 13), OnCompleted<int>(300) });
- var e9 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnNext(230, 7), OnNext(240, 8), OnNext(250, 9), OnNext(260, 10), OnNext(270, 11), OnNext(280, 12), OnNext(290, 13), OnNext(300, 14), OnCompleted<int>(310) });
- var e10 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnNext(230, 7), OnNext(240, 8), OnNext(250, 9), OnNext(260, 10), OnNext(270, 11), OnNext(280, 12), OnNext(290, 13), OnNext(300, 14), OnNext(310, 15), OnCompleted<int>(320) });
- var e11 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnNext(230, 7), OnNext(240, 8), OnNext(250, 9), OnNext(260, 10), OnNext(270, 11), OnNext(280, 12), OnNext(290, 13), OnNext(300, 14), OnNext(310, 15), OnNext(320, 16), OnCompleted<int>(330) });
- var e12 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnNext(230, 7), OnNext(240, 8), OnNext(250, 9), OnNext(260, 10), OnNext(270, 11), OnNext(280, 12), OnNext(290, 13), OnNext(300, 14), OnNext(310, 15), OnNext(320, 16), OnNext(330, 17), OnCompleted<int>(340) });
-
- var res = scheduler.Start(() =>
- Observable.Zip(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12)
- );
-
- res.Messages.AssertEqual(
- OnNext<int>(210, 65),
- OnCompleted<int>(330)
- );
-
- var es = new[] { e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12 };
-
- var i = 0;
- foreach (var e in es.Take(es.Length - 1))
- e.Subscriptions.AssertEqual(Subscribe(200, 220 + (i++ * 10)));
-
- es.Last().Subscriptions.AssertEqual(
- Subscribe(200, 220 + (i - 1) * 10)
- );
- }
-
- [TestMethod]
- public void Zip_AllCompleted14()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnCompleted<int>(220) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnCompleted<int>(230) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnNext(230, 7), OnCompleted<int>(240) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnNext(230, 7), OnNext(240, 8), OnCompleted<int>(250) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnNext(230, 7), OnNext(240, 8), OnNext(250, 9), OnCompleted<int>(260) });
- var e5 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnNext(230, 7), OnNext(240, 8), OnNext(250, 9), OnNext(260, 10), OnCompleted<int>(270) });
- var e6 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnNext(230, 7), OnNext(240, 8), OnNext(250, 9), OnNext(260, 10), OnNext(270, 11), OnCompleted<int>(280) });
- var e7 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnNext(230, 7), OnNext(240, 8), OnNext(250, 9), OnNext(260, 10), OnNext(270, 11), OnNext(280, 12), OnCompleted<int>(290) });
- var e8 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnNext(230, 7), OnNext(240, 8), OnNext(250, 9), OnNext(260, 10), OnNext(270, 11), OnNext(280, 12), OnNext(290, 13), OnCompleted<int>(300) });
- var e9 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnNext(230, 7), OnNext(240, 8), OnNext(250, 9), OnNext(260, 10), OnNext(270, 11), OnNext(280, 12), OnNext(290, 13), OnNext(300, 14), OnCompleted<int>(310) });
- var e10 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnNext(230, 7), OnNext(240, 8), OnNext(250, 9), OnNext(260, 10), OnNext(270, 11), OnNext(280, 12), OnNext(290, 13), OnNext(300, 14), OnNext(310, 15), OnCompleted<int>(320) });
- var e11 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnNext(230, 7), OnNext(240, 8), OnNext(250, 9), OnNext(260, 10), OnNext(270, 11), OnNext(280, 12), OnNext(290, 13), OnNext(300, 14), OnNext(310, 15), OnNext(320, 16), OnCompleted<int>(330) });
- var e12 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnNext(230, 7), OnNext(240, 8), OnNext(250, 9), OnNext(260, 10), OnNext(270, 11), OnNext(280, 12), OnNext(290, 13), OnNext(300, 14), OnNext(310, 15), OnNext(320, 16), OnNext(330, 17), OnCompleted<int>(340) });
- var e13 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnNext(230, 7), OnNext(240, 8), OnNext(250, 9), OnNext(260, 10), OnNext(270, 11), OnNext(280, 12), OnNext(290, 13), OnNext(300, 14), OnNext(310, 15), OnNext(320, 16), OnNext(330, 17), OnNext(340, 18), OnCompleted<int>(350) });
-
- var res = scheduler.Start(() =>
- Observable.Zip(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12 + _13)
- );
-
- res.Messages.AssertEqual(
- OnNext<int>(210, 70),
- OnCompleted<int>(340)
- );
-
- var es = new[] { e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13 };
-
- var i = 0;
- foreach (var e in es.Take(es.Length - 1))
- e.Subscriptions.AssertEqual(Subscribe(200, 220 + (i++ * 10)));
-
- es.Last().Subscriptions.AssertEqual(
- Subscribe(200, 220 + (i - 1) * 10)
- );
- }
-
- [TestMethod]
- public void Zip_AllCompleted15()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnCompleted<int>(220) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnCompleted<int>(230) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnNext(230, 7), OnCompleted<int>(240) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnNext(230, 7), OnNext(240, 8), OnCompleted<int>(250) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnNext(230, 7), OnNext(240, 8), OnNext(250, 9), OnCompleted<int>(260) });
- var e5 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnNext(230, 7), OnNext(240, 8), OnNext(250, 9), OnNext(260, 10), OnCompleted<int>(270) });
- var e6 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnNext(230, 7), OnNext(240, 8), OnNext(250, 9), OnNext(260, 10), OnNext(270, 11), OnCompleted<int>(280) });
- var e7 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnNext(230, 7), OnNext(240, 8), OnNext(250, 9), OnNext(260, 10), OnNext(270, 11), OnNext(280, 12), OnCompleted<int>(290) });
- var e8 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnNext(230, 7), OnNext(240, 8), OnNext(250, 9), OnNext(260, 10), OnNext(270, 11), OnNext(280, 12), OnNext(290, 13), OnCompleted<int>(300) });
- var e9 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnNext(230, 7), OnNext(240, 8), OnNext(250, 9), OnNext(260, 10), OnNext(270, 11), OnNext(280, 12), OnNext(290, 13), OnNext(300, 14), OnCompleted<int>(310) });
- var e10 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnNext(230, 7), OnNext(240, 8), OnNext(250, 9), OnNext(260, 10), OnNext(270, 11), OnNext(280, 12), OnNext(290, 13), OnNext(300, 14), OnNext(310, 15), OnCompleted<int>(320) });
- var e11 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnNext(230, 7), OnNext(240, 8), OnNext(250, 9), OnNext(260, 10), OnNext(270, 11), OnNext(280, 12), OnNext(290, 13), OnNext(300, 14), OnNext(310, 15), OnNext(320, 16), OnCompleted<int>(330) });
- var e12 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnNext(230, 7), OnNext(240, 8), OnNext(250, 9), OnNext(260, 10), OnNext(270, 11), OnNext(280, 12), OnNext(290, 13), OnNext(300, 14), OnNext(310, 15), OnNext(320, 16), OnNext(330, 17), OnCompleted<int>(340) });
- var e13 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnNext(230, 7), OnNext(240, 8), OnNext(250, 9), OnNext(260, 10), OnNext(270, 11), OnNext(280, 12), OnNext(290, 13), OnNext(300, 14), OnNext(310, 15), OnNext(320, 16), OnNext(330, 17), OnNext(340, 18), OnCompleted<int>(350) });
- var e14 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnNext(230, 7), OnNext(240, 8), OnNext(250, 9), OnNext(260, 10), OnNext(270, 11), OnNext(280, 12), OnNext(290, 13), OnNext(300, 14), OnNext(310, 15), OnNext(320, 16), OnNext(330, 17), OnNext(340, 18), OnNext(350, 19), OnCompleted<int>(360) });
-
- var res = scheduler.Start(() =>
- Observable.Zip(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12 + _13 + _14)
- );
-
- res.Messages.AssertEqual(
- OnNext<int>(210, 75),
- OnCompleted<int>(350)
- );
-
- var es = new[] { e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14 };
-
- var i = 0;
- foreach (var e in es.Take(es.Length - 1))
- e.Subscriptions.AssertEqual(Subscribe(200, 220 + (i++ * 10)));
-
- es.Last().Subscriptions.AssertEqual(
- Subscribe(200, 220 + (i - 1) * 10)
- );
- }
-
- [TestMethod]
- public void Zip_AllCompleted16()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnCompleted<int>(220) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnCompleted<int>(230) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnNext(230, 7), OnCompleted<int>(240) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnNext(230, 7), OnNext(240, 8), OnCompleted<int>(250) });
- var e4 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnNext(230, 7), OnNext(240, 8), OnNext(250, 9), OnCompleted<int>(260) });
- var e5 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnNext(230, 7), OnNext(240, 8), OnNext(250, 9), OnNext(260, 10), OnCompleted<int>(270) });
- var e6 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnNext(230, 7), OnNext(240, 8), OnNext(250, 9), OnNext(260, 10), OnNext(270, 11), OnCompleted<int>(280) });
- var e7 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnNext(230, 7), OnNext(240, 8), OnNext(250, 9), OnNext(260, 10), OnNext(270, 11), OnNext(280, 12), OnCompleted<int>(290) });
- var e8 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnNext(230, 7), OnNext(240, 8), OnNext(250, 9), OnNext(260, 10), OnNext(270, 11), OnNext(280, 12), OnNext(290, 13), OnCompleted<int>(300) });
- var e9 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnNext(230, 7), OnNext(240, 8), OnNext(250, 9), OnNext(260, 10), OnNext(270, 11), OnNext(280, 12), OnNext(290, 13), OnNext(300, 14), OnCompleted<int>(310) });
- var e10 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnNext(230, 7), OnNext(240, 8), OnNext(250, 9), OnNext(260, 10), OnNext(270, 11), OnNext(280, 12), OnNext(290, 13), OnNext(300, 14), OnNext(310, 15), OnCompleted<int>(320) });
- var e11 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnNext(230, 7), OnNext(240, 8), OnNext(250, 9), OnNext(260, 10), OnNext(270, 11), OnNext(280, 12), OnNext(290, 13), OnNext(300, 14), OnNext(310, 15), OnNext(320, 16), OnCompleted<int>(330) });
- var e12 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnNext(230, 7), OnNext(240, 8), OnNext(250, 9), OnNext(260, 10), OnNext(270, 11), OnNext(280, 12), OnNext(290, 13), OnNext(300, 14), OnNext(310, 15), OnNext(320, 16), OnNext(330, 17), OnCompleted<int>(340) });
- var e13 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnNext(230, 7), OnNext(240, 8), OnNext(250, 9), OnNext(260, 10), OnNext(270, 11), OnNext(280, 12), OnNext(290, 13), OnNext(300, 14), OnNext(310, 15), OnNext(320, 16), OnNext(330, 17), OnNext(340, 18), OnCompleted<int>(350) });
- var e14 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnNext(230, 7), OnNext(240, 8), OnNext(250, 9), OnNext(260, 10), OnNext(270, 11), OnNext(280, 12), OnNext(290, 13), OnNext(300, 14), OnNext(310, 15), OnNext(320, 16), OnNext(330, 17), OnNext(340, 18), OnNext(350, 19), OnCompleted<int>(360) });
- var e15 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 5), OnNext(220, 6), OnNext(230, 7), OnNext(240, 8), OnNext(250, 9), OnNext(260, 10), OnNext(270, 11), OnNext(280, 12), OnNext(290, 13), OnNext(300, 14), OnNext(310, 15), OnNext(320, 16), OnNext(330, 17), OnNext(340, 18), OnNext(350, 19), OnNext(360, 20), OnCompleted<int>(370) });
-
- var res = scheduler.Start(() =>
- Observable.Zip(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, (_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15) => _0 + _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 + _10 + _11 + _12 + _13 + _14 + _15)
- );
-
- res.Messages.AssertEqual(
- OnNext<int>(210, 80),
- OnCompleted<int>(360)
- );
-
- var es = new[] { e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15 };
-
- var i = 0;
- foreach (var e in es.Take(es.Length - 1))
- e.Subscriptions.AssertEqual(Subscribe(200, 220 + (i++ * 10)));
-
- es.Last().Subscriptions.AssertEqual(
- Subscribe(200, 220 + (i - 1) * 10)
- );
- }
-#endif
-
-#endregion
-
- #region ZipWithEnumerable
-
- [TestMethod]
- public void ZipWithEnumerable_NeverNever()
- {
- var evt = new ManualResetEvent(false);
- var scheduler = new TestScheduler();
-
- var n1 = scheduler.CreateHotObservable(
- OnNext(150, 1)
- );
-
- var n2 = new MockEnumerable<int>(scheduler,
- EnumerableNever(evt)
- );
-
- var res = scheduler.Start(() =>
- n1.Zip(n2, (x, y) => x + y)
- );
-
- res.Messages.AssertEqual(
- );
-
- n1.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
-
- n2.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
-
- evt.Set();
- }
-
- [TestMethod]
- public void ZipWithEnumerable_NeverEmpty()
- {
- var scheduler = new TestScheduler();
-
- var n = scheduler.CreateHotObservable(
- OnNext(150, 1)
- );
-
- var e = new MockEnumerable<int>(scheduler,
- Enumerable.Empty<int>()
- );
-
- var res = scheduler.Start(() =>
- n.Zip(e, (x, y) => x + y)
- );
-
- res.Messages.AssertEqual(
- );
-
- n.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
-
- e.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
- }
-
- [TestMethod]
- public void ZipWithEnumerable_EmptyNever()
- {
- var evt = new ManualResetEvent(false);
-
- var scheduler = new TestScheduler();
-
- var e = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnCompleted<int>(210)
- );
-
- var n = new MockEnumerable<int>(scheduler,
- EnumerableNever(evt)
- );
-
- var res = scheduler.Start(() =>
- e.Zip(n, (x, y) => x + y)
- );
-
- res.Messages.AssertEqual(
- OnCompleted<int>(210)
- );
-
- e.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
-
- n.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
-
- evt.Set();
- }
-
- [TestMethod]
- public void ZipWithEnumerable_EmptyEmpty()
- {
- var scheduler = new TestScheduler();
-
- var e1 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnCompleted<int>(210)
- );
-
- var e2 = new MockEnumerable<int>(scheduler,
- Enumerable.Empty<int>()
- );
-
- var res = scheduler.Start(() =>
- e1.Zip(e2, (x, y) => x + y)
- );
-
- res.Messages.AssertEqual(
- OnCompleted<int>(210)
- );
-
- e1.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
-
- e2.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void ZipWithEnumerable_EmptyNonEmpty()
- {
- var scheduler = new TestScheduler();
-
- var e = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnCompleted<int>(210)
- );
-
- var o = new MockEnumerable<int>(scheduler,
- new[] { 2 }
- );
-
- var res = scheduler.Start(() =>
- e.Zip(o, (x, y) => x + y)
- );
-
- res.Messages.AssertEqual(
- OnCompleted<int>(210)
- );
-
- e.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
-
- o.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void ZipWithEnumerable_NonEmptyEmpty()
- {
- var scheduler = new TestScheduler();
-
- var e = new MockEnumerable<int>(scheduler,
- Enumerable.Empty<int>()
- );
-
- var o = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(215, 2),
- OnCompleted<int>(220)
- );
-
- var res = scheduler.Start(() =>
- o.Zip(e, (x, y) => x + y)
- );
-
- res.Messages.AssertEqual(
- OnCompleted<int>(215)
- );
-
- e.Subscriptions.AssertEqual(
- Subscribe(200, 215)
- );
-
- o.Subscriptions.AssertEqual(
- Subscribe(200, 215)
- );
- }
-
- [TestMethod]
- public void ZipWithEnumerable_NeverNonEmpty()
- {
- var scheduler = new TestScheduler();
-
- var o = new MockEnumerable<int>(scheduler,
- new[] { 2 }
- );
-
- var n = scheduler.CreateHotObservable(
- OnNext(150, 1)
- );
-
- var res = scheduler.Start(() =>
- n.Zip(o, (x, y) => x + y)
- );
-
- res.Messages.AssertEqual(
- );
-
- o.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
-
- n.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
- }
-
- [TestMethod]
- public void ZipWithEnumerable_NonEmptyNonEmpty()
- {
- var scheduler = new TestScheduler();
-
- var o1 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(215, 2),
- OnCompleted<int>(230)
- );
-
- var o2 = new MockEnumerable<int>(scheduler,
- new[] { 3 }
- );
-
- var res = scheduler.Start(() =>
- o1.Zip(o2, (x, y) => x + y)
- );
-
- res.Messages.AssertEqual(
- OnNext(215, 2 + 3),
- OnCompleted<int>(230)
- );
-
- o1.Subscriptions.AssertEqual(
- Subscribe(200, 230)
- );
-
- o2.Subscriptions.AssertEqual(
- Subscribe(200, 230)
- );
- }
-
- [TestMethod]
- public void ZipWithEnumerable_EmptyError()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var e = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnCompleted<int>(230)
- );
-
- var f = new MockEnumerable<int>(scheduler,
- ThrowEnumerable(false, ex)
- );
-
- var res = scheduler.Start(() =>
- e.Zip(f, (x, y) => x + y)
- );
-
- res.Messages.AssertEqual(
- OnCompleted<int>(230)
- );
-
- e.Subscriptions.AssertEqual(
- Subscribe(200, 230)
- );
-
- f.Subscriptions.AssertEqual(
- Subscribe(200, 230)
- );
- }
-
- [TestMethod]
- public void ZipWithEnumerable_ErrorEmpty()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var e = new MockEnumerable<int>(scheduler,
- Enumerable.Empty<int>()
- );
-
- var f = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnError<int>(220, ex)
- );
-
- var res = scheduler.Start(() =>
- f.Zip(e, (x, y) => x + y)
- );
-
- res.Messages.AssertEqual(
- OnError<int>(220, ex)
- );
-
- e.Subscriptions.AssertEqual(
- Subscribe(200, 220)
- );
-
- f.Subscriptions.AssertEqual(
- Subscribe(200, 220)
- );
- }
-
- [TestMethod]
- public void ZipWithEnumerable_NeverError()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var n = scheduler.CreateHotObservable(
- OnNext(150, 1)
- );
-
- var f = new MockEnumerable<int>(scheduler,
- ThrowEnumerable(false, ex)
- );
-
- var res = scheduler.Start(() =>
- n.Zip(f, (x, y) => x + y)
- );
-
- res.Messages.AssertEqual(
- );
-
- n.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
-
- f.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
- }
-
- [TestMethod]
- public void ZipWithEnumerable_ErrorNever()
- {
- var evt = new ManualResetEvent(false);
-
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var n = new MockEnumerable<int>(scheduler,
- EnumerableNever(evt)
- );
-
- var f = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnError<int>(220, ex)
- );
-
- var res = scheduler.Start(() =>
- f.Zip(n, (x, y) => x + y)
- );
-
- res.Messages.AssertEqual(
- OnError<int>(220, ex)
- );
-
- n.Subscriptions.AssertEqual(
- Subscribe(200, 220)
- );
-
- f.Subscriptions.AssertEqual(
- Subscribe(200, 220)
- );
-
- evt.Set();
- }
-
- [TestMethod]
- public void ZipWithEnumerable_ErrorError()
- {
- var scheduler = new TestScheduler();
-
- var ex1 = new Exception();
- var ex2 = new Exception();
-
- var f1 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnError<int>(230, ex1)
- );
-
- var f2 = new MockEnumerable<int>(scheduler,
- ThrowEnumerable(false, ex2)
- );
-
- var res = scheduler.Start(() =>
- f1.Zip(f2, (x, y) => x + y)
- );
-
- res.Messages.AssertEqual(
- OnError<int>(230, ex1)
- );
-
- f1.Subscriptions.AssertEqual(
- Subscribe(200, 230)
- );
-
- f2.Subscriptions.AssertEqual(
- Subscribe(200, 230)
- );
- }
-
- [TestMethod]
- public void ZipWithEnumerable_SomeError()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var o = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(215, 2),
- OnCompleted<int>(230)
- );
-
- var e = new MockEnumerable<int>(scheduler,
- ThrowEnumerable(false, ex)
- );
-
- var res = scheduler.Start(() =>
- o.Zip(e, (x, y) => x + y)
- );
-
- res.Messages.AssertEqual(
- OnError<int>(215, ex)
- );
-
- o.Subscriptions.AssertEqual(
- Subscribe(200, 215)
- );
-
- e.Subscriptions.AssertEqual(
- Subscribe(200, 215)
- );
- }
-
- [TestMethod]
- public void ZipWithEnumerable_ErrorSome()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var o = new MockEnumerable<int>(scheduler,
- new[] { 2 }
- );
-
- var e = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnError<int>(220, ex)
- );
-
- var res = scheduler.Start(() =>
- e.Zip(o, (x, y) => x + y)
- );
-
- res.Messages.AssertEqual(
- OnError<int>(220, ex)
- );
-
- o.Subscriptions.AssertEqual(
- Subscribe(200, 220)
- );
-
- e.Subscriptions.AssertEqual(
- Subscribe(200, 220)
- );
- }
-
- [TestMethod]
- public void ZipWithEnumerable_SomeDataBothSides()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var o = new MockEnumerable<int>(scheduler,
- new[] { 5, 4, 3, 2 }
- );
-
- var e = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnNext(220, 3),
- OnNext(230, 4),
- OnNext(240, 5)
- );
-
- var res = scheduler.Start(() =>
- e.Zip(o, (x, y) => x + y)
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 7),
- OnNext(220, 7),
- OnNext(230, 7),
- OnNext(240, 7)
- );
-
- o.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
-
- e.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
- }
-
- [TestMethod]
- public void ZipWithEnumerable_EnumeratorThrowsMoveNext()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var o1 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(215, 2),
- OnNext(225, 4),
- OnCompleted<int>(240)
- );
-
- var o2 = new MockEnumerable<int>(scheduler,
- new MyEnumerable(false, ex)
- );
-
- var res = scheduler.Start(() =>
- o1.Zip(o2, (x, y) => x + y)
- );
-
- res.Messages.AssertEqual(
- OnError<int>(215, ex)
- );
-
- o1.Subscriptions.AssertEqual(
- Subscribe(200, 215)
- );
-
- o2.Subscriptions.AssertEqual(
- Subscribe(200, 215)
- );
- }
-
- [TestMethod]
- public void ZipWithEnumerable_EnumeratorThrowsCurrent()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var o1 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(215, 2),
- OnNext(225, 4),
- OnCompleted<int>(240)
- );
-
- var o2 = new MockEnumerable<int>(scheduler,
- new MyEnumerable(true, ex)
- );
-
- var res = scheduler.Start(() =>
- o1.Zip(o2, (x, y) => x + y)
- );
-
- res.Messages.AssertEqual(
- OnError<int>(215, ex)
- );
-
- o1.Subscriptions.AssertEqual(
- Subscribe(200, 215)
- );
-
- o2.Subscriptions.AssertEqual(
- Subscribe(200, 215)
- );
- }
-
- [TestMethod]
- public void ZipWithEnumerable_SelectorThrows()
- {
- var scheduler = new TestScheduler();
-
- var o1 = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(215, 2),
- OnNext(225, 4),
- OnCompleted<int>(240)
- );
-
- var o2 = new MockEnumerable<int>(scheduler,
- new[] { 3, 5 }
- );
-
- var ex = new Exception();
-
- var res = scheduler.Start(() =>
- o1.Zip(o2, (x, y) =>
- {
- if (y == 5)
- throw ex;
- return x + y;
- })
- );
-
- res.Messages.AssertEqual(
- OnNext(215, 2 + 3),
- OnError<int>(225, ex)
- );
-
- o1.Subscriptions.AssertEqual(
- Subscribe(200, 225)
- );
-
- o2.Subscriptions.AssertEqual(
- Subscribe(200, 225)
- );
- }
-
- private IEnumerable<int> EnumerableNever(ManualResetEvent evt)
- {
- evt.WaitOne();
- yield break;
- }
-
- private IEnumerable<int> ThrowEnumerable(bool b, Exception ex)
- {
- if (!b)
- throw ex;
- yield break;
- }
-
- class MyEnumerable : IEnumerable<int>
- {
- private bool _throwInCurrent;
- private Exception _ex;
-
- public MyEnumerable(bool throwInCurrent, Exception ex)
- {
- _throwInCurrent = throwInCurrent;
- _ex = ex;
- }
-
- public IEnumerator<int> GetEnumerator()
- {
- return new MyEnumerator(_throwInCurrent, _ex);
- }
-
- System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
- {
- return GetEnumerator();
- }
-
- class MyEnumerator : IEnumerator<int>
- {
- private bool _throwInCurrent;
- private Exception _ex;
-
- public MyEnumerator(bool throwInCurrent, Exception ex)
- {
- _throwInCurrent = throwInCurrent;
- _ex = ex;
- }
-
- public int Current
- {
- get
- {
- if (_throwInCurrent)
- throw _ex;
- else
- return 1;
- }
- }
-
- public void Dispose()
- {
- }
-
- object System.Collections.IEnumerator.Current
- {
- get { return Current; }
- }
-
- public bool MoveNext()
- {
- if (!_throwInCurrent)
- throw _ex;
- return true;
- }
-
- public void Reset()
- {
- }
- }
- }
-
- #endregion
-
- #region NAry
-
- [TestMethod]
- public void Zip_NAry_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(default(IEnumerable<IObservable<int>>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(default(IEnumerable<IObservable<int>>), _ => 42));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(new[] { Observable.Return(42) }, default(Func<IList<int>, string>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Zip(default(IObservable<int>[])));
- }
-
- [TestMethod]
- public void Zip_NAry_Symmetric()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 1), OnNext(250, 4), OnCompleted<int>(420) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(220, 2), OnNext(240, 5), OnCompleted<int>(410) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(230, 3), OnNext(260, 6), OnCompleted<int>(400) });
-
- var res = scheduler.Start(() =>
- Observable.Zip(e0, e1, e2)
- );
-
- res.Messages.AssertEqual(
- OnNext<IList<int>>(230, l => l.SequenceEqual(new[] { 1, 2, 3 })),
- OnNext<IList<int>>(260, l => l.SequenceEqual(new[] { 4, 5, 6 })),
- OnCompleted<IList<int>>(420)
- );
-
- e0.Subscriptions.AssertEqual(
- Subscribe(200, 420)
- );
-
- e1.Subscriptions.AssertEqual(
- Subscribe(200, 410)
- );
-
- e2.Subscriptions.AssertEqual(
- Subscribe(200, 400)
- );
- }
-
- [TestMethod]
- public void Zip_NAry_Symmetric_Selector()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 1), OnNext(250, 4), OnCompleted<int>(420) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(220, 2), OnNext(240, 5), OnCompleted<int>(410) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(230, 3), OnNext(260, 6), OnCompleted<int>(400) });
-
- var res = scheduler.Start(() =>
- Observable.Zip(new[] { e0, e1, e2 }, xs => xs.Sum())
- );
-
- res.Messages.AssertEqual(
- OnNext<int>(230, new[] { 1, 2, 3 }.Sum()),
- OnNext<int>(260, new[] { 4, 5, 6 }.Sum()),
- OnCompleted<int>(420)
- );
-
- e0.Subscriptions.AssertEqual(
- Subscribe(200, 420)
- );
-
- e1.Subscriptions.AssertEqual(
- Subscribe(200, 410)
- );
-
- e2.Subscriptions.AssertEqual(
- Subscribe(200, 400)
- );
- }
-
- [TestMethod]
- public void Zip_NAry_Asymmetric()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 1), OnNext(250, 4), OnCompleted<int>(270) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(220, 2), OnNext(240, 5), OnNext(290, 7), OnNext(310, 9), OnCompleted<int>(410) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(230, 3), OnNext(260, 6), OnNext(280, 8), OnCompleted<int>(300) });
-
- var res = scheduler.Start(() =>
- Observable.Zip(e0, e1, e2)
- );
-
- res.Messages.AssertEqual(
- OnNext<IList<int>>(230, l => l.SequenceEqual(new[] { 1, 2, 3 })),
- OnNext<IList<int>>(260, l => l.SequenceEqual(new[] { 4, 5, 6 })),
- OnCompleted<IList<int>>(310)
- );
-
- e0.Subscriptions.AssertEqual(
- Subscribe(200, 270)
- );
-
- e1.Subscriptions.AssertEqual(
- Subscribe(200, 310)
- );
-
- e2.Subscriptions.AssertEqual(
- Subscribe(200, 300)
- );
- }
-
- [TestMethod]
- public void Zip_NAry_Asymmetric_Selector()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 1), OnNext(250, 4), OnCompleted<int>(270) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(220, 2), OnNext(240, 5), OnNext(290, 7), OnNext(310, 9), OnCompleted<int>(410) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(230, 3), OnNext(260, 6), OnNext(280, 8), OnCompleted<int>(300) });
-
- var res = scheduler.Start(() =>
- Observable.Zip(new[] { e0, e1, e2 }, xs => xs.Sum())
- );
-
- res.Messages.AssertEqual(
- OnNext<int>(230, new[] { 1, 2, 3 }.Sum()),
- OnNext<int>(260, new[] { 4, 5, 6 }.Sum()),
- OnCompleted<int>(310)
- );
-
- e0.Subscriptions.AssertEqual(
- Subscribe(200, 270)
- );
-
- e1.Subscriptions.AssertEqual(
- Subscribe(200, 310)
- );
-
- e2.Subscriptions.AssertEqual(
- Subscribe(200, 300)
- );
- }
-
- [TestMethod]
- public void Zip_NAry_Error()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 1), OnError<int>(250, ex) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(220, 2), OnNext(240, 5), OnCompleted<int>(410) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(230, 3), OnNext(260, 6), OnCompleted<int>(400) });
-
- var res = scheduler.Start(() =>
- Observable.Zip(e0, e1, e2)
- );
-
- res.Messages.AssertEqual(
- OnNext<IList<int>>(230, l => l.SequenceEqual(new[] { 1, 2, 3 })),
- OnError<IList<int>>(250, ex)
- );
-
- e0.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
-
- e1.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
-
- e2.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Zip_NAry_Error_Selector()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 1), OnError<int>(250, ex) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(220, 2), OnNext(240, 5), OnCompleted<int>(410) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(230, 3), OnNext(260, 6), OnCompleted<int>(400) });
-
- var res = scheduler.Start(() =>
- Observable.Zip(new[] { e0, e1, e2 }, xs => xs.Sum())
- );
-
- res.Messages.AssertEqual(
- OnNext<int>(230, new[] { 1, 2, 3 }.Sum()),
- OnError<int>(250, ex)
- );
-
- e0.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
-
- e1.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
-
- e2.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Zip_NAry_Enumerable_Simple()
- {
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 1), OnNext(250, 4), OnCompleted<int>(420) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(220, 2), OnNext(240, 5), OnCompleted<int>(410) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(230, 3), OnNext(260, 6), OnCompleted<int>(400) });
-
- var started = default(long);
- var xss = GetSources(() => started = scheduler.Clock, e0, e1, e2).Select(xs => (IObservable<int>)xs);
-
- var res = scheduler.Start(() =>
- Observable.Zip(xss)
- );
-
- Assert.AreEqual(200, started);
-
- res.Messages.AssertEqual(
- OnNext<IList<int>>(230, l => l.SequenceEqual(new[] { 1, 2, 3 })),
- OnNext<IList<int>>(260, l => l.SequenceEqual(new[] { 4, 5, 6 })),
- OnCompleted<IList<int>>(420)
- );
-
- e0.Subscriptions.AssertEqual(
- Subscribe(200, 420)
- );
-
- e1.Subscriptions.AssertEqual(
- Subscribe(200, 410)
- );
-
- e2.Subscriptions.AssertEqual(
- Subscribe(200, 400)
- );
- }
-
- [TestMethod]
- public void Zip_NAry_Enumerable_Throws()
- {
- var ex = new Exception();
- var xss = GetSources(ex, Observable.Return(42));
- var res = Observable.Zip(xss);
-
- ReactiveAssert.Throws(ex, () => res.Subscribe(_ => { }));
- }
-
- private IEnumerable<ITestableObservable<int>> GetSources(Action start, params ITestableObservable<int>[] sources)
- {
- start();
-
- foreach (var xs in sources)
- yield return xs;
- }
-
- private IEnumerable<IObservable<T>> GetSources<T>(Exception ex, params IObservable<T>[] sources)
- {
- foreach (var xs in sources)
- yield return xs;
-
- throw ex;
- }
-
- #endregion
-
- #region AtLeastOneThrows
-
- [TestMethod]
- public void Zip_AtLeastOneThrows4()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var e0 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(210, 1), OnCompleted<int>(400) });
- var e1 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(220, 2), OnCompleted<int>(400) });
- var e2 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnError<int>(230, ex) });
- var e3 = scheduler.CreateHotObservable(new[] { OnNext(150, 1), OnNext(240, 4), OnCompleted<int>(400) });
-
- var res = scheduler.Start(() =>
- Observable.Zip(e0, e1, e2, e3, (_0, _1, _2, _3) => 42)
- );
-
- res.Messages.AssertEqual(
- OnError<int>(230, ex)
- );
-
- e0.Subscriptions.AssertEqual(Subscribe(200, 230));
- e1.Subscriptions.AssertEqual(Subscribe(200, 230));
- e2.Subscriptions.AssertEqual(Subscribe(200, 230));
- e3.Subscriptions.AssertEqual(Subscribe(200, 230));
- }
-
- #endregion
-
- #endregion
- }
-}
diff --git a/Rx.NET/Tests.System.Reactive/Tests/ObservableRemotingTest.cs b/Rx.NET/Tests.System.Reactive/Tests/ObservableRemotingTest.cs
deleted file mode 100644
index abeb921..0000000
--- a/Rx.NET/Tests.System.Reactive/Tests/ObservableRemotingTest.cs
+++ /dev/null
@@ -1,220 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_REMOTING
-
-using System;
-using System.Reactive.Linq;
-using System.Reflection;
-using System.Runtime.Remoting.Lifetime;
-using System.Threading;
-using Microsoft.Reactive.Testing;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-
-namespace ReactiveTests.Tests
-{
- [TestClass]
- public partial class ObservableRemotingTest : ReactiveTest
- {
- [TestMethod]
- public void Remotable_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => RemotingObservable.Remotable(default(IObservable<int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => RemotingObservable.Remotable(default(IObservable<int>), new MyLease()));
-
- ReactiveAssert.Throws<ArgumentNullException>(() => RemotingObservable.Remotable(default(IQbservable<int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => RemotingObservable.Remotable(default(IQbservable<int>), new MyLease()));
-
- RemotingObservable.Remotable(Observable.Return(42));
- RemotingObservable.Remotable(Observable.Return(42), null /* valid lease object */);
-
- RemotingObservable.Remotable(Qbservable.Return(Qbservable.Provider, 42));
- RemotingObservable.Remotable(Qbservable.Return(Qbservable.Provider, 42), null /* valid lease object */);
- }
-
- class MyLease : ILease
- {
- public TimeSpan CurrentLeaseTime
- {
- get { throw new NotImplementedException(); }
- }
-
- public LeaseState CurrentState
- {
- get { throw new NotImplementedException(); }
- }
-
- public TimeSpan InitialLeaseTime
- {
- get
- {
- throw new NotImplementedException();
- }
- set
- {
- throw new NotImplementedException();
- }
- }
-
- public void Register(ISponsor obj)
- {
- throw new NotImplementedException();
- }
-
- public void Register(ISponsor obj, TimeSpan renewalTime)
- {
- throw new NotImplementedException();
- }
-
- public TimeSpan Renew(TimeSpan renewalTime)
- {
- throw new NotImplementedException();
- }
-
- public TimeSpan RenewOnCallTime
- {
- get
- {
- throw new NotImplementedException();
- }
- set
- {
- throw new NotImplementedException();
- }
- }
-
- public TimeSpan SponsorshipTimeout
- {
- get
- {
- throw new NotImplementedException();
- }
- set
- {
- throw new NotImplementedException();
- }
- }
-
- public void Unregister(ISponsor obj)
- {
- throw new NotImplementedException();
- }
- }
-
- [TestMethod]
- public void Remotable_Empty()
- {
- var evt = new ManualResetEvent(false);
-
- var e = GetRemoteObservable(t => t.Empty());
- using (e.Subscribe(_ => { Assert.Fail(); }, _ => { Assert.Fail(); }, () => { evt.Set(); }))
- {
- evt.WaitOne();
- }
- }
-
- [TestMethod]
- public void Remotable_Return()
- {
- var evt = new ManualResetEvent(false);
-
- bool next = false;
- var e = GetRemoteObservable(t => t.Return(42));
- using (e.Subscribe(value => { next = true; Assert.AreEqual(42, value); }, _ => { Assert.Fail(); }, () => { evt.Set(); }))
- {
- evt.WaitOne();
- Assert.IsTrue(next);
- }
- }
-
- [TestMethod]
- public void Remotable_Return_LongLease()
- {
- var evt = new ManualResetEvent(false);
-
- bool next = false;
- var e = GetRemoteObservable(t => t.ReturnLongLease(42));
- using (e.Subscribe(value => { next = true; Assert.AreEqual(42, value); }, _ => { Assert.Fail(); }, () => { evt.Set(); }))
- {
- evt.WaitOne();
- Assert.IsTrue(next);
- }
- }
-
- [TestMethod]
- public void Remotable_Throw()
- {
- var ex = new InvalidOperationException("Oops!");
-
- var evt = new ManualResetEvent(false);
-
- bool error = false;
- var e = GetRemoteObservable(t => t.Throw(ex));
- using (e.Subscribe(value => { Assert.Fail(); }, err => { error = true; Assert.IsTrue(err is InvalidOperationException && err.Message == ex.Message); evt.Set(); }, () => { Assert.Fail(); }))
- {
- evt.WaitOne();
- Assert.IsTrue(error);
- }
- }
-
- [TestMethod]
- public void Remotable_Disposal()
- {
- var test = GetRemoteTestObject();
- test.Disposal().Subscribe().Dispose();
- Assert.IsTrue(test.Disposed);
- }
-
- private IObservable<int> GetRemoteObservable(Func<RemotingTest, IObservable<int>> f)
- {
- var test = GetRemoteTestObject();
- return f(test);
- }
-
- private RemotingTest GetRemoteTestObject()
- {
- var ads = new AppDomainSetup { ApplicationBase = AppDomain.CurrentDomain.BaseDirectory };
- var ad = AppDomain.CreateDomain("test", null, ads);
- var test = (RemotingTest)ad.CreateInstanceAndUnwrap(Assembly.GetExecutingAssembly().FullName, "ReactiveTests.Tests.RemotingTest");
- return test;
- }
- }
-
- public class RemotingTest : MarshalByRefObject
- {
- public override object InitializeLifetimeService()
- {
- return null;
- }
-
- public IObservable<int> Empty()
- {
- return Observable.Empty<int>().Remotable();
- }
-
- public IObservable<int> Return(int value)
- {
- return Observable.Return<int>(value).Remotable();
- }
-
- public IObservable<int> ReturnLongLease(int value)
- {
- return Observable.Return<int>(value).Remotable(null);
- }
-
- public IObservable<int> Throw(Exception ex)
- {
- return Observable.Throw<int>(ex).Remotable();
- }
-
- public IObservable<int> Disposal()
- {
- return Observable.Create<int>(obs =>
- {
- return () => { Disposed = true; };
- }).Remotable();
- }
-
- public bool Disposed { get; set; }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/Tests.System.Reactive/Tests/ObservableSafetyTest.cs b/Rx.NET/Tests.System.Reactive/Tests/ObservableSafetyTest.cs
deleted file mode 100644
index c7d67a4..0000000
--- a/Rx.NET/Tests.System.Reactive/Tests/ObservableSafetyTest.cs
+++ /dev/null
@@ -1,284 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System;
-using System.Reactive;
-using System.Reactive.Concurrency;
-using System.Reactive.Linq;
-using System.Threading;
-using Microsoft.Reactive.Testing;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-
-namespace ReactiveTests.Tests
-{
- [TestClass]
- public partial class ObservableSafetyTest : ReactiveTest
- {
- [TestMethod]
- public void SubscribeSafe_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => ObservableExtensions.SubscribeSafe<int>(default(IObservable<int>), Observer.Create<int>(_ => { })));
- ReactiveAssert.Throws<ArgumentNullException>(() => ObservableExtensions.SubscribeSafe<int>(Observable.Return(42), default(IObserver<int>)));
- }
-
- [TestMethod]
- public void Safety_Subscription1()
- {
- var ex = new Exception();
-
- var xs = new RogueObservable(ex);
- var res = xs.Where(x => true).Select(x => x);
-
- var err = default(Exception);
- var d = res.Subscribe(x => { Assert.Fail(); }, ex_ => { err = ex_; }, () => { Assert.Fail(); });
-
- Assert.AreSame(ex, err);
-
- d.Dispose();
- }
-
- [TestMethod]
- public void Safety_Subscription2()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable<int>(
- OnNext(210, 42),
- OnNext(220, 43),
- OnNext(230, 44),
- OnNext(240, 45),
- OnCompleted<int>(250)
- );
-
- var ys = new RogueObservable(ex);
-
- var res = scheduler.Start(() =>
- xs.Merge(ys)
- );
-
- res.Messages.AssertEqual(
- OnError<int>(200, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 200)
- );
- }
-
- class RogueObservable : IObservable<int>
- {
- private readonly Exception _ex;
-
- public RogueObservable(Exception ex)
- {
- _ex = ex;
- }
-
- public IDisposable Subscribe(IObserver<int> observer)
- {
- throw _ex;
- }
- }
-
- [TestMethod]
- public void ObservableBase_ObserverThrows()
- {
- var ex = new Exception();
-
- var failed = new ManualResetEvent(false);
- var disposed = new ManualResetEvent(false);
- var err = default(Exception);
-
- var xs = Observable.Create<int>(observer =>
- {
- Scheduler.Default.Schedule(() =>
- {
- try
- {
- observer.OnNext(42);
- }
- catch (Exception ex_)
- {
- err = ex_;
- failed.Set();
- }
- });
-
- return () => { disposed.Set(); };
- });
-
- xs.Subscribe(x =>
- {
- throw ex;
- });
-
- // Can't use WaitAll - we're on an STA thread.
- disposed.WaitOne();
- failed.WaitOne();
-
- Assert.AreSame(ex, err);
- }
-
- [TestMethod]
- public void ObservableBase_ObserverThrows_CustomObserver()
- {
- var ex = new Exception();
-
- var failed = new ManualResetEvent(false);
- var disposed = new ManualResetEvent(false);
- var err = default(Exception);
-
- var xs = Observable.Create<int>(observer =>
- {
- Scheduler.Default.Schedule(() =>
- {
- try
- {
- observer.OnNext(42);
- }
- catch (Exception ex_)
- {
- err = ex_;
- failed.Set();
- }
- });
-
- return () => { disposed.Set(); };
- });
-
- xs.Subscribe(new MyObserver(_ => true, ex));
-
- // Can't use WaitAll - we're on an STA thread.
- disposed.WaitOne();
- failed.WaitOne();
-
- Assert.AreSame(ex, err);
- }
-
- [TestMethod]
- public void Producer_ObserverThrows()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable<int>(
- OnNext(210, 1),
- OnNext(220, 2),
- OnNext(230, 3)
- );
-
- var ys = scheduler.CreateHotObservable<int>(
- OnNext(215, 1),
- OnNext(225, 2),
- OnNext(235, 3)
- );
-
- var res = xs.CombineLatest(ys, (x, y) => x + y); // This creates a Producer object
-
- scheduler.ScheduleAbsolute(200, () =>
- {
- res.Subscribe(z =>
- {
- if (z == 4)
- throw ex;
- });
- });
-
- try
- {
- scheduler.Start();
- Assert.Fail();
- }
- catch (Exception err)
- {
- Assert.AreSame(ex, err);
- }
-
- Assert.AreEqual(225, scheduler.Clock);
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 225)
- );
-
- ys.Subscriptions.AssertEqual(
- Subscribe(200, 225)
- );
- }
-
- [TestMethod]
- public void Producer_ObserverThrows_CustomObserver()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable<int>(
- OnNext(210, 1),
- OnNext(220, 2),
- OnNext(230, 3)
- );
-
- var ys = scheduler.CreateHotObservable<int>(
- OnNext(215, 1),
- OnNext(225, 2),
- OnNext(235, 3)
- );
-
- var res = xs.CombineLatest(ys, (x, y) => x + y); // This creates a Producer object
-
- scheduler.ScheduleAbsolute(200, () =>
- {
- res.Subscribe(new MyObserver(x => x == 4, ex));
- });
-
- try
- {
- scheduler.Start();
- Assert.Fail();
- }
- catch (Exception err)
- {
- Assert.AreSame(ex, err);
- }
-
- Assert.AreEqual(225, scheduler.Clock);
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 225)
- );
-
- ys.Subscriptions.AssertEqual(
- Subscribe(200, 225)
- );
- }
-
- class MyObserver : ObserverBase<int>
- {
- private readonly Func<int, bool> _predicate;
- private readonly Exception _exception;
-
- public MyObserver(Func<int, bool> predicate, Exception exception)
- {
- _predicate = predicate;
- _exception = exception;
- }
-
- protected override void OnNextCore(int value)
- {
- if (_predicate(value))
- throw _exception;
- }
-
- protected override void OnErrorCore(Exception error)
- {
- }
-
- protected override void OnCompletedCore()
- {
- }
- }
-
- }
-}
diff --git a/Rx.NET/Tests.System.Reactive/Tests/ObservableSingleTest.cs b/Rx.NET/Tests.System.Reactive/Tests/ObservableSingleTest.cs
deleted file mode 100644
index 7361fed..0000000
--- a/Rx.NET/Tests.System.Reactive/Tests/ObservableSingleTest.cs
+++ /dev/null
@@ -1,4565 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Reactive;
-using System.Reactive.Concurrency;
-using System.Reactive.Linq;
-using Microsoft.Reactive.Testing;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using ReactiveTests.Dummies;
-
-namespace ReactiveTests.Tests
-{
- [TestClass]
- public class ObservableSingleTest : ReactiveTest
- {
- #region + AsObservable +
-
- [TestMethod]
- public void AsObservable_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.AsObservable<int>(null));
- }
-
- [TestMethod]
- public void AsObservable_AsObservable()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(220, 2),
- OnCompleted<int>(250)
- );
-
- var ys = xs.AsObservable().AsObservable();
-
- Assert.AreNotSame(xs, ys);
-
- var res = scheduler.Start(() =>
- ys
- );
-
- res.Messages.AssertEqual(
- OnNext(220, 2),
- OnCompleted<int>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void AsObservable_Hides()
- {
- var xs = Observable.Empty<int>();
-
- var res = xs.AsObservable();
-
- Assert.AreNotSame(xs, res);
- }
-
- [TestMethod]
- public void AsObservable_Never()
- {
- var scheduler = new TestScheduler();
-
- var xs = Observable.Never<int>();
-
- var res = scheduler.Start(() =>
- xs.AsObservable()
- );
-
- res.Messages.AssertEqual(
- );
- }
-
- [TestMethod]
- public void AsObservable_Empty()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.AsObservable()
- );
-
- res.Messages.AssertEqual(
- OnCompleted<int>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void AsObservable_Throw()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnError<int>(250, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.AsObservable()
- );
-
- res.Messages.AssertEqual(
- OnError<int>(250, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void AsObservable_Return()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(220, 2),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.AsObservable()
- );
-
- res.Messages.AssertEqual(
- OnNext(220, 2),
- OnCompleted<int>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void AsObservable_IsNotEager()
- {
- var scheduler = new TestScheduler();
-
- bool subscribed = false;
- var xs = Observable.Create<int>(obs =>
- {
- subscribed = true;
-
- var disp = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(220, 2),
- OnCompleted<int>(250)
- ).Subscribe(obs);
-
- return disp.Dispose;
- });
-
- xs.AsObservable();
- Assert.IsFalse(subscribed);
-
- var res = scheduler.Start(() =>
- xs.AsObservable()
- );
- Assert.IsTrue(subscribed);
- }
-
- #endregion
-
- #region + Buffer +
-
- [TestMethod]
- public void Buffer_Single_ArgumentChecking()
- {
- var someObservable = Observable.Empty<int>();
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Buffer(default(IObservable<int>), 1));
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => Observable.Buffer(someObservable, 0));
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => Observable.Buffer(someObservable, -1));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Buffer(default(IObservable<int>), 1, 1));
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => Observable.Buffer(someObservable, 1, 0));
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => Observable.Buffer(someObservable, 0, 1));
- }
-
- [TestMethod]
- public void Buffer_Count_PartialWindow()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnNext(220, 3),
- OnNext(230, 4),
- OnNext(240, 5),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Buffer(5)
- );
-
- res.Messages.AssertEqual(
- OnNext<IList<int>>(250, l => l.SequenceEqual(new[] { 2, 3, 4, 5 })),
- OnCompleted<IList<int>>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Buffer_Count_FullWindows()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnNext(220, 3),
- OnNext(230, 4),
- OnNext(240, 5),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Buffer(2)
- );
-
- res.Messages.AssertEqual(
- OnNext<IList<int>>(220, l => l.SequenceEqual(new[] { 2, 3 })),
- OnNext<IList<int>>(240, l => l.SequenceEqual(new[] { 4, 5 })),
- OnCompleted<IList<int>>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Buffer_Count_FullAndPartialWindows()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnNext(220, 3),
- OnNext(230, 4),
- OnNext(240, 5),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Buffer(3)
- );
-
- res.Messages.AssertEqual(
- OnNext<IList<int>>(230, l => l.SequenceEqual(new int[] { 2, 3, 4 })),
- OnNext<IList<int>>(250, l => l.SequenceEqual(new int[] { 5 })),
- OnCompleted<IList<int>>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Buffer_Count_Error()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnNext(220, 3),
- OnNext(230, 4),
- OnNext(240, 5),
- OnError<int>(250, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.Buffer(5)
- );
-
- res.Messages.AssertEqual(
- OnError<IList<int>>(250, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Buffer_Count_Skip_Less()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnNext(220, 3),
- OnNext(230, 4),
- OnNext(240, 5),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Buffer(3, 1)
- );
-
- res.Messages.AssertEqual(
- OnNext<IList<int>>(230, l => l.SequenceEqual(new int[] { 2, 3, 4 })),
- OnNext<IList<int>>(240, l => l.SequenceEqual(new int[] { 3, 4, 5 })),
- OnNext<IList<int>>(250, l => l.SequenceEqual(new int[] { 4, 5 })),
- OnNext<IList<int>>(250, l => l.SequenceEqual(new int[] { 5 })),
- OnCompleted<IList<int>>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Buffer_Count_Skip_More()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnNext(220, 3),
- OnNext(230, 4),
- OnNext(240, 5),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Buffer(2, 3)
- );
-
- res.Messages.AssertEqual(
- OnNext<IList<int>>(220, l => l.SequenceEqual(new int[] { 2, 3 })),
- OnNext<IList<int>>(250, l => l.SequenceEqual(new int[] { 5 })),
- OnCompleted<IList<int>>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void BufferWithCount_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Buffer(default(IObservable<int>), 1, 1));
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => Observable.Buffer(DummyObservable<int>.Instance, 0, 1));
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => Observable.Buffer(DummyObservable<int>.Instance, 1, 0));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Buffer(default(IObservable<int>), 1));
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => Observable.Buffer(DummyObservable<int>.Instance, 0));
- }
-
- [TestMethod]
- public void BufferWithCount_Basic()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(100, 1),
- OnNext(210, 2),
- OnNext(240, 3),
- OnNext(280, 4),
- OnNext(320, 5),
- OnNext(350, 6),
- OnNext(380, 7),
- OnNext(420, 8),
- OnNext(470, 9),
- OnCompleted<int>(600)
- );
-
- var res = scheduler.Start(() =>
- xs.Buffer(3, 2).Select(x => string.Join(",", x.Select(xx => xx.ToString()).ToArray()))
- );
-
- res.Messages.AssertEqual(
- OnNext(280, "2,3,4"),
- OnNext(350, "4,5,6"),
- OnNext(420, "6,7,8"),
- OnNext(600, "8,9"),
- OnCompleted<string>(600)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 600)
- );
- }
-
- [TestMethod]
- public void BufferWithCount_Disposed()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(100, 1),
- OnNext(210, 2),
- OnNext(240, 3),
- OnNext(280, 4),
- OnNext(320, 5),
- OnNext(350, 6),
- OnNext(380, 7),
- OnNext(420, 8),
- OnNext(470, 9),
- OnCompleted<int>(600)
- );
-
- var res = scheduler.Start(() =>
- xs.Buffer(3, 2).Select(x => string.Join(",", x.Select(xx => xx.ToString()).ToArray())), 370
- );
-
- res.Messages.AssertEqual(
- OnNext(280, "2,3,4"),
- OnNext(350, "4,5,6")
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 370)
- );
- }
-
- [TestMethod]
- public void BufferWithCount_Error()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(100, 1),
- OnNext(210, 2),
- OnNext(240, 3),
- OnNext(280, 4),
- OnNext(320, 5),
- OnNext(350, 6),
- OnNext(380, 7),
- OnNext(420, 8),
- OnNext(470, 9),
- OnError<int>(600, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.Buffer(3, 2).Select(x => string.Join(",", x.Select(xx => xx.ToString()).ToArray()))
- );
-
- res.Messages.AssertEqual(
- OnNext(280, "2,3,4"),
- OnNext(350, "4,5,6"),
- OnNext(420, "6,7,8"),
- OnError<string>(600, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 600)
- );
- }
-
- [TestMethod]
- public void BufferWithCount_Default()
- {
- Observable.Range(1, 10).Buffer(3).Skip(1).First().AssertEqual(4, 5, 6);
- Observable.Range(1, 10).Buffer(3, 2).Skip(1).First().AssertEqual(3, 4, 5);
- }
-
- #endregion
-
- #region + Dematerialize +
-
- [TestMethod]
- public void Dematerialize_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Dematerialize<int>(null));
- }
-
- [TestMethod]
- public void Dematerialize_Range1()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, Notification.CreateOnNext(41)),
- OnNext(210, Notification.CreateOnNext(42)),
- OnNext(220, Notification.CreateOnNext(43)),
- OnCompleted<Notification<int>>(250)
- );
- var res = scheduler.Start(() =>
- xs.Dematerialize()
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 42),
- OnNext(220, 43),
- OnCompleted<int>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Dematerialize_Range2()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, Notification.CreateOnNext(41)),
- OnNext(210, Notification.CreateOnNext(42)),
- OnNext(220, Notification.CreateOnNext(43)),
- OnNext(230, Notification.CreateOnCompleted<int>())
- );
- var res = scheduler.Start(() =>
- xs.Dematerialize()
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 42),
- OnNext(220, 43),
- OnCompleted<int>(230)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 230)
- );
- }
-
- [TestMethod]
- public void Dematerialize_Error1()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, Notification.CreateOnNext(41)),
- OnNext(210, Notification.CreateOnNext(42)),
- OnNext(220, Notification.CreateOnNext(43)),
- OnError<Notification<int>>(230, ex)
- );
- var res = scheduler.Start(() =>
- xs.Dematerialize()
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 42),
- OnNext(220, 43),
- OnError<int>(230, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 230)
- );
- }
-
- [TestMethod]
- public void Dematerialize_Error2()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, Notification.CreateOnNext(41)),
- OnNext(210, Notification.CreateOnNext(42)),
- OnNext(220, Notification.CreateOnNext(43)),
- OnNext(230, Notification.CreateOnError<int>(ex))
- );
- var res = scheduler.Start(() =>
- xs.Dematerialize()
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 42),
- OnNext(220, 43),
- OnError<int>(230, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 230)
- );
- }
-
- [TestMethod]
- public void Materialize_Dematerialize_Never()
- {
- var scheduler = new TestScheduler();
-
- var xs = Observable.Never<int>();
-
- var res = scheduler.Start(() =>
- xs.Materialize().Dematerialize()
- );
-
- res.Messages.AssertEqual(
- );
- }
-
- [TestMethod]
- public void Materialize_Dematerialize_Empty()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Materialize().Dematerialize()
- );
-
- res.Messages.AssertEqual(
- OnCompleted<int>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Materialize_Dematerialize_Return()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Materialize().Dematerialize()
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 2),
- OnCompleted<int>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Materialize_Dematerialize_Throw()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnError<int>(250, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.Materialize().Dematerialize()
- );
-
- res.Messages.AssertEqual(
- OnError<int>(250, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- #endregion
-
- #region + DistinctUntilChanged +
-
- [TestMethod]
- public void DistinctUntilChanged_ArgumentChecking()
- {
- var someObservable = Observable.Empty<int>();
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.DistinctUntilChanged<int>(null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.DistinctUntilChanged<int>(null, EqualityComparer<int>.Default));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.DistinctUntilChanged<int>(someObservable, null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.DistinctUntilChanged<int, int>(null, _ => _));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.DistinctUntilChanged<int, int>(someObservable, null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.DistinctUntilChanged<int, int>(someObservable, _ => _, null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.DistinctUntilChanged<int, int>(null, _ => _, EqualityComparer<int>.Default));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.DistinctUntilChanged<int, int>(someObservable, null, EqualityComparer<int>.Default));
- }
-
- [TestMethod]
- public void DistinctUntilChanged_Never()
- {
- var scheduler = new TestScheduler();
-
- var xs = Observable.Never<int>();
-
- var res = scheduler.Start(() =>
- xs.DistinctUntilChanged()
- );
-
- res.Messages.AssertEqual(
- );
- }
-
- [TestMethod]
- public void DistinctUntilChanged_Empty()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.DistinctUntilChanged()
- );
-
- res.Messages.AssertEqual(
- OnCompleted<int>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void DistinctUntilChanged_Return()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(220, 2),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.DistinctUntilChanged()
- );
-
- res.Messages.AssertEqual(
- OnNext(220, 2),
- OnCompleted<int>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void DistinctUntilChanged_Throw()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnError<int>(250, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.DistinctUntilChanged()
- );
-
- res.Messages.AssertEqual(
- OnError<int>(250, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void DistinctUntilChanged_AllChanges()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnNext(220, 3),
- OnNext(230, 4),
- OnNext(240, 5),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.DistinctUntilChanged()
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 2),
- OnNext(220, 3),
- OnNext(230, 4),
- OnNext(240, 5),
- OnCompleted<int>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void DistinctUntilChanged_AllSame()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnNext(220, 2),
- OnNext(230, 2),
- OnNext(240, 2),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.DistinctUntilChanged()
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 2),
- OnCompleted<int>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void DistinctUntilChanged_SomeChanges()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2), //*
- OnNext(215, 3), //*
- OnNext(220, 3),
- OnNext(225, 2), //*
- OnNext(230, 2),
- OnNext(230, 1), //*
- OnNext(240, 2), //*
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.DistinctUntilChanged()
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 2),
- OnNext(215, 3),
- OnNext(225, 2),
- OnNext(230, 1),
- OnNext(240, 2),
- OnCompleted<int>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void DistinctUntilChanged_Comparer_AllEqual()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnNext(220, 3),
- OnNext(230, 4),
- OnNext(240, 5),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.DistinctUntilChanged(new FuncComparer<int>((x, y) => true))
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 2),
- OnCompleted<int>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void DistinctUntilChanged_Comparer_AllDifferent()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnNext(220, 2),
- OnNext(230, 2),
- OnNext(240, 2),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.DistinctUntilChanged(new FuncComparer<int>((x, y) => false))
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 2),
- OnNext(220, 2),
- OnNext(230, 2),
- OnNext(240, 2),
- OnCompleted<int>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void DistinctUntilChanged_KeySelector_Div2()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2), //*
- OnNext(220, 4),
- OnNext(230, 3), //*
- OnNext(240, 5),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.DistinctUntilChanged(x => x % 2)
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 2),
- OnNext(230, 3),
- OnCompleted<int>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- class FuncComparer<T> : IEqualityComparer<T>
- {
- private Func<T, T, bool> _equals;
-
- public FuncComparer(Func<T, T, bool> equals)
- {
- _equals = equals;
- }
-
- public bool Equals(T x, T y)
- {
- return _equals(x, y);
- }
-
- public int GetHashCode(T obj)
- {
- return 0;
- }
- }
-
- [TestMethod]
- public void DistinctUntilChanged_KeySelectorThrows()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.DistinctUntilChanged(new Func<int, int>(x => { throw ex; }))
- );
-
- res.Messages.AssertEqual(
- OnError<int>(210, ex)
- );
- }
-
- [TestMethod]
- public void DistinctUntilChanged_ComparerThrows()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnNext(220, 3),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.DistinctUntilChanged(new ThrowComparer<int>(ex))
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 2),
- OnError<int>(220, ex)
- );
- }
-
- class ThrowComparer<T> : IEqualityComparer<T>
- {
- private Exception _ex;
-
- public ThrowComparer(Exception ex)
- {
- _ex = ex;
- }
-
- public bool Equals(T x, T y)
- {
- throw _ex;
- }
-
- public int GetHashCode(T obj)
- {
- return 0;
- }
- }
-
- [TestMethod]
- public void DistinctUntilChanged_KeySelector_Comparer()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2), // * key = 1 % 3 = 1
- OnNext(220, 8), // key = 4 % 3 = 1 same
- OnNext(230, 2), // key = 1 % 3 = 1 same
- OnNext(240, 5), // * key = 2 % 3 = 2
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.DistinctUntilChanged(x => x / 2, new FuncComparer<int>((x, y) => x % 3 == y % 3))
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 2),
- OnNext(240, 5),
- OnCompleted<int>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- #endregion
-
- #region + Do +
-
- [TestMethod]
- public void Do_ArgumentChecking()
- {
- var someObservable = Observable.Empty<int>();
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Do<int>(someObservable, (Action<int>)null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Do<int>(null, _ => { }));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Do<int>(someObservable, x => { }, (Action)null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Do<int>(someObservable, (Action<int>)null, () => { }));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Do<int>(null, x => { }, () => { }));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Do<int>(someObservable, x => { }, (Action<Exception>)null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Do<int>(someObservable, (Action<int>)null, (Exception _) => { }));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Do<int>(null, x => { }, (Exception _) => { }));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Do<int>(someObservable, x => { }, (Exception _) => { }, null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Do<int>(someObservable, x => { }, (Action<Exception>)null, () => { }));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Do<int>(someObservable, (Action<int>)null, (Exception _) => { }, () => { }));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Do<int>(null, x => { }, (Exception _) => { }, () => { }));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Do<int>(null, Observer.Create<int>(i => { })));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Do<int>(someObservable, default(IObserver<int>)));
- }
-
- [TestMethod]
- public void Do_ShouldSeeAllValues()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnNext(220, 3),
- OnNext(230, 4),
- OnNext(240, 5),
- OnCompleted<int>(250)
- );
-
- int i = 0;
- int sum = 2 + 3 + 4 + 5;
- var res = scheduler.Start(() =>
- xs.Do(x => { i++; sum -= x; })
- );
-
- Assert.AreEqual(4, i);
- Assert.AreEqual(0, sum);
-
- res.Messages.AssertEqual(
- OnNext(210, 2),
- OnNext(220, 3),
- OnNext(230, 4),
- OnNext(240, 5),
- OnCompleted<int>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Do_PlainAction()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnNext(220, 3),
- OnNext(230, 4),
- OnNext(240, 5),
- OnCompleted<int>(250)
- );
-
- int i = 0;
- var res = scheduler.Start(() =>
- xs.Do(_ => { i++; })
- );
-
- Assert.AreEqual(4, i);
-
- res.Messages.AssertEqual(
- OnNext(210, 2),
- OnNext(220, 3),
- OnNext(230, 4),
- OnNext(240, 5),
- OnCompleted<int>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Do_NextCompleted()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnNext(220, 3),
- OnNext(230, 4),
- OnNext(240, 5),
- OnCompleted<int>(250)
- );
-
- int i = 0;
- int sum = 2 + 3 + 4 + 5;
- bool completed = false;
- var res = scheduler.Start(() =>
- xs.Do(x => { i++; sum -= x; }, () => { completed = true; })
- );
-
- Assert.AreEqual(4, i);
- Assert.AreEqual(0, sum);
- Assert.IsTrue(completed);
-
- res.Messages.AssertEqual(
- OnNext(210, 2),
- OnNext(220, 3),
- OnNext(230, 4),
- OnNext(240, 5),
- OnCompleted<int>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Do_NextCompleted_Never()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable<int>();
-
- int i = 0;
- bool completed = false;
- var res = scheduler.Start(() =>
- xs.Do(x => { i++; }, () => { completed = true; })
- );
-
- Assert.AreEqual(0, i);
- Assert.IsFalse(completed);
-
- res.Messages.AssertEqual(
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
- }
-
- [TestMethod]
- public void Do_NextError()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnNext(220, 3),
- OnNext(230, 4),
- OnNext(240, 5),
- OnError<int>(250, ex)
- );
-
- int i = 0;
- int sum = 2 + 3 + 4 + 5;
- bool sawError = false;
- var res = scheduler.Start(() =>
- xs.Do(x => { i++; sum -= x; }, e => { sawError = e == ex; })
- );
-
- Assert.AreEqual(4, i);
- Assert.AreEqual(0, sum);
- Assert.IsTrue(sawError);
-
- res.Messages.AssertEqual(
- OnNext(210, 2),
- OnNext(220, 3),
- OnNext(230, 4),
- OnNext(240, 5),
- OnError<int>(250, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Do_NextErrorNot()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnNext(220, 3),
- OnNext(230, 4),
- OnNext(240, 5),
- OnCompleted<int>(250)
- );
-
- int i = 0;
- int sum = 2 + 3 + 4 + 5;
- bool sawError = false;
- var res = scheduler.Start(() =>
- xs.Do(x => { i++; sum -= x; }, _ => { sawError = true; })
- );
-
- Assert.AreEqual(4, i);
- Assert.AreEqual(0, sum);
- Assert.IsFalse(sawError);
-
- res.Messages.AssertEqual(
- OnNext(210, 2),
- OnNext(220, 3),
- OnNext(230, 4),
- OnNext(240, 5),
- OnCompleted<int>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Do_NextErrorCompleted()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnNext(220, 3),
- OnNext(230, 4),
- OnNext(240, 5),
- OnCompleted<int>(250)
- );
-
- int i = 0;
- int sum = 2 + 3 + 4 + 5;
- bool sawError = false;
- bool hasCompleted = false;
- var res = scheduler.Start(() =>
- xs.Do(x => { i++; sum -= x; }, e => { sawError = true; }, () => { hasCompleted = true; })
- );
-
- Assert.AreEqual(4, i);
- Assert.AreEqual(0, sum);
- Assert.IsFalse(sawError);
- Assert.IsTrue(hasCompleted);
-
- res.Messages.AssertEqual(
- OnNext(210, 2),
- OnNext(220, 3),
- OnNext(230, 4),
- OnNext(240, 5),
- OnCompleted<int>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Do_NextErrorCompletedError()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnNext(220, 3),
- OnNext(230, 4),
- OnNext(240, 5),
- OnError<int>(250, ex)
- );
-
- int i = 0;
- int sum = 2 + 3 + 4 + 5;
- bool sawError = false;
- bool hasCompleted = false;
- var res = scheduler.Start(() =>
- xs.Do(x => { i++; sum -= x; }, e => { sawError = e == ex; }, () => { hasCompleted = true; })
- );
-
- Assert.AreEqual(4, i);
- Assert.AreEqual(0, sum);
- Assert.IsTrue(sawError);
- Assert.IsFalse(hasCompleted);
-
- res.Messages.AssertEqual(
- OnNext(210, 2),
- OnNext(220, 3),
- OnNext(230, 4),
- OnNext(240, 5),
- OnError<int>(250, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Do_NextErrorCompletedNever()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable<int>();
-
- int i = 0;
- bool sawError = false;
- bool hasCompleted = false;
- var res = scheduler.Start(() =>
- xs.Do(x => { i++; }, e => { sawError = true; }, () => { hasCompleted = true; })
- );
-
- Assert.AreEqual(0, i);
- Assert.IsFalse(sawError);
- Assert.IsFalse(hasCompleted);
-
- res.Messages.AssertEqual(
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
- }
-
- [TestMethod]
- public void Do_Observer_SomeDataWithError()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnNext(220, 3),
- OnNext(230, 4),
- OnNext(240, 5),
- OnError<int>(250, ex)
- );
-
- int i = 0;
- int sum = 2 + 3 + 4 + 5;
- bool sawError = false;
- bool hasCompleted = false;
- var res = scheduler.Start(() =>
- xs.Do(Observer.Create<int>(x => { i++; sum -= x; }, e => { sawError = e == ex; }, () => { hasCompleted = true; }))
- );
-
- Assert.AreEqual(4, i);
- Assert.AreEqual(0, sum);
- Assert.IsTrue(sawError);
- Assert.IsFalse(hasCompleted);
-
- res.Messages.AssertEqual(
- OnNext(210, 2),
- OnNext(220, 3),
- OnNext(230, 4),
- OnNext(240, 5),
- OnError<int>(250, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Do_Observer_SomeDataWithoutError()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnNext(220, 3),
- OnNext(230, 4),
- OnNext(240, 5),
- OnCompleted<int>(250)
- );
-
- int i = 0;
- int sum = 2 + 3 + 4 + 5;
- bool sawError = false;
- bool hasCompleted = false;
- var res = scheduler.Start(() =>
- xs.Do(Observer.Create<int>(x => { i++; sum -= x; }, e => { sawError = true; }, () => { hasCompleted = true; }))
- );
-
- Assert.AreEqual(4, i);
- Assert.AreEqual(0, sum);
- Assert.IsFalse(sawError);
- Assert.IsTrue(hasCompleted);
-
- res.Messages.AssertEqual(
- OnNext(210, 2),
- OnNext(220, 3),
- OnNext(230, 4),
- OnNext(240, 5),
- OnCompleted<int>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Do1422_Next_NextThrows()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Do(x => { throw ex; })
- );
-
- res.Messages.AssertEqual(
- OnError<int>(210, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void Do1422_NextCompleted_NextThrows()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Do(x => { throw ex; }, () => { })
- );
-
- res.Messages.AssertEqual(
- OnError<int>(210, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void Do1422_NextCompleted_CompletedThrows()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Do(x => { }, () => { throw ex; })
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 2),
- OnError<int>(250, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Do1422_NextError_NextThrows()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Do(x => { throw ex; }, _ => { })
- );
-
- res.Messages.AssertEqual(
- OnError<int>(210, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void Do1422_NextError_ErrorThrows()
- {
- var scheduler = new TestScheduler();
-
- var ex1 = new Exception();
- var ex2 = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnError<int>(210, ex1)
- );
-
- var res = scheduler.Start(() =>
- xs.Do(x => { }, _ => { throw ex2; })
- );
-
- res.Messages.AssertEqual(
- OnError<int>(210, ex2)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void Do1422_NextErrorCompleted_NextThrows()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Do(x => { throw ex; }, _ => { }, () => { })
- );
-
- res.Messages.AssertEqual(
- OnError<int>(210, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void Do1422_NextErrorCompleted_ErrorThrows()
- {
- var scheduler = new TestScheduler();
-
- var ex1 = new Exception();
- var ex2 = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnError<int>(210, ex1)
- );
-
- var res = scheduler.Start(() =>
- xs.Do(x => { }, _ => { throw ex2; }, () => { })
- );
-
- res.Messages.AssertEqual(
- OnError<int>(210, ex2)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void Do1422_NextErrorCompleted_CompletedThrows()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Do(x => { }, _ => { }, () => { throw ex; })
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 2),
- OnError<int>(250, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Do1422_Observer_NextThrows()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Do(Observer.Create<int>(x => { throw ex; }, _ => { }, () => { }))
- );
-
- res.Messages.AssertEqual(
- OnError<int>(210, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void Do1422_Observer_ErrorThrows()
- {
- var scheduler = new TestScheduler();
-
- var ex1 = new Exception();
- var ex2 = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnError<int>(210, ex1)
- );
-
- var res = scheduler.Start(() =>
- xs.Do(Observer.Create<int>(x => { }, _ => { throw ex2; }, () => { }))
- );
-
- res.Messages.AssertEqual(
- OnError<int>(210, ex2)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void Do1422_Observer_CompletedThrows()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Do(Observer.Create<int>(x => { }, _ => { }, () => { throw ex; }))
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 2),
- OnError<int>(250, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- #endregion
-
- #region + Finally +
-
- [TestMethod]
- public void Finally_ArgumentChecking()
- {
- var someObservable = Observable.Empty<int>();
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Finally<int>(null, () => { }));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Finally<int>(someObservable, null));
- }
-
- [TestMethod]
- public void Finally_Never()
- {
- var scheduler = new TestScheduler();
-
- bool invoked = false;
- var res = scheduler.Start(() =>
- Observable.Never<int>().Finally(() => { invoked = true; })
- );
-
- res.Messages.AssertEqual(
- );
-
- Assert.IsTrue(invoked); // due to unsubscribe; see 1356
- }
-
- [TestMethod]
- public void Finally_OnlyCalledOnce_Never()
- {
- int invokeCount = 0;
- var someObservable = Observable.Never<int>().Finally(() => { invokeCount++; });
- var d = someObservable.Subscribe();
- d.Dispose();
- d.Dispose();
-
- Assert.AreEqual(1, invokeCount);
- }
-
- [TestMethod]
- public void Finally_OnlyCalledOnce_Empty()
- {
- var invokeCount = 0;
- var someObservable = Observable.Empty<int>().Finally(() => { invokeCount++; });
- var d = someObservable.Subscribe();
- d.Dispose();
- d.Dispose();
-
- Assert.AreEqual(1, invokeCount);
- }
-
- [TestMethod]
- public void Finally_Empty()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnCompleted<int>(250)
- );
-
- var invoked = false;
- var res = scheduler.Start(() =>
- xs.Finally(() => { invoked = true; })
- );
-
- Assert.IsTrue(invoked);
-
- res.Messages.AssertEqual(
- OnCompleted<int>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Finally_Return()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnCompleted<int>(250)
- );
-
- var invoked = false;
- var res = scheduler.Start(() =>
- xs.Finally(() => { invoked = true; })
- );
-
- Assert.IsTrue(invoked);
-
- res.Messages.AssertEqual(
- OnNext(210, 2),
- OnCompleted<int>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Finally_Throw()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnError<int>(250, ex)
- );
-
- var invoked = false;
- var res = scheduler.Start(() =>
- xs.Finally(() => { invoked = true; })
- );
-
- Assert.IsTrue(invoked);
-
- res.Messages.AssertEqual(
- OnError<int>(250, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- #endregion
-
- #region + IgnoreElements +
-
- [TestMethod]
- public void IgnoreElements_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.IgnoreElements<int>(null));
- }
-
- [TestMethod]
- public void IgnoreElements_IgnoreElements()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(180, 1),
- OnNext(210, 2),
- OnNext(250, 3),
- OnNext(270, 4),
- OnCompleted<int>(300)
- );
-
- var res = scheduler.Start(() =>
- xs.IgnoreElements().IgnoreElements()
- );
-
- res.Messages.AssertEqual(
- OnCompleted<int>(300)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 300)
- );
- }
-
- [TestMethod]
- public void IgnoreElements_Basic()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(180, 1),
- OnNext(210, 2),
- OnNext(250, 3),
- OnNext(270, 4),
- OnNext(310, 5),
- OnNext(360, 6),
- OnNext(380, 7),
- OnNext(410, 8),
- OnNext(590, 9)
- );
-
- var res = scheduler.Start(() =>
- xs.IgnoreElements()
- );
-
- res.Messages.AssertEqual(
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
- }
-
- [TestMethod]
- public void IgnoreElements_Completed()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(180, 1),
- OnNext(210, 2),
- OnNext(250, 3),
- OnNext(270, 4),
- OnNext(310, 5),
- OnNext(360, 6),
- OnNext(380, 7),
- OnNext(410, 8),
- OnNext(590, 9),
- OnCompleted<int>(610)
- );
-
- var res = scheduler.Start(() =>
- xs.IgnoreElements()
- );
-
- res.Messages.AssertEqual(
- OnCompleted<int>(610)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 610)
- );
- }
-
- [TestMethod]
- public void IgnoreElements_Error()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(180, 1),
- OnNext(210, 2),
- OnNext(250, 3),
- OnNext(270, 4),
- OnNext(310, 5),
- OnNext(360, 6),
- OnNext(380, 7),
- OnNext(410, 8),
- OnNext(590, 9),
- OnError<int>(610, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.IgnoreElements()
- );
-
- res.Messages.AssertEqual(
- OnError<int>(610, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 610)
- );
- }
-
- #endregion
-
- #region + Materialize +
-
- [TestMethod]
- public void Materialize_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Materialize<int>(null));
- }
-
- [TestMethod]
- public void Materialize_Never()
- {
- var scheduler = new TestScheduler();
- var res = scheduler.Start(() =>
- Observable.Never<int>().Materialize()
- );
-
- res.Messages.AssertEqual(
- );
- }
-
- [TestMethod]
- public void Materialize_Empty()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Materialize()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, Notification.CreateOnCompleted<int>()),
- OnCompleted<Notification<int>>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Materialize_Return()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Materialize()
- );
-
- res.Messages.AssertEqual(
- OnNext(210, Notification.CreateOnNext(2)),
- OnNext(250, Notification.CreateOnCompleted<int>()),
- OnCompleted<Notification<int>>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Materialize_Throw()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnError<int>(250, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.Materialize()
- );
-
- res.Messages.AssertEqual(
- OnNext(250, Notification.CreateOnError<int>(ex)),
- OnCompleted<Notification<int>>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- #endregion
-
- #region - Repeat -
-
- [TestMethod]
- public void Repeat_Observable_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Repeat<int>(null));
- ReactiveAssert.Throws<ArgumentNullException>(() => DummyObservable<int>.Instance.Repeat().Subscribe(null));
- }
-
- [TestMethod]
- public void Repeat_Observable_Basic()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateColdObservable(
- OnNext(100, 1),
- OnNext(150, 2),
- OnNext(200, 3),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Repeat()
- );
-
- res.Messages.AssertEqual(
- OnNext(300, 1),
- OnNext(350, 2),
- OnNext(400, 3),
- OnNext(550, 1),
- OnNext(600, 2),
- OnNext(650, 3),
- OnNext(800, 1),
- OnNext(850, 2),
- OnNext(900, 3)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 450),
- Subscribe(450, 700),
- Subscribe(700, 950),
- Subscribe(950, 1000)
- );
- }
-
- [TestMethod]
- public void Repeat_Observable_Infinite()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateColdObservable(
- OnNext(100, 1),
- OnNext(150, 2),
- OnNext(200, 3)
- );
-
- var res = scheduler.Start(() =>
- xs.Repeat()
- );
-
- res.Messages.AssertEqual(
- OnNext(300, 1),
- OnNext(350, 2),
- OnNext(400, 3)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
- }
-
- [TestMethod]
- public void Repeat_Observable_Error()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateColdObservable(
- OnNext(100, 1),
- OnNext(150, 2),
- OnNext(200, 3),
- OnError<int>(250, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.Repeat()
- );
-
- res.Messages.AssertEqual(
- OnNext(300, 1),
- OnNext(350, 2),
- OnNext(400, 3),
- OnError<int>(450, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 450)
- );
- }
-
- [TestMethod]
- public void Repeat_Observable_Throws()
- {
- var scheduler1 = new TestScheduler();
-
- var xs = Observable.Return(1, scheduler1).Repeat();
-
- xs.Subscribe(x => { throw new InvalidOperationException(); });
-
- ReactiveAssert.Throws<InvalidOperationException>(() => scheduler1.Start());
-
- var scheduler2 = new TestScheduler();
-
- var ys = Observable.Throw<int>(new Exception(), scheduler2).Repeat();
-
- ys.Subscribe(x => { }, ex => { throw new InvalidOperationException(); });
-
- ReactiveAssert.Throws<InvalidOperationException>(() => scheduler2.Start());
-
- var scheduler3 = new TestScheduler();
-
- var zs = Observable.Return(1, scheduler3).Repeat();
-
- var d = zs.Subscribe(x => { }, ex => { }, () => { throw new InvalidOperationException(); });
-
- scheduler3.ScheduleAbsolute(210, () => d.Dispose());
-
- scheduler3.Start();
-
- var xss = Observable.Create<int>(new Func<IObserver<int>, Action>(o => { throw new InvalidOperationException(); })).Repeat();
-
- ReactiveAssert.Throws<InvalidOperationException>(() => xss.Subscribe());
- }
-
- [TestMethod]
- public void Repeat_Observable_Default_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Repeat<int>((IObservable<int>)null));
- ReactiveAssert.Throws<ArgumentNullException>(() => DummyObservable<int>.Instance.Repeat().Subscribe(null));
- }
-
- [TestMethod]
- public void Repeat_Observable_RepeatCount_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Repeat<int>(null, 0));
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => DummyObservable<int>.Instance.Repeat(-1));
- ReactiveAssert.Throws<ArgumentNullException>(() => DummyObservable<int>.Instance.Repeat(0).Subscribe(null));
- }
-
- [TestMethod]
- public void Repeat_Observable_RepeatCount_Basic()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateColdObservable(
- OnNext(5, 1),
- OnNext(10, 2),
- OnNext(15, 3),
- OnCompleted<int>(20)
- );
-
- var res = scheduler.Start(() =>
- xs.Repeat(3)
- );
-
- res.Messages.AssertEqual(
- OnNext(205, 1),
- OnNext(210, 2),
- OnNext(215, 3),
- OnNext(225, 1),
- OnNext(230, 2),
- OnNext(235, 3),
- OnNext(245, 1),
- OnNext(250, 2),
- OnNext(255, 3),
- OnCompleted<int>(260)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 220),
- Subscribe(220, 240),
- Subscribe(240, 260)
- );
- }
-
- [TestMethod]
- public void Repeat_Observable_RepeatCount_Dispose()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateColdObservable(
- OnNext(5, 1),
- OnNext(10, 2),
- OnNext(15, 3),
- OnCompleted<int>(20)
- );
-
- var res = scheduler.Start(() =>
- xs.Repeat(3), 231
- );
-
- res.Messages.AssertEqual(
- OnNext(205, 1),
- OnNext(210, 2),
- OnNext(215, 3),
- OnNext(225, 1),
- OnNext(230, 2)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 220),
- Subscribe(220, 231)
- );
- }
-
- [TestMethod]
- public void Repeat_Observable_RepeatCount_Infinite()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateColdObservable(
- OnNext(100, 1),
- OnNext(150, 2),
- OnNext(200, 3)
- );
-
- var res = scheduler.Start(() =>
- xs.Repeat(3)
- );
-
- res.Messages.AssertEqual(
- OnNext(300, 1),
- OnNext(350, 2),
- OnNext(400, 3)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
- }
-
- [TestMethod]
- public void Repeat_Observable_RepeatCount_Error()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateColdObservable(
- OnNext(100, 1),
- OnNext(150, 2),
- OnNext(200, 3),
- OnError<int>(250, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.Repeat(3)
- );
-
- res.Messages.AssertEqual(
- OnNext(300, 1),
- OnNext(350, 2),
- OnNext(400, 3),
- OnError<int>(450, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 450)
- );
- }
-
- [TestMethod]
- public void Repeat_Observable_RepeatCount_Throws()
- {
- var scheduler1 = new TestScheduler();
-
- var xs = Observable.Return(1, scheduler1).Repeat(3);
-
- xs.Subscribe(x => { throw new InvalidOperationException(); });
-
- ReactiveAssert.Throws<InvalidOperationException>(() => scheduler1.Start());
-
- var scheduler2 = new TestScheduler();
-
- var ys = Observable.Throw<int>(new Exception(), scheduler2).Repeat(3);
-
- ys.Subscribe(x => { }, ex => { throw new InvalidOperationException(); });
-
- ReactiveAssert.Throws<InvalidOperationException>(() => scheduler2.Start());
-
- var scheduler3 = new TestScheduler();
-
- var zs = Observable.Return(1, scheduler3).Repeat(100);
-
- var d = zs.Subscribe(x => { }, ex => { }, () => { throw new InvalidOperationException(); });
-
- scheduler3.ScheduleAbsolute(10, () => d.Dispose());
-
- scheduler3.Start();
-
- var xss = Observable.Create<int>(new Func<IObserver<int>, Action>(o => { throw new InvalidOperationException(); })).Repeat(3);
-
- ReactiveAssert.Throws<InvalidOperationException>(() => xss.Subscribe());
- }
-
- [TestMethod]
- public void Repeat_Observable_RepeatCount_Default_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Repeat<int>(default(IObservable<int>), 0));
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => DummyObservable<int>.Instance.Repeat(-1));
- ReactiveAssert.Throws<ArgumentNullException>(() => DummyObservable<int>.Instance.Repeat(0).Subscribe(null));
- }
-
- #endregion
-
- #region - Retry -
-
- [TestMethod]
- public void Retry_Observable_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Retry<int>(null));
- ReactiveAssert.Throws<ArgumentNullException>(() => DummyObservable<int>.Instance.Retry().Subscribe(null));
- }
-
- [TestMethod]
- public void Retry_Observable_Basic()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateColdObservable(
- OnNext(100, 1),
- OnNext(150, 2),
- OnNext(200, 3),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Retry()
- );
-
- res.Messages.AssertEqual(
- OnNext(300, 1),
- OnNext(350, 2),
- OnNext(400, 3),
- OnCompleted<int>(450)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 450)
- );
- }
-
- [TestMethod]
- public void Retry_Observable_Infinite()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateColdObservable(
- OnNext(100, 1),
- OnNext(150, 2),
- OnNext(200, 3)
- );
-
- var res = scheduler.Start(() =>
- xs.Retry()
- );
-
- res.Messages.AssertEqual(
- OnNext(300, 1),
- OnNext(350, 2),
- OnNext(400, 3)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
- }
-
- [TestMethod]
- public void Retry_Observable_Error()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateColdObservable(
- OnNext(100, 1),
- OnNext(150, 2),
- OnNext(200, 3),
- OnError<int>(250, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.Retry(), 1100
- );
-
- res.Messages.AssertEqual(
- OnNext(300, 1),
- OnNext(350, 2),
- OnNext(400, 3),
- OnNext(550, 1),
- OnNext(600, 2),
- OnNext(650, 3),
- OnNext(800, 1),
- OnNext(850, 2),
- OnNext(900, 3),
- OnNext(1050, 1)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 450),
- Subscribe(450, 700),
- Subscribe(700, 950),
- Subscribe(950, 1100)
- );
- }
-
- [TestMethod]
- public void Retry_Observable_Throws1()
- {
- var scheduler1 = new TestScheduler();
-
- var xs = Observable.Return(1, scheduler1).Retry();
-
- xs.Subscribe(x => { throw new InvalidOperationException(); });
-
- ReactiveAssert.Throws<InvalidOperationException>(() => scheduler1.Start());
- }
-
- [TestMethod]
- public void Retry_Observable_Throws2()
- {
- var scheduler2 = new TestScheduler();
-
- var ys = Observable.Throw<int>(new Exception(), scheduler2).Retry();
-
- var d = ys.Subscribe(x => { }, ex => { throw new InvalidOperationException(); });
-
- scheduler2.ScheduleAbsolute(210, () => d.Dispose());
-
- scheduler2.Start();
- }
-
- [TestMethod]
- public void Retry_Observable_Throws3()
- {
- var scheduler3 = new TestScheduler();
-
- var zs = Observable.Return(1, scheduler3).Retry();
-
- zs.Subscribe(x => { }, ex => { }, () => { throw new InvalidOperationException(); });
-
- ReactiveAssert.Throws<InvalidOperationException>(() => scheduler3.Start());
- }
-
- /*
- * BREAKING CHANGE v2.0 > v1.x - The code below will loop endlessly, trying to repeat the failing subscription,
- * whose exception is propagated through OnError starting from v2.0.
- *
- [TestMethod]
- public void Retry_Observable_Throws4()
- {
- var xss = Observable.Create<int>(new Func<IObserver<int>, Action>(o => { throw new InvalidOperationException(); })).Retry();
-
- ReactiveAssert.Throws<InvalidOperationException>(() => xss.Subscribe());
- }
- */
-
- [TestMethod]
- public void Retry_Observable_Default_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Retry<int>((IObservable<int>)null));
- ReactiveAssert.Throws<ArgumentNullException>(() => DummyObservable<int>.Instance.Retry().Subscribe(null));
- }
-
- [TestMethod]
- public void Retry_Observable_RetryCount_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Retry<int>(null, 0));
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => DummyObservable<int>.Instance.Retry(-1));
- ReactiveAssert.Throws<ArgumentNullException>(() => DummyObservable<int>.Instance.Retry(0).Subscribe(null));
- }
-
- [TestMethod]
- public void Retry_Observable_RetryCount_Basic()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateColdObservable(
- OnNext(5, 1),
- OnNext(10, 2),
- OnNext(15, 3),
- OnError<int>(20, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.Retry(3)
- );
-
- res.Messages.AssertEqual(
- OnNext(205, 1),
- OnNext(210, 2),
- OnNext(215, 3),
- OnNext(225, 1),
- OnNext(230, 2),
- OnNext(235, 3),
- OnNext(245, 1),
- OnNext(250, 2),
- OnNext(255, 3),
- OnError<int>(260, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 220),
- Subscribe(220, 240),
- Subscribe(240, 260)
- );
- }
-
- [TestMethod]
- public void Retry_Observable_RetryCount_Dispose()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateColdObservable(
- OnNext(5, 1),
- OnNext(10, 2),
- OnNext(15, 3),
- OnError<int>(20, new Exception())
- );
-
- var res = scheduler.Start(() =>
- xs.Retry(3), 231
- );
-
- res.Messages.AssertEqual(
- OnNext(205, 1),
- OnNext(210, 2),
- OnNext(215, 3),
- OnNext(225, 1),
- OnNext(230, 2)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 220),
- Subscribe(220, 231)
- );
- }
-
- [TestMethod]
- public void Retry_Observable_RetryCount_Infinite()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateColdObservable(
- OnNext(100, 1),
- OnNext(150, 2),
- OnNext(200, 3)
- );
-
- var res = scheduler.Start(() =>
- xs.Retry(3)
- );
-
- res.Messages.AssertEqual(
- OnNext(300, 1),
- OnNext(350, 2),
- OnNext(400, 3)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
- }
-
- [TestMethod]
- public void Retry_Observable_RetryCount_Completed()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateColdObservable(
- OnNext(100, 1),
- OnNext(150, 2),
- OnNext(200, 3),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Retry(3)
- );
-
- res.Messages.AssertEqual(
- OnNext(300, 1),
- OnNext(350, 2),
- OnNext(400, 3),
- OnCompleted<int>(450)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 450)
- );
- }
-
- [TestMethod]
- public void Retry_Observable_RetryCount_Throws()
- {
- var scheduler1 = new TestScheduler();
-
- var xs = Observable.Return(1, scheduler1).Retry(3);
-
- xs.Subscribe(x => { throw new InvalidOperationException(); });
-
- ReactiveAssert.Throws<InvalidOperationException>(() => scheduler1.Start());
-
- var scheduler2 = new TestScheduler();
-
- var ys = Observable.Throw<int>(new Exception(), scheduler2).Retry(100);
-
- var d = ys.Subscribe(x => { }, ex => { throw new InvalidOperationException(); });
-
- scheduler2.ScheduleAbsolute(10, () => d.Dispose());
-
- scheduler2.Start();
-
- var scheduler3 = new TestScheduler();
-
- var zs = Observable.Return(1, scheduler3).Retry(100);
-
- zs.Subscribe(x => { }, ex => { }, () => { throw new InvalidOperationException(); });
-
- ReactiveAssert.Throws<InvalidOperationException>(() => scheduler3.Start());
-
- var xss = Observable.Create<int>(new Func<IObserver<int>, Action>(o => { throw new InvalidOperationException(); })).Retry(3);
-
- ReactiveAssert.Throws<InvalidOperationException>(() => xss.Subscribe());
- }
-
- [TestMethod]
- public void Retry_Observable_RetryCount_Default_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Retry<int>(default(IObservable<int>), 0));
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => DummyObservable<int>.Instance.Retry(-1));
- ReactiveAssert.Throws<ArgumentNullException>(() => DummyObservable<int>.Instance.Retry(0).Subscribe(null));
- }
-
- [TestMethod]
- public void Retry_Observable_RetryCount_Default()
- {
- Observable.Range(1, 3).Retry(3).AssertEqual(Observable.Range(1, 3).Retry(3));
- }
-
- #endregion
-
- #region + Scan +
-
- [TestMethod]
- public void Scan_ArgumentChecking()
- {
- var someObservable = Observable.Empty<int>();
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Scan<int>(null, (_, __) => 0));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Scan<int>(someObservable, null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Scan<int, int>(null, 0, (_, __) => 0));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Scan<int, int>(someObservable, 0, null));
- }
-
- [TestMethod]
- public void Scan_Seed_Never()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable<int>();
-
- var seed = 42;
- var res = scheduler.Start(() =>
- xs.Scan(seed, (acc, x) => acc + x)
- );
-
- res.Messages.AssertEqual(
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
- }
-
- [TestMethod]
- public void Scan_Seed_Empty()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnCompleted<int>(250)
- );
-
- var seed = 42;
- var res = scheduler.Start(() =>
- xs.Scan(seed, (acc, x) => acc + x)
- );
-
- res.Messages.AssertEqual(
- OnCompleted<int>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Scan_Seed_Return()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(220, 2),
- OnCompleted<int>(250)
- );
-
- var seed = 42;
- var res = scheduler.Start(() =>
- xs.Scan(seed, (acc, x) => acc + x)
- );
-
- res.Messages.AssertEqual(
- OnNext(220, seed + 2),
- OnCompleted<int>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Scan_Seed_Throw()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnError<int>(250, ex)
- );
-
- var seed = 42;
- var res = scheduler.Start(() =>
- xs.Scan(seed, (acc, x) => acc + x)
- );
-
- res.Messages.AssertEqual(
- OnError<int>(250, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Scan_Seed_SomeData()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnNext(220, 3),
- OnNext(230, 4),
- OnNext(240, 5),
- OnCompleted<int>(250)
- );
-
- var seed = 1;
- var res = scheduler.Start(() =>
- xs.Scan(seed, (acc, x) => acc + x)
- );
-
- res.Messages.AssertEqual(
- OnNext(210, seed + 2),
- OnNext(220, seed + 2 + 3),
- OnNext(230, seed + 2 + 3 + 4),
- OnNext(240, seed + 2 + 3 + 4 + 5),
- OnCompleted<int>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Scan_Seed_AccumulatorThrows()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnNext(220, 3),
- OnNext(230, 4),
- OnNext(240, 5),
- OnCompleted<int>(250)
- );
-
- var ex = new Exception();
- var seed = 1;
- var res = scheduler.Start(() =>
- xs.Scan(seed, (acc, x) => { if (x == 4) throw ex; return acc + x; })
- );
-
- res.Messages.AssertEqual(
- OnNext(210, seed + 2),
- OnNext(220, seed + 2 + 3),
- OnError<int>(230, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 230)
- );
- }
-
- [TestMethod]
- public void Scan_NoSeed_Never()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable<int>();
-
- var res = scheduler.Start(() =>
- xs.Scan((acc, x) => acc + x)
- );
-
- res.Messages.AssertEqual(
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
- }
-
- [TestMethod]
- public void Scan_NoSeed_Empty()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Scan((acc, x) => acc + x)
- );
-
- res.Messages.AssertEqual(
- OnCompleted<int>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Scan_NoSeed_Return()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(220, 2),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Scan((acc, x) => acc + x)
- );
-
- res.Messages.AssertEqual(
- OnNext(220, 2),
- OnCompleted<int>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Scan_NoSeed_Throw()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnError<int>(250, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.Scan((acc, x) => acc + x)
- );
-
- res.Messages.AssertEqual(
- OnError<int>(250, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Scan_NoSeed_SomeData()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnNext(220, 3),
- OnNext(230, 4),
- OnNext(240, 5),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.Scan((acc, x) => acc + x)
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 2),
- OnNext(220, 2 + 3),
- OnNext(230, 2 + 3 + 4),
- OnNext(240, 2 + 3 + 4 + 5),
- OnCompleted<int>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Scan_NoSeed_AccumulatorThrows()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnNext(220, 3),
- OnNext(230, 4),
- OnNext(240, 5),
- OnCompleted<int>(250)
- );
-
- var ex = new Exception();
- var res = scheduler.Start(() =>
- xs.Scan((acc, x) => { if (x == 4) throw ex; return acc + x; })
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 2),
- OnNext(220, 2 + 3),
- OnError<int>(230, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 230)
- );
- }
-
- #endregion
-
- #region + SkipLast +
-
- [TestMethod]
- public void SkipLast_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.SkipLast<int>(null, 0));
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => Observable.SkipLast(DummyObservable<int>.Instance, -1));
- }
-
- [TestMethod]
- public void SkipLast_Zero_Completed()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(180, 1),
- OnNext(210, 2),
- OnNext(250, 3),
- OnNext(270, 4),
- OnNext(310, 5),
- OnNext(360, 6),
- OnNext(380, 7),
- OnNext(410, 8),
- OnNext(590, 9),
- OnCompleted<int>(650)
- );
-
- var res = scheduler.Start(() =>
- xs.SkipLast(0)
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 2),
- OnNext(250, 3),
- OnNext(270, 4),
- OnNext(310, 5),
- OnNext(360, 6),
- OnNext(380, 7),
- OnNext(410, 8),
- OnNext(590, 9),
- OnCompleted<int>(650)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 650)
- );
- }
-
- [TestMethod]
- public void SkipLast_Zero_Error()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(180, 1),
- OnNext(210, 2),
- OnNext(250, 3),
- OnNext(270, 4),
- OnNext(310, 5),
- OnNext(360, 6),
- OnNext(380, 7),
- OnNext(410, 8),
- OnNext(590, 9),
- OnError<int>(650, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.SkipLast(0)
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 2),
- OnNext(250, 3),
- OnNext(270, 4),
- OnNext(310, 5),
- OnNext(360, 6),
- OnNext(380, 7),
- OnNext(410, 8),
- OnNext(590, 9),
- OnError<int>(650, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 650)
- );
- }
-
- [TestMethod]
- public void SkipLast_Zero_Disposed()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(180, 1),
- OnNext(210, 2),
- OnNext(250, 3),
- OnNext(270, 4),
- OnNext(310, 5),
- OnNext(360, 6),
- OnNext(380, 7),
- OnNext(410, 8),
- OnNext(590, 9)
- );
-
- var res = scheduler.Start(() =>
- xs.SkipLast(0)
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 2),
- OnNext(250, 3),
- OnNext(270, 4),
- OnNext(310, 5),
- OnNext(360, 6),
- OnNext(380, 7),
- OnNext(410, 8),
- OnNext(590, 9)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
- }
-
- [TestMethod]
- public void SkipLast_One_Completed()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(180, 1),
- OnNext(210, 2),
- OnNext(250, 3),
- OnNext(270, 4),
- OnNext(310, 5),
- OnNext(360, 6),
- OnNext(380, 7),
- OnNext(410, 8),
- OnNext(590, 9),
- OnCompleted<int>(650)
- );
-
- var res = scheduler.Start(() =>
- xs.SkipLast(1)
- );
-
- res.Messages.AssertEqual(
- OnNext(250, 2),
- OnNext(270, 3),
- OnNext(310, 4),
- OnNext(360, 5),
- OnNext(380, 6),
- OnNext(410, 7),
- OnNext(590, 8),
- OnCompleted<int>(650)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 650)
- );
- }
-
- [TestMethod]
- public void SkipLast_One_Error()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(180, 1),
- OnNext(210, 2),
- OnNext(250, 3),
- OnNext(270, 4),
- OnNext(310, 5),
- OnNext(360, 6),
- OnNext(380, 7),
- OnNext(410, 8),
- OnNext(590, 9),
- OnError<int>(650, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.SkipLast(1)
- );
-
- res.Messages.AssertEqual(
- OnNext(250, 2),
- OnNext(270, 3),
- OnNext(310, 4),
- OnNext(360, 5),
- OnNext(380, 6),
- OnNext(410, 7),
- OnNext(590, 8),
- OnError<int>(650, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 650)
- );
- }
-
- [TestMethod]
- public void SkipLast_One_Disposed()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(180, 1),
- OnNext(210, 2),
- OnNext(250, 3),
- OnNext(270, 4),
- OnNext(310, 5),
- OnNext(360, 6),
- OnNext(380, 7),
- OnNext(410, 8),
- OnNext(590, 9)
- );
-
- var res = scheduler.Start(() =>
- xs.SkipLast(1)
- );
-
- res.Messages.AssertEqual(
- OnNext(250, 2),
- OnNext(270, 3),
- OnNext(310, 4),
- OnNext(360, 5),
- OnNext(380, 6),
- OnNext(410, 7),
- OnNext(590, 8)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
- }
-
- [TestMethod]
- public void SkipLast_Three_Completed()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(180, 1),
- OnNext(210, 2),
- OnNext(250, 3),
- OnNext(270, 4),
- OnNext(310, 5),
- OnNext(360, 6),
- OnNext(380, 7),
- OnNext(410, 8),
- OnNext(590, 9),
- OnCompleted<int>(650)
- );
-
- var res = scheduler.Start(() =>
- xs.SkipLast(3)
- );
-
- res.Messages.AssertEqual(
- OnNext(310, 2),
- OnNext(360, 3),
- OnNext(380, 4),
- OnNext(410, 5),
- OnNext(590, 6),
- OnCompleted<int>(650)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 650)
- );
- }
-
- [TestMethod]
- public void SkipLast_Three_Error()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(180, 1),
- OnNext(210, 2),
- OnNext(250, 3),
- OnNext(270, 4),
- OnNext(310, 5),
- OnNext(360, 6),
- OnNext(380, 7),
- OnNext(410, 8),
- OnNext(590, 9),
- OnError<int>(650, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.SkipLast(3)
- );
-
- res.Messages.AssertEqual(
- OnNext(310, 2),
- OnNext(360, 3),
- OnNext(380, 4),
- OnNext(410, 5),
- OnNext(590, 6),
- OnError<int>(650, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 650)
- );
- }
-
- [TestMethod]
- public void SkipLast_Three_Disposed()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(180, 1),
- OnNext(210, 2),
- OnNext(250, 3),
- OnNext(270, 4),
- OnNext(310, 5),
- OnNext(360, 6),
- OnNext(380, 7),
- OnNext(410, 8),
- OnNext(590, 9)
- );
-
- var res = scheduler.Start(() =>
- xs.SkipLast(3)
- );
-
- res.Messages.AssertEqual(
- OnNext(310, 2),
- OnNext(360, 3),
- OnNext(380, 4),
- OnNext(410, 5),
- OnNext(590, 6)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
- }
-
- #endregion
-
- #region StartWith
-
- [TestMethod]
- public void StartWith_ArgumentChecking()
- {
- var scheduler = new TestScheduler();
- var someObservable = Observable.Empty<int>();
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.StartWith(default(IObservable<int>), 1));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.StartWith(someObservable, default(int[])));
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.StartWith(default(IObservable<int>), scheduler, 1));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.StartWith(someObservable, default(IScheduler), 1));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.StartWith(someObservable, scheduler, default(int[])));
- }
-
- [TestMethod]
- public void StartWith()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(220, 2),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.StartWith(1)
- );
-
- res.Messages.AssertEqual(
- OnNext(200, 1),
- OnNext(220, 2),
- OnCompleted<int>(250)
- );
- }
-
- [TestMethod]
- public void StartWith_Scheduler()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(220, 4),
- OnCompleted<int>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.StartWith(scheduler, 1, 2, 3)
- );
-
- res.Messages.AssertEqual(
- OnNext(201, 1),
- OnNext(202, 2),
- OnNext(203, 3),
- OnNext(220, 4),
- OnCompleted<int>(250)
- );
- }
-
- #endregion
-
- #region + TakeLast +
-
- [TestMethod]
- public void TakeLast_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.TakeLast<int>(null, 0));
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => Observable.TakeLast(DummyObservable<int>.Instance, -1));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.TakeLast<int>(null, 0, Scheduler.Default));
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => Observable.TakeLast(DummyObservable<int>.Instance, -1, Scheduler.Default));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.TakeLast(DummyObservable<int>.Instance, 0, default(IScheduler)));
- }
-
- [TestMethod]
- public void TakeLast_Zero_Completed()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(180, 1),
- OnNext(210, 2),
- OnNext(250, 3),
- OnNext(270, 4),
- OnNext(310, 5),
- OnNext(360, 6),
- OnNext(380, 7),
- OnNext(410, 8),
- OnNext(590, 9),
- OnCompleted<int>(650)
- );
-
- var res = scheduler.Start(() =>
- xs.TakeLast(0)
- );
-
- res.Messages.AssertEqual(
- OnCompleted<int>(650)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 650)
- );
- }
-
- [TestMethod]
- public void TakeLast_Zero_Error()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(180, 1),
- OnNext(210, 2),
- OnNext(250, 3),
- OnNext(270, 4),
- OnNext(310, 5),
- OnNext(360, 6),
- OnNext(380, 7),
- OnNext(410, 8),
- OnNext(590, 9),
- OnError<int>(650, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.TakeLast(0)
- );
-
- res.Messages.AssertEqual(
- OnError<int>(650, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 650)
- );
- }
-
- [TestMethod]
- public void TakeLast_Zero_Disposed()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(180, 1),
- OnNext(210, 2),
- OnNext(250, 3),
- OnNext(270, 4),
- OnNext(310, 5),
- OnNext(360, 6),
- OnNext(380, 7),
- OnNext(410, 8),
- OnNext(590, 9)
- );
-
- var res = scheduler.Start(() =>
- xs.TakeLast(0)
- );
-
- res.Messages.AssertEqual(
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
- }
-
- [TestMethod]
- public void TakeLast_One_Completed()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(180, 1),
- OnNext(210, 2),
- OnNext(250, 3),
- OnNext(270, 4),
- OnNext(310, 5),
- OnNext(360, 6),
- OnNext(380, 7),
- OnNext(410, 8),
- OnNext(590, 9),
- OnCompleted<int>(650)
- );
-
- var res = scheduler.Start(() =>
- xs.TakeLast(1)
- );
-
- res.Messages.AssertEqual(
- OnNext(650, 9),
- OnCompleted<int>(650)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 650)
- );
- }
-
- [TestMethod]
- public void TakeLast_One_Error()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(180, 1),
- OnNext(210, 2),
- OnNext(250, 3),
- OnNext(270, 4),
- OnNext(310, 5),
- OnNext(360, 6),
- OnNext(380, 7),
- OnNext(410, 8),
- OnNext(590, 9),
- OnError<int>(650, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.TakeLast(1)
- );
-
- res.Messages.AssertEqual(
- OnError<int>(650, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 650)
- );
- }
-
- [TestMethod]
- public void TakeLast_One_Disposed()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(180, 1),
- OnNext(210, 2),
- OnNext(250, 3),
- OnNext(270, 4),
- OnNext(310, 5),
- OnNext(360, 6),
- OnNext(380, 7),
- OnNext(410, 8),
- OnNext(590, 9)
- );
-
- var res = scheduler.Start(() =>
- xs.TakeLast(1)
- );
-
- res.Messages.AssertEqual(
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
- }
-
- [TestMethod]
- public void TakeLast_Three_Completed()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(180, 1),
- OnNext(210, 2),
- OnNext(250, 3),
- OnNext(270, 4),
- OnNext(310, 5),
- OnNext(360, 6),
- OnNext(380, 7),
- OnNext(410, 8),
- OnNext(590, 9),
- OnCompleted<int>(650)
- );
-
- var res = scheduler.Start(() =>
- xs.TakeLast(3)
- );
-
- res.Messages.AssertEqual(
- OnNext(650, 7),
- OnNext(650, 8),
- OnNext(650, 9),
- OnCompleted<int>(650)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 650)
- );
- }
-
- [TestMethod]
- public void TakeLast_Three_Error()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(180, 1),
- OnNext(210, 2),
- OnNext(250, 3),
- OnNext(270, 4),
- OnNext(310, 5),
- OnNext(360, 6),
- OnNext(380, 7),
- OnNext(410, 8),
- OnNext(590, 9),
- OnError<int>(650, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.TakeLast(3)
- );
-
- res.Messages.AssertEqual(
- OnError<int>(650, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 650)
- );
- }
-
- [TestMethod]
- public void TakeLast_Three_Disposed()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(180, 1),
- OnNext(210, 2),
- OnNext(250, 3),
- OnNext(270, 4),
- OnNext(310, 5),
- OnNext(360, 6),
- OnNext(380, 7),
- OnNext(410, 8),
- OnNext(590, 9)
- );
-
- var res = scheduler.Start(() =>
- xs.TakeLast(3)
- );
-
- res.Messages.AssertEqual(
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
- }
-
- [TestMethod]
- public void TakeLast_LongRunning_Regular()
- {
- var res = Observable.Range(0, 100, Scheduler.Default).TakeLast(10, NewThreadScheduler.Default);
-
- var lst = new List<int>();
- res.ForEach(lst.Add);
-
- Assert.IsTrue(Enumerable.Range(90, 10).SequenceEqual(lst));
- }
-
- #endregion
-
- #region + TakeLastBuffer +
-
- [TestMethod]
- public void TakeLastBuffer_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.TakeLastBuffer<int>(null, 0));
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => Observable.TakeLastBuffer(DummyObservable<int>.Instance, -1));
- }
-
- [TestMethod]
- public void TakeLastBuffer_Zero_Completed()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(180, 1),
- OnNext(210, 2),
- OnNext(250, 3),
- OnNext(270, 4),
- OnNext(310, 5),
- OnNext(360, 6),
- OnNext(380, 7),
- OnNext(410, 8),
- OnNext(590, 9),
- OnCompleted<int>(650)
- );
-
- var res = scheduler.Start(() =>
- xs.TakeLastBuffer(0)
- );
-
- res.Messages.AssertEqual(
- OnNext<IList<int>>(650, lst => lst.Count == 0),
- OnCompleted<IList<int>>(650)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 650)
- );
- }
-
- [TestMethod]
- public void TakeLastBuffer_Zero_Error()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(180, 1),
- OnNext(210, 2),
- OnNext(250, 3),
- OnNext(270, 4),
- OnNext(310, 5),
- OnNext(360, 6),
- OnNext(380, 7),
- OnNext(410, 8),
- OnNext(590, 9),
- OnError<int>(650, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.TakeLastBuffer(0)
- );
-
- res.Messages.AssertEqual(
- OnError<IList<int>>(650, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 650)
- );
- }
-
- [TestMethod]
- public void TakeLastBuffer_Zero_Disposed()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(180, 1),
- OnNext(210, 2),
- OnNext(250, 3),
- OnNext(270, 4),
- OnNext(310, 5),
- OnNext(360, 6),
- OnNext(380, 7),
- OnNext(410, 8),
- OnNext(590, 9)
- );
-
- var res = scheduler.Start(() =>
- xs.TakeLastBuffer(0)
- );
-
- res.Messages.AssertEqual(
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
- }
-
- [TestMethod]
- public void TakeLastBuffer_One_Completed()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(180, 1),
- OnNext(210, 2),
- OnNext(250, 3),
- OnNext(270, 4),
- OnNext(310, 5),
- OnNext(360, 6),
- OnNext(380, 7),
- OnNext(410, 8),
- OnNext(590, 9),
- OnCompleted<int>(650)
- );
-
- var res = scheduler.Start(() =>
- xs.TakeLastBuffer(1)
- );
-
- res.Messages.AssertEqual(
- OnNext<IList<int>>(650, lst => lst.SequenceEqual(new[] { 9 })),
- OnCompleted<IList<int>>(650)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 650)
- );
- }
-
- [TestMethod]
- public void TakeLastBuffer_One_Error()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(180, 1),
- OnNext(210, 2),
- OnNext(250, 3),
- OnNext(270, 4),
- OnNext(310, 5),
- OnNext(360, 6),
- OnNext(380, 7),
- OnNext(410, 8),
- OnNext(590, 9),
- OnError<int>(650, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.TakeLastBuffer(1)
- );
-
- res.Messages.AssertEqual(
- OnError<IList<int>>(650, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 650)
- );
- }
-
- [TestMethod]
- public void TakeLastBuffer_One_Disposed()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(180, 1),
- OnNext(210, 2),
- OnNext(250, 3),
- OnNext(270, 4),
- OnNext(310, 5),
- OnNext(360, 6),
- OnNext(380, 7),
- OnNext(410, 8),
- OnNext(590, 9)
- );
-
- var res = scheduler.Start(() =>
- xs.TakeLastBuffer(1)
- );
-
- res.Messages.AssertEqual(
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
- }
-
- [TestMethod]
- public void TakeLastBuffer_Three_Completed()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(180, 1),
- OnNext(210, 2),
- OnNext(250, 3),
- OnNext(270, 4),
- OnNext(310, 5),
- OnNext(360, 6),
- OnNext(380, 7),
- OnNext(410, 8),
- OnNext(590, 9),
- OnCompleted<int>(650)
- );
-
- var res = scheduler.Start(() =>
- xs.TakeLastBuffer(3)
- );
-
- res.Messages.AssertEqual(
- OnNext<IList<int>>(650, lst => lst.SequenceEqual(new[] { 7, 8, 9 })),
- OnCompleted<IList<int>>(650)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 650)
- );
- }
-
- [TestMethod]
- public void TakeLastBuffer_Three_Error()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(180, 1),
- OnNext(210, 2),
- OnNext(250, 3),
- OnNext(270, 4),
- OnNext(310, 5),
- OnNext(360, 6),
- OnNext(380, 7),
- OnNext(410, 8),
- OnNext(590, 9),
- OnError<int>(650, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.TakeLastBuffer(3)
- );
-
- res.Messages.AssertEqual(
- OnError<IList<int>>(650, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 650)
- );
- }
-
- [TestMethod]
- public void TakeLastBuffer_Three_Disposed()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(180, 1),
- OnNext(210, 2),
- OnNext(250, 3),
- OnNext(270, 4),
- OnNext(310, 5),
- OnNext(360, 6),
- OnNext(380, 7),
- OnNext(410, 8),
- OnNext(590, 9)
- );
-
- var res = scheduler.Start(() =>
- xs.TakeLastBuffer(3)
- );
-
- res.Messages.AssertEqual(
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
- }
-
- #endregion
-
- #region + Window +
-
- [TestMethod]
- public void WindowWithCount_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Window(default(IObservable<int>), 1, 1));
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => Observable.Window(DummyObservable<int>.Instance, 0, 1));
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => Observable.Window(DummyObservable<int>.Instance, 1, 0));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Window(default(IObservable<int>), 1));
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => Observable.Window(DummyObservable<int>.Instance, 0));
- }
-
- [TestMethod]
- public void WindowWithCount_Basic()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(100, 1),
- OnNext(210, 2),
- OnNext(240, 3),
- OnNext(280, 4),
- OnNext(320, 5),
- OnNext(350, 6),
- OnNext(380, 7),
- OnNext(420, 8),
- OnNext(470, 9),
- OnCompleted<int>(600)
- );
-
- var res = scheduler.Start(() =>
- xs.Window(3, 2).Select((w, i) => w.Select(x => i.ToString() + " " + x.ToString())).Merge()
- );
-
- res.Messages.AssertEqual(
- OnNext(210, "0 2"),
- OnNext(240, "0 3"),
- OnNext(280, "0 4"),
- OnNext(280, "1 4"),
- OnNext(320, "1 5"),
- OnNext(350, "1 6"),
- OnNext(350, "2 6"),
- OnNext(380, "2 7"),
- OnNext(420, "2 8"),
- OnNext(420, "3 8"),
- OnNext(470, "3 9"),
- OnCompleted<string>(600)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 600)
- );
- }
-
- [TestMethod]
- public void WindowWithCount_InnerTimings()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(100, 1),
- OnNext(210, 2),
- OnNext(240, 3),
- OnNext(280, 4),
- OnNext(320, 5),
- OnNext(350, 6),
- OnNext(380, 7),
- OnNext(420, 8),
- OnNext(470, 9),
- OnCompleted<int>(600)
- );
-
- var res = default(IObservable<IObservable<int>>);
- var outerSubscription = default(IDisposable);
- var innerSubscriptions = new List<IDisposable>();
- var windows = new List<IObservable<int>>();
- var observers = new List<ITestableObserver<int>>();
-
- scheduler.ScheduleAbsolute(Created, () => res = xs.Window(3, 2));
-
- scheduler.ScheduleAbsolute(Subscribed, () =>
- {
- outerSubscription = res.Subscribe(
- window =>
- {
- var result = scheduler.CreateObserver<int>();
- windows.Add(window);
- observers.Add(result);
- scheduler.ScheduleAbsolute(0, () => innerSubscriptions.Add(window.Subscribe(result)));
- }
- );
- });
-
- scheduler.Start();
-
- Assert.AreEqual(5, observers.Count);
-
- observers[0].Messages.AssertEqual(
- OnNext(210, 2),
- OnNext(240, 3),
- OnNext(280, 4),
- OnCompleted<int>(280)
- );
-
- observers[1].Messages.AssertEqual(
- OnNext(280, 4),
- OnNext(320, 5),
- OnNext(350, 6),
- OnCompleted<int>(350)
- );
-
- observers[2].Messages.AssertEqual(
- OnNext(350, 6),
- OnNext(380, 7),
- OnNext(420, 8),
- OnCompleted<int>(420)
- );
-
- observers[3].Messages.AssertEqual(
- OnNext(420, 8),
- OnNext(470, 9),
- OnCompleted<int>(600)
- );
-
- observers[4].Messages.AssertEqual(
- OnCompleted<int>(600)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 600)
- );
- }
-
- [TestMethod]
- public void WindowWithCount_InnerTimings_DisposeOuter()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(100, 1),
- OnNext(210, 2),
- OnNext(240, 3),
- OnNext(280, 4),
- OnNext(320, 5),
- OnNext(350, 6),
- OnNext(380, 7),
- OnNext(420, 8),
- OnNext(470, 9),
- OnCompleted<int>(600)
- );
-
- var res = default(IObservable<IObservable<int>>);
- var outerSubscription = default(IDisposable);
- var innerSubscriptions = new List<IDisposable>();
- var windows = new List<IObservable<int>>();
- var observers = new List<ITestableObserver<int>>();
- var windowCreationTimes = new List<long>();
-
- scheduler.ScheduleAbsolute(Created, () => res = xs.Window(3, 2));
-
- scheduler.ScheduleAbsolute(Subscribed, () =>
- {
- outerSubscription = res.Subscribe(
- window =>
- {
- windowCreationTimes.Add(scheduler.Clock);
-
- var result = scheduler.CreateObserver<int>();
- windows.Add(window);
- observers.Add(result);
- scheduler.ScheduleAbsolute(0, () => innerSubscriptions.Add(window.Subscribe(result)));
- }
- );
- });
-
- scheduler.ScheduleAbsolute(400, () =>
- {
- outerSubscription.Dispose();
- });
-
- scheduler.Start();
-
- Assert.IsTrue(windowCreationTimes.Last() < 400);
-
- Assert.AreEqual(4, observers.Count);
-
- observers[0].Messages.AssertEqual(
- OnNext(210, 2),
- OnNext(240, 3),
- OnNext(280, 4),
- OnCompleted<int>(280)
- );
-
- observers[1].Messages.AssertEqual(
- OnNext(280, 4),
- OnNext(320, 5),
- OnNext(350, 6),
- OnCompleted<int>(350)
- );
-
- observers[2].Messages.AssertEqual(
- OnNext(350, 6),
- OnNext(380, 7),
- OnNext(420, 8),
- OnCompleted<int>(420)
- );
-
- observers[3].Messages.AssertEqual(
- OnNext(420, 8),
- OnNext(470, 9),
- OnCompleted<int>(600)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 600)
- );
- }
-
- [TestMethod]
- public void WindowWithCount_InnerTimings_DisposeOuterAndInners()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(100, 1),
- OnNext(210, 2),
- OnNext(240, 3),
- OnNext(280, 4),
- OnNext(320, 5),
- OnNext(350, 6),
- OnNext(380, 7),
- OnNext(420, 8),
- OnNext(470, 9),
- OnCompleted<int>(600)
- );
-
- var res = default(IObservable<IObservable<int>>);
- var outerSubscription = default(IDisposable);
- var innerSubscriptions = new List<IDisposable>();
- var windows = new List<IObservable<int>>();
- var observers = new List<ITestableObserver<int>>();
- var windowCreationTimes = new List<long>();
-
- scheduler.ScheduleAbsolute(Created, () => res = xs.Window(3, 2));
-
- scheduler.ScheduleAbsolute(Subscribed, () =>
- {
- outerSubscription = res.Subscribe(
- window =>
- {
- windowCreationTimes.Add(scheduler.Clock);
-
- var result = scheduler.CreateObserver<int>();
- windows.Add(window);
- observers.Add(result);
- scheduler.ScheduleAbsolute(0, () => innerSubscriptions.Add(window.Subscribe(result)));
- }
- );
- });
-
- scheduler.ScheduleAbsolute(400, () =>
- {
- outerSubscription.Dispose();
- foreach (var d in innerSubscriptions)
- d.Dispose();
- });
-
- scheduler.Start();
-
- Assert.IsTrue(windowCreationTimes.Last() < 400);
-
- Assert.AreEqual(4, observers.Count);
-
- observers[0].Messages.AssertEqual(
- OnNext(210, 2),
- OnNext(240, 3),
- OnNext(280, 4),
- OnCompleted<int>(280)
- );
-
- observers[1].Messages.AssertEqual(
- OnNext(280, 4),
- OnNext(320, 5),
- OnNext(350, 6),
- OnCompleted<int>(350)
- );
-
- observers[2].Messages.AssertEqual(
- OnNext(350, 6),
- OnNext(380, 7)
- );
-
- observers[3].Messages.AssertEqual(
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 400)
- );
- }
-
- [TestMethod]
- public void WindowWithCount_Disposed()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(100, 1),
- OnNext(210, 2),
- OnNext(240, 3),
- OnNext(280, 4),
- OnNext(320, 5),
- OnNext(350, 6),
- OnNext(380, 7),
- OnNext(420, 8),
- OnNext(470, 9),
- OnCompleted<int>(600)
- );
-
- var res = scheduler.Start(() =>
- xs.Window(3, 2).Select((w, i) => w.Select(x => i.ToString() + " " + x.ToString())).Merge(), 370
- );
-
- res.Messages.AssertEqual(
- OnNext(210, "0 2"),
- OnNext(240, "0 3"),
- OnNext(280, "0 4"),
- OnNext(280, "1 4"),
- OnNext(320, "1 5"),
- OnNext(350, "1 6"),
- OnNext(350, "2 6")
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 370)
- );
- }
-
- [TestMethod]
- public void WindowWithCount_Error()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(100, 1),
- OnNext(210, 2),
- OnNext(240, 3),
- OnNext(280, 4),
- OnNext(320, 5),
- OnNext(350, 6),
- OnNext(380, 7),
- OnNext(420, 8),
- OnNext(470, 9),
- OnError<int>(600, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.Window(3, 2).Select((w, i) => w.Select(x => i.ToString() + " " + x.ToString())).Merge()
- );
-
- res.Messages.AssertEqual(
- OnNext(210, "0 2"),
- OnNext(240, "0 3"),
- OnNext(280, "0 4"),
- OnNext(280, "1 4"),
- OnNext(320, "1 5"),
- OnNext(350, "1 6"),
- OnNext(350, "2 6"),
- OnNext(380, "2 7"),
- OnNext(420, "2 8"),
- OnNext(420, "3 8"),
- OnNext(470, "3 9"),
- OnError<string>(600, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 600)
- );
- }
-
- [TestMethod]
- public void WindowWithCount_Default()
- {
- Observable.Range(1, 10).Window(3).Skip(1).First().SequenceEqual(new[] { 4, 5, 6 }.ToObservable());
- Observable.Range(1, 10).Window(3).Skip(1).First().SequenceEqual(new[] { 4, 5, 6 }.ToObservable());
- Observable.Range(1, 10).Window(3, 2).Skip(1).First().SequenceEqual(new[] { 3, 4, 5 }.ToObservable());
- }
-
- #endregion
- }
-}
diff --git a/Rx.NET/Tests.System.Reactive/Tests/ObservableStandardQueryOperatorTest.cs b/Rx.NET/Tests.System.Reactive/Tests/ObservableStandardQueryOperatorTest.cs
deleted file mode 100644
index 9160de4..0000000
--- a/Rx.NET/Tests.System.Reactive/Tests/ObservableStandardQueryOperatorTest.cs
+++ /dev/null
@@ -1,12995 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Reactive;
-using System.Reactive.Concurrency;
-using System.Reactive.Disposables;
-using System.Reactive.Linq;
-using System.Reactive.Subjects;
-using System.Text;
-using Microsoft.Reactive.Testing;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using ReactiveTests.Dummies;
-
-#if !NO_TPL
-using System.Threading.Tasks;
-using System.Threading;
-#endif
-
-namespace ReactiveTests.Tests
-{
- [TestClass]
- public class ObservableStandardQueryOperatorTest : ReactiveTest
- {
- #region + Cast +
-
- [TestMethod]
- public void Cast_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => ((IObservable<object>)null).Cast<bool>());
- ReactiveAssert.Throws<ArgumentNullException>(() => DummyObservable<object>.Instance.Cast<bool>().Subscribe(null));
- }
-
- class A : IEquatable<A>
- {
- int id;
-
- public A(int id)
- {
- this.id = id;
- }
-
- public bool Equals(A other)
- {
- if (other == null)
- return false;
- return id == other.id && GetType().Equals(other.GetType());
- }
-
- public override bool Equals(object obj)
- {
- return Equals(obj as A);
- }
-
- public override int GetHashCode()
- {
- return id;
- }
- }
-
- class B : A
- {
- public B(int id)
- : base(id)
- {
- }
- }
-
- class C : A
- {
- public C(int id)
- : base(id)
- {
- }
- }
-
- class D : B
- {
- public D(int id)
- : base(id)
- {
- }
- }
-
- class E : IEquatable<E>
- {
- int id;
-
- public E(int id)
- {
- this.id = id;
- }
-
- public bool Equals(E other)
- {
- if (other == null)
- return false;
- return id == other.id && GetType().Equals(other.GetType());
- }
-
- public override bool Equals(object obj)
- {
- return Equals(obj as E);
- }
-
- public override int GetHashCode()
- {
- return id;
- }
- }
-
- [TestMethod]
- public void Cast_Complete()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable<object>(
- OnNext<object>(210, new B(0)),
- OnNext<object>(220, new D(1)),
- OnNext<object>(240, new B(2)),
- OnNext<object>(270, new D(3)),
- OnCompleted<object>(300)
- );
-
- var res = scheduler.Start(() =>
- xs.Cast<B>()
- );
-
- res.Messages.AssertEqual(
- OnNext<B>(210, new B(0)),
- OnNext<B>(220, new D(1)),
- OnNext<B>(240, new B(2)),
- OnNext<B>(270, new D(3)),
- OnCompleted<B>(300)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 300)
- );
- }
-
- [TestMethod]
- public void Cast_Error()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable<object>(
- OnNext<object>(210, new B(0)),
- OnNext<object>(220, new D(1)),
- OnNext<object>(240, new B(2)),
- OnNext<object>(270, new D(3)),
- OnError<object>(300, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.Cast<B>()
- );
-
- res.Messages.AssertEqual(
- OnNext<B>(210, new B(0)),
- OnNext<B>(220, new D(1)),
- OnNext<B>(240, new B(2)),
- OnNext<B>(270, new D(3)),
- OnError<B>(300, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 300)
- );
- }
-
- [TestMethod]
- public void Cast_Dispose()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable<object>(
- OnNext<object>(210, new B(0)),
- OnNext<object>(220, new D(1)),
- OnNext<object>(240, new B(2)),
- OnNext<object>(270, new D(3)),
- OnCompleted<object>(300)
- );
-
- var res = scheduler.Start(() =>
- xs.Cast<B>(),
- 250
- );
-
- res.Messages.AssertEqual(
- OnNext<B>(210, new B(0)),
- OnNext<B>(220, new D(1)),
- OnNext<B>(240, new B(2))
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Cast_NotValid()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable<object>(
- OnNext<object>(210, new B(0)),
- OnNext<object>(220, new D(1)),
- OnNext<object>(240, new B(2)),
- OnNext<object>(250, new A(-1)),
- OnNext<object>(270, new D(3)),
- OnCompleted<object>(300)
- );
-
- var res = scheduler.Start(() =>
- xs.Cast<B>()
- );
-
- res.Messages.AssertEqual(
- OnNext<B>(210, new B(0)),
- OnNext<B>(220, new D(1)),
- OnNext<B>(240, new B(2)),
- OnError<B>(250, e => e is InvalidCastException)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- #endregion
-
- #region + DefaultIfEmpty +
-
- [TestMethod]
- public void DefaultIfEmpty_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.DefaultIfEmpty(default(IObservable<int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.DefaultIfEmpty(default(IObservable<int>), 42));
- }
-
- [TestMethod]
- public void DefaultIfEmpty_NonEmpty1()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(280, 42),
- OnNext(360, 43),
- OnCompleted<int>(420)
- );
-
- var res = scheduler.Start(() =>
- xs.DefaultIfEmpty()
- );
-
- res.Messages.AssertEqual(
- OnNext(280, 42),
- OnNext(360, 43),
- OnCompleted<int>(420)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 420)
- );
- }
-
- [TestMethod]
- public void DefaultIfEmpty_NonEmpty2()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(280, 42),
- OnNext(360, 43),
- OnCompleted<int>(420)
- );
-
- var res = scheduler.Start(() =>
- xs.DefaultIfEmpty(-1)
- );
-
- res.Messages.AssertEqual(
- OnNext(280, 42),
- OnNext(360, 43),
- OnCompleted<int>(420)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 420)
- );
- }
-
- [TestMethod]
- public void DefaultIfEmpty_Empty1()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnCompleted<int>(420)
- );
-
- var res = scheduler.Start(() =>
- xs.DefaultIfEmpty()
- );
-
- res.Messages.AssertEqual(
- OnNext(420, 0),
- OnCompleted<int>(420)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 420)
- );
- }
-
- [TestMethod]
- public void DefaultIfEmpty_Empty2()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnCompleted<int>(420)
- );
-
- var res = scheduler.Start(() =>
- xs.DefaultIfEmpty(-1)
- );
-
- res.Messages.AssertEqual(
- OnNext(420, -1),
- OnCompleted<int>(420)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 420)
- );
- }
-
- [TestMethod]
- public void DefaultIfEmpty_Throw1()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnError<int>(420, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.DefaultIfEmpty()
- );
-
- res.Messages.AssertEqual(
- OnError<int>(420, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 420)
- );
- }
-
- [TestMethod]
- public void DefaultIfEmpty_Throw2()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnError<int>(420, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.DefaultIfEmpty(42)
- );
-
- res.Messages.AssertEqual(
- OnError<int>(420, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 420)
- );
- }
-
- #endregion
-
- #region + Distinct +
-
- [TestMethod]
- public void Distinct_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Distinct(default(IObservable<int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Distinct(default(IObservable<int>), EqualityComparer<int>.Default));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Distinct(Observable.Return(42), default(EqualityComparer<int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Distinct(default(IObservable<int>), x => x));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Distinct(Observable.Return(42), default(Func<int, int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Distinct(default(IObservable<int>), x => x, EqualityComparer<int>.Default));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Distinct(Observable.Return(42), default(Func<int, int>), EqualityComparer<int>.Default));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Distinct(Observable.Return(42), x => x, default(EqualityComparer<int>)));
- }
-
- [TestMethod]
- public void Distinct_DefaultComparer_AllDistinct()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(280, 4),
- OnNext(300, 2),
- OnNext(350, 1),
- OnNext(380, 3),
- OnNext(400, 5),
- OnCompleted<int>(420)
- );
-
- var res = scheduler.Start(() =>
- xs.Distinct()
- );
-
- res.Messages.AssertEqual(
- OnNext(280, 4),
- OnNext(300, 2),
- OnNext(350, 1),
- OnNext(380, 3),
- OnNext(400, 5),
- OnCompleted<int>(420)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 420)
- );
- }
-
- [TestMethod]
- public void Distinct_DefaultComparer_SomeDuplicates()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(280, 4),
- OnNext(300, 2),
- OnNext(350, 2),
- OnNext(380, 3),
- OnNext(400, 4),
- OnCompleted<int>(420)
- );
-
- var res = scheduler.Start(() =>
- xs.Distinct()
- );
-
- res.Messages.AssertEqual(
- OnNext(280, 4),
- OnNext(300, 2),
- OnNext(380, 3),
- OnCompleted<int>(420)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 420)
- );
- }
-
- [TestMethod]
- public void Distinct_CustomComparer_AllDistinct()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(280, 4),
- OnNext(300, 2),
- OnNext(350, 1),
- OnNext(380, 3),
- OnNext(400, 5),
- OnCompleted<int>(420)
- );
-
- var res = scheduler.Start(() =>
- xs.Distinct(new ModComparer(10))
- );
-
- res.Messages.AssertEqual(
- OnNext(280, 4),
- OnNext(300, 2),
- OnNext(350, 1),
- OnNext(380, 3),
- OnNext(400, 5),
- OnCompleted<int>(420)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 420)
- );
- }
-
- [TestMethod]
- public void Distinct_CustomComparer_SomeDuplicates()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(280, 4),
- OnNext(300, 2),
- OnNext(350, 12),
- OnNext(380, 3),
- OnNext(400, 24),
- OnCompleted<int>(420)
- );
-
- var res = scheduler.Start(() =>
- xs.Distinct(new ModComparer(10))
- );
-
- res.Messages.AssertEqual(
- OnNext(280, 4),
- OnNext(300, 2),
- OnNext(380, 3),
- OnCompleted<int>(420)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 420)
- );
- }
-
- class ModComparer : IEqualityComparer<int>
- {
- private readonly int _mod;
-
- public ModComparer(int mod)
- {
- _mod = mod;
- }
-
- public bool Equals(int x, int y)
- {
- return EqualityComparer<int>.Default.Equals(x % _mod, y % _mod);
- }
-
- public int GetHashCode(int obj)
- {
- return EqualityComparer<int>.Default.GetHashCode(obj % _mod);
- }
- }
-
- [TestMethod]
- public void Distinct_KeySelector_DefaultComparer_AllDistinct()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(280, 8),
- OnNext(300, 4),
- OnNext(350, 2),
- OnNext(380, 6),
- OnNext(400, 10),
- OnCompleted<int>(420)
- );
-
- var res = scheduler.Start(() =>
- xs.Distinct(x => x / 2)
- );
-
- res.Messages.AssertEqual(
- OnNext(280, 8),
- OnNext(300, 4),
- OnNext(350, 2),
- OnNext(380, 6),
- OnNext(400, 10),
- OnCompleted<int>(420)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 420)
- );
- }
-
- [TestMethod]
- public void Distinct_KeySelector_DefaultComparer_SomeDuplicates()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(280, 4),
- OnNext(300, 2),
- OnNext(350, 3),
- OnNext(380, 7),
- OnNext(400, 5),
- OnCompleted<int>(420)
- );
-
- var res = scheduler.Start(() =>
- xs.Distinct(x => x / 2)
- );
-
- res.Messages.AssertEqual(
- OnNext(280, 4),
- OnNext(300, 2),
- OnNext(380, 7),
- OnCompleted<int>(420)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 420)
- );
- }
-
- [TestMethod]
- public void Distinct_KeySelector_CustomComparer_AllDistinct()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(280, 8),
- OnNext(300, 4),
- OnNext(350, 2),
- OnNext(380, 6),
- OnNext(400, 10),
- OnCompleted<int>(420)
- );
-
- var res = scheduler.Start(() =>
- xs.Distinct(x => x / 2, new ModComparer(10))
- );
-
- res.Messages.AssertEqual(
- OnNext(280, 8),
- OnNext(300, 4),
- OnNext(350, 2),
- OnNext(380, 6),
- OnNext(400, 10),
- OnCompleted<int>(420)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 420)
- );
- }
-
- [TestMethod]
- public void Distinct_KeySelector_CustomComparer_SomeDuplicates()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(280, 8),
- OnNext(300, 4),
- OnNext(350, 2),
- OnNext(380, 6),
- OnNext(400, 10),
- OnCompleted<int>(420)
- );
-
- var res = scheduler.Start(() =>
- xs.Distinct(x => x / 2, new ModComparer(3))
- );
-
- res.Messages.AssertEqual(
- OnNext(280, 8),
- OnNext(300, 4),
- OnNext(380, 6),
- OnCompleted<int>(420)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 420)
- );
- }
-
- [TestMethod]
- public void Distinct_KeySelector_Throws()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(280, 3),
- OnNext(300, 2),
- OnNext(350, 1),
- OnNext(380, 0),
- OnNext(400, 4),
- OnCompleted<int>(420)
- );
-
- var ex = new Exception();
-
- var res = scheduler.Start(() =>
- xs.Distinct(x => { if (x == 0) throw ex; return x / 2; })
- );
-
- res.Messages.AssertEqual(
- OnNext(280, 3),
- OnNext(350, 1),
- OnError<int>(380, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 380)
- );
- }
-
- [TestMethod]
- public void Distinct_CustomComparer_Throws()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(280, 1),
- OnNext(300, 2),
- OnNext(350, 3),
- OnNext(380, 4),
- OnNext(400, 5),
- OnCompleted<int>(420)
- );
-
- var ex = new Exception();
-
- var res = scheduler.Start(() =>
- xs.Distinct(new ThrowComparer(4, ex))
- );
-
- res.Messages.AssertEqual(
- OnNext(280, 1),
- OnNext(300, 2),
- OnNext(350, 3),
- OnError<int>(380, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 380)
- );
- }
-
- class ThrowComparer : IEqualityComparer<int>
- {
- private readonly int _err;
- private readonly Exception _ex;
-
- public ThrowComparer(int err, Exception ex)
- {
- _err = err;
- _ex = ex;
- }
-
- public bool Equals(int x, int y)
- {
- return EqualityComparer<int>.Default.Equals(x, y);
- }
-
- public int GetHashCode(int obj)
- {
- if (obj == _err)
- throw _ex;
-
- return EqualityComparer<int>.Default.GetHashCode(obj);
- }
- }
-
- [TestMethod]
- public void Distinct_Throw()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(280, 1),
- OnNext(300, 2),
- OnNext(350, 3),
- OnError<int>(380, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.Distinct()
- );
-
- res.Messages.AssertEqual(
- OnNext(280, 1),
- OnNext(300, 2),
- OnNext(350, 3),
- OnError<int>(380, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 380)
- );
- }
-
- #endregion
-
- #region + GroupBy +
-
- [TestMethod]
- public void GroupBy_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => ((IObservable<int>)null).GroupBy(DummyFunc<int, int>.Instance, DummyFunc<int, int>.Instance, EqualityComparer<int>.Default));
- ReactiveAssert.Throws<ArgumentNullException>(() => DummyObservable<int>.Instance.GroupBy((Func<int, int>)null, DummyFunc<int, int>.Instance, EqualityComparer<int>.Default));
- ReactiveAssert.Throws<ArgumentNullException>(() => DummyObservable<int>.Instance.GroupBy(DummyFunc<int, int>.Instance, (Func<int, int>)null, EqualityComparer<int>.Default));
- ReactiveAssert.Throws<ArgumentNullException>(() => DummyObservable<int>.Instance.GroupBy(DummyFunc<int, int>.Instance, DummyFunc<int, int>.Instance, null));
- ReactiveAssert.Throws<ArgumentNullException>(() => DummyObservable<int>.Instance.GroupBy(DummyFunc<int, int>.Instance, DummyFunc<int, int>.Instance, EqualityComparer<int>.Default).Subscribe(null));
- }
-
- [TestMethod]
- public void GroupBy_KeyEle_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => ((IObservable<int>)null).GroupBy(DummyFunc<int, int>.Instance, DummyFunc<int, int>.Instance));
- ReactiveAssert.Throws<ArgumentNullException>(() => DummyObservable<int>.Instance.GroupBy((Func<int, int>)null, DummyFunc<int, int>.Instance));
- ReactiveAssert.Throws<ArgumentNullException>(() => DummyObservable<int>.Instance.GroupBy(DummyFunc<int, int>.Instance, (Func<int, int>)null));
- ReactiveAssert.Throws<ArgumentNullException>(() => DummyObservable<int>.Instance.GroupBy(DummyFunc<int, int>.Instance, DummyFunc<int, int>.Instance).Subscribe(null));
- }
-
- [TestMethod]
- public void GroupBy_KeyComparer_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => ((IObservable<int>)null).GroupBy(DummyFunc<int, int>.Instance, EqualityComparer<int>.Default));
- ReactiveAssert.Throws<ArgumentNullException>(() => DummyObservable<int>.Instance.GroupBy((Func<int, int>)null, EqualityComparer<int>.Default));
- ReactiveAssert.Throws<ArgumentNullException>(() => DummyObservable<int>.Instance.GroupBy(DummyFunc<int, int>.Instance, (IEqualityComparer<int>)null));
- ReactiveAssert.Throws<ArgumentNullException>(() => DummyObservable<int>.Instance.GroupBy(DummyFunc<int, int>.Instance, EqualityComparer<int>.Default).Subscribe(null));
- }
-
- [TestMethod]
- public void GroupBy_Key_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => ((IObservable<int>)null).GroupBy(DummyFunc<int, int>.Instance));
- ReactiveAssert.Throws<ArgumentNullException>(() => DummyObservable<int>.Instance.GroupBy((Func<int, int>)null));
- ReactiveAssert.Throws<ArgumentNullException>(() => DummyObservable<int>.Instance.GroupBy(DummyFunc<int, int>.Instance).Subscribe(null));
- }
-
- [TestMethod]
- public void GroupBy_WithKeyComparer()
- {
- var scheduler = new TestScheduler();
-
- var keyInvoked = 0;
-
- var xs = scheduler.CreateHotObservable(
- OnNext(90, "error"),
- OnNext(110, "error"),
- OnNext(130, "error"),
- OnNext(220, " foo"),
- OnNext(240, " FoO "),
- OnNext(270, "baR "),
- OnNext(310, "foO "),
- OnNext(350, " Baz "),
- OnNext(360, " qux "),
- OnNext(390, " bar"),
- OnNext(420, " BAR "),
- OnNext(470, "FOO "),
- OnNext(480, "baz "),
- OnNext(510, " bAZ "),
- OnNext(530, " fOo "),
- OnCompleted<string>(570),
- OnNext(580, "error"),
- OnCompleted<string>(600),
- OnError<string>(650, new Exception())
- );
-
- var comparer = new GroupByComparer(scheduler);
-
- var res = scheduler.Start(() =>
- xs.GroupBy(x =>
- {
- keyInvoked++;
- return x.Trim();
- }, comparer).Select(g => g.Key)
- );
-
- res.Messages.AssertEqual(
- OnNext(220, "foo"),
- OnNext(270, "baR"),
- OnNext(350, "Baz"),
- OnNext(360, "qux"),
- OnCompleted<string>(570)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 570)
- );
-
- Assert.AreEqual(12, keyInvoked);
- }
-
- [TestMethod]
- public void GroupBy_Outer_Complete()
- {
- var scheduler = new TestScheduler();
-
- var keyInvoked = 0;
- var eleInvoked = 0;
-
- var xs = scheduler.CreateHotObservable(
- OnNext(90, "error"),
- OnNext(110, "error"),
- OnNext(130, "error"),
- OnNext(220, " foo"),
- OnNext(240, " FoO "),
- OnNext(270, "baR "),
- OnNext(310, "foO "),
- OnNext(350, " Baz "),
- OnNext(360, " qux "),
- OnNext(390, " bar"),
- OnNext(420, " BAR "),
- OnNext(470, "FOO "),
- OnNext(480, "baz "),
- OnNext(510, " bAZ "),
- OnNext(530, " fOo "),
- OnCompleted<string>(570),
- OnNext(580, "error"),
- OnCompleted<string>(600),
- OnError<string>(650, new Exception())
- );
-
- var comparer = new GroupByComparer(scheduler);
-
- var res = scheduler.Start(() =>
- xs.GroupBy(
- x =>
- {
- keyInvoked++;
- return x.Trim();
- },
- x =>
- {
- eleInvoked++;
- return Reverse(x);
- },
- comparer
- ).Select(g => g.Key)
- );
-
- res.Messages.AssertEqual(
- OnNext(220, "foo"),
- OnNext(270, "baR"),
- OnNext(350, "Baz"),
- OnNext(360, "qux"),
- OnCompleted<string>(570)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 570)
- );
-
- Assert.AreEqual(12, keyInvoked);
- Assert.AreEqual(12, eleInvoked);
- }
-
- [TestMethod]
- public void GroupBy_Outer_Error()
- {
- var scheduler = new TestScheduler();
-
- var keyInvoked = 0;
- var eleInvoked = 0;
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(90, "error"),
- OnNext(110, "error"),
- OnNext(130, "error"),
- OnNext(220, " foo"),
- OnNext(240, " FoO "),
- OnNext(270, "baR "),
- OnNext(310, "foO "),
- OnNext(350, " Baz "),
- OnNext(360, " qux "),
- OnNext(390, " bar"),
- OnNext(420, " BAR "),
- OnNext(470, "FOO "),
- OnNext(480, "baz "),
- OnNext(510, " bAZ "),
- OnNext(530, " fOo "),
- OnError<string>(570, ex),
- OnNext(580, "error"),
- OnCompleted<string>(600),
- OnError<string>(650, new Exception())
- );
-
- var comparer = new GroupByComparer(scheduler);
-
- var res = scheduler.Start(() =>
- xs.GroupBy(
- x =>
- {
- keyInvoked++;
- return x.Trim();
- },
- x =>
- {
- eleInvoked++;
- return Reverse(x);
- },
- comparer
- ).Select(g => g.Key)
- );
-
- res.Messages.AssertEqual(
- OnNext(220, "foo"),
- OnNext(270, "baR"),
- OnNext(350, "Baz"),
- OnNext(360, "qux"),
- OnError<string>(570, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 570)
- );
-
- Assert.AreEqual(12, keyInvoked);
- Assert.AreEqual(12, eleInvoked);
- }
-
- [TestMethod]
- public void GroupBy_Outer_Dispose()
- {
- var scheduler = new TestScheduler();
-
- var keyInvoked = 0;
- var eleInvoked = 0;
-
- var xs = scheduler.CreateHotObservable(
- OnNext(90, "error"),
- OnNext(110, "error"),
- OnNext(130, "error"),
- OnNext(220, " foo"),
- OnNext(240, " FoO "),
- OnNext(270, "baR "),
- OnNext(310, "foO "),
- OnNext(350, " Baz "),
- OnNext(360, " qux "),
- OnNext(390, " bar"),
- OnNext(420, " BAR "),
- OnNext(470, "FOO "),
- OnNext(480, "baz "),
- OnNext(510, " bAZ "),
- OnNext(530, " fOo "),
- OnCompleted<string>(570),
- OnNext(580, "error"),
- OnCompleted<string>(600),
- OnError<string>(650, new Exception())
- );
-
- var comparer = new GroupByComparer(scheduler);
-
- var res = scheduler.Start(() =>
- xs.GroupBy(
- x =>
- {
- keyInvoked++;
- return x.Trim();
- }, x =>
- {
- eleInvoked++;
- return Reverse(x);
- }, comparer
- ).Select(g => g.Key),
- 355
- );
-
- res.Messages.AssertEqual(
- OnNext(220, "foo"),
- OnNext(270, "baR"),
- OnNext(350, "Baz")
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 355)
- );
-
- Assert.AreEqual(5, keyInvoked);
- Assert.AreEqual(5, eleInvoked);
- }
-
- [TestMethod]
- public void GroupBy_Outer_KeyThrow()
- {
- var scheduler = new TestScheduler();
-
- var keyInvoked = 0;
- var eleInvoked = 0;
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(90, "error"),
- OnNext(110, "error"),
- OnNext(130, "error"),
- OnNext(220, " foo"),
- OnNext(240, " FoO "),
- OnNext(270, "baR "),
- OnNext(310, "foO "),
- OnNext(350, " Baz "),
- OnNext(360, " qux "),
- OnNext(390, " bar"),
- OnNext(420, " BAR "),
- OnNext(470, "FOO "),
- OnNext(480, "baz "),
- OnNext(510, " bAZ "),
- OnNext(530, " fOo "),
- OnCompleted<string>(570),
- OnNext(580, "error"),
- OnCompleted<string>(600),
- OnError<string>(650, new Exception())
- );
-
- var comparer = new GroupByComparer(scheduler);
-
- var res = scheduler.Start(() =>
- xs.GroupBy(
- x =>
- {
- keyInvoked++;
- if (keyInvoked == 10)
- throw ex;
- return x.Trim();
- },
- x =>
- {
- eleInvoked++;
- return Reverse(x);
- },
- comparer
- ).Select(g => g.Key)
- );
-
- res.Messages.AssertEqual(
- OnNext(220, "foo"),
- OnNext(270, "baR"),
- OnNext(350, "Baz"),
- OnNext(360, "qux"),
- OnError<string>(480, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 480)
- );
-
- Assert.AreEqual(10, keyInvoked);
- Assert.AreEqual(9, eleInvoked);
- }
-
- [TestMethod]
- public void GroupBy_Outer_EleThrow()
- {
- var scheduler = new TestScheduler();
-
- var keyInvoked = 0;
- var eleInvoked = 0;
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(90, "error"),
- OnNext(110, "error"),
- OnNext(130, "error"),
- OnNext(220, " foo"),
- OnNext(240, " FoO "),
- OnNext(270, "baR "),
- OnNext(310, "foO "),
- OnNext(350, " Baz "),
- OnNext(360, " qux "),
- OnNext(390, " bar"),
- OnNext(420, " BAR "),
- OnNext(470, "FOO "),
- OnNext(480, "baz "),
- OnNext(510, " bAZ "),
- OnNext(530, " fOo "),
- OnCompleted<string>(570),
- OnNext(580, "error"),
- OnCompleted<string>(600),
- OnError<string>(650, new Exception())
- );
-
- var comparer = new GroupByComparer(scheduler);
-
- var res = scheduler.Start(() =>
- xs.GroupBy(
- x =>
- {
- keyInvoked++;
- return x.Trim();
- },
- x =>
- {
- eleInvoked++;
- if (eleInvoked == 10)
- throw ex;
- return Reverse(x);
- },
- comparer
- ).Select(g => g.Key)
- );
-
- res.Messages.AssertEqual(
- OnNext(220, "foo"),
- OnNext(270, "baR"),
- OnNext(350, "Baz"),
- OnNext(360, "qux"),
- OnError<string>(480, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 480)
- );
-
- Assert.AreEqual(10, keyInvoked);
- Assert.AreEqual(10, eleInvoked);
- }
-
- [TestMethod]
- public void GroupBy_Outer_ComparerEqualsThrow()
- {
- var scheduler = new TestScheduler();
-
- var keyInvoked = 0;
- var eleInvoked = 0;
-
- var xs = scheduler.CreateHotObservable(
- OnNext(90, "error"),
- OnNext(110, "error"),
- OnNext(130, "error"),
- OnNext(220, " foo"),
- OnNext(240, " FoO "),
- OnNext(270, "baR "),
- OnNext(310, "foO "),
- OnNext(350, " Baz "),
- OnNext(360, " qux "),
- OnNext(390, " bar"),
- OnNext(420, " BAR "),
- OnNext(470, "FOO "),
- OnNext(480, "baz "),
- OnNext(510, " bAZ "),
- OnNext(530, " fOo "),
- OnCompleted<string>(570),
- OnNext(580, "error"),
- OnCompleted<string>(600),
- OnError<string>(650, new Exception())
- );
-
- var comparer = new GroupByComparer(scheduler, 250, ushort.MaxValue);
-
- var res = scheduler.Start(() =>
- xs.GroupBy(
- x =>
- {
- keyInvoked++;
- return x.Trim();
- },
- x =>
- {
- eleInvoked++;
- return Reverse(x);
- },
- comparer
- ).Select(g => g.Key)
- );
-
- res.Messages.AssertEqual(
- OnNext(220, "foo"),
- OnNext(270, "baR"),
- OnError<string>(310, comparer.EqualsException)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 310)
- );
-
- Assert.AreEqual(4, keyInvoked);
- Assert.AreEqual(3, eleInvoked);
- }
-
- [TestMethod]
- public void GroupBy_Outer_ComparerGetHashCodeThrow()
- {
- var scheduler = new TestScheduler();
-
- var keyInvoked = 0;
- var eleInvoked = 0;
-
- var xs = scheduler.CreateHotObservable(
- OnNext(90, "error"),
- OnNext(110, "error"),
- OnNext(130, "error"),
- OnNext(220, " foo"),
- OnNext(240, " FoO "),
- OnNext(270, "baR "),
- OnNext(310, "foO "),
- OnNext(350, " Baz "),
- OnNext(360, " qux "),
- OnNext(390, " bar"),
- OnNext(420, " BAR "),
- OnNext(470, "FOO "),
- OnNext(480, "baz "),
- OnNext(510, " bAZ "),
- OnNext(530, " fOo "),
- OnCompleted<string>(570),
- OnNext(580, "error"),
- OnCompleted<string>(600),
- OnError<string>(650, new Exception())
- );
-
- var comparer = new GroupByComparer(scheduler, ushort.MaxValue, 410);
-
- var res = scheduler.Start(() =>
- xs.GroupBy(
- x =>
- {
- keyInvoked++;
- return x.Trim();
- },
- x =>
- {
- eleInvoked++;
- return Reverse(x);
- },
- comparer
- ).Select(g => g.Key)
- );
-
- res.Messages.AssertEqual(
- OnNext(220, "foo"),
- OnNext(270, "baR"),
- OnNext(350, "Baz"),
- OnNext(360, "qux"),
- OnError<string>(420, comparer.HashCodeException)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 420)
- );
-
- Assert.AreEqual(8, keyInvoked);
- Assert.AreEqual(7, eleInvoked);
- }
-
- [TestMethod]
- public void GroupBy_Inner_Complete()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(90, "error"),
- OnNext(110, "error"),
- OnNext(130, "error"),
- OnNext(220, " foo"),
- OnNext(240, " FoO "),
- OnNext(270, "baR "),
- OnNext(310, "foO "),
- OnNext(350, " Baz "),
- OnNext(360, " qux "),
- OnNext(390, " bar"),
- OnNext(420, " BAR "),
- OnNext(470, "FOO "),
- OnNext(480, "baz "),
- OnNext(510, " bAZ "),
- OnNext(530, " fOo "),
- OnCompleted<string>(570),
- OnNext(580, "error"),
- OnCompleted<string>(600),
- OnError<string>(650, new Exception())
- );
-
- var comparer = new GroupByComparer(scheduler);
- var outer = default(IObservable<IGroupedObservable<string, string>>);
- var outerSubscription = default(IDisposable);
- var inners = new Dictionary<string, IObservable<string>>();
- var innerSubscriptions = new Dictionary<string, IDisposable>();
- var res = new Dictionary<string, ITestableObserver<string>>();
-
- scheduler.ScheduleAbsolute(Created, () => outer = xs.GroupBy(x => x.Trim(), x => Reverse(x), comparer));
-
- scheduler.ScheduleAbsolute(Subscribed, () => outerSubscription = outer.Subscribe(group =>
- {
- var result = scheduler.CreateObserver<string>();
- inners[group.Key] = group;
- res[group.Key] = result;
- scheduler.ScheduleRelative(100, () => innerSubscriptions[group.Key] = group.Subscribe(result));
- }));
-
- scheduler.ScheduleAbsolute(Disposed, () =>
- {
- outerSubscription.Dispose();
- foreach (var d in innerSubscriptions.Values)
- d.Dispose();
- });
-
- scheduler.Start();
-
- Assert.AreEqual(4, inners.Count);
-
- res["foo"].Messages.AssertEqual(
- OnNext(470, " OOF"),
- OnNext(530, " oOf "),
- OnCompleted<string>(570)
- );
-
- res["baR"].Messages.AssertEqual(
- OnNext(390, "rab "),
- OnNext(420, " RAB "),
- OnCompleted<string>(570)
- );
-
- res["Baz"].Messages.AssertEqual(
- OnNext(480, " zab"),
- OnNext(510, " ZAb "),
- OnCompleted<string>(570)
- );
-
- res["qux"].Messages.AssertEqual(
- OnCompleted<string>(570)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 570)
- );
- }
-
- [TestMethod]
- public void GroupBy_Inner_Complete_All()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(90, "error"),
- OnNext(110, "error"),
- OnNext(130, "error"),
- OnNext(220, " foo"),
- OnNext(240, " FoO "),
- OnNext(270, "baR "),
- OnNext(310, "foO "),
- OnNext(350, " Baz "),
- OnNext(360, " qux "),
- OnNext(390, " bar"),
- OnNext(420, " BAR "),
- OnNext(470, "FOO "),
- OnNext(480, "baz "),
- OnNext(510, " bAZ "),
- OnNext(530, " fOo "),
- OnCompleted<string>(570),
- OnNext(580, "error"),
- OnCompleted<string>(600),
- OnError<string>(650, new Exception())
- );
-
- var comparer = new GroupByComparer(scheduler);
- var outer = default(IObservable<IGroupedObservable<string, string>>);
- var outerSubscription = default(IDisposable);
- var inners = new Dictionary<string, IObservable<string>>();
- var innerSubscriptions = new Dictionary<string, IDisposable>();
- var res = new Dictionary<string, ITestableObserver<string>>();
-
- scheduler.ScheduleAbsolute(Created, () => outer = xs.GroupBy(x => x.Trim(), x => Reverse(x), comparer));
-
- scheduler.ScheduleAbsolute(Subscribed, () => outerSubscription = outer.Subscribe(group =>
- {
- var result = scheduler.CreateObserver<string>();
- inners[group.Key] = group;
- res[group.Key] = result;
- innerSubscriptions[group.Key] = group.Subscribe(result);
- }));
-
- scheduler.ScheduleAbsolute(Disposed, () =>
- {
- outerSubscription.Dispose();
- foreach (var d in innerSubscriptions.Values)
- d.Dispose();
- });
-
- scheduler.Start();
-
- Assert.AreEqual(4, inners.Count);
-
- res["foo"].Messages.AssertEqual(
- OnNext(220, "oof "),
- OnNext(240, " OoF "),
- OnNext(310, " Oof"),
- OnNext(470, " OOF"),
- OnNext(530, " oOf "),
- OnCompleted<string>(570)
- );
-
- res["baR"].Messages.AssertEqual(
- OnNext(270, " Rab"),
- OnNext(390, "rab "),
- OnNext(420, " RAB "),
- OnCompleted<string>(570)
- );
-
- res["Baz"].Messages.AssertEqual(
- OnNext(350, " zaB "),
- OnNext(480, " zab"),
- OnNext(510, " ZAb "),
- OnCompleted<string>(570)
- );
-
- res["qux"].Messages.AssertEqual(
- OnNext(360, " xuq "),
- OnCompleted<string>(570)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 570)
- );
- }
-
- [TestMethod]
- public void GroupBy_Inner_Error()
- {
- var scheduler = new TestScheduler();
-
- var ex1 = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(90, "error"),
- OnNext(110, "error"),
- OnNext(130, "error"),
- OnNext(220, " foo"),
- OnNext(240, " FoO "),
- OnNext(270, "baR "),
- OnNext(310, "foO "),
- OnNext(350, " Baz "),
- OnNext(360, " qux "),
- OnNext(390, " bar"),
- OnNext(420, " BAR "),
- OnNext(470, "FOO "),
- OnNext(480, "baz "),
- OnNext(510, " bAZ "),
- OnNext(530, " fOo "),
- OnError<string>(570, ex1),
- OnNext(580, "error"),
- OnCompleted<string>(600),
- OnError<string>(650, new Exception())
- );
-
- var comparer = new GroupByComparer(scheduler);
- var outer = default(IObservable<IGroupedObservable<string, string>>);
- var outerSubscription = default(IDisposable);
- var inners = new Dictionary<string, IObservable<string>>();
- var innerSubscriptions = new Dictionary<string, IDisposable>();
- var res = new Dictionary<string, ITestableObserver<string>>();
-
- scheduler.ScheduleAbsolute(Created, () => outer = xs.GroupBy(x => x.Trim(), x => Reverse(x), comparer));
-
- scheduler.ScheduleAbsolute(Subscribed, () => outerSubscription = outer.Subscribe(group =>
- {
- var result = scheduler.CreateObserver<string>();
- inners[group.Key] = group;
- res[group.Key] = result;
- scheduler.ScheduleRelative(100, () => innerSubscriptions[group.Key] = group.Subscribe(result));
- }, ex => { }));
-
- scheduler.ScheduleAbsolute(Disposed, () =>
- {
- outerSubscription.Dispose();
- foreach (var d in innerSubscriptions.Values)
- d.Dispose();
- });
-
- scheduler.Start();
-
- Assert.AreEqual(4, inners.Count);
-
- res["foo"].Messages.AssertEqual(
- OnNext(470, " OOF"),
- OnNext(530, " oOf "),
- OnError<string>(570, ex1)
- );
-
- res["baR"].Messages.AssertEqual(
- OnNext(390, "rab "),
- OnNext(420, " RAB "),
- OnError<string>(570, ex1)
- );
-
- res["Baz"].Messages.AssertEqual(
- OnNext(480, " zab"),
- OnNext(510, " ZAb "),
- OnError<string>(570, ex1)
- );
-
- res["qux"].Messages.AssertEqual(
- OnError<string>(570, ex1)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 570)
- );
- }
-
- [TestMethod]
- public void GroupBy_Inner_Dispose()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(90, "error"),
- OnNext(110, "error"),
- OnNext(130, "error"),
- OnNext(220, " foo"),
- OnNext(240, " FoO "),
- OnNext(270, "baR "),
- OnNext(310, "foO "),
- OnNext(350, " Baz "),
- OnNext(360, " qux "),
- OnNext(390, " bar"),
- OnNext(420, " BAR "),
- OnNext(470, "FOO "),
- OnNext(480, "baz "),
- OnNext(510, " bAZ "),
- OnNext(530, " fOo "),
- OnCompleted<string>(570),
- OnNext(580, "error"),
- OnCompleted<string>(600),
- OnError<string>(650, new Exception())
- );
-
- var comparer = new GroupByComparer(scheduler);
- var outer = default(IObservable<IGroupedObservable<string, string>>);
- var outerSubscription = default(IDisposable);
- var inners = new Dictionary<string, IObservable<string>>();
- var innerSubscriptions = new Dictionary<string, IDisposable>();
- var res = new Dictionary<string, ITestableObserver<string>>();
-
- scheduler.ScheduleAbsolute(Created, () => outer = xs.GroupBy(x => x.Trim(), x => Reverse(x), comparer));
-
- scheduler.ScheduleAbsolute(Subscribed, () => outerSubscription = outer.Subscribe(group =>
- {
- var result = scheduler.CreateObserver<string>();
- inners[group.Key] = group;
- res[group.Key] = result;
- innerSubscriptions[group.Key] = group.Subscribe(result);
- }));
-
- scheduler.ScheduleAbsolute(400, () =>
- {
- outerSubscription.Dispose();
- foreach (var d in innerSubscriptions.Values)
- d.Dispose();
- });
-
- scheduler.Start();
-
- Assert.AreEqual(4, inners.Count);
-
- res["foo"].Messages.AssertEqual(
- OnNext(220, "oof "),
- OnNext(240, " OoF "),
- OnNext(310, " Oof")
- );
-
- res["baR"].Messages.AssertEqual(
- OnNext(270, " Rab"),
- OnNext(390, "rab ")
- );
-
- res["Baz"].Messages.AssertEqual(
- OnNext(350, " zaB ")
- );
-
- res["qux"].Messages.AssertEqual(
- OnNext(360, " xuq ")
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 400)
- );
- }
-
- [TestMethod]
- public void GroupBy_Inner_KeyThrow()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(90, "error"),
- OnNext(110, "error"),
- OnNext(130, "error"),
- OnNext(220, " foo"),
- OnNext(240, " FoO "),
- OnNext(270, "baR "),
- OnNext(310, "foO "),
- OnNext(350, " Baz "),
- OnNext(360, " qux "),
- OnNext(390, " bar"),
- OnNext(420, " BAR "),
- OnNext(470, "FOO "),
- OnNext(480, "baz "),
- OnNext(510, " bAZ "),
- OnNext(530, " fOo "),
- OnCompleted<string>(570),
- OnNext(580, "error"),
- OnCompleted<string>(600),
- OnError<string>(650, new Exception())
- );
-
- var comparer = new GroupByComparer(scheduler);
- var outer = default(IObservable<IGroupedObservable<string, string>>);
- var outerSubscription = default(IDisposable);
- var inners = new Dictionary<string, IObservable<string>>();
- var innerSubscriptions = new Dictionary<string, IDisposable>();
- var res = new Dictionary<string, ITestableObserver<string>>();
-
- var keyInvoked = 0;
-
- scheduler.ScheduleAbsolute(Created, () => outer = xs.GroupBy(x =>
- {
- keyInvoked++;
- if (keyInvoked == 6)
- throw ex;
- return x.Trim();
- }, x => Reverse(x), comparer));
-
- scheduler.ScheduleAbsolute(Subscribed, () => outerSubscription = outer.Subscribe(group =>
- {
- var result = scheduler.CreateObserver<string>();
- inners[group.Key] = group;
- res[group.Key] = result;
- innerSubscriptions[group.Key] = group.Subscribe(result);
- }, _ => { }));
-
- scheduler.ScheduleAbsolute(Disposed, () =>
- {
- outerSubscription.Dispose();
- foreach (var d in innerSubscriptions.Values)
- d.Dispose();
- });
-
- scheduler.Start();
-
- Assert.AreEqual(3, inners.Count);
-
- res["foo"].Messages.AssertEqual(
- OnNext(220, "oof "),
- OnNext(240, " OoF "),
- OnNext(310, " Oof"),
- OnError<string>(360, ex)
- );
-
- res["baR"].Messages.AssertEqual(
- OnNext(270, " Rab"),
- OnError<string>(360, ex)
- );
-
- res["Baz"].Messages.AssertEqual(
- OnNext(350, " zaB "),
- OnError<string>(360, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 360)
- );
- }
-
- [TestMethod]
- public void GroupBy_Inner_EleThrow()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(90, "error"),
- OnNext(110, "error"),
- OnNext(130, "error"),
- OnNext(220, " foo"),
- OnNext(240, " FoO "),
- OnNext(270, "baR "),
- OnNext(310, "foO "),
- OnNext(350, " Baz "),
- OnNext(360, " qux "),
- OnNext(390, " bar"),
- OnNext(420, " BAR "),
- OnNext(470, "FOO "),
- OnNext(480, "baz "),
- OnNext(510, " bAZ "),
- OnNext(530, " fOo "),
- OnCompleted<string>(570),
- OnNext(580, "error"),
- OnCompleted<string>(600),
- OnError<string>(650, new Exception())
- );
-
- var comparer = new GroupByComparer(scheduler);
- var outer = default(IObservable<IGroupedObservable<string, string>>);
- var outerSubscription = default(IDisposable);
- var inners = new Dictionary<string, IObservable<string>>();
- var innerSubscriptions = new Dictionary<string, IDisposable>();
- var res = new Dictionary<string, ITestableObserver<string>>();
-
- var eleInvoked = 0;
-
- scheduler.ScheduleAbsolute(Created, () => outer = xs.GroupBy(x => x.Trim(), x =>
- {
- eleInvoked++;
- if (eleInvoked == 6)
- throw ex;
- return Reverse(x);
- }, comparer));
-
- scheduler.ScheduleAbsolute(Subscribed, () => outerSubscription = outer.Subscribe(group =>
- {
- var result = scheduler.CreateObserver<string>();
- inners[group.Key] = group;
- res[group.Key] = result;
- innerSubscriptions[group.Key] = group.Subscribe(result);
- }, _ => { }));
-
- scheduler.ScheduleAbsolute(Disposed, () =>
- {
- outerSubscription.Dispose();
- foreach (var d in innerSubscriptions.Values)
- d.Dispose();
- });
-
- scheduler.Start();
-
- Assert.AreEqual(4, inners.Count);
-
- res["foo"].Messages.AssertEqual(
- OnNext(220, "oof "),
- OnNext(240, " OoF "),
- OnNext(310, " Oof"),
- OnError<string>(360, ex)
- );
-
- res["baR"].Messages.AssertEqual(
- OnNext(270, " Rab"),
- OnError<string>(360, ex)
- );
-
- res["Baz"].Messages.AssertEqual(
- OnNext(350, " zaB "),
- OnError<string>(360, ex)
- );
-
- res["qux"].Messages.AssertEqual(
- OnError<string>(360, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 360)
- );
- }
-
- [TestMethod]
- public void GroupBy_Inner_Comparer_EqualsThrow()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(90, "error"),
- OnNext(110, "error"),
- OnNext(130, "error"),
- OnNext(220, " foo"),
- OnNext(240, " FoO "),
- OnNext(270, "baR "),
- OnNext(310, "foO "),
- OnNext(350, " Baz "),
- OnNext(360, " qux "),
- OnNext(390, " bar"),
- OnNext(420, " BAR "),
- OnNext(470, "FOO "),
- OnNext(480, "baz "),
- OnNext(510, " bAZ "),
- OnNext(530, " fOo "),
- OnCompleted<string>(570),
- OnNext(580, "error"),
- OnCompleted<string>(600),
- OnError<string>(650, new Exception())
- );
-
- var comparer = new GroupByComparer(scheduler, 400, ushort.MaxValue);
- var outer = default(IObservable<IGroupedObservable<string, string>>);
- var outerSubscription = default(IDisposable);
- var inners = new Dictionary<string, IObservable<string>>();
- var innerSubscriptions = new Dictionary<string, IDisposable>();
- var res = new Dictionary<string, ITestableObserver<string>>();
-
- scheduler.ScheduleAbsolute(Created, () => outer = xs.GroupBy(x => x.Trim(), x => Reverse(x), comparer));
-
- scheduler.ScheduleAbsolute(Subscribed, () => outerSubscription = outer.Subscribe(group =>
- {
- var result = scheduler.CreateObserver<string>();
- inners[group.Key] = group;
- res[group.Key] = result;
- innerSubscriptions[group.Key] = group.Subscribe(result);
- }, _ => { }));
-
- scheduler.ScheduleAbsolute(Disposed, () =>
- {
- outerSubscription.Dispose();
- foreach (var d in innerSubscriptions.Values)
- d.Dispose();
- });
-
- scheduler.Start();
-
- Assert.AreEqual(4, inners.Count);
-
- res["foo"].Messages.AssertEqual(
- OnNext(220, "oof "),
- OnNext(240, " OoF "),
- OnNext(310, " Oof"),
- OnError<string>(420, comparer.EqualsException)
- );
-
- res["baR"].Messages.AssertEqual(
- OnNext(270, " Rab"),
- OnNext(390, "rab "),
- OnError<string>(420, comparer.EqualsException)
- );
-
- res["Baz"].Messages.AssertEqual(
- OnNext(350, " zaB "),
- OnError<string>(420, comparer.EqualsException)
- );
-
- res["qux"].Messages.AssertEqual(
- OnNext(360, " xuq "),
- OnError<string>(420, comparer.EqualsException)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 420)
- );
- }
-
- [TestMethod]
- public void GroupBy_Inner_Comparer_GetHashCodeThrow()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(90, "error"),
- OnNext(110, "error"),
- OnNext(130, "error"),
- OnNext(220, " foo"),
- OnNext(240, " FoO "),
- OnNext(270, "baR "),
- OnNext(310, "foO "),
- OnNext(350, " Baz "),
- OnNext(360, " qux "),
- OnNext(390, " bar"),
- OnNext(420, " BAR "),
- OnNext(470, "FOO "),
- OnNext(480, "baz "),
- OnNext(510, " bAZ "),
- OnNext(530, " fOo "),
- OnCompleted<string>(570),
- OnNext(580, "error"),
- OnCompleted<string>(600),
- OnError<string>(650, new Exception())
- );
-
- var comparer = new GroupByComparer(scheduler, ushort.MaxValue, 400);
- var outer = default(IObservable<IGroupedObservable<string, string>>);
- var outerSubscription = default(IDisposable);
- var inners = new Dictionary<string, IObservable<string>>();
- var innerSubscriptions = new Dictionary<string, IDisposable>();
- var res = new Dictionary<string, ITestableObserver<string>>();
-
- scheduler.ScheduleAbsolute(Created, () => outer = xs.GroupBy(x => x.Trim(), x => Reverse(x), comparer));
-
- scheduler.ScheduleAbsolute(Subscribed, () => outerSubscription = outer.Subscribe(group =>
- {
- var result = scheduler.CreateObserver<string>();
- inners[group.Key] = group;
- res[group.Key] = result;
- innerSubscriptions[group.Key] = group.Subscribe(result);
- }, _ => { }));
-
- scheduler.ScheduleAbsolute(Disposed, () =>
- {
- outerSubscription.Dispose();
- foreach (var d in innerSubscriptions.Values)
- d.Dispose();
- });
-
- scheduler.Start();
-
- Assert.AreEqual(4, inners.Count);
-
- res["foo"].Messages.AssertEqual(
- OnNext(220, "oof "),
- OnNext(240, " OoF "),
- OnNext(310, " Oof"),
- OnError<string>(420, comparer.HashCodeException)
- );
-
- res["baR"].Messages.AssertEqual(
- OnNext(270, " Rab"),
- OnNext(390, "rab "),
- OnError<string>(420, comparer.HashCodeException)
- );
-
- res["Baz"].Messages.AssertEqual(
- OnNext(350, " zaB "),
- OnError<string>(420, comparer.HashCodeException)
- );
-
- res["qux"].Messages.AssertEqual(
- OnNext(360, " xuq "),
- OnError<string>(420, comparer.HashCodeException)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 420)
- );
- }
-
- [TestMethod]
- public void GroupBy_Outer_Independence()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(90, "error"),
- OnNext(110, "error"),
- OnNext(130, "error"),
- OnNext(220, " foo"),
- OnNext(240, " FoO "),
- OnNext(270, "baR "),
- OnNext(310, "foO "),
- OnNext(350, " Baz "),
- OnNext(360, " qux "),
- OnNext(390, " bar"),
- OnNext(420, " BAR "),
- OnNext(470, "FOO "),
- OnNext(480, "baz "),
- OnNext(510, " bAZ "),
- OnNext(530, " fOo "),
- OnCompleted<string>(570),
- OnNext(580, "error"),
- OnCompleted<string>(600),
- OnError<string>(650, new Exception())
- );
-
- var comparer = new GroupByComparer(scheduler);
- var outer = default(IObservable<IGroupedObservable<string, string>>);
- var outerSubscription = default(IDisposable);
- var inners = new Dictionary<string, IObservable<string>>();
- var innerSubscriptions = new Dictionary<string, IDisposable>();
- var res = new Dictionary<string, ITestableObserver<string>>();
- var outerResults = scheduler.CreateObserver<string>();
-
- scheduler.ScheduleAbsolute(Created, () => outer = xs.GroupBy(x => x.Trim(), x => Reverse(x), comparer));
-
- scheduler.ScheduleAbsolute(Subscribed, () => outerSubscription = outer.Subscribe(group =>
- {
- outerResults.OnNext(group.Key);
- var result = scheduler.CreateObserver<string>();
- inners[group.Key] = group;
- res[group.Key] = result;
- innerSubscriptions[group.Key] = group.Subscribe(result);
- }, outerResults.OnError, outerResults.OnCompleted));
-
- scheduler.ScheduleAbsolute(Disposed, () =>
- {
- outerSubscription.Dispose();
- foreach (var d in innerSubscriptions.Values)
- d.Dispose();
- });
-
- scheduler.ScheduleAbsolute(320, () => outerSubscription.Dispose());
-
- scheduler.Start();
-
- Assert.AreEqual(2, inners.Count);
-
- outerResults.Messages.AssertEqual(
- OnNext(220, "foo"),
- OnNext(270, "baR")
- );
-
- res["foo"].Messages.AssertEqual(
- OnNext(220, "oof "),
- OnNext(240, " OoF "),
- OnNext(310, " Oof"),
- OnNext(470, " OOF"),
- OnNext(530, " oOf "),
- OnCompleted<string>(570)
- );
-
- res["baR"].Messages.AssertEqual(
- OnNext(270, " Rab"),
- OnNext(390, "rab "),
- OnNext(420, " RAB "),
- OnCompleted<string>(570)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 570)
- );
- }
-
- [TestMethod]
- public void GroupBy_Inner_Independence()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(90, "error"),
- OnNext(110, "error"),
- OnNext(130, "error"),
- OnNext(220, " foo"),
- OnNext(240, " FoO "),
- OnNext(270, "baR "),
- OnNext(310, "foO "),
- OnNext(350, " Baz "),
- OnNext(360, " qux "),
- OnNext(390, " bar"),
- OnNext(420, " BAR "),
- OnNext(470, "FOO "),
- OnNext(480, "baz "),
- OnNext(510, " bAZ "),
- OnNext(530, " fOo "),
- OnCompleted<string>(570),
- OnNext(580, "error"),
- OnCompleted<string>(600),
- OnError<string>(650, new Exception())
- );
-
- var comparer = new GroupByComparer(scheduler);
- var outer = default(IObservable<IGroupedObservable<string, string>>);
- var outerSubscription = default(IDisposable);
- var inners = new Dictionary<string, IObservable<string>>();
- var innerSubscriptions = new Dictionary<string, IDisposable>();
- var res = new Dictionary<string, ITestableObserver<string>>();
- var outerResults = scheduler.CreateObserver<string>();
-
- scheduler.ScheduleAbsolute(Created, () => outer = xs.GroupBy(x => x.Trim(), x => Reverse(x), comparer));
-
- scheduler.ScheduleAbsolute(Subscribed, () => outerSubscription = outer.Subscribe(group =>
- {
- outerResults.OnNext(group.Key);
- var result = scheduler.CreateObserver<string>();
- inners[group.Key] = group;
- res[group.Key] = result;
- innerSubscriptions[group.Key] = group.Subscribe(result);
- }, outerResults.OnError, outerResults.OnCompleted));
-
- scheduler.ScheduleAbsolute(Disposed, () =>
- {
- outerSubscription.Dispose();
- foreach (var d in innerSubscriptions.Values)
- d.Dispose();
- });
-
- scheduler.ScheduleAbsolute(320, () => innerSubscriptions["foo"].Dispose());
-
- scheduler.Start();
-
- Assert.AreEqual(4, inners.Count);
-
- res["foo"].Messages.AssertEqual(
- OnNext(220, "oof "),
- OnNext(240, " OoF "),
- OnNext(310, " Oof")
- );
-
- res["baR"].Messages.AssertEqual(
- OnNext(270, " Rab"),
- OnNext(390, "rab "),
- OnNext(420, " RAB "),
- OnCompleted<string>(570)
- );
-
- res["Baz"].Messages.AssertEqual(
- OnNext(350, " zaB "),
- OnNext(480, " zab"),
- OnNext(510, " ZAb "),
- OnCompleted<string>(570)
- );
-
- res["qux"].Messages.AssertEqual(
- OnNext(360, " xuq "),
- OnCompleted<string>(570)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 570)
- );
- }
-
- [TestMethod]
- public void GroupBy_Inner_Multiple_Independence()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(90, "error"),
- OnNext(110, "error"),
- OnNext(130, "error"),
- OnNext(220, " foo"),
- OnNext(240, " FoO "),
- OnNext(270, "baR "),
- OnNext(310, "foO "),
- OnNext(350, " Baz "),
- OnNext(360, " qux "),
- OnNext(390, " bar"),
- OnNext(420, " BAR "),
- OnNext(470, "FOO "),
- OnNext(480, "baz "),
- OnNext(510, " bAZ "),
- OnNext(530, " fOo "),
- OnCompleted<string>(570),
- OnNext(580, "error"),
- OnCompleted<string>(600),
- OnError<string>(650, new Exception())
- );
-
- var comparer = new GroupByComparer(scheduler);
- var outer = default(IObservable<IGroupedObservable<string, string>>);
- var outerSubscription = default(IDisposable);
- var inners = new Dictionary<string, IObservable<string>>();
- var innerSubscriptions = new Dictionary<string, IDisposable>();
- var res = new Dictionary<string, ITestableObserver<string>>();
- var outerResults = scheduler.CreateObserver<string>();
-
- scheduler.ScheduleAbsolute(Created, () => outer = xs.GroupBy(x => x.Trim(), x => Reverse(x), comparer));
-
- scheduler.ScheduleAbsolute(Subscribed, () => outerSubscription = outer.Subscribe(group =>
- {
- outerResults.OnNext(group.Key);
- var result = scheduler.CreateObserver<string>();
- inners[group.Key] = group;
- res[group.Key] = result;
- innerSubscriptions[group.Key] = group.Subscribe(result);
- }, outerResults.OnError, outerResults.OnCompleted));
-
- scheduler.ScheduleAbsolute(Disposed, () =>
- {
- outerSubscription.Dispose();
- foreach (var d in innerSubscriptions.Values)
- d.Dispose();
- });
-
- scheduler.ScheduleAbsolute(320, () => innerSubscriptions["foo"].Dispose());
- scheduler.ScheduleAbsolute(280, () => innerSubscriptions["baR"].Dispose());
- scheduler.ScheduleAbsolute(355, () => innerSubscriptions["Baz"].Dispose());
- scheduler.ScheduleAbsolute(400, () => innerSubscriptions["qux"].Dispose());
-
- scheduler.Start();
-
- Assert.AreEqual(4, inners.Count);
-
- res["foo"].Messages.AssertEqual(
- OnNext(220, "oof "),
- OnNext(240, " OoF "),
- OnNext(310, " Oof")
- );
-
- res["baR"].Messages.AssertEqual(
- OnNext(270, " Rab")
- );
-
- res["Baz"].Messages.AssertEqual(
- OnNext(350, " zaB ")
- );
-
- res["qux"].Messages.AssertEqual(
- OnNext(360, " xuq ")
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 570)
- );
- }
-
- [TestMethod]
- public void GroupBy_Inner_Escape_Complete()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(220, " foo"),
- OnNext(240, " FoO "),
- OnNext(310, "foO "),
- OnNext(470, "FOO "),
- OnNext(530, " fOo "),
- OnCompleted<string>(570)
- );
-
- var outer = default(IObservable<IGroupedObservable<string, string>>);
- var outerSubscription = default(IDisposable);
- var inner = default(IObservable<string>);
- var innerSubscription = default(IDisposable);
- var res = scheduler.CreateObserver<string>();
-
- scheduler.ScheduleAbsolute(Created, () => outer = xs.GroupBy(x => x.Trim()));
-
- scheduler.ScheduleAbsolute(Subscribed, () => outerSubscription = outer.Subscribe(group =>
- {
- inner = group;
- }));
-
- scheduler.ScheduleAbsolute(600, () => innerSubscription = inner.Subscribe(res));
-
- scheduler.ScheduleAbsolute(Disposed, () =>
- {
- outerSubscription.Dispose();
- innerSubscription.Dispose();
- });
-
- scheduler.Start();
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 570)
- );
-
- res.Messages.AssertEqual(
- OnCompleted<string>(600)
- );
- }
-
- [TestMethod]
- public void GroupBy_Inner_Escape_Error()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(220, " foo"),
- OnNext(240, " FoO "),
- OnNext(310, "foO "),
- OnNext(470, "FOO "),
- OnNext(530, " fOo "),
- OnError<string>(570, ex)
- );
-
- var outer = default(IObservable<IGroupedObservable<string, string>>);
- var outerSubscription = default(IDisposable);
- var inner = default(IObservable<string>);
- var innerSubscription = default(IDisposable);
- var res = scheduler.CreateObserver<string>();
-
- scheduler.ScheduleAbsolute(Created, () => outer = xs.GroupBy(x => x.Trim()));
-
- scheduler.ScheduleAbsolute(Subscribed, () => outerSubscription = outer.Subscribe(group =>
- {
- inner = group;
- }, _ => { }));
-
- scheduler.ScheduleAbsolute(600, () => innerSubscription = inner.Subscribe(res));
-
- scheduler.ScheduleAbsolute(Disposed, () =>
- {
- outerSubscription.Dispose();
- innerSubscription.Dispose();
- });
-
- scheduler.Start();
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 570)
- );
-
- res.Messages.AssertEqual(
- OnError<string>(600, ex)
- );
- }
-
- [TestMethod]
- public void GroupBy_Inner_Escape_Dispose()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(220, " foo"),
- OnNext(240, " FoO "),
- OnNext(310, "foO "),
- OnNext(470, "FOO "),
- OnNext(530, " fOo "),
- OnError<string>(570, new Exception())
- );
-
- var outer = default(IObservable<IGroupedObservable<string, string>>);
- var outerSubscription = default(IDisposable);
- var inner = default(IObservable<string>);
- var innerSubscription = default(IDisposable);
- var res = scheduler.CreateObserver<string>();
-
- scheduler.ScheduleAbsolute(Created, () => outer = xs.GroupBy(x => x.Trim()));
-
- scheduler.ScheduleAbsolute(Subscribed, () => outerSubscription = outer.Subscribe(group =>
- {
- inner = group;
- }));
-
- scheduler.ScheduleAbsolute(400, () => outerSubscription.Dispose());
-
- scheduler.ScheduleAbsolute(600, () => innerSubscription = inner.Subscribe(res));
-
- scheduler.ScheduleAbsolute(Disposed, () =>
- {
- innerSubscription.Dispose();
- });
-
- scheduler.Start();
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 400)
- );
-
- res.Messages.AssertEqual(
- );
- }
-
- class GroupByComparer : IEqualityComparer<string>
- {
- TestScheduler scheduler;
- int equalsThrowsAfter;
- ushort getHashCodeThrowsAfter;
-
- public Exception HashCodeException = new Exception();
- public Exception EqualsException = new Exception();
-
- public GroupByComparer(TestScheduler scheduler, ushort equalsThrowsAfter, ushort getHashCodeThrowsAfter)
- {
- this.scheduler = scheduler;
- this.equalsThrowsAfter = equalsThrowsAfter;
- this.getHashCodeThrowsAfter = getHashCodeThrowsAfter;
- }
-
- public GroupByComparer(TestScheduler scheduler)
- : this(scheduler, ushort.MaxValue, ushort.MaxValue)
- {
- }
-
- public bool Equals(string x, string y)
- {
- if (scheduler.Clock > equalsThrowsAfter)
- throw EqualsException;
-
- return x.Equals(y, StringComparison.OrdinalIgnoreCase);
- }
-
- public int GetHashCode(string obj)
- {
- if (scheduler.Clock > getHashCodeThrowsAfter)
- throw HashCodeException;
-
- return StringComparer.OrdinalIgnoreCase.GetHashCode(obj);
- }
- }
-
- static string Reverse(string s)
- {
- var sb = new StringBuilder();
-
- for (var i = s.Length - 1; i >= 0; i--)
- sb.Append(s[i]);
-
- return sb.ToString();
- }
-
- #endregion
-
- #region + GroupByUntil +
-
- [TestMethod]
- public void GroupByUntil_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.GroupByUntil(default(IObservable<int>), DummyFunc<int, int>.Instance, DummyFunc<int, int>.Instance, DummyFunc<IGroupedObservable<int, int>, IObservable<int>>.Instance, EqualityComparer<int>.Default));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.GroupByUntil(DummyObservable<int>.Instance, default(Func<int, int>), DummyFunc<int, int>.Instance, DummyFunc<IGroupedObservable<int, int>, IObservable<int>>.Instance, EqualityComparer<int>.Default));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.GroupByUntil(DummyObservable<int>.Instance, DummyFunc<int, int>.Instance, default(Func<int, int>), DummyFunc<IGroupedObservable<int, int>, IObservable<int>>.Instance, EqualityComparer<int>.Default));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.GroupByUntil(DummyObservable<int>.Instance, DummyFunc<int, int>.Instance, DummyFunc<int, int>.Instance, default(Func<IGroupedObservable<int, int>, IObservable<int>>), EqualityComparer<int>.Default));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.GroupByUntil(DummyObservable<int>.Instance, DummyFunc<int, int>.Instance, DummyFunc<int, int>.Instance, DummyFunc<IGroupedObservable<int, int>, IObservable<int>>.Instance, default(IEqualityComparer<int>)));
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.GroupByUntil(default(IObservable<int>), DummyFunc<int, int>.Instance, DummyFunc<int, int>.Instance, DummyFunc<IGroupedObservable<int, int>, IObservable<int>>.Instance));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.GroupByUntil(DummyObservable<int>.Instance, default(Func<int, int>), DummyFunc<int, int>.Instance, DummyFunc<IGroupedObservable<int, int>, IObservable<int>>.Instance));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.GroupByUntil(DummyObservable<int>.Instance, DummyFunc<int, int>.Instance, default(Func<int, int>), DummyFunc<IGroupedObservable<int, int>, IObservable<int>>.Instance));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.GroupByUntil(DummyObservable<int>.Instance, DummyFunc<int, int>.Instance, DummyFunc<int, int>.Instance, default(Func<IGroupedObservable<int, int>, IObservable<int>>)));
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.GroupByUntil(default(IObservable<int>), DummyFunc<int, int>.Instance, DummyFunc<IGroupedObservable<int, int>, IObservable<int>>.Instance, EqualityComparer<int>.Default));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.GroupByUntil(DummyObservable<int>.Instance, default(Func<int, int>), DummyFunc<IGroupedObservable<int, int>, IObservable<int>>.Instance, EqualityComparer<int>.Default));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.GroupByUntil(DummyObservable<int>.Instance, DummyFunc<int, int>.Instance, default(Func<IGroupedObservable<int, int>, IObservable<int>>), EqualityComparer<int>.Default));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.GroupByUntil(DummyObservable<int>.Instance, DummyFunc<int, int>.Instance, DummyFunc<IGroupedObservable<int, int>, IObservable<int>>.Instance, default(IEqualityComparer<int>)));
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.GroupByUntil(default(IObservable<int>), DummyFunc<int, int>.Instance, DummyFunc<IGroupedObservable<int, int>, IObservable<int>>.Instance));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.GroupByUntil(DummyObservable<int>.Instance, default(Func<int, int>), DummyFunc<IGroupedObservable<int, int>, IObservable<int>>.Instance));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.GroupByUntil(DummyObservable<int>.Instance, DummyFunc<int, int>.Instance, default(Func<IGroupedObservable<int, int>, IObservable<int>>)));
- }
-
- [TestMethod]
- public void GroupByUntil_WithKeyComparer()
- {
- var scheduler = new TestScheduler();
-
- var keyInvoked = 0;
-
- var xs = scheduler.CreateHotObservable(
- OnNext(90, "error"),
- OnNext(110, "error"),
- OnNext(130, "error"),
- OnNext(220, " foo"),
- OnNext(240, " FoO "),
- OnNext(270, "baR "),
- OnNext(310, "foO "),
- OnNext(350, " Baz "),
- OnNext(360, " qux "),
- OnNext(390, " bar"),
- OnNext(420, " BAR "),
- OnNext(470, "FOO "),
- OnNext(480, "baz "),
- OnNext(510, " bAZ "),
- OnNext(530, " fOo "),
- OnCompleted<string>(570),
- OnNext(580, "error"),
- OnCompleted<string>(600),
- OnError<string>(650, new Exception())
- );
-
- var comparer = new GroupByComparer(scheduler);
-
- var res = scheduler.Start(() =>
- xs.GroupByUntil(
- x =>
- {
- keyInvoked++;
- return x.Trim();
- },
- g => g.Skip(2),
- comparer
- ).Select(g => g.Key)
- );
-
- res.Messages.AssertEqual(
- OnNext(220, "foo"),
- OnNext(270, "baR"),
- OnNext(350, "Baz"),
- OnNext(360, "qux"),
- OnNext(470, "FOO"),
- OnCompleted<string>(570)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 570)
- );
-
- Assert.AreEqual(12, keyInvoked);
- }
-
- [TestMethod]
- public void GroupByUntil_Outer_Complete()
- {
- var scheduler = new TestScheduler();
-
- var keyInvoked = 0;
- var eleInvoked = 0;
-
- var xs = scheduler.CreateHotObservable(
- OnNext(90, "error"),
- OnNext(110, "error"),
- OnNext(130, "error"),
- OnNext(220, " foo"),
- OnNext(240, " FoO "),
- OnNext(270, "baR "),
- OnNext(310, "foO "),
- OnNext(350, " Baz "),
- OnNext(360, " qux "),
- OnNext(390, " bar"),
- OnNext(420, " BAR "),
- OnNext(470, "FOO "),
- OnNext(480, "baz "),
- OnNext(510, " bAZ "),
- OnNext(530, " fOo "),
- OnCompleted<string>(570),
- OnNext(580, "error"),
- OnCompleted<string>(600),
- OnError<string>(650, new Exception())
- );
-
- var comparer = new GroupByComparer(scheduler);
-
- var res = scheduler.Start(() =>
- xs.GroupByUntil(
- x =>
- {
- keyInvoked++;
- return x.Trim();
- },
- x =>
- {
- eleInvoked++;
- return Reverse(x);
- },
- g => g.Skip(2),
- comparer
- ).Select(g => g.Key)
- );
-
- res.Messages.AssertEqual(
- OnNext(220, "foo"),
- OnNext(270, "baR"),
- OnNext(350, "Baz"),
- OnNext(360, "qux"),
- OnNext(470, "FOO"),
- OnCompleted<string>(570)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 570)
- );
-
- Assert.AreEqual(12, keyInvoked);
- Assert.AreEqual(12, eleInvoked);
- }
-
- [TestMethod]
- public void GroupByUntil_Outer_Error()
- {
- var scheduler = new TestScheduler();
-
- var keyInvoked = 0;
- var eleInvoked = 0;
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(90, "error"),
- OnNext(110, "error"),
- OnNext(130, "error"),
- OnNext(220, " foo"),
- OnNext(240, " FoO "),
- OnNext(270, "baR "),
- OnNext(310, "foO "),
- OnNext(350, " Baz "),
- OnNext(360, " qux "),
- OnNext(390, " bar"),
- OnNext(420, " BAR "),
- OnNext(470, "FOO "),
- OnNext(480, "baz "),
- OnNext(510, " bAZ "),
- OnNext(530, " fOo "),
- OnError<string>(570, ex),
- OnNext(580, "error"),
- OnCompleted<string>(600),
- OnError<string>(650, new Exception())
- );
-
- var comparer = new GroupByComparer(scheduler);
-
- var res = scheduler.Start(() =>
- xs.GroupByUntil(
- x =>
- {
- keyInvoked++;
- return x.Trim();
- },
- x =>
- {
- eleInvoked++;
- return Reverse(x);
- },
- g => g.Skip(2),
- comparer
- ).Select(g => g.Key)
- );
-
- res.Messages.AssertEqual(
- OnNext(220, "foo"),
- OnNext(270, "baR"),
- OnNext(350, "Baz"),
- OnNext(360, "qux"),
- OnNext(470, "FOO"),
- OnError<string>(570, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 570)
- );
-
- Assert.AreEqual(12, keyInvoked);
- Assert.AreEqual(12, eleInvoked);
- }
-
- [TestMethod]
- public void GroupByUntil_Outer_Dispose()
- {
- var scheduler = new TestScheduler();
-
- var keyInvoked = 0;
- var eleInvoked = 0;
-
- var xs = scheduler.CreateHotObservable(
- OnNext(90, "error"),
- OnNext(110, "error"),
- OnNext(130, "error"),
- OnNext(220, " foo"),
- OnNext(240, " FoO "),
- OnNext(270, "baR "),
- OnNext(310, "foO "),
- OnNext(350, " Baz "),
- OnNext(360, " qux "),
- OnNext(390, " bar"),
- OnNext(420, " BAR "),
- OnNext(470, "FOO "),
- OnNext(480, "baz "),
- OnNext(510, " bAZ "),
- OnNext(530, " fOo "),
- OnCompleted<string>(570),
- OnNext(580, "error"),
- OnCompleted<string>(600),
- OnError<string>(650, new Exception())
- );
-
- var comparer = new GroupByComparer(scheduler);
-
- var res = scheduler.Start(() =>
- xs.GroupByUntil(
- x =>
- {
- keyInvoked++;
- return x.Trim();
- },
- x =>
- {
- eleInvoked++;
- return Reverse(x);
- },
- g => g.Skip(2),
- comparer
- ).Select(g => g.Key),
- 355
- );
-
- res.Messages.AssertEqual(
- OnNext(220, "foo"),
- OnNext(270, "baR"),
- OnNext(350, "Baz")
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 355)
- );
-
- Assert.AreEqual(5, keyInvoked);
- Assert.AreEqual(5, eleInvoked);
- }
-
- [TestMethod]
- public void GroupByUntil_Outer_KeyThrow()
- {
- var scheduler = new TestScheduler();
-
- var keyInvoked = 0;
- var eleInvoked = 0;
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(90, "error"),
- OnNext(110, "error"),
- OnNext(130, "error"),
- OnNext(220, " foo"),
- OnNext(240, " FoO "),
- OnNext(270, "baR "),
- OnNext(310, "foO "),
- OnNext(350, " Baz "),
- OnNext(360, " qux "),
- OnNext(390, " bar"),
- OnNext(420, " BAR "),
- OnNext(470, "FOO "),
- OnNext(480, "baz "),
- OnNext(510, " bAZ "),
- OnNext(530, " fOo "),
- OnCompleted<string>(570),
- OnNext(580, "error"),
- OnCompleted<string>(600),
- OnError<string>(650, new Exception())
- );
-
- var comparer = new GroupByComparer(scheduler);
-
- var res = scheduler.Start(() =>
- xs.GroupByUntil(
- x =>
- {
- keyInvoked++;
- if (keyInvoked == 10)
- throw ex;
- return x.Trim();
- },
- x =>
- {
- eleInvoked++;
- return Reverse(x);
- },
- g => g.Skip(2),
- comparer
- ).Select(g => g.Key)
- );
-
- res.Messages.AssertEqual(
- OnNext(220, "foo"),
- OnNext(270, "baR"),
- OnNext(350, "Baz"),
- OnNext(360, "qux"),
- OnNext(470, "FOO"),
- OnError<string>(480, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 480)
- );
-
- Assert.AreEqual(10, keyInvoked);
- Assert.AreEqual(9, eleInvoked);
- }
-
- [TestMethod]
- public void GroupByUntil_Outer_EleThrow()
- {
- var scheduler = new TestScheduler();
-
- var keyInvoked = 0;
- var eleInvoked = 0;
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(90, "error"),
- OnNext(110, "error"),
- OnNext(130, "error"),
- OnNext(220, " foo"),
- OnNext(240, " FoO "),
- OnNext(270, "baR "),
- OnNext(310, "foO "),
- OnNext(350, " Baz "),
- OnNext(360, " qux "),
- OnNext(390, " bar"),
- OnNext(420, " BAR "),
- OnNext(470, "FOO "),
- OnNext(480, "baz "),
- OnNext(510, " bAZ "),
- OnNext(530, " fOo "),
- OnCompleted<string>(570),
- OnNext(580, "error"),
- OnCompleted<string>(600),
- OnError<string>(650, new Exception())
- );
-
- var comparer = new GroupByComparer(scheduler);
-
- var res = scheduler.Start(() =>
- xs.GroupByUntil(
- x =>
- {
- keyInvoked++;
- return x.Trim();
- },
- x =>
- {
- eleInvoked++;
- if (eleInvoked == 10)
- throw ex;
- return Reverse(x);
- },
- g => g.Skip(2),
- comparer
- ).Select(g => g.Key)
- );
-
- res.Messages.AssertEqual(
- OnNext(220, "foo"),
- OnNext(270, "baR"),
- OnNext(350, "Baz"),
- OnNext(360, "qux"),
- OnNext(470, "FOO"),
- OnError<string>(480, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 480)
- );
-
- Assert.AreEqual(10, keyInvoked);
- Assert.AreEqual(10, eleInvoked);
- }
-
- [TestMethod]
- public void GroupByUntil_Outer_ComparerEqualsThrow()
- {
- var scheduler = new TestScheduler();
-
- var keyInvoked = 0;
- var eleInvoked = 0;
-
- var xs = scheduler.CreateHotObservable(
- OnNext(90, "error"),
- OnNext(110, "error"),
- OnNext(130, "error"),
- OnNext(220, " foo"),
- OnNext(240, " FoO "),
- OnNext(270, "baR "),
- OnNext(310, "foO "),
- OnNext(350, " Baz "),
- OnNext(360, " qux "),
- OnNext(390, " bar"),
- OnNext(420, " BAR "),
- OnNext(470, "FOO "),
- OnNext(480, "baz "),
- OnNext(510, " bAZ "),
- OnNext(530, " fOo "),
- OnCompleted<string>(570),
- OnNext(580, "error"),
- OnCompleted<string>(600),
- OnError<string>(650, new Exception())
- );
-
- var comparer = new GroupByComparer(scheduler, 250, ushort.MaxValue);
-
- var res = scheduler.Start(() =>
- xs.GroupByUntil(
- x =>
- {
- keyInvoked++;
- return x.Trim();
- },
- x =>
- {
- eleInvoked++;
- return Reverse(x);
- },
- g => g.Skip(2),
- comparer
- ).Select(g => g.Key)
- );
-
- res.Messages.AssertEqual(
- OnNext(220, "foo"),
- OnNext(270, "baR"),
- OnError<string>(310, comparer.EqualsException)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 310)
- );
-
- Assert.AreEqual(4, keyInvoked);
- Assert.AreEqual(3, eleInvoked);
- }
-
- [TestMethod]
- public void GroupByUntil_Outer_ComparerGetHashCodeThrow()
- {
- var scheduler = new TestScheduler();
-
- var keyInvoked = 0;
- var eleInvoked = 0;
-
- var xs = scheduler.CreateHotObservable(
- OnNext(90, "error"),
- OnNext(110, "error"),
- OnNext(130, "error"),
- OnNext(220, " foo"),
- OnNext(240, " FoO "),
- OnNext(270, "baR "),
- OnNext(310, "foO "),
- OnNext(350, " Baz "),
- OnNext(360, " qux "),
- OnNext(390, " bar"),
- OnNext(420, " BAR "),
- OnNext(470, "FOO "),
- OnNext(480, "baz "),
- OnNext(510, " bAZ "),
- OnNext(530, " fOo "),
- OnCompleted<string>(570),
- OnNext(580, "error"),
- OnCompleted<string>(600),
- OnError<string>(650, new Exception())
- );
-
- var comparer = new GroupByComparer(scheduler, ushort.MaxValue, 410);
-
- var res = scheduler.Start(() =>
- xs.GroupByUntil(
- x =>
- {
- keyInvoked++;
- return x.Trim();
- },
- x =>
- {
- eleInvoked++;
- return Reverse(x);
- },
- g => g.Skip(2),
- comparer
- ).Select(g => g.Key)
- );
-
- res.Messages.AssertEqual(
- OnNext(220, "foo"),
- OnNext(270, "baR"),
- OnNext(350, "Baz"),
- OnNext(360, "qux"),
- OnError<string>(420, comparer.HashCodeException)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 420)
- );
-
- Assert.AreEqual(8, keyInvoked);
- Assert.AreEqual(7, eleInvoked);
- }
-
- [TestMethod]
- public void GroupByUntil_Inner_Complete()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(90, "error"),
- OnNext(110, "error"),
- OnNext(130, "error"),
- OnNext(220, " foo"),
- OnNext(240, " FoO "),
- OnNext(270, "baR "),
- OnNext(310, "foO "),
- OnNext(350, " Baz "),
- OnNext(360, " qux "),
- OnNext(390, " bar"),
- OnNext(420, " BAR "),
- OnNext(470, "FOO "),
- OnNext(480, "baz "),
- OnNext(510, " bAZ "),
- OnNext(530, " fOo "),
- OnCompleted<string>(570),
- OnNext(580, "error"),
- OnCompleted<string>(600),
- OnError<string>(650, new Exception())
- );
-
- var comparer = new GroupByComparer(scheduler);
- var outer = default(IObservable<IGroupedObservable<string, string>>);
- var outerSubscription = default(IDisposable);
- var inners = new Dictionary<string, IObservable<string>>();
- var innerSubscriptions = new Dictionary<string, IDisposable>();
- var res = new Dictionary<string, ITestableObserver<string>>();
-
- scheduler.ScheduleAbsolute(Created, () => outer = xs.GroupByUntil(x => x.Trim(), x => Reverse(x), g => g.Skip(2), comparer));
-
- scheduler.ScheduleAbsolute(Subscribed, () => outerSubscription = outer.Subscribe(group =>
- {
- var result = scheduler.CreateObserver<string>();
- inners[group.Key] = group;
- res[group.Key] = result;
- scheduler.ScheduleRelative(100, () => innerSubscriptions[group.Key] = group.Subscribe(result));
- }));
-
- scheduler.ScheduleAbsolute(Disposed, () =>
- {
- outerSubscription.Dispose();
- foreach (var d in innerSubscriptions.Values)
- d.Dispose();
- });
-
- scheduler.Start();
-
- Assert.AreEqual(5, inners.Count);
-
- res["foo"].Messages.AssertEqual(
- OnCompleted<string>(320)
- );
-
- res["baR"].Messages.AssertEqual(
- OnNext(390, "rab "),
- OnCompleted<string>(420)
- );
-
- res["Baz"].Messages.AssertEqual(
- OnNext(480, " zab"),
- OnCompleted<string>(510)
- );
-
- res["qux"].Messages.AssertEqual(
- OnCompleted<string>(570)
- );
-
- res["FOO"].Messages.AssertEqual(
- OnCompleted<string>(570)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 570)
- );
- }
-
- [TestMethod]
- public void GroupByUntil_Inner_Complete_All()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(90, "error"),
- OnNext(110, "error"),
- OnNext(130, "error"),
- OnNext(220, " foo"),
- OnNext(240, " FoO "),
- OnNext(270, "baR "),
- OnNext(310, "foO "),
- OnNext(350, " Baz "),
- OnNext(360, " qux "),
- OnNext(390, " bar"),
- OnNext(420, " BAR "),
- OnNext(470, "FOO "),
- OnNext(480, "baz "),
- OnNext(510, " bAZ "),
- OnNext(530, " fOo "),
- OnCompleted<string>(570),
- OnNext(580, "error"),
- OnCompleted<string>(600),
- OnError<string>(650, new Exception())
- );
-
- var comparer = new GroupByComparer(scheduler);
- var outer = default(IObservable<IGroupedObservable<string, string>>);
- var outerSubscription = default(IDisposable);
- var inners = new Dictionary<string, IObservable<string>>();
- var innerSubscriptions = new Dictionary<string, IDisposable>();
- var res = new Dictionary<string, ITestableObserver<string>>();
-
- scheduler.ScheduleAbsolute(Created, () => outer = xs.GroupByUntil(x => x.Trim(), x => Reverse(x), g => g.Skip(2), comparer));
-
- scheduler.ScheduleAbsolute(Subscribed, () => outerSubscription = outer.Subscribe(group =>
- {
- var result = scheduler.CreateObserver<string>();
- inners[group.Key] = group;
- res[group.Key] = result;
- innerSubscriptions[group.Key] = group.Subscribe(result);
- }));
-
- scheduler.ScheduleAbsolute(Disposed, () =>
- {
- outerSubscription.Dispose();
- foreach (var d in innerSubscriptions.Values)
- d.Dispose();
- });
-
- scheduler.Start();
-
- Assert.AreEqual(5, inners.Count);
-
- res["foo"].Messages.AssertEqual(
- OnNext(220, "oof "),
- OnNext(240, " OoF "),
- OnNext(310, " Oof"),
- OnCompleted<string>(310)
- );
-
- res["baR"].Messages.AssertEqual(
- OnNext(270, " Rab"),
- OnNext(390, "rab "),
- OnNext(420, " RAB "),
- OnCompleted<string>(420)
- );
-
- res["Baz"].Messages.AssertEqual(
- OnNext(350, " zaB "),
- OnNext(480, " zab"),
- OnNext(510, " ZAb "),
- OnCompleted<string>(510)
- );
-
- res["qux"].Messages.AssertEqual(
- OnNext(360, " xuq "),
- OnCompleted<string>(570)
- );
-
- res["FOO"].Messages.AssertEqual(
- OnNext(470, " OOF"),
- OnNext(530, " oOf "),
- OnCompleted<string>(570)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 570)
- );
- }
-
- [TestMethod]
- public void GroupByUntil_Inner_Error()
- {
- var scheduler = new TestScheduler();
-
- var ex1 = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(90, "error"),
- OnNext(110, "error"),
- OnNext(130, "error"),
- OnNext(220, " foo"),
- OnNext(240, " FoO "),
- OnNext(270, "baR "),
- OnNext(310, "foO "),
- OnNext(350, " Baz "),
- OnNext(360, " qux "),
- OnNext(390, " bar"),
- OnNext(420, " BAR "),
- OnNext(470, "FOO "),
- OnNext(480, "baz "),
- OnNext(510, " bAZ "),
- OnNext(530, " fOo "),
- OnError<string>(570, ex1),
- OnNext(580, "error"),
- OnCompleted<string>(600),
- OnError<string>(650, new Exception())
- );
-
- var comparer = new GroupByComparer(scheduler);
- var outer = default(IObservable<IGroupedObservable<string, string>>);
- var outerSubscription = default(IDisposable);
- var inners = new Dictionary<string, IObservable<string>>();
- var innerSubscriptions = new Dictionary<string, IDisposable>();
- var res = new Dictionary<string, ITestableObserver<string>>();
-
- scheduler.ScheduleAbsolute(Created, () => outer = xs.GroupByUntil(x => x.Trim(), x => Reverse(x), g => g.Skip(2), comparer));
-
- scheduler.ScheduleAbsolute(Subscribed, () => outerSubscription = outer.Subscribe(group =>
- {
- var result = scheduler.CreateObserver<string>();
- inners[group.Key] = group;
- res[group.Key] = result;
- scheduler.ScheduleRelative(100, () => innerSubscriptions[group.Key] = group.Subscribe(result));
- }, ex => { }));
-
- scheduler.ScheduleAbsolute(Disposed, () =>
- {
- outerSubscription.Dispose();
- foreach (var d in innerSubscriptions.Values)
- d.Dispose();
- });
-
- scheduler.Start();
-
- Assert.AreEqual(5, inners.Count);
-
- res["foo"].Messages.AssertEqual(
- OnCompleted<string>(320)
- );
-
- res["baR"].Messages.AssertEqual(
- OnNext(390, "rab "),
- OnCompleted<string>(420)
- );
-
- res["Baz"].Messages.AssertEqual(
- OnNext(480, " zab"),
- OnCompleted<string>(510)
- );
-
- res["qux"].Messages.AssertEqual(
- OnError<string>(570, ex1)
- );
-
- res["FOO"].Messages.AssertEqual(
- OnError<string>(570, ex1)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 570)
- );
- }
-
- [TestMethod]
- public void GroupByUntil_Inner_Dispose()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(90, "error"),
- OnNext(110, "error"),
- OnNext(130, "error"),
- OnNext(220, " foo"),
- OnNext(240, " FoO "),
- OnNext(270, "baR "),
- OnNext(310, "foO "),
- OnNext(350, " Baz "),
- OnNext(360, " qux "),
- OnNext(390, " bar"),
- OnNext(420, " BAR "),
- OnNext(470, "FOO "),
- OnNext(480, "baz "),
- OnNext(510, " bAZ "),
- OnNext(530, " fOo "),
- OnCompleted<string>(570),
- OnNext(580, "error"),
- OnCompleted<string>(600),
- OnError<string>(650, new Exception())
- );
-
- var comparer = new GroupByComparer(scheduler);
- var outer = default(IObservable<IGroupedObservable<string, string>>);
- var outerSubscription = default(IDisposable);
- var inners = new Dictionary<string, IObservable<string>>();
- var innerSubscriptions = new Dictionary<string, IDisposable>();
- var res = new Dictionary<string, ITestableObserver<string>>();
-
- scheduler.ScheduleAbsolute(Created, () => outer = xs.GroupByUntil(x => x.Trim(), x => Reverse(x), g => g.Skip(2), comparer));
-
- scheduler.ScheduleAbsolute(Subscribed, () => outerSubscription = outer.Subscribe(group =>
- {
- var result = scheduler.CreateObserver<string>();
- inners[group.Key] = group;
- res[group.Key] = result;
- innerSubscriptions[group.Key] = group.Subscribe(result);
- }));
-
- scheduler.ScheduleAbsolute(400, () =>
- {
- outerSubscription.Dispose();
- foreach (var d in innerSubscriptions.Values)
- d.Dispose();
- });
-
- scheduler.Start();
-
- Assert.AreEqual(4, inners.Count);
-
- res["foo"].Messages.AssertEqual(
- OnNext(220, "oof "),
- OnNext(240, " OoF "),
- OnNext(310, " Oof"),
- OnCompleted<string>(310)
- );
-
- res["baR"].Messages.AssertEqual(
- OnNext(270, " Rab"),
- OnNext(390, "rab ")
- );
-
- res["Baz"].Messages.AssertEqual(
- OnNext(350, " zaB ")
- );
-
- res["qux"].Messages.AssertEqual(
- OnNext(360, " xuq ")
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 400)
- );
- }
-
- [TestMethod]
- public void GroupByUntil_Inner_KeyThrow()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(90, "error"),
- OnNext(110, "error"),
- OnNext(130, "error"),
- OnNext(220, " foo"),
- OnNext(240, " FoO "),
- OnNext(270, "baR "),
- OnNext(310, "foO "),
- OnNext(350, " Baz "),
- OnNext(360, " qux "),
- OnNext(390, " bar"),
- OnNext(420, " BAR "),
- OnNext(470, "FOO "),
- OnNext(480, "baz "),
- OnNext(510, " bAZ "),
- OnNext(530, " fOo "),
- OnCompleted<string>(570),
- OnNext(580, "error"),
- OnCompleted<string>(600),
- OnError<string>(650, new Exception())
- );
-
- var comparer = new GroupByComparer(scheduler);
- var outer = default(IObservable<IGroupedObservable<string, string>>);
- var outerSubscription = default(IDisposable);
- var inners = new Dictionary<string, IObservable<string>>();
- var innerSubscriptions = new Dictionary<string, IDisposable>();
- var res = new Dictionary<string, ITestableObserver<string>>();
-
- var keyInvoked = 0;
- var ex = new Exception();
-
- scheduler.ScheduleAbsolute(Created, () => outer = xs.GroupByUntil(x =>
- {
- keyInvoked++;
- if (keyInvoked == 6)
- throw ex;
- return x.Trim();
- }, x => Reverse(x), g => g.Skip(2), comparer));
-
- scheduler.ScheduleAbsolute(Subscribed, () => outerSubscription = outer.Subscribe(group =>
- {
- var result = scheduler.CreateObserver<string>();
- inners[group.Key] = group;
- res[group.Key] = result;
- innerSubscriptions[group.Key] = group.Subscribe(result);
- }, _ => { }));
-
- scheduler.ScheduleAbsolute(Disposed, () =>
- {
- outerSubscription.Dispose();
- foreach (var d in innerSubscriptions.Values)
- d.Dispose();
- });
-
- scheduler.Start();
-
- Assert.AreEqual(3, inners.Count);
-
- res["foo"].Messages.AssertEqual(
- OnNext(220, "oof "),
- OnNext(240, " OoF "),
- OnNext(310, " Oof"),
- OnCompleted<string>(310)
- );
-
- res["baR"].Messages.AssertEqual(
- OnNext(270, " Rab"),
- OnError<string>(360, ex)
- );
-
- res["Baz"].Messages.AssertEqual(
- OnNext(350, " zaB "),
- OnError<string>(360, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 360)
- );
- }
-
- [TestMethod]
- public void GroupByUntil_Inner_EleThrow()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(90, "error"),
- OnNext(110, "error"),
- OnNext(130, "error"),
- OnNext(220, " foo"),
- OnNext(240, " FoO "),
- OnNext(270, "baR "),
- OnNext(310, "foO "),
- OnNext(350, " Baz "),
- OnNext(360, " qux "),
- OnNext(390, " bar"),
- OnNext(420, " BAR "),
- OnNext(470, "FOO "),
- OnNext(480, "baz "),
- OnNext(510, " bAZ "),
- OnNext(530, " fOo "),
- OnCompleted<string>(570),
- OnNext(580, "error"),
- OnCompleted<string>(600),
- OnError<string>(650, new Exception())
- );
-
- var comparer = new GroupByComparer(scheduler);
- var outer = default(IObservable<IGroupedObservable<string, string>>);
- var outerSubscription = default(IDisposable);
- var inners = new Dictionary<string, IObservable<string>>();
- var innerSubscriptions = new Dictionary<string, IDisposable>();
- var res = new Dictionary<string, ITestableObserver<string>>();
-
- var eleInvoked = 0;
- var ex = new Exception();
-
- scheduler.ScheduleAbsolute(Created, () => outer = xs.GroupByUntil(x => x.Trim(), x =>
- {
- eleInvoked++;
- if (eleInvoked == 6)
- throw ex;
- return Reverse(x);
- }, g => g.Skip(2), comparer));
-
- scheduler.ScheduleAbsolute(Subscribed, () => outerSubscription = outer.Subscribe(group =>
- {
- var result = scheduler.CreateObserver<string>();
- inners[group.Key] = group;
- res[group.Key] = result;
- innerSubscriptions[group.Key] = group.Subscribe(result);
- }, _ => { }));
-
- scheduler.ScheduleAbsolute(Disposed, () =>
- {
- outerSubscription.Dispose();
- foreach (var d in innerSubscriptions.Values)
- d.Dispose();
- });
-
- scheduler.Start();
-
- Assert.AreEqual(4, inners.Count);
-
- res["foo"].Messages.AssertEqual(
- OnNext(220, "oof "),
- OnNext(240, " OoF "),
- OnNext(310, " Oof"),
- OnCompleted<string>(310)
- );
-
- res["baR"].Messages.AssertEqual(
- OnNext(270, " Rab"),
- OnError<string>(360, ex)
- );
-
- res["Baz"].Messages.AssertEqual(
- OnNext(350, " zaB "),
- OnError<string>(360, ex)
- );
-
- res["qux"].Messages.AssertEqual(
- OnError<string>(360, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 360)
- );
- }
-
- [TestMethod]
- public void GroupByUntil_Inner_Comparer_EqualsThrow()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(90, "error"),
- OnNext(110, "error"),
- OnNext(130, "error"),
- OnNext(220, " foo"),
- OnNext(240, " FoO "),
- OnNext(270, "baR "),
- OnNext(310, "foO "),
- OnNext(350, " Baz "),
- OnNext(360, " qux "),
- OnNext(390, " bar"),
- OnNext(420, " BAR "),
- OnNext(470, "FOO "),
- OnNext(480, "baz "),
- OnNext(510, " bAZ "),
- OnNext(530, " fOo "),
- OnCompleted<string>(570),
- OnNext(580, "error"),
- OnCompleted<string>(600),
- OnError<string>(650, new Exception())
- );
-
- var comparer = new GroupByComparer(scheduler, 400, ushort.MaxValue);
- var outer = default(IObservable<IGroupedObservable<string, string>>);
- var outerSubscription = default(IDisposable);
- var inners = new Dictionary<string, IObservable<string>>();
- var innerSubscriptions = new Dictionary<string, IDisposable>();
- var res = new Dictionary<string, ITestableObserver<string>>();
-
- scheduler.ScheduleAbsolute(Created, () => outer = xs.GroupByUntil(x => x.Trim(), x => Reverse(x), g => g.Skip(2), comparer));
-
- scheduler.ScheduleAbsolute(Subscribed, () => outerSubscription = outer.Subscribe(group =>
- {
- var result = scheduler.CreateObserver<string>();
- inners[group.Key] = group;
- res[group.Key] = result;
- innerSubscriptions[group.Key] = group.Subscribe(result);
- }, _ => { }));
-
- scheduler.ScheduleAbsolute(Disposed, () =>
- {
- outerSubscription.Dispose();
- foreach (var d in innerSubscriptions.Values)
- d.Dispose();
- });
-
- scheduler.Start();
-
- Assert.AreEqual(4, inners.Count);
-
- res["foo"].Messages.AssertEqual(
- OnNext(220, "oof "),
- OnNext(240, " OoF "),
- OnNext(310, " Oof"),
- OnCompleted<string>(310)
- );
-
- res["baR"].Messages.AssertEqual(
- OnNext(270, " Rab"),
- OnNext(390, "rab "),
- OnError<string>(420, comparer.EqualsException)
- );
-
- res["Baz"].Messages.AssertEqual(
- OnNext(350, " zaB "),
- OnError<string>(420, comparer.EqualsException)
- );
-
- res["qux"].Messages.AssertEqual(
- OnNext(360, " xuq "),
- OnError<string>(420, comparer.EqualsException)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 420)
- );
- }
-
- [TestMethod]
- public void GroupByUntil_Inner_Comparer_GetHashCodeThrow()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(90, "error"),
- OnNext(110, "error"),
- OnNext(130, "error"),
- OnNext(220, " foo"),
- OnNext(240, " FoO "),
- OnNext(270, "baR "),
- OnNext(310, "foO "),
- OnNext(350, " Baz "),
- OnNext(360, " qux "),
- OnNext(390, " bar"),
- OnNext(420, " BAR "),
- OnNext(470, "FOO "),
- OnNext(480, "baz "),
- OnNext(510, " bAZ "),
- OnNext(530, " fOo "),
- OnCompleted<string>(570),
- OnNext(580, "error"),
- OnCompleted<string>(600),
- OnError<string>(650, new Exception())
- );
-
- var comparer = new GroupByComparer(scheduler, ushort.MaxValue, 400);
- var outer = default(IObservable<IGroupedObservable<string, string>>);
- var outerSubscription = default(IDisposable);
- var inners = new Dictionary<string, IObservable<string>>();
- var innerSubscriptions = new Dictionary<string, IDisposable>();
- var res = new Dictionary<string, ITestableObserver<string>>();
-
- scheduler.ScheduleAbsolute(Created, () => outer = xs.GroupByUntil(x => x.Trim(), x => Reverse(x), g => g.Skip(2), comparer));
-
- scheduler.ScheduleAbsolute(Subscribed, () => outerSubscription = outer.Subscribe(group =>
- {
- var result = scheduler.CreateObserver<string>();
- inners[group.Key] = group;
- res[group.Key] = result;
- innerSubscriptions[group.Key] = group.Subscribe(result);
- }, _ => { }));
-
- scheduler.ScheduleAbsolute(Disposed, () =>
- {
- outerSubscription.Dispose();
- foreach (var d in innerSubscriptions.Values)
- d.Dispose();
- });
-
- scheduler.Start();
-
- Assert.AreEqual(4, inners.Count);
-
- res["foo"].Messages.AssertEqual(
- OnNext(220, "oof "),
- OnNext(240, " OoF "),
- OnNext(310, " Oof"),
- OnCompleted<string>(310)
- );
-
- res["baR"].Messages.AssertEqual(
- OnNext(270, " Rab"),
- OnNext(390, "rab "),
- OnError<string>(420, comparer.HashCodeException)
- );
-
- res["Baz"].Messages.AssertEqual(
- OnNext(350, " zaB "),
- OnError<string>(420, comparer.HashCodeException)
- );
-
- res["qux"].Messages.AssertEqual(
- OnNext(360, " xuq "),
- OnError<string>(420, comparer.HashCodeException)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 420)
- );
- }
-
- [TestMethod]
- public void GroupByUntil_Outer_Independence()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(90, "error"),
- OnNext(110, "error"),
- OnNext(130, "error"),
- OnNext(220, " foo"),
- OnNext(240, " FoO "),
- OnNext(270, "baR "),
- OnNext(310, "foO "),
- OnNext(350, " Baz "),
- OnNext(360, " qux "),
- OnNext(390, " bar"),
- OnNext(420, " BAR "),
- OnNext(470, "FOO "),
- OnNext(480, "baz "),
- OnNext(510, " bAZ "),
- OnNext(530, " fOo "),
- OnCompleted<string>(570),
- OnNext(580, "error"),
- OnCompleted<string>(600),
- OnError<string>(650, new Exception())
- );
-
- var comparer = new GroupByComparer(scheduler);
- var outer = default(IObservable<IGroupedObservable<string, string>>);
- var outerSubscription = default(IDisposable);
- var inners = new Dictionary<string, IObservable<string>>();
- var innerSubscriptions = new Dictionary<string, IDisposable>();
- var res = new Dictionary<string, ITestableObserver<string>>();
- var outerResults = scheduler.CreateObserver<string>();
-
- scheduler.ScheduleAbsolute(Created, () => outer = xs.GroupByUntil(x => x.Trim(), x => Reverse(x), g => g.Skip(2), comparer));
-
- scheduler.ScheduleAbsolute(Subscribed, () => outerSubscription = outer.Subscribe(group =>
- {
- outerResults.OnNext(group.Key);
- var result = scheduler.CreateObserver<string>();
- inners[group.Key] = group;
- res[group.Key] = result;
- innerSubscriptions[group.Key] = group.Subscribe(result);
- }, outerResults.OnError, outerResults.OnCompleted));
-
- scheduler.ScheduleAbsolute(Disposed, () =>
- {
- outerSubscription.Dispose();
- foreach (var d in innerSubscriptions.Values)
- d.Dispose();
- });
-
- scheduler.ScheduleAbsolute(320, () => outerSubscription.Dispose());
-
- scheduler.Start();
-
- Assert.AreEqual(2, inners.Count);
-
- outerResults.Messages.AssertEqual(
- OnNext(220, "foo"),
- OnNext(270, "baR")
- );
-
- res["foo"].Messages.AssertEqual(
- OnNext(220, "oof "),
- OnNext(240, " OoF "),
- OnNext(310, " Oof"),
- OnCompleted<string>(310)
- );
-
- res["baR"].Messages.AssertEqual(
- OnNext(270, " Rab"),
- OnNext(390, "rab "),
- OnNext(420, " RAB "),
- OnCompleted<string>(420)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 420)
- );
- }
-
- [TestMethod]
- public void GroupByUntil_Inner_Independence()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(90, "error"),
- OnNext(110, "error"),
- OnNext(130, "error"),
- OnNext(220, " foo"),
- OnNext(240, " FoO "),
- OnNext(270, "baR "),
- OnNext(310, "foO "),
- OnNext(350, " Baz "),
- OnNext(360, " qux "),
- OnNext(390, " bar"),
- OnNext(420, " BAR "),
- OnNext(470, "FOO "),
- OnNext(480, "baz "),
- OnNext(510, " bAZ "),
- OnNext(530, " fOo "),
- OnCompleted<string>(570),
- OnNext(580, "error"),
- OnCompleted<string>(600),
- OnError<string>(650, new Exception())
- );
-
- var comparer = new GroupByComparer(scheduler);
- var outer = default(IObservable<IGroupedObservable<string, string>>);
- var outerSubscription = default(IDisposable);
- var inners = new Dictionary<string, IObservable<string>>();
- var innerSubscriptions = new Dictionary<string, IDisposable>();
- var res = new Dictionary<string, ITestableObserver<string>>();
- var outerResults = scheduler.CreateObserver<string>();
-
- scheduler.ScheduleAbsolute(Created, () => outer = xs.GroupByUntil(x => x.Trim(), x => Reverse(x), g => g.Skip(2), comparer));
-
- scheduler.ScheduleAbsolute(Subscribed, () => outerSubscription = outer.Subscribe(group =>
- {
- outerResults.OnNext(group.Key);
- var result = scheduler.CreateObserver<string>();
- inners[group.Key] = group;
- res[group.Key] = result;
- innerSubscriptions[group.Key] = group.Subscribe(result);
- }, outerResults.OnError, outerResults.OnCompleted));
-
- scheduler.ScheduleAbsolute(Disposed, () =>
- {
- outerSubscription.Dispose();
- foreach (var d in innerSubscriptions.Values)
- d.Dispose();
- });
-
- scheduler.ScheduleAbsolute(320, () => innerSubscriptions["foo"].Dispose());
-
- scheduler.Start();
-
- Assert.AreEqual(5, inners.Count);
-
- res["foo"].Messages.AssertEqual(
- OnNext(220, "oof "),
- OnNext(240, " OoF "),
- OnNext(310, " Oof"),
- OnCompleted<string>(310)
- );
-
- res["baR"].Messages.AssertEqual(
- OnNext(270, " Rab"),
- OnNext(390, "rab "),
- OnNext(420, " RAB "),
- OnCompleted<string>(420)
- );
-
- res["Baz"].Messages.AssertEqual(
- OnNext(350, " zaB "),
- OnNext(480, " zab"),
- OnNext(510, " ZAb "),
- OnCompleted<string>(510)
- );
-
- res["qux"].Messages.AssertEqual(
- OnNext(360, " xuq "),
- OnCompleted<string>(570)
- );
-
- res["FOO"].Messages.AssertEqual(
- OnNext(470, " OOF"),
- OnNext(530, " oOf "),
- OnCompleted<string>(570)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 570)
- );
- }
-
- [TestMethod]
- public void GroupByUntil_Inner_Multiple_Independence()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(90, "error"),
- OnNext(110, "error"),
- OnNext(130, "error"),
- OnNext(220, " foo"),
- OnNext(240, " FoO "),
- OnNext(270, "baR "),
- OnNext(310, "foO "),
- OnNext(350, " Baz "),
- OnNext(360, " qux "),
- OnNext(390, " bar"),
- OnNext(420, " BAR "),
- OnNext(470, "FOO "),
- OnNext(480, "baz "),
- OnNext(510, " bAZ "),
- OnNext(530, " fOo "),
- OnCompleted<string>(570),
- OnNext(580, "error"),
- OnCompleted<string>(600),
- OnError<string>(650, new Exception())
- );
-
- var comparer = new GroupByComparer(scheduler);
- var outer = default(IObservable<IGroupedObservable<string, string>>);
- var outerSubscription = default(IDisposable);
- var inners = new Dictionary<string, IObservable<string>>();
- var innerSubscriptions = new Dictionary<string, IDisposable>();
- var res = new Dictionary<string, ITestableObserver<string>>();
- var outerResults = scheduler.CreateObserver<string>();
-
- scheduler.ScheduleAbsolute(Created, () => outer = xs.GroupByUntil(x => x.Trim(), x => Reverse(x), g => g.Skip(2), comparer));
-
- scheduler.ScheduleAbsolute(Subscribed, () => outerSubscription = outer.Subscribe(group =>
- {
- outerResults.OnNext(group.Key);
- var result = scheduler.CreateObserver<string>();
- inners[group.Key] = group;
- res[group.Key] = result;
- innerSubscriptions[group.Key] = group.Subscribe(result);
- }, outerResults.OnError, outerResults.OnCompleted));
-
- scheduler.ScheduleAbsolute(Disposed, () =>
- {
- outerSubscription.Dispose();
- foreach (var d in innerSubscriptions.Values)
- d.Dispose();
- });
-
- scheduler.ScheduleAbsolute(320, () => innerSubscriptions["foo"].Dispose());
- scheduler.ScheduleAbsolute(280, () => innerSubscriptions["baR"].Dispose());
- scheduler.ScheduleAbsolute(355, () => innerSubscriptions["Baz"].Dispose());
- scheduler.ScheduleAbsolute(400, () => innerSubscriptions["qux"].Dispose());
-
- scheduler.Start();
-
- Assert.AreEqual(5, inners.Count);
-
- res["foo"].Messages.AssertEqual(
- OnNext(220, "oof "),
- OnNext(240, " OoF "),
- OnNext(310, " Oof"),
- OnCompleted<string>(310)
- );
-
- res["baR"].Messages.AssertEqual(
- OnNext(270, " Rab")
- );
-
- res["Baz"].Messages.AssertEqual(
- OnNext(350, " zaB ")
- );
-
- res["qux"].Messages.AssertEqual(
- OnNext(360, " xuq ")
- );
-
- res["FOO"].Messages.AssertEqual(
- OnNext(470, " OOF"),
- OnNext(530, " oOf "),
- OnCompleted<string>(570)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 570)
- );
- }
-
- [TestMethod]
- public void GroupByUntil_Inner_Escape_Complete()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(220, " foo"),
- OnNext(240, " FoO "),
- OnNext(310, "foO "),
- OnNext(470, "FOO "),
- OnNext(530, " fOo "),
- OnCompleted<string>(570)
- );
-
- var outer = default(IObservable<IGroupedObservable<string, string>>);
- var outerSubscription = default(IDisposable);
- var inner = default(IObservable<string>);
- var innerSubscription = default(IDisposable);
- var res = scheduler.CreateObserver<string>();
-
- scheduler.ScheduleAbsolute(Created, () => outer = xs.GroupByUntil(x => x.Trim(), g => g.Skip(2)));
-
- scheduler.ScheduleAbsolute(Subscribed, () => outerSubscription = outer.Subscribe(group =>
- {
- inner = group;
- }));
-
- scheduler.ScheduleAbsolute(600, () => innerSubscription = inner.Subscribe(res));
-
- scheduler.ScheduleAbsolute(Disposed, () =>
- {
- outerSubscription.Dispose();
- innerSubscription.Dispose();
- });
-
- scheduler.Start();
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 570)
- );
-
- res.Messages.AssertEqual(
- OnCompleted<string>(600)
- );
- }
-
- [TestMethod]
- public void GroupByUntil_Inner_Escape_Error()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(220, " foo"),
- OnNext(240, " FoO "),
- OnNext(310, "foO "),
- OnNext(470, "FOO "),
- OnNext(530, " fOo "),
- OnError<string>(570, ex)
- );
-
- var outer = default(IObservable<IGroupedObservable<string, string>>);
- var outerSubscription = default(IDisposable);
- var inner = default(IObservable<string>);
- var innerSubscription = default(IDisposable);
- var res = scheduler.CreateObserver<string>();
-
- scheduler.ScheduleAbsolute(Created, () => outer = xs.GroupByUntil(x => x.Trim(), g => g.Skip(2)));
-
- scheduler.ScheduleAbsolute(Subscribed, () => outerSubscription = outer.Subscribe(group =>
- {
- inner = group;
- }, _ => { }));
-
- scheduler.ScheduleAbsolute(600, () => innerSubscription = inner.Subscribe(res));
-
- scheduler.ScheduleAbsolute(Disposed, () =>
- {
- outerSubscription.Dispose();
- innerSubscription.Dispose();
- });
-
- scheduler.Start();
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 570)
- );
-
- res.Messages.AssertEqual(
- OnError<string>(600, ex)
- );
- }
-
- [TestMethod]
- public void GroupByUntil_Inner_Escape_Dispose()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(220, " foo"),
- OnNext(240, " FoO "),
- OnNext(310, "foO "),
- OnNext(470, "FOO "),
- OnNext(530, " fOo "),
- OnError<string>(570, new Exception())
- );
-
- var outer = default(IObservable<IGroupedObservable<string, string>>);
- var outerSubscription = default(IDisposable);
- var inner = default(IObservable<string>);
- var innerSubscription = default(IDisposable);
- var res = scheduler.CreateObserver<string>();
-
- scheduler.ScheduleAbsolute(Created, () => outer = xs.GroupByUntil(x => x.Trim(), g => g.Skip(2)));
-
- scheduler.ScheduleAbsolute(Subscribed, () => outerSubscription = outer.Subscribe(group =>
- {
- inner = group;
- }));
-
- scheduler.ScheduleAbsolute(290, () => outerSubscription.Dispose());
-
- scheduler.ScheduleAbsolute(600, () => innerSubscription = inner.Subscribe(res));
-
- scheduler.ScheduleAbsolute(Disposed, () =>
- {
- innerSubscription.Dispose();
- });
-
- scheduler.Start();
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 290)
- );
-
- res.Messages.AssertEqual(
- );
- }
-
- [TestMethod]
- public void GroupByUntil_Default()
- {
- var scheduler = new TestScheduler();
-
- var keyInvoked = 0;
- var eleInvoked = 0;
-
- var xs = scheduler.CreateHotObservable(
- OnNext(90, "error"),
- OnNext(110, "error"),
- OnNext(130, "error"),
- OnNext(220, " foo"),
- OnNext(240, " FoO "),
- OnNext(270, "baR "),
- OnNext(310, "foO "),
- OnNext(350, " Baz "),
- OnNext(360, " qux "),
- OnNext(390, " bar"),
- OnNext(420, " BAR "),
- OnNext(470, "FOO "),
- OnNext(480, "baz "),
- OnNext(510, " bAZ "),
- OnNext(530, " fOo "),
- OnCompleted<string>(570),
- OnNext(580, "error"),
- OnCompleted<string>(600),
- OnError<string>(650, new Exception())
- );
-
- var res = scheduler.Start(() =>
- xs.GroupByUntil(
- x =>
- {
- keyInvoked++;
- return x.Trim().ToLower();
- },
- x =>
- {
- eleInvoked++;
- return Reverse(x);
- },
- g => g.Skip(2)
- ).Select(g => g.Key)
- );
-
- res.Messages.AssertEqual(
- OnNext(220, "foo"),
- OnNext(270, "bar"),
- OnNext(350, "baz"),
- OnNext(360, "qux"),
- OnNext(470, "foo"),
- OnCompleted<string>(570)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 570)
- );
-
- Assert.AreEqual(12, keyInvoked);
- Assert.AreEqual(12, eleInvoked);
- }
-
- [TestMethod]
- public void GroupByUntil_DurationSelector_Throws()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(210, "foo")
- );
-
- var ex = new Exception();
-
- var res = scheduler.Start(() =>
- xs.GroupByUntil<string, string, string>(x => x, g => { throw ex; })
- );
-
- res.Messages.AssertEqual(
- OnError<IGroupedObservable<string, string>>(210, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- #endregion
-
- #region + GroupJoin +
-
- [TestMethod]
- public void GroupJoinOp_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.GroupJoin(null, DummyObservable<int>.Instance, DummyFunc<int, IObservable<int>>.Instance, DummyFunc<int, IObservable<int>>.Instance, DummyFunc<int, IObservable<int>, int>.Instance));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.GroupJoin(DummyObservable<int>.Instance, null, DummyFunc<int, IObservable<int>>.Instance, DummyFunc<int, IObservable<int>>.Instance, DummyFunc<int, IObservable<int>, int>.Instance));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.GroupJoin(DummyObservable<int>.Instance, DummyObservable<int>.Instance, default(Func<int, IObservable<int>>), DummyFunc<int, IObservable<int>>.Instance, DummyFunc<int, IObservable<int>, int>.Instance));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.GroupJoin(DummyObservable<int>.Instance, DummyObservable<int>.Instance, DummyFunc<int, IObservable<int>>.Instance, default(Func<int, IObservable<int>>), DummyFunc<int, IObservable<int>, int>.Instance));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.GroupJoin(DummyObservable<int>.Instance, DummyObservable<int>.Instance, DummyFunc<int, IObservable<int>>.Instance, DummyFunc<int, IObservable<int>>.Instance, default(Func<int, IObservable<int>, int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.GroupJoin(DummyObservable<int>.Instance, DummyObservable<int>.Instance, DummyFunc<int, IObservable<int>>.Instance, DummyFunc<int, IObservable<int>>.Instance, DummyFunc<int, IObservable<int>, int>.Instance).Subscribe(null));
- }
-
- [TestMethod]
- public void GroupJoinOp_Normal_I()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(210, new TimeInterval<int>(0, TimeSpan.FromTicks(10))),
- OnNext(219, new TimeInterval<int>(1, TimeSpan.FromTicks(5))),
- OnNext(240, new TimeInterval<int>(2, TimeSpan.FromTicks(10))),
- OnNext(300, new TimeInterval<int>(3, TimeSpan.FromTicks(100))),
- OnNext(310, new TimeInterval<int>(4, TimeSpan.FromTicks(80))),
- OnNext(500, new TimeInterval<int>(5, TimeSpan.FromTicks(90))),
- OnNext(700, new TimeInterval<int>(6, TimeSpan.FromTicks(25))),
- OnNext(710, new TimeInterval<int>(7, TimeSpan.FromTicks(280))),
- OnNext(720, new TimeInterval<int>(8, TimeSpan.FromTicks(100))),
- OnNext(830, new TimeInterval<int>(9, TimeSpan.FromTicks(10))),
- OnCompleted<TimeInterval<int>>(900)
- );
-
- var ys = scheduler.CreateHotObservable(
- OnNext(215, new TimeInterval<string>("hat", TimeSpan.FromTicks(20))),
- OnNext(217, new TimeInterval<string>("bat", TimeSpan.FromTicks(1))),
- OnNext(290, new TimeInterval<string>("wag", TimeSpan.FromTicks(200))),
- OnNext(300, new TimeInterval<string>("pig", TimeSpan.FromTicks(10))),
- OnNext(305, new TimeInterval<string>("cup", TimeSpan.FromTicks(50))),
- OnNext(600, new TimeInterval<string>("yak", TimeSpan.FromTicks(90))),
- OnNext(702, new TimeInterval<string>("tin", TimeSpan.FromTicks(20))),
- OnNext(712, new TimeInterval<string>("man", TimeSpan.FromTicks(10))),
- OnNext(722, new TimeInterval<string>("rat", TimeSpan.FromTicks(200))),
- OnNext(732, new TimeInterval<string>("wig", TimeSpan.FromTicks(5))),
- OnCompleted<TimeInterval<string>>(800)
- );
-
- var xsd = new List<ITestableObservable<long>>();
- var ysd = new List<ITestableObservable<long>>();
-
- var res = scheduler.Start(() =>
- xs.GroupJoin(ys, x => NewTimer(xsd, x.Interval, scheduler), y => NewTimer(ysd, y.Interval, scheduler), (x, yy) => yy.Select(y => x.Value + y.Value)).Merge()
- );
-
- res.Messages.AssertEqual(
- OnNext(215, "0hat"),
- OnNext(217, "0bat"),
- OnNext(219, "1hat"),
- OnNext(300, "3wag"),
- OnNext(300, "3pig"),
- OnNext(305, "3cup"),
- OnNext(310, "4wag"),
- OnNext(310, "4pig"),
- OnNext(310, "4cup"),
- OnNext(702, "6tin"),
- OnNext(710, "7tin"),
- OnNext(712, "7man"),
- OnNext(712, "6man"),
- OnNext(720, "8tin"),
- OnNext(720, "8man"),
- OnNext(722, "7rat"),
- OnNext(722, "6rat"),
- OnNext(722, "8rat"),
- OnNext(732, "7wig"),
- OnNext(732, "8wig"),
- OnNext(830, "9rat"),
- OnCompleted<string>(990)
- );
-
- AssertDurations(xs, xsd, 990);
- AssertDurations(ys, ysd, 990);
-
-#if !NO_PERF // BREAKING CHANGE v2 > v1.x -> More aggressive disposal behavior
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 900)
- );
-#else
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 990)
- );
-#endif
-
-#if !NO_PERF // BREAKING CHANGE v2 > v1.x -> More aggressive disposal behavior
- ys.Subscriptions.AssertEqual(
- Subscribe(200, 800)
- );
-#else
- ys.Subscriptions.AssertEqual(
- Subscribe(200, 990)
- );
-#endif
- }
-
- [TestMethod]
- public void GroupJoinOp_Normal_II()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(210, new TimeInterval<int>(0, TimeSpan.FromTicks(10))),
- OnNext(219, new TimeInterval<int>(1, TimeSpan.FromTicks(5))),
- OnNext(240, new TimeInterval<int>(2, TimeSpan.FromTicks(10))),
- OnNext(300, new TimeInterval<int>(3, TimeSpan.FromTicks(100))),
- OnNext(310, new TimeInterval<int>(4, TimeSpan.FromTicks(80))),
- OnNext(500, new TimeInterval<int>(5, TimeSpan.FromTicks(90))),
- OnNext(700, new TimeInterval<int>(6, TimeSpan.FromTicks(25))),
- OnNext(710, new TimeInterval<int>(7, TimeSpan.FromTicks(200))),
- OnNext(720, new TimeInterval<int>(8, TimeSpan.FromTicks(100))),
- OnCompleted<TimeInterval<int>>(721)
- );
-
- var ys = scheduler.CreateHotObservable(
- OnNext(215, new TimeInterval<string>("hat", TimeSpan.FromTicks(20))),
- OnNext(217, new TimeInterval<string>("bat", TimeSpan.FromTicks(1))),
- OnNext(290, new TimeInterval<string>("wag", TimeSpan.FromTicks(200))),
- OnNext(300, new TimeInterval<string>("pig", TimeSpan.FromTicks(10))),
- OnNext(305, new TimeInterval<string>("cup", TimeSpan.FromTicks(50))),
- OnNext(600, new TimeInterval<string>("yak", TimeSpan.FromTicks(90))),
- OnNext(702, new TimeInterval<string>("tin", TimeSpan.FromTicks(20))),
- OnNext(712, new TimeInterval<string>("man", TimeSpan.FromTicks(10))),
- OnNext(722, new TimeInterval<string>("rat", TimeSpan.FromTicks(200))),
- OnNext(732, new TimeInterval<string>("wig", TimeSpan.FromTicks(5))),
- OnCompleted<TimeInterval<string>>(990)
- );
-
- var xsd = new List<ITestableObservable<long>>();
- var ysd = new List<ITestableObservable<long>>();
-
- var res = scheduler.Start(() =>
- xs.GroupJoin(ys, x => NewTimer(xsd, x.Interval, scheduler), y => NewTimer(ysd, y.Interval, scheduler), (x, yy) => yy.Select(y => x.Value + y.Value)).Merge()
- );
-
- res.Messages.AssertEqual(
- OnNext(215, "0hat"),
- OnNext(217, "0bat"),
- OnNext(219, "1hat"),
- OnNext(300, "3wag"),
- OnNext(300, "3pig"),
- OnNext(305, "3cup"),
- OnNext(310, "4wag"),
- OnNext(310, "4pig"),
- OnNext(310, "4cup"),
- OnNext(702, "6tin"),
- OnNext(710, "7tin"),
- OnNext(712, "7man"),
- OnNext(712, "6man"),
- OnNext(720, "8tin"),
- OnNext(720, "8man"),
- OnNext(722, "7rat"),
- OnNext(722, "6rat"),
- OnNext(722, "8rat"),
- OnNext(732, "7wig"),
- OnNext(732, "8wig"),
- OnCompleted<string>(910)
- );
-
- AssertDurations(xs, xsd, 910);
- AssertDurations(ys, ysd, 910);
-
-#if !NO_PERF // BREAKING CHANGE v2 > v1.x -> More aggressive disposal behavior
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 721)
- );
-#else
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 910)
- );
-#endif
-
- ys.Subscriptions.AssertEqual(
- Subscribe(200, 910)
- );
- }
-
- [TestMethod]
- public void GroupJoinOp_Normal_III()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(210, new TimeInterval<int>(0, TimeSpan.FromTicks(10))),
- OnNext(219, new TimeInterval<int>(1, TimeSpan.FromTicks(5))),
- OnNext(240, new TimeInterval<int>(2, TimeSpan.FromTicks(10))),
- OnNext(300, new TimeInterval<int>(3, TimeSpan.FromTicks(100))),
- OnNext(310, new TimeInterval<int>(4, TimeSpan.FromTicks(80))),
- OnNext(500, new TimeInterval<int>(5, TimeSpan.FromTicks(90))),
- OnNext(700, new TimeInterval<int>(6, TimeSpan.FromTicks(25))),
- OnNext(710, new TimeInterval<int>(7, TimeSpan.FromTicks(280))),
- OnNext(720, new TimeInterval<int>(8, TimeSpan.FromTicks(100))),
- OnNext(830, new TimeInterval<int>(9, TimeSpan.FromTicks(10))),
- OnCompleted<TimeInterval<int>>(900)
- );
-
- var ys = scheduler.CreateHotObservable(
- OnNext(215, new TimeInterval<string>("hat", TimeSpan.FromTicks(20))),
- OnNext(217, new TimeInterval<string>("bat", TimeSpan.FromTicks(1))),
- OnNext(290, new TimeInterval<string>("wag", TimeSpan.FromTicks(200))),
- OnNext(300, new TimeInterval<string>("pig", TimeSpan.FromTicks(10))),
- OnNext(305, new TimeInterval<string>("cup", TimeSpan.FromTicks(50))),
- OnNext(600, new TimeInterval<string>("yak", TimeSpan.FromTicks(90))),
- OnNext(702, new TimeInterval<string>("tin", TimeSpan.FromTicks(20))),
- OnNext(712, new TimeInterval<string>("man", TimeSpan.FromTicks(10))),
- OnNext(722, new TimeInterval<string>("rat", TimeSpan.FromTicks(200))),
- OnNext(732, new TimeInterval<string>("wig", TimeSpan.FromTicks(5))),
- OnCompleted<TimeInterval<string>>(800)
- );
-
- var xsd = new List<ITestableObservable<long>>();
- var ysd = new List<ITestableObservable<long>>();
-
- var res = scheduler.Start(() =>
- xs.GroupJoin(ys, x => NewTimer(xsd, x.Interval, scheduler).Where(_ => false), y => NewTimer(ysd, y.Interval, scheduler).Where(_ => false), (x, yy) => yy.Select(y => x.Value + y.Value)).Merge()
- );
-
- res.Messages.AssertEqual(
- OnNext(215, "0hat"),
- OnNext(217, "0bat"),
- OnNext(219, "1hat"),
- OnNext(300, "3wag"),
- OnNext(300, "3pig"),
- OnNext(305, "3cup"),
- OnNext(310, "4wag"),
- OnNext(310, "4pig"),
- OnNext(310, "4cup"),
- OnNext(702, "6tin"),
- OnNext(710, "7tin"),
- OnNext(712, "7man"),
- OnNext(712, "6man"),
- OnNext(720, "8tin"),
- OnNext(720, "8man"),
- OnNext(722, "7rat"),
- OnNext(722, "6rat"),
- OnNext(722, "8rat"),
- OnNext(732, "7wig"),
- OnNext(732, "8wig"),
- OnNext(830, "9rat"),
- OnCompleted<string>(990)
- );
-
- AssertDurations(xs, xsd, 990);
- AssertDurations(ys, ysd, 990);
-
-#if !NO_PERF // BREAKING CHANGE v2 > v1.x -> More aggressive disposal behavior
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 900)
- );
-#else
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 990)
- );
-#endif
-
-#if !NO_PERF // BREAKING CHANGE v2 > v1.x -> More aggressive disposal behavior
- ys.Subscriptions.AssertEqual(
- Subscribe(200, 800)
- );
-#else
- ys.Subscriptions.AssertEqual(
- Subscribe(200, 990)
- );
-#endif
- }
-
- [TestMethod]
- public void GroupJoinOp_Normal_IV()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(210, new TimeInterval<int>(0, TimeSpan.FromTicks(10))),
- OnNext(219, new TimeInterval<int>(1, TimeSpan.FromTicks(5))),
- OnNext(240, new TimeInterval<int>(2, TimeSpan.FromTicks(10))),
- OnNext(300, new TimeInterval<int>(3, TimeSpan.FromTicks(100))),
- OnNext(310, new TimeInterval<int>(4, TimeSpan.FromTicks(80))),
- OnNext(500, new TimeInterval<int>(5, TimeSpan.FromTicks(90))),
- OnNext(700, new TimeInterval<int>(6, TimeSpan.FromTicks(25))),
- OnNext(710, new TimeInterval<int>(7, TimeSpan.FromTicks(200))),
- OnNext(720, new TimeInterval<int>(8, TimeSpan.FromTicks(100))),
- OnCompleted<TimeInterval<int>>(990)
- );
-
- var ys = scheduler.CreateHotObservable(
- OnNext(215, new TimeInterval<string>("hat", TimeSpan.FromTicks(20))),
- OnNext(217, new TimeInterval<string>("bat", TimeSpan.FromTicks(1))),
- OnNext(290, new TimeInterval<string>("wag", TimeSpan.FromTicks(200))),
- OnNext(300, new TimeInterval<string>("pig", TimeSpan.FromTicks(10))),
- OnNext(305, new TimeInterval<string>("cup", TimeSpan.FromTicks(50))),
- OnNext(600, new TimeInterval<string>("yak", TimeSpan.FromTicks(90))),
- OnNext(702, new TimeInterval<string>("tin", TimeSpan.FromTicks(20))),
- OnNext(712, new TimeInterval<string>("man", TimeSpan.FromTicks(10))),
- OnNext(722, new TimeInterval<string>("rat", TimeSpan.FromTicks(200))),
- OnNext(732, new TimeInterval<string>("wig", TimeSpan.FromTicks(5))),
- OnCompleted<TimeInterval<string>>(980)
- );
-
- var xsd = new List<ITestableObservable<long>>();
- var ysd = new List<ITestableObservable<long>>();
-
- var res = scheduler.Start(() =>
- xs.GroupJoin(ys, x => NewTimer(xsd, x.Interval, scheduler), y => NewTimer(ysd, y.Interval, scheduler), (x, yy) => yy.Select(y => x.Value + y.Value)).Merge()
- );
-
- res.Messages.AssertEqual(
- OnNext(215, "0hat"),
- OnNext(217, "0bat"),
- OnNext(219, "1hat"),
- OnNext(300, "3wag"),
- OnNext(300, "3pig"),
- OnNext(305, "3cup"),
- OnNext(310, "4wag"),
- OnNext(310, "4pig"),
- OnNext(310, "4cup"),
- OnNext(702, "6tin"),
- OnNext(710, "7tin"),
- OnNext(712, "7man"),
- OnNext(712, "6man"),
- OnNext(720, "8tin"),
- OnNext(720, "8man"),
- OnNext(722, "7rat"),
- OnNext(722, "6rat"),
- OnNext(722, "8rat"),
- OnNext(732, "7wig"),
- OnNext(732, "8wig"),
- OnCompleted<string>(990)
- );
-
- AssertDurations(xs, xsd, 990);
- AssertDurations(ys, ysd, 990);
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 990)
- );
-
-#if !NO_PERF // BREAKING CHANGE v2 > v1.x -> More aggressive disposal behavior
- ys.Subscriptions.AssertEqual(
- Subscribe(200, 980)
- );
-#else
- ys.Subscriptions.AssertEqual(
- Subscribe(200, 990)
- );
-#endif
- }
-
- [TestMethod]
- public void GroupJoinOp_Normal_V()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(210, new TimeInterval<int>(0, TimeSpan.FromTicks(10))),
- OnNext(219, new TimeInterval<int>(1, TimeSpan.FromTicks(5))),
- OnNext(240, new TimeInterval<int>(2, TimeSpan.FromTicks(10))),
- OnNext(300, new TimeInterval<int>(3, TimeSpan.FromTicks(100))),
- OnNext(310, new TimeInterval<int>(4, TimeSpan.FromTicks(80))),
- OnNext(500, new TimeInterval<int>(5, TimeSpan.FromTicks(90))),
- OnNext(700, new TimeInterval<int>(6, TimeSpan.FromTicks(25))),
- OnNext(710, new TimeInterval<int>(7, TimeSpan.FromTicks(200))),
- OnNext(720, new TimeInterval<int>(8, TimeSpan.FromTicks(100))),
- OnCompleted<TimeInterval<int>>(990)
- );
-
- var ys = scheduler.CreateHotObservable(
- OnNext(215, new TimeInterval<string>("hat", TimeSpan.FromTicks(20))),
- OnNext(217, new TimeInterval<string>("bat", TimeSpan.FromTicks(1))),
- OnNext(290, new TimeInterval<string>("wag", TimeSpan.FromTicks(200))),
- OnNext(300, new TimeInterval<string>("pig", TimeSpan.FromTicks(10))),
- OnNext(305, new TimeInterval<string>("cup", TimeSpan.FromTicks(50))),
- OnNext(600, new TimeInterval<string>("yak", TimeSpan.FromTicks(90))),
- OnNext(702, new TimeInterval<string>("tin", TimeSpan.FromTicks(20))),
- OnNext(712, new TimeInterval<string>("man", TimeSpan.FromTicks(10))),
- OnNext(722, new TimeInterval<string>("rat", TimeSpan.FromTicks(200))),
- OnNext(732, new TimeInterval<string>("wig", TimeSpan.FromTicks(5))),
- OnCompleted<TimeInterval<string>>(900)
- );
-
- var xsd = new List<ITestableObservable<long>>();
- var ysd = new List<ITestableObservable<long>>();
-
- var res = scheduler.Start(() =>
- xs.GroupJoin(ys, x => NewTimer(xsd, x.Interval, scheduler), y => NewTimer(ysd, y.Interval, scheduler), (x, yy) => yy.Select(y => x.Value + y.Value)).Merge()
- );
-
- res.Messages.AssertEqual(
- OnNext(215, "0hat"),
- OnNext(217, "0bat"),
- OnNext(219, "1hat"),
- OnNext(300, "3wag"),
- OnNext(300, "3pig"),
- OnNext(305, "3cup"),
- OnNext(310, "4wag"),
- OnNext(310, "4pig"),
- OnNext(310, "4cup"),
- OnNext(702, "6tin"),
- OnNext(710, "7tin"),
- OnNext(712, "7man"),
- OnNext(712, "6man"),
- OnNext(720, "8tin"),
- OnNext(720, "8man"),
- OnNext(722, "7rat"),
- OnNext(722, "6rat"),
- OnNext(722, "8rat"),
- OnNext(732, "7wig"),
- OnNext(732, "8wig"),
- OnCompleted<string>(990)
- );
-
- AssertDurations(xs, xsd, 990);
- AssertDurations(ys, ysd, 990);
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 990)
- );
-
-#if !NO_PERF // BREAKING CHANGE v2 > v1.x -> More aggressive disposal behavior
- ys.Subscriptions.AssertEqual(
- Subscribe(200, 900)
- );
-#else
- ys.Subscriptions.AssertEqual(
- Subscribe(200, 990)
- );
-#endif
- }
-
- [TestMethod]
- public void GroupJoinOp_Normal_VI()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(210, new TimeInterval<int>(0, TimeSpan.FromTicks(10))),
- OnNext(219, new TimeInterval<int>(1, TimeSpan.FromTicks(5))),
- OnNext(240, new TimeInterval<int>(2, TimeSpan.FromTicks(10))),
- OnNext(300, new TimeInterval<int>(3, TimeSpan.FromTicks(100))),
- OnNext(310, new TimeInterval<int>(4, TimeSpan.FromTicks(80))),
- OnNext(500, new TimeInterval<int>(5, TimeSpan.FromTicks(90))),
- OnNext(700, new TimeInterval<int>(6, TimeSpan.FromTicks(25))),
- OnNext(710, new TimeInterval<int>(7, TimeSpan.FromTicks(30))),
- OnNext(720, new TimeInterval<int>(8, TimeSpan.FromTicks(200))),
- OnNext(830, new TimeInterval<int>(9, TimeSpan.FromTicks(10))),
- OnCompleted<TimeInterval<int>>(850)
- );
-
- var ys = scheduler.CreateHotObservable(
- OnNext(215, new TimeInterval<string>("hat", TimeSpan.FromTicks(20))),
- OnNext(217, new TimeInterval<string>("bat", TimeSpan.FromTicks(1))),
- OnNext(290, new TimeInterval<string>("wag", TimeSpan.FromTicks(200))),
- OnNext(300, new TimeInterval<string>("pig", TimeSpan.FromTicks(10))),
- OnNext(305, new TimeInterval<string>("cup", TimeSpan.FromTicks(50))),
- OnNext(600, new TimeInterval<string>("yak", TimeSpan.FromTicks(90))),
- OnNext(702, new TimeInterval<string>("tin", TimeSpan.FromTicks(20))),
- OnNext(712, new TimeInterval<string>("man", TimeSpan.FromTicks(10))),
- OnNext(722, new TimeInterval<string>("rat", TimeSpan.FromTicks(20))),
- OnNext(732, new TimeInterval<string>("wig", TimeSpan.FromTicks(5))),
- OnCompleted<TimeInterval<string>>(900)
- );
-
- var xsd = new List<ITestableObservable<long>>();
- var ysd = new List<ITestableObservable<long>>();
-
- var res = scheduler.Start(() =>
- xs.GroupJoin(ys, x => NewTimer(xsd, x.Interval, scheduler), y => NewTimer(ysd, y.Interval, scheduler), (x, yy) => yy.Select(y => x.Value + y.Value)).Merge()
- );
-
- res.Messages.AssertEqual(
- OnNext(215, "0hat"),
- OnNext(217, "0bat"),
- OnNext(219, "1hat"),
- OnNext(300, "3wag"),
- OnNext(300, "3pig"),
- OnNext(305, "3cup"),
- OnNext(310, "4wag"),
- OnNext(310, "4pig"),
- OnNext(310, "4cup"),
- OnNext(702, "6tin"),
- OnNext(710, "7tin"),
- OnNext(712, "7man"),
- OnNext(712, "6man"),
- OnNext(720, "8tin"),
- OnNext(720, "8man"),
- OnNext(722, "7rat"),
- OnNext(722, "6rat"),
- OnNext(722, "8rat"),
- OnNext(732, "7wig"),
- OnNext(732, "8wig"),
- OnCompleted<string>(920)
- );
-
- AssertDurations(xs, xsd, 920);
- AssertDurations(ys, ysd, 920);
-
-#if !NO_PERF // BREAKING CHANGE v2 > v1.x -> More aggressive disposal behavior
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 850)
- );
-#else
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 920)
- );
-#endif
-
-#if !NO_PERF // BREAKING CHANGE v2 > v1.x -> More aggressive disposal behavior
- ys.Subscriptions.AssertEqual(
- Subscribe(200, 900)
- );
-#else
- ys.Subscriptions.AssertEqual(
- Subscribe(200, 920)
- );
-#endif
- }
-
- [TestMethod]
- public void GroupJoinOp_Normal_VII()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnCompleted<TimeInterval<int>>(210)
- );
-
- var ys = scheduler.CreateHotObservable(
- OnNext(215, new TimeInterval<string>("hat", TimeSpan.FromTicks(20))),
- OnNext(217, new TimeInterval<string>("bat", TimeSpan.FromTicks(1))),
- OnNext(290, new TimeInterval<string>("wag", TimeSpan.FromTicks(200))),
- OnNext(300, new TimeInterval<string>("pig", TimeSpan.FromTicks(10))),
- OnNext(305, new TimeInterval<string>("cup", TimeSpan.FromTicks(50))),
- OnNext(600, new TimeInterval<string>("yak", TimeSpan.FromTicks(90))),
- OnNext(702, new TimeInterval<string>("tin", TimeSpan.FromTicks(20))),
- OnNext(712, new TimeInterval<string>("man", TimeSpan.FromTicks(10))),
- OnNext(722, new TimeInterval<string>("rat", TimeSpan.FromTicks(20))),
- OnNext(732, new TimeInterval<string>("wig", TimeSpan.FromTicks(5))),
- OnCompleted<TimeInterval<string>>(900)
- );
-
- var xsd = new List<ITestableObservable<long>>();
- var ysd = new List<ITestableObservable<long>>();
-
- var res = scheduler.Start(() =>
- xs.GroupJoin(ys, x => NewTimer(xsd, x.Interval, scheduler), y => NewTimer(ysd, y.Interval, scheduler), (x, yy) => yy.Select(y => x.Value + y.Value)).Merge()
- );
-
- res.Messages.AssertEqual(
- OnCompleted<string>(210)
- );
-
- AssertDurations(xs, xsd, 210);
- AssertDurations(ys, ysd, 210);
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
-
- ys.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void GroupJoinOp_Normal_VIII()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(210, new TimeInterval<int>(0, TimeSpan.FromTicks(200)))
- );
-
- var ys = scheduler.CreateHotObservable(
- OnNext(220, new TimeInterval<string>("hat", TimeSpan.FromTicks(100))),
- OnCompleted<TimeInterval<string>>(230)
- );
-
- var xsd = new List<ITestableObservable<long>>();
- var ysd = new List<ITestableObservable<long>>();
-
- var res = scheduler.Start(() =>
- xs.GroupJoin(ys, x => NewTimer(xsd, x.Interval, scheduler), y => NewTimer(ysd, y.Interval, scheduler), (x, yy) => yy.Select(y => x.Value + y.Value)).Merge()
- );
-
- res.Messages.AssertEqual(
- OnNext(220, "0hat")
- );
-
- AssertDurations(xs, xsd, 1000);
- AssertDurations(ys, ysd, 1000);
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
-
-#if !NO_PERF // BREAKING CHANGE v2 > v1.x -> More aggressive disposal behavior
- ys.Subscriptions.AssertEqual(
- Subscribe(200, 230)
- );
-#else
- ys.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
-#endif
- }
-
- [TestMethod]
- public void GroupJoinOp_Normal_IX()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(210, new TimeInterval<int>(0, TimeSpan.FromTicks(10))),
- OnNext(219, new TimeInterval<int>(1, TimeSpan.FromTicks(5))),
- OnNext(240, new TimeInterval<int>(2, TimeSpan.FromTicks(10))),
- OnNext(300, new TimeInterval<int>(3, TimeSpan.FromTicks(100))),
- OnNext(310, new TimeInterval<int>(4, TimeSpan.FromTicks(80))),
- OnNext(500, new TimeInterval<int>(5, TimeSpan.FromTicks(90))),
- OnNext(700, new TimeInterval<int>(6, TimeSpan.FromTicks(25))),
- OnNext(710, new TimeInterval<int>(7, TimeSpan.FromTicks(300))),
- OnNext(720, new TimeInterval<int>(8, TimeSpan.FromTicks(100))),
- OnNext(830, new TimeInterval<int>(9, TimeSpan.FromTicks(10))),
- OnCompleted<TimeInterval<int>>(900)
- );
-
- var ys = scheduler.CreateHotObservable(
- OnNext(215, new TimeInterval<string>("hat", TimeSpan.FromTicks(20))),
- OnNext(217, new TimeInterval<string>("bat", TimeSpan.FromTicks(1))),
- OnNext(290, new TimeInterval<string>("wag", TimeSpan.FromTicks(200))),
- OnNext(300, new TimeInterval<string>("pig", TimeSpan.FromTicks(10))),
- OnNext(305, new TimeInterval<string>("cup", TimeSpan.FromTicks(50))),
- OnNext(600, new TimeInterval<string>("yak", TimeSpan.FromTicks(90))),
- OnNext(702, new TimeInterval<string>("tin", TimeSpan.FromTicks(20))),
- OnNext(712, new TimeInterval<string>("man", TimeSpan.FromTicks(10))),
- OnNext(722, new TimeInterval<string>("rat", TimeSpan.FromTicks(200))),
- OnNext(732, new TimeInterval<string>("wig", TimeSpan.FromTicks(5))),
- OnCompleted<TimeInterval<string>>(800)
- );
-
- var xsd = new List<ITestableObservable<long>>();
- var ysd = new List<ITestableObservable<long>>();
-
- var res = scheduler.Start(() =>
- xs.GroupJoin(ys, x => NewTimer(xsd, x.Interval, scheduler), y => NewTimer(ysd, y.Interval, scheduler), (x, yy) => yy.Select(y => x.Value + y.Value)).Merge(),
- 713
- );
-
- res.Messages.AssertEqual(
- OnNext(215, "0hat"),
- OnNext(217, "0bat"),
- OnNext(219, "1hat"),
- OnNext(300, "3wag"),
- OnNext(300, "3pig"),
- OnNext(305, "3cup"),
- OnNext(310, "4wag"),
- OnNext(310, "4pig"),
- OnNext(310, "4cup"),
- OnNext(702, "6tin"),
- OnNext(710, "7tin"),
- OnNext(712, "7man"),
- OnNext(712, "6man")
- );
-
- AssertDurations(xs, xsd, 713);
- AssertDurations(ys, ysd, 713);
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 713)
- );
-
- ys.Subscriptions.AssertEqual(
- Subscribe(200, 713)
- );
- }
-
- [TestMethod]
- public void GroupJoinOp_Error_I()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(210, new TimeInterval<int>(0, TimeSpan.FromTicks(10))),
- OnNext(219, new TimeInterval<int>(1, TimeSpan.FromTicks(5))),
- OnNext(240, new TimeInterval<int>(2, TimeSpan.FromTicks(10))),
- OnNext(300, new TimeInterval<int>(3, TimeSpan.FromTicks(100))),
- OnError<TimeInterval<int>>(310, ex)
- );
-
- var ys = scheduler.CreateHotObservable(
- OnNext(215, new TimeInterval<string>("hat", TimeSpan.FromTicks(20))),
- OnNext(217, new TimeInterval<string>("bat", TimeSpan.FromTicks(1))),
- OnNext(290, new TimeInterval<string>("wag", TimeSpan.FromTicks(200))),
- OnNext(300, new TimeInterval<string>("pig", TimeSpan.FromTicks(10))),
- OnNext(305, new TimeInterval<string>("cup", TimeSpan.FromTicks(50))),
- OnNext(600, new TimeInterval<string>("yak", TimeSpan.FromTicks(90))),
- OnNext(702, new TimeInterval<string>("tin", TimeSpan.FromTicks(20))),
- OnNext(712, new TimeInterval<string>("man", TimeSpan.FromTicks(10))),
- OnNext(722, new TimeInterval<string>("rat", TimeSpan.FromTicks(200))),
- OnNext(732, new TimeInterval<string>("wig", TimeSpan.FromTicks(5))),
- OnCompleted<TimeInterval<string>>(800)
- );
-
- var xsd = new List<ITestableObservable<long>>();
- var ysd = new List<ITestableObservable<long>>();
-
- var res = scheduler.Start(() =>
- xs.GroupJoin(ys, x => NewTimer(xsd, x.Interval, scheduler), y => NewTimer(ysd, y.Interval, scheduler), (x, yy) => yy.Select(y => x.Value + y.Value)).Merge()
- );
-
- res.Messages.AssertEqual(
- OnNext(215, "0hat"),
- OnNext(217, "0bat"),
- OnNext(219, "1hat"),
- OnNext(300, "3wag"),
- OnNext(300, "3pig"),
- OnNext(305, "3cup"),
- OnError<string>(310, ex)
- );
-
- AssertDurations(xs, xsd, 310);
- AssertDurations(ys, ysd, 310);
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 310)
- );
-
- ys.Subscriptions.AssertEqual(
- Subscribe(200, 310)
- );
- }
-
- [TestMethod]
- public void GroupJoinOp_Error_II()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(210, new TimeInterval<int>(0, TimeSpan.FromTicks(10))),
- OnNext(219, new TimeInterval<int>(1, TimeSpan.FromTicks(5))),
- OnNext(240, new TimeInterval<int>(2, TimeSpan.FromTicks(10))),
- OnNext(300, new TimeInterval<int>(3, TimeSpan.FromTicks(100))),
- OnNext(310, new TimeInterval<int>(4, TimeSpan.FromTicks(80))),
- OnNext(500, new TimeInterval<int>(5, TimeSpan.FromTicks(90))),
- OnNext(700, new TimeInterval<int>(6, TimeSpan.FromTicks(25))),
- OnNext(710, new TimeInterval<int>(7, TimeSpan.FromTicks(300))),
- OnNext(720, new TimeInterval<int>(8, TimeSpan.FromTicks(100))),
- OnNext(830, new TimeInterval<int>(9, TimeSpan.FromTicks(10))),
- OnCompleted<TimeInterval<int>>(900)
- );
-
- var ys = scheduler.CreateHotObservable(
- OnNext(215, new TimeInterval<string>("hat", TimeSpan.FromTicks(20))),
- OnNext(217, new TimeInterval<string>("bat", TimeSpan.FromTicks(1))),
- OnNext(290, new TimeInterval<string>("wag", TimeSpan.FromTicks(200))),
- OnNext(300, new TimeInterval<string>("pig", TimeSpan.FromTicks(10))),
- OnNext(305, new TimeInterval<string>("cup", TimeSpan.FromTicks(50))),
- OnNext(600, new TimeInterval<string>("yak", TimeSpan.FromTicks(90))),
- OnNext(702, new TimeInterval<string>("tin", TimeSpan.FromTicks(20))),
- OnNext(712, new TimeInterval<string>("man", TimeSpan.FromTicks(10))),
- OnError<TimeInterval<string>>(722, ex)
- );
-
- var xsd = new List<ITestableObservable<long>>();
- var ysd = new List<ITestableObservable<long>>();
-
- var res = scheduler.Start(() =>
- xs.GroupJoin(ys, x => NewTimer(xsd, x.Interval, scheduler), y => NewTimer(ysd, y.Interval, scheduler), (x, yy) => yy.Select(y => x.Value + y.Value)).Merge()
- );
-
- res.Messages.AssertEqual(
- OnNext(215, "0hat"),
- OnNext(217, "0bat"),
- OnNext(219, "1hat"),
- OnNext(300, "3wag"),
- OnNext(300, "3pig"),
- OnNext(305, "3cup"),
- OnNext(310, "4wag"),
- OnNext(310, "4pig"),
- OnNext(310, "4cup"),
- OnNext(702, "6tin"),
- OnNext(710, "7tin"),
- OnNext(712, "7man"),
- OnNext(712, "6man"),
- OnNext(720, "8tin"),
- OnNext(720, "8man"),
- OnError<string>(722, ex)
- );
-
- AssertDurations(xs, xsd, 722);
- AssertDurations(ys, ysd, 722);
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 722)
- );
-
- ys.Subscriptions.AssertEqual(
- Subscribe(200, 722)
- );
- }
-
- [TestMethod]
- public void GroupJoinOp_Error_III()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(210, new TimeInterval<int>(0, TimeSpan.FromTicks(10))),
- OnNext(219, new TimeInterval<int>(1, TimeSpan.FromTicks(5))),
- OnNext(240, new TimeInterval<int>(2, TimeSpan.FromTicks(10))),
- OnNext(300, new TimeInterval<int>(3, TimeSpan.FromTicks(100))),
- OnNext(310, new TimeInterval<int>(4, TimeSpan.FromTicks(80))),
- OnNext(500, new TimeInterval<int>(5, TimeSpan.FromTicks(90))),
- OnNext(700, new TimeInterval<int>(6, TimeSpan.FromTicks(25))),
- OnNext(710, new TimeInterval<int>(7, TimeSpan.FromTicks(300))),
- OnNext(720, new TimeInterval<int>(8, TimeSpan.FromTicks(100))),
- OnNext(830, new TimeInterval<int>(9, TimeSpan.FromTicks(10))),
- OnCompleted<TimeInterval<int>>(900)
- );
-
- var ys = scheduler.CreateHotObservable(
- OnNext(215, new TimeInterval<string>("hat", TimeSpan.FromTicks(20))),
- OnNext(217, new TimeInterval<string>("bat", TimeSpan.FromTicks(1))),
- OnNext(290, new TimeInterval<string>("wag", TimeSpan.FromTicks(200))),
- OnNext(300, new TimeInterval<string>("pig", TimeSpan.FromTicks(10))),
- OnNext(305, new TimeInterval<string>("cup", TimeSpan.FromTicks(50))),
- OnNext(600, new TimeInterval<string>("yak", TimeSpan.FromTicks(90))),
- OnNext(702, new TimeInterval<string>("tin", TimeSpan.FromTicks(20))),
- OnNext(712, new TimeInterval<string>("man", TimeSpan.FromTicks(10))),
- OnNext(722, new TimeInterval<string>("rat", TimeSpan.FromTicks(200))),
- OnNext(732, new TimeInterval<string>("wig", TimeSpan.FromTicks(5))),
- OnCompleted<TimeInterval<string>>(800)
- );
-
- var ex = new Exception();
-
- var xsd = new List<ITestableObservable<long>>();
- var ysd = new List<ITestableObservable<long>>();
-
- var res = scheduler.Start(() =>
- xs.GroupJoin(ys, x => NewTimer(xsd, x.Interval, scheduler).SelectMany(x.Value == 6 ? Observable.Throw<long>(ex) : Observable.Empty<long>()), y => NewTimer(ysd, y.Interval, scheduler), (x, yy) => yy.Select(y => x.Value + y.Value)).Merge()
- );
-
- res.Messages.AssertEqual(
- OnNext(215, "0hat"),
- OnNext(217, "0bat"),
- OnNext(219, "1hat"),
- OnNext(300, "3wag"),
- OnNext(300, "3pig"),
- OnNext(305, "3cup"),
- OnNext(310, "4wag"),
- OnNext(310, "4pig"),
- OnNext(310, "4cup"),
- OnNext(702, "6tin"),
- OnNext(710, "7tin"),
- OnNext(712, "7man"),
- OnNext(712, "6man"),
- OnNext(720, "8tin"),
- OnNext(720, "8man"),
- OnNext(722, "7rat"),
- OnNext(722, "6rat"),
- OnNext(722, "8rat"),
- OnError<string>(725, ex)
- );
-
- AssertDurations(xs, xsd, 725);
- AssertDurations(ys, ysd, 725);
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 725)
- );
-
- ys.Subscriptions.AssertEqual(
- Subscribe(200, 725)
- );
- }
-
- [TestMethod]
- public void GroupJoinOp_Error_IV()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(210, new TimeInterval<int>(0, TimeSpan.FromTicks(10))),
- OnNext(219, new TimeInterval<int>(1, TimeSpan.FromTicks(5))),
- OnNext(240, new TimeInterval<int>(2, TimeSpan.FromTicks(10))),
- OnNext(300, new TimeInterval<int>(3, TimeSpan.FromTicks(100))),
- OnNext(310, new TimeInterval<int>(4, TimeSpan.FromTicks(80))),
- OnNext(500, new TimeInterval<int>(5, TimeSpan.FromTicks(90))),
- OnNext(700, new TimeInterval<int>(6, TimeSpan.FromTicks(25))),
- OnNext(710, new TimeInterval<int>(7, TimeSpan.FromTicks(300))),
- OnNext(720, new TimeInterval<int>(8, TimeSpan.FromTicks(100))),
- OnNext(830, new TimeInterval<int>(9, TimeSpan.FromTicks(10))),
- OnCompleted<TimeInterval<int>>(900)
- );
-
- var ys = scheduler.CreateHotObservable(
- OnNext(215, new TimeInterval<string>("hat", TimeSpan.FromTicks(20))),
- OnNext(217, new TimeInterval<string>("bat", TimeSpan.FromTicks(1))),
- OnNext(290, new TimeInterval<string>("wag", TimeSpan.FromTicks(200))),
- OnNext(300, new TimeInterval<string>("pig", TimeSpan.FromTicks(10))),
- OnNext(305, new TimeInterval<string>("cup", TimeSpan.FromTicks(50))),
- OnNext(600, new TimeInterval<string>("yak", TimeSpan.FromTicks(90))),
- OnNext(702, new TimeInterval<string>("tin", TimeSpan.FromTicks(19))),
- OnNext(712, new TimeInterval<string>("man", TimeSpan.FromTicks(10))),
- OnNext(722, new TimeInterval<string>("rat", TimeSpan.FromTicks(200))),
- OnNext(732, new TimeInterval<string>("wig", TimeSpan.FromTicks(5))),
- OnCompleted<TimeInterval<string>>(800)
- );
-
- var ex = new Exception();
-
- var xsd = new List<ITestableObservable<long>>();
- var ysd = new List<ITestableObservable<long>>();
-
- var res = scheduler.Start(() =>
- xs.GroupJoin(ys, x => NewTimer(xsd, x.Interval, scheduler), y => NewTimer(ysd, y.Interval, scheduler).SelectMany(y.Value == "tin" ? Observable.Throw<long>(ex) : Observable.Empty<long>()), (x, yy) => yy.Select(y => x.Value + y.Value)).Merge()
- );
-
- res.Messages.AssertEqual(
- OnNext(215, "0hat"),
- OnNext(217, "0bat"),
- OnNext(219, "1hat"),
- OnNext(300, "3wag"),
- OnNext(300, "3pig"),
- OnNext(305, "3cup"),
- OnNext(310, "4wag"),
- OnNext(310, "4pig"),
- OnNext(310, "4cup"),
- OnNext(702, "6tin"),
- OnNext(710, "7tin"),
- OnNext(712, "7man"),
- OnNext(712, "6man"),
- OnNext(720, "8tin"),
- OnNext(720, "8man"),
- OnError<string>(721, ex)
- );
-
- AssertDurations(xs, xsd, 721);
- AssertDurations(ys, ysd, 721);
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 721)
- );
-
- ys.Subscriptions.AssertEqual(
- Subscribe(200, 721)
- );
- }
-
- [TestMethod]
- public void GroupJoinOp_Error_V()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(210, new TimeInterval<int>(0, TimeSpan.FromTicks(10))),
- OnNext(219, new TimeInterval<int>(1, TimeSpan.FromTicks(5))),
- OnNext(240, new TimeInterval<int>(2, TimeSpan.FromTicks(10))),
- OnNext(300, new TimeInterval<int>(3, TimeSpan.FromTicks(100))),
- OnNext(310, new TimeInterval<int>(4, TimeSpan.FromTicks(80))),
- OnNext(500, new TimeInterval<int>(5, TimeSpan.FromTicks(90))),
- OnNext(700, new TimeInterval<int>(6, TimeSpan.FromTicks(25))),
- OnNext(710, new TimeInterval<int>(7, TimeSpan.FromTicks(300))),
- OnNext(720, new TimeInterval<int>(8, TimeSpan.FromTicks(100))),
- OnNext(830, new TimeInterval<int>(9, TimeSpan.FromTicks(10))),
- OnCompleted<TimeInterval<int>>(900)
- );
-
- var ys = scheduler.CreateHotObservable(
- OnNext(215, new TimeInterval<string>("hat", TimeSpan.FromTicks(20))),
- OnNext(217, new TimeInterval<string>("bat", TimeSpan.FromTicks(1))),
- OnNext(290, new TimeInterval<string>("wag", TimeSpan.FromTicks(200))),
- OnNext(300, new TimeInterval<string>("pig", TimeSpan.FromTicks(10))),
- OnNext(305, new TimeInterval<string>("cup", TimeSpan.FromTicks(50))),
- OnNext(600, new TimeInterval<string>("yak", TimeSpan.FromTicks(90))),
- OnNext(702, new TimeInterval<string>("tin", TimeSpan.FromTicks(20))),
- OnNext(712, new TimeInterval<string>("man", TimeSpan.FromTicks(10))),
- OnNext(722, new TimeInterval<string>("rat", TimeSpan.FromTicks(200))),
- OnNext(732, new TimeInterval<string>("wig", TimeSpan.FromTicks(5))),
- OnCompleted<TimeInterval<string>>(800)
- );
-
- var ex = new Exception();
-
- var ysd = new List<ITestableObservable<long>>();
-
- var res = scheduler.Start(() =>
- xs.GroupJoin(ys, x => { if (x.Value >= 0) throw ex; return Observable.Empty<long>(); }, y => NewTimer(ysd, y.Interval, scheduler), (x, yy) => yy.Select(y => x.Value + y.Value)).Merge()
- );
-
- res.Messages.AssertEqual(
- OnError<string>(210, ex)
- );
-
- AssertDurations(ys, ysd, 210);
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
-
- ys.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void GroupJoinOp_Error_VI()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(210, new TimeInterval<int>(0, TimeSpan.FromTicks(10))),
- OnNext(219, new TimeInterval<int>(1, TimeSpan.FromTicks(5))),
- OnNext(240, new TimeInterval<int>(2, TimeSpan.FromTicks(10))),
- OnNext(300, new TimeInterval<int>(3, TimeSpan.FromTicks(100))),
- OnNext(310, new TimeInterval<int>(4, TimeSpan.FromTicks(80))),
- OnNext(500, new TimeInterval<int>(5, TimeSpan.FromTicks(90))),
- OnNext(700, new TimeInterval<int>(6, TimeSpan.FromTicks(25))),
- OnNext(710, new TimeInterval<int>(7, TimeSpan.FromTicks(300))),
- OnNext(720, new TimeInterval<int>(8, TimeSpan.FromTicks(100))),
- OnNext(830, new TimeInterval<int>(9, TimeSpan.FromTicks(10))),
- OnCompleted<TimeInterval<int>>(900)
- );
-
- var ys = scheduler.CreateHotObservable(
- OnNext(215, new TimeInterval<string>("hat", TimeSpan.FromTicks(20))),
- OnNext(217, new TimeInterval<string>("bat", TimeSpan.FromTicks(1))),
- OnNext(290, new TimeInterval<string>("wag", TimeSpan.FromTicks(200))),
- OnNext(300, new TimeInterval<string>("pig", TimeSpan.FromTicks(10))),
- OnNext(305, new TimeInterval<string>("cup", TimeSpan.FromTicks(50))),
- OnNext(600, new TimeInterval<string>("yak", TimeSpan.FromTicks(90))),
- OnNext(702, new TimeInterval<string>("tin", TimeSpan.FromTicks(20))),
- OnNext(712, new TimeInterval<string>("man", TimeSpan.FromTicks(10))),
- OnNext(722, new TimeInterval<string>("rat", TimeSpan.FromTicks(200))),
- OnNext(732, new TimeInterval<string>("wig", TimeSpan.FromTicks(5))),
- OnCompleted<TimeInterval<string>>(800)
- );
-
- var ex = new Exception();
-
- var xsd = new List<ITestableObservable<long>>();
-
- var res = scheduler.Start(() =>
- xs.GroupJoin(ys, x => NewTimer(xsd, x.Interval, scheduler), y => { if (y.Value.Length >= 0) throw ex; return Observable.Empty<long>(); }, (x, yy) => yy.Select(y => x.Value + y.Value)).Merge()
- );
-
- res.Messages.AssertEqual(
- OnError<string>(215, ex)
- );
-
- AssertDurations(xs, xsd, 215);
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 215)
- );
-
- ys.Subscriptions.AssertEqual(
- Subscribe(200, 215)
- );
- }
-
- [TestMethod]
- public void GroupJoinOp_Error_VII()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(215, new TimeInterval<int>(0, TimeSpan.FromTicks(10))),
- OnNext(219, new TimeInterval<int>(1, TimeSpan.FromTicks(5))),
- OnNext(240, new TimeInterval<int>(2, TimeSpan.FromTicks(10))),
- OnNext(300, new TimeInterval<int>(3, TimeSpan.FromTicks(100))),
- OnNext(310, new TimeInterval<int>(4, TimeSpan.FromTicks(80))),
- OnNext(500, new TimeInterval<int>(5, TimeSpan.FromTicks(90))),
- OnNext(700, new TimeInterval<int>(6, TimeSpan.FromTicks(25))),
- OnNext(710, new TimeInterval<int>(7, TimeSpan.FromTicks(300))),
- OnNext(720, new TimeInterval<int>(8, TimeSpan.FromTicks(100))),
- OnNext(830, new TimeInterval<int>(9, TimeSpan.FromTicks(10))),
- OnCompleted<TimeInterval<int>>(900)
- );
-
- var ys = scheduler.CreateHotObservable(
- OnNext(210, new TimeInterval<string>("hat", TimeSpan.FromTicks(20))),
- OnNext(217, new TimeInterval<string>("bat", TimeSpan.FromTicks(1))),
- OnNext(290, new TimeInterval<string>("wag", TimeSpan.FromTicks(200))),
- OnNext(300, new TimeInterval<string>("pig", TimeSpan.FromTicks(10))),
- OnNext(305, new TimeInterval<string>("cup", TimeSpan.FromTicks(50))),
- OnNext(600, new TimeInterval<string>("yak", TimeSpan.FromTicks(90))),
- OnNext(702, new TimeInterval<string>("tin", TimeSpan.FromTicks(20))),
- OnNext(712, new TimeInterval<string>("man", TimeSpan.FromTicks(10))),
- OnNext(722, new TimeInterval<string>("rat", TimeSpan.FromTicks(200))),
- OnNext(732, new TimeInterval<string>("wig", TimeSpan.FromTicks(5))),
- OnCompleted<TimeInterval<string>>(800)
- );
-
- var ex = new Exception();
-
- var xsd = new List<ITestableObservable<long>>();
- var ysd = new List<ITestableObservable<long>>();
-
- var res = scheduler.Start(() =>
- xs.GroupJoin(ys, x => NewTimer(xsd, x.Interval, scheduler), y => NewTimer(ysd, y.Interval, scheduler), (x, yy) => { if (x.Value >= 0) throw ex; return yy.Select(y => x.Value + y.Value); }).Merge()
- );
-
- res.Messages.AssertEqual(
- OnError<string>(215, ex)
- );
-
-#if !NO_PERF // BREAKING CHANGE v2 > v1.x - Duration selector is now invoked before the result selector
- AssertDurations(xs, xsd, 215);
-#endif
- AssertDurations(ys, ysd, 215);
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 215)
- );
-
- ys.Subscriptions.AssertEqual(
- Subscribe(200, 215)
- );
- }
-
- [TestMethod]
- public void GroupJoinOp_Error_VIII()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(210, new TimeInterval<int>(0, TimeSpan.FromTicks(10))),
- OnNext(219, new TimeInterval<int>(1, TimeSpan.FromTicks(5))),
- OnNext(240, new TimeInterval<int>(2, TimeSpan.FromTicks(10))),
- OnNext(300, new TimeInterval<int>(3, TimeSpan.FromTicks(100))),
- OnNext(310, new TimeInterval<int>(4, TimeSpan.FromTicks(80))),
- OnNext(500, new TimeInterval<int>(5, TimeSpan.FromTicks(90))),
- OnNext(700, new TimeInterval<int>(6, TimeSpan.FromTicks(25))),
- OnNext(710, new TimeInterval<int>(7, TimeSpan.FromTicks(300))),
- OnNext(720, new TimeInterval<int>(8, TimeSpan.FromTicks(100))),
- OnNext(830, new TimeInterval<int>(9, TimeSpan.FromTicks(10))),
- OnCompleted<TimeInterval<int>>(900)
- );
-
- var ys = scheduler.CreateHotObservable(
- OnNext(215, new TimeInterval<string>("hat", TimeSpan.FromTicks(20))),
- OnNext(217, new TimeInterval<string>("bat", TimeSpan.FromTicks(1))),
- OnNext(290, new TimeInterval<string>("wag", TimeSpan.FromTicks(200))),
- OnNext(300, new TimeInterval<string>("pig", TimeSpan.FromTicks(10))),
- OnNext(305, new TimeInterval<string>("cup", TimeSpan.FromTicks(50))),
- OnNext(600, new TimeInterval<string>("yak", TimeSpan.FromTicks(90))),
- OnNext(702, new TimeInterval<string>("tin", TimeSpan.FromTicks(20))),
- OnNext(712, new TimeInterval<string>("man", TimeSpan.FromTicks(10))),
- OnNext(722, new TimeInterval<string>("rat", TimeSpan.FromTicks(200))),
- OnNext(732, new TimeInterval<string>("wig", TimeSpan.FromTicks(5))),
- OnCompleted<TimeInterval<string>>(800)
- );
-
- var ex = new Exception();
-
- var xsd = new List<ITestableObservable<long>>();
- var ysd = new List<ITestableObservable<long>>();
-
- var res = scheduler.Start(() =>
- xs.GroupJoin(ys, x => NewTimer(xsd, x.Interval, scheduler), y => NewTimer(ysd, y.Interval, scheduler), (x, yy) => { if (x.Value >= 0) throw ex; return yy.Select(y => x.Value + y.Value); }).Merge()
- );
-
- res.Messages.AssertEqual(
- OnError<string>(210, ex)
- );
-
-#if !NO_PERF // BREAKING CHANGE v2 > v1.x - Duration selector is now invoked before the result selector
- AssertDurations(xs, xsd, 210);
-#endif
- AssertDurations(ys, ysd, 210);
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
-
- ys.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- #endregion
-
- #region + Join +
-
- [TestMethod]
- public void JoinOp_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Join(null, DummyObservable<int>.Instance, DummyFunc<int, IObservable<int>>.Instance, DummyFunc<int, IObservable<int>>.Instance, DummyFunc<int, int, int>.Instance));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Join(DummyObservable<int>.Instance, null, DummyFunc<int, IObservable<int>>.Instance, DummyFunc<int, IObservable<int>>.Instance, DummyFunc<int, int, int>.Instance));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Join(DummyObservable<int>.Instance, DummyObservable<int>.Instance, default(Func<int, IObservable<int>>), DummyFunc<int, IObservable<int>>.Instance, DummyFunc<int, int, int>.Instance));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Join(DummyObservable<int>.Instance, DummyObservable<int>.Instance, DummyFunc<int, IObservable<int>>.Instance, default(Func<int, IObservable<int>>), DummyFunc<int, int, int>.Instance));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Join(DummyObservable<int>.Instance, DummyObservable<int>.Instance, DummyFunc<int, IObservable<int>>.Instance, DummyFunc<int, IObservable<int>>.Instance, default(Func<int, int, int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Join(DummyObservable<int>.Instance, DummyObservable<int>.Instance, DummyFunc<int, IObservable<int>>.Instance, DummyFunc<int, IObservable<int>>.Instance, DummyFunc<int, int, int>.Instance).Subscribe(null));
- }
-
- [TestMethod]
- public void JoinOp_Normal_I()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(210, new TimeInterval<int>(0, TimeSpan.FromTicks(10))),
- OnNext(219, new TimeInterval<int>(1, TimeSpan.FromTicks(5))),
- OnNext(240, new TimeInterval<int>(2, TimeSpan.FromTicks(10))),
- OnNext(300, new TimeInterval<int>(3, TimeSpan.FromTicks(100))),
- OnNext(310, new TimeInterval<int>(4, TimeSpan.FromTicks(80))),
- OnNext(500, new TimeInterval<int>(5, TimeSpan.FromTicks(90))),
- OnNext(700, new TimeInterval<int>(6, TimeSpan.FromTicks(25))),
- OnNext(710, new TimeInterval<int>(7, TimeSpan.FromTicks(300))),
- OnNext(720, new TimeInterval<int>(8, TimeSpan.FromTicks(100))),
- OnNext(830, new TimeInterval<int>(9, TimeSpan.FromTicks(10))),
- OnCompleted<TimeInterval<int>>(900)
- );
-
- var ys = scheduler.CreateHotObservable(
- OnNext(215, new TimeInterval<string>("hat", TimeSpan.FromTicks(20))),
- OnNext(217, new TimeInterval<string>("bat", TimeSpan.FromTicks(1))),
- OnNext(290, new TimeInterval<string>("wag", TimeSpan.FromTicks(200))),
- OnNext(300, new TimeInterval<string>("pig", TimeSpan.FromTicks(10))),
- OnNext(305, new TimeInterval<string>("cup", TimeSpan.FromTicks(50))),
- OnNext(600, new TimeInterval<string>("yak", TimeSpan.FromTicks(90))),
- OnNext(702, new TimeInterval<string>("tin", TimeSpan.FromTicks(20))),
- OnNext(712, new TimeInterval<string>("man", TimeSpan.FromTicks(10))),
- OnNext(722, new TimeInterval<string>("rat", TimeSpan.FromTicks(200))),
- OnNext(732, new TimeInterval<string>("wig", TimeSpan.FromTicks(5))),
- OnCompleted<TimeInterval<string>>(800)
- );
-
- var xsd = new List<ITestableObservable<long>>();
- var ysd = new List<ITestableObservable<long>>();
-
- var res = scheduler.Start(() =>
- xs.Join(ys, x => NewTimer(xsd, x.Interval, scheduler), y => NewTimer(ysd, y.Interval, scheduler), (x, y) => x.Value + y.Value)
- );
-
- res.Messages.AssertEqual(
- OnNext(215, "0hat"),
- OnNext(217, "0bat"),
- OnNext(219, "1hat"),
- OnNext(300, "3wag"),
- OnNext(300, "3pig"),
- OnNext(305, "3cup"),
- OnNext(310, "4wag"),
- OnNext(310, "4pig"),
- OnNext(310, "4cup"),
- OnNext(702, "6tin"),
- OnNext(710, "7tin"),
- OnNext(712, "7man"),
- OnNext(712, "6man"),
- OnNext(720, "8tin"),
- OnNext(720, "8man"),
- OnNext(722, "7rat"),
- OnNext(722, "6rat"),
- OnNext(722, "8rat"),
- OnNext(732, "7wig"),
- OnNext(732, "8wig"),
- OnNext(830, "9rat"),
- OnCompleted<string>(900)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 900)
- );
-
-#if !NO_PERF // BREAKING CHANGE v2 > v1.x -> More aggressive disposal behavior
- ys.Subscriptions.AssertEqual(
- Subscribe(200, 800)
- );
-#else
- ys.Subscriptions.AssertEqual(
- Subscribe(200, 900)
- );
-#endif
-
- AssertDurations(xs, xsd, 900);
- AssertDurations(ys, ysd, 900);
- }
-
- [TestMethod]
- public void JoinOp_Normal_II()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(210, new TimeInterval<int>(0, TimeSpan.FromTicks(10))),
- OnNext(219, new TimeInterval<int>(1, TimeSpan.FromTicks(5))),
- OnNext(240, new TimeInterval<int>(2, TimeSpan.FromTicks(10))),
- OnNext(300, new TimeInterval<int>(3, TimeSpan.FromTicks(100))),
- OnNext(310, new TimeInterval<int>(4, TimeSpan.FromTicks(80))),
- OnNext(500, new TimeInterval<int>(5, TimeSpan.FromTicks(90))),
- OnNext(700, new TimeInterval<int>(6, TimeSpan.FromTicks(25))),
- OnNext(710, new TimeInterval<int>(7, TimeSpan.FromTicks(200))),
- OnNext(720, new TimeInterval<int>(8, TimeSpan.FromTicks(100))),
- OnCompleted<TimeInterval<int>>(721)
- );
-
- var ys = scheduler.CreateHotObservable(
- OnNext(215, new TimeInterval<string>("hat", TimeSpan.FromTicks(20))),
- OnNext(217, new TimeInterval<string>("bat", TimeSpan.FromTicks(1))),
- OnNext(290, new TimeInterval<string>("wag", TimeSpan.FromTicks(200))),
- OnNext(300, new TimeInterval<string>("pig", TimeSpan.FromTicks(10))),
- OnNext(305, new TimeInterval<string>("cup", TimeSpan.FromTicks(50))),
- OnNext(600, new TimeInterval<string>("yak", TimeSpan.FromTicks(90))),
- OnNext(702, new TimeInterval<string>("tin", TimeSpan.FromTicks(20))),
- OnNext(712, new TimeInterval<string>("man", TimeSpan.FromTicks(10))),
- OnNext(722, new TimeInterval<string>("rat", TimeSpan.FromTicks(200))),
- OnNext(732, new TimeInterval<string>("wig", TimeSpan.FromTicks(5))),
- OnCompleted<TimeInterval<string>>(990)
- );
-
- var xsd = new List<ITestableObservable<long>>();
- var ysd = new List<ITestableObservable<long>>();
-
- var res = scheduler.Start(() =>
- xs.Join(ys, x => NewTimer(xsd, x.Interval, scheduler), y => NewTimer(ysd, y.Interval, scheduler), (x, y) => x.Value + y.Value)
- );
-
- res.Messages.AssertEqual(
- OnNext(215, "0hat"),
- OnNext(217, "0bat"),
- OnNext(219, "1hat"),
- OnNext(300, "3wag"),
- OnNext(300, "3pig"),
- OnNext(305, "3cup"),
- OnNext(310, "4wag"),
- OnNext(310, "4pig"),
- OnNext(310, "4cup"),
- OnNext(702, "6tin"),
- OnNext(710, "7tin"),
- OnNext(712, "7man"),
- OnNext(712, "6man"),
- OnNext(720, "8tin"),
- OnNext(720, "8man"),
- OnNext(722, "7rat"),
- OnNext(722, "6rat"),
- OnNext(722, "8rat"),
- OnNext(732, "7wig"),
- OnNext(732, "8wig"),
- OnCompleted<string>(910)
- );
-
-#if !NO_PERF // BREAKING CHANGE v2 > v1.x -> More aggressive disposal behavior
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 721)
- );
-#else
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 910)
- );
-#endif
-
- ys.Subscriptions.AssertEqual(
- Subscribe(200, 910)
- );
-
- AssertDurations(xs, xsd, 910);
- AssertDurations(ys, ysd, 910);
- }
-
- [TestMethod]
- public void JoinOp_Normal_III()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(210, new TimeInterval<int>(0, TimeSpan.FromTicks(10))),
- OnNext(219, new TimeInterval<int>(1, TimeSpan.FromTicks(5))),
- OnNext(240, new TimeInterval<int>(2, TimeSpan.FromTicks(10))),
- OnNext(300, new TimeInterval<int>(3, TimeSpan.FromTicks(100))),
- OnNext(310, new TimeInterval<int>(4, TimeSpan.FromTicks(80))),
- OnNext(500, new TimeInterval<int>(5, TimeSpan.FromTicks(90))),
- OnNext(700, new TimeInterval<int>(6, TimeSpan.FromTicks(25))),
- OnNext(710, new TimeInterval<int>(7, TimeSpan.FromTicks(300))),
- OnNext(720, new TimeInterval<int>(8, TimeSpan.FromTicks(100))),
- OnNext(830, new TimeInterval<int>(9, TimeSpan.FromTicks(10))),
- OnCompleted<TimeInterval<int>>(900)
- );
-
- var ys = scheduler.CreateHotObservable(
- OnNext(215, new TimeInterval<string>("hat", TimeSpan.FromTicks(20))),
- OnNext(217, new TimeInterval<string>("bat", TimeSpan.FromTicks(1))),
- OnNext(290, new TimeInterval<string>("wag", TimeSpan.FromTicks(200))),
- OnNext(300, new TimeInterval<string>("pig", TimeSpan.FromTicks(10))),
- OnNext(305, new TimeInterval<string>("cup", TimeSpan.FromTicks(50))),
- OnNext(600, new TimeInterval<string>("yak", TimeSpan.FromTicks(90))),
- OnNext(702, new TimeInterval<string>("tin", TimeSpan.FromTicks(20))),
- OnNext(712, new TimeInterval<string>("man", TimeSpan.FromTicks(10))),
- OnNext(722, new TimeInterval<string>("rat", TimeSpan.FromTicks(200))),
- OnNext(732, new TimeInterval<string>("wig", TimeSpan.FromTicks(5))),
- OnCompleted<TimeInterval<string>>(800)
- );
-
- var xsd = new List<ITestableObservable<long>>();
- var ysd = new List<ITestableObservable<long>>();
-
- var res = scheduler.Start(() =>
- xs.Join(ys, x => NewTimer(xsd, x.Interval, scheduler).Where(_ => false), y => NewTimer(ysd, y.Interval, scheduler).Where(_ => false), (x, y) => x.Value + y.Value)
- );
-
- res.Messages.AssertEqual(
- OnNext(215, "0hat"),
- OnNext(217, "0bat"),
- OnNext(219, "1hat"),
- OnNext(300, "3wag"),
- OnNext(300, "3pig"),
- OnNext(305, "3cup"),
- OnNext(310, "4wag"),
- OnNext(310, "4pig"),
- OnNext(310, "4cup"),
- OnNext(702, "6tin"),
- OnNext(710, "7tin"),
- OnNext(712, "7man"),
- OnNext(712, "6man"),
- OnNext(720, "8tin"),
- OnNext(720, "8man"),
- OnNext(722, "7rat"),
- OnNext(722, "6rat"),
- OnNext(722, "8rat"),
- OnNext(732, "7wig"),
- OnNext(732, "8wig"),
- OnNext(830, "9rat"),
- OnCompleted<string>(900)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 900)
- );
-
-#if !NO_PERF // BREAKING CHANGE v2 > v1.x -> More aggressive disposal behavior
- ys.Subscriptions.AssertEqual(
- Subscribe(200, 800)
- );
-#else
- ys.Subscriptions.AssertEqual(
- Subscribe(200, 900)
- );
-#endif
-
- AssertDurations(xs, xsd, 900);
- AssertDurations(ys, ysd, 900);
- }
-
- [TestMethod]
- public void JoinOp_Normal_IV()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(210, new TimeInterval<int>(0, TimeSpan.FromTicks(10))),
- OnNext(219, new TimeInterval<int>(1, TimeSpan.FromTicks(5))),
- OnNext(240, new TimeInterval<int>(2, TimeSpan.FromTicks(10))),
- OnNext(300, new TimeInterval<int>(3, TimeSpan.FromTicks(100))),
- OnNext(310, new TimeInterval<int>(4, TimeSpan.FromTicks(80))),
- OnNext(500, new TimeInterval<int>(5, TimeSpan.FromTicks(90))),
- OnNext(700, new TimeInterval<int>(6, TimeSpan.FromTicks(25))),
- OnNext(710, new TimeInterval<int>(7, TimeSpan.FromTicks(200))),
- OnNext(720, new TimeInterval<int>(8, TimeSpan.FromTicks(100))),
- OnCompleted<TimeInterval<int>>(990)
- );
-
- var ys = scheduler.CreateHotObservable(
- OnNext(215, new TimeInterval<string>("hat", TimeSpan.FromTicks(20))),
- OnNext(217, new TimeInterval<string>("bat", TimeSpan.FromTicks(1))),
- OnNext(290, new TimeInterval<string>("wag", TimeSpan.FromTicks(200))),
- OnNext(300, new TimeInterval<string>("pig", TimeSpan.FromTicks(10))),
- OnNext(305, new TimeInterval<string>("cup", TimeSpan.FromTicks(50))),
- OnNext(600, new TimeInterval<string>("yak", TimeSpan.FromTicks(90))),
- OnNext(702, new TimeInterval<string>("tin", TimeSpan.FromTicks(20))),
- OnNext(712, new TimeInterval<string>("man", TimeSpan.FromTicks(10))),
- OnNext(722, new TimeInterval<string>("rat", TimeSpan.FromTicks(200))),
- OnNext(732, new TimeInterval<string>("wig", TimeSpan.FromTicks(5))),
- OnCompleted<TimeInterval<string>>(980)
- );
-
- var xsd = new List<ITestableObservable<long>>();
- var ysd = new List<ITestableObservable<long>>();
-
- var res = scheduler.Start(() =>
- xs.Join(ys, x => NewTimer(xsd, x.Interval, scheduler), y => NewTimer(ysd, y.Interval, scheduler), (x, y) => x.Value + y.Value)
- );
-
- res.Messages.AssertEqual(
- OnNext(215, "0hat"),
- OnNext(217, "0bat"),
- OnNext(219, "1hat"),
- OnNext(300, "3wag"),
- OnNext(300, "3pig"),
- OnNext(305, "3cup"),
- OnNext(310, "4wag"),
- OnNext(310, "4pig"),
- OnNext(310, "4cup"),
- OnNext(702, "6tin"),
- OnNext(710, "7tin"),
- OnNext(712, "7man"),
- OnNext(712, "6man"),
- OnNext(720, "8tin"),
- OnNext(720, "8man"),
- OnNext(722, "7rat"),
- OnNext(722, "6rat"),
- OnNext(722, "8rat"),
- OnNext(732, "7wig"),
- OnNext(732, "8wig"),
- OnCompleted<string>(980)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 980)
- );
-
- ys.Subscriptions.AssertEqual(
- Subscribe(200, 980)
- );
-
- AssertDurations(xs, xsd, 980);
- AssertDurations(ys, ysd, 980);
- }
-
- [TestMethod]
- public void JoinOp_Normal_V()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(210, new TimeInterval<int>(0, TimeSpan.FromTicks(10))),
- OnNext(219, new TimeInterval<int>(1, TimeSpan.FromTicks(5))),
- OnNext(240, new TimeInterval<int>(2, TimeSpan.FromTicks(10))),
- OnNext(300, new TimeInterval<int>(3, TimeSpan.FromTicks(100))),
- OnNext(310, new TimeInterval<int>(4, TimeSpan.FromTicks(80))),
- OnNext(500, new TimeInterval<int>(5, TimeSpan.FromTicks(90))),
- OnNext(700, new TimeInterval<int>(6, TimeSpan.FromTicks(25))),
- OnNext(710, new TimeInterval<int>(7, TimeSpan.FromTicks(200))),
- OnNext(720, new TimeInterval<int>(8, TimeSpan.FromTicks(100))),
- OnCompleted<TimeInterval<int>>(990)
- );
-
- var ys = scheduler.CreateHotObservable(
- OnNext(215, new TimeInterval<string>("hat", TimeSpan.FromTicks(20))),
- OnNext(217, new TimeInterval<string>("bat", TimeSpan.FromTicks(1))),
- OnNext(290, new TimeInterval<string>("wag", TimeSpan.FromTicks(200))),
- OnNext(300, new TimeInterval<string>("pig", TimeSpan.FromTicks(10))),
- OnNext(305, new TimeInterval<string>("cup", TimeSpan.FromTicks(50))),
- OnNext(600, new TimeInterval<string>("yak", TimeSpan.FromTicks(90))),
- OnNext(702, new TimeInterval<string>("tin", TimeSpan.FromTicks(20))),
- OnNext(712, new TimeInterval<string>("man", TimeSpan.FromTicks(10))),
- OnNext(722, new TimeInterval<string>("rat", TimeSpan.FromTicks(200))),
- OnNext(732, new TimeInterval<string>("wig", TimeSpan.FromTicks(5))),
- OnCompleted<TimeInterval<string>>(900)
- );
-
- var xsd = new List<ITestableObservable<long>>();
- var ysd = new List<ITestableObservable<long>>();
-
- var res = scheduler.Start(() =>
- xs.Join(ys, x => NewTimer(xsd, x.Interval, scheduler), y => NewTimer(ysd, y.Interval, scheduler), (x, y) => x.Value + y.Value)
- );
-
- res.Messages.AssertEqual(
- OnNext(215, "0hat"),
- OnNext(217, "0bat"),
- OnNext(219, "1hat"),
- OnNext(300, "3wag"),
- OnNext(300, "3pig"),
- OnNext(305, "3cup"),
- OnNext(310, "4wag"),
- OnNext(310, "4pig"),
- OnNext(310, "4cup"),
- OnNext(702, "6tin"),
- OnNext(710, "7tin"),
- OnNext(712, "7man"),
- OnNext(712, "6man"),
- OnNext(720, "8tin"),
- OnNext(720, "8man"),
- OnNext(722, "7rat"),
- OnNext(722, "6rat"),
- OnNext(722, "8rat"),
- OnNext(732, "7wig"),
- OnNext(732, "8wig"),
- OnCompleted<string>(922)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 922)
- );
-
-#if !NO_PERF // BREAKING CHANGE v2 > v1.x -> More aggressive disposal behavior
- ys.Subscriptions.AssertEqual(
- Subscribe(200, 900)
- );
-#else
- ys.Subscriptions.AssertEqual(
- Subscribe(200, 922)
- );
-#endif
-
- AssertDurations(xs, xsd, 922);
- AssertDurations(ys, ysd, 922);
- }
-
- [TestMethod]
- public void JoinOp_Normal_VI()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(210, new TimeInterval<int>(0, TimeSpan.FromTicks(10))),
- OnNext(219, new TimeInterval<int>(1, TimeSpan.FromTicks(5))),
- OnNext(240, new TimeInterval<int>(2, TimeSpan.FromTicks(10))),
- OnNext(300, new TimeInterval<int>(3, TimeSpan.FromTicks(100))),
- OnNext(310, new TimeInterval<int>(4, TimeSpan.FromTicks(80))),
- OnNext(500, new TimeInterval<int>(5, TimeSpan.FromTicks(90))),
- OnNext(700, new TimeInterval<int>(6, TimeSpan.FromTicks(25))),
- OnNext(710, new TimeInterval<int>(7, TimeSpan.FromTicks(30))),
- OnNext(720, new TimeInterval<int>(8, TimeSpan.FromTicks(200))),
- OnNext(830, new TimeInterval<int>(9, TimeSpan.FromTicks(10))),
- OnCompleted<TimeInterval<int>>(850)
- );
-
- var ys = scheduler.CreateHotObservable(
- OnNext(215, new TimeInterval<string>("hat", TimeSpan.FromTicks(20))),
- OnNext(217, new TimeInterval<string>("bat", TimeSpan.FromTicks(1))),
- OnNext(290, new TimeInterval<string>("wag", TimeSpan.FromTicks(200))),
- OnNext(300, new TimeInterval<string>("pig", TimeSpan.FromTicks(10))),
- OnNext(305, new TimeInterval<string>("cup", TimeSpan.FromTicks(50))),
- OnNext(600, new TimeInterval<string>("yak", TimeSpan.FromTicks(90))),
- OnNext(702, new TimeInterval<string>("tin", TimeSpan.FromTicks(20))),
- OnNext(712, new TimeInterval<string>("man", TimeSpan.FromTicks(10))),
- OnNext(722, new TimeInterval<string>("rat", TimeSpan.FromTicks(20))),
- OnNext(732, new TimeInterval<string>("wig", TimeSpan.FromTicks(5))),
- OnCompleted<TimeInterval<string>>(900)
- );
-
- var xsd = new List<ITestableObservable<long>>();
- var ysd = new List<ITestableObservable<long>>();
-
- var res = scheduler.Start(() =>
- xs.Join(ys, x => NewTimer(xsd, x.Interval, scheduler), y => NewTimer(ysd, y.Interval, scheduler), (x, y) => x.Value + y.Value)
- );
-
- res.Messages.AssertEqual(
- OnNext(215, "0hat"),
- OnNext(217, "0bat"),
- OnNext(219, "1hat"),
- OnNext(300, "3wag"),
- OnNext(300, "3pig"),
- OnNext(305, "3cup"),
- OnNext(310, "4wag"),
- OnNext(310, "4pig"),
- OnNext(310, "4cup"),
- OnNext(702, "6tin"),
- OnNext(710, "7tin"),
- OnNext(712, "7man"),
- OnNext(712, "6man"),
- OnNext(720, "8tin"),
- OnNext(720, "8man"),
- OnNext(722, "7rat"),
- OnNext(722, "6rat"),
- OnNext(722, "8rat"),
- OnNext(732, "7wig"),
- OnNext(732, "8wig"),
- OnCompleted<string>(900)
- );
-
-#if !NO_PERF // BREAKING CHANGE v2 > v1.x -> More aggressive disposal behavior
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 850)
- );
-#else
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 900)
- );
-#endif
-
- ys.Subscriptions.AssertEqual(
- Subscribe(200, 900)
- );
-
- AssertDurations(xs, xsd, 900);
- AssertDurations(ys, ysd, 900);
- }
-
- [TestMethod]
- public void JoinOp_Normal_VII()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(210, new TimeInterval<int>(0, TimeSpan.FromTicks(10))),
- OnNext(219, new TimeInterval<int>(1, TimeSpan.FromTicks(5))),
- OnNext(240, new TimeInterval<int>(2, TimeSpan.FromTicks(10))),
- OnNext(300, new TimeInterval<int>(3, TimeSpan.FromTicks(100))),
- OnNext(310, new TimeInterval<int>(4, TimeSpan.FromTicks(80))),
- OnNext(500, new TimeInterval<int>(5, TimeSpan.FromTicks(90))),
- OnNext(700, new TimeInterval<int>(6, TimeSpan.FromTicks(25))),
- OnNext(710, new TimeInterval<int>(7, TimeSpan.FromTicks(300))),
- OnNext(720, new TimeInterval<int>(8, TimeSpan.FromTicks(100))),
- OnNext(830, new TimeInterval<int>(9, TimeSpan.FromTicks(10))),
- OnCompleted<TimeInterval<int>>(900)
- );
-
- var ys = scheduler.CreateHotObservable(
- OnNext(215, new TimeInterval<string>("hat", TimeSpan.FromTicks(20))),
- OnNext(217, new TimeInterval<string>("bat", TimeSpan.FromTicks(1))),
- OnNext(290, new TimeInterval<string>("wag", TimeSpan.FromTicks(200))),
- OnNext(300, new TimeInterval<string>("pig", TimeSpan.FromTicks(10))),
- OnNext(305, new TimeInterval<string>("cup", TimeSpan.FromTicks(50))),
- OnNext(600, new TimeInterval<string>("yak", TimeSpan.FromTicks(90))),
- OnNext(702, new TimeInterval<string>("tin", TimeSpan.FromTicks(20))),
- OnNext(712, new TimeInterval<string>("man", TimeSpan.FromTicks(10))),
- OnNext(722, new TimeInterval<string>("rat", TimeSpan.FromTicks(200))),
- OnNext(732, new TimeInterval<string>("wig", TimeSpan.FromTicks(5))),
- OnCompleted<TimeInterval<string>>(800)
- );
-
- var xsd = new List<ITestableObservable<long>>();
- var ysd = new List<ITestableObservable<long>>();
-
- var res = scheduler.Start(() =>
- xs.Join(ys, x => NewTimer(xsd, x.Interval, scheduler), y => NewTimer(ysd, y.Interval, scheduler), (x, y) => x.Value + y.Value),
- 713
- );
-
- res.Messages.AssertEqual(
- OnNext(215, "0hat"),
- OnNext(217, "0bat"),
- OnNext(219, "1hat"),
- OnNext(300, "3wag"),
- OnNext(300, "3pig"),
- OnNext(305, "3cup"),
- OnNext(310, "4wag"),
- OnNext(310, "4pig"),
- OnNext(310, "4cup"),
- OnNext(702, "6tin"),
- OnNext(710, "7tin"),
- OnNext(712, "7man"),
- OnNext(712, "6man")
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 713)
- );
-
- ys.Subscriptions.AssertEqual(
- Subscribe(200, 713)
- );
-
- AssertDurations(xs, xsd, 713);
- AssertDurations(ys, ysd, 713);
- }
-
- [TestMethod]
- public void JoinOp_Error_I()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(210, new TimeInterval<int>(0, TimeSpan.FromTicks(10))),
- OnNext(219, new TimeInterval<int>(1, TimeSpan.FromTicks(5))),
- OnNext(240, new TimeInterval<int>(2, TimeSpan.FromTicks(10))),
- OnNext(300, new TimeInterval<int>(3, TimeSpan.FromTicks(100))),
- OnError<TimeInterval<int>>(310, ex)
- );
-
- var ys = scheduler.CreateHotObservable(
- OnNext(215, new TimeInterval<string>("hat", TimeSpan.FromTicks(20))),
- OnNext(217, new TimeInterval<string>("bat", TimeSpan.FromTicks(1))),
- OnNext(290, new TimeInterval<string>("wag", TimeSpan.FromTicks(200))),
- OnNext(300, new TimeInterval<string>("pig", TimeSpan.FromTicks(10))),
- OnNext(305, new TimeInterval<string>("cup", TimeSpan.FromTicks(50))),
- OnNext(600, new TimeInterval<string>("yak", TimeSpan.FromTicks(90))),
- OnNext(702, new TimeInterval<string>("tin", TimeSpan.FromTicks(20))),
- OnNext(712, new TimeInterval<string>("man", TimeSpan.FromTicks(10))),
- OnNext(722, new TimeInterval<string>("rat", TimeSpan.FromTicks(200))),
- OnNext(732, new TimeInterval<string>("wig", TimeSpan.FromTicks(5))),
- OnCompleted<TimeInterval<string>>(800)
- );
-
- var xsd = new List<ITestableObservable<long>>();
- var ysd = new List<ITestableObservable<long>>();
-
- var res = scheduler.Start(() =>
- xs.Join(ys, x => NewTimer(xsd, x.Interval, scheduler), y => NewTimer(ysd, y.Interval, scheduler), (x, y) => x.Value + y.Value)
- );
-
- res.Messages.AssertEqual(
- OnNext(215, "0hat"),
- OnNext(217, "0bat"),
- OnNext(219, "1hat"),
- OnNext(300, "3wag"),
- OnNext(300, "3pig"),
- OnNext(305, "3cup"),
- OnError<string>(310, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 310)
- );
-
- ys.Subscriptions.AssertEqual(
- Subscribe(200, 310)
- );
-
- AssertDurations(xs, xsd, 310);
- AssertDurations(ys, ysd, 310);
- }
-
- [TestMethod]
- public void JoinOp_Error_II()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(210, new TimeInterval<int>(0, TimeSpan.FromTicks(10))),
- OnNext(219, new TimeInterval<int>(1, TimeSpan.FromTicks(5))),
- OnNext(240, new TimeInterval<int>(2, TimeSpan.FromTicks(10))),
- OnNext(300, new TimeInterval<int>(3, TimeSpan.FromTicks(100))),
- OnNext(310, new TimeInterval<int>(4, TimeSpan.FromTicks(80))),
- OnNext(500, new TimeInterval<int>(5, TimeSpan.FromTicks(90))),
- OnNext(700, new TimeInterval<int>(6, TimeSpan.FromTicks(25))),
- OnNext(710, new TimeInterval<int>(7, TimeSpan.FromTicks(300))),
- OnNext(720, new TimeInterval<int>(8, TimeSpan.FromTicks(100))),
- OnNext(830, new TimeInterval<int>(9, TimeSpan.FromTicks(10))),
- OnCompleted<TimeInterval<int>>(900)
- );
-
- var ys = scheduler.CreateHotObservable(
- OnNext(215, new TimeInterval<string>("hat", TimeSpan.FromTicks(20))),
- OnNext(217, new TimeInterval<string>("bat", TimeSpan.FromTicks(1))),
- OnNext(290, new TimeInterval<string>("wag", TimeSpan.FromTicks(200))),
- OnNext(300, new TimeInterval<string>("pig", TimeSpan.FromTicks(10))),
- OnNext(305, new TimeInterval<string>("cup", TimeSpan.FromTicks(50))),
- OnNext(600, new TimeInterval<string>("yak", TimeSpan.FromTicks(90))),
- OnNext(702, new TimeInterval<string>("tin", TimeSpan.FromTicks(20))),
- OnNext(712, new TimeInterval<string>("man", TimeSpan.FromTicks(10))),
- OnError<TimeInterval<string>>(722, ex)
- );
-
- var xsd = new List<ITestableObservable<long>>();
- var ysd = new List<ITestableObservable<long>>();
-
- var res = scheduler.Start(() =>
- xs.Join(ys, x => NewTimer(xsd, x.Interval, scheduler), y => NewTimer(ysd, y.Interval, scheduler), (x, y) => x.Value + y.Value)
- );
-
- res.Messages.AssertEqual(
- OnNext(215, "0hat"),
- OnNext(217, "0bat"),
- OnNext(219, "1hat"),
- OnNext(300, "3wag"),
- OnNext(300, "3pig"),
- OnNext(305, "3cup"),
- OnNext(310, "4wag"),
- OnNext(310, "4pig"),
- OnNext(310, "4cup"),
- OnNext(702, "6tin"),
- OnNext(710, "7tin"),
- OnNext(712, "7man"),
- OnNext(712, "6man"),
- OnNext(720, "8tin"),
- OnNext(720, "8man"),
- OnError<string>(722, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 722)
- );
-
- ys.Subscriptions.AssertEqual(
- Subscribe(200, 722)
- );
-
- AssertDurations(xs, xsd, 722);
- AssertDurations(ys, ysd, 722);
- }
-
- [TestMethod]
- public void JoinOp_Error_III()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(210, new TimeInterval<int>(0, TimeSpan.FromTicks(10))),
- OnNext(219, new TimeInterval<int>(1, TimeSpan.FromTicks(5))),
- OnNext(240, new TimeInterval<int>(2, TimeSpan.FromTicks(10))),
- OnNext(300, new TimeInterval<int>(3, TimeSpan.FromTicks(100))),
- OnNext(310, new TimeInterval<int>(4, TimeSpan.FromTicks(80))),
- OnNext(500, new TimeInterval<int>(5, TimeSpan.FromTicks(90))),
- OnNext(700, new TimeInterval<int>(6, TimeSpan.FromTicks(25))),
- OnNext(710, new TimeInterval<int>(7, TimeSpan.FromTicks(300))),
- OnNext(720, new TimeInterval<int>(8, TimeSpan.FromTicks(100))),
- OnNext(830, new TimeInterval<int>(9, TimeSpan.FromTicks(10))),
- OnCompleted<TimeInterval<int>>(900)
- );
-
- var ys = scheduler.CreateHotObservable(
- OnNext(215, new TimeInterval<string>("hat", TimeSpan.FromTicks(20))),
- OnNext(217, new TimeInterval<string>("bat", TimeSpan.FromTicks(1))),
- OnNext(290, new TimeInterval<string>("wag", TimeSpan.FromTicks(200))),
- OnNext(300, new TimeInterval<string>("pig", TimeSpan.FromTicks(10))),
- OnNext(305, new TimeInterval<string>("cup", TimeSpan.FromTicks(50))),
- OnNext(600, new TimeInterval<string>("yak", TimeSpan.FromTicks(90))),
- OnNext(702, new TimeInterval<string>("tin", TimeSpan.FromTicks(20))),
- OnNext(712, new TimeInterval<string>("man", TimeSpan.FromTicks(10))),
- OnNext(722, new TimeInterval<string>("rat", TimeSpan.FromTicks(200))),
- OnNext(732, new TimeInterval<string>("wig", TimeSpan.FromTicks(5))),
- OnCompleted<TimeInterval<string>>(800)
- );
-
- var ex = new Exception();
-
- var xsd = new List<ITestableObservable<long>>();
- var ysd = new List<ITestableObservable<long>>();
-
- var res = scheduler.Start(() =>
- xs.Join(ys, x => NewTimer(xsd, x.Interval, scheduler).SelectMany(x.Value == 6 ? Observable.Throw<long>(ex) : Observable.Empty<long>()), y => NewTimer(ysd, y.Interval, scheduler), (x, y) => x.Value + y.Value)
- );
-
- res.Messages.AssertEqual(
- OnNext(215, "0hat"),
- OnNext(217, "0bat"),
- OnNext(219, "1hat"),
- OnNext(300, "3wag"),
- OnNext(300, "3pig"),
- OnNext(305, "3cup"),
- OnNext(310, "4wag"),
- OnNext(310, "4pig"),
- OnNext(310, "4cup"),
- OnNext(702, "6tin"),
- OnNext(710, "7tin"),
- OnNext(712, "7man"),
- OnNext(712, "6man"),
- OnNext(720, "8tin"),
- OnNext(720, "8man"),
- OnNext(722, "7rat"),
- OnNext(722, "6rat"),
- OnNext(722, "8rat"),
- OnError<string>(725, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 725)
- );
-
- ys.Subscriptions.AssertEqual(
- Subscribe(200, 725)
- );
-
- AssertDurations(xs, xsd, 725);
- AssertDurations(ys, ysd, 725);
- }
-
- [TestMethod]
- public void JoinOp_Error_IV()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(210, new TimeInterval<int>(0, TimeSpan.FromTicks(10))),
- OnNext(219, new TimeInterval<int>(1, TimeSpan.FromTicks(5))),
- OnNext(240, new TimeInterval<int>(2, TimeSpan.FromTicks(10))),
- OnNext(300, new TimeInterval<int>(3, TimeSpan.FromTicks(100))),
- OnNext(310, new TimeInterval<int>(4, TimeSpan.FromTicks(80))),
- OnNext(500, new TimeInterval<int>(5, TimeSpan.FromTicks(90))),
- OnNext(700, new TimeInterval<int>(6, TimeSpan.FromTicks(25))),
- OnNext(710, new TimeInterval<int>(7, TimeSpan.FromTicks(300))),
- OnNext(720, new TimeInterval<int>(8, TimeSpan.FromTicks(100))),
- OnNext(830, new TimeInterval<int>(9, TimeSpan.FromTicks(10))),
- OnCompleted<TimeInterval<int>>(900)
- );
-
- var ys = scheduler.CreateHotObservable(
- OnNext(215, new TimeInterval<string>("hat", TimeSpan.FromTicks(20))),
- OnNext(217, new TimeInterval<string>("bat", TimeSpan.FromTicks(1))),
- OnNext(290, new TimeInterval<string>("wag", TimeSpan.FromTicks(200))),
- OnNext(300, new TimeInterval<string>("pig", TimeSpan.FromTicks(10))),
- OnNext(305, new TimeInterval<string>("cup", TimeSpan.FromTicks(50))),
- OnNext(600, new TimeInterval<string>("yak", TimeSpan.FromTicks(90))),
- OnNext(702, new TimeInterval<string>("tin", TimeSpan.FromTicks(19))),
- OnNext(712, new TimeInterval<string>("man", TimeSpan.FromTicks(10))),
- OnNext(722, new TimeInterval<string>("rat", TimeSpan.FromTicks(200))),
- OnNext(732, new TimeInterval<string>("wig", TimeSpan.FromTicks(5))),
- OnCompleted<TimeInterval<string>>(800)
- );
-
- var ex = new Exception();
-
- var xsd = new List<ITestableObservable<long>>();
- var ysd = new List<ITestableObservable<long>>();
-
- var res = scheduler.Start(() =>
- xs.Join(ys, x => NewTimer(xsd, x.Interval, scheduler), y => NewTimer(ysd, y.Interval, scheduler).SelectMany(y.Value == "tin" ? Observable.Throw<long>(ex) : Observable.Empty<long>()), (x, y) => x.Value + y.Value)
- );
-
- res.Messages.AssertEqual(
- OnNext(215, "0hat"),
- OnNext(217, "0bat"),
- OnNext(219, "1hat"),
- OnNext(300, "3wag"),
- OnNext(300, "3pig"),
- OnNext(305, "3cup"),
- OnNext(310, "4wag"),
- OnNext(310, "4pig"),
- OnNext(310, "4cup"),
- OnNext(702, "6tin"),
- OnNext(710, "7tin"),
- OnNext(712, "7man"),
- OnNext(712, "6man"),
- OnNext(720, "8tin"),
- OnNext(720, "8man"),
- OnError<string>(721, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 721)
- );
-
- ys.Subscriptions.AssertEqual(
- Subscribe(200, 721)
- );
-
- AssertDurations(xs, xsd, 721);
- AssertDurations(ys, ysd, 721);
- }
-
- [TestMethod]
- public void JoinOp_Error_V()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(210, new TimeInterval<int>(0, TimeSpan.FromTicks(10))),
- OnNext(219, new TimeInterval<int>(1, TimeSpan.FromTicks(5))),
- OnNext(240, new TimeInterval<int>(2, TimeSpan.FromTicks(10))),
- OnNext(300, new TimeInterval<int>(3, TimeSpan.FromTicks(100))),
- OnNext(310, new TimeInterval<int>(4, TimeSpan.FromTicks(80))),
- OnNext(500, new TimeInterval<int>(5, TimeSpan.FromTicks(90))),
- OnNext(700, new TimeInterval<int>(6, TimeSpan.FromTicks(25))),
- OnNext(710, new TimeInterval<int>(7, TimeSpan.FromTicks(300))),
- OnNext(720, new TimeInterval<int>(8, TimeSpan.FromTicks(100))),
- OnNext(830, new TimeInterval<int>(9, TimeSpan.FromTicks(10))),
- OnCompleted<TimeInterval<int>>(900)
- );
-
- var ys = scheduler.CreateHotObservable(
- OnNext(215, new TimeInterval<string>("hat", TimeSpan.FromTicks(20))),
- OnNext(217, new TimeInterval<string>("bat", TimeSpan.FromTicks(1))),
- OnNext(290, new TimeInterval<string>("wag", TimeSpan.FromTicks(200))),
- OnNext(300, new TimeInterval<string>("pig", TimeSpan.FromTicks(10))),
- OnNext(305, new TimeInterval<string>("cup", TimeSpan.FromTicks(50))),
- OnNext(600, new TimeInterval<string>("yak", TimeSpan.FromTicks(90))),
- OnNext(702, new TimeInterval<string>("tin", TimeSpan.FromTicks(20))),
- OnNext(712, new TimeInterval<string>("man", TimeSpan.FromTicks(10))),
- OnNext(722, new TimeInterval<string>("rat", TimeSpan.FromTicks(200))),
- OnNext(732, new TimeInterval<string>("wig", TimeSpan.FromTicks(5))),
- OnCompleted<TimeInterval<string>>(800)
- );
-
- var ex = new Exception();
-
- var ysd = new List<ITestableObservable<long>>();
-
- var res = scheduler.Start(() =>
- xs.Join(ys, x => { if (x.Value >= 0) throw ex; return Observable.Empty<long>(); }, y => NewTimer(ysd, y.Interval, scheduler), (x, y) => x.Value + y.Value)
- );
-
- res.Messages.AssertEqual(
- OnError<string>(210, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
-
- ys.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
-
- AssertDurations(ys, ysd, 210);
- }
-
- [TestMethod]
- public void JoinOp_Error_VI()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(210, new TimeInterval<int>(0, TimeSpan.FromTicks(10))),
- OnNext(219, new TimeInterval<int>(1, TimeSpan.FromTicks(5))),
- OnNext(240, new TimeInterval<int>(2, TimeSpan.FromTicks(10))),
- OnNext(300, new TimeInterval<int>(3, TimeSpan.FromTicks(100))),
- OnNext(310, new TimeInterval<int>(4, TimeSpan.FromTicks(80))),
- OnNext(500, new TimeInterval<int>(5, TimeSpan.FromTicks(90))),
- OnNext(700, new TimeInterval<int>(6, TimeSpan.FromTicks(25))),
- OnNext(710, new TimeInterval<int>(7, TimeSpan.FromTicks(300))),
- OnNext(720, new TimeInterval<int>(8, TimeSpan.FromTicks(100))),
- OnNext(830, new TimeInterval<int>(9, TimeSpan.FromTicks(10))),
- OnCompleted<TimeInterval<int>>(900)
- );
-
- var ys = scheduler.CreateHotObservable(
- OnNext(215, new TimeInterval<string>("hat", TimeSpan.FromTicks(20))),
- OnNext(217, new TimeInterval<string>("bat", TimeSpan.FromTicks(1))),
- OnNext(290, new TimeInterval<string>("wag", TimeSpan.FromTicks(200))),
- OnNext(300, new TimeInterval<string>("pig", TimeSpan.FromTicks(10))),
- OnNext(305, new TimeInterval<string>("cup", TimeSpan.FromTicks(50))),
- OnNext(600, new TimeInterval<string>("yak", TimeSpan.FromTicks(90))),
- OnNext(702, new TimeInterval<string>("tin", TimeSpan.FromTicks(20))),
- OnNext(712, new TimeInterval<string>("man", TimeSpan.FromTicks(10))),
- OnNext(722, new TimeInterval<string>("rat", TimeSpan.FromTicks(200))),
- OnNext(732, new TimeInterval<string>("wig", TimeSpan.FromTicks(5))),
- OnCompleted<TimeInterval<string>>(800)
- );
-
- var ex = new Exception();
-
- var xsd = new List<ITestableObservable<long>>();
-
- var res = scheduler.Start(() =>
- xs.Join(ys, x => NewTimer(xsd, x.Interval, scheduler), y => { if (y.Value.Length >= 0) throw ex; return Observable.Empty<long>(); }, (x, y) => x.Value + y.Value)
- );
-
- res.Messages.AssertEqual(
- OnError<string>(215, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 215)
- );
-
- ys.Subscriptions.AssertEqual(
- Subscribe(200, 215)
- );
-
- AssertDurations(xs, xsd, 215);
- }
-
- [TestMethod]
- public void JoinOp_Error_VII()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(215, new TimeInterval<int>(0, TimeSpan.FromTicks(10))),
- OnNext(219, new TimeInterval<int>(1, TimeSpan.FromTicks(5))),
- OnNext(240, new TimeInterval<int>(2, TimeSpan.FromTicks(10))),
- OnNext(300, new TimeInterval<int>(3, TimeSpan.FromTicks(100))),
- OnNext(310, new TimeInterval<int>(4, TimeSpan.FromTicks(80))),
- OnNext(500, new TimeInterval<int>(5, TimeSpan.FromTicks(90))),
- OnNext(700, new TimeInterval<int>(6, TimeSpan.FromTicks(25))),
- OnNext(710, new TimeInterval<int>(7, TimeSpan.FromTicks(300))),
- OnNext(720, new TimeInterval<int>(8, TimeSpan.FromTicks(100))),
- OnNext(830, new TimeInterval<int>(9, TimeSpan.FromTicks(10))),
- OnCompleted<TimeInterval<int>>(900)
- );
-
- var ys = scheduler.CreateHotObservable(
- OnNext(210, new TimeInterval<string>("hat", TimeSpan.FromTicks(20))),
- OnNext(217, new TimeInterval<string>("bat", TimeSpan.FromTicks(1))),
- OnNext(290, new TimeInterval<string>("wag", TimeSpan.FromTicks(200))),
- OnNext(300, new TimeInterval<string>("pig", TimeSpan.FromTicks(10))),
- OnNext(305, new TimeInterval<string>("cup", TimeSpan.FromTicks(50))),
- OnNext(600, new TimeInterval<string>("yak", TimeSpan.FromTicks(90))),
- OnNext(702, new TimeInterval<string>("tin", TimeSpan.FromTicks(20))),
- OnNext(712, new TimeInterval<string>("man", TimeSpan.FromTicks(10))),
- OnNext(722, new TimeInterval<string>("rat", TimeSpan.FromTicks(200))),
- OnNext(732, new TimeInterval<string>("wig", TimeSpan.FromTicks(5))),
- OnCompleted<TimeInterval<string>>(800)
- );
-
- var ex = new Exception();
-
- var xsd = new List<ITestableObservable<long>>();
- var ysd = new List<ITestableObservable<long>>();
-
- var res = scheduler.Start(() =>
- xs.Join(ys, x => NewTimer(xsd, x.Interval, scheduler), y => NewTimer(ysd, y.Interval, scheduler), (x, y) => { if (x.Value >= 0) throw ex; return x.Value + y.Value; })
- );
-
- res.Messages.AssertEqual(
- OnError<string>(215, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 215)
- );
-
- ys.Subscriptions.AssertEqual(
- Subscribe(200, 215)
- );
-
- AssertDurations(xs, xsd, 215);
- AssertDurations(ys, ysd, 215);
- }
-
- [TestMethod]
- public void JoinOp_Error_VIII()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(210, new TimeInterval<int>(0, TimeSpan.FromTicks(10))),
- OnNext(219, new TimeInterval<int>(1, TimeSpan.FromTicks(5))),
- OnNext(240, new TimeInterval<int>(2, TimeSpan.FromTicks(10))),
- OnNext(300, new TimeInterval<int>(3, TimeSpan.FromTicks(100))),
- OnNext(310, new TimeInterval<int>(4, TimeSpan.FromTicks(80))),
- OnNext(500, new TimeInterval<int>(5, TimeSpan.FromTicks(90))),
- OnNext(700, new TimeInterval<int>(6, TimeSpan.FromTicks(25))),
- OnNext(710, new TimeInterval<int>(7, TimeSpan.FromTicks(300))),
- OnNext(720, new TimeInterval<int>(8, TimeSpan.FromTicks(100))),
- OnNext(830, new TimeInterval<int>(9, TimeSpan.FromTicks(10))),
- OnCompleted<TimeInterval<int>>(900)
- );
-
- var ys = scheduler.CreateHotObservable(
- OnNext(215, new TimeInterval<string>("hat", TimeSpan.FromTicks(20))),
- OnNext(217, new TimeInterval<string>("bat", TimeSpan.FromTicks(1))),
- OnNext(290, new TimeInterval<string>("wag", TimeSpan.FromTicks(200))),
- OnNext(300, new TimeInterval<string>("pig", TimeSpan.FromTicks(10))),
- OnNext(305, new TimeInterval<string>("cup", TimeSpan.FromTicks(50))),
- OnNext(600, new TimeInterval<string>("yak", TimeSpan.FromTicks(90))),
- OnNext(702, new TimeInterval<string>("tin", TimeSpan.FromTicks(20))),
- OnNext(712, new TimeInterval<string>("man", TimeSpan.FromTicks(10))),
- OnNext(722, new TimeInterval<string>("rat", TimeSpan.FromTicks(200))),
- OnNext(732, new TimeInterval<string>("wig", TimeSpan.FromTicks(5))),
- OnCompleted<TimeInterval<string>>(800)
- );
-
- var ex = new Exception();
-
- var xsd = new List<ITestableObservable<long>>();
- var ysd = new List<ITestableObservable<long>>();
-
- var res = scheduler.Start(() =>
- xs.Join(ys, x => NewTimer(xsd, x.Interval, scheduler), y => NewTimer(ysd, y.Interval, scheduler), (x, y) => { if (x.Value >= 0) throw ex; return x.Value + y.Value; })
- );
-
- res.Messages.AssertEqual(
- OnError<string>(215, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 215)
- );
-
- ys.Subscriptions.AssertEqual(
- Subscribe(200, 215)
- );
-
- AssertDurations(xs, xsd, 215);
- AssertDurations(ys, ysd, 215);
- }
-
- private ITestableObservable<long> NewTimer(List<ITestableObservable<long>> l, TimeSpan t, TestScheduler scheduler)
- {
- var timer = scheduler.CreateColdObservable(OnNext(t.Ticks, 0L), OnCompleted<long>(t.Ticks));
- l.Add(timer);
- return timer;
- }
-
- private void AssertDurations<T, U>(ITestableObservable<TimeInterval<T>> xs, List<ITestableObservable<U>> xsd, long lastEnd)
- {
- Assert.AreEqual(xs.Messages.Where(x => x.Value.Kind == NotificationKind.OnNext && x.Time <= lastEnd).Count(), xsd.Count);
-
- foreach (var pair in xs.Messages.Zip(xsd, (x, y) => new { Item1 = x, Item2 = y }))
- {
- var start = pair.Item1.Time;
- var end = Math.Min(start + pair.Item1.Value.Value.Interval.Ticks, lastEnd);
- pair.Item2.Subscriptions.AssertEqual(
- Subscribe(start, end)
- );
- }
- }
-
- #endregion
-
- #region + OfType +
-
- [TestMethod]
- public void OfType_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => ((IObservable<object>)null).OfType<bool>());
- ReactiveAssert.Throws<ArgumentNullException>(() => DummyObservable<object>.Instance.OfType<bool>().Subscribe(null));
- }
-
- [TestMethod]
- public void OfType_Complete()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable<object>(
- OnNext<object>(210, new B(0)),
- OnNext<object>(220, new A(1)),
- OnNext<object>(230, new E(2)),
- OnNext<object>(240, new D(3)),
- OnNext<object>(250, new C(4)),
- OnNext<object>(260, new B(5)),
- OnNext<object>(270, new B(6)),
- OnNext<object>(280, new D(7)),
- OnNext<object>(290, new A(8)),
- OnNext<object>(300, new E(9)),
- OnNext<object>(310, 3),
- OnNext<object>(320, "foo"),
- OnNext<object>(330, true),
- OnNext<object>(340, new B(10)),
- OnCompleted<object>(350)
- );
-
- var res = scheduler.Start(() =>
- xs.OfType<B>()
- );
-
- res.Messages.AssertEqual(
- OnNext<B>(210, new B(0)),
- OnNext<B>(240, new D(3)),
- OnNext<B>(260, new B(5)),
- OnNext<B>(270, new B(6)),
- OnNext<B>(280, new D(7)),
- OnNext<B>(340, new B(10)),
- OnCompleted<B>(350)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 350)
- );
- }
-
- [TestMethod]
- public void OfType_Error()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable<object>(
- OnNext<object>(210, new B(0)),
- OnNext<object>(220, new A(1)),
- OnNext<object>(230, new E(2)),
- OnNext<object>(240, new D(3)),
- OnNext<object>(250, new C(4)),
- OnNext<object>(260, new B(5)),
- OnNext<object>(270, new B(6)),
- OnNext<object>(280, new D(7)),
- OnNext<object>(290, new A(8)),
- OnNext<object>(300, new E(9)),
- OnNext<object>(310, 3),
- OnNext<object>(320, "foo"),
- OnNext<object>(330, true),
- OnNext<object>(340, new B(10)),
- OnError<object>(350, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.OfType<B>()
- );
-
- res.Messages.AssertEqual(
- OnNext<B>(210, new B(0)),
- OnNext<B>(240, new D(3)),
- OnNext<B>(260, new B(5)),
- OnNext<B>(270, new B(6)),
- OnNext<B>(280, new D(7)),
- OnNext<B>(340, new B(10)),
- OnError<B>(350, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 350)
- );
- }
-
- [TestMethod]
- public void OfType_Dispose()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable<object>(
- OnNext<object>(210, new B(0)),
- OnNext<object>(220, new A(1)),
- OnNext<object>(230, new E(2)),
- OnNext<object>(240, new D(3)),
- OnNext<object>(250, new C(4)),
- OnNext<object>(260, new B(5)),
- OnNext<object>(270, new B(6)),
- OnNext<object>(280, new D(7)),
- OnNext<object>(290, new A(8)),
- OnNext<object>(300, new E(9)),
- OnNext<object>(310, 3),
- OnNext<object>(320, "foo"),
- OnNext<object>(330, true),
- OnNext<object>(340, new B(10)),
- OnError<object>(350, new Exception())
- );
-
- var res = scheduler.Start(() =>
- xs.OfType<B>(),
- 275
- );
-
- res.Messages.AssertEqual(
- OnNext<B>(210, new B(0)),
- OnNext<B>(240, new D(3)),
- OnNext<B>(260, new B(5)),
- OnNext<B>(270, new B(6))
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 275)
- );
- }
-
- #endregion
-
- #region + Select +
-
- [TestMethod]
- public void Select_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => ((IObservable<int>)null).Select<int, int>(DummyFunc<int, int>.Instance));
- ReactiveAssert.Throws<ArgumentNullException>(() => DummyObservable<int>.Instance.Select<int, int>((Func<int, int>)null));
- ReactiveAssert.Throws<ArgumentNullException>(() => DummyObservable<int>.Instance.Select<int, int>(DummyFunc<int, int>.Instance).Subscribe(null));
- }
-
- [TestMethod]
- public void Select_Throws()
- {
- ReactiveAssert.Throws<InvalidOperationException>(() =>
- Observable.Return(1).Select<int, int>(x => x).Subscribe(
- x =>
- {
- throw new InvalidOperationException();
- }));
- ReactiveAssert.Throws<InvalidOperationException>(() =>
- Observable.Throw<int>(new Exception()).Select<int, int>(x => x).Subscribe(
- x => { },
- exception =>
- {
- throw new InvalidOperationException();
- }));
- ReactiveAssert.Throws<InvalidOperationException>(() =>
- Observable.Empty<int>().Select<int, int>(x => x).Subscribe(
- x => { },
- exception => { },
- () =>
- {
- throw new InvalidOperationException();
- }));
- ReactiveAssert.Throws<InvalidOperationException>(() => Observable.Create<int>(new Func<IObserver<int>, Action>(o => { throw new InvalidOperationException(); })).Select(x => x).Subscribe());
- }
-
- [TestMethod]
- public void Select_DisposeInsideSelector()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(100, 1),
- OnNext(200, 2),
- OnNext(500, 3),
- OnNext(600, 4)
- );
-
- var invoked = 0;
-
- var res = scheduler.CreateObserver<int>();
-
- var d = new SerialDisposable();
- d.Disposable = xs.Select(x =>
- {
- invoked++;
- if (scheduler.Clock > 400)
- d.Dispose();
- return x;
- }).Subscribe(res);
-
- scheduler.ScheduleAbsolute(Disposed, d.Dispose);
-
- scheduler.Start();
-
- res.Messages.AssertEqual(
- OnNext(100, 1),
- OnNext(200, 2)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(0, 500)
- );
-
- Assert.AreEqual(3, invoked);
- }
-
- [TestMethod]
- public void Select_Completed()
- {
- var scheduler = new TestScheduler();
-
- var invoked = 0;
-
- var xs = scheduler.CreateHotObservable(
- OnNext(180, 1),
- OnNext(210, 2),
- OnNext(240, 3),
- OnNext(290, 4),
- OnNext(350, 5),
- OnCompleted<int>(400),
- OnNext(410, -1),
- OnCompleted<int>(420),
- OnError<int>(430, new Exception())
- );
-
- var res = scheduler.Start(() =>
- xs.Select(x =>
- {
- invoked++;
- return x + 1;
- })
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 3),
- OnNext(240, 4),
- OnNext(290, 5),
- OnNext(350, 6),
- OnCompleted<int>(400)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 400)
- );
-
- Assert.AreEqual(4, invoked);
- }
-
- [TestMethod]
- public void Select_NotCompleted()
- {
- var scheduler = new TestScheduler();
-
- var invoked = 0;
-
- var xs = scheduler.CreateHotObservable(
- OnNext(180, 1),
- OnNext(210, 2),
- OnNext(240, 3),
- OnNext(290, 4),
- OnNext(350, 5)
- );
-
- var res = scheduler.Start(() =>
- xs.Select(x =>
- {
- invoked++;
- return x + 1;
- })
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 3),
- OnNext(240, 4),
- OnNext(290, 5),
- OnNext(350, 6)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
-
- Assert.AreEqual(4, invoked);
- }
-
- [TestMethod]
- public void Select_Error()
- {
- var scheduler = new TestScheduler();
-
- var invoked = 0;
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(180, 1),
- OnNext(210, 2),
- OnNext(240, 3),
- OnNext(290, 4),
- OnNext(350, 5),
- OnError<int>(400, ex),
- OnNext(410, -1),
- OnCompleted<int>(420),
- OnError<int>(430, new Exception())
- );
-
- var res = scheduler.Start(() =>
- xs.Select(x =>
- {
- invoked++;
- return x + 1;
- })
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 3),
- OnNext(240, 4),
- OnNext(290, 5),
- OnNext(350, 6),
- OnError<int>(400, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 400)
- );
-
- Assert.AreEqual(4, invoked);
- }
-
- [TestMethod]
- public void Select_SelectorThrows()
- {
- var scheduler = new TestScheduler();
-
- var invoked = 0;
-
- var xs = scheduler.CreateHotObservable(
- OnNext(180, 1),
- OnNext(210, 2),
- OnNext(240, 3),
- OnNext(290, 4),
- OnNext(350, 5),
- OnCompleted<int>(400),
- OnNext(410, -1),
- OnCompleted<int>(420),
- OnError<int>(430, new Exception())
- );
-
- var ex = new Exception();
-
- var res = scheduler.Start(() =>
- xs.Select(x =>
- {
- invoked++;
- if (invoked == 3)
- throw ex;
- return x + 1;
- })
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 3),
- OnNext(240, 4),
- OnError<int>(290, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 290)
- );
-
- Assert.AreEqual(3, invoked);
- }
-
- [TestMethod]
- public void SelectWithIndex_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => ((IObservable<int>)null).Select<int, int>(DummyFunc<int, int, int>.Instance));
- ReactiveAssert.Throws<ArgumentNullException>(() => DummyObservable<int>.Instance.Select<int, int>((Func<int, int, int>)null));
- ReactiveAssert.Throws<ArgumentNullException>(() => DummyObservable<int>.Instance.Select<int, int>(DummyFunc<int, int, int>.Instance).Subscribe(null));
- }
-
- [TestMethod]
- public void SelectWithIndex_Throws()
- {
- ReactiveAssert.Throws<InvalidOperationException>(() =>
- Observable.Return(1).Select<int, int>((x, index) => x).Subscribe(
- x =>
- {
- throw new InvalidOperationException();
- }));
- ReactiveAssert.Throws<InvalidOperationException>(() =>
- Observable.Throw<int>(new Exception()).Select<int, int>((x, index) => x).Subscribe(
- x => { },
- exception =>
- {
- throw new InvalidOperationException();
- }));
- ReactiveAssert.Throws<InvalidOperationException>(() =>
- Observable.Empty<int>().Select<int, int>((x, index) => x).Subscribe(
- x => { },
- exception => { },
- () =>
- {
- throw new InvalidOperationException();
- }));
- ReactiveAssert.Throws<InvalidOperationException>(() => Observable.Create<int>(new Func<IObserver<int>, Action>(o => { throw new InvalidOperationException(); })).Select((x, index) => x).Subscribe());
- }
-
- [TestMethod]
- public void SelectWithIndex_DisposeInsideSelector()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(100, 4),
- OnNext(200, 3),
- OnNext(500, 2),
- OnNext(600, 1)
- );
-
- var invoked = 0;
-
- var res = scheduler.CreateObserver<int>();
-
- var d = new SerialDisposable();
- d.Disposable = xs.Select((x, index) =>
- {
- invoked++;
- if (scheduler.Clock > 400)
- d.Dispose();
- return x + index * 10;
- }).Subscribe(res);
-
- scheduler.ScheduleAbsolute(Disposed, d.Dispose);
-
- scheduler.Start();
-
- res.Messages.AssertEqual(
- OnNext(100, 4),
- OnNext(200, 13)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(0, 500)
- );
-
- Assert.AreEqual(3, invoked);
- }
-
- [TestMethod]
- public void SelectWithIndex_Completed()
- {
- var scheduler = new TestScheduler();
-
- var invoked = 0;
-
- var xs = scheduler.CreateHotObservable(
- OnNext(180, 5),
- OnNext(210, 4),
- OnNext(240, 3),
- OnNext(290, 2),
- OnNext(350, 1),
- OnCompleted<int>(400),
- OnNext(410, -1),
- OnCompleted<int>(420),
- OnError<int>(430, new Exception())
- );
-
- var res = scheduler.Start(() =>
- xs.Select((x, index) =>
- {
- invoked++;
- return (x + 1) + (index * 10);
- })
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 5),
- OnNext(240, 14),
- OnNext(290, 23),
- OnNext(350, 32),
- OnCompleted<int>(400)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 400)
- );
-
- Assert.AreEqual(4, invoked);
- }
-
- [TestMethod]
- public void SelectWithIndex_NotCompleted()
- {
- var scheduler = new TestScheduler();
-
- var invoked = 0;
-
- var xs = scheduler.CreateHotObservable(
- OnNext(180, 5),
- OnNext(210, 4),
- OnNext(240, 3),
- OnNext(290, 2),
- OnNext(350, 1)
- );
-
- var res = scheduler.Start(() =>
- xs.Select((x, index) =>
- {
- invoked++;
- return (x + 1) + (index * 10);
- })
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 5),
- OnNext(240, 14),
- OnNext(290, 23),
- OnNext(350, 32)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
-
- Assert.AreEqual(4, invoked);
- }
-
- [TestMethod]
- public void SelectWithIndex_Error()
- {
- var scheduler = new TestScheduler();
-
- var invoked = 0;
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(180, 5),
- OnNext(210, 4),
- OnNext(240, 3),
- OnNext(290, 2),
- OnNext(350, 1),
- OnError<int>(400, ex),
- OnNext(410, -1),
- OnCompleted<int>(420),
- OnError<int>(430, new Exception())
- );
-
- var res = scheduler.Start(() =>
- xs.Select((x, index) =>
- {
- invoked++;
- return (x + 1) + (index * 10);
- })
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 5),
- OnNext(240, 14),
- OnNext(290, 23),
- OnNext(350, 32),
- OnError<int>(400, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 400)
- );
-
- Assert.AreEqual(4, invoked);
- }
-
- [TestMethod]
- public void SelectWithIndex_SelectorThrows()
- {
- var scheduler = new TestScheduler();
-
- var invoked = 0;
-
- var xs = scheduler.CreateHotObservable(
- OnNext(180, 5),
- OnNext(210, 4),
- OnNext(240, 3),
- OnNext(290, 2),
- OnNext(350, 1),
- OnCompleted<int>(400),
- OnNext(410, -1),
- OnCompleted<int>(420),
- OnError<int>(430, new Exception())
- );
-
- var ex = new Exception();
-
- var res = scheduler.Start(() =>
- xs.Select((x, index) =>
- {
- invoked++;
- if (invoked == 3)
- throw ex;
- return (x + 1) + (index * 10);
- })
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 5),
- OnNext(240, 14),
- OnError<int>(290, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 290)
- );
-
- Assert.AreEqual(3, invoked);
- }
-
- [TestMethod]
- public void Select_Select1()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(180, 5),
- OnNext(210, 4),
- OnNext(240, 3),
- OnNext(290, 2),
- OnNext(350, 1),
- OnCompleted<int>(400)
- );
-
- var res = scheduler.Start(() =>
- xs.Select(x => x + 1).Select(x => x - 2)
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 4 + 1 - 2),
- OnNext(240, 3 + 1 - 2),
- OnNext(290, 2 + 1 - 2),
- OnNext(350, 1 + 1 - 2),
- OnCompleted<int>(400)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 400)
- );
- }
-
- [TestMethod]
- public void Select_Select2()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(180, 5),
- OnNext(210, 4),
- OnNext(240, 3),
- OnNext(290, 2),
- OnNext(350, 1),
- OnCompleted<int>(400)
- );
-
- var res = scheduler.Start(() =>
- xs.Select((x, i) => x + i).Select(x => x - 2)
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 4 + 0 - 2),
- OnNext(240, 3 + 1 - 2),
- OnNext(290, 2 + 2 - 2),
- OnNext(350, 1 + 3 - 2),
- OnCompleted<int>(400)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 400)
- );
- }
-
- [TestMethod]
- public void Select_Select3()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(180, 5),
- OnNext(210, 4),
- OnNext(240, 3),
- OnNext(290, 2),
- OnNext(350, 1),
- OnCompleted<int>(400)
- );
-
- var res = scheduler.Start(() =>
- xs.Select(x => x + 1).Select((x, i) => x - i)
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 4 + 1 - 0),
- OnNext(240, 3 + 1 - 1),
- OnNext(290, 2 + 1 - 2),
- OnNext(350, 1 + 1 - 3),
- OnCompleted<int>(400)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 400)
- );
- }
-
- [TestMethod]
- public void Select_Select4()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(180, 5),
- OnNext(210, 4),
- OnNext(240, 3),
- OnNext(290, 2),
- OnNext(350, 1),
- OnCompleted<int>(400)
- );
-
- var res = scheduler.Start(() =>
- xs.Select((x, i) => x + i).Select((x, i) => x - i)
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 4),
- OnNext(240, 3),
- OnNext(290, 2),
- OnNext(350, 1),
- OnCompleted<int>(400)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 400)
- );
- }
-
- #endregion
-
- #region + SelectMany +
-
- [TestMethod]
- public void SelectMany_Then_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => ((IObservable<int>)null).SelectMany(DummyObservable<string>.Instance));
- ReactiveAssert.Throws<ArgumentNullException>(() => DummyObservable<int>.Instance.SelectMany(((IObservable<string>)null)));
- ReactiveAssert.Throws<ArgumentNullException>(() => DummyObservable<int>.Instance.SelectMany(DummyObservable<string>.Instance).Subscribe(null));
- }
-
- [TestMethod]
- public void SelectMany_Then_Complete_Complete()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateColdObservable(
- OnNext(100, 4),
- OnNext(200, 2),
- OnNext(300, 3),
- OnNext(400, 1),
- OnCompleted<int>(500)
- );
-
- var ys = scheduler.CreateColdObservable(
- OnNext(50, "foo"),
- OnNext(100, "bar"),
- OnNext(150, "baz"),
- OnNext(200, "qux"),
- OnCompleted<string>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.SelectMany(ys)
- );
-
- res.Messages.AssertEqual(
- OnNext(350, "foo"),
- OnNext(400, "bar"),
- OnNext(450, "baz"),
- OnNext(450, "foo"),
- OnNext(500, "qux"),
- OnNext(500, "bar"),
- OnNext(550, "baz"),
- OnNext(550, "foo"),
- OnNext(600, "qux"),
- OnNext(600, "bar"),
- OnNext(650, "baz"),
- OnNext(650, "foo"),
- OnNext(700, "qux"),
- OnNext(700, "bar"),
- OnNext(750, "baz"),
- OnNext(800, "qux"),
- OnCompleted<string>(850)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 700)
- );
-
- ys.Subscriptions.AssertEqual(
- Subscribe(300, 550),
- Subscribe(400, 650),
- Subscribe(500, 750),
- Subscribe(600, 850)
- );
- }
-
- [TestMethod]
- public void SelectMany_Then_Complete_Complete_2()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateColdObservable(
- OnNext(100, 4),
- OnNext(200, 2),
- OnNext(300, 3),
- OnNext(400, 1),
- OnCompleted<int>(700)
- );
-
- var ys = scheduler.CreateColdObservable(
- OnNext(50, "foo"),
- OnNext(100, "bar"),
- OnNext(150, "baz"),
- OnNext(200, "qux"),
- OnCompleted<string>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.SelectMany(ys)
- );
-
- res.Messages.AssertEqual(
- OnNext(350, "foo"),
- OnNext(400, "bar"),
- OnNext(450, "baz"),
- OnNext(450, "foo"),
- OnNext(500, "qux"),
- OnNext(500, "bar"),
- OnNext(550, "baz"),
- OnNext(550, "foo"),
- OnNext(600, "qux"),
- OnNext(600, "bar"),
- OnNext(650, "baz"),
- OnNext(650, "foo"),
- OnNext(700, "qux"),
- OnNext(700, "bar"),
- OnNext(750, "baz"),
- OnNext(800, "qux"),
- OnCompleted<string>(900)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 900)
- );
-
- ys.Subscriptions.AssertEqual(
- Subscribe(300, 550),
- Subscribe(400, 650),
- Subscribe(500, 750),
- Subscribe(600, 850)
- );
- }
-
- [TestMethod]
- public void SelectMany_Then_Never_Complete()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateColdObservable(
- OnNext(100, 4),
- OnNext(200, 2),
- OnNext(300, 3),
- OnNext(400, 1),
- OnNext(500, 5),
- OnNext(700, 0)
- );
-
- var ys = scheduler.CreateColdObservable(
- OnNext(50, "foo"),
- OnNext(100, "bar"),
- OnNext(150, "baz"),
- OnNext(200, "qux"),
- OnCompleted<string>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.SelectMany(ys)
- );
-
- res.Messages.AssertEqual(
- OnNext(350, "foo"),
- OnNext(400, "bar"),
- OnNext(450, "baz"),
- OnNext(450, "foo"),
- OnNext(500, "qux"),
- OnNext(500, "bar"),
- OnNext(550, "baz"),
- OnNext(550, "foo"),
- OnNext(600, "qux"),
- OnNext(600, "bar"),
- OnNext(650, "baz"),
- OnNext(650, "foo"),
- OnNext(700, "qux"),
- OnNext(700, "bar"),
- OnNext(750, "baz"),
- OnNext(750, "foo"),
- OnNext(800, "qux"),
- OnNext(800, "bar"),
- OnNext(850, "baz"),
- OnNext(900, "qux"),
- OnNext(950, "foo")
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
-
- ys.Subscriptions.AssertEqual(
- Subscribe(300, 550),
- Subscribe(400, 650),
- Subscribe(500, 750),
- Subscribe(600, 850),
- Subscribe(700, 950),
- Subscribe(900, 1000)
- );
- }
-
- [TestMethod]
- public void SelectMany_Then_Complete_Never()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateColdObservable(
- OnNext(100, 4),
- OnNext(200, 2),
- OnNext(300, 3),
- OnNext(400, 1),
- OnCompleted<int>(500)
- );
-
- var ys = scheduler.CreateColdObservable(
- OnNext(50, "foo"),
- OnNext(100, "bar"),
- OnNext(150, "baz"),
- OnNext(200, "qux")
- );
-
- var res = scheduler.Start(() =>
- xs.SelectMany(ys)
- );
-
- res.Messages.AssertEqual(
- OnNext(350, "foo"),
- OnNext(400, "bar"),
- OnNext(450, "baz"),
- OnNext(450, "foo"),
- OnNext(500, "qux"),
- OnNext(500, "bar"),
- OnNext(550, "baz"),
- OnNext(550, "foo"),
- OnNext(600, "qux"),
- OnNext(600, "bar"),
- OnNext(650, "baz"),
- OnNext(650, "foo"),
- OnNext(700, "qux"),
- OnNext(700, "bar"),
- OnNext(750, "baz"),
- OnNext(800, "qux")
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 700)
- );
-
- ys.Subscriptions.AssertEqual(
- Subscribe(300, 1000),
- Subscribe(400, 1000),
- Subscribe(500, 1000),
- Subscribe(600, 1000)
- );
- }
-
- [TestMethod]
- public void SelectMany_Then_Complete_Error()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateColdObservable(
- OnNext(100, 4),
- OnNext(200, 2),
- OnNext(300, 3),
- OnNext(400, 1),
- OnCompleted<int>(500)
- );
-
- var ys = scheduler.CreateColdObservable(
- OnNext(50, "foo"),
- OnNext(100, "bar"),
- OnNext(150, "baz"),
- OnNext(200, "qux"),
- OnError<string>(300, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.SelectMany(ys)
- );
-
- res.Messages.AssertEqual(
- OnNext(350, "foo"),
- OnNext(400, "bar"),
- OnNext(450, "baz"),
- OnNext(450, "foo"),
- OnNext(500, "qux"),
- OnNext(500, "bar"),
- OnNext(550, "baz"),
- OnNext(550, "foo"),
- OnError<string>(600, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 600)
- );
-
- ys.Subscriptions.AssertEqual(
- Subscribe(300, 600),
- Subscribe(400, 600),
- Subscribe(500, 600),
- Subscribe(600, 600)
- );
- }
-
- [TestMethod]
- public void SelectMany_Then_Error_Complete()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateColdObservable(
- OnNext(100, 4),
- OnNext(200, 2),
- OnNext(300, 3),
- OnNext(400, 1),
- OnError<int>(500, ex)
- );
-
- var ys = scheduler.CreateColdObservable(
- OnNext(50, "foo"),
- OnNext(100, "bar"),
- OnNext(150, "baz"),
- OnNext(200, "qux"),
- OnCompleted<string>(250)
- );
-
- var res = scheduler.Start(() =>
- xs.SelectMany(ys)
- );
-
- res.Messages.AssertEqual(
- OnNext(350, "foo"),
- OnNext(400, "bar"),
- OnNext(450, "baz"),
- OnNext(450, "foo"),
- OnNext(500, "qux"),
- OnNext(500, "bar"),
- OnNext(550, "baz"),
- OnNext(550, "foo"),
- OnNext(600, "qux"),
- OnNext(600, "bar"),
- OnNext(650, "baz"),
- OnNext(650, "foo"),
- OnError<string>(700, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 700)
- );
-
- ys.Subscriptions.AssertEqual(
- Subscribe(300, 550),
- Subscribe(400, 650),
- Subscribe(500, 700),
- Subscribe(600, 700)
- );
- }
-
- [TestMethod]
- public void SelectMany_Then_Error_Error()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateColdObservable(
- OnNext(100, 4),
- OnNext(200, 2),
- OnNext(300, 3),
- OnNext(400, 1),
- OnError<int>(500, new Exception())
- );
-
- var ys = scheduler.CreateColdObservable(
- OnNext(50, "foo"),
- OnNext(100, "bar"),
- OnNext(150, "baz"),
- OnNext(200, "qux"),
- OnError<string>(250, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.SelectMany(ys)
- );
-
- res.Messages.AssertEqual(
- OnNext(350, "foo"),
- OnNext(400, "bar"),
- OnNext(450, "baz"),
- OnNext(450, "foo"),
- OnNext(500, "qux"),
- OnNext(500, "bar"),
- OnError<string>(550, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 550)
- );
-
- ys.Subscriptions.AssertEqual(
- Subscribe(300, 550),
- Subscribe(400, 550),
- Subscribe(500, 550)
- );
- }
-
- [TestMethod]
- public void SelectMany_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => ((IObservable<int>)null).SelectMany<int, int>(DummyFunc<int, IObservable<int>>.Instance));
- ReactiveAssert.Throws<ArgumentNullException>(() => DummyObservable<int>.Instance.SelectMany((Func<int, IObservable<int>>)null));
- ReactiveAssert.Throws<ArgumentNullException>(() => DummyObservable<int>.Instance.SelectMany(DummyFunc<int, IObservable<int>>.Instance).Subscribe(null));
- }
-
- [TestMethod]
- public void SelectMany_Complete()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(5, scheduler.CreateColdObservable(
- OnError<int>(1, new InvalidOperationException()))),
- OnNext(105, scheduler.CreateColdObservable(
- OnError<int>(1, new InvalidOperationException()))),
- OnNext(300, scheduler.CreateColdObservable(
- OnNext(10, 102),
- OnNext(90, 103),
- OnNext(110, 104),
- OnNext(190, 105),
- OnNext(440, 106),
- OnCompleted<int>(460))),
- OnNext(400, scheduler.CreateColdObservable(
- OnNext(180, 202),
- OnNext(190, 203),
- OnCompleted<int>(205))),
- OnNext(550, scheduler.CreateColdObservable(
- OnNext(10, 301),
- OnNext(50, 302),
- OnNext(70, 303),
- OnNext(260, 304),
- OnNext(310, 305),
- OnCompleted<int>(410))),
- OnNext(750, scheduler.CreateColdObservable(
- OnCompleted<int>(40))),
- OnNext(850, scheduler.CreateColdObservable(
- OnNext(80, 401),
- OnNext(90, 402),
- OnCompleted<int>(100))),
- OnCompleted<ITestableObservable<int>>(900)
- );
-
- var res = scheduler.Start(() =>
- xs.SelectMany(x => x)
- );
-
- res.Messages.AssertEqual(
- OnNext(310, 102),
- OnNext(390, 103),
- OnNext(410, 104),
- OnNext(490, 105),
- OnNext(560, 301),
- OnNext(580, 202),
- OnNext(590, 203),
- OnNext(600, 302),
- OnNext(620, 303),
- OnNext(740, 106),
- OnNext(810, 304),
- OnNext(860, 305),
- OnNext(930, 401),
- OnNext(940, 402),
- OnCompleted<int>(960)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 900));
-
- xs.Messages[2].Value.Value.Subscriptions.AssertEqual(
- Subscribe(300, 760));
-
- xs.Messages[3].Value.Value.Subscriptions.AssertEqual(
- Subscribe(400, 605));
-
- xs.Messages[4].Value.Value.Subscriptions.AssertEqual(
- Subscribe(550, 960));
-
- xs.Messages[5].Value.Value.Subscriptions.AssertEqual(
- Subscribe(750, 790));
-
- xs.Messages[6].Value.Value.Subscriptions.AssertEqual(
- Subscribe(850, 950));
- }
-
- [TestMethod]
- public void SelectMany_Complete_InnerNotComplete()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(5, scheduler.CreateColdObservable(
- OnError<int>(1, new InvalidOperationException()))),
- OnNext(105, scheduler.CreateColdObservable(
- OnError<int>(1, new InvalidOperationException()))),
- OnNext(300, scheduler.CreateColdObservable(
- OnNext(10, 102),
- OnNext(90, 103),
- OnNext(110, 104),
- OnNext(190, 105),
- OnNext(440, 106),
- OnCompleted<int>(460))),
- OnNext(400, scheduler.CreateColdObservable(
- OnNext(180, 202),
- OnNext(190, 203))),
- OnNext(550, scheduler.CreateColdObservable(
- OnNext(10, 301),
- OnNext(50, 302),
- OnNext(70, 303),
- OnNext(260, 304),
- OnNext(310, 305),
- OnCompleted<int>(410))),
- OnNext(750, scheduler.CreateColdObservable(
- OnCompleted<int>(40))),
- OnNext(850, scheduler.CreateColdObservable(
- OnNext(80, 401),
- OnNext(90, 402),
- OnCompleted<int>(100))),
- OnCompleted<ITestableObservable<int>>(900)
- );
-
- var res = scheduler.Start(() =>
- xs.SelectMany(x => x)
- );
-
- res.Messages.AssertEqual(
- OnNext(310, 102),
- OnNext(390, 103),
- OnNext(410, 104),
- OnNext(490, 105),
- OnNext(560, 301),
- OnNext(580, 202),
- OnNext(590, 203),
- OnNext(600, 302),
- OnNext(620, 303),
- OnNext(740, 106),
- OnNext(810, 304),
- OnNext(860, 305),
- OnNext(930, 401),
- OnNext(940, 402)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 900));
-
- xs.Messages[2].Value.Value.Subscriptions.AssertEqual(
- Subscribe(300, 760));
-
- xs.Messages[3].Value.Value.Subscriptions.AssertEqual(
- Subscribe(400, 1000));
-
- xs.Messages[4].Value.Value.Subscriptions.AssertEqual(
- Subscribe(550, 960));
-
- xs.Messages[5].Value.Value.Subscriptions.AssertEqual(
- Subscribe(750, 790));
-
- xs.Messages[6].Value.Value.Subscriptions.AssertEqual(
- Subscribe(850, 950));
- }
-
- [TestMethod]
- public void SelectMany_Complete_OuterNotComplete()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(5, scheduler.CreateColdObservable(
- OnError<int>(1, new InvalidOperationException()))),
- OnNext(105, scheduler.CreateColdObservable(
- OnError<int>(1, new InvalidOperationException()))),
- OnNext(300, scheduler.CreateColdObservable(
- OnNext(10, 102),
- OnNext(90, 103),
- OnNext(110, 104),
- OnNext(190, 105),
- OnNext(440, 106),
- OnCompleted<int>(460))),
- OnNext(400, scheduler.CreateColdObservable(
- OnNext(180, 202),
- OnNext(190, 203),
- OnCompleted<int>(205))),
- OnNext(550, scheduler.CreateColdObservable(
- OnNext(10, 301),
- OnNext(50, 302),
- OnNext(70, 303),
- OnNext(260, 304),
- OnNext(310, 305),
- OnCompleted<int>(410))),
- OnNext(750, scheduler.CreateColdObservable(
- OnCompleted<int>(40))),
- OnNext(850, scheduler.CreateColdObservable(
- OnNext(80, 401),
- OnNext(90, 402),
- OnCompleted<int>(100)))
- );
-
- var res = scheduler.Start(() =>
- xs.SelectMany(x => x)
- );
-
- res.Messages.AssertEqual(
- OnNext(310, 102),
- OnNext(390, 103),
- OnNext(410, 104),
- OnNext(490, 105),
- OnNext(560, 301),
- OnNext(580, 202),
- OnNext(590, 203),
- OnNext(600, 302),
- OnNext(620, 303),
- OnNext(740, 106),
- OnNext(810, 304),
- OnNext(860, 305),
- OnNext(930, 401),
- OnNext(940, 402)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 1000));
-
- xs.Messages[2].Value.Value.Subscriptions.AssertEqual(
- Subscribe(300, 760));
-
- xs.Messages[3].Value.Value.Subscriptions.AssertEqual(
- Subscribe(400, 605));
-
- xs.Messages[4].Value.Value.Subscriptions.AssertEqual(
- Subscribe(550, 960));
-
- xs.Messages[5].Value.Value.Subscriptions.AssertEqual(
- Subscribe(750, 790));
-
- xs.Messages[6].Value.Value.Subscriptions.AssertEqual(
- Subscribe(850, 950));
- }
-
- [TestMethod]
- public void SelectMany_Error_Outer()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(5, scheduler.CreateColdObservable(
- OnError<int>(1, new InvalidOperationException()))),
- OnNext(105, scheduler.CreateColdObservable(
- OnError<int>(1, new InvalidOperationException()))),
- OnNext(300, scheduler.CreateColdObservable(
- OnNext(10, 102),
- OnNext(90, 103),
- OnNext(110, 104),
- OnNext(190, 105),
- OnNext(440, 106),
- OnCompleted<int>(460))),
- OnNext(400, scheduler.CreateColdObservable(
- OnNext(180, 202),
- OnNext(190, 203),
- OnCompleted<int>(205))),
- OnNext(550, scheduler.CreateColdObservable(
- OnNext(10, 301),
- OnNext(50, 302),
- OnNext(70, 303),
- OnNext(260, 304),
- OnNext(310, 305),
- OnCompleted<int>(410))),
- OnNext(750, scheduler.CreateColdObservable(
- OnCompleted<int>(40))),
- OnNext(850, scheduler.CreateColdObservable(
- OnNext(80, 401),
- OnNext(90, 402),
- OnCompleted<int>(100))),
- OnError<ITestableObservable<int>>(900, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.SelectMany(x => x)
- );
-
- res.Messages.AssertEqual(
- OnNext(310, 102),
- OnNext(390, 103),
- OnNext(410, 104),
- OnNext(490, 105),
- OnNext(560, 301),
- OnNext(580, 202),
- OnNext(590, 203),
- OnNext(600, 302),
- OnNext(620, 303),
- OnNext(740, 106),
- OnNext(810, 304),
- OnNext(860, 305),
- OnError<int>(900, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 900));
-
- xs.Messages[2].Value.Value.Subscriptions.AssertEqual(
- Subscribe(300, 760));
-
- xs.Messages[3].Value.Value.Subscriptions.AssertEqual(
- Subscribe(400, 605));
-
- xs.Messages[4].Value.Value.Subscriptions.AssertEqual(
- Subscribe(550, 900));
-
- xs.Messages[5].Value.Value.Subscriptions.AssertEqual(
- Subscribe(750, 790));
-
- xs.Messages[6].Value.Value.Subscriptions.AssertEqual(
- Subscribe(850, 900));
- }
-
- [TestMethod]
- public void SelectMany_Error_Inner()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(5, scheduler.CreateColdObservable(
- OnError<int>(1, new InvalidOperationException()))),
- OnNext(105, scheduler.CreateColdObservable(
- OnError<int>(1, new InvalidOperationException()))),
- OnNext(300, scheduler.CreateColdObservable(
- OnNext(10, 102),
- OnNext(90, 103),
- OnNext(110, 104),
- OnNext(190, 105),
- OnNext(440, 106),
- OnError<int>(460, ex))),
- OnNext(400, scheduler.CreateColdObservable(
- OnNext(180, 202),
- OnNext(190, 203),
- OnCompleted<int>(205))),
- OnNext(550, scheduler.CreateColdObservable(
- OnNext(10, 301),
- OnNext(50, 302),
- OnNext(70, 303),
- OnNext(260, 304),
- OnNext(310, 305),
- OnCompleted<int>(410))),
- OnNext(750, scheduler.CreateColdObservable(
- OnCompleted<int>(40))),
- OnNext(850, scheduler.CreateColdObservable(
- OnNext(80, 401),
- OnNext(90, 402),
- OnCompleted<int>(100))),
- OnCompleted<ITestableObservable<int>>(900)
- );
-
- var res = scheduler.Start(() =>
- xs.SelectMany(x => x)
- );
-
- res.Messages.AssertEqual(
- OnNext(310, 102),
- OnNext(390, 103),
- OnNext(410, 104),
- OnNext(490, 105),
- OnNext(560, 301),
- OnNext(580, 202),
- OnNext(590, 203),
- OnNext(600, 302),
- OnNext(620, 303),
- OnNext(740, 106),
- OnError<int>(760, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 760));
-
- xs.Messages[2].Value.Value.Subscriptions.AssertEqual(
- Subscribe(300, 760));
-
- xs.Messages[3].Value.Value.Subscriptions.AssertEqual(
- Subscribe(400, 605));
-
- xs.Messages[4].Value.Value.Subscriptions.AssertEqual(
- Subscribe(550, 760));
-
- xs.Messages[5].Value.Value.Subscriptions.AssertEqual(
- Subscribe(750, 760));
-
- xs.Messages[6].Value.Value.Subscriptions.AssertEqual(
- );
- }
-
- [TestMethod]
- public void SelectMany_Dispose()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(5, scheduler.CreateColdObservable(
- OnError<int>(1, new InvalidOperationException()))),
- OnNext(105, scheduler.CreateColdObservable(
- OnError<int>(1, new InvalidOperationException()))),
- OnNext(300, scheduler.CreateColdObservable(
- OnNext(10, 102),
- OnNext(90, 103),
- OnNext(110, 104),
- OnNext(190, 105),
- OnNext(440, 106),
- OnCompleted<int>(460))),
- OnNext(400, scheduler.CreateColdObservable(
- OnNext(180, 202),
- OnNext(190, 203),
- OnCompleted<int>(205))),
- OnNext(550, scheduler.CreateColdObservable(
- OnNext(10, 301),
- OnNext(50, 302),
- OnNext(70, 303),
- OnNext(260, 304),
- OnNext(310, 305),
- OnCompleted<int>(410))),
- OnNext(750, scheduler.CreateColdObservable(
- OnCompleted<int>(40))),
- OnNext(850, scheduler.CreateColdObservable(
- OnNext(80, 401),
- OnNext(90, 402),
- OnCompleted<int>(100))),
- OnCompleted<ITestableObservable<int>>(900)
- );
-
- var res = scheduler.Start(() =>
- xs.SelectMany(x => x),
- 700
- );
-
- res.Messages.AssertEqual(
- OnNext(310, 102),
- OnNext(390, 103),
- OnNext(410, 104),
- OnNext(490, 105),
- OnNext(560, 301),
- OnNext(580, 202),
- OnNext(590, 203),
- OnNext(600, 302),
- OnNext(620, 303)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 700));
-
- xs.Messages[2].Value.Value.Subscriptions.AssertEqual(
- Subscribe(300, 700));
-
- xs.Messages[3].Value.Value.Subscriptions.AssertEqual(
- Subscribe(400, 605));
-
- xs.Messages[4].Value.Value.Subscriptions.AssertEqual(
- Subscribe(550, 700));
-
- xs.Messages[5].Value.Value.Subscriptions.AssertEqual(
- );
-
- xs.Messages[6].Value.Value.Subscriptions.AssertEqual(
- );
- }
-
- [TestMethod]
- public void SelectMany_Throw()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(5, scheduler.CreateColdObservable(
- OnError<int>(1, new InvalidOperationException()))),
- OnNext(105, scheduler.CreateColdObservable(
- OnError<int>(1, new InvalidOperationException()))),
- OnNext(300, scheduler.CreateColdObservable(
- OnNext(10, 102),
- OnNext(90, 103),
- OnNext(110, 104),
- OnNext(190, 105),
- OnNext(440, 106),
- OnCompleted<int>(460))),
- OnNext(400, scheduler.CreateColdObservable(
- OnNext(180, 202),
- OnNext(190, 203),
- OnCompleted<int>(205))),
- OnNext(550, scheduler.CreateColdObservable(
- OnNext(10, 301),
- OnNext(50, 302),
- OnNext(70, 303),
- OnNext(260, 304),
- OnNext(310, 305),
- OnCompleted<int>(410))),
- OnNext(750, scheduler.CreateColdObservable(
- OnCompleted<int>(40))),
- OnNext(850, scheduler.CreateColdObservable(
- OnNext(80, 401),
- OnNext(90, 402),
- OnCompleted<int>(100))),
- OnCompleted<ITestableObservable<int>>(900)
- );
-
- var invoked = 0;
-
- var ex = new Exception();
-
- var res = scheduler.Start(() =>
- xs.SelectMany(x =>
- {
- invoked++;
- if (invoked == 3)
- throw ex;
- return x;
- })
- );
-
- res.Messages.AssertEqual(
- OnNext(310, 102),
- OnNext(390, 103),
- OnNext(410, 104),
- OnNext(490, 105),
- OnError<int>(550, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 550));
-
- xs.Messages[2].Value.Value.Subscriptions.AssertEqual(
- Subscribe(300, 550));
-
- xs.Messages[3].Value.Value.Subscriptions.AssertEqual(
- Subscribe(400, 550));
-
- xs.Messages[4].Value.Value.Subscriptions.AssertEqual(
- );
-
- xs.Messages[5].Value.Value.Subscriptions.AssertEqual(
- );
-
- xs.Messages[6].Value.Value.Subscriptions.AssertEqual(
- );
-
- Assert.AreEqual(3, invoked);
- }
-
- [TestMethod]
- public void SelectMany_UseFunction()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(210, 4),
- OnNext(220, 3),
- OnNext(250, 5),
- OnNext(270, 1),
- OnCompleted<int>(290)
- );
-
- var res = scheduler.Start(() =>
- xs.SelectMany(x => Observable.Interval(TimeSpan.FromTicks(10), scheduler).Select(_ => x).Take(x))
- );
-
- res.Messages.AssertEqual(
- OnNext(220, 4),
- OnNext(230, 3),
- OnNext(230, 4),
- OnNext(240, 3),
- OnNext(240, 4),
- OnNext(250, 3),
- OnNext(250, 4),
- OnNext(260, 5),
- OnNext(270, 5),
- OnNext(280, 1),
- OnNext(280, 5),
- OnNext(290, 5),
- OnNext(300, 5),
- OnCompleted<int>(300)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 290)
- );
- }
-
- [TestMethod]
- public void SelectMany_Enumerable_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => ((IObservable<int>)null).SelectMany<int, int>(DummyFunc<int, IEnumerable<int>>.Instance));
- ReactiveAssert.Throws<ArgumentNullException>(() => DummyObservable<int>.Instance.SelectMany((Func<int, IEnumerable<int>>)null));
- ReactiveAssert.Throws<ArgumentNullException>(() => DummyObservable<int>.Instance.SelectMany(DummyFunc<int, IEnumerable<int>>.Instance).Subscribe(null));
-
- ReactiveAssert.Throws<ArgumentNullException>(() => ((IObservable<int>)null).SelectMany<int, int, int>(DummyFunc<int, IEnumerable<int>>.Instance, DummyFunc<int, int, int>.Instance));
- ReactiveAssert.Throws<ArgumentNullException>(() => DummyObservable<int>.Instance.SelectMany((Func<int, IEnumerable<int>>)null, DummyFunc<int, int, int>.Instance));
- ReactiveAssert.Throws<ArgumentNullException>(() => DummyObservable<int>.Instance.SelectMany(DummyFunc<int, IEnumerable<int>>.Instance, (Func<int, int, int>)null));
- }
-
- [TestMethod]
- public void SelectMany_Enumerable_Complete()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(210, 2),
- OnNext(340, 4),
- OnNext(420, 3),
- OnNext(510, 2),
- OnCompleted<int>(600)
- );
-
- var inners = new List<MockEnumerable<int>>();
-
- var res = scheduler.Start(() =>
- xs.SelectMany(x =>
- {
- var ys = new MockEnumerable<int>(scheduler, Enumerable.Repeat(x, x));
- inners.Add(ys);
- return ys;
- })
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 2),
- OnNext(210, 2),
- OnNext(340, 4),
- OnNext(340, 4),
- OnNext(340, 4),
- OnNext(340, 4),
- OnNext(420, 3),
- OnNext(420, 3),
- OnNext(420, 3),
- OnNext(510, 2),
- OnNext(510, 2),
- OnCompleted<int>(600)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 600)
- );
-
- Assert.AreEqual(4, inners.Count);
-
- inners[0].Subscriptions.AssertEqual(
- Subscribe(210, 210)
- );
-
- inners[1].Subscriptions.AssertEqual(
- Subscribe(340, 340)
- );
-
- inners[2].Subscriptions.AssertEqual(
- Subscribe(420, 420)
- );
-
- inners[3].Subscriptions.AssertEqual(
- Subscribe(510, 510)
- );
- }
-
- [TestMethod]
- public void SelectMany_Enumerable_Complete_ResultSelector()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(210, 2),
- OnNext(340, 4),
- OnNext(420, 3),
- OnNext(510, 2),
- OnCompleted<int>(600)
- );
-
- var res = scheduler.Start(() =>
- xs.SelectMany(x => Enumerable.Repeat(x, x), (x, y) => x + y)
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 4),
- OnNext(210, 4),
- OnNext(340, 8),
- OnNext(340, 8),
- OnNext(340, 8),
- OnNext(340, 8),
- OnNext(420, 6),
- OnNext(420, 6),
- OnNext(420, 6),
- OnNext(510, 4),
- OnNext(510, 4),
- OnCompleted<int>(600)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 600)
- );
- }
-
- [TestMethod]
- public void SelectMany_Enumerable_Error()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(210, 2),
- OnNext(340, 4),
- OnNext(420, 3),
- OnNext(510, 2),
- OnError<int>(600, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.SelectMany(x => Enumerable.Repeat(x, x))
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 2),
- OnNext(210, 2),
- OnNext(340, 4),
- OnNext(340, 4),
- OnNext(340, 4),
- OnNext(340, 4),
- OnNext(420, 3),
- OnNext(420, 3),
- OnNext(420, 3),
- OnNext(510, 2),
- OnNext(510, 2),
- OnError<int>(600, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 600)
- );
- }
-
- [TestMethod]
- public void SelectMany_Enumerable_Error_ResultSelector()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(210, 2),
- OnNext(340, 4),
- OnNext(420, 3),
- OnNext(510, 2),
- OnError<int>(600, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.SelectMany(x => Enumerable.Repeat(x, x), (x, y) => x + y)
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 4),
- OnNext(210, 4),
- OnNext(340, 8),
- OnNext(340, 8),
- OnNext(340, 8),
- OnNext(340, 8),
- OnNext(420, 6),
- OnNext(420, 6),
- OnNext(420, 6),
- OnNext(510, 4),
- OnNext(510, 4),
- OnError<int>(600, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 600)
- );
- }
-
- [TestMethod]
- public void SelectMany_Enumerable_Dispose()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(210, 2),
- OnNext(340, 4),
- OnNext(420, 3),
- OnNext(510, 2),
- OnCompleted<int>(600)
- );
-
- var res = scheduler.Start(() =>
- xs.SelectMany(x => Enumerable.Repeat(x, x)),
- 350
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 2),
- OnNext(210, 2),
- OnNext(340, 4),
- OnNext(340, 4),
- OnNext(340, 4),
- OnNext(340, 4)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 350)
- );
- }
-
- [TestMethod]
- public void SelectMany_Enumerable_Dispose_ResultSelector()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(210, 2),
- OnNext(340, 4),
- OnNext(420, 3),
- OnNext(510, 2),
- OnCompleted<int>(600)
- );
-
- var res = scheduler.Start(() =>
- xs.SelectMany(x => Enumerable.Repeat(x, x), (x, y) => x + y),
- 350
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 4),
- OnNext(210, 4),
- OnNext(340, 8),
- OnNext(340, 8),
- OnNext(340, 8),
- OnNext(340, 8)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 350)
- );
- }
-
- [TestMethod]
- public void SelectMany_Enumerable_SelectorThrows()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(210, 2),
- OnNext(340, 4),
- OnNext(420, 3),
- OnNext(510, 2),
- OnCompleted<int>(600)
- );
-
- var invoked = 0;
- var ex = new Exception();
-
- var res = scheduler.Start(() =>
- xs.SelectMany(x =>
- {
- invoked++;
- if (invoked == 3)
- throw ex;
-
- return Enumerable.Repeat(x, x);
- })
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 2),
- OnNext(210, 2),
- OnNext(340, 4),
- OnNext(340, 4),
- OnNext(340, 4),
- OnNext(340, 4),
- OnError<int>(420, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 420)
- );
-
- Assert.AreEqual(3, invoked);
- }
-
- [TestMethod]
- public void SelectMany_Enumerable_ResultSelectorThrows()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(210, 2),
- OnNext(340, 4),
- OnNext(420, 3),
- OnNext(510, 2),
- OnCompleted<int>(600)
- );
-
- var ex = new Exception();
-
- var inners = new List<MockEnumerable<int>>();
-
- var res = scheduler.Start(() =>
- xs.SelectMany(
- x =>
- {
- var ys = new MockEnumerable<int>(scheduler, Enumerable.Repeat(x, x));
- inners.Add(ys);
- return ys;
- },
- (x, y) =>
- {
- if (x == 3)
- throw ex;
-
- return x + y;
- }
- )
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 4),
- OnNext(210, 4),
- OnNext(340, 8),
- OnNext(340, 8),
- OnNext(340, 8),
- OnNext(340, 8),
- OnError<int>(420, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 420)
- );
-
- Assert.AreEqual(3, inners.Count);
-
- inners[0].Subscriptions.AssertEqual(
- Subscribe(210, 210)
- );
-
- inners[1].Subscriptions.AssertEqual(
- Subscribe(340, 340)
- );
-
- inners[2].Subscriptions.AssertEqual(
- Subscribe(420, 420)
- );
- }
-
- [TestMethod]
- public void SelectMany_Enumerable_ResultSelector_GetEnumeratorThrows()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(210, 2),
- OnNext(340, 4),
- OnNext(420, 3),
- OnNext(510, 2),
- OnCompleted<int>(600)
- );
-
- var ex = new Exception();
-
- var res = scheduler.Start(() =>
- xs.SelectMany(x => new RogueEnumerable<int>(ex), (x, y) => x + y)
- );
-
- res.Messages.AssertEqual(
- OnError<int>(210, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void SelectMany_Enumerable_SelectorThrows_ResultSelector()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(210, 2),
- OnNext(340, 4),
- OnNext(420, 3),
- OnNext(510, 2),
- OnCompleted<int>(600)
- );
-
- var invoked = 0;
- var ex = new Exception();
-
- var res = scheduler.Start(() =>
- xs.SelectMany(
- x =>
- {
- invoked++;
- if (invoked == 3)
- throw ex;
-
- return Enumerable.Repeat(x, x);
- },
- (x, y) => x + y
- )
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 4),
- OnNext(210, 4),
- OnNext(340, 8),
- OnNext(340, 8),
- OnNext(340, 8),
- OnNext(340, 8),
- OnError<int>(420, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 420)
- );
-
- Assert.AreEqual(3, invoked);
- }
-
- class CurrentThrowsEnumerable<T> : IEnumerable<T>
- {
- IEnumerable<T> e;
- Exception ex;
-
- public CurrentThrowsEnumerable(IEnumerable<T> e, Exception ex)
- {
- this.e = e;
- this.ex = ex;
- }
-
- public IEnumerator<T> GetEnumerator()
- {
- return new Enumerator(e.GetEnumerator(), ex);
- }
-
- System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
- {
- return GetEnumerator();
- }
-
- class Enumerator : IEnumerator<T>
- {
- IEnumerator<T> e;
- Exception ex;
-
- public Enumerator(IEnumerator<T> e, Exception ex)
- {
- this.e = e;
- this.ex = ex;
- }
-
- public T Current
- {
- get { throw ex; }
- }
-
- public void Dispose()
- {
- e.Dispose();
- }
-
- object System.Collections.IEnumerator.Current
- {
- get { return Current; }
- }
-
- public bool MoveNext()
- {
- return e.MoveNext();
- }
-
- public void Reset()
- {
- e.Reset();
- }
- }
- }
-
- [TestMethod]
- public void SelectMany_Enumerable_CurrentThrows()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(210, 2),
- OnNext(340, 4),
- OnNext(420, 3),
- OnNext(510, 2),
- OnCompleted<int>(600)
- );
-
- var ex = new Exception();
-
- var res = scheduler.Start(() =>
- xs.SelectMany(x => new CurrentThrowsEnumerable<int>(Enumerable.Repeat(x, x), ex))
- );
-
- res.Messages.AssertEqual(
- OnError<int>(210, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void SelectMany_Enumerable_CurrentThrows_ResultSelector()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(210, 2),
- OnNext(340, 4),
- OnNext(420, 3),
- OnNext(510, 2),
- OnCompleted<int>(600)
- );
-
- var ex = new Exception();
-
- var res = scheduler.Start(() =>
- xs.SelectMany(x => new CurrentThrowsEnumerable<int>(Enumerable.Repeat(x, x), ex), (x, y) => x + y)
- );
-
- res.Messages.AssertEqual(
- OnError<int>(210, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- class MoveNextThrowsEnumerable<T> : IEnumerable<T>
- {
- IEnumerable<T> e;
- Exception ex;
-
- public MoveNextThrowsEnumerable(IEnumerable<T> e, Exception ex)
- {
- this.e = e;
- this.ex = ex;
- }
-
- public IEnumerator<T> GetEnumerator()
- {
- return new Enumerator(e.GetEnumerator(), ex);
- }
-
- System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
- {
- return GetEnumerator();
- }
-
- class Enumerator : IEnumerator<T>
- {
- IEnumerator<T> e;
- Exception ex;
-
- public Enumerator(IEnumerator<T> e, Exception ex)
- {
- this.e = e;
- this.ex = ex;
- }
-
- public T Current
- {
- get { return e.Current; }
- }
-
- public void Dispose()
- {
- e.Dispose();
- }
-
- object System.Collections.IEnumerator.Current
- {
- get { return Current; }
- }
-
- public bool MoveNext()
- {
- throw ex;
- }
-
- public void Reset()
- {
- e.Reset();
- }
- }
- }
-
- [TestMethod]
- public void SelectMany_Enumerable_GetEnumeratorThrows()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(210, 2),
- OnNext(340, 4),
- OnNext(420, 3),
- OnNext(510, 2),
- OnCompleted<int>(600)
- );
-
- var ex = new Exception();
-
- var res = scheduler.Start(() =>
- xs.SelectMany(x => new RogueEnumerable<int>(ex))
- );
-
- res.Messages.AssertEqual(
- OnError<int>(210, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void SelectMany_Enumerable_MoveNextThrows()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(210, 2),
- OnNext(340, 4),
- OnNext(420, 3),
- OnNext(510, 2),
- OnCompleted<int>(600)
- );
-
- var ex = new Exception();
-
- var res = scheduler.Start(() =>
- xs.SelectMany(x => new MoveNextThrowsEnumerable<int>(Enumerable.Repeat(x, x), ex))
- );
-
- res.Messages.AssertEqual(
- OnError<int>(210, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void SelectMany_Enumerable_MoveNextThrows_ResultSelector()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(210, 2),
- OnNext(340, 4),
- OnNext(420, 3),
- OnNext(510, 2),
- OnCompleted<int>(600)
- );
-
- var ex = new Exception();
-
- var res = scheduler.Start(() =>
- xs.SelectMany(x => new MoveNextThrowsEnumerable<int>(Enumerable.Repeat(x, x), ex), (x, y) => x + y)
- );
-
- res.Messages.AssertEqual(
- OnError<int>(210, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void SelectMany_QueryOperator_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => ((IObservable<int>)null).SelectMany<int, int, int>(DummyFunc<int, IObservable<int>>.Instance, DummyFunc<int, int, int>.Instance));
- ReactiveAssert.Throws<ArgumentNullException>(() => DummyObservable<int>.Instance.SelectMany((Func<int, IObservable<int>>)null, DummyFunc<int, int, int>.Instance));
- ReactiveAssert.Throws<ArgumentNullException>(() => DummyObservable<int>.Instance.SelectMany(DummyFunc<int, IObservable<int>>.Instance, ((Func<int, int, int>)null)));
- ReactiveAssert.Throws<ArgumentNullException>(() => DummyObservable<int>.Instance.SelectMany(DummyFunc<int, IObservable<int>>.Instance, DummyFunc<int, int, int>.Instance).Subscribe(null));
-
-#if !NO_TPL
- ReactiveAssert.Throws<ArgumentNullException>(() => ((IObservable<int>)null).SelectMany<int, int, int>(DummyFunc<int, Task<int>>.Instance, DummyFunc<int, int, int>.Instance));
- ReactiveAssert.Throws<ArgumentNullException>(() => DummyObservable<int>.Instance.SelectMany((Func<int, Task<int>>)null, DummyFunc<int, int, int>.Instance));
- ReactiveAssert.Throws<ArgumentNullException>(() => DummyObservable<int>.Instance.SelectMany(DummyFunc<int, Task<int>>.Instance, ((Func<int, int, int>)null)));
-
- ReactiveAssert.Throws<ArgumentNullException>(() => ((IObservable<int>)null).SelectMany<int, int, int>(DummyFunc<int, CancellationToken, Task<int>>.Instance, DummyFunc<int, int, int>.Instance));
- ReactiveAssert.Throws<ArgumentNullException>(() => DummyObservable<int>.Instance.SelectMany((Func<int, CancellationToken, Task<int>>)null, DummyFunc<int, int, int>.Instance));
- ReactiveAssert.Throws<ArgumentNullException>(() => DummyObservable<int>.Instance.SelectMany(DummyFunc<int, CancellationToken, Task<int>>.Instance, ((Func<int, int, int>)null)));
-
- ReactiveAssert.Throws<ArgumentNullException>(() => ((IObservable<int>)null).SelectMany<int, int>(DummyFunc<int, Task<int>>.Instance));
- ReactiveAssert.Throws<ArgumentNullException>(() => DummyObservable<int>.Instance.SelectMany((Func<int, Task<int>>)null));
-
- ReactiveAssert.Throws<ArgumentNullException>(() => ((IObservable<int>)null).SelectMany<int, int>(DummyFunc<int, CancellationToken, Task<int>>.Instance));
- ReactiveAssert.Throws<ArgumentNullException>(() => DummyObservable<int>.Instance.SelectMany((Func<int, CancellationToken, Task<int>>)null));
-#endif
- }
-
- [TestMethod]
- public void SelectMany_QueryOperator_CompleteOuterFirst()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(220, 4),
- OnNext(221, 3),
- OnNext(222, 2),
- OnNext(223, 5),
- OnCompleted<int>(224)
- );
-
- var res = scheduler.Start(() =>
- from x in xs
- from y in Observable.Interval(TimeSpan.FromTicks(1), scheduler).Take(x)
- select x * 10 + (int)y
- );
-
- res.Messages.AssertEqual(
- OnNext(221, 40),
- OnNext(222, 30),
- OnNext(222, 41),
- OnNext(223, 20),
- OnNext(223, 31),
- OnNext(223, 42),
- OnNext(224, 50),
- OnNext(224, 21),
- OnNext(224, 32),
- OnNext(224, 43),
- OnNext(225, 51),
- OnNext(226, 52),
- OnNext(227, 53),
- OnNext(228, 54),
- OnCompleted<int>(228)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 224)
- );
- }
-
- [TestMethod]
- public void SelectMany_QueryOperator_CompleteInnerFirst()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(220, 4),
- OnNext(221, 3),
- OnNext(222, 2),
- OnNext(223, 5),
- OnCompleted<int>(300)
- );
-
- var res = scheduler.Start(() =>
- from x in xs
- from y in Observable.Interval(TimeSpan.FromTicks(1), scheduler).Take(x)
- select x * 10 + (int)y
- );
-
- res.Messages.AssertEqual(
- OnNext(221, 40),
- OnNext(222, 30),
- OnNext(222, 41),
- OnNext(223, 20),
- OnNext(223, 31),
- OnNext(223, 42),
- OnNext(224, 50),
- OnNext(224, 21),
- OnNext(224, 32),
- OnNext(224, 43),
- OnNext(225, 51),
- OnNext(226, 52),
- OnNext(227, 53),
- OnNext(228, 54),
- OnCompleted<int>(300)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 300)
- );
- }
-
- [TestMethod]
- public void SelectMany_QueryOperator_ErrorOuter()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(220, 4),
- OnNext(221, 3),
- OnNext(222, 2),
- OnNext(223, 5),
- OnError<int>(224, ex)
- );
-
- var res = scheduler.Start(() =>
- from x in xs
- from y in Observable.Interval(TimeSpan.FromTicks(1), scheduler).Take(x)
- select x * 10 + (int)y
- );
-
- res.Messages.AssertEqual(
- OnNext(221, 40),
- OnNext(222, 30),
- OnNext(222, 41),
- OnNext(223, 20),
- OnNext(223, 31),
- OnNext(223, 42),
- OnError<int>(224, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 224)
- );
- }
-
- [TestMethod]
- public void SelectMany_QueryOperator_ErrorInner()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(220, 4),
- OnNext(221, 3),
- OnNext(222, 2),
- OnNext(223, 5),
- OnCompleted<int>(224)
- );
-
- var ex = new Exception();
-
- var res = scheduler.Start(() =>
- from x in xs
- from y in x == 2 ? Observable.Throw<long>(ex, scheduler)
- : Observable.Interval(TimeSpan.FromTicks(1), scheduler).Take(x)
- select x * 10 + (int)y
- );
-
- res.Messages.AssertEqual(
- OnNext(221, 40),
- OnNext(222, 30),
- OnNext(222, 41),
- OnError<int>(223, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 223)
- );
- }
-
- [TestMethod]
- public void SelectMany_QueryOperator_Dispose()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(220, 4),
- OnNext(221, 3),
- OnNext(222, 2),
- OnNext(223, 5),
- OnCompleted<int>(224)
- );
-
- var res = scheduler.Start(() =>
- from x in xs
- from y in Observable.Interval(TimeSpan.FromTicks(1), scheduler).Take(x)
- select x * 10 + (int)y,
- 223
- );
-
- res.Messages.AssertEqual(
- OnNext(221, 40),
- OnNext(222, 30),
- OnNext(222, 41)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 223)
- );
- }
-
- static T Throw<T>(Exception ex)
- {
- throw ex;
- }
-
-
- [TestMethod]
- public void SelectMany_QueryOperator_ThrowSelector()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(220, 4),
- OnNext(221, 3),
- OnNext(222, 2),
- OnNext(223, 5),
- OnCompleted<int>(224)
- );
-
- var ex = new Exception();
-
- var res = scheduler.Start(() =>
- from x in xs
- from y in Throw<IObservable<long>>(ex)
- select x * 10 + (int)y
- );
-
- res.Messages.AssertEqual(
- OnError<int>(220, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 220)
- );
- }
-
- [TestMethod]
- public void SelectMany_QueryOperator_ThrowResult()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(220, 4),
- OnNext(221, 3),
- OnNext(222, 2),
- OnNext(223, 5),
- OnCompleted<int>(224)
- );
-
- var ex = new Exception();
-
- var res = scheduler.Start(() =>
- from x in xs
- from y in Observable.Interval(TimeSpan.FromTicks(1), scheduler).Take(x)
- select Throw<int>(ex)
- );
-
- res.Messages.AssertEqual(
- OnError<int>(221, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 221)
- );
- }
-
- [TestMethod]
- public void SelectMany_Triple_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.SelectMany(null, DummyFunc<int, IObservable<int>>.Instance, DummyFunc<Exception, IObservable<int>>.Instance, DummyFunc<IObservable<int>>.Instance));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.SelectMany(DummyObservable<int>.Instance, null, DummyFunc<Exception, IObservable<int>>.Instance, DummyFunc<IObservable<int>>.Instance));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.SelectMany(DummyObservable<int>.Instance, DummyFunc<int, IObservable<int>>.Instance, null, DummyFunc<IObservable<int>>.Instance));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.SelectMany(DummyObservable<int>.Instance, DummyFunc<int, IObservable<int>>.Instance, DummyFunc<Exception, IObservable<int>>.Instance, null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.SelectMany(DummyObservable<int>.Instance, DummyFunc<int, IObservable<int>>.Instance, DummyFunc<Exception, IObservable<int>>.Instance, DummyFunc<IObservable<int>>.Instance).Subscribe(null));
- }
-
- [TestMethod]
- public void SelectMany_Triple_Identity()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(300, 0),
- OnNext(301, 1),
- OnNext(302, 2),
- OnNext(303, 3),
- OnNext(304, 4),
- OnCompleted<int>(305)
- );
-
- var res = scheduler.Start(() =>
- xs.SelectMany(
- x => Observable.Return(x, scheduler),
- ex => Observable.Throw<int>(ex, scheduler),
- () => Observable.Empty<int>(scheduler)
- )
- );
-
- res.Messages.AssertEqual(
- OnNext(301, 0),
- OnNext(302, 1),
- OnNext(303, 2),
- OnNext(304, 3),
- OnNext(305, 4),
- OnCompleted<int>(306)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 305)
- );
- }
-
- [TestMethod]
- public void SelectMany_Triple_InnersWithTiming1()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(300, 0),
- OnNext(301, 1),
- OnNext(302, 2),
- OnNext(303, 3),
- OnNext(304, 4),
- OnCompleted<int>(305)
- );
-
- var ysn = scheduler.CreateColdObservable(
- OnNext(10, 10),
- OnNext(20, 11),
- OnNext(30, 12),
- OnCompleted<int>(40)
- );
-
- var yse = scheduler.CreateColdObservable(
- OnNext(0, 99),
- OnCompleted<int>(10)
- );
-
- var ysc = scheduler.CreateColdObservable(
- OnNext(10, 42),
- OnCompleted<int>(20)
- );
-
- var res = scheduler.Start(() =>
- xs.SelectMany(
- x => ysn,
- ex => yse,
- () => ysc
- )
- );
-
- res.Messages.AssertEqual(
- OnNext(310, 10),
- OnNext(311, 10),
- OnNext(312, 10),
- OnNext(313, 10),
- OnNext(314, 10),
- OnNext(315, 42),
- OnNext(320, 11),
- OnNext(321, 11),
- OnNext(322, 11),
- OnNext(323, 11),
- OnNext(324, 11),
- OnNext(330, 12),
- OnNext(331, 12),
- OnNext(332, 12),
- OnNext(333, 12),
- OnNext(334, 12),
- OnCompleted<int>(344)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 305)
- );
-
- ysn.Subscriptions.AssertEqual(
- Subscribe(300, 340),
- Subscribe(301, 341),
- Subscribe(302, 342),
- Subscribe(303, 343),
- Subscribe(304, 344)
- );
-
- yse.Subscriptions.AssertEqual(
- );
-
- ysc.Subscriptions.AssertEqual(
- Subscribe(305, 325)
- );
- }
-
- [TestMethod]
- public void SelectMany_Triple_InnersWithTiming2()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(300, 0),
- OnNext(301, 1),
- OnNext(302, 2),
- OnNext(303, 3),
- OnNext(304, 4),
- OnCompleted<int>(305)
- );
-
- var ysn = scheduler.CreateColdObservable(
- OnNext(10, 10),
- OnNext(20, 11),
- OnNext(30, 12),
- OnCompleted<int>(40)
- );
-
- var yse = scheduler.CreateColdObservable(
- OnNext(0, 99),
- OnCompleted<int>(10)
- );
-
- var ysc = scheduler.CreateColdObservable(
- OnNext(10, 42),
- OnCompleted<int>(50)
- );
-
- var res = scheduler.Start(() =>
- xs.SelectMany(
- x => ysn,
- ex => yse,
- () => ysc
- )
- );
-
- res.Messages.AssertEqual(
- OnNext(310, 10),
- OnNext(311, 10),
- OnNext(312, 10),
- OnNext(313, 10),
- OnNext(314, 10),
- OnNext(315, 42),
- OnNext(320, 11),
- OnNext(321, 11),
- OnNext(322, 11),
- OnNext(323, 11),
- OnNext(324, 11),
- OnNext(330, 12),
- OnNext(331, 12),
- OnNext(332, 12),
- OnNext(333, 12),
- OnNext(334, 12),
- OnCompleted<int>(355)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 305)
- );
-
- ysn.Subscriptions.AssertEqual(
- Subscribe(300, 340),
- Subscribe(301, 341),
- Subscribe(302, 342),
- Subscribe(303, 343),
- Subscribe(304, 344)
- );
-
- yse.Subscriptions.AssertEqual(
- );
-
- ysc.Subscriptions.AssertEqual(
- Subscribe(305, 355)
- );
- }
-
- [TestMethod]
- public void SelectMany_Triple_InnersWithTiming3()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(300, 0),
- OnNext(400, 1),
- OnNext(500, 2),
- OnNext(600, 3),
- OnNext(700, 4),
- OnCompleted<int>(800)
- );
-
- var ysn = scheduler.CreateColdObservable(
- OnNext(10, 10),
- OnNext(20, 11),
- OnNext(30, 12),
- OnCompleted<int>(40)
- );
-
- var yse = scheduler.CreateColdObservable(
- OnNext(0, 99),
- OnCompleted<int>(10)
- );
-
- var ysc = scheduler.CreateColdObservable(
- OnNext(10, 42),
- OnCompleted<int>(100)
- );
-
- var res = scheduler.Start(() =>
- xs.SelectMany(
- x => ysn,
- ex => yse,
- () => ysc
- )
- );
-
- res.Messages.AssertEqual(
- OnNext(310, 10),
- OnNext(320, 11),
- OnNext(330, 12),
- OnNext(410, 10),
- OnNext(420, 11),
- OnNext(430, 12),
- OnNext(510, 10),
- OnNext(520, 11),
- OnNext(530, 12),
- OnNext(610, 10),
- OnNext(620, 11),
- OnNext(630, 12),
- OnNext(710, 10),
- OnNext(720, 11),
- OnNext(730, 12),
- OnNext(810, 42),
- OnCompleted<int>(900)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 800)
- );
-
- ysn.Subscriptions.AssertEqual(
- Subscribe(300, 340),
- Subscribe(400, 440),
- Subscribe(500, 540),
- Subscribe(600, 640),
- Subscribe(700, 740)
- );
-
- yse.Subscriptions.AssertEqual(
- );
-
- ysc.Subscriptions.AssertEqual(
- Subscribe(800, 900)
- );
- }
-
- [TestMethod]
- public void SelectMany_Triple_Error_Identity()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(300, 0),
- OnNext(301, 1),
- OnNext(302, 2),
- OnNext(303, 3),
- OnNext(304, 4),
- OnError<int>(305, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.SelectMany(
- x => Observable.Return(x, scheduler),
- ex1 => Observable.Throw<int>(ex1, scheduler),
- () => Observable.Empty<int>(scheduler)
- )
- );
-
- res.Messages.AssertEqual(
- OnNext(301, 0),
- OnNext(302, 1),
- OnNext(303, 2),
- OnNext(304, 3),
- OnNext(305, 4),
- OnError<int>(306, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 305)
- );
- }
-
- [TestMethod]
- public void SelectMany_Triple_SelectMany()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(300, 0),
- OnNext(301, 1),
- OnNext(302, 2),
- OnNext(303, 3),
- OnNext(304, 4),
- OnCompleted<int>(305)
- );
-
- var res = scheduler.Start(() =>
- xs.SelectMany(
- x => Observable.Repeat(x, x, scheduler),
- ex => Observable.Throw<int>(ex, scheduler),
- () => Observable.Empty<int>(scheduler)
- )
- );
-
- res.Messages.AssertEqual(
- OnNext(302, 1),
- OnNext(303, 2),
- OnNext(304, 3),
- OnNext(304, 2),
- OnNext(305, 4),
- OnNext(305, 3),
- OnNext(306, 4),
- OnNext(306, 3),
- OnNext(307, 4),
- OnNext(308, 4),
- OnCompleted<int>(308)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 305)
- );
- }
-
-
- [TestMethod]
- public void SelectMany_Triple_Concat()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(300, 0),
- OnNext(301, 1),
- OnNext(302, 2),
- OnNext(303, 3),
- OnNext(304, 4),
- OnCompleted<int>(305)
- );
-
- var res = scheduler.Start(() =>
- xs.SelectMany(
- x => Observable.Return(x, scheduler),
- ex => Observable.Throw<int>(ex, scheduler),
- () => Observable.Range(1, 3, scheduler)
- )
- );
-
- res.Messages.AssertEqual(
- OnNext(301, 0),
- OnNext(302, 1),
- OnNext(303, 2),
- OnNext(304, 3),
- OnNext(305, 4),
- OnNext(306, 1),
- OnNext(307, 2),
- OnNext(308, 3),
- OnCompleted<int>(309)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 305)
- );
- }
-
- [TestMethod]
- public void SelectMany_Triple_Catch()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(300, 0),
- OnNext(301, 1),
- OnNext(302, 2),
- OnNext(303, 3),
- OnNext(304, 4),
- OnCompleted<int>(305)
- );
-
- var res = scheduler.Start(() =>
- xs.SelectMany(
- x => Observable.Return(x, scheduler),
- ex => Observable.Range(1, 3, scheduler),
- () => Observable.Empty<int>(scheduler)
- )
- );
-
- res.Messages.AssertEqual(
- OnNext(301, 0),
- OnNext(302, 1),
- OnNext(303, 2),
- OnNext(304, 3),
- OnNext(305, 4),
- OnCompleted<int>(306)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 305)
- );
- }
-
- [TestMethod]
- public void SelectMany_Triple_Error_Catch()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(300, 0),
- OnNext(301, 1),
- OnNext(302, 2),
- OnNext(303, 3),
- OnNext(304, 4),
- OnError<int>(305, new Exception())
- );
-
- var res = scheduler.Start(() =>
- xs.SelectMany(
- x => Observable.Return(x, scheduler),
- ex => Observable.Range(1, 3, scheduler),
- () => Observable.Empty<int>(scheduler)
- )
- );
-
- res.Messages.AssertEqual(
- OnNext(301, 0),
- OnNext(302, 1),
- OnNext(303, 2),
- OnNext(304, 3),
- OnNext(305, 4),
- OnNext(306, 1),
- OnNext(307, 2),
- OnNext(308, 3),
- OnCompleted<int>(309)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 305)
- );
- }
-
- [TestMethod]
- public void SelectMany_Triple_All()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(300, 0),
- OnNext(301, 1),
- OnNext(302, 2),
- OnNext(303, 3),
- OnNext(304, 4),
- OnCompleted<int>(305)
- );
-
- var res = scheduler.Start(() =>
- xs.SelectMany(
- x => Observable.Repeat(x, x, scheduler),
- ex => Observable.Repeat(0, 2, scheduler),
- () => Observable.Repeat(-1, 2, scheduler)
- )
- );
-
- res.Messages.AssertEqual(
- OnNext(302, 1),
- OnNext(303, 2),
- OnNext(304, 3),
- OnNext(304, 2),
- OnNext(305, 4),
- OnNext(305, 3),
- OnNext(306, -1),
- OnNext(306, 4),
- OnNext(306, 3),
- OnNext(307, -1),
- OnNext(307, 4),
- OnNext(308, 4),
- OnCompleted<int>(308)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 305)
- );
- }
-
- [TestMethod]
- public void SelectMany_Triple_Error_All()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(300, 0),
- OnNext(301, 1),
- OnNext(302, 2),
- OnNext(303, 3),
- OnNext(304, 4),
- OnError<int>(305, new Exception())
- );
-
- var res = scheduler.Start(() =>
- xs.SelectMany(
- x => Observable.Repeat(x, x, scheduler),
- ex => Observable.Repeat(0, 2, scheduler),
- () => Observable.Repeat(-1, 2, scheduler)
- )
- );
-
- res.Messages.AssertEqual(
- OnNext(302, 1),
- OnNext(303, 2),
- OnNext(304, 3),
- OnNext(304, 2),
- OnNext(305, 4),
- OnNext(305, 3),
- OnNext(306, 0),
- OnNext(306, 4),
- OnNext(306, 3),
- OnNext(307, 0),
- OnNext(307, 4),
- OnNext(308, 4),
- OnCompleted<int>(308)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 305)
- );
- }
-
- [TestMethod]
- public void SelectMany_Triple_All_Dispose()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(300, 0),
- OnNext(301, 1),
- OnNext(302, 2),
- OnNext(303, 3),
- OnNext(304, 4),
- OnCompleted<int>(305)
- );
-
- var res = scheduler.Start(() =>
- xs.SelectMany(
- x => Observable.Repeat(x, x, scheduler),
- ex => Observable.Repeat(0, 2, scheduler),
- () => Observable.Repeat(-1, 2, scheduler)
- ),
- 307
- );
-
- res.Messages.AssertEqual(
- OnNext(302, 1),
- OnNext(303, 2),
- OnNext(304, 3),
- OnNext(304, 2),
- OnNext(305, 4),
- OnNext(305, 3),
- OnNext(306, -1),
- OnNext(306, 4),
- OnNext(306, 3)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 305)
- );
- }
-
- [TestMethod]
- public void SelectMany_Triple_All_Dispose_Before_First()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(300, 0),
- OnNext(301, 1),
- OnNext(302, 2),
- OnNext(303, 3),
- OnNext(304, 4),
- OnCompleted<int>(305)
- );
-
- var res = scheduler.Start(() =>
- xs.SelectMany(
- x => Observable.Repeat(x, x, scheduler),
- ex => Observable.Repeat(0, 2, scheduler),
- () => Observable.Repeat(-1, 2, scheduler)
- ),
- 304
- );
-
- res.Messages.AssertEqual(
- OnNext(302, 1),
- OnNext(303, 2)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 304)
- );
- }
-
- [TestMethod]
- public void SelectMany_Triple_OnNextThrow()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(300, 0),
- OnNext(301, 1),
- OnNext(302, 2),
- OnNext(303, 3),
- OnNext(304, 4),
- OnCompleted<int>(305)
- );
-
- var ex = new Exception();
-
- var res = scheduler.Start(() =>
- xs.SelectMany(
- x => Throw<IObservable<int>>(ex),
- ex1 => Observable.Repeat(0, 2, scheduler),
- () => Observable.Repeat(-1, 2, scheduler)
- )
- );
-
- res.Messages.AssertEqual(
- OnError<int>(300, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 300)
- );
- }
-
- [TestMethod]
- public void SelectMany_Triple_OnErrorThrow()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(300, 0),
- OnNext(301, 1),
- OnNext(302, 2),
- OnNext(303, 3),
- OnNext(304, 4),
- OnError<int>(305, new Exception())
- );
-
- var res = scheduler.Start(() =>
- xs.SelectMany(
- x => Observable.Repeat(x, x, scheduler),
- ex1 => Throw<IObservable<int>>(ex),
- () => Observable.Repeat(-1, 2, scheduler)
- )
- );
-
- res.Messages.AssertEqual(
- OnNext(302, 1),
- OnNext(303, 2),
- OnNext(304, 3),
- OnNext(304, 2),
- OnError<int>(305, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 305)
- );
- }
-
- [TestMethod]
- public void SelectMany_Triple_OnCompletedThrow()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(300, 0),
- OnNext(301, 1),
- OnNext(302, 2),
- OnNext(303, 3),
- OnNext(304, 4),
- OnCompleted<int>(305)
- );
-
- var ex = new Exception();
-
- var res = scheduler.Start(() =>
- xs.SelectMany(
- x => Observable.Repeat(x, x, scheduler),
- ex1 => Observable.Repeat(0, 2, scheduler),
- () => Throw<IObservable<int>>(ex)
- )
- );
-
- res.Messages.AssertEqual(
- OnNext(302, 1),
- OnNext(303, 2),
- OnNext(304, 3),
- OnNext(304, 2),
- OnError<int>(305, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 305)
- );
- }
-
-#if !NO_TPL
-
- [TestMethod]
- public void SelectMany_Task_ArgumentChecking()
- {
- var t = new Task<int>(() => 42);
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.SelectMany(default(IObservable<int>), x => t));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.SelectMany(DummyObservable<int>.Instance, default(Func<int, Task<int>>)));
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.SelectMany(default(IObservable<int>), (x, ct) => t));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.SelectMany(DummyObservable<int>.Instance, default(Func<int, CancellationToken, Task<int>>)));
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.SelectMany(default(IObservable<int>), x => t, (x, y) => x));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.SelectMany(DummyObservable<int>.Instance, default(Func<int, Task<int>>), (x, y) => x));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.SelectMany(DummyObservable<int>.Instance, x => t, default(Func<int, int, int>)));
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.SelectMany(default(IObservable<int>), (x, ct) => t, (x, y) => x));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.SelectMany(DummyObservable<int>.Instance, default(Func<int, CancellationToken, Task<int>>), (x, y) => x));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.SelectMany(DummyObservable<int>.Instance, (x, ct) => t, default(Func<int, int, int>)));
- }
-
- [TestMethod]
- public void SelectMany_Task1()
- {
- var res = Observable.Range(0, 10).SelectMany(x => Task.Factory.StartNew(() => x + 1)).ToEnumerable();
- Assert.IsTrue(Enumerable.Range(0, 10).SelectMany(x => new[] { x + 1 }).SequenceEqual(res.OrderBy(x => x)));
- }
-
- [TestMethod]
- public void SelectMany_Task2()
- {
- var res = Observable.Range(0, 10).SelectMany((x, ct) => Task.Factory.StartNew(() => x + 1, ct)).ToEnumerable();
- Assert.IsTrue(Enumerable.Range(0, 10).SelectMany(x => new[] { x + 1 }).SequenceEqual(res.OrderBy(x => x)));
- }
-
- [TestMethod]
- public void SelectMany_Task_TaskThrows()
- {
- var ex = new Exception();
-
- var res = Observable.Range(0, 10).SelectMany(x => Task.Factory.StartNew(() =>
- {
- if (x > 5)
- throw ex;
- return x + 1;
- })).ToEnumerable();
-
- ReactiveAssert.Throws(ex, () =>
- {
- foreach (var x in res)
- ;
- });
- }
-
- [TestMethod]
- public void SelectMany_Task_SelectorThrows()
- {
- var ex = new Exception();
-
- var res = Observable.Range(0, 10).SelectMany(x =>
- {
- if (x > 5)
- throw ex;
- return Task.Factory.StartNew(() => x + 1);
- }).ToEnumerable();
-
- ReactiveAssert.Throws(ex, () =>
- {
- foreach (var x in res)
- ;
- });
- }
-
- [TestMethod]
- public void SelectMany_Task_ResultSelector1()
- {
- var res = Observable.Range(0, 10).SelectMany(x => Task.Factory.StartNew(() => x + 1), (x, y) => x + y).ToEnumerable();
- Assert.IsTrue(Enumerable.Range(0, 10).SelectMany(x => new[] { 2 * x + 1 }).SequenceEqual(res.OrderBy(x => x)));
- }
-
- [TestMethod]
- public void SelectMany_Task_ResultSelector2()
- {
- var res = Observable.Range(0, 10).SelectMany((x, ct) => Task.Factory.StartNew(() => x + 1, ct), (x, y) => x + y).ToEnumerable();
- Assert.IsTrue(Enumerable.Range(0, 10).SelectMany(x => new[] { 2 * x + 1 }).SequenceEqual(res.OrderBy(x => x)));
- }
-
- [TestMethod]
- public void SelectMany_Task_ResultSelectorThrows()
- {
- var ex = new Exception();
-
- var res = Observable.Range(0, 10).SelectMany(x => Task.Factory.StartNew(() => x + 1), (x, y) =>
- {
- if (x > 5)
- throw ex;
- return x + y;
- }).ToEnumerable();
-
- ReactiveAssert.Throws(ex, () =>
- {
- foreach (var x in res)
- ;
- });
- }
-
-#endif
-
- #endregion
-
- #region + Skip +
-
- [TestMethod]
- public void Skip_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => ((IObservable<int>)null).Skip(0));
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => DummyObservable<int>.Instance.Skip(-1));
- ReactiveAssert.Throws<ArgumentNullException>(() => DummyObservable<int>.Instance.Skip(0).Subscribe(null));
- }
-
- [TestMethod]
- public void Skip_Complete_After()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(70, 6),
- OnNext(150, 4),
- OnNext(210, 9),
- OnNext(230, 13),
- OnNext(270, 7),
- OnNext(280, 1),
- OnNext(300, -1),
- OnNext(310, 3),
- OnNext(340, 8),
- OnNext(370, 11),
- OnNext(410, 15),
- OnNext(415, 16),
- OnNext(460, 72),
- OnNext(510, 76),
- OnNext(560, 32),
- OnNext(570, -100),
- OnNext(580, -3),
- OnNext(590, 5),
- OnNext(630, 10),
- OnCompleted<int>(690)
- );
-
- var res = scheduler.Start(() =>
- xs.Skip(20)
- );
-
- res.Messages.AssertEqual(
- OnCompleted<int>(690)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 690)
- );
- }
-
- [TestMethod]
- public void Skip_Complete_Same()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(70, 6),
- OnNext(150, 4),
- OnNext(210, 9),
- OnNext(230, 13),
- OnNext(270, 7),
- OnNext(280, 1),
- OnNext(300, -1),
- OnNext(310, 3),
- OnNext(340, 8),
- OnNext(370, 11),
- OnNext(410, 15),
- OnNext(415, 16),
- OnNext(460, 72),
- OnNext(510, 76),
- OnNext(560, 32),
- OnNext(570, -100),
- OnNext(580, -3),
- OnNext(590, 5),
- OnNext(630, 10),
- OnCompleted<int>(690)
- );
-
- var res = scheduler.Start(() =>
- xs.Skip(17)
- );
-
- res.Messages.AssertEqual(
- OnCompleted<int>(690)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 690)
- );
- }
-
- [TestMethod]
- public void Skip_Complete_Before()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(70, 6),
- OnNext(150, 4),
- OnNext(210, 9),
- OnNext(230, 13),
- OnNext(270, 7),
- OnNext(280, 1),
- OnNext(300, -1),
- OnNext(310, 3),
- OnNext(340, 8),
- OnNext(370, 11),
- OnNext(410, 15),
- OnNext(415, 16),
- OnNext(460, 72),
- OnNext(510, 76),
- OnNext(560, 32),
- OnNext(570, -100),
- OnNext(580, -3),
- OnNext(590, 5),
- OnNext(630, 10),
- OnCompleted<int>(690)
- );
-
- var res = scheduler.Start(() =>
- xs.Skip(10)
- );
-
- res.Messages.AssertEqual(
- OnNext(460, 72),
- OnNext(510, 76),
- OnNext(560, 32),
- OnNext(570, -100),
- OnNext(580, -3),
- OnNext(590, 5),
- OnNext(630, 10),
- OnCompleted<int>(690)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 690)
- );
- }
-
- [TestMethod]
- public void Skip_Complete_Zero()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(70, 6),
- OnNext(150, 4),
- OnNext(210, 9),
- OnNext(230, 13),
- OnNext(270, 7),
- OnNext(280, 1),
- OnNext(300, -1),
- OnNext(310, 3),
- OnNext(340, 8),
- OnNext(370, 11),
- OnNext(410, 15),
- OnNext(415, 16),
- OnNext(460, 72),
- OnNext(510, 76),
- OnNext(560, 32),
- OnNext(570, -100),
- OnNext(580, -3),
- OnNext(590, 5),
- OnNext(630, 10),
- OnCompleted<int>(690)
- );
-
- var res = scheduler.Start(() =>
- xs.Skip(0)
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 9),
- OnNext(230, 13),
- OnNext(270, 7),
- OnNext(280, 1),
- OnNext(300, -1),
- OnNext(310, 3),
- OnNext(340, 8),
- OnNext(370, 11),
- OnNext(410, 15),
- OnNext(415, 16),
- OnNext(460, 72),
- OnNext(510, 76),
- OnNext(560, 32),
- OnNext(570, -100),
- OnNext(580, -3),
- OnNext(590, 5),
- OnNext(630, 10),
- OnCompleted<int>(690)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 690)
- );
- }
-
- [TestMethod]
- public void Skip_Error_After()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(70, 6),
- OnNext(150, 4),
- OnNext(210, 9),
- OnNext(230, 13),
- OnNext(270, 7),
- OnNext(280, 1),
- OnNext(300, -1),
- OnNext(310, 3),
- OnNext(340, 8),
- OnNext(370, 11),
- OnNext(410, 15),
- OnNext(415, 16),
- OnNext(460, 72),
- OnNext(510, 76),
- OnNext(560, 32),
- OnNext(570, -100),
- OnNext(580, -3),
- OnNext(590, 5),
- OnNext(630, 10),
- OnError<int>(690, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.Skip(20)
- );
-
- res.Messages.AssertEqual(
- OnError<int>(690, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 690)
- );
- }
-
- [TestMethod]
- public void Skip_Error_Same()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(70, 6),
- OnNext(150, 4),
- OnNext(210, 9),
- OnNext(230, 13),
- OnNext(270, 7),
- OnNext(280, 1),
- OnNext(300, -1),
- OnNext(310, 3),
- OnNext(340, 8),
- OnNext(370, 11),
- OnNext(410, 15),
- OnNext(415, 16),
- OnNext(460, 72),
- OnNext(510, 76),
- OnNext(560, 32),
- OnNext(570, -100),
- OnNext(580, -3),
- OnNext(590, 5),
- OnNext(630, 10),
- OnError<int>(690, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.Skip(17)
- );
-
- res.Messages.AssertEqual(
- OnError<int>(690, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 690)
- );
- }
-
- [TestMethod]
- public void Skip_Error_Before()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(70, 6),
- OnNext(150, 4),
- OnNext(210, 9),
- OnNext(230, 13),
- OnNext(270, 7),
- OnNext(280, 1),
- OnNext(300, -1),
- OnNext(310, 3),
- OnNext(340, 8),
- OnNext(370, 11),
- OnNext(410, 15),
- OnNext(415, 16),
- OnNext(460, 72),
- OnNext(510, 76),
- OnNext(560, 32),
- OnNext(570, -100),
- OnNext(580, -3),
- OnNext(590, 5),
- OnNext(630, 10),
- OnError<int>(690, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.Skip(3)
- );
-
- res.Messages.AssertEqual(
- OnNext(280, 1),
- OnNext(300, -1),
- OnNext(310, 3),
- OnNext(340, 8),
- OnNext(370, 11),
- OnNext(410, 15),
- OnNext(415, 16),
- OnNext(460, 72),
- OnNext(510, 76),
- OnNext(560, 32),
- OnNext(570, -100),
- OnNext(580, -3),
- OnNext(590, 5),
- OnNext(630, 10),
- OnError<int>(690, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 690)
- );
- }
-
- [TestMethod]
- public void Skip_Dispose_Before()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(70, 6),
- OnNext(150, 4),
- OnNext(210, 9),
- OnNext(230, 13),
- OnNext(270, 7),
- OnNext(280, 1),
- OnNext(300, -1),
- OnNext(310, 3),
- OnNext(340, 8),
- OnNext(370, 11),
- OnNext(410, 15),
- OnNext(415, 16),
- OnNext(460, 72),
- OnNext(510, 76),
- OnNext(560, 32),
- OnNext(570, -100),
- OnNext(580, -3),
- OnNext(590, 5),
- OnNext(630, 10)
- );
-
- var res = scheduler.Start(() =>
- xs.Skip(3),
- 250
- );
-
- res.Messages.AssertEqual(
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Skip_Dispose_After()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(70, 6),
- OnNext(150, 4),
- OnNext(210, 9),
- OnNext(230, 13),
- OnNext(270, 7),
- OnNext(280, 1),
- OnNext(300, -1),
- OnNext(310, 3),
- OnNext(340, 8),
- OnNext(370, 11),
- OnNext(410, 15),
- OnNext(415, 16),
- OnNext(460, 72),
- OnNext(510, 76),
- OnNext(560, 32),
- OnNext(570, -100),
- OnNext(580, -3),
- OnNext(590, 5),
- OnNext(630, 10)
- );
-
- var res = scheduler.Start(() =>
- xs.Skip(3),
- 400
- );
-
- res.Messages.AssertEqual(
- OnNext(280, 1),
- OnNext(300, -1),
- OnNext(310, 3),
- OnNext(340, 8),
- OnNext(370, 11)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 400)
- );
- }
-
- [TestMethod]
- public void Skip_Skip1()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(70, 6),
- OnNext(150, 4),
- OnNext(210, 9),
- OnNext(230, 13),
- OnNext(270, 7),
- OnNext(280, 1),
- OnNext(300, -1),
- OnNext(310, 3),
- OnNext(340, 8),
- OnNext(370, 11),
- OnCompleted<int>(400)
- );
-
- var res = scheduler.Start(() =>
- xs.Skip(3).Skip(2)
- );
-
- res.Messages.AssertEqual(
- OnNext(310, 3),
- OnNext(340, 8),
- OnNext(370, 11),
- OnCompleted<int>(400)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 400)
- );
- }
-
- #endregion
-
- #region + SkipWhile +
-
- [TestMethod]
- public void SkipWhile_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => ((IObservable<int>)null).SkipWhile(DummyFunc<int, bool>.Instance));
- ReactiveAssert.Throws<ArgumentNullException>(() => DummyObservable<int>.Instance.SkipWhile(default(Func<int, bool>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => DummyObservable<int>.Instance.SkipWhile(DummyFunc<int, bool>.Instance).Subscribe(null));
- ReactiveAssert.Throws<ArgumentNullException>(() => ((IObservable<int>)null).SkipWhile((x, i) => true));
- ReactiveAssert.Throws<ArgumentNullException>(() => DummyObservable<int>.Instance.SkipWhile(default(Func<int, int, bool>)));
- }
-
- [TestMethod]
- public void SkipWhile_Complete_Before()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(90, -1),
- OnNext(110, -1),
- OnNext(210, 2),
- OnNext(260, 5),
- OnNext(290, 13),
- OnNext(320, 3),
- OnCompleted<int>(330),
- OnNext(350, 7),
- OnNext(390, 4),
- OnNext(410, 17),
- OnNext(450, 8),
- OnNext(500, 23),
- OnCompleted<int>(600)
- );
-
- var invoked = 0;
-
- var res = scheduler.Start(() =>
- xs.SkipWhile(x =>
- {
- invoked++;
- return IsPrime(x);
- })
- );
-
- res.Messages.AssertEqual(
- OnCompleted<int>(330)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 330)
- );
-
- Assert.AreEqual(4, invoked);
- }
-
- [TestMethod]
- public void SkipWhile_Complete_After()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(90, -1),
- OnNext(110, -1),
- OnNext(210, 2),
- OnNext(260, 5),
- OnNext(290, 13),
- OnNext(320, 3),
- OnNext(350, 7),
- OnNext(390, 4),
- OnNext(410, 17),
- OnNext(450, 8),
- OnNext(500, 23),
- OnCompleted<int>(600)
- );
-
- var invoked = 0;
-
- var res = scheduler.Start(() =>
- xs.SkipWhile(x =>
- {
- invoked++;
- return IsPrime(x);
- })
- );
-
- res.Messages.AssertEqual(
- OnNext(390, 4),
- OnNext(410, 17),
- OnNext(450, 8),
- OnNext(500, 23),
- OnCompleted<int>(600)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 600)
- );
-
- Assert.AreEqual(6, invoked);
- }
-
- [TestMethod]
- public void SkipWhile_Error_Before()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(90, -1),
- OnNext(110, -1),
- OnNext(210, 2),
- OnNext(260, 5),
- OnError<int>(270, ex),
- OnNext(290, 13),
- OnNext(320, 3),
- OnNext(350, 7),
- OnNext(390, 4),
- OnNext(410, 17),
- OnNext(450, 8),
- OnNext(500, 23)
- );
-
- var invoked = 0;
-
- var res = scheduler.Start(() =>
- xs.SkipWhile(x =>
- {
- invoked++;
- return IsPrime(x);
- })
- );
-
- res.Messages.AssertEqual(
- OnError<int>(270, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 270)
- );
-
- Assert.AreEqual(2, invoked);
- }
-
- [TestMethod]
- public void SkipWhile_Error_After()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(90, -1),
- OnNext(110, -1),
- OnNext(210, 2),
- OnNext(260, 5),
- OnNext(290, 13),
- OnNext(320, 3),
- OnNext(350, 7),
- OnNext(390, 4),
- OnNext(410, 17),
- OnNext(450, 8),
- OnNext(500, 23),
- OnError<int>(600, ex)
- );
-
- var invoked = 0;
-
- var res = scheduler.Start(() =>
- xs.SkipWhile(x =>
- {
- invoked++;
- return IsPrime(x);
- })
- );
-
- res.Messages.AssertEqual(
- OnNext(390, 4),
- OnNext(410, 17),
- OnNext(450, 8),
- OnNext(500, 23),
- OnError<int>(600, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 600)
- );
-
- Assert.AreEqual(6, invoked);
- }
-
- [TestMethod]
- public void SkipWhile_Dispose_Before()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(90, -1),
- OnNext(110, -1),
- OnNext(210, 2),
- OnNext(260, 5),
- OnNext(290, 13),
- OnNext(320, 3),
- OnNext(350, 7),
- OnNext(390, 4),
- OnNext(410, 17),
- OnNext(450, 8),
- OnNext(500, 23),
- OnCompleted<int>(600)
- );
-
- var invoked = 0;
-
- var res = scheduler.Start(() =>
- xs.SkipWhile(x =>
- {
- invoked++;
- return IsPrime(x);
- }),
- 300
- );
-
- res.Messages.AssertEqual(
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 300)
- );
-
- Assert.AreEqual(3, invoked);
- }
-
- [TestMethod]
- public void SkipWhile_Dispose_After()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(90, -1),
- OnNext(110, -1),
- OnNext(210, 2),
- OnNext(260, 5),
- OnNext(290, 13),
- OnNext(320, 3),
- OnNext(350, 7),
- OnNext(390, 4),
- OnNext(410, 17),
- OnNext(450, 8),
- OnNext(500, 23),
- OnCompleted<int>(600)
- );
-
- var invoked = 0;
-
- var res = scheduler.Start(() =>
- xs.SkipWhile(x =>
- {
- invoked++;
- return IsPrime(x);
- }),
- 470
- );
-
- res.Messages.AssertEqual(
- OnNext(390, 4),
- OnNext(410, 17),
- OnNext(450, 8)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 470)
- );
-
- Assert.AreEqual(6, invoked);
- }
-
- [TestMethod]
- public void SkipWhile_Zero()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(90, -1),
- OnNext(110, -1),
- OnNext(205, 100),
- OnNext(210, 2),
- OnNext(260, 5),
- OnNext(290, 13),
- OnNext(320, 3),
- OnNext(350, 7),
- OnNext(390, 4),
- OnNext(410, 17),
- OnNext(450, 8),
- OnNext(500, 23),
- OnCompleted<int>(600)
- );
-
- var invoked = 0;
-
- var res = scheduler.Start(() =>
- xs.SkipWhile(x =>
- {
- invoked++;
- return IsPrime(x);
- })
- );
-
- res.Messages.AssertEqual(
- OnNext(205, 100),
- OnNext(210, 2),
- OnNext(260, 5),
- OnNext(290, 13),
- OnNext(320, 3),
- OnNext(350, 7),
- OnNext(390, 4),
- OnNext(410, 17),
- OnNext(450, 8),
- OnNext(500, 23),
- OnCompleted<int>(600)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 600)
- );
-
- Assert.AreEqual(1, invoked);
- }
-
- [TestMethod]
- public void SkipWhile_Throw()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(90, -1),
- OnNext(110, -1),
- OnNext(210, 2),
- OnNext(260, 5),
- OnNext(290, 13),
- OnNext(320, 3),
- OnNext(350, 7),
- OnNext(390, 4),
- OnNext(410, 17),
- OnNext(450, 8),
- OnNext(500, 23),
- OnCompleted<int>(600)
- );
-
- var invoked = 0;
- var ex = new Exception();
-
- var res = scheduler.Start(() =>
- xs.SkipWhile(x =>
- {
- invoked++;
- if (invoked == 3)
- throw ex;
- return IsPrime(x);
- })
- );
-
- res.Messages.AssertEqual(
- OnError<int>(290, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 290)
- );
-
- Assert.AreEqual(3, invoked);
- }
-
- [TestMethod]
- public void SkipWhile_Index()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(90, -1),
- OnNext(110, -1),
- OnNext(205, 100),
- OnNext(210, 2),
- OnNext(260, 5),
- OnNext(290, 13),
- OnNext(320, 3),
- OnNext(350, 7),
- OnNext(390, 4),
- OnNext(410, 17),
- OnNext(450, 8),
- OnNext(500, 23),
- OnCompleted<int>(600)
- );
-
- var res = scheduler.Start(() =>
- xs.SkipWhile((x, i) => i < 5)
- );
-
- res.Messages.AssertEqual(
- OnNext(350, 7),
- OnNext(390, 4),
- OnNext(410, 17),
- OnNext(450, 8),
- OnNext(500, 23),
- OnCompleted<int>(600)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 600)
- );
- }
-
- [TestMethod]
- public void SkipWhile_Index_Throw()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(90, -1),
- OnNext(110, -1),
- OnNext(205, 100),
- OnNext(210, 2),
- OnNext(260, 5),
- OnNext(290, 13),
- OnNext(320, 3),
- OnNext(350, 7),
- OnNext(390, 4),
- OnError<int>(400, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.SkipWhile((x, i) => i < 5)
- );
-
- res.Messages.AssertEqual(
- OnNext(350, 7),
- OnNext(390, 4),
- OnError<int>(400, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 400)
- );
- }
-
- [TestMethod]
- public void SkipWhile_Index_SelectorThrows()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(90, -1),
- OnNext(110, -1),
- OnNext(205, 100),
- OnNext(210, 2),
- OnNext(260, 5),
- OnNext(290, 13),
- OnNext(320, 3),
- OnNext(350, 7),
- OnNext(390, 4),
- OnCompleted<int>(400)
- );
-
- var res = scheduler.Start(() =>
- xs.SkipWhile((x, i) => { if (i < 5) return true; throw ex; })
- );
-
- res.Messages.AssertEqual(
- OnError<int>(350, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 350)
- );
- }
-
- #endregion
-
- #region + Take +
-
- [TestMethod]
- public void Take_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => ((IObservable<int>)null).Take(0));
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => DummyObservable<int>.Instance.Take(-1));
- ReactiveAssert.Throws<ArgumentNullException>(() => DummyObservable<int>.Instance.Take(1).Subscribe(null));
-
- ReactiveAssert.Throws<ArgumentNullException>(() => ((IObservable<int>)null).Take(0, Scheduler.Immediate));
- ReactiveAssert.Throws<ArgumentNullException>(() => DummyObservable<int>.Instance.Take(0, default(IScheduler)));
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => DummyObservable<int>.Instance.Take(-1, Scheduler.Immediate));
- }
-
- [TestMethod]
- public void Take_Complete_After()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(70, 6),
- OnNext(150, 4),
- OnNext(210, 9),
- OnNext(230, 13),
- OnNext(270, 7),
- OnNext(280, 1),
- OnNext(300, -1),
- OnNext(310, 3),
- OnNext(340, 8),
- OnNext(370, 11),
- OnNext(410, 15),
- OnNext(415, 16),
- OnNext(460, 72),
- OnNext(510, 76),
- OnNext(560, 32),
- OnNext(570, -100),
- OnNext(580, -3),
- OnNext(590, 5),
- OnNext(630, 10),
- OnCompleted<int>(690)
- );
-
- var res = scheduler.Start(() =>
- xs.Take(20)
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 9),
- OnNext(230, 13),
- OnNext(270, 7),
- OnNext(280, 1),
- OnNext(300, -1),
- OnNext(310, 3),
- OnNext(340, 8),
- OnNext(370, 11),
- OnNext(410, 15),
- OnNext(415, 16),
- OnNext(460, 72),
- OnNext(510, 76),
- OnNext(560, 32),
- OnNext(570, -100),
- OnNext(580, -3),
- OnNext(590, 5),
- OnNext(630, 10),
- OnCompleted<int>(690)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 690)
- );
- }
-
- [TestMethod]
- public void Take_Complete_Same()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(70, 6),
- OnNext(150, 4),
- OnNext(210, 9),
- OnNext(230, 13),
- OnNext(270, 7),
- OnNext(280, 1),
- OnNext(300, -1),
- OnNext(310, 3),
- OnNext(340, 8),
- OnNext(370, 11),
- OnNext(410, 15),
- OnNext(415, 16),
- OnNext(460, 72),
- OnNext(510, 76),
- OnNext(560, 32),
- OnNext(570, -100),
- OnNext(580, -3),
- OnNext(590, 5),
- OnNext(630, 10),
- OnCompleted<int>(690)
- );
-
- var res = scheduler.Start(() =>
- xs.Take(17)
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 9),
- OnNext(230, 13),
- OnNext(270, 7),
- OnNext(280, 1),
- OnNext(300, -1),
- OnNext(310, 3),
- OnNext(340, 8),
- OnNext(370, 11),
- OnNext(410, 15),
- OnNext(415, 16),
- OnNext(460, 72),
- OnNext(510, 76),
- OnNext(560, 32),
- OnNext(570, -100),
- OnNext(580, -3),
- OnNext(590, 5),
- OnNext(630, 10),
- OnCompleted<int>(630)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 630)
- );
- }
-
- [TestMethod]
- public void Take_Complete_Before()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(70, 6),
- OnNext(150, 4),
- OnNext(210, 9),
- OnNext(230, 13),
- OnNext(270, 7),
- OnNext(280, 1),
- OnNext(300, -1),
- OnNext(310, 3),
- OnNext(340, 8),
- OnNext(370, 11),
- OnNext(410, 15),
- OnNext(415, 16),
- OnNext(460, 72),
- OnNext(510, 76),
- OnNext(560, 32),
- OnNext(570, -100),
- OnNext(580, -3),
- OnNext(590, 5),
- OnNext(630, 10),
- OnCompleted<int>(690)
- );
-
- var res = scheduler.Start(() =>
- xs.Take(10)
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 9),
- OnNext(230, 13),
- OnNext(270, 7),
- OnNext(280, 1),
- OnNext(300, -1),
- OnNext(310, 3),
- OnNext(340, 8),
- OnNext(370, 11),
- OnNext(410, 15),
- OnNext(415, 16),
- OnCompleted<int>(415)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 415)
- );
- }
-
- [TestMethod]
- public void Take_Error_After()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(70, 6),
- OnNext(150, 4),
- OnNext(210, 9),
- OnNext(230, 13),
- OnNext(270, 7),
- OnNext(280, 1),
- OnNext(300, -1),
- OnNext(310, 3),
- OnNext(340, 8),
- OnNext(370, 11),
- OnNext(410, 15),
- OnNext(415, 16),
- OnNext(460, 72),
- OnNext(510, 76),
- OnNext(560, 32),
- OnNext(570, -100),
- OnNext(580, -3),
- OnNext(590, 5),
- OnNext(630, 10),
- OnError<int>(690, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.Take(20)
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 9),
- OnNext(230, 13),
- OnNext(270, 7),
- OnNext(280, 1),
- OnNext(300, -1),
- OnNext(310, 3),
- OnNext(340, 8),
- OnNext(370, 11),
- OnNext(410, 15),
- OnNext(415, 16),
- OnNext(460, 72),
- OnNext(510, 76),
- OnNext(560, 32),
- OnNext(570, -100),
- OnNext(580, -3),
- OnNext(590, 5),
- OnNext(630, 10),
- OnError<int>(690, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 690)
- );
- }
-
- [TestMethod]
- public void Take_Error_Same()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(70, 6),
- OnNext(150, 4),
- OnNext(210, 9),
- OnNext(230, 13),
- OnNext(270, 7),
- OnNext(280, 1),
- OnNext(300, -1),
- OnNext(310, 3),
- OnNext(340, 8),
- OnNext(370, 11),
- OnNext(410, 15),
- OnNext(415, 16),
- OnNext(460, 72),
- OnNext(510, 76),
- OnNext(560, 32),
- OnNext(570, -100),
- OnNext(580, -3),
- OnNext(590, 5),
- OnNext(630, 10),
- OnError<int>(690, new Exception())
- );
-
- var res = scheduler.Start(() =>
- xs.Take(17)
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 9),
- OnNext(230, 13),
- OnNext(270, 7),
- OnNext(280, 1),
- OnNext(300, -1),
- OnNext(310, 3),
- OnNext(340, 8),
- OnNext(370, 11),
- OnNext(410, 15),
- OnNext(415, 16),
- OnNext(460, 72),
- OnNext(510, 76),
- OnNext(560, 32),
- OnNext(570, -100),
- OnNext(580, -3),
- OnNext(590, 5),
- OnNext(630, 10),
- OnCompleted<int>(630)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 630)
- );
- }
-
- [TestMethod]
- public void Take_Error_Before()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(70, 6),
- OnNext(150, 4),
- OnNext(210, 9),
- OnNext(230, 13),
- OnNext(270, 7),
- OnNext(280, 1),
- OnNext(300, -1),
- OnNext(310, 3),
- OnNext(340, 8),
- OnNext(370, 11),
- OnNext(410, 15),
- OnNext(415, 16),
- OnNext(460, 72),
- OnNext(510, 76),
- OnNext(560, 32),
- OnNext(570, -100),
- OnNext(580, -3),
- OnNext(590, 5),
- OnNext(630, 10),
- OnError<int>(690, new Exception())
- );
-
- var res = scheduler.Start(() =>
- xs.Take(3)
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 9),
- OnNext(230, 13),
- OnNext(270, 7),
- OnCompleted<int>(270)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 270)
- );
- }
-
- [TestMethod]
- public void Take_Dispose_Before()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(70, 6),
- OnNext(150, 4),
- OnNext(210, 9),
- OnNext(230, 13),
- OnNext(270, 7),
- OnNext(280, 1),
- OnNext(300, -1),
- OnNext(310, 3),
- OnNext(340, 8),
- OnNext(370, 11),
- OnNext(410, 15),
- OnNext(415, 16),
- OnNext(460, 72),
- OnNext(510, 76),
- OnNext(560, 32),
- OnNext(570, -100),
- OnNext(580, -3),
- OnNext(590, 5),
- OnNext(630, 10)
- );
-
- var res = scheduler.Start(() =>
- xs.Take(3),
- 250
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 9),
- OnNext(230, 13)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Take_Dispose_After()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(70, 6),
- OnNext(150, 4),
- OnNext(210, 9),
- OnNext(230, 13),
- OnNext(270, 7),
- OnNext(280, 1),
- OnNext(300, -1),
- OnNext(310, 3),
- OnNext(340, 8),
- OnNext(370, 11),
- OnNext(410, 15),
- OnNext(415, 16),
- OnNext(460, 72),
- OnNext(510, 76),
- OnNext(560, 32),
- OnNext(570, -100),
- OnNext(580, -3),
- OnNext(590, 5),
- OnNext(630, 10)
- );
-
- var res = scheduler.Start(() =>
- xs.Take(3),
- 400
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 9),
- OnNext(230, 13),
- OnNext(270, 7),
- OnCompleted<int>(270)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 270)
- );
- }
-
- [TestMethod]
- public void Take_0_Scheduler()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(70, 6),
- OnNext(150, 4),
- OnNext(210, 9),
- OnNext(230, 13)
- );
-
- var res = scheduler.Start(() =>
- xs.Take(0, scheduler)
- );
-
- res.Messages.AssertEqual(
- OnCompleted<int>(200 + 1) // Extra scheduling call by Empty
- );
-
- xs.Subscriptions.AssertEqual(
- );
- }
-
- [TestMethod]
- public void Take_0_DefaultScheduler()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(70, 6),
- OnNext(150, 4),
- OnNext(210, 9),
- OnNext(230, 13)
- );
-
- var res = scheduler.Start(() =>
- xs.Take(0)
- );
-
- res.Messages.AssertEqual(
- OnCompleted<int>(200) // Immediate
- );
-
- xs.Subscriptions.AssertEqual(
- );
- }
-
- [TestMethod]
- public void Take_Non0_Scheduler()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(70, 6),
- OnNext(150, 4),
- OnNext(210, 9),
- OnNext(230, 13)
- );
-
- var res = scheduler.Start(() =>
- xs.Take(1, scheduler)
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 9),
- OnCompleted<int>(210)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void Take_Take1()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(70, 6),
- OnNext(150, 4),
- OnNext(210, 9),
- OnNext(230, 13),
- OnNext(270, 7),
- OnNext(280, 1),
- OnNext(300, -1),
- OnNext(310, 3),
- OnNext(340, 8),
- OnNext(370, 11),
- OnCompleted<int>(400)
- );
-
- var res = scheduler.Start(() =>
- xs.Take(3).Take(4)
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 9),
- OnNext(230, 13),
- OnNext(270, 7),
- OnCompleted<int>(270)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 270)
- );
- }
-
- [TestMethod]
- public void Take_Take2()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(70, 6),
- OnNext(150, 4),
- OnNext(210, 9),
- OnNext(230, 13),
- OnNext(270, 7),
- OnNext(280, 1),
- OnNext(300, -1),
- OnNext(310, 3),
- OnNext(340, 8),
- OnNext(370, 11),
- OnCompleted<int>(400)
- );
-
- var res = scheduler.Start(() =>
- xs.Take(4).Take(3)
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 9),
- OnNext(230, 13),
- OnNext(270, 7),
- OnCompleted<int>(270)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 270)
- );
- }
-
- [TestMethod]
- public void Take_DecrementsCountFirst()
- {
- var k = new BehaviorSubject<bool>(true);
- k.Take(1).Subscribe(b => k.OnNext(!b));
-
- //
- // No assert needed; test will stack overflow for failure.
- //
- }
-
- #endregion
-
- #region + TakeWhile +
-
- [TestMethod]
- public void TakeWhile_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => ((IObservable<int>)null).TakeWhile(DummyFunc<int, bool>.Instance));
- ReactiveAssert.Throws<ArgumentNullException>(() => DummyObservable<int>.Instance.TakeWhile(default(Func<int, bool>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => DummyObservable<int>.Instance.TakeWhile(DummyFunc<int, bool>.Instance).Subscribe(null));
- ReactiveAssert.Throws<ArgumentNullException>(() => ((IObservable<int>)null).TakeWhile((x, i) => true));
- ReactiveAssert.Throws<ArgumentNullException>(() => DummyObservable<int>.Instance.TakeWhile(default(Func<int, int, bool>)));
- }
-
- [TestMethod]
- public void TakeWhile_Complete_Before()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(90, -1),
- OnNext(110, -1),
- OnNext(210, 2),
- OnNext(260, 5),
- OnNext(290, 13),
- OnNext(320, 3),
- OnCompleted<int>(330),
- OnNext(350, 7),
- OnNext(390, 4),
- OnNext(410, 17),
- OnNext(450, 8),
- OnNext(500, 23),
- OnCompleted<int>(600)
- );
-
- var invoked = 0;
-
- var res = scheduler.Start(() =>
- xs.TakeWhile(x =>
- {
- invoked++;
- return IsPrime(x);
- })
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 2),
- OnNext(260, 5),
- OnNext(290, 13),
- OnNext(320, 3),
- OnCompleted<int>(330)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 330)
- );
-
- Assert.AreEqual(4, invoked);
- }
-
- [TestMethod]
- public void TakeWhile_Complete_After()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(90, -1),
- OnNext(110, -1),
- OnNext(210, 2),
- OnNext(260, 5),
- OnNext(290, 13),
- OnNext(320, 3),
- OnNext(350, 7),
- OnNext(390, 4),
- OnNext(410, 17),
- OnNext(450, 8),
- OnNext(500, 23),
- OnCompleted<int>(600)
- );
-
- var invoked = 0;
-
- var res = scheduler.Start(() =>
- xs.TakeWhile(x =>
- {
- invoked++;
- return IsPrime(x);
- })
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 2),
- OnNext(260, 5),
- OnNext(290, 13),
- OnNext(320, 3),
- OnNext(350, 7),
- OnCompleted<int>(390)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 390)
- );
-
- Assert.AreEqual(6, invoked);
- }
-
- [TestMethod]
- public void TakeWhile_Error_Before()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(90, -1),
- OnNext(110, -1),
- OnNext(210, 2),
- OnNext(260, 5),
- OnError<int>(270, ex),
- OnNext(290, 13),
- OnNext(320, 3),
- OnNext(350, 7),
- OnNext(390, 4),
- OnNext(410, 17),
- OnNext(450, 8),
- OnNext(500, 23)
- );
-
- var invoked = 0;
-
- var res = scheduler.Start(() =>
- xs.TakeWhile(x =>
- {
- invoked++;
- return IsPrime(x);
- })
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 2),
- OnNext(260, 5),
- OnError<int>(270, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 270)
- );
-
- Assert.AreEqual(2, invoked);
- }
-
- [TestMethod]
- public void TakeWhile_Error_After()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(90, -1),
- OnNext(110, -1),
- OnNext(210, 2),
- OnNext(260, 5),
- OnNext(290, 13),
- OnNext(320, 3),
- OnNext(350, 7),
- OnNext(390, 4),
- OnNext(410, 17),
- OnNext(450, 8),
- OnNext(500, 23),
- OnError<int>(600, new Exception())
- );
-
- var invoked = 0;
-
- var res = scheduler.Start(() =>
- xs.TakeWhile(x =>
- {
- invoked++;
- return IsPrime(x);
- })
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 2),
- OnNext(260, 5),
- OnNext(290, 13),
- OnNext(320, 3),
- OnNext(350, 7),
- OnCompleted<int>(390)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 390)
- );
-
- Assert.AreEqual(6, invoked);
- }
-
- [TestMethod]
- public void TakeWhile_Dispose_Before()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(90, -1),
- OnNext(110, -1),
- OnNext(210, 2),
- OnNext(260, 5),
- OnNext(290, 13),
- OnNext(320, 3),
- OnNext(350, 7),
- OnNext(390, 4),
- OnNext(410, 17),
- OnNext(450, 8),
- OnNext(500, 23),
- OnCompleted<int>(600)
- );
-
- var invoked = 0;
-
- var res = scheduler.Start(() =>
- xs.TakeWhile(x =>
- {
- invoked++;
- return IsPrime(x);
- }),
- 300
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 2),
- OnNext(260, 5),
- OnNext(290, 13)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 300)
- );
-
- Assert.AreEqual(3, invoked);
- }
-
- [TestMethod]
- public void TakeWhile_Dispose_After()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(90, -1),
- OnNext(110, -1),
- OnNext(210, 2),
- OnNext(260, 5),
- OnNext(290, 13),
- OnNext(320, 3),
- OnNext(350, 7),
- OnNext(390, 4),
- OnNext(410, 17),
- OnNext(450, 8),
- OnNext(500, 23),
- OnCompleted<int>(600)
- );
-
- var invoked = 0;
-
- var res = scheduler.Start(() =>
- xs.TakeWhile(x =>
- {
- invoked++;
- return IsPrime(x);
- }),
- 400
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 2),
- OnNext(260, 5),
- OnNext(290, 13),
- OnNext(320, 3),
- OnNext(350, 7),
- OnCompleted<int>(390)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 390)
- );
-
- Assert.AreEqual(6, invoked);
- }
-
- [TestMethod]
- public void TakeWhile_Zero()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(90, -1),
- OnNext(110, -1),
- OnNext(205, 100),
- OnNext(210, 2),
- OnNext(260, 5),
- OnNext(290, 13),
- OnNext(320, 3),
- OnNext(350, 7),
- OnNext(390, 4),
- OnNext(410, 17),
- OnNext(450, 8),
- OnNext(500, 23),
- OnCompleted<int>(600)
- );
-
- var invoked = 0;
-
- var res = scheduler.Start(() =>
- xs.TakeWhile(x =>
- {
- invoked++;
- return IsPrime(x);
- }),
- 300
- );
-
- res.Messages.AssertEqual(
- OnCompleted<int>(205)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 205)
- );
-
- Assert.AreEqual(1, invoked);
- }
-
- [TestMethod]
- public void TakeWhile_Throw()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(90, -1),
- OnNext(110, -1),
- OnNext(210, 2),
- OnNext(260, 5),
- OnNext(290, 13),
- OnNext(320, 3),
- OnNext(350, 7),
- OnNext(390, 4),
- OnNext(410, 17),
- OnNext(450, 8),
- OnNext(500, 23),
- OnCompleted<int>(600)
- );
-
- var invoked = 0;
- var ex = new Exception();
-
- var res = scheduler.Start(() =>
- xs.TakeWhile(x =>
- {
- invoked++;
- if (invoked == 3)
- throw ex;
- return IsPrime(x);
- })
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 2),
- OnNext(260, 5),
- OnError<int>(290, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 290)
- );
-
- Assert.AreEqual(3, invoked);
- }
-
- [TestMethod]
- public void TakeWhile_Index1()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(90, -1),
- OnNext(110, -1),
- OnNext(205, 100),
- OnNext(210, 2),
- OnNext(260, 5),
- OnNext(290, 13),
- OnNext(320, 3),
- OnNext(350, 7),
- OnNext(390, 4),
- OnNext(410, 17),
- OnNext(450, 8),
- OnNext(500, 23),
- OnCompleted<int>(600)
- );
-
- var res = scheduler.Start(() =>
- xs.TakeWhile((x, i) => i < 5)
- );
-
- res.Messages.AssertEqual(
- OnNext(205, 100),
- OnNext(210, 2),
- OnNext(260, 5),
- OnNext(290, 13),
- OnNext(320, 3),
- OnCompleted<int>(350)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 350)
- );
- }
-
- [TestMethod]
- public void TakeWhile_Index2()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(90, -1),
- OnNext(110, -1),
- OnNext(205, 100),
- OnNext(210, 2),
- OnNext(260, 5),
- OnNext(290, 13),
- OnNext(320, 3),
- OnNext(350, 7),
- OnNext(390, 4),
- OnCompleted<int>(400)
- );
-
- var res = scheduler.Start(() =>
- xs.TakeWhile((x, i) => i >= 0)
- );
-
- res.Messages.AssertEqual(
- OnNext(205, 100),
- OnNext(210, 2),
- OnNext(260, 5),
- OnNext(290, 13),
- OnNext(320, 3),
- OnNext(350, 7),
- OnNext(390, 4),
- OnCompleted<int>(400)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 400)
- );
- }
-
- [TestMethod]
- public void TakeWhile_Index_Throw()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(90, -1),
- OnNext(110, -1),
- OnNext(205, 100),
- OnNext(210, 2),
- OnNext(260, 5),
- OnNext(290, 13),
- OnNext(320, 3),
- OnNext(350, 7),
- OnNext(390, 4),
- OnError<int>(400, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.TakeWhile((x, i) => i >= 0)
- );
-
- res.Messages.AssertEqual(
- OnNext(205, 100),
- OnNext(210, 2),
- OnNext(260, 5),
- OnNext(290, 13),
- OnNext(320, 3),
- OnNext(350, 7),
- OnNext(390, 4),
- OnError<int>(400, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 400)
- );
- }
-
- [TestMethod]
- public void TakeWhile_Index_SelectorThrows()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(90, -1),
- OnNext(110, -1),
- OnNext(205, 100),
- OnNext(210, 2),
- OnNext(260, 5),
- OnNext(290, 13),
- OnNext(320, 3),
- OnNext(350, 7),
- OnNext(390, 4),
- OnCompleted<int>(400)
- );
-
- var res = scheduler.Start(() =>
- xs.TakeWhile((x, i) => { if (i < 5) return true; throw ex; })
- );
-
- res.Messages.AssertEqual(
- OnNext(205, 100),
- OnNext(210, 2),
- OnNext(260, 5),
- OnNext(290, 13),
- OnNext(320, 3),
- OnError<int>(350, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 350)
- );
- }
-
- #endregion
-
- #region + Where +
-
- [TestMethod]
- public void Where_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => ((IObservable<int>)null).Where<int>(DummyFunc<int, bool>.Instance));
- ReactiveAssert.Throws<ArgumentNullException>(() => DummyObservable<int>.Instance.Where<int>((Func<int, bool>)null));
- ReactiveAssert.Throws<ArgumentNullException>(() => DummyObservable<int>.Instance.Where<int>(DummyFunc<int, bool>.Instance).Subscribe(null));
- }
-
- static bool IsPrime(int i)
- {
- if (i <= 1)
- return false;
-
- var max = (int)Math.Sqrt(i);
- for (var j = 2; j <= max; ++j)
- if (i % j == 0)
- return false;
-
- return true;
- }
-
- [TestMethod]
- public void Where_Complete()
- {
- var scheduler = new TestScheduler();
-
- var invoked = 0;
-
- var xs = scheduler.CreateHotObservable(
- OnNext(110, 1),
- OnNext(180, 2),
- OnNext(230, 3),
- OnNext(270, 4),
- OnNext(340, 5),
- OnNext(380, 6),
- OnNext(390, 7),
- OnNext(450, 8),
- OnNext(470, 9),
- OnNext(560, 10),
- OnNext(580, 11),
- OnCompleted<int>(600),
- OnNext(610, 12),
- OnError<int>(620, new Exception()),
- OnCompleted<int>(630)
- );
-
- var res = scheduler.Start(() =>
- xs.Where(x =>
- {
- invoked++;
- return IsPrime(x);
- })
- );
-
- res.Messages.AssertEqual(
- OnNext(230, 3),
- OnNext(340, 5),
- OnNext(390, 7),
- OnNext(580, 11),
- OnCompleted<int>(600)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 600)
- );
-
- Assert.AreEqual(9, invoked);
- }
-
- [TestMethod]
- public void Where_True()
- {
- var scheduler = new TestScheduler();
-
- var invoked = 0;
-
- var xs = scheduler.CreateHotObservable(
- OnNext(110, 1),
- OnNext(180, 2),
- OnNext(230, 3),
- OnNext(270, 4),
- OnNext(340, 5),
- OnNext(380, 6),
- OnNext(390, 7),
- OnNext(450, 8),
- OnNext(470, 9),
- OnNext(560, 10),
- OnNext(580, 11),
- OnCompleted<int>(600)
- );
-
- var res = scheduler.Start(() =>
- xs.Where(x =>
- {
- invoked++;
- return true;
- })
- );
-
- res.Messages.AssertEqual(
- OnNext(230, 3),
- OnNext(270, 4),
- OnNext(340, 5),
- OnNext(380, 6),
- OnNext(390, 7),
- OnNext(450, 8),
- OnNext(470, 9),
- OnNext(560, 10),
- OnNext(580, 11),
- OnCompleted<int>(600)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 600)
- );
-
- Assert.AreEqual(9, invoked);
- }
-
- [TestMethod]
- public void Where_False()
- {
- var scheduler = new TestScheduler();
-
- var invoked = 0;
-
- var xs = scheduler.CreateHotObservable(
- OnNext(110, 1),
- OnNext(180, 2),
- OnNext(230, 3),
- OnNext(270, 4),
- OnNext(340, 5),
- OnNext(380, 6),
- OnNext(390, 7),
- OnNext(450, 8),
- OnNext(470, 9),
- OnNext(560, 10),
- OnNext(580, 11),
- OnCompleted<int>(600)
- );
-
- var res = scheduler.Start(() =>
- xs.Where(x =>
- {
- invoked++;
- return false;
- })
- );
-
- res.Messages.AssertEqual(
- OnCompleted<int>(600)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 600)
- );
-
- Assert.AreEqual(9, invoked);
- }
-
- [TestMethod]
- public void Where_Dispose()
- {
- var scheduler = new TestScheduler();
-
- var invoked = 0;
-
- var xs = scheduler.CreateHotObservable(
- OnNext(110, 1),
- OnNext(180, 2),
- OnNext(230, 3),
- OnNext(270, 4),
- OnNext(340, 5),
- OnNext(380, 6),
- OnNext(390, 7),
- OnNext(450, 8),
- OnNext(470, 9),
- OnNext(560, 10),
- OnNext(580, 11),
- OnCompleted<int>(600)
- );
-
- var res = scheduler.Start(() =>
- xs.Where(x =>
- {
- invoked++;
- return IsPrime(x);
- }),
- 400
- );
-
- res.Messages.AssertEqual(
- OnNext(230, 3),
- OnNext(340, 5),
- OnNext(390, 7)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 400)
- );
-
- Assert.AreEqual(5, invoked);
- }
-
- [TestMethod]
- public void Where_Error()
- {
- var scheduler = new TestScheduler();
-
- var invoked = 0;
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(110, 1),
- OnNext(180, 2),
- OnNext(230, 3),
- OnNext(270, 4),
- OnNext(340, 5),
- OnNext(380, 6),
- OnNext(390, 7),
- OnNext(450, 8),
- OnNext(470, 9),
- OnNext(560, 10),
- OnNext(580, 11),
- OnError<int>(600, ex),
- OnNext(610, 12),
- OnError<int>(620, new Exception()),
- OnCompleted<int>(630)
- );
-
- var res = scheduler.Start(() =>
- xs.Where(x =>
- {
- invoked++;
- return IsPrime(x);
- })
- );
-
- res.Messages.AssertEqual(
- OnNext(230, 3),
- OnNext(340, 5),
- OnNext(390, 7),
- OnNext(580, 11),
- OnError<int>(600, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 600)
- );
-
- Assert.AreEqual(9, invoked);
- }
-
- [TestMethod]
- public void Where_Throw()
- {
- var scheduler = new TestScheduler();
-
- var invoked = 0;
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(110, 1),
- OnNext(180, 2),
- OnNext(230, 3),
- OnNext(270, 4),
- OnNext(340, 5),
- OnNext(380, 6),
- OnNext(390, 7),
- OnNext(450, 8),
- OnNext(470, 9),
- OnNext(560, 10),
- OnNext(580, 11),
- OnCompleted<int>(600),
- OnNext(610, 12),
- OnError<int>(620, new Exception()),
- OnCompleted<int>(630)
- );
-
- var res = scheduler.Start(() =>
- xs.Where(x =>
- {
- invoked++;
- if (x > 5)
- throw ex;
- return IsPrime(x);
- })
- );
-
- res.Messages.AssertEqual(
- OnNext(230, 3),
- OnNext(340, 5),
- OnError<int>(380, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 380)
- );
-
- Assert.AreEqual(4, invoked);
- }
-
- [TestMethod]
- public void Where_DisposeInPredicate()
- {
- var scheduler = new TestScheduler();
-
- var invoked = 0;
-
- var xs = scheduler.CreateHotObservable(
- OnNext(110, 1),
- OnNext(180, 2),
- OnNext(230, 3),
- OnNext(270, 4),
- OnNext(340, 5),
- OnNext(380, 6),
- OnNext(390, 7),
- OnNext(450, 8),
- OnNext(470, 9),
- OnNext(560, 10),
- OnNext(580, 11),
- OnCompleted<int>(600),
- OnNext(610, 12),
- OnError<int>(620, new Exception()),
- OnCompleted<int>(630)
- );
-
- var res = scheduler.CreateObserver<int>();
-
- var d = new SerialDisposable();
- var ys = default(IObservable<int>);
-
- scheduler.ScheduleAbsolute(Created, () => ys = xs.Where(x =>
- {
- invoked++;
- if (x == 8)
- d.Dispose();
- return IsPrime(x);
- }));
-
- scheduler.ScheduleAbsolute(Subscribed, () => d.Disposable = ys.Subscribe(res));
-
- scheduler.ScheduleAbsolute(Disposed, () => d.Dispose());
-
- scheduler.Start();
-
- res.Messages.AssertEqual(
- OnNext(230, 3),
- OnNext(340, 5),
- OnNext(390, 7)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 450)
- );
-
- Assert.AreEqual(6, invoked);
- }
-
- [TestMethod]
- public void WhereWhereOptimization_Regular()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(110, 1),
- OnNext(180, 2),
- OnNext(230, 3),
- OnNext(270, 4),
- OnNext(340, 5),
- OnNext(380, 6),
- OnNext(390, 7),
- OnNext(450, 8),
- OnNext(470, 9),
- OnNext(560, 10),
- OnNext(580, 11),
- OnCompleted<int>(600)
- );
-
- var res = scheduler.Start(() =>
- xs.Where(x => x > 3).Where(x => x % 2 == 0)
- );
-
- res.Messages.AssertEqual(
- OnNext(270, 4),
- OnNext(380, 6),
- OnNext(450, 8),
- OnNext(560, 10),
- OnCompleted<int>(600)
- );
- }
-
- [TestMethod]
- public void WhereWhereOptimization_SecondPredicateThrows()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(110, 1),
- OnNext(180, 2),
- OnNext(230, 3),
- OnNext(270, 4),
- OnNext(340, 5),
- OnNext(380, 6),
- OnNext(390, 7),
- OnNext(450, 8),
- OnNext(470, 9),
- OnNext(560, 10),
- OnNext(580, 11),
- OnCompleted<int>(600)
- );
-
- var res = scheduler.Start(() =>
- xs.Where(x => x > 3).Where(x =>
- {
- if (x <= 3)
- throw new Exception();
-
- return x % 2 == 0;
- })
- );
-
- res.Messages.AssertEqual(
- OnNext(270, 4),
- OnNext(380, 6),
- OnNext(450, 8),
- OnNext(560, 10),
- OnCompleted<int>(600)
- );
- }
-
- [TestMethod]
- public void WhereIndex_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => ((IObservable<int>)null).Where<int>(DummyFunc<int, int, bool>.Instance));
- ReactiveAssert.Throws<ArgumentNullException>(() => DummyObservable<int>.Instance.Where<int>((Func<int, int, bool>)null));
- ReactiveAssert.Throws<ArgumentNullException>(() => DummyObservable<int>.Instance.Where<int>(DummyFunc<int, int, bool>.Instance).Subscribe(null));
- }
-
- [TestMethod]
- public void WhereIndex_Complete()
- {
- var scheduler = new TestScheduler();
-
- var invoked = 0;
-
- var xs = scheduler.CreateHotObservable(
- OnNext(110, 1),
- OnNext(180, 2),
- OnNext(230, 3),
- OnNext(270, 4),
- OnNext(340, 5),
- OnNext(380, 6),
- OnNext(390, 7),
- OnNext(450, 8),
- OnNext(470, 9),
- OnNext(560, 10),
- OnNext(580, 11),
- OnCompleted<int>(600),
- OnNext(610, 12),
- OnError<int>(620, new Exception()),
- OnCompleted<int>(630)
- );
-
- var res = scheduler.Start(() =>
- xs.Where((x, i) =>
- {
- invoked++;
- return IsPrime(x + i * 10);
- })
- );
-
- res.Messages.AssertEqual(
- OnNext(230, 3),
- OnNext(390, 7),
- OnCompleted<int>(600)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 600)
- );
-
- Assert.AreEqual(9, invoked);
- }
-
- [TestMethod]
- public void WhereIndex_True()
- {
- var scheduler = new TestScheduler();
-
- var invoked = 0;
-
- var xs = scheduler.CreateHotObservable(
- OnNext(110, 1),
- OnNext(180, 2),
- OnNext(230, 3),
- OnNext(270, 4),
- OnNext(340, 5),
- OnNext(380, 6),
- OnNext(390, 7),
- OnNext(450, 8),
- OnNext(470, 9),
- OnNext(560, 10),
- OnNext(580, 11),
- OnCompleted<int>(600)
- );
-
- var res = scheduler.Start(() =>
- xs.Where((x, i) =>
- {
- invoked++;
- return true;
- })
- );
-
- res.Messages.AssertEqual(
- OnNext(230, 3),
- OnNext(270, 4),
- OnNext(340, 5),
- OnNext(380, 6),
- OnNext(390, 7),
- OnNext(450, 8),
- OnNext(470, 9),
- OnNext(560, 10),
- OnNext(580, 11),
- OnCompleted<int>(600)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 600)
- );
-
- Assert.AreEqual(9, invoked);
- }
-
- [TestMethod]
- public void WhereIndex_False()
- {
- var scheduler = new TestScheduler();
-
- var invoked = 0;
-
- var xs = scheduler.CreateHotObservable(
- OnNext(110, 1),
- OnNext(180, 2),
- OnNext(230, 3),
- OnNext(270, 4),
- OnNext(340, 5),
- OnNext(380, 6),
- OnNext(390, 7),
- OnNext(450, 8),
- OnNext(470, 9),
- OnNext(560, 10),
- OnNext(580, 11),
- OnCompleted<int>(600)
- );
-
- var res = scheduler.Start(() =>
- xs.Where((x, i) =>
- {
- invoked++;
- return false;
- })
- );
-
- res.Messages.AssertEqual(
- OnCompleted<int>(600)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 600)
- );
-
- Assert.AreEqual(9, invoked);
- }
-
- [TestMethod]
- public void WhereIndex_Dispose()
- {
- var scheduler = new TestScheduler();
-
- var invoked = 0;
-
- var xs = scheduler.CreateHotObservable(
- OnNext(110, 1),
- OnNext(180, 2),
- OnNext(230, 3),
- OnNext(270, 4),
- OnNext(340, 5),
- OnNext(380, 6),
- OnNext(390, 7),
- OnNext(450, 8),
- OnNext(470, 9),
- OnNext(560, 10),
- OnNext(580, 11),
- OnCompleted<int>(600)
- );
-
- var res = scheduler.Start(() =>
- xs.Where((x, i) =>
- {
- invoked++;
- return IsPrime(x + i * 10);
- }),
- 400
- );
-
- res.Messages.AssertEqual(
- OnNext(230, 3),
- OnNext(390, 7)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 400)
- );
-
- Assert.AreEqual(5, invoked);
- }
-
- [TestMethod]
- public void WhereIndex_Error()
- {
- var scheduler = new TestScheduler();
-
- var invoked = 0;
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(110, 1),
- OnNext(180, 2),
- OnNext(230, 3),
- OnNext(270, 4),
- OnNext(340, 5),
- OnNext(380, 6),
- OnNext(390, 7),
- OnNext(450, 8),
- OnNext(470, 9),
- OnNext(560, 10),
- OnNext(580, 11),
- OnError<int>(600, ex),
- OnNext(610, 12),
- OnError<int>(620, new Exception()),
- OnCompleted<int>(630)
- );
-
- var res = scheduler.Start(() =>
- xs.Where((x, i) =>
- {
- invoked++;
- return IsPrime(x + i * 10);
- })
- );
-
- res.Messages.AssertEqual(
- OnNext(230, 3),
- OnNext(390, 7),
- OnError<int>(600, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 600)
- );
-
- Assert.AreEqual(9, invoked);
- }
-
- [TestMethod]
- public void WhereIndex_Throw()
- {
- var scheduler = new TestScheduler();
-
- var invoked = 0;
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(110, 1),
- OnNext(180, 2),
- OnNext(230, 3),
- OnNext(270, 4),
- OnNext(340, 5),
- OnNext(380, 6),
- OnNext(390, 7),
- OnNext(450, 8),
- OnNext(470, 9),
- OnNext(560, 10),
- OnNext(580, 11),
- OnCompleted<int>(600),
- OnNext(610, 12),
- OnError<int>(620, new Exception()),
- OnCompleted<int>(630)
- );
-
- var res = scheduler.Start(() =>
- xs.Where((x, i) =>
- {
- invoked++;
- if (x > 5)
- throw ex;
- return IsPrime(x + i * 10);
- })
- );
-
- res.Messages.AssertEqual(
- OnNext(230, 3),
- OnError<int>(380, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 380)
- );
-
- Assert.AreEqual(4, invoked);
- }
-
- [TestMethod]
- public void WhereIndex_DisposeInPredicate()
- {
- var scheduler = new TestScheduler();
-
- var invoked = 0;
-
- var xs = scheduler.CreateHotObservable(
- OnNext(110, 1),
- OnNext(180, 2),
- OnNext(230, 3),
- OnNext(270, 4),
- OnNext(340, 5),
- OnNext(380, 6),
- OnNext(390, 7),
- OnNext(450, 8),
- OnNext(470, 9),
- OnNext(560, 10),
- OnNext(580, 11),
- OnCompleted<int>(600),
- OnNext(610, 12),
- OnError<int>(620, new Exception()),
- OnCompleted<int>(630)
- );
-
- var res = scheduler.CreateObserver<int>();
-
- var d = new SerialDisposable();
- var ys = default(IObservable<int>);
-
-
- scheduler.ScheduleAbsolute(Created, () => ys = xs.Where((x, i) =>
- {
- invoked++;
- if (x == 8)
- d.Dispose();
- return IsPrime(x + i * 10);
- }));
-
- scheduler.ScheduleAbsolute(Subscribed, () => d.Disposable = ys.Subscribe(res));
-
- scheduler.ScheduleAbsolute(Disposed, () => d.Dispose());
-
- scheduler.Start();
-
- res.Messages.AssertEqual(
- OnNext(230, 3),
- OnNext(390, 7)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 450)
- );
-
- Assert.AreEqual(6, invoked);
- }
-
- [TestMethod]
- public void Where_Where1()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(110, 1),
- OnNext(180, 2),
- OnNext(230, 3),
- OnNext(270, 4),
- OnNext(340, 5),
- OnNext(380, 6),
- OnNext(390, 7),
- OnCompleted<int>(400)
- );
-
- var res = scheduler.Start(() =>
- xs.Where(x => x > 3).Where(x => x < 6)
- );
-
- res.Messages.AssertEqual(
- OnNext(270, 4),
- OnNext(340, 5),
- OnCompleted<int>(400)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 400)
- );
- }
-
- [TestMethod]
- public void Where_Where2()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(110, 1),
- OnNext(180, 2),
- OnNext(230, 3),
- OnNext(270, 4),
- OnNext(340, 5),
- OnNext(380, 6),
- OnNext(390, 7),
- OnCompleted<int>(400)
- );
-
- var res = scheduler.Start(() =>
- xs.Where((x, i) => i >= 1).Where(x => x < 6)
- );
-
- res.Messages.AssertEqual(
- OnNext(270, 4),
- OnNext(340, 5),
- OnCompleted<int>(400)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 400)
- );
- }
-
- [TestMethod]
- public void Where_Where3()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(110, 1),
- OnNext(180, 2),
- OnNext(230, 3),
- OnNext(270, 4),
- OnNext(340, 5),
- OnNext(380, 6),
- OnNext(390, 7),
- OnCompleted<int>(400)
- );
-
- var res = scheduler.Start(() =>
- xs.Where(x => x > 3).Where((x, i) => i < 2)
- );
-
- res.Messages.AssertEqual(
- OnNext(270, 4),
- OnNext(340, 5),
- OnCompleted<int>(400)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 400)
- );
- }
-
- [TestMethod]
- public void Where_Where4()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(110, 1),
- OnNext(180, 2),
- OnNext(230, 3),
- OnNext(270, 4),
- OnNext(340, 5),
- OnNext(380, 6),
- OnNext(390, 7),
- OnCompleted<int>(400)
- );
-
- var res = scheduler.Start(() =>
- xs.Where((x, i) => i >= 1).Where((x, i) => i < 2)
- );
-
- res.Messages.AssertEqual(
- OnNext(270, 4),
- OnNext(340, 5),
- OnCompleted<int>(400)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 400)
- );
- }
-
- #endregion
- }
-}
diff --git a/Rx.NET/Tests.System.Reactive/Tests/ObservableTimeTest.cs b/Rx.NET/Tests.System.Reactive/Tests/ObservableTimeTest.cs
deleted file mode 100644
index 45be1df..0000000
--- a/Rx.NET/Tests.System.Reactive/Tests/ObservableTimeTest.cs
+++ /dev/null
@@ -1,8936 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Reactive;
-using System.Reactive.Concurrency;
-using System.Reactive.Disposables;
-using System.Reactive.Linq;
-using System.Reactive.Subjects;
-using System.Text;
-using System.Threading;
-using Microsoft.Reactive.Testing;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using ReactiveTests.Dummies;
-
-namespace ReactiveTests.Tests
-{
- [TestClass]
- public class ObservableTimeTest : ReactiveTest
- {
- #region + Buffer +
-
- [TestMethod]
- public void Buffer_Time_ArgumentChecking()
- {
- var scheduler = new TestScheduler();
- var someObservable = Observable.Empty<int>();
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Buffer(default(IObservable<int>), TimeSpan.Zero));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Buffer(someObservable, TimeSpan.Zero, null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Buffer(default(IObservable<int>), TimeSpan.Zero, scheduler));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Buffer(default(IObservable<int>), TimeSpan.Zero, TimeSpan.Zero));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Buffer(someObservable, TimeSpan.Zero, TimeSpan.Zero, null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Buffer(default(IObservable<int>), TimeSpan.Zero, TimeSpan.Zero, scheduler));
- }
-
- [TestMethod]
- public void BufferWithTime_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Buffer(default(IObservable<int>), TimeSpan.FromTicks(1), TimeSpan.FromTicks(1), DummyScheduler.Instance));
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => Observable.Buffer(DummyObservable<int>.Instance, TimeSpan.FromTicks(-1), TimeSpan.FromTicks(1), DummyScheduler.Instance));
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => Observable.Buffer(DummyObservable<int>.Instance, TimeSpan.FromTicks(1), TimeSpan.FromTicks(-1), DummyScheduler.Instance));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Buffer(DummyObservable<int>.Instance, TimeSpan.FromTicks(1), TimeSpan.FromTicks(1), null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Buffer(default(IObservable<int>), TimeSpan.FromTicks(1), TimeSpan.FromTicks(1)));
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => Observable.Buffer(DummyObservable<int>.Instance, TimeSpan.FromTicks(-1), TimeSpan.FromTicks(1)));
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => Observable.Buffer(DummyObservable<int>.Instance, TimeSpan.FromTicks(1), TimeSpan.FromTicks(-1)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Buffer(default(IObservable<int>), TimeSpan.FromTicks(1), DummyScheduler.Instance));
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => Observable.Buffer(DummyObservable<int>.Instance, TimeSpan.FromTicks(-1), DummyScheduler.Instance));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Buffer(DummyObservable<int>.Instance, TimeSpan.FromTicks(1), null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Buffer(default(IObservable<int>), TimeSpan.FromTicks(1)));
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => Observable.Buffer(DummyObservable<int>.Instance, TimeSpan.FromTicks(-1)));
- }
-
- [TestMethod]
- public void BufferWithTime_Basic1()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(100, 1),
- OnNext(210, 2),
- OnNext(240, 3),
- OnNext(280, 4),
- OnNext(320, 5),
- OnNext(350, 6),
- OnNext(380, 7),
- OnNext(420, 8),
- OnNext(470, 9),
- OnCompleted<int>(600)
- );
-
- var res = scheduler.Start(() =>
- xs.Buffer(TimeSpan.FromTicks(100), TimeSpan.FromTicks(70), scheduler).Select(x => string.Join(",", x.Select(xx => xx.ToString()).ToArray()))
- );
-
- res.Messages.AssertEqual(
- OnNext(300, "2,3,4"),
- OnNext(370, "4,5,6"),
- OnNext(440, "6,7,8"),
- OnNext(510, "8,9"),
- OnNext(580, ""),
- OnNext(600, ""),
- OnCompleted<string>(600)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 600)
- );
- }
-
- [TestMethod]
- public void BufferWithTime_Basic2()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(100, 1),
- OnNext(210, 2),
- OnNext(240, 3),
- OnNext(280, 4),
- OnNext(320, 5),
- OnNext(350, 6),
- OnNext(380, 7),
- OnNext(420, 8),
- OnNext(470, 9),
- OnCompleted<int>(600)
- );
-
- var res = scheduler.Start(() =>
- xs.Buffer(TimeSpan.FromTicks(70), TimeSpan.FromTicks(100), scheduler).Select(x => string.Join(",", x.Select(xx => xx.ToString()).ToArray()))
- );
-
- res.Messages.AssertEqual(
- OnNext(270, "2,3"),
- OnNext(370, "5,6"),
- OnNext(470, "8,9"),
- OnNext(570, ""),
- OnCompleted<string>(600)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 600)
- );
- }
-
- [TestMethod]
- public void BufferWithTime_Error()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(100, 1),
- OnNext(210, 2),
- OnNext(240, 3),
- OnNext(280, 4),
- OnNext(320, 5),
- OnNext(350, 6),
- OnNext(380, 7),
- OnNext(420, 8),
- OnNext(470, 9),
- OnError<int>(600, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.Buffer(TimeSpan.FromTicks(100), TimeSpan.FromTicks(70), scheduler).Select(x => string.Join(",", x.Select(xx => xx.ToString()).ToArray()))
- );
-
- res.Messages.AssertEqual(
- OnNext(300, "2,3,4"),
- OnNext(370, "4,5,6"),
- OnNext(440, "6,7,8"),
- OnNext(510, "8,9"),
- OnNext(580, ""),
- OnError<string>(600, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 600)
- );
- }
-
- [TestMethod]
- public void BufferWithTime_Disposed()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(100, 1),
- OnNext(210, 2),
- OnNext(240, 3),
- OnNext(280, 4),
- OnNext(320, 5),
- OnNext(350, 6),
- OnNext(380, 7),
- OnNext(420, 8),
- OnNext(470, 9),
- OnCompleted<int>(600)
- );
-
- var res = scheduler.Start(() =>
- xs.Buffer(TimeSpan.FromTicks(100), TimeSpan.FromTicks(70), scheduler).Select(x => string.Join(",", x.Select(xx => xx.ToString()).ToArray())),
- 370
- );
-
- res.Messages.AssertEqual(
- OnNext(300, "2,3,4")
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 370)
- );
- }
-
- [TestMethod]
- public void BufferWithTime_Basic_Same()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(100, 1),
- OnNext(210, 2),
- OnNext(240, 3),
- OnNext(280, 4),
- OnNext(320, 5),
- OnNext(350, 6),
- OnNext(380, 7),
- OnNext(420, 8),
- OnNext(470, 9),
- OnCompleted<int>(600)
- );
-
- var res = scheduler.Start(() =>
- xs.Buffer(TimeSpan.FromTicks(100), scheduler).Select(x => string.Join(",", x.Select(xx => xx.ToString()).ToArray()))
- );
-
- res.Messages.AssertEqual(
- OnNext(300, "2,3,4"),
- OnNext(400, "5,6,7"),
- OnNext(500, "8,9"),
- OnNext(600, ""),
- OnCompleted<string>(600)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 600)
- );
- }
-
- [TestMethod]
- public void BufferWithTime_Basic_Same_Periodic()
- {
- var scheduler = new PeriodicTestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(100, 1),
- OnNext(210, 2),
- OnNext(240, 3),
- OnNext(280, 4),
- OnNext(320, 5),
- OnNext(350, 6),
- OnNext(380, 7),
- OnNext(420, 8),
- OnNext(470, 9),
- OnCompleted<int>(600)
- );
-
- var res = scheduler.Start(() =>
- xs.Buffer(TimeSpan.FromTicks(100), scheduler).Select(x => string.Join(",", x.Select(xx => xx.ToString()).ToArray()))
- );
-
- res.Messages.AssertEqual(
- OnNext(300, "2,3,4"),
- OnNext(400, "5,6,7"),
- OnNext(500, "8,9"),
- OnNext(600, ""),
- OnCompleted<string>(600)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 600)
- );
-
- scheduler.Timers.AssertEqual(
- new TimerRun(200, 600) { 300, 400, 500 }
- );
- }
-
- [TestMethod]
- public void BufferWithTime_Basic_Same_Periodic_Error()
- {
- var ex = new Exception();
-
- var scheduler = new PeriodicTestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(100, 1),
- OnNext(210, 2),
- OnNext(240, 3),
- OnNext(280, 4),
- OnNext(320, 5),
- OnNext(350, 6),
- OnNext(380, 7),
- OnNext(420, 8),
- OnNext(470, 9),
- OnError<int>(480, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.Buffer(TimeSpan.FromTicks(100), scheduler).Select(x => string.Join(",", x.Select(xx => xx.ToString()).ToArray()))
- );
-
- res.Messages.AssertEqual(
- OnNext(300, "2,3,4"),
- OnNext(400, "5,6,7"),
- OnError<string>(480, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 480)
- );
-
- scheduler.Timers.AssertEqual(
- new TimerRun(200, 480) { 300, 400 }
- );
- }
-
- [TestMethod]
- public void BufferWithTime_Default()
- {
- Observable.Range(0, 10).Buffer(TimeSpan.FromDays(1), TimeSpan.FromDays(1)).First().AssertEqual(Enumerable.Range(0, 10));
- Observable.Range(0, 10).Buffer(TimeSpan.FromDays(1)).First().AssertEqual(Enumerable.Range(0, 10));
- }
-
- [TestMethod]
- public void BufferWithTimeOrCount_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Buffer(default(IObservable<int>), TimeSpan.FromTicks(1), 1, DummyScheduler.Instance));
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => Observable.Buffer(DummyObservable<int>.Instance, TimeSpan.FromTicks(-1), 1, DummyScheduler.Instance));
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => Observable.Buffer(DummyObservable<int>.Instance, TimeSpan.FromTicks(1), 0, DummyScheduler.Instance));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Buffer(DummyObservable<int>.Instance, TimeSpan.FromTicks(1), 1, null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Buffer(default(IObservable<int>), TimeSpan.FromTicks(1), 1));
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => Observable.Buffer(DummyObservable<int>.Instance, TimeSpan.FromTicks(-1), 1));
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => Observable.Buffer(DummyObservable<int>.Instance, TimeSpan.FromTicks(1), 0));
- }
-
- [TestMethod]
- public void BufferWithTimeOrCount_Basic()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(205, 1),
- OnNext(210, 2),
- OnNext(240, 3),
- OnNext(280, 4),
- OnNext(320, 5),
- OnNext(350, 6),
- OnNext(370, 7),
- OnNext(420, 8),
- OnNext(470, 9),
- OnCompleted<int>(600)
- );
-
- var res = scheduler.Start(() =>
- xs.Buffer(TimeSpan.FromTicks(70), 3, scheduler).Select(x => string.Join(",", x.Select(xx => xx.ToString()).ToArray()))
- );
-
- res.Messages.AssertEqual(
- OnNext(240, "1,2,3"),
- OnNext(310, "4"),
- OnNext(370, "5,6,7"),
- OnNext(440, "8"),
- OnNext(510, "9"),
- OnNext(580, ""),
- OnNext(600, ""),
- OnCompleted<string>(600)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 600)
- );
- }
-
- [TestMethod]
- public void BufferWithTimeOrCount_Error()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(205, 1),
- OnNext(210, 2),
- OnNext(240, 3),
- OnNext(280, 4),
- OnNext(320, 5),
- OnNext(350, 6),
- OnNext(370, 7),
- OnNext(420, 8),
- OnNext(470, 9),
- OnError<int>(600, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.Buffer(TimeSpan.FromTicks(70), 3, scheduler).Select(x => string.Join(",", x.Select(xx => xx.ToString()).ToArray()))
- );
-
- res.Messages.AssertEqual(
- OnNext(240, "1,2,3"),
- OnNext(310, "4"),
- OnNext(370, "5,6,7"),
- OnNext(440, "8"),
- OnNext(510, "9"),
- OnNext(580, ""),
- OnError<string>(600, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 600)
- );
- }
-
- [TestMethod]
- public void BufferWithTimeOrCount_Disposed()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(205, 1),
- OnNext(210, 2),
- OnNext(240, 3),
- OnNext(280, 4),
- OnNext(320, 5),
- OnNext(350, 6),
- OnNext(370, 7),
- OnNext(420, 8),
- OnNext(470, 9),
- OnCompleted<int>(600)
- );
-
- var res = scheduler.Start(() =>
- xs.Buffer(TimeSpan.FromTicks(70), 3, scheduler).Select(x => string.Join(",", x.Select(xx => xx.ToString()).ToArray())),
- 370
- );
-
- res.Messages.AssertEqual(
- OnNext(240, "1,2,3"),
- OnNext(310, "4"),
- OnNext(370, "5,6,7")
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 370)
- );
- }
-
- [TestMethod]
- public void BufferWithTimeOrCount_Default()
- {
- Observable.Range(1, 10, DefaultScheduler.Instance).Buffer(TimeSpan.FromDays(1), 3).Skip(1).First().AssertEqual(4, 5, 6);
- }
-
- #endregion
-
- #region + Delay +
-
- [TestMethod]
- public void Delay_ArgumentChecking()
- {
- var scheduler = new TestScheduler();
- var someObservable = Observable.Empty<int>();
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Delay(default(IObservable<int>), DateTimeOffset.Now));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Delay(default(IObservable<int>), TimeSpan.Zero));
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => Observable.Delay(someObservable, TimeSpan.FromSeconds(-1)));
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Delay(default(IObservable<int>), DateTimeOffset.Now, scheduler));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Delay(default(IObservable<int>), TimeSpan.Zero, scheduler));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Delay(someObservable, DateTimeOffset.Now, null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Delay(someObservable, TimeSpan.Zero, null));
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => Observable.Delay(someObservable, TimeSpan.FromSeconds(-1), scheduler));
- }
-
- [TestMethod]
- public void Delay_TimeSpan_Simple1()
- {
- Delay_TimeSpan_Simple1_Impl(false);
- }
-
- [TestMethod]
- public void Delay_TimeSpan_Simple1_Stopwatch()
- {
- Delay_TimeSpan_Simple1_Impl(true);
- }
-
- private void Delay_TimeSpan_Simple1_Impl(bool useStopwatch)
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(250, 2),
- OnNext(350, 3),
- OnNext(450, 4),
- OnCompleted<int>(550)
- );
-
- var res = scheduler.Start(() =>
- xs.Delay(TimeSpan.FromTicks(100), useStopwatch ? scheduler : scheduler.DisableOptimizations())
- );
-
- res.Messages.AssertEqual(
- OnNext(350, 2),
- OnNext(450, 3),
- OnNext(550, 4),
- OnCompleted<int>(650)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 550)
- );
- }
-
- [TestMethod]
- public void Delay_DateTimeOffset_Simple1()
- {
- Delay_DateTimeOffset_Simple1_Impl(false);
- }
-
- [TestMethod]
- public void Delay_DateTimeOffset_Simple1_Stopwatch()
- {
- Delay_DateTimeOffset_Simple1_Impl(true);
- }
-
- private void Delay_DateTimeOffset_Simple1_Impl(bool useStopwatch)
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(250, 2),
- OnNext(350, 3),
- OnNext(450, 4),
- OnCompleted<int>(550)
- );
-
- var res = scheduler.Start(() =>
- xs.Delay(new DateTimeOffset(300, TimeSpan.Zero), useStopwatch ? scheduler : scheduler.DisableOptimizations())
- );
-
- res.Messages.AssertEqual(
- OnNext(350, 2),
- OnNext(450, 3),
- OnNext(550, 4),
- OnCompleted<int>(650)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 550)
- );
- }
-
- [TestMethod]
- public void Delay_TimeSpan_Simple2()
- {
- Delay_TimeSpan_Simple2_Impl(false);
- }
-
- [TestMethod]
- public void Delay_TimeSpan_Simple2_Stopwatch()
- {
- Delay_TimeSpan_Simple2_Impl(true);
- }
-
- private void Delay_TimeSpan_Simple2_Impl(bool useStopwatch)
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(250, 2),
- OnNext(350, 3),
- OnNext(450, 4),
- OnCompleted<int>(550)
- );
-
- var res = scheduler.Start(() =>
- xs.Delay(TimeSpan.FromTicks(50), useStopwatch ? scheduler : scheduler.DisableOptimizations())
- );
-
- res.Messages.AssertEqual(
- OnNext(300, 2),
- OnNext(400, 3),
- OnNext(500, 4),
- OnCompleted<int>(600)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 550)
- );
- }
-
- [TestMethod]
- public void Delay_DateTimeOffset_Simple2()
- {
- Delay_DateTimeOffset_Simple2_Impl(false);
- }
-
- [TestMethod]
- public void Delay_DateTimeOffset_Simple2_Stopwatch()
- {
- Delay_DateTimeOffset_Simple2_Impl(true);
- }
-
- private void Delay_DateTimeOffset_Simple2_Impl(bool useStopwatch)
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(250, 2),
- OnNext(350, 3),
- OnNext(450, 4),
- OnCompleted<int>(550)
- );
-
- var res = scheduler.Start(() =>
- xs.Delay(new DateTimeOffset(250, TimeSpan.Zero), useStopwatch ? scheduler : scheduler.DisableOptimizations())
- );
-
- res.Messages.AssertEqual(
- OnNext(300, 2),
- OnNext(400, 3),
- OnNext(500, 4),
- OnCompleted<int>(600)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 550)
- );
- }
-
- [TestMethod]
- public void Delay_TimeSpan_Simple3()
- {
- Delay_TimeSpan_Simple3_Impl(false);
- }
-
- [TestMethod]
- public void Delay_TimeSpan_Simple3_Stopwatch()
- {
- Delay_TimeSpan_Simple3_Impl(true);
- }
-
- private void Delay_TimeSpan_Simple3_Impl(bool useStopwatch)
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(250, 2),
- OnNext(350, 3),
- OnNext(450, 4),
- OnCompleted<int>(550)
- );
-
- var res = scheduler.Start(() =>
- xs.Delay(TimeSpan.FromTicks(150), useStopwatch ? scheduler : scheduler.DisableOptimizations())
- );
-
- res.Messages.AssertEqual(
- OnNext(400, 2),
- OnNext(500, 3),
- OnNext(600, 4),
- OnCompleted<int>(700)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 550)
- );
- }
-
- [TestMethod]
- public void Delay_DateTimeOffset_Simple3()
- {
- Delay_DateTimeOffset_Simple3_Impl(false);
- }
-
- [TestMethod]
- public void Delay_DateTimeOffset_Simple3_Stopwatch()
- {
- Delay_DateTimeOffset_Simple3_Impl(true);
- }
-
- private void Delay_DateTimeOffset_Simple3_Impl(bool useStopwatch)
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(250, 2),
- OnNext(350, 3),
- OnNext(450, 4),
- OnCompleted<int>(550)
- );
-
- var res = scheduler.Start(() =>
- xs.Delay(new DateTimeOffset(350, TimeSpan.Zero), useStopwatch ? scheduler : scheduler.DisableOptimizations())
- );
-
- res.Messages.AssertEqual(
- OnNext(400, 2),
- OnNext(500, 3),
- OnNext(600, 4),
- OnCompleted<int>(700)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 550)
- );
- }
-
- [TestMethod]
- public void Delay_TimeSpan_Error1()
- {
- Delay_TimeSpan_Error1_Impl(false);
- }
-
- [TestMethod]
- public void Delay_TimeSpan_Error1_Stopwatch()
- {
- Delay_TimeSpan_Error1_Impl(true);
- }
-
- private void Delay_TimeSpan_Error1_Impl(bool useStopwatch)
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(250, 2),
- OnNext(350, 3),
- OnNext(450, 4),
- OnError<int>(550, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.Delay(TimeSpan.FromTicks(50), useStopwatch ? scheduler : scheduler.DisableOptimizations())
- );
-
- res.Messages.AssertEqual(
- OnNext(300, 2),
- OnNext(400, 3),
- OnNext(500, 4),
- OnError<int>(550, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 550)
- );
- }
-
- [TestMethod]
- public void Delay_DateTimeOffset_Error1()
- {
- Delay_DateTimeOffset_Error1_Impl(false);
- }
-
- [TestMethod]
- public void Delay_DateTimeOffset_Error1_Stopwatch()
- {
- Delay_DateTimeOffset_Error1_Impl(true);
- }
-
- private void Delay_DateTimeOffset_Error1_Impl(bool useStopwatch)
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(250, 2),
- OnNext(350, 3),
- OnNext(450, 4),
- OnError<int>(550, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.Delay(new DateTimeOffset(250, TimeSpan.Zero), useStopwatch ? scheduler : scheduler.DisableOptimizations())
- );
-
- res.Messages.AssertEqual(
- OnNext(300, 2),
- OnNext(400, 3),
- OnNext(500, 4),
- OnError<int>(550, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 550)
- );
- }
-
- [TestMethod]
- public void Delay_TimeSpan_Error2()
- {
- Delay_TimeSpan_Error2_Impl(false);
- }
-
- [TestMethod]
- public void Delay_TimeSpan_Error2_Stopwatch()
- {
- Delay_TimeSpan_Error2_Impl(true);
- }
-
- private void Delay_TimeSpan_Error2_Impl(bool useStopwatch)
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(250, 2),
- OnNext(350, 3),
- OnNext(450, 4),
- OnError<int>(550, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.Delay(TimeSpan.FromTicks(150), useStopwatch ? scheduler : scheduler.DisableOptimizations())
- );
-
- res.Messages.AssertEqual(
- OnNext(400, 2),
- OnNext(500, 3),
- OnError<int>(550, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 550)
- );
- }
-
- [TestMethod]
- public void Delay_DateTimeOffset_Error2()
- {
- Delay_DateTimeOffset_Error2_Impl(false);
- }
-
- [TestMethod]
- public void Delay_DateTimeOffset_Error2_Stopwatch()
- {
- Delay_DateTimeOffset_Error2_Impl(true);
- }
-
- private void Delay_DateTimeOffset_Error2_Impl(bool useStopwatch)
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(250, 2),
- OnNext(350, 3),
- OnNext(450, 4),
- OnError<int>(550, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.Delay(new DateTimeOffset(350, TimeSpan.Zero), useStopwatch ? scheduler : scheduler.DisableOptimizations())
- );
-
- res.Messages.AssertEqual(
- OnNext(400, 2),
- OnNext(500, 3),
- OnError<int>(550, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 550)
- );
- }
-
- [TestMethod]
- public void Delay_TimeSpan_Real_Simple1()
- {
- Delay_TimeSpan_Real_Simple1_Impl(ThreadPoolScheduler.Instance.DisableOptimizations());
- }
-
- [TestMethod]
- public void Delay_TimeSpan_Real_Simple1_Stopwatch()
- {
- Delay_TimeSpan_Real_Simple1_Impl(ThreadPoolScheduler.Instance);
- }
-
- private void Delay_TimeSpan_Real_Simple1_Impl(IScheduler scheduler)
- {
- var s = new Subject<int>();
-
- var res = s.Delay(TimeSpan.FromMilliseconds(10), scheduler);
-
- var lst = new List<int>();
- var e = new ManualResetEvent(false);
- res.Subscribe(lst.Add, () => e.Set());
-
- new Thread(() =>
- {
- s.OnNext(1);
- s.OnNext(2);
- s.OnNext(3);
- s.OnCompleted();
- }).Start();
-
- e.WaitOne();
- Assert.IsTrue(new[] { 1, 2, 3 }.SequenceEqual(lst));
- }
-
- [TestMethod]
- public void Delay_TimeSpan_Real_Error1()
- {
- Delay_TimeSpan_Real_Error1_Impl(ThreadPoolScheduler.Instance.DisableOptimizations());
- }
-
- [TestMethod]
- public void Delay_TimeSpan_Real_Error1_Stopwatch()
- {
- Delay_TimeSpan_Real_Error1_Impl(ThreadPoolScheduler.Instance);
- }
-
- private void Delay_TimeSpan_Real_Error1_Impl(IScheduler scheduler)
- {
- var ex = new Exception();
-
- var s = new Subject<int>();
-
- var res = s.Delay(TimeSpan.FromMilliseconds(10), scheduler);
-
- var e = new ManualResetEvent(false);
- var err = default(Exception);
- res.Subscribe(_ => { }, ex_ => { err = ex_; e.Set(); });
-
- new Thread(() =>
- {
- s.OnNext(1);
- s.OnNext(2);
- s.OnNext(3);
- s.OnError(ex);
- }).Start();
-
- e.WaitOne();
- Assert.AreSame(ex, err);
- }
-
- [TestMethod]
- public void Delay_TimeSpan_Real_Error2()
- {
- Delay_TimeSpan_Real_Error2_Impl(ThreadPoolScheduler.Instance.DisableOptimizations());
- }
-
- [TestMethod]
- public void Delay_TimeSpan_Real_Error2_Stopwatch()
- {
- Delay_TimeSpan_Real_Error2_Impl(ThreadPoolScheduler.Instance);
- }
-
- private void Delay_TimeSpan_Real_Error2_Impl(IScheduler scheduler)
- {
- var ex = new Exception();
-
- var s = new Subject<int>();
-
- var res = s.Delay(TimeSpan.FromMilliseconds(10), scheduler);
-
- var next = new ManualResetEvent(false);
- var e = new ManualResetEvent(false);
- var err = default(Exception);
- res.Subscribe(_ => { next.Set(); }, ex_ => { err = ex_; e.Set(); });
-
- new Thread(() =>
- {
- s.OnNext(1);
- next.WaitOne();
-
- s.OnError(ex);
- }).Start();
-
- e.WaitOne();
- Assert.AreSame(ex, err);
- }
-
- [TestMethod]
- public void Delay_TimeSpan_Real_Error3()
- {
- Delay_TimeSpan_Real_Error3_Impl(ThreadPoolScheduler.Instance.DisableOptimizations());
- }
-
- [TestMethod]
- public void Delay_TimeSpan_Real_Error3_Stopwatch()
- {
- Delay_TimeSpan_Real_Error3_Impl(ThreadPoolScheduler.Instance);
- }
-
- private void Delay_TimeSpan_Real_Error3_Impl(IScheduler scheduler)
- {
- var ex = new Exception();
-
- var s = new Subject<int>();
-
- var res = s.Delay(TimeSpan.FromMilliseconds(10), scheduler);
-
- var next = new ManualResetEvent(false);
- var ack = new ManualResetEvent(false);
-
- var e = new ManualResetEvent(false);
- var err = default(Exception);
- res.Subscribe(_ => { next.Set(); ack.WaitOne(); }, ex_ => { err = ex_; e.Set(); });
-
- new Thread(() =>
- {
- s.OnNext(1);
- next.WaitOne();
-
- s.OnError(ex);
- ack.Set();
- }).Start();
-
- e.WaitOne();
- Assert.AreSame(ex, err);
- }
-
- [TestMethod]
- public void Delay_TimeSpan_Positive()
- {
- var scheduler = new TestScheduler();
-
- var msgs = new[] {
- OnNext(150, 1),
- OnNext(250, 2),
- OnNext(350, 3),
- OnNext(450, 4),
- OnCompleted<int>(550)
- };
-
- var xs = scheduler.CreateHotObservable(msgs);
-
- const ushort delay = 42;
-
- var res = scheduler.Start(() =>
- xs.Delay(TimeSpan.FromTicks(delay), scheduler)
- );
-
- var expected = from n in msgs
- where n.Time > ObservableTest.Subscribed
- select new Recorded<Notification<int>>((ushort)(n.Time + delay), n.Value);
-
- res.Messages.AssertEqual(expected);
- }
-
- [TestMethod]
- public void Delay_Empty()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnCompleted<int>(550)
- );
-
- var res = scheduler.Start(() =>
- xs.Delay(TimeSpan.FromTicks(10), scheduler)
- );
-
- res.Messages.AssertEqual(
- OnCompleted<int>(560)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 550)
- );
- }
-
- [TestMethod]
- public void Delay_Error()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnError<int>(550, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.Delay(TimeSpan.FromTicks(10), scheduler)
- );
-
- res.Messages.AssertEqual(
- OnError<int>(550, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 550)
- );
- }
-
- [TestMethod]
- public void Delay_Never()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1)
- );
-
- var res = scheduler.Start(() =>
- xs.Delay(TimeSpan.FromTicks(10), scheduler)
- );
-
- res.Messages.AssertEqual(
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
- }
-
- [TestMethod]
- public void Delay_TimeSpan_DefaultScheduler()
- {
- Assert.IsTrue(Observable.Return(1).Delay(TimeSpan.FromMilliseconds(1)).ToEnumerable().SequenceEqual(new[] { 1 }));
- }
-
- [TestMethod]
- public void Delay_DateTimeOffset_DefaultScheduler()
- {
- Assert.IsTrue(Observable.Return(1).Delay(DateTimeOffset.UtcNow + TimeSpan.FromMilliseconds(1)).ToEnumerable().SequenceEqual(new[] { 1 }));
- }
-
- [TestMethod]
- public void Delay_CrossingMessages()
- {
- var lst = new List<int>();
-
- var evt = new ManualResetEvent(false);
-
- var s = new Subject<int>();
- s.Delay(TimeSpan.FromSeconds(0.01)).Subscribe(x =>
- {
- lst.Add(x);
- if (x < 9)
- s.OnNext(x + 1);
- else
- s.OnCompleted();
- }, () =>
- {
- evt.Set();
- });
- s.OnNext(0);
-
- evt.WaitOne();
-
- Assert.IsTrue(Enumerable.Range(0, 10).SequenceEqual(lst));
- }
-
- [TestMethod]
- public void Delay_Duration_ArgumentChecking()
- {
- var someObservable = DummyObservable<int>.Instance;
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Delay(default(IObservable<int>), x => someObservable));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Delay(someObservable, default(Func<int, IObservable<int>>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Delay(default(IObservable<int>), someObservable, x => someObservable));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Delay(someObservable, default(IObservable<int>), x => someObservable));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Delay(someObservable, someObservable, default(Func<int, IObservable<int>>)));
- }
-
- [TestMethod]
- public void Delay_Duration_Simple1()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 10),
- OnNext(220, 30),
- OnNext(230, 50),
- OnNext(240, 35),
- OnNext(250, 20),
- OnCompleted<int>(260)
- );
-
- var res = scheduler.Start(() =>
- xs.Delay(x => scheduler.CreateColdObservable(new[] { OnNext(x, "!") }))
- );
-
- res.Messages.AssertEqual(
- OnNext(210 + 10, 10),
- OnNext(220 + 30, 30),
- OnNext(250 + 20, 20),
- OnNext(240 + 35, 35),
- OnNext(230 + 50, 50),
- OnCompleted<int>(280)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 260)
- );
- }
-
- [TestMethod]
- public void Delay_Duration_Simple2()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnNext(220, 3),
- OnNext(230, 4),
- OnNext(240, 5),
- OnNext(250, 6),
- OnCompleted<int>(300)
- );
-
- var ys = scheduler.CreateColdObservable(
- OnNext(10, "!")
- );
-
- var res = scheduler.Start(() =>
- xs.Delay(_ => ys)
- );
-
- res.Messages.AssertEqual(
- OnNext(210 + 10, 2),
- OnNext(220 + 10, 3),
- OnNext(230 + 10, 4),
- OnNext(240 + 10, 5),
- OnNext(250 + 10, 6),
- OnCompleted<int>(300)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 300)
- );
-
- ys.Subscriptions.AssertEqual(
- Subscribe(210, 220),
- Subscribe(220, 230),
- Subscribe(230, 240),
- Subscribe(240, 250),
- Subscribe(250, 260)
- );
- }
-
- [TestMethod]
- public void Delay_Duration_Simple3()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnNext(220, 3),
- OnNext(230, 4),
- OnNext(240, 5),
- OnNext(250, 6),
- OnCompleted<int>(300)
- );
-
- var ys = scheduler.CreateColdObservable(
- OnNext(100, "!")
- );
-
- var res = scheduler.Start(() =>
- xs.Delay(_ => ys)
- );
-
- res.Messages.AssertEqual(
- OnNext(210 + 100, 2),
- OnNext(220 + 100, 3),
- OnNext(230 + 100, 4),
- OnNext(240 + 100, 5),
- OnNext(250 + 100, 6),
- OnCompleted<int>(350)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 300)
- );
-
- ys.Subscriptions.AssertEqual(
- Subscribe(210, 310),
- Subscribe(220, 320),
- Subscribe(230, 330),
- Subscribe(240, 340),
- Subscribe(250, 350)
- );
- }
-
- [TestMethod]
- public void Delay_Duration_Simple4_InnerEmpty()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnNext(220, 3),
- OnNext(230, 4),
- OnNext(240, 5),
- OnNext(250, 6),
- OnCompleted<int>(300)
- );
-
- var ys = scheduler.CreateColdObservable(
- OnCompleted<int>(100)
- );
-
- var res = scheduler.Start(() =>
- xs.Delay(_ => ys)
- );
-
- res.Messages.AssertEqual(
- OnNext(210 + 100, 2),
- OnNext(220 + 100, 3),
- OnNext(230 + 100, 4),
- OnNext(240 + 100, 5),
- OnNext(250 + 100, 6),
- OnCompleted<int>(350)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 300)
- );
-
- ys.Subscriptions.AssertEqual(
- Subscribe(210, 310),
- Subscribe(220, 320),
- Subscribe(230, 330),
- Subscribe(240, 340),
- Subscribe(250, 350)
- );
- }
-
- [TestMethod]
- public void Delay_Duration_Dispose1()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnNext(220, 3),
- OnNext(230, 4),
- OnNext(240, 5),
- OnNext(250, 6),
- OnCompleted<int>(300)
- );
-
- var ys = scheduler.CreateColdObservable(
- OnNext(200, "!")
- );
-
- var res = scheduler.Start(() =>
- xs.Delay(_ => ys),
- 425
- );
-
- res.Messages.AssertEqual(
- OnNext(210 + 200, 2),
- OnNext(220 + 200, 3)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 300)
- );
-
- ys.Subscriptions.AssertEqual(
- Subscribe(210, 410),
- Subscribe(220, 420),
- Subscribe(230, 425),
- Subscribe(240, 425),
- Subscribe(250, 425)
- );
- }
-
- [TestMethod]
- public void Delay_Duration_Dispose2()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnNext(400, 3),
- OnCompleted<int>(500)
- );
-
- var ys = scheduler.CreateColdObservable(
- OnNext(50, "!")
- );
-
- var res = scheduler.Start(() =>
- xs.Delay(_ => ys),
- 300
- );
-
- res.Messages.AssertEqual(
- OnNext(210 + 50, 2)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 300)
- );
-
- ys.Subscriptions.AssertEqual(
- Subscribe(210, 260)
- );
- }
-
- [TestMethod]
- public void Delay_Duration_OuterError1()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnNext(220, 3),
- OnNext(230, 4),
- OnNext(240, 5),
- OnNext(250, 6),
- OnError<int>(300, ex)
- );
-
- var ys = scheduler.CreateColdObservable(
- OnNext(100, "!")
- );
-
- var res = scheduler.Start(() =>
- xs.Delay(_ => ys)
- );
-
- res.Messages.AssertEqual(
- OnError<int>(300, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 300)
- );
-
- ys.Subscriptions.AssertEqual(
- Subscribe(210, 300),
- Subscribe(220, 300),
- Subscribe(230, 300),
- Subscribe(240, 300),
- Subscribe(250, 300)
- );
- }
-
- [TestMethod]
- public void Delay_Duration_OuterError2()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnNext(220, 3),
- OnNext(230, 4),
- OnNext(240, 5),
- OnNext(250, 6),
- OnError<int>(300, ex)
- );
-
- var ys = scheduler.CreateColdObservable(
- OnNext(10, "!")
- );
-
- var res = scheduler.Start(() =>
- xs.Delay(_ => ys)
- );
-
- res.Messages.AssertEqual(
- OnNext(210 + 10, 2),
- OnNext(220 + 10, 3),
- OnNext(230 + 10, 4),
- OnNext(240 + 10, 5),
- OnNext(250 + 10, 6),
- OnError<int>(300, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 300)
- );
-
- ys.Subscriptions.AssertEqual(
- Subscribe(210, 220),
- Subscribe(220, 230),
- Subscribe(230, 240),
- Subscribe(240, 250),
- Subscribe(250, 260)
- );
- }
-
- [TestMethod]
- public void Delay_Duration_InnerError1()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnNext(220, 3),
- OnNext(230, 4),
- OnNext(240, 5),
- OnNext(250, 6),
- OnCompleted<int>(300)
- );
-
- var ys = scheduler.CreateColdObservable(
- OnNext(30, "!")
- );
-
- var zs = scheduler.CreateColdObservable(
- OnError<string>(25, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.Delay(x => x != 5 ? ys : zs)
- );
-
- res.Messages.AssertEqual(
- OnNext(210 + 30, 2),
- OnNext(220 + 30, 3),
- OnNext(230 + 30, 4),
- OnError<int>(240 + 25, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 265)
- );
-
- ys.Subscriptions.AssertEqual(
- Subscribe(210, 240),
- Subscribe(220, 250),
- Subscribe(230, 260),
- Subscribe(250, 265)
- );
- }
-
- [TestMethod]
- public void Delay_Duration_InnerError2()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnNext(220, 3),
- OnNext(230, 4),
- OnNext(240, 5),
- OnNext(250, 6),
- OnCompleted<int>(300)
- );
-
- var ys = scheduler.CreateColdObservable(
- OnError<string>(100, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.Delay(_ => ys)
- );
-
- res.Messages.AssertEqual(
- OnError<int>(210 + 100, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 300)
- );
-
- ys.Subscriptions.AssertEqual(
- Subscribe(210, 310),
- Subscribe(220, 310),
- Subscribe(230, 310),
- Subscribe(240, 310),
- Subscribe(250, 310)
- );
- }
-
- [TestMethod]
- public void Delay_Duration_SelectorThrows1()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(250, 2),
- OnNext(300, 3),
- OnNext(350, 4),
- OnNext(400, 5),
- OnNext(450, 6),
- OnCompleted<int>(500)
- );
-
- var ys = scheduler.CreateColdObservable(
- OnNext<string>(80, "")
- );
-
- var res = scheduler.Start(() =>
- xs.Delay(x =>
- {
- if (x == 4)
- throw ex;
-
- return ys;
- })
- );
-
- res.Messages.AssertEqual(
- OnNext(330, 2),
- OnError<int>(350, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 350)
- );
-
- ys.Subscriptions.AssertEqual(
- Subscribe(250, 330),
- Subscribe(300, 350)
- );
- }
-
- [TestMethod]
- public void Delay_Duration_Simple()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(250, 2),
- OnNext(350, 3),
- OnNext(450, 4),
- OnCompleted<int>(550)
- );
-
- var res = scheduler.Start(() =>
- xs.Delay(x =>
- scheduler.CreateColdObservable(
- OnNext(x * 10, "Ignore"),
- OnNext(x * 10 + 5, "Aargh!")
- )
- )
- );
-
- res.Messages.AssertEqual(
- OnNext<int>(250 + 2 * 10, 2),
- OnNext<int>(350 + 3 * 10, 3),
- OnNext<int>(450 + 4 * 10, 4),
- OnCompleted<int>(550)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 550)
- );
- }
-
- [TestMethod]
- public void Delay_Duration_DeferOnCompleted()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(250, 2),
- OnNext(350, 3),
- OnNext(450, 4),
- OnCompleted<int>(451)
- );
-
- var res = scheduler.Start(() =>
- xs.Delay(x =>
- scheduler.CreateColdObservable(
- OnNext(x * 10, "Ignore"),
- OnNext(x * 10 + 5, "Aargh!")
- )
- )
- );
-
- res.Messages.AssertEqual(
- OnNext<int>(250 + 2 * 10, 2),
- OnNext<int>(350 + 3 * 10, 3),
- OnNext<int>(450 + 4 * 10, 4),
- OnCompleted<int>(450 + 4 * 10)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 451)
- );
- }
-
- [TestMethod]
- public void Delay_Duration_InnerError()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(250, 2),
- OnNext(350, 3),
- OnNext(450, 4),
- OnCompleted<int>(451)
- );
-
- var ex = new Exception();
-
- var res = scheduler.Start(() =>
- xs.Delay(x =>
- x < 4 ? scheduler.CreateColdObservable(
- OnNext(x * 10, "Ignore"),
- OnNext(x * 10 + 5, "Aargh!")
- )
- : scheduler.CreateColdObservable(
- OnError<string>(x * 10, ex)
- )
- )
- );
-
- res.Messages.AssertEqual(
- OnNext<int>(250 + 2 * 10, 2),
- OnNext<int>(350 + 3 * 10, 3),
- OnError<int>(450 + 4 * 10, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 451)
- );
- }
-
- [TestMethod]
- public void Delay_Duration_OuterError()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(250, 2),
- OnNext(350, 3),
- OnNext(450, 4),
- OnError<int>(460, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.Delay(x =>
- scheduler.CreateColdObservable(
- OnNext(x * 10, "Ignore"),
- OnNext(x * 10 + 5, "Aargh!")
- )
- )
- );
-
- res.Messages.AssertEqual(
- OnNext<int>(250 + 2 * 10, 2),
- OnNext<int>(350 + 3 * 10, 3),
- OnError<int>(460, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 460)
- );
- }
-
- [TestMethod]
- public void Delay_Duration_SelectorThrows2()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(250, 2),
- OnNext(350, 3),
- OnNext(450, 4),
- OnCompleted<int>(550)
- );
-
- var ex = new Exception();
-
- var res = scheduler.Start(() =>
- xs.Delay(x =>
- {
- if (x < 4)
- {
- return scheduler.CreateColdObservable(
- OnNext(x * 10, "Ignore"),
- OnNext(x * 10 + 5, "Aargh!")
- );
- }
- else
- throw ex;
- })
- );
-
- res.Messages.AssertEqual(
- OnNext<int>(250 + 2 * 10, 2),
- OnNext<int>(350 + 3 * 10, 3),
- OnError<int>(450, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 450)
- );
- }
-
- [TestMethod]
- public void Delay_Duration_InnerDone()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(250, 2),
- OnNext(350, 3),
- OnNext(450, 4),
- OnCompleted<int>(550)
- );
-
- var ex = new Exception();
-
- var res = scheduler.Start(() =>
- xs.Delay(x =>
- scheduler.CreateColdObservable(
- OnCompleted<string>(x * 10)
- )
- )
- );
-
- res.Messages.AssertEqual(
- OnNext<int>(250 + 2 * 10, 2),
- OnNext<int>(350 + 3 * 10, 3),
- OnNext<int>(450 + 4 * 10, 4),
- OnCompleted<int>(550)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 550)
- );
- }
-
- [TestMethod]
- public void Delay_Duration_InnerSubscriptionTimes()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, -1),
- OnNext(250, 0),
- OnNext(350, 1),
- OnNext(450, 2),
- OnCompleted<int>(550)
- );
-
- var ys = new[] {
- scheduler.CreateColdObservable(
- OnNext(20, 42),
- OnNext(25, 99)
- ),
- scheduler.CreateColdObservable(
- OnNext(10, 43),
- OnNext(15, 99)
- ),
- scheduler.CreateColdObservable(
- OnNext(30, 44),
- OnNext(35, 99)
- ),
- };
-
- var res = scheduler.Start(() =>
- xs.Delay(x => ys[x])
- );
-
- res.Messages.AssertEqual(
- OnNext<int>(250 + 20, 0),
- OnNext<int>(350 + 10, 1),
- OnNext<int>(450 + 30, 2),
- OnCompleted<int>(550)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 550)
- );
-
- ys[0].Subscriptions.AssertEqual(Subscribe(250, 250 + 20));
- ys[1].Subscriptions.AssertEqual(Subscribe(350, 350 + 10));
- ys[2].Subscriptions.AssertEqual(Subscribe(450, 450 + 30));
- }
-
- [TestMethod]
- public void Delay_DurationAndSubscription_Simple1()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 10),
- OnNext(220, 30),
- OnNext(230, 50),
- OnNext(240, 35),
- OnNext(250, 20),
- OnCompleted<int>(260)
- );
-
- var ys = scheduler.CreateColdObservable(
- OnNext(10, "!")
- );
-
- var res = scheduler.Start(() =>
- xs.Delay(ys, x => scheduler.CreateColdObservable(new[] { OnNext(x, "!") }))
- );
-
- res.Messages.AssertEqual(
- OnNext(220 + 30, 30),
- OnNext(250 + 20, 20),
- OnNext(240 + 35, 35),
- OnNext(230 + 50, 50),
- OnCompleted<int>(280)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(210, 260)
- );
-
- ys.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void Delay_DurationAndSubscription_Simple2()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 10),
- OnNext(220, 30),
- OnNext(230, 50),
- OnNext(240, 35),
- OnNext(250, 20),
- OnCompleted<int>(260)
- );
-
- var ys = scheduler.CreateColdObservable(
- OnCompleted<string>(10)
- );
-
- var res = scheduler.Start(() =>
- xs.Delay(ys, x => scheduler.CreateColdObservable(new[] { OnNext(x, "!") }))
- );
-
- res.Messages.AssertEqual(
- OnNext(220 + 30, 30),
- OnNext(250 + 20, 20),
- OnNext(240 + 35, 35),
- OnNext(230 + 50, 50),
- OnCompleted<int>(280)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(210, 260)
- );
-
- ys.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void Delay_DurationAndSubscription_Dispose1()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 10),
- OnNext(220, 30),
- OnNext(230, 50),
- OnNext(240, 35),
- OnNext(250, 20),
- OnCompleted<int>(260)
- );
-
- var ys = scheduler.CreateColdObservable(
- OnNext<string>(10, "!")
- );
-
- var res = scheduler.Start(() =>
- xs.Delay(ys, x => scheduler.CreateColdObservable(new[] { OnNext(x, "!") })),
- 255
- );
-
- res.Messages.AssertEqual(
- OnNext(220 + 30, 30)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(210, 255)
- );
-
- ys.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void Delay_DurationAndSubscription_Dispose2()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 10),
- OnNext(220, 30),
- OnNext(230, 50),
- OnNext(240, 35),
- OnNext(250, 20),
- OnCompleted<int>(260)
- );
-
- var ys = scheduler.CreateColdObservable(
- OnNext<string>(100, "!")
- );
-
- var res = scheduler.Start(() =>
- xs.Delay(ys, x => scheduler.CreateColdObservable(new[] { OnNext(x, "!") })),
- 255
- );
-
- res.Messages.AssertEqual(
- );
-
- xs.Subscriptions.AssertEqual(
- );
-
- ys.Subscriptions.AssertEqual(
- Subscribe(200, 255)
- );
- }
-
- [TestMethod]
- public void Delay_DurationAndSubscription_Error()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 10),
- OnNext(220, 30),
- OnNext(230, 50),
- OnNext(240, 35),
- OnNext(250, 20),
- OnCompleted<int>(260)
- );
-
- var ys = scheduler.CreateColdObservable(
- OnError<string>(10, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.Delay(ys, x => scheduler.CreateColdObservable(new[] { OnNext(x, "!") }))
- );
-
- res.Messages.AssertEqual(
- OnError<int>(200 + 10, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- );
-
- ys.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void Delay_ErrorHandling1()
- {
- //
- // Checks for race condition between OnNext and OnError where the latter has a chance to
- // send out the OnError message before the former gets a chance to run in the delayed
- // queue. In that case, the OnNext message should not come out.
- //
- // See DrainQueue's first _hasFailed check.
- //
-
- var xs = Observable.Create<int>(observer =>
- {
- observer.OnNext(42);
- observer.OnError(new Exception());
- return () => { };
- });
-
- var s = new ImpulseScheduler();
-
- var called = false;
- var failed = new ManualResetEvent(false);
- xs.Delay(TimeSpan.FromDays(1), s).Subscribe(_ => { called = true; }, ex => { failed.Set(); });
-
- failed.WaitOne();
- s.Event.Set();
- s.Done.WaitOne();
-
- Assert.IsFalse(called);
- }
-
- class ImpulseScheduler : IScheduler
- {
- public DateTimeOffset Now
- {
- get { return DateTimeOffset.UtcNow; }
- }
-
- public IDisposable Schedule<TState>(TState state, Func<IScheduler, TState, IDisposable> action)
- {
- throw new NotImplementedException();
- }
-
- private ManualResetEvent _event = new ManualResetEvent(false);
- private ManualResetEvent _done = new ManualResetEvent(false);
-
- public ManualResetEvent Event { get { return _event; } }
- public ManualResetEvent Done { get { return _done; } }
-
- public IDisposable Schedule<TState>(TState state, TimeSpan dueTime, Func<IScheduler, TState, IDisposable> action)
- {
- Scheduler.Default.Schedule(() =>
- {
- _event.WaitOne();
- action(this, state);
- _done.Set();
- });
-
- return Disposable.Empty;
- }
-
- public IDisposable Schedule<TState>(TState state, DateTimeOffset dueTime, Func<IScheduler, TState, IDisposable> action)
- {
- throw new NotImplementedException();
- }
- }
-
- [TestMethod]
- public void Delay_LongRunning_CancelEarly()
- {
- var xs = Observable.Create<int>(observer =>
- {
- return Scheduler.Default.Schedule(TimeSpan.FromHours(1), () =>
- {
- observer.OnNext(42);
- });
- });
-
- var s = new ManualResetEvent(false);
- var e = new ManualResetEvent(false);
-
- var ys = xs.Delay(TimeSpan.Zero, new MyLongRunning1(s, e));
-
- var d = ys.Subscribe(_ => { });
-
- s.WaitOne();
- d.Dispose();
- e.WaitOne();
- }
-
- class MyLongRunning1 : LocalScheduler, ISchedulerLongRunning
- {
- private ManualResetEvent _start;
- private ManualResetEvent _stop;
-
- public MyLongRunning1(ManualResetEvent start, ManualResetEvent stop)
- {
- _start = start;
- _stop = stop;
- }
-
- public IDisposable ScheduleLongRunning<TState>(TState state, Action<TState, ICancelable> action)
- {
- var b = new BooleanDisposable();
- new Thread(() =>
- {
- _start.Set();
- action(state, b);
- _stop.Set();
- }).Start();
- return b;
- }
-
- public override IDisposable Schedule<TState>(TState state, TimeSpan dueTime, Func<IScheduler, TState, IDisposable> action)
- {
- throw new NotImplementedException();
- }
- }
-
- [TestMethod]
- public void Delay_LongRunning_CancelLate()
- {
- var xs = Observable.Return(42);
-
- var s = new ManualResetEvent(false);
- var e = new ManualResetEvent(false);
-
- var ys = xs.Delay(TimeSpan.FromHours(1), new MyLongRunning2(s, e));
-
- var d = ys.Subscribe(_ => { });
-
- s.WaitOne();
- d.Dispose();
- e.WaitOne();
- }
-
- class MyLongRunning2 : LocalScheduler, ISchedulerLongRunning
- {
- private ManualResetEvent _start;
- private ManualResetEvent _stop;
-
- public MyLongRunning2(ManualResetEvent start, ManualResetEvent stop)
- {
- _start = start;
- _stop = stop;
- }
-
- public IDisposable ScheduleLongRunning<TState>(TState state, Action<TState, ICancelable> action)
- {
- var b = new BooleanDisposable();
- new Thread(() =>
- {
- action(state, b);
- _stop.Set();
- }).Start();
- return b;
- }
-
- public override IDisposable Schedule<TState>(TState state, TimeSpan dueTime, Func<IScheduler, TState, IDisposable> action)
- {
- _start.Set();
- return Disposable.Empty;
- }
- }
-
- #endregion
-
- #region + DelaySubscription +
-
- [TestMethod]
- public void DelaySubscription_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.DelaySubscription(default(IObservable<int>), DateTimeOffset.Now));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.DelaySubscription(default(IObservable<int>), DateTimeOffset.Now, Scheduler.Immediate));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.DelaySubscription(DummyObservable<int>.Instance, DateTimeOffset.Now, default(IScheduler)));
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.DelaySubscription(default(IObservable<int>), TimeSpan.Zero));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.DelaySubscription(default(IObservable<int>), TimeSpan.Zero, Scheduler.Immediate));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.DelaySubscription(DummyObservable<int>.Instance, TimeSpan.Zero, default(IScheduler)));
-
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => Observable.DelaySubscription(DummyObservable<int>.Instance, TimeSpan.FromSeconds(-1)));
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => Observable.DelaySubscription(DummyObservable<int>.Instance, TimeSpan.FromSeconds(-1), Scheduler.Immediate));
- }
-
- [TestMethod]
- public void DelaySubscription_TimeSpan_Default()
- {
- var lst = new List<int>();
- Observable.Range(0, 10).DelaySubscription(TimeSpan.FromMilliseconds(1)).ForEach(lst.Add);
- Assert.IsTrue(Enumerable.Range(0, 10).SequenceEqual(lst));
- }
-
- [TestMethod]
- public void DelaySubscription_TimeSpan_Simple()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateColdObservable(
- OnNext(50, 42),
- OnNext(60, 43),
- OnCompleted<int>(70)
- );
-
- var res = scheduler.Start(() =>
- xs.DelaySubscription(TimeSpan.FromTicks(30), scheduler)
- );
-
- res.Messages.AssertEqual(
- OnNext(280, 42),
- OnNext(290, 43),
- OnCompleted<int>(300)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(230, 300)
- );
- }
-
- [TestMethod]
- public void DelaySubscription_TimeSpan_Error()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateColdObservable(
- OnNext(50, 42),
- OnNext(60, 43),
- OnError<int>(70, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.DelaySubscription(TimeSpan.FromTicks(30), scheduler)
- );
-
- res.Messages.AssertEqual(
- OnNext(280, 42),
- OnNext(290, 43),
- OnError<int>(300, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(230, 300)
- );
- }
-
- [TestMethod]
- public void DelaySubscription_DateTimeOffset_Default()
- {
- var lst = new List<int>();
- Observable.Range(0, 10).DelaySubscription(DateTimeOffset.UtcNow.AddMilliseconds(1)).ForEach(lst.Add);
- Assert.IsTrue(Enumerable.Range(0, 10).SequenceEqual(lst));
- }
-
- [TestMethod]
- public void DelaySubscription_DateTimeOffset_Simple()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateColdObservable(
- OnNext(50, 42),
- OnNext(60, 43),
- OnCompleted<int>(70)
- );
-
- var res = scheduler.Start(() =>
- xs.DelaySubscription(new DateTimeOffset(230, TimeSpan.Zero), scheduler)
- );
-
- res.Messages.AssertEqual(
- OnNext(280, 42),
- OnNext(290, 43),
- OnCompleted<int>(300)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(230, 300)
- );
- }
-
- [TestMethod]
- public void DelaySubscription_DateTimeOffset_Error()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateColdObservable(
- OnNext(50, 42),
- OnNext(60, 43),
- OnError<int>(70, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.DelaySubscription(new DateTimeOffset(230, TimeSpan.Zero), scheduler)
- );
-
- res.Messages.AssertEqual(
- OnNext(280, 42),
- OnNext(290, 43),
- OnError<int>(300, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(230, 300)
- );
- }
-
- #endregion
-
- #region + Generate +
-
- [TestMethod]
- public void Generate_TimeSpan_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Generate(0, DummyFunc<int, bool>.Instance, DummyFunc<int, int>.Instance, DummyFunc<int, int>.Instance, DummyFunc<int, TimeSpan>.Instance, (IScheduler)null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Generate(0, (Func<int, bool>)null, DummyFunc<int, int>.Instance, DummyFunc<int, int>.Instance, DummyFunc<int, TimeSpan>.Instance, DummyScheduler.Instance));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Generate(0, DummyFunc<int, bool>.Instance, DummyFunc<int, int>.Instance, (Func<int, int>)null, DummyFunc<int, TimeSpan>.Instance, DummyScheduler.Instance));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Generate(0, DummyFunc<int, bool>.Instance, (Func<int, int>)null, DummyFunc<int, int>.Instance, DummyFunc<int, TimeSpan>.Instance, DummyScheduler.Instance));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Generate(0, DummyFunc<int, bool>.Instance, DummyFunc<int, int>.Instance, DummyFunc<int, int>.Instance, (Func<int, TimeSpan>)null, DummyScheduler.Instance));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Generate(0, DummyFunc<int, bool>.Instance, DummyFunc<int, int>.Instance, DummyFunc<int, int>.Instance, DummyFunc<int, TimeSpan>.Instance, DummyScheduler.Instance).Subscribe(null));
- }
-
- [TestMethod]
- public void Generate_TimeSpan_Finite()
- {
- var scheduler = new TestScheduler();
-
- var res = scheduler.Start(() =>
- Observable.Generate(0, x => x <= 3, x => x + 1, x => x, x => TimeSpan.FromTicks(x + 1), scheduler)
- );
-
- res.Messages.AssertEqual(
- OnNext(202, 0),
- OnNext(204, 1),
- OnNext(207, 2),
- OnNext(211, 3),
- OnCompleted<int>(211)
- );
- }
-
- [TestMethod]
- public void Generate_TimeSpan_Throw_Condition()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var res = scheduler.Start(() =>
- Observable.Generate(0, new Func<int, bool>(x => { throw ex; }), x => x + 1, x => x, x => TimeSpan.FromTicks(x + 1), scheduler)
- );
-
- res.Messages.AssertEqual(
- OnError<int>(201, ex)
- );
- }
-
- [TestMethod]
- public void Generate_TimeSpan_Throw_ResultSelector()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var res = scheduler.Start(() =>
- Observable.Generate(0, x => true, x => x + 1, new Func<int, int>(x => { throw ex; }), x => TimeSpan.FromTicks(x + 1), scheduler)
- );
-
- res.Messages.AssertEqual(
- OnError<int>(201, ex)
- );
- }
-
- [TestMethod]
- public void Generate_TimeSpan_Throw_Iterate()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var res = scheduler.Start(() =>
- Observable.Generate(0, x => true, new Func<int, int>(x => { throw ex; }), x => x, x => TimeSpan.FromTicks(x + 1), scheduler)
- );
-
- res.Messages.AssertEqual(
- OnNext(202, 0),
- OnError<int>(202, ex)
- );
- }
-
- [TestMethod]
- public void Generate_TimeSpan_Throw_TimeSelector()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var res = scheduler.Start(() =>
- Observable.Generate(0, x => true, x => x + 1, x => x, new Func<int, TimeSpan>(x => { throw ex; }), scheduler)
- );
-
- res.Messages.AssertEqual(
- OnError<int>(201, ex)
- );
- }
-
- [TestMethod]
- public void Generate_TimeSpan_Dispose()
- {
- var scheduler = new TestScheduler();
-
- var res = scheduler.Start(() =>
- Observable.Generate(0, x => true, x => x + 1, x => x, x => TimeSpan.FromTicks(x + 1), scheduler),
- 210
- );
-
- res.Messages.AssertEqual(
- OnNext(202, 0),
- OnNext(204, 1),
- OnNext(207, 2)
- );
- }
-
- [TestMethod]
- public void Generate_TimeSpan_DefaultScheduler_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Generate(0, (Func<int, bool>)null, DummyFunc<int, int>.Instance, DummyFunc<int, int>.Instance, DummyFunc<int, TimeSpan>.Instance));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Generate(0, DummyFunc<int, bool>.Instance, DummyFunc<int, int>.Instance, (Func<int, int>)null, DummyFunc<int, TimeSpan>.Instance));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Generate(0, DummyFunc<int, bool>.Instance, (Func<int, int>)null, DummyFunc<int, int>.Instance, DummyFunc<int, TimeSpan>.Instance));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Generate(0, DummyFunc<int, bool>.Instance, DummyFunc<int, int>.Instance, DummyFunc<int, int>.Instance, (Func<int, TimeSpan>)null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Generate(0, DummyFunc<int, bool>.Instance, DummyFunc<int, int>.Instance, DummyFunc<int, int>.Instance, DummyFunc<int, TimeSpan>.Instance).Subscribe(null));
- }
-
- [TestMethod]
- public void Generate_TimeSpan_DefaultScheduler()
- {
- Observable.Generate(0, x => x < 10, x => x + 1, x => x, x => TimeSpan.FromMilliseconds(x)).AssertEqual(Observable.Generate(0, x => x < 10, x => x + 1, x => x, x => TimeSpan.FromMilliseconds(x), DefaultScheduler.Instance));
- }
-
- [TestMethod]
- public void Generate_DateTimeOffset_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Generate(0, DummyFunc<int, bool>.Instance, DummyFunc<int, int>.Instance, DummyFunc<int, int>.Instance, DummyFunc<int, DateTimeOffset>.Instance, (IScheduler)null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Generate(0, (Func<int, bool>)null, DummyFunc<int, int>.Instance, DummyFunc<int, int>.Instance, DummyFunc<int, DateTimeOffset>.Instance, DummyScheduler.Instance));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Generate(0, DummyFunc<int, bool>.Instance, DummyFunc<int, int>.Instance, (Func<int, int>)null, DummyFunc<int, DateTimeOffset>.Instance, DummyScheduler.Instance));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Generate(0, DummyFunc<int, bool>.Instance, (Func<int, int>)null, DummyFunc<int, int>.Instance, DummyFunc<int, DateTimeOffset>.Instance, DummyScheduler.Instance));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Generate(0, DummyFunc<int, bool>.Instance, DummyFunc<int, int>.Instance, DummyFunc<int, int>.Instance, (Func<int, DateTimeOffset>)null, DummyScheduler.Instance));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Generate(0, DummyFunc<int, bool>.Instance, DummyFunc<int, int>.Instance, DummyFunc<int, int>.Instance, DummyFunc<int, DateTimeOffset>.Instance, DummyScheduler.Instance).Subscribe(null));
- }
-
- [TestMethod]
- public void Generate_DateTimeOffset_Finite()
- {
- var scheduler = new TestScheduler();
-
- var res = scheduler.Start(() =>
- Observable.Generate(0, x => x <= 3, x => x + 1, x => x, x => scheduler.Now.AddTicks(x + 1), scheduler)
- );
-
- res.Messages.AssertEqual(
- OnNext(202, 0),
- OnNext(204, 1),
- OnNext(207, 2),
- OnNext(211, 3),
- OnCompleted<int>(211)
- );
- }
-
- [TestMethod]
- public void Generate_DateTimeOffset_Throw_Condition()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var res = scheduler.Start(() =>
- Observable.Generate(0, new Func<int, bool>(x => { throw ex; }), x => x + 1, x => x, x => scheduler.Now.AddTicks(x + 1), scheduler)
- );
-
- res.Messages.AssertEqual(
- OnError<int>(201, ex)
- );
- }
-
- [TestMethod]
- public void Generate_DateTimeOffset_Throw_ResultSelector()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var res = scheduler.Start(() =>
- Observable.Generate(0, x => true, x => x + 1, new Func<int, int>(x => { throw ex; }), x => scheduler.Now.AddTicks(x + 1), scheduler)
- );
-
- res.Messages.AssertEqual(
- OnError<int>(201, ex)
- );
- }
-
- [TestMethod]
- public void Generate_DateTimeOffset_Throw_Iterate()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var res = scheduler.Start(() =>
- Observable.Generate(0, x => true, new Func<int, int>(x => { throw ex; }), x => x, x => scheduler.Now.AddTicks(x + 1), scheduler)
- );
-
- res.Messages.AssertEqual(
- OnNext(202, 0),
- OnError<int>(202, ex)
- );
- }
-
- [TestMethod]
- public void Generate_DateTimeOffset_Throw_TimeSelector()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var res = scheduler.Start(() =>
- Observable.Generate(0, x => true, x => x + 1, x => x, new Func<int, DateTimeOffset>(x => { throw ex; }), scheduler)
- );
-
- res.Messages.AssertEqual(
- OnError<int>(201, ex)
- );
- }
-
- [TestMethod]
- public void Generate_DateTimeOffset_Dispose()
- {
- var scheduler = new TestScheduler();
-
- var res = scheduler.Start(() =>
- Observable.Generate(0, x => true, x => x + 1, x => x, x => scheduler.Now.AddTicks(x + 1), scheduler),
- 210
- );
-
- res.Messages.AssertEqual(
- OnNext(202, 0),
- OnNext(204, 1),
- OnNext(207, 2)
- );
- }
-
- [TestMethod]
- public void Generate_DateTimeOffset_DefaultScheduler_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Generate(0, (Func<int, bool>)null, DummyFunc<int, int>.Instance, DummyFunc<int, int>.Instance, DummyFunc<int, DateTimeOffset>.Instance));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Generate(0, DummyFunc<int, bool>.Instance, DummyFunc<int, int>.Instance, (Func<int, int>)null, DummyFunc<int, DateTimeOffset>.Instance));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Generate(0, DummyFunc<int, bool>.Instance, (Func<int, int>)null, DummyFunc<int, int>.Instance, DummyFunc<int, DateTimeOffset>.Instance));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Generate(0, DummyFunc<int, bool>.Instance, DummyFunc<int, int>.Instance, DummyFunc<int, int>.Instance, (Func<int, DateTimeOffset>)null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Generate(0, DummyFunc<int, bool>.Instance, DummyFunc<int, int>.Instance, DummyFunc<int, int>.Instance, DummyFunc<int, DateTimeOffset>.Instance).Subscribe(null));
- }
-
- [TestMethod]
- public void Generate_DateTimeOffset_DefaultScheduler()
- {
- Observable.Generate(0, x => x < 10, x => x + 1, x => x, x => DateTimeOffset.Now.AddMilliseconds(x)).AssertEqual(Observable.Generate(0, x => x < 10, x => x + 1, x => x, x => DateTimeOffset.Now.AddMilliseconds(x), DefaultScheduler.Instance));
- }
-
- #endregion
-
- #region + Interval +
-
- [TestMethod]
- public void Interval_TimeSpan_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Interval(TimeSpan.Zero, null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Interval(TimeSpan.Zero, DummyScheduler.Instance).Subscribe(null));
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => Observable.Interval(TimeSpan.FromSeconds(-1)));
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => Observable.Interval(TimeSpan.FromSeconds(-1), DummyScheduler.Instance));
- }
-
- [TestMethod]
- public void Interval_TimeSpan_Basic()
- {
- var scheduler = new TestScheduler();
-
- var res = scheduler.Start(() =>
- Observable.Interval(TimeSpan.FromTicks(100), scheduler)
- );
-
- res.Messages.AssertEqual(
- OnNext(300, 0L),
- OnNext(400, 1L),
- OnNext(500, 2L),
- OnNext(600, 3L),
- OnNext(700, 4L),
- OnNext(800, 5L),
- OnNext(900, 6L)
- );
- }
-
- [TestMethod]
- public void Interval_TimeSpan_Zero()
- {
- var scheduler = new TestScheduler();
-
- var res = scheduler.Start(() =>
- Observable.Interval(TimeSpan.FromTicks(0), scheduler),
- 210
- );
-
- res.Messages.AssertEqual(
- OnNext(201, 0L),
- OnNext(202, 1L),
- OnNext(203, 2L),
- OnNext(204, 3L),
- OnNext(205, 4L),
- OnNext(206, 5L),
- OnNext(207, 6L),
- OnNext(208, 7L),
- OnNext(209, 8L)
- );
- }
-
- [TestMethod]
- public void Interval_TimeSpan_Disposed()
- {
- var scheduler = new TestScheduler();
-
- var res = scheduler.Start(
- () => Observable.Interval(TimeSpan.FromTicks(1000), scheduler)
- );
-
- res.Messages.AssertEqual(
- );
- }
-
- [TestMethod]
- public void Interval_TimeSpan_ObserverThrows()
- {
- var scheduler = new TestScheduler();
-
- var xs = Observable.Interval(TimeSpan.FromTicks(1), scheduler);
-
- xs.Subscribe(x => { throw new InvalidOperationException(); });
-
- ReactiveAssert.Throws<InvalidOperationException>(() => scheduler.Start());
- }
-
- [TestMethod]
- public void Interval_TimeSpan_DefaultScheduler()
- {
- Assert.IsTrue(Observable.Interval(TimeSpan.FromMilliseconds(1)).ToEnumerable().Take(3).SequenceEqual(new[] { 0L, 1L, 2L }));
- }
-
- #endregion
-
- #region + Sample +
-
- [TestMethod]
- public void Sample_ArgumentChecking()
- {
- var scheduler = new TestScheduler();
- var someObservable = Observable.Empty<int>();
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Sample(default(IObservable<int>), TimeSpan.Zero));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Sample(default(IObservable<int>), TimeSpan.Zero, scheduler));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Sample(someObservable, TimeSpan.Zero, null));
-
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => Observable.Sample(someObservable, TimeSpan.FromSeconds(-1)));
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => Observable.Sample(someObservable, TimeSpan.FromSeconds(-1), scheduler));
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Sample(default(IObservable<int>), someObservable));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Sample(someObservable, default(IObservable<int>)));
- }
-
- [TestMethod]
- public void Sample_Regular()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnNext(230, 3),
- OnNext(260, 4),
- OnNext(300, 5),
- OnNext(350, 6),
- OnNext(380, 7),
- OnCompleted<int>(390)
- );
-
- var res = scheduler.Start(() =>
- xs.Sample(TimeSpan.FromTicks(50), scheduler)
- );
-
- res.Messages.AssertEqual(
- OnNext(250, 3),
- OnNext(300, 5), /* CHECK: boundary of sampling */
- OnNext(350, 6),
- OnNext(400, 7), /* Sample in last bucket */
- OnCompleted<int>(400)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 390)
- );
- }
-
- [TestMethod]
- public void Sample_Periodic_Regular()
- {
- var scheduler = new PeriodicTestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnNext(230, 3),
- OnNext(260, 4),
- OnNext(300, 5),
- OnNext(350, 6),
- OnNext(380, 7),
- OnCompleted<int>(390)
- );
-
- var res = scheduler.Start(() =>
- xs.Sample(TimeSpan.FromTicks(50), scheduler)
- );
-
- res.Messages.AssertEqual(
- OnNext(250, 3),
- OnNext(300, 5), /* CHECK: boundary of sampling */
- OnNext(350, 6),
- OnNext(400, 7), /* Sample in last bucket */
- OnCompleted<int>(400)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 390)
- );
-
- scheduler.Timers.AssertEqual(
- new TimerRun(200, 400) { 250, 300, 350, 400 }
- );
- }
-
- [TestMethod]
- public void Sample_ErrorInFlight()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnNext(230, 3),
- OnNext(260, 4),
- OnNext(300, 5),
- OnNext(310, 6),
- OnError<int>(330, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.Sample(TimeSpan.FromTicks(50), scheduler)
- );
-
- res.Messages.AssertEqual(
- OnNext(250, 3),
- OnNext(300, 5), /* CHECK: boundary of sampling */
- OnError<int>(330, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 330)
- );
- }
-
- [TestMethod]
- public void Sample_Periodic_ErrorInFlight()
- {
- var scheduler = new PeriodicTestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnNext(230, 3),
- OnNext(260, 4),
- OnNext(300, 5),
- OnNext(310, 6),
- OnError<int>(330, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.Sample(TimeSpan.FromTicks(50), scheduler)
- );
-
- res.Messages.AssertEqual(
- OnNext(250, 3),
- OnNext(300, 5), /* CHECK: boundary of sampling */
- OnError<int>(330, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 330)
- );
-
- scheduler.Timers.AssertEqual(
- new TimerRun(200, 330) { 250, 300 }
- );
- }
-
- [TestMethod]
- public void Sample_Empty()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnCompleted<int>(300)
- );
-
- var res = scheduler.Start(() =>
- xs.Sample(TimeSpan.FromTicks(50), scheduler)
- );
-
- res.Messages.AssertEqual(
- OnCompleted<int>(300)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 300)
- );
- }
-
- [TestMethod]
- public void Sample_Periodic_Empty()
- {
- var scheduler = new PeriodicTestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnCompleted<int>(300)
- );
-
- var res = scheduler.Start(() =>
- xs.Sample(TimeSpan.FromTicks(50), scheduler)
- );
-
- res.Messages.AssertEqual(
- OnCompleted<int>(300)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 300)
- );
-
- scheduler.Timers.AssertEqual(
- new TimerRun(200, 300) { 250, 300 }
- );
- }
-
- [TestMethod]
- public void Sample_Error()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnError<int>(300, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.Sample(TimeSpan.FromTicks(50), scheduler)
- );
-
- res.Messages.AssertEqual(
- OnError<int>(300, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 300)
- );
- }
-
- [TestMethod]
- public void Sample_Periodic_Error()
- {
- var scheduler = new PeriodicTestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnError<int>(300, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.Sample(TimeSpan.FromTicks(50), scheduler)
- );
-
- res.Messages.AssertEqual(
- OnError<int>(300, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 300)
- );
-
- scheduler.Timers.AssertEqual(
- new TimerRun(200, 300) { 250 }
- );
- }
-
- [TestMethod]
- public void Sample_Never()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1)
- );
-
- var res = scheduler.Start(() =>
- xs.Sample(TimeSpan.FromTicks(50), scheduler)
- );
-
- res.Messages.AssertEqual(
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
- }
-
- [TestMethod]
- public void Sample_Periodic_Never()
- {
- var scheduler = new PeriodicTestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1)
- );
-
- var res = scheduler.Start(() =>
- xs.Sample(TimeSpan.FromTicks(50), scheduler)
- );
-
- res.Messages.AssertEqual(
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
-
- scheduler.Timers.AssertEqual(
- new TimerRun(200, 1000) { 250, 300, 350, 400, 450, 500, 550, 600, 650, 700, 750, 800, 850, 900, 950 }
- );
- }
-
- [TestMethod]
- public void Sample_DefaultScheduler_Periodic()
- {
- var res = Observable.Return(42).Sample(TimeSpan.FromMilliseconds(1)).ToEnumerable().Single();
- Assert.AreEqual(42, res);
- }
-
- [TestMethod]
- public void Sample_DefaultScheduler_PeriodicDisabled()
- {
- var res = Observable.Return(42).Sample(TimeSpan.FromMilliseconds(1), Scheduler.Default.DisableOptimizations()).ToEnumerable().Single();
- Assert.AreEqual(42, res);
- }
-
- [TestMethod]
- public void Sample_Sampler_Simple1()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(220, 2),
- OnNext(240, 3),
- OnNext(290, 4),
- OnNext(300, 5),
- OnNext(310, 6),
- OnCompleted<int>(400)
- );
-
- var ys = scheduler.CreateHotObservable(
- OnNext(150, ""),
- OnNext(210, "bar"),
- OnNext(250, "foo"),
- OnNext(260, "qux"),
- OnNext(320, "baz"),
- OnCompleted<string>(500)
- );
-
- var res = scheduler.Start(() =>
- xs.Sample(ys)
- );
-
- res.Messages.AssertEqual(
- OnNext(250, 3),
- OnNext(320, 6),
- OnCompleted<int>(500 /* on sampling boundaries only */)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 400)
- );
-
- ys.Subscriptions.AssertEqual(
- Subscribe(200, 500)
- );
- }
-
- [TestMethod]
- public void Sample_Sampler_Simple2()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(220, 2),
- OnNext(240, 3),
- OnNext(290, 4),
- OnNext(300, 5),
- OnNext(310, 6),
- OnNext(360, 7),
- OnCompleted<int>(400)
- );
-
- var ys = scheduler.CreateHotObservable(
- OnNext(150, ""),
- OnNext(210, "bar"),
- OnNext(250, "foo"),
- OnNext(260, "qux"),
- OnNext(320, "baz"),
- OnCompleted<string>(500)
- );
-
- var res = scheduler.Start(() =>
- xs.Sample(ys)
- );
-
- res.Messages.AssertEqual(
- OnNext(250, 3),
- OnNext(320, 6),
- OnNext(500, 7),
- OnCompleted<int>(500 /* on sampling boundaries only */)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 400)
- );
-
- ys.Subscriptions.AssertEqual(
- Subscribe(200, 500)
- );
- }
-
- [TestMethod]
- public void Sample_Sampler_Simple3()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(220, 2),
- OnNext(240, 3),
- OnNext(290, 4),
- OnCompleted<int>(300)
- );
-
- var ys = scheduler.CreateHotObservable(
- OnNext(150, ""),
- OnNext(210, "bar"),
- OnNext(250, "foo"),
- OnNext(260, "qux"),
- OnNext(320, "baz"),
- OnCompleted<string>(500)
- );
-
- var res = scheduler.Start(() =>
- xs.Sample(ys)
- );
-
- res.Messages.AssertEqual(
- OnNext(250, 3),
- OnNext(320, 4),
- OnCompleted<int>(320 /* on sampling boundaries only */)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 300)
- );
-
- ys.Subscriptions.AssertEqual(
- Subscribe(200, 320)
- );
- }
-
- [TestMethod]
- public void Sample_Sampler_SourceThrows()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(220, 2),
- OnNext(240, 3),
- OnNext(290, 4),
- OnNext(300, 5),
- OnNext(310, 6),
- OnError<int>(320, ex)
- );
-
- var ys = scheduler.CreateHotObservable(
- OnNext(150, ""),
- OnNext(210, "bar"),
- OnNext(250, "foo"),
- OnNext(260, "qux"),
- OnNext(330, "baz"),
- OnCompleted<string>(400)
- );
-
- var res = scheduler.Start(() =>
- xs.Sample(ys)
- );
-
- res.Messages.AssertEqual(
- OnNext(250, 3),
- OnError<int>(320, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 320)
- );
-
- ys.Subscriptions.AssertEqual(
- Subscribe(200, 320)
- );
- }
-
-#if !NO_PERF // BREAKING CHANGE v2 > v1.x - behavior when sampler throws
- [TestMethod]
- public void Sample_Sampler_SamplerThrows()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(220, 2),
- OnNext(240, 3),
- OnNext(290, 4),
- OnNext(300, 5),
- OnNext(310, 6),
- OnCompleted<int>(400)
- );
-
- var ys = scheduler.CreateHotObservable(
- OnNext(150, ""),
- OnNext(210, "bar"),
- OnNext(250, "foo"),
- OnNext(260, "qux"),
- OnError<string>(320, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.Sample(ys)
- );
-
- res.Messages.AssertEqual(
- OnNext(250, 3),
- OnError<int>(320, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 320)
- );
-
- ys.Subscriptions.AssertEqual(
- Subscribe(200, 320)
- );
- }
-#endif
-
- #endregion
-
- #region + Skip +
-
- [TestMethod]
- public void Skip_ArgumentChecking()
- {
- var xs = Observable.Return(42);
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Skip(default(IObservable<int>), TimeSpan.FromSeconds(1)));
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => Observable.Skip(xs, TimeSpan.FromSeconds(-1)));
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Skip(default(IObservable<int>), TimeSpan.FromSeconds(1), Scheduler.Default));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Skip(xs, TimeSpan.FromSeconds(1), default(IScheduler)));
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => Observable.Skip(xs, TimeSpan.FromSeconds(-1), Scheduler.Default));
- }
-
- [TestMethod]
- public void Skip_Zero()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable<int>(
- OnNext(210, 1),
- OnNext(220, 2),
- OnCompleted<int>(230)
- );
-
- var res = scheduler.Start(() =>
- xs.Skip(TimeSpan.Zero, scheduler)
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 1),
- OnNext(220, 2),
- OnCompleted<int>(230)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 230)
- );
- }
-
- [TestMethod]
- public void Skip_Some()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable<int>(
- OnNext(210, 1),
- OnNext(220, 2),
- OnCompleted<int>(230)
- );
-
- var res = scheduler.Start(() =>
- xs.Skip(TimeSpan.FromTicks(15), scheduler)
- );
-
- res.Messages.AssertEqual(
- OnNext(220, 2),
- OnCompleted<int>(230)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 230)
- );
- }
-
- [TestMethod]
- public void Skip_Late()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable<int>(
- OnNext(210, 1),
- OnNext(220, 2),
- OnCompleted<int>(230)
- );
-
- var res = scheduler.Start(() =>
- xs.Skip(TimeSpan.FromTicks(50), scheduler)
- );
-
- res.Messages.AssertEqual(
- OnCompleted<int>(230)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 230)
- );
- }
-
- [TestMethod]
- public void Skip_Error()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable<int>(
- OnError<int>(210, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.Skip(TimeSpan.FromTicks(50), scheduler)
- );
-
- res.Messages.AssertEqual(
- OnError<int>(210, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void Skip_Never()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable<int>(
- );
-
- var res = scheduler.Start(() =>
- xs.Skip(TimeSpan.FromTicks(50), scheduler)
- );
-
- res.Messages.AssertEqual(
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
- }
-
- [TestMethod]
- public void Skip_Twice1()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable<int>(
- OnNext(210, 1),
- OnNext(220, 2),
- OnNext(230, 3),
- OnNext(240, 4),
- OnNext(250, 5),
- OnNext(260, 6),
- OnCompleted<int>(270)
- );
-
- var res = scheduler.Start(() =>
- xs.Skip(TimeSpan.FromTicks(15), scheduler).Skip(TimeSpan.FromTicks(30), scheduler)
- );
-
- res.Messages.AssertEqual(
- OnNext(240, 4),
- OnNext(250, 5),
- OnNext(260, 6),
- OnCompleted<int>(270)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 270)
- );
- }
-
- [TestMethod]
- public void Skip_Twice2()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable<int>(
- OnNext(210, 1),
- OnNext(220, 2),
- OnNext(230, 3),
- OnNext(240, 4),
- OnNext(250, 5),
- OnNext(260, 6),
- OnCompleted<int>(270)
- );
-
- var res = scheduler.Start(() =>
- xs.Skip(TimeSpan.FromTicks(30), scheduler).Skip(TimeSpan.FromTicks(15), scheduler)
- );
-
- res.Messages.AssertEqual(
- OnNext(240, 4),
- OnNext(250, 5),
- OnNext(260, 6),
- OnCompleted<int>(270)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 270)
- );
- }
-
- [TestMethod]
- public void Skip_Default()
- {
- var xs = Observable.Range(0, 10, Scheduler.Default);
-
- var res = xs.Skip(TimeSpan.FromSeconds(60));
-
- var e = new ManualResetEvent(false);
-
- var lst = new List<int>();
- res.Subscribe(
- lst.Add,
- () => e.Set()
- );
-
- e.WaitOne();
-
- Assert.IsTrue(lst.Count == 0);
- }
-
- #endregion
-
- #region + SkipLast +
-
- [TestMethod]
- public void SkipLast_ArgumentChecking()
- {
- var xs = Observable.Return(42);
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.SkipLast(default(IObservable<int>), TimeSpan.FromSeconds(1)));
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => Observable.SkipLast(xs, TimeSpan.FromSeconds(-1)));
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.SkipLast(default(IObservable<int>), TimeSpan.FromSeconds(1), Scheduler.Default));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.SkipLast(xs, TimeSpan.FromSeconds(1), default(IScheduler)));
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => Observable.SkipLast(xs, TimeSpan.FromSeconds(-1), Scheduler.Default));
- }
-
- [TestMethod]
- public void SkipLast_Zero1()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable<int>(
- OnNext(210, 1),
- OnNext(220, 2),
- OnCompleted<int>(230)
- );
-
- var res = scheduler.Start(() =>
- xs.SkipLast(TimeSpan.Zero, scheduler)
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 1),
- OnNext(220, 2),
- OnCompleted<int>(230)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 230)
- );
- }
-
- [TestMethod]
- public void SkipLast_Zero2()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable<int>(
- OnNext(210, 1),
- OnNext(220, 2),
- OnNext(230, 3),
- OnCompleted<int>(230)
- );
-
- var res = scheduler.Start(() =>
- xs.SkipLast(TimeSpan.Zero, scheduler)
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 1),
- OnNext(220, 2),
- OnNext(230, 3),
- OnCompleted<int>(230)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 230)
- );
- }
-
- [TestMethod]
- public void SkipLast_Some1()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable<int>(
- OnNext(210, 1),
- OnNext(220, 2),
- OnCompleted<int>(230)
- );
-
- var res = scheduler.Start(() =>
- xs.SkipLast(TimeSpan.FromTicks(15), scheduler)
- );
-
- res.Messages.AssertEqual(
- OnNext(230, 1),
- OnCompleted<int>(230)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 230)
- );
- }
-
- [TestMethod]
- public void SkipLast_Some2()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable<int>(
- OnNext(210, 1),
- OnNext(220, 2),
- OnNext(230, 3),
- OnNext(240, 4),
- OnNext(250, 5),
- OnNext(260, 6),
- OnNext(270, 7),
- OnNext(280, 8),
- OnNext(290, 9),
- OnCompleted<int>(300)
- );
-
- var res = scheduler.Start(() =>
- xs.SkipLast(TimeSpan.FromTicks(45), scheduler)
- );
-
- res.Messages.AssertEqual(
- OnNext(260, 1),
- OnNext(270, 2),
- OnNext(280, 3),
- OnNext(290, 4),
- OnNext(300, 5),
- OnCompleted<int>(300)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 300)
- );
- }
-
- [TestMethod]
- public void SkipLast_All()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable<int>(
- OnNext(210, 1),
- OnNext(220, 2),
- OnCompleted<int>(230)
- );
-
- var res = scheduler.Start(() =>
- xs.SkipLast(TimeSpan.FromTicks(50), scheduler)
- );
-
- res.Messages.AssertEqual(
- OnCompleted<int>(230)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 230)
- );
- }
-
- [TestMethod]
- public void SkipLast_Error()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable<int>(
- OnError<int>(210, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.SkipLast(TimeSpan.FromTicks(50), scheduler)
- );
-
- res.Messages.AssertEqual(
- OnError<int>(210, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void SkipLast_Never()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable<int>(
- );
-
- var res = scheduler.Start(() =>
- xs.SkipLast(TimeSpan.FromTicks(50), scheduler)
- );
-
- res.Messages.AssertEqual(
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
- }
-
- [TestMethod]
- public void SkipLast_Default1()
- {
- var xs = Observable.Range(0, 10, Scheduler.Default);
-
- var res = xs.SkipLast(TimeSpan.FromSeconds(60));
-
- var e = new ManualResetEvent(false);
-
- var lst = new List<int>();
- res.Subscribe(
- lst.Add,
- () => e.Set()
- );
-
- e.WaitOne();
-
- Assert.IsTrue(lst.Count == 0);
- }
-
- [TestMethod]
- public void SkipLast_Default2()
- {
- var xs = Observable.Range(0, 10, Scheduler.Default);
-
- var res = xs.SkipLast(TimeSpan.FromSeconds(60), Scheduler.Default.DisableOptimizations());
-
- var e = new ManualResetEvent(false);
-
- var lst = new List<int>();
- res.Subscribe(
- lst.Add,
- () => e.Set()
- );
-
- e.WaitOne();
-
- Assert.IsTrue(lst.Count == 0);
- }
-
- [TestMethod]
- public void SkipLast_Default3()
- {
- var xs = Observable.Range(0, 10, Scheduler.Default);
-
- var res = xs.SkipLast(TimeSpan.Zero);
-
- var e = new ManualResetEvent(false);
-
- var lst = new List<int>();
- res.Subscribe(
- lst.Add,
- () => e.Set()
- );
-
- e.WaitOne();
-
- Assert.IsTrue(lst.SequenceEqual(Enumerable.Range(0, 10)));
- }
-
- [TestMethod]
- public void SkipLast_Default4()
- {
- var xs = Observable.Range(0, 10, Scheduler.Default);
-
- var res = xs.SkipLast(TimeSpan.Zero, Scheduler.Default.DisableOptimizations());
-
- var e = new ManualResetEvent(false);
-
- var lst = new List<int>();
- res.Subscribe(
- lst.Add,
- () => e.Set()
- );
-
- e.WaitOne();
-
- Assert.IsTrue(lst.SequenceEqual(Enumerable.Range(0, 10)));
- }
-
- #endregion
-
- #region + SkipUntil +
-
- [TestMethod]
- public void SkipUntil_ArgumentChecking()
- {
- var xs = Observable.Return(42);
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.SkipUntil(default(IObservable<int>), DateTimeOffset.Now));
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.SkipUntil(default(IObservable<int>), DateTimeOffset.Now, Scheduler.Default));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.SkipUntil(xs, DateTimeOffset.Now, default(IScheduler)));
- }
-
- [TestMethod]
- public void SkipUntil_Zero()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable<int>(
- OnNext(210, 1),
- OnNext(220, 2),
- OnCompleted<int>(230)
- );
-
- var res = scheduler.Start(() =>
- xs.SkipUntil(new DateTimeOffset(), scheduler)
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 1),
- OnNext(220, 2),
- OnCompleted<int>(230)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 230)
- );
- }
-
- [TestMethod]
- public void SkipUntil_Some()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable<int>(
- OnNext(210, 1),
- OnNext(220, 2),
- OnCompleted<int>(230)
- );
-
- var res = scheduler.Start(() =>
- xs.SkipUntil(new DateTimeOffset(215, TimeSpan.Zero), scheduler)
- );
-
- res.Messages.AssertEqual(
- OnNext(220, 2),
- OnCompleted<int>(230)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 230)
- );
- }
-
- [TestMethod]
- public void SkipUntil_Late()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable<int>(
- OnNext(210, 1),
- OnNext(220, 2),
- OnCompleted<int>(230)
- );
-
- var res = scheduler.Start(() =>
- xs.SkipUntil(new DateTimeOffset(250, TimeSpan.Zero), scheduler)
- );
-
- res.Messages.AssertEqual(
- OnCompleted<int>(230)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 230)
- );
- }
-
- [TestMethod]
- public void SkipUntil_Error()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable<int>(
- OnError<int>(210, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.SkipUntil(new DateTimeOffset(250, TimeSpan.Zero), scheduler)
- );
-
- res.Messages.AssertEqual(
- OnError<int>(210, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void SkipUntil_Never()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable<int>(
- );
-
- var res = scheduler.Start(() =>
- xs.SkipUntil(new DateTimeOffset(250, TimeSpan.Zero), scheduler)
- );
-
- res.Messages.AssertEqual(
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
- }
-
- [TestMethod]
- public void SkipUntil_Twice1()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable<int>(
- OnNext(210, 1),
- OnNext(220, 2),
- OnNext(230, 3),
- OnNext(240, 4),
- OnNext(250, 5),
- OnNext(260, 6),
- OnCompleted<int>(270)
- );
-
- var res = scheduler.Start(() =>
- xs.SkipUntil(new DateTimeOffset(215, TimeSpan.Zero), scheduler).SkipUntil(new DateTimeOffset(230, TimeSpan.Zero), scheduler)
- );
-
- res.Messages.AssertEqual(
- OnNext(240, 4),
- OnNext(250, 5),
- OnNext(260, 6),
- OnCompleted<int>(270)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 270)
- );
- }
-
- [TestMethod]
- public void SkipUntil_Twice2()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable<int>(
- OnNext(210, 1),
- OnNext(220, 2),
- OnNext(230, 3),
- OnNext(240, 4),
- OnNext(250, 5),
- OnNext(260, 6),
- OnCompleted<int>(270)
- );
-
- var res = scheduler.Start(() =>
- xs.SkipUntil(new DateTimeOffset(230, TimeSpan.Zero), scheduler).SkipUntil(new DateTimeOffset(215, TimeSpan.Zero), scheduler)
- );
-
- res.Messages.AssertEqual(
- OnNext(240, 4),
- OnNext(250, 5),
- OnNext(260, 6),
- OnCompleted<int>(270)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 270)
- );
- }
-
- [TestMethod]
- public void SkipUntil_Default()
- {
- var xs = Observable.Range(0, 10, Scheduler.Default);
-
- var res = xs.SkipUntil(DateTimeOffset.UtcNow.AddMinutes(1));
-
- var e = new ManualResetEvent(false);
-
- var lst = new List<int>();
- res.Subscribe(
- lst.Add,
- () => e.Set()
- );
-
- e.WaitOne();
-
- Assert.IsTrue(lst.Count == 0);
- }
-
- #endregion
-
- #region + Take +
-
- [TestMethod]
- public void Take_ArgumentChecking()
- {
- var xs = Observable.Return(42);
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Take(default(IObservable<int>), TimeSpan.FromSeconds(1)));
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => Observable.Take(xs, TimeSpan.FromSeconds(-1)));
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Take(default(IObservable<int>), TimeSpan.FromSeconds(1), Scheduler.Default));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Take(xs, TimeSpan.FromSeconds(1), default(IScheduler)));
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => Observable.Take(xs, TimeSpan.FromSeconds(-1), Scheduler.Default));
- }
-
- [TestMethod]
- public void Take_Zero()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable<int>(
- OnNext(210, 1),
- OnNext(220, 2),
- OnCompleted<int>(230)
- );
-
- var res = scheduler.Start(() =>
- xs.Take(TimeSpan.Zero, scheduler)
- );
-
- res.Messages.AssertEqual(
- OnCompleted<int>(201)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 201)
- );
- }
-
- [TestMethod]
- public void Take_Some()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable<int>(
- OnNext(210, 1),
- OnNext(220, 2),
- OnNext(230, 3),
- OnCompleted<int>(240)
- );
-
- var res = scheduler.Start(() =>
- xs.Take(TimeSpan.FromTicks(25), scheduler)
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 1),
- OnNext(220, 2),
- OnCompleted<int>(225)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 225)
- );
- }
-
- [TestMethod]
- public void Take_Late()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable<int>(
- OnNext(210, 1),
- OnNext(220, 2),
- OnCompleted<int>(230)
- );
-
- var res = scheduler.Start(() =>
- xs.Take(TimeSpan.FromTicks(50), scheduler)
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 1),
- OnNext(220, 2),
- OnCompleted<int>(230)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 230)
- );
- }
-
- [TestMethod]
- public void Take_Error()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable<int>(
- OnError<int>(210, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.Take(TimeSpan.FromTicks(50), scheduler)
- );
-
- res.Messages.AssertEqual(
- OnError<int>(210, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void Take_Never()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable<int>(
- );
-
- var res = scheduler.Start(() =>
- xs.Take(TimeSpan.FromTicks(50), scheduler)
- );
-
- res.Messages.AssertEqual(
- OnCompleted<int>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void Take_Twice1()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable<int>(
- OnNext(210, 1),
- OnNext(220, 2),
- OnNext(230, 3),
- OnNext(240, 4),
- OnNext(250, 5),
- OnNext(260, 6),
- OnCompleted<int>(270)
- );
-
- var res = scheduler.Start(() =>
- xs.Take(TimeSpan.FromTicks(55), scheduler).Take(TimeSpan.FromTicks(35), scheduler)
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 1),
- OnNext(220, 2),
- OnNext(230, 3),
- OnCompleted<int>(235)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 235)
- );
- }
-
- [TestMethod]
- public void Take_Twice2()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable<int>(
- OnNext(210, 1),
- OnNext(220, 2),
- OnNext(230, 3),
- OnNext(240, 4),
- OnNext(250, 5),
- OnNext(260, 6),
- OnCompleted<int>(270)
- );
-
- var res = scheduler.Start(() =>
- xs.Take(TimeSpan.FromTicks(35), scheduler).Take(TimeSpan.FromTicks(55), scheduler)
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 1),
- OnNext(220, 2),
- OnNext(230, 3),
- OnCompleted<int>(235)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 235)
- );
- }
-
- [TestMethod]
- public void Take_Default()
- {
- var xs = Observable.Range(0, 10, Scheduler.Default);
-
- var res = xs.Take(TimeSpan.FromSeconds(60));
-
- var e = new ManualResetEvent(false);
-
- var lst = new List<int>();
- res.Subscribe(
- lst.Add,
- () => e.Set()
- );
-
- e.WaitOne();
-
- Assert.IsTrue(lst.SequenceEqual(Enumerable.Range(0, 10)));
- }
-
- #endregion
-
- #region + TakeLast +
-
- [TestMethod]
- public void TakeLast_ArgumentChecking()
- {
- var xs = Observable.Return(42);
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.TakeLast(default(IObservable<int>), TimeSpan.FromSeconds(1)));
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => Observable.TakeLast(xs, TimeSpan.FromSeconds(-1)));
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.TakeLast(default(IObservable<int>), TimeSpan.FromSeconds(1), Scheduler.Default));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.TakeLast(xs, TimeSpan.FromSeconds(1), default(IScheduler)));
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => Observable.TakeLast(xs, TimeSpan.FromSeconds(-1), Scheduler.Default));
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.TakeLast(default(IObservable<int>), TimeSpan.FromSeconds(1), Scheduler.Default, Scheduler.Default));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.TakeLast(xs, TimeSpan.FromSeconds(1), default(IScheduler), Scheduler.Default));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.TakeLast(xs, TimeSpan.FromSeconds(1), Scheduler.Default, default(IScheduler)));
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => Observable.TakeLast(xs, TimeSpan.FromSeconds(-1), Scheduler.Default, Scheduler.Default));
- }
-
- [TestMethod]
- public void TakeLast_Zero1()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable<int>(
- OnNext(210, 1),
- OnNext(220, 2),
- OnCompleted<int>(230)
- );
-
- var res = scheduler.Start(() =>
- xs.TakeLast(TimeSpan.Zero, scheduler)
- );
-
- res.Messages.AssertEqual(
- OnCompleted<int>(230)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 230)
- );
- }
-
- [TestMethod]
- public void TakeLast_Zero1_WithLoopScheduler()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable<int>(
- OnNext(210, 1),
- OnNext(220, 2),
- OnCompleted<int>(230)
- );
-
- var res = scheduler.Start(() =>
- xs.TakeLast(TimeSpan.Zero, scheduler, scheduler)
- );
-
- res.Messages.AssertEqual(
- OnCompleted<int>(231)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 230)
- );
- }
-
- [TestMethod]
- public void TakeLast_Zero2()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable<int>(
- OnNext(210, 1),
- OnNext(220, 2),
- OnNext(230, 3),
- OnCompleted<int>(230)
- );
-
- var res = scheduler.Start(() =>
- xs.TakeLast(TimeSpan.Zero, scheduler)
- );
-
- res.Messages.AssertEqual(
- OnCompleted<int>(230)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 230)
- );
- }
-
- [TestMethod]
- public void TakeLast_Zero2_WithLoopScheduler()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable<int>(
- OnNext(210, 1),
- OnNext(220, 2),
- OnNext(230, 3),
- OnCompleted<int>(230)
- );
-
- var res = scheduler.Start(() =>
- xs.TakeLast(TimeSpan.Zero, scheduler, scheduler)
- );
-
- res.Messages.AssertEqual(
- OnCompleted<int>(231)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 230)
- );
- }
-
- [TestMethod]
- public void TakeLast_Some1()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable<int>(
- OnNext(210, 1),
- OnNext(220, 2),
- OnNext(230, 3),
- OnCompleted<int>(240)
- );
-
- var res = scheduler.Start(() =>
- xs.TakeLast(TimeSpan.FromTicks(25), scheduler)
- );
-
- res.Messages.AssertEqual(
- OnNext(240, 2),
- OnNext(240, 3),
- OnCompleted<int>(240)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 240)
- );
- }
-
- [TestMethod]
- public void TakeLast_Some1_WithLoopScheduler()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable<int>(
- OnNext(210, 1),
- OnNext(220, 2),
- OnNext(230, 3),
- OnCompleted<int>(240)
- );
-
- var res = scheduler.Start(() =>
- xs.TakeLast(TimeSpan.FromTicks(25), scheduler, scheduler)
- );
-
- res.Messages.AssertEqual(
- OnNext(241, 2),
- OnNext(242, 3),
- OnCompleted<int>(243)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 240)
- );
- }
-
- [TestMethod]
- public void TakeLast_Some2()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable<int>(
- OnNext(210, 1),
- OnNext(220, 2),
- OnNext(230, 3),
- OnCompleted<int>(300)
- );
-
- var res = scheduler.Start(() =>
- xs.TakeLast(TimeSpan.FromTicks(25), scheduler)
- );
-
- res.Messages.AssertEqual(
- OnCompleted<int>(300)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 300)
- );
- }
-
- [TestMethod]
- public void TakeLast_Some2_WithLoopScheduler()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable<int>(
- OnNext(210, 1),
- OnNext(220, 2),
- OnNext(230, 3),
- OnCompleted<int>(300)
- );
-
- var res = scheduler.Start(() =>
- xs.TakeLast(TimeSpan.FromTicks(25), scheduler, scheduler)
- );
-
- res.Messages.AssertEqual(
- OnCompleted<int>(301)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 300)
- );
- }
-
- [TestMethod]
- public void TakeLast_Some3()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable<int>(
- OnNext(210, 1),
- OnNext(220, 2),
- OnNext(230, 3),
- OnNext(240, 4),
- OnNext(250, 5),
- OnNext(260, 6),
- OnNext(270, 7),
- OnNext(280, 8),
- OnNext(290, 9),
- OnCompleted<int>(300)
- );
-
- var res = scheduler.Start(() =>
- xs.TakeLast(TimeSpan.FromTicks(45), scheduler)
- );
-
- res.Messages.AssertEqual(
- OnNext(300, 6),
- OnNext(300, 7),
- OnNext(300, 8),
- OnNext(300, 9),
- OnCompleted<int>(300)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 300)
- );
- }
-
- [TestMethod]
- public void TakeLast_Some3_WithLoopScheduler()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable<int>(
- OnNext(210, 1),
- OnNext(220, 2),
- OnNext(230, 3),
- OnNext(240, 4),
- OnNext(250, 5),
- OnNext(260, 6),
- OnNext(270, 7),
- OnNext(280, 8),
- OnNext(290, 9),
- OnCompleted<int>(300)
- );
-
- var res = scheduler.Start(() =>
- xs.TakeLast(TimeSpan.FromTicks(45), scheduler, scheduler)
- );
-
- res.Messages.AssertEqual(
- OnNext(301, 6),
- OnNext(302, 7),
- OnNext(303, 8),
- OnNext(304, 9),
- OnCompleted<int>(305)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 300)
- );
- }
-
- [TestMethod]
- public void TakeLast_Some4()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable<int>(
- OnNext(210, 1),
- OnNext(240, 2),
- OnNext(250, 3),
- OnNext(280, 4),
- OnNext(290, 5),
- OnNext(300, 6),
- OnCompleted<int>(350)
- );
-
- var res = scheduler.Start(() =>
- xs.TakeLast(TimeSpan.FromTicks(25), scheduler)
- );
-
- res.Messages.AssertEqual(
- OnCompleted<int>(350)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 350)
- );
- }
-
- [TestMethod]
- public void TakeLast_Some4_WithLoopScheduler()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable<int>(
- OnNext(210, 1),
- OnNext(240, 2),
- OnNext(250, 3),
- OnNext(280, 4),
- OnNext(290, 5),
- OnNext(300, 6),
- OnCompleted<int>(350)
- );
-
- var res = scheduler.Start(() =>
- xs.TakeLast(TimeSpan.FromTicks(25), scheduler, scheduler)
- );
-
- res.Messages.AssertEqual(
- OnCompleted<int>(351)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 350)
- );
- }
-
- [TestMethod]
- public void TakeLast_All()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable<int>(
- OnNext(210, 1),
- OnNext(220, 2),
- OnCompleted<int>(230)
- );
-
- var res = scheduler.Start(() =>
- xs.TakeLast(TimeSpan.FromTicks(50), scheduler)
- );
-
- res.Messages.AssertEqual(
- OnNext(230, 1),
- OnNext(230, 2),
- OnCompleted<int>(230)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 230)
- );
- }
-
- [TestMethod]
- public void TakeLast_All_WithLoopScheduler()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable<int>(
- OnNext(210, 1),
- OnNext(220, 2),
- OnCompleted<int>(230)
- );
-
- var res = scheduler.Start(() =>
- xs.TakeLast(TimeSpan.FromTicks(50), scheduler, scheduler)
- );
-
- res.Messages.AssertEqual(
- OnNext(231, 1),
- OnNext(232, 2),
- OnCompleted<int>(233)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 230)
- );
- }
-
- [TestMethod]
- public void TakeLast_Error()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable<int>(
- OnError<int>(210, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.TakeLast(TimeSpan.FromTicks(50), scheduler)
- );
-
- res.Messages.AssertEqual(
- OnError<int>(210, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void TakeLast_Error_WithLoopScheduler()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable<int>(
- OnError<int>(210, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.TakeLast(TimeSpan.FromTicks(50), scheduler, scheduler)
- );
-
- res.Messages.AssertEqual(
- OnError<int>(210, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void TakeLast_Never()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable<int>(
- );
-
- var res = scheduler.Start(() =>
- xs.TakeLast(TimeSpan.FromTicks(50), scheduler)
- );
-
- res.Messages.AssertEqual(
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
- }
-
- [TestMethod]
- public void TakeLast_Never_WithLoopScheduler()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable<int>(
- );
-
- var res = scheduler.Start(() =>
- xs.TakeLast(TimeSpan.FromTicks(50), scheduler, scheduler)
- );
-
- res.Messages.AssertEqual(
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
- }
-
- [TestMethod]
- public void TakeLast_Default1()
- {
- var xs = Observable.Range(0, 10, Scheduler.Default);
-
- var res = xs.TakeLast(TimeSpan.FromSeconds(60));
-
- var e = new ManualResetEvent(false);
-
- var lst = new List<int>();
- res.Subscribe(
- lst.Add,
- () => e.Set()
- );
-
- e.WaitOne();
-
- Assert.IsTrue(lst.SequenceEqual(Enumerable.Range(0, 10)));
- }
-
- [TestMethod]
- public void TakeLast_Default2()
- {
- var xs = Observable.Range(0, 10, Scheduler.Default);
-
- var res = xs.TakeLast(TimeSpan.FromSeconds(60), Scheduler.Default.DisableOptimizations());
-
- var e = new ManualResetEvent(false);
-
- var lst = new List<int>();
- res.Subscribe(
- lst.Add,
- () => e.Set()
- );
-
- e.WaitOne();
-
- Assert.IsTrue(lst.SequenceEqual(Enumerable.Range(0, 10)));
- }
-
- [TestMethod]
- public void TakeLast_Default3()
- {
- var xs = Observable.Range(0, 10, Scheduler.Default);
-
- var res = xs.TakeLast(TimeSpan.Zero);
-
- var e = new ManualResetEvent(false);
-
- var lst = new List<int>();
- res.Subscribe(
- lst.Add,
- () => e.Set()
- );
-
- e.WaitOne();
-
- Assert.IsTrue(lst.Count == 0);
- }
-
- [TestMethod]
- public void TakeLast_Default4()
- {
- var xs = Observable.Range(0, 10, Scheduler.Default);
-
- var res = xs.TakeLast(TimeSpan.Zero, Scheduler.Default.DisableOptimizations());
-
- var e = new ManualResetEvent(false);
-
- var lst = new List<int>();
- res.Subscribe(
- lst.Add,
- () => e.Set()
- );
-
- e.WaitOne();
-
- Assert.IsTrue(lst.Count == 0);
- }
-
- [TestMethod]
- public void TakeLast_LongRunning_Regular()
- {
- var res = Observable.Range(0, 10, Scheduler.Default).TakeLast(TimeSpan.FromSeconds(60), Scheduler.Default, NewThreadScheduler.Default);
-
- var lst = new List<int>();
- res.ForEach(lst.Add);
-
- Assert.IsTrue(Enumerable.Range(0, 10).SequenceEqual(lst));
- }
-
- #endregion
-
- #region + TakeLastBuffer +
-
- [TestMethod]
- public void TakeLastBuffer_ArgumentChecking()
- {
- var xs = Observable.Return(42);
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.TakeLastBuffer(default(IObservable<int>), TimeSpan.FromSeconds(1)));
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => Observable.TakeLastBuffer(xs, TimeSpan.FromSeconds(-1)));
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.TakeLastBuffer(default(IObservable<int>), TimeSpan.FromSeconds(1), Scheduler.Default));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.TakeLastBuffer(xs, TimeSpan.FromSeconds(1), default(IScheduler)));
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => Observable.TakeLastBuffer(xs, TimeSpan.FromSeconds(-1), Scheduler.Default));
- }
-
- [TestMethod]
- public void TakeLastBuffer_Zero1()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable<int>(
- OnNext(210, 1),
- OnNext(220, 2),
- OnCompleted<int>(230)
- );
-
- var res = scheduler.Start(() =>
- xs.TakeLastBuffer(TimeSpan.Zero, scheduler)
- );
-
- res.Messages.AssertEqual(
- OnNext<IList<int>>(230, lst => lst.Count == 0),
- OnCompleted<IList<int>>(230)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 230)
- );
- }
-
- [TestMethod]
- public void TakeLastBuffer_Zero2()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable<int>(
- OnNext(210, 1),
- OnNext(220, 2),
- OnNext(230, 3),
- OnCompleted<int>(230)
- );
-
- var res = scheduler.Start(() =>
- xs.TakeLastBuffer(TimeSpan.Zero, scheduler)
- );
-
- res.Messages.AssertEqual(
- OnNext<IList<int>>(230, lst => lst.Count == 0),
- OnCompleted<IList<int>>(230)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 230)
- );
- }
-
- [TestMethod]
- public void TakeLastBuffer_Some1()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable<int>(
- OnNext(210, 1),
- OnNext(220, 2),
- OnNext(230, 3),
- OnCompleted<int>(240)
- );
-
- var res = scheduler.Start(() =>
- xs.TakeLastBuffer(TimeSpan.FromTicks(25), scheduler)
- );
-
- res.Messages.AssertEqual(
- OnNext<IList<int>>(240, lst => lst.SequenceEqual(new[] { 2, 3 })),
- OnCompleted<IList<int>>(240)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 240)
- );
- }
-
- [TestMethod]
- public void TakeLastBuffer_Some2()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable<int>(
- OnNext(210, 1),
- OnNext(220, 2),
- OnNext(230, 3),
- OnCompleted<int>(300)
- );
-
- var res = scheduler.Start(() =>
- xs.TakeLastBuffer(TimeSpan.FromTicks(25), scheduler)
- );
-
- res.Messages.AssertEqual(
- OnNext<IList<int>>(300, lst => lst.Count == 0),
- OnCompleted<IList<int>>(300)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 300)
- );
- }
-
- [TestMethod]
- public void TakeLastBuffer_Some3()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable<int>(
- OnNext(210, 1),
- OnNext(220, 2),
- OnNext(230, 3),
- OnNext(240, 4),
- OnNext(250, 5),
- OnNext(260, 6),
- OnNext(270, 7),
- OnNext(280, 8),
- OnNext(290, 9),
- OnCompleted<int>(300)
- );
-
- var res = scheduler.Start(() =>
- xs.TakeLastBuffer(TimeSpan.FromTicks(45), scheduler)
- );
-
- res.Messages.AssertEqual(
- OnNext<IList<int>>(300, lst => lst.SequenceEqual(new[] { 6, 7, 8, 9 })),
- OnCompleted<IList<int>>(300)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 300)
- );
- }
-
- [TestMethod]
- public void TakeLastBuffer_Some4()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable<int>(
- OnNext(210, 1),
- OnNext(240, 2),
- OnNext(250, 3),
- OnNext(280, 4),
- OnNext(290, 5),
- OnNext(300, 6),
- OnCompleted<int>(350)
- );
-
- var res = scheduler.Start(() =>
- xs.TakeLastBuffer(TimeSpan.FromTicks(25), scheduler)
- );
-
- res.Messages.AssertEqual(
- OnNext<IList<int>>(350, lst => lst.Count == 0),
- OnCompleted<IList<int>>(350)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 350)
- );
- }
-
- [TestMethod]
- public void TakeLastBuffer_All()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable<int>(
- OnNext(210, 1),
- OnNext(220, 2),
- OnCompleted<int>(230)
- );
-
- var res = scheduler.Start(() =>
- xs.TakeLastBuffer(TimeSpan.FromTicks(50), scheduler)
- );
-
- res.Messages.AssertEqual(
- OnNext<IList<int>>(230, lst => lst.SequenceEqual(new[] { 1, 2 })),
- OnCompleted<IList<int>>(230)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 230)
- );
- }
-
- [TestMethod]
- public void TakeLastBuffer_Error()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable<int>(
- OnError<int>(210, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.TakeLastBuffer(TimeSpan.FromTicks(50), scheduler)
- );
-
- res.Messages.AssertEqual(
- OnError<IList<int>>(210, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void TakeLastBuffer_Never()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable<int>(
- );
-
- var res = scheduler.Start(() =>
- xs.TakeLastBuffer(TimeSpan.FromTicks(50), scheduler)
- );
-
- res.Messages.AssertEqual(
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
- }
-
- [TestMethod]
- public void TakeLastBuffer_Default1()
- {
- var xs = Observable.Range(0, 10, Scheduler.Default);
-
- var res = xs.TakeLastBuffer(TimeSpan.FromSeconds(60)).SingleAsync();
-
- var e = new ManualResetEvent(false);
-
- var lst = default (IList<int>);
- res.Subscribe(
- x => lst = x,
- () => e.Set()
- );
-
- e.WaitOne();
-
- Assert.IsTrue(lst.SequenceEqual(Enumerable.Range(0, 10)));
- }
-
- [TestMethod]
- public void TakeLastBuffer_Default2()
- {
- var xs = Observable.Range(0, 10, Scheduler.Default);
-
- var res = xs.TakeLastBuffer(TimeSpan.FromSeconds(60), Scheduler.Default.DisableOptimizations()).SingleAsync();
-
- var e = new ManualResetEvent(false);
-
- var lst = default(IList<int>);
- res.Subscribe(
- x => lst = x,
- () => e.Set()
- );
-
- e.WaitOne();
-
- Assert.IsTrue(lst.SequenceEqual(Enumerable.Range(0, 10)));
- }
-
- [TestMethod]
- public void TakeLastBuffer_Default3()
- {
- var xs = Observable.Range(0, 10, Scheduler.Default);
-
- var res = xs.TakeLastBuffer(TimeSpan.Zero).SingleAsync();
-
- var e = new ManualResetEvent(false);
-
- var lst = default(IList<int>);
- res.Subscribe(
- x => lst = x,
- () => e.Set()
- );
-
- e.WaitOne();
-
- Assert.IsTrue(lst.Count == 0);
- }
-
- [TestMethod]
- public void TakeLastBuffer_Default4()
- {
- var xs = Observable.Range(0, 10, Scheduler.Default);
-
- var res = xs.TakeLastBuffer(TimeSpan.Zero, Scheduler.Default.DisableOptimizations()).SingleAsync();
-
- var e = new ManualResetEvent(false);
-
- var lst = default(IList<int>);
- res.Subscribe(
- x => lst = x,
- () => e.Set()
- );
-
- e.WaitOne();
-
- Assert.IsTrue(lst.Count == 0);
- }
-
- #endregion
-
- #region + TakeUntil +
-
- [TestMethod]
- public void TakeUntil_ArgumentChecking()
- {
- var xs = Observable.Return(42);
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.TakeUntil(default(IObservable<int>), DateTimeOffset.Now));
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.TakeUntil(default(IObservable<int>), DateTimeOffset.Now, Scheduler.Default));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.TakeUntil(xs, DateTimeOffset.Now, default(IScheduler)));
- }
-
- [TestMethod]
- public void TakeUntil_Zero()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable<int>(
- OnNext(210, 1),
- OnNext(220, 2),
- OnCompleted<int>(230)
- );
-
- var res = scheduler.Start(() =>
- xs.TakeUntil(new DateTimeOffset(), scheduler)
- );
-
- res.Messages.AssertEqual(
- OnCompleted<int>(201)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 201)
- );
- }
-
- [TestMethod]
- public void TakeUntil_Some()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable<int>(
- OnNext(210, 1),
- OnNext(220, 2),
- OnNext(230, 3),
- OnCompleted<int>(240)
- );
-
- var res = scheduler.Start(() =>
- xs.TakeUntil(new DateTimeOffset(225, TimeSpan.Zero), scheduler)
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 1),
- OnNext(220, 2),
- OnCompleted<int>(225)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 225)
- );
- }
-
- [TestMethod]
- public void TakeUntil_Late()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable<int>(
- OnNext(210, 1),
- OnNext(220, 2),
- OnCompleted<int>(230)
- );
-
- var res = scheduler.Start(() =>
- xs.TakeUntil(new DateTimeOffset(250, TimeSpan.Zero), scheduler)
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 1),
- OnNext(220, 2),
- OnCompleted<int>(230)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 230)
- );
- }
-
- [TestMethod]
- public void TakeUntil_Error()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable<int>(
- OnError<int>(210, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.TakeUntil(new DateTimeOffset(250, TimeSpan.Zero), scheduler)
- );
-
- res.Messages.AssertEqual(
- OnError<int>(210, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 210)
- );
- }
-
- [TestMethod]
- public void TakeUntil_Never()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable<int>(
- );
-
- var res = scheduler.Start(() =>
- xs.TakeUntil(new DateTimeOffset(250, TimeSpan.Zero), scheduler)
- );
-
- res.Messages.AssertEqual(
- OnCompleted<int>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
- }
-
- [TestMethod]
- public void TakeUntil_Twice1()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable<int>(
- OnNext(210, 1),
- OnNext(220, 2),
- OnNext(230, 3),
- OnNext(240, 4),
- OnNext(250, 5),
- OnNext(260, 6),
- OnCompleted<int>(270)
- );
-
- var res = scheduler.Start(() =>
- xs.TakeUntil(new DateTimeOffset(255, TimeSpan.Zero), scheduler).TakeUntil(new DateTimeOffset(235, TimeSpan.Zero), scheduler)
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 1),
- OnNext(220, 2),
- OnNext(230, 3),
- OnCompleted<int>(235)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 235)
- );
- }
-
- [TestMethod]
- public void TakeUntil_Twice2()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable<int>(
- OnNext(210, 1),
- OnNext(220, 2),
- OnNext(230, 3),
- OnNext(240, 4),
- OnNext(250, 5),
- OnNext(260, 6),
- OnCompleted<int>(270)
- );
-
- var res = scheduler.Start(() =>
- xs.TakeUntil(new DateTimeOffset(235, TimeSpan.Zero), scheduler).TakeUntil(new DateTimeOffset(255, TimeSpan.Zero), scheduler)
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 1),
- OnNext(220, 2),
- OnNext(230, 3),
- OnCompleted<int>(235)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 235)
- );
- }
-
- [TestMethod]
- public void TakeUntil_Default()
- {
- var xs = Observable.Range(0, 10, Scheduler.Default);
-
- var res = xs.TakeUntil(DateTimeOffset.Now.AddMinutes(1));
-
- var e = new ManualResetEvent(false);
-
- var lst = new List<int>();
- res.Subscribe(
- lst.Add,
- () => e.Set()
- );
-
- e.WaitOne();
-
- Assert.IsTrue(lst.SequenceEqual(Enumerable.Range(0, 10)));
- }
-
- #endregion
-
- #region + Throttle +
-
- [TestMethod]
- public void Throttle_ArgumentChecking()
- {
- var scheduler = new TestScheduler();
- var someObservable = Observable.Empty<int>();
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Throttle(default(IObservable<int>), TimeSpan.Zero));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Throttle(someObservable, TimeSpan.Zero, null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Throttle(default(IObservable<int>), TimeSpan.Zero, scheduler));
-
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => Observable.Throttle(someObservable, TimeSpan.FromSeconds(-1)));
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => Observable.Throttle(someObservable, TimeSpan.FromSeconds(-1), scheduler));
- }
-
- private IEnumerable<Recorded<Notification<T>>> Generate<T, S>(S seed, Func<S, bool> condition, Func<S, S> iterate, Func<S, Recorded<Notification<T>>> selector, Func<S, Recorded<Notification<T>>> final)
- {
- S s;
- for (s = seed; condition(s); s = iterate(s))
- yield return selector(s);
-
- yield return final(s);
- }
-
- [TestMethod]
- public void Throttle_TimeSpan_AllPass()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 0),
- OnNext(210, 1),
- OnNext(240, 2),
- OnNext(270, 3),
- OnNext(300, 4),
- OnCompleted<int>(400)
- );
-
- var res = scheduler.Start(() =>
- xs.Throttle(TimeSpan.FromTicks(20), scheduler)
- );
-
- res.Messages.AssertEqual(
- OnNext(230, 1),
- OnNext(260, 2),
- OnNext(290, 3),
- OnNext(320, 4),
- OnCompleted<int>(400)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 400)
- );
- }
-
- [TestMethod]
- public void Throttle_TimeSpan_AllPass_ErrorEnd()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 0),
- OnNext(210, 1),
- OnNext(240, 2),
- OnNext(270, 3),
- OnNext(300, 4),
- OnError<int>(400, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.Throttle(TimeSpan.FromTicks(20), scheduler)
- );
-
- res.Messages.AssertEqual(
- OnNext(230, 1),
- OnNext(260, 2),
- OnNext(290, 3),
- OnNext(320, 4),
- OnError<int>(400, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 400)
- );
- }
-
- [TestMethod]
- public void Throttle_TimeSpan_AllDrop()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 0),
- OnNext(210, 1),
- OnNext(240, 2),
- OnNext(270, 3),
- OnNext(300, 4),
- OnNext(330, 5),
- OnNext(360, 6),
- OnNext(390, 7),
- OnCompleted<int>(400)
- );
-
- var res = scheduler.Start(() =>
- xs.Throttle(TimeSpan.FromTicks(40), scheduler)
- );
-
- res.Messages.AssertEqual(
- OnNext(400, 7),
- OnCompleted<int>(400)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 400)
- );
- }
-
- [TestMethod]
- public void Throttle_TimeSpan_AllDrop_ErrorEnd()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 0),
- OnNext(210, 1),
- OnNext(240, 2),
- OnNext(270, 3),
- OnNext(300, 4),
- OnNext(330, 5),
- OnNext(360, 6),
- OnNext(390, 7),
- OnError<int>(400, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.Throttle(TimeSpan.FromTicks(40), scheduler)
- );
-
- res.Messages.AssertEqual(
- OnError<int>(400, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 400)
- );
- }
-
- [TestMethod]
- public void Throttle_Empty()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 0),
- OnCompleted<int>(300)
- );
-
- var res = scheduler.Start(() =>
- xs.Throttle(TimeSpan.FromTicks(10), scheduler)
- );
-
- res.Messages.AssertEqual(
- OnCompleted<int>(300)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 300)
- );
- }
-
- [TestMethod]
- public void Throttle_Error()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 0),
- OnError<int>(300, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.Throttle(TimeSpan.FromTicks(10), scheduler)
- );
-
- res.Messages.AssertEqual(
- OnError<int>(300, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 300)
- );
- }
-
- [TestMethod]
- public void Throttle_Never()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 0)
- );
-
- var res = scheduler.Start(() =>
- xs.Throttle(TimeSpan.FromTicks(10), scheduler)
- );
-
- res.Messages.AssertEqual(
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
- }
-
- [TestMethod]
- public void Throttle_Simple()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 0),
- OnNext(210, 1),
- OnNext(240, 2),
- OnNext(250, 3),
- OnNext(280, 4),
- OnCompleted<int>(300)
- );
-
- var res = scheduler.Start(() =>
- xs.Throttle(TimeSpan.FromTicks(20), scheduler)
- );
-
- res.Messages.AssertEqual(
- OnNext(230, 1),
- OnNext(270, 3),
- OnNext(300, 4),
- OnCompleted<int>(300)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 300)
- );
- }
-
- [TestMethod]
- public void Throttle_DefaultScheduler()
- {
- Assert.IsTrue(Observable.Return(1).Throttle(TimeSpan.FromMilliseconds(1)).ToEnumerable().SequenceEqual(new[] { 1 }));
- }
-
- [TestMethod]
- public void Throttle_Duration_ArgumentChecking()
- {
- var someObservable = DummyObservable<int>.Instance;
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Throttle(default(IObservable<int>), x => someObservable));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Throttle(someObservable, default(Func<int, IObservable<string>>)));
- }
-
- [TestMethod]
- public void Throttle_Duration_DelayBehavior()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, -1),
- OnNext(250, 0),
- OnNext(280, 1),
- OnNext(310, 2),
- OnNext(350, 3),
- OnNext(400, 4),
- OnCompleted<int>(550)
- );
-
- var ys = new[] {
- scheduler.CreateColdObservable(
- OnNext(20, 42),
- OnNext(25, 99)
- ),
- scheduler.CreateColdObservable(
- OnNext(20, 42),
- OnNext(25, 99)
- ),
- scheduler.CreateColdObservable(
- OnNext(20, 42),
- OnNext(25, 99)
- ),
- scheduler.CreateColdObservable(
- OnNext(20, 42),
- OnNext(25, 99)
- ),
- scheduler.CreateColdObservable(
- OnNext(20, 42),
- OnNext(25, 99)
- ),
- };
-
- var res = scheduler.Start(() =>
- xs.Throttle(x => ys[x])
- );
-
- res.Messages.AssertEqual(
- OnNext<int>(250 + 20, 0),
- OnNext<int>(280 + 20, 1),
- OnNext<int>(310 + 20, 2),
- OnNext<int>(350 + 20, 3),
- OnNext<int>(400 + 20, 4),
- OnCompleted<int>(550)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 550)
- );
-
- ys[0].Subscriptions.AssertEqual(Subscribe(250, 250 + 20));
- ys[1].Subscriptions.AssertEqual(Subscribe(280, 280 + 20));
- ys[2].Subscriptions.AssertEqual(Subscribe(310, 310 + 20));
- ys[3].Subscriptions.AssertEqual(Subscribe(350, 350 + 20));
- ys[4].Subscriptions.AssertEqual(Subscribe(400, 400 + 20));
- }
-
- [TestMethod]
- public void Throttle_Duration_ThrottleBehavior()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, -1),
- OnNext(250, 0),
- OnNext(280, 1),
- OnNext(310, 2),
- OnNext(350, 3),
- OnNext(400, 4),
- OnCompleted<int>(550)
- );
-
- var ys = new[] {
- scheduler.CreateColdObservable(
- OnNext(20, 42),
- OnNext(25, 99)
- ),
- scheduler.CreateColdObservable(
- OnNext(40, 42),
- OnNext(45, 99)
- ),
- scheduler.CreateColdObservable(
- OnNext(20, 42),
- OnNext(25, 99)
- ),
- scheduler.CreateColdObservable(
- OnNext(60, 42),
- OnNext(65, 99)
- ),
- scheduler.CreateColdObservable(
- OnNext(20, 42),
- OnNext(25, 99)
- ),
- };
-
- var res = scheduler.Start(() =>
- xs.Throttle(x => ys[x])
- );
-
- res.Messages.AssertEqual(
- OnNext<int>(250 + 20, 0),
- OnNext<int>(310 + 20, 2),
- OnNext<int>(400 + 20, 4),
- OnCompleted<int>(550)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 550)
- );
-
- ys[0].Subscriptions.AssertEqual(Subscribe(250, 250 + 20));
- ys[1].Subscriptions.AssertEqual(Subscribe(280, 310));
- ys[2].Subscriptions.AssertEqual(Subscribe(310, 310 + 20));
- ys[3].Subscriptions.AssertEqual(Subscribe(350, 400));
- ys[4].Subscriptions.AssertEqual(Subscribe(400, 400 + 20));
- }
-
- [TestMethod]
- public void Throttle_Duration_EarlyCompletion()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, -1),
- OnNext(250, 0),
- OnNext(280, 1),
- OnNext(310, 2),
- OnNext(350, 3),
- OnNext(400, 4),
- OnCompleted<int>(410)
- );
-
- var ys = new[] {
- scheduler.CreateColdObservable(
- OnNext(20, 42),
- OnNext(25, 99)
- ),
- scheduler.CreateColdObservable(
- OnNext(40, 42),
- OnNext(45, 99)
- ),
- scheduler.CreateColdObservable(
- OnNext(20, 42),
- OnNext(25, 99)
- ),
- scheduler.CreateColdObservable(
- OnNext(60, 42),
- OnNext(65, 99)
- ),
- scheduler.CreateColdObservable(
- OnNext(20, 42),
- OnNext(25, 99)
- ),
- };
-
- var res = scheduler.Start(() =>
- xs.Throttle(x => ys[x])
- );
-
- res.Messages.AssertEqual(
- OnNext<int>(250 + 20, 0),
- OnNext<int>(310 + 20, 2),
- OnNext<int>(410, 4),
- OnCompleted<int>(410)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 410)
- );
-
- ys[0].Subscriptions.AssertEqual(Subscribe(250, 250 + 20));
- ys[1].Subscriptions.AssertEqual(Subscribe(280, 310));
- ys[2].Subscriptions.AssertEqual(Subscribe(310, 310 + 20));
- ys[3].Subscriptions.AssertEqual(Subscribe(350, 400));
- ys[4].Subscriptions.AssertEqual(Subscribe(400, 410));
- }
-
- [TestMethod]
- public void Throttle_Duration_InnerError()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(250, 2),
- OnNext(350, 3),
- OnNext(450, 4),
- OnCompleted<int>(550)
- );
-
- var ex = new Exception();
-
- var res = scheduler.Start(() =>
- xs.Throttle(x =>
- x < 4 ? scheduler.CreateColdObservable(
- OnNext(x * 10, "Ignore"),
- OnNext(x * 10 + 5, "Aargh!")
- )
- : scheduler.CreateColdObservable(
- OnError<string>(x * 10, ex)
- )
- )
- );
-
- res.Messages.AssertEqual(
- OnNext<int>(250 + 2 * 10, 2),
- OnNext<int>(350 + 3 * 10, 3),
- OnError<int>(450 + 4 * 10, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 490)
- );
- }
-
- [TestMethod]
- public void Throttle_Duration_OuterError()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(250, 2),
- OnNext(350, 3),
- OnNext(450, 4),
- OnError<int>(460, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.Throttle(x =>
- scheduler.CreateColdObservable(
- OnNext(x * 10, "Ignore"),
- OnNext(x * 10 + 5, "Aargh!")
- )
- )
- );
-
- res.Messages.AssertEqual(
- OnNext<int>(250 + 2 * 10, 2),
- OnNext<int>(350 + 3 * 10, 3),
- OnError<int>(460, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 460)
- );
- }
-
- [TestMethod]
- public void Throttle_Duration_SelectorThrows()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(250, 2),
- OnNext(350, 3),
- OnNext(450, 4),
- OnCompleted<int>(550)
- );
-
- var ex = new Exception();
-
- var res = scheduler.Start(() =>
- xs.Throttle(x =>
- {
- if (x < 4)
- {
- return scheduler.CreateColdObservable(
- OnNext(x * 10, "Ignore"),
- OnNext(x * 10 + 5, "Aargh!")
- );
- }
- else
- throw ex;
- })
- );
-
- res.Messages.AssertEqual(
- OnNext<int>(250 + 2 * 10, 2),
- OnNext<int>(350 + 3 * 10, 3),
- OnError<int>(450, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 450)
- );
- }
-
- [TestMethod]
- public void Throttle_Duration_InnerDone_DelayBehavior()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(250, 2),
- OnNext(350, 3),
- OnNext(450, 4),
- OnCompleted<int>(550)
- );
-
- var ex = new Exception();
-
- var res = scheduler.Start(() =>
- xs.Throttle(x =>
- scheduler.CreateColdObservable(
- OnCompleted<string>(x * 10)
- )
- )
- );
-
- res.Messages.AssertEqual(
- OnNext<int>(250 + 2 * 10, 2),
- OnNext<int>(350 + 3 * 10, 3),
- OnNext<int>(450 + 4 * 10, 4),
- OnCompleted<int>(550)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 550)
- );
- }
-
- [TestMethod]
- public void Throttle_Duration_InnerDone_ThrottleBehavior()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(250, 2),
- OnNext(280, 3),
- OnNext(300, 4),
- OnNext(400, 5),
- OnNext(410, 6),
- OnCompleted<int>(550)
- );
-
- var ex = new Exception();
-
- var res = scheduler.Start(() =>
- xs.Throttle(x =>
- scheduler.CreateColdObservable(
- OnCompleted<string>(x * 10)
- )
- )
- );
-
- res.Messages.AssertEqual(
- OnNext<int>(250 + 2 * 10, 2),
- OnNext<int>(300 + 4 * 10, 4),
- OnNext<int>(410 + 6 * 10, 6),
- OnCompleted<int>(550)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 550)
- );
- }
-
- #endregion
-
- #region + TimeInterval +
-
- [TestMethod]
- public void TimeInterval_ArgumentChecking()
- {
- var scheduler = new TestScheduler();
- var someObservable = Observable.Empty<int>();
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.TimeInterval(default(IObservable<int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.TimeInterval(default(IObservable<int>), scheduler));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.TimeInterval(someObservable, null));
- }
-
- [TestMethod]
- public void TimeInterval_Regular()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnNext(230, 3),
- OnNext(260, 4),
- OnNext(300, 5),
- OnNext(350, 6),
- OnCompleted<int>(400)
- );
-
- var res = scheduler.Start(() =>
- xs.TimeInterval(scheduler.DisableOptimizations())
- );
-
- res.Messages.AssertEqual(
- OnNext(210, new TimeInterval<int>(2, TimeSpan.FromTicks(10))),
- OnNext(230, new TimeInterval<int>(3, TimeSpan.FromTicks(20))),
- OnNext(260, new TimeInterval<int>(4, TimeSpan.FromTicks(30))),
- OnNext(300, new TimeInterval<int>(5, TimeSpan.FromTicks(40))),
- OnNext(350, new TimeInterval<int>(6, TimeSpan.FromTicks(50))),
- OnCompleted<TimeInterval<int>>(400)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 400)
- );
- }
-
- [TestMethod]
- public void TimeInterval_Empty()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnCompleted<int>(300)
- );
-
- var res = scheduler.Start(() =>
- xs.TimeInterval(scheduler.DisableOptimizations())
- );
-
- res.Messages.AssertEqual(
- OnCompleted<TimeInterval<int>>(300)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 300)
- );
- }
-
- [TestMethod]
- public void TimeInterval_Error()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnError<int>(300, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.TimeInterval(scheduler.DisableOptimizations())
- );
-
- res.Messages.AssertEqual(
- OnError<TimeInterval<int>>(300, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 300)
- );
- }
-
- [TestMethod]
- public void TimeInterval_Never()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1)
- );
-
- var res = scheduler.Start(() =>
- xs.TimeInterval(scheduler.DisableOptimizations())
- );
-
- res.Messages.AssertEqual(
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
- }
-
- [TestMethod]
- public void TimeInterval_DefaultScheduler()
- {
- Assert.IsTrue(Observable.Return(1).TimeInterval().Count().First() == 1);
- }
-
- [TestMethod]
- public void TimeInterval_WithStopwatch_Regular()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnNext(230, 3),
- OnNext(260, 4),
- OnNext(300, 5),
- OnNext(350, 6),
- OnCompleted<int>(400)
- );
-
- var res = scheduler.Start(() =>
- xs.TimeInterval(scheduler)
- );
-
- res.Messages.AssertEqual(
- OnNext(210, new TimeInterval<int>(2, TimeSpan.FromTicks(10))),
- OnNext(230, new TimeInterval<int>(3, TimeSpan.FromTicks(20))),
- OnNext(260, new TimeInterval<int>(4, TimeSpan.FromTicks(30))),
- OnNext(300, new TimeInterval<int>(5, TimeSpan.FromTicks(40))),
- OnNext(350, new TimeInterval<int>(6, TimeSpan.FromTicks(50))),
- OnCompleted<TimeInterval<int>>(400)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 400)
- );
- }
-
- [TestMethod]
- public void TimeInterval_WithStopwatch_Empty()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnCompleted<int>(300)
- );
-
- var res = scheduler.Start(() =>
- xs.TimeInterval(scheduler)
- );
-
- res.Messages.AssertEqual(
- OnCompleted<TimeInterval<int>>(300)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 300)
- );
- }
-
- [TestMethod]
- public void TimeInterval_WithStopwatch_Error()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnError<int>(300, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.TimeInterval(scheduler)
- );
-
- res.Messages.AssertEqual(
- OnError<TimeInterval<int>>(300, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 300)
- );
- }
-
- [TestMethod]
- public void TimeInterval_WithStopwatch_Never()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1)
- );
-
- var res = scheduler.Start(() =>
- xs.TimeInterval(scheduler)
- );
-
- res.Messages.AssertEqual(
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
- }
-
- #endregion
-
- #region + Timeout +
-
- [TestMethod]
- public void Timeout_ArgumentChecking()
- {
- var scheduler = new TestScheduler();
- var someObservable = Observable.Empty<int>();
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Timeout(default(IObservable<int>), TimeSpan.Zero));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Timeout(default(IObservable<int>), TimeSpan.Zero, someObservable));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Timeout(someObservable, TimeSpan.Zero, default(IObservable<int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Timeout(default(IObservable<int>), new DateTimeOffset()));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Timeout(default(IObservable<int>), new DateTimeOffset(), someObservable));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Timeout(someObservable, new DateTimeOffset(), default(IObservable<int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Timeout(default(IObservable<int>), TimeSpan.Zero, scheduler));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Timeout(someObservable, TimeSpan.Zero, default(IScheduler)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Timeout(default(IObservable<int>), TimeSpan.Zero, someObservable, scheduler));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Timeout(someObservable, TimeSpan.Zero, someObservable, null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Timeout(someObservable, TimeSpan.Zero, default(IObservable<int>), scheduler));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Timeout(default(IObservable<int>), new DateTimeOffset(), scheduler));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Timeout(someObservable, new DateTimeOffset(), default(IScheduler)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Timeout(default(IObservable<int>), new DateTimeOffset(), someObservable, scheduler));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Timeout(someObservable, new DateTimeOffset(), someObservable, null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Timeout(someObservable, new DateTimeOffset(), default(IObservable<int>), scheduler));
-
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => Observable.Timeout(someObservable, TimeSpan.FromSeconds(-1)));
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => Observable.Timeout(someObservable, TimeSpan.FromSeconds(-1), scheduler));
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => Observable.Timeout(someObservable, TimeSpan.FromSeconds(-1), someObservable));
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => Observable.Timeout(someObservable, TimeSpan.FromSeconds(-1), someObservable, scheduler));
- }
-
- [TestMethod]
- public void Timeout_InTime()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnNext(230, 3),
- OnNext(260, 4),
- OnNext(300, 5),
- OnNext(350, 6),
- OnCompleted<int>(400)
- );
-
- var res = scheduler.Start(() =>
- xs.Timeout(TimeSpan.FromTicks(500), scheduler)
- );
-
- res.Messages.AssertEqual(
- OnNext(210, 2),
- OnNext(230, 3),
- OnNext(260, 4),
- OnNext(300, 5),
- OnNext(350, 6),
- OnCompleted<int>(400)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 400)
- );
- }
-
- [TestMethod]
- public void Timeout_DateTimeOffset_TimeoutOccurs_WithDefaultException()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(410, 1)
- );
-
- var res = scheduler.Start(() =>
- xs.Timeout(new DateTimeOffset(new DateTime(400), TimeSpan.Zero), scheduler)
- );
-
- res.Messages.AssertEqual(
- OnError<int>(400, ex => ex is TimeoutException)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 400)
- );
- }
-
- [TestMethod]
- public void Timeout_TimeSpan_TimeoutOccurs_WithDefaultException()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(410, 1)
- );
-
- var res = scheduler.Start(() =>
- xs.Timeout(TimeSpan.FromTicks(200), scheduler)
- );
-
- res.Messages.AssertEqual(
- OnError<int>(400, ex => ex is TimeoutException)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 400)
- );
- }
-
- [TestMethod]
- public void Timeout_TimeSpan_DefaultScheduler()
- {
- Assert.IsTrue(Observable.Return(1).Timeout(TimeSpan.FromSeconds(10)).ToEnumerable().Single() == 1);
- }
-
- [TestMethod]
- public void Timeout_TimeSpan_Observable_DefaultScheduler()
- {
- Assert.IsTrue(Observable.Return(1).Timeout(TimeSpan.FromSeconds(10), Observable.Return(2)).ToEnumerable().Single() == 1);
- }
-
- [TestMethod]
- public void Timeout_DateTimeOffset_DefaultScheduler()
- {
- Assert.IsTrue(Observable.Return(1).Timeout(DateTimeOffset.UtcNow + TimeSpan.FromSeconds(10)).ToEnumerable().Single() == 1);
- }
-
- [TestMethod]
- public void Timeout_DateTimeOffset_Observable_DefaultScheduler()
- {
- Assert.IsTrue(Observable.Return(1).Timeout(DateTimeOffset.UtcNow + TimeSpan.FromSeconds(10), Observable.Return(2)).ToEnumerable().Single() == 1);
- }
-
- [TestMethod]
- public void Timeout_TimeoutOccurs_1()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(70, 1),
- OnNext(130, 2),
- OnNext(310, 3),
- OnNext(400, 4),
- OnCompleted<int>(500)
- );
-
- var ys = scheduler.CreateColdObservable(
- OnNext(50, -1),
- OnNext(200, -2),
- OnNext(310, -3),
- OnCompleted<int>(320)
- );
-
- var res = scheduler.Start(() =>
- xs.Timeout(TimeSpan.FromTicks(100), ys, scheduler)
- );
-
- res.Messages.AssertEqual(
- OnNext(350, -1),
- OnNext(500, -2),
- OnNext(610, -3),
- OnCompleted<int>(620)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 300)
- );
-
- ys.Subscriptions.AssertEqual(
- Subscribe(300, 620)
- );
- }
-
- [TestMethod]
- public void Timeout_TimeoutOccurs_2()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(70, 1),
- OnNext(130, 2),
- OnNext(240, 3),
- OnNext(310, 4),
- OnNext(430, 5),
- OnCompleted<int>(500)
- );
-
- var ys = scheduler.CreateColdObservable(
- OnNext(50, -1),
- OnNext(200, -2),
- OnNext(310, -3),
- OnCompleted<int>(320)
- );
-
- var res = scheduler.Start(() =>
- xs.Timeout(TimeSpan.FromTicks(100), ys, scheduler)
- );
-
- res.Messages.AssertEqual(
- OnNext(240, 3),
- OnNext(310, 4),
- OnNext(460, -1),
- OnNext(610, -2),
- OnNext(720, -3),
- OnCompleted<int>(730)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 410)
- );
-
- ys.Subscriptions.AssertEqual(
- Subscribe(410, 730)
- );
- }
-
- [TestMethod]
- public void Timeout_TimeoutOccurs_Never()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(70, 1),
- OnNext(130, 2),
- OnNext(240, 3),
- OnNext(310, 4),
- OnNext(430, 5),
- OnCompleted<int>(500)
- );
-
- var ys = scheduler.CreateColdObservable<int>(
- );
-
- var res = scheduler.Start(() =>
- xs.Timeout(TimeSpan.FromTicks(100), ys, scheduler)
- );
-
- res.Messages.AssertEqual(
- OnNext(240, 3),
- OnNext(310, 4)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 410)
- );
-
- ys.Subscriptions.AssertEqual(
- Subscribe(410, 1000)
- );
- }
-
- [TestMethod]
- public void Timeout_TimeoutOccurs_Completed()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnCompleted<int>(500)
- );
-
- var ys = scheduler.CreateColdObservable(
- OnNext(100, -1)
- );
-
- var res = scheduler.Start(() =>
- xs.Timeout(TimeSpan.FromTicks(100), ys, scheduler)
- );
-
- res.Messages.AssertEqual(
- OnNext(400, -1)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 300)
- );
-
- ys.Subscriptions.AssertEqual(
- Subscribe(300, 1000)
- );
- }
-
- [TestMethod]
- public void Timeout_TimeoutOccurs_Error()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnError<int>(500, new Exception())
- );
-
- var ys = scheduler.CreateColdObservable(
- OnNext(100, -1)
- );
-
- var res = scheduler.Start(() =>
- xs.Timeout(TimeSpan.FromTicks(100), ys, scheduler)
- );
-
- res.Messages.AssertEqual(
- OnNext(400, -1)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 300)
- );
-
- ys.Subscriptions.AssertEqual(
- Subscribe(300, 1000)
- );
- }
-
- [TestMethod]
- public void Timeout_TimeoutOccurs_NextIsError()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext<int>(500, 42)
- );
-
- var ys = scheduler.CreateColdObservable(
- OnError<int>(100, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.Timeout(TimeSpan.FromTicks(100), ys, scheduler)
- );
-
- res.Messages.AssertEqual(
- OnError<int>(400, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 300)
- );
-
- ys.Subscriptions.AssertEqual(
- Subscribe(300, 400)
- );
- }
-
- [TestMethod]
- public void Timeout_TimeoutNotOccurs_Completed()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnCompleted<int>(250)
- );
-
- var ys = scheduler.CreateColdObservable(
- OnNext(100, -1)
- );
-
- var res = scheduler.Start(() =>
- xs.Timeout(TimeSpan.FromTicks(100), ys, scheduler)
- );
-
- res.Messages.AssertEqual(
- OnCompleted<int>(250)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
-
- ys.Subscriptions.AssertEqual(
- );
- }
-
- [TestMethod]
- public void Timeout_TimeoutNotOccurs_Error()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnError<int>(250, ex)
- );
-
- var ys = scheduler.CreateColdObservable(
- OnNext(100, -1)
- );
-
- var res = scheduler.Start(() =>
- xs.Timeout(TimeSpan.FromTicks(100), ys, scheduler)
- );
-
- res.Messages.AssertEqual(
- OnError<int>(250, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
-
- ys.Subscriptions.AssertEqual(
- );
- }
-
- [TestMethod]
- public void Timeout_TimeoutDoesNotOccur()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(70, 1),
- OnNext(130, 2),
- OnNext(240, 3),
- OnNext(320, 4),
- OnNext(410, 5),
- OnCompleted<int>(500)
- );
-
- var ys = scheduler.CreateColdObservable(
- OnNext(50, -1),
- OnNext(200, -2),
- OnNext(310, -3),
- OnCompleted<int>(320)
- );
-
- var res = scheduler.Start(() =>
- xs.Timeout(TimeSpan.FromTicks(100), ys, scheduler)
- );
-
- res.Messages.AssertEqual(
- OnNext(240, 3),
- OnNext(320, 4),
- OnNext(410, 5),
- OnCompleted<int>(500)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 500)
- );
-
- ys.Subscriptions.AssertEqual(
- );
- }
-
- [TestMethod]
- public void Timeout_DateTimeOffset_TimeoutOccurs()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(410, 1)
- );
-
- var ys = scheduler.CreateColdObservable(
- OnNext(100, -1)
- );
-
- var res = scheduler.Start(() =>
- xs.Timeout(new DateTimeOffset(new DateTime(400), TimeSpan.Zero), ys, scheduler)
- );
-
- res.Messages.AssertEqual(
- OnNext(500, -1)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 400)
- );
-
- ys.Subscriptions.AssertEqual(
- Subscribe(400, 1000)
- );
- }
-
- [TestMethod]
- public void Timeout_DateTimeOffset_TimeoutDoesNotOccur_Completed()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(310, 1),
- OnCompleted<int>(390)
- );
-
- var ys = scheduler.CreateColdObservable(
- OnNext(100, -1)
- );
-
- var res = scheduler.Start(() =>
- xs.Timeout(new DateTimeOffset(new DateTime(400), TimeSpan.Zero), ys, scheduler)
- );
-
- res.Messages.AssertEqual(
- OnNext(310, 1),
- OnCompleted<int>(390)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 390)
- );
-
- ys.Subscriptions.AssertEqual(
- );
- }
-
- [TestMethod]
- public void Timeout_DateTimeOffset_TimeoutDoesNotOccur_Error()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(310, 1),
- OnError<int>(390, ex)
- );
-
- var ys = scheduler.CreateColdObservable(
- OnNext(100, -1)
- );
-
- var res = scheduler.Start(() =>
- xs.Timeout(new DateTimeOffset(new DateTime(400), TimeSpan.Zero), ys, scheduler)
- );
-
- res.Messages.AssertEqual(
- OnNext(310, 1),
- OnError<int>(390, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 390)
- );
-
- ys.Subscriptions.AssertEqual(
- );
- }
-
- [TestMethod]
- public void Timeout_DateTimeOffset_TimeoutOccur_2()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(310, 1),
- OnNext(350, 2),
- OnNext(420, 3),
- OnCompleted<int>(450)
- );
-
- var ys = scheduler.CreateColdObservable(
- OnNext(100, -1)
- );
-
- var res = scheduler.Start(() =>
- xs.Timeout(new DateTimeOffset(new DateTime(400), TimeSpan.Zero), ys, scheduler)
- );
-
- res.Messages.AssertEqual(
- OnNext(310, 1),
- OnNext(350, 2),
- OnNext(500, -1)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 400)
- );
-
- ys.Subscriptions.AssertEqual(
- Subscribe(400, 1000)
- );
- }
-
- [TestMethod]
- public void Timeout_DateTimeOffset_TimeoutOccur_3()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(310, 1),
- OnNext(350, 2),
- OnNext(420, 3),
- OnCompleted<int>(450)
- );
-
- var ys = scheduler.CreateColdObservable<int>(
- );
-
- var res = scheduler.Start(() =>
- xs.Timeout(new DateTimeOffset(new DateTime(400), TimeSpan.Zero), ys, scheduler)
- );
-
- res.Messages.AssertEqual(
- OnNext(310, 1),
- OnNext(350, 2)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 400)
- );
-
- ys.Subscriptions.AssertEqual(
- Subscribe(400, 1000)
- );
- }
-
- [TestMethod]
- public void Timeout_Duration_ArgumentChecking()
- {
- var someObservable = Observable.Empty<int>();
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Timeout(default(IObservable<int>), someObservable, x => someObservable, someObservable));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Timeout(someObservable, default(IObservable<int>), x => someObservable, someObservable));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Timeout(someObservable, someObservable, default(Func<int, IObservable<int>>), someObservable));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Timeout(someObservable, someObservable, x => someObservable, default(IObservable<int>)));
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Timeout(default(IObservable<int>), someObservable, x => someObservable));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Timeout(someObservable, default(IObservable<int>), x => someObservable));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Timeout(someObservable, someObservable, default(Func<int, IObservable<int>>)));
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Timeout(default(IObservable<int>), x => someObservable, someObservable));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Timeout(someObservable, default(Func<int, IObservable<int>>), someObservable));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Timeout(someObservable, x => someObservable, default(IObservable<int>)));
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Timeout(default(IObservable<int>), x => someObservable));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Timeout(someObservable, default(Func<int, IObservable<int>>)));
- }
-
- [TestMethod]
- public void Timeout_Duration_Simple_Never()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(310, 1),
- OnNext(350, 2),
- OnNext(420, 3),
- OnCompleted<int>(450)
- );
-
- var ys = scheduler.CreateColdObservable<int>(
- );
-
- var res = scheduler.Start(() =>
- xs.Timeout(ys, _ => ys)
- );
-
- res.Messages.AssertEqual(
- OnNext(310, 1),
- OnNext(350, 2),
- OnNext(420, 3),
- OnCompleted<int>(450)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 450)
- );
-
- ys.Subscriptions.AssertEqual(
- Subscribe(200, 310),
- Subscribe(310, 350),
- Subscribe(350, 420),
- Subscribe(420, 450)
- );
- }
-
- [TestMethod]
- public void Timeout_Duration_Simple_TimeoutFirst()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(310, 1),
- OnNext(350, 2),
- OnNext(420, 3),
- OnCompleted<int>(450)
- );
-
- var ys = scheduler.CreateColdObservable<string>(
- OnNext(100, "Boo!")
- );
-
- var zs = scheduler.CreateColdObservable<string>(
- );
-
- var res = scheduler.Start(() =>
- xs.Timeout(ys, _ => zs)
- );
-
- res.Messages.AssertEqual(
- OnError<int>(300, ex => ex is TimeoutException)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 300)
- );
-
- ys.Subscriptions.AssertEqual(
- Subscribe(200, 300)
- );
-
- zs.Subscriptions.AssertEqual(
- );
- }
-
- [TestMethod]
- public void Timeout_Duration_Simple_TimeoutFirst_Other()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(310, 1),
- OnNext(350, 2),
- OnNext(420, 3),
- OnCompleted<int>(450)
- );
-
- var ys = scheduler.CreateColdObservable<string>(
- OnNext(100, "Boo!")
- );
-
- var zs = scheduler.CreateColdObservable<string>(
- );
-
- var ts = scheduler.CreateColdObservable<int>(
- OnNext(50, 42),
- OnCompleted<int>(70)
- );
-
- var res = scheduler.Start(() =>
- xs.Timeout(ys, _ => zs, ts)
- );
-
- res.Messages.AssertEqual(
- OnNext(350, 42),
- OnCompleted<int>(370)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 300)
- );
-
- ys.Subscriptions.AssertEqual(
- Subscribe(200, 300)
- );
-
- zs.Subscriptions.AssertEqual(
- );
-
- ts.Subscriptions.AssertEqual(
- Subscribe(300, 370)
- );
- }
-
- [TestMethod]
- public void Timeout_Duration_Simple_TimeoutLater()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(310, 1),
- OnNext(350, 2),
- OnNext(420, 3),
- OnCompleted<int>(450)
- );
-
- var ys = scheduler.CreateColdObservable<string>(
- );
-
- var zs = scheduler.CreateColdObservable<string>(
- OnNext(50, "Boo!")
- );
-
- var res = scheduler.Start(() =>
- xs.Timeout(ys, _ => zs)
- );
-
- res.Messages.AssertEqual(
- OnNext<int>(310, 1),
- OnNext<int>(350, 2),
- OnError<int>(400, ex => ex is TimeoutException)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 400)
- );
-
- ys.Subscriptions.AssertEqual(
- Subscribe(200, 310)
- );
-
- zs.Subscriptions.AssertEqual(
- Subscribe(310, 350),
- Subscribe(350, 400)
- );
- }
-
- [TestMethod]
- public void Timeout_Duration_Simple_TimeoutLater_Other()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(310, 1),
- OnNext(350, 2),
- OnNext(420, 3),
- OnCompleted<int>(450)
- );
-
- var ys = scheduler.CreateColdObservable<string>(
- );
-
- var zs = scheduler.CreateColdObservable<string>(
- OnNext(50, "Boo!")
- );
-
- var ts = scheduler.CreateColdObservable<int>(
- OnNext(50, 42),
- OnCompleted<int>(70)
- );
-
- var res = scheduler.Start(() =>
- xs.Timeout(ys, _ => zs, ts)
- );
-
- res.Messages.AssertEqual(
- OnNext(310, 1),
- OnNext(350, 2),
- OnNext(450, 42),
- OnCompleted<int>(470)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 400)
- );
-
- ys.Subscriptions.AssertEqual(
- Subscribe(200, 310)
- );
-
- zs.Subscriptions.AssertEqual(
- Subscribe(310, 350),
- Subscribe(350, 400)
- );
-
- ts.Subscriptions.AssertEqual(
- Subscribe(400, 470)
- );
- }
-
- [TestMethod]
- public void Timeout_Duration_Simple_TimeoutLater_NoFirst()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(310, 1),
- OnNext(350, 2),
- OnNext(420, 3),
- OnCompleted<int>(450)
- );
-
- var zs = scheduler.CreateColdObservable<string>(
- OnNext(50, "Boo!")
- );
-
- var res = scheduler.Start(() =>
- xs.Timeout(_ => zs)
- );
-
- res.Messages.AssertEqual(
- OnNext<int>(310, 1),
- OnNext<int>(350, 2),
- OnError<int>(400, ex => ex is TimeoutException)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 400)
- );
-
- zs.Subscriptions.AssertEqual(
- Subscribe(310, 350),
- Subscribe(350, 400)
- );
- }
-
- [TestMethod]
- public void Timeout_Duration_Simple_TimeoutLater_Other_NoFirst()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(310, 1),
- OnNext(350, 2),
- OnNext(420, 3),
- OnCompleted<int>(450)
- );
-
- var zs = scheduler.CreateColdObservable<string>(
- OnNext(50, "Boo!")
- );
-
- var ts = scheduler.CreateColdObservable<int>(
- OnNext(50, 42),
- OnCompleted<int>(70)
- );
-
- var res = scheduler.Start(() =>
- xs.Timeout(_ => zs, ts)
- );
-
- res.Messages.AssertEqual(
- OnNext(310, 1),
- OnNext(350, 2),
- OnNext(450, 42),
- OnCompleted<int>(470)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 400)
- );
-
- zs.Subscriptions.AssertEqual(
- Subscribe(310, 350),
- Subscribe(350, 400)
- );
-
- ts.Subscriptions.AssertEqual(
- Subscribe(400, 470)
- );
- }
-
- [TestMethod]
- public void Timeout_Duration_Simple_TimeoutByCompletion()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(310, 1),
- OnNext(350, 2),
- OnNext(420, 3),
- OnCompleted<int>(450)
- );
-
- var ys = scheduler.CreateColdObservable<string>(
- );
-
- var zs = scheduler.CreateColdObservable<string>(
- OnCompleted<string>(50)
- );
-
- var res = scheduler.Start(() =>
- xs.Timeout(ys, _ => zs)
- );
-
- res.Messages.AssertEqual(
- OnNext<int>(310, 1),
- OnNext<int>(350, 2),
- OnError<int>(400, ex => ex is TimeoutException)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 400)
- );
-
- ys.Subscriptions.AssertEqual(
- Subscribe(200, 310)
- );
-
- zs.Subscriptions.AssertEqual(
- Subscribe(310, 350),
- Subscribe(350, 400)
- );
- }
-
- [TestMethod]
- public void Timeout_Duration_Simple_SelectorThrows()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(310, 1),
- OnNext(350, 2),
- OnNext(420, 3),
- OnCompleted<int>(450)
- );
-
- var ys = scheduler.CreateColdObservable<string>(
- );
-
- var zs = scheduler.CreateColdObservable<string>(
- );
-
- var ex = new Exception();
-
- var res = scheduler.Start(() =>
- xs.Timeout(ys, x =>
- {
- if (x < 3)
- return zs;
- else
- throw ex;
- })
- );
-
- res.Messages.AssertEqual(
- OnNext(310, 1),
- OnNext(350, 2),
- OnNext(420, 3),
- OnError<int>(420, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 420)
- );
-
- ys.Subscriptions.AssertEqual(
- Subscribe(200, 310)
- );
-
- zs.Subscriptions.AssertEqual(
- Subscribe(310, 350),
- Subscribe(350, 420)
- );
- }
-
- [TestMethod]
- public void Timeout_Duration_Simple_InnerThrows()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(310, 1),
- OnNext(350, 2),
- OnNext(420, 3),
- OnCompleted<int>(450)
- );
-
- var ys = scheduler.CreateColdObservable<string>(
- );
-
- var zs = scheduler.CreateColdObservable<string>(
- OnError<string>(50, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.Timeout(ys, x => zs)
- );
-
- res.Messages.AssertEqual(
- OnNext(310, 1),
- OnNext(350, 2),
- OnError<int>(400, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 400)
- );
-
- ys.Subscriptions.AssertEqual(
- Subscribe(200, 310)
- );
-
- zs.Subscriptions.AssertEqual(
- Subscribe(310, 350),
- Subscribe(350, 400)
- );
- }
-
- [TestMethod]
- public void Timeout_Duration_Simple_FirstThrows()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(310, 1),
- OnNext(350, 2),
- OnNext(420, 3),
- OnCompleted<int>(450)
- );
-
- var ys = scheduler.CreateColdObservable<string>(
- OnError<string>(50, ex)
- );
-
- var zs = scheduler.CreateColdObservable<string>(
- );
-
- var res = scheduler.Start(() =>
- xs.Timeout(ys, x => zs)
- );
-
- res.Messages.AssertEqual(
- OnError<int>(250, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
-
- ys.Subscriptions.AssertEqual(
- Subscribe(200, 250)
- );
-
- zs.Subscriptions.AssertEqual(
- );
- }
-
- [TestMethod]
- public void Timeout_Duration_Simple_SourceThrows()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(310, 1),
- OnNext(350, 2),
- OnNext(420, 3),
- OnError<int>(450, ex)
- );
-
- var ys = scheduler.CreateColdObservable<string>(
- );
-
- var zs = scheduler.CreateColdObservable<string>(
- );
-
- var res = scheduler.Start(() =>
- xs.Timeout(ys, x => zs)
- );
-
- res.Messages.AssertEqual(
- OnNext(310, 1),
- OnNext(350, 2),
- OnNext(420, 3),
- OnError<int>(450, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 450)
- );
-
- ys.Subscriptions.AssertEqual(
- Subscribe(200, 310)
- );
-
- zs.Subscriptions.AssertEqual(
- Subscribe(310, 350),
- Subscribe(350, 420),
- Subscribe(420, 450)
- );
- }
-
- #endregion
-
- #region + Timer +
-
- [TestMethod]
- public void OneShotTimer_TimeSpan_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Timer(TimeSpan.Zero, null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Timer(TimeSpan.Zero, DummyScheduler.Instance).Subscribe(null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Timer(DateTimeOffset.Now, null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Timer(TimeSpan.Zero, TimeSpan.Zero, null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Timer(DateTimeOffset.Now, TimeSpan.Zero, null));
-
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => Observable.Timer(TimeSpan.Zero, TimeSpan.FromSeconds(-1)));
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => Observable.Timer(TimeSpan.Zero, TimeSpan.FromSeconds(-1), DummyScheduler.Instance));
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => Observable.Timer(DateTimeOffset.Now, TimeSpan.FromSeconds(-1)));
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => Observable.Timer(DateTimeOffset.Now, TimeSpan.FromSeconds(-1), DummyScheduler.Instance));
- }
-
- [TestMethod]
- public void OneShotTimer_TimeSpan_Basic()
- {
- var scheduler = new TestScheduler();
-
- var res = scheduler.Start(() =>
- Observable.Timer(TimeSpan.FromTicks(300), scheduler)
- );
-
- res.Messages.AssertEqual(
- OnNext(500, 0L),
- OnCompleted<long>(500)
- );
- }
-
- [TestMethod]
- public void OneShotTimer_TimeSpan_Zero()
- {
- var scheduler = new TestScheduler();
-
- var res = scheduler.Start(() =>
- Observable.Timer(TimeSpan.FromTicks(0), scheduler)
- );
-
- res.Messages.AssertEqual(
- OnNext(201, 0L),
- OnCompleted<long>(201)
- );
- }
-
- [TestMethod]
- public void OneShotTimer_TimeSpan_Negative()
- {
- var scheduler = new TestScheduler();
-
- var res = scheduler.Start(() =>
- Observable.Timer(TimeSpan.FromTicks(-1), scheduler)
- );
-
- res.Messages.AssertEqual(
- OnNext(201, 0L),
- OnCompleted<long>(201)
- );
- }
-
- [TestMethod]
- public void OneShotTimer_TimeSpan_Disposed()
- {
- var scheduler = new TestScheduler();
-
- var res = scheduler.Start(() =>
- Observable.Timer(TimeSpan.FromTicks(1000), scheduler)
- );
-
- res.Messages.AssertEqual(
- );
- }
-
- [TestMethod]
- public void OneShotTimer_TimeSpan_ObserverThrows()
- {
- var scheduler1 = new TestScheduler();
-
- var xs = Observable.Timer(TimeSpan.FromTicks(1), scheduler1);
-
- xs.Subscribe(x => { throw new InvalidOperationException(); });
-
- ReactiveAssert.Throws<InvalidOperationException>(() => scheduler1.Start());
-
- var scheduler2 = new TestScheduler();
-
- var ys = Observable.Timer(TimeSpan.FromTicks(1), scheduler2);
-
- ys.Subscribe(x => { }, ex => { }, () => { throw new InvalidOperationException(); });
-
- ReactiveAssert.Throws<InvalidOperationException>(() => scheduler2.Start());
- }
-
- [TestMethod]
- public void OneShotTimer_TimeSpan_DefaultScheduler()
- {
- Assert.IsTrue(Observable.Timer(TimeSpan.FromMilliseconds(1)).ToEnumerable().SequenceEqual(new[] { 0L }));
- }
-
- [TestMethod]
- public void OneShotTimer_DateTimeOffset_DefaultScheduler()
- {
- Assert.IsTrue(Observable.Timer(DateTimeOffset.UtcNow + TimeSpan.FromSeconds(1)).ToEnumerable().SequenceEqual(new[] { 0L }));
- }
-
- [TestMethod]
- public void OneShotTimer_TimeSpan_TimeSpan_DefaultScheduler()
- {
- Assert.IsTrue(Observable.Timer(TimeSpan.FromMilliseconds(1), TimeSpan.FromMilliseconds(1)).ToEnumerable().Take(2).SequenceEqual(new[] { 0L, 1L }));
- }
-
- [TestMethod]
- public void OneShotTimer_DateTimeOffset_TimeSpan_DefaultScheduler()
- {
- Assert.IsTrue(Observable.Timer(DateTimeOffset.UtcNow + TimeSpan.FromSeconds(1), TimeSpan.FromMilliseconds(1)).ToEnumerable().Take(2).SequenceEqual(new[] { 0L, 1L }));
- }
-
- [TestMethod]
- public void OneShotTimer_DateTimeOffset_Basic()
- {
- var scheduler = new TestScheduler();
-
- var res = scheduler.Start(() =>
- Observable.Timer(new DateTimeOffset(500, TimeSpan.Zero), scheduler)
- );
-
- res.Messages.AssertEqual(
- OnNext(500, 0L),
- OnCompleted<long>(500)
- );
- }
-
- [TestMethod]
- public void OneShotTimer_DateTimeOffset_Zero()
- {
- var scheduler = new TestScheduler();
-
- var res = scheduler.Start(() =>
- Observable.Timer(new DateTimeOffset(200, TimeSpan.Zero), scheduler)
- );
-
- res.Messages.AssertEqual(
- OnNext(201, 0L),
- OnCompleted<long>(201)
- );
- }
-
- [TestMethod]
- public void OneShotTimer_DateTimeOffset_Past()
- {
- var scheduler = new TestScheduler();
-
- var res = scheduler.Start(() =>
- Observable.Timer(new DateTimeOffset(0, TimeSpan.Zero), scheduler)
- );
-
- res.Messages.AssertEqual(
- OnNext(201, 0L),
- OnCompleted<long>(201)
- );
- }
-
- [TestMethod]
- public void RepeatingTimer_DateTimeOffset_TimeSpan_Simple()
- {
- var scheduler = new TestScheduler();
-
- var res = scheduler.Start(() =>
- Observable.Timer(new DateTimeOffset(300, TimeSpan.Zero), TimeSpan.FromTicks(100), scheduler),
- 0, 200, 750
- );
-
- res.Messages.AssertEqual(
- OnNext(300, 0L),
- OnNext(400, 1L),
- OnNext(500, 2L),
- OnNext(600, 3L),
- OnNext(700, 4L)
- );
- }
-
- [TestMethod]
- public void RepeatingTimer_TimeSpan_TimeSpan_Simple()
- {
- var scheduler = new TestScheduler();
-
- var res = scheduler.Start(() =>
- Observable.Timer(TimeSpan.FromTicks(100), TimeSpan.FromTicks(100), scheduler),
- 0, 200, 750
- );
-
- res.Messages.AssertEqual(
- OnNext(300, 0L),
- OnNext(400, 1L),
- OnNext(500, 2L),
- OnNext(600, 3L),
- OnNext(700, 4L)
- );
- }
-
- [TestMethod]
- public void RepeatingTimer_Periodic1()
- {
- var scheduler = new PeriodicTestScheduler();
-
- var res = scheduler.Start(() =>
- Observable.Timer(TimeSpan.FromTicks(50), TimeSpan.FromTicks(100), scheduler),
- 0, 200, 700
- );
-
- res.Messages.AssertEqual(
- OnNext(250, 0L),
- OnNext(350, 1L),
- OnNext(450, 2L),
- OnNext(550, 3L),
- OnNext(650, 4L)
- );
-
- scheduler.Timers.AssertEqual(
- new TimerRun(250, 700) { 350, 450, 550, 650 }
- );
- }
-
- [TestMethod]
- public void RepeatingTimer_Periodic2()
- {
- var scheduler = new PeriodicTestScheduler();
-
- var res = scheduler.Start(() =>
- Observable.Timer(TimeSpan.FromTicks(100), TimeSpan.FromTicks(100), scheduler),
- 0, 200, 750
- );
-
- res.Messages.AssertEqual(
- OnNext(300, 0L),
- OnNext(400, 1L),
- OnNext(500, 2L),
- OnNext(600, 3L),
- OnNext(700, 4L)
- );
-
- scheduler.Timers.AssertEqual(
- new TimerRun(200, 750) { 300, 400, 500, 600, 700 }
- );
- }
-
- [TestMethod]
- public void RepeatingTimer_UsingStopwatch_Slippage1()
- {
- var scheduler = new TestScheduler();
-
- var xs = default(IObservable<long>);
- scheduler.ScheduleAbsolute(100, () => { xs = Observable.Timer(TimeSpan.Zero, TimeSpan.FromTicks(100), scheduler); });
-
- var times = new List<long>();
-
- var onNext = new Action<long>(x =>
- {
- times.Add(scheduler.Clock);
-
- if (x == 0)
- {
- return;
- }
-
- if (x < 2)
- {
- scheduler.Sleep(50);
- return;
- }
-
- if (x < 4)
- {
- scheduler.Sleep(120);
- return;
- }
-
- if (x < 6)
- {
- scheduler.Sleep(50);
- return;
- }
-
- if (x < 8)
- {
- return;
- }
- });
-
- var d = default(IDisposable);
- scheduler.ScheduleAbsolute(200, () => { d = xs.Subscribe(onNext); });
-
- scheduler.ScheduleAbsolute(1000, () => { d.Dispose(); });
-
- scheduler.Start();
-
- times.AssertEqual(
- 201, // 1 off because of initial scheduling jump (InvokeStart)
- 301,
- 401,
- 522, // 2 off because of 401 + 120 + 1 scheduling tick
- 643, // 3 off because of 522 + 120 + 1 scheduling tick
- 701,
- 801,
- 901
- );
- }
-
- [TestMethod]
- public void RepeatingTimer_UsingStopwatch_Slippage2()
- {
- var scheduler = new TestScheduler();
-
- var xs = default(IObservable<long>);
- scheduler.ScheduleAbsolute(100, () => { xs = Observable.Timer(TimeSpan.FromTicks(100), TimeSpan.FromTicks(100), scheduler); });
-
- var times = new List<long>();
-
- var onNext = new Action<long>(x =>
- {
- times.Add(scheduler.Clock);
-
- if (x == 0)
- {
- return;
- }
-
- if (x < 2)
- {
- scheduler.Sleep(50);
- return;
- }
-
- if (x < 4)
- {
- scheduler.Sleep(120);
- return;
- }
-
- if (x < 6)
- {
- scheduler.Sleep(50);
- return;
- }
-
- if (x < 8)
- {
- return;
- }
- });
-
- var d = default(IDisposable);
- scheduler.ScheduleAbsolute(200, () => { d = xs.Subscribe(onNext); });
-
- scheduler.ScheduleAbsolute(1000, () => { d.Dispose(); });
-
- scheduler.Start();
-
- times.AssertEqual(
- 300,
- 400,
- 500,
- 621, // 1 off because of recursive scheduling beyond the target time
- 742, // 2 off because of 621 + 120 + 1 scheduling tick
- 800,
- 900
- );
- }
-
- [TestMethod]
- public void RepeatingTimer_UsingStopwatch_Slippage3_CatchUpFromLongInvokeStart()
- {
- var scheduler = new TestScheduler();
-
- var xs = default(IObservable<long>);
- scheduler.ScheduleAbsolute(100, () => { xs = Observable.Timer(TimeSpan.Zero, TimeSpan.FromTicks(100), scheduler); });
-
- var times = new List<long>();
-
- var onNext = new Action<long>(x =>
- {
- times.Add(scheduler.Clock);
-
- if (x == 0)
- {
- scheduler.Sleep(350);
- return;
- }
- });
-
- var d = default(IDisposable);
- scheduler.ScheduleAbsolute(200, () => { d = xs.Subscribe(onNext); });
-
- scheduler.ScheduleAbsolute(1000, () => { d.Dispose(); });
-
- scheduler.Start();
-
- times.AssertEqual(
- 201, // 1 off because of initial scheduling jump (InvokeStart)
- 551, // catching up after excessive delay of 350 (target was 300)
- 552, // catching up after excessive delay of 350 (target was 400)
- 553, // catching up after excessive delay of 350 (target was 500)
- 601, // back in sync
- 701,
- 801,
- 901
- );
- }
-
- [TestMethod]
- public void RepeatingTimer_UsingStopwatch_Slippage3_CatchUpFromLongInvokeStart_ThrowsFirst()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = default(IObservable<long>);
- scheduler.ScheduleAbsolute(100, () => { xs = Observable.Timer(TimeSpan.Zero, TimeSpan.FromTicks(100), scheduler); });
-
- var onNext = new Action<long>(x =>
- {
- if (x == 0)
- throw ex;
- });
-
- var d = default(IDisposable);
- scheduler.ScheduleAbsolute(200, () => { d = xs.Subscribe(onNext); });
-
- scheduler.ScheduleAbsolute(1000, () => { d.Dispose(); });
-
- try
- {
- scheduler.Start();
- }
- catch (Exception e)
- {
- Assert.AreEqual(201, scheduler.Clock);
- Assert.AreSame(ex, e);
- }
- }
-
- [TestMethod]
- public void RepeatingTimer_UsingStopwatch_Slippage3_CatchUpFromLongInvokeStart_ThrowsBeyondFirst()
- {
- var ex = new Exception();
-
- var scheduler = new TestScheduler();
-
- var xs = default(IObservable<long>);
- scheduler.ScheduleAbsolute(100, () => { xs = Observable.Timer(TimeSpan.Zero, TimeSpan.FromTicks(100), scheduler); });
-
- var times = new List<long>();
-
- var onNext = new Action<long>(x =>
- {
- times.Add(scheduler.Clock);
-
- if (x == 0)
- {
- scheduler.Sleep(350);
- return;
- }
-
- if (x == 5)
- throw ex;
- });
-
- var d = default(IDisposable);
- scheduler.ScheduleAbsolute(200, () => { d = xs.Subscribe(onNext); });
-
- scheduler.ScheduleAbsolute(1000, () => { d.Dispose(); });
-
- try
- {
- scheduler.Start();
- }
- catch (Exception e)
- {
- Assert.AreEqual(701, scheduler.Clock);
- Assert.AreSame(ex, e);
- }
-
- times.AssertEqual(
- 201, // 1 off because of initial scheduling jump (InvokeStart)
- 551, // catching up after excessive delay of 350 (target was 300)
- 552, // catching up after excessive delay of 350 (target was 400)
- 553, // catching up after excessive delay of 350 (target was 500)
- 601, // back in sync
- 701
- );
- }
-
- [TestMethod]
- public void RepeatingTimer_NoStopwatch_Slippage1()
- {
- var scheduler = new TestScheduler();
-
- var xs = default(IObservable<long>);
- scheduler.ScheduleAbsolute(100, () => { xs = Observable.Timer(TimeSpan.Zero, TimeSpan.FromTicks(100), scheduler.DisableOptimizations(typeof(IStopwatchProvider))); });
-
- var times = new List<long>();
-
- var onNext = new Action<long>(x =>
- {
- times.Add(scheduler.Clock);
-
- if (x == 0)
- {
- return;
- }
-
- if (x < 2)
- {
- scheduler.Sleep(50);
- return;
- }
-
- if (x < 4)
- {
- scheduler.Sleep(120);
- return;
- }
-
- if (x < 6)
- {
- scheduler.Sleep(50);
- return;
- }
-
- if (x < 8)
- {
- return;
- }
- });
-
- var d = default(IDisposable);
- scheduler.ScheduleAbsolute(200, () => { d = xs.Subscribe(onNext); });
-
- scheduler.ScheduleAbsolute(1000, () => { d.Dispose(); });
-
- scheduler.Start();
-
- times.AssertEqual(
- 201, // 1 off because of initial scheduling jump (InvokeStart)
- 301,
- 401,
- 523, // 3 off because of 401 + 120 + 2 scheduling ticks (one due to yield in SchedulePeriodic emulation code)
- 645, // 5 off because of 523 + 120 + 2 scheduling ticks (one due to yield in SchedulePeriodic emulation code)
- 743, // \
- 843, // +--> 43 off because this situation (no stopwatch or periodic scheduling interface) only gets best effort treatment (see SchedulePeriodic emulation code)
- 943 // /
- );
- }
-
- [TestMethod]
- public void RepeatingTimer_NoStopwatch_Slippage2()
- {
- var scheduler = new TestScheduler();
-
- var xs = default(IObservable<long>);
- scheduler.ScheduleAbsolute(100, () => { xs = Observable.Timer(TimeSpan.FromTicks(100), TimeSpan.FromTicks(100), scheduler.DisableOptimizations(typeof(IStopwatchProvider))); });
-
- var times = new List<long>();
-
- var onNext = new Action<long>(x =>
- {
- times.Add(scheduler.Clock);
-
- if (x == 0)
- {
- return;
- }
-
- if (x < 2)
- {
- scheduler.Sleep(50);
- return;
- }
-
- if (x < 4)
- {
- scheduler.Sleep(120);
- return;
- }
-
- if (x < 6)
- {
- scheduler.Sleep(50);
- return;
- }
-
- if (x < 8)
- {
- return;
- }
- });
-
- var d = default(IDisposable);
- scheduler.ScheduleAbsolute(200, () => { d = xs.Subscribe(onNext); });
-
- scheduler.ScheduleAbsolute(1000, () => { d.Dispose(); });
-
- scheduler.Start();
-
- times.AssertEqual(
- 300,
- 400,
- 500,
- 622, // 2 off because of 500 + 120 + 2 scheduling ticks (one due to yield in SchedulePeriodic emulation code)
- 744, // 4 off because of 622 + 120 + 2 scheduling ticks (one due to yield in SchedulePeriodic emulation code)
- 842, // |
- 942 // +--> 42 off because this situation (no stopwatch or periodic scheduling interface) only gets best effort treatment (see SchedulePeriodic emulation code)
- );
- }
-
- [TestMethod]
- public void RepeatingTimer_Start_CatchUp()
- {
- var e = new ManualResetEvent(false);
-
- var xs = Observable.Timer(TimeSpan.Zero, TimeSpan.FromMilliseconds(10));
-
- var d = new SingleAssignmentDisposable();
- d.Disposable = xs.Subscribe(x =>
- {
- if (x == 0)
- Thread.Sleep(500);
-
- if (x > 10)
- {
- e.Set();
- d.Dispose();
- }
- });
-
- e.WaitOne();
- }
-
- [TestMethod]
- public void RepeatingTimer_Start_CatchUp_Throws()
- {
- var end = new ManualResetEvent(false);
-
- var err = new Exception();
- var ex = default(Exception);
-
- var s = ThreadPoolScheduler.Instance.Catch<Exception>(e =>
- {
- Interlocked.Exchange(ref ex, e);
- end.Set();
- return true;
- });
-
- var xs = Observable.Timer(TimeSpan.Zero, TimeSpan.FromMilliseconds(10), s);
-
- xs.Subscribe(x =>
- {
- if (x == 0)
- Thread.Sleep(500);
-
- if (x == 5)
- throw err;
- });
-
- end.WaitOne();
-
- Assert.AreSame(err, ex);
- }
-
- class SchedulerWithCatch : IServiceProvider, IScheduler
- {
- private readonly IScheduler _scheduler;
- private readonly Action<Exception> _setException;
-
- public SchedulerWithCatch(IScheduler scheduler, Action<Exception> setException)
- {
- _scheduler = scheduler;
- _setException = setException;
- }
-
- public object GetService(Type serviceType)
- {
- return ((IServiceProvider)_scheduler).GetService(serviceType);
- }
-
- public DateTimeOffset Now
- {
- get { return _scheduler.Now; }
- }
-
- public IDisposable Schedule<TState>(TState state, Func<IScheduler, TState, IDisposable> action)
- {
- return _scheduler.Schedule<TState>(state, GetCatch(action));
- }
-
- public IDisposable Schedule<TState>(TState state, TimeSpan dueTime, Func<IScheduler, TState, IDisposable> action)
- {
- return _scheduler.Schedule<TState>(state, dueTime, GetCatch(action));
- }
-
- public IDisposable Schedule<TState>(TState state, DateTimeOffset dueTime, Func<IScheduler, TState, IDisposable> action)
- {
- return _scheduler.Schedule<TState>(state, dueTime, GetCatch(action));
- }
-
- private Func<IScheduler, TState, IDisposable> GetCatch<TState>(Func<IScheduler, TState, IDisposable> action)
- {
- return (self, s) =>
- {
- try
- {
- return action(new SchedulerWithCatch(self, _setException), s);
- }
- catch (Exception ex)
- {
- _setException(ex);
- return Disposable.Empty;
- }
- };
- }
- }
-
- class PeriodicTestScheduler : TestScheduler, ISchedulerPeriodic, IServiceProvider
- {
- private readonly List<TimerRun> _timers;
-
- public PeriodicTestScheduler()
- {
- _timers = new List<TimerRun>();
- }
-
- public IDisposable SchedulePeriodic<TState>(TState state, TimeSpan period, Func<TState, TState> action)
- {
- var run = new TimerRun(this.Clock);
- _timers.Add(run);
-
- var x = state;
-
- var d = this.Schedule(period, self =>
- {
- run.Add(this.Clock);
-
- x = action(x);
- self(period);
- });
-
- return new CompositeDisposable(
- Disposable.Create(() => { run.Stop(this.Clock); }),
- d
- );
- }
-
- public List<TimerRun> Timers
- {
- get { return _timers; }
- }
-
- protected override object GetService(Type serviceType)
- {
- if (serviceType == typeof(ISchedulerPeriodic))
- return this as ISchedulerPeriodic;
-
- return null;
- }
- }
-
- class TimerRun : IEnumerable<long>
- {
- private readonly long _started;
- private long _stopped;
- private bool _hasStopped;
- private readonly List<long> _ticks;
-
- public TimerRun(long started)
- {
- _started = started;
- _ticks = new List<long>();
- }
-
- public TimerRun(long started, long stopped)
- {
- _started = started;
- _stopped = stopped;
- _hasStopped = true;
- _ticks = new List<long>();
- }
-
- public override int GetHashCode()
- {
- return 0;
- }
-
- public override bool Equals(object obj)
- {
- var other = obj as TimerRun;
- if (other == null)
- return false;
-
- return _started == other._started && _stopped == other._stopped && _ticks.SequenceEqual(other._ticks);
- }
-
- public long Started
- {
- get { return _started; }
- }
-
- public IEnumerable<long> Ticks
- {
- get { return _ticks; }
- }
-
- public long Stopped
- {
- get { return _stopped; }
- }
-
- internal void Stop(long clock)
- {
- _stopped = clock;
- _hasStopped = true;
- }
-
- public override string ToString()
- {
- var sb = new StringBuilder();
-
- sb.Append("Start(" + _started + ") ");
- sb.Append("Ticks(" + string.Join(", ", _ticks.Select(t => t.ToString()).ToArray()) + ") ");
- if (_hasStopped)
- sb.Append("Stop(" + _stopped + ")");
-
- return sb.ToString();
- }
-
- public IEnumerator<long> GetEnumerator()
- {
- return _ticks.GetEnumerator();
- }
-
- System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
- {
- return _ticks.GetEnumerator();
- }
-
- public void Add(long clock)
- {
- _ticks.Add(clock);
- }
- }
-
- #endregion
-
- #region + Timestamp +
-
- [TestMethod]
- public void Timestamp_ArgumentChecking()
- {
- var scheduler = new TestScheduler();
- var someObservable = Observable.Empty<int>();
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Timestamp(default(IObservable<int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Timestamp(default(IObservable<int>), scheduler));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Timestamp(someObservable, null));
- }
-
- [TestMethod]
- public void Timestamp_Regular()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnNext(230, 3),
- OnNext(260, 4),
- OnNext(300, 5),
- OnNext(350, 6),
- OnCompleted<int>(400)
- );
-
- var res = scheduler.Start(() =>
- xs.Timestamp(scheduler)
- );
-
- res.Messages.AssertEqual(
- OnNext(210, new Timestamped<int>(2, new DateTimeOffset(210, TimeSpan.Zero))),
- OnNext(230, new Timestamped<int>(3, new DateTimeOffset(230, TimeSpan.Zero))),
- OnNext(260, new Timestamped<int>(4, new DateTimeOffset(260, TimeSpan.Zero))),
- OnNext(300, new Timestamped<int>(5, new DateTimeOffset(300, TimeSpan.Zero))),
- OnNext(350, new Timestamped<int>(6, new DateTimeOffset(350, TimeSpan.Zero))),
- OnCompleted<Timestamped<int>>(400)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 400)
- );
- }
-
- [TestMethod]
- public void Timestamp_Empty()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable<int>(
- OnNext(150, 1),
- OnCompleted<int>(400)
- );
-
- var res = scheduler.Start(() =>
- xs.Timestamp(scheduler)
- );
-
- res.Messages.AssertEqual(
- OnCompleted<Timestamped<int>>(400)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 400)
- );
- }
-
- [TestMethod]
- public void Timestamp_Error()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable<int>(
- OnNext(150, 1),
- OnError<int>(400, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.Timestamp(scheduler)
- );
-
- res.Messages.AssertEqual(
- OnError<Timestamped<int>>(400, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 400)
- );
- }
-
- [TestMethod]
- public void Timestamp_Never()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable<int>(
- OnNext(150, 1)
- );
-
- var res = scheduler.Start(() =>
- xs.Timestamp(scheduler)
- );
-
- res.Messages.AssertEqual(
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 1000)
- );
- }
-
- [TestMethod]
- public void Timestamp_DefaultScheduler()
- {
- Assert.IsTrue(Observable.Return(1).Timestamp().Count().First() == 1);
- }
-
- #endregion
-
- #region + Window +
-
- [TestMethod]
- public void Window_Time_Basic()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnNext(240, 3),
- OnNext(270, 4),
- OnNext(320, 5),
- OnNext(360, 6),
- OnNext(390, 7),
- OnNext(410, 8),
- OnNext(460, 9),
- OnNext(470, 10),
- OnCompleted<int>(490)
- );
-
- var res = scheduler.Start(() =>
- xs.Window(TimeSpan.FromTicks(100), scheduler).Select((ys, i) => ys.Select(y => i + " " + y).Concat(Observable.Return(i + " end"))).Merge()
- );
-
- res.Messages.AssertEqual(
- OnNext(210, "0 2"),
- OnNext(240, "0 3"),
- OnNext(270, "0 4"),
- OnNext(300, "0 end"),
- OnNext(320, "1 5"),
- OnNext(360, "1 6"),
- OnNext(390, "1 7"),
- OnNext(400, "1 end"),
- OnNext(410, "2 8"),
- OnNext(460, "2 9"),
- OnNext(470, "2 10"),
- OnNext(490, "2 end"),
- OnCompleted<string>(490)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 490)
- );
- }
-
- [TestMethod]
- public void Window_Time_Basic_Periodic()
- {
- var scheduler = new PeriodicTestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnNext(240, 3),
- OnNext(270, 4),
- OnNext(320, 5),
- OnNext(360, 6),
- OnNext(390, 7),
- OnNext(410, 8),
- OnNext(460, 9),
- OnNext(470, 10),
- OnCompleted<int>(490)
- );
-
- var res = scheduler.Start(() =>
- xs.Window(TimeSpan.FromTicks(100), scheduler).Select((ys, i) => ys.Select(y => i + " " + y).Concat(Observable.Return(i + " end"))).Merge()
- );
-
- res.Messages.AssertEqual(
- OnNext(210, "0 2"),
- OnNext(240, "0 3"),
- OnNext(270, "0 4"),
- OnNext(300, "0 end"),
- OnNext(320, "1 5"),
- OnNext(360, "1 6"),
- OnNext(390, "1 7"),
- OnNext(400, "1 end"),
- OnNext(410, "2 8"),
- OnNext(460, "2 9"),
- OnNext(470, "2 10"),
- OnNext(490, "2 end"),
- OnCompleted<string>(490)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 490)
- );
-
- scheduler.Timers.AssertEqual(
- new TimerRun(200, 490) { 300, 400 }
- );
- }
-
- [TestMethod]
- public void Window_Time_Basic_Periodic_Error()
- {
- var ex = new Exception();
-
- var scheduler = new PeriodicTestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnNext(240, 3),
- OnNext(270, 4),
- OnNext(320, 5),
- OnNext(360, 6),
- OnNext(390, 7),
- OnNext(410, 8),
- OnError<int>(460, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.Window(TimeSpan.FromTicks(100), scheduler).Select((ys, i) => ys.Select(y => i + " " + y).Concat(Observable.Return(i + " end"))).Merge()
- );
-
- res.Messages.AssertEqual(
- OnNext(210, "0 2"),
- OnNext(240, "0 3"),
- OnNext(270, "0 4"),
- OnNext(300, "0 end"),
- OnNext(320, "1 5"),
- OnNext(360, "1 6"),
- OnNext(390, "1 7"),
- OnNext(400, "1 end"),
- OnNext(410, "2 8"),
- OnError<string>(460, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 460)
- );
-
- scheduler.Timers.AssertEqual(
- new TimerRun(200, 460) { 300, 400 }
- );
- }
-
- [TestMethod]
- public void Window_Time_Basic_Both()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(150, 1),
- OnNext(210, 2),
- OnNext(240, 3),
- OnNext(270, 4),
- OnNext(320, 5),
- OnNext(360, 6),
- OnNext(390, 7),
- OnNext(410, 8),
- OnNext(460, 9),
- OnNext(470, 10),
- OnCompleted<int>(490)
- );
-
- var res = scheduler.Start(() =>
- xs.Window(TimeSpan.FromTicks(100), TimeSpan.FromTicks(50), scheduler).Select((ys, i) => ys.Select(y => i + " " + y).Concat(Observable.Return(i + " end"))).Merge()
- );
-
- res.Messages.AssertEqual(
- OnNext(210, "0 2"),
- OnNext(240, "0 3"),
- OnNext(270, "0 4"),
- OnNext(270, "1 4"),
- OnNext(300, "0 end"),
- OnNext(320, "1 5"),
- OnNext(320, "2 5"),
- OnNext(350, "1 end"),
- OnNext(360, "2 6"),
- OnNext(360, "3 6"),
- OnNext(390, "2 7"),
- OnNext(390, "3 7"),
- OnNext(400, "2 end"),
- OnNext(410, "3 8"),
- OnNext(410, "4 8"),
- OnNext(450, "3 end"),
- OnNext(460, "4 9"),
- OnNext(460, "5 9"),
- OnNext(470, "4 10"),
- OnNext(470, "5 10"),
- OnNext(490, "4 end"),
- OnNext(490, "5 end"),
- OnCompleted<string>(490)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 490)
- );
- }
-
- [TestMethod]
- public void WindowWithTime_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Window(default(IObservable<int>), TimeSpan.FromTicks(1), TimeSpan.FromTicks(1), DummyScheduler.Instance));
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => Observable.Window(DummyObservable<int>.Instance, TimeSpan.FromTicks(-1), TimeSpan.FromTicks(1), DummyScheduler.Instance));
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => Observable.Window(DummyObservable<int>.Instance, TimeSpan.FromTicks(1), TimeSpan.FromTicks(-1), DummyScheduler.Instance));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Window(DummyObservable<int>.Instance, TimeSpan.FromTicks(1), TimeSpan.FromTicks(1), null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Window(default(IObservable<int>), TimeSpan.FromTicks(1), TimeSpan.FromTicks(1)));
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => Observable.Window(DummyObservable<int>.Instance, TimeSpan.FromTicks(-1), TimeSpan.FromTicks(1)));
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => Observable.Window(DummyObservable<int>.Instance, TimeSpan.FromTicks(1), TimeSpan.FromTicks(-1)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Window(default(IObservable<int>), TimeSpan.FromTicks(1), DummyScheduler.Instance));
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => Observable.Window(DummyObservable<int>.Instance, TimeSpan.FromTicks(-1), DummyScheduler.Instance));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Window(DummyObservable<int>.Instance, TimeSpan.FromTicks(1), null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Window(default(IObservable<int>), TimeSpan.FromTicks(1)));
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => Observable.Window(DummyObservable<int>.Instance, TimeSpan.FromTicks(-1)));
- }
-
- [TestMethod]
- public void WindowWithTime_Basic1()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(100, 1),
- OnNext(210, 2),
- OnNext(240, 3),
- OnNext(280, 4),
- OnNext(320, 5),
- OnNext(350, 6),
- OnNext(380, 7),
- OnNext(420, 8),
- OnNext(470, 9),
- OnCompleted<int>(600)
- );
-
- var res = scheduler.Start(() =>
- xs.Window(TimeSpan.FromTicks(100), TimeSpan.FromTicks(70), scheduler).Select((w, i) => w.Select(x => i.ToString() + " " + x.ToString())).Merge()
- );
-
- res.Messages.AssertEqual(
- OnNext(210, "0 2"),
- OnNext(240, "0 3"),
- OnNext(280, "0 4"),
- OnNext(280, "1 4"),
- OnNext(320, "1 5"),
- OnNext(350, "1 6"),
- OnNext(350, "2 6"),
- OnNext(380, "2 7"),
- OnNext(420, "2 8"),
- OnNext(420, "3 8"),
- OnNext(470, "3 9"),
- OnCompleted<string>(600)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 600)
- );
- }
-
- [TestMethod]
- public void WindowWithTime_Basic2()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(100, 1),
- OnNext(210, 2),
- OnNext(240, 3),
- OnNext(280, 4),
- OnNext(320, 5),
- OnNext(350, 6),
- OnNext(380, 7),
- OnNext(420, 8),
- OnNext(470, 9),
- OnCompleted<int>(600)
- );
-
- var res = scheduler.Start(() =>
- xs.Window(TimeSpan.FromTicks(70), TimeSpan.FromTicks(100), scheduler).Select((w, i) => w.Select(x => i.ToString() + " " + x.ToString())).Merge()
- );
-
- res.Messages.AssertEqual(
- OnNext(210, "0 2"),
- OnNext(240, "0 3"),
- OnNext(320, "1 5"),
- OnNext(350, "1 6"),
- OnNext(420, "2 8"),
- OnNext(470, "2 9"),
- OnCompleted<string>(600)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 600)
- );
- }
-
- [TestMethod]
- public void WindowWithTime_Error()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(100, 1),
- OnNext(210, 2),
- OnNext(240, 3),
- OnNext(280, 4),
- OnNext(320, 5),
- OnNext(350, 6),
- OnNext(380, 7),
- OnNext(420, 8),
- OnNext(470, 9),
- OnError<int>(600, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.Window(TimeSpan.FromTicks(100), TimeSpan.FromTicks(70), scheduler).Select((w, i) => w.Select(x => i.ToString() + " " + x.ToString())).Merge()
- );
-
- res.Messages.AssertEqual(
- OnNext(210, "0 2"),
- OnNext(240, "0 3"),
- OnNext(280, "0 4"),
- OnNext(280, "1 4"),
- OnNext(320, "1 5"),
- OnNext(350, "1 6"),
- OnNext(350, "2 6"),
- OnNext(380, "2 7"),
- OnNext(420, "2 8"),
- OnNext(420, "3 8"),
- OnNext(470, "3 9"),
- OnError<string>(600, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 600)
- );
- }
-
- [TestMethod]
- public void WindowWithTime_Disposed()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(100, 1),
- OnNext(210, 2),
- OnNext(240, 3),
- OnNext(280, 4),
- OnNext(320, 5),
- OnNext(350, 6),
- OnNext(380, 7),
- OnNext(420, 8),
- OnNext(470, 9),
- OnCompleted<int>(600)
- );
-
- var res = scheduler.Start(() =>
- xs.Window(TimeSpan.FromTicks(100), TimeSpan.FromTicks(70), scheduler).Select((w, i) => w.Select(x => i.ToString() + " " + x.ToString())).Merge(),
- 370
- );
-
- res.Messages.AssertEqual(
- OnNext(210, "0 2"),
- OnNext(240, "0 3"),
- OnNext(280, "0 4"),
- OnNext(280, "1 4"),
- OnNext(320, "1 5"),
- OnNext(350, "1 6"),
- OnNext(350, "2 6")
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 370)
- );
- }
-
- [TestMethod]
- public void WindowWithTime_Basic_Same()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(100, 1),
- OnNext(210, 2),
- OnNext(240, 3),
- OnNext(280, 4),
- OnNext(320, 5),
- OnNext(350, 6),
- OnNext(380, 7),
- OnNext(420, 8),
- OnNext(470, 9),
- OnCompleted<int>(600)
- );
-
- var res = scheduler.Start(() =>
- xs.Window(TimeSpan.FromTicks(100), scheduler).Select((w, i) => w.Select(x => i.ToString() + " " + x.ToString())).Merge()
- );
-
- res.Messages.AssertEqual(
- OnNext(210, "0 2"),
- OnNext(240, "0 3"),
- OnNext(280, "0 4"),
- OnNext(320, "1 5"),
- OnNext(350, "1 6"),
- OnNext(380, "1 7"),
- OnNext(420, "2 8"),
- OnNext(470, "2 9"),
- OnCompleted<string>(600)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 600)
- );
- }
-
- [TestMethod]
- public void WindowWithTime_Default()
- {
- Observable.Range(0, 10).Window(TimeSpan.FromDays(1), TimeSpan.FromDays(1)).SelectMany(Observable.ToList).First().AssertEqual(Enumerable.Range(0, 10));
- Observable.Range(0, 10).Window(TimeSpan.FromDays(1)).SelectMany(Observable.ToList).First().AssertEqual(Enumerable.Range(0, 10));
- }
-
- [TestMethod]
- public void WindowWithTimeOrCount_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Window(default(IObservable<int>), TimeSpan.FromTicks(1), 1, DummyScheduler.Instance));
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => Observable.Window(DummyObservable<int>.Instance, TimeSpan.FromTicks(-1), 1, DummyScheduler.Instance));
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => Observable.Window(DummyObservable<int>.Instance, TimeSpan.FromTicks(1), 0, DummyScheduler.Instance));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Window(DummyObservable<int>.Instance, TimeSpan.FromTicks(1), 1, null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Window(default(IObservable<int>), TimeSpan.FromTicks(1), 1));
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => Observable.Window(DummyObservable<int>.Instance, TimeSpan.FromTicks(-1), 1));
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => Observable.Window(DummyObservable<int>.Instance, TimeSpan.FromTicks(1), 0));
- }
-
- [TestMethod]
- public void WindowWithTimeOrCount_Basic()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(205, 1),
- OnNext(210, 2),
- OnNext(240, 3),
- OnNext(280, 4),
- OnNext(320, 5),
- OnNext(350, 6),
- OnNext(370, 7),
- OnNext(420, 8),
- OnNext(470, 9),
- OnCompleted<int>(600)
- );
-
- var res = scheduler.Start(() =>
- xs.Window(TimeSpan.FromTicks(70), 3, scheduler).Select((w, i) => w.Select(x => i.ToString() + " " + x.ToString())).Merge()
- );
-
- res.Messages.AssertEqual(
- OnNext(205, "0 1"),
- OnNext(210, "0 2"),
- OnNext(240, "0 3"),
- OnNext(280, "1 4"),
- OnNext(320, "2 5"),
- OnNext(350, "2 6"),
- OnNext(370, "2 7"),
- OnNext(420, "3 8"),
- OnNext(470, "4 9"),
- OnCompleted<string>(600)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 600)
- );
- }
-
- [TestMethod]
- public void WindowWithTimeOrCount_Error()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(205, 1),
- OnNext(210, 2),
- OnNext(240, 3),
- OnNext(280, 4),
- OnNext(320, 5),
- OnNext(350, 6),
- OnNext(370, 7),
- OnNext(420, 8),
- OnNext(470, 9),
- OnError<int>(600, ex)
- );
-
- var res = scheduler.Start(() =>
- xs.Window(TimeSpan.FromTicks(70), 3, scheduler).Select((w, i) => w.Select(x => i.ToString() + " " + x.ToString())).Merge()
- );
-
- res.Messages.AssertEqual(
- OnNext(205, "0 1"),
- OnNext(210, "0 2"),
- OnNext(240, "0 3"),
- OnNext(280, "1 4"),
- OnNext(320, "2 5"),
- OnNext(350, "2 6"),
- OnNext(370, "2 7"),
- OnNext(420, "3 8"),
- OnNext(470, "4 9"),
- OnError<string>(600, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 600)
- );
- }
-
- [TestMethod]
- public void WindowWithTimeOrCount_Disposed()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(205, 1),
- OnNext(210, 2),
- OnNext(240, 3),
- OnNext(280, 4),
- OnNext(320, 5),
- OnNext(350, 6),
- OnNext(370, 7),
- OnNext(420, 8),
- OnNext(470, 9),
- OnCompleted<int>(600)
- );
-
- var res = scheduler.Start(() =>
- xs.Window(TimeSpan.FromTicks(70), 3, scheduler).Select((w, i) => w.Select(x => i.ToString() + " " + x.ToString())).Merge(),
- 370
- );
-
- res.Messages.AssertEqual(
- OnNext(205, "0 1"),
- OnNext(210, "0 2"),
- OnNext(240, "0 3"),
- OnNext(280, "1 4"),
- OnNext(320, "2 5"),
- OnNext(350, "2 6"),
- OnNext(370, "2 7")
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 370)
- );
- }
-
- [TestMethod]
- public void WindowWithTimeOrCount_Default()
- {
- Observable.Range(1, 10).Window(TimeSpan.FromDays(1), 3).Skip(1).First().SequenceEqual(Observable.Range(4, 3));
- }
-
- #endregion
- }
-}
diff --git a/Rx.NET/Tests.System.Reactive/Tests/ObserverTest.cs b/Rx.NET/Tests.System.Reactive/Tests/ObserverTest.cs
deleted file mode 100644
index bdf9be1..0000000
--- a/Rx.NET/Tests.System.Reactive/Tests/ObserverTest.cs
+++ /dev/null
@@ -1,818 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Reactive;
-using System.Reactive.Concurrency;
-using System.Threading;
-using Microsoft.Reactive.Testing;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-
-namespace ReactiveTests.Tests
-{
- [TestClass]
- public partial class ObserverTest : ReactiveTest
- {
- [TestMethod]
- public void ToObserver_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observer.ToObserver<int>(default(Action<Notification<int>>)));
- }
-
- [TestMethod]
- public void ToObserver_NotificationOnNext()
- {
- int i = 0;
- Action<Notification<int>> next = n =>
- {
- Assert.AreEqual(i++, 0);
- Assert.AreEqual(n.Kind, NotificationKind.OnNext);
- Assert.AreEqual(n.Value, 42);
- Assert.AreEqual(n.Exception, null);
- Assert.IsTrue(n.HasValue);
- };
- next.ToObserver().OnNext(42);
- }
-
- [TestMethod]
- public void ToObserver_NotificationOnError()
- {
- var ex = new Exception();
- int i = 0;
- Action<Notification<int>> next = n =>
- {
- Assert.AreEqual(i++, 0);
- Assert.AreEqual(n.Kind, NotificationKind.OnError);
- Assert.AreSame(n.Exception, ex);
- Assert.IsFalse(n.HasValue);
- };
- next.ToObserver().OnError(ex);
- }
-
- [TestMethod]
- public void ToObserver_NotificationOnCompleted()
- {
- var ex = new Exception();
- int i = 0;
- Action<Notification<int>> next = n =>
- {
- Assert.AreEqual(i++, 0);
- Assert.AreEqual(n.Kind, NotificationKind.OnCompleted);
- Assert.IsFalse(n.HasValue);
- };
- next.ToObserver().OnCompleted();
- }
-
- [TestMethod]
- public void ToNotifier_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observer.ToNotifier<int>(default(IObserver<int>)));
- }
-
- [TestMethod]
- public void ToNotifier_Forwards()
- {
- var obsn = new MyObserver();
- obsn.ToNotifier()(Notification.CreateOnNext<int>(42));
- Assert.AreEqual(obsn.HasOnNext, 42);
-
- var ex = new Exception();
- var obse = new MyObserver();
- obse.ToNotifier()(Notification.CreateOnError<int>(ex));
- Assert.AreSame(ex, obse.HasOnError);
-
- var obsc = new MyObserver();
- obsc.ToNotifier()(Notification.CreateOnCompleted<int>());
- Assert.IsTrue(obsc.HasOnCompleted);
- }
-
- [TestMethod]
- public void Create_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observer.Create<int>(default(Action<int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observer.Create<int>(default(Action<int>), () => { }));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observer.Create<int>(_ => { }, default(Action)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observer.Create<int>(default(Action<int>), (Exception _) => { }));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observer.Create<int>(_ => { }, default(Action<Exception>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observer.Create<int>(default(Action<int>), (Exception _) => { }, () => { }));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observer.Create<int>(_ => { }, default(Action<Exception>), () => { }));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observer.Create<int>(_ => { }, (Exception _) => { }, default(Action)));
- }
-
- [TestMethod]
- public void Create_OnNext()
- {
- bool next = false;
- var res = Observer.Create<int>(x => { Assert.AreEqual(42, x); next = true; });
- res.OnNext(42);
- Assert.IsTrue(next);
- res.OnCompleted();
- }
-
- [TestMethod]
- public void Create_OnNext_HasError()
- {
- var ex = new Exception();
- var e_ = default(Exception);
-
- bool next = false;
- var res = Observer.Create<int>(x => { Assert.AreEqual(42, x); next = true; });
- res.OnNext(42);
- Assert.IsTrue(next);
-
- try
- {
- res.OnError(ex);
- Assert.Fail();
- }
- catch (Exception e)
- {
- e_ = e;
- }
- Assert.AreSame(ex, e_);
- }
-
- [TestMethod]
- public void Create_OnNextOnCompleted()
- {
- bool next = false;
- bool completed = false;
- var res = Observer.Create<int>(x => { Assert.AreEqual(42, x); next = true; }, () => { completed = true; });
- res.OnNext(42);
- Assert.IsTrue(next);
- Assert.IsFalse(completed);
- res.OnCompleted();
- Assert.IsTrue(completed);
- }
-
- [TestMethod]
- public void Create_OnNextOnCompleted_HasError()
- {
- var ex = new Exception();
- var e_ = default(Exception);
-
- bool next = false;
- bool completed = false;
- var res = Observer.Create<int>(x => { Assert.AreEqual(42, x); next = true; }, () => { completed = true; });
- res.OnNext(42);
- Assert.IsTrue(next);
- Assert.IsFalse(completed);
- try
- {
- res.OnError(ex);
- Assert.Fail();
- }
- catch (Exception e)
- {
- e_ = e;
- }
- Assert.AreSame(ex, e_);
- Assert.IsFalse(completed);
- }
-
- [TestMethod]
- public void Create_OnNextOnError()
- {
- var ex = new Exception();
- bool next = true;
- bool error = false;
- var res = Observer.Create<int>(x => { Assert.AreEqual(42, x); next = true; }, e => { Assert.AreSame(ex, e); error = true; });
- res.OnNext(42);
- Assert.IsTrue(next);
- Assert.IsFalse(error);
- res.OnError(ex);
- Assert.IsTrue(error);
- }
-
- [TestMethod]
- public void Create_OnNextOnError_HitCompleted()
- {
- var ex = new Exception();
- bool next = true;
- bool error = false;
- var res = Observer.Create<int>(x => { Assert.AreEqual(42, x); next = true; }, e => { Assert.AreSame(ex, e); error = true; });
- res.OnNext(42);
- Assert.IsTrue(next);
- Assert.IsFalse(error);
- res.OnCompleted();
- Assert.IsFalse(error);
- }
-
- [TestMethod]
- public void Create_OnNextOnErrorOnCompleted1()
- {
- var ex = new Exception();
- bool next = true;
- bool error = false;
- bool completed = false;
- var res = Observer.Create<int>(x => { Assert.AreEqual(42, x); next = true; }, e => { Assert.AreSame(ex, e); error = true; }, () => { completed = true; });
- res.OnNext(42);
- Assert.IsTrue(next);
- Assert.IsFalse(error);
- Assert.IsFalse(completed);
- res.OnCompleted();
- Assert.IsTrue(completed);
- Assert.IsFalse(error);
- }
-
- [TestMethod]
- public void Create_OnNextOnErrorOnCompleted2()
- {
- var ex = new Exception();
- bool next = true;
- bool error = false;
- bool completed = false;
- var res = Observer.Create<int>(x => { Assert.AreEqual(42, x); next = true; }, e => { Assert.AreSame(ex, e); error = true; }, () => { completed = true; });
- res.OnNext(42);
- Assert.IsTrue(next);
- Assert.IsFalse(error);
- Assert.IsFalse(completed);
- res.OnError(ex);
- Assert.IsTrue(error);
- Assert.IsFalse(completed);
- }
-
- [TestMethod]
- public void AsObserver_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observer.AsObserver<int>(default(IObserver<int>)));
- }
-
- [TestMethod]
- public void AsObserver_Hides()
- {
- var obs = new MyObserver();
- var res = obs.AsObserver();
-
- Assert.IsFalse(object.ReferenceEquals(obs, res));
- }
-
- [TestMethod]
- public void AsObserver_Forwards()
- {
- var obsn = new MyObserver();
- obsn.AsObserver().OnNext(42);
- Assert.AreEqual(obsn.HasOnNext, 42);
-
- var ex = new Exception();
- var obse = new MyObserver();
- obse.AsObserver().OnError(ex);
- Assert.AreSame(ex, obse.HasOnError);
-
- var obsc = new MyObserver();
- obsc.AsObserver().OnCompleted();
- Assert.IsTrue(obsc.HasOnCompleted);
- }
-
- class MyObserver : IObserver<int>
- {
- public void OnNext(int value)
- {
- HasOnNext = value;
- }
-
- public void OnError(Exception exception)
- {
- HasOnError = exception;
- }
-
- public void OnCompleted()
- {
- HasOnCompleted = true;
- }
-
- public int HasOnNext { get; set; }
- public Exception HasOnError { get; set; }
- public bool HasOnCompleted { get; set; }
- }
-
- [TestMethod]
- public void Observer_Checked_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observer.Checked(default(IObserver<int>)));
- }
-
- [TestMethod]
- public void Observer_Checked_AlreadyTerminated_Completed()
- {
- var m = 0;
- var n = 0;
-
- var o = Observer.Create<int>(_ => { m++; }, ex => { Assert.Fail(); }, () => { n++; }).Checked();
-
- o.OnNext(1);
- o.OnNext(2);
- o.OnCompleted();
-
- ReactiveAssert.Throws<InvalidOperationException>(() => o.OnCompleted());
- ReactiveAssert.Throws<InvalidOperationException>(() => o.OnError(new Exception()));
-
- Assert.AreEqual(2, m);
- Assert.AreEqual(1, n);
- }
-
- [TestMethod]
- public void Observer_Checked_AlreadyTerminated_Error()
- {
- var m = 0;
- var n = 0;
-
- var o = Observer.Create<int>(_ => { m++; }, ex => { n++; }, () => { Assert.Fail(); }).Checked();
-
- o.OnNext(1);
- o.OnNext(2);
- o.OnError(new Exception());
-
- ReactiveAssert.Throws<InvalidOperationException>(() => o.OnCompleted());
- ReactiveAssert.Throws<InvalidOperationException>(() => o.OnError(new Exception()));
-
- Assert.AreEqual(2, m);
- Assert.AreEqual(1, n);
- }
-
- [TestMethod]
- public void Observer_Checked_Reentrant_Next()
- {
- var n = 0;
-
- var o = default(IObserver<int>);
- o = Observer.Create<int>(
- _ =>
- {
- n++;
-
- ReactiveAssert.Throws<InvalidOperationException>(() => o.OnNext(9));
- ReactiveAssert.Throws<InvalidOperationException>(() => o.OnError(new Exception()));
- ReactiveAssert.Throws<InvalidOperationException>(() => o.OnCompleted());
- },
- ex =>
- {
- Assert.Fail();
- },
- () =>
- {
- Assert.Fail();
- })
- .Checked();
-
- o.OnNext(1);
-
- Assert.AreEqual(1, n);
- }
-
- [TestMethod]
- public void Observer_Checked_Reentrant_Error()
- {
- var n = 0;
-
- var o = default(IObserver<int>);
- o = Observer.Create<int>(
- _ =>
- {
- Assert.Fail();
- },
- ex =>
- {
- n++;
-
- ReactiveAssert.Throws<InvalidOperationException>(() => o.OnNext(9));
- ReactiveAssert.Throws<InvalidOperationException>(() => o.OnError(new Exception()));
- ReactiveAssert.Throws<InvalidOperationException>(() => o.OnCompleted());
- },
- () =>
- {
- Assert.Fail();
- })
- .Checked();
-
- o.OnError(new Exception());
-
- Assert.AreEqual(1, n);
- }
-
- [TestMethod]
- public void Observer_Checked_Reentrant_Completed()
- {
- var n = 0;
-
- var o = default(IObserver<int>);
- o = Observer.Create<int>(
- _ =>
- {
- Assert.Fail();
- },
- ex =>
- {
- Assert.Fail();
- },
- () =>
- {
- n++;
-
- ReactiveAssert.Throws<InvalidOperationException>(() => o.OnNext(9));
- ReactiveAssert.Throws<InvalidOperationException>(() => o.OnError(new Exception()));
- ReactiveAssert.Throws<InvalidOperationException>(() => o.OnCompleted());
- })
- .Checked();
-
- o.OnCompleted();
-
- Assert.AreEqual(1, n);
- }
-
- [TestMethod]
- public void Observer_Synchronize_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observer.Synchronize(default(IObserver<int>)));
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Observer.Synchronize(default(IObserver<int>), true));
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Observer.Synchronize(default(IObserver<int>), new object()));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observer.Synchronize(new MyObserver(), default(object)));
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Observer.Synchronize(default(IObserver<int>), new AsyncLock()));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observer.Synchronize(new MyObserver(), default(AsyncLock)));
- }
-
- [TestMethod]
- public void Observer_Synchronize_Monitor_Reentrant1()
- {
- var res = false;
- var inOne = false;
-
- var s = default(IObserver<int>);
-
- var o = Observer.Create<int>(x =>
- {
- if (x == 1)
- {
- inOne = true;
- s.OnNext(2);
- inOne = false;
- }
- else if (x == 2)
- {
- res = inOne;
- }
- });
-
- s = Observer.Synchronize(o);
-
- s.OnNext(1);
-
- Assert.IsTrue(res);
- }
-
- [TestMethod]
- public void Observer_Synchronize_Monitor_Reentrant2()
- {
- var res = false;
- var inOne = false;
-
- var s = default(IObserver<int>);
-
- var o = Observer.Create<int>(x =>
- {
- if (x == 1)
- {
- inOne = true;
- s.OnNext(2);
- inOne = false;
- }
- else if (x == 2)
- {
- res = inOne;
- }
- });
-
- s = Observer.Synchronize(o, new object());
-
- s.OnNext(1);
-
- Assert.IsTrue(res);
- }
-
- [TestMethod]
- public void Observer_Synchronize_Monitor_Reentrant3()
- {
- var res = false;
- var inOne = false;
-
- var s = default(IObserver<int>);
-
- var o = Observer.Create<int>(x =>
- {
- if (x == 1)
- {
- inOne = true;
- s.OnNext(2);
- inOne = false;
- }
- else if (x == 2)
- {
- res = inOne;
- }
- });
-
- s = Observer.Synchronize(o, false);
-
- s.OnNext(1);
-
- Assert.IsTrue(res);
- }
-
- [TestMethod]
- public void Observer_Synchronize_AsyncLock_NonReentrant1()
- {
- var res = false;
- var inOne = false;
-
- var s = default(IObserver<int>);
-
- var o = Observer.Create<int>(x =>
- {
- if (x == 1)
- {
- inOne = true;
- s.OnNext(2);
- inOne = false;
- }
- else if (x == 2)
- {
- res = !inOne;
- }
- });
-
- s = Observer.Synchronize(o, new AsyncLock());
-
- s.OnNext(1);
-
- Assert.IsTrue(res);
- }
-
- [TestMethod]
- public void Observer_Synchronize_AsyncLock_NonReentrant2()
- {
- var res = false;
- var inOne = false;
-
- var s = default(IObserver<int>);
-
- var o = Observer.Create<int>(x =>
- {
- if (x == 1)
- {
- inOne = true;
- s.OnNext(2);
- inOne = false;
- }
- else if (x == 2)
- {
- res = !inOne;
- }
- });
-
- s = Observer.Synchronize(o, true);
-
- s.OnNext(1);
-
- Assert.IsTrue(res);
- }
-
- [TestMethod]
- public void Observer_Synchronize_AsyncLock()
- {
- {
- var res = false;
-
- var s = default(IObserver<int>);
-
- var o = Observer.Create<int>(
- x => { res = x == 1; },
- ex => { Assert.Fail(); },
- () => { Assert.Fail(); }
- );
-
- s = Observer.Synchronize(o, true);
-
- s.OnNext(1);
-
- Assert.IsTrue(res);
- }
-
- {
- var res = default(Exception);
-
- var err = new Exception();
-
- var s = default(IObserver<int>);
-
- var o = Observer.Create<int>(
- x => { Assert.Fail(); },
- ex => { res = ex; },
- () => { Assert.Fail(); }
- );
-
- s = Observer.Synchronize(o, true);
-
- s.OnError(err);
-
- Assert.AreSame(err, res);
- }
-
- {
- var res = false;
-
- var s = default(IObserver<int>);
-
- var o = Observer.Create<int>(
- x => { Assert.Fail(); },
- ex => { Assert.Fail(); },
- () => { res = true; }
- );
-
- s = Observer.Synchronize(o, true);
-
- s.OnCompleted();
-
- Assert.IsTrue(res);
- }
- }
-
-#if !NO_CDS
- [TestMethod]
- public void Observer_Synchronize_OnCompleted()
- {
- Observer_Synchronize(true);
- }
-
- [TestMethod]
- public void Observer_Synchronize_OnError()
- {
- Observer_Synchronize(false);
- }
-
- private void Observer_Synchronize(bool success)
- {
- var busy = false;
-
- var n = 0;
- var ex = default(Exception);
- var done = false;
-
- var o = Observer.Create<int>(
- _ =>
- {
- Assert.IsFalse(busy);
- busy = true;
- n++;
- busy = false;
- },
- _ =>
- {
- Assert.IsFalse(busy);
- busy = true;
- ex = _;
- busy = false;
- },
- () =>
- {
- Assert.IsFalse(busy);
- busy = true;
- done = true;
- busy = false;
- }
- );
-
- var s = Observer.Synchronize(o);
-
- var N = 10;
- var M = 1000;
-
- var e = new CountdownEvent(N);
- for (int i = 0; i < N; i++)
- {
- Scheduler.Default.Schedule(() =>
- {
- for (int j = 0; j < M; j++)
- s.OnNext(j);
- e.Signal();
- });
- }
-
- e.Wait();
-
- if (success)
- {
- s.OnCompleted();
- Assert.IsTrue(done);
- }
- else
- {
- var err = new Exception();
- s.OnError(err);
- Assert.AreSame(err, ex);
- }
-
- Assert.AreEqual(n, N * M);
- }
-#endif
-
- [TestMethod]
- public void NotifyOn_Null()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Observer.NotifyOn(default(IObserver<int>), Scheduler.Immediate));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observer.NotifyOn(new MyObserver(), default(IScheduler)));
-
-#if !NO_SYNCCTX
- ReactiveAssert.Throws<ArgumentNullException>(() => Observer.NotifyOn(default(IObserver<int>), new MySyncCtx()));
- ReactiveAssert.Throws<ArgumentNullException>(() => Observer.NotifyOn(new MyObserver(), default(SynchronizationContext)));
-#endif
- }
-
- [TestMethod]
- public void NotifyOn_Scheduler_OnCompleted()
- {
- NotifyOn_Scheduler(true);
- }
-
- [TestMethod]
- public void NotifyOn_Scheduler_OnError()
- {
- NotifyOn_Scheduler(false);
- }
-
- private void NotifyOn_Scheduler(bool success)
- {
- var e = new ManualResetEvent(false);
- var c = 0;
- var N = 100;
- var err = new Exception();
-
- var o = Observer.Create<int>(
- x =>
- {
- c++;
-#if DESKTOPCLR
- Assert.IsTrue(Thread.CurrentThread.IsThreadPoolThread);
-#endif
- },
- ex =>
- {
- Assert.AreSame(err, ex);
- e.Set();
- },
- () =>
- {
-#if DESKTOPCLR
- Assert.IsTrue(Thread.CurrentThread.IsThreadPoolThread);
-#endif
- e.Set();
- }
- );
-
- var s = ThreadPoolScheduler.Instance.DisableOptimizations(/* long-running creates a non-threadpool thread */);
- var n = Observer.NotifyOn(o, s);
-
- new Thread(() =>
- {
- for (int i = 0; i < N; i++)
- n.OnNext(i);
-
- if (success)
- n.OnCompleted();
- else
- n.OnError(err);
- }).Start();
-
- e.WaitOne();
- Assert.AreEqual(N, c);
- }
-
- [TestMethod]
- public void NotifyOn_SyncCtx()
- {
- var lst = new List<int>();
- var don = new ManualResetEvent(false);
- var obs = Observer.Create<int>(x => { lst.Add(x); }, ex => { Assert.Fail(); }, () => { don.Set(); });
- var ctx = new MySyncCtx();
- var res = obs.NotifyOn(ctx);
-
- for (int i = 0; i < 100; i++)
- obs.OnNext(i);
- obs.OnCompleted();
-
- don.WaitOne();
- Assert.IsTrue(lst.SequenceEqual(Enumerable.Range(0, 100)));
- }
-
- class MySyncCtx : SynchronizationContext
- {
- public override void Post(SendOrPostCallback d, object state)
- {
- ThreadPool.QueueUserWorkItem(_ => d(state), state);
- }
- }
- }
-}
diff --git a/Rx.NET/Tests.System.Reactive/Tests/PrivateTypesTest.cs b/Rx.NET/Tests.System.Reactive/Tests/PrivateTypesTest.cs
deleted file mode 100644
index 9332e24..0000000
--- a/Rx.NET/Tests.System.Reactive/Tests/PrivateTypesTest.cs
+++ /dev/null
@@ -1,239 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !SILVERLIGHT // Reflection security restrictions
-using System;
-using System.Linq;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using Microsoft.Reactive.Testing;
-using System.Reactive.Linq;
-
-namespace ReactiveTests.Tests
-{
- [TestClass]
- public partial class PrivateTypesTest : ReactiveTest
- {
- [TestMethod]
- public void EitherValueRoundtrip()
- {
- {
- var value = 42;
- var left = (Either<int, string>.Left)Either<int, string>.CreateLeft(value);
- Assert.AreEqual(value, left.Value);
- }
- {
- var value = "42";
- var right = (Either<int, string>.Right)Either<int, string>.CreateRight(value);
- Assert.AreEqual(value, right.Value);
- }
- }
-
- [TestMethod]
- public void EitherEqualsEquatable()
- {
- {
- var value = 42;
- var left = (Either<int, string>.Left)Either<int, string>.CreateLeft(value);
-
- Assert.IsTrue(left.Equals(left));
- Assert.IsFalse(left.Equals((Either<int, string>.Left)null));
-
- var other = (Either<int, string>.Left)Either<int, string>.CreateLeft(value + 1);
- Assert.IsFalse(left.Equals(other));
- }
- {
- var value = "42";
- var right = (Either<int, string>.Right)Either<int, string>.CreateRight(value);
-
- Assert.IsTrue(right.Equals(right));
- Assert.IsFalse(right.Equals((Either<int, string>.Right)null));
-
- var other = (Either<int, string>.Right)Either<int, string>.CreateRight(value + "1");
- Assert.IsFalse(right.Equals(other));
- }
- }
-
- [TestMethod]
- public void EitherEqualsObject()
- {
- {
- var value = 42;
- var left = (Either<int, string>.Left)Either<int, string>.CreateLeft(value);
-
- Assert.IsTrue(left.Equals((object)left));
- Assert.IsFalse(left.Equals((object)null));
-
- var other = (Either<int, string>.Left)Either<int, string>.CreateLeft(value + 1);
- Assert.IsFalse(left.Equals((object)other));
- }
- {
- var value = "42";
- var right = (Either<int, string>.Right)Either<int, string>.CreateRight(value);
-
- Assert.IsTrue(right.Equals((object)right));
- Assert.IsFalse(right.Equals((object)null));
-
- var other = (Either<int, string>.Right)Either<int, string>.CreateRight(value + "1");
- Assert.IsFalse(right.Equals((object)other));
- }
- }
-
- [TestMethod]
- public void EitherGetHashCode()
- {
- {
- var left = (Either<int, string>.Left)Either<int, string>.CreateLeft(42);
- var other = (Either<int, string>.Left)Either<int, string>.CreateLeft(43);
- Assert.AreNotEqual(left.GetHashCode(), other.GetHashCode());
- }
- {
- var right = (Either<int, string>.Right)Either<int, string>.CreateRight("42");
- var other = (Either<int, string>.Right)Either<int, string>.CreateRight("43");
- Assert.AreNotEqual(right.GetHashCode(), other.GetHashCode());
- }
- }
-
- [TestMethod]
- public void EitherToString()
- {
- {
- var left = (Either<int, string>.Left)Either<int, string>.CreateLeft(42);
- Assert.IsTrue(left.ToString() == "Left(42)");
- }
- {
- var right = (Either<int, string>.Right)Either<int, string>.CreateRight("42");
- Assert.IsTrue(right.ToString() == "Right(42)");
- }
- }
-
- [TestMethod]
- public void EitherSwitchFunc()
- {
- {
- var value = 42;
- var left = (Either<int, string>.Left)Either<int, string>.CreateLeft(value);
- Assert.AreEqual(left.Switch<int>(l => l, r => r.Length), value);
- }
- {
- var value = "42";
- var right = (Either<int, string>.Right)Either<int, string>.CreateRight(value);
- Assert.AreEqual(right.Switch<int>(l => l, r => r.Length), value.Length);
- }
- }
-
- [TestMethod]
- public void EitherSwitchAction()
- {
- {
- var value = 42;
- var left = (Either<int, string>.Left)Either<int, string>.CreateLeft(value);
- int res = 0;
- left.Switch(l => { res = 1; }, r => { res = 2;});
- Assert.AreEqual(1, res);
- }
- {
- var value = "42";
- var right = (Either<int, string>.Right)Either<int, string>.CreateRight(value);
- int res = 0;
- right.Switch(l => { res = 1; }, r => { res = 2; });
- Assert.AreEqual(2, res);
- }
- }
- }
-
- class EitherBase
- {
- protected object _value;
-
- public override bool Equals(object obj)
- {
- var equ = _value.GetType().GetMethods().Where(m => m.Name == "Equals" && m.GetParameters()[0].ParameterType == typeof(object)).Single();
- return (bool)equ.Invoke(_value, new object[] { obj is EitherBase ? ((EitherBase)obj)._value : obj });
- }
-
- public override int GetHashCode()
- {
- return (int)_value.GetType().GetMethod("GetHashCode").Invoke(_value, null);
- }
-
- public override string ToString()
- {
- return (string)_value.GetType().GetMethod("ToString").Invoke(_value, null);
- }
- }
-
- class Either<TLeft, TRight> : EitherBase
- {
- public static Either<TLeft, TRight> CreateLeft(TLeft value)
- {
- var tpe = typeof(Observable).Assembly.GetTypes().Single(t => t.Name == "Either`2").MakeGenericType(typeof(TLeft), typeof(TRight));
- var mth = tpe.GetMethod("CreateLeft");
- var res = mth.Invoke(null, new object[] { value });
- return new Either<TLeft, TRight>.Left(res);
- }
-
- public static Either<TLeft, TRight> CreateRight(TRight value)
- {
- var tpe = typeof(Observable).Assembly.GetTypes().Single(t => t.Name == "Either`2").MakeGenericType(typeof(TLeft), typeof(TRight));
- var mth = tpe.GetMethod("CreateRight");
- var res = mth.Invoke(null, new object[] { value });
- return new Either<TLeft, TRight>.Right(res);
- }
-
- public TResult Switch<TResult>(Func<TLeft, TResult> caseLeft, Func<TRight, TResult> caseRight)
- {
- var mth = _value.GetType().GetMethods().Where(m => m.Name == "Switch" && m.ReturnType != typeof(void)).Single().MakeGenericMethod(typeof(TResult));
- return (TResult)mth.Invoke(_value, new object[] { caseLeft, caseRight });
- }
-
- public void Switch(Action<TLeft> caseLeft, Action<TRight> caseRight)
- {
- var mth = _value.GetType().GetMethods().Where(m => m.Name == "Switch" && m.ReturnType == typeof(void)).Single();
- mth.Invoke(_value, new object[] { caseLeft, caseRight });
- }
-
- public sealed class Left : Either<TLeft, TRight>, IEquatable<Left>
- {
- public TLeft Value
- {
- get
- {
- return (TLeft)_value.GetType().GetProperty("Value").GetValue(_value, null);
- }
- }
-
- public Left(object value)
- {
- _value = value;
- }
-
- public bool Equals(Left other)
- {
- var equ = _value.GetType().GetMethods().Where(m => m.Name == "Equals" && m.GetParameters()[0].ParameterType != typeof(object)).Single();
- return (bool)equ.Invoke(_value, new object[] { other == null ? null : other._value });
- }
- }
-
- public sealed class Right : Either<TLeft, TRight>, IEquatable<Right>
- {
- public TRight Value
- {
- get
- {
- return (TRight)_value.GetType().GetProperty("Value").GetValue(_value, null);
- }
- }
-
- public Right(object value)
- {
- _value = value;
- }
-
- public bool Equals(Right other)
- {
- var equ = _value.GetType().GetMethods().Where(m => m.Name == "Equals" && m.GetParameters()[0].ParameterType != typeof(object)).Single();
- return (bool)equ.Invoke(_value, new object[] { other == null ? null : other._value });
- }
- }
- }
-}
-#endif
diff --git a/Rx.NET/Tests.System.Reactive/Tests/QbservableExTest.cs b/Rx.NET/Tests.System.Reactive/Tests/QbservableExTest.cs
deleted file mode 100644
index e8caa9a..0000000
--- a/Rx.NET/Tests.System.Reactive/Tests/QbservableExTest.cs
+++ /dev/null
@@ -1,73 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !SILVERLIGHTM7
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Linq.Expressions;
-using System.Reactive.Linq;
-using Microsoft.Reactive.Testing;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-
-namespace ReactiveTests.Tests
-{
- [TestClass]
- public class QbservableExTest : ReactiveTest
- {
- private IQbservable<int> _qbNull = null;
- private IQbservable<int> _qbMy = new MyQbservable<int>();
- private IQbservableProvider _qbp = new MyQbservableProvider();
-
- [TestMethod]
- public void ForkJoin_ArgumentNullChecks()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => QbservableEx.ForkJoin(_qbNull, _qbMy, (a, b) => a + b));
- ReactiveAssert.Throws<ArgumentNullException>(() => QbservableEx.ForkJoin(_qbMy, _qbNull, (a, b) => a + b));
- ReactiveAssert.Throws<ArgumentNullException>(() => QbservableEx.ForkJoin(_qbMy, _qbMy, default(Expression<Func<int, int, int>>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => QbservableEx.ForkJoin(default(IQbservableProvider), _qbMy));
- ReactiveAssert.Throws<ArgumentNullException>(() => QbservableEx.ForkJoin(_qbp, default(IQbservable<int>[])));
- ReactiveAssert.Throws<ArgumentNullException>(() => QbservableEx.ForkJoin(default(IQbservableProvider), new MyQueryable<IObservable<int>>()));
- ReactiveAssert.Throws<ArgumentNullException>(() => QbservableEx.ForkJoin(_qbp, default(IQueryable<IObservable<int>>)));
- }
-
- [TestMethod]
- public void ForkJoin()
- {
- _qbMy.ForkJoin(_qbMy, (a, b) => a + b);
- _qbp.ForkJoin(_qbMy, _qbMy);
- _qbp.ForkJoin(new MyQueryable<IObservable<int>>());
- }
-
- [TestMethod]
- public void Create_ArgumentNullChecks()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => QbservableEx.Create<int>(default(IQbservableProvider), _ => new IObservable<object>[0]));
- ReactiveAssert.Throws<ArgumentNullException>(() => QbservableEx.Create<int>(_qbp, default(Expression<Func<IObserver<int>, IEnumerable<IObservable<object>>>>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => QbservableEx.Create(default(IQbservableProvider), () => new IObservable<object>[0]));
- ReactiveAssert.Throws<ArgumentNullException>(() => QbservableEx.Create(_qbp, null));
- }
-
- [TestMethod]
- public void Create()
- {
- _qbp.Create<int>(obs => new IObservable<object>[0]);
- _qbp.Create(() => new IObservable<object>[0]);
- }
-
- [TestMethod]
- public void Let_ArgumentNullChecks()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => QbservableEx.Let(_qbNull, xs => xs));
- ReactiveAssert.Throws<ArgumentNullException>(() => QbservableEx.Let(_qbMy, default(Expression<Func<IObservable<int>, IObservable<int>>>)));
- }
-
- [TestMethod]
- public void Let()
- {
- _qbMy.Let(xs => xs);
- }
- }
-}
-
-#endif \ No newline at end of file
diff --git a/Rx.NET/Tests.System.Reactive/Tests/QbservableTest.cs b/Rx.NET/Tests.System.Reactive/Tests/QbservableTest.cs
deleted file mode 100644
index 63a9aa9..0000000
--- a/Rx.NET/Tests.System.Reactive/Tests/QbservableTest.cs
+++ /dev/null
@@ -1,2114 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !SILVERLIGHTM7
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Linq.Expressions;
-using System.Reactive;
-using System.Reactive.Concurrency;
-using System.Reactive.Joins;
-using System.Reactive.Linq;
-using System.Reactive.Subjects;
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Threading;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using Microsoft.Reactive.Testing;
-
-namespace ReactiveTests.Tests
-{
- [TestClass]
- public class QbservableTest
- {
- private IQbservable<int> _qbNull = null;
- private IQbservable<int> _qbMy = new MyQbservable<int>();
- private IQbservableProvider _qbp = new MyQbservableProvider();
-
- [TestMethod]
- public void LocalQueryMethodImplementationTypeAttribute()
- {
- var t = typeof(string);
-
- var attr = new LocalQueryMethodImplementationTypeAttribute(t);
-
- Assert.AreSame(t, attr.TargetType);
- }
-
- [TestMethod]
- public void Aggregate_ArgumentNullChecks()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Aggregate(_qbNull, (a, b) => a + b));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Aggregate(_qbMy, null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Aggregate(_qbNull, 1, (a, b) => a + b));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Aggregate(_qbMy, 1, null));
- }
-
- [TestMethod]
- public void Aggregate()
- {
- _qbMy.Aggregate((a, b) => a + b);
- _qbMy.Aggregate("", (a, b) => a + b);
- }
-
- [TestMethod]
- public void All_ArgumentNullChecks()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.All(_qbNull, a => true));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.All(_qbMy, null));
- }
-
- [TestMethod]
- public void All()
- {
- _qbMy.All(a => true);
- }
-
- [TestMethod]
- public void Amb_ArgumentNullChecks()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Amb(_qbNull, _qbMy));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Amb(_qbMy, _qbNull));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Amb(default(IQbservableProvider), _qbMy));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Amb(_qbp, default(IQbservable<int>[])));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Amb(default(IQbservableProvider), new MyQueryable<IObservable<int>>()));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Amb(_qbp, default(IQueryable<IObservable<int>>)));
- }
-
- [TestMethod]
- public void Amb()
- {
- _qbMy.Amb(_qbMy);
- _qbp.Amb(_qbMy, _qbMy);
- _qbp.Amb(new MyQueryable<IObservable<int>>());
- }
-
- [TestMethod]
- public void And_ArgumentNullChecks()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.And(_qbNull, _qbMy));
- ReactiveAssert.Throws<ArgumentNullException>(() => _qbMy.And(_qbNull));
- ReactiveAssert.Throws<ArgumentNullException>(() => _qbMy.And(_qbMy).And(_qbNull));
- ReactiveAssert.Throws<ArgumentNullException>(() => _qbMy.And(_qbMy).And(_qbMy).And(_qbNull));
-#if !NO_LARGEARITY
- ReactiveAssert.Throws<ArgumentNullException>(() => _qbMy.And(_qbMy).And(_qbMy).And(_qbMy).And(_qbNull));
- ReactiveAssert.Throws<ArgumentNullException>(() => _qbMy.And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbNull));
- ReactiveAssert.Throws<ArgumentNullException>(() => _qbMy.And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbNull));
- ReactiveAssert.Throws<ArgumentNullException>(() => _qbMy.And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbNull));
- ReactiveAssert.Throws<ArgumentNullException>(() => _qbMy.And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbNull));
- ReactiveAssert.Throws<ArgumentNullException>(() => _qbMy.And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbNull));
- ReactiveAssert.Throws<ArgumentNullException>(() => _qbMy.And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbNull));
- ReactiveAssert.Throws<ArgumentNullException>(() => _qbMy.And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbNull));
- ReactiveAssert.Throws<ArgumentNullException>(() => _qbMy.And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbNull));
- ReactiveAssert.Throws<ArgumentNullException>(() => _qbMy.And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbNull));
- ReactiveAssert.Throws<ArgumentNullException>(() => _qbMy.And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbNull));
- ReactiveAssert.Throws<ArgumentNullException>(() => _qbMy.And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbNull));
-#endif
- }
-
- [TestMethod]
- public void And()
- {
- _qbMy.And(_qbMy);
- }
-
- [TestMethod]
- public void Any_ArgumentNullChecks()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Any(_qbNull));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Any(_qbNull, a => true));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Any(_qbMy, null));
- }
-
- [TestMethod]
- public void Any()
- {
- _qbMy.Any();
- _qbMy.Any(a => true);
- }
-
- [TestMethod]
- public void Average_ArgumentNullChecks()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Average(default(IQbservable<decimal?>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Average(default(IQbservable<decimal>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Average(default(IQbservable<double?>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Average(default(IQbservable<double>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Average(default(IQbservable<float?>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Average(default(IQbservable<float>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Average(default(IQbservable<int?>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Average(default(IQbservable<int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Average(default(IQbservable<long?>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Average(default(IQbservable<long>)));
- }
-
- [TestMethod]
- public void Average()
- {
- new MyQbservable<decimal?>().Average();
- new MyQbservable<decimal>().Average();
- new MyQbservable<double?>().Average();
- new MyQbservable<double>().Average();
- new MyQbservable<float?>().Average();
- new MyQbservable<float>().Average();
- new MyQbservable<int?>().Average();
- new MyQbservable<int>().Average();
- new MyQbservable<long?>().Average();
- new MyQbservable<long>().Average();
- }
-
- [TestMethod]
- public void BufferWithCount_ArgumentNullChecks()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Window(_qbNull, 1));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Window(_qbNull, 1, 1));
- }
-
- [TestMethod]
- public void BufferWithCount()
- {
- _qbMy.Window(1);
- _qbMy.Window(1, 1);
- }
-
- [TestMethod]
- public void BufferWithTime_ArgumentNullChecks()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Buffer(_qbNull, TimeSpan.Zero));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Buffer(_qbNull, TimeSpan.Zero, Scheduler.Immediate));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Buffer(_qbMy, TimeSpan.Zero, default(IScheduler)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Buffer(_qbNull, TimeSpan.Zero, TimeSpan.Zero));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Buffer(_qbNull, TimeSpan.Zero, TimeSpan.Zero, Scheduler.Immediate));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Buffer(_qbMy, TimeSpan.Zero, TimeSpan.Zero, default(IScheduler)));
- }
-
- [TestMethod]
- public void BufferWithTime()
- {
- _qbMy.Buffer(TimeSpan.Zero);
- _qbMy.Buffer(TimeSpan.Zero, Scheduler.Immediate);
- _qbMy.Buffer(TimeSpan.Zero, TimeSpan.Zero);
- _qbMy.Buffer(TimeSpan.Zero, TimeSpan.Zero, Scheduler.Immediate);
- }
-
- [TestMethod]
- public void Case_ArgumentNullChecks()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Case(null, () => 1, new Dictionary<int, IObservable<int>>()));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Case(_qbp, default(Expression<Func<int>>), new Dictionary<int, IObservable<int>>()));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Case(_qbp, () => 1, default(Dictionary<int, IObservable<int>>)));
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Case(null, () => 1, new Dictionary<int, IObservable<int>>(), Scheduler.Immediate));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Case(_qbp, default(Expression<Func<int>>), new Dictionary<int, IObservable<int>>(), Scheduler.Immediate));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Case(_qbp, () => 1, default(Dictionary<int, IObservable<int>>), Scheduler.Immediate));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Case(_qbp, () => 1, new Dictionary<int, IObservable<int>>(), default(IScheduler)));
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Case(null, () => 1, new Dictionary<int, IObservable<int>>(), _qbMy));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Case(_qbp, default(Expression<Func<int>>), new Dictionary<int, IObservable<int>>(), _qbMy));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Case(_qbp, () => 1, default(Dictionary<int, IObservable<int>>), _qbMy));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Case(_qbp, () => 1, new Dictionary<int, IObservable<int>>(), default(IQbservable<int>)));
- }
-
- [TestMethod]
- public void Case()
- {
- _qbp.Case(() => 1, new Dictionary<int, IObservable<int>>());
- _qbp.Case(() => 1, new Dictionary<int, IObservable<int>>(), Scheduler.Immediate);
- _qbp.Case(() => 1, new Dictionary<int, IObservable<int>>(), _qbMy);
- }
-
- [TestMethod]
- public void Cast_ArgumentNullChecks()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Cast<int>(default(MyQbservable<object>)));
- }
-
- [TestMethod]
- public void Cast()
- {
- Qbservable.Cast<int>(new MyQbservable<object>());
- }
-
- [TestMethod]
- public void Catch_ArgumentNullChecks()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Catch<int, Exception>(_qbMy, null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Catch<int, Exception>(_qbNull, (Exception ex) => null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Catch<int>(_qbMy, _qbNull));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Catch<int>(_qbNull, _qbMy));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Catch(default(IQbservableProvider), _qbMy));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Catch(_qbp, default(IQbservable<int>[])));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Catch(default(IQbservableProvider), new MyQueryable<IObservable<int>>()));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Catch(_qbp, default(IQueryable<IObservable<int>>)));
- }
-
- [TestMethod]
- public void Catch()
- {
- _qbMy.Catch((Exception ex) => _qbMy);
- _qbMy.Catch(_qbMy);
- _qbp.Catch(_qbMy, _qbMy);
- _qbp.Catch(new MyQueryable<IObservable<int>>());
- }
-
- [TestMethod]
- public void CombineLatest_ArgumentNullChecks()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.CombineLatest(_qbNull, _qbMy, (a, b) => a + b));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.CombineLatest(_qbMy, _qbNull, (a, b) => a + b));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.CombineLatest(_qbMy, _qbMy, default(Expression<Func<int, int, int>>)));
- }
-
- [TestMethod]
- public void CombineLatest()
- {
- _qbMy.CombineLatest(_qbMy, (a, b) => a + b);
- }
-
- [TestMethod]
- public void Contains_ArgumentNullChecks()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Contains(_qbNull, 1));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Contains(_qbNull, 1, EqualityComparer<int>.Default));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Contains(_qbMy, 1, null));
- }
-
- [TestMethod]
- public void Contains()
- {
- _qbMy.Contains(1);
- _qbMy.Contains(1, EqualityComparer<int>.Default);
- }
-
- [TestMethod]
- public void Count_ArgumentNullChecks()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Count(_qbNull));
- }
-
- [TestMethod]
- public void Count()
- {
- _qbMy.Count();
- }
-
- [TestMethod]
- public void Concat_ArgumentNullChecks()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Concat(_qbNull, _qbMy));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Concat(_qbMy, _qbNull));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Concat(default(IQbservableProvider), _qbMy));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Concat(_qbp, default(IQbservable<int>[])));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Concat(default(IQbservableProvider), new MyQueryable<IObservable<int>>()));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Concat(_qbp, default(IQueryable<IObservable<int>>)));
- }
-
- [TestMethod]
- public void Concat()
- {
- _qbMy.Concat(_qbMy);
- _qbp.Concat(_qbMy, _qbMy);
- _qbp.Concat(new MyQueryable<IObservable<int>>());
- }
-
- [TestMethod]
- public void Create_ArgumentNullChecks()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Create<int>(null, o => default(Action)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Create<int>(_qbp, default(Expression<Func<IObserver<int>, Action>>)));
- }
-
- [TestMethod]
- public void Create()
- {
- _qbp.Create<int>(o => default(Action));
- }
-
- [TestMethod]
- public void CreateWithDisposable_ArgumentNullChecks()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Create<int>(null, o => default(IDisposable)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Create<int>(_qbp, default(Expression<Func<IObserver<int>, IDisposable>>)));
- }
-
- [TestMethod]
- public void CreateWithDisposable()
- {
- _qbp.Create<int>(o => default(IDisposable));
- }
-
- [TestMethod]
- public void Defer_ArgumentNullChecks()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Defer(null, () => _qbMy));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Defer<int>(_qbp, default(Expression<Func<IObservable<int>>>)));
- }
-
- [TestMethod]
- public void Defer()
- {
- _qbp.Defer<int>(() => _qbMy);
- }
-
- [TestMethod]
- public void Delay_ArgumentNullChecks()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Delay(_qbNull, DateTimeOffset.Now));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Delay(_qbNull, DateTimeOffset.Now, Scheduler.Immediate));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Delay(_qbMy, DateTimeOffset.Now, default(IScheduler)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Delay(_qbNull, TimeSpan.Zero));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Delay(_qbNull, TimeSpan.Zero, Scheduler.Immediate));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Delay(_qbMy, TimeSpan.Zero, default(IScheduler)));
- }
-
- [TestMethod]
- public void Delay()
- {
- _qbMy.Delay(DateTimeOffset.Now);
- _qbMy.Delay(TimeSpan.Zero);
- _qbMy.Delay(DateTimeOffset.Now, Scheduler.Immediate);
- _qbMy.Delay(TimeSpan.Zero, Scheduler.Immediate);
- }
-
- [TestMethod]
- public void Dematerialize_ArgumentNullChecks()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Dematerialize(default(IQbservable<Notification<int>>)));
- }
-
- [TestMethod]
- public void Dematerialize()
- {
- new MyQbservable<Notification<int>>().Dematerialize();
- }
-
- [TestMethod]
- public void DistinctUntilChanged_ArgumentNullChecks()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.DistinctUntilChanged(_qbNull));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.DistinctUntilChanged(_qbNull, a => a));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.DistinctUntilChanged(_qbMy, default(Expression<Func<int, int>>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.DistinctUntilChanged(_qbNull, EqualityComparer<int>.Default));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.DistinctUntilChanged(_qbMy, default(IEqualityComparer<int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.DistinctUntilChanged(_qbNull, a => a, EqualityComparer<int>.Default));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.DistinctUntilChanged(_qbMy, default(Expression<Func<int, int>>), EqualityComparer<int>.Default));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.DistinctUntilChanged(_qbMy, a => a, default(IEqualityComparer<int>)));
- }
-
- [TestMethod]
- public void DistinctUntilChanged()
- {
- _qbMy.DistinctUntilChanged();
- _qbMy.DistinctUntilChanged(a => a);
- _qbMy.DistinctUntilChanged(EqualityComparer<int>.Default);
- _qbMy.DistinctUntilChanged(a => a, EqualityComparer<int>.Default);
- }
-
- [TestMethod]
- public void Do_ArgumentNullChecks()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Do(_qbNull, i => Console.WriteLine(i)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Do(_qbMy, default(Expression<Action<int>>)));
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Do(_qbNull, i => Console.WriteLine(i), ex => Console.WriteLine(ex.Message)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Do(_qbMy, default(Expression<Action<int>>), ex => Console.WriteLine(ex.Message)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Do(_qbMy, i => Console.WriteLine(i), default(Expression<Action<Exception>>)));
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Do(_qbNull, i => Console.WriteLine(i), () => Console.WriteLine()));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Do(_qbMy, default(Expression<Action<int>>), () => Console.WriteLine()));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Do(_qbMy, i => Console.WriteLine(i), default(Expression<Action>)));
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Do(_qbNull, i => Console.WriteLine(i), ex => Console.WriteLine(ex.Message), () => Console.WriteLine()));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Do(_qbMy, default(Expression<Action<int>>), ex => Console.WriteLine(ex.Message), () => Console.WriteLine()));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Do(_qbMy, i => Console.WriteLine(i), default(Expression<Action<Exception>>), () => Console.WriteLine()));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Do(_qbMy, i => Console.WriteLine(i), ex => Console.WriteLine(ex.Message), default(Expression<Action>)));
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Do(_qbNull, Observer.Create<int>(i => Console.WriteLine(i))));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Do(_qbMy, default(IObserver<int>)));
- }
-
- [TestMethod]
- public void Do()
- {
- _qbMy.Do(i => Console.WriteLine(i));
- _qbMy.Do(i => Console.WriteLine(i), ex => Console.WriteLine(ex.Message));
- _qbMy.Do(i => Console.WriteLine(i), () => Console.WriteLine());
- _qbMy.Do(i => Console.WriteLine(i), ex => Console.WriteLine(ex.Message), () => Console.WriteLine());
- _qbMy.Do(Observer.Create<int>(i => Console.WriteLine(i)));
- }
-
- [TestMethod]
- public void DoWhile_ArgumentNullChecks()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.DoWhile(_qbNull, () => true));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.DoWhile(_qbMy, null));
- }
-
- [TestMethod]
- public void DoWhile()
- {
- _qbMy.DoWhile(() => true);
- }
-
- [TestMethod]
- public void Empty_ArgumentNullChecks()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Empty<int>(null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Empty<int>(_qbp, null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Empty<int>(null, Scheduler.Immediate));
- }
-
- [TestMethod]
- public void Empty()
- {
- _qbp.Empty<int>();
- _qbp.Empty<int>(Scheduler.Immediate);
- }
-
- [TestMethod]
- public void Finally_ArgumentNullChecks()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Finally(_qbNull, () => Console.WriteLine()));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Finally(_qbMy, null));
- }
-
- [TestMethod]
- public void Finally()
- {
- _qbMy.Finally(() => Console.WriteLine());
- }
-
- [TestMethod]
- public void For_ArgumentNullChecks()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.For(null, new[] { 1 }, i => _qbMy));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.For(_qbp, default(IEnumerable<int>), i => _qbMy));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.For(_qbp, new[] { 1 }, default(Expression<Func<int, IObservable<int>>>)));
- }
-
- [TestMethod]
- public void For()
- {
- _qbp.For(new[] { 1 }, i => _qbMy);
- }
-
- [TestMethod]
- public void FromEvent_ArgumentNullChecks()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.FromEventPattern<EventArgs>(null, "", "Event"));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.FromEventPattern<EventArgs>(_qbp, null, "Event"));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.FromEventPattern<EventArgs>(_qbp, "", null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.FromEventPattern<EventArgs>(null, e => Console.WriteLine(), e => Console.WriteLine()));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.FromEventPattern<EventArgs>(_qbp, null, e => Console.WriteLine()));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.FromEventPattern<EventArgs>(_qbp, e => Console.WriteLine(), null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.FromEventPattern<Action, EventArgs>(null, e => () => Console.WriteLine(), e => Console.WriteLine(), e => Console.WriteLine()));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.FromEventPattern<Action, EventArgs>(_qbp, null, e => Console.WriteLine(), e => Console.WriteLine()));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.FromEventPattern<Action, EventArgs>(_qbp, e => () => Console.WriteLine(), null, e => Console.WriteLine()));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.FromEventPattern<Action, EventArgs>(_qbp, e => () => Console.WriteLine(), e => Console.WriteLine(), null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.FromEventPattern(_qbp, default(Expression<Action<EventHandler>>), e => Console.WriteLine()));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.FromEventPattern(_qbp, e => Console.WriteLine(), default(Expression<Action<EventHandler>>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.FromEventPattern(null, e => Console.WriteLine(), e => Console.WriteLine()));
- }
-
- [TestMethod]
- public void FromEvent()
- {
- _qbp.FromEventPattern<EventArgs>("", "Event");
- _qbp.FromEventPattern<EventArgs>(e => Console.WriteLine(), e => Console.WriteLine());
- _qbp.FromEventPattern<Action, EventArgs>(e => () => Console.WriteLine(), a => Console.WriteLine(), a => Console.WriteLine());
- _qbp.FromEventPattern(e => Console.WriteLine(), e => Console.WriteLine());
- }
-
- [TestMethod]
- public void Generate_ArgumentNullChecks()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Generate(null, 1, i => true, i => i + 1, i => i));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Generate(_qbp, 1, null, i => i + 1, i => i));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Generate(_qbp, 1, i => true, i => i + 1, default(Expression<Func<int, int>>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Generate(_qbp, 1, i => true, null, i => i));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Generate(null, 1, i => true, i => i + 1, i => i, Scheduler.Immediate));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Generate(_qbp, 1, null, i => i + 1, i => i, Scheduler.Immediate));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Generate(_qbp, 1, i => true, i => i + 1, default(Expression<Func<int, int>>), Scheduler.Immediate));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Generate(_qbp, 1, i => true, null, i => i, Scheduler.Immediate));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Generate(_qbp, 1, i => true, i => i + 1, i => i, default(IScheduler)));
- }
-
- [TestMethod]
- public void Generate()
- {
- _qbp.Generate(1, i => true, i => i + 1, i => i);
- _qbp.Generate(1, i => true, i => i + 1, i => i, Scheduler.Immediate);
- }
-
- [TestMethod]
- public void GenerateWithTime_ArgumentNullChecks()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Generate(null, 1, i => true, i => i + 1, i => i, i => DateTimeOffset.Now));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Generate(_qbp, 1, null, i => i + 1, i => i, i => DateTimeOffset.Now));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Generate(_qbp, 1, i => true, i => i + 1, default(Expression<Func<int, int>>), i => DateTimeOffset.Now));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Generate(_qbp, 1, i => true, null, i => i, i => DateTimeOffset.Now));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Generate(_qbp, 1, i => true, i => i + 1, i => i, default(Expression<Func<int, DateTimeOffset>>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Generate(null, 1, i => true, i => i + 1, i => i, i => DateTimeOffset.Now, Scheduler.Immediate));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Generate(_qbp, 1, null, i => i + 1, i => i, i => DateTimeOffset.Now, Scheduler.Immediate));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Generate(_qbp, 1, i => true, i => i + 1, default(Expression<Func<int, int>>), i => DateTimeOffset.Now, Scheduler.Immediate));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Generate(_qbp, 1, i => true, i => i + 1, i => i, default(Expression<Func<int, DateTimeOffset>>), Scheduler.Immediate));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Generate(_qbp, 1, i => true, null, i => i, i => DateTimeOffset.Now, Scheduler.Immediate));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Generate(_qbp, 1, i => true, i => i + 1, i => i, i => DateTimeOffset.Now, null));
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Generate(null, 1, i => true, i => i + 1, i => i, i => TimeSpan.Zero));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Generate(_qbp, 1, null, i => i + 1, i => i, i => TimeSpan.Zero));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Generate(_qbp, 1, i => true, i => i + 1, default(Expression<Func<int, int>>), i => TimeSpan.Zero));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Generate(_qbp, 1, i => true, null, i => i, i => TimeSpan.Zero));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Generate(_qbp, 1, i => true, i => i + 1, i => i, default(Expression<Func<int, TimeSpan>>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Generate(null, 1, i => true, i => i + 1, i => i, i => TimeSpan.Zero, Scheduler.Immediate));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Generate(_qbp, 1, null, i => i + 1, i => i, i => TimeSpan.Zero, Scheduler.Immediate));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Generate(_qbp, 1, i => true, i => i + 1, default(Expression<Func<int, int>>), i => TimeSpan.Zero, Scheduler.Immediate));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Generate(_qbp, 1, i => true, i => i + 1, i => i, default(Expression<Func<int, TimeSpan>>), Scheduler.Immediate));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Generate(_qbp, 1, i => true, null, i => i, i => TimeSpan.Zero, Scheduler.Immediate));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Generate(_qbp, 1, i => true, i => i + 1, i => i, i => TimeSpan.Zero, null));
- }
-
- [TestMethod]
- public void GenerateWithTime()
- {
- _qbp.Generate(1, i => true, i => i + 1, i => i, i => DateTimeOffset.Now);
- _qbp.Generate(1, i => true, i => i + 1, i => i, i => DateTimeOffset.Now, Scheduler.Immediate);
- _qbp.Generate(1, i => true, i => i + 1, i => i, i => TimeSpan.Zero);
- _qbp.Generate(1, i => true, i => i + 1, i => i, i => TimeSpan.Zero, Scheduler.Immediate);
- }
-
- [TestMethod]
- public void GroupBy_ArgumentNullChecks()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.GroupBy(_qbNull, x => x));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.GroupBy(_qbMy, default(Expression<Func<int, int>>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.GroupBy(_qbNull, x => x, EqualityComparer<int>.Default));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.GroupBy(_qbMy, default(Expression<Func<int, int>>), EqualityComparer<int>.Default));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.GroupBy(_qbMy, x => x, default(IEqualityComparer<int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.GroupBy(_qbNull, x => x, x => x));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.GroupBy(_qbMy, default(Expression<Func<int, int>>), x => x));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.GroupBy(_qbMy, x => x, default(Expression<Func<int, int>>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.GroupBy(_qbNull, x => x, x => x, EqualityComparer<int>.Default));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.GroupBy(_qbMy, default(Expression<Func<int, int>>), x => x, EqualityComparer<int>.Default));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.GroupBy(_qbMy, x => x, default(Expression<Func<int, int>>), EqualityComparer<int>.Default));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.GroupBy(_qbMy, x => x, x => x, default(IEqualityComparer<int>)));
- }
-
- [TestMethod]
- public void GroupBy()
- {
- _qbMy.GroupBy(x => (double)x);
- _qbMy.GroupBy(x => (double)x, EqualityComparer<double>.Default);
- _qbMy.GroupBy(x => (double)x, x => x.ToString());
- _qbMy.GroupBy(x => (double)x, x => x.ToString(), EqualityComparer<double>.Default);
- }
-
- [TestMethod]
- public void If_ArgumentNullChecks()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.If(null, () => true, _qbMy, _qbMy));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.If(_qbp, null, _qbMy, _qbMy));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.If(_qbp, () => true, _qbNull, _qbMy));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.If(_qbp, () => true, _qbMy, _qbNull));
- }
-
- [TestMethod]
- public void If()
- {
- _qbp.If(() => true, _qbMy, _qbMy);
- }
-
- [TestMethod]
- public void Interval_ArgumentNullChecks()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Interval(null, TimeSpan.Zero));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Interval(null, TimeSpan.Zero, Scheduler.Immediate));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Interval(_qbp, TimeSpan.Zero, default(IScheduler)));
- }
-
- [TestMethod]
- public void Interval()
- {
- _qbp.Interval(TimeSpan.Zero);
- _qbp.Interval(TimeSpan.Zero, Scheduler.Immediate);
- }
-
- [TestMethod]
- public void IsEmpty_ArgumentNullChecks()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.IsEmpty(_qbNull));
- }
-
- [TestMethod]
- public void IsEmpty()
- {
- _qbMy.IsEmpty();
- }
-
- [TestMethod]
- public void Latest_ArgumentNullChecks()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Latest(_qbNull));
- }
-
- [TestMethod]
- public void Latest()
- {
- ReactiveAssert.Throws<InvalidCastException>(() => _qbMy.Latest());
- new MyQbservableQueryable<int>().Latest();
- }
-
- [TestMethod]
- public void LongCount_ArgumentNullChecks()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.LongCount(_qbNull));
- }
-
- [TestMethod]
- public void LongCount()
- {
- _qbMy.LongCount();
- }
-
- [TestMethod]
- public void Materialize_ArgumentNullChecks()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Materialize(_qbNull));
- }
-
- [TestMethod]
- public void Materialize()
- {
- _qbMy.Materialize();
- }
-
- [TestMethod]
- public void Max_ArgumentNullChecks()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Max<string>(null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Max<string>(null, Comparer<string>.Default));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Max<string>(new MyQbservable<string>(), default(IComparer<string>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Max(default(IQbservable<decimal?>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Max(default(IQbservable<decimal>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Max(default(IQbservable<double?>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Max(default(IQbservable<double>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Max(default(IQbservable<float?>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Max(default(IQbservable<float>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Max(default(IQbservable<int?>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Max(default(IQbservable<int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Max(default(IQbservable<long?>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Max(default(IQbservable<long>)));
- }
-
- [TestMethod]
- public void Max()
- {
- new MyQbservable<string>().Max();
- new MyQbservable<string>().Max(Comparer<string>.Default);
- new MyQbservable<decimal?>().Max();
- new MyQbservable<decimal>().Max();
- new MyQbservable<double?>().Max();
- new MyQbservable<double>().Max();
- new MyQbservable<float?>().Max();
- new MyQbservable<float>().Max();
- new MyQbservable<int?>().Max();
- new MyQbservable<int>().Max();
- new MyQbservable<long?>().Max();
- new MyQbservable<long>().Max();
- }
-
- [TestMethod]
- public void MaxBy_ArgumentNullChecks()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.MaxBy(default(IQbservable<string>), s => s.Length));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.MaxBy(new MyQbservable<string>(), default(Expression<Func<string, int>>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.MaxBy(default(IQbservable<string>), s => s.Length, Comparer<int>.Default));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.MaxBy(new MyQbservable<string>(), default(Expression<Func<string, int>>), Comparer<int>.Default));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.MaxBy(new MyQbservable<string>(), s => s.Length, default(IComparer<int>)));
- }
-
- [TestMethod]
- public void MaxBy()
- {
- new MyQbservable<string>().MaxBy(s => s.Length);
- new MyQbservable<string>().MaxBy(s => s.Length, Comparer<int>.Default);
- }
-
- [TestMethod]
- public void Merge_ArgumentNullChecks()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Merge(_qbNull, _qbMy));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Merge(_qbMy, _qbNull));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Merge(_qbNull, _qbMy, Scheduler.Immediate));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Merge(_qbMy, _qbNull, Scheduler.Immediate));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Merge(_qbMy, _qbMy, default(IScheduler)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Merge(default(IQbservable<IObservable<int>>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Merge(default(IQbservableProvider), _qbMy));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Merge(_qbp, default(IQbservable<int>[])));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Merge(default(IQbservableProvider), Scheduler.Immediate, _qbMy));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Merge(_qbp, default(IScheduler), _qbMy));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Merge(_qbp, Scheduler.Immediate, default(IQbservable<int>[])));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Merge(default(IQbservableProvider), new MyQueryable<IObservable<int>>()));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Merge(_qbp, default(IQueryable<IObservable<int>>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Merge(default(IQbservableProvider), new MyQueryable<IObservable<int>>(), Scheduler.Immediate));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Merge(_qbp, new MyQueryable<IObservable<int>>(), default(IScheduler)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Merge(_qbp, default(IQueryable<IObservable<int>>), Scheduler.Immediate));
- }
-
- [TestMethod]
- public void Merge()
- {
- _qbMy.Merge(_qbMy);
- _qbMy.Merge(_qbMy, Scheduler.Immediate);
- new MyQbservable<IObservable<int>>().Merge();
- _qbp.Merge(_qbMy, _qbMy);
- _qbp.Merge(Scheduler.Immediate, _qbMy, _qbMy);
- _qbp.Merge(new MyQueryable<IObservable<int>>());
- _qbp.Merge(new MyQueryable<IObservable<int>>(), Scheduler.Immediate);
- }
-
- [TestMethod]
- public void Min_ArgumentNullChecks()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Min<string>(null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Min<string>(null, Comparer<string>.Default));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Min<string>(new MyQbservable<string>(), default(IComparer<string>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Min(default(IQbservable<decimal?>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Min(default(IQbservable<decimal>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Min(default(IQbservable<double?>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Min(default(IQbservable<double>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Min(default(IQbservable<float?>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Min(default(IQbservable<float>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Min(default(IQbservable<int?>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Min(default(IQbservable<int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Min(default(IQbservable<long?>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Min(default(IQbservable<long>)));
- }
-
- [TestMethod]
- public void Min()
- {
- new MyQbservable<string>().Min();
- new MyQbservable<string>().Min(Comparer<string>.Default);
- new MyQbservable<decimal?>().Min();
- new MyQbservable<decimal>().Min();
- new MyQbservable<double?>().Min();
- new MyQbservable<double>().Min();
- new MyQbservable<float?>().Min();
- new MyQbservable<float>().Min();
- new MyQbservable<int?>().Min();
- new MyQbservable<int>().Min();
- new MyQbservable<long?>().Min();
- new MyQbservable<long>().Min();
- }
-
- [TestMethod]
- public void MinBy_ArgumentNullChecks()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.MinBy(default(IQbservable<string>), s => s.Length));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.MinBy(new MyQbservable<string>(), default(Expression<Func<string, int>>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.MinBy(default(IQbservable<string>), s => s.Length, Comparer<int>.Default));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.MinBy(new MyQbservable<string>(), default(Expression<Func<string, int>>), Comparer<int>.Default));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.MinBy(new MyQbservable<string>(), s => s.Length, default(IComparer<int>)));
- }
-
- [TestMethod]
- public void MinBy()
- {
- new MyQbservable<string>().MinBy(s => s.Length);
- new MyQbservable<string>().MinBy(s => s.Length, Comparer<int>.Default);
- }
-
- [TestMethod]
- public void MostRecent_ArgumentNullChecks()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.MostRecent(_qbNull, 1));
- }
-
- [TestMethod]
- public void MostRecent()
- {
- ReactiveAssert.Throws<InvalidCastException>(() => _qbMy.MostRecent(1));
- new MyQbservableQueryable<int>().MostRecent(1);
- }
-
- [TestMethod]
- public void Never_ArgumentNullChecks()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Never<int>(null));
- }
-
- [TestMethod]
- public void Never()
- {
- _qbp.Never<int>();
- }
-
- [TestMethod]
- public void Next_ArgumentNullChecks()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Next(_qbNull));
- }
-
- [TestMethod]
- public void Next()
- {
- ReactiveAssert.Throws<InvalidCastException>(() => _qbMy.Next());
- new MyQbservableQueryable<int>().Next();
- }
-
- [TestMethod]
- public void ObserveOn_ArgumentNullChecks()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.ObserveOn(_qbMy, default(IScheduler)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.ObserveOn(_qbMy, default(SynchronizationContext)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.ObserveOn(_qbMy, default(DispatcherScheduler)));
-#if HAS_WINFORMS
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.ObserveOn(_qbMy, default(ControlScheduler)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.ObserveOn(_qbNull, new ControlScheduler(new System.Windows.Forms.Form())));
-#endif
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.ObserveOn(_qbNull, Scheduler.Immediate));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.ObserveOn(_qbNull, new SynchronizationContext()));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.ObserveOn(_qbNull, DispatcherScheduler.Instance));
- }
-
- [TestMethod]
- public void ObserveOn()
- {
- _qbMy.ObserveOn(Scheduler.Immediate);
- _qbMy.ObserveOn(new SynchronizationContext());
- Qbservable.ObserveOn(_qbMy, DispatcherScheduler.Instance);
- }
-
- [TestMethod]
- public void OfType_ArgumentNullChecks()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.OfType<int>(default(MyQbservable<object>)));
- }
-
- [TestMethod]
- public void OfType()
- {
- Qbservable.OfType<int>(new MyQbservable<object>());
- }
-
- [TestMethod]
- public void OnErrorResumeNext_ArgumentNullChecks()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.OnErrorResumeNext(_qbNull, _qbMy));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.OnErrorResumeNext(_qbMy, _qbNull));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.OnErrorResumeNext(default(IQbservableProvider), _qbMy));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.OnErrorResumeNext(_qbp, default(IQbservable<int>[])));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.OnErrorResumeNext(default(IQbservableProvider), new MyQueryable<IObservable<int>>()));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.OnErrorResumeNext(_qbp, default(IQueryable<IObservable<int>>)));
- }
-
- [TestMethod]
- public void OnErrorResumeNext()
- {
- _qbMy.OnErrorResumeNext(_qbMy);
- _qbp.OnErrorResumeNext(_qbMy, _qbMy);
- _qbp.OnErrorResumeNext(new MyQueryable<IObservable<int>>());
- }
-
-
- [TestMethod]
- public void Range_ArgumentNullChecks()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Range(null, 0, 10));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Range(null, 0, 10, Scheduler.Immediate));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Range(_qbp, 0, 10, default(IScheduler)));
- }
-
- [TestMethod]
- public void Range()
- {
- _qbp.Range(0, 10);
- _qbp.Range(0, 10, Scheduler.Immediate);
- }
-
- [TestMethod]
- public void RefCount_ArgumentNullChecks()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.RefCount(null, Observable.Return(1).Multicast(new ReplaySubject<int>())));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.RefCount(_qbp, default(IConnectableObservable<int>)));
- }
-
- [TestMethod]
- public void RefCount()
- {
- _qbp.RefCount(Observable.Return(1).Multicast(new ReplaySubject<int>()));
- }
-
- [TestMethod]
- public void Repeat_ArgumentNullChecks()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Repeat(null, 0));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Repeat(null, 0, Scheduler.Immediate));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Repeat(_qbp, 0, default(IScheduler)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Repeat(null, 0, 10));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Repeat(null, 0, 10, Scheduler.Immediate));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Repeat(_qbp, 0, 10, default(IScheduler)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Repeat(_qbNull));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Repeat(_qbNull, 1));
- }
-
- [TestMethod]
- public void Repeat()
- {
- _qbMy.Repeat();
- _qbMy.Repeat(1);
- _qbp.Repeat(42);
- _qbp.Repeat(42, 1);
- _qbp.Repeat(42, Scheduler.Immediate);
- _qbp.Repeat(42, 1, Scheduler.Immediate);
- }
- [TestMethod]
- public void Retry_ArgumentNullChecks()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Retry(_qbNull));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Retry(_qbNull, 1));
- }
-
- [TestMethod]
- public void Retry()
- {
- _qbMy.Retry();
- _qbMy.Retry(1);
- }
-
- [TestMethod]
- public void Return_ArgumentNullChecks()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Return(null, 1));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Return(null, 1, Scheduler.Immediate));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Return(_qbp, 1, default(IScheduler)));
- }
-
- [TestMethod]
- public void Return()
- {
- _qbp.Return(1);
- _qbp.Return(1, Scheduler.Immediate);
- }
-
- [TestMethod]
- public void Sample_ArgumentNullChecks()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Sample(_qbNull, TimeSpan.Zero));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Sample(_qbNull, TimeSpan.Zero, Scheduler.Immediate));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Sample(_qbMy, TimeSpan.Zero, default(IScheduler)));
- }
-
- [TestMethod]
- public void Sample()
- {
- _qbMy.Sample(TimeSpan.Zero);
- _qbMy.Sample(TimeSpan.Zero, Scheduler.Immediate);
- }
-
- [TestMethod]
- public void Scan_ArgumentNullChecks()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Scan(_qbNull, (a, b) => a + b));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Scan(_qbMy, null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Scan(_qbNull, 1, (a, b) => a + b));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Scan(_qbMy, 1, null));
- }
-
- [TestMethod]
- public void Scan()
- {
- _qbMy.Scan((a, b) => a + b);
- _qbMy.Scan("", (a, b) => a + b);
- }
-
- [TestMethod]
- public void Select_ArgumentNullChecks()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Select(_qbNull, x => x));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Select(_qbNull, (x, i) => x));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Select(_qbMy, default(Expression<Func<int, int>>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Select(_qbMy, default(Expression<Func<int, int, int>>)));
- }
-
- [TestMethod]
- public void Select()
- {
- _qbMy.Select(x => x + 1);
- _qbMy.Select((x, i) => x + i);
- }
-
- [TestMethod]
- public void SelectMany_ArgumentNullChecks()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.SelectMany(_qbNull, x => new[] { "" }));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.SelectMany(_qbMy, default(Expression<Func<int, IEnumerable<string>>>)));
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.SelectMany(_qbNull, x => Observable.Return("")));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.SelectMany(_qbMy, default(Expression<Func<int, IObservable<string>>>)));
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.SelectMany(_qbNull, _qbMy));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.SelectMany(_qbMy, _qbNull));
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.SelectMany(_qbNull, x => Observable.Return(""), (x, s) => 0.0));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.SelectMany(_qbMy, default(Expression<Func<int, IObservable<string>>>), (x, s) => 0.0));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.SelectMany(_qbMy, x => Observable.Return(""), default(Expression<Func<int, string, double>>)));
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.SelectMany(_qbNull, x => Observable.Return(""), x => Observable.Return(""), () => Observable.Return("")));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.SelectMany(_qbMy, default(Expression<Func<int, IObservable<string>>>), x => Observable.Return(""), () => Observable.Return("")));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.SelectMany(_qbMy, x => Observable.Return(""), default(Expression<Func<Exception, IObservable<string>>>), () => Observable.Return("")));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.SelectMany(_qbMy, x => Observable.Return(""), x => Observable.Return(""), default(Expression<Func<IObservable<string>>>)));
- }
-
- [TestMethod]
- public void SelectMany()
- {
- _qbMy.SelectMany(x => new[] { "" });
- _qbMy.SelectMany(x => Observable.Return(""));
- _qbMy.SelectMany(_qbMy);
- _qbMy.SelectMany(x => Observable.Return(""), (x, s) => 0.0);
- _qbMy.SelectMany(x => Observable.Return(""), x => Observable.Return(""), () => Observable.Return(""));
- }
-
- [TestMethod]
- public void Skip_ArgumentNullChecks()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Skip(_qbNull, 1));
- }
-
- [TestMethod]
- public void Skip()
- {
- _qbMy.Skip(1);
- }
-
- [TestMethod]
- public void SkipLast_ArgumentNullChecks()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.SkipLast(_qbNull, 1));
- }
-
- [TestMethod]
- public void SkipLast()
- {
- _qbMy.SkipLast(1);
- }
-
- [TestMethod]
- public void SkipUntil_ArgumentNullChecks()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.SkipUntil(_qbNull, _qbMy));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.SkipUntil(_qbMy, _qbNull));
- }
-
- [TestMethod]
- public void SkipUntil()
- {
- _qbMy.SkipUntil(_qbMy);
- }
-
- [TestMethod]
- public void SkipWhile_ArgumentNullChecks()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.SkipWhile(_qbNull, x => true));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.SkipWhile(_qbMy, default(Expression<Func<int, bool>>)));
- }
-
- [TestMethod]
- public void SkipWhile()
- {
- _qbMy.SkipWhile(x => true);
- }
-
- [TestMethod]
- public void StartWith_ArgumentNullChecks()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.StartWith(_qbNull, new[] { 1 }));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.StartWith(_qbMy, default(int[])));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.StartWith(_qbNull, Scheduler.Immediate, new[] { 1 }));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.StartWith(_qbMy, default(IScheduler), new[] { 1 }));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.StartWith(_qbMy, Scheduler.Immediate, default(int[])));
- }
-
- [TestMethod]
- public void StartWith()
- {
- Ignore(_qbMy.StartWith(1, 2, 3));
- Ignore(_qbMy.StartWith(Scheduler.Immediate, 1, 2, 3));
- }
-
- [TestMethod]
- public void SubscribeOn_ArgumentNullChecks()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.SubscribeOn(_qbMy, default(IScheduler)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.SubscribeOn(_qbMy, default(SynchronizationContext)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.SubscribeOn(_qbMy, default(DispatcherScheduler)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.SubscribeOn(_qbNull, Scheduler.Immediate));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.SubscribeOn(_qbNull, new SynchronizationContext()));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.SubscribeOn(_qbNull, DispatcherScheduler.Instance));
-#if HAS_WINFORMS
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.SubscribeOn(_qbMy, default(ControlScheduler)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.SubscribeOn(_qbNull, new ControlScheduler(new System.Windows.Forms.Form())));
-#endif
- }
-
- [TestMethod]
- public void SubscribeOn()
- {
- _qbMy.SubscribeOn(Scheduler.Immediate);
- _qbMy.SubscribeOn(new SynchronizationContext());
- Qbservable.SubscribeOn(_qbMy, DispatcherScheduler.Instance);
-#if HAS_WINFORMS
- _qbMy.SubscribeOn(new ControlScheduler(new System.Windows.Forms.Form()));
-#endif
- }
-
- [TestMethod]
- public void Sum_ArgumentNullChecks()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Sum(default(IQbservable<decimal?>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Sum(default(IQbservable<decimal>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Sum(default(IQbservable<double?>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Sum(default(IQbservable<double>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Sum(default(IQbservable<float?>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Sum(default(IQbservable<float>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Sum(default(IQbservable<int?>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Sum(default(IQbservable<int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Sum(default(IQbservable<long?>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Sum(default(IQbservable<long>)));
- }
-
- [TestMethod]
- public void Sum()
- {
- new MyQbservable<decimal?>().Sum();
- new MyQbservable<decimal>().Sum();
- new MyQbservable<double?>().Sum();
- new MyQbservable<double>().Sum();
- new MyQbservable<float?>().Sum();
- new MyQbservable<float>().Sum();
- new MyQbservable<int?>().Sum();
- new MyQbservable<int>().Sum();
- new MyQbservable<long?>().Sum();
- new MyQbservable<long>().Sum();
- }
-
- [TestMethod]
- public void Switch_ArgumentNullChecks()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Switch<int>(default(IQbservable<IObservable<int>>)));
- }
-
- [TestMethod]
- public void Switch()
- {
- new MyQbservable<IObservable<int>>().Switch();
- }
-
- [TestMethod]
- public void Synchronize_ArgumentNullChecks()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Synchronize(_qbNull));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Synchronize(_qbNull, ""));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Synchronize(_qbMy, null));
- }
-
- [TestMethod]
- public void Synchronize()
- {
- _qbMy.Synchronize();
- _qbMy.Synchronize("");
- }
-
- [TestMethod]
- public void Take_ArgumentNullChecks()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Take(_qbNull, 1));
- }
-
- [TestMethod]
- public void Take()
- {
- _qbMy.Take(1);
- }
-
- [TestMethod]
- public void TakeLast_ArgumentNullChecks()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.TakeLast(_qbNull, 1));
- }
-
- [TestMethod]
- public void TakeLast()
- {
- _qbMy.TakeLast(1);
- }
-
- [TestMethod]
- public void TakeUntil_ArgumentNullChecks()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.TakeUntil(_qbNull, _qbMy));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.TakeUntil(_qbMy, _qbNull));
- }
-
- [TestMethod]
- public void TakeUntil()
- {
- _qbMy.TakeUntil(_qbMy);
- }
-
- [TestMethod]
- public void TakeWhile_ArgumentNullChecks()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.TakeWhile(_qbNull, x => true));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.TakeWhile(_qbMy, default(Expression<Func<int, bool>>)));
- }
-
- [TestMethod]
- public void TakeWhile()
- {
- _qbMy.TakeWhile(x => true);
- }
-
- [TestMethod]
- public void Throttle_ArgumentNullChecks()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Throttle(_qbNull, TimeSpan.Zero));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Throttle(_qbNull, TimeSpan.Zero, Scheduler.Immediate));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Throttle(_qbMy, TimeSpan.Zero, default(IScheduler)));
- }
-
- [TestMethod]
- public void Throttle()
- {
- _qbMy.Throttle(TimeSpan.Zero);
- _qbMy.Throttle(TimeSpan.Zero, Scheduler.Immediate);
- }
-
- [TestMethod]
- public void Throw_ArgumentNullChecks()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Throw<int>(null, new Exception()));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Throw<int>(_qbp, null));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Throw<int>(null, new Exception(), Scheduler.Immediate));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Throw<int>(_qbp, null, Scheduler.Immediate));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Throw<int>(_qbp, new Exception(), default(IScheduler)));
- }
-
- [TestMethod]
- public void Throw()
- {
- _qbp.Throw<int>(new Exception());
- _qbp.Throw<int>(new Exception(), Scheduler.Immediate);
- }
-
- [TestMethod]
- public void TimeInterval_ArgumentNullChecks()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.TimeInterval(_qbNull));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.TimeInterval(_qbNull, Scheduler.Immediate));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.TimeInterval(_qbMy, default(IScheduler)));
- }
-
- [TestMethod]
- public void TimeInterval()
- {
- _qbMy.TimeInterval();
- _qbMy.TimeInterval(Scheduler.Immediate);
- }
-
- [TestMethod]
- public void Timeout_ArgumentNullChecks()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Timeout(_qbNull, DateTimeOffset.Now));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Timeout(_qbNull, TimeSpan.Zero));
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Timeout(_qbNull, DateTimeOffset.Now, _qbMy));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Timeout(_qbNull, TimeSpan.Zero, _qbMy));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Timeout(_qbMy, DateTimeOffset.Now, _qbNull));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Timeout(_qbMy, TimeSpan.Zero, _qbNull));
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Timeout(_qbNull, DateTimeOffset.Now, Scheduler.Immediate));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Timeout(_qbNull, TimeSpan.Zero, Scheduler.Immediate));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Timeout(_qbMy, DateTimeOffset.Now, default(IScheduler)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Timeout(_qbMy, TimeSpan.Zero, default(IScheduler)));
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Timeout(_qbNull, DateTimeOffset.Now, _qbMy, Scheduler.Immediate));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Timeout(_qbNull, TimeSpan.Zero, _qbMy, Scheduler.Immediate));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Timeout(_qbMy, DateTimeOffset.Now, _qbNull, Scheduler.Immediate));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Timeout(_qbMy, TimeSpan.Zero, _qbNull, Scheduler.Immediate));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Timeout(_qbMy, DateTimeOffset.Now, _qbMy, default(IScheduler)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Timeout(_qbMy, TimeSpan.Zero, _qbMy, default(IScheduler)));
- }
-
- [TestMethod]
- public void Timeout()
- {
- _qbMy.Timeout(DateTimeOffset.Now);
- _qbMy.Timeout(TimeSpan.Zero);
- _qbMy.Timeout(DateTimeOffset.Now, _qbMy);
- _qbMy.Timeout(TimeSpan.Zero, _qbMy);
- _qbMy.Timeout(DateTimeOffset.Now, Scheduler.Immediate);
- _qbMy.Timeout(TimeSpan.Zero, Scheduler.Immediate);
- _qbMy.Timeout(DateTimeOffset.Now, _qbMy, Scheduler.Immediate);
- _qbMy.Timeout(TimeSpan.Zero, _qbMy, Scheduler.Immediate);
- }
-
- [TestMethod]
- public void Timer_ArgumentNullChecks()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Timer(null, DateTimeOffset.Now));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Timer(null, TimeSpan.Zero));
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Timer(null, DateTimeOffset.Now, Scheduler.Immediate));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Timer(_qbp, DateTimeOffset.Now, default(IScheduler)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Timer(null, TimeSpan.Zero, Scheduler.Immediate));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Timer(_qbp, TimeSpan.Zero, default(IScheduler)));
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Timer(null, DateTimeOffset.Now, TimeSpan.Zero));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Timer(null, TimeSpan.Zero, TimeSpan.Zero));
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Timer(null, DateTimeOffset.Now, TimeSpan.Zero, Scheduler.Immediate));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Timer(_qbp, DateTimeOffset.Now, TimeSpan.Zero, default(IScheduler)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Timer(null, TimeSpan.Zero, TimeSpan.Zero, Scheduler.Immediate));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Timer(_qbp, TimeSpan.Zero, TimeSpan.Zero, default(IScheduler)));
- }
-
- [TestMethod]
- public void Timer()
- {
- _qbp.Timer(DateTimeOffset.Now);
- _qbp.Timer(TimeSpan.Zero);
- _qbp.Timer(DateTimeOffset.Now, Scheduler.Immediate);
- _qbp.Timer(TimeSpan.Zero, Scheduler.Immediate);
- _qbp.Timer(DateTimeOffset.Now, TimeSpan.Zero);
- _qbp.Timer(TimeSpan.Zero, TimeSpan.Zero);
- _qbp.Timer(DateTimeOffset.Now, TimeSpan.Zero, Scheduler.Immediate);
- _qbp.Timer(TimeSpan.Zero, TimeSpan.Zero, Scheduler.Immediate);
- }
-
- [TestMethod]
- public void Timestamp_ArgumentNullChecks()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Timestamp(_qbNull));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Timestamp(_qbNull, Scheduler.Immediate));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Timestamp(_qbMy, default(IScheduler)));
- }
-
- [TestMethod]
- public void Timestamp()
- {
- _qbMy.Timestamp();
- _qbMy.Timestamp(Scheduler.Immediate);
- }
-
- [TestMethod]
- public void ToObservable_ArgumentNullChecks()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.ToObservable(null, new[] { 1 }));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.ToObservable(_qbp, default(IEnumerable<int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.ToObservable(null, new[] { 1 }, Scheduler.Immediate));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.ToObservable(_qbp, default(IEnumerable<int>), Scheduler.Immediate));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.ToObservable(_qbp, new[] { 1 }, default(IScheduler)));
- }
-
- [TestMethod]
- public void ToObservable()
- {
- _qbp.ToObservable(new[] { 1 });
- _qbp.ToObservable(new[] { 1 }, Scheduler.Immediate);
- }
-
- [TestMethod]
- public void ToQueryable_ArgumentNullChecks()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.ToQueryable(_qbNull));
- }
-
- [TestMethod]
- public void ToQueryable()
- {
- ReactiveAssert.Throws<InvalidCastException>(() => _qbMy.ToQueryable());
- new MyQbservableQueryable<int>().ToQueryable();
- }
-
- [TestMethod]
- public void ToQbservable_ArgumentNullChecks()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.ToQbservable(default(IQueryable<int>)));
- }
-
- [TestMethod]
- public void ToQbservable()
- {
- ReactiveAssert.Throws<InvalidCastException>(() => new[] { 1 }.AsQueryable().ToQbservable());
- new MyQueryable<int>().ToQbservable();
- }
-
- [TestMethod]
- public void Using_ArgumentNullChecks()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Using(null, () => new MyDisposable(), x => Observable.Return(x.ToString())));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Using(_qbp, default(Expression<Func<MyDisposable>>), x => Observable.Return(x.ToString())));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Using(_qbp, () => new MyDisposable(), default(Expression<Func<MyDisposable, IObservable<int>>>)));
- }
-
- class MyDisposable : IDisposable
- {
- public void Dispose()
- {
- throw new NotImplementedException();
- }
- }
-
- [TestMethod]
- public void Using()
- {
- _qbp.Using(() => new MyDisposable(), x => Observable.Return(x.ToString()));
- }
-
- [TestMethod]
- public void Where_ArgumentNullChecks()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Where(_qbNull, x => true));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Where(_qbNull, (x, i) => true));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Where(_qbMy, default(Expression<Func<int, bool>>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Where(_qbMy, default(Expression<Func<int, int, bool>>)));
- }
-
- [TestMethod]
- public void Where()
- {
- _qbMy.Where(x => true);
- _qbMy.Where((x, i) => true);
- }
-
- [TestMethod]
- public void While_ArgumentNullChecks()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.While(null, () => true, _qbMy));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.While(_qbp, default(Expression<Func<bool>>), _qbMy));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.While(_qbp, () => true, _qbNull));
- }
-
- [TestMethod]
- public void While()
- {
- _qbp.While(() => true, _qbMy);
- }
-
- [TestMethod]
- public void Zip_ArgumentNullChecks()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Zip(_qbNull, _qbMy, (a, b) => a + b));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Zip(_qbMy, _qbNull, (a, b) => a + b));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Zip(_qbMy, _qbMy, default(Expression<Func<int, int, int>>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Zip(_qbNull, new[] { 1 }, (a, b) => a + b));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Zip(_qbMy, default(IEnumerable<int>), (a, b) => a + b));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Zip(_qbMy, new[] { 1 }, default(Expression<Func<int, int, int>>)));
- }
-
- [TestMethod]
- public void Zip()
- {
- _qbMy.Zip(_qbMy, (a, b) => a + b);
- _qbMy.Zip(new[] { 1 }, (a, b) => a + b);
- }
-
- [TestMethod]
- public void AsObservable_ArgumentNullChecks()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.AsObservable(_qbNull));
- }
-
- [TestMethod]
- public void AsObservable()
- {
- Assert.AreSame(_qbMy.AsObservable(), _qbMy);
- }
-
- [TestMethod]
- public void Join_ArgumentNullChecks()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.When(null, _qbMy.Then(x => x)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.When(_qbp, default(QueryablePlan<int>[])));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.When(null, new MyQueryable<QueryablePlan<int>>()));
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.When(_qbp, default(IQueryable<QueryablePlan<int>>)));
- }
-
- [TestMethod]
- public void Join()
- {
- _qbp.When(new MyQueryable<QueryablePlan<int>>());
-
- _qbp.When(
- _qbMy.Then((t0) => 1),
- _qbMy.And(_qbMy).Then((t0, t1) => 1),
- _qbMy.And(_qbMy).And(_qbMy).Then((t0, t1, t2) => 1),
- _qbMy.And(_qbMy).And(_qbMy).And(_qbMy).Then((t0, t1, t2, t3) => 1)
-#if !NO_LARGEARITY
- ,
- _qbMy.And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).Then((t0, t1, t2, t3, t4) => 1),
- _qbMy.And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).Then((t0, t1, t2, t3, t4, t5) => 1),
- _qbMy.And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).Then((t0, t1, t2, t3, t4, t5, t6) => 1),
- _qbMy.And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).Then((t0, t1, t2, t3, t4, t5, t6, t7) => 1),
- _qbMy.And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).Then((t0, t1, t2, t3, t4, t5, t6, t7, t8) => 1),
- _qbMy.And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).Then((t0, t1, t2, t3, t4, t5, t6, t7, t8, t9) => 1),
- _qbMy.And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).Then((t0, t1, t2, t3, t4, t5, t6, t7, t8, t9, t10) => 1),
- _qbMy.And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).Then((t0, t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11) => 1),
- _qbMy.And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).Then((t0, t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12) => 1),
- _qbMy.And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).Then((t0, t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13) => 1),
- _qbMy.And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).Then((t0, t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14) => 1),
- _qbMy.And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).Then((t0, t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15) => 1)
-#endif
-);
- }
-
- [TestMethod]
- public void Then_ArgumentNullChecks()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.Then(_qbNull, default(Expression<Func<int, int>>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => _qbMy.Then(default(Expression<Func<int, int>>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => _qbMy.And(_qbMy).Then(default(Expression<Func<int, int, int>>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => _qbMy.And(_qbMy).And(_qbMy).Then(default(Expression<Func<int, int, int, int>>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => _qbMy.And(_qbMy).And(_qbMy).And(_qbMy).Then(default(Expression<Func<int, int, int, int, int>>)));
-#if !NO_LARGEARITY
- ReactiveAssert.Throws<ArgumentNullException>(() => _qbMy.And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).Then(default(Expression<Func<int, int, int, int, int, int>>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => _qbMy.And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).Then(default(Expression<Func<int, int, int, int, int, int, int>>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => _qbMy.And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).Then(default(Expression<Func<int, int, int, int, int, int, int, int>>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => _qbMy.And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).Then(default(Expression<Func<int, int, int, int, int, int, int, int, int>>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => _qbMy.And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).Then(default(Expression<Func<int, int, int, int, int, int, int, int, int, int>>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => _qbMy.And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).Then(default(Expression<Func<int, int, int, int, int, int, int, int, int, int, int>>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => _qbMy.And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).Then(default(Expression<Func<int, int, int, int, int, int, int, int, int, int, int, int>>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => _qbMy.And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).Then(default(Expression<Func<int, int, int, int, int, int, int, int, int, int, int, int, int>>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => _qbMy.And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).Then(default(Expression<Func<int, int, int, int, int, int, int, int, int, int, int, int, int, int>>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => _qbMy.And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).Then(default(Expression<Func<int, int, int, int, int, int, int, int, int, int, int, int, int, int, int>>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => _qbMy.And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).Then(default(Expression<Func<int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int>>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => _qbMy.And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).And(_qbMy).Then(default(Expression<Func<int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int>>)));
-#endif
- }
-
- [TestMethod]
- public void AsQbservable_ArgumentNullChecks()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.AsQbservable<int>(null));
- }
-
- [TestMethod]
- public void AsQbservable_CreateQuery_ArgumentChecks()
- {
- var xs = Observable.Return(1).AsQbservable();
- ReactiveAssert.Throws<ArgumentNullException>(() => xs.Provider.CreateQuery<int>(null));
- ReactiveAssert.Throws<ArgumentException>(() => xs.Provider.CreateQuery<int>(Expression.Constant(1)));
- }
-
- [TestMethod]
- public void AsQbservable_ToString()
- {
- var xs = Observable.Return(1);
- var ys = xs.AsQbservable();
- Assert.AreEqual(ys.ToString(), xs.ToString());
-
- var ex = Expression.Constant(xs);
- var zs = ys.Provider.CreateQuery<int>(ex);
- Assert.AreEqual(zs.ToString(), ex.ToString());
-
- var ns = ys.Provider.CreateQuery<int>(Expression.Constant(null, typeof(IObservable<int>)));
- Assert.AreEqual(ns.ToString(), "null");
-
- var ws = ys.Where(x => true);
- Assert.AreEqual(ws.Expression.ToString(), ws.ToString());
- }
-
- [TestMethod]
- public void Qbservable_Subscribe_Source()
- {
- var xs = Observable.Return(1).AsQbservable();
- var _x = 0;
- xs.ForEach(x => _x = x);
- Assert.AreEqual(_x, 1);
- }
-
- [TestMethod]
- public void Qbservable_VariousOperators()
- {
- var xs = Observable.Return(1).AsQbservable();
-
- Assert.IsTrue(xs.Where(x => true).ToEnumerable().SequenceEqual(new[] { 1 }), "Where");
- Assert.IsTrue(xs.Select(x => x.ToString()).ToEnumerable().SequenceEqual(new[] { "1" }), "Select");
- Assert.IsTrue(xs.Take(1).ToEnumerable().SequenceEqual(new[] { 1 }), "Take");
- Assert.IsTrue(xs.Sum().ToEnumerable().SequenceEqual(new[] { 1 }), "Sum");
- Assert.IsTrue(xs.Amb(xs).ToEnumerable().SequenceEqual(new[] { 1 }), "Amb");
- Assert.IsTrue(xs.Concat(xs).ToEnumerable().SequenceEqual(new[] { 1, 1 }), "Concat");
- Assert.IsTrue(xs.Aggregate("", (s, i) => s + i).ToEnumerable().SequenceEqual(new[] { "1" }), "Aggregate");
- Assert.IsTrue(xs.Where(x => true).Concat(xs.Where(x => false)).ToEnumerable().SequenceEqual(new[] { 1 }), "Concat/Where");
- Assert.IsTrue(xs.SelectMany(x => xs).ToEnumerable().SequenceEqual(new[] { 1 }), "SelectMany");
- Assert.IsTrue(xs.GroupBy(x => x).SelectMany(g => g).ToEnumerable().SequenceEqual(new[] { 1 }), "GroupBy/SelectMany");
- Assert.IsTrue(xs.GroupBy(x => x, x => x).SelectMany(g => g).ToEnumerable().SequenceEqual(new[] { 1 }), "GroupBy/SelectMany (more generics)");
-
- // TODO: IQueryable ones
- }
-
- [TestMethod]
- public void Qbservable_ProviderOperators()
- {
- var xs = Observable.Return(1).AsQbservable();
-
- Assert.IsTrue(Qbservable.Provider.Amb(xs, xs, xs).ToEnumerable().SequenceEqual(new[] { 1 }), "Amb (n-ary)");
- Assert.IsTrue(Qbservable.Provider.Concat(xs, xs, xs).ToEnumerable().SequenceEqual(new[] { 1, 1, 1 }), "Concat (n-ary)");
-
- ReactiveAssert.Throws<MyException>(() => Qbservable.Provider.Throw<int>(new MyException()).ForEach(_ => { }));
- }
-
- class MyException : Exception
- {
- }
-
- [TestMethod]
- public void Qbservable_JoinPatterns()
- {
- var xs = Observable.Return(1).AsQbservable();
- var ys = Observable.Return(2).AsQbservable();
- var zs = Observable.Return(3).AsQbservable();
-
- Assert.IsTrue(Qbservable.Provider.When(xs.And(ys).Then((x, y) => x + y)).ToEnumerable().SequenceEqual(new[] { 3 }), "Join");
- Assert.IsTrue(Qbservable.Provider.When(xs.And(ys).And(zs).Then((x, y, z) => x + y + z)).ToEnumerable().SequenceEqual(new[] { 6 }), "Join");
- }
-
- [TestMethod]
- public void Qbservable_MoreProviderFun()
- {
- Assert.IsTrue(
- Qbservable.Provider.Concat(
- Qbservable.Provider.Return(1).Where(x => x > 0).Select(x => x + 1),
- Qbservable.Provider.Return(2).Where(x => x < 2),
- Qbservable.Provider.Throw<int>(new Exception())
- )
- .Catch((Exception ex) => Qbservable.Provider.Return(3))
- .ToEnumerable()
- .SequenceEqual(new[] { 2, 3 })
- );
- }
-
- [TestMethod]
- public void Qbservable_AsQbservable_ToQueryable()
- {
- var xs = Observable.Range(0, 10).Where(x => x > 5).AsQbservable().Select(x => x + 1);
- var ys = xs.ToQueryable().OrderByDescending(x => x);
-
- Assert.IsTrue(ys.SequenceEqual(new[] { 10, 9, 8, 7 }));
- }
-
- [TestMethod]
- public void Qbservable_AsQbservable_ToQueryable_Errors()
- {
- var provider = (IQueryProvider)Qbservable.Provider;
-
- ReactiveAssert.Throws<NotImplementedException>(() => provider.Execute(Expression.Constant(1)));
- ReactiveAssert.Throws<NotImplementedException>(() => provider.Execute<int>(Expression.Constant(1)));
-
- ReactiveAssert.Throws<NotImplementedException>(() => provider.CreateQuery(Expression.Constant(1)));
- ReactiveAssert.Throws<ArgumentException>(() => provider.CreateQuery<int>(Expression.Constant(1)));
- ReactiveAssert.Throws<ArgumentException>(() => provider.CreateQuery<int>(new[] { 0 }.AsQueryable().Reverse().Expression));
- ReactiveAssert.Throws<ArgumentException>(() => provider.CreateQuery<int>(Qbservable.Provider.Return(1).Expression));
- }
-
- [TestMethod]
- public void Qbservable_TwoProviders_Amb()
- {
- var xs = Observable.Return(1).AsQbservable();
- var ys = new EmptyQbservable<int>().Where(x => true);
-
- xs.Amb(ys).ForEach(_ => { });
- ys.Amb(xs).ForEach(_ => { });
- xs.Concat(ys.Provider.Amb(xs)).ForEach(_ => { });
- }
-
- private void Ignore<T>(IQbservable<T> q)
- {
- }
-
- [TestMethod]
- public void Qbservable_Observable_Parity()
- {
- var obs = typeof(Observable).GetMethods(BindingFlags.Public | BindingFlags.Static).ToList();
- var qbs = typeof(Qbservable).GetMethods(BindingFlags.Public | BindingFlags.Static).ToList();
-
- var onlyInObs = obs.Select(m => m.Name).Except(qbs.Select(m => m.Name)).Except(new[] { "First", "FirstOrDefault", "Last", "LastOrDefault", "Single", "SingleOrDefault", "ForEach", "Subscribe", "GetEnumerator", "ToEnumerable", "Multicast", "GetAwaiter", "ToEvent", "ToEventPattern", "ForEachAsync", "Wait", "RunAsync", "ToListObservable" }).ToList();
- var onlyInQbs = qbs.Select(m => m.Name).Except(obs.Select(m => m.Name)).Except(new[] { "ToQueryable", "ToQbservable", "get_Provider", "AsQbservable" }).ToList();
-
- Assert.IsTrue(onlyInObs.Count == 0, "Missing Qbservable operator: " + string.Join(", ", onlyInObs.ToArray()));
- Assert.IsTrue(onlyInQbs.Count == 0, "Missing Observable operator: " + string.Join(", ", onlyInQbs.ToArray()));
-
- var obgs = obs.GroupBy(m => m.Name);
- var qbgs = qbs.GroupBy(m => m.Name);
- var mtch = (from o in obgs
- where o.Key != "And" && o.Key != "Then" && o.Key != "When"
- join q in qbgs on o.Key equals q.Key
- select new { Name = o.Key, Observable = o.ToList(), Qbservable = q.ToList() })
- .ToList();
-
- Func<Type, bool> filterReturn = t =>
- {
- if (t.IsGenericType)
- {
- var gd = t.GetGenericTypeDefinition();
- if (
- gd == typeof(ListObservable<>) ||
- gd == typeof(IConnectableObservable<>))
- return false;
- }
- return true;
- };
-
- foreach (var group in mtch)
- {
- if (group.Name == "FromAsyncPattern" || group.Name == "ToAsync")
- {
- Assert.AreEqual(group.Observable.Count, group.Qbservable.Count, "Mismatch overload count between Qbservable and Observable for " + group.Name);
- continue;
- }
-
- var oss = group.Observable.Where(m => filterReturn(m.ReturnType)).Select(m => GetSignature(m, false)).OrderBy(x => x).ToList();
- var qss = group.Qbservable.Select(m => GetSignature(m, true)).OrderBy(x => x).ToList();
-
- Assert.IsTrue(oss.SequenceEqual(qss), "Mismatch between Qbservable and Observable for " + group.Name);
- }
- }
-
- public static string GetSignature(MethodInfo m, bool correct)
- {
- var ps = m.GetParameters();
- var pss = ps.AsEnumerable();
- if (correct && ps.Length > 0 && ps[0].ParameterType == typeof(IQbservableProvider))
- pss = pss.Skip(1);
-
- var gens = m.IsGenericMethod ? string.Format("<{0}>", string.Join(", ", m.GetGenericArguments().Select(a => GetTypeName(a, correct)).ToArray())) : "";
-
- var pars = string.Join(", ", pss.Select(p => (Attribute.IsDefined(p, typeof(ParamArrayAttribute)) ? "params " : "") + GetTypeName(p.ParameterType, correct) + " " + p.Name).ToArray());
- if (Attribute.IsDefined(m, typeof(ExtensionAttribute)))
- {
- if (pars.StartsWith("IQbservable") || pars.StartsWith("IQueryable"))
- pars = "this " + pars;
- }
-
- return string.Format("{0} {1}{2}({3})", GetTypeName(m.ReturnType, correct), m.Name, gens, pars);
- }
-
- public static string GetTypeName(Type t, bool correct)
- {
- if (t.IsGenericType)
- {
- var gtd = t.GetGenericTypeDefinition();
- if (gtd == typeof(Expression<>))
- return GetTypeName(t.GetGenericArguments()[0], false);
-
- var args = string.Join(", ", t.GetGenericArguments().Select(a => GetTypeName(a, false)).ToArray());
-
- var len = t.Name.IndexOf('`');
- var name = len >= 0 ? t.Name.Substring(0, len) : t.Name;
- if (correct && name == "IQbservable")
- name = "IObservable";
- if (correct && name == "IQueryable")
- name = "IEnumerable";
-
- return string.Format("{0}<{1}>", name, args);
- }
-
- if (t.IsArray)
- {
- return GetTypeName(t.GetElementType(), correct) + "[]";
- }
-
- return t.Name;
- }
-
- [TestMethod]
- public void Qbservable_Extensibility_Combinator()
- {
- var res1 = Observable.Return(42).AsQbservable().Foo(x => x / 2).AsObservable().Single();
- Assert.AreEqual(21, res1);
-
- var res2 = Observable.Return(3).AsQbservable().Bar().AsObservable().Single();
- Assert.AreEqual("***", res2);
- }
-
- [TestMethod]
- public void Qbservable_Extensibility_Constructor()
- {
- var res1 = Qbservable.Provider.Qux(42).AsObservable().Single();
- Assert.AreEqual(42, res1);
- }
-
- [TestMethod]
- public void Qbservable_Extensibility_Missing()
- {
- try
- {
- Observable.Return(42).AsQbservable().Baz(x => x).AsObservable().Single();
- }
- catch (InvalidOperationException)
- {
- return;
- }
-
- Assert.Fail();
- }
- }
-
- public static class MyExt
- {
- public static IQbservable<R> Foo<T, R>(this IQbservable<T> source, Expression<Func<T, R>> f)
- {
- return source.Provider.CreateQuery<R>(
- Expression.Call(
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(T), typeof(R)),
- source.Expression,
- f
- )
- );
- }
-
- public static IObservable<R> Foo<T, R>(this IObservable<T> source, Func<T, R> f)
- {
- return source.Select(f);
- }
-
- public static IQbservable<string> Bar(this IQbservable<int> source)
- {
- return source.Provider.CreateQuery<string>(
- Expression.Call(
- (MethodInfo)MethodInfo.GetCurrentMethod(),
- source.Expression
- )
- );
- }
-
- public static IObservable<string> Bar(this IObservable<int> source)
- {
- return source.Select(x => new string('*', x));
- }
-
- public static IQbservable<T> Qux<T>(this IQbservableProvider provider, T value)
- {
- return provider.CreateQuery<T>(
- Expression.Call(
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(T)),
- Expression.Constant(provider, typeof(IQbservableProvider)),
- Expression.Constant(value, typeof(T))
- )
- );
- }
-
- public static IObservable<T> Qux<T>(T value)
- {
- return Observable.Return(value);
- }
-
- public static IQbservable<R> Baz<T, R>(this IQbservable<T> source, Expression<Func<T, R>> f)
- {
- return source.Provider.CreateQuery<R>(
- Expression.Call(
- ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(T), typeof(R)),
- source.Expression,
- f
- )
- );
- }
- }
-
- class MyQbservable<T> : IQbservable<T>
- {
- public MyQbservable()
- {
- Expression = Expression.Constant(this);
- }
-
- public MyQbservable(Expression expression)
- {
- Expression = expression;
- }
-
- public Type ElementType
- {
- get { return typeof(T); }
- }
-
- public Expression Expression
- {
- get;
- private set;
- }
-
- public IQbservableProvider Provider
- {
- get { return new MyQbservableProvider(); }
- }
-
- public IDisposable Subscribe(IObserver<T> observer)
- {
- throw new NotImplementedException();
- }
- }
-
- class MyQbservableProvider : IQbservableProvider
- {
- public IQbservable<TResult> CreateQuery<TResult>(Expression expression)
- {
- return new MyQbservable<TResult>(expression);
- }
- }
-
- class MyQbservableQueryable<T> : IQbservable<T>
- {
- public MyQbservableQueryable()
- {
- Expression = Expression.Constant(this);
- }
-
- public MyQbservableQueryable(Expression expression)
- {
- Expression = expression;
- }
-
- public Type ElementType
- {
- get { return typeof(T); }
- }
-
- public Expression Expression
- {
- get;
- private set;
- }
-
- public IQbservableProvider Provider
- {
- get { return new MyQbservableQueryableProvider(); }
- }
-
- public IDisposable Subscribe(IObserver<T> observer)
- {
- throw new NotImplementedException();
- }
- }
-
- class MyQueryable<T> : IQueryable<T>
- {
- public MyQueryable()
- {
- Expression = Expression.Constant(this);
- }
-
- public MyQueryable(Expression expression)
- {
- Expression = expression;
- }
-
- public Expression Expression
- {
- get;
- private set;
- }
-
- public IEnumerator<T> GetEnumerator()
- {
- throw new NotImplementedException();
- }
-
- System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
- {
- return GetEnumerator();
- }
-
- public Type ElementType
- {
- get { return typeof(T); }
- }
-
- IQueryProvider IQueryable.Provider
- {
- get { return new MyQbservableQueryableProvider(); }
- }
- }
-
- class MyQbservableQueryableProvider : IQbservableProvider, IQueryProvider
- {
- public IQbservable<TResult> CreateQuery<TResult>(Expression expression)
- {
- return new MyQbservable<TResult>(expression);
- }
-
- IQueryable<TElement> IQueryProvider.CreateQuery<TElement>(Expression expression)
- {
- return new MyQueryable<TElement>(expression);
- }
-
- public IQueryable CreateQuery(Expression expression)
- {
- throw new NotImplementedException();
- }
-
- public TResult Execute<TResult>(Expression expression)
- {
- throw new NotImplementedException();
- }
-
- public object Execute(Expression expression)
- {
- throw new NotImplementedException();
- }
- }
-
- class EmptyQbservable<T> : IQbservable<T>, IQbservableProvider
- {
- private Expression _expression;
-
- public EmptyQbservable()
- {
- _expression = Expression.Constant(this);
- }
-
- public EmptyQbservable(Expression expression)
- {
- _expression = expression;
- }
-
- public Type ElementType
- {
- get { return typeof(T); }
- }
-
- public Expression Expression
- {
- get { return _expression; }
- }
-
- public IQbservableProvider Provider
- {
- get { return this; }
- }
-
- public IDisposable Subscribe(IObserver<T> observer)
- {
- observer.OnCompleted();
- return new MyD();
- }
-
- class MyD : IDisposable
- {
- public void Dispose()
- {
- }
- }
-
- public IQbservable<TResult> CreateQuery<TResult>(Expression expression)
- {
- return new EmptyQbservable<TResult>(expression);
- }
- }
-}
-
-#endif \ No newline at end of file
diff --git a/Rx.NET/Tests.System.Reactive/Tests/RegressionTest.cs b/Rx.NET/Tests.System.Reactive/Tests/RegressionTest.cs
deleted file mode 100644
index 88d2f27..0000000
--- a/Rx.NET/Tests.System.Reactive/Tests/RegressionTest.cs
+++ /dev/null
@@ -1,429 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Reactive;
-using System.Reactive.Concurrency;
-using System.Reactive.Linq;
-using System.Reactive.Subjects;
-using System.Threading;
-using Microsoft.Reactive.Testing;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-
-namespace ReactiveTests.Tests
-{
- [TestClass]
- public class RegressionTest : ReactiveTest
- {
-#if DESKTOPCLR40 || DESKTOPCLR45
- [TestMethod]
- public void Bug_ConcurrentMerge()
- {
- const int reps = 1000;
- var source = Enumerable.Range(0, reps).ToObservable();
-
- var resultQueue = new System.Collections.Concurrent.ConcurrentQueue<int>();
- var r = new Random();
-
- source.Select(i => Observable.Create<Unit>(o =>
- {
- resultQueue.Enqueue(i);
- System.Threading.Tasks.Task.Factory.StartNew(
- () =>
- {
- Thread.Sleep(r.Next(10));
- o.OnCompleted();
- });
- return () => { };
- })).Merge(3).ForEach(_ => { });
-
- Assert.IsTrue(Enumerable.Range(0, reps).ToList().SequenceEqual(resultQueue.ToList()));
- }
-#endif
-
- [TestMethod]
- public void Bug_1283()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(100, 1),
- OnNext(220, 2),
- OnNext(240, 3),
- OnNext(300, 4),
- OnNext(310, 5),
- OnCompleted<int>(350)
- );
-
- var results = scheduler.Start(() =>
- xs.Window(TimeSpan.FromTicks(100), scheduler).Select((x, i) => x.Select(y => i.ToString() + " " + y.ToString()).Concat(Observable.Return(i.ToString() + " end", scheduler))).Merge()
- );
-
- results.Messages.AssertEqual(
- OnNext(220, "0 2"),
- OnNext(240, "0 3"),
- OnNext(300, "0 4"),
- OnNext(301, "0 end"),
- OnNext(310, "1 5"),
- OnNext(351, "1 end"),
- OnCompleted<string>(351)
- );
- }
-
- [TestMethod]
- public void Bug_1261()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(205, 1),
- OnNext(210, 2),
- OnNext(215, 3),
- OnNext(220, 4),
- OnNext(225, 5),
- OnNext(230, 6),
- OnCompleted<int>(230));
-
- var results = scheduler.Start(() =>
- xs.Window(TimeSpan.FromTicks(10), scheduler).Select((x, i) => x.Select(y => i.ToString() + " " + y.ToString()).Concat(Observable.Return(i.ToString() + " end", scheduler))).Merge()
- );
-
- results.Messages.AssertEqual(
- OnNext(205, "0 1"),
- OnNext(210, "0 2"),
- OnNext(211, "0 end"),
- OnNext(215, "1 3"),
- OnNext(220, "1 4"),
- OnNext(221, "1 end"),
- OnNext(225, "2 5"),
- OnNext(230, "2 6"),
- OnNext(231, "2 end"),
- OnCompleted<string>(231)
- );
- }
-
- [TestMethod]
- public void Bug_1130()
- {
- var xs = Observable.Start(() => 5);
- Assert.IsNull(xs as ISubject<int, int>);
- }
-
- [TestMethod]
- public void Bug_1286()
- {
- var infinite = Observable.Return(new { Name = "test", Value = 0d }, DefaultScheduler.Instance).Repeat();
- var grouped = infinite.GroupBy(x => x.Name, x => x.Value);
- var disp = grouped.Subscribe(_ => { });
- Thread.Sleep(1);
- //most of the time, this deadlocks
- disp.Dispose();
- disp = grouped.Subscribe(_ => { });
- Thread.Sleep(1);
- //if the first doesn't this one always
- disp.Dispose();
- }
-
- [TestMethod]
- public void Bug_1287()
- {
- var flag = false;
- var x = Observable.Return(1, Scheduler.CurrentThread).Concat(Observable.Never<int>()).Finally(() => flag = true).First();
- Assert.AreEqual(1, x);
- Assert.IsTrue(flag);
- }
-
-#if !SILVERLIGHTM7
- static IEnumerable<int> Bug_1333_Enumerable(AsyncSubject<IDisposable> s, Semaphore sema)
- {
- var d = s.First();
- var t = new Thread(() => { d.Dispose(); sema.Release(); });
- t.Start();
- t.Join();
- yield return 1;
- }
-
- [TestMethod]
- [Timeout(1000)]
- public void Bug_1333()
- {
- var sema = new Semaphore(0, 1);
- var d = new AsyncSubject<IDisposable>();
- var e = Bug_1333_Enumerable(d, sema).ToObservable(DefaultScheduler.Instance).Subscribe();
- d.OnNext(e);
- d.OnCompleted();
- sema.WaitOne();
- }
-#endif
- [TestMethod]
- public void Bug_1295_Completed()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(300, 1),
- OnNext(350, 2),
- OnNext(500, 3),
- OnCompleted<int>(550)
- );
-
- var results = scheduler.Start(() =>
- xs.Throttle(TimeSpan.FromTicks(100), scheduler)
- );
-
- results.Messages.AssertEqual(
- OnNext(450, 2),
- OnNext(550, 3),
- OnCompleted<int>(550)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 550)
- );
- }
-
- [TestMethod]
- public void Bug_1295_Error()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(300, 1),
- OnNext(350, 2),
- OnNext(500, 3),
- OnError<int>(550, ex)
- );
-
- var results = scheduler.Start(() =>
- xs.Throttle(TimeSpan.FromTicks(100), scheduler)
- );
-
- results.Messages.AssertEqual(
- OnNext(450, 2),
- OnError<int>(550, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 550)
- );
- }
-
- [TestMethod]
- public void Bug_1297_Catch_None()
- {
- var scheduler = new TestScheduler();
-
- var results = scheduler.Start(() =>
- Observable.Catch<int>()
- );
-
- results.Messages.AssertEqual(
- OnCompleted<int>(200)
- );
- }
-
- [TestMethod]
- public void Bug_1297_OnErrorResumeNext_None()
- {
- var scheduler = new TestScheduler();
-
- var results = scheduler.Start(() =>
- Observable.OnErrorResumeNext<int>()
- );
-
- results.Messages.AssertEqual(
- OnCompleted<int>(200)
- );
- }
-
- [TestMethod]
- public void Bug_1297_Catch_Single()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = Observable.Throw<int>(ex, scheduler);
-
- var results = scheduler.Start(() =>
- Observable.Catch(xs)
- );
-
- results.Messages.AssertEqual(
- OnError<int>(201, ex)
- );
- }
-
- [TestMethod]
- public void Bug_1297_OnErrorResumeNext_Single()
- {
- var scheduler = new TestScheduler();
-
- var xs = Observable.Throw<int>(new Exception(), scheduler);
-
- var results = scheduler.Start(() =>
- Observable.OnErrorResumeNext(xs)
- );
-
- results.Messages.AssertEqual(
- OnCompleted<int>(201)
- );
- }
-
- [TestMethod]
- public void Bug_1297_Catch_Multi()
- {
- var scheduler = new TestScheduler();
-
- var ex1 = new Exception();
- var ex2 = new Exception();
- var ex3 = new Exception();
-
- var xs = Observable.Throw<int>(ex1, scheduler);
- var ys = Observable.Throw<int>(ex2, scheduler);
- var zs = Observable.Throw<int>(ex3, scheduler);
-
- var results = scheduler.Start(() =>
- Observable.Catch(xs, ys, zs)
- );
-
- results.Messages.AssertEqual(
- OnError<int>(203, ex3)
- );
- }
-
- [TestMethod]
- public void Bug_1297_OnErrorResumeNext_Multi()
- {
- var scheduler = new TestScheduler();
-
- var ex1 = new Exception();
- var ex2 = new Exception();
- var ex3 = new Exception();
-
- var xs = Observable.Throw<int>(ex1, scheduler);
- var ys = Observable.Throw<int>(ex2, scheduler);
- var zs = Observable.Throw<int>(ex3, scheduler);
-
- var results = scheduler.Start(() =>
- Observable.OnErrorResumeNext(xs, ys, zs)
- );
-
- results.Messages.AssertEqual(
- OnCompleted<int>(203)
- );
- }
-
- [TestMethod]
- public void Bug_1380()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(220, 1),
- OnNext(250, 2),
- OnNext(270, 3),
- OnNext(290, 4),
- OnNext(310, 5),
- OnNext(340, 6),
- OnNext(360, 7),
- OnError<int>(380, ex)
- );
-
- var results = scheduler.Start(() =>
- xs.Delay(TimeSpan.FromTicks(100), scheduler)
- );
-
- results.Messages.AssertEqual(
- OnNext(320, 1),
- OnNext(350, 2),
- OnNext(370, 3),
- OnError<int>(380, ex)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 380)
- );
- }
-
-
- [TestMethod]
- public void Bug_1356()
- {
- var run = false;
- Observable.Range(0, 10).Finally(() => run = true).Take(5).ForEach(_ => { });
- Assert.IsTrue(run);
- }
-
- [TestMethod]
- public void Bug_1381()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext( 90, 1),
- OnNext(110, 2),
- OnNext(250, 3),
- OnNext(270, 4),
- OnNext(280, 5),
- OnNext(301, 6),
- OnNext(302, 7),
- OnNext(400, 8),
- OnNext(401, 9),
- OnNext(510, 10)
- );
-
- var results = scheduler.CreateObserver<int>();
- var ys = default(IConnectableObservable<int>);
- var connection = default(IDisposable);
- var subscription = default(IDisposable);
-
- scheduler.ScheduleAbsolute(100, () => ys = xs.Multicast(new ReplaySubject<int>(scheduler)));
- scheduler.ScheduleAbsolute(200, () => connection = ys.Connect());
- scheduler.ScheduleAbsolute(300, () => subscription = ys.Subscribe(results));
- scheduler.ScheduleAbsolute(500, () => subscription.Dispose());
- scheduler.ScheduleAbsolute(600, () => connection.Dispose());
-
- scheduler.Start();
-
- results.Messages.AssertEqual(
- OnNext(301, 3),
- OnNext(302, 4),
- OnNext(303, 5),
- OnNext(304, 6),
- OnNext(305, 7),
- OnNext(401, 8),
- OnNext(402, 9)
- );
-
- xs.Subscriptions.AssertEqual(
- Subscribe(200, 600)
- );
- }
-
- [TestMethod]
- public void Reentrant_Subject()
- {
- var s = Subject.Synchronize(new Subject<int>(), Scheduler.Immediate);
- var list = new List<int>();
-
- s.Subscribe(
- x =>
- {
- list.Add(x);
- if (x < 3)
- s.OnNext(x + 1);
- list.Add(-x);
- });
-
- s.OnNext(1);
-
- list.AssertEqual(1, -1, 2, -2, 3, -3);
- }
- }
-}
diff --git a/Rx.NET/Tests.System.Reactive/Tests/ReplaySubjectTest.cs b/Rx.NET/Tests.System.Reactive/Tests/ReplaySubjectTest.cs
deleted file mode 100644
index 5597439..0000000
--- a/Rx.NET/Tests.System.Reactive/Tests/ReplaySubjectTest.cs
+++ /dev/null
@@ -1,502 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System;
-using System.Reactive.Concurrency;
-using System.Reactive.Subjects;
-using Microsoft.Reactive.Testing;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using ReactiveTests.Dummies;
-
-namespace ReactiveTests.Tests
-{
- [TestClass]
- public partial class ReplaySubjectTest : ReactiveTest
- {
- [TestMethod]
- public void Subscribe_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => new ReplaySubject<int>().Subscribe(null));
- }
-
- [TestMethod]
- public void OnError_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => new ReplaySubject<int>(DummyScheduler.Instance).OnError(null));
- }
-
- [TestMethod]
- public void Constructor_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => new ReplaySubject<int>(-1));
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => new ReplaySubject<int>(-1, DummyScheduler.Instance));
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => new ReplaySubject<int>(-1, TimeSpan.Zero));
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => new ReplaySubject<int>(-1, TimeSpan.Zero, DummyScheduler.Instance));
-
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => new ReplaySubject<int>(TimeSpan.FromTicks(-1)));
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => new ReplaySubject<int>(TimeSpan.FromTicks(-1), DummyScheduler.Instance));
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => new ReplaySubject<int>(0, TimeSpan.FromTicks(-1)));
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => new ReplaySubject<int>(0, TimeSpan.FromTicks(-1), DummyScheduler.Instance));
-
- ReactiveAssert.Throws<ArgumentNullException>(() => new ReplaySubject<int>(null));
- ReactiveAssert.Throws<ArgumentNullException>(() => new ReplaySubject<int>(0, null));
- ReactiveAssert.Throws<ArgumentNullException>(() => new ReplaySubject<int>(TimeSpan.Zero, null));
- ReactiveAssert.Throws<ArgumentNullException>(() => new ReplaySubject<int>(0, TimeSpan.Zero, null));
-
- // zero allowed
- new ReplaySubject<int>(0);
- new ReplaySubject<int>(TimeSpan.Zero);
- new ReplaySubject<int>(0, TimeSpan.Zero);
- new ReplaySubject<int>(0, DummyScheduler.Instance);
- new ReplaySubject<int>(TimeSpan.Zero, DummyScheduler.Instance);
- new ReplaySubject<int>(0, TimeSpan.Zero, DummyScheduler.Instance);
- }
-
- [TestMethod]
- public void Infinite()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(70, 1),
- OnNext(110, 2),
- OnNext(220, 3),
- OnNext(270, 4),
- OnNext(340, 5),
- OnNext(410, 6),
- OnNext(520, 7),
- OnNext(630, 8),
- OnNext(710, 9),
- OnNext(870, 10),
- OnNext(940, 11),
- OnNext(1020, 12)
- );
-
- var subject = default(ReplaySubject<int>);
- var subscription = default(IDisposable);
-
- var results1 = scheduler.CreateObserver<int>();
- var subscription1 = default(IDisposable);
-
- var results2 = scheduler.CreateObserver<int>();
- var subscription2 = default(IDisposable);
-
- var results3 = scheduler.CreateObserver<int>();
- var subscription3 = default(IDisposable);
-
- scheduler.ScheduleAbsolute(100, () => subject = new ReplaySubject<int>(3, TimeSpan.FromTicks(100), scheduler));
- scheduler.ScheduleAbsolute(200, () => subscription = xs.Subscribe(subject));
- scheduler.ScheduleAbsolute(1000, () => subscription.Dispose());
-
- scheduler.ScheduleAbsolute(300, () => subscription1 = subject.Subscribe(results1));
- scheduler.ScheduleAbsolute(400, () => subscription2 = subject.Subscribe(results2));
- scheduler.ScheduleAbsolute(900, () => subscription3 = subject.Subscribe(results3));
-
- scheduler.ScheduleAbsolute(600, () => subscription1.Dispose());
- scheduler.ScheduleAbsolute(700, () => subscription2.Dispose());
- scheduler.ScheduleAbsolute(800, () => subscription1.Dispose());
- scheduler.ScheduleAbsolute(950, () => subscription3.Dispose());
-
- scheduler.Start();
-
- results1.Messages.AssertEqual(
- OnNext(301, 3),
- OnNext(302, 4),
- OnNext(341, 5),
- OnNext(411, 6),
- OnNext(521, 7)
- );
-
- results2.Messages.AssertEqual(
- OnNext(401, 5),
- OnNext(411, 6),
- OnNext(521, 7),
- OnNext(631, 8)
- );
-
- results3.Messages.AssertEqual(
- OnNext(901, 10),
- OnNext(941, 11)
- );
- }
-
- [TestMethod]
- public void Infinite2()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(70, 1),
- OnNext(110, 2),
- OnNext(220, 3),
- OnNext(270, 4),
- OnNext(280, -1),
- OnNext(290, -2),
- OnNext(340, 5),
- OnNext(410, 6),
- OnNext(520, 7),
- OnNext(630, 8),
- OnNext(710, 9),
- OnNext(870, 10),
- OnNext(940, 11),
- OnNext(1020, 12)
- );
-
- var subject = default(ReplaySubject<int>);
- var subscription = default(IDisposable);
-
- var results1 = scheduler.CreateObserver<int>();
- var subscription1 = default(IDisposable);
-
- var results2 = scheduler.CreateObserver<int>();
- var subscription2 = default(IDisposable);
-
- var results3 = scheduler.CreateObserver<int>();
- var subscription3 = default(IDisposable);
-
- scheduler.ScheduleAbsolute(100, () => subject = new ReplaySubject<int>(3, TimeSpan.FromTicks(100), scheduler));
- scheduler.ScheduleAbsolute(200, () => subscription = xs.Subscribe(subject));
- scheduler.ScheduleAbsolute(1000, () => subscription.Dispose());
-
- scheduler.ScheduleAbsolute(300, () => subscription1 = subject.Subscribe(results1));
- scheduler.ScheduleAbsolute(400, () => subscription2 = subject.Subscribe(results2));
- scheduler.ScheduleAbsolute(900, () => subscription3 = subject.Subscribe(results3));
-
- scheduler.ScheduleAbsolute(600, () => subscription1.Dispose());
- scheduler.ScheduleAbsolute(700, () => subscription2.Dispose());
- scheduler.ScheduleAbsolute(800, () => subscription1.Dispose());
- scheduler.ScheduleAbsolute(950, () => subscription3.Dispose());
-
- scheduler.Start();
-
- results1.Messages.AssertEqual(
- OnNext(301, 4),
- OnNext(302, -1),
- OnNext(303, -2),
- OnNext(341, 5),
- OnNext(411, 6),
- OnNext(521, 7)
- );
-
- results2.Messages.AssertEqual(
- OnNext(401, 5),
- OnNext(411, 6),
- OnNext(521, 7),
- OnNext(631, 8)
- );
-
- results3.Messages.AssertEqual(
- OnNext(901, 10),
- OnNext(941, 11)
- );
- }
-
- [TestMethod]
- public void Finite()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(70, 1),
- OnNext(110, 2),
- OnNext(220, 3),
- OnNext(270, 4),
- OnNext(340, 5),
- OnNext(410, 6),
- OnNext(520, 7),
- OnCompleted<int>(630),
- OnNext(640, 9),
- OnCompleted<int>(650),
- OnError<int>(660, new Exception())
- );
-
- var subject = default(ReplaySubject<int>);
- var subscription = default(IDisposable);
-
- var results1 = scheduler.CreateObserver<int>();
- var subscription1 = default(IDisposable);
-
- var results2 = scheduler.CreateObserver<int>();
- var subscription2 = default(IDisposable);
-
- var results3 = scheduler.CreateObserver<int>();
- var subscription3 = default(IDisposable);
-
- scheduler.ScheduleAbsolute(100, () => subject = new ReplaySubject<int>(3, TimeSpan.FromTicks(100), scheduler));
- scheduler.ScheduleAbsolute(200, () => subscription = xs.Subscribe(subject));
- scheduler.ScheduleAbsolute(1000, () => subscription.Dispose());
-
- scheduler.ScheduleAbsolute(300, () => subscription1 = subject.Subscribe(results1));
- scheduler.ScheduleAbsolute(400, () => subscription2 = subject.Subscribe(results2));
- scheduler.ScheduleAbsolute(900, () => subscription3 = subject.Subscribe(results3));
-
- scheduler.ScheduleAbsolute(600, () => subscription1.Dispose());
- scheduler.ScheduleAbsolute(700, () => subscription2.Dispose());
- scheduler.ScheduleAbsolute(800, () => subscription1.Dispose());
- scheduler.ScheduleAbsolute(950, () => subscription3.Dispose());
-
- scheduler.Start();
-
- results1.Messages.AssertEqual(
- OnNext(301, 3),
- OnNext(302, 4),
- OnNext(341, 5),
- OnNext(411, 6),
- OnNext(521, 7)
- );
-
- results2.Messages.AssertEqual(
- OnNext(401, 5),
- OnNext(411, 6),
- OnNext(521, 7),
- OnCompleted<int>(631)
- );
-
- results3.Messages.AssertEqual(
- OnCompleted<int>(901)
- );
- }
-
- [TestMethod]
- public void Error()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(70, 1),
- OnNext(110, 2),
- OnNext(220, 3),
- OnNext(270, 4),
- OnNext(340, 5),
- OnNext(410, 6),
- OnNext(520, 7),
- OnError<int>(630, ex),
- OnNext(640, 9),
- OnCompleted<int>(650),
- OnError<int>(660, new Exception())
- );
-
- var subject = default(ReplaySubject<int>);
- var subscription = default(IDisposable);
-
- var results1 = scheduler.CreateObserver<int>();
- var subscription1 = default(IDisposable);
-
- var results2 = scheduler.CreateObserver<int>();
- var subscription2 = default(IDisposable);
-
- var results3 = scheduler.CreateObserver<int>();
- var subscription3 = default(IDisposable);
-
- scheduler.ScheduleAbsolute(100, () => subject = new ReplaySubject<int>(3, TimeSpan.FromTicks(100), scheduler));
- scheduler.ScheduleAbsolute(200, () => subscription = xs.Subscribe(subject));
- scheduler.ScheduleAbsolute(1000, () => subscription.Dispose());
-
- scheduler.ScheduleAbsolute(300, () => subscription1 = subject.Subscribe(results1));
- scheduler.ScheduleAbsolute(400, () => subscription2 = subject.Subscribe(results2));
- scheduler.ScheduleAbsolute(900, () => subscription3 = subject.Subscribe(results3));
-
- scheduler.ScheduleAbsolute(600, () => subscription1.Dispose());
- scheduler.ScheduleAbsolute(700, () => subscription2.Dispose());
- scheduler.ScheduleAbsolute(800, () => subscription1.Dispose());
- scheduler.ScheduleAbsolute(950, () => subscription3.Dispose());
-
- scheduler.Start();
-
- results1.Messages.AssertEqual(
- OnNext(301, 3),
- OnNext(302, 4),
- OnNext(341, 5),
- OnNext(411, 6),
- OnNext(521, 7)
- );
-
- results2.Messages.AssertEqual(
- OnNext(401, 5),
- OnNext(411, 6),
- OnNext(521, 7),
- OnError<int>(631, ex)
- );
-
- results3.Messages.AssertEqual(
- OnError<int>(901, ex)
- );
- }
-
- [TestMethod]
- public void Canceled()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnCompleted<int>(630),
- OnNext(640, 9),
- OnCompleted<int>(650),
- OnError<int>(660, new Exception())
- );
-
- var subject = default(ReplaySubject<int>);
- var subscription = default(IDisposable);
-
- var results1 = scheduler.CreateObserver<int>();
- var subscription1 = default(IDisposable);
-
- var results2 = scheduler.CreateObserver<int>();
- var subscription2 = default(IDisposable);
-
- var results3 = scheduler.CreateObserver<int>();
- var subscription3 = default(IDisposable);
-
- scheduler.ScheduleAbsolute(100, () => subject = new ReplaySubject<int>(3, TimeSpan.FromTicks(100), scheduler));
- scheduler.ScheduleAbsolute(200, () => subscription = xs.Subscribe(subject));
- scheduler.ScheduleAbsolute(1000, () => subscription.Dispose());
-
- scheduler.ScheduleAbsolute(300, () => subscription1 = subject.Subscribe(results1));
- scheduler.ScheduleAbsolute(400, () => subscription2 = subject.Subscribe(results2));
- scheduler.ScheduleAbsolute(900, () => subscription3 = subject.Subscribe(results3));
-
- scheduler.ScheduleAbsolute(600, () => subscription1.Dispose());
- scheduler.ScheduleAbsolute(700, () => subscription2.Dispose());
- scheduler.ScheduleAbsolute(800, () => subscription1.Dispose());
- scheduler.ScheduleAbsolute(950, () => subscription3.Dispose());
-
- scheduler.Start();
-
- results1.Messages.AssertEqual(
- );
-
- results2.Messages.AssertEqual(
- OnCompleted<int>(631)
- );
-
- results3.Messages.AssertEqual(
- OnCompleted<int>(901)
- );
- }
-
- [TestMethod]
- public void SubjectDisposed()
- {
- var scheduler = new TestScheduler();
-
- var subject = default(ReplaySubject<int>);
-
- var results1 = scheduler.CreateObserver<int>();
- var subscription1 = default(IDisposable);
-
- var results2 = scheduler.CreateObserver<int>();
- var subscription2 = default(IDisposable);
-
- var results3 = scheduler.CreateObserver<int>();
- var subscription3 = default(IDisposable);
-
- scheduler.ScheduleAbsolute(100, () => subject = new ReplaySubject<int>(scheduler));
- scheduler.ScheduleAbsolute(200, () => subscription1 = subject.Subscribe(results1));
- scheduler.ScheduleAbsolute(300, () => subscription2 = subject.Subscribe(results2));
- scheduler.ScheduleAbsolute(400, () => subscription3 = subject.Subscribe(results3));
- scheduler.ScheduleAbsolute(500, () => subscription1.Dispose());
- scheduler.ScheduleAbsolute(600, () => subject.Dispose());
- scheduler.ScheduleAbsolute(700, () => subscription2.Dispose());
- scheduler.ScheduleAbsolute(800, () => subscription3.Dispose());
-
- scheduler.ScheduleAbsolute(150, () => subject.OnNext(1));
- scheduler.ScheduleAbsolute(250, () => subject.OnNext(2));
- scheduler.ScheduleAbsolute(350, () => subject.OnNext(3));
- scheduler.ScheduleAbsolute(450, () => subject.OnNext(4));
- scheduler.ScheduleAbsolute(550, () => subject.OnNext(5));
- scheduler.ScheduleAbsolute(650, () => ReactiveAssert.Throws<ObjectDisposedException>(() => subject.OnNext(6)));
- scheduler.ScheduleAbsolute(750, () => ReactiveAssert.Throws<ObjectDisposedException>(() => subject.OnCompleted()));
- scheduler.ScheduleAbsolute(850, () => ReactiveAssert.Throws<ObjectDisposedException>(() => subject.OnError(new Exception())));
- scheduler.ScheduleAbsolute(950, () => ReactiveAssert.Throws<ObjectDisposedException>(() => subject.Subscribe()));
-
- scheduler.Start();
-
- results1.Messages.AssertEqual(
- OnNext(201, 1),
- OnNext(251, 2),
- OnNext(351, 3),
- OnNext(451, 4)
- );
-
- results2.Messages.AssertEqual(
- OnNext(301, 1),
- OnNext(302, 2),
- OnNext(351, 3),
- OnNext(451, 4),
- OnNext(551, 5)
- );
-
- results3.Messages.AssertEqual(
- OnNext(401, 1),
- OnNext(402, 2),
- OnNext(403, 3),
- OnNext(451, 4),
- OnNext(551, 5)
- );
- }
-
- [TestMethod]
- public void ReplaySubjectDiesOut()
- {
- //
- // Tests v1.x behavior as documented in ReplaySubject.cs (Subscribe method).
- //
-
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(70, 1),
- OnNext(110, 2),
- OnNext(220, 3),
- OnNext(270, 4),
- OnNext(340, 5),
- OnNext(410, 6),
- OnNext(520, 7),
- OnCompleted<int>(580)
- );
-
- var subject = default(ReplaySubject<int>);
-
- var results1 = scheduler.CreateObserver<int>();
- var results2 = scheduler.CreateObserver<int>();
- var results3 = scheduler.CreateObserver<int>();
- var results4 = scheduler.CreateObserver<int>();
-
- scheduler.ScheduleAbsolute(100, () => subject = new ReplaySubject<int>(int.MaxValue, TimeSpan.FromTicks(100), scheduler));
- scheduler.ScheduleAbsolute(200, () => xs.Subscribe(subject));
-
- scheduler.ScheduleAbsolute(300, () => subject.Subscribe(results1));
- scheduler.ScheduleAbsolute(400, () => subject.Subscribe(results2));
- scheduler.ScheduleAbsolute(600, () => subject.Subscribe(results3));
- scheduler.ScheduleAbsolute(900, () => subject.Subscribe(results4));
-
- scheduler.Start();
-
- results1.Messages.AssertEqual(
- OnNext(301, 3),
- OnNext(302, 4),
- OnNext(341, 5),
- OnNext(411, 6),
- OnNext(521, 7),
- OnCompleted<int>(581)
- );
-
- results2.Messages.AssertEqual(
- OnNext(401, 5),
- OnNext(411, 6),
- OnNext(521, 7),
- OnCompleted<int>(581)
- );
-
- results3.Messages.AssertEqual(
- OnNext(601, 7),
- OnCompleted<int>(602)
- );
-
- results4.Messages.AssertEqual(
- OnCompleted<int>(901)
- );
- }
- }
-}
diff --git a/Rx.NET/Tests.System.Reactive/Tests/RogueEnumerable.cs b/Rx.NET/Tests.System.Reactive/Tests/RogueEnumerable.cs
deleted file mode 100644
index b2feb9c..0000000
--- a/Rx.NET/Tests.System.Reactive/Tests/RogueEnumerable.cs
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System;
-using System.Collections.Generic;
-
-namespace ReactiveTests.Tests
-{
- class RogueEnumerable<T> : IEnumerable<T>
- {
- private readonly Exception _ex;
-
- public RogueEnumerable(Exception ex)
- {
- _ex = ex;
- }
-
- public IEnumerator<T> GetEnumerator()
- {
- throw _ex;
- }
-
- System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
- {
- throw new NotImplementedException();
- }
- }
-}
diff --git a/Rx.NET/Tests.System.Reactive/Tests/ScheduledItemTest.cs b/Rx.NET/Tests.System.Reactive/Tests/ScheduledItemTest.cs
deleted file mode 100644
index 835cd7f..0000000
--- a/Rx.NET/Tests.System.Reactive/Tests/ScheduledItemTest.cs
+++ /dev/null
@@ -1,137 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System;
-using System.Collections.Generic;
-using System.Reactive.Concurrency;
-using System.Reactive.Disposables;
-using Microsoft.Reactive.Testing;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-
-namespace ReactiveTests
-{
- [TestClass]
- public class ScheduledItemTest : ReactiveTest
- {
- [TestMethod]
- public void ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => new ScheduledItem<DateTimeOffset, int>(default(IScheduler), 42, (x, y) => Disposable.Empty, DateTimeOffset.Now));
- ReactiveAssert.Throws<ArgumentNullException>(() => new ScheduledItem<DateTimeOffset, int>(Scheduler.Default, 42, default(Func<IScheduler, int, IDisposable>), DateTimeOffset.Now));
-
- ReactiveAssert.Throws<ArgumentNullException>(() => new ScheduledItem<DateTimeOffset, int>(default(IScheduler), 42, (x, y) => Disposable.Empty, DateTimeOffset.Now, Comparer<DateTimeOffset>.Default));
- ReactiveAssert.Throws<ArgumentNullException>(() => new ScheduledItem<DateTimeOffset, int>(Scheduler.Default, 42, default(Func<IScheduler, int, IDisposable>), DateTimeOffset.Now, Comparer<DateTimeOffset>.Default));
- ReactiveAssert.Throws<ArgumentNullException>(() => new ScheduledItem<DateTimeOffset, int>(Scheduler.Default, 42, (x, y) => Disposable.Empty, DateTimeOffset.Now, default(IComparer<DateTimeOffset>)));
- }
-
- [TestMethod]
- public void Inequalities()
- {
- var si1 = new SI(42);
- var si2 = new SI(43);
- var si3 = new SI(42);
-
- Assert.IsTrue(si1 < si2);
- Assert.IsFalse(si1 < si3);
- Assert.IsTrue(si1 <= si2);
- Assert.IsTrue(si1 <= si3);
- Assert.IsTrue(si2 > si1);
- Assert.IsFalse(si3 > si1);
- Assert.IsTrue(si2 >= si1);
- Assert.IsTrue(si3 >= si1);
-
- Assert.IsTrue(si1.CompareTo(si2) < 0);
- Assert.IsTrue(si2.CompareTo(si1) > 0);
- Assert.IsTrue(si1.CompareTo(si1) == 0);
- Assert.IsTrue(si1.CompareTo(si3) == 0);
-
- Assert.IsTrue(si2 > null);
- Assert.IsTrue(si2 >= null);
- Assert.IsFalse(si2 < null);
- Assert.IsFalse(si2 <= null);
- Assert.IsTrue(null < si1);
- Assert.IsTrue(null <= si1);
- Assert.IsFalse(null > si1);
- Assert.IsFalse(null >= si1);
-
- Assert.IsTrue(si1.CompareTo(null) > 0);
-
- var si4 = new SI2(43, -1);
- var si5 = new SI2(44, -1);
-
- Assert.IsTrue(si4 > si1);
- Assert.IsTrue(si4 >= si1);
- Assert.IsTrue(si1 < si4);
- Assert.IsTrue(si1 <= si4);
- Assert.IsFalse(si4 > si2);
- Assert.IsTrue(si4 >= si2);
- Assert.IsFalse(si2 < si4);
- Assert.IsTrue(si2 <= si4);
-
- Assert.IsTrue(si5 > si4);
- Assert.IsTrue(si5 >= si4);
- Assert.IsFalse(si4 > si5);
- Assert.IsFalse(si4 >= si5);
- Assert.IsTrue(si4 < si5);
- Assert.IsTrue(si4 <= si5);
- Assert.IsFalse(si5 < si4);
- Assert.IsFalse(si5 <= si4);
- }
-
- [TestMethod]
- public void Equalities()
- {
- var si1 = new SI2(42, 123);
- var si2 = new SI2(42, 123);
- var si3 = new SI2(42, 321);
- var si4 = new SI2(43, 123);
-
-#pragma warning disable 1718
- Assert.IsFalse(si1 != si1);
- Assert.IsTrue(si1 == si1);
-#pragma warning restore 1718
- Assert.IsTrue(si1.Equals(si1));
-
- Assert.IsTrue(si1 != si2);
- Assert.IsFalse(si1 == si2);
- Assert.IsFalse(si1.Equals(si2));
-
- Assert.IsTrue(si1 != null);
- Assert.IsTrue(null != si1);
- Assert.IsFalse(si1 == null);
- Assert.IsFalse(null == si1);
-
- Assert.AreEqual(si1.GetHashCode(), si1.GetHashCode());
- Assert.AreNotEqual(si1.GetHashCode(), si2.GetHashCode());
- Assert.AreNotEqual(si1.GetHashCode(), si3.GetHashCode());
- }
-
- class SI : ScheduledItem<int>
- {
- public SI(int dueTime)
- : base(dueTime, Comparer<int>.Default)
- {
- }
-
- protected override IDisposable InvokeCore()
- {
- throw new NotImplementedException();
- }
- }
-
- class SI2 : ScheduledItem<int>
- {
- private readonly int _value;
-
- public SI2(int dueTime, int value)
- : base(dueTime, Comparer<int>.Default)
- {
- _value = value;
- }
-
- protected override IDisposable InvokeCore()
- {
- throw new NotImplementedException();
- }
- }
- }
-}
diff --git a/Rx.NET/Tests.System.Reactive/Tests/SchedulerTest.cs b/Rx.NET/Tests.System.Reactive/Tests/SchedulerTest.cs
deleted file mode 100644
index 7efe66b..0000000
--- a/Rx.NET/Tests.System.Reactive/Tests/SchedulerTest.cs
+++ /dev/null
@@ -1,1080 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Reactive.Concurrency;
-using System.Reactive.Disposables;
-using System.Reactive.Linq;
-using System.Reactive.PlatformServices;
-using System.Runtime.CompilerServices;
-using System.Threading;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using Microsoft.Reactive.Testing;
-
-#if HAS_WINFORMS
-using System.Windows.Forms;
-#endif
-
-namespace ReactiveTests.Tests
-{
- [TestClass]
- public class SchedulerTest
- {
- #region IScheduler
-
- [TestMethod]
- public void Scheduler_ArgumentChecks()
- {
- var ms = new MyScheduler();
- ReactiveAssert.Throws<ArgumentNullException>(() => Scheduler.Schedule(default(IScheduler), a => { }));
- ReactiveAssert.Throws<ArgumentNullException>(() => Scheduler.Schedule(default(IScheduler), () => { }));
- ReactiveAssert.Throws<ArgumentNullException>(() => Scheduler.Schedule(default(IScheduler), 1, (a, s) => { }));
- ReactiveAssert.Throws<ArgumentNullException>(() => Scheduler.Schedule(ms, default(Action<Action>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Scheduler.Schedule(ms, 1, default(Action<int, Action<int>>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Scheduler.Schedule(default(IScheduler), DateTimeOffset.Now, a => { }));
- ReactiveAssert.Throws<ArgumentNullException>(() => Scheduler.Schedule(default(IScheduler), DateTimeOffset.Now, () => { }));
- ReactiveAssert.Throws<ArgumentNullException>(() => Scheduler.Schedule(default(IScheduler), 1, DateTimeOffset.Now, (a, s) => { }));
- ReactiveAssert.Throws<ArgumentNullException>(() => Scheduler.Schedule(ms, DateTimeOffset.Now, default(Action<Action<DateTimeOffset>>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Scheduler.Schedule(ms, 1, DateTimeOffset.Now, default(Action<int, Action<int, DateTimeOffset>>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Scheduler.Schedule(default(IScheduler), TimeSpan.Zero, a => { }));
- ReactiveAssert.Throws<ArgumentNullException>(() => Scheduler.Schedule(default(IScheduler), TimeSpan.Zero, () => { }));
- ReactiveAssert.Throws<ArgumentNullException>(() => Scheduler.Schedule(default(IScheduler), 1, TimeSpan.Zero, (a, s) => { }));
- ReactiveAssert.Throws<ArgumentNullException>(() => Scheduler.Schedule(ms, TimeSpan.Zero, default(Action<Action<TimeSpan>>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Scheduler.Schedule(ms, 1, TimeSpan.Zero, default(Action<int, Action<int, TimeSpan>>)));
- }
-
- [TestMethod]
- public void Schedulers_ArgumentChecks()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Scheduler.CurrentThread.Schedule(default(Action)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Scheduler.CurrentThread.Schedule(TimeSpan.Zero, default(Action)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Scheduler.CurrentThread.Schedule(DateTimeOffset.MaxValue, default(Action)));
- ReactiveAssert.Throws<ArgumentNullException>(() => DispatcherScheduler.Instance.Schedule(default(Action)));
- ReactiveAssert.Throws<ArgumentNullException>(() => DispatcherScheduler.Instance.Schedule(TimeSpan.Zero, default(Action)));
- ReactiveAssert.Throws<ArgumentNullException>(() => DispatcherScheduler.Instance.Schedule(DateTimeOffset.MaxValue, default(Action)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Scheduler.Immediate.Schedule(default(Action)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Scheduler.Immediate.Schedule(TimeSpan.Zero, default(Action)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Scheduler.Immediate.Schedule(DateTimeOffset.MaxValue, default(Action)));
- ReactiveAssert.Throws<ArgumentNullException>(() => NewThreadScheduler.Default.Schedule(default(Action)));
- ReactiveAssert.Throws<ArgumentNullException>(() => NewThreadScheduler.Default.Schedule(TimeSpan.Zero, default(Action)));
- ReactiveAssert.Throws<ArgumentNullException>(() => NewThreadScheduler.Default.Schedule(DateTimeOffset.MaxValue, default(Action)));
-#if !NO_TPL
- ReactiveAssert.Throws<ArgumentNullException>(() => TaskPoolScheduler.Default.Schedule(default(Action)));
- ReactiveAssert.Throws<ArgumentNullException>(() => TaskPoolScheduler.Default.Schedule(TimeSpan.Zero, default(Action)));
- ReactiveAssert.Throws<ArgumentNullException>(() => TaskPoolScheduler.Default.Schedule(DateTimeOffset.MaxValue, default(Action)));
-#endif
- ReactiveAssert.Throws<ArgumentNullException>(() => DefaultScheduler.Instance.Schedule(default(Action)));
- ReactiveAssert.Throws<ArgumentNullException>(() => DefaultScheduler.Instance.Schedule(TimeSpan.Zero, default(Action)));
- ReactiveAssert.Throws<ArgumentNullException>(() => DefaultScheduler.Instance.Schedule(DateTimeOffset.MaxValue, default(Action)));
- ReactiveAssert.Throws<ArgumentNullException>(() => DefaultScheduler.Instance.SchedulePeriodic(42, TimeSpan.FromSeconds(1), default(Func<int, int>)));
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => DefaultScheduler.Instance.SchedulePeriodic(42, TimeSpan.FromSeconds(-1), _ => _));
-#if HAS_WINFORMS
- var lbl = new Label();
- ReactiveAssert.Throws<ArgumentNullException>(() => new ControlScheduler(lbl).Schedule(default(Action)));
- ReactiveAssert.Throws<ArgumentNullException>(() => new ControlScheduler(lbl).Schedule(TimeSpan.Zero, default(Action)));
- ReactiveAssert.Throws<ArgumentNullException>(() => new ControlScheduler(lbl).Schedule(DateTimeOffset.MaxValue, default(Action)));
-#endif
- var ctx = new SynchronizationContext();
- ReactiveAssert.Throws<ArgumentNullException>(() => new SynchronizationContextScheduler(ctx).Schedule(default(Action)));
- ReactiveAssert.Throws<ArgumentNullException>(() => new SynchronizationContextScheduler(ctx).Schedule(TimeSpan.Zero, default(Action)));
- ReactiveAssert.Throws<ArgumentNullException>(() => new SynchronizationContextScheduler(ctx).Schedule(DateTimeOffset.MaxValue, default(Action)));
- }
-
- [TestMethod]
- public void Scheduler_ScheduleNonRecursive()
- {
- var ms = new MyScheduler();
- var res = false;
- Scheduler.Schedule(ms, a => { res = true; });
- Assert.IsTrue(res);
- }
-
- [TestMethod]
- public void Scheduler_ScheduleRecursive()
- {
- var ms = new MyScheduler();
- var i = 0;
- Scheduler.Schedule(ms, a => { if (++i < 10) a(); });
- Assert.AreEqual(10, i);
- }
-
- [TestMethod]
- public void Scheduler_ScheduleWithTimeNonRecursive()
- {
- var now = DateTimeOffset.Now;
- var ms = new MyScheduler(now) { Check = (a, s, t) => { Assert.IsTrue(t == TimeSpan.Zero); } };
- var res = false;
- Scheduler.Schedule(ms, now, a => { res = true; });
- Assert.IsTrue(res);
- Assert.IsTrue(ms.WaitCycles == 0);
- }
-
- [TestMethod]
- public void Scheduler_ScheduleWithTimeRecursive()
- {
- var now = DateTimeOffset.Now;
- var i = 0;
- var ms = new MyScheduler(now) { Check = (a, s, t) => { Assert.IsTrue(t == TimeSpan.Zero); } };
- Scheduler.Schedule(ms, now, a => { if (++i < 10) a(now); });
- Assert.IsTrue(ms.WaitCycles == 0);
- Assert.AreEqual(10, i);
- }
-
- [TestMethod]
- public void Scheduler_ScheduleWithTimeSpanNonRecursive()
- {
- var now = DateTimeOffset.Now;
- var ms = new MyScheduler(now) { Check = (a, s, t) => { Assert.IsTrue(t == TimeSpan.Zero); } };
- var res = false;
- Scheduler.Schedule(ms, TimeSpan.Zero, a => { res = true; });
- Assert.IsTrue(res);
- Assert.IsTrue(ms.WaitCycles == 0);
- }
-
- [TestMethod]
- public void Scheduler_ScheduleWithTimeSpanRecursive()
- {
- var now = DateTimeOffset.Now;
- var ms = new MyScheduler(now) { Check = (a, s, t) => { Assert.IsTrue(t < TimeSpan.FromTicks(10)); } };
- var i = 0;
- Scheduler.Schedule(ms, TimeSpan.Zero, a => { if (++i < 10) a(TimeSpan.FromTicks(i)); });
- Assert.IsTrue(ms.WaitCycles == Enumerable.Range(1, 9).Sum());
- Assert.AreEqual(10, i);
- }
-
- [TestMethod]
- public void Scheduler_StateThreading()
- {
- var lst = new List<int>();
- Scheduler.Immediate.Schedule(0, (i, a) =>
- {
- lst.Add(i);
- if (i < 9)
- a(i + 1);
- });
-
- Assert.IsTrue(lst.SequenceEqual(Enumerable.Range(0, 10)));
- }
-
- [TestMethod]
- public void Scheduler_Builtins()
- {
- // Default
- {
- var e = new ManualResetEvent(false);
- Scheduler.Default.Schedule(() => e.Set());
- e.WaitOne();
- }
-
- if (!Utils.IsRunningWithPortableLibraryBinaries())
- {
- Scheduler_Builtins_NoPlib();
- }
- }
-
- [MethodImpl(MethodImplOptions.NoInlining)]
- private void Scheduler_Builtins_NoPlib()
- {
-#if !PLIB
- // ThreadPool
- {
- var e = new ManualResetEvent(false);
- Scheduler.ThreadPool.Schedule(() => e.Set());
- e.WaitOne();
- }
-#endif
-
-#if !NO_THREAD
- // NewThread
- {
- var e = new ManualResetEvent(false);
- Scheduler.NewThread.Schedule(() => e.Set());
- e.WaitOne();
- }
-#endif
-
-#if !NO_TPL
- // TaskPool
- {
- var e = new ManualResetEvent(false);
- Scheduler.TaskPool.Schedule(() => e.Set());
- e.WaitOne();
- }
-#endif
- }
-
- #endregion
-
- #region ISchedulerLongRunning
-
-#if !NO_PERF
- [TestMethod]
- public void Scheduler_LongRunning_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Scheduler.ScheduleLongRunning(null, c => { }));
- ReactiveAssert.Throws<ArgumentNullException>(() => Scheduler.ScheduleLongRunning(ThreadPoolScheduler.Instance, default(Action<ICancelable>)));
- }
-
- [TestMethod]
- public void Scheduler_Periodic_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Scheduler.SchedulePeriodic(null, TimeSpan.FromSeconds(1), () => { }));
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => Scheduler.SchedulePeriodic(ThreadPoolScheduler.Instance, TimeSpan.FromSeconds(-1), () => { }));
- ReactiveAssert.Throws<ArgumentNullException>(() => Scheduler.SchedulePeriodic(ThreadPoolScheduler.Instance, TimeSpan.FromSeconds(1), default(Action)));
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Scheduler.SchedulePeriodic<int>(null, 42, TimeSpan.FromSeconds(1), _ => { }));
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => Scheduler.SchedulePeriodic<int>(ThreadPoolScheduler.Instance, 42, TimeSpan.FromSeconds(-1), _ => { }));
- ReactiveAssert.Throws<ArgumentNullException>(() => Scheduler.SchedulePeriodic<int>(ThreadPoolScheduler.Instance, 42, TimeSpan.FromSeconds(1), default(Action<int>)));
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Scheduler.SchedulePeriodic<int>(null, 42, TimeSpan.FromSeconds(1), _ => _));
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => Scheduler.SchedulePeriodic<int>(ThreadPoolScheduler.Instance, 42, TimeSpan.FromSeconds(-1), _ => _));
- ReactiveAssert.Throws<ArgumentNullException>(() => Scheduler.SchedulePeriodic<int>(ThreadPoolScheduler.Instance, 42, TimeSpan.FromSeconds(1), default(Func<int, int>)));
- }
-
- [TestMethod]
- public void Scheduler_Stopwatch_Emulation()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Scheduler.StartStopwatch(null));
- }
-
-#if !NO_TPL
- [TestMethod]
- public void Scheduler_LongRunning1()
- {
- var s = TaskPoolScheduler.Default;
-
- var x = new ManualResetEvent(false);
- var e = new ManualResetEvent(false);
-
- var d = s.ScheduleLongRunning(42, (state, cancel) =>
- {
- while (!cancel.IsDisposed)
- x.Set();
- e.Set();
- });
-
- x.WaitOne();
- d.Dispose();
-
- e.WaitOne();
- }
-
- [TestMethod]
- public void Scheduler_LongRunning2()
- {
- var s = TaskPoolScheduler.Default;
-
- var x = new ManualResetEvent(false);
- var e = new ManualResetEvent(false);
-
- var d = s.ScheduleLongRunning(cancel =>
- {
- while (!cancel.IsDisposed)
- x.Set();
- e.Set();
- });
-
- x.WaitOne();
- d.Dispose();
-
- e.WaitOne();
- }
-#endif
-#endif
-
- #endregion
-
- #region ISchedulerPeriodic
-
-#if !NO_PERF
- [TestMethod]
- public void Scheduler_Periodic1()
- {
- var n = 0;
- var e = new ManualResetEvent(false);
-
- var d = ThreadPoolScheduler.Instance.SchedulePeriodic(TimeSpan.FromMilliseconds(50), () =>
- {
- if (n++ == 10)
- e.Set();
- });
-
- e.WaitOne();
- d.Dispose();
- }
-
- [TestMethod]
- public void Scheduler_Periodic2()
- {
- var n = 0;
- var e = new ManualResetEvent(false);
-
- var d = ThreadPoolScheduler.Instance.SchedulePeriodic(42, TimeSpan.FromMilliseconds(50), x =>
- {
- Assert.AreEqual(42, x);
-
- if (n++ == 10)
- e.Set();
- });
-
- e.WaitOne();
- d.Dispose();
- }
-
-#if DESKTOPCLR
- [TestMethod]
- public void Scheduler_Periodic_HostLifecycleManagement()
- {
- var cur = AppDomain.CurrentDomain.BaseDirectory;
-
- var domain = AppDomain.CreateDomain("HLN", null, new AppDomainSetup { ApplicationBase = cur });
-
- domain.DoCallBack(() =>
- {
- var pep = PlatformEnlightenmentProvider.Current;
-
- try
- {
- var hln = new HLN();
- PlatformEnlightenmentProvider.Current = new PEP(hln);
-
- var s = ThreadPoolScheduler.Instance.DisableOptimizations(typeof(ISchedulerPeriodic));
-
- var n = 0;
- var e = new ManualResetEvent(false);
-
- var d = Observable.Interval(TimeSpan.FromMilliseconds(100), s).Subscribe(_ =>
- {
- if (n++ == 10)
- e.Set();
- });
-
- hln.OnSuspending();
- hln.OnResuming();
-
- Thread.Sleep(250);
- hln.OnSuspending();
-
- Thread.Sleep(150);
- hln.OnResuming();
-
- Thread.Sleep(50);
- hln.OnSuspending();
- hln.OnResuming();
-
- e.WaitOne();
- d.Dispose();
- }
- finally
- {
- PlatformEnlightenmentProvider.Current = pep;
- }
- });
- }
-
- class PEP : IPlatformEnlightenmentProvider
- {
- private readonly IPlatformEnlightenmentProvider _old;
- private readonly IHostLifecycleNotifications _hln;
-
- public PEP(HLN hln)
- {
- _old = PlatformEnlightenmentProvider.Current;
- _hln = hln;
- }
-
- public T GetService<T>(params object[] args) where T : class
- {
- if (typeof(T) == typeof(IHostLifecycleNotifications))
- {
- return (T)(object)_hln;
- }
-
- return _old.GetService<T>(args);
- }
- }
-
- class HLN : IHostLifecycleNotifications
- {
- public event EventHandler<HostSuspendingEventArgs> Suspending;
- public event EventHandler<HostResumingEventArgs> Resuming;
-
- public void OnSuspending()
- {
- var s = Suspending;
- if (s != null)
- s(this, null);
- }
-
- public void OnResuming()
- {
- var s = Resuming;
- if (s != null)
- s(this, null);
- }
- }
-#endif
-
-#endif
-
- #endregion
-
- #region DisableOptimizations
-
-#if !NO_PERF
- [TestMethod]
- public void DisableOptimizations_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Scheduler.DisableOptimizations(default(IScheduler)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Scheduler.DisableOptimizations(default(IScheduler), new Type[0]));
- ReactiveAssert.Throws<ArgumentNullException>(() => Scheduler.DisableOptimizations(ThreadPoolScheduler.Instance, default(Type[])));
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Scheduler.DisableOptimizations(Scheduler.Default).Schedule(42, default(Func<IScheduler, int, IDisposable>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Scheduler.DisableOptimizations(Scheduler.Default).Schedule(42, TimeSpan.FromSeconds(1), default(Func<IScheduler, int, IDisposable>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Scheduler.DisableOptimizations(Scheduler.Default).Schedule(42, DateTimeOffset.Now, default(Func<IScheduler, int, IDisposable>)));
- }
-
-#if !NO_TPL
- [TestMethod]
- public void DisableOptimizations1()
- {
- var s = TaskPoolScheduler.Default;
- Assert.IsTrue(s is IServiceProvider);
-
- var t = s.DisableOptimizations();
-
- var d = t.Now - s.Now;
- Assert.IsTrue(d.TotalSeconds < 1);
-
- var e1 = new ManualResetEvent(false);
- t.Schedule(42, (self, state) =>
- {
- e1.Set();
- return Disposable.Empty;
- });
- e1.WaitOne();
-
- var e2 = new ManualResetEvent(false);
- t.Schedule(42, TimeSpan.FromMilliseconds(1), (self, state) =>
- {
- e2.Set();
- return Disposable.Empty;
- });
- e2.WaitOne();
-
- var e3 = new ManualResetEvent(false);
- t.Schedule(42, DateTimeOffset.Now.AddMilliseconds(10), (self, state) =>
- {
- e3.Set();
- return Disposable.Empty;
- });
- e3.WaitOne();
- }
-
- [TestMethod]
- public void DisableOptimizations2()
- {
- var s = TaskPoolScheduler.Default;
- Assert.IsTrue(s is IServiceProvider);
-
- var lr1 = ((IServiceProvider)s).GetService(typeof(ISchedulerLongRunning));
- Assert.IsNotNull(lr1);
-
- var e1 = new ManualResetEvent(false);
- s.Schedule(42, (self, state) =>
- {
- Assert.IsTrue(self is IServiceProvider);
-
- var lrr1 = ((IServiceProvider)self).GetService(typeof(ISchedulerLongRunning));
- Assert.IsNotNull(lrr1);
-
- e1.Set();
- return Disposable.Empty;
- });
- e1.WaitOne();
-
- var t = s.DisableOptimizations();
- Assert.IsTrue(t is IServiceProvider);
-
- var lr2 = ((IServiceProvider)t).GetService(typeof(ISchedulerLongRunning));
- Assert.IsNull(lr2);
-
- var e2 = new ManualResetEvent(false);
- t.Schedule(42, (self, state) =>
- {
- Assert.IsTrue(self is IServiceProvider);
-
- var lrr2 = ((IServiceProvider)self).GetService(typeof(ISchedulerLongRunning));
- Assert.IsNull(lrr2);
-
- e2.Set();
- return Disposable.Empty;
- });
- e2.WaitOne();
- }
-
- [TestMethod]
- public void DisableOptimizations3()
- {
- var s = TaskPoolScheduler.Default;
- Assert.IsTrue(s is IServiceProvider);
-
- var lr1 = ((IServiceProvider)s).GetService(typeof(ISchedulerLongRunning));
- Assert.IsNotNull(lr1);
-
- var p1 = ((IServiceProvider)s).GetService(typeof(ISchedulerPeriodic));
- Assert.IsNotNull(p1);
-
- var e1 = new ManualResetEvent(false);
- s.Schedule(42, (self, state) =>
- {
- Assert.IsTrue(self is IServiceProvider);
-
- var lrr1 = ((IServiceProvider)self).GetService(typeof(ISchedulerLongRunning));
- Assert.IsNotNull(lrr1);
-
- var pr1 = ((IServiceProvider)self).GetService(typeof(ISchedulerPeriodic));
- Assert.IsNotNull(pr1);
-
- e1.Set();
- return Disposable.Empty;
- });
- e1.WaitOne();
-
- var t = s.DisableOptimizations(typeof(ISchedulerLongRunning));
- Assert.IsTrue(t is IServiceProvider);
-
- var lr2 = ((IServiceProvider)t).GetService(typeof(ISchedulerLongRunning));
- Assert.IsNull(lr2);
-
- var p2 = ((IServiceProvider)t).GetService(typeof(ISchedulerPeriodic));
- Assert.IsNotNull(p2);
-
- var e2 = new ManualResetEvent(false);
- t.Schedule(42, (self, state) =>
- {
- Assert.IsTrue(self is IServiceProvider);
-
- var lrr2 = ((IServiceProvider)self).GetService(typeof(ISchedulerLongRunning));
- Assert.IsNull(lrr2);
-
- var pr2 = ((IServiceProvider)self).GetService(typeof(ISchedulerPeriodic));
- Assert.IsNotNull(pr2);
-
- e2.Set();
- return Disposable.Empty;
- });
- e2.WaitOne();
- }
-#endif
-#endif
-
- [TestMethod]
- public void DisableOptimizations_UnknownService()
- {
- var s = new MyScheduler();
- Assert.IsFalse(s is IServiceProvider);
-
- var d = s.DisableOptimizations();
- Assert.IsTrue(d is IServiceProvider);
- Assert.IsNull(((IServiceProvider)d).GetService(typeof(bool)));
- }
-
- class MyScheduler : IScheduler
- {
- public MyScheduler()
- : this(DateTimeOffset.Now)
- {
- }
-
- public MyScheduler(DateTimeOffset now)
- {
- Now = now;
- }
-
- public DateTimeOffset Now
- {
- get;
- private set;
- }
-
- public IDisposable Schedule<T>(T state, Func<IScheduler, T, IDisposable> action)
- {
- return action(this, state);
- }
-
- public Action<Action<object>, object, TimeSpan> Check { get; set; }
- public long WaitCycles { get; set; }
-
- public IDisposable Schedule<T>(T state, TimeSpan dueTime, Func<IScheduler, T, IDisposable> action)
- {
- Check(o => action(this, (T)o), state, dueTime);
- WaitCycles += dueTime.Ticks;
- return action(this, state);
- }
-
- public IDisposable Schedule<T>(T state, DateTimeOffset dueTime, Func<IScheduler, T, IDisposable> action)
- {
- return Schedule(state, dueTime - Now, action);
- }
- }
-
- #endregion
-
- #region Catch
-
- [TestMethod]
- public void Catch_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Scheduler.Catch<Exception>(default(IScheduler), _ => true));
- ReactiveAssert.Throws<ArgumentNullException>(() => Scheduler.Catch<Exception>(Scheduler.Default, default(Func<Exception, bool>)));
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Scheduler.Catch<Exception>(Scheduler.Default, _ => true).Schedule(42, default(Func<IScheduler, int, IDisposable>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Scheduler.Catch<Exception>(Scheduler.Default, _ => true).Schedule(42, TimeSpan.FromSeconds(1), default(Func<IScheduler, int, IDisposable>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Scheduler.Catch<Exception>(Scheduler.Default, _ => true).Schedule(42, DateTimeOffset.Now, default(Func<IScheduler, int, IDisposable>)));
- }
-
- [TestMethod]
- public void Catch_Builtin_Swallow_Shallow()
- {
- var done = new ManualResetEvent(false);
-
- var swallow = Scheduler.Default.Catch<InvalidOperationException>(_ => { done.Set(); return true; });
-
- swallow.Schedule(() =>
- {
- throw new InvalidOperationException();
- });
-
- done.WaitOne();
- }
-
- [TestMethod]
- public void Catch_Builtin_Swallow_Recursive()
- {
- var done = new ManualResetEvent(false);
-
- var swallow = Scheduler.Default.Catch<InvalidOperationException>(_ => { done.Set(); return true; });
-
- swallow.Schedule(42, (self, state) =>
- {
- return self.Schedule(() =>
- {
- throw new InvalidOperationException();
- });
- });
-
- done.WaitOne();
- }
-
- [TestMethod]
- public void Catch_Custom_Unhandled()
- {
- var err = default(Exception);
- var scheduler = new MyExceptionScheduler(ex_ => err = ex_);
-
- scheduler.Catch<InvalidOperationException>(_ => true).Schedule(() =>
- {
- throw new InvalidOperationException();
- });
- Assert.IsNull(err);
-
- var ex = new ArgumentException();
- scheduler.Catch<InvalidOperationException>(_ => true).Schedule(() =>
- {
- throw ex;
- });
- Assert.AreSame(ex, err);
- }
-
- [TestMethod]
- public void Catch_Custom_Rethrow()
- {
- var err = default(Exception);
- var scheduler = new MyExceptionScheduler(ex_ => err = ex_);
-
- var ex = new InvalidOperationException();
- scheduler.Catch<InvalidOperationException>(_ => false).Schedule(() =>
- {
- throw ex;
- });
- Assert.AreSame(ex, err);
- }
-
- [TestMethod]
- public void Catch_Custom_LongRunning_Caught()
- {
- var err = default(Exception);
- var scheduler = new MyExceptionScheduler(ex_ => err = ex_);
-
- var caught = false;
- var @catch = scheduler.Catch<InvalidOperationException>(_ => caught = true);
- var slr = (ISchedulerLongRunning)((IServiceProvider)@catch).GetService(typeof(ISchedulerLongRunning));
-
- slr.ScheduleLongRunning(cancel =>
- {
- throw new InvalidOperationException();
- });
- Assert.IsTrue(caught);
- Assert.IsNull(err);
-
- var ex = new ArgumentException();
- slr.ScheduleLongRunning(cancel =>
- {
- throw ex;
- });
- Assert.AreSame(ex, err);
- }
-
- [TestMethod]
- public void Catch_Custom_LongRunning_Rethrow()
- {
- var err = default(Exception);
- var scheduler = new MyExceptionScheduler(ex_ => err = ex_);
-
- var @catch = scheduler.Catch<InvalidOperationException>(_ => false);
- var slr = (ISchedulerLongRunning)((IServiceProvider)@catch).GetService(typeof(ISchedulerLongRunning));
-
- var done = false;
- slr.ScheduleLongRunning(cancel =>
- {
- done = true;
- });
- Assert.IsTrue(done);
-
- var ex = new InvalidOperationException();
- slr.ScheduleLongRunning(cancel =>
- {
- throw ex;
- });
- Assert.AreSame(ex, err);
- }
-
- [TestMethod]
- public void Catch_Custom_Periodic_Regular()
- {
- var scheduler = new MyExceptionScheduler(_ => { });
- scheduler.PeriodicStopped = new ManualResetEvent(false);
-
- var @catch = scheduler.Catch<InvalidOperationException>(_ => true);
- var per = (ISchedulerPeriodic)((IServiceProvider)@catch).GetService(typeof(ISchedulerPeriodic));
-
- var madeProgress = new ManualResetEvent(false);
- var d = per.SchedulePeriodic(0, TimeSpan.Zero, x =>
- {
- if (x > 10)
- madeProgress.Set();
-
- return x + 1;
- });
-
- madeProgress.WaitOne();
- d.Dispose();
- scheduler.PeriodicStopped.WaitOne();
- }
-
- [TestMethod]
- public void Catch_Custom_Periodic_Uncaught1()
- {
- var err = default(Exception);
- var done = new ManualResetEvent(false);
- var scheduler = new MyExceptionScheduler(ex_ => { err = ex_; done.Set(); });
- scheduler.PeriodicStopped = new ManualResetEvent(false);
-
- var @catch = scheduler.Catch<InvalidOperationException>(_ => true);
- var per = (ISchedulerPeriodic)((IServiceProvider)@catch).GetService(typeof(ISchedulerPeriodic));
-
- var ex = new ArgumentException();
- per.SchedulePeriodic(42, TimeSpan.Zero, x =>
- {
- throw ex;
- });
-
- scheduler.PeriodicStopped.WaitOne();
- done.WaitOne();
- Assert.AreSame(ex, err);
- }
-
- [TestMethod]
- public void Catch_Custom_Periodic_Uncaught2()
- {
- var err = default(Exception);
- var done = new ManualResetEvent(false);
- var scheduler = new MyExceptionScheduler(ex_ => { err = ex_; done.Set(); });
- scheduler.PeriodicStopped = new ManualResetEvent(false);
-
- var @catch = scheduler.Catch<InvalidOperationException>(_ => false);
- var per = (ISchedulerPeriodic)((IServiceProvider)@catch).GetService(typeof(ISchedulerPeriodic));
-
- var ex = new InvalidOperationException();
- per.SchedulePeriodic(42, TimeSpan.Zero, x =>
- {
- throw ex;
- });
-
- scheduler.PeriodicStopped.WaitOne();
- done.WaitOne();
- Assert.AreSame(ex, err);
- }
-
- [TestMethod]
- public void Catch_Custom_Periodic_Caught()
- {
- var err = default(Exception);
- var scheduler = new MyExceptionScheduler(ex_ => err = ex_);
- scheduler.PeriodicStopped = new ManualResetEvent(false);
-
- var caught = new ManualResetEvent(false);
- var @catch = scheduler.Catch<InvalidOperationException>(_ => { caught.Set(); return true; });
- var per = (ISchedulerPeriodic)((IServiceProvider)@catch).GetService(typeof(ISchedulerPeriodic));
-
- per.SchedulePeriodic(42, TimeSpan.Zero, x =>
- {
- throw new InvalidOperationException();
- });
-
- scheduler.PeriodicStopped.WaitOne();
- caught.WaitOne();
- Assert.IsNull(err);
- }
-
- class MyExceptionScheduler : LocalScheduler, ISchedulerLongRunning, ISchedulerPeriodic
- {
- private readonly Action<Exception> _onError;
-
- public MyExceptionScheduler(Action<Exception> onError)
- {
- _onError = onError;
- }
-
- public override IDisposable Schedule<TState>(TState state, Func<IScheduler, TState, IDisposable> action)
- {
- try
- {
- return action(this, state);
- }
- catch (Exception exception)
- {
- _onError(exception);
- return Disposable.Empty;
- }
- }
-
- public override IDisposable Schedule<TState>(TState state, TimeSpan dueTime, Func<IScheduler, TState, IDisposable> action)
- {
- throw new NotImplementedException();
- }
-
- public IDisposable ScheduleLongRunning<TState>(TState state, Action<TState, ICancelable> action)
- {
- var b = new BooleanDisposable();
-
- try
- {
- action(state, b);
- }
- catch (Exception exception)
- {
- _onError(exception);
- return Disposable.Empty;
- }
-
- return b;
- }
-
- public ManualResetEvent PeriodicStopped { get; set; }
-
- public IDisposable SchedulePeriodic<TState>(TState state, TimeSpan period, Func<TState, TState> action)
- {
- var b = new BooleanDisposable();
-
- Scheduler.Default.Schedule(() =>
- {
- try
- {
- var s = state;
- for (int i = 0; true; i++)
- {
- if (i > 100 /* mimic delayed cancellation */ && b.IsDisposed)
- break;
- s = action(s);
- }
- }
- catch (Exception exception)
- {
- _onError(exception);
- }
- finally
- {
- PeriodicStopped.Set();
- }
- });
-
- return b;
- }
- }
-
- #endregion
-
- #region Services
-
- [TestMethod]
- public void InvalidService_Null()
- {
- var s = new MySchedulerWithoutServices();
- Assert.IsNull(((IServiceProvider)s).GetService(typeof(IAsyncResult)));
- }
-
- class MySchedulerWithoutServices : LocalScheduler
- {
- public override IDisposable Schedule<TState>(TState state, TimeSpan dueTime, Func<IScheduler, TState, IDisposable> action)
- {
- throw new NotImplementedException();
- }
- }
-
- [TestMethod]
- public void DetectServices_Null_1()
- {
- var s = new MyDumbScheduler1();
- Assert.IsNull(Scheduler.AsLongRunning(s));
- Assert.IsNull(Scheduler.AsPeriodic(s));
- Assert.IsNull(Scheduler.AsStopwatchProvider(s));
- }
-
- class MyDumbScheduler1 : IScheduler
- {
- public DateTimeOffset Now
- {
- get { throw new NotImplementedException(); }
- }
-
- public IDisposable Schedule<TState>(TState state, Func<IScheduler, TState, IDisposable> action)
- {
- throw new NotImplementedException();
- }
-
- public IDisposable Schedule<TState>(TState state, TimeSpan dueTime, Func<IScheduler, TState, IDisposable> action)
- {
- throw new NotImplementedException();
- }
-
- public IDisposable Schedule<TState>(TState state, DateTimeOffset dueTime, Func<IScheduler, TState, IDisposable> action)
- {
- throw new NotImplementedException();
- }
- }
-
- [TestMethod]
- public void DetectServices_Null_2()
- {
- var s = new MyDumbScheduler2(new Dictionary<Type, object>());
- Assert.IsNull(Scheduler.AsLongRunning(s));
- Assert.IsNull(Scheduler.AsPeriodic(s));
- Assert.IsNull(Scheduler.AsStopwatchProvider(s));
- }
-
- [TestMethod]
- public void DetectServices_Found()
- {
- {
- var x = new MyLongRunning();
-
- var s = new MyDumbScheduler2(new Dictionary<Type, object>
- {
- { typeof(ISchedulerLongRunning), x }
- });
-
- Assert.AreEqual(x, Scheduler.AsLongRunning(s));
- }
-
- {
- var x = new MyStopwatchProvider();
-
- var s = new MyDumbScheduler2(new Dictionary<Type, object>
- {
- { typeof(IStopwatchProvider), x }
- });
-
- Assert.AreEqual(x, Scheduler.AsStopwatchProvider(s));
- }
-
- {
- var x = new MyPeriodic();
-
- var s = new MyDumbScheduler2(new Dictionary<Type, object>
- {
- { typeof(ISchedulerPeriodic), x }
- });
-
- Assert.AreEqual(x, Scheduler.AsPeriodic(s));
- }
- }
-
- class MyDumbScheduler2 : IScheduler, IServiceProvider
- {
- private readonly Dictionary<Type, object> _services;
-
- public MyDumbScheduler2(Dictionary<Type, object> services)
- {
- _services = services;
- }
-
- public DateTimeOffset Now
- {
- get { throw new NotImplementedException(); }
- }
-
- public IDisposable Schedule<TState>(TState state, Func<IScheduler, TState, IDisposable> action)
- {
- throw new NotImplementedException();
- }
-
- public IDisposable Schedule<TState>(TState state, TimeSpan dueTime, Func<IScheduler, TState, IDisposable> action)
- {
- throw new NotImplementedException();
- }
-
- public IDisposable Schedule<TState>(TState state, DateTimeOffset dueTime, Func<IScheduler, TState, IDisposable> action)
- {
- throw new NotImplementedException();
- }
-
- public object GetService(Type serviceType)
- {
- var res = default(object);
- if (_services.TryGetValue(serviceType, out res))
- return res;
-
- return null;
- }
- }
-
- class MyLongRunning : ISchedulerLongRunning
- {
- public IDisposable ScheduleLongRunning<TState>(TState state, Action<TState, ICancelable> action)
- {
- throw new NotImplementedException();
- }
- }
-
- class MyStopwatchProvider : IStopwatchProvider
- {
- public IStopwatch StartStopwatch()
- {
- throw new NotImplementedException();
- }
- }
-
- class MyPeriodic : ISchedulerPeriodic
- {
- public IDisposable SchedulePeriodic<TState>(TState state, TimeSpan period, Func<TState, TState> action)
- {
- throw new NotImplementedException();
- }
- }
-
- #endregion
- }
-}
diff --git a/Rx.NET/Tests.System.Reactive/Tests/StopwatchTest.cs b/Rx.NET/Tests.System.Reactive/Tests/StopwatchTest.cs
deleted file mode 100644
index 9fed695..0000000
--- a/Rx.NET/Tests.System.Reactive/Tests/StopwatchTest.cs
+++ /dev/null
@@ -1,41 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_STOPWATCH
-using System;
-using System.Reactive.Concurrency;
-using System.Threading;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-
-namespace ReactiveTests.Tests
-{
- static class StopwatchTest
- {
- public static void Run(IStopwatchProvider stopwatchProvider)
- {
- /*
- * TODO: Temporarily disabled until we iron out all of the scheduler improvements.
- */
-
- //var N = 10;
- //var t = default(long);
- //var d = 1;
-
- //for (int i = 0; i < N; i++)
- //{
- // var sw = stopwatchProvider.StartStopwatch();
-
- // var e1 = sw.Elapsed;
- // Thread.Sleep(d);
- // var e2 = sw.Elapsed;
-
- // Assert.IsTrue(e2.Ticks > e1.Ticks);
- // t += (e2 - e1).Ticks;
-
- // sw.Dispose();
- //}
-
- //Assert.IsTrue(TimeSpan.FromTicks(t / N).TotalMilliseconds < d * 10 /* 10x margin */);
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/Tests.System.Reactive/Tests/SubjectTest.cs b/Rx.NET/Tests.System.Reactive/Tests/SubjectTest.cs
deleted file mode 100644
index 9249d98..0000000
--- a/Rx.NET/Tests.System.Reactive/Tests/SubjectTest.cs
+++ /dev/null
@@ -1,433 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System;
-using System.Linq;
-using System.Reactive;
-using System.Reactive.Concurrency;
-using System.Reactive.Linq;
-using System.Reactive.Subjects;
-using System.Threading;
-using Microsoft.Reactive.Testing;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-
-namespace ReactiveTests.Tests
-{
- [TestClass]
- public partial class SubjectTest : ReactiveTest
- {
- [TestMethod]
- public void Subscribe_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => new Subject<int>().Subscribe(null));
- }
-
- [TestMethod]
- public void OnError_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => new Subject<int>().OnError(null));
- }
-
- [TestMethod]
- public void Infinite()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(70, 1),
- OnNext(110, 2),
- OnNext(220, 3),
- OnNext(270, 4),
- OnNext(340, 5),
- OnNext(410, 6),
- OnNext(520, 7),
- OnNext(630, 8),
- OnNext(710, 9),
- OnNext(870, 10),
- OnNext(940, 11),
- OnNext(1020, 12)
- );
-
- var s = default(Subject<int>);
- var subscription = default(IDisposable);
-
- var results1 = scheduler.CreateObserver<int>();
- var subscription1 = default(IDisposable);
-
- var results2 = scheduler.CreateObserver<int>();
- var subscription2 = default(IDisposable);
-
- var results3 = scheduler.CreateObserver<int>();
- var subscription3 = default(IDisposable);
-
- scheduler.ScheduleAbsolute(100, () => s = new Subject<int>());
- scheduler.ScheduleAbsolute(200, () => subscription = xs.Subscribe(s));
- scheduler.ScheduleAbsolute(1000, () => subscription.Dispose());
-
- scheduler.ScheduleAbsolute(300, () => subscription1 = s.Subscribe(results1));
- scheduler.ScheduleAbsolute(400, () => subscription2 = s.Subscribe(results2));
- scheduler.ScheduleAbsolute(900, () => subscription3 = s.Subscribe(results3));
-
- scheduler.ScheduleAbsolute(600, () => subscription1.Dispose());
- scheduler.ScheduleAbsolute(700, () => subscription2.Dispose());
- scheduler.ScheduleAbsolute(800, () => subscription1.Dispose());
- scheduler.ScheduleAbsolute(950, () => subscription3.Dispose());
-
- scheduler.Start();
-
- results1.Messages.AssertEqual(
- OnNext(340, 5),
- OnNext(410, 6),
- OnNext(520, 7)
- );
-
- results2.Messages.AssertEqual(
- OnNext(410, 6),
- OnNext(520, 7),
- OnNext(630, 8)
- );
-
- results3.Messages.AssertEqual(
- OnNext(940, 11)
- );
- }
-
- [TestMethod]
- public void Finite()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(70, 1),
- OnNext(110, 2),
- OnNext(220, 3),
- OnNext(270, 4),
- OnNext(340, 5),
- OnNext(410, 6),
- OnNext(520, 7),
- OnCompleted<int>(630),
- OnNext(640, 9),
- OnCompleted<int>(650),
- OnError<int>(660, new Exception())
- );
-
- var s = default(Subject<int>);
- var subscription = default(IDisposable);
-
- var results1 = scheduler.CreateObserver<int>();
- var subscription1 = default(IDisposable);
-
- var results2 = scheduler.CreateObserver<int>();
- var subscription2 = default(IDisposable);
-
- var results3 = scheduler.CreateObserver<int>();
- var subscription3 = default(IDisposable);
-
- scheduler.ScheduleAbsolute(100, () => s = new Subject<int>());
- scheduler.ScheduleAbsolute(200, () => subscription = xs.Subscribe(s));
- scheduler.ScheduleAbsolute(1000, () => subscription.Dispose());
-
- scheduler.ScheduleAbsolute(300, () => subscription1 = s.Subscribe(results1));
- scheduler.ScheduleAbsolute(400, () => subscription2 = s.Subscribe(results2));
- scheduler.ScheduleAbsolute(900, () => subscription3 = s.Subscribe(results3));
-
- scheduler.ScheduleAbsolute(600, () => subscription1.Dispose());
- scheduler.ScheduleAbsolute(700, () => subscription2.Dispose());
- scheduler.ScheduleAbsolute(800, () => subscription1.Dispose());
- scheduler.ScheduleAbsolute(950, () => subscription3.Dispose());
-
- scheduler.Start();
-
- results1.Messages.AssertEqual(
- OnNext(340, 5),
- OnNext(410, 6),
- OnNext(520, 7)
- );
-
- results2.Messages.AssertEqual(
- OnNext(410, 6),
- OnNext(520, 7),
- OnCompleted<int>(630)
- );
-
- results3.Messages.AssertEqual(
- OnCompleted<int>(900)
- );
- }
-
- [TestMethod]
- public void Error()
- {
- var scheduler = new TestScheduler();
-
- var ex = new Exception();
-
- var xs = scheduler.CreateHotObservable(
- OnNext(70, 1),
- OnNext(110, 2),
- OnNext(220, 3),
- OnNext(270, 4),
- OnNext(340, 5),
- OnNext(410, 6),
- OnNext(520, 7),
- OnError<int>(630, ex),
- OnNext(640, 9),
- OnCompleted<int>(650),
- OnError<int>(660, new Exception())
- );
-
- var s = default(Subject<int>);
- var subscription = default(IDisposable);
-
- var results1 = scheduler.CreateObserver<int>();
- var subscription1 = default(IDisposable);
-
- var results2 = scheduler.CreateObserver<int>();
- var subscription2 = default(IDisposable);
-
- var results3 = scheduler.CreateObserver<int>();
- var subscription3 = default(IDisposable);
-
- scheduler.ScheduleAbsolute(100, () => s = new Subject<int>());
- scheduler.ScheduleAbsolute(200, () => subscription = xs.Subscribe(s));
- scheduler.ScheduleAbsolute(1000, () => subscription.Dispose());
-
- scheduler.ScheduleAbsolute(300, () => subscription1 = s.Subscribe(results1));
- scheduler.ScheduleAbsolute(400, () => subscription2 = s.Subscribe(results2));
- scheduler.ScheduleAbsolute(900, () => subscription3 = s.Subscribe(results3));
-
- scheduler.ScheduleAbsolute(600, () => subscription1.Dispose());
- scheduler.ScheduleAbsolute(700, () => subscription2.Dispose());
- scheduler.ScheduleAbsolute(800, () => subscription1.Dispose());
- scheduler.ScheduleAbsolute(950, () => subscription3.Dispose());
-
- scheduler.Start();
-
- results1.Messages.AssertEqual(
- OnNext(340, 5),
- OnNext(410, 6),
- OnNext(520, 7)
- );
-
- results2.Messages.AssertEqual(
- OnNext(410, 6),
- OnNext(520, 7),
- OnError<int>(630, ex)
- );
-
- results3.Messages.AssertEqual(
- OnError<int>(900, ex)
- );
- }
-
- [TestMethod]
- public void Canceled()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateHotObservable(
- OnCompleted<int>(630),
- OnNext(640, 9),
- OnCompleted<int>(650),
- OnError<int>(660, new Exception())
- );
-
- var s = default(Subject<int>);
- var subscription = default(IDisposable);
-
- var results1 = scheduler.CreateObserver<int>();
- var subscription1 = default(IDisposable);
-
- var results2 = scheduler.CreateObserver<int>();
- var subscription2 = default(IDisposable);
-
- var results3 = scheduler.CreateObserver<int>();
- var subscription3 = default(IDisposable);
-
- scheduler.ScheduleAbsolute(100, () => s = new Subject<int>());
- scheduler.ScheduleAbsolute(200, () => subscription = xs.Subscribe(s));
- scheduler.ScheduleAbsolute(1000, () => subscription.Dispose());
-
- scheduler.ScheduleAbsolute(300, () => subscription1 = s.Subscribe(results1));
- scheduler.ScheduleAbsolute(400, () => subscription2 = s.Subscribe(results2));
- scheduler.ScheduleAbsolute(900, () => subscription3 = s.Subscribe(results3));
-
- scheduler.ScheduleAbsolute(600, () => subscription1.Dispose());
- scheduler.ScheduleAbsolute(700, () => subscription2.Dispose());
- scheduler.ScheduleAbsolute(800, () => subscription1.Dispose());
- scheduler.ScheduleAbsolute(950, () => subscription3.Dispose());
-
- scheduler.Start();
-
- results1.Messages.AssertEqual(
- );
-
- results2.Messages.AssertEqual(
- OnCompleted<int>(630)
- );
-
- results3.Messages.AssertEqual(
- OnCompleted<int>(900)
- );
- }
-
- [TestMethod]
- public void Dispose()
- {
- var scheduler = new TestScheduler();
-
- var s = new Subject<int>();
-
- scheduler.ScheduleAbsolute(300, () => s.OnNext(1));
- scheduler.ScheduleAbsolute(998, () => s.OnNext(2));
- scheduler.ScheduleAbsolute(999, () => s.OnNext(3));
- scheduler.ScheduleAbsolute(1001, () => s.OnNext(3));
-
- var results = scheduler.Start(() => s);
-
- results.Messages.AssertEqual(
- OnNext(300, 1),
- OnNext(998, 2),
- OnNext(999, 3)
- );
- }
-
- [TestMethod]
- public void PreComplete()
- {
- var scheduler = new TestScheduler();
-
- var s = new Subject<int>();
-
- scheduler.ScheduleAbsolute(90, () => s.OnCompleted());
-
- var results = scheduler.Start(() => s);
-
- results.Messages.AssertEqual(
- OnCompleted<int>(200)
- );
- }
-
- [TestMethod]
- public void SubjectDisposed()
- {
- var scheduler = new TestScheduler();
-
- var subject = default(Subject<int>);
-
- var results1 = scheduler.CreateObserver<int>();
- var subscription1 = default(IDisposable);
-
- var results2 = scheduler.CreateObserver<int>();
- var subscription2 = default(IDisposable);
-
- var results3 = scheduler.CreateObserver<int>();
- var subscription3 = default(IDisposable);
-
- scheduler.ScheduleAbsolute(100, () => subject = new Subject<int>());
- scheduler.ScheduleAbsolute(200, () => subscription1 = subject.Subscribe(results1));
- scheduler.ScheduleAbsolute(300, () => subscription2 = subject.Subscribe(results2));
- scheduler.ScheduleAbsolute(400, () => subscription3 = subject.Subscribe(results3));
- scheduler.ScheduleAbsolute(500, () => subscription1.Dispose());
- scheduler.ScheduleAbsolute(600, () => subject.Dispose());
- scheduler.ScheduleAbsolute(700, () => subscription2.Dispose());
- scheduler.ScheduleAbsolute(800, () => subscription3.Dispose());
-
- scheduler.ScheduleAbsolute(150, () => subject.OnNext(1));
- scheduler.ScheduleAbsolute(250, () => subject.OnNext(2));
- scheduler.ScheduleAbsolute(350, () => subject.OnNext(3));
- scheduler.ScheduleAbsolute(450, () => subject.OnNext(4));
- scheduler.ScheduleAbsolute(550, () => subject.OnNext(5));
- scheduler.ScheduleAbsolute(650, () => ReactiveAssert.Throws<ObjectDisposedException>(() => subject.OnNext(6)));
- scheduler.ScheduleAbsolute(750, () => ReactiveAssert.Throws<ObjectDisposedException>(() => subject.OnCompleted()));
- scheduler.ScheduleAbsolute(850, () => ReactiveAssert.Throws<ObjectDisposedException>(() => subject.OnError(new Exception())));
- scheduler.ScheduleAbsolute(950, () => ReactiveAssert.Throws<ObjectDisposedException>(() => subject.Subscribe()));
-
- scheduler.Start();
-
- results1.Messages.AssertEqual(
- OnNext(250, 2),
- OnNext(350, 3),
- OnNext(450, 4)
- );
-
- results2.Messages.AssertEqual(
- OnNext(350, 3),
- OnNext(450, 4),
- OnNext(550, 5)
- );
-
- results3.Messages.AssertEqual(
- OnNext(450, 4),
- OnNext(550, 5)
- );
- }
-
- [TestMethod]
- public void Subject_Create_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Subject.Create<int, int>(null, Observable.Return(42)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Subject.Create<int, int>(Observer.Create<int>(x => {}), null));
- }
-
- [TestMethod]
- public void Subject_Create()
- {
- var _x = default(int);
- var _ex = default(Exception);
- var done = false;
-
- var v = Observer.Create<int>(x => _x = x, ex => _ex = ex, () => done = true);
- var o = Observable.Return(42);
-
- var s = Subject.Create<int, int>(v, o);
-
- ReactiveAssert.Throws<ArgumentNullException>(() => s.Subscribe(null));
- s.Subscribe(x => _x = x);
- Assert.AreEqual(42, _x);
-
- s.OnNext(21);
- Assert.AreEqual(21, _x);
-
- ReactiveAssert.Throws<ArgumentNullException>(() => s.OnError(null));
- var e = new Exception();
- s.OnError(e);
- Assert.AreSame(e, _ex);
-
- s.OnCompleted();
- Assert.IsFalse(done); // already cut off
- }
-
- [TestMethod]
- public void Subject_Synchronize_ArgumentChecking()
- {
- var s = new Subject<int>();
-
- ReactiveAssert.Throws<ArgumentNullException>(() => Subject.Synchronize(default(ISubject<int, int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Subject.Synchronize(default(ISubject<int, int>), Scheduler.Immediate));
- ReactiveAssert.Throws<ArgumentNullException>(() => Subject.Synchronize(s, null));
- }
-
- [TestMethod]
- public void Subject_Synchronize()
- {
- var N = 10;
-
- var y = 0;
- var o = Observer.Create<int>(x => y += x);
- var s = Subject.Synchronize(Subject.Create(o, Observable.Empty<string>()));
-
- var e = new ManualResetEvent(false);
- var t = Enumerable.Range(0, N).Select(x => new Thread(() => { e.WaitOne(); s.OnNext(x); })).ToArray();
-
- foreach (var u in t)
- u.Start();
-
- e.Set();
-
- foreach (var u in t)
- u.Join();
-
- Assert.AreEqual(Enumerable.Range(0, N).Sum(), y);
- }
- }
-}
diff --git a/Rx.NET/Tests.System.Reactive/Tests/SynchronizationContextSchedulerTest.cs b/Rx.NET/Tests.System.Reactive/Tests/SynchronizationContextSchedulerTest.cs
deleted file mode 100644
index f335490..0000000
--- a/Rx.NET/Tests.System.Reactive/Tests/SynchronizationContextSchedulerTest.cs
+++ /dev/null
@@ -1,234 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System;
-using System.Diagnostics;
-using System.Reactive.Concurrency;
-using System.Reactive.Disposables;
-using System.Threading;
-using Microsoft.Reactive.Testing;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-
-namespace ReactiveTests.Tests
-{
- [TestClass]
- public class SynchronizationContextSchedulerTest
- {
- [TestMethod]
- public void SynchronizationContext_ArgumentChecking()
- {
- var ms = new MySync();
- var s = new SynchronizationContextScheduler(ms);
-
- ReactiveAssert.Throws<ArgumentNullException>(() => new SynchronizationContextScheduler(null));
- ReactiveAssert.Throws<ArgumentNullException>(() => new SynchronizationContextScheduler(null, true));
- ReactiveAssert.Throws<ArgumentNullException>(() => s.Schedule<int>(42, default(Func<IScheduler, int, IDisposable>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => s.Schedule<int>(42, DateTimeOffset.Now, default(Func<IScheduler, int, IDisposable>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => s.Schedule<int>(42, TimeSpan.Zero, default(Func<IScheduler, int, IDisposable>)));
- }
-
- [TestMethod]
- public void SynchronizationContext_Now()
- {
- var ms = new MySync();
- var s = new SynchronizationContextScheduler(ms);
-
- var res = s.Now - DateTime.Now;
- Assert.IsTrue(res.Seconds < 1);
- }
-
- [TestMethod]
- public void SynchronizationContext_ScheduleAction()
- {
- var ms = new MySync();
- var s = new SynchronizationContextScheduler(ms);
-
- var ran = false;
- s.Schedule(() => { ran = true; });
- Assert.IsTrue(ms.Count == 1);
- Assert.IsTrue(ran);
- }
-
- [TestMethod]
- public void SynchronizationContext_ScheduleAction_TimeSpan()
- {
- var ms = new MySync();
- var s = new SynchronizationContextScheduler(ms);
-
- var e = new ManualResetEvent(false);
- s.Schedule(TimeSpan.FromMilliseconds(1), () => { e.Set(); });
-
- e.WaitOne();
- Assert.IsTrue(ms.Count == 1);
- }
-
- [TestMethod]
- public void SynchronizationContext_ScheduleAction_DateTimeOffset()
- {
- var ms = new MySync();
- var s = new SynchronizationContextScheduler(ms);
-
- var e = new ManualResetEvent(false);
- s.Schedule(DateTimeOffset.Now.AddMilliseconds(100), () => { e.Set(); });
-
- e.WaitOne();
- Assert.IsTrue(ms.Count == 1);
- }
-
- [TestMethod]
- public void SynchronizationContext_ScheduleActionError()
- {
- var ms = new MySync();
- var s = new SynchronizationContextScheduler(ms);
-
- var ex = new Exception();
-
- try
- {
- s.Schedule(() => { throw ex; });
- Assert.Fail();
- }
- catch (Exception e)
- {
- Assert.AreSame(e, ex);
- }
-
- Assert.IsTrue(ms.Count == 1);
- }
-
-#if !SILVERLIGHT
- [TestMethod]
- [Ignore]
- public void SynchronizationContext_ScheduleActionDue()
- {
- var ms = new MySync();
- var s = new SynchronizationContextScheduler(ms);
-
- var evt = new ManualResetEvent(false);
- var sw = new Stopwatch();
- sw.Start();
- s.Schedule(TimeSpan.FromSeconds(0.2), () => { sw.Stop(); evt.Set(); });
- evt.WaitOne();
- Assert.IsTrue(sw.ElapsedMilliseconds > 180, "due " + sw.ElapsedMilliseconds);
- Assert.IsTrue(ms.Count == 1);
- }
-#endif
-
- class MySync : SynchronizationContext
- {
- public int Count { get; private set; }
-
- public override void Post(SendOrPostCallback d, object state)
- {
- Count++;
- d(state);
- }
-
- public override void Send(SendOrPostCallback d, object state)
- {
- throw new NotImplementedException();
- }
-
- public int Started { get; private set; }
-
- public override void OperationStarted()
- {
- base.OperationStarted();
- Started++;
- }
-
- public int Completed { get; private set; }
-
- public override void OperationCompleted()
- {
- base.OperationCompleted();
- Completed++;
- }
- }
-
- [TestMethod]
- public void SynchronizationContext_StartedCompleted()
- {
- var ms = new MySync();
- var s = new SynchronizationContextScheduler(ms);
-
- var started = 0;
- s.Schedule<int>(42, TimeSpan.Zero, (self, x) => { started = ms.Started; return Disposable.Empty; });
-
- Assert.IsTrue(started == 1);
- Assert.IsTrue(ms.Count == 1);
- Assert.IsTrue(ms.Completed == 1);
- }
-
- [TestMethod]
- public void SynchronizationContext_DontPost_Different()
- {
- var ms = new MySync();
- var s = new SynchronizationContextScheduler(ms, false);
-
- var ran = false;
- s.Schedule(() => { ran = true; });
- Assert.IsTrue(ms.Count == 1);
- Assert.IsTrue(ran);
- }
-
- [TestMethod]
- public void SynchronizationContext_DontPost_Same()
- {
- var count = 0;
- var ran = false;
-
- var t = new Thread(() =>
- {
- var ms = new MySync();
- SynchronizationContext.SetSynchronizationContext(ms);
-
- var s = new SynchronizationContextScheduler(ms, false);
-
- s.Schedule(() => { ran = true; });
- count = ms.Count;
- });
-
- t.Start();
- t.Join();
-
- Assert.IsTrue(count == 0 /* no post */);
- Assert.IsTrue(ran);
- }
-
- [TestMethod]
- public void SynchronizationContext_AlwaysPost_Different()
- {
- var ms = new MySync();
- var s = new SynchronizationContextScheduler(ms, true);
-
- var ran = false;
- s.Schedule(() => { ran = true; });
- Assert.IsTrue(ms.Count == 1);
- Assert.IsTrue(ran);
- }
-
- [TestMethod]
- public void SynchronizationContext_AlwaysPost_Same()
- {
- var count = 0;
- var ran = false;
-
- var t = new Thread(() =>
- {
- var ms = new MySync();
- SynchronizationContext.SetSynchronizationContext(ms);
-
- var s = new SynchronizationContextScheduler(ms, true);
-
- s.Schedule(() => { ran = true; });
- count = ms.Count;
- });
-
- t.Start();
- t.Join();
-
- Assert.IsTrue(count == 1 /* post */);
- Assert.IsTrue(ran);
- }
- }
-}
diff --git a/Rx.NET/Tests.System.Reactive/Tests/SynchronizationTest.cs b/Rx.NET/Tests.System.Reactive/Tests/SynchronizationTest.cs
deleted file mode 100644
index 4c0a04f..0000000
--- a/Rx.NET/Tests.System.Reactive/Tests/SynchronizationTest.cs
+++ /dev/null
@@ -1,51 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System;
-using System.Reactive.Concurrency;
-using System.Threading;
-using Microsoft.Reactive.Testing;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using ReactiveTests.Dummies;
-
-namespace ReactiveTests.Tests
-{
- [TestClass]
- public class SynchronizationTests
- {
- [TestMethod]
- public void Synchronization_SubscribeOn_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Synchronization.SubscribeOn(default(IObservable<int>), Scheduler.Immediate));
- ReactiveAssert.Throws<ArgumentNullException>(() => Synchronization.SubscribeOn(DummyObservable<int>.Instance, default(IScheduler)));
-
-#if !NO_SYNCCTX
- ReactiveAssert.Throws<ArgumentNullException>(() => Synchronization.SubscribeOn(default(IObservable<int>), new MySyncCtx()));
- ReactiveAssert.Throws<ArgumentNullException>(() => Synchronization.SubscribeOn(DummyObservable<int>.Instance, default(SynchronizationContext)));
-#endif
- }
-
- [TestMethod]
- public void Synchronization_ObserveOn_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Synchronization.ObserveOn(default(IObservable<int>), Scheduler.Immediate));
- ReactiveAssert.Throws<ArgumentNullException>(() => Synchronization.ObserveOn(DummyObservable<int>.Instance, default(IScheduler)));
-
-#if !NO_SYNCCTX
- ReactiveAssert.Throws<ArgumentNullException>(() => Synchronization.ObserveOn(default(IObservable<int>), new MySyncCtx()));
- ReactiveAssert.Throws<ArgumentNullException>(() => Synchronization.ObserveOn(DummyObservable<int>.Instance, default(SynchronizationContext)));
-#endif
- }
-
- [TestMethod]
- public void Synchronization_Synchronize_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => Synchronization.Synchronize(default(IObservable<int>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => Synchronization.Synchronize(default(IObservable<int>), new object()));
- ReactiveAssert.Throws<ArgumentNullException>(() => Synchronization.Synchronize(DummyObservable<int>.Instance, null));
- }
-
- class MySyncCtx : SynchronizationContext
- {
- }
- }
-}
diff --git a/Rx.NET/Tests.System.Reactive/Tests/SystemClockTest.cs b/Rx.NET/Tests.System.Reactive/Tests/SystemClockTest.cs
deleted file mode 100644
index 5f35383..0000000
--- a/Rx.NET/Tests.System.Reactive/Tests/SystemClockTest.cs
+++ /dev/null
@@ -1,1095 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_REMOTING
-using System;
-using System.Collections.Generic;
-using System.Reactive;
-using System.Reactive.Concurrency;
-using System.Reactive.Disposables;
-using System.Reactive.PlatformServices;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-
-namespace ReactiveTests.Tests
-{
- static class Exts
- {
- public static T Deq<T>(this List<T> l)
- {
- var t = l[0];
- l.RemoveAt(0);
- return t;
- }
- }
-
- [TestClass]
- public class SystemClockTest
- {
- private void Run(CrossAppDomainDelegate a)
- {
- var domain = AppDomain.CreateDomain(Guid.NewGuid().ToString(), null, new AppDomainSetup { ApplicationBase = AppDomain.CurrentDomain.BaseDirectory });
- domain.DoCallBack(a);
- AppDomain.Unload(domain);
- }
-
- [TestMethod]
- public void PastWork()
- {
- Run(() =>
- {
- var provider = new MyPlatformEnlightenmentProvider();
- PlatformEnlightenmentProvider.Current = provider;
-
- var cal = provider._cal;
- var now = new DateTimeOffset(2012, 4, 25, 12, 0, 0, TimeSpan.Zero);
- var due = now - TimeSpan.FromMinutes(1);
-
- var s = new MyScheduler();
- s.SetTime(now);
-
- var done = false;
- s.Schedule(due, () => { done = true; });
-
- Assert.AreEqual(1, s._queue.Count);
-
- var next = s._queue.Deq();
- Assert.IsTrue(s.Now + next.DueTime == now);
-
- s.SetTime(due);
- next.Invoke();
-
- Assert.IsTrue(done);
- });
- }
-
- [TestMethod]
- public void ImmediateWork()
- {
- Run(() =>
- {
- var provider = new MyPlatformEnlightenmentProvider();
- PlatformEnlightenmentProvider.Current = provider;
-
- var cal = provider._cal;
- var now = new DateTimeOffset(2012, 4, 25, 12, 0, 0, TimeSpan.Zero);
- var due = now;
-
- var s = new MyScheduler();
- s.SetTime(now);
-
- var done = false;
- s.Schedule(due, () => { done = true; });
-
- Assert.AreEqual(1, s._queue.Count);
-
- var next = s._queue.Deq();
- Assert.IsTrue(s.Now + next.DueTime == due);
-
- s.SetTime(due);
- next.Invoke();
-
- Assert.IsTrue(done);
- });
- }
-
- [TestMethod]
- public void ShortTermWork()
- {
- Run(() =>
- {
- var provider = new MyPlatformEnlightenmentProvider();
- PlatformEnlightenmentProvider.Current = provider;
-
- var cal = provider._cal;
- var now = new DateTimeOffset(2012, 4, 25, 12, 0, 0, TimeSpan.Zero);
- var rel = TimeSpan.FromSeconds(1) /* rel <= SHORTTERM */;
- var due = now + rel;
-
- var s = new MyScheduler();
- s.SetTime(now);
-
- var done = false;
- s.Schedule(due, () => { done = true; });
-
- Assert.AreEqual(1, s._queue.Count);
-
- var next = s._queue.Deq();
- Assert.IsTrue(s.Now + next.DueTime == due);
-
- s.SetTime(due);
- next.Invoke();
-
- Assert.IsTrue(done);
- });
- }
-
- [TestMethod]
- public void ShortTermWork_Dispose()
- {
- Run(() =>
- {
- var provider = new MyPlatformEnlightenmentProvider();
- PlatformEnlightenmentProvider.Current = provider;
-
- var cal = provider._cal;
- var now = new DateTimeOffset(2012, 4, 25, 12, 0, 0, TimeSpan.Zero);
- var rel = TimeSpan.FromSeconds(1) /* rel <= SHORTTERM */;
- var due = now + rel;
-
- var s = new MyScheduler();
- s.SetTime(now);
-
- var done = false;
- var d = s.Schedule(due, () => { done = true; });
-
- Assert.AreEqual(1, s._queue.Count);
-
- var next = s._queue.Deq();
- Assert.IsTrue(s.Now + next.DueTime == due);
-
- d.Dispose();
-
- s.SetTime(due);
- next.Invoke();
-
- Assert.IsFalse(done);
- });
- }
-
- [TestMethod]
- public void ShortTermWork_InaccurateClock()
- {
- Run(() =>
- {
- var provider = new MyPlatformEnlightenmentProvider();
- PlatformEnlightenmentProvider.Current = provider;
-
- var cal = provider._cal;
- var now = new DateTimeOffset(2012, 4, 25, 12, 0, 0, TimeSpan.Zero);
- var rel = TimeSpan.FromSeconds(1);
- var due = now + rel;
-
- var s = new MyScheduler();
- s.SetTime(now);
-
- var done = false;
- s.Schedule(due, () => { done = true; });
-
- Assert.AreEqual(1, s._queue.Count);
-
- var nxt1 = s._queue.Deq();
- Assert.IsTrue(s.Now + nxt1.DueTime == due);
-
- s.SetTime(due - TimeSpan.FromMilliseconds(500) /* > RETRYSHORT */);
- nxt1.Invoke();
-
- Assert.AreEqual(1, s._queue.Count);
-
- var nxt2 = s._queue.Deq();
- Assert.IsTrue(s.Now + nxt2.DueTime == due);
-
- s.SetTime(due);
- nxt2.Invoke();
-
- Assert.IsTrue(done);
- });
- }
-
- [TestMethod]
- public void LongTermWork1()
- {
- Run(() =>
- {
- var provider = new MyPlatformEnlightenmentProvider();
- PlatformEnlightenmentProvider.Current = provider;
-
- var cal = provider._cal;
- var now = new DateTimeOffset(2012, 4, 25, 12, 0, 0, TimeSpan.Zero);
- var rel = TimeSpan.FromMinutes(1) /* rel > SHORTTERM */;
- var due = now + rel;
-
- var s = new MyScheduler();
- s.SetTime(now);
-
- var done = false;
- s.Schedule(due, () => { done = true; });
-
- Assert.AreEqual(1, cal._queue.Count);
-
- var work = cal._queue.Deq();
- Assert.IsTrue(work.Interval < rel);
-
- s.SetTime(s.Now + work.Interval);
- work.Value._action(work.Value._state);
-
- Assert.AreEqual(1, s._queue.Count);
-
- var next = s._queue.Deq();
- Assert.IsTrue(s.Now + next.DueTime == due);
-
- s.SetTime(due);
- next.Invoke();
-
- Assert.IsTrue(done);
- });
- }
-
- [TestMethod]
- public void LongTermWork2()
- {
- Run(() =>
- {
- var provider = new MyPlatformEnlightenmentProvider();
- PlatformEnlightenmentProvider.Current = provider;
-
- var cal = provider._cal;
- var now = new DateTimeOffset(2012, 4, 25, 12, 0, 0, TimeSpan.Zero);
- var rel = TimeSpan.FromDays(1) /* rel > SHORTTERM and rel * MAXERRORRATIO > SHORTTERM */;
- var due = now + rel;
-
- var s = new MyScheduler();
- s.SetTime(now);
-
- var done = false;
- s.Schedule(due, () => { done = true; });
-
- Assert.AreEqual(1, cal._queue.Count);
-
- var wrk1 = cal._queue.Deq();
- Assert.IsTrue(wrk1.Interval < rel);
-
- s.SetTime(s.Now + wrk1.Interval);
- wrk1.Value._action(wrk1.Value._state);
-
- // Begin of second long term scheduling
- Assert.AreEqual(1, cal._queue.Count);
-
- var wrk2 = cal._queue.Deq();
- Assert.IsTrue(wrk2.Interval < rel);
-
- s.SetTime(s.Now + wrk2.Interval);
- wrk2.Value._action(wrk2.Value._state);
- // End of second long term scheduling
-
- Assert.AreEqual(1, s._queue.Count);
-
- var next = s._queue.Deq();
- Assert.IsTrue(s.Now + next.DueTime == due);
-
- s.SetTime(due);
- next.Invoke();
-
- Assert.IsTrue(done);
- });
- }
-
- [TestMethod]
- public void LongTerm_Multiple()
- {
- Run(() =>
- {
- var provider = new MyPlatformEnlightenmentProvider();
- PlatformEnlightenmentProvider.Current = provider;
-
- var cal = provider._cal;
- var now = new DateTimeOffset(2012, 4, 25, 12, 0, 0, TimeSpan.Zero);
-
- var s = new MyScheduler();
- s.SetTime(now);
-
- var due1 = now + TimeSpan.FromMinutes(10);
- var due2 = now + TimeSpan.FromMinutes(30);
- var due3 = now + TimeSpan.FromMinutes(60);
-
- var done1 = false;
- var done2 = false;
- var done3 = false;
-
- s.Schedule(due2, () => { done2 = true; });
- s.Schedule(due1, () => { done1 = true; });
- s.Schedule(due3, () => { done3 = true; });
-
- // First CHK
- Assert.AreEqual(1, cal._queue.Count);
- var wrk1 = cal._queue.Deq();
- var fst = s.Now + wrk1.Interval;
- Assert.IsTrue(fst < due1);
-
- // First TRN
- s.SetTime(fst);
- wrk1.Value._action(wrk1.Value._state);
-
- // First SHT
- Assert.AreEqual(1, s._queue.Count);
- var sh1 = s._queue.Deq();
-
- // Second CHK
- Assert.AreEqual(1, cal._queue.Count);
- var wrk2 = cal._queue.Deq();
- var snd = s.Now + wrk2.Interval;
- Assert.IsTrue(snd < due2);
-
- // First RUN
- s.SetTime(due1);
- sh1.Invoke();
- Assert.IsTrue(done1);
-
- // Second TRN
- s.SetTime(snd);
- wrk2.Value._action(wrk2.Value._state);
-
- // Second SHT
- Assert.AreEqual(1, s._queue.Count);
- var sh2 = s._queue.Deq();
-
- // Third CHK
- Assert.AreEqual(1, cal._queue.Count);
- var wrk3 = cal._queue.Deq();
- var trd = s.Now + wrk3.Interval;
- Assert.IsTrue(trd < due3);
-
- // Second RUN
- s.SetTime(due2);
- sh2.Invoke();
- Assert.IsTrue(done2);
-
- // Third TRN
- s.SetTime(trd);
- wrk3.Value._action(wrk3.Value._state);
-
- // Third SHT
- Assert.AreEqual(1, s._queue.Count);
- var sh3 = s._queue.Deq();
-
- // Third RUN
- s.SetTime(due3);
- sh3.Invoke();
- Assert.IsTrue(done3);
- });
- }
-
- [TestMethod]
- public void LongTerm_Multiple_Dispose()
- {
- Run(() =>
- {
- var provider = new MyPlatformEnlightenmentProvider();
- PlatformEnlightenmentProvider.Current = provider;
-
- var cal = provider._cal;
- var now = new DateTimeOffset(2012, 4, 25, 12, 0, 0, TimeSpan.Zero);
-
- var s = new MyScheduler();
- s.SetTime(now);
-
- var due1 = now + TimeSpan.FromMinutes(10);
- var due2 = now + TimeSpan.FromMinutes(30);
- var due3 = now + TimeSpan.FromMinutes(60);
-
- var done1 = false;
- var done2 = false;
- var done3 = false;
-
- var d2 = s.Schedule(due2, () => { done2 = true; });
- var d1 = s.Schedule(due1, () => { done1 = true; });
- var d3 = s.Schedule(due3, () => { done3 = true; });
-
- // First CHK
- Assert.AreEqual(1, cal._queue.Count);
- var wrk1 = cal._queue.Deq();
- var fst = s.Now + wrk1.Interval;
- Assert.IsTrue(fst < due1);
-
- // First TRN
- s.SetTime(fst);
- wrk1.Value._action(wrk1.Value._state);
-
- // First DIS
- d1.Dispose();
-
- // First SHT
- Assert.AreEqual(1, s._queue.Count);
- var sh1 = s._queue.Deq();
-
- // Second CHK
- Assert.AreEqual(1, cal._queue.Count);
- var wrk2 = cal._queue.Deq();
- var snd = s.Now + wrk2.Interval;
- Assert.IsTrue(snd < due2);
-
- // First RUN
- s.SetTime(due1);
- sh1.Invoke();
- Assert.IsFalse(done1);
-
- // Second DIS
- // Third DIS
- d2.Dispose();
- d3.Dispose();
-
- // Second TRN
- s.SetTime(snd);
- wrk2.Value._action(wrk2.Value._state);
-
- // Second SHT
- Assert.AreEqual(1, s._queue.Count);
- var sh2 = s._queue.Deq();
-
- // Third CHK
- Assert.AreEqual(1, cal._queue.Count);
- var wrk3 = cal._queue.Deq();
- var trd = s.Now + wrk3.Interval;
- Assert.IsTrue(trd < due3);
-
- // Second RUN
- s.SetTime(due2);
- sh2.Invoke();
- Assert.IsFalse(done2);
-
- // Third TRN
- s.SetTime(trd);
- wrk3.Value._action(wrk3.Value._state);
-
- // Third SHT
- Assert.AreEqual(1, s._queue.Count);
- var sh3 = s._queue.Deq();
-
- // Third RUN
- s.SetTime(due3);
- sh3.Invoke();
- Assert.IsFalse(done3);
- });
- }
-
- [TestMethod]
- public void ClockChanged_FalsePositive()
- {
- Run(() =>
- {
- var provider = new MyPlatformEnlightenmentProvider();
- PlatformEnlightenmentProvider.Current = provider;
-
- var scm = (ClockChanged)provider.GetService<INotifySystemClockChanged>();
-
- var cal = provider._cal;
- var now = new DateTimeOffset(2012, 4, 25, 12, 0, 0, TimeSpan.Zero);
- var rel = TimeSpan.FromMinutes(1);
- var due = now + rel;
-
- var s = new MyScheduler();
- s.SetTime(now);
-
- var done = false;
- s.Schedule(due, () => { done = true; });
-
- Assert.AreEqual(1, cal._queue.Count);
-
- s.SetTime(now);
- scm.OnSystemClockChanged();
-
- var work = cal._queue.Deq();
- Assert.IsTrue(work.Interval < rel);
-
- s.SetTime(s.Now + work.Interval);
- work.Value._action(work.Value._state);
-
- Assert.AreEqual(1, s._queue.Count);
-
- var next = s._queue.Deq();
- Assert.IsTrue(s.Now + next.DueTime == due);
-
- s.SetTime(due);
- next.Invoke();
-
- Assert.IsTrue(done);
- });
- }
-
- [TestMethod]
- public void ClockChanged_Forward1()
- {
- Run(() =>
- {
- var provider = new MyPlatformEnlightenmentProvider();
- PlatformEnlightenmentProvider.Current = provider;
-
- var scm = (ClockChanged)provider.GetService<INotifySystemClockChanged>();
-
- var cal = provider._cal;
- var now = new DateTimeOffset(2012, 4, 25, 12, 0, 0, TimeSpan.Zero);
- var rel = TimeSpan.FromMinutes(1);
- var due = now + rel;
- var err = TimeSpan.FromMinutes(1);
-
- var s = new MyScheduler();
- s.SetTime(now);
-
- var done = false;
- s.Schedule(due, () => { done = true; });
-
- Assert.AreEqual(1, cal._queue.Count);
- Assert.AreEqual(0, s._queue.Count);
-
- s.SetTime(due + err);
- scm.OnSystemClockChanged();
-
- Assert.AreEqual(1, s._queue.Count);
-
- var next = s._queue.Deq();
- Assert.IsTrue(next.DueTime == TimeSpan.Zero);
- next.Invoke();
- Assert.IsTrue(done);
-
- var tmr = cal._queue.Deq();
- tmr.Value._action(tmr.Value._state);
-
- Assert.AreEqual(0, cal._queue.Count);
- Assert.AreEqual(0, s._queue.Count);
- });
- }
-
- [TestMethod]
- public void ClockChanged_Forward2()
- {
- Run(() =>
- {
- var provider = new MyPlatformEnlightenmentProvider();
- PlatformEnlightenmentProvider.Current = provider;
-
- var scm = (ClockChanged)provider.GetService<INotifySystemClockChanged>();
-
- var cal = provider._cal;
- var now = new DateTimeOffset(2012, 4, 25, 12, 0, 0, TimeSpan.Zero);
- var rel = TimeSpan.FromSeconds(1);
- var due = now + rel;
- var err = TimeSpan.FromMinutes(1);
-
- var s = new MyScheduler();
- s.SetTime(now);
-
- var n = 0;
- s.Schedule(due, () => { n++; });
-
- Assert.AreEqual(1, s._queue.Count);
-
- var wrk = s._queue.Deq();
- Assert.IsTrue(wrk.DueTime == rel);
-
- s.SetTime(due + err);
- scm.OnSystemClockChanged();
-
- Assert.AreEqual(1, s._queue.Count);
-
- var next = s._queue.Deq();
- Assert.IsTrue(next.DueTime == TimeSpan.Zero);
- next.Invoke();
- Assert.AreEqual(1, n);
-
- wrk.Invoke(); // Bad schedulers may not grant cancellation immediately.
- Assert.AreEqual(1, n); // Invoke shouldn't cause double execution of the work.
- });
- }
-
- [TestMethod]
- public void ClockChanged_Backward1()
- {
- Run(() =>
- {
- var provider = new MyPlatformEnlightenmentProvider();
- PlatformEnlightenmentProvider.Current = provider;
-
- var scm = (ClockChanged)provider.GetService<INotifySystemClockChanged>();
-
- var cal = provider._cal;
- var now = new DateTimeOffset(2012, 4, 25, 12, 0, 0, TimeSpan.Zero);
- var rel = TimeSpan.FromMinutes(1);
- var due = now + rel;
- var err = TimeSpan.FromMinutes(-2);
-
- var s = new MyScheduler();
- s.SetTime(now);
-
- var done = false;
- s.Schedule(due, () => { done = true; });
-
- Assert.AreEqual(1, cal._queue.Count);
- Assert.IsTrue(cal._queue[0].Interval < rel);
-
- Assert.AreEqual(0, s._queue.Count);
-
- s.SetTime(due + err);
- scm.OnSystemClockChanged();
-
- Assert.AreEqual(1, cal._queue.Count);
-
- var tmr = cal._queue.Deq();
- Assert.IsTrue(tmr.Interval > rel);
- Assert.IsTrue(tmr.Interval < -err);
-
- s.SetTime(s.Now + tmr.Interval);
- tmr.Value._action(tmr.Value._state);
-
- Assert.IsFalse(done);
-
- Assert.AreEqual(0, cal._queue.Count);
- Assert.AreEqual(1, s._queue.Count);
-
- s.SetTime(due);
- s._queue.Deq().Invoke();
-
- Assert.IsTrue(done);
- });
- }
-
- [TestMethod]
- public void ClockChanged_Backward2()
- {
- Run(() =>
- {
- var provider = new MyPlatformEnlightenmentProvider();
- PlatformEnlightenmentProvider.Current = provider;
-
- var scm = (ClockChanged)provider.GetService<INotifySystemClockChanged>();
-
- var cal = provider._cal;
- var now = new DateTimeOffset(2012, 4, 25, 12, 0, 0, TimeSpan.Zero);
- var rel = TimeSpan.FromSeconds(1);
- var due = now + rel;
- var err = TimeSpan.FromMinutes(-1);
-
- var s = new MyScheduler();
- s.SetTime(now);
-
- var n = 0;
- s.Schedule(due, () => { n++; });
-
- Assert.AreEqual(0, cal._queue.Count);
- Assert.AreEqual(1, s._queue.Count);
- var wrk = s._queue[0];
- Assert.IsTrue(wrk.DueTime == rel);
-
- s.SetTime(due + err);
- scm.OnSystemClockChanged();
-
- Assert.AreEqual(1, cal._queue.Count);
-
- var tmr = cal._queue.Deq();
- Assert.IsTrue(tmr.Interval > rel);
- Assert.IsTrue(tmr.Interval < -err);
-
- s.SetTime(s.Now + tmr.Interval);
- tmr.Value._action(tmr.Value._state);
-
- Assert.AreEqual(0, n);
-
- Assert.AreEqual(0, cal._queue.Count);
- Assert.AreEqual(1, s._queue.Count);
-
- s.SetTime(due);
- s._queue.Deq().Invoke();
-
- Assert.AreEqual(1, n);
-
- wrk.Invoke(); // Bad schedulers may not grant cancellation immediately.
- Assert.AreEqual(1, n); // Invoke shouldn't cause double execution of the work.
- });
- }
-
- [TestMethod]
- public void PeriodicSystemClockChangeMonitor()
- {
- Run(() =>
- {
- var provider = new FakeClockPlatformEnlightenmentProvider();
- PlatformEnlightenmentProvider.Current = provider;
-
- var clock = (FakeClock)provider.GetService<ISystemClock>();
- clock._now = new DateTimeOffset(2012, 4, 26, 12, 0, 0, TimeSpan.Zero);
-
- var cal = (FakeClockCAL)provider.GetService<IConcurrencyAbstractionLayer>();
-
- var period = TimeSpan.FromSeconds(1);
- var ptscm = new PeriodicTimerSystemClockMonitor(period);
-
- var delta = TimeSpan.Zero;
- var n = 0;
- var h = new EventHandler<SystemClockChangedEventArgs>((o, e) =>
- {
- delta = e.NewTime - e.OldTime;
- n++;
- });
-
- ptscm.SystemClockChanged += h;
-
- Assert.IsNotNull(cal._action);
- Assert.IsTrue(cal._period == period);
- Assert.AreEqual(0, n);
-
- clock._now += period;
- cal._action();
- Assert.AreEqual(0, n);
-
- clock._now += period;
- cal._action();
- Assert.AreEqual(0, n);
-
- var diff1 = TimeSpan.FromSeconds(3);
- clock._now += period + diff1;
- cal._action();
- Assert.AreEqual(1, n);
- Assert.IsTrue(delta == diff1);
-
- clock._now += period;
- cal._action();
- Assert.AreEqual(1, n);
-
- clock._now += period;
- cal._action();
- Assert.AreEqual(1, n);
-
- var diff2 = TimeSpan.FromSeconds(-5);
- clock._now += period + diff2;
- cal._action();
- Assert.AreEqual(2, n);
- Assert.IsTrue(delta == diff2);
-
- clock._now += period;
- cal._action();
- Assert.AreEqual(2, n);
-
- ptscm.SystemClockChanged -= h;
-
- Assert.IsNull(cal._action);
- });
- }
-
- [TestMethod]
- public void ClockChanged_RefCounting()
- {
- Run(() =>
- {
- var provider = new MyPlatformEnlightenmentProvider();
- PlatformEnlightenmentProvider.Current = provider;
-
- var scm = (ClockChanged)provider.GetService<INotifySystemClockChanged>();
-
- var cal = provider._cal;
- var now = new DateTimeOffset(2012, 4, 25, 12, 0, 0, TimeSpan.Zero);
-
- var s = new MyScheduler();
- s.SetTime(now);
-
- var due1 = now + TimeSpan.FromSeconds(5);
- var due2 = now + TimeSpan.FromSeconds(8);
- var due3 = now + TimeSpan.FromMinutes(1);
- var due4 = now + TimeSpan.FromMinutes(2);
- var due5 = now + TimeSpan.FromMinutes(3);
- var due6 = now + TimeSpan.FromMinutes(3) + TimeSpan.FromSeconds(2);
-
- var done1 = false;
- var done2 = false;
- var done3 = false;
- var done4 = false;
- var done5 = false;
- var done6 = false;
-
- var d1 = s.Schedule(due1, () => { done1 = true; });
- var d5 = s.Schedule(due5, () => { done5 = true; });
- var d3 = s.Schedule(due3, () => { done3 = true; throw new Exception(); });
- var d2 = s.Schedule(due2, () => { done2 = true; });
- var d4 = s.Schedule(due4, () => { done4 = true; });
-
- d2.Dispose();
- d4.Dispose();
-
- Assert.AreEqual(1, scm.n);
-
- s.SetTime(due1);
- var i1 = s._queue.Deq();
- i1.Invoke();
- Assert.IsTrue(done1);
-
- Assert.AreEqual(1, scm.n);
-
- s.SetTime(due2);
- var i2 = s._queue.Deq();
- i2.Invoke();
- Assert.IsFalse(done2);
-
- Assert.AreEqual(1, scm.n);
-
- var l1 = cal._queue.Deq();
- var l1d = now + l1.Interval;
- s.SetTime(l1d);
- l1.Value._action(l1.Value._state);
-
- s.SetTime(due3);
- var i3 = s._queue.Deq();
- try
- {
- i3.Invoke();
- Assert.Fail();
- }
- catch { }
- Assert.IsTrue(done3);
-
- Assert.AreEqual(1, scm.n);
-
- var l2 = cal._queue.Deq();
- var l2d = l1d + l2.Interval;
- s.SetTime(l2d);
- l2.Value._action(l2.Value._state);
-
- s.SetTime(due4);
- var i4 = s._queue.Deq();
- i4.Invoke();
- Assert.IsFalse(done4);
-
- Assert.AreEqual(1, scm.n);
-
- var l3 = cal._queue.Deq();
- var l3d = l2d + l3.Interval;
- s.SetTime(l3d);
- l3.Value._action(l3.Value._state);
-
- s.SetTime(due5);
- var i5 = s._queue.Deq();
- i5.Invoke();
- Assert.IsTrue(done5);
-
- Assert.AreEqual(0, scm.n);
-
- var d6 = s.Schedule(due6, () => { done6 = true; });
-
- Assert.AreEqual(1, scm.n);
-
- s.SetTime(due6);
- var i6 = s._queue.Deq();
- i6.Invoke();
- Assert.IsTrue(done6);
-
- Assert.AreEqual(0, scm.n);
- });
- }
-
- class MyScheduler : LocalScheduler
- {
- internal List<ScheduledItem<TimeSpan>> _queue = new List<ScheduledItem<TimeSpan>>();
-
- private DateTimeOffset _now;
-
- public void SetTime(DateTimeOffset now)
- {
- _now = now;
- }
-
- public override DateTimeOffset Now
- {
- get { return _now; }
- }
-
- public override IDisposable Schedule<TState>(TState state, TimeSpan dueTime, Func<IScheduler, TState, IDisposable> action)
- {
- var s = new ScheduledItem<TimeSpan, TState>(this, state, action, dueTime);
- _queue.Add(s);
- return Disposable.Create(() => _queue.Remove(s));
- }
- }
-
- class MyPlatformEnlightenmentProvider : IPlatformEnlightenmentProvider
- {
- internal MyCAL _cal;
-
- public MyPlatformEnlightenmentProvider()
- {
- _cal = new MyCAL();
- }
-
- public T GetService<T>(params object[] args) where T : class
- {
- if (typeof(T) == typeof(IConcurrencyAbstractionLayer))
- {
- return (T)(object)_cal;
- }
- else if (typeof(T) == typeof(INotifySystemClockChanged))
- {
- return (T)(object)ClockChanged.Instance;
- }
-
- return null;
- }
- }
-
- class FakeClockPlatformEnlightenmentProvider : IPlatformEnlightenmentProvider
- {
- internal FakeClockCAL _cal;
- internal FakeClock _clock;
-
- public FakeClockPlatformEnlightenmentProvider()
- {
- _cal = new FakeClockCAL();
- _clock = new FakeClock();
- }
-
- public T GetService<T>(params object[] args) where T : class
- {
- if (typeof(T) == typeof(IConcurrencyAbstractionLayer))
- {
- return (T)(object)_cal;
- }
- else if (typeof(T) == typeof(ISystemClock))
- {
- return (T)(object)_clock;
- }
-
- return null;
- }
- }
-
- class Work
- {
- internal readonly Action<object> _action;
- internal readonly object _state;
-
- public Work(Action<object> action, object state)
- {
- _action = action;
- _state = state;
- }
- }
-
- class MyCAL : IConcurrencyAbstractionLayer
- {
- internal List<TimeInterval<Work>> _queue = new List<TimeInterval<Work>>();
-
- public IDisposable StartTimer(Action<object> action, object state, TimeSpan dueTime)
- {
- var t = new TimeInterval<Work>(new Work(action, state), dueTime);
- _queue.Add(t);
- return Disposable.Create(() => _queue.Remove(t));
- }
-
- public IDisposable StartPeriodicTimer(Action action, TimeSpan period)
- {
- throw new NotImplementedException();
- }
-
- public IDisposable QueueUserWorkItem(Action<object> action, object state)
- {
- throw new NotImplementedException();
- }
-
- public void Sleep(TimeSpan timeout)
- {
- throw new NotImplementedException();
- }
-
- public IStopwatch StartStopwatch()
- {
- throw new NotImplementedException();
- }
-
- public bool SupportsLongRunning
- {
- get { throw new NotImplementedException(); }
- }
-
- public void StartThread(Action<object> action, object state)
- {
- throw new NotImplementedException();
- }
- }
-
- class FakeClockCAL : IConcurrencyAbstractionLayer
- {
- internal Action _action;
- internal TimeSpan _period;
-
- public IDisposable StartTimer(Action<object> action, object state, TimeSpan dueTime)
- {
- throw new NotImplementedException();
- }
-
- public IDisposable StartPeriodicTimer(Action action, TimeSpan period)
- {
- _action = action;
- _period = period;
- return Disposable.Create(() => _action = null);
- }
-
- public IDisposable QueueUserWorkItem(Action<object> action, object state)
- {
- throw new NotImplementedException();
- }
-
- public void Sleep(TimeSpan timeout)
- {
- throw new NotImplementedException();
- }
-
- public IStopwatch StartStopwatch()
- {
- throw new NotImplementedException();
- }
-
- public bool SupportsLongRunning
- {
- get { throw new NotImplementedException(); }
- }
-
- public void StartThread(Action<object> action, object state)
- {
- throw new NotImplementedException();
- }
- }
-
- class FakeClock : ISystemClock
- {
- internal DateTimeOffset _now;
-
- public DateTimeOffset UtcNow
- {
- get { return _now; }
- }
- }
-
- class ClockChanged : INotifySystemClockChanged
- {
- private static ClockChanged s_instance = new ClockChanged();
-
- private EventHandler<SystemClockChangedEventArgs> _systemClockChanged;
-
- internal int n = 0;
-
- public event EventHandler<SystemClockChangedEventArgs> SystemClockChanged
- {
- add
- {
- _systemClockChanged += value;
- n++;
- }
-
- remove
- {
- _systemClockChanged -= value;
- n--;
- }
- }
-
- public static ClockChanged Instance
- {
- get
- {
- return s_instance;
- }
- }
-
- public void OnSystemClockChanged()
- {
- var scc = _systemClockChanged;
- if (scc != null)
- scc(this, new SystemClockChangedEventArgs());
- }
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/Tests.System.Reactive/Tests/TaskObservableExtensionsTest.cs b/Rx.NET/Tests.System.Reactive/Tests/TaskObservableExtensionsTest.cs
deleted file mode 100644
index 229576b..0000000
--- a/Rx.NET/Tests.System.Reactive/Tests/TaskObservableExtensionsTest.cs
+++ /dev/null
@@ -1,818 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_TPL
-using System;
-using System.Linq;
-using System.Reactive;
-using System.Reactive.Concurrency;
-using System.Reactive.Linq;
-using System.Reactive.Threading.Tasks;
-using System.Threading;
-using System.Threading.Tasks;
-using Microsoft.Reactive.Testing;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-
-namespace ReactiveTests.Tests
-{
- [TestClass]
- public class TaskObservableExtensionsTest : ReactiveTest
- {
- #region ToObservable
-
- [TestMethod]
- public void TaskToObservable_NonVoid_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => TaskObservableExtensions.ToObservable((System.Threading.Tasks.Task<int>)null));
- var tcs = new System.Threading.Tasks.TaskCompletionSource<int>();
- var task = tcs.Task;
- ReactiveAssert.Throws<ArgumentNullException>(() => task.ToObservable().Subscribe(null));
- }
-
- [TestMethod]
- public void TaskToObservable_NonVoid_Complete_BeforeCreate()
- {
- var taskScheduler = new TestTaskScheduler();
- var taskFactory = new TaskFactory(taskScheduler);
- var res = default(ITestableObserver<int>);
-
- taskFactory.StartNew(() =>
- {
- var scheduler = new TestScheduler();
-
- var taskSource = new TaskCompletionSource<int>();
- taskSource.Task.ContinueWith(t => { var e = t.Exception; });
-
- scheduler.ScheduleAbsolute(10, () => taskSource.SetResult(42));
-
- res = scheduler.Start(() =>
- taskSource.Task.ToObservable()
- );
- });
-
- res.Messages.AssertEqual(
- OnNext(200, 42),
- OnCompleted<int>(200)
- );
- }
-
- [TestMethod]
- public void TaskToObservable_NonVoid_Complete_BeforeSubscribe()
- {
- var taskScheduler = new TestTaskScheduler();
- var taskFactory = new TaskFactory(taskScheduler);
- var res = default(ITestableObserver<int>);
-
- taskFactory.StartNew(() =>
- {
- var scheduler = new TestScheduler();
-
- var taskSource = new TaskCompletionSource<int>();
- taskSource.Task.ContinueWith(t => { var e = t.Exception; });
-
- scheduler.ScheduleAbsolute(110, () => taskSource.SetResult(42));
-
- res = scheduler.Start(() =>
- taskSource.Task.ToObservable()
- );
- });
-
- res.Messages.AssertEqual(
- OnNext(200, 42),
- OnCompleted<int>(200)
- );
- }
-
- [TestMethod]
- public void TaskToObservable_NonVoid_Complete_BeforeDispose()
- {
- var taskScheduler = new TestTaskScheduler();
- var taskFactory = new TaskFactory(taskScheduler);
- var res = default(ITestableObserver<int>);
-
- taskFactory.StartNew(() =>
- {
- var scheduler = new TestScheduler();
-
- var taskSource = new TaskCompletionSource<int>();
- taskSource.Task.ContinueWith(t => { var e = t.Exception; });
-
- scheduler.ScheduleAbsolute(300, () => taskSource.SetResult(42));
-
- res = scheduler.Start(() =>
- taskSource.Task.ToObservable()
- );
- });
-
- res.Messages.AssertEqual(
- OnNext(300, 42),
- OnCompleted<int>(300)
- );
- }
-
- [TestMethod]
- public void TaskToObservable_NonVoid_Complete_AfterDispose()
- {
- var taskScheduler = new TestTaskScheduler();
- var taskFactory = new TaskFactory(taskScheduler);
- var res = default(ITestableObserver<int>);
-
- taskFactory.StartNew(() =>
- {
- var scheduler = new TestScheduler();
-
- var taskSource = new TaskCompletionSource<int>();
- taskSource.Task.ContinueWith(t => { var e = t.Exception; });
-
- scheduler.ScheduleAbsolute(1100, () => taskSource.SetResult(42));
-
- res = scheduler.Start(() =>
- taskSource.Task.ToObservable()
- );
- });
-
- res.Messages.AssertEqual(
- );
- }
-
- [TestMethod]
- public void TaskToObservable_NonVoid_Exception_BeforeCreate()
- {
- var taskScheduler = new TestTaskScheduler();
- var taskFactory = new TaskFactory(taskScheduler);
- var res = default(ITestableObserver<int>);
-
- var ex = new Exception();
-
- taskFactory.StartNew(() =>
- {
- var scheduler = new TestScheduler();
-
- var taskSource = new TaskCompletionSource<int>();
- taskSource.Task.ContinueWith(t => { var e = t.Exception; });
-
- scheduler.ScheduleAbsolute(10, () => taskSource.SetException(ex));
-
- res = scheduler.Start(() =>
- taskSource.Task.ToObservable()
- );
- });
-
- res.Messages.AssertEqual(
- OnError<int>(200, ex)
- );
- }
-
- [TestMethod]
- public void TaskToObservable_NonVoid_Exception_BeforeSubscribe()
- {
- var taskScheduler = new TestTaskScheduler();
- var taskFactory = new TaskFactory(taskScheduler);
- var res = default(ITestableObserver<int>);
-
- var ex = new Exception();
-
- taskFactory.StartNew(() =>
- {
- var scheduler = new TestScheduler();
-
- var taskSource = new TaskCompletionSource<int>();
- taskSource.Task.ContinueWith(t => { var e = t.Exception; });
-
- scheduler.ScheduleAbsolute(110, () => taskSource.SetException(ex));
-
- res = scheduler.Start(() =>
- taskSource.Task.ToObservable()
- );
- });
-
- res.Messages.AssertEqual(
- OnError<int>(200, ex)
- );
- }
-
- [TestMethod]
- public void TaskToObservable_NonVoid_Exception_BeforeDispose()
- {
- var taskScheduler = new TestTaskScheduler();
- var taskFactory = new TaskFactory(taskScheduler);
- var res = default(ITestableObserver<int>);
-
- var ex = new Exception();
-
- taskFactory.StartNew(() =>
- {
- var scheduler = new TestScheduler();
-
- var taskSource = new TaskCompletionSource<int>();
- taskSource.Task.ContinueWith(t => { var e = t.Exception; });
-
- scheduler.ScheduleAbsolute(300, () => taskSource.SetException(ex));
-
- res = scheduler.Start(() =>
- taskSource.Task.ToObservable()
- );
- });
-
- res.Messages.AssertEqual(
- OnError<int>(300, ex)
- );
- }
-
- [TestMethod]
- public void TaskToObservable_NonVoid_Exception_AfterDispose()
- {
- var taskScheduler = new TestTaskScheduler();
- var taskFactory = new TaskFactory(taskScheduler);
- var res = default(ITestableObserver<int>);
-
- taskFactory.StartNew(() =>
- {
- var scheduler = new TestScheduler();
-
- var taskSource = new TaskCompletionSource<int>();
- taskSource.Task.ContinueWith(t => { var e = t.Exception; });
-
- scheduler.ScheduleAbsolute(1100, () => taskSource.SetException(new Exception()));
-
- res = scheduler.Start(() =>
- taskSource.Task.ToObservable()
- );
- });
-
- res.Messages.AssertEqual(
- );
- }
-
- [TestMethod]
- public void TaskToObservable_NonVoid_Canceled_BeforeCreate()
- {
- var taskScheduler = new TestTaskScheduler();
- var taskFactory = new TaskFactory(taskScheduler);
- var res = default(ITestableObserver<int>);
-
- taskFactory.StartNew(() =>
- {
- var scheduler = new TestScheduler();
-
- var taskSource = new TaskCompletionSource<int>();
- taskSource.Task.ContinueWith(t => { var e = t.Exception; });
-
- scheduler.ScheduleAbsolute(10, () => taskSource.SetCanceled());
-
- res = scheduler.Start(() =>
- taskSource.Task.ToObservable()
- );
- });
-
- res.Messages.AssertEqual(
- OnError<int>(200, ex => ex is TaskCanceledException)
- );
- }
-
- [TestMethod]
- public void TaskToObservable_NonVoid_Canceled_BeforeSubscribe()
- {
- var taskScheduler = new TestTaskScheduler();
- var taskFactory = new TaskFactory(taskScheduler);
- var res = default(ITestableObserver<int>);
-
- taskFactory.StartNew(() =>
- {
- var scheduler = new TestScheduler();
-
- var taskSource = new TaskCompletionSource<int>();
- taskSource.Task.ContinueWith(t => { var e = t.Exception; });
-
- scheduler.ScheduleAbsolute(110, () => taskSource.SetCanceled());
-
- res = scheduler.Start(() =>
- taskSource.Task.ToObservable()
- );
- });
-
- res.Messages.AssertEqual(
- OnError<int>(200, ex => ex is TaskCanceledException)
- );
- }
-
- [TestMethod]
- public void TaskToObservable_NonVoid_Canceled_BeforeDispose()
- {
- var taskScheduler = new TestTaskScheduler();
- var taskFactory = new TaskFactory(taskScheduler);
- var res = default(ITestableObserver<int>);
-
- taskFactory.StartNew(() =>
- {
- var scheduler = new TestScheduler();
-
- var taskSource = new TaskCompletionSource<int>();
- taskSource.Task.ContinueWith(t => { var e = t.Exception; });
-
- scheduler.ScheduleAbsolute(300, () => taskSource.SetCanceled());
-
- res = scheduler.Start(() =>
- taskSource.Task.ToObservable()
- );
- });
-
- res.Messages.AssertEqual(
- OnError<int>(300, ex => ex is TaskCanceledException)
- );
- }
-
- [TestMethod]
- public void TaskToObservable_NonVoid_Canceled_AfterDispose()
- {
- var taskScheduler = new TestTaskScheduler();
- var taskFactory = new TaskFactory(taskScheduler);
- var res = default(ITestableObserver<int>);
-
- taskFactory.StartNew(() =>
- {
- var scheduler = new TestScheduler();
-
- var taskSource = new TaskCompletionSource<int>();
- taskSource.Task.ContinueWith(t => { var e = t.Exception; });
-
- scheduler.ScheduleAbsolute(1100, () => taskSource.SetCanceled());
-
- res = scheduler.Start(() =>
- taskSource.Task.ToObservable()
- );
- });
-
- res.Messages.AssertEqual(
- );
- }
-
- [TestMethod]
- public void TaskToObservable_Void_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => TaskObservableExtensions.ToObservable((System.Threading.Tasks.Task)null));
- var tcs = new System.Threading.Tasks.TaskCompletionSource<int>();
- System.Threading.Tasks.Task task = tcs.Task;
- ReactiveAssert.Throws<ArgumentNullException>(() => task.ToObservable().Subscribe(null));
- }
-
- [TestMethod]
- public void TaskToObservable_Void_Complete_BeforeCreate()
- {
- var taskScheduler = new TestTaskScheduler();
- var taskFactory = new TaskFactory(taskScheduler);
- var res = default(ITestableObserver<Unit>);
-
- taskFactory.StartNew(() =>
- {
- var scheduler = new TestScheduler();
-
- var taskSource = new TaskCompletionSource<int>();
- taskSource.Task.ContinueWith(t => { var e = t.Exception; });
-
- scheduler.ScheduleAbsolute(10, () => taskSource.SetResult(42));
-
- res = scheduler.Start(() =>
- ((Task)taskSource.Task).ToObservable()
- );
- });
-
- res.Messages.AssertEqual(
- OnNext(200, new Unit()),
- OnCompleted<Unit>(200)
- );
- }
-
- [TestMethod]
- public void TaskToObservable_Void_Complete_BeforeSubscribe()
- {
- var taskScheduler = new TestTaskScheduler();
- var taskFactory = new TaskFactory(taskScheduler);
- var res = default(ITestableObserver<Unit>);
-
- taskFactory.StartNew(() =>
- {
- var scheduler = new TestScheduler();
-
- var taskSource = new TaskCompletionSource<int>();
- taskSource.Task.ContinueWith(t => { var e = t.Exception; });
-
- scheduler.ScheduleAbsolute(110, () => taskSource.SetResult(42));
-
- res = scheduler.Start(() =>
- ((Task)taskSource.Task).ToObservable()
- );
- });
-
- res.Messages.AssertEqual(
- OnNext(200, new Unit()),
- OnCompleted<Unit>(200)
- );
- }
-
- [TestMethod]
- public void TaskToObservable_Void_Complete_BeforeDispose()
- {
- var taskScheduler = new TestTaskScheduler();
- var taskFactory = new TaskFactory(taskScheduler);
- var res = default(ITestableObserver<Unit>);
-
- taskFactory.StartNew(() =>
- {
- var scheduler = new TestScheduler();
-
- var taskSource = new TaskCompletionSource<int>();
- taskSource.Task.ContinueWith(t => { var e = t.Exception; });
-
- scheduler.ScheduleAbsolute(300, () => taskSource.SetResult(42));
-
- res = scheduler.Start(() =>
- ((Task)taskSource.Task).ToObservable()
- );
- });
-
- res.Messages.AssertEqual(
- OnNext(300, new Unit()),
- OnCompleted<Unit>(300)
- );
- }
-
- [TestMethod]
- public void TaskToObservable_Void_Complete_AfterDispose()
- {
- var taskScheduler = new TestTaskScheduler();
- var taskFactory = new TaskFactory(taskScheduler);
- var res = default(ITestableObserver<Unit>);
-
- taskFactory.StartNew(() =>
- {
- var scheduler = new TestScheduler();
-
- var taskSource = new TaskCompletionSource<int>();
- taskSource.Task.ContinueWith(t => { var e = t.Exception; });
-
- scheduler.ScheduleAbsolute(1100, () => taskSource.SetResult(42));
-
- res = scheduler.Start(() =>
- ((Task)taskSource.Task).ToObservable()
- );
- });
-
- res.Messages.AssertEqual(
- );
- }
-
- [TestMethod]
- public void TaskToObservable_Void_Exception_BeforeCreate()
- {
- var taskScheduler = new TestTaskScheduler();
- var taskFactory = new TaskFactory(taskScheduler);
- var res = default(ITestableObserver<Unit>);
-
- var ex = new Exception();
-
- taskFactory.StartNew(() =>
- {
- var scheduler = new TestScheduler();
-
- var taskSource = new TaskCompletionSource<int>();
- taskSource.Task.ContinueWith(t => { var e = t.Exception; });
-
- scheduler.ScheduleAbsolute(10, () => taskSource.SetException(ex));
-
- res = scheduler.Start(() =>
- ((Task)taskSource.Task).ToObservable()
- );
- });
-
- res.Messages.AssertEqual(
- OnError<Unit>(200, ex)
- );
- }
-
- [TestMethod]
- public void TaskToObservable_Void_Exception_BeforeSubscribe()
- {
- var taskScheduler = new TestTaskScheduler();
- var taskFactory = new TaskFactory(taskScheduler);
- var res = default(ITestableObserver<Unit>);
-
- var ex = new Exception();
-
- taskFactory.StartNew(() =>
- {
- var scheduler = new TestScheduler();
-
- var taskSource = new TaskCompletionSource<int>();
- taskSource.Task.ContinueWith(t => { var e = t.Exception; });
-
- scheduler.ScheduleAbsolute(110, () => taskSource.SetException(ex));
-
- res = scheduler.Start(() =>
- ((Task)taskSource.Task).ToObservable()
- );
- });
-
- res.Messages.AssertEqual(
- OnError<Unit>(200, ex)
- );
- }
-
- [TestMethod]
- public void TaskToObservable_Void_Exception_BeforeDispose()
- {
- var taskScheduler = new TestTaskScheduler();
- var taskFactory = new TaskFactory(taskScheduler);
- var res = default(ITestableObserver<Unit>);
-
- var ex = new Exception();
-
- taskFactory.StartNew(() =>
- {
- var scheduler = new TestScheduler();
-
- var taskSource = new TaskCompletionSource<int>();
- taskSource.Task.ContinueWith(t => { var e = t.Exception; });
-
- scheduler.ScheduleAbsolute(300, () => taskSource.SetException(ex));
-
- res = scheduler.Start(() =>
- ((Task)taskSource.Task).ToObservable()
- );
- });
-
- res.Messages.AssertEqual(
- OnError<Unit>(300, ex)
- );
- }
-
- [TestMethod]
- public void TaskToObservable_Void_Exception_AfterDispose()
- {
- var taskScheduler = new TestTaskScheduler();
- var taskFactory = new TaskFactory(taskScheduler);
- var res = default(ITestableObserver<Unit>);
-
- taskFactory.StartNew(() =>
- {
- var scheduler = new TestScheduler();
-
- var taskSource = new TaskCompletionSource<int>();
- taskSource.Task.ContinueWith(t => { var e = t.Exception; });
-
- scheduler.ScheduleAbsolute(1100, () => taskSource.SetException(new Exception()));
-
- res = scheduler.Start(() =>
- ((Task)taskSource.Task).ToObservable()
- );
- });
-
- res.Messages.AssertEqual(
- );
- }
-
- [TestMethod]
- public void TaskToObservable_Void_Canceled_BeforeCreate()
- {
- var taskScheduler = new TestTaskScheduler();
- var taskFactory = new TaskFactory(taskScheduler);
- var res = default(ITestableObserver<Unit>);
-
- taskFactory.StartNew(() =>
- {
- var scheduler = new TestScheduler();
-
- var taskSource = new TaskCompletionSource<int>();
- taskSource.Task.ContinueWith(t => { var e = t.Exception; });
-
- scheduler.ScheduleAbsolute(10, () => taskSource.SetCanceled());
-
- res = scheduler.Start(() =>
- ((Task)taskSource.Task).ToObservable()
- );
- });
-
- res.Messages.AssertEqual(
- OnError<Unit>(200, ex => ex is TaskCanceledException)
- );
- }
-
- [TestMethod]
- public void TaskToObservable_Void_Canceled_BeforeSubscribe()
- {
- var taskScheduler = new TestTaskScheduler();
- var taskFactory = new TaskFactory(taskScheduler);
- var res = default(ITestableObserver<Unit>);
-
- taskFactory.StartNew(() =>
- {
- var scheduler = new TestScheduler();
-
- var taskSource = new TaskCompletionSource<int>();
- taskSource.Task.ContinueWith(t => { var e = t.Exception; });
-
- scheduler.ScheduleAbsolute(110, () => taskSource.SetCanceled());
-
- res = scheduler.Start(() =>
- ((Task)taskSource.Task).ToObservable()
- );
- });
-
- res.Messages.AssertEqual(
- OnError<Unit>(200, ex => ex is TaskCanceledException)
- );
- }
-
- [TestMethod]
- public void TaskToObservable_Void_Canceled_BeforeDispose()
- {
- var taskScheduler = new TestTaskScheduler();
- var taskFactory = new TaskFactory(taskScheduler);
- var res = default(ITestableObserver<Unit>);
-
- taskFactory.StartNew(() =>
- {
- var scheduler = new TestScheduler();
-
- var taskSource = new TaskCompletionSource<int>();
- taskSource.Task.ContinueWith(t => { var e = t.Exception; });
-
- scheduler.ScheduleAbsolute(300, () => taskSource.SetCanceled());
-
- res = scheduler.Start(() =>
- ((Task)taskSource.Task).ToObservable()
- );
- });
-
- res.Messages.AssertEqual(
- OnError<Unit>(300, ex => ex is TaskCanceledException)
- );
- }
-
- [TestMethod]
- public void TaskToObservable_Void_Canceled_AfterDispose()
- {
- var taskScheduler = new TestTaskScheduler();
- var taskFactory = new TaskFactory(taskScheduler);
- var res = default(ITestableObserver<Unit>);
-
- taskFactory.StartNew(() =>
- {
- var scheduler = new TestScheduler();
-
- var taskSource = new TaskCompletionSource<int>();
- taskSource.Task.ContinueWith(t => { var e = t.Exception; });
-
- scheduler.ScheduleAbsolute(1100, () => taskSource.SetCanceled());
-
- res = scheduler.Start(() =>
- ((Task)taskSource.Task).ToObservable()
- );
- });
-
- res.Messages.AssertEqual(
- );
- }
-
- #endregion
-
- #region ToTask
-
- [TestMethod]
- public void ObservableToTask_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => TaskObservableExtensions.ToTask<int>(null));
- ReactiveAssert.Throws<ArgumentNullException>(() => TaskObservableExtensions.ToTask<int>(null, new CancellationToken()));
- ReactiveAssert.Throws<ArgumentNullException>(() => TaskObservableExtensions.ToTask<int>(null, new object()));
- ReactiveAssert.Throws<ArgumentNullException>(() => TaskObservableExtensions.ToTask<int>(null, new CancellationToken(), new object()));
- }
-
- [TestMethod]
- public void ObservableToTaskNoValue()
- {
- var scheduler = new TestScheduler();
-
- var xs = Observable.Empty<int>(scheduler);
-
- var continuation = xs.ToTask();
- scheduler.Start();
-
- Assert.IsTrue(continuation.IsFaulted);
- Assert.IsTrue(continuation.Exception.InnerExceptions.Count == 1 && continuation.Exception.InnerExceptions[0] is InvalidOperationException);
-
- Assert.AreEqual(1, scheduler.Clock);
- }
-
- [TestMethod]
- public void ObservableToTaskSingleValue()
- {
- var scheduler = new TestScheduler();
-
- var xs = Observable.Return(5, scheduler);
-
- var continuation = xs.ToTask();
- scheduler.Start();
-
- Assert.IsTrue(continuation.IsCompleted);
- Assert.AreEqual(5, continuation.Result);
-
- Assert.AreEqual(1, scheduler.Clock);
- }
-
- [TestMethod]
- public void ObservableToTaskMultipleValues()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateColdObservable(
- OnNext(100, 1),
- OnNext(150, 2),
- OnNext(200, 3),
- OnCompleted<int>(200)
- );
-
- var continuation = xs.ToTask();
- scheduler.Start();
-
- Assert.IsTrue(continuation.IsCompleted);
- Assert.AreEqual(3, continuation.Result);
-
- xs.Subscriptions.AssertEqual(
- Subscribe(0, 200)
- );
- }
-
- [TestMethod]
- public void ObservableToTaskException()
- {
- var scheduler = new TestScheduler();
-
- var ex = new InvalidOperationException();
-
- var xs = scheduler.CreateColdObservable(
- OnNext(100, 1),
- OnNext(150, 2),
- OnError<int>(200, ex)
- );
-
- var continuation = xs.ToTask();
- scheduler.Start();
-
- Assert.IsTrue(continuation.IsFaulted);
- var ag = continuation.Exception;
- Assert.IsNotNull(ag);
- Assert.AreEqual(1, ag.InnerExceptions.Count);
- Assert.AreEqual(ex, ag.InnerExceptions[0]);
-
- xs.Subscriptions.AssertEqual(
- Subscribe(0, 200)
- );
- }
-
- [TestMethod]
- public void ObservableToTaskCancelled()
- {
- var scheduler = new TestScheduler();
-
- var xs = scheduler.CreateColdObservable(
- OnNext(100, 1),
- OnNext(150, 2),
- OnCompleted<int>(200)
- );
-
- var cts = new CancellationTokenSource();
- var continuation = xs.ToTask(cts.Token);
- scheduler.ScheduleAbsolute(125, cts.Cancel);
-
- scheduler.Start();
-
- Assert.IsTrue(continuation.IsCanceled);
-
- xs.Subscriptions.AssertEqual(
- Subscribe(0, 125)
- );
- }
-
- [TestMethod]
- public void ObservableToTaskWithStateSingleValue()
- {
- var state = "bar";
-
- var scheduler = new TestScheduler();
-
- var xs = Observable.Return(5, scheduler);
-
- var continuation = xs.ToTask(state);
- Assert.AreSame(continuation.AsyncState, state);
-
- scheduler.Start();
-
- Assert.IsTrue(continuation.IsCompleted);
- Assert.AreEqual(5, continuation.Result);
-
- Assert.AreEqual(1, scheduler.Clock);
- }
-
- #endregion
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/Tests.System.Reactive/Tests/TaskPoolSchedulerTest.cs b/Rx.NET/Tests.System.Reactive/Tests/TaskPoolSchedulerTest.cs
deleted file mode 100644
index ba21aae..0000000
--- a/Rx.NET/Tests.System.Reactive/Tests/TaskPoolSchedulerTest.cs
+++ /dev/null
@@ -1,165 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_TPL
-using System;
-using System.Reactive.Concurrency;
-using System.Threading;
-using Microsoft.Reactive.Testing;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-
-namespace ReactiveTests.Tests
-{
- [TestClass]
- public class TaskPoolSchedulerTest
- {
- [TestMethod]
- public void TaskPool_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => new TaskPoolScheduler(null));
- ReactiveAssert.Throws<ArgumentNullException>(() => TaskPoolScheduler.Default.Schedule<int>(42, default(Func<IScheduler, int, IDisposable>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => TaskPoolScheduler.Default.Schedule<int>(42, DateTimeOffset.Now, default(Func<IScheduler, int, IDisposable>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => TaskPoolScheduler.Default.Schedule<int>(42, TimeSpan.Zero, default(Func<IScheduler, int, IDisposable>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => TaskPoolScheduler.Default.SchedulePeriodic(42, TimeSpan.FromSeconds(1), default(Func<int, int>)));
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => TaskPoolScheduler.Default.SchedulePeriodic(42, TimeSpan.FromSeconds(-1), _ => _));
- }
-
- [TestMethod]
- public void TaskPool_Now()
- {
- var res = TaskPoolScheduler.Default.Now - DateTime.Now;
- Assert.IsTrue(res.Seconds < 1);
- }
-
- [TestMethod]
- public void TaskPool_ScheduleAction()
- {
- var id = Thread.CurrentThread.ManagedThreadId;
- var nt = TaskPoolScheduler.Default;
- var evt = new ManualResetEvent(false);
- nt.Schedule(() => { Assert.AreNotEqual(id, Thread.CurrentThread.ManagedThreadId); evt.Set(); });
- evt.WaitOne();
- }
-
- [TestMethod]
- public void TaskPool_ScheduleActionDueNow()
- {
- var id = Thread.CurrentThread.ManagedThreadId;
- var nt = TaskPoolScheduler.Default;
- var evt = new ManualResetEvent(false);
- nt.Schedule(TimeSpan.Zero, () => { Assert.AreNotEqual(id, Thread.CurrentThread.ManagedThreadId); evt.Set(); });
- evt.WaitOne();
- }
-
- [TestMethod]
- public void TaskPool_ScheduleActionDue()
- {
- var id = Thread.CurrentThread.ManagedThreadId;
- var nt = TaskPoolScheduler.Default;
- var evt = new ManualResetEvent(false);
- nt.Schedule(TimeSpan.FromMilliseconds(1), () => { Assert.AreNotEqual(id, Thread.CurrentThread.ManagedThreadId); evt.Set(); });
- evt.WaitOne();
- }
-
- [TestMethod]
- public void TaskPool_ScheduleActionCancel()
- {
- var id = Thread.CurrentThread.ManagedThreadId;
- var nt = TaskPoolScheduler.Default;
- var set = false;
- var d = nt.Schedule(TimeSpan.FromSeconds(0.2), () => { Assert.Fail(); set = true; });
- d.Dispose();
- Thread.Sleep(400);
- Assert.IsFalse(set);
- }
-
-#if !NO_PERF
- [TestMethod]
- public void TaskPool_ScheduleLongRunning()
- {
- var n = 0;
- var e = new ManualResetEvent(false);
- var gate = new object();
-
- var d = TaskPoolScheduler.Default.ScheduleLongRunning(42, (x, cancel) =>
- {
- while (!cancel.IsDisposed)
- lock (gate)
- n++;
- e.Set();
- });
-
- while (true)
- {
- lock (gate)
- if (n >= 10)
- break;
-
- Thread.Sleep(10);
- }
-
- d.Dispose();
- e.WaitOne();
-
- Assert.IsTrue(n >= 0);
- }
-#endif
-
-#if !NO_PERF
-#if !NO_STOPWATCH
- [TestMethod]
- public void Stopwatch()
- {
- StopwatchTest.Run(TaskPoolScheduler.Default);
- }
-#endif
-#endif
-
- [TestMethod]
- public void TaskPool_Periodic()
- {
- var n = 0;
- var e = new ManualResetEvent(false);
-
- var d = TaskPoolScheduler.Default.SchedulePeriodic(TimeSpan.FromMilliseconds(25), () =>
- {
- if (Interlocked.Increment(ref n) == 10)
- e.Set();
- });
-
- if (!e.WaitOne(10000))
- Assert.Fail();
-
- d.Dispose();
- }
-
- [TestMethod]
- public void TaskPool_Periodic_NonReentrant()
- {
- var n = 0;
- var fail = false;
-
- var d = TaskPoolScheduler.Default.SchedulePeriodic(0, TimeSpan.FromMilliseconds(50), x =>
- {
- try
- {
- if (Interlocked.Increment(ref n) > 1) // Without an AsyncLock this would fail.
- fail = true;
-
- Thread.Sleep(100);
-
- return x + 1;
- }
- finally
- {
- Interlocked.Decrement(ref n);
- }
- });
-
- Thread.Sleep(500);
- d.Dispose();
-
- Assert.IsFalse(fail);
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/Tests.System.Reactive/Tests/ThreadPoolSchedulerTest.cs b/Rx.NET/Tests.System.Reactive/Tests/ThreadPoolSchedulerTest.cs
deleted file mode 100644
index dc29982..0000000
--- a/Rx.NET/Tests.System.Reactive/Tests/ThreadPoolSchedulerTest.cs
+++ /dev/null
@@ -1,237 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !NO_THREAD
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Reactive.Concurrency;
-using System.Reactive.Disposables;
-using System.Threading;
-using Microsoft.Reactive.Testing;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-
-namespace ReactiveTests.Tests
-{
- [TestClass]
- public class ThreadPoolSchedulerTest
- {
- [TestMethod]
- public void Schedule_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => ThreadPoolScheduler.Instance.Schedule<int>(42, default(Func<IScheduler, int, IDisposable>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => ThreadPoolScheduler.Instance.Schedule<int>(42, DateTimeOffset.Now, default(Func<IScheduler, int, IDisposable>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => ThreadPoolScheduler.Instance.Schedule<int>(42, TimeSpan.Zero, default(Func<IScheduler, int, IDisposable>)));
- }
-
- [TestMethod]
- public void Get_Now()
- {
- var res = ThreadPoolScheduler.Instance.Now - DateTime.Now;
- Assert.IsTrue(res.Seconds < 1);
- }
-
- [TestMethod]
- public void ScheduleAction()
- {
- var id = Thread.CurrentThread.ManagedThreadId;
- var nt = ThreadPoolScheduler.Instance;
- var evt = new ManualResetEvent(false);
- nt.Schedule(() => { Assert.AreNotEqual(id, Thread.CurrentThread.ManagedThreadId); evt.Set(); });
- evt.WaitOne();
- }
-
-#if !SILVERLIGHT
- [TestMethod]
- public void ScheduleActionDueRelative()
- {
- var id = Thread.CurrentThread.ManagedThreadId;
- var nt = ThreadPoolScheduler.Instance;
- var evt = new ManualResetEvent(false);
- nt.Schedule(TimeSpan.FromSeconds(0.2), () => { Assert.AreNotEqual(id, Thread.CurrentThread.ManagedThreadId); evt.Set(); });
- evt.WaitOne();
- }
-
- [TestMethod]
- public void ScheduleActionDue0()
- {
- var id = Thread.CurrentThread.ManagedThreadId;
- var nt = ThreadPoolScheduler.Instance;
- var evt = new ManualResetEvent(false);
- nt.Schedule(TimeSpan.FromTicks(0), () => { Assert.AreNotEqual(id, Thread.CurrentThread.ManagedThreadId); evt.Set(); });
- evt.WaitOne();
- }
-
- [TestMethod]
- public void ScheduleActionDueAbsolute()
- {
- var id = Thread.CurrentThread.ManagedThreadId;
- var nt = ThreadPoolScheduler.Instance;
- var evt = new ManualResetEvent(false);
- nt.Schedule(DateTimeOffset.UtcNow + TimeSpan.FromSeconds(0.2), () => { Assert.AreNotEqual(id, Thread.CurrentThread.ManagedThreadId); evt.Set(); });
- evt.WaitOne();
- }
-#endif
-
- [TestMethod]
- public void ScheduleActionCancel()
- {
- var id = Thread.CurrentThread.ManagedThreadId;
- var nt = ThreadPoolScheduler.Instance;
- var set = false;
- var d = nt.Schedule(TimeSpan.FromSeconds(0.2), () => { Assert.Fail(); set = true; });
- d.Dispose();
- Thread.Sleep(400);
- Assert.IsFalse(set);
- }
-
-#if !NO_PERF
-
- [TestMethod]
- public void ScheduleLongRunning_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => ThreadPoolScheduler.Instance.ScheduleLongRunning<int>(42, default(Action<int, ICancelable>)));
- }
-
- [TestMethod]
- public void ScheduleLongRunning()
- {
- var id = Thread.CurrentThread.ManagedThreadId;
- var nt = ThreadPoolScheduler.Instance;
- var evt = new ManualResetEvent(false);
- nt.ScheduleLongRunning(42, (x, cancel) => { Assert.AreNotEqual(id, Thread.CurrentThread.ManagedThreadId); evt.Set(); });
- evt.WaitOne();
- }
-
- [TestMethod]
- public void ScheduleLongRunningCancel()
- {
- var nt = ThreadPoolScheduler.Instance;
-
- var started = new ManualResetEvent(false);
- var stopped = new ManualResetEvent(false);
-
- var n = 0;
-
- var d = nt.ScheduleLongRunning(42, (x, cancel) =>
- {
- for (n = 0; !cancel.IsDisposed; n++)
- {
- if (n == 10)
- started.Set();
- }
-
- stopped.Set();
- });
-
- started.WaitOne();
- d.Dispose();
-
- stopped.WaitOne();
- Assert.IsTrue(n >= 10);
- }
-
-#if !NO_STOPWATCH
-
- [TestMethod]
- public void Stopwatch()
- {
- var nt = ThreadPoolScheduler.Instance;
-
- var sw = nt.StartStopwatch();
-
- var s0 = sw.Elapsed.Ticks;
- Thread.Sleep(10);
- var s1 = sw.Elapsed.Ticks;
-
- Assert.IsTrue(s1 > s0);
- }
-
-#endif
-
- [TestMethod]
- public void Periodic_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => ThreadPoolScheduler.Instance.SchedulePeriodic(0, TimeSpan.FromSeconds(1), null));
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => ThreadPoolScheduler.Instance.SchedulePeriodic(0, TimeSpan.Zero, _ => _));
- ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => ThreadPoolScheduler.Instance.SchedulePeriodic(0, TimeSpan.FromSeconds(-1), _ => _));
- }
-
- [TestMethod]
- public void Periodic_Regular()
- {
- var gate = new object();
- var n = 0;
- var e = new ManualResetEvent(false);
-
- var lst = new List<int>();
-
- var d = ThreadPoolScheduler.Instance.SchedulePeriodic(0, TimeSpan.FromMilliseconds(25), x =>
- {
- lock (gate)
- {
- if (n++ == 10)
- e.Set();
- }
-
- lst.Add(x);
- return x + 1;
- });
-
- e.WaitOne();
- d.Dispose();
-
- var m = default(int);
- var k = default(int);
-
- var i = 0;
- do
- {
- lock (gate)
- m = n;
-
- Thread.Sleep(50);
-
- lock (gate)
- k = n;
- } while (m != k && i++ < 10); // Wait for Dispose to reach the timer; should be almost instantaneous due to nop'ing out of the action.
-
- Assert.AreNotEqual(10, i);
-
- var res = lst.ToArray();
- Assert.IsTrue(res.Length >= 10);
- Assert.IsTrue(res.Take(10).SequenceEqual(Enumerable.Range(0, 10)));
- }
-
- [TestMethod]
- public void Periodic_NonReentrant()
- {
- var n = 0;
- var fail = false;
-
- var d = ThreadPoolScheduler.Instance.SchedulePeriodic(0, TimeSpan.FromMilliseconds(50), x =>
- {
- try
- {
- if (Interlocked.Increment(ref n) > 1) // Without an AsyncLock this would fail.
- fail = true;
-
- Thread.Sleep(100);
-
- return x + 1;
- }
- finally
- {
- Interlocked.Decrement(ref n);
- }
- });
-
- Thread.Sleep(500);
- d.Dispose();
-
- Assert.IsFalse(fail);
- }
-
-#endif
- }
-}
-#endif \ No newline at end of file
diff --git a/Rx.NET/Tests.System.Reactive/Tests/TimeTests.cs b/Rx.NET/Tests.System.Reactive/Tests/TimeTests.cs
deleted file mode 100644
index e08f7f2..0000000
--- a/Rx.NET/Tests.System.Reactive/Tests/TimeTests.cs
+++ /dev/null
@@ -1,160 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System;
-using System.Reactive;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-
-namespace ReactiveTests.Tests
-{
- [TestClass]
- public class TimeTests
- {
- [TestMethod]
- public void TimeInterval_Ctor_Properties()
- {
- var ti = new TimeInterval<int>(42, TimeSpan.FromSeconds(123.45));
- Assert.AreEqual(42, ti.Value);
- Assert.AreEqual(TimeSpan.FromSeconds(123.45), ti.Interval);
- }
-
- [TestMethod]
- public void TimeInterval_Equals()
- {
- var ti = new TimeInterval<int>(42, TimeSpan.FromSeconds(123.45));
- Assert.IsFalse(ti.Equals("x"));
- Assert.IsFalse(((object)ti).Equals("x"));
- Assert.IsTrue(ti.Equals(ti));
- Assert.IsTrue(((object)ti).Equals(ti));
-
- var t2 = new TimeInterval<int>(43, TimeSpan.FromSeconds(123.45));
- Assert.IsFalse(ti.Equals(t2));
- Assert.IsFalse(((object)ti).Equals(t2));
-
- var t3 = new TimeInterval<int>(42, TimeSpan.FromSeconds(123.56));
- Assert.IsFalse(ti.Equals(t3));
- Assert.IsFalse(((object)ti).Equals(t3));
-
- var t4 = new TimeInterval<int>(42, TimeSpan.FromSeconds(123.45));
- Assert.IsTrue(ti.Equals(t4));
- Assert.IsTrue(((object)ti).Equals(t4));
- }
-
- [TestMethod]
- public void TimeInterval_GetHashCode()
- {
- var ti = new TimeInterval<string>(null, TimeSpan.FromSeconds(123.45));
- Assert.IsTrue(ti.GetHashCode() != 0);
- Assert.AreEqual(ti.GetHashCode(), ti.GetHashCode());
-
- var t2 = new TimeInterval<string>("", TimeSpan.FromSeconds(123.45));
- Assert.AreNotEqual(ti.GetHashCode(), t2.GetHashCode());
- }
-
- [TestMethod]
- public void TimeInterval_EqualsOperators()
- {
- var ti = new TimeInterval<int>(42, TimeSpan.FromSeconds(123.45));
- var t2 = new TimeInterval<int>(43, TimeSpan.FromSeconds(123.45));
- Assert.IsFalse(ti == t2);
- Assert.IsFalse(t2 == ti);
- Assert.IsTrue(ti != t2);
- Assert.IsTrue(t2 != ti);
-
- var t3 = new TimeInterval<int>(42, TimeSpan.FromSeconds(123.56));
- Assert.IsFalse(ti == t3);
- Assert.IsFalse(t3 == ti);
- Assert.IsTrue(ti != t3);
- Assert.IsTrue(t3 != ti);
-
- var t4 = new TimeInterval<int>(42, TimeSpan.FromSeconds(123.45));
- Assert.IsTrue(ti == t4);
- Assert.IsTrue(t4 == ti);
- Assert.IsFalse(ti != t4);
- Assert.IsFalse(t4 != ti);
- }
-
- [TestMethod]
- public void TimeInterval_ToString()
- {
- var ti = new TimeInterval<int>(42, TimeSpan.FromSeconds(123.45));
- Assert.IsTrue(ti.ToString().Contains(42.ToString()));
- Assert.IsTrue(ti.ToString().Contains(TimeSpan.FromSeconds(123.45).ToString()));
- }
-
- [TestMethod]
- public void TimeStamped_Ctor_Properties()
- {
- var o = new DateTimeOffset();
- var ti = new Timestamped<int>(42, o);
- Assert.AreEqual(42, ti.Value);
- Assert.AreEqual(o, ti.Timestamp);
- }
-
- [TestMethod]
- public void TimeStamped_Equals()
- {
- var ti = new Timestamped<int>(42, new DateTimeOffset());
- Assert.IsFalse(ti.Equals("x"));
- Assert.IsFalse(((object)ti).Equals("x"));
- Assert.IsTrue(ti.Equals(ti));
- Assert.IsTrue(((object)ti).Equals(ti));
-
- var t2 = new Timestamped<int>(43, new DateTimeOffset());
- Assert.IsFalse(ti.Equals(t2));
- Assert.IsFalse(((object)ti).Equals(t2));
-
- var t3 = new Timestamped<int>(42, new DateTimeOffset().AddDays(1));
- Assert.IsFalse(ti.Equals(t3));
- Assert.IsFalse(((object)ti).Equals(t3));
-
- var t4 = new Timestamped<int>(42, new DateTimeOffset());
- Assert.IsTrue(ti.Equals(t4));
- Assert.IsTrue(((object)ti).Equals(t4));
- }
-
- [TestMethod]
- public void TimeStamped_GetHashCode()
- {
- var ti = new Timestamped<string>(null, new DateTimeOffset());
- Assert.IsTrue(ti.GetHashCode() != 0);
- Assert.AreEqual(ti.GetHashCode(), ti.GetHashCode());
-
- var t2 = new Timestamped<string>("", new DateTimeOffset());
- Assert.AreNotEqual(ti.GetHashCode(), t2.GetHashCode());
- }
-
- [TestMethod]
- public void TimeStamped_EqualsOperators()
- {
- var o = new DateTimeOffset();
-
- var ti = new Timestamped<int>(42, o);
- var t2 = new Timestamped<int>(43, o);
- Assert.IsFalse(ti == t2);
- Assert.IsFalse(t2 == ti);
- Assert.IsTrue(ti != t2);
- Assert.IsTrue(t2 != ti);
-
- var t3 = new Timestamped<int>(42, o.AddDays(1));
- Assert.IsFalse(ti == t3);
- Assert.IsFalse(t3 == ti);
- Assert.IsTrue(ti != t3);
- Assert.IsTrue(t3 != ti);
-
- var t4 = new Timestamped<int>(42, o);
- Assert.IsTrue(ti == t4);
- Assert.IsTrue(t4 == ti);
- Assert.IsFalse(ti != t4);
- Assert.IsFalse(t4 != ti);
- }
-
- [TestMethod]
- public void TimeStamped_ToString()
- {
- var o = new DateTimeOffset();
- var ti = new Timestamped<int>(42, o);
- Assert.IsTrue(ti.ToString().Contains(42.ToString()));
- Assert.IsTrue(ti.ToString().Contains(o.ToString()));
- }
- }
-}
diff --git a/Rx.NET/Tests.System.Reactive/Tests/UnitTest.cs b/Rx.NET/Tests.System.Reactive/Tests/UnitTest.cs
deleted file mode 100644
index d5ea8a1..0000000
--- a/Rx.NET/Tests.System.Reactive/Tests/UnitTest.cs
+++ /dev/null
@@ -1,25 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System.Reactive;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-
-namespace ReactiveTests.Tests
-{
- [TestClass]
- public class UnitTest
- {
- [TestMethod]
- public void Unit()
- {
- var u1 = new Unit();
- var u2 = new Unit();
- Assert.IsTrue(u1.Equals(u2));
- Assert.IsFalse(u1.Equals(""));
- Assert.IsFalse(u1.Equals(null));
- Assert.IsTrue(u1 == u2);
- Assert.IsFalse(u1 != u2);
- Assert.AreEqual(0, u1.GetHashCode());
- Assert.AreEqual("()", u1.ToString());
- }
- }
-}
diff --git a/Rx.NET/Tests.System.Reactive/Tests/VirtualSchedulerTest.cs b/Rx.NET/Tests.System.Reactive/Tests/VirtualSchedulerTest.cs
deleted file mode 100644
index ecb6267..0000000
--- a/Rx.NET/Tests.System.Reactive/Tests/VirtualSchedulerTest.cs
+++ /dev/null
@@ -1,127 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Reactive.Concurrency;
-using System.Threading;
-using Microsoft.Reactive.Testing;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-
-namespace ReactiveTests.Tests
-{
- [TestClass]
- public class VirtualSchedulerTest
- {
- class VirtualSchedulerTestScheduler : VirtualTimeScheduler<string, char>
- {
- public VirtualSchedulerTestScheduler()
- {
- }
-
- public VirtualSchedulerTestScheduler(string initialClock, IComparer<string> comparer)
- : base(initialClock, comparer)
- {
- }
-
- protected override string Add(string absolute, char relative)
- {
- return (absolute ?? string.Empty) + relative;
- }
-
- protected override DateTimeOffset ToDateTimeOffset(string absolute)
- {
- return new DateTimeOffset((absolute ?? string.Empty).Length, TimeSpan.Zero);
- }
-
- protected override char ToRelative(TimeSpan timeSpan)
- {
- return (char)(timeSpan.Ticks % char.MaxValue);
- }
- }
-
- [TestMethod]
- public void Virtual_Now()
- {
- var res = new VirtualSchedulerTestScheduler().Now - DateTime.Now;
- Assert.IsTrue(res.Seconds < 1);
- }
-
- [TestMethod]
- public void Virtual_ScheduleAction()
- {
- var id = Thread.CurrentThread.ManagedThreadId;
- var ran = false;
- var scheduler = new VirtualSchedulerTestScheduler();
- scheduler.Schedule(() => { Assert.AreEqual(id, Thread.CurrentThread.ManagedThreadId); ran = true; });
- scheduler.Start();
- Assert.IsTrue(ran);
- }
-
- [TestMethod]
- public void Virtual_ScheduleActionError()
- {
- var ex = new Exception();
-
- try
- {
- var scheduler = new VirtualSchedulerTestScheduler();
- scheduler.Schedule(() => { throw ex; });
- scheduler.Start();
- Assert.Fail();
- }
- catch (Exception e)
- {
- Assert.AreSame(e, ex);
- }
- }
-
- [TestMethod]
- public void Virtual_InitialAndComparer_Now()
- {
- var s = new VirtualSchedulerTestScheduler("Bar", Comparer<string>.Default);
- Assert.AreEqual(3, s.Now.Ticks);
- }
-
- [TestMethod]
- public void Virtual_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => new VirtualSchedulerTestScheduler("", null));
- ReactiveAssert.Throws<ArgumentNullException>(() => new VirtualSchedulerTestScheduler().ScheduleRelative(0, 'a', null));
- ReactiveAssert.Throws<ArgumentNullException>(() => new VirtualSchedulerTestScheduler().ScheduleAbsolute(0, "", null));
- ReactiveAssert.Throws<ArgumentNullException>(() => new VirtualSchedulerTestScheduler().Schedule(0, default(Func<IScheduler, int, IDisposable>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => new VirtualSchedulerTestScheduler().Schedule(0, TimeSpan.Zero, default(Func<IScheduler, int, IDisposable>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => new VirtualSchedulerTestScheduler().Schedule(0, DateTimeOffset.UtcNow, default(Func<IScheduler, int, IDisposable>)));
-
- ReactiveAssert.Throws<ArgumentNullException>(() => VirtualTimeSchedulerExtensions.ScheduleAbsolute(default(VirtualSchedulerTestScheduler), "", () => {}));
- ReactiveAssert.Throws<ArgumentNullException>(() => VirtualTimeSchedulerExtensions.ScheduleAbsolute(new VirtualSchedulerTestScheduler(), "", default(Action)));
- ReactiveAssert.Throws<ArgumentNullException>(() => VirtualTimeSchedulerExtensions.ScheduleRelative(default(VirtualSchedulerTestScheduler), 'a', () => { }));
- ReactiveAssert.Throws<ArgumentNullException>(() => VirtualTimeSchedulerExtensions.ScheduleRelative(new VirtualSchedulerTestScheduler(), 'a', default(Action)));
- }
-
- [TestMethod]
- public void Historical_ArgumentChecking()
- {
- ReactiveAssert.Throws<ArgumentNullException>(() => new HistoricalScheduler(DateTime.Now, default(IComparer<DateTimeOffset>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => new HistoricalScheduler().ScheduleAbsolute(42, DateTime.Now, default(Func<IScheduler, int, IDisposable>)));
- ReactiveAssert.Throws<ArgumentNullException>(() => new HistoricalScheduler().ScheduleRelative(42, TimeSpan.FromSeconds(1), default(Func<IScheduler, int, IDisposable>)));
- }
-
-#if !SILVERLIGHT
- [TestMethod]
- [Ignore]
- public void Virtual_ScheduleActionDue()
- {
- var id = Thread.CurrentThread.ManagedThreadId;
- var ran = false;
- var sw = new Stopwatch();
- sw.Start();
- var scheduler = new VirtualSchedulerTestScheduler();
- scheduler.Schedule(TimeSpan.FromSeconds(0.2), () => { sw.Stop(); Assert.AreEqual(id, Thread.CurrentThread.ManagedThreadId); ran = true; });
- scheduler.Start();
- Assert.IsTrue(ran, "ran");
- Assert.IsTrue(sw.ElapsedMilliseconds > 180, "due " + sw.ElapsedMilliseconds);
- }
-#endif
- }
-}
diff --git a/Rx.NET/Tests.System.Reactive/Utils.cs b/Rx.NET/Tests.System.Reactive/Utils.cs
deleted file mode 100644
index 6c8fe3f..0000000
--- a/Rx.NET/Tests.System.Reactive/Utils.cs
+++ /dev/null
@@ -1,22 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System.Linq;
-using System.Reactive.Subjects;
-using System.Runtime.Versioning;
-
-namespace ReactiveTests
-{
- static class Utils
- {
- public static bool IsRunningWithPortableLibraryBinaries()
- {
-#if DESKTOPCLR20
- return false;
-#else
-
- var a = typeof(ISubject<int>).Assembly.GetCustomAttributes(typeof(TargetFrameworkAttribute), false).Cast<TargetFrameworkAttribute>().SingleOrDefault();
- return a != null && a.FrameworkDisplayName == ".NET Portable Subset";
-#endif
- }
- }
-}
diff --git a/Rx.NET/Tests.System.Reactive/replacer.sh b/Rx.NET/Tests.System.Reactive/replacer.sh
deleted file mode 100644
index bcc15c1..0000000
--- a/Rx.NET/Tests.System.Reactive/replacer.sh
+++ /dev/null
@@ -1,24 +0,0 @@
-using System.IO;
-using System.Text;
-
-foreach (var file in Directory.GetFiles (".", "*.cs", SearchOption.AllDirectories)) {
- var text = File.ReadAllText (file);
- if (text.Contains ("#if NUNIT"))
- continue;
- Console.Error.WriteLine (file + " : " + text.Contains ("using Microsoft.VisualStudio.TestTools.UnitTesting;"));
- text = text.Replace (
-"using Microsoft.VisualStudio.TestTools.UnitTesting;",
-@"#if NUNIT
-using NUnit.Framework;
-using TestClassAttribute = NUnit.Framework.TestFixtureAttribute;
-using TestMethodAttribute = NUnit.Framework.TestAttribute;
-using TestInitializeAttribute = NUnit.Framework.SetUpAttribute;
-#else
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-#endif".Replace ("\n", "\r\n"));
-
- text = text.Replace ("[Timeout", "//[Timeout"); // no TimeoutAttribute in NUnit.
-
- using (var tw = new StreamWriter (file, false, new UTF8Encoding (true, true)))
- tw.Write (text);
-}
diff --git a/Rx.NET/TraceAndTestImpact.testsettings b/Rx.NET/TraceAndTestImpact.testsettings
deleted file mode 100644
index 866e920..0000000
--- a/Rx.NET/TraceAndTestImpact.testsettings
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<TestSettings name="Trace and Test Impact" id="7c4a9a1b-6b11-4bd8-8a68-92d1f4b8e07b" xmlns="http://microsoft.com/schemas/VisualStudio/TeamTest/2010">
- <Description>These are test settings for Trace and Test Impact.</Description>
- <Execution>
- <TestTypeSpecific />
- <AgentRule name="Execution Agents">
- <DataCollectors>
- <DataCollector uri="datacollector://microsoft/SystemInfo/1.0" assemblyQualifiedName="Microsoft.VisualStudio.TestTools.DataCollection.SystemInfo.SystemInfoDataCollector, Microsoft.VisualStudio.TestTools.DataCollection.SystemInfo, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" friendlyName="System Information">
- </DataCollector>
- <DataCollector uri="datacollector://microsoft/ActionLog/1.0" assemblyQualifiedName="Microsoft.VisualStudio.TestTools.ManualTest.ActionLog.ActionLogPlugin, Microsoft.VisualStudio.TestTools.ManualTest.ActionLog, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" friendlyName="Actions">
- </DataCollector>
- <DataCollector uri="datacollector://microsoft/HttpProxy/1.0" assemblyQualifiedName="Microsoft.VisualStudio.TraceCollector.HttpProxyCollector, Microsoft.VisualStudio.TraceCollector, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" friendlyName="ASP.NET Client Proxy for IntelliTrace and Test Impact">
- </DataCollector>
- <DataCollector uri="datacollector://microsoft/TestImpact/1.0" assemblyQualifiedName="Microsoft.VisualStudio.TraceCollector.TestImpactDataCollector, Microsoft.VisualStudio.TraceCollector, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" friendlyName="Test Impact">
- </DataCollector>
- <DataCollector uri="datacollector://microsoft/TraceDebugger/1.0" assemblyQualifiedName="Microsoft.VisualStudio.TraceCollector.TraceDebuggerDataCollector, Microsoft.VisualStudio.TraceCollector, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" friendlyName="IntelliTrace">
- </DataCollector>
- </DataCollectors>
- </AgentRule>
- </Execution>
-</TestSettings> \ No newline at end of file
diff --git a/Rx.NET/license.txt b/Rx.NET/license.txt
deleted file mode 100644
index 5b47fbd..0000000
--- a/Rx.NET/license.txt
+++ /dev/null
@@ -1,15 +0,0 @@
-Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
-Microsoft Open Technologies would like to thank its contributors, a list
-of whom are at http://rx.codeplex.com/wikipage?title=Contributors.
-
-Licensed under the Apache License, Version 2.0 (the "License"); you
-may not use this file except in compliance with the License. You may
-obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-implied. See the License for the specific language governing permissions
-and limitations under the License. \ No newline at end of file
diff --git a/Rx.NET/mono.patch b/Rx.NET/mono.patch
deleted file mode 100644
index 4b45349..0000000
--- a/Rx.NET/mono.patch
+++ /dev/null
@@ -1,15 +0,0 @@
-diff --git a/Rx.NET/Microsoft.Reactive.Testing/ReactiveAssert.cs b/Rx.NET/Microsoft.Reactive.Testing/ReactiveAssert.cs
-index e9715a4..86cd62e 100644
---- a/Rx.NET/Microsoft.Reactive.Testing/ReactiveAssert.cs
-+++ b/Rx.NET/Microsoft.Reactive.Testing/ReactiveAssert.cs
-@@ -8,7 +8,9 @@
- using System.Reactive.Disposables;
- using System.Reactive.Linq;
-
--#if WINDOWS8
-+#if NUNIT
-+using NUnit.Framework;
-+#elif WINDOWS8
- using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
- #else
- using Microsoft.VisualStudio.TestTools.UnitTesting;