Пример #1
0
        public void TextObjectGetPropertiesTest()
        {
            const string source     = "MyTest\r\nYourTest\r\nHisTest\r\n";
            var          textObject = new TextObject(source);
            var          props      = textObject.GetProperties("([a-z|A-Z]*?)Test").ToList();

            Assert.AreEqual(3, props.Count);
            Assert.AreEqual("My", textObject.GetProperty(props[0]));
            Assert.AreEqual("Your", textObject.GetProperty(props[1]));
            // SerializeProperty is the same as GetProperty for text objects
            Assert.AreEqual("His", textObject.SerializeProperty(props[2]));
        }
Пример #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));
        }