Beispiel #1
0
        private static void Method2ToBenchMark()
        {
            AssemblyOpCodeBuilder builder = new AssemblyOpCodeBuilder();
            MockClass mock = builder.BuildAssemblyFromType<MockClass>(typeof(MockClass), null);
            Decorator decorator = new ObjectDecorator(new ObjectInstantiator());
            decorator.Decorate<MockClass>(mock);

            double value = mock.GetZero();
        }
Beispiel #2
0
        private static void Method2ToBenchMark()
        {
            AssemblyOpCodeBuilder builder   = new AssemblyOpCodeBuilder();
            MockClass             mock      = builder.BuildAssemblyFromType <MockClass>(typeof(MockClass), null);
            Decorator             decorator = new ObjectDecorator(new ObjectInstantiator());

            decorator.Decorate <MockClass>(mock);

            double value = mock.GetZero();
        }
        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);
        }
Beispiel #4
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);
        }
Beispiel #5
0
        public void ShouldBuildInstanceFromExistingConcreteType()
        {
            MockObject actual = builder.BuildAssemblyFromType <MockObject>(typeof(MockObject), null);

            Assert.IsNotNull(actual);
        }