コード例 #1
0
        public void IsAscii_returns_true_for_mixed_case_ascii_string()
        {
            // arrange
            var input = "TaYeRtGeYReerfGHdTReFF";
            var regex = new Blobby.Utils.Regex();

            // act
            var isAscii = regex.IsAscii(input);

            // assert
            Assert.True(isAscii);
        }
コード例 #2
0
        public void IsAscii_returns_true_for_uppercase_ascii_string()
        {
            // arrange
            var input = "TYRGYRGHTRFF";
            var regex = new Blobby.Utils.Regex();

            // act
            var isAscii = regex.IsAscii(input);

            // assert
            Assert.True(isAscii);
        }
コード例 #3
0
        public void GetMatches_returns_empty_list_for_null_input()
        {
            // arrange
            string input = null;
            var regex = new Regex();

            // act
            var matches = regex.GetMatches(input, "some pattern");

            // assert
            Assert.That(matches.Count, Is.EqualTo(0));
        }
コード例 #4
0
        public void IsAscii_returns_false_for_string_with_numbers_and_letters()
        {
            // arrange
            var input = "123456 and some letters";
            var regex = new Blobby.Utils.Regex();

            // act
            var isAscii = regex.IsAscii(input);

            // assert
            Assert.False(isAscii);
        }
コード例 #5
0
        public void IsAscii_returns_false_for_null_string()
        {
            // arrange
            string input = null;
            var    regex = new Blobby.Utils.Regex();

            // act
            var isAscii = regex.IsAscii(input);

            // assert
            Assert.False(isAscii);
        }
コード例 #6
0
        public void IsAscii_returns_false_for_whitespace_string()
        {
            // arrange
            var input = "       ";
            var regex = new Blobby.Utils.Regex();

            // act
            var isAscii = regex.IsAscii(input);

            // assert
            Assert.False(isAscii);
        }
コード例 #7
0
        public void IsMatch_returns_false_when_nonnumeric_input_is_checked_for_numbers()
        {
            // arrange
            var input   = "some alpha string without numbers";
            var pattern = @"\d";
            var regex   = new Blobby.Utils.Regex();

            // act
            var isMatch = regex.IsMatch(input, pattern);

            // assert
            Assert.False(isMatch);
        }
コード例 #8
0
        public void GetMatches_returns_empty_list_for_no_match()
        {
            // arrange
            var input = "abcdefg";
            var pattern = "zzz";
            var regex = new Regex();

            // act
            var matches = regex.GetMatches(input, pattern);

            // assert
            Assert.That(matches.Count, Is.EqualTo(0));
        }
コード例 #9
0
        public void IsMatch_returns_true_for_numeric_input()
        {
            // arrange
            var input   = "123456";
            var pattern = @"\d";
            var regex   = new Blobby.Utils.Regex();

            // act
            var isMatch = regex.IsMatch(input, pattern);

            // assert
            Assert.True(isMatch);
        }
コード例 #10
0
        public void GenerateRandomAlpha_returns_string_with_only_ascii_characters()
        {
            // arrange
            var utils = new StringUtils();

            // act
            var actual = utils.GenerateRandomAlpha(8);

            // assert
            var regex = new Blobby.Utils.Regex();
            var isAscii = regex.IsAscii(actual);
            Assert.True(isAscii);
        }
コード例 #11
0
        public void GetMatches_returns_correct_list_for_two_matches()
        {
            // arrange
            var input = "abcdefg zzz asdfds zzz werewr";
            var pattern = "zzz";
            var regex = new Regex();

            // act
            var matches = regex.GetMatches(input, pattern);

            // assert
            Assert.That(matches.Count, Is.EqualTo(2));
            Assert.That(matches.First(), Is.EqualTo("zzz"));
        }
コード例 #12
0
        public void GenerateRandomAlpha_returns_string_with_only_ascii_characters()
        {
            // arrange
            var utils = new StringUtils();

            // act
            var actual = utils.GenerateRandomAlpha(8);

            // assert
            var regex   = new Blobby.Utils.Regex();
            var isAscii = regex.IsAscii(actual);

            Assert.True(isAscii);
        }
コード例 #13
0
        public void IsAscii_returns_false_for_string_with_only_numbers()
        {
            // arrange
            var input = "123456";
            var regex = new Blobby.Utils.Regex();

            // act
            var isAscii = regex.IsAscii(input);

            // assert
            Assert.False(isAscii);
        }
コード例 #14
0
        public void IsAscii_returns_true_for_uppercase_ascii_string()
        {
            // arrange
            var input = "TYRGYRGHTRFF";
            var regex = new Blobby.Utils.Regex();

            // act
            var isAscii = regex.IsAscii(input);

            // assert
            Assert.True(isAscii);
        }
コード例 #15
0
        public void IsMatch_returns_false_when_nonnumeric_input_is_checked_for_numbers()
        {
            // arrange
            var input = "some alpha string without numbers";
            var pattern = @"\d";
            var regex = new Blobby.Utils.Regex();

            // act
            var isMatch = regex.IsMatch(input, pattern);

            // assert
            Assert.False(isMatch);
        }
コード例 #16
0
        public void IsMatch_returns_true_for_numeric_input()
        {
            // arrange
            var input = "123456";
            var pattern = @"\d";
            var regex = new Blobby.Utils.Regex();

            // act
            var isMatch = regex.IsMatch(input, pattern);

            // assert
            Assert.True(isMatch);
        }
コード例 #17
0
        public void IsAscii_returns_false_for_empty_string()
        {
            // arrange
            var input = "";
            var regex = new Blobby.Utils.Regex();

            // act
            var isAscii = regex.IsAscii(input);

            // assert
            Assert.False(isAscii);
        }
コード例 #18
0
        public void IsAscii_returns_true_for_mixed_case_ascii_string()
        {
            // arrange
            var input = "TaYeRtGeYReerfGHdTReFF";
            var regex = new Blobby.Utils.Regex();

            // act
            var isAscii = regex.IsAscii(input);

            // assert
            Assert.True(isAscii);
        }