コード例 #1
0
ファイル: EventBusBuilder.cs プロジェクト: sn001/RedDog
        /// <summary>
        /// Register one or more events with a sender.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="config"></param>
        /// <returns></returns>
        public IEventBusConfiguration RegisterEvents(IMessageSender sender, Action <IFluentMessageRegistration <IEvent> > config)
        {
            // Start the fluent configuration.
            var registration = new FluentMessageRegistration <IEvent>();

            config(registration);

            // Register.
            return(RegisterEvents(sender, registration));
        }
コード例 #2
0
        public void GetTypesShouldReturnCorrectTypes()
        {
            // Arrange.
            var source = new FluentMessageRegistration <ICommand>()
                         .With <SubmitOrderCommand>()
                         .With <DeleteOrderCommand>();

            // Act.
            var types = source.GetTypes();

            // Assert.
            Assert.Equal(2, types.Length);
            Assert.Equal(typeof(DeleteOrderCommand), types[0]);
            Assert.Equal(typeof(SubmitOrderCommand), types[1]);
        }
コード例 #3
0
        public void GetTypesShouldReturnCorrectTypes()
        {
            // Arrange.
            var source = new FluentMessageRegistration<ICommand>()
                .With<SubmitOrderCommand>()
                .With<DeleteOrderCommand>();
            
            // Act.
            var types = source.GetTypes();

            // Assert.
            Assert.Equal(2, types.Length);
            Assert.Equal(typeof(DeleteOrderCommand), types[0]);
            Assert.Equal(typeof(SubmitOrderCommand), types[1]);
        }