public void EscapedQuotedStringTest(char escapedChar) { var escapedString = _escapeChars[escapedChar]; var txt = string.Format(@"'start{0}end'", escapedString); // ' is the quote character; using (var scan = new ParameterScanner(txt)) Assert.AreEqual(string.Format("start{0}end", escapedChar), scan.ScanQuotedString()); }
public void UndefinedEscapedQuotedStringTest(char escapedChar) { var escapedString = _undefinedEscapeChars[escapedChar]; var txt = @"'start" + escapedString + "end'"; // ' is the quote character; using (var scan = new ParameterScanner(txt)) { Assert.AreEqual(string.Format("start\\{0}end", escapedString.Substring(1)), scan.ScanQuotedString()); } }
public void GenParameterScannerTest() { const string txt = "Property=Title[Title='Property Title',DataType=String,Read,Write,PrivateVar,Visibility=3]\r\n"; GenDataDef.CreateMinimal(); using (var scan = new ParameterScanner(txt)) { scan.ScanObject(); Assert.IsFalse(scan.AtEnd); Assert.AreEqual("Property", scan.RecordType, "Property record type expected"); Assert.AreEqual("Title", scan.Attribute("Name"), "Name attribute by default"); Assert.AreEqual("Property Title", scan.Attribute("Title"), "Quoted attribute value"); Assert.AreEqual("True", scan.Attribute("Read"), "Boolean attribute"); Assert.AreEqual("", scan.Attribute("Missing"), "Missing attribute blank by default"); scan.ScanObject(); Assert.IsTrue(scan.Eof); } }