Beispiel #1
0
        public void RegisterHandler_Generic_Test()
        {
            object parameterObject = new object();
            bool   handlerExecuted = false;
            var    handler         = new Action <object>(o => { handlerExecuted = o == parameterObject; });

            testObj.RegisterHandler(handler);

            var captor = new ArgumentCaptor <Action <object> >();

            Verify(handlersByType).TryAdd(Eq(typeof(object)), captor.GetParameter());
            VerifyNoMoreInteractions();

            AssertFalse(handlerExecuted);
            captor.Value(parameterObject);
            AssertTrue(handlerExecuted);
        }