コード例 #1
0
        public void WhenCreatingPatternForBaseArgsType_ThenSucceeds()
        {
            var pattern = EventPattern.Create <EventArgs>(this, new FooArgs());

            Assert.NotNull(pattern);
            Assert.True(pattern.EventArgs is FooArgs);
        }
コード例 #2
0
 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));
 }
コード例 #3
0
ファイル: EventStreamSpec.cs プロジェクト: nobitagamer/netfx
        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);
        }
コード例 #4
0
ファイル: EventStreamSpec.cs プロジェクト: nobitagamer/netfx
        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);
        }
コード例 #5
0
        protected override EventPattern <TTarget> Convert(EventPattern <TSource> value)
        {
            Contract.Assume(value != null);

            return(new EventPattern <TTarget>(value.Sender, (TTarget)(object)value.EventArgs));
        }
コード例 #6
0
        public void WhenCreatingPatternForSameArgsType_ThenSucceeds()
        {
            var pattern = EventPattern.Create <EventArgs>(this, EventArgs.Empty);

            Assert.NotNull(pattern);
        }
コード例 #7
0
 public void WhenCreatingPatternForNullEventArgs_ThenThrows()
 {
     Assert.Throws <ArgumentNullException>(() => EventPattern.Create <EventArgs>(this, null));
 }
コード例 #8
0
 public void WhenCreatingPatternForNullSender_ThenThrows()
 {
     Assert.Throws <ArgumentNullException>(() => EventPattern.Create(null, EventArgs.Empty));
 }
コード例 #9
0
 protected override void OnNextCore(EventPattern <TSender, TEventArgs> value)
 {
     _sourceBase._invokeHandler(_invoke, value);
 }
コード例 #10
0
 public bool Equals(EventPattern <TSender, TEventArgs> other)