public MessagingBusBuilder()
 {
     ServicesBuilder = new ServicesBuilder(this);
     ServiceBuilderServiceResolver = new ServiceBuilderServiceResolver(ServicesBuilder);
     ServiceResolver =
         new CompoundServiceResolver(ServiceBuilderServiceResolver, new DefaultServiceResolver());
     SubscriptionBuilder = new SubscriptionsBuilder(this);
     MessagingConfig     = new MessagingConfigurationBuilder(this);
 }
        public void SetUp()
        {
            _globalSubscriptionsServiceMock = new Mock <IGlobalSubscriptionsService>(MockBehavior.Strict);
            _scopedSubscriptionsServiceMock = new Mock <IScopedSubscriptionsService>(MockBehavior.Strict);

            _subscriptionsBuilder = new SubscriptionsBuilder(
                _globalSubscriptionsServiceMock.Object,
                _scopedSubscriptionsServiceMock.Object
                );
        }
 protected override void OnBuildingSubscriptions(SubscriptionsBuilder subscriptionsBuilder)
 {
     subscriptionsBuilder
     .ServiceHandler <
         ProductSubscriptionCancelledEventHandler,
         ProductSubscription,
         ProductSubscriptionCancelledEventArgs
         >()
     .HasGlobalSubscriptionTo((source, h) => source.Cancelled += h);
 }
Beispiel #4
0
        /// <summary>
        /// Configures the subscriptions.
        /// </summary>
        /// <param name="configure">A delegate to a method to use to configure subscriptions.</param>
        /// <returns>
        /// The current <see cref="MessagingBusBuilder"/>.
        /// </returns>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="configure"/> is <see langword="null"/>.
        /// </exception>
        public MessagingBusBuilder Subscriptions(Action <SubscriptionsBuilder> configure)
        {
            if (configure == null)
            {
                throw new ArgumentNullException(nameof(configure));
            }

            if (SubscriptionBuilder == null)
            {
                SubscriptionBuilder = new SubscriptionsBuilder(this);
            }

            configure(SubscriptionBuilder);

            return(this);
        }