Exemplo n.º 1
0
        public void Crash_OnSubscribe()
        {
            var cs = new MaybeSubject <int>();

            cs.SubscribeSafe(new FailingMaybeObserver(true, true, true, true));

            Assert.False(cs.HasObserver());
        }
Exemplo n.º 2
0
        public void Crash_OnError()
        {
            var cs = new MaybeSubject <int>();

            cs.SubscribeSafe(new FailingMaybeObserver(false, true, true, true));

            Assert.True(cs.HasObserver());

            cs.OnError(new InvalidOperationException("main"));
        }
Exemplo n.º 3
0
        public void Crash_OnCompleted()
        {
            var cs = new MaybeSubject <int>();

            cs.SubscribeSafe(new FailingMaybeObserver(false, true, true, true));

            Assert.True(cs.HasObserver());

            cs.OnCompleted();
        }
Exemplo n.º 4
0
        public void Normal_Dispose()
        {
            var cs = new MaybeSubject <int>();
            var to = new TestObserver <int>();

            cs.SubscribeSafe(to);

            Assert.True(cs.HasObserver());

            to.Dispose();

            Assert.False(cs.HasObserver());
        }