public void FiresOnEventBroker() { IEventFired message = GetMessage(); this.testee.TestDoHandle(message); A.CallTo(() => this.eventBroker.Fire("topic://Appccelerate.DistributedEventBroker/DISTRIBUTED", this.testee, HandlerRestriction.Asynchronous, this.testee, A <EventArgs <IEventFired> > .Ignored)).MustHaveHappened(); }
/// <summary> /// Message handler which can be called by extensions or internal event brokers. /// </summary> /// <param name="sender">The sender.</param> /// <param name="eventFired">The event fired.</param> protected virtual void HandleMessage(object sender, IEventFired eventFired) { Ensure.ArgumentNotNull(eventFired, "eventFired"); if (this.HostedEventBrokerIdentification.Equals(eventFired.EventBrokerIdentification)) { return; } var eventArgsType = Type.GetType(eventFired.EventArgsType, true); var eventArgs = this.Serializer.Deserialize(eventArgsType, eventFired.EventArgs); this.HostedEventBroker.Fire(eventFired.Topic, this, eventFired.HandlerRestriction, this, eventArgs); }
/// <summary> /// Publishes the specified event fired message on the bus. /// </summary> /// <param name="message">The message.</param> public void Publish(IEventFired message) { var eventFired = message as INServiceBusEventFired; if (eventFired == null) { throw new ArgumentException( string.Format( CultureInfo.InvariantCulture, "Type must be convertible to {0}!", typeof(INServiceBusEventFired).Name), "message"); } this.serviceBus.Publish(eventFired); }
public void PassesMessageToEventArgs() { EventArgs <IEventFired> collectedArgs = null; IEventFired message = GetMessage(); A.CallTo( () => this.eventBroker.Fire( A <string> .Ignored, A <object> .Ignored, A <HandlerRestriction> .Ignored, A <object> .Ignored, A <EventArgs> .Ignored)).Invokes(fake => collectedArgs = fake.Arguments.Get <EventArgs <IEventFired> >(4)); this.testee.TestDoHandle(message); collectedArgs.Should().NotBeNull(); collectedArgs.Value.Should().BeSameAs(message); }
public void TestDoHandle(IEventFired message) { this.DoHandle(message); }
/// <summary> /// Creates the dynamic topic according to the message. /// </summary> /// <param name="message">The message.</param> /// <returns>The topic uri.</returns> protected virtual string CreateTopic(IEventFired message) { Ensure.ArgumentNotNull(message, "message"); return string.Format(CultureInfo.InvariantCulture, Constants.InternalTopicFormat, message.DistributedEventBrokerIdentification); }
public void Handle(IEventFired message) { this.fakeEventFiredHandler.Handle(message); }
/// <summary> /// Publishes the specified event fired message on the bus. /// </summary> /// <param name="message">The message.</param> public void Publish(IEventFired message) { this.serviceBus.Publish(message); }
/// <summary> /// Fires the message event on the internal event broker. /// </summary> /// <param name="message">The message.</param> protected virtual void DoHandle(IEventFired message) { string topic = this.CreateTopic(message); this.EventBroker.Fire(topic, this, HandlerRestriction.Asynchronous, this, new EventArgs <IEventFired>(message)); }
protected override void DoHandle(IEventFired message) { this.DoHandleWasCalled = true; }
public void Publish(IEventFired message) { this.eventFiredHandler.Handle(message); }
public void TestHandleMessage(IEventFired eventFired) { this.HandleMessage(this, eventFired); }
/// <summary> /// Creates the dynamic topic according to the message. /// </summary> /// <param name="message">The message.</param> /// <returns>The topic uri.</returns> protected virtual string CreateTopic(IEventFired message) { Ensure.ArgumentNotNull(message, "message"); return(string.Format(CultureInfo.InvariantCulture, Constants.InternalTopicFormat, message.DistributedEventBrokerIdentification)); }
/// <summary> /// Publishes the specified event fired message on the bus. /// </summary> /// <param name="message">The message.</param> public void Publish(IEventFired message) { this.serviceBus.Notify(message); }
/// <summary> /// Fires the message event on the internal event broker. /// </summary> /// <param name="message">The message.</param> protected virtual void DoHandle(IEventFired message) { string topic = this.CreateTopic(message); this.EventBroker.Fire(topic, this, this.Restriction, this, new EventArgs<IEventFired>(message)); }