public void ElementType()
        {
            var parser = new SimpleSelectorParser();

            parser.SetContext("div");
            var not = parser.DoParse();

            Assert.IsTrue(parser.End);
            Assert.AreEqual(0, parser.Errors.Count);
            Assert.IsTrue(not != null && not.IsValid, "invalid selector");
            Assert.AreEqual("div", not.ToString());
            Assert.AreEqual(SimpleSelector.Type.ElementType, not.SelectorType);
        }
        public void Simple()
        {
            var parser = new SimpleSelectorParser();

            parser.SetContext(".my-class");
            var cl = parser.DoParse();

            Assert.IsTrue(parser.End);
            Assert.AreEqual(0, parser.Errors.Count);
            Assert.IsTrue(cl != null && cl.IsValid, "invalid selector");
            Assert.AreEqual("my-class", cl.Name);
            Assert.AreEqual(SimpleSelector.Type.Class, cl.SelectorType);
        }
        public void Lang()
        {
            var parser = new SimpleSelectorParser();

            parser.SetContext(":lang(en)");
            var not = parser.DoParse();

            Assert.IsTrue(parser.End);
            Assert.AreEqual(0, parser.Errors.Count);
            Assert.IsTrue(not != null && not.IsValid, "invalid selector");
            Assert.AreEqual(":lang(en)", not.ToString());
            Assert.IsTrue(not.HasArgument);
            Assert.AreEqual("en", not.Argument.ToString());
            Assert.IsNull(not.SelectorArgument);
        }
        public void Not()
        {
            var parser = new SimpleSelectorParser();

            parser.SetContext(":not(.notclass)");
            var not = parser.DoParse();

            Assert.IsTrue(parser.End);
            Assert.AreEqual(0, parser.Errors.Count);
            Assert.IsTrue(not != null && not.IsValid, "invalid selector");
            Assert.AreEqual(":not(.notclass)", not.ToString());
            Assert.IsTrue(not.HasArgument);
            Assert.IsInstanceOfType(not.SelectorArgument, typeof(SimpleSelector));
            Assert.IsNull(not.Argument);
        }
        public void NthChild()
        {
            var parser = new SimpleSelectorParser();

            parser.SetContext(":nth-of-type(1n)");
            var not = parser.DoParse();

            Assert.IsTrue(parser.End);
            Assert.AreEqual(0, parser.Errors.Count);
            Assert.IsTrue(not != null && not.IsValid, "invalid selector");

            parser.SetContext(":nth-of-type(3n+0)");
            not = parser.DoParse();
            Assert.IsTrue(parser.End);
            Assert.AreEqual(0, parser.Errors.Count);
            Assert.IsTrue(not != null && not.IsValid, "invalid selector");
        }