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


C# Binder.BindTo方法代码示例

本文整理汇总了C#中Binder.BindTo方法的典型用法代码示例。如果您正苦于以下问题:C# Binder.BindTo方法的具体用法?C# Binder.BindTo怎么用?C# Binder.BindTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Binder的用法示例。


在下文中一共展示了Binder.BindTo方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: can_bind_property_to_A_using_different_name_from_attribute

        public void can_bind_property_to_A_using_different_name_from_attribute()
        {
            var binder = new Binder<A>();
            var pairs = new KeyValuePair<string, string>[]{
                new KeyValuePair<string,string>("AnIntegerV2","4")
            };

            var a = binder.BindTo(pairs);

            Assert.AreEqual(4, a.AStringCustoName);
        }
开发者ID:vilhena,项目名称:PROMPT11-01-VMEssentials.vilhena,代码行数:11,代码来源:Problem2.cs

示例2: can_bind_to_int_and_string_prop_and_field_of_A

        public void can_bind_to_int_and_string_prop_and_field_of_A()
        {
            var binder = new Binder();
            var pairs = new KeyValuePair<string, string>[]
                {
                    new KeyValuePair<string, string>("AnInteger","2"),
                    new KeyValuePair<string, string>("AString","abc")
                };
            var a = binder.BindTo<A>(pairs);

            Assert.AreEqual(2, a.AnInteger);
            Assert.AreEqual("abc", a.AString);
        }
开发者ID:cmfaustino,项目名称:Prompt11-01-VMEssentials.cmfaustino,代码行数:13,代码来源:BinderTests.cs

示例3: can_bind_property_to_A_using_attribute

        public void can_bind_property_to_A_using_attribute()
        {
            var binder = new Binder<A>();
            var pairs = new KeyValuePair<string, string>[]{
                new KeyValuePair<string,string>("AnInteger","2"),
            new KeyValuePair<string,string>("AString","abc")
            };

            var a = binder.BindTo(pairs);

            Assert.AreEqual(2, a.AnInteger);
            Assert.AreEqual("abc", a.AString);
        }
开发者ID:vilhena,项目名称:PROMPT11-01-VMEssentials.vilhena,代码行数:13,代码来源:Problem2.cs

示例4: test

        public void test()
        {
            var binder = new Binder();
            var pairs = new KeyValuePair<string, string>[]
                            {
                                new KeyValuePair<string, string>("AnInteger", "2"),
                                new KeyValuePair<string, string>("AString", "abc"),
                                new KeyValuePair<string, string>("APoint", "1,2"), 
                            };

            var exc = Assert.Throws<InvalidMemberTypeException>(() => binder.BindTo<B>(pairs));
            Assert.AreEqual(typeof(B).GetField("APoint"), exc.MemberInfo);
        }
开发者ID:luismdcp,项目名称:PROMPT11-01-VMEssentials.luismdcp,代码行数:13,代码来源:Class1.cs

示例5: can_bind_to_A

        public void can_bind_to_A()
        {
            var binder = new Binder();
            var pairs = new KeyValuePair<string, string>[]
            {
                new KeyValuePair<string,string> ("AnInteger", "2"),
                new KeyValuePair<string, string>("AString","123")
            };
            var a = binder.BindTo<A>(pairs);

            Assert.AreEqual(2, a.AnInteger);
            Assert.AreEqual("123", a.AString);
        }
开发者ID:sandrapatfer,项目名称:PROMPT11-01-VMEssentials.sandrapatfer,代码行数:13,代码来源:BindingTests.cs

示例6: when_member_has_invalid_type_then_BindTo_throws

 public void when_member_has_invalid_type_then_BindTo_throws()
 {
     var binder = new Binder();
     var pairs = new KeyValuePair<string, string>[]
         {
             new KeyValuePair<string, string>("AnInteger","2"),
             new KeyValuePair<string, string>("AString","abc"),
             new KeyValuePair<string, string>("APoint","1,2")
         };
     var exc = Assert.Throws<InvalidMemberTypeException>(() =>
         binder.BindTo<B>(pairs)
     );
     Assert.AreEqual(typeof(B).GetProperty("APoint"),exc.MemberInfo);
 }
开发者ID:cmfaustino,项目名称:Prompt11-01-VMEssentials.cmfaustino,代码行数:14,代码来源:BinderTests.cs

示例7: cand_bind_only_to_bindable_fields_or_properties_that_are_required

        public void cand_bind_only_to_bindable_fields_or_properties_that_are_required()
        {
            var binder = new Binder();
            var pairs = new KeyValuePair<string, string>[]
                            {
                                new KeyValuePair<string, string>("AnInteger", "2"),
                                new KeyValuePair<string, string>("AString", "abc")
                            };

            var a = binder.BindTo<C>(pairs);

            Assert.AreEqual(default(Int32), a.AnInteger);
            Assert.AreEqual(default(String), a.AString);
        }
开发者ID:luismdcp,项目名称:PROMPT11-01-VMEssentials.luismdcp,代码行数:14,代码来源:Class1.cs


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