示例#1
0
        public void Should_not_touch_already_normalized_urls(string url, string expected)
        {
            var settings = new UrlNormalizerSettings
            {
                PerServiceSettings = new Dictionary <string, UrlNormalizerServiceSettings>
                {
                    ["cut"] = new UrlNormalizerServiceSettings
                    {
                        FilteredPrefixes = new[] { "track/~/~/open", "track/" }
                    }
                }
            };

            new UrlNormalizer(() => settings)
            .NormalizePath("cut", new Uri(url, UriKind.Absolute))
            .Should()
            .Be(expected);
        }
示例#2
0
        public void Should_cut_suffixes_for_service(string service, string url, string expected)
        {
            var settings = new UrlNormalizerSettings
            {
                PerServiceSettings = new Dictionary <string, UrlNormalizerServiceSettings>
                {
                    ["cut"] = new UrlNormalizerServiceSettings
                    {
                        FilteredPrefixes = new[] { "foo/~/bar/", "foo", "slash/" }
                    },
                    ["cut_all"] = new UrlNormalizerServiceSettings
                    {
                        FilteredPrefixes = new[] { "" }
                    }
                }
            };

            new UrlNormalizer(() => settings)
            .NormalizePath(service, new Uri(url, UriKind.Absolute))
            .Should()
            .Be(expected);
        }