public void GetPropertyValueThrowsArgumentExceptionWhenNameIsEmpty() { using (var transformation = new FakeTransformation()) using (var context = new TransformationContext(transformation, transformation.GenerationEnvironment)) { context.GetPropertyValue(" \t\r\n"); } }
public void GetPropertyValueReturnsValueSuppliedByProvider() { using (var transformation = new FakeTransformation()) using (var context = new TransformationContext(transformation, transformation.GenerationEnvironment)) { const string ExpectedValue = "TestValue"; transformation.Host.GetPropertyValue = (hierarchy, propertyName) => ExpectedValue; Assert.AreEqual(ExpectedValue, context.GetPropertyValue("TestProperty")); } }
public void GetPropertyValuePassesHostHierarchyToProvider() { using (var transformation = new FakeTransformation()) using (var context = new TransformationContext(transformation, transformation.GenerationEnvironment)) { transformation.Host.Hierarchy = new object(); object actualHierarchy = null; transformation.Host.GetPropertyValue = (hierarchy, propertyName) => { actualHierarchy = hierarchy; return(string.Empty); }; context.GetPropertyValue("Irrelevant"); Assert.AreSame(transformation.Host.Hierarchy, actualHierarchy); } }
public void GetPropertyValueThrowsArgumentNullExceptionWhenNameIsNull() { using (var transformation = new FakeTransformation()) using (var context = new TransformationContext(transformation, transformation.GenerationEnvironment)) { context.GetPropertyValue(null); } }
public void GetPropertyValuePassesHostHierarchyToProvider() { using (var transformation = new FakeTransformation()) using (var context = new TransformationContext(transformation, transformation.GenerationEnvironment)) { transformation.Host.Hierarchy = new object(); object actualHierarchy = null; transformation.Host.GetPropertyValue = (hierarchy, propertyName) => { actualHierarchy = hierarchy; return string.Empty; }; context.GetPropertyValue("Irrelevant"); Assert.AreSame(transformation.Host.Hierarchy, actualHierarchy); } }