示例#1
0
        public void CreateAnonymousWillSatisfyMinimumWhenHigh()
        {
            // Fixture setup
            var minimum = 109;
            var sut     = new ConstrainedStringGenerator(minimum, 200);
            // Exercise system
            string result = sut.CreateaAnonymous(string.Empty);

            // Verify outcome
            Assert.True(result.Length >= minimum, "Length greater than minimum");
            // Teardown
        }
示例#2
0
        public void CreateAnonymousWillSatisfyMaximumWhenHigh()
        {
            // Fixture setup
            var maximum = 89;
            var sut     = new ConstrainedStringGenerator(1, maximum);
            // Exercise system
            var result = sut.CreateaAnonymous(string.Empty);

            // Verify outcome
            Assert.True(result.Length <= maximum, "Length less than maximum");
            // Teardown
        }
示例#3
0
        public void CreateAnonymousWillPrefixWithSeed()
        {
            // Fixture setup
            var seed = "Anonymous seed";
            var sut  = new ConstrainedStringGenerator(1, 100);
            // Exercise system
            var result = sut.CreateaAnonymous(seed);

            // Verify outcome
            Assert.StartsWith(seed, result);
            // Teardown
        }
示例#4
0
        public static IPostprocessComposer <T> With <T>(
            this ICustomizationComposer <T> ob,
            Expression <Func <T, string> > propertyPicker,
            int minimumLength,
            int maximumLength)
        {
            var me        = (MemberExpression)propertyPicker.Body;
            var name      = me.Member.Name;
            var generator =
                new ConstrainedStringGenerator(
                    minimumLength, maximumLength);
            var value = generator.CreateaAnonymous(name);

            return(ob.With(propertyPicker, value));
        }