Пример #1
0
        public void ShouldBeInvalidWhenSearchingIrregularRegEx()
        {
            var searchRequest = new SearchRequest("[inf", true);

            var result = searchRequest.BuildMessage();

            result.IsValid.Should().BeFalse();
            result.Message.Should().Be("Invalid regular expression");
        }
Пример #2
0
        public void ShouldBeInvalidWhenPlainTextContainsIllegalCharacter()
        {
            var searchRequest = new SearchRequest(@"[i\nf", false);

            var result = searchRequest.BuildMessage();

            result.IsValid.Should().BeFalse();
            result.Message.Should().Be("Text contains illegal characters");
        }
Пример #3
0
        public void ShouldBeValidWhenSearchingPlainTextExclusion()
        {
            var searchRequest = new SearchRequest("-[inf", false);

            var result = searchRequest.BuildMessage();

            result.IsValid.Should().BeTrue();
            result.Message.Should().Be("Hit enter to search using plain text");
        }
Пример #4
0
        public void ShouldBeInvalidWhenPlainTextExclusionTextIsTooShort()
        {
            var searchRequest = new SearchRequest("-f", false);

            var result = searchRequest.BuildMessage();

            result.IsValid.Should().BeFalse();
            result.Message.Should().Be("Text must be at least 3 characters");
        }
Пример #5
0
        public void ShouldBeInvalidWhenSearchingTooShortRegEx()
        {
            var searchRequest = new SearchRequest(".", true);

            var result = searchRequest.BuildMessage();

            result.IsValid.Should().BeFalse();
            result.Message.Should().Be("Regex must be at least 2 characters");
        }
Пример #6
0
        public void ShouldBeValidWhenSearchingAValidRegex()
        {
            var searchRequest = new SearchRequest("[inf]", true);

            var result = searchRequest.BuildMessage();

            result.IsValid.Should().BeTrue();
            result.Message.Should().Be("Hit enter to search using regex");
        }
Пример #7
0
        public void ShouldAskForTextWhenRegexIsEmpty()
        {
            var searchRequest = new SearchRequest("", true);

            var result = searchRequest.BuildMessage();

            result.IsValid.Should().BeTrue();
            result.Message.Should().Be("Type to search using regex");
        }
Пример #8
0
        public void ShouldBeInvalidWhenPlainTextContainsOnlyWhiteSpaces()
        {
            var searchRequest = new SearchRequest("-    \t", false);

            var result = searchRequest.BuildMessage();

            result.IsValid.Should().BeFalse();
            result.Message.Should().Be("Text contains illegal characters");
        }
Пример #9
0
        public void ShouldAskForTextWhenTextIsEmpty()
        {
            var searchRequest = new SearchRequest("", false);

            var result = searchRequest.BuildMessage();

            result.IsValid.Should().BeTrue();
            result.Message.Should().Be("Type to search using plain text");
        }