Ejemplo n.º 1
0
        public void TextObjectEvaluatorTest()
        {
            const string source     = "{\"ResponseCode\":\"0\", \"ResponseText\":\"3349\"}";
            var          textObject = new TextObject(source);

            Assert.AreEqual("3349", textObject.Evaluate("\"ResponseText\":\"(\\d+)\""));
            Assert.AreEqual(null, textObject.Evaluate("NonExistingElement"));
            Assert.AreEqual("Text", textObject.Evaluate("(?:(?:\"Response([a-zA-Z]*)\":).*?){2}"));
        }
Ejemplo n.º 2
0
        public void TextObjectTrimTest()
        {
            const string source  = "text:   aa   ";
            const string locator = "text:(.*)";
            var          noTrim  = new TextObject(source);

            Assert.AreEqual("   aa   ", noTrim.GetProperty(locator));
            Assert.AreEqual("   aa   ", noTrim.Evaluate(locator));
            var trim = new TextObject(source, true);

            Assert.AreEqual("aa", trim.GetProperty(locator));
            Assert.AreEqual("aa", trim.Evaluate(locator));
        }