public StepArgumentTypeConverter(ITestTracer testTracer, IBindingRegistry bindingRegistry, IContextManager contextManager, IBindingInvoker bindingInvoker)
 {
     this.testTracer = testTracer;
     this.bindingRegistry = bindingRegistry;
     this.contextManager = contextManager;
     this.bindingInvoker = bindingInvoker;
 }
 public AzureServiceBusReceiveMessages(
     IAzureReceiveMessageChain azureReceiveMessageChain, 
     IContextManager contextManager)
 {
     _azureReceiveMessageChain = azureReceiveMessageChain;
     this._contextManager = contextManager;
 }
Example #3
0
 private CultureInfoScope CreateCultureInfoScope(IContextManager contextManager)
 {
     var cultureInfo = CultureInfo.CurrentCulture;
     if (contextManager.FeatureContext != null)
     {
         cultureInfo = contextManager.FeatureContext.BindingCulture;
     }
     return new CultureInfoScope(cultureInfo);
 }
 // Methods
 internal FtpListenerSession(Socket control, IContextManager context)
 {
     m_CommandSocket = control;
     m_SendContext = context;
     Logging.Print("New connection established from " + control.RemoteEndPoint);
     m_HostIp = (control.LocalEndPoint as IPEndPoint).Address;
     m_DataReadyEvent = new AutoResetEvent(false);
     m_DataChannelEstablished = new ManualResetEvent(false);
     m_CommandThread = new Thread(WorkerThread);
     m_CommandThread.Start();
 }
 public StepArgumentTypeConverter(ITestTracer testTracer, IBindingRegistry bindingRegistry, IContextManager contextManager, IBindingInvoker bindingInvoker)
 {
     converters = new IStepArgumentTypeConverter[]
     {
         new IndentityConverter(),
         new StepArgumentTransformationConverter(this, testTracer, bindingRegistry, contextManager, bindingInvoker),
         new VerticalTableConverter(this),
         new HorizontalTableConverter(this),
         new SimpleConverter()
     };
 }
Example #6
0
        public object InvokeBinding(IBinding binding, IContextManager contextManager, object[] arguments, ITestTracer testTracer, out TimeSpan duration)
        {
            MethodInfo methodInfo;
            Delegate bindingAction;
            EnsureReflectionInfo(binding, out methodInfo, out bindingAction);

            try
            {
                object result;
                Stopwatch stopwatch = new Stopwatch();
                using (CreateCultureInfoScope(contextManager))
                {
                    stopwatch.Start();
                    object[] invokeArgs = new object[arguments == null ? 1 : arguments.Length + 1];
                    if (arguments != null)
                        Array.Copy(arguments, 0, invokeArgs, 1, arguments.Length);
                    invokeArgs[0] = contextManager;
                    result = bindingAction.DynamicInvoke(invokeArgs);

                    if (result is Task)
                    {
                        ((Task) result).Wait();
                    }

                    stopwatch.Stop();
                }

                if (runtimeConfiguration.TraceTimings && stopwatch.Elapsed >= runtimeConfiguration.MinTracedDuration)
                {
                    testTracer.TraceDuration(stopwatch.Elapsed, binding.Method, arguments);
                }

                duration = stopwatch.Elapsed;
                return result;
            }
            catch (ArgumentException ex)
            {
                throw errorProvider.GetCallError(binding.Method, ex);
            }
            catch (TargetInvocationException invEx)
            {
                var ex = invEx.InnerException;
                ex = ex.PreserveStackTrace(errorProvider.GetMethodText(binding.Method));
                throw ex;
            }
            catch (AggregateException agEx)  //from Task.Wait();
            {
                var ex = agEx.InnerExceptions.First();
                ex = ex.PreserveStackTrace(errorProvider.GetMethodText(binding.Method));
                throw ex;
            }
        }
 public void SetupContextManagerAndCreateDatabase()
 {
     _contextManager = new CoursesContextManager(ConfigurationManager.ConnectionStrings["CoursesConnection"].ConnectionString);
     var contextBuilder = new CoursesContextBuilder(ConfigurationManager.ConnectionStrings["CoursesConnection"].ConnectionString);
     using (var context = contextBuilder.GetContext())
     {
         if (context.DatabaseExists())
         {
             context.DeleteDatabase();
         }
         context.CreateDatabase();
     }
 }
