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); }
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); }
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); var targetError = default(Exception); var error = new Exception(); target.Subscribe(_ => { }, e => targetError = e); activator.OnError(error); Assert.Same(error, source.Error); Assert.Same(error, targetError); }
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(AvaloniaProperty.UnsetValue, source.Value); activator.OnNext(true); target.OnNext("baz"); Assert.Equal("baz", source.Value); activator.OnNext(false); Assert.Equal(AvaloniaProperty.UnsetValue, source.Value); target.OnNext("bax"); activator.OnNext(true); Assert.Equal("bax", source.Value); }