コード例 #1
0
        public void ShouldProperlyValidateExchangeType(string type, bool expectedResult)
        {
            var specification = new ValidExchangeTypeSpecification();
            var options       = new RabbitMqExchangeOptions
            {
                Type = type
            };
            var result = specification.IsSatisfiedBy(options);

            Assert.Equal(expectedResult, result);
        }
コード例 #2
0
        private static void ValidateExchangeTypes(string exchangeName, RabbitMqExchangeOptions options)
        {
            var exchangeSpecification = new ValidExchangeTypeSpecification();

            if (!exchangeSpecification.IsSatisfiedBy(options))
            {
                throw new InvalidExchangeTypeException(exchangeName, options.Type);
            }

            var deadLetterExchangeSpecification = new ValidDeadLetterExchangeTypeSpecification();

            if (!deadLetterExchangeSpecification.IsSatisfiedBy(options))
            {
                throw new InvalidExchangeTypeException(options.DeadLetterExchange, options.DeadLetterExchangeType);
            }
        }