public void TransformClearsPreviousOutputToAllowGeneratingMultipleOutputsFromSingleTemplate() { using (var template = new FakeTemplate()) { template.TransformedText = () => template.Write("First Output"); template.Transform(); template.TransformedText = () => template.Write(TestOutput); Assert.AreEqual(TestOutput, template.Transform()); } }
public void TransformGeneratesOutputWhenValidateReportsWarnings() { using (var template = new FakeTemplate()) { template.TransformedText = () => template.Write(TestOutput); template.Validated = () => template.Warning(TestMessage); Assert.AreEqual(TestOutput, template.Transform()); } }
public void TransformClearsPreviousErrorsToAllowTransformingSameTemplateMultipleTimes() { using (var template = new FakeTemplate()) { template.Validated = () => template.Error(TestMessage); template.Transform(); template.Validated = null; template.TransformedText = () => template.Write(TestOutput); Assert.AreEqual(TestOutput, template.Transform()); } }
public void RenderToFileRendersTheTemplate() { OutputFile[] outputFiles = null; this.transformation.Host.UpdatedOutputFiles = (input, outputs) => outputFiles = outputs; using (var template = new FakeTemplate()) { template.TransformedText = () => template.Write(TestOutput); template.RenderToFile(TestFile); } this.Dispose(); // Force the end of transformation OutputFile outputFile = outputFiles.Single(output => output.File == TestFile); Assert.AreEqual(TestOutput, outputFile.Content.ToString()); }