Ejemplo n.º 1
0
        public void Should_Invoke_OnCompleted_On_Activator_Completed()
        {
            var activator = new BehaviorSubject <bool>(false);
            var source    = new TestSubject();
            var target    = new ActivatedSubject(activator, source, string.Empty);

            activator.OnCompleted();

            Assert.True(source.Completed);
        }
Ejemplo n.º 2
0
        public void Should_Invoke_OnError_On_Activator_Error()
        {
            var activator = new BehaviorSubject <bool>(false);
            var source    = new TestSubject();
            var target    = new ActivatedSubject(activator, source, string.Empty);

            activator.OnError(new Exception());

            Assert.NotNull(source.Error);
        }
Ejemplo n.º 3
0
        public void Should_Set_Values()
        {
            var activator = new BehaviorSubject <bool>(false);
            var source    = new TestSubject();
            var target    = new ActivatedSubject(activator, source, string.Empty);

            target.OnNext("bar");
            Assert.Equal(PerspexProperty.UnsetValue, source.Value);
            activator.OnNext(true);
            target.OnNext("baz");
            Assert.Equal("baz", source.Value);
            activator.OnNext(false);
            Assert.Equal(PerspexProperty.UnsetValue, source.Value);
            target.OnNext("bax");
            activator.OnNext(true);
            Assert.Equal("bax", source.Value);
        }