public void AllTest() { IBussinesLogicEmployees iBLExternal = null; iBLExternal = (IBussinesLogicEmployees)CodeInjection.Create( new BussinesLogicEmployees(), typeof(IBussinesLogicEmployeesAll)); Employees dsE = null; dsE = iBLExternal.GetEmployees(BussinesLogicEmployees.Delegation.Madrid); Assert.IsNotNull(dsE); Assert.AreEqual(1, CountingCalls.Calls("GetEmployees")); try { dsE = iBLExternal.GetEmployees(BussinesLogicEmployees.Delegation.Paris); } catch { dsE = null; } Assert.IsNull(dsE); Assert.AreEqual(2, CountingCalls.Calls("GetEmployees")); dsE = iBLExternal.GetEmployees(BussinesLogicEmployees.Delegation.London); Assert.IsNotNull(dsE); Assert.AreEqual(3, CountingCalls.Calls("GetEmployees")); }
static void Main(string[] args) { //var x = new TempAssemblyInjection__ProxyIMyclassMyClassTest(new MyClassTest(), typeof(IMyclass)); ////x.MyClassTestInterface(); var my = (IMyclass)CodeInjection.Create(new MyClassTest(), typeof(IMyclass)); MethodInfo mf = my.GetType().GetMethod("MyClassTestInterface", new Type[0]); var str = mf.Invoke(my, null); Console.WriteLine(str); my.MyClassTestInterface(); //CodeInjection.InjectHandler(this.target, // Helper.GetMethodFromType(this.target.GetType(), MethodBase.GetCurrentMethod()), // parameters, // Helper.AspectUnion(Helper.GetMethodFromType(this.iface, MethodBase.GetCurrentMethod()).GetCustomAttributes(typeof(AspectAttribute), true))); Console.Read(); }