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


C# Class2.SetValue方法代码示例

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

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

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

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

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

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

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

示例8: Validation_Can_Be_Overridden

 public void Validation_Can_Be_Overridden()
 {
     var target = new Class2();
     Assert.Throws<ArgumentOutOfRangeException>(() => target.SetValue(Class1.QuxProperty, 5));
 }
开发者ID:Robertofon,项目名称:Perspex,代码行数:5,代码来源:PerspexObjectTests_Validation.cs


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