Exemple #1
0
        public static IExecuteTestStep FindStep(ITestInjector injector, TestStep testStep, IEnumerable <Assembly> assemblies)
        {
            int behaveStepId = 0;

            var matchString = testStep.Description.StartsWith("GUI - ")
                ? testStep.Description.Substring("GUI - ".Length)
                : testStep.Description;

            foreach (var assembly in assemblies)
            {
                var types = assembly.GetTypes().Where(x => x.IsClass && TypeHasMatchingAttribute(x, matchString, ref behaveStepId));
                var type  = types.FirstOrDefault();

                if (type == null)
                {
                    continue;
                }

                var instance = Activator.CreateInstance(type, injector);
                if (instance is BaseExecuteTestStep)
                {
                    ((BaseExecuteTestStep)instance).BehaveStepId = behaveStepId;
                }

                return((IExecuteTestStep)instance);
            }

            throw new NotImplementedException($"Can not find step '{matchString}'");
        }
 public TestStepFactory(ITestInjector di)
 {
     _injector = di;
 }
Exemple #3
0
 public void RegisterTests(ITestInjector injector)
 {
     injector.RegisterTest <StegMedTestDataComment>(131353);
 }