Esempio n. 1
0
        public void Should_throw_if_any_string_property_exceeds_255_chars()
        {
            var longInput = new String('*', 256);

            var properties   = new MessageProperties();
            var stringFields = properties.GetType().GetProperties().Where(x => x.PropertyType == typeof(String));

            foreach (var propertyInfo in stringFields)
            {
                var threw = false;
                try
                {
                    propertyInfo.SetValue(properties, longInput, new object[0]);
                }
                catch (TargetInvocationException exception)
                {
                    if (exception.InnerException is EasyNetQException)
                    {
                        // Console.Out.WriteLine(exception.InnerException.Message);
                        threw = true;
                    }
                    else
                    {
                        throw;
                    }
                }
                if (!threw)
                {
                    Assert.Fail("Over length property set didn't fail");
                }
            }
        }
Esempio n. 2
0
        public void Should_throw_if_any_string_property_exceeds_255_chars()
        {
            var longInput = new String('*', 256);

            var properties = new MessageProperties();
            var stringFields = properties.GetType().GetProperties().Where(x => x.PropertyType == typeof (String));
            foreach (var propertyInfo in stringFields)
            {
                var threw = false;
                try
                {
                    propertyInfo.SetValue(properties, longInput, new object[0]);
                }
                catch (TargetInvocationException exception)
                {
                    if (exception.InnerException is EasyNetQException)
                    {
                        // Console.Out.WriteLine(exception.InnerException.Message);
                        threw = true;
                    }
                    else
                    {
                        throw;
                    }
                }
                if (!threw)
                {
                    Assert.Fail("Over length property set didn't fail");
                }
            }
        }