コード例 #1
0
        public void ShouldImplementPropertiesAndDecorateThem()
        {
            MockInjectable actual    = builder.BuildAssemblyFromType <MockInjectable>(typeof(MockInjectable), null);
            Decorator      decorator = new ObjectDecorator(new ObjectInstantiator());

            decorator.Decorate <MockInjectable>(actual);
            Assert.IsNotNull(actual.Earth);
        }
コード例 #2
0
        public void DecoratePropertyTest()
        {
            AssemblyOpCodeBuilder builder   = new AssemblyOpCodeBuilder();
            MockInjectable        mock      = builder.BuildAssemblyFromType <MockInjectable>(typeof(MockInjectable), null);
            Decorator             decorator = new ObjectDecorator(new ObjectInstantiator());

            decorator.Decorate <MockInjectable>(mock);

            Assert.IsNotNull(mock.Fire);
            Assert.IsTrue(mock.Fire is Fire);

            Assert.IsNotNull(mock.Water);
            Assert.IsTrue(mock.Water is Water);

            Assert.IsNotNull(mock.Earth);
            Assert.IsTrue(mock.Earth is Earth);
        }