本文整理汇总了C#中Class1.GetValue方法的典型用法代码示例。如果您正苦于以下问题:C# Class1.GetValue方法的具体用法?C# Class1.GetValue怎么用?C# Class1.GetValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Class1
的用法示例。
在下文中一共展示了Class1.GetValue方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetValue_Causes_Coercion
public void SetValue_Causes_Coercion()
{
var target = new Class1();
target.SetValue(Class1.QuxProperty, 5);
Assert.Equal(5, target.GetValue(Class1.QuxProperty));
target.SetValue(Class1.QuxProperty, -5);
Assert.Equal(0, target.GetValue(Class1.QuxProperty));
target.SetValue(Class1.QuxProperty, 15);
Assert.Equal(10, target.GetValue(Class1.QuxProperty));
}
示例2: SetValue_Sets_Value
public void SetValue_Sets_Value()
{
Class1 target = new Class1();
target.SetValue(Class1.FooProperty, "newvalue");
Assert.Equal("newvalue", target.GetValue(Class1.FooProperty));
}
示例3: SetValue_Causes_Validation
public void SetValue_Causes_Validation()
{
var target = new Class1();
target.SetValue(Class1.QuxProperty, 5);
Assert.Throws<ArgumentOutOfRangeException>(() => target.SetValue(Class1.QuxProperty, 25));
Assert.Equal(5, target.GetValue(Class1.QuxProperty));
}
示例4: ClearValue_Clears_Value
public void ClearValue_Clears_Value()
{
Class1 target = new Class1();
target.SetValue(Class1.FooProperty, "newvalue");
target.ClearValue(Class1.FooProperty);
Assert.Equal("foodefault", target.GetValue(Class1.FooProperty));
}
示例5: Revalidate_Causes_Recoercion
public void Revalidate_Causes_Recoercion()
{
var target = new Class1();
target.SetValue(Class1.QuxProperty, 7);
Assert.Equal(7, target.GetValue(Class1.QuxProperty));
target.MaxQux = 5;
target.Revalidate(Class1.QuxProperty);
}
示例6: Setting_UnsetValue_Reverts_To_Default_Value
public void Setting_UnsetValue_Reverts_To_Default_Value()
{
Class1 target = new Class1();
target.SetValue(Class1.FooProperty, "newvalue");
target.SetValue(Class1.FooProperty, PerspexProperty.UnsetValue);
Assert.Equal("foodefault", target.GetValue(Class1.FooProperty));
}
示例7: BindingError_With_FallbackValue_Causes_Target_Update
public void BindingError_With_FallbackValue_Causes_Target_Update()
{
var target = new Class1();
var source = new Subject<object>();
target.Bind(Class1.FooProperty, source);
source.OnNext("initial");
source.OnNext(new BindingError(new InvalidOperationException("Foo"), "fallback"));
Assert.Equal("fallback", target.GetValue(Class1.FooProperty));
}
示例8: SetValue_Respects_Priority
public void SetValue_Respects_Priority()
{
Class1 target = new Class1();
target.SetValue(Class1.FooProperty, "one", BindingPriority.TemplatedParent);
Assert.Equal("one", target.GetValue(Class1.FooProperty));
target.SetValue(Class1.FooProperty, "two", BindingPriority.Style);
Assert.Equal("one", target.GetValue(Class1.FooProperty));
target.SetValue(Class1.FooProperty, "three", BindingPriority.StyleTrigger);
Assert.Equal("three", target.GetValue(Class1.FooProperty));
}
示例9: GetValue_Gets_Value_NonGeneric
public void GetValue_Gets_Value_NonGeneric()
{
var target = new Class1();
Assert.Equal("initial", target.GetValue((PerspexProperty)Class1.FooProperty));
}
示例10: GetValue_Gets_Value
public void GetValue_Gets_Value()
{
var target = new Class1();
Assert.Equal("initial", target.GetValue(Class1.FooProperty));
}
示例11: BindingError_Does_Not_Cause_Target_Update
public void BindingError_Does_Not_Cause_Target_Update()
{
var target = new Class1();
var source = new Subject<object>();
target.Bind(Class1.FooProperty, source);
source.OnNext("initial");
source.OnNext(new BindingNotification(new InvalidOperationException("Foo"), BindingErrorType.Error));
Assert.Equal("initial", target.GetValue(Class1.FooProperty));
}
示例12: GetValue_Returns_Default_Value
public void GetValue_Returns_Default_Value()
{
Class1 target = new Class1();
Assert.Equal("foodefault", target.GetValue(Class1.FooProperty));
}