Exemple #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());
            }
        }
Exemple #2
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());
            }
        }
Exemple #3
0
 public void TransformDoesNotCatchTransformationException()
 {
     using (var template = new FakeTemplate())
     {
         template.Validated = () => { throw new TransformationException(); };
         template.Transform();
     }
 }
Exemple #4
0
 public void TransformDoesNotValidateOutputProperties()
 {
     using (var template = new FakeTemplate())
     {
         template.Output.Project = "Test.proj";
         template.Transform();
         Assert.AreEqual(0, template.Errors.Count);
     }
 }
Exemple #5
0
 public void TransformGeneratesOutputWhenValidateReportsWarnings()
 {
     using (var template = new FakeTemplate())
     {
         template.TransformedText = () => template.Write(TestOutput);
         template.Validated       = () => template.Warning(TestMessage);
         Assert.AreEqual(TestOutput, template.Transform());
     }
 }
Exemple #6
0
 public void TransformDoesNotGenerateOutputWhenValidateReportsErrors()
 {
     using (var template = new FakeTemplate())
     {
         template.TransformedText = () => template.WriteLine(TestOutput);
         template.Validated       = () => template.Error(TestMessage);
         Assert.AreEqual(string.Empty, template.Transform());
     }
 }
Exemple #7
0
 public void TransformValidatesTemplate()
 {
     using (var template = new FakeTemplate())
     {
         template.Validated = () => template.Error(TestMessage);
         template.Transform();
         Assert.AreEqual(1, template.Errors.Count);
     }
 }
Exemple #8
0
 public void TransformRunsCodeGeneratedByDirectiveProcessors()
 {
     using (var template = new FakeTemplate())
     {
         bool initialized = false;
         template.Initialized = () => initialized = true;
         template.Transform();
         Assert.IsTrue(initialized);
     }
 }
Exemple #9
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());
            }            
        }
Exemple #10
0
 public void TransformDoesNotValidateOutputProperties()
 {
     using (var template = new FakeTemplate())
     {
         template.Output.Project = "Test.proj";
         template.Transform();
         Assert.AreEqual(0, template.Errors.Count);
     }
 }
Exemple #11
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());
            }
        }
Exemple #12
0
 public void TransformGeneratesOutputWhenValidateReportsWarnings()
 {
     using (var template = new FakeTemplate())
     {
         template.TransformedText = () => template.Write(TestOutput);
         template.Validated = () => template.Warning(TestMessage);
         Assert.AreEqual(TestOutput, template.Transform());
     }
 }
Exemple #13
0
 public void TransformDoesNotGenerateOutputWhenValidateReportsErrors()
 {
     using (var template = new FakeTemplate())
     {
         template.TransformedText = () => template.WriteLine(TestOutput);
         template.Validated = () => template.Error(TestMessage);
         Assert.AreEqual(string.Empty, template.Transform());
     }
 }
Exemple #14
0
 public void TransformDoesNotCatchTransformationException()
 {
     using (var template = new FakeTemplate())
     {
         template.Validated = () => { throw new TransformationException(); };
         template.Transform();
     }
 }
Exemple #15
0
 public void TransformValidatesTemplate()
 {
     using (var template = new FakeTemplate())
     {
         template.Validated = () => template.Error(TestMessage);
         template.Transform();
         Assert.AreEqual(1, template.Errors.Count);
     }            
 }
Exemple #16
0
 public void TransformRunsCodeGeneratedByDirectiveProcessors()
 {
     using (var template = new FakeTemplate())
     {
         bool initialized = false;
         template.Initialized = () => initialized = true;
         template.Transform();
         Assert.IsTrue(initialized);
     }                        
 }