Ejemplo n.º 1
0
        private RemoveAllComments MakeTransformer(bool shouldStrip)
        {
            var arguments = CompilerArgumentsFactory.Make();

            arguments.StripComments = shouldStrip;
            return(RemoveAllCommentsFactory.Make(arguments));
        }
Ejemplo n.º 2
0
        public ReplaceTokensTest()
        {
            var arguments = CompilerArgumentsFactory.Make();

            arguments.TokenReplacers.Add(new TokenDateReplacer("{TOKENA}", "Y-m-d"));
            arguments.TokenReplacers.Add(new TokenDateReplacer("{TOKENB}", "d-m-Y"));
            transformer = ReplaceTokensFactory.Make(arguments);
        }
        public void TestItReplacesTokens()
        {
            var    arguments = CompilerArgumentsFactory.Make();
            string version   = "This is the {VERSION} string";
            var    replacer  = new TokenBuildVersionReplacer(arguments, "{VERSION}");

            Assert.Equal(
                "This is the BUILD_VERSION string",
                replacer.ReplaceTokens(version)
                );
        }
        public OutputWriterTest()
        {
            var arguments = CompilerArgumentsFactory.Make();

            arguments.StripComments = true;
            outputMock = new Mock <TextWriter>();
            writer     = OutputWriterFactory.Make(
                arguments,
                "file.txt",
                new MockOutputStreamFactory(outputMock.Object)
                );
        }
        public void TestItAddsTransformers()
        {
            List <Type> expected = new(new[]
            {
                typeof(RemoveAllComments),
                typeof(ReplaceTokens)
            }
                                       );

            Assert.Equal(
                expected,
                TransformerChainFactory.Create(CompilerArgumentsFactory.Make()).GetTransformerTypes()
                );
        }
Ejemplo n.º 6
0
        static int Main(string[] args)
        {
            // Setup the console output stream.
            StreamWriter output = new StreamWriter(Console.OpenStandardOutput())
            {
                AutoFlush = true
            };

            Console.SetOut(output);

            // Parse the sectorfile
            CompilerArguments compilerArguments = CompilerArgumentsFactory.Make();
            CliArguments      cliArguments      = CliArgumentsFactory.Make();

            try
            {
                ArgumentParserFactory.Make().CreateFromCommandLine(compilerArguments, cliArguments, args);
            } catch (ArgumentException exception)
            {
                output.Write(exception.Message);
                return(1);
            }

            int returnCode = SectorFileCompilerFactory.Create(
                compilerArguments,
                new List <IEventObserver>()
            {
                new ConsoleOutput(output)
            }
                ).Compile();

            if (cliArguments.PauseOnFinish)
            {
                output.Write("Press any key to exit");
                Console.ReadKey();
            }
            return(returnCode);
        }
 public ConfigOutputFilesOptionLoaderTest()
 {
     loader    = new ConfigOutputFilesOptionLoader();
     arguments = CompilerArgumentsFactory.Make();
 }
 public ConfigTokenReplaceOptionLoaderTest()
 {
     loader    = new ConfigTokenReplaceOptionLoader();
     arguments = CompilerArgumentsFactory.Make();
 }
 public ConfigOptionsLoaderTest()
 {
     loader    = ConfigOptionsLoaderFactory.Make();
     arguments = CompilerArgumentsFactory.Make();
 }
Ejemplo n.º 10
0
 public ArgumentParserTest()
 {
     parser            = ArgumentParserFactory.Make();
     compilerArguments = CompilerArgumentsFactory.Make();
     cliArguments      = CliArgumentsFactory.Make();
 }