Example #1
0
 public void CreateAndVerifyIProxyInterfaceImplementation()
 {
     this.Initialize();
     var simple = new SimpleClass().CreateProxy(
         new ProxyContext(AssemblyBuilderAccess.RunAndSave, true, false), this);
     Assert.True(typeof(IProxy<SimpleClass>).IsAssignableFrom(simple.GetType()));
     Assert.NotNull((simple as IProxy<SimpleClass>).Target);
 }
        public void CreateWithDefaultContext()
        {
            this.Initialize();
            var simple = new SimpleClass().CreateProxy(this);
            simple.Hook();
            simple.DoNotHook();
            simple.Hook();

            var hooks = this.Counts["Hook"];
            Assert.Equal(2, hooks.BeforeCount);
            Assert.Equal(2, hooks.AfterCount);
            Assert.Equal(0, hooks.AfterExceptionCount);
        }