Пример #1
0
        public void TestStringPassThrough()
        {
            var attribute = new PropertyByTypeTransformationAttribute {
                Property = "name", TypeToTransform = typeof(TestType)
            };
            object result = attribute.Transform(null, s_testString);

            Assert.AreEqual(result, s_testString);
        }
Пример #2
0
        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);
        }
Пример #3
0
        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);
        }