public void Activator_Or_Should_Follow_Single_Input() { var inputs = new[] { new TestSubject <bool>(false) }; var target = StyleActivator.Or(inputs); var result = new TestObserver <bool>(); target.Subscribe(result); Assert.False(result.GetValue()); inputs[0].OnNext(true); Assert.True(result.GetValue()); inputs[0].OnNext(false); Assert.False(result.GetValue()); inputs[0].OnNext(true); Assert.True(result.GetValue()); Assert.Equal(1, inputs[0].SubscriberCount); }
public void Activator_Or_Should_Not_Unsubscribe_All_When_Input_Completes_On_False() { var inputs = new[] { new TestSubject <bool>(false), new TestSubject <bool>(false), new TestSubject <bool>(true), }; var target = StyleActivator.Or(inputs); var result = new TestObserver <bool>(); target.Subscribe(result); Assert.True(result.GetValue()); inputs[2].OnNext(false); Assert.False(result.GetValue()); inputs[2].OnCompleted(); Assert.Equal(1, inputs[0].SubscriberCount); Assert.Equal(1, inputs[1].SubscriberCount); Assert.Equal(0, inputs[2].SubscriberCount); }
public void Activator_And_Should_AND_Multiple_Inputs() { var inputs = new[] { new TestSubject <bool>(false), new TestSubject <bool>(false), new TestSubject <bool>(true), }; var target = StyleActivator.And(inputs); var result = new TestObserver <bool>(); target.Subscribe(result); Assert.False(result.GetValue()); inputs[0].OnNext(true); inputs[1].OnNext(true); Assert.True(result.GetValue()); inputs[0].OnNext(false); Assert.False(result.GetValue()); Assert.Equal(1, inputs[0].SubscriberCount); Assert.Equal(1, inputs[1].SubscriberCount); Assert.Equal(1, inputs[2].SubscriberCount); }