public void ProvideValueConst () { var x = new StaticExtension (); x.MemberType = typeof (XamlLanguage); x.Member = "Xaml2006Namespace"; Assert.AreEqual (XamlLanguage.Xaml2006Namespace, x.ProvideValue (null), "#1"); }
public void ProvideValueStaticProperty () { var x = new StaticExtension (); x.MemberType = typeof (XamlLanguage); x.Member = "Array"; Assert.AreEqual (XamlLanguage.Array, x.ProvideValue (null), "#1"); }
public void ProvideValueInstanceProperty () { var x = new StaticExtension (); x.MemberType = typeof (StaticExtension); x.Member = "MemberType"; // instance property is out of scope. x.ProvideValue (null); }
public void ProvideValueTest_nullService () { StaticExtension se = new StaticExtension ("Test.Field"); ProviderPoker p = new ProviderPoker (null); Assert.IsNull (se.ProvideValue (p)); }
public void ProvideValueTest_nonIXamlTypeResolver () { StaticExtension se = new StaticExtension ("Test.Field"); ProviderPoker p = new ProviderPoker (new object()); Assert.IsNull (se.ProvideValue (p)); }
public void ProvideValueWithoutType () { var x = new StaticExtension (); // it fails because it cannot be resolved to a static member. // This possibly mean, there might be a member that // could be resolved only with the name, without type. x.Member = "Foo"; x.ProvideValue (null); }
public void ProvideValueTest_IXamlTypeResolver_PrivateStaticProperty () { StaticExtension ne = new StaticExtension ("Test.Property"); ProviderPoker2 p = new ProviderPoker2 (typeof (PrivateStaticPropertyTest)); Assert.AreEqual (5, ne.ProvideValue (p)); }
public void ProvideValueTest_IXamlTypeResolver_Enum () { StaticExtension ne = new StaticExtension ("Test.Foo"); ProviderPoker2 p = new ProviderPoker2 (typeof (EnumTest)); Assert.AreEqual (EnumTest.Foo, ne.ProvideValue (p)); }
public void ProvideValueTest_IXamlTypeResolver_StaticField () { StaticExtension ne = new StaticExtension ("Test.Field"); ProviderPoker2 p = new ProviderPoker2 (typeof (StaticFieldTest)); Assert.AreEqual (5, ne.ProvideValue (p)); }
public void ProvideValueTest_IXamlTypeResolver_MissingField () { StaticExtension ne = new StaticExtension ("Test.Field2"); ProviderPoker2 p = new ProviderPoker2 (typeof (StaticFieldTest)); ne.ProvideValue (p); }
private object GetStaticExtensionValue(short memberId) { object valueObject = null; if (memberId < 0) { short keyId = (short)-memberId; // if keyId is more than the range it is the actual resource, else it is the key. if (keyId > (short)SystemResourceKeyID.InternalSystemThemeStylesEnd) { keyId -= (short)SystemResourceKeyID.InternalSystemThemeStylesEnd; valueObject = SystemResourceKey.GetResource(keyId); } else { valueObject = SystemResourceKey.GetResourceKey(keyId); } } else { BamlAttributeInfoRecord attribInfo = MapTable.GetAttributeInfoFromId(memberId); if (attribInfo != null) { StaticExtension se = new StaticExtension(); se.MemberType = MapTable.GetTypeFromId(attribInfo.OwnerTypeId); se.Member = attribInfo.Name; valueObject = se.ProvideValue(null); } } return valueObject; }
public override object ProvideValue(IServiceProvider serviceProvider) { return(ForView.Wrap(_inner.ProvideValue(serviceProvider))); }
public void ProvideValuePrivateConst () { var x = new StaticExtension (); x.MemberType = GetType (); x.Member = "FooBar"; // private const could not be resolved. Assert.AreEqual ("foobar", x.ProvideValue (null), "#1"); }
public void ProvideValueWithoutMember () { var x = new StaticExtension (); x.MemberType = typeof (int); x.ProvideValue (null); }
public void ProvideValueEvent () { var x = new StaticExtension (); x.MemberType = GetType (); x.Member = "FooEvent"; // private const could not be resolved. Assert.IsNotNull (x.ProvideValue (null), "#1"); }