public void RenderReportsTemplateValidationErrorsToTransformation() { using (var template = new FakeTemplate()) { template.Validated = () => template.Error(TestMessage); template.Render(); AssertSingleError(this.transformation.Errors, TestMessage); } }
public void RenderReportsTransformationExceptionsAsErrors() { using (var template = new FakeTemplate()) { template.Validated = () => { throw new TransformationException(TestMessage); }; template.Render(); AssertSingleError(template.Errors, TestMessage); } }
public void RenderRaisesRenderingEvent() { using (var template = new FakeTemplate()) { bool eventRaised = false; template.Rendering += delegate { eventRaised = true; }; template.Render(); Assert.AreEqual(true, eventRaised); } }
public void RenderDoesNotTransformTemplateWhenEnabledIsFalse() { using (var template = new FakeTemplate()) { template.Enabled = false; bool transformed = false; template.TransformedText = () => transformed = true; template.Render(); Assert.IsFalse(transformed); } }
public void RenderTransformsTemplateWhenEnabledIsSetByRenderingEventHandler() { using (var template = new FakeTemplate()) { template.Enabled = false; bool transformed = false; template.Rendering += delegate { template.Enabled = true; }; template.TransformedText = () => transformed = true; template.Render(); Assert.IsTrue(transformed); } }
public void RenderReportsTemplateFileInErrorsOfTemplateFileBasedTransformation() { this.transformation.Host.TemplateFile = "Template.tt"; using (var template = new FakeTemplate()) { template.Validated = () => template.Error(TestMessage); template.Render(); } var error = this.transformation.Errors.Cast <CompilerError>().Single(); Assert.AreEqual("Template.tt", error.FileName); }
public void RenderReportsInputFileInErrorsOfInputFileBasedTransformation() { this.transformation.Session[TransformationContext.InputFileNameKey] = "Input.cs"; using (var template = new FakeTemplate()) { template.Validated = () => template.Error(TestMessage); template.Render(); } var error = this.transformation.Errors.Cast <CompilerError>().Single(); Assert.AreEqual("Input.cs", error.FileName); }
public void RenderReportsInputFileInErrorsOfInputFileBasedTransformation() { this.transformation.Session[TransformationContext.InputFileNameKey] = "Input.cs"; using (var template = new FakeTemplate()) { template.Validated = () => template.Error(TestMessage); template.Render(); } var error = this.transformation.Errors.Cast<CompilerError>().Single(); Assert.AreEqual("Input.cs", error.FileName); }
public void RenderReportsTemplateFileInErrorsOfTemplateFileBasedTransformation() { this.transformation.Host.TemplateFile = "Template.tt"; using (var template = new FakeTemplate()) { template.Validated = () => template.Error(TestMessage); template.Render(); } var error = this.transformation.Errors.Cast<CompilerError>().Single(); Assert.AreEqual("Template.tt", error.FileName); }