Esempio n. 1
0
        public void InterceptGenericMethods()
        {
            var simpleCalls        = new SimpleCalls();
            var proxiedSimpleCalls = BeginInvokeProxy <ISimpleCalls> .Create(simpleCalls, new NonRecursiveExecutionDispatcher());

            Assert.AreEqual(5, proxiedSimpleCalls.Repeate(5));
        }
Esempio n. 2
0
        public void InterceptMethodsThatRetuns()
        {
            var simpleCalls        = new SimpleCalls();
            var proxiedSimpleCalls = BeginInvokeProxy <ISimpleCalls> .Create(simpleCalls, new NonRecursiveExecutionDispatcher());

            Assert.IsTrue(proxiedSimpleCalls.Ask());
            Assert.IsTrue(simpleCalls.Called);
        }
Esempio n. 3
0
        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);
        }
Esempio n. 4
0
        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);
        }
Esempio n. 5
0
        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);
        }
Esempio n. 6
0
        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);
        }
Esempio n. 7
0
        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);
        }
Esempio n. 8
0
 public void Test_StartHere()
 {
     Implementation.LogOrError = Implementation.Log;
     SimpleCalls.FindBestSandwich(new ZipCode("90210"));
 }