public void WhenCreatingPatternForBaseArgsType_ThenSucceeds() { var pattern = EventPattern.Create <EventArgs>(this, new FooArgs()); Assert.NotNull(pattern); Assert.True(pattern.EventArgs is FooArgs); }
public bool Equals(EventPattern <TEventArgs> other) { if ((object)other == null) { return(false); } return(((object)sender == null ? (object)other.sender == null : sender.Equals(other.sender)) && e.Equals(other.e)); }
public void WhenPushingEventPattern_ThenCanSubscribeToEventArgsOnlyToo() { var stream = new EventStream(); var called = false; using (var subscription = stream.Of <BaseEvent>().Subscribe(c => called = true)) { stream.Push(EventPattern.Create(this, new PatientEnteredHospital())); } Assert.True(called); }
public void WhenSubscribingAsGenericInterfaceConcreteArgs_ThenCallsSubscriber() { var stream = new EventStream(); var called = false; using (var subscription = stream.Of <IEventPattern <PatientEnteredHospital> >().Subscribe(c => called = true)) { stream.Push(EventPattern.Create(this, new PatientEnteredHospital())); } Assert.True(called); }
protected override EventPattern <TTarget> Convert(EventPattern <TSource> value) { Contract.Assume(value != null); return(new EventPattern <TTarget>(value.Sender, (TTarget)(object)value.EventArgs)); }
public void WhenCreatingPatternForSameArgsType_ThenSucceeds() { var pattern = EventPattern.Create <EventArgs>(this, EventArgs.Empty); Assert.NotNull(pattern); }
public void WhenCreatingPatternForNullEventArgs_ThenThrows() { Assert.Throws <ArgumentNullException>(() => EventPattern.Create <EventArgs>(this, null)); }
public void WhenCreatingPatternForNullSender_ThenThrows() { Assert.Throws <ArgumentNullException>(() => EventPattern.Create(null, EventArgs.Empty)); }
protected override void OnNextCore(EventPattern <TSender, TEventArgs> value) { _sourceBase._invokeHandler(_invoke, value); }
public bool Equals(EventPattern <TSender, TEventArgs> other)