コード例 #1
0
        private static List <NonIdempotencySign> PreprocessSigns(NonIdempotencySignsSettings nonIdempotencySignsSettings)
        {
            var signs          = nonIdempotencySignsSettings.Signs;
            var processedSigns = new List <NonIdempotencySign>(signs.Count);

            processedSigns.AddRange(
                signs.Select(
                    sign => new NonIdempotencySign(
                        sign.Method,
                        sign.PathPattern
                        )
                    ));

            return(processedSigns);
        }
コード例 #2
0
        public void Should_trim_start_slash()
        {
            var settings = new NonIdempotencySignsSettings()
            {
                Signs = new List <NonIdempotencySignSettings>
                {
                    new NonIdempotencySignSettings()
                    {
                        Method      = "Post",
                        PathPattern = "/test"
                    }
                }
            };

            singsProvider.Get().Returns(settings);

            var cached = cache.Get();

            cached.Count.Should().Be(1);

            cached[0].PathPattern.IsMatch("/test").Should().Be(false);

            cached[0].PathPattern.IsMatch("test").Should().Be(true);
        }