public void Tokenize_SingleToken_ReturnsExpectedToken(string path, PropertyPathTokenType expectedType) { var tokenizer = new PropertyPathTokenizer(); var token = tokenizer.Tokenize(path).Single(); Assert.AreEqual(expectedType, token.Type); }
public void PropertyDotAfterIndexTest() { string input = "Test[1]."; string[] result = PropertyPathTokenizer.Tokenize(input).ToArray(); CompareResults(result, "Test", "[", "1", "]", "."); }
public void PropertyAtCommaTest() { string input = "Test[1,"; string[] result = PropertyPathTokenizer.Tokenize(input).ToArray(); CompareResults(result, "Test", "[", "1", ","); }
public void PropertyAtIndexerTest() { string input = "Test["; string[] result = PropertyPathTokenizer.Tokenize(input).ToArray(); CompareResults(result, "Test", "["); }
public void PropertyIndexerMultiTest() { string input = "Test[1,2]"; string[] result = PropertyPathTokenizer.Tokenize(input).ToArray(); CompareResults(result, "Test", "[", "1", ",", "2", "]"); }
public void PropertyGroupDotEndTest() { string input = "Test."; string[] result = PropertyPathTokenizer.Tokenize(input).ToArray(); CompareResults(result, "Test", "."); }
public void InCompletionSituationTest1() { string input = "(typeName."; string[] result = PropertyPathTokenizer.Tokenize(input).ToArray(); CompareResults(result, "(", "typeName", "."); }
public void InvalidStringTest() { string input = "(typeName&.propert$$yName).(##otherType . otherProperty).property"; string[] result = PropertyPathTokenizer.Tokenize(input).ToArray(); CompareResults(result, "(", "typeName", ".", "propert", "yName", ")", ".", "(", "otherType", ".", "otherProperty", ")", ".", "property"); }
public void AttachedPropertiesTest() { string input = "(typeName.propertyName).(otherType.otherProperty).property"; string[] result = PropertyPathTokenizer.Tokenize(input).ToArray(); CompareResults(result, "(", "typeName", ".", "propertyName", ")", ".", "(", "otherType", ".", "otherProperty", ")", ".", "property"); }
public void SimpleTest() { string input = "Test"; string[] result = PropertyPathTokenizer.Tokenize(input).ToArray(); CompareResults(result, "Test"); }
public void WhitespaceTest() { string input = " propertyName / propertyNameX [ 1 , 2 ] .property"; string[] result = PropertyPathTokenizer.Tokenize(input).ToArray(); CompareResults(result, "propertyName", "/", "propertyNameX", "[", "1", ",", "2", "]", ".", "property"); }
public void PropertySourceTraversalTest() { string input = "propertyName/propertyNameX"; string[] result = PropertyPathTokenizer.Tokenize(input).ToArray(); CompareResults(result, "propertyName", "/", "propertyNameX"); }
public void PropertyIndexAtStartTest() { string input = "[1]."; string[] result = PropertyPathTokenizer.Tokenize(input).ToArray(); CompareResults(result, "[", "1", "]", "."); }
public void Tokenize_Null_ThrowsArgumentNullException() { var tokenizer = new PropertyPathTokenizer(); Assert.Throws <ArgumentNullException>(() => { // ReSharper disable once ReturnValueOfPureMethodIsNotUsed tokenizer.Tokenize(null).ToList(); }); }
public void Tokenize_IllegalCharacters_ThrowsFormatException(string input) { var tokenizer = new PropertyPathTokenizer(); Assert.Throws <FormatException>(() => { // ReSharper disable once ReturnValueOfPureMethodIsNotUsed tokenizer.Tokenize(input).ToList(); // Using ToList to force tokenization of the entire string }); }