Example #8
0
    static ApplicationContext()
    {
#if !SILVERLIGHT && !NETFX_CORE
      _webManagerType = Type.GetType("Csla.Web.ApplicationContextManager, Csla.Web");
      _xamlManagerType = Type.GetType("Csla.Xaml.ApplicationContextManager, Csla.Xaml");

      if (_webManagerType != null)
        WebContextManager = (IContextManager)Activator.CreateInstance(_webManagerType);
      if (_xamlManagerType != null)
        _contextManager = (IContextManager)Activator.CreateInstance(_xamlManagerType);
#endif
      if (_contextManager == null)
        _contextManager = new ApplicationContextManager();
    }
Example #9
0
        public TestExecutionEngine(IStepFormatter stepFormatter, ITestTracer testTracer, IErrorProvider errorProvider, IStepArgumentTypeConverter stepArgumentTypeConverter, 
            RuntimeConfiguration runtimeConfiguration, IBindingRegistry bindingRegistry, IUnitTestRuntimeProvider unitTestRuntimeProvider, 
            IDictionary<ProgrammingLanguage, IStepDefinitionSkeletonProvider> stepDefinitionSkeletonProviders, IContextManager contextManager)
        {
            this.errorProvider = errorProvider;
            this.contextManager = contextManager;
            this.stepDefinitionSkeletonProviders = stepDefinitionSkeletonProviders;
            this.unitTestRuntimeProvider = unitTestRuntimeProvider;
            this.bindingRegistry = bindingRegistry;
            this.runtimeConfiguration = runtimeConfiguration;
            this.testTracer = testTracer;
            this.stepFormatter = stepFormatter;
            this.stepArgumentTypeConverter = stepArgumentTypeConverter;

            this.currentStepDefinitionSkeletonProvider = stepDefinitionSkeletonProviders[ProgrammingLanguage.CSharp]; // fallback if feature initialization was not proper
        }
 public TestExecutionEngine(IStepFormatter stepFormatter, ITestTracer testTracer, IErrorProvider errorProvider, IStepArgumentTypeConverter stepArgumentTypeConverter, 
     RuntimeConfiguration runtimeConfiguration, IBindingRegistry bindingRegistry, IUnitTestRuntimeProvider unitTestRuntimeProvider, 
     IStepDefinitionSkeletonProvider stepDefinitionSkeletonProvider, IContextManager contextManager, IStepDefinitionMatchService stepDefinitionMatchService,
     IDictionary<string, IStepErrorHandler> stepErrorHandlers, IBindingInvoker bindingInvoker)
 {
     this.errorProvider = errorProvider;
     this.bindingInvoker = bindingInvoker;
     this.contextManager = contextManager;
     this.unitTestRuntimeProvider = unitTestRuntimeProvider;
     this.stepDefinitionSkeletonProvider = stepDefinitionSkeletonProvider;
     this.bindingRegistry = bindingRegistry;
     this.runtimeConfiguration = runtimeConfiguration;
     this.testTracer = testTracer;
     this.stepFormatter = stepFormatter;
     this.stepArgumentTypeConverter = stepArgumentTypeConverter;
     this.stepErrorHandlers = stepErrorHandlers == null ? null : stepErrorHandlers.Values.ToArray();
     this.stepDefinitionMatchService = stepDefinitionMatchService;
 }
        public TestExecutionEngine(IStepFormatter stepFormatter, ITestTracer testTracer, IErrorProvider errorProvider, IStepArgumentTypeConverter stepArgumentTypeConverter, 
            RuntimeConfiguration runtimeConfiguration, IBindingRegistry bindingRegistry, IUnitTestRuntimeProvider unitTestRuntimeProvider, 
            IDictionary<ProgrammingLanguage, IStepDefinitionSkeletonProvider> stepDefinitionSkeletonProviders, IContextManager contextManager, IStepDefinitionMatchService stepDefinitionMatchService,
            IDictionary<string, IStepErrorHandler> stepErrorHandlers, IBindingInvoker bindingInvoker, IRuntimeBindingRegistryBuilder bindingRegistryBuilder)
        {
            this.errorProvider = errorProvider;
            //this.stepDefinitionMatcher = stepDefinitionMatcher;
            this.bindingInvoker = bindingInvoker;
            this.bindingRegistryBuilder = bindingRegistryBuilder;
            this.contextManager = contextManager;
            this.stepDefinitionSkeletonProviders = stepDefinitionSkeletonProviders;
            this.unitTestRuntimeProvider = unitTestRuntimeProvider;
            this.bindingRegistry = bindingRegistry;
            this.runtimeConfiguration = runtimeConfiguration;
            this.testTracer = testTracer;
            this.stepFormatter = stepFormatter;
            this.stepArgumentTypeConverter = stepArgumentTypeConverter;
            this.stepErrorHandlers = stepErrorHandlers == null ? null : stepErrorHandlers.Values.ToArray();

            this.currentStepDefinitionSkeletonProvider = stepDefinitionSkeletonProviders[ProgrammingLanguage.CSharp]; // fallback if feature initialization was not proper

            this.stepDefinitionMatchService = stepDefinitionMatchService;
        }
