Beispiel #1
0
 public HookRegistry(IAssemblyLoader assemblyLoader)
 {
     _targetLibAssembly = assemblyLoader.GetTargetLibAssembly();
     foreach (var type in _hooks.Keys)
     {
         AddHookOfType(type, assemblyLoader.GetMethods(type));
     }
 }
Beispiel #2
0
        public List <GaugeMethod> GetStepMethods()
        {
            var infos = _assemblyLoader.GetMethods("Gauge.CSharp.Lib.Attribute.Step");

            MethodMap = new Dictionary <string, MethodInfo>();
            foreach (var info in infos)
            {
                var methodId = info.FullyQuallifiedName();
                MethodMap.Add(methodId, info);
                LogManager.GetLogger("Sandbox").Debug("Scanned and caching Gauge Step: {0}, Recoverable: {1}", methodId, info.IsRecoverableStep());
            }
            return(MethodMap.Keys.Select(s =>
            {
                var method = MethodMap[s];
                return new GaugeMethod {
                    Name = s, ParameterCount = method.GetParameters().Length, ContinueOnFailure = method.IsRecoverableStep()
                };
            }).ToList());
        }
Beispiel #3
0
        public HookRegistry(IAssemblyLoader assemblyLoader)
        {
            _assemblyLoader = assemblyLoader;
            _hooks          = new Dictionary <LibType, HashSet <IHookMethod> >
            {
                { LibType.BeforeSuite, new HashSet <IHookMethod>() },
                { LibType.AfterSuite, new HashSet <IHookMethod>() },
                { LibType.BeforeSpec, new HashSet <IHookMethod>() },
                { LibType.AfterSpec, new HashSet <IHookMethod>() },
                { LibType.BeforeScenario, new HashSet <IHookMethod>() },
                { LibType.AfterScenario, new HashSet <IHookMethod>() },
                { LibType.BeforeStep, new HashSet <IHookMethod>() },
                { LibType.AfterStep, new HashSet <IHookMethod>() }
            };

            foreach (var type in _hooks.Keys)
            {
                AddHookOfType(type, assemblyLoader.GetMethods(type));
            }
        }
Beispiel #4
0
        public HookRegistry(IAssemblyLoader assemblyLoader)
        {
            _hooks = new Dictionary <string, HashSet <IHookMethod> >
            {
                { "BeforeSuite", new HashSet <IHookMethod>() },
                { "AfterSuite", new HashSet <IHookMethod>() },
                { "BeforeSpec", new HashSet <IHookMethod>() },
                { "AfterSpec", new HashSet <IHookMethod>() },
                { "BeforeScenario", new HashSet <IHookMethod>() },
                { "AfterScenario", new HashSet <IHookMethod>() },
                { "BeforeStep", new HashSet <IHookMethod>() },
                { "AfterStep", new HashSet <IHookMethod>() }
            };

            _targetLibAssembly = assemblyLoader.GetTargetLibAssembly();
            foreach (var type in _hooks.Keys)
            {
                AddHookOfType(type, assemblyLoader.GetMethods(string.Format("Gauge.CSharp.Lib.Attribute.{0}", type)));
            }
        }
        public HookRegistry(IAssemblyLoader assemblyLoader)
        {
            /* Must use equality by full name because hook types (e.g. BeforeSuite) registered from sandbox side
             * MAY have different version than one in runner's domain.
             * Then trying to get key for BeforeSuite version 0.5.3 from runner will thrown key not found,
             * because HashSet was added for BeforeSuite version 0.5.1
             */
            _hooks = new Dictionary <Type, HashSet <HookMethod> > (new TypeEqualityComparerByFullName());
            _hooks.Add(typeof(BeforeSuite), new HashSet <HookMethod> ());
            _hooks.Add(typeof(AfterSuite), new HashSet <HookMethod>());
            _hooks.Add(typeof(BeforeSpec), new HashSet <HookMethod>());
            _hooks.Add(typeof(AfterSpec), new HashSet <HookMethod> ());
            _hooks.Add(typeof(BeforeScenario), new HashSet <HookMethod> ());
            _hooks.Add(typeof(AfterScenario), new HashSet <HookMethod> ());
            _hooks.Add(typeof(BeforeStep), new HashSet <HookMethod> ());
            _hooks.Add(typeof(AfterStep), new HashSet <HookMethod> ());

            _targetLibAssembly = assemblyLoader.GetTargetLibAssembly();
            foreach (var type in _hooks.Keys)
            {
                AddHookOfType(type, assemblyLoader.GetMethods(type));
            }
        }
Beispiel #6
0
 public List <MethodInfo> GetStepMethods()
 {
     return(_assemblyLoader.GetMethods(typeof(Step)));
 }