Beispiel #1
0
        public void SetUp()
        {
            var _busConfigurationBuilder = new BusConfigurationBuilder();

            _busConfigurationBuilder.ConnectionUris.Add("....");
            _busConfigurationBuilder.RegisterConsumer <MyEvent>(
                TestingConfiguration.QueueName,
                typeof(MyEvent).Name,
                message =>
            {
                this.c_messageProcessrResult = ConsumerHandlerResult.Completed;
                return(ConsumerHandlerResult.Completed);
            });
            _busConfigurationBuilder.RegisterConsumer <MyEvent>(
                TestingConfiguration.QueueName,
                typeof(MyEvent).FullName,
                message =>
            {
                this.c_messageProcessrResult = ConsumerHandlerResult.Completed;
                return(ConsumerHandlerResult.Completed);
            });
            _busConfigurationBuilder.RegisterConsumer <MyEvent>(
                TestingConfiguration.QueueName,
                "Throw_Error_Type_Header",
                message =>
            {
                throw new ApplicationException("Bang !");
            });
            _busConfigurationBuilder.RegisterConsumer <MyEvent>(
                TestingConfiguration.QueueName,
                "Returns_Errored_Result",
                message =>
            {
                this.c_messageProcessrResult = ConsumerHandlerResult.Errored;
                return(ConsumerHandlerResult.Errored);
            });
            var _busConfiguration = _busConfigurationBuilder.Build();

            var _connection = Substitute.For <IConnection>();

            this.c_channel = Substitute.For <IModel>();
            _connection.CreateModel().Returns(this.c_channel);

            this.c_SUT = new ConsumerMessageProcessor(_busConfiguration);

            this.c_messageProcessrResult = ConsumerHandlerResult.None;
        }
		public void SetUp()
		{
			var _busConfigurationBuilder = new BusConfigurationBuilder();
			_busConfigurationBuilder.ConnectionUris.Add("....");
			_busConfigurationBuilder.RegisterConsumer<MyEvent>(
				TestingConfiguration.QueueName,
				typeof(MyEvent).Name,
				message =>
					{
						this.c_messageProcessrResult = ConsumerHandlerResult.Completed;
						return ConsumerHandlerResult.Completed;
					});
			_busConfigurationBuilder.RegisterConsumer<MyEvent>(
				TestingConfiguration.QueueName,
				typeof(MyEvent).FullName,
				message =>
					{
						this.c_messageProcessrResult = ConsumerHandlerResult.Completed;
						return ConsumerHandlerResult.Completed;
					});
			_busConfigurationBuilder.RegisterConsumer<MyEvent>(
				TestingConfiguration.QueueName,
				"Throw_Error_Type_Header",
				message =>
					{
						throw new ApplicationException("Bang !");
					});
			_busConfigurationBuilder.RegisterConsumer<MyEvent>(
				TestingConfiguration.QueueName,
				"Returns_Errored_Result",
				message =>
					{
						this.c_messageProcessrResult = ConsumerHandlerResult.Errored;
						return ConsumerHandlerResult.Errored;
					});
			var _busConfiguration = _busConfigurationBuilder.Build();

			var _connection = Substitute.For<IConnection>();

			this.c_channel = Substitute.For<IModel>();
			_connection.CreateModel().Returns(this.c_channel);

			this.c_SUT = new ConsumerMessageProcessor(_busConfiguration);

			this.c_messageProcessrResult = ConsumerHandlerResult.None;
		}