예제 #1
0
        public void ShouldSetSelfWhenDecorating()
        {
            var targetObj = new TargetObjImpl();

            var proxy = (TargetObjImpl)classUnderTest.Decorate(typeof(TargetObjImpl), targetObj);

            Assert.AreSame(targetObj.Self, proxy);
        }
        public void DecorateInterface()
        {
            ISelfType targetObj = new TargetObjImpl();
            var       proxy     = decorator.Decorate(targetObj);

            Assert.That(proxy, Is.SameAs(((TargetObjImpl)targetObj).Self));
            Assert.That(1, Is.EqualTo(proxy.DoSomething()));
            Assert.That(1, Is.EqualTo(countAspect.CallCount));
        }
        public void DecorateClass()
        {
            var targetObj = new TargetObjImpl();
            var proxy     = decorator.Decorate(targetObj);

            Assert.That(proxy, Is.SameAs(targetObj.Self));
            Assert.That(1, Is.EqualTo(proxy.DoSomething()));
            Assert.That(1, Is.EqualTo(countAspect.CallCount));
        }