当前位置: 首页>>代码示例>>C#>>正文


C# Class1.GetValue方法代码示例

本文整理汇总了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));
        }
开发者ID:Robertofon,项目名称:Perspex,代码行数:11,代码来源:PerspexObjectTests_Validation.cs

示例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));
        }
开发者ID:,项目名称:,代码行数:8,代码来源:

示例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));
        }
开发者ID:Robertofon,项目名称:Perspex,代码行数:8,代码来源:PerspexObjectTests_Validation.cs

示例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));
        }
开发者ID:,项目名称:,代码行数:9,代码来源:

示例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);
        }
开发者ID:Robertofon,项目名称:Perspex,代码行数:9,代码来源:PerspexObjectTests_Validation.cs

示例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));
        }
开发者ID:Robertofon,项目名称:Perspex,代码行数:9,代码来源:PerspexObjectTests_SetValue.cs

示例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));
        }
开发者ID:CarlSosaDev,项目名称:Avalonia,代码行数:11,代码来源:AvaloniaObjectTests_Direct.cs

示例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));
        }
开发者ID:,项目名称:,代码行数:11,代码来源:

示例9: GetValue_Gets_Value_NonGeneric

        public void GetValue_Gets_Value_NonGeneric()
        {
            var target = new Class1();

            Assert.Equal("initial", target.GetValue((PerspexProperty)Class1.FooProperty));
        }
开发者ID:rdterner,项目名称:Perspex,代码行数:6,代码来源:PerspexObjectTests_Direct.cs

示例10: GetValue_Gets_Value

        public void GetValue_Gets_Value()
        {
            var target = new Class1();

            Assert.Equal("initial", target.GetValue(Class1.FooProperty));
        }
开发者ID:rdterner,项目名称:Perspex,代码行数:6,代码来源:PerspexObjectTests_Direct.cs

示例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));
        }
开发者ID:jkoritzinsky,项目名称:Avalonia,代码行数:11,代码来源:AvaloniaObjectTests_Direct.cs

示例12: GetValue_Returns_Default_Value

        public void GetValue_Returns_Default_Value()
        {
            Class1 target = new Class1();

            Assert.Equal("foodefault", target.GetValue(Class1.FooProperty));
        }
开发者ID:KvanTTT,项目名称:Perspex,代码行数:6,代码来源:PerspexObjectTests_GetValue.cs


注:本文中的Class1.GetValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。