Exemple #1
0
        public void ShouldBeReallyReallyFast()
        {
            IFoo original = new Blah();

            var foo = original;
            using (Time.This)
                for (int i = 0; i < 1000000L; i++) { foo.Junk(); }

            foo = generator.GenerateProxy(foo);
            using (Time.This)
                for (int i = 0; i < 1000000L; i++) { foo.Junk(); }

            foo = generator.GenerateProxy(foo, new DoNothingInterceptor());
            using (Time.This)
                for (int i = 0; i < 1000000L; i++) { foo.Junk(); }

            foo = generator.GenerateProxy(foo, new DoNothingInterceptor(), new DoNothingInterceptor());
            using (Time.This)
                for (int i = 0; i < 1000000L; i++) { foo.Junk(); }
        }
Exemple #2
0
        public void ShouldStoreBackingObjectAndInterceptors()
        {
            var backingObject = new Blah();
            var blah = generator.GenerateProxy<IFoo>(backingObject);

            var backing = blah.GetType().GetField("backingObject");
            backing.GetValue(blah).ShouldBe(backingObject);
        }