本文整理汇总了C#中Class2.SetValue方法的典型用法代码示例。如果您正苦于以下问题:C# Class2.SetValue方法的具体用法?C# Class2.SetValue怎么用?C# Class2.SetValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Class2
的用法示例。
在下文中一共展示了Class2.SetValue方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Attached_Property_Should_Be_Validated
public void Attached_Property_Should_Be_Validated()
{
var target = new Class2();
target.SetValue(Class1.AttachedProperty, 15);
Assert.Equal(10, target.GetValue(Class1.AttachedProperty));
}
示例2: SetValue_Can_Convert_To_Nullable
public void SetValue_Can_Convert_To_Nullable()
{
Class2 target = new Class2();
target.SetValue((PerspexProperty)Class2.FredProperty, 4.0);
var value = target.GetValue(Class2.FredProperty);
Assert.IsType<double>(value);
Assert.Equal(4, value);
}
示例3: GetObservable_Returns_Property_Change_Only_For_Correct_Property
public void GetObservable_Returns_Property_Change_Only_For_Correct_Property()
{
Class2 target = new Class2();
bool raised = false;
target.GetObservable(Class1.FooProperty).Subscribe(x => raised = true);
raised = false;
target.SetValue(Class2.BarProperty, "newvalue");
Assert.False(raised);
}
示例4: Setting_InheritanceParent_Doesnt_Raise_PropertyChanged_When_Local_Value_Set
public void Setting_InheritanceParent_Doesnt_Raise_PropertyChanged_When_Local_Value_Set()
{
bool raised = false;
Class1 parent = new Class1();
parent.SetValue(Class1.BazProperty, "changed");
Class2 child = new Class2();
child.SetValue(Class1.BazProperty, "localvalue");
child.PropertyChanged += (s, e) => raised = true;
child.Parent = parent;
Assert.False(raised);
}
示例5: SetValue_Sets_Value_On_AddOwnered_Property_Using_Original_NonGeneric
public void SetValue_Sets_Value_On_AddOwnered_Property_Using_Original_NonGeneric()
{
var target = new Class2();
target.SetValue((PerspexProperty)Class1.FooProperty, "newvalue");
Assert.Equal("newvalue", target.Foo);
}
示例6: SetValue_On_Unregistered_Property_Throws_Exception
public void SetValue_On_Unregistered_Property_Throws_Exception()
{
var target = new Class2();
Assert.Throws<ArgumentException>(() => target.SetValue(Class1.BarProperty, "value"));
}
示例7: UnsetValue_Is_Used_On_AddOwnered_Property
public void UnsetValue_Is_Used_On_AddOwnered_Property()
{
var target = new Class2();
target.SetValue((AvaloniaProperty)Class1.FooProperty, AvaloniaProperty.UnsetValue);
Assert.Equal("unset", target.Foo);
}
示例8: Validation_Can_Be_Overridden
public void Validation_Can_Be_Overridden()
{
var target = new Class2();
Assert.Throws<ArgumentOutOfRangeException>(() => target.SetValue(Class1.QuxProperty, 5));
}