예제 #1
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");
        }
예제 #2
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");
        }
예제 #3
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");
        }
예제 #4
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");
        }
예제 #5
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");
        }
예제 #6
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");
        }
예제 #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 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");
        }
예제 #9
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");
        }