예제 #1
0
        public void Slug_has_no_leading_or_trailing_whitespace()
        {
            string input    = "       Foo Bar Baz      ";
            string expected = "foo-bar-baz";

            var    slugMaker = new SlugMaker();
            string slug      = slugMaker.CreateSlug(input);

            Assert.AreEqual(expected, slug);
        }
예제 #2
0
        public void Spaces_are_converted_to_dashes()
        {
            string input    = "foo bar baz";
            string expected = "foo-bar-baz";

            var    slugMaker = new SlugMaker();
            string slug      = slugMaker.CreateSlug(input);

            Assert.AreEqual(expected, slug);
        }
예제 #3
0
        public void Only_alphanumeric_characters_exist_in_generated_slug()
        {
            string input    = "Foo BaR BAZ%^@ () ";
            string expected = "foo-bar-baz";

            var    slugMaker = new SlugMaker();
            string slug      = slugMaker.CreateSlug(input);

            Assert.AreEqual(expected, slug);
        }
예제 #4
0
        public void Multiple_whitespace_do_not_result_in_double_dashes()
        {
            string input    = "foo  bar       baz";
            string expected = "foo-bar-baz";

            var    slugMaker = new SlugMaker();
            string slug      = slugMaker.CreateSlug(input);

            Assert.AreEqual(expected, slug);
        }
예제 #5
0
        public void Spaces_are_converted_to_dashes()
        {
            string input = "foo bar baz";
            string expected = "foo-bar-baz";

            var slugMaker = new SlugMaker();
            string slug = slugMaker.CreateSlug(input);

            Assert.Equal(expected, slug);
        }
예제 #6
0
        public void Slug_generated_is_all_lowercase()
        {
            string input    = "Foo BaR BAZ";
            string expected = "foo-bar-baz";

            var    slugMaker = new SlugMaker();
            string slug      = slugMaker.CreateSlug(input);

            Assert.AreEqual(expected, slug);
        }
예제 #7
0
        public void Slug_has_no_leading_or_trailing_whitespace()
        {
            string input = "       Foo Bar Baz      ";
            string expected = "foo-bar-baz";

            var slugMaker = new SlugMaker();
            string slug = slugMaker.CreateSlug(input);

            Assert.Equal(expected, slug);
        }
예제 #8
0
        public void Slug_generated_is_all_lowercase()
        {
            string input = "Foo BaR BAZ";
            string expected = "foo-bar-baz";

            var slugMaker = new SlugMaker();
            string slug = slugMaker.CreateSlug(input);

            Assert.Equal(expected, slug);
        }
예제 #9
0
        public void Only_alphanumeric_characters_exist_in_generated_slug()
        {
            string input = "Foo BaR BAZ%^@ () ";
            string expected = "foo-bar-baz";

            var slugMaker = new SlugMaker();
            string slug = slugMaker.CreateSlug(input);

            Assert.Equal(expected, slug);
        }
예제 #10
0
        public void Multiple_whitespace_do_not_result_in_double_dashes()
        {
            string input = "foo  bar       baz";
            string expected = "foo-bar-baz";

            var slugMaker = new SlugMaker();
            string slug = slugMaker.CreateSlug(input);

            Assert.Equal(expected, slug);
        }
예제 #11
0
        public void Slug_generated_does_not_exceed_max_length()
        {
            int maxLength = 50;

            string input = string.Join("", Enumerable.Range(0, 51).Select(n => "a"));

            var    slugMaker = new SlugMaker(maxLength);
            string slug      = slugMaker.CreateSlug(input);

            Assert.AreEqual(maxLength, slug.Length);
        }
예제 #12
0
        public void Slug_generated_does_not_exceed_max_length()
        {
            int maxLength = 50;

            string input = string.Join("", Enumerable.Range(0, 51).Select(n => "a"));

            var slugMaker = new SlugMaker(maxLength);
            string slug = slugMaker.CreateSlug(input);

            Assert.Equal(maxLength, slug.Length);
        }