Exemplo n.º 1
0
        public void ToNotifier_Forwards()
        {
            var obsn = new MyObserver();

            obsn.ToNotifier()(new Notification <int> .OnNext(42));
            Assert.AreEqual(obsn.HasOnNext, 42);

            var ex   = new Exception();
            var obse = new MyObserver();

            obse.ToNotifier()(new Notification <int> .OnError(ex));
            Assert.AreSame(ex, obse.HasOnError);

            var obsc = new MyObserver();

            obsc.ToNotifier()(new Notification <int> .OnCompleted());
            Assert.IsTrue(obsc.HasOnCompleted);
        }
Exemplo n.º 2
0
        public void ToNotifier_Forwards()
        {
            var obsn = new MyObserver();

            obsn.ToNotifier()(Notification.CreateOnNext <int>(42));
            Assert.Equal(obsn.HasOnNext, 42);

            var ex   = new Exception();
            var obse = new MyObserver();

            obse.ToNotifier()(Notification.CreateOnError <int>(ex));
            Assert.Same(ex, obse.HasOnError);

            var obsc = new MyObserver();

            obsc.ToNotifier()(Notification.CreateOnCompleted <int>());
            Assert.True(obsc.HasOnCompleted);
        }