Example #12
0
 protected CurrentContext(IContextManager contextManager)
 {
     this._contextManager = contextManager;
 }
Example #13
0
 public UnitOfWork(IContextManager contextManager)
 {
     this.contextManager = contextManager;
     dbContext           = contextManager.GetContext();
 }
Example #14
0
 public NoteService(IContextManager contextManager)
 {
     _contextManager = contextManager;
 }
Example #15
0
 public StepArgumentTypeConverter(ITestTracer testTracer, IBindingRegistry bindingRegistry, IContextManager contextManager)
 {
     this.testTracer     = testTracer;
     this.contextManager = contextManager;
     StepTransformations = bindingRegistry.StepTransformations ?? new List <StepTransformationBinding>();
 }
 public ScopedTerminalTasks(ITerminalTasks scoped, IContextManager contextManager)
 {
     terminalTasks = scoped.notNull();
     this.contextManager = contextManager.notNull();
 }
Example #17
0
        public void HandleKeyEvent(Event evt, IContextManager contextManager)
        {
            if (evt == null || !evt.isKey || evt.keyCode == KeyCode.None)
            {
                return;
            }

            if (evt.type == EventType.KeyUp)
            {
                Tuple <ShortcutEntry, object> clutchTuple;
                if (m_ActiveClutches.TryGetValue(evt.keyCode, out clutchTuple))
                {
                    var clutchContext = m_ActiveClutches[evt.keyCode].Item2;

                    m_ActiveClutches.Remove(evt.keyCode);
                    var args = new ShortcutArguments
                    {
                        context = clutchContext,
                        state   = ShortcutState.End
                    };
                    invokingAction?.Invoke(clutchTuple.Item1, args);
                    clutchTuple.Item1.action(args);
                }
                return;
            }

            // Use the event and return if the key is currently used in an active clutch
            if (m_ActiveClutches.ContainsKey(evt.keyCode))
            {
                evt.Use();
                return;
            }

            var keyCodeCombination = KeyCombination.FromKeyboardInput(evt);

            m_KeyCombinationSequence.Add(keyCodeCombination);

            // Ignore event if sequence is empty
            if (m_KeyCombinationSequence.Count == 0)
            {
                return;
            }

            m_Directory.FindShortcutEntries(m_KeyCombinationSequence, contextManager, m_Entries);
            IEnumerable <ShortcutEntry> entries = m_Entries;

            // Deal ONLY with prioritycontext
            if (entries.Count() > 1 && contextManager.HasAnyPriorityContext())
            {
                entries = m_Entries.FindAll(a => contextManager.HasPriorityContextOfType(a.context));
                if (!entries.Any())
                {
                    entries = m_Entries;
                }
            }

            switch (entries.Count())
            {
            case 0:
                Reset();
                break;

            case 1:
                var shortcutEntry = entries.Single();
                if (ShortcutFullyMatchesKeyCombination(shortcutEntry))
                {
                    if (evt.keyCode != m_KeyCombinationSequence.Last().keyCode)
                    {
                        break;
                    }

                    var args = new ShortcutArguments();
                    args.context = contextManager.GetContextInstanceOfType(shortcutEntry.context);
                    switch (shortcutEntry.type)
                    {
                    case ShortcutType.Action:
                        args.state = ShortcutState.End;
                        invokingAction?.Invoke(shortcutEntry, args);
                        shortcutEntry.action(args);
                        evt.Use();
                        Reset();
                        break;

                    case ShortcutType.Clutch:
                        if (!m_ActiveClutches.ContainsKey(evt.keyCode))
                        {
                            m_ActiveClutches.Add(evt.keyCode, new Tuple <ShortcutEntry, object>(shortcutEntry, args.context));
                            args.state = ShortcutState.Begin;
                            invokingAction?.Invoke(shortcutEntry, args);
                            shortcutEntry.action(args);
                            evt.Use();
                            Reset();
                        }
                        break;

                    case ShortcutType.Menu:
                        args.state = ShortcutState.End;
                        invokingAction?.Invoke(shortcutEntry, args);
                        shortcutEntry.action(args);
                        evt.Use();
                        Reset();
                        break;
                    }
                }
                break;

            default:
                if (HasConflicts(entries, m_KeyCombinationSequence))
                {
                    m_ConflictResolver.ResolveConflict(m_KeyCombinationSequence, entries);
                    evt.Use();
                    Reset();
                }
                break;
            }
        }
