Inheritance: System.Management.Automation.ArgumentTransformationAttribute
 public void TestProjectConversion()
 {
     TestType project = new TestType { Name = s_testString };
     var attribute = new PropertyByTypeTransformationAttribute { Property = "name", TypeToTransform = typeof(TestType) };
     object result = attribute.Transform(null, project);
     Assert.AreEqual(s_testString, result);
 }
Beispiel #2
0
 public ArrayPropertyTransformAttribute(Type typeToTransform, string property)
 {
     typeTransformationAttribute = new PropertyByTypeTransformationAttribute
     {
         Property        = property,
         TypeToTransform = typeToTransform
     };
 }
 public void TestDeepPSObjectConversion()
 {
     TestType project = new TestType { Name = s_testString };
     PSObject obj = new PSObject(project);
     var attribute = new PropertyByTypeTransformationAttribute { Property = "name", TypeToTransform = typeof(TestType) };
     object result = attribute.Transform(null, new PSObject(obj));
     Assert.AreEqual(result, s_testString);
 }
 public ArrayPropertyTransformAttribute(Type typeToTransform, string property)
 {
     _typeTransformationAttribute = new PropertyByTypeTransformationAttribute
     {
         Property = property,
         TypeToTransform = typeToTransform
     };
 }
 public void TestStringPassThrough()
 {
     var attribute = new PropertyByTypeTransformationAttribute { Property = "name", TypeToTransform = typeof(TestType) };
     object result = attribute.Transform(null, s_testString);
     Assert.AreEqual(result, s_testString);
 }