public void Should_remove_variable_definitions_with_a_sensible_replacement()
        {
            // Given
            var stepDefinition = new StepDefinition("My name is '(.*)'");

            // When
            var replacementText = stepDefinition.Name;

            // Then
            Assert.That(replacementText, Is.EqualTo("My name is '..'"));
        }
        public void Should_remove_StartOfLine_and_EndOfLine_from_replacement_text()
        {
            // Given
            var stepDefinition = new StepDefinition("^bla$");

            // When
            var replacementText = stepDefinition.Name;

            // Then
            Assert.That(replacementText, Is.EqualTo("bla"));
        }
Beispiel #3
0
 private void QueueIdentifierToken(StepDefinition stepDefinition, int startIndex, int endIndex)
 {
     var tokenInfo = new TokenInfo
                         {
                             StartIndex = startIndex,
                             EndIndex = endIndex
                         };
     SetIdentifierColorAndType(tokenInfo, stepDefinition);
     _queuedTokens.Enqueue(tokenInfo);
 }
Beispiel #4
0
 private void ProcessStepIdentifierParameters(TokenInfo tokenInfo, StepDefinition stepDefinition, GroupCollection groups)
 {
     var lastEndIndex = tokenInfo.StartIndex - 1;
     for (var i=1; i < groups.Count; i++)
     {
         var group = groups[i];
         var startIndex = tokenInfo.StartIndex + group.Index;
         if (startIndex > lastEndIndex + 1)
             QueueIdentifierToken(stepDefinition, lastEndIndex + 1, startIndex - 1);
         var captureTokenInfo = new TokenInfo
                                    {
                                        StartIndex = startIndex,
                                        EndIndex = startIndex + group.Length - 1,
                                        Color = Microsoft.VisualStudio.Package.TokenColor.Number,
                                        Type = Microsoft.VisualStudio.Package.TokenType.String
                                    };
         _queuedTokens.Enqueue(captureTokenInfo);
         lastEndIndex = captureTokenInfo.EndIndex;
     }
     if (lastEndIndex < tokenInfo.EndIndex)
         QueueIdentifierToken(stepDefinition, lastEndIndex + 1, tokenInfo.EndIndex);
     UpdateTokenInfoFromQueue(tokenInfo);
 }
Beispiel #5
0
 private static void SetIdentifierColorAndType(TokenInfo tokenInfo, StepDefinition stepDefinition)
 {
     tokenInfo.Color = stepDefinition.IsPending? Microsoft.VisualStudio.Package.TokenColor.String : Microsoft.VisualStudio.Package.TokenColor.Text;
     tokenInfo.Type = Microsoft.VisualStudio.Package.TokenType.Identifier;
 }