BananaHook.Specs.describe_ReflectionDetourNotifier.when_the_hook_is_called C# (CSharp) Метод

when_the_hook_is_called() приватный Метод

private when_the_hook_is_called ( ) : void
Результат void
        void when_the_hook_is_called()
        {
            before = () =>
            {
                _notifier = new ReflectionDetourNotifier(HookFactory, _subject.Managed);
                _notifier.Hook.Apply();
            };

            act = () => _result = _subject.Managed(2.0);

            context["and the return value is modified in an event handler"] = () =>
            {
                before = () => _notifier.DetourCalled += (s, e) => e.ReturnValue = ExpectedValue;

                it["should return the modified value"] = () => _result.should_be(ExpectedValue);
                it["should call the original"] = () => _subject.WasManagedCalled.should_be_true();
            };

            context["and the original shall not be called"] = () =>
            {
                before = () => _notifier.DetourCalled += (s, e) =>
                {
                    e.CallOriginal = false;
                    e.ReturnValue = ExpectedValue;
                };

                it["should not call the original"] = () => _subject.WasManagedCalled.should_be_false();
            };

            after = () => _notifier.Dispose();
        }