예제 #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());
            }
        }
예제 #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());
            }
        }
예제 #3
0
 public void TransformDoesNotCatchTransformationException()
 {
     using (var template = new FakeTemplate())
     {
         template.Validated = () => { throw new TransformationException(); };
         template.Transform();
     }
 }
예제 #4
0
 public void TransformDoesNotValidateOutputProperties()
 {
     using (var template = new FakeTemplate())
     {
         template.Output.Project = "Test.proj";
         template.Transform();
         Assert.AreEqual(0, template.Errors.Count);
     }
 }
예제 #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());
     }
 }
예제 #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());
     }
 }
예제 #7
0
 public void TransformValidatesTemplate()
 {
     using (var template = new FakeTemplate())
     {
         template.Validated = () => template.Error(TestMessage);
         template.Transform();
         Assert.AreEqual(1, template.Errors.Count);
     }
 }
예제 #8
0
 public void TransformRunsCodeGeneratedByDirectiveProcessors()
 {
     using (var template = new FakeTemplate())
     {
         bool initialized = false;
         template.Initialized = () => initialized = true;
         template.Transform();
         Assert.IsTrue(initialized);
     }
 }
예제 #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());
            }            
        }
예제 #10
0
 public void TransformDoesNotValidateOutputProperties()
 {
     using (var template = new FakeTemplate())
     {
         template.Output.Project = "Test.proj";
         template.Transform();
         Assert.AreEqual(0, template.Errors.Count);
     }
 }
예제 #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());
            }
        }
예제 #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());
     }
 }
예제 #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());
     }
 }
예제 #14
0
 public void TransformDoesNotCatchTransformationException()
 {
     using (var template = new FakeTemplate())
     {
         template.Validated = () => { throw new TransformationException(); };
         template.Transform();
     }
 }
예제 #15
0
 public void TransformValidatesTemplate()
 {
     using (var template = new FakeTemplate())
     {
         template.Validated = () => template.Error(TestMessage);
         template.Transform();
         Assert.AreEqual(1, template.Errors.Count);
     }            
 }
예제 #16
0
 public void TransformRunsCodeGeneratedByDirectiveProcessors()
 {
     using (var template = new FakeTemplate())
     {
         bool initialized = false;
         template.Initialized = () => initialized = true;
         template.Transform();
         Assert.IsTrue(initialized);
     }                        
 }