예제 #1
0
        public void WhenAddingProxyBehavior_ThenCanAddLambda()
        {
            var proxy = new TestProxy();

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

            Assert.Equal(1, proxy.Behaviors.Count);
        }
예제 #2
0
        public void WhenAddingProxyBehaviorToObject_ThenCanAddInterface()
        {
            object proxy = new TestProxy();

            proxy.AddProxyBehavior(new TestProxyBehavior());

            Assert.Equal(1, ((IProxy)proxy).Behaviors.Count);
        }
예제 #3
0
        public void WhenAddingProxyBehaviorToObject_ThenCanAddLambda()
        {
            object proxy = new TestProxy();

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

            Assert.Equal(1, ((IProxy)proxy).Behaviors.Count);
        }
예제 #4
0
        public void WhenAddingProxyBehavior_ThenCanAddInterface()
        {
            var proxy = new TestProxy();

            proxy.AddProxyBehavior(new TestProxyBehavior());

            Assert.Equal(1, proxy.Behaviors.Count);
        }
예제 #5
0
        public void WhenInsertingProxyBehaviorToObject_ThenCanAddLambda()
        {
            object proxy = new TestProxy();

            proxy.AddProxyBehavior((m, n) => null);
            proxy.InsertProxyBehavior(0, (m, n) => throw new NotImplementedException());

            Assert.Equal(2, ((IProxy)proxy).Behaviors.Count);
            Assert.Throws <NotImplementedException>(() => ((IProxy)proxy).Behaviors[0].Invoke(null, null));
        }
예제 #6
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]);
        }