Example #18
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="contextManager"></param>
 public PlayerController(IContextManager contextManager)
 {
     _fullService = new PlayerService(contextManager);
 }
Example #19
0
 public UserInfoService(IHttpContextAccessor ctxAccessor, UserRolesCache userRolesCache, IUserOrganizationService userOrganizationService, IContextManager contextManager)
 {
     this.ctxAccessor             = ctxAccessor;
     this.userRolesCache          = userRolesCache;
     this.userOrganizationService = userOrganizationService;
     this.contextManager          = contextManager;
 }
        public override object InvokeBinding(IBinding binding, IContextManager contextManager, object[] arguments, ITestTracer testTracer, out TimeSpan duration)
        {
            // process hook
            if (binding is HookBinding hook)
            {
                var featureContainerId = AllureHelper.GetFeatureContainerId(contextManager.FeatureContext?.FeatureInfo);

                switch (hook.HookType)
                {
                case HookType.BeforeFeature:
                    if (hook.HookOrder == int.MinValue)
                    {
                        // starting point
                        var featureContainer = new TestResultContainer()
                        {
                            uuid = AllureHelper.GetFeatureContainerId(contextManager.FeatureContext?.FeatureInfo)
                        };
                        Allure.StartTestContainer(featureContainer);

                        if (contextManager.FeatureContext != null)
                        {
                            contextManager.FeatureContext.Set(new HashSet <TestResultContainer>());
                            contextManager.FeatureContext.Set(new HashSet <TestResult>());
                        }

                        return(base.InvokeBinding(binding, contextManager, arguments, testTracer, out duration));
                    }
                    else
                    {
                        try
                        {
                            StartFixture(hook, featureContainerId);
                            var result = base.InvokeBinding(binding, contextManager, arguments, testTracer, out duration);
                            Allure.StopFixture(x => x.status = Status.passed);
                            return(result);
                        }
                        catch (Exception ex)
                        {
                            Allure.StopFixture(x => x.status = Status.broken);

                            // if BeforeFeature is failed execution is stopped. We need to create, update, stop and write everything here.

                            // create fake scenario container
                            var scenarioContainer = AllureHelper.StartTestContainer(contextManager.FeatureContext, null);

                            // start fake scenario
                            var scenario = AllureHelper.StartTestCase(scenarioContainer.uuid, contextManager.FeatureContext, null);

                            // update, stop and write
                            Allure
                            .StopTestCase(x =>
                            {
                                x.status        = Status.broken;
                                x.statusDetails = new StatusDetails()
                                {
                                    message = ex.Message,
                                    trace   = ex.StackTrace
                                };
                            })
                            .WriteTestCase(scenario.uuid)
                            .StopTestContainer(scenarioContainer.uuid)
                            .WriteTestContainer(scenarioContainer.uuid)
                            .StopTestContainer(featureContainerId)
                            .WriteTestContainer(featureContainerId);

                            throw;
                        }
                    }

                case HookType.BeforeStep:
                case HookType.AfterStep:
                {
                    var scenario = AllureHelper.GetCurrentTestCase(contextManager.ScenarioContext);

                    try
                    {
                        return(base.InvokeBinding(binding, contextManager, arguments, testTracer, out duration));
                    }
                    catch (Exception ex)
                    {
                        Allure
                        .UpdateTestCase(scenario.uuid,
                                        x =>
                            {
                                x.status        = Status.broken;
                                x.statusDetails = new StatusDetails()
                                {
                                    message = ex.Message,
                                    trace   = ex.StackTrace
                                };
                            });
                        throw;
                    }
                }

                case HookType.BeforeScenario:
                case HookType.AfterScenario:
                    if (hook.HookOrder == int.MinValue || hook.HookOrder == int.MaxValue)
                    {
                        return(base.InvokeBinding(binding, contextManager, arguments, testTracer, out duration));
                    }
                    else
                    {
                        var scenarioContainer = AllureHelper.GetCurrentTestConainer(contextManager.ScenarioContext);

                        try
                        {
                            StartFixture(hook, scenarioContainer.uuid);
                            var result = base.InvokeBinding(binding, contextManager, arguments, testTracer, out duration);
                            Allure.StopFixture(x => x.status = Status.passed);
                            return(result);
                        }
                        catch (Exception ex)
                        {
                            Allure.StopFixture(x => x.status = Status.broken);

                            // get or add new scenario
                            var scenario = AllureHelper.GetCurrentTestCase(contextManager.ScenarioContext) ??
                                           AllureHelper.StartTestCase(scenarioContainer.uuid, contextManager.FeatureContext, contextManager.ScenarioContext);

                            Allure.UpdateTestCase(scenario.uuid,
                                                  x =>
                            {
                                x.status        = Status.broken;
                                x.statusDetails = new StatusDetails()
                                {
                                    message = ex.Message,
                                    trace   = ex.StackTrace
                                };
                            });
                            throw;
                        }
                    }

                case HookType.AfterFeature:
                    if (hook.HookOrder == int.MaxValue)
                    // finish point
                    {
                        WriteScenarios(contextManager);
                        Allure
                        .StopTestContainer(featureContainerId)
                        .WriteTestContainer(featureContainerId);

                        return(base.InvokeBinding(binding, contextManager, arguments, testTracer, out duration));
                    }
                    else
                    {
                        try
                        {
                            StartFixture(hook, featureContainerId);
                            var result = base.InvokeBinding(binding, contextManager, arguments, testTracer, out duration);
                            Allure.StopFixture(x => x.status = Status.passed);
                            return(result);
                        }
                        catch (Exception ex)
                        {
                            var scenario = contextManager.FeatureContext?.Get <HashSet <TestResult> >().Last();
                            Allure
                            .StopFixture(x => x.status = Status.broken)
                            .UpdateTestCase(scenario?.uuid,
                                            x =>
                            {
                                x.status        = Status.broken;
                                x.statusDetails = new StatusDetails()
                                {
                                    message = ex.Message,
                                    trace   = ex.StackTrace
                                };
                            });

                            WriteScenarios(contextManager);

                            Allure
                            .StopTestContainer(featureContainerId)
                            .WriteTestContainer(featureContainerId);

                            throw;
                        }
                    }

//                    case HookType.BeforeScenarioBlock:
//                    case HookType.AfterScenarioBlock:
//                    case HookType.BeforeTestRun:
//                    case HookType.AfterTestRun:
                default:
                    return(base.InvokeBinding(binding, contextManager, arguments, testTracer, out duration));
                }
            }
            else
            {
                return(base.InvokeBinding(binding, contextManager, arguments, testTracer, out duration));
            }
        }
 /// <summary>
 /// Todo: Resolve with inversion of control
 /// </summary>
 static ContextManager()
 {
     instance = new ContextPerRequestContextManager();
 }
