Esempio n. 1
0
        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());
            }
        }
Esempio n. 2
0
 public void TransformGeneratesOutputWhenValidateReportsWarnings()
 {
     using (var template = new FakeTemplate())
     {
         template.TransformedText = () => template.Write(TestOutput);
         template.Validated       = () => template.Warning(TestMessage);
         Assert.AreEqual(TestOutput, template.Transform());
     }
 }
Esempio n. 3
0
        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());
            }
        }
Esempio n. 4
0
        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());
        }
Esempio n. 5
0
        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());
            }            
        }
Esempio n. 6
0
        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());
            }
        }
Esempio n. 7
0
 public void TransformGeneratesOutputWhenValidateReportsWarnings()
 {
     using (var template = new FakeTemplate())
     {
         template.TransformedText = () => template.Write(TestOutput);
         template.Validated = () => template.Warning(TestMessage);
         Assert.AreEqual(TestOutput, template.Transform());
     }
 }
Esempio n. 8
0
        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());
        }