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 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 TransformDoesNotCatchTransformationException() { using (var template = new FakeTemplate()) { template.Validated = () => { throw new TransformationException(); }; template.Transform(); } }
public void TransformDoesNotValidateOutputProperties() { using (var template = new FakeTemplate()) { template.Output.Project = "Test.proj"; template.Transform(); Assert.AreEqual(0, template.Errors.Count); } }
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 TransformDoesNotGenerateOutputWhenValidateReportsErrors() { using (var template = new FakeTemplate()) { template.TransformedText = () => template.WriteLine(TestOutput); template.Validated = () => template.Error(TestMessage); Assert.AreEqual(string.Empty, template.Transform()); } }
public void TransformValidatesTemplate() { using (var template = new FakeTemplate()) { template.Validated = () => template.Error(TestMessage); template.Transform(); Assert.AreEqual(1, template.Errors.Count); } }
public void TransformRunsCodeGeneratedByDirectiveProcessors() { using (var template = new FakeTemplate()) { bool initialized = false; template.Initialized = () => initialized = true; template.Transform(); Assert.IsTrue(initialized); } }