Exemplo n.º 1
0
 public void Should_find_hook(Type typeOfHook)
 {
     var hooksCatalog = new HooksCatalog();
     var h = new HooksParser(hooksCatalog);
     h.FindHooks(GetType());
     Assert.IsTrue(hooksCatalog.OfType(typeOfHook).Any());
 }
Exemplo n.º 2
0
 public void Should_find_hook_in_nested_class(Type typeOfHook)
 {
     var c = new HooksCatalog();
     var p = new HooksParser(c);
     p.FindHooks(typeof(When_running_hooks_with_tag_filter.When_matching_tag_for_RunIfHasTags));
     Assert.IsTrue(c.OfType(typeOfHook).Any());
 }
Exemplo n.º 3
0
        public void Initialise()
        {
            var parser = new HooksParser(_hooks);

            foreach (var assembly in _configuration.Assemblies)
                parser.FindHooks(Assembly.LoadFrom(assembly));
        }
Exemplo n.º 4
0
            public void Should_find_hook_in_nested_class(Type typeOfHook)
            {
                var c = new HooksCatalog();
                var p = new HooksParser(c);

                p.FindHooks(typeof(When_running_hooks_with_tag_filter.When_matching_tag_for_RunIfHasTags));
                Assert.IsTrue(c.OfType(typeOfHook).Any());
            }
Exemplo n.º 5
0
            public void Should_find_hook(Type typeOfHook)
            {
                var hooksCatalog = new HooksCatalog();
                var h            = new HooksParser(hooksCatalog);

                h.FindHooks(GetType());
                Assert.IsTrue(hooksCatalog.OfType(typeOfHook).Any());
            }
Exemplo n.º 6
0
        public void Initialise()
        {
            var parser = new HooksParser(_hooks);

            foreach (var assembly in _configuration.Assemblies)
            {
                parser.FindHooks(Assembly.LoadFrom(assembly));
            }
        }
Exemplo n.º 7
0
 public void Should_find_hook_on_private_Action_delegate()
 {
     var c = new HooksCatalog();
     var p = new HooksParser(c);
     PrivateDelegateHookCalled = false;
     p.FindHooks(GetType());
     var hooks = c.OfType<BeforeRunAttribute>().ToList();
     hooks.Each(_ => _.Invoke());
     Assert.IsTrue(PrivateDelegateHookCalled);
 }
Exemplo n.º 8
0
            public void Should_find_hook_on_private_Action_delegate()
            {
                var c = new HooksCatalog();
                var p = new HooksParser(c);

                PrivateDelegateHookCalled = false;
                p.FindHooks(GetType());
                var hooks = c.OfType <BeforeRunAttribute>().ToList();

                hooks.Each(_ => _.Invoke());
                Assert.IsTrue(PrivateDelegateHookCalled);
            }
Exemplo n.º 9
0
            public void Init()
            {
                var catalog = new HooksCatalog();
                var loader  = new HooksParser(catalog);

                loader.FindHooks(GetType());

                var handler = new HooksHandler(catalog);

                context = MockRepository.GenerateStub <IRunContextEvents>();
                handler.SubscribeToHubEvents(context);

                SetupContextTags();
            }
Exemplo n.º 10
0
            public void Init()
            {
                var catalog = new HooksCatalog();
                var loader = new HooksParser(catalog);
                loader.FindHooks(GetType());

                var handler = new HooksHandler(catalog);
                context = MockRepository.GenerateStub<IRunContextEvents>();
                handler.SubscribeToHubEvents(context);

                SetupContextTags();
            }
Exemplo n.º 11
0
        private void SetupHooks()
        {
            var h = new HooksParser(hooksCatalog);

            h.FindHooks(GetTypeByCallStack());
        }