示例#1
0
        public void WhenInsertingProxyBehavior_ThenCanAddInterface()
        {
            var proxy    = new TestProxy();
            var behavior = new TestProxyBehavior();

            proxy.AddBehavior((m, n) => null);
            proxy.InsertBehavior(0, behavior);

            Assert.Equal(2, proxy.Behaviors.Count);
            Assert.Same(behavior, proxy.Behaviors[0]);
        }
示例#2
0
        public void WhenInsertingProxyBehaviorToObject_ThenCanAddInterface()
        {
            object proxy    = new TestProxy();
            var    behavior = new TestProxyBehavior();

            proxy.AddProxyBehavior((m, n) => null);
            proxy.InsertProxyBehavior(0, behavior);

            Assert.Equal(2, ((IProxy)proxy).Behaviors.Count);
            Assert.Same(behavior, ((IProxy)proxy).Behaviors[0]);
        }