public void ShouldClassifyVariable() { var script = "$variable"; Token[] tokens; ParseError[] errors; Parser.ParseInput(script, out tokens, out errors); var infos = _classifierService.ClassifyTokens(tokens, 0); Assert.AreEqual("variable", infos.ElementAt(0).ClassificationType.Classification); }
private void ClassifyPowerShellTokensTestHelper(string script, int targetToken, string expectedType) { Token[] tokens; ParseError[] errors; Parser.ParseInput(script, out tokens, out errors); var infos = _classifierService.ClassifyTokens(tokens, 0).ToArray(); var actual = infos[targetToken].ClassificationType.Classification; Assert.AreEqual(expectedType, actual, string.Format("{0} classifcation type expected, got {1}.", expectedType, actual)); }