Exemplo n.º 1
0
 private static bool DispatcherCallOriginal(
     MethodAccess methodAccess,
     object instance,
     params object[] args)
 {
     m_DispatcherCalls.Add(methodAccess);
     methodAccess.CallOriginal(instance, args);
     return(false);
 }
Exemplo n.º 2
0
        private void OriginalIsCalledOnInvoke()
        {
            // Register sync handler
            A instance = new A();

            Assert.Equal(0, instance.NumberOfCalls);
            int iNumberOfHandlerCalls = 0;

            m_SyncedMethod.SetHandler(instance, args => { ++iNumberOfHandlerCalls; });

            // Call the original
            int iExpectedValue = 42;

            m_SyncedMethod.CallOriginal(instance, new object[] { iExpectedValue });
            Assert.Equal(0, iNumberOfHandlerCalls);
            Assert.Equal(1, instance.NumberOfCalls);
            Assert.Equal(iExpectedValue, instance.LatestArgument);
        }