示例#1
0
        public void FirstPredicate_Return_NoMatch()
        {
            var value = 42;

            ReactiveAssert.Throws <InvalidOperationException>(() => Observable.Return(value).First(i => i % 2 != 0));
        }
示例#2
0
 public void Repeat_Value_ArgumentChecking()
 {
     ReactiveAssert.Throws <ArgumentNullException>(() => Observable.Repeat(1, null));
     ReactiveAssert.Throws <ArgumentNullException>(() => Observable.Repeat(DummyScheduler.Instance, 1).Subscribe(null));
 }
示例#3
0
 public void Repeat_Value_Count_ArgumentChecking()
 {
     ReactiveAssert.Throws <ArgumentNullException>(() => Observable.Repeat(1, 0, default));
     ReactiveAssert.Throws <ArgumentOutOfRangeException>(() => Observable.Repeat(1, -1, DummyScheduler.Instance));
     ReactiveAssert.Throws <ArgumentNullException>(() => Observable.Repeat(1, 1, DummyScheduler.Instance).Subscribe(null));
 }
示例#4
0
 public void Wait_Empty()
 {
     ReactiveAssert.Throws <InvalidOperationException>(() => Observable.Empty <int>().Wait());
 }
示例#5
0
 public void ElementAtOrDefault_ArgumentChecking()
 {
     ReactiveAssert.Throws <ArgumentNullException>(() => Observable.ElementAtOrDefault(default(IObservable <int>), 2));
     ReactiveAssert.Throws <ArgumentOutOfRangeException>(() => Observable.ElementAtOrDefault(DummyObservable <int> .Instance, -1));
 }
示例#6
0
 public void OnError_ArgumentChecking()
 {
     ReactiveAssert.Throws <ArgumentNullException>(() => new Subject <int>().OnError(null));
 }
示例#7
0
        public void AnonymousObserver_Error_Null()
        {
            var observer = new AnonymousObserver <int>(_ => { }, e => { }, () => { });

            ReactiveAssert.Throws <ArgumentNullException>(() => observer.OnError(null));
        }
示例#8
0
 public void CompositeDisposable_RemoveNull()
 {
     ReactiveAssert.Throws <ArgumentNullException>(() => new CompositeDisposable().Remove(null));
 }
示例#9
0
 public void ContextDisposable_CreateNullContext()
 {
     ReactiveAssert.Throws <ArgumentNullException>(() => new ContextDisposable(null, Disposable.Empty));
 }
示例#10
0
        public void CompositeDisposable_AddNull_via_params_ctor()
        {
            IDisposable d1 = null;

            ReactiveAssert.Throws <ArgumentException>(() => new CompositeDisposable(d1));
        }
示例#11
0
        public void CompositeDisposable_AddNull_via_IEnum_ctor()
        {
            IEnumerable <IDisposable> values = new IDisposable[] { null };

            ReactiveAssert.Throws <ArgumentException>(() => new CompositeDisposable(values));
        }
示例#12
0
 public void CompositeDisposable_CopyTo_BeyondEnd()
 {
     ReactiveAssert.Throws <ArgumentOutOfRangeException>(() => new CompositeDisposable().CopyTo(new IDisposable[2], 2));
 }
示例#13
0
 public void CompositeDisposable_CopyTo_Null()
 {
     ReactiveAssert.Throws <ArgumentNullException>(() => new CompositeDisposable().CopyTo(null, 0));
 }
示例#14
0
 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));
 }
示例#15
0
 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)));
 }
示例#16
0
 public void ContextDisposable_CreateNullDisposable()
 {
     ReactiveAssert.Throws <ArgumentNullException>(() => new ContextDisposable(new SynchronizationContext(), null));
 }
示例#17
0
 public void Subscribe_ArgumentChecking()
 {
     ReactiveAssert.Throws <ArgumentNullException>(() => new Subject <int>().Subscribe(null));
 }
示例#18
0
 public void RefCountDisposable_Ctor_Null()
 {
     ReactiveAssert.Throws <ArgumentNullException>(() => new RefCountDisposable(null));
 }
示例#19
0
 public void AnonymousObservable_ArgumentChecking()
 {
     ReactiveAssert.Throws <ArgumentNullException>(() => new AnonymousObservable <int>(null));
 }
示例#20
0
 public void ScheduledDisposable_Null()
 {
     ReactiveAssert.Throws <ArgumentNullException>(() => new ScheduledDisposable(null, Disposable.Empty));
     ReactiveAssert.Throws <ArgumentNullException>(() => new ScheduledDisposable(Scheduler.Immediate, null));
 }
示例#21
0
 public void Wait_ArgumentChecking()
 {
     ReactiveAssert.Throws <ArgumentNullException>(() => Observable.Wait(default(IObservable <int>)));
 }
 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>)));
 }
示例#23
0
 public void Switch_ArgumentChecking()
 {
     ReactiveAssert.Throws <ArgumentNullException>(() => Observable.Switch((IObservable <IObservable <int> >)null));
     ReactiveAssert.Throws <ArgumentNullException>(() => Observable.Switch((IObservable <Task <int> >)null));
 }
示例#24
0
 public void RetryWhen_Observable_ArgumentChecking()
 {
     ReactiveAssert.Throws <ArgumentNullException>(() => Observable.RetryWhen <int, Exception>(null, v => v));
     ReactiveAssert.Throws <ArgumentNullException>(() => Observable.RetryWhen <int, Exception>(Observable.Return(1), null));
     ReactiveAssert.Throws <ArgumentNullException>(() => DummyObservable <int> .Instance.RetryWhen(v => v).Subscribe(null));
 }
示例#25
0
 public void DoWhile_ArgumentChecking()
 {
     ReactiveAssert.Throws <ArgumentNullException>(() => Observable.DoWhile(DummyObservable <int> .Instance, null));
     ReactiveAssert.Throws <ArgumentNullException>(() => Observable.DoWhile(default(IObservable <int>), DummyFunc <bool> .Instance));
 }
示例#26
0
 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>)));
 }
示例#27
0
 public void Repeat_Value_Default_ArgumentChecking()
 {
     ReactiveAssert.Throws <ArgumentNullException>(() => Observable.Repeat(1).Subscribe(null));
 }
 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));
 }
示例#29
0
 public void Repeat_Observable_Default_ArgumentChecking()
 {
     ReactiveAssert.Throws <ArgumentNullException>(() => Observable.Repeat <int>(null));
     ReactiveAssert.Throws <ArgumentNullException>(() => DummyObservable <int> .Instance.Repeat().Subscribe(null));
 }
示例#30
0
 public void FirstPredicate_Empty()
 {
     ReactiveAssert.Throws <InvalidOperationException>(() => Observable.Empty <int>().First(_ => true));
 }