Esempio n. 1
0
 public void ApplyTo(Fixture generator, StringGenerator stringGenerator, NumericGenerator numericGenerator)
 {
     generator.Register(() => _types.Next());
     generator.Register(() => _methodList.Next());
     generator.Register(() => new Exception(stringGenerator.String(), new Exception(stringGenerator.String())));
     generator.Register(
         () =>
         new IPAddress(new[]
                       { numericGenerator.Octet(), numericGenerator.Octet(), numericGenerator.Octet(), numericGenerator.Octet() }));
     generator.Customize(new MultipleCustomization());
 }
Esempio n. 2
0
        public static AllGenerator Create()
        {
            var emptyCollectionFixture = new Fixture
            {
                RepeatCount = 0
            };
            var methodProxyCalls     = new GenericMethodProxyCalls();
            var fixtureConfiguration = new AutoFixtureConfiguration();
            var fixture                     = fixtureConfiguration.CreateUnconfiguredInstance();
            var collectionGenerator         = new CollectionGenerator(methodProxyCalls);
            var valueGenerator              = new ValueGenerator(fixture);
            var charGenerator               = new CharGenerator(valueGenerator);
            var specificTypeObjectGenerator = new SpecificTypeObjectGenerator(valueGenerator);
            var emptyCollectionGenerator    = new EmptyCollectionGenerator(
                emptyCollectionFixture,
                methodProxyCalls);
            var proxyGenerator      = new ProxyGenerator();
            var proxyBasedGenerator = new ProxyBasedGenerator(
                emptyCollectionFixture,
                methodProxyCalls,
                emptyCollectionGenerator, //TODO make separate chain for this
                proxyGenerator,
                new FakeChainFactory(
                    new CachedReturnValueGeneration(new PerMethodCache <object>()),
                    GlobalNestingLimit.Of(5),
                    proxyGenerator, //TODO get rid of this dependency - its runtime-circular
                    valueGenerator,
                    collectionGenerator));
            var stringGenerator = new StringGenerator(
                charGenerator,
                valueGenerator,
                specificTypeObjectGenerator);
            var numericGenerator = new NumericGenerator(
                valueGenerator);
            var allGenerator = new AllGenerator(valueGenerator,
                                                charGenerator,
                                                specificTypeObjectGenerator,
                                                stringGenerator,
                                                emptyCollectionGenerator,
                                                numericGenerator,
                                                proxyBasedGenerator,
                                                collectionGenerator,
                                                new InvokableGenerator());

            fixtureConfiguration.ApplyTo(fixture, stringGenerator, numericGenerator);
            return(allGenerator);
        }
Esempio n. 3
0
 public AllGenerator(
     ValueGenerator valueGenerator,
     CharGenerator charGenerator,
     SpecificTypeObjectGenerator specificTypeObjectGenerator,
     StringGenerator stringGenerator,
     EmptyCollectionGenerator emptyCollectionGenerator,
     NumericGenerator numericGenerator,
     ProxyBasedGenerator genericGenerator,
     CollectionGenerator collectionGenerator,
     InvokableGenerator invokableGenerator)
 {
     _valueGenerator = valueGenerator;
     _charGenerator  = charGenerator;
     _specificTypeObjectGenerator = specificTypeObjectGenerator;
     _stringGenerator             = stringGenerator;
     _emptyCollectionGenerator    = emptyCollectionGenerator;
     _numericGenerator            = numericGenerator;
     _genericGenerator            = genericGenerator;
     _collectionGenerator         = collectionGenerator;
     _invokableGenerator          = invokableGenerator;
 }