public void Setup()
        {
            _ioSubstitute = Substitute.For <ISystemIO>();
            _solutionFileParserSubstitute = Substitute.For <ISolutionFileParser>();
            _solutionFactorySubstitute    = Substitute.For <ISolutionFactory>();

            _reader = new SolutionReader(_ioSubstitute, _solutionFactorySubstitute, _solutionFileParserSubstitute);
        }
Ejemplo n.º 2
0
        private static void InIt()
        {
            _solutionFactory = new SolutionFactory();
            _consoleHelper   = new ConsoleHelper();

            _consoleHelper.ShowMianText();

            _run = true;
        }
Ejemplo n.º 3
0
 public SolutionBuilder(ISolutionContext solutionContext, ISolutionFactory solutionFactory, IFileFactory fileFactory)
 {
     _solutionContext = solutionContext;
     _solutionFactory = solutionFactory;
     _fileFactory     = fileFactory;
     _projects        = new List <Project>();
     _plainFiles      = new List <PlainFile>();
     _solution        = new Solution();
 }
Ejemplo n.º 4
0
        public static void Main()
        {
            Console.WriteLine("Starting...");

            var services             = new OpenApiCommandLineServices(FilePath);
            ISolutionFactory factory = services.GetService <ISolutionFactory>();

            factory.CreateSolution(PostAction.OpenInExplorer);

            Console.WriteLine("Complete!");
        }
Ejemplo n.º 5
0
        public Generator(int population, int cityCount, int generations, double mutationRate, int seed)
        {
            this.logger = new GeneratorLogger();

            this.population   = population;
            this.cityCount    = cityCount;
            this.generations  = generations;
            this.mutationRate = mutationRate;
            this.seed         = seed;

            this.abstractFactory = new AbstractFactory();
            this.cityFactory     = abstractFactory.CreateCityFactory(this.seed);
            this.breedingFactory = abstractFactory.CreateBreedingFactory();
            ISolutionFactory solutionFactory = abstractFactory.CreateSolutionFactory();

            IMutater mutater = breedingFactory.CreateMutater(mutationRate);

            this.solutionFactory = solutionFactory;
            this.bestFit         = new BestFit();

            this.breeder = breedingFactory.CreateBreeder(mutater, solutionFactory);
        }
 public CodeGeneratorContextFactory(ISolutionFactory solutionFactory)
 {
     _solutionFactory = solutionFactory;
 }
 public CodeGeneratorContextFactory(ISolutionFactory solutionFactory)
 {
     _solutionFactory = solutionFactory;
 }
Ejemplo n.º 8
0
 public SolutionReader(ISystemIO io, ISolutionFactory solutionFactory, ISolutionFileParser solutionFileParser) : base(io, SlnFileGlob)
 {
     _solutionFactory    = solutionFactory ?? throw new ArgumentNullException(nameof(solutionFactory));
     _solutionFileParser = solutionFileParser ?? throw new ArgumentNullException(nameof(solutionFileParser));
 }
Ejemplo n.º 9
0
        public ISolution Parse(string slnFilePath)
        {
            string slnFileText = File.ReadAllText(slnFilePath);

            ISolution solution = ISolutionFactory.create();

            //solution.setLogMessageCallback(log);
            solution.setErrorMessageCallback(log);

            SolutionCallback callback = new SolutionCallback();

            callback.LoadExternalAssemblyModuleCallback = new LoadExternalAssemblyModuleDelegate(loadExternalAssemblyModule2);
            callback.LoadTextFileCallback      = new LoadTextFileDelegate(loadTextFile);
            callback.PropertyEvaluatorCallback = new PropertyEvaluatorDelegate(propertyEvaluator);
            callback.BetterAssemblyCallback    = new BetterAssemblyDelegate(betterAssembly);

            modules = new Dictionary <string, IExternalAssemblyModule>();

            solution.loadSlnFile(
                slnFilePath,
                slnFileText.ToCharArray(),
                callback,
                project_namespace.pn_project_namespace
                );

            //apply configuration
            ISlnFileConfiguration[] configs = solution.getSlnFileConfigurations();
            string configuration            = configs[0].getConfiguration();
            string platform = configs[0].getPlatform();

            solution.applyConfiguration(
                configuration,
                platform,
                callback,
                true,
                AssemblyTypeMapping.atm_default
                );

            //parse
            //solution.setParseAccessibleTypesAndMembersOnly(true);
            solution.parse();


            //modules = new Dictionary<string, IExternalAssemblyModule>();

            //string slnFileText = File.ReadAllText(slnFilePath);

            //ISolution solution = ISolutionFactory.create();
            ////solution.setLogMessageCallback(log);

            //solution.loadSlnFile(
            //    slnFilePath,
            //    slnFileText.ToCharArray(),
            //    loadTextFile,
            //    loadExternalAssemblyModule2,
            //    project_namespace.pn_project_namespace
            //    );

            ////apply configuration
            //ISlnFileConfiguration[] configs = solution.getSlnFileConfigurations();
            //string configuration = configs[0].getConfiguration();
            //string platform = configs[0].getPlatform();
            //solution.applyConfiguration(
            //    configuration,
            //    platform,
            //    loadTextFile,
            //    loadExternalAssemblyModule2,
            //    propertyEvaluator,
            //    betterAssembly,
            //    true,
            //    AssemblyTypeMapping.atm_default
            //    );

            ////parse
            ////solution.setParseAccessibleTypesAndMembersOnly(true);
            ////solution.parse();

            return(solution);
        }
Ejemplo n.º 10
0
 public Breeder(IMutater mutater, ISolutionFactory solutionFactory)
 {
     this.mutater         = mutater;
     this.solutionFactory = solutionFactory;
 }
Ejemplo n.º 11
0
 public IBreeder CreateBreeder(IMutater mutater, ISolutionFactory solutionFactory)
 {
     return(new Breeder(mutater, solutionFactory));
 }