public void InterceptGenericMethods() { var simpleCalls = new SimpleCalls(); var proxiedSimpleCalls = BeginInvokeProxy <ISimpleCalls> .Create(simpleCalls, new NonRecursiveExecutionDispatcher()); Assert.AreEqual(5, proxiedSimpleCalls.Repeate(5)); }
public void InterceptMethodsThatRetuns() { var simpleCalls = new SimpleCalls(); var proxiedSimpleCalls = BeginInvokeProxy <ISimpleCalls> .Create(simpleCalls, new NonRecursiveExecutionDispatcher()); Assert.IsTrue(proxiedSimpleCalls.Ask()); Assert.IsTrue(simpleCalls.Called); }
public void OutParameterAreHandled() { var simpleCalls = new SimpleCalls(); var proxiedSimpleCalls = BeginInvokeProxy <ISimpleCalls> .Create(simpleCalls, new NonRecursiveExecutionDispatcher()); int expect5; proxiedSimpleCalls.Assign5(out expect5); Assert.AreEqual(5, expect5); }
public void PropertyIshandled() { var simpleCalls = new SimpleCalls(); var proxiedSimpleCalls = BeginInvokeProxy <ISimpleCalls> .Create(simpleCalls, new NonRecursiveExecutionDispatcher()); proxiedSimpleCalls.SomeProperty = 5; Assert.AreEqual(5, simpleCalls.SomeProperty); Assert.AreEqual(5, proxiedSimpleCalls.SomeProperty); }
public void OutParameterMixedWithOtherInGenericMethodAreHandled() { var simpleCalls = new SimpleCalls(); var proxiedSimpleCalls = BeginInvokeProxy <ISimpleCalls> .Create(simpleCalls, new NonRecursiveExecutionDispatcher()); string assigned; bool toInvert = false; var firstVal = "55"; proxiedSimpleCalls.AssignWithFirstVal(out assigned, ref toInvert, firstVal); Assert.AreEqual("55", assigned); Assert.AreEqual("55", firstVal); Assert.IsTrue(toInvert); }
public void ExceptionOnNonVoidIsRethrown() { var simpleCalls = new SimpleCalls(); var proxiedSimpleCalls = BeginInvokeProxy <ISimpleCalls> .Create(simpleCalls, new NonRecursiveExecutionDispatcher()); try { proxiedSimpleCalls.ThowOnFunc(); Assert.Fail(); } catch (Exception e) { Assert.IsInstanceOf <NotImplementedException>(e); } Assert.IsTrue(simpleCalls.Called); }
public void ExceptionOnVoidIsIgnored() { var simpleCalls = new SimpleCalls(); var executionQueue = new QueuedExecutionDispatcher(); var proxiedSimpleCalls = BeginInvokeProxy <ISimpleCalls> .Create(simpleCalls, executionQueue); proxiedSimpleCalls.ThowOnVoid(); try { executionQueue.ExecuteAll(); Assert.Fail(); } catch (Exception e) { Assert.IsNotNull(e); } Assert.IsTrue(simpleCalls.Called); }
public void Test_StartHere() { Implementation.LogOrError = Implementation.Log; SimpleCalls.FindBestSandwich(new ZipCode("90210")); }