public void QuotedTermNotSplit()
        {
            var term      = "\"Example search term\"";
            var tokeniser = new KeywordsTokeniser();

            var result = tokeniser.Tokenise(term);

            Assert.AreEqual(1, result.Count);
            Assert.AreEqual(term, result[0]);
        }
        public void ForwardSlashIsAllowed()
        {
            // orbis/TP/12/345 is a typical TribePad job reference
            var term      = "orbis/TP/12/345";
            var tokeniser = new KeywordsTokeniser();

            var result = tokeniser.Tokenise(term);

            Assert.AreEqual(term, result[0]);
        }
        public void TwoQuotedTermsWithTrailingSpace()
        {
            var term      = "\"spring term\" \"summer term\" ";
            var tokeniser = new KeywordsTokeniser();

            var result = tokeniser.Tokenise(term);

            Assert.AreEqual(2, result.Count);
            Assert.AreEqual("\"spring term\"", result[0]);
            Assert.AreEqual("\"summer term\"", result[1]);
        }
        public void OrdinarySearchTermSplitOnSpace()
        {
            var term      = "Example search term";
            var tokeniser = new KeywordsTokeniser();

            var result = tokeniser.Tokenise(term);

            Assert.AreEqual(3, result.Count);
            Assert.AreEqual("Example", result[0]);
            Assert.AreEqual("search", result[1]);
            Assert.AreEqual("term", result[2]);
        }
        public void InvalidCharacterRemoved()
        {
            // [ ] has a meaning in Examine syntax, so ] on its own causes a syntax error if it's not removedr
            var term      = "Example search term]";
            var tokeniser = new KeywordsTokeniser();

            var result = tokeniser.Tokenise(term);

            Assert.AreEqual(3, result.Count);
            Assert.AreEqual("Example", result[0]);
            Assert.AreEqual("search", result[1]);
            Assert.AreEqual("term", result[2]);
        }
        public void QuotedTermWithinUnquotedTermsNotSplit()
        {
            var term      = "Example term \"to test\" search tokeniser";
            var tokeniser = new KeywordsTokeniser();

            var result = tokeniser.Tokenise(term);

            Assert.AreEqual(5, result.Count);
            Assert.AreEqual("Example", result[0]);
            Assert.AreEqual("term", result[1]);
            Assert.AreEqual("\"to test\"", result[2]);
            Assert.AreEqual("search", result[3]);
            Assert.AreEqual("tokeniser", result[4]);
        }