Example #22
0
 public ContactController(InternalServicesDirectoryV1Context context)
 {
     _contextManager = new ContextManager(context);
 }
Example #23
0
 public TestExecutionEngine(IStepFormatter stepFormatter, ITestTracer testTracer, IErrorProvider errorProvider, IStepArgumentTypeConverter stepArgumentTypeConverter,
                            RuntimeConfiguration runtimeConfiguration, IBindingRegistry bindingRegistry, IUnitTestRuntimeProvider unitTestRuntimeProvider,
                            IStepDefinitionSkeletonProvider stepDefinitionSkeletonProvider, IContextManager contextManager, IStepDefinitionMatchService stepDefinitionMatchService,
                            IDictionary <string, IStepErrorHandler> stepErrorHandlers, IBindingInvoker bindingInvoker)
 {
     this.errorProvider                  = errorProvider;
     this.bindingInvoker                 = bindingInvoker;
     this.contextManager                 = contextManager;
     this.unitTestRuntimeProvider        = unitTestRuntimeProvider;
     this.stepDefinitionSkeletonProvider = stepDefinitionSkeletonProvider;
     this.bindingRegistry                = bindingRegistry;
     this.runtimeConfiguration           = runtimeConfiguration;
     this.testTracer                 = testTracer;
     this.stepFormatter              = stepFormatter;
     this.stepArgumentTypeConverter  = stepArgumentTypeConverter;
     this.stepErrorHandlers          = stepErrorHandlers == null ? null : stepErrorHandlers.Values.ToArray();
     this.stepDefinitionMatchService = stepDefinitionMatchService;
 }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="contextManager"></param>
 public CharacterController(IContextManager contextManager)
 {
     _fullService = new CharacterService(contextManager);
 }
