private Ranges GetUnitTestElementLocation(IInvocationExpression invocation)
        {
            var reference = (invocation.InvokedExpression as IReferenceExpression)
              .AssertNotNull("invocationExpression.InvokedExpression is not a IReferenceExpression");

              var startOffset = reference.NameIdentifier.GetDocumentStartOffset();
              var endOffset = invocation.GetDocumentRange().EndOffsetRange();
              var textRange = startOffset.JoinRight(endOffset);

              return new Ranges(textRange, textRange);
        }
示例#2
0
        private Ranges GetUnitTestElementLocation(IInvocationExpression invocation)
        {
            var reference = (invocation.InvokedExpression as IReferenceExpression)
                            .NotNull("invocationExpression.InvokedExpression is not a IReferenceExpression");

            var startOffset = reference.NameIdentifier.GetDocumentStartOffset();
            var endOffset   = invocation.GetDocumentRange().EndOffsetRange();
            var textRange   = startOffset.JoinRight(endOffset);

            return(new Ranges(textRange, textRange));
        }
        private UnitTestElementLocation GetUnitTestElementLocation(IInvocationExpression invocation)
        {
            var projectFile = invocation.GetSourceFile().ToProjectFile();
            var reference   = (invocation.InvokedExpression as IReferenceExpression)
                              .AssertNotNull("invocationExpression.InvokedExpression is not a IReferenceExpression");

            var startOffset = reference.NameIdentifier.GetDocumentStartOffset();
            var endOffset   = invocation.GetDocumentRange().EndOffsetRange();
            var textRange   = startOffset.JoinRight(endOffset).TextRange;

            return(new UnitTestElementLocation(projectFile, textRange, textRange));
        }
示例#4
0
        private UnitTestElementLocation GetUnitTestElementLocation(IInvocationExpression invocation)
        {
            var projectFile = invocation.GetSourceFile().ToProjectFile();
              var reference = (invocation.InvokedExpression as IReferenceExpression)
              .AssertNotNull("invocationExpression.InvokedExpression is not a IReferenceExpression");

              var startOffset = reference.NameIdentifier.GetDocumentStartOffset();
              var endOffset = invocation.GetDocumentRange().EndOffsetRange();
              var textRange = startOffset.JoinRight(endOffset).TextRange;

              return new UnitTestElementLocation(projectFile, textRange, textRange);
        }
        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 ExploreTest(TextRange textRange, IInvocationExpression invocationExpression)
        {
            var arguments = invocationExpression.Arguments;

            switch (arguments.Count)
            {
            case 2:
            case 3:
            {
                var expression = arguments[0] as IJavaScriptLiteralExpression;
                if (expression != null)
                {
                    var range = invocationExpression.GetDocumentRange().TextRange;
                    FinishCurrentSuite(range.StartOffset);
                    var stringValue     = expression.GetStringValue();
                    var unitTestElement = _factory.GetOrCreateSpecification(stringValue, _project, _projectFileEnvoy, _filename, range, _referencedFiles, _currentSuite);
                    _consumer(new UnitTestElementDisposition(unitTestElement, _file.GetSourceFile().ToProjectFile(), textRange, range));
                }
                break;
            }
            }
        }
 private void ExploreTest(TextRange textRange, IInvocationExpression invocationExpression)
 {
     var arguments = invocationExpression.Arguments;
     switch (arguments.Count)
     {
         case 2:
         case 3:
         {
             var expression = arguments[0] as IJavaScriptLiteralExpression;
             if (expression != null)
             {
                 var range = invocationExpression.GetDocumentRange().TextRange;
                 FinishCurrentSuite(range.StartOffset);
                 var stringValue = expression.GetStringValue();
                 var unitTestElement = _factory.GetOrCreateSpecification(stringValue, _project, _projectFileEnvoy, _filename, range, _referencedFiles, _currentSuite);
                 _consumer(new UnitTestElementDisposition(unitTestElement, _file.GetSourceFile().ToProjectFile(), textRange, range));
             }
             break;
         }
     }
 }
 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));
         }
     }
 }
示例#9
0
 public DocumentRange CalculateRange()
 {
     return(InvocationExpression.GetDocumentRange());
 }
 /// <inheritdoc />
 public DocumentRange CalculateRange() => InvocationExpression.GetDocumentRange();
示例#11
0
 public override DocumentRange CalculateRange()
 {
     return(_invocation.GetDocumentRange());
 }