Beispiel #1
0
        /// <summary>
        /// Create Factories mapped to satisfy the demanded types(and all the intermediate dependencies).
        /// Any failures to locate a needed factory will cause an exception.
        /// </summary>
        /// <param name="factoriesPath">Path to the Factories List file</param>
        /// <param name="demandedTypes">A list of types needed for stress test execution</param>
        public FactoryPool(string factoriesPath, List <Type> demandedTypes, ConstraintsTable constraintsTable)
        {
            List <Type> factoryTypes             = TypeListReader.ParseTypeList(factoriesPath, typeof(DiscoverableFactory));
            List <DiscoverableFactory> factories = InstantiateFactories(factoryTypes);

            RegisterFactories(factories, demandedTypes);
            constraintsTable.VerifyConstraints(factoryTypes);
        }
        /// <summary>
        /// Initializes the state object against the state Payload.
        /// </summary>
        /// <param name="stateData"></param>
        public void Initialize(IStatePayload stateData)
        {
            ConvenienceStressStatePayload payload = (ConvenienceStressStatePayload)stateData;

            string windowXamlPaths = payload.WindowXamlPaths;

            if (!String.IsNullOrEmpty(windowXamlPaths))
            {
                windowXamls = windowXamlPaths.Split(new char[] { ',' });
            }

            contentXaml = payload.ContentXamlPath;

            constraintsTable = new ConstraintsTable(payload.ConstraintsTablePath);

            actionTypes = TypeListReader.ParseTypeList(payload.ActionsPath, typeof(DiscoverableAction));
            factoryPool = new FactoryPool(payload.FactoriesPath, DiscoverableInputHelper.GetFactoryInputTypes(actionTypes), constraintsTable);
            constraintsTable.VerifyConstraints(actionTypes);
            memoryLimit = payload.MemoryLimit;
        }