Пример #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]);
        }