/
githubmirror
/
aspnetcore
Обзор
Документация
Войти
/
githubmirror
/
aspnetcore
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/Middleware/RateLimiting/test/TestEndpointBuilder.cs
40 строк
1 KB
Ilya Klimenko
Improved rate limiting tests (#45541)
13 дек 2022, 00:54
Не верифицирован
13 дек 2022, 00:54
88ba76b
Код
Авторство
О чём код?
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Http; namespace Microsoft.AspNetCore.RateLimiting; internal class TestEndpointBuilder : EndpointBuilder { public override Endpoint Build() { return new Endpoint(RequestDelegate, new EndpointMetadataCollection(Metadata), DisplayName); } } internal class TestEndpointConventionBuilder : IEndpointConventionBuilder { public IList<Action<EndpointBuilder>> Conventions { get; } = new List<Action<EndpointBuilder>>(); public void Add(Action<EndpointBuilder> convention) { Conventions.Add(convention); } public TestEndpointConventionBuilder ApplyToEndpoint(EndpointBuilder endpoint) { foreach (var convention in Conventions) { convention(endpoint); } return this; } }