public void InvokeOverloadedByTypeParameterizedPropertySetter() { var obj = new TestOverloadedByTypeParameterizedProperty(new [] {"a.txt"}); var psObject = new PSObject(obj); var propertyInfo = psObject.Members.Single(m => m.Name == "FileNames") as PSParameterizedProperty; propertyInfo.InvokeSet("b.txt", "a.txt"); Assert.AreEqual("b.txt", obj[1]); }
public void ObjectWithOverloadedByTypeParameterizedProperty() { var obj = new TestOverloadedByTypeParameterizedProperty(); var psObject = new PSObject(obj); var propertyInfo = psObject.Members.Single(m => m.Name == "FileNames") as PSParameterizedProperty; Assert.IsTrue(propertyInfo.IsGettable); Assert.IsTrue(propertyInfo.IsSettable); Assert.AreEqual("FileNames", propertyInfo.Name); Assert.AreEqual("System.String", propertyInfo.TypeNameOfValue); Assert.AreEqual(propertyInfo, propertyInfo.Value); Assert.AreEqual(2, propertyInfo.OverloadDefinitions.Count); Assert.AreEqual("string FileNames(int index) {get;set;}", propertyInfo.OverloadDefinitions[0]); Assert.AreEqual("string FileNames(string fileName) {get;set;}", propertyInfo.OverloadDefinitions[1]); }