public void A_Feature_whose_instance_is_an_IFeature_is_unavailable_until_the_IFeature_is_available() { var inner = new Feature<string>(); var outer = new Feature<Feature<string>>(inner); bool available = false; outer.Availability.Subscribe(a => available = a); Assert.That(available, Is.False); inner.OnNext("hello"); Assert.That(available, Is.True); }
public void A_feature_can_be_subscribed_before_it_is_registered_and_when_it_is_later_initialized_subscribers_will_be_notified() { string result = null; var feature = new Feature<string>(); feature.Subscribe(s => result = s); Assert.That(result, Is.Null); feature.OnNext("hello"); Assert.That(result, Is.EqualTo("hello")); }
public void A_Feature_whose_instance_is_an_IFeature_produces_a_value_when_the_IFeature_is_available() { var inner = new Feature<string>(); var outer = new Feature<Feature<string>>(inner); Feature<string> result = null; outer.Subscribe(v => result = v); inner.OnNext("hello"); Assert.That(outer.Availability.First(), Is.EqualTo(true)); Assert.That(outer.First().First(), Is.EqualTo("hello")); }