예제 #1
0
        public void NormalizeSlug_ShouldWorkProperly()
        {
            // Arrange
            var name     = "My awesome name";
            var expected = "my-awesome-name";

            // Act
            var actual = SlugNormalizer.Normalize(name);

            // Assert
            actual.ShouldBe(expected);
        }
예제 #2
0
        public void NormalizeSlug_ShouldWorkProperly_WithTurkishChars()
        {
            // Arrange
            var name     = "Özel Türkçe karakterler: ğüşiöç";
            var expected = "ozel-turkce-karakterler-gusioc";

            // Act
            var actual = SlugNormalizer.Normalize(name);

            // Assert
            actual.ShouldBe(expected);
        }
예제 #3
0
        public void NormalizeSlug_ShouldWorkProperly_WithDoubleDash()
        {
            // Arrange
            var name     = "Go and Code --part 2";
            var expected = "go-and-code-part-2";

            // Act
            var actual = SlugNormalizer.Normalize(name);

            // Assert
            actual.ShouldBe(expected);
        }
예제 #4
0
        public void NormalizeSlug_ShouldWorkProperly_WithCyrillicChars()
        {
            // Arrange
            var name     = "Мое классное название";
            var expected = "moe-klassnoe-nazvanie";

            // Act
            var actual = SlugNormalizer.Normalize(name);

            // Assert
            actual.ShouldBe(expected);
        }
예제 #5
0
        public void NormalizeSlug_ShouldWorkProperly_WithQuestionMark()
        {
            // Arrange
            var name     = "Are you gonna die?";
            var expected = "are-you-gonna-die";

            // Act
            var actual = SlugNormalizer.Normalize(name);

            // Assert
            actual.ShouldBe(expected);
        }
예제 #6
0
        public void NormalizeSlug_ShouldWorkProperly_WithAmpersand()
        {
            // Arrange
            var name     = "We & Machines Challenge";
            var expected = "we-machines-challenge";

            // Act
            var actual = SlugNormalizer.Normalize(name);

            // Assert
            actual.ShouldBe(expected);
        }
예제 #7
0
        public void NormalizeSlug_ShouldWorkProperly_WithDot()
        {
            // Arrange
            var name     = "My Perfect Title v.2";
            var expected = "my-perfect-title-v.2";

            // Act
            var actual = SlugNormalizer.Normalize(name);

            // Assert
            actual.ShouldBe(expected);
        }
예제 #8
0
        public void NormalizeSlug_ShouldWorkProperly_WithEmoji()
        {
            // Arrange
            var name     = "Let's Rock 👊";
            var expected = "lets-rock";

            // Act
            var actual = SlugNormalizer.Normalize(name);

            // Assert
            actual.ShouldBe(expected);
        }
예제 #9
0
        public void NormalizeSlug_ShouldWorkProperly_WithChineseChars()
        {
            // Arrange
            var name     = "我的真棒头衔";
            var expected = "wo-de-zhen-bang-tou-xian";

            // Act
            var actual = SlugNormalizer.Normalize(name);

            // Assert
            actual.ShouldBe(expected);
        }
예제 #10
0
    internal void SetSlug(string slug)
    {
        Check.NotNullOrWhiteSpace(slug, nameof(slug), BlogPostConsts.MaxSlugLength, BlogPostConsts.MinSlugLength);

        Slug = SlugNormalizer.Normalize(slug);
    }
예제 #11
0
    public virtual void SetSlug(string slug)
    {
        Check.NotNullOrWhiteSpace(slug, nameof(slug), BlogConsts.MaxNameLength);

        Slug = SlugNormalizer.Normalize(slug);
    }
예제 #12
0
파일: Page.cs 프로젝트: netcore-jroger/abp
 internal virtual void SetSlug(string slug)
 {
     Slug = SlugNormalizer.Normalize(
         Check.NotNullOrEmpty(slug, nameof(slug), PageConsts.MaxSlugLength)
         );
 }