コード例 #1
0
        public void TestCtor()
        {
            Should.Throw <ArgumentNullException> (() => new StringMatchOperation(null), "a1");
            Should.Throw <ArgumentException> (() => new StringMatchOperation(String.Empty), "a2");

            var op = new StringMatchOperation("foo");

            Assert.AreEqual("foo", op.String, "a3");
        }
コード例 #2
0
        public void MatchNotAtStartShouldFail()
        {
            var op   = new StringMatchOperation("oobar");
            var data = new DataDictionary();
            int end;

            bool m = op.IsMatch("foobar", 0, out data, out end);

            Assert.IsFalse(m, "a1");
            Assert.IsNull(data, "a2");
            Assert.AreEqual(0, end, "a3");
        }
コード例 #3
0
        public void MatchFullStringTest()
        {
            var op   = new StringMatchOperation("foobar");
            var data = new DataDictionary();
            int end;

            bool m = op.IsMatch("foobar", 0, out data, out end);

            Assert.IsTrue(m, "a1");
            Assert.IsNull(data, "a2");
            Assert.AreEqual(6, end, "a3");
        }
コード例 #4
0
        public void TestStringProperty()
        {
            var op = new StringMatchOperation("foo");

            Assert.AreEqual("foo", op.String, "a1");

            Should.Throw <ArgumentNullException> (() => op.String = null, "a2");
            Should.Throw <ArgumentException> (() => op.String     = String.Empty, "a3");

            op.String = "baz";
            Assert.AreEqual("baz", op.String);
        }
コード例 #5
0
        public void MatchNotAtStartShouldFail()
        {
            var op = new StringMatchOperation("oobar");
            var data = new DataDictionary();
            int end;

            bool m = op.IsMatch("foobar", 0, out data, out end);

            Assert.IsFalse(m, "a1");
            Assert.IsNull(data, "a2");
            Assert.AreEqual(0, end, "a3");
        }
コード例 #6
0
        public void MatchFullStringTest()
        {
            var op = new StringMatchOperation("foobar");
            var data = new DataDictionary();
            int end;

            bool m = op.IsMatch("foobar", 0, out data, out end);

            Assert.IsTrue(m, "a1");
            Assert.IsNull(data, "a2");
            Assert.AreEqual(6, end, "a3");
        }
コード例 #7
0
        public void TestCtor()
        {
            Should.Throw<ArgumentNullException>(() => new StringMatchOperation(null), "a1");
            Should.Throw<ArgumentException>(() => new StringMatchOperation(String.Empty), "a2");

            var op = new StringMatchOperation("foo");
            Assert.AreEqual("foo", op.String, "a3");
        }
コード例 #8
0
        public void TestStringProperty()
        {
            var op = new StringMatchOperation("foo");
            Assert.AreEqual("foo", op.String, "a1");

            Should.Throw<ArgumentNullException>(() => op.String = null, "a2");
            Should.Throw<ArgumentException>(() => op.String = String.Empty, "a3");

            op.String = "baz";
            Assert.AreEqual("baz", op.String);
        }