コード例 #1
0
 public void TestInitialize()
 {
     UIThreadDispatcher.Invoke(delegate
     {
         this.project  = this.CreateTestProject();
         this.provider = (ITransformationContextProvider)ServiceProvider.GetService(typeof(ITransformationContextProvider));
     });
 }
コード例 #2
0
 public void TestInitialize()
 {
     UIThreadDispatcher.Invoke(delegate
     {
         this.project = this.CreateTestProject();
         this.provider = (ITransformationContextProvider)ServiceProvider.GetService(typeof(ITransformationContextProvider));
     });
 }
コード例 #3
0
        public void TestInitialize()
        {
            UIThreadDispatcher.Invoke(delegate
            {
                this.templatingService = (ITextTemplating)ServiceProvider.GetService(typeof(STextTemplating));
                this.templatingHost = (ITextTemplatingEngineHost)this.templatingService;
                this.provider = (ITransformationContextProvider)ServiceProvider.GetService(typeof(ITransformationContextProvider));

                this.project = this.CreateTestProject();
                this.folder = this.project.ProjectItems.AddFolder(Path.GetRandomFileName());
                this.input = this.CreateTestProjectItem(this.folder.ProjectItems, TextFileItemTemplate);

                this.output = new OutputFile { File = Path.GetRandomFileName() + ".txt" };
                this.output.Content.Append(TestText);

                this.SimulateTransformation();
            });
        }
コード例 #4
0
        public void TestInitialize()
        {
            UIThreadDispatcher.Invoke(delegate
            {
                this.templatingService = (ITextTemplating)ServiceProvider.GetService(typeof(STextTemplating));
                this.templatingHost    = (ITextTemplatingEngineHost)this.templatingService;
                this.provider          = (ITransformationContextProvider)ServiceProvider.GetService(typeof(ITransformationContextProvider));

                this.project = this.CreateTestProject();
                this.folder  = this.project.ProjectItems.AddFolder(Path.GetRandomFileName());
                this.input   = this.CreateTestProjectItem(this.folder.ProjectItems, TextFileItemTemplate);

                this.output = new OutputFile {
                    File = Path.GetRandomFileName() + ".txt"
                };
                this.output.Content.Append(TestText);

                this.SimulateTransformation();
            });
        }
コード例 #5
0
        internal TransformationContext(TextTransformation transformation, StringBuilder generationEnvironment)
        {
            if (transformation == null)
            {
                throw new ArgumentNullException("transformation");
            }

            if (generationEnvironment == null)
            {
                throw new ArgumentNullException("generationEnvironment");
            }

            PropertyInfo hostProperty = transformation.GetType().GetProperty("Host");

            if (hostProperty == null)
            {
                throw new ArgumentException("TextTransformation does not have Host property");
            }

            this.Host = (ITextTemplatingEngineHost)hostProperty.GetValue(transformation);
            if (this.Host == null)
            {
                throw new ArgumentException("TextTransformation.Host is null.");
            }

            this.Transformation = transformation;

            // Create a special output file for the transformation output.
            this.outputFiles.Add(new OutputFile(generationEnvironment));

            this.provider = (ITransformationContextProvider)this.GetService(typeof(ITransformationContextProvider));
            if (this.provider == null)
            {
                throw new InvalidOperationException("ITransformationContextProvider service is not available.");
            }

            this.InitializeParameters();
        }
コード例 #6
0
        internal TransformationContext(TextTransformation transformation, StringBuilder generationEnvironment)
        {
            if (transformation == null)
            {
                throw new ArgumentNullException("transformation");
            }

            if (generationEnvironment == null)
            {
                throw new ArgumentNullException("generationEnvironment");
            }

            PropertyInfo hostProperty = transformation.GetType().GetProperty("Host");
            if (hostProperty == null)
            {
                throw new ArgumentException("TextTransformation does not have Host property");
            }

            this.Host = (ITextTemplatingEngineHost)hostProperty.GetValue(transformation);
            if (this.Host == null)
            {
                throw new ArgumentException("TextTransformation.Host is null.");
            }

            this.Transformation = transformation;

            // Create a special output file for the transformation output.
            this.outputFiles.Add(new OutputFile(generationEnvironment));

            this.provider = (ITransformationContextProvider)this.GetService(typeof(ITransformationContextProvider));
            if (this.provider == null)
            {
                throw new InvalidOperationException("ITransformationContextProvider service is not available.");
            }

            this.InitializeParameters();
        }
コード例 #7
0
        public void UpdateOutputFilesThrowsArgumentExceptionWhenAnyOutputFileIsNull()
        {
            ITransformationContextProvider target = CreateTransformationContextProvider();

            target.UpdateOutputFiles(@"C:\input.tt", new OutputFile[1]);
        }
コード例 #8
0
        public void UpdateOutputFilesThrowsArgumentExceptionWhenInputFileIsNotRooted()
        {
            ITransformationContextProvider target = CreateTransformationContextProvider();

            target.UpdateOutputFiles("input.tt", new OutputFile[0]);
        }
コード例 #9
0
        public void UpdateOutputFilesThrowsArgumentNullExceptionWhenInputFileIsNull()
        {
            ITransformationContextProvider target = CreateTransformationContextProvider();

            target.UpdateOutputFiles(null, new OutputFile[0]);
        }