private void FinishCurrentSuite(int offset)
 {
     if ((_currentSuite != null) && (_currentSuite.TextRange.EndOffset < offset))
     {
         _currentSuite = _currentSuite.Parent as JasmineSuiteElement;
         FinishCurrentSuite(offset);
     }
 }
        public JasmineSuiteElement GetOrCreateSuite(IProject project, ProjectModelElementEnvoy projectFileEnvoy,
			string suiteName, JasmineSuiteElement parentSuite, TextRange textRange, IList<string> referencedFiles)
        {
            var id = string.Format("{0}:{1}", (parentSuite != null) ? parentSuite.Id : _provider.TestProvider.ID, suiteName);
            var elementById = _unitTestElementManager.GetElementById(project, id) as JasmineSuiteElement;
            if (elementById != null)
            {
                elementById.ReferencedFiles = referencedFiles;
                elementById.TextRange = textRange;
                elementById.State = UnitTestElementState.Valid;
                elementById.Parent = parentSuite;
                return elementById;
            }
            return new JasmineSuiteElement(_provider, suiteName, parentSuite, projectFileEnvoy, textRange, referencedFiles);
        }
        private void ExploreSuite(IInvocationExpression invocationExpression)
        {
            var arguments = invocationExpression.Arguments;

            if (arguments.Count == 2)
            {
                var expression = arguments[0] as IJavaScriptLiteralExpression;
                if ((expression != null) && (arguments[1] is IFunctionExpression))
                {
                    var stringValue = expression.GetStringValue();
                    FinishCurrentSuite(invocationExpression.GetDocumentRange().TextRange.StartOffset);
                    _currentSuite = _factory.GetOrCreateSuite(_project, _projectFileEnvoy, stringValue, _currentSuite, invocationExpression.GetDocumentRange().TextRange, _referencedFiles);
                    foreach (var element in _currentSuite.Children.ToList())
                    {
                        element.State = UnitTestElementState.Pending;
                    }
                    _consumer(new UnitTestElementDisposition(_currentSuite, _file.GetSourceFile().ToProjectFile(), expression.GetDocumentRange().TextRange, invocationExpression.GetDocumentRange().TextRange));
                }
            }
        }
 private void FinishCurrentSuite(int offset)
 {
     if ((_currentSuite != null) && (_currentSuite.TextRange.EndOffset < offset))
     {
         _currentSuite = _currentSuite.Parent as JasmineSuiteElement;
         FinishCurrentSuite(offset);
     }
 }
 private void ExploreSuite(IInvocationExpression invocationExpression)
 {
     var arguments = invocationExpression.Arguments;
     if (arguments.Count == 2)
     {
         var expression = arguments[0] as IJavaScriptLiteralExpression;
         if ((expression != null) && (arguments[1] is IFunctionExpression))
         {
             var stringValue = expression.GetStringValue();
             FinishCurrentSuite(invocationExpression.GetDocumentRange().TextRange.StartOffset);
             _currentSuite = _factory.GetOrCreateSuite(_project, _projectFileEnvoy, stringValue, _currentSuite, invocationExpression.GetDocumentRange().TextRange, _referencedFiles);
             foreach (var element in _currentSuite.Children.ToList())
             {
                 element.State = UnitTestElementState.Pending;
             }
             _consumer(new UnitTestElementDisposition(_currentSuite, _file.GetSourceFile().ToProjectFile(), expression.GetDocumentRange().TextRange, invocationExpression.GetDocumentRange().TextRange));
         }
     }
 }