Exemple #1
0
        public void MockObjCanHandleGetEventSubscribersCallsWithoutEventsRegistered()
        {
            WithParameters withParameters = MockRepository.GenerateStrictMock <WithParameters>(1);
            IMockedObject  mocked         = (IMockedObject)withParameters;

            Delegate eventSubscribers = mocked.GetEventSubscribers("ff");

            Assert.Null(eventSubscribers);
        }
        /// <summary>
        /// Raise the event
        /// </summary>
        public void Raise(params object[] args)
        {
            Delegate subscribed = proxy.GetEventSubscribers(eventName);

            if (subscribed != null)
            {
                AssertMatchingParameters(subscribed.Method, args);
                try
                {
                    subscribed.DynamicInvoke(args);
                }
                catch (TargetInvocationException e)
                {
                    PreserveStackTrace(e.InnerException);
                    throw e.InnerException;
                }
            }
        }