コード例 #1
0
        public void TestUsingOnlySources()
        {
            IBusinessObject obj = new BusinessObject();
            BindingPairHolder bindingPairHolder = new BindingPairHolder();

            using (BindingScope scope = new BindingScope(bindingPairHolder))
            {
                IBusinessObject source = scope.CreateSource(obj);

                Assert.IsNull(bindingPairHolder.ConsumeBindingPair());

                string name = source.Name;

                BindingPair pair = bindingPairHolder.ConsumeBindingPair();
                Assert.IsNotNull(pair);
                Assert.AreEqual(obj, pair.Object);
                Assert.AreEqual("Name", pair.Member);

                short number = source.ShortValue;

                BindingPair anotherPair = bindingPairHolder.ConsumeBindingPair();
                Assert.IsNotNull(anotherPair);
                Assert.AreEqual(obj, anotherPair.Object);
                Assert.AreEqual("ShortValue", anotherPair.Member);
            }
        }
コード例 #2
0
ファイル: AbstractBinding.cs プロジェクト: havard/strongbind
 /// <summary>
 /// Constructs a new abstract binding.
 /// </summary>
 /// <param name="bindingPairHolder">The binding pair holder to use for the binding.</param>
 protected AbstractBinding(BindingPairHolder bindingPairHolder)
 {
     this.bindingPairHolder = bindingPairHolder;
 }
コード例 #3
0
 public DynamicProxyInterceptor(IBindingScope scope, object original, BindingPairHolder bindingPairHolder)
 {
     this.scope = scope;
     proxied = original;
     this.bindingPairHolder = bindingPairHolder;
 }