Exemple #1
0
 public void GetPropertyValueThrowsArgumentExceptionWhenNameIsEmpty()
 {
     using (var transformation = new FakeTransformation())
         using (var context = new TransformationContext(transformation, transformation.GenerationEnvironment))
         {
             context.GetPropertyValue(" \t\r\n");
         }
 }
Exemple #2
0
 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"));
         }
 }
Exemple #3
0
        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 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);
            }
        }