public void GetMetadataValueThrowsArgumentExceptionWhenNameIsEmpty() { using (var transformation = new FakeTransformation()) using (var context = new TransformationContext(transformation, transformation.GenerationEnvironment)) { context.GetMetadataValue(" \t\r\n"); } }
public void GetMetadataValueReturnsValueSuppliedByProvider() { using (var transformation = new FakeTransformation()) using (var context = new TransformationContext(transformation, transformation.GenerationEnvironment)) { const string ExpectedValue = "TestValue"; transformation.Host.GetMetadataValue = (hierarchy, fileName, metadataName) => ExpectedValue; Assert.AreEqual(ExpectedValue, context.GetMetadataValue("TestProperty")); } }
public void GetMetadataValuePassesInputFileToProvider() { using (var transformation = new FakeTransformation()) using (var context = new TransformationContext(transformation, transformation.GenerationEnvironment)) { transformation.Host.TemplateFile = Path.GetRandomFileName(); string actualFileName = null; transformation.Host.GetMetadataValue = (hierarchy, fileName, metadataName) => { actualFileName = fileName; return(string.Empty); }; context.GetMetadataValue("Irrelevant"); Assert.AreSame(transformation.Host.TemplateFile, actualFileName); } }
public void GetMetadataValuePassesHostHierarchyToProvider() { using (var transformation = new FakeTransformation()) using (var context = new TransformationContext(transformation, transformation.GenerationEnvironment)) { transformation.Host.Hierarchy = new object(); object actualHierarchy = null; transformation.Host.GetMetadataValue = (hierarchy, fileName, metadataName) => { actualHierarchy = hierarchy; return(string.Empty); }; context.GetMetadataValue("Irrelevant"); Assert.AreSame(transformation.Host.Hierarchy, actualHierarchy); } }
public void GetMetadataValueThrowsArgumentNullExceptionWhenNameIsNull() { using (var transformation = new FakeTransformation()) using (var context = new TransformationContext(transformation, transformation.GenerationEnvironment)) { context.GetMetadataValue(null); } }
public void GetMetadataValueReturnsValueSuppliedByProvider() { using (var transformation = new FakeTransformation()) using (var context = new TransformationContext(transformation, transformation.GenerationEnvironment)) { const string ExpectedValue = "TestValue"; transformation.Host.GetMetadataValue = (hierarchy, fileName, metadataName) => ExpectedValue; Assert.AreEqual(ExpectedValue, context.GetMetadataValue("TestProperty")); } }
public void GetMetadataValuePassesInputFileToProvider() { using (var transformation = new FakeTransformation()) using (var context = new TransformationContext(transformation, transformation.GenerationEnvironment)) { transformation.Host.TemplateFile = Path.GetRandomFileName(); string actualFileName = null; transformation.Host.GetMetadataValue = (hierarchy, fileName, metadataName) => { actualFileName = fileName; return string.Empty; }; context.GetMetadataValue("Irrelevant"); Assert.AreSame(transformation.Host.TemplateFile, actualFileName); } }
public void GetMetadataValuePassesHostHierarchyToProvider() { using (var transformation = new FakeTransformation()) using (var context = new TransformationContext(transformation, transformation.GenerationEnvironment)) { transformation.Host.Hierarchy = new object(); object actualHierarchy = null; transformation.Host.GetMetadataValue = (hierarchy, fileName, metadataName) => { actualHierarchy = hierarchy; return string.Empty; }; context.GetMetadataValue("Irrelevant"); Assert.AreSame(transformation.Host.Hierarchy, actualHierarchy); } }