Example #25
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Hooks"/> class.
 /// </summary>
 /// <param name="ContextManager"></param>
 /// <param name="TestContext"></param>
 public Hooks(IContextManager ContextManager, TestContext TestContext)
 {
     this.contextManager = ContextManager;
     this.TestContext    = TestContext;
 }
Example #26
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="authManager"></param>
 /// <param name="contextManager"></param>
 /// <param name="authenticationLevel"></param>
 public ExecutionFilterAttribute(IAuthManager authManager, IContextManager contextManager, AuthenticationLevel authenticationLevel)
 {
     this.authManager         = authManager;
     this.contextManager      = contextManager;
     this.authenticationLevel = authenticationLevel;
 }
Example #27
0
 protected abstract IEnumerable <T> Execute(IContextManager manager);
Example #28
0
         public SkillsController(IContextManager contextManager)
 {
     _fullService = new SkillService(contextManager);
 }
 public MemoryReceiveMessages(IMemoryReceiveMessageChain receiveMessageChain, IContextManager contextManager)
 {
     _receiveMessageChain = receiveMessageChain;
     _contextManager = contextManager;
 }
 protected override void Execute(IContextManager manager)
 {
     manager.Resolve<NHibernateContext>()
         .SaveOrUpdate(EntityObject);
 }
 public void sup()
 {
     cache = new WinCacheManager();
     context = new WpfContextManager(cache, new ContextFactory());
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="MongoDbDatabaseManageSteps"/> class.
 /// </summary>
 /// <param name="contextManager">The object container.</param>
 public MongoDbDatabaseManageSteps(IContextManager contextManager)
 {
     this.objectContainer = contextManager?.TestThreadContext.Get <IObjectContainer>("objectContainer");
     this.mongoDbHelper   = this.objectContainer?.Resolve <MongoDbHelper>();
 }
Example #33
0
 public DispositivoRepository(IContextManager contextManager) : base(contextManager)
 {
     _contextManager = contextManager;
 }
Example #34
0
 public SqlDatabase(string nameOrConnectionString, IContextManager contextManager)
     : base(nameOrConnectionString, contextManager)
 {
 }
Example #35
0
 public StepArgumentTransformationConverter(IStepArgumentTypeConverter stepArgumentTypeConverter, ITestTracer testTracer, IBindingRegistry bindingRegistry, IContextManager contextManager, IBindingInvoker bindingInvoker)
 {
     this.stepArgumentTypeConverter = stepArgumentTypeConverter;
     this.testTracer      = testTracer;
     this.bindingRegistry = bindingRegistry;
     this.contextManager  = contextManager;
     this.bindingInvoker  = bindingInvoker;
 }
Example #36
0
 public void Begin()
 {
     contextManager = LocatorHelper.GetInstance <IContextManager>();
 }
Example #37
0
 public static bool HasBind(IContextManager contextManager)
 {
     return(GetCurrentContext(contextManager).Context != null);
 }
Example #38
0
 public ThreadService(IContextManager contextManager)
 {
     _contextManager = contextManager;
 }
 public ManageUserController(ILogger logger, IMapperResolverService mapperResolverService, IContextManager contextManager, IUserService userService)
     : base(logger)
 {
     this.contextManager        = contextManager;
     this.mapperResolverService = mapperResolverService;
     this.userService           = userService;
 }
 public void SetUp()
 {
     contextManager   = new ContextManager();
     personRepository = new PersonRepository(contextManager);
 }
Example #41
0
 public LockingManager(IContextManager contextManager, IUserIdentification userIdentification)
 {
     this.contextManager     = contextManager;
     this.userIdentification = userIdentification;
 }
Example #42
0
 public void SetUp()
 {
     var repositoryManager = new RepositoryManager(new SimpleSelect(), new CategoryBlacklist());
     var tagger = new Tagger(new MorfeuszConverter());
     contextManager = new ContextManager(new ContextBuilder(), repositoryManager, tagger, new BagOfWords());
 }
Example #43
0
 public CallContext(IContextManager factory)
     : base(factory)
 {
 }
Example #44
0
 public NoteService(IContextManager contextManager)
 {
     _contextManager = contextManager;
 }
Example #45
0
 public UsuarioRepository(IContextManager contextManager) : base(contextManager)
 {
     _contextManager = contextManager;
 }
Example #46
0
 public static void InvokeHook(this IBindingInvoker invoker, IHookBinding hookBinding, IContextManager contextManager, ITestTracer testTracer)
 {
     TimeSpan duration;
     invoker.InvokeBinding(hookBinding, contextManager, null, testTracer, out duration);
 }
Example #47
0
 public ConfigurationService(IContextManager contextManager)
 {
     this.contextManager = contextManager;
 }
Example #48
0
        public object InvokeAction(IContextManager contextManager, object[] arguments, ITestTracer testTracer, out TimeSpan duration)
        {
            try
            {
                object result;
                Stopwatch stopwatch = new Stopwatch();
                using (CreateCultureInfoScope(contextManager))
                {
                    stopwatch.Start();
                    object[] invokeArgs = new object[arguments == null ? 1 : arguments.Length + 1];
                    if (arguments != null)
                        Array.Copy(arguments, 0, invokeArgs, 1, arguments.Length);
                    invokeArgs[0] = contextManager;
                    result = BindingAction.DynamicInvoke(invokeArgs);
                    stopwatch.Stop();
                }

                if (runtimeConfiguration.TraceTimings && stopwatch.Elapsed >= runtimeConfiguration.MinTracedDuration)
                {
                    testTracer.TraceDuration(stopwatch.Elapsed, MethodInfo, arguments);
                }

                duration = stopwatch.Elapsed;
                return result;
            }
            catch (ArgumentException ex)
            {
                throw errorProvider.GetCallError(MethodInfo, ex);
            }
            catch (TargetInvocationException invEx)
            {
                var ex = invEx.InnerException;
                ex = ex.PreserveStackTrace(errorProvider.GetMethodText(MethodInfo));
                throw ex;
            }
        }
 public StepArgumentTypeConverter(ITestTracer testTracer, IBindingRegistry bindingRegistry, IContextManager contextManager)
 {
     this.testTracer = testTracer;
     this.contextManager = contextManager;
     StepTransformations = bindingRegistry.StepTransformations ?? new List<StepTransformationBinding>();
 }
 protected abstract void Execute(IContextManager manager);
Example #51
0
 public object InvokeAction(IContextManager contextManager, object[] arguments, ITestTracer testTracer)
 {
     TimeSpan duration;
     return InvokeAction(contextManager, arguments, testTracer, out duration);
 }
 public PersonRepository(IContextManager contextManager)
 {
     this.contextManager = contextManager;
 }
Example #53
0
        private void ExecuteStep(IContextManager contextManager, StepInstance stepInstance)
        {
            HandleBlockSwitch(stepInstance.StepDefinitionType.ToScenarioBlock());

            _testTracer.TraceStep(stepInstance, true);

            bool isStepSkipped       = contextManager.ScenarioContext.ScenarioExecutionStatus != ScenarioExecutionStatus.OK;
            bool onStepStartExecuted = false;

            BindingMatch match = null;

            object[] arguments = null;
            try
            {
                match = GetStepMatch(stepInstance);
                contextManager.StepContext.StepInfo.BindingMatch = match;
                contextManager.StepContext.StepInfo.StepInstance = stepInstance;
                arguments = GetExecuteArguments(match);

                if (isStepSkipped)
                {
                    _testTracer.TraceStepSkipped();
                }
                else
                {
                    _obsoleteStepHandler.Handle(match);

                    onStepStartExecuted = true;
                    OnStepStart();
                    TimeSpan duration = ExecuteStepMatch(match, arguments);
                    if (_specFlowConfiguration.TraceSuccessfulSteps)
                    {
                        _testTracer.TraceStepDone(match, arguments, duration);
                    }
                }
            }
            catch (PendingStepException)
            {
                Debug.Assert(match != null);
                Debug.Assert(arguments != null);

                _testTracer.TraceStepPending(match, arguments);
                contextManager.ScenarioContext.PendingSteps.Add(
                    _stepFormatter.GetMatchText(match, arguments));

                if (contextManager.ScenarioContext.ScenarioExecutionStatus < ScenarioExecutionStatus.StepDefinitionPending)
                {
                    contextManager.ScenarioContext.ScenarioExecutionStatus = ScenarioExecutionStatus.StepDefinitionPending;
                }
            }
            catch (MissingStepDefinitionException)
            {
                if (contextManager.ScenarioContext.ScenarioExecutionStatus < ScenarioExecutionStatus.UndefinedStep)
                {
                    contextManager.ScenarioContext.ScenarioExecutionStatus = ScenarioExecutionStatus.UndefinedStep;
                }
            }
            catch (BindingException ex)
            {
                _testTracer.TraceBindingError(ex);
                if (contextManager.ScenarioContext.ScenarioExecutionStatus < ScenarioExecutionStatus.BindingError)
                {
                    contextManager.ScenarioContext.ScenarioExecutionStatus = ScenarioExecutionStatus.BindingError;
                    contextManager.ScenarioContext.TestError = ex;
                }
            }
            catch (Exception ex)
            {
                _testTracer.TraceError(ex);

                if (contextManager.ScenarioContext.ScenarioExecutionStatus < ScenarioExecutionStatus.TestError)
                {
                    contextManager.ScenarioContext.ScenarioExecutionStatus = ScenarioExecutionStatus.TestError;
                    contextManager.ScenarioContext.TestError = ex;
                }

                if (_specFlowConfiguration.StopAtFirstError)
                {
                    throw;
                }
            }
            finally
            {
                if (onStepStartExecuted)
                {
                    OnStepEnd();
                }
            }
        }
 public WinFrequencyDao(IContextManager contextManager)
 {
     this.contextManager = contextManager.notNull();
 }
Example #55
0
 public ForumService(IContextManager contextManager)
 {
     _contextManager = contextManager;
 }
Example #56
0
 public object InvokeBinding(IBinding binding, IContextManager contextManager, object[] arguments, ITestTracer testTracer, out TimeSpan duration)
 {
     duration = TimeSpan.Zero;
     return(null);
 }
 public LibraryAccountService(IContextManager contextManger)
 {
     _contextManager = contextManger;
 }
Example #58
0
 internal virtual void HandleInTrigger(Event evt, IContextManager contextManager)
 {
     m_Trigger.HandleKeyEvent(evt, contextManager);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="ServiceHandlerRepositoryFactory"/> class.
 /// </summary>
 /// <param name="contextManager">The context manager.</param>
 public ServiceHandlerRepositoryFactory(IContextManager contextManager)
     : base(contextManager)
 {
 }
 public TipoDePessoaRepository(IContextManager contextManager) : base(contextManager)
 {
 }