public void TestInitialize() { UIThreadDispatcher.Invoke(delegate { this.project = this.CreateTestProject(); this.provider = (ITransformationContextProvider)ServiceProvider.GetService(typeof(ITransformationContextProvider)); }); }
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(); }); }
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(); }
public void UpdateOutputFilesThrowsArgumentExceptionWhenAnyOutputFileIsNull() { ITransformationContextProvider target = CreateTransformationContextProvider(); target.UpdateOutputFiles(@"C:\input.tt", new OutputFile[1]); }
public void UpdateOutputFilesThrowsArgumentExceptionWhenInputFileIsNotRooted() { ITransformationContextProvider target = CreateTransformationContextProvider(); target.UpdateOutputFiles("input.tt", new OutputFile[0]); }
public void UpdateOutputFilesThrowsArgumentNullExceptionWhenInputFileIsNull() { ITransformationContextProvider target = CreateTransformationContextProvider(); target.UpdateOutputFiles(null, new OutputFile